-
Notifications
You must be signed in to change notification settings - Fork 39
Custom level generation #750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
8b17521
7c047e1
ea8320c
d2bf067
2490b78
8f8c157
f9fb019
f65b5f5
d313242
e2f77b4
32e508d
1feba7f
bfab985
845072c
c2cc975
47dbdd9
7d5ce08
57a718d
05c839a
9a7e37e
40605fd
797a52d
8ad7897
2e6f9f4
e1b7d98
bd2415e
52c50b5
c308a3e
0bbb155
d89ff98
fc5098b
6edd184
2c37191
86ff2bb
062d157
4732779
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5651,7 +5651,7 @@ HOOK_STATIC(LuaEngine, PostEntityKill, (Entity* ent) -> void, __stdcall) { | |
|
|
||
|
|
||
| //MC_PRE_GENERATE_DUNGEON(1340) | ||
| bool ProcessGenerateDungeonCallback(Level* level, RNG& rng, int dungeonType) { | ||
| bool ProcessGenerateDungeonCallback(Level* level, RNG& rng, DungeonGenerationType dungeonType) { | ||
| const int callbackId = 1340; | ||
| if (!CallbackState.test(callbackId - 1000)) { | ||
| return false; | ||
|
|
@@ -5664,10 +5664,10 @@ bool ProcessGenerateDungeonCallback(Level* level, RNG& rng, int dungeonType) { | |
| DungeonGenerator generator(&rng); | ||
| lua::LuaResults results = lua::LuaCaller(L) | ||
| .push(callbackId) | ||
| .push(dungeonType) | ||
| .push((int)dungeonType) | ||
| .push(&generator, lua::metatables::DungeonGeneratorMT) | ||
| .push(&rng, lua::Metatables::RNG) | ||
| .push(dungeonType) | ||
| .push((int)dungeonType) | ||
| .call(1); | ||
|
|
||
| if (results || !lua_isboolean(L, -1) || !lua_toboolean(L, -1)) | ||
|
|
@@ -5682,7 +5682,7 @@ bool ProcessGenerateDungeonCallback(Level* level, RNG& rng, int dungeonType) { | |
|
|
||
| HOOK_METHOD(Level, generate_dungeon, (RNG* rng) -> void) | ||
| { | ||
| bool skip = ProcessGenerateDungeonCallback(this, *rng, 0); | ||
| bool skip = ProcessGenerateDungeonCallback(this, *rng, DEFAULT); | ||
| if (skip) { | ||
| return; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to call generate_mirror_world here, for the appropriate stages. In theory it should just do what it normally does and flips the main layout... Guess we'll find out if it works.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to confirm if there's anything else we need to do here since we're skipping the vanilla code, like anything the game changes or sets that isnt directly tied to the LevelGenerator portion. I'll need to defer to Guantol for that, though. |
||
| } | ||
|
|
@@ -5691,7 +5691,7 @@ HOOK_METHOD(Level, generate_dungeon, (RNG* rng) -> void) | |
| } | ||
|
|
||
| HOOK_METHOD(Level, generate_blue_womb, () -> void) { | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, 1); | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, BLUE_WOMB); | ||
| if (skip) { | ||
| return; | ||
| } | ||
|
|
@@ -5700,7 +5700,7 @@ HOOK_METHOD(Level, generate_blue_womb, () -> void) { | |
| } | ||
|
|
||
| HOOK_METHOD(Level, generate_backwards_dungeon, () -> void) { | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, 2); | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, BACKWARDS); | ||
| if (skip) { | ||
| return; | ||
| } | ||
|
|
@@ -5709,7 +5709,7 @@ HOOK_METHOD(Level, generate_backwards_dungeon, () -> void) { | |
| } | ||
|
|
||
| HOOK_METHOD(Level, generate_home_dungeon, () -> void) { | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, 3); | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, HOME); | ||
| if (skip) { | ||
| return; | ||
| } | ||
|
|
@@ -5718,7 +5718,7 @@ HOOK_METHOD(Level, generate_home_dungeon, () -> void) { | |
| } | ||
|
|
||
| HOOK_METHOD(Level, generate_redkey_dungeon, () -> void) { | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, 4); | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, RED_REDEMPTION); | ||
| if (skip) { | ||
| return; | ||
| } | ||
|
|
@@ -5727,7 +5727,7 @@ HOOK_METHOD(Level, generate_redkey_dungeon, () -> void) { | |
| } | ||
|
|
||
| HOOK_METHOD(Level, generate_greed_dungeon, () -> void) { | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, 5); | ||
| bool skip = ProcessGenerateDungeonCallback(this, g_Game->_generationRNG, GREED); | ||
| if (skip) { | ||
| return; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.