Skip to content
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

Even more refactor #411

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
77febfb
add `is_active` method for `Online`
Mr-Auto Dec 29, 2024
8e62788
Implement `HeapBase` struct, change `savestate` using `HeapBase`, fix…
Mr-Auto Dec 30, 2024
fb730a3
fix overlunky initializing UI to fast @estebanfer
Mr-Auto Dec 30, 2024
0862cab
HeapBase get rid of `get_local`, rename `get_local_safe` to `get`, re…
Mr-Auto Dec 31, 2024
6d7c873
move API init out of `State::get`, remove leftover `Spelunky_UpdateLi…
Mr-Auto Dec 31, 2024
bf47001
move `get_correct_liquid_engine` to `LiquidPhysics`
Mr-Auto Dec 31, 2024
b50e2fa
simplify `refresh_illumination`, update doc
Mr-Auto Jan 1, 2025
62e872e
move `layer` from `State` to `StateMemory`, remove `flags`, `set_flag…
Mr-Auto Jan 4, 2025
a24ede2
fix `get_frame` comment
Mr-Auto Jan 4, 2025
7dd2036
move copying HeapBase and heap clone hook into `thread_utils`
Mr-Auto Jan 4, 2025
e993b59
some save state changes, exposing prng and frame of the saved state
Mr-Auto Jan 4, 2025
e1862a4
get rid of prng getter, also change `seed_prng` to use local
Mr-Auto Jan 4, 2025
c4b5e9c
Some extra renderer stuff
Mr-Auto Jan 5, 2025
320b2f9
move camera function to `Camera`, also fold some one line functions i…
Mr-Auto Jan 5, 2025
b711e82
move `lowbias32` to rpc, move and rename `fix_liquid_out_of_bounds` t…
Mr-Auto Jan 5, 2025
d4b6044
move `enum_to_layer` declaration to aliases, move last stand alone fu…
Mr-Auto Jan 5, 2025
36a9dab
move `warp`, `set_seed` to `StateMemory`. Move and rename `State::fin…
Mr-Auto Jan 6, 2025
d907986
remove `State::get_frame_count`, make event deal with HeapBase instea…
Mr-Auto Jan 6, 2025
90f4f4f
get rid of `State`
Mr-Auto Jan 7, 2025
6a6eda8
rename `thread_utils` to `heap_base` and mess around with some `#incl…
Mr-Auto Jan 7, 2025
bf6c489
fix `get_global_frame` return in doc
Mr-Auto Jan 8, 2025
7c196f2
move deprecated functions from `lua_vm` to separate file
Mr-Auto Jan 8, 2025
3617fd0
move the the stuff for global `players` from `lua_vm` to separate file
Mr-Auto Jan 8, 2025
6d43579
move spawn functions from `lua_vm` to new `spawn_lua`
Mr-Auto Jan 8, 2025
1df3ee2
use `ENTITY_MASK` when possible
Mr-Auto Jan 9, 2025
89c6f06
move `RenderInfo` to `vanilla_render_lua`
Mr-Auto Jan 10, 2025
a753728
move `HOTKEY_TYPE` enum to `gui_lua` since there is the `set_hotkey` …
Mr-Auto Jan 10, 2025
b3f56db
move options stuff to `options_lua`
Mr-Auto Jan 10, 2025
e9f3b93
Deprecate `flip_entity`, move entity related functions to `entity_lua…
Mr-Auto Jan 10, 2025
61e7b46
Deprecate `lock_door_at` and `unlock_door_at`, move deprecated functi…
Mr-Auto Jan 12, 2025
7623b09
add `get_target` and `set_taget` for ExitDoor class
Mr-Auto Jan 12, 2025
90c59d8
try to improve clarity of the difference between `replace_drop` and `…
Mr-Auto Jan 12, 2025
9157d8f
move functions that modyfy game code to `game_patches` and make `_lua…
Mr-Auto Jan 12, 2025
7406096
make separate category in the docs for the `Game patching functions` …
Mr-Auto Jan 12, 2025
b3ae44d
move liquid structs to a separate header
Mr-Auto Jan 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,079 changes: 1,536 additions & 1,543 deletions docs/game_data/spel2.lua

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ def print_lf(lf):
cat = "Callback functions"
elif any(subs in func["name"] for subs in ["flag", "clr_mask", "flip_mask", "set_mask", "test_mask"]):
cat = "Flag functions"
elif any(subs in func["file"] for subs in ["game_patches_lua.cpp"]) or any(
subs in func["name"] for subs in ["replace_drop", "set_drop_chance"]):
cat = "Game patching functions"
elif any(subs in func["name"] for subs in ["shop"]):
cat = "Shop functions"
elif any(subs in func["name"] for subs in ["_room"]):
Expand Down Expand Up @@ -506,6 +509,10 @@ def print_lf(lf):

for cat in sorted(func_cats):
print("\n## " + cat + "\n")
if cat.startswith("Game patch"):
print(
"<aside class='warning'>These functions modify the game code, which is hard to keep track and reverse for online rollback mechanics. If you care about online compatibility of your mod, consider using them only during level generation etc.</aside>"
)
for lf in sorted(func_cats[cat], key=lambda x: x["name"]):
if len(ps.rpcfunc(lf["cpp"])):
print_lf(lf)
Expand Down
7 changes: 7 additions & 0 deletions docs/parse_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
"../src/game_api/bucket.hpp",
"../src/game_api/socket.hpp",
"../src/game_api/savestate.hpp",
"../src/game_api/game_patches.hpp",
"../src/game_api/liquid_engine.hpp",
]
api_files = [
"../src/game_api/script/script_impl.cpp",
Expand Down Expand Up @@ -171,6 +173,10 @@
"../src/game_api/script/usertypes/logic_lua.cpp",
"../src/game_api/script/usertypes/bucket_lua.cpp",
"../src/game_api/script/usertypes/color_lua.cpp",
"../src/game_api/script/usertypes/deprecated_func.cpp",
"../src/game_api/script/usertypes/spawn_lua.cpp",
"../src/game_api/script/usertypes/options_lua.cpp",
"../src/game_api/script/usertypes/game_patches_lua.cpp",
]
vtable_api_files = [
"../src/game_api/script/usertypes/vtables_lua.cpp",
Expand Down Expand Up @@ -561,6 +567,7 @@ def run_parse():
"cpp": replace_fun(m.group(2)),
"comment": comment,
"cb_signature": cb_signature,
"file": file,
}
if not comment or "NoDoc" not in comment[0]:
if comment and comment[0] == "Deprecated":
Expand Down
1,486 changes: 742 additions & 744 deletions docs/src/includes/_globals.md

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ Type | Name | Description
[EntityDB](#EntityDB) | [new(EntityDB other)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=EntityDB) |
[EntityDB](#EntityDB) | [new(ENT_TYPE other)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=EntityDB) |
[ENT_TYPE](#ENT_TYPE) | [id](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=id) |
int | [search_flags](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=search_flags) | [MASK](#MASK)
[MASK](#MASK) | [search_flags](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=search_flags) | [MASK](#MASK)
float | [width](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=width) |
float | [height](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=height) |
int | [draw_depth](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_depth) |
Expand Down Expand Up @@ -1017,6 +1017,9 @@ nil | [load()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=load) |
nil | [save()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=save) | Save over a previously allocated [SaveState](#SaveState)
nil | [clear()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=clear) | Delete the [SaveState](#SaveState) and free the memory. The [SaveState](#SaveState) can't be used after this.
[StateMemory](#StateMemory) | [get_state()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_state) | Access the [StateMemory](#StateMemory) inside a [SaveState](#SaveState)
int | [get_frame()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_frame) | Get the current frame from the [SaveState](#SaveState), equivelent to the [get_frame](#Get_frame) global function that returns the frame from the "loaded in state"
[PRNG](#PRNG) | [get_prng()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_prng) | Access the [PRNG](#PRNG) inside a [SaveState](#SaveState)
[SaveState](#SaveState) | [get(int save_slot)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get) | Get the pre-allocated by the game save slot 1-4

### SharedIO

Expand Down Expand Up @@ -1830,6 +1833,7 @@ Type | Name | Description
array&lt;[OnlinePlayer](#OnlinePlayer), 4&gt; | [online_players](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=online_players) |
[OnlinePlayer](#OnlinePlayer) | [local_player](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=local_player) |
[OnlineLobby](#OnlineLobby) | [lobby](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=lobby) |
bool | [is_active()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_active) |

### OnlineLobby

Expand Down Expand Up @@ -3943,6 +3947,8 @@ int | [level](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=level) |
int | [timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=timer) |
int | [world](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=world) |
int | [theme](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=theme) |
nil | [set_target(int ww, int l, int t)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_target) |
tuple&lt;int, int, int&gt; | [get_target()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_target) | Get target world, level, theme of this door. If the `special_door` is false, it returns the StateMemory world_next, level_next, theme_next

### Floor

Expand Down Expand Up @@ -4354,9 +4360,9 @@ bool | [is_in_liquid()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q
bool | [is_cursed()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_cursed) |
bool | [is_movable()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_movable) |
bool | [can_be_pushed()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=can_be_pushed) |
nil | [kill_recursive(bool destroy_corpse, Entity responsible, optional<int> mask, array<ENT_TYPE> ent_types, RECURSIVE_MODE rec_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=kill_recursive) | Kill entity along with all entities attached to it. Be aware that for example killing push block with this function will also kill anything on top of it, any items, players, monsters etc.<br/>To avoid that, you can inclusively or exclusively limit certain [MASK](#MASK) and [ENT_TYPE](#ENT_TYPE). Note: the function will first check mask, if the entity doesn't match, it will look in the provided [ENT_TYPE](#ENT_TYPE)'s<br/>destroy_corpse and responsible are the standard parameters for the kill function
nil | [kill_recursive(bool destroy_corpse, Entity responsible, optional<MASK> mask, array<ENT_TYPE> ent_types, RECURSIVE_MODE rec_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=kill_recursive) | Kill entity along with all entities attached to it. Be aware that for example killing push block with this function will also kill anything on top of it, any items, players, monsters etc.<br/>To avoid that, you can inclusively or exclusively limit certain [MASK](#MASK) and [ENT_TYPE](#ENT_TYPE). Note: the function will first check mask, if the entity doesn't match, it will look in the provided [ENT_TYPE](#ENT_TYPE)'s<br/>destroy_corpse and responsible are the standard parameters for the kill function
nil | [kill_recursive(bool destroy_corpse, Entity responsible)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=kill_recursive) | Short for using [RECURSIVE_MODE](#RECURSIVE_MODE).NONE
nil | [destroy_recursive(optional<int> mask, array<ENT_TYPE> ent_types, RECURSIVE_MODE rec_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=destroy_recursive) | Destroy entity along with all entities attached to it. Be aware that for example destroying push block with this function will also destroy anything on top of it, any items, players, monsters etc.<br/>To avoid that, you can inclusively or exclusively limit certain [MASK](#MASK) and [ENT_TYPE](#ENT_TYPE). Note: the function will first check the mask, if the entity doesn't match, it will look in the provided [ENT_TYPE](#ENT_TYPE)'s
nil | [destroy_recursive(optional<MASK> mask, array<ENT_TYPE> ent_types, RECURSIVE_MODE rec_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=destroy_recursive) | Destroy entity along with all entities attached to it. Be aware that for example destroying push block with this function will also destroy anything on top of it, any items, players, monsters etc.<br/>To avoid that, you can inclusively or exclusively limit certain [MASK](#MASK) and [ENT_TYPE](#ENT_TYPE). Note: the function will first check the mask, if the entity doesn't match, it will look in the provided [ENT_TYPE](#ENT_TYPE)'s
nil | [destroy_recursive()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=destroy_recursive) | Short for using [RECURSIVE_MODE](#RECURSIVE_MODE).NONE
nil | [update()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=update) |
nil | [flip(bool left)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=flip) |
Expand Down
10 changes: 10 additions & 0 deletions src/game_api/aliases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,20 @@ enum class ENTITY_MASK : uint32_t
};
ENUM_CLASS_FLAGS(ENTITY_MASK)

inline bool operator!(ENTITY_MASK v)
{
return v == static_cast<ENTITY_MASK>(0);
}

// Returns true if any of the set bits in `mask` are in `flags`
template <class T>
requires std::is_enum_v<T>
bool test_mask(T flags, T mask)
{
return static_cast<std::underlying_type_t<T>>(flags & mask) != 0;
}

// safe function, returns only 0 or 1. returns 0 for LAYER::BOTH
uint8_t enum_to_layer(const LAYER layer, struct Vec2& player_position);
// safe function, returns only 0 or 1. returns 0 for LAYER::BOTH
uint8_t enum_to_layer(const LAYER layer);
35 changes: 17 additions & 18 deletions src/game_api/bucket.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "bucket.hpp"

#include "containers/game_allocator.hpp"
#include "entities_chars.hpp"
#include "game_manager.hpp"
#include "items.hpp"
#include "memory.hpp"
#include "screen.hpp"
#include "state.hpp"
#include "entities_chars.hpp" // for Player
#include "game_manager.hpp" // for GameManager, get_game_manager
#include "items.hpp" // for Items
#include "screen.hpp" // for ScreenCharacterSelect
#include "search.hpp" // for get_address
#include "state.hpp" // for StateMemory, get_state_ptr

Bucket* Bucket::get()
{
Expand All @@ -23,21 +22,21 @@ Bucket* Bucket::get()

PAUSE_TYPE PauseAPI::get_pause()
{
pause = (PAUSE_TYPE)(State::get().ptr()->pause | ((uint32_t)pause & ~0x3f));
pause = (PAUSE_TYPE)(get_state_ptr()->pause | ((uint32_t)pause & ~0x3f));
return pause;
}

void PauseAPI::set_pause(PAUSE_TYPE flags)
{
auto state = State::get().ptr();
auto state = get_state_ptr();
pause = flags;
state->pause = (uint8_t)(((uint32_t)flags) & 0x3f);
}

bool PauseAPI::check_trigger(PAUSE_TRIGGER& trigger, PAUSE_SCREEN& screen) const
{
bool match = false;
auto state = State::get().ptr();
auto state = get_state_ptr();

if (state->loading == 2 && (trigger & PAUSE_TRIGGER::SCREEN) != PAUSE_TRIGGER::NONE && (screen == PAUSE_SCREEN::NONE || (screen & (PAUSE_SCREEN)(1 << state->screen_next)) != PAUSE_SCREEN::NONE))
match = true;
Expand All @@ -54,15 +53,15 @@ bool PauseAPI::check_trigger(PAUSE_TRIGGER& trigger, PAUSE_SCREEN& screen) const
if (match && (trigger & PAUSE_TRIGGER::ONCE) != PAUSE_TRIGGER::NONE)
trigger = PAUSE_TRIGGER::NONE;

if (match && last_trigger_frame == get_global_update_count())
if (match && (uint64_t)last_trigger_frame == API::get_global_update_count())
match = false;

return match;
}

bool PauseAPI::loading()
{
auto state = State::get().ptr();
auto state = get_state_ptr();
auto gm = get_game_manager();
bool loading = state->loading > 0 || state->fade_timer > 0 || (state->screen == 4 && gm->screen_menu->menu_text_opacity < 1) || (state->screen == 9 && (state->screen_character_select->topleft_woodpanel_esc_slidein == 0 || state->screen_character_select->start_pressed)) || state->logic->ouroboros;
if ((state->loading == 3 && (state->fade_timer <= 1 || state->fade_length == 0)) || (state->loading == 1 && state->fade_timer == state->fade_length))
Expand All @@ -74,7 +73,7 @@ bool PauseAPI::event(PAUSE_TYPE pause_event)
{
bool block = false;
std::optional<bool> force;
auto state = State::get().ptr();
auto state = get_state_ptr();

if (skip_fade)
{
Expand All @@ -95,13 +94,13 @@ bool PauseAPI::event(PAUSE_TYPE pause_event)
{
set_paused(true);
force = true;
last_trigger_frame = get_global_update_count();
last_trigger_frame = API::get_global_update_count();
}
if (check_trigger(unpause_trigger, unpause_screen))
{
set_paused(false);
force = false;
last_trigger_frame = get_global_update_count();
last_trigger_frame = API::get_global_update_count();
}
last_fade_timer = state->fade_timer;
last_level_flags = state->level_flags;
Expand Down Expand Up @@ -132,7 +131,7 @@ bool PauseAPI::event(PAUSE_TYPE pause_event)
set_paused(true);

if (update_camera && ((block && (pause_event == PAUSE_TYPE::PRE_UPDATE || pause_event == PAUSE_TYPE::PRE_GAME_LOOP)) || ((pause_event == PAUSE_TYPE::PRE_UPDATE && (uint8_t)pause_type & 0x3f) && state->pause > 0)) && ((state->pause & 1) == 0 || (uint8_t)pause_type & 1))
update_camera_position();
state->camera->update_position();

if ((pause_type & pause_event) != PAUSE_TYPE::NONE)
blocked = block;
Expand All @@ -142,7 +141,7 @@ bool PauseAPI::event(PAUSE_TYPE pause_event)

void PauseAPI::post_loop()
{
auto state = State::get().ptr();
auto state = get_state_ptr();
if (skip)
state->pause |= (uint8_t)pause_type & 0x3f;
skip = false;
Expand All @@ -156,7 +155,7 @@ bool PauseAPI::pre_input()
return false;

auto gm = get_game_manager();
auto state = State::get().ptr();
auto state = get_state_ptr();

if (bucket->pause_api->modifiers_block & bucket->pause_api->modifiers_down)
{
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ uColor get_color(const std::string& color_name, std::optional<uint8_t> alpha)
{
// #RRGGBBAA
// 0xAABBGGRR
// treating not even number of hex characters as user error = behavior is undefined
// treating non even number of hex characters as user error = behavior is undefined

if (color_name.size() == 0)
return 0;
Expand Down
6 changes: 3 additions & 3 deletions src/game_api/containers/custom_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <string> // for operator""sv

#include "memory.hpp" // for memory_read, Memory
#include "search.hpp" // for get_address
#include "thread_utils.hpp" // for OnHeapPointer
#include "heap_base.hpp" // for OnHeapPointer
#include "memory.hpp" // for memory_read, Memory
#include "search.hpp" // for get_address

using CustomMallocFun = void*(void*, std::size_t);
using CustomFreeFun = void*(void*, void*);
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/custom_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <utility> // for min, find
#include <vector> // for vector, allocator, vector<>::iterator

#include "entity.hpp" // for to_id
#include "entity_db.hpp" // for to_id

const std::vector<std::pair<CUSTOM_TYPE, std::string_view>> custom_type_names = {
{CUSTOM_TYPE::ACIDBUBBLE, "ACIDBUBBLE"},
Expand Down
16 changes: 11 additions & 5 deletions src/game_api/drops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
#include <string_view> //
#include <utility> // for min, max

#include "entity.hpp" // for to_id
#include "memory.hpp" // for Memory, recover_mem, write_mem_recoverable
#include "search.hpp" // for find_inst
#include "entity_db.hpp" // for to_id
#include "memory.hpp" // for Memory, recover_mem, write_mem_recoverable
#include "search.hpp" // for find_inst

///
/// DROP
///
std::vector<DropEntry> drop_entries{
{"ALTAR_DICE_CLIMBINGGLOVES", "\xBA\x0D\x02\x00\x00\xEB\x05"sv, VTABLE_OFFSET::NONE, 0, 1}, // VTABLE_OFFSET::FLOOR_ALTAR, 26
{"ALTAR_DICE_COOKEDTURKEY", "\xBA\x06\x02\x00\x00\xEB\x0C"sv, VTABLE_OFFSET::NONE, 0, 1},
Expand Down Expand Up @@ -316,6 +319,9 @@ std::vector<DropEntry> drop_entries{
/// maybe TODO: if someone wants all the explosions (from damage/death/crush), could also be added
};

///
/// DROPCHANCE
///
std::vector<DropChanceEntry> dropchance_entries{
{"BONEBLOCK_SKELETONKEY", "\xE8\x03\x00\x00"sv, VTABLE_OFFSET::ACTIVEFLOOR_BONEBLOCK, 3},
{"CROCMAN_TELEPACK", "\x64"sv, VTABLE_OFFSET::MONS_CROCMAN, 3, 1},
Expand All @@ -330,7 +336,7 @@ std::vector<DropChanceEntry> dropchance_entries{
{"YETI_PITCHERSMITT", "\xE8\x03\x00\x00"sv, VTABLE_OFFSET::MONS_YETI, 3},
};

void set_drop_chance(int32_t dropchance_id, uint32_t new_drop_chance)
void set_drop_chance(DROPCHANCE dropchance_id, uint32_t new_drop_chance)
{
if (dropchance_id < (int32_t)dropchance_entries.size())
{
Expand Down Expand Up @@ -366,7 +372,7 @@ void set_drop_chance(int32_t dropchance_id, uint32_t new_drop_chance)
}
}

void replace_drop(int32_t drop_id, ENT_TYPE new_drop_entity_type)
void replace_drop(DROP drop_id, ENT_TYPE new_drop_entity_type)
{
const static auto nof_ent_types = to_id("ENT_TYPE_LIQUID_COARSE_LAVA") + 1;
if (drop_id < (int32_t)drop_entries.size() && new_drop_entity_type < nof_ent_types)
Expand Down
7 changes: 4 additions & 3 deletions src/game_api/drops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ struct DropChanceEntry
uint8_t chance_sizeof = 4;
size_t offset = 0;
};

void set_drop_chance(int32_t dropchance_id, uint32_t new_drop_chance);
void replace_drop(int32_t drop_id, ENT_TYPE new_drop_entity_type);
using DROPCHANCE = int32_t;
void set_drop_chance(DROPCHANCE dropchance_id, uint32_t new_drop_chance);
using DROP = int32_t;
void replace_drop(DROP drop_id, ENT_TYPE new_drop_entity_type);

extern std::vector<DropEntry> drop_entries;

Expand Down
3 changes: 1 addition & 2 deletions src/game_api/entities_activefloors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include "entity.hpp" // for Entity, to_id, EntityDB
#include "items.hpp" // IWYU pragma: keep
#include "layer.hpp" // for EntityList::Range, EntityList, EntityList::Ent...
#include "search.hpp" // for get_address
#include "sound_manager.hpp" //
#include "sound_manager.hpp" // for construct_soundmeta

uint8_t Olmec::broken_floaters()
{
Expand Down
Loading