Curation round 21: rock drops, Boss Rush and room setup, Dross, Ashpit and Gehenna enemies, Book of Virtues wisps and Dream Catcher, the last familiars and effects, player damage branches, a Corpse floor and Abyss crash fix, shared constants (186 duplicates)
This commit is contained in:
1 parent
8dbeb1bc4a
commit
6a11163842
184 files changed
+16980
-1419
No files matched your search
+16
-10
@@ -6,6 +6,7 @@
|
||||
#include "entity_npc.h"
|
||||
#include "entity_player.h"
|
||||
#include "entity_tear.h"
|
||||
#include "fx_layers.h"
|
||||
#include "game.h"
|
||||
#include "log.h"
|
||||
#include "lua_engine.h"
|
||||
@@ -26,14 +27,6 @@ extern "C"
|
||||
}
|
||||
#undef luaL_newstate
|
||||
|
||||
// The room's play area on screen: world units from its corner shrink by ROOM_SCREEN_SCALE into a centered view.
|
||||
constexpr float ROOM_ORIGIN_X = 60;
|
||||
constexpr float ROOM_ORIGIN_Y = 140;
|
||||
constexpr float ROOM_SCREEN_SCALE = 0.65f;
|
||||
constexpr float ROOM_VIEW_HEIGHT = 182;
|
||||
constexpr float ROOM_VIEW_WIDTH = 338;
|
||||
constexpr float HALF = 0.5f;
|
||||
|
||||
// GetRenderZ's bands: the background layer, the door layer and the normal layer sorted by depth.
|
||||
constexpr int RENDER_INDEX_MASK = 0x3ff;
|
||||
constexpr int RENDER_Z_BACKGROUND_BASE = 100;
|
||||
@@ -806,6 +799,20 @@ void Entity::Update()
|
||||
subtype);
|
||||
}
|
||||
|
||||
// A knockback that hurts on impact, hitting a wall: it bounces back along its motion at four fifths of its push and
|
||||
// takes 10 plus twice the floor's depth (one deeper on the alternate path) once.
|
||||
constexpr float WALL_IMPACT_BOUNCE = 0.8f;
|
||||
constexpr float WALL_IMPACT_DAMAGE = 10;
|
||||
constexpr int WALL_IMPACT_COUNTDOWN = 30;
|
||||
|
||||
void Entity::wall_impact_apply()
|
||||
{
|
||||
float push = vector_length(knockbackDirection);
|
||||
knockbackDirection = vector_scale(vector_normalized(velocity), push * WALL_IMPACT_BOUNCE);
|
||||
TakeDamage((float)(g_game->stage_depth_get() - 1) * 2 + WALL_IMPACT_DAMAGE, 0, EntityRef(), WALL_IMPACT_COUNTDOWN);
|
||||
ClearEntityFlags(FLAG_APPLY_IMPACT_DAMAGE);
|
||||
}
|
||||
|
||||
// A heavy knockback's push: it keeps the entity moving, slowing, until it is spent or something stops it.
|
||||
void Entity::knockback_update()
|
||||
{
|
||||
@@ -826,8 +833,7 @@ void Entity::knockback_update()
|
||||
}
|
||||
if (isCollidesWithGrid)
|
||||
{
|
||||
if (HasEntityFlags(FLAG_APPLY_IMPACT_DAMAGE))
|
||||
reconstruction_missing("Entity::Update 006ae820: the damage a knocked back entity takes hitting a wall");
|
||||
if (HasEntityFlags(FLAG_APPLY_IMPACT_DAMAGE)) wall_impact_apply();
|
||||
knockbackCountdown = knockbackCountdown / 2;
|
||||
}
|
||||
velocity = knockbackDirection;
|
||||
|
||||
Reference in new issue
Block a user