mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2025-02-17 15:40:19 -05:00
Fix explosion bug
This commit is contained in:
parent
dd6a22d9b2
commit
49e92f1b88
7
TODO.txt
7
TODO.txt
@ -127,10 +127,6 @@ level ideas:
|
|||||||
|
|
||||||
bugs:
|
bugs:
|
||||||
|
|
||||||
- Player can be thrown inside a wall (by an explosion it seems), seems to happen
|
|
||||||
near door. If this can't be prevented completely, automatically unstuck the
|
|
||||||
player into a playable area.
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
- add headbob
|
- add headbob
|
||||||
@ -205,6 +201,9 @@ done:
|
|||||||
- Add SW buttons to emscripten version so that it's playable on mobiles.
|
- Add SW buttons to emscripten version so that it's playable on mobiles.
|
||||||
- When SDL level starts without moving the mouse, the camera sometimes rotates
|
- When SDL level starts without moving the mouse, the camera sometimes rotates
|
||||||
wildly.
|
wildly.
|
||||||
|
- Player can be thrown inside a wall (by an explosion it seems), seems to happen
|
||||||
|
near door. If this can't be prevented completely, automatically unstuck the
|
||||||
|
player into a playable area.
|
||||||
|
|
||||||
scratched:
|
scratched:
|
||||||
- option for disabling wall transparency, for performance?
|
- option for disabling wall transparency, for performance?
|
||||||
|
17
constants.h
17
constants.h
@ -86,7 +86,7 @@
|
|||||||
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
|
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
|
||||||
square).
|
square).
|
||||||
*/
|
*/
|
||||||
#define SFG_ELEMENT_COLLISION_RADIUS 1900
|
#define SFG_ELEMENT_COLLISION_RADIUS 1800
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Height, in RCL_Units, at which collisions happen with level elements
|
Height, in RCL_Units, at which collisions happen with level elements
|
||||||
@ -95,15 +95,18 @@
|
|||||||
#define SFG_ELEMENT_COLLISION_HEIGHT 1024
|
#define SFG_ELEMENT_COLLISION_HEIGHT 1024
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Distance at which explosion does damage and throws away the player and
|
Distance at which explosion does damage and throws away the player, in
|
||||||
monsters, in RCL_Units.
|
RCL_Units. Should be higher than SFG_ELEMENT_COLLISION_RADIUS so that
|
||||||
|
exploded rockets also hurt the target.
|
||||||
*/
|
*/
|
||||||
#define SFG_EXPLOSION_RADIUS 2048
|
#define SFG_EXPLOSION_RADIUS 2000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Distance in RCL_Units which the player is pushed away by an explosion.
|
Distance in RCL_Units which the player is pushed away by an explosion. Watch
|
||||||
|
out, a slightly higher value can make player go through walls. Rather keep
|
||||||
|
this under RCL_UNITS_PER_SQUARE;
|
||||||
*/
|
*/
|
||||||
#define SFG_EXPLOSION_PUSH_AWAY_DISTANCE 1200
|
#define SFG_EXPLOSION_PUSH_AWAY_DISTANCE 1023
|
||||||
|
|
||||||
/**
|
/**
|
||||||
How much damage triggers a barrel explosion.
|
How much damage triggers a barrel explosion.
|
||||||
@ -552,7 +555,7 @@ SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] =
|
|||||||
lllll: eigth of frames to live
|
lllll: eigth of frames to live
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOW_FPS (SFG_FPS < 20) ///< low FPS needs low speeds, because collisions
|
#define LOW_FPS (SFG_FPS < 24) ///< low FPS needs low speeds, because collisions
|
||||||
|
|
||||||
SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] =
|
SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] =
|
||||||
{
|
{
|
||||||
|
9
game.h
9
game.h
@ -1797,8 +1797,6 @@ uint8_t SFG_pushAway(
|
|||||||
fromCenter = RCL_angleToDirection(preferredDirection);
|
fromCenter = RCL_angleToDirection(preferredDirection);
|
||||||
l = RCL_UNITS_PER_SQUARE;
|
l = RCL_UNITS_PER_SQUARE;
|
||||||
}
|
}
|
||||||
else if (l >= distance)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
RCL_Vector2D offset;
|
RCL_Vector2D offset;
|
||||||
|
|
||||||
@ -2014,8 +2012,13 @@ void SFG_createExplosion(RCL_Unit x, RCL_Unit y, RCL_Unit z)
|
|||||||
|
|
||||||
uint8_t damage = SFG_getDamageValue(SFG_WEAPON_FIRE_TYPE_FIREBALL);
|
uint8_t damage = SFG_getDamageValue(SFG_WEAPON_FIRE_TYPE_FIREBALL);
|
||||||
|
|
||||||
if (SFG_pushPlayerAway(x,y,SFG_EXPLOSION_PUSH_AWAY_DISTANCE))
|
if (SFG_taxicabDistance(x,y,z,SFG_player.camera.position.x,
|
||||||
|
SFG_player.camera.position.y,SFG_player.camera.height)
|
||||||
|
<= SFG_EXPLOSION_RADIUS)
|
||||||
|
{
|
||||||
SFG_playerChangeHealth(-1 * damage);
|
SFG_playerChangeHealth(-1 * damage);
|
||||||
|
SFG_pushPlayerAway(x,y,SFG_EXPLOSION_PUSH_AWAY_DISTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i)
|
for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i)
|
||||||
{
|
{
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #define SFG_START_LEVEL 1
|
// #define SFG_START_LEVEL 1
|
||||||
// #define SFG_IMMORTAL 1
|
#define SFG_IMMORTAL 1
|
||||||
// #define SFG_UNLOCK_DOOR 1
|
#define SFG_UNLOCK_DOOR 1
|
||||||
// #define SFG_REVEAL_MAP 1
|
// #define SFG_REVEAL_MAP 1
|
||||||
// #define SFG_INFINITE_AMMO 1
|
#define SFG_INFINITE_AMMO 1
|
||||||
|
|
||||||
// uncomment for perfomance debug
|
// uncomment for perfomance debug
|
||||||
//#define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
|
//#define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
|
||||||
|
Loading…
Reference in New Issue
Block a user