Skip to content

Commit c7aff85

Browse files
committed
Revert changes made to debug the level gen freeze
1 parent 875ca74 commit c7aff85

File tree

2 files changed

+40
-44
lines changed

2 files changed

+40
-44
lines changed

libzhl/dllmain.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
1818
{
1919
if(ul_reason_for_call == DLL_PROCESS_ATTACH)
2020
{
21-
FILE* f = fopen("testzhl.log", "w");
22-
fprintf(f, "Kill me\n");
23-
fclose(f);
24-
ZHL::Log("libzhl: entering DllMain\n");
2521
InitializeSymbolHandler();
2622

2723
#ifdef ZHL_LOG_FILE

repentogon/LuaInterfaces/CustomCallbacks.cpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,46 +2493,46 @@ HOOK_METHOD(GridEntity, hurt_func, (Entity* ent, int Damage, int DamageFlags, fl
24932493
}
24942494

24952495
// MC_POST_LEVEL_LAYOUT_GENERATED
2496-
//HOOK_METHOD(LevelGenerator, Generate, (int unk, bool unk2, bool unk3, bool unk4, unsigned int const& allowedShapes, unsigned int numDeadEnds, LevelGenerator_Room* startRoom) -> void) {
2497-
// super(unk, unk2, unk3, unk4, allowedShapes, numDeadEnds, startRoom);
2498-
//
2499-
// const int callbackId = 1099;
2500-
// if (!CallbackState.test(callbackId - 1000)) {
2501-
// return;
2502-
// }
2503-
//
2504-
// lua_State* L = g_LuaEngine->_state;
2505-
// lua::LuaStackProtector protector(L);
2506-
//
2507-
// lua_rawgeti(L, LUA_REGISTRYINDEX, g_LuaEngine->runCallbackRegistry->key);
2508-
// lua::LuaResults result = lua::LuaCaller(L).push(callbackId)
2509-
// .push(12)
2510-
// .push(this, lua::metatables::LevelGeneratorMT)
2511-
// .call(0);
2512-
//
2513-
// /* std::ofstream stream("repentogon.log", std::ios::app);
2514-
// stream << "After the call to Generate: " << std::endl;
2515-
// stream << " - Dead ends (" << GetDeadEnds()->size() << "): ";
2516-
// for (int idx : *GetDeadEnds()) {
2517-
// stream << idx << " ";
2518-
// }
2519-
// stream << std::endl;
2520-
// stream << " - Non dead ends (" << GetNonDeadEnds()->size() << "): ";
2521-
// for (int idx : *GetNonDeadEnds()) {
2522-
// stream << idx << " ";
2523-
// }
2524-
// stream << std::endl;
2525-
// stream << " - Rooms are as follows : " << std::endl;
2526-
// for (LevelGenerator_Room const& room : *allRooms) {
2527-
// stream << "\tRoom " << room._generationIndex << " at (" << room._gridColIdx << ", " << room._gridLineIdx << ") of shape " << room._shape << " with allowed door slots " << room._doors << " connects to ";
2528-
// for (auto const& neighbor : room._neighbors) {
2529-
// stream << neighbor << " ";
2530-
// }
2531-
// stream << std::endl;
2532-
// }
2533-
//
2534-
// stream.flush(); */
2535-
//}
2496+
HOOK_METHOD(LevelGenerator, Generate, (int unk, bool unk2, bool unk3, bool unk4, unsigned int const& allowedShapes, unsigned int numDeadEnds, LevelGenerator_Room* startRoom) -> void) {
2497+
super(unk, unk2, unk3, unk4, allowedShapes, numDeadEnds, startRoom);
2498+
2499+
const int callbackId = 1099;
2500+
if (!CallbackState.test(callbackId - 1000)) {
2501+
return;
2502+
}
2503+
2504+
lua_State* L = g_LuaEngine->_state;
2505+
lua::LuaStackProtector protector(L);
2506+
2507+
lua_rawgeti(L, LUA_REGISTRYINDEX, g_LuaEngine->runCallbackRegistry->key);
2508+
lua::LuaResults result = lua::LuaCaller(L).push(callbackId)
2509+
.push(12)
2510+
.push(this, lua::metatables::LevelGeneratorMT)
2511+
.call(0);
2512+
2513+
/* std::ofstream stream("repentogon.log", std::ios::app);
2514+
stream << "After the call to Generate: " << std::endl;
2515+
stream << " - Dead ends (" << GetDeadEnds()->size() << "): ";
2516+
for (int idx : *GetDeadEnds()) {
2517+
stream << idx << " ";
2518+
}
2519+
stream << std::endl;
2520+
stream << " - Non dead ends (" << GetNonDeadEnds()->size() << "): ";
2521+
for (int idx : *GetNonDeadEnds()) {
2522+
stream << idx << " ";
2523+
}
2524+
stream << std::endl;
2525+
stream << " - Rooms are as follows : " << std::endl;
2526+
for (LevelGenerator_Room const& room : *allRooms) {
2527+
stream << "\tRoom " << room._generationIndex << " at (" << room._gridColIdx << ", " << room._gridLineIdx << ") of shape " << room._shape << " with allowed door slots " << room._doors << " connects to ";
2528+
for (auto const& neighbor : room._neighbors) {
2529+
stream << neighbor << " ";
2530+
}
2531+
stream << std::endl;
2532+
}
2533+
2534+
stream.flush(); */
2535+
}
25362536

25372537
//POST_NIGHTMARE_SCENE_RENDER (1102)
25382538
/*HOOK_METHOD(NightmareScene, Render, () -> void) {

0 commit comments

Comments
 (0)