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
@@ -8,6 +8,9 @@
|
||||
#include "engine/render_passes.h"
|
||||
#include "level/room.h"
|
||||
#include <cmath>
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
#include "repentogon/callbacks.h"
|
||||
#endif
|
||||
|
||||
constexpr int SLEEP_SOUL_HEARTS = 6;
|
||||
constexpr int EVENT_COUNTER_SLEEPS = 202;
|
||||
@@ -66,11 +69,15 @@ static void overlay_sound_play(int sound, int frameDelay, float pitch)
|
||||
}
|
||||
|
||||
// Sleeping's healing: each player but Tainted Soul fills its red hearts, or takes three soul hearts without heart
|
||||
// containers, with a power up sound unless finishing. The game counts the sleep.
|
||||
// containers, with a power up sound unless finishing. The game counts the sleep. A mod may skip a player.
|
||||
static void sleep_heal(OverlayUpdate mode)
|
||||
{
|
||||
for (Entity_Player* player : g_game->playerManager.playerList)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
if (boolean_run({"PreTriggerBedSleepEffect", MC_PRE_TRIGGER_BED_SLEEP_EFFECT, std::nullopt}, false, player))
|
||||
continue;
|
||||
#endif
|
||||
if (player->playerType == PLAYER_THESOUL_B)
|
||||
continue;
|
||||
|
||||
@@ -128,8 +135,23 @@ static void sleep_nightmare_update(ANM2& overlay, OverlayUpdate mode)
|
||||
|
||||
// 009ad210 Shows a giant book: its .anm2 with the entry's spritesheet and recolored layers, playing its animation, at
|
||||
// once or after a delay. An entry without one (Mega Mush's) leaves the sprite empty.
|
||||
// A mod may keep it hidden or show another.
|
||||
void ItemOverlay::Show(int overlayId, int showDelay, Entity_Player* shown)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
LuaEngine& engine = lua_engine_get();
|
||||
if (callback_run(engine, {"PreItemOverlayShow", MC_PRE_ITEM_OVERLAY_SHOW, overlayId}, overlayId, showDelay, shown))
|
||||
{
|
||||
bool isCancelled = lua_isboolean(engine.state, -1) && lua_toboolean(engine.state, -1);
|
||||
if (lua_isnumber(engine.state, -1)) overlayId = (int)lua_tonumber(engine.state, -1);
|
||||
lua_pop(engine.state, 1);
|
||||
if (isCancelled) return;
|
||||
}
|
||||
ScopeExit post{[&] {
|
||||
CallbackRun run = {"PostItemOverlayShow", MC_POST_ITEM_OVERLAY_SHOW, overlayId};
|
||||
callback_notify(engine, run, overlayId, showDelay, shown);
|
||||
}};
|
||||
#endif
|
||||
if ((unsigned)overlayId >= GIANTBOOK_ENTRY_COUNT)
|
||||
return;
|
||||
|
||||
@@ -163,6 +185,12 @@ void ItemOverlay::Show(int overlayId, int showDelay, Entity_Player* shown)
|
||||
// and the nightmare of the bed in Home. Finishing skips the animations to their end and the sounds.
|
||||
void ItemOverlay::Update(OverlayUpdate mode)
|
||||
{
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
ScopeExit post{[&] {
|
||||
CallbackRun run = {"PostItemOverlayUpdate", MC_POST_ITEM_OVERLAY_UPDATE, overlayID};
|
||||
callback_notify(lua_engine_get(), run, overlayID, mode == OVERLAY_UPDATE_FINISH);
|
||||
}};
|
||||
#endif
|
||||
if (state == ITEM_OVERLAY_WAITING)
|
||||
{
|
||||
if (--delay < 1)
|
||||
@@ -237,4 +265,8 @@ void ItemOverlay::Render()
|
||||
}
|
||||
}
|
||||
graphics.shader_default_set();
|
||||
#ifdef ISAAC_REPENTOGON
|
||||
if (sprite.isLoaded || overlayID == GIANTBOOK_MEGA_MUSH)
|
||||
callback_notify(lua_engine_get(), {"PostItemOverlayRender", MC_POST_ITEM_OVERLAY_RENDER, overlayID}, overlayID);
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user