mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-22 07:18:49 -05:00
Hit also ceiling
This commit is contained in:
parent
ec5703bcec
commit
8631f54db5
23
main.c
23
main.c
@ -1698,13 +1698,14 @@ void SFG_gameStep()
|
||||
|
||||
int8_t shearing = 0;
|
||||
|
||||
#if SFG_PREVIEW_MODE == 0
|
||||
if (
|
||||
SFG_keyIsDown(SFG_KEY_B) &&
|
||||
!SFG_keyIsDown(SFG_KEY_C) &&
|
||||
(SFG_gameFrame - SFG_player.weaponCooldownStartFrame >
|
||||
SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(SFG_player.weapon)))
|
||||
{
|
||||
// fire
|
||||
// attack
|
||||
|
||||
uint8_t projectile;
|
||||
|
||||
@ -1796,7 +1797,8 @@ void SFG_gameStep()
|
||||
}
|
||||
|
||||
SFG_player.weaponCooldownStartFrame = SFG_gameFrame;
|
||||
}
|
||||
} // attack
|
||||
#endif // SFG_PREVIEW_MODE == 0
|
||||
|
||||
if (SFG_keyIsDown(SFG_KEY_A))
|
||||
{
|
||||
@ -2119,12 +2121,18 @@ void SFG_gameStep()
|
||||
{
|
||||
// check collision with the map
|
||||
|
||||
if (SFG_floorHeightAt(pos[0] / RCL_UNITS_PER_SQUARE,pos[1] /
|
||||
if (
|
||||
(SFG_floorHeightAt(pos[0] / RCL_UNITS_PER_SQUARE,pos[1] /
|
||||
RCL_UNITS_PER_SQUARE) >= pos[2])
|
||||
||
|
||||
(SFG_ceilingHeightAt(pos[0] / RCL_UNITS_PER_SQUARE,pos[1] /
|
||||
RCL_UNITS_PER_SQUARE) <= pos[2])
|
||||
)
|
||||
eliminate = 1;
|
||||
|
||||
// check collision with active level elements
|
||||
|
||||
if (!eliminate) // monsters
|
||||
for (uint16_t j = 0; j < SFG_currentLevel.monsterRecordCount; ++j)
|
||||
{
|
||||
SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[j]);
|
||||
@ -2152,7 +2160,7 @@ void SFG_gameStep()
|
||||
}
|
||||
}
|
||||
|
||||
if (!eliminate)
|
||||
if (!eliminate) // items
|
||||
for (uint16_t j = 0; j < SFG_currentLevel.itemRecordCount; ++j)
|
||||
{
|
||||
const SFG_LevelElement *e = SFG_getActiveItemElement(j);
|
||||
@ -2360,7 +2368,9 @@ void SFG_gameStep()
|
||||
}
|
||||
else if (state != SFG_MONSTER_STATE_INACTIVE)
|
||||
{
|
||||
#if SFG_PREVIEW_MODE == 0
|
||||
SFG_monsterPerformAI(monster);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2775,7 +2785,8 @@ void SFG_draw()
|
||||
if (p.depth > 0)
|
||||
SFG_drawScaledSprite(s,
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(spriteSize,p.depth),0,p.depth);
|
||||
RCL_perspectiveScale(spriteSize,p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth);
|
||||
}
|
||||
|
||||
#if SFG_HEADBOB_ENABLED
|
||||
@ -2783,7 +2794,9 @@ void SFG_draw()
|
||||
SFG_player.camera.height -= headBobOffset;
|
||||
#endif
|
||||
|
||||
#if SFG_PREVIEW_MODE == 0
|
||||
SFG_drawWeapon(weaponBobOffset);
|
||||
#endif
|
||||
|
||||
// draw the HUD:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user