REPENTOGON phase 1: 361 of 396 callbacks fired at their original sites with REPENTOGON's arguments, filters and return handling, inert without mods (72 goldens identical), vanilla changes behind the parity switch; source_tree.py skips src/'s own template structs
This commit is contained in:
1 parent
2cc082f6ee
commit
74322af121
167 files changed
+6408
-546
No files matched your search
+53
-10
@@ -19,6 +19,10 @@
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
#include "repentogon/player.h"
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
constexpr const char* HEARTS_PNG = "gfx/ui/ui_hearts.png";
|
||||
constexpr const char* HEARTS_SMALL_PNG = "gfx/ui/ui_hearts_small.png";
|
||||
@@ -733,6 +737,12 @@ void PlayerHUD::UpdateHearts(std::span<PlayerHUDHeart> slots, Entity_Player& sho
|
||||
// versus match a health bar. outExtent is how far the hearts reach.
|
||||
void PlayerHUD::RenderHearts(Vector& outExtent, ANM2& sprite, PlayerHudLayout layout, float heartScale, Vector at)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
HudHeartsDraw heartsDraw = {outExtent, sprite, at, layout, heartScale};
|
||||
bool isFollowed = player && !player->isCoopGhost;
|
||||
if (isFollowed && hud_hearts_pre_render(*this, heartsDraw)) return;
|
||||
ScopeExit heartsPost = {[&] { if (isFollowed) hud_hearts_post_render(*this, heartsDraw); }};
|
||||
#endif
|
||||
Game& game = *g_game;
|
||||
if (game.currentRoomIdx == ROOM_DEATHMATCH_IDX)
|
||||
{
|
||||
@@ -1055,6 +1065,10 @@ static void glitched_icon_draw(int id, const SourceQuad& source, const KAGE::Gra
|
||||
static void active_item_draw(const PlayerHUDActiveItem& active, const SourceQuad& source,
|
||||
const KAGE::Graphics::ColorQuad& quad, const ColorMod& color)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
bool isOutline = std::memcmp(&color, &ICON_OUTLINE, sizeof(ColorMod)) == 0;
|
||||
if (activeItemRender.isItemHidden || (activeItemRender.isOutlineHidden && isOutline)) return;
|
||||
#endif
|
||||
KAGE::Graphics::manager.shader_default_set();
|
||||
if (active.id < 0) return glitched_icon_draw(active.id, source, quad, color);
|
||||
if (!active.itemImage) return;
|
||||
@@ -1161,8 +1175,17 @@ static void bar_fill_draw(const ChargeBar& bar, float fill, ColorMod color)
|
||||
// overlay on even frames. Hold shows the poop it holds.
|
||||
void PlayerHUD::RenderActiveItem(int activeSlot, Vector at, PlayerHudLayout layout, float itemScale, float alpha)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
max_charge_cache_begin();
|
||||
ScopeExit cacheEnd = {max_charge_cache_end};
|
||||
#endif
|
||||
if (!player || player->isCoopGhost)
|
||||
return;
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
HudActiveDraw activeDraw = {at, activeSlot, layout, alpha, itemScale};
|
||||
if (hud_active_item_pre_render(*this, activeDraw)) return;
|
||||
ScopeExit activePost = {[&] { hud_active_item_post_render(*this, activeDraw); }};
|
||||
#endif
|
||||
|
||||
KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager;
|
||||
Entity_Player& shown = *player;
|
||||
@@ -1191,6 +1214,9 @@ void PlayerHUD::RenderActiveItem(int activeSlot, Vector at, PlayerHudLayout layo
|
||||
shown.GetTotalActiveCharge(activeSlot) >= shown.GetActiveMinUsableCharge(activeSlot) &&
|
||||
alpha >= 1;
|
||||
active_icon_frame_set(icon, shown, activeSlot, charge);
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
if (activeItemRender.isCropped) icon.frame = vector_make(activeItemRender.cropX, activeItemRender.cropY);
|
||||
#endif
|
||||
if (item == COLLECTIBLE_HOLD && shown.activeItems[activeSlot].varData != 0)
|
||||
{
|
||||
ANM2& poops = hud->poopSpellsSprite;
|
||||
@@ -1232,7 +1258,11 @@ void PlayerHUD::RenderActiveItem(int activeSlot, Vector at, PlayerHudLayout layo
|
||||
icon_pass_draw(active, icon, iconSize, main);
|
||||
}
|
||||
|
||||
if (charge.max < 1)
|
||||
bool isBarHidden = charge.max < 1;
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
isBarHidden = isBarHidden || activeItemRender.isChargeBarHidden;
|
||||
#endif
|
||||
if (isBarHidden)
|
||||
{
|
||||
graphics.shader_default_set();
|
||||
return;
|
||||
@@ -1294,13 +1324,11 @@ void PlayerHUD::RenderActiveItem(int activeSlot, Vector at, PlayerHudLayout layo
|
||||
graphics.shader_default_set();
|
||||
}
|
||||
|
||||
// (0084bab0) Draws a trinket's icon at a position and size in a color: its 32 pixel frame, which for Monkey Paw is the
|
||||
// one of the paw's fingers left.
|
||||
void PlayerHUD::trinket_draw(const PlayerHUDTrinket& trinket, Vector at, const ColorMod& color, float trinketScale)
|
||||
// (0084bab0) Draws a trinket's icon at a position and size in a color, from its 32 pixel frame at crop.
|
||||
void PlayerHUD::trinket_draw(const PlayerHUDTrinket& trinket, Vector at, const ColorMod& color, float trinketScale,
|
||||
Vector crop)
|
||||
{
|
||||
float frameX = trinket.id == TRINKET_MONKEY_PAW ? (float)(MONKEY_PAW_FRAMES - player->monkeyPawCounter) * TRINKET_SIZE
|
||||
: 0;
|
||||
SourceQuad source = KAGE::Graphics::source_quad_rect(vector_make(frameX, 0), vector_make(TRINKET_SIZE, TRINKET_SIZE));
|
||||
SourceQuad source = KAGE::Graphics::source_quad_rect(crop, vector_make(TRINKET_SIZE, TRINKET_SIZE));
|
||||
Vector size = vector_make(trinketScale * TRINKET_SIZE, trinketScale * TRINKET_SIZE);
|
||||
KAGE::Graphics::ColorQuad quad = KAGE::Graphics::color_quad_rect(at, size, kcolor_rgba(1, 1, 1, 1));
|
||||
|
||||
@@ -1310,11 +1338,18 @@ void PlayerHUD::trinket_draw(const PlayerHUDTrinket& trinket, Vector at, const C
|
||||
|
||||
// 00846ff0 Draws a trinket slot's icon over its shadow, shaken with the screen and, when small, centered on its drawn
|
||||
// pixels: the error trinket reddened, a golden trinket shimmering in the gold shader, a Modeling Clay copy in clay.
|
||||
// The original leaves the shaders it picks current. Here they are popped after.
|
||||
// Monkey Paw shows the frame of the fingers it has left. The original leaves the shaders it picks current. Here they
|
||||
// are popped after.
|
||||
void PlayerHUD::RenderTrinket(int trinketSlot, Vector at, float trinketScale, bool isSmall)
|
||||
{
|
||||
const PlayerHUDTrinket& trinket = trinkets[trinketSlot];
|
||||
if (trinket.id == 0 || !trinket.image) return;
|
||||
float frameX = trinket.id == TRINKET_MONKEY_PAW ? (float)(MONKEY_PAW_FRAMES - player->monkeyPawCounter) * TRINKET_SIZE
|
||||
: 0;
|
||||
Vector crop = vector_make(frameX, 0);
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
if (!hud_trinket_pre_render(*this, trinketSlot, at, trinketScale, crop)) return;
|
||||
#endif
|
||||
|
||||
KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager;
|
||||
Vector shake = g_game->screenShakeOffset;
|
||||
@@ -1324,7 +1359,7 @@ void PlayerHUD::RenderTrinket(int trinketSlot, Vector at, float trinketScale, bo
|
||||
|
||||
int pushed = graphics.shader_push(COLOR_OFFSET_SHADER) ? 1 : 0;
|
||||
trinket_draw(trinket, vector_make(trinketScale + trinketScale + position.x, trinketScale + trinketScale + position.y),
|
||||
TRINKET_SHADOW, trinketScale);
|
||||
TRINKET_SHADOW, trinketScale, crop);
|
||||
|
||||
ColorMod color = COLOR_DEFAULT;
|
||||
uint32_t held = player->trinkets[trinketSlot];
|
||||
@@ -1337,7 +1372,7 @@ void PlayerHUD::RenderTrinket(int trinketSlot, Vector at, float trinketScale, bo
|
||||
}
|
||||
else if (trinket.clayItem != 0)
|
||||
for (int i = 0; i < 4; i++) color._colorize[i] = CLAY_COLORIZE[i];
|
||||
trinket_draw(trinket, position, color, trinketScale);
|
||||
trinket_draw(trinket, position, color, trinketScale, crop);
|
||||
for (; pushed > 0; pushed--) graphics.shader_pop();
|
||||
}
|
||||
|
||||
@@ -1544,6 +1579,10 @@ static void inventory_icon_draw(const PlayerHUDIcon& icon, const KAGE::Graphics:
|
||||
// one the next item replaces.
|
||||
void PlayerHUD::render_inventory(Vector at, float inventoryScale)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
HudElementScope elementScope(*this, HUD_ELEMENT_INVENTORY, at, inventoryScale);
|
||||
if (!elementScope.isDrawn) return;
|
||||
#endif
|
||||
ANM2& sprite = hud->inventorySprite;
|
||||
int slots = player->GetMaxInventorySize();
|
||||
int columns = slots / 2;
|
||||
@@ -1654,6 +1693,10 @@ void PlayerHUD::render_card_table(Vector at, float tableScale)
|
||||
// challenge it draws the card table instead.
|
||||
void PlayerHUD::RenderCraftingTable(Vector at, float tableScale)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
HudElementScope elementScope(*this, HUD_ELEMENT_CRAFTING_TABLE, at, tableScale);
|
||||
if (!elementScope.isDrawn) return;
|
||||
#endif
|
||||
ANM2& sprite = hud->craftingTableSprite;
|
||||
sprite.scale = vector_make(tableScale, tableScale);
|
||||
if (g_game->challenge == CHALLENGE_CANTRIPPED)
|
||||
|
||||
Reference in new issue
Block a user