mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-08-13 15:53:48 -04:00
Fix sprites a bit
This commit is contained in:
parent
72a666d3ad
commit
03638e62ec
@ -126,6 +126,9 @@
|
||||
|
||||
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
|
||||
|
||||
#define SFG_BASE_SPRITE_SIZE \
|
||||
((SFG_GAME_RESOLUTION_Y * 2) / 3)
|
||||
|
||||
#if SFG_MS_PER_FRAME == 0
|
||||
#define SFG_MS_PER_FRAME 1
|
||||
#endif
|
||||
|
2
levels.h
2
levels.h
@ -256,7 +256,7 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level0 =
|
||||
{SFG_LEVEL_ELEMENT_HEALTH, {12, 4}}, {SFG_LEVEL_ELEMENT_HEALTH, {15, 4}},
|
||||
{SFG_LEVEL_ELEMENT_BARREL, {24, 10}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_BARREL, {13, 4}}, {SFG_LEVEL_ELEMENT_BARREL, {12, 6}},
|
||||
{SFG_LEVEL_ELEMENT_MONSTER_ENDER, {23, 7}}, {SFG_LEVEL_ELEMENT_MONSTER_SPIDER, {16, 8}},
|
||||
{SFG_LEVEL_ELEMENT_MONSTER_ENDER, {23, 10}}, {SFG_LEVEL_ELEMENT_MONSTER_SPIDER, {16, 8}},
|
||||
{SFG_LEVEL_ELEMENT_MONSTER_DESTROYER, {16, 7}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_MONSTER_WARRIOR, {18, 31}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT, {19, 31}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
|
25
main.c
25
main.c
@ -482,9 +482,12 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
|
||||
uint8_t shadow = 0;
|
||||
|
||||
if (pixel->position.y == SFG_GAME_RESOLUTION_Y / 2)
|
||||
{
|
||||
uint8_t zValue = pixel->isWall ? SFG_RCLUnitToZBuffer(pixel->depth) : 255;
|
||||
|
||||
for (uint8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i)
|
||||
SFG_zBuffer[pixel->position.x * SFG_RAYCASTING_SUBSAMPLE + i] =
|
||||
SFG_RCLUnitToZBuffer(pixel->depth);
|
||||
SFG_zBuffer[pixel->position.x * SFG_RAYCASTING_SUBSAMPLE + i] = zValue;
|
||||
}
|
||||
|
||||
if (pixel->isHorizon && pixel->depth > RCL_UNITS_PER_SQUARE * 16)
|
||||
{
|
||||
@ -950,8 +953,8 @@ void SFG_setAndInitLevel(const SFG_Level *level)
|
||||
monster->stateType = e->type | 0;
|
||||
monster->health = SFG_GET_MONSTER_MAX_HEALTH(SFG_MONSTER_TYPE_TO_INDEX(e->type));
|
||||
|
||||
monster->coords[0] = e->coords[0] * 4;
|
||||
monster->coords[1] = e->coords[1] * 4;
|
||||
monster->coords[0] = e->coords[0] * 4 + 2;
|
||||
monster->coords[1] = e->coords[1] * 4 + 2;
|
||||
|
||||
SFG_currentLevel.monsterRecordCount++;
|
||||
}
|
||||
@ -994,7 +997,7 @@ void SFG_init()
|
||||
|
||||
SFG_backgroundScroll = 0;
|
||||
|
||||
SFG_setAndInitLevel(&SFG_level1);
|
||||
SFG_setAndInitLevel(&SFG_level0);
|
||||
|
||||
SFG_lastFrameTimeMs = SFG_getTimeMs();
|
||||
}
|
||||
@ -1259,6 +1262,7 @@ void SFG_createDust(RCL_Unit x, RCL_Unit y, RCL_Unit z)
|
||||
|
||||
void SFG_monsterPerformAI(SFG_MonsterRecord *monster)
|
||||
{
|
||||
return;
|
||||
uint8_t state = SFG_MR_STATE(*monster);
|
||||
uint8_t type = SFG_MR_TYPE(*monster);
|
||||
uint8_t monsterNumber = SFG_MONSTER_TYPE_TO_INDEX(type);
|
||||
@ -2522,7 +2526,7 @@ void SFG_draw()
|
||||
|
||||
SFG_drawScaledSprite(s,
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(SFG_GAME_RESOLUTION_Y,p.depth),
|
||||
RCL_perspectiveScale(SFG_BASE_SPRITE_SIZE,p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth);
|
||||
}
|
||||
}
|
||||
@ -2555,8 +2559,9 @@ void SFG_draw()
|
||||
{
|
||||
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);
|
||||
|
||||
RCL_perspectiveScale(SFG_BASE_SPRITE_SIZE,p.depth)/*40*/,
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth - 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2578,7 +2583,7 @@ void SFG_draw()
|
||||
|
||||
const uint8_t *s = SFG_effectSprites[proj->type];
|
||||
|
||||
int16_t spriteSize = SFG_GAME_RESOLUTION_Y / 3;
|
||||
int16_t spriteSize = SFG_BASE_SPRITE_SIZE / 2;
|
||||
|
||||
if (proj->type == SFG_PROJECTILE_EXPLOSION ||
|
||||
proj->type == SFG_PROJECTILE_DUST)
|
||||
@ -2589,7 +2594,7 @@ void SFG_draw()
|
||||
// grow the explosion sprite as an animation
|
||||
spriteSize =
|
||||
(
|
||||
SFG_GAME_RESOLUTION_Y *
|
||||
SFG_BASE_SPRITE_SIZE *
|
||||
RCL_sinInt(
|
||||
((doubleFramesToLive -
|
||||
proj->doubleFramesToLive) * RCL_UNITS_PER_SQUARE / 4)
|
||||
|
@ -1549,8 +1549,7 @@ static inline void _RCL_precomputeFloorDistances(RCL_Camera camera,
|
||||
RCL_Unit camHeightScreenSize =
|
||||
(camera.height * camera.resolution.y) / RCL_UNITS_PER_SQUARE;
|
||||
|
||||
for (uint16_t i = startIndex
|
||||
; i < camera.resolution.y; ++i)
|
||||
for (uint16_t i = startIndex; i < camera.resolution.y; ++i)
|
||||
dest[i] = RCL_perspectiveScaleInverse(camHeightScreenSize,
|
||||
RCL_absVal(i - _RCL_middleRow));
|
||||
}
|
||||
@ -1681,7 +1680,8 @@ RCL_PixelInfo RCL_mapToScreen(RCL_Vector2D worldPosition, RCL_Unit height,
|
||||
middleColumn + (-1 * toPoint.y * middleColumn) / RCL_nonZero(result.depth);
|
||||
|
||||
result.position.y = camera.resolution.y / 2 -
|
||||
(camera.resolution.y *
|
||||
(((3 * camera.resolution.y) / 4 ) *
|
||||
// ((camera.resolution.y / 2) *
|
||||
RCL_perspectiveScale(height - camera.height,result.depth))
|
||||
/ RCL_UNITS_PER_SQUARE + camera.shear;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user