Curation round 14: console and Lua API, effects, lasers, enemies, eleven bosses, the Depths and Mom, status effects, the playable characters
This commit is contained in:
1 parent
8ae02a8422
commit
6e3da161fc
138 files changed
+16754
-6825
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#include "entity_effect.h"
|
||||
#include "entity_laser.h"
|
||||
#include "entity_player.h"
|
||||
#include "entity_tear.h"
|
||||
#include "game.h"
|
||||
@@ -10,6 +11,13 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
constexpr int TECH5_FLAG_CHANCE = 5;
|
||||
constexpr int TECH5_FLAG_ROLL = 100;
|
||||
constexpr int TECH5_FLAG_COUNT = 84;
|
||||
constexpr float HEAD_PIVOT_LIFT = -5;
|
||||
constexpr int PLAYER_HEAD_LAYER = 4;
|
||||
constexpr const char* NULL_OFFSET_NAMES[] = {"LeftEye", "RightEye", "Forehead", "Mouth", "Mouth", "MomsEye", "Tractor"};
|
||||
|
||||
constexpr float CROSS_EYED_ANGLE = 0.7853982f;
|
||||
constexpr float DEAD_EYE_STEP = 0.125f;
|
||||
constexpr float DEGREES_TO_RADIANS = 0.017453292f;
|
||||
@@ -61,7 +69,6 @@ constexpr int PLAYERFORM_BOOKWORM = 10;
|
||||
constexpr int TRANSFORMATION_COUNT = 3;
|
||||
constexpr int TEAR_COLOR_PRIORITY = 255;
|
||||
|
||||
constexpr int COLLECTIBLE_20_20 = 245;
|
||||
constexpr int COLLECTIBLE_BRIMSTONE_WEAPON = 118;
|
||||
constexpr int COLLECTIBLE_CURSED_EYE_WEAPON = 316;
|
||||
constexpr int COLLECTIBLE_DEAD_TOOTH = 446;
|
||||
@@ -414,3 +421,130 @@ Entity_Tear* Entity_Player::FireTear(const PosVel& shot, uint32_t fireFlags, Ent
|
||||
reconstruction_missing("Entity_Player::FireTear 00790af0 (Evil Eye)");
|
||||
return tear;
|
||||
}
|
||||
|
||||
// 0075af10 Where a null sits on the player, under its head's facing for a direction (its costumes' null overriding
|
||||
// the body's), else on its current animations: scaled by the sprite, and by the head's size about the head's pivot.
|
||||
Vector Entity_Player::GetCostumeNullPos(std::string_view nullName, bool isHeadScale, const Vector& direction)
|
||||
{
|
||||
const NullFrame* frame = nullptr;
|
||||
bool isCostumed = variant == PLAYER_VARIANT_PLAYER && !isCoopGhost;
|
||||
if (direction.x != 0 || direction.y != 0)
|
||||
{
|
||||
std::string headAnimation = std::abs(direction.x) <= std::abs(direction.y) ? (direction.y >= 0 ? "HeadDown" : "HeadUp")
|
||||
: (direction.x >= 0 ? "HeadRight" : "HeadLeft");
|
||||
frame = sprite.GetNullFrame(headAnimation, nullName, 1);
|
||||
if (!frame && sprite.overlayAnimState.animData) frame = sprite.GetNullFrame(headAnimation + "_Overlay", nullName, 1);
|
||||
if (isCostumed)
|
||||
for (PlayerCostumeMap& costume : playerCostumeMap)
|
||||
if (costume.index >= 0)
|
||||
if (const NullFrame* worn = costumeSpriteDescs[(size_t)costume.index].sprite.GetNullFrame(headAnimation, nullName, 1))
|
||||
frame = worn;
|
||||
}
|
||||
if (!frame)
|
||||
{
|
||||
frame = sprite.animState.animData ? sprite.animState.GetNullFrame(nullName) : nullptr;
|
||||
if (!frame && sprite.overlayAnimState.animData) frame = sprite.overlayAnimState.GetNullFrame(nullName);
|
||||
if (isCostumed)
|
||||
for (PlayerCostumeMap& costume : playerCostumeMap)
|
||||
{
|
||||
if (costume.index < 0) continue;
|
||||
AnimationState& worn = costumeSpriteDescs[(size_t)costume.index].sprite.animState;
|
||||
if (const NullFrame* found = worn.animData ? worn.GetNullFrame(nullName) : nullptr) frame = found;
|
||||
}
|
||||
if (!frame) return {};
|
||||
}
|
||||
|
||||
Vector position = vector_make(sprite.scale.x * frame->pos.x, sprite.scale.y * frame->pos.y);
|
||||
if (!isHeadScale) return position;
|
||||
Vector pivot = vector_make(0, sprite.scale.y * HEAD_PIVOT_LIFT);
|
||||
position = vector_make(position.x - pivot.x, position.y - pivot.y);
|
||||
if (isCostumed)
|
||||
{
|
||||
LayerState* head = sprite.GetLayer(PLAYER_HEAD_LAYER);
|
||||
position = vector_make(position.x * head->size.x, position.y * head->size.y);
|
||||
}
|
||||
return vector_add(position, pivot);
|
||||
}
|
||||
|
||||
// 007aa850 Where a laser of an offset leaves the player: the null of its eye, forehead, mouth, Mom's Eye (facing back)
|
||||
// or Tractor Beam, in world units, lifted while it flies. C Section's lasers leave above it instead.
|
||||
Vector Entity_Player::GetLaserOffset(int laserOffsetId, const Vector& shootDirection)
|
||||
{
|
||||
if (laserOffsetId == LASER_OFFSET_NONE) return {};
|
||||
if (laserOffsetId == LASER_OFFSET_BRIMSTONE && HasCollectible(COLLECTIBLE_C_SECTION))
|
||||
return vector_make(0, sprite.scale.y * C_SECTION_LASER_LIFT);
|
||||
|
||||
Vector offset{};
|
||||
if (laserOffsetId >= LASER_OFFSET_TECH1 && laserOffsetId <= LASER_OFFSET_TRACTOR_BEAM)
|
||||
{
|
||||
Vector facing = shootDirection;
|
||||
if (laserOffsetId == LASER_OFFSET_MOMS_EYE) facing = vector_make(-shootDirection.x, -shootDirection.y);
|
||||
if (laserOffsetId == LASER_OFFSET_SHOOP || laserOffsetId == LASER_OFFSET_BRIMSTONE ||
|
||||
laserOffsetId == LASER_OFFSET_TRACTOR_BEAM)
|
||||
facing = Vector{};
|
||||
offset = vector_scale(GetCostumeNullPos(NULL_OFFSET_NAMES[laserOffsetId], true, facing), 1 / LASER_SCREEN_SCALE);
|
||||
}
|
||||
if (canFly) offset = vector_add(offset, vector_scale(GetFlyingOffset(), 1 / LASER_SCREEN_SCALE));
|
||||
return offset;
|
||||
}
|
||||
|
||||
// 007aab70 Fires a Technology laser from the player: from an eye's offset along a direction, lasting three frames,
|
||||
// in the player's laser color with its laser hit params (Technology 2's with the player's damage, one of Tech.5's in
|
||||
// twenty with a random flag of its own), drawn behind the head when it fires up or away from the eye.
|
||||
Entity_Laser* Entity_Player::FireTechLaser(const TechLaserShot& shot)
|
||||
{
|
||||
Vector offset = GetLaserOffset(shot.offsetId, shot.direction);
|
||||
Entity_Laser* laser = Entity_Laser::ShootAngle({.position = vector_make(shot.position.x + offset.x, shot.position.y),
|
||||
.posOffset = vector_make(0, offset.y),
|
||||
.source = shot.source ? shot.source : this,
|
||||
.angleDegrees = std::atan2(shot.direction.y, shot.direction.x) * DEGREES_PER_RADIAN,
|
||||
.timeout = TECH_LASER_TIMEOUT,
|
||||
.variant = LASER_THIN_RED});
|
||||
laser->parentOffset = vector_make(offset.x, 0);
|
||||
laser->isOneHit = shot.isOneHit;
|
||||
laser->isDisableFollowParent = true;
|
||||
laser->pos = vector_add(vector_add(tearsOffset, shot.position), vector_make(offset.x, 0));
|
||||
|
||||
TearFlags flags = tearFlags;
|
||||
if (shot.offsetId == LASER_OFFSET_TECH5 && Random() % TECH5_FLAG_ROLL < TECH5_FLAG_CHANCE)
|
||||
{
|
||||
flags.reset();
|
||||
flags.set(Random() % TECH5_FLAG_COUNT);
|
||||
}
|
||||
laser->tearFlags = flags;
|
||||
laser->SetColor(laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
if (shot.offsetId == LASER_OFFSET_TECH2) laser->SetCollisionDamage(damage);
|
||||
else
|
||||
{
|
||||
int displacement = (int)(Random() & 1) * 2 - 1;
|
||||
TearParams params = GetTearHitParams(WEAPON_LASER, shot.damageScale, displacement, nullptr);
|
||||
laser->SetCollisionDamage(params.tearDamage);
|
||||
laser->tearFlags |= params.tearFlags;
|
||||
laser->damageMultiplier = shot.damageScale;
|
||||
laser->set_scale(params.tearScale);
|
||||
laser->mass *= params.massMultiplier;
|
||||
}
|
||||
laser->entityGridCollisionClass = GRIDCOLL_NOPITS;
|
||||
|
||||
const Vector& aim = shot.direction;
|
||||
bool isBehind = shot.isLeftEye ? (aim.y < -TECH_LASER_FACING || aim.x > TECH_LASER_FACING)
|
||||
: (aim.y <= -TECH_LASER_FACING || aim.x <= -TECH_LASER_FACING);
|
||||
laser->renderDepthOffset = isBehind ? TECH_LASER_BACK_DEPTH : TECH_LASER_FRONT_DEPTH;
|
||||
laser->isPlayerParams = true;
|
||||
return laser;
|
||||
}
|
||||
|
||||
// 007a0f50 Fires a Brimstone beam from the player in its laser color (Lua's FireBrimstone).
|
||||
Entity_Laser* Entity_Player::FireBrimstone(const Vector& direction, Entity*, float damageMultiplier)
|
||||
{
|
||||
Entity_Laser* laser = Weapon::FireBrimstone({.direction = direction, .position = pos, .entity = this,
|
||||
.damageMultiplier = damageMultiplier});
|
||||
laser->SetColor(laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
return laser;
|
||||
}
|
||||
|
||||
// 00665c20 The player's laser color.
|
||||
ColorMod Entity_Player::get_laser_color_copy()
|
||||
{
|
||||
return laserColor;
|
||||
}
|
||||
Reference in new issue
Block a user