Curation round 15: restart and mods, Brimstone and Tech X, room gaps, eight bosses, the Womb and Mom's Heart, the Forgotten and tainted starts, alt path enemies and exits
This commit is contained in:
1 parent
6e3da161fc
commit
78a2680134
128 files changed
+13196
-2933
No files matched your search
@@ -0,0 +1,103 @@
|
||||
#include "active_items.h"
|
||||
#include "entity_npc.h"
|
||||
#include "entity_player.h"
|
||||
#include "game.h"
|
||||
#include "grid_entity_door.h"
|
||||
#include "menu_manager.h"
|
||||
#include "room.h"
|
||||
#include "room_grid.h"
|
||||
|
||||
// A fall costs half a heart, and the player climbs out after 40 frames once it moves, or on its own after 120, safe
|
||||
// from harm for 120 frames.
|
||||
constexpr float PITFALL_DAMAGE = 1;
|
||||
constexpr int PITFALL_DAMAGE_COUNTDOWN = 30;
|
||||
constexpr int PITFALL_CLIMB_FRAMES = 40;
|
||||
constexpr int PITFALL_FORCED_CLIMB_FRAMES = 120;
|
||||
constexpr int PITFALL_LANDING_COOLDOWN = 120;
|
||||
constexpr std::array<ButtonAction, 4> PITFALL_MOVE_ACTIONS = {ACTION_LEFT, ACTION_RIGHT, ACTION_UP, ACTION_DOWN};
|
||||
|
||||
// 007abc20 Drops the player into a pit: it plays "FallIn" without control or collisions, unless Mega Mush keeps it out.
|
||||
// A fall ignoring that goes through to another room.
|
||||
void Entity_Player::AnimatePitfallIn(bool isIgnoreEffect)
|
||||
{
|
||||
if (!isIgnoreEffect && temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH)) return;
|
||||
|
||||
PlayExtraAnimation("FallIn");
|
||||
isControlsEnabled = false;
|
||||
entityCollisionClass = ENTCOLL_NONE;
|
||||
pitfallTimer = 0;
|
||||
pitfallState = isIgnoreEffect ? PITFALL_GONE : PITFALL_FALLING;
|
||||
}
|
||||
|
||||
// 007abc90 Plays the player's jump out of a pit.
|
||||
void Entity_Player::AnimatePitfallOut()
|
||||
{
|
||||
pitfallState = PITFALL_CLIMBING;
|
||||
PlayExtraAnimation("JumpOut");
|
||||
}
|
||||
|
||||
// The climb out of a pit: on the spot when it is free, else at a free spot near it, or near the door the room was
|
||||
// entered by when that spot is no better.
|
||||
// The original reads the slot before the doors when the room was entered by no door. Here no door is used.
|
||||
static void pitfall_climb(Entity_Player& player)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
if (room_grid_collision_at(player.pos) == 0) return player.AnimatePitfallOut();
|
||||
|
||||
Vector landing = room_free_pickup_position_find({.position = player.pos, .isAvoidActiveEntities = true});
|
||||
int door = g_game->enterDoor;
|
||||
if (room_grid_collision_at(landing) > 0 && door >= 0 && door < DOOR_SLOT_COUNT && room.doors[door])
|
||||
{
|
||||
Vector doorPos = room.doors[door]->Position();
|
||||
landing = room_free_pickup_position_find({.position = doorPos, .isAvoidActiveEntities = true});
|
||||
}
|
||||
player.Teleport(landing, false, false);
|
||||
player.AnimatePitfallOut();
|
||||
player.sprite.SetLastFrame();
|
||||
}
|
||||
|
||||
// 007b9b50 A player's fall into a pit: the fall hurts it once "FallIn" ends, it climbs out once it moves after 40
|
||||
// frames or after 120, and gets its control and collisions back once "JumpOut" ends. Its extra animation holds
|
||||
// meanwhile, and through a pixelated room transition.
|
||||
void Entity_Player::update_pitfall()
|
||||
{
|
||||
if (pitfallState == PITFALL_NONE) return;
|
||||
|
||||
RoomTransition& transition = g_game->roomTransition;
|
||||
if (transition.mode != TRANSITION_NONE)
|
||||
{
|
||||
if (pitfallState != PITFALL_CLIMBING && transition.animation == TRANSITION_PIXELATION)
|
||||
isPlayingExtraAnimation = true;
|
||||
return;
|
||||
}
|
||||
if (isDead) return;
|
||||
|
||||
const AnimationState& animation = sprite.animState;
|
||||
if (animation.animData && !animation.isPlaying && animation.animData->name == "FallIn" &&
|
||||
pitfallState == PITFALL_FALLING)
|
||||
{
|
||||
pitfallState = PITFALL_DOWN;
|
||||
TakeDamage(PITFALL_DAMAGE, DAMAGE_PITFALL, EntityRef(), PITFALL_DAMAGE_COUNTDOWN);
|
||||
}
|
||||
if (pitfallState == PITFALL_DOWN && ++pitfallTimer >= PITFALL_CLIMB_FRAMES)
|
||||
{
|
||||
bool isMoving = false;
|
||||
for (ButtonAction action : PITFALL_MOVE_ACTIONS)
|
||||
isMoving = input_is_action_pressed(action, controllerIndex, this) || isMoving;
|
||||
if (isMoving || pitfallTimer >= PITFALL_FORCED_CLIMB_FRAMES)
|
||||
{
|
||||
pitfall_climb(*this);
|
||||
damageCooldown = PITFALL_LANDING_COOLDOWN;
|
||||
}
|
||||
}
|
||||
if (pitfallState == PITFALL_CLIMBING && (!animation.animData || !animation.isPlaying))
|
||||
{
|
||||
isPlayingExtraAnimation = false;
|
||||
pitfallTimer = 0;
|
||||
pitfallState = PITFALL_NONE;
|
||||
isControlsEnabled = true;
|
||||
entityCollisionClass = ENTCOLL_ALL;
|
||||
return;
|
||||
}
|
||||
isPlayingExtraAnimation = true;
|
||||
}
|
||||
Reference in new issue
Block a user