diff --git a/sfall/Modules/Objects.cpp b/sfall/Modules/Objects.cpp index dcb78144..762dd465 100644 --- a/sfall/Modules/Objects.cpp +++ b/sfall/Modules/Objects.cpp @@ -29,6 +29,8 @@ namespace sfall static int unjamTimeState; static int maxCountLoadProto = 512; +static fo::GameObject* outlinedObjs[500]; + long Objects::uniqueID = UniqueID::Start; // current counter id, saving to sfallgv.sav bool Objects::IsUniqueID(long id) { @@ -251,6 +253,18 @@ skip: } } +static __declspec(naked) void obj_render_pre_roof_hack() { + __asm { + cmp eax, 500; + jge jbreak; + retn; +jbreak: + pop edx; + add edx, 13; // offset to next section (0x4896E8, 0x4897C7) + jmp edx; + } +} + void Objects::init() { LoadGameHook::OnGameReset() += []() { RestoreObjUnjamAllLocks(); @@ -273,6 +287,15 @@ void Objects::init() { // Place some objects on the lower z-layer of the tile MakeCall(0x48D918, obj_insert_hack, 1); + + // Increase the maximum number of objects that can be outlined simultaneously (when w/o HRP 4.x by Mash) + if (*(DWORD*)0x48981D == 0x639C00) { + // replace _outlinedObjects array (was 100 objects) + SafeWriteBatch((DWORD)outlinedObjs - 4, {0x4896DF, 0x4897BE}); // obj_render_pre_roof_ + SafeWrite32(0x48981D, (DWORD)outlinedObjs); // obj_render_post_roof_ + // change the maximum limit to 500 + MakeCalls(obj_render_pre_roof_hack, {0x4896D6, 0x4897B5}); + } } } diff --git a/sfall/Modules/Scripting/Handlers/Interface.h b/sfall/Modules/Scripting/Handlers/Interface.h index 76c647ea..bcde25cf 100644 --- a/sfall/Modules/Scripting/Handlers/Interface.h +++ b/sfall/Modules/Scripting/Handlers/Interface.h @@ -27,8 +27,6 @@ namespace script class OpcodeContext; -void ClearInterfaceArtCache(); - // input_functions void op_input_funcs_available(); diff --git a/sfall/Modules/Scripting/Handlers/Metarule.cpp b/sfall/Modules/Scripting/Handlers/Metarule.cpp index 12f4fafd..3fac27f2 100644 --- a/sfall/Modules/Scripting/Handlers/Metarule.cpp +++ b/sfall/Modules/Scripting/Handlers/Metarule.cpp @@ -126,7 +126,7 @@ static const SfallMetarule metarules[] = { {"loot_obj", mf_get_loot_object, 0, 0}, {"message_box", mf_message_box, 1, 4, -1, {ARG_STRING, ARG_INT, ARG_INT, ARG_INT}}, {"metarule_exist", mf_metarule_exist, 1, 1}, // no arg check - {"npc_engine_level_up", mf_npc_engine_level_up, 1, 1}, + {"npc_engine_level_up", mf_npc_engine_level_up, 1, 1, -1, {ARG_INT}}, {"obj_is_openable", mf_obj_is_openable, 1, 1, 0, {ARG_OBJECT}}, {"obj_under_cursor", mf_obj_under_cursor, 2, 2, 0, {ARG_INT, ARG_INT}}, {"objects_in_radius", mf_objects_in_radius, 3, 4, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}}, diff --git a/sfall/Modules/Scripting/Handlers/Objects.cpp b/sfall/Modules/Scripting/Handlers/Objects.cpp index fafab9d7..8e7cf8e8 100644 --- a/sfall/Modules/Scripting/Handlers/Objects.cpp +++ b/sfall/Modules/Scripting/Handlers/Objects.cpp @@ -615,7 +615,7 @@ void mf_objects_in_radius(OpcodeContext& ctx) { } void mf_npc_engine_level_up(OpcodeContext& ctx) { - if (ctx.arg(0).asBool()) { + if (ctx.arg(0).rawValue()) { if (!npcEngineLevelUp) SafeWrite16(0x4AFC1C, 0x840F); // enable npcEngineLevelUp = true; } else {