Six agents took over Game::Start, Level::SetNextStage, BossPool, save_game_state, level generation to the first room (place_special_rooms, RoomDescriptor, load_room), Room, Camera, Entity/EntityList/EntityRef with a curated skeleton of every Entity_* subclass, Entity_Player, Game::Render, Manager::Update's run branch, RoomTransition, ItemInfoHUD and StatHUD. Integration wrote FirstTrinketOwner and room_shape_get_door_grid_index (checked against the decompile for every shape and slot) and folded the duplicated constants. A run now generates its floor, loads the start room and draws the HUD (under gdb); Isaac renders correctly when drawn, the room itself waits for Room::Render. 2479 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.3 KiB
C++
78 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "anm2.h"
|
|
#include <array>
|
|
#include <cstdint>
|
|
|
|
constexpr int STAT_PLAYER_COUNT = 2;
|
|
constexpr int STAT_TRACKER_COUNT = 10;
|
|
constexpr float STAT_THRESHOLD_FINE = 0.01f;
|
|
constexpr float STAT_THRESHOLD_COARSE = 0.1f;
|
|
|
|
// The stats the stats HUD tracks, in the order of hudstats2.anm2's frames. The last two are tracked but never shown.
|
|
enum StatHudStat : int
|
|
{
|
|
STAT_SPEED,
|
|
STAT_TEARS,
|
|
STAT_DAMAGE,
|
|
STAT_RANGE,
|
|
STAT_SHOT_SPEED,
|
|
STAT_LUCK,
|
|
STAT_DEVIL_CHANCE,
|
|
STAT_ANGEL_CHANCE,
|
|
STAT_UNUSED,
|
|
STAT_PLANETARIUM_CHANCE
|
|
};
|
|
|
|
// Which stats RecomputeStats recomputes, a bit per stat. Either deal chance bit recomputes both.
|
|
enum StatHudFlag : uint32_t
|
|
{
|
|
STAT_FLAG_SPEED = 1 << STAT_SPEED,
|
|
STAT_FLAG_TEARS = 1 << STAT_TEARS,
|
|
STAT_FLAG_DAMAGE = 1 << STAT_DAMAGE,
|
|
STAT_FLAG_RANGE = 1 << STAT_RANGE,
|
|
STAT_FLAG_SHOT_SPEED = 1 << STAT_SHOT_SPEED,
|
|
STAT_FLAG_LUCK = 1 << STAT_LUCK,
|
|
STAT_FLAG_DEVIL_CHANCE = 1 << STAT_DEVIL_CHANCE,
|
|
STAT_FLAG_ANGEL_CHANCE = 1 << STAT_ANGEL_CHANCE,
|
|
STAT_FLAG_UNUSED = 1 << STAT_UNUSED,
|
|
STAT_FLAG_PLANETARIUM_CHANCE = 1 << STAT_PLANETARIUM_CHANCE,
|
|
STAT_FLAGS_ALL = 0xffffffff
|
|
};
|
|
|
|
// A stat the stats HUD shows: its value, the value before its change, the change shown and for how long, and the
|
|
// smallest change worth showing.
|
|
struct StatTracker
|
|
{
|
|
float change = 0;
|
|
float previous = 0;
|
|
float threshold = STAT_THRESHOLD_FINE;
|
|
float value = 0;
|
|
int changeTimer = 0;
|
|
|
|
void set(float newValue, bool isAnimated);
|
|
};
|
|
|
|
// The stats one player shows.
|
|
struct StatHUDPlayer
|
|
{
|
|
std::array<StatTracker, STAT_TRACKER_COUNT> stats{};
|
|
Entity_Player* player = nullptr;
|
|
};
|
|
|
|
// The stats HUD (REPENTOGON's StatHUD) under the pickups, with the found HUD option: speed, tears, damage, range, shot
|
|
// speed, luck and the deal chances, for up to two players, each change shown beside its stat for a while.
|
|
struct StatHUD
|
|
{
|
|
ANM2 sprite;
|
|
std::array<StatHUDPlayer, STAT_PLAYER_COUNT> players{};
|
|
bool isDualityOwned = false;
|
|
|
|
void reset();
|
|
int player_slot_get(Entity_Player* player);
|
|
void Update();
|
|
void Render(Vector at);
|
|
void RecomputeStats(int playerId, uint32_t flags);
|
|
void update_player(Entity_Player* oldPlayer, Entity_Player* newPlayer);
|
|
};
|