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

Add LOD management functions #3831

Draft
wants to merge 36 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6f7c6c6
add shared func getObjectLODModel(int objectModel)
Fernando-A-Rocha Oct 29, 2024
f182db2
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Oct 29, 2024
cb928f1
refactor 1
Fernando-A-Rocha Oct 29, 2024
93251bd
new arg parser
Fernando-A-Rocha Oct 30, 2024
d0419a3
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Oct 30, 2024
62cb6e8
rename to GetObjectLODOfModel
Fernando-A-Rocha Oct 30, 2024
c648cbb
add getObjectModelOfLOD
Fernando-A-Rocha Oct 30, 2024
405ad8d
refactors
Fernando-A-Rocha Oct 30, 2024
51e8967
refactor
Fernando-A-Rocha Oct 30, 2024
21e7b28
test @TracerDS
Fernando-A-Rocha Oct 30, 2024
6244ebb
fix OBJ_LOD_MODELS array @TracerDS
Fernando-A-Rocha Oct 31, 2024
73a4252
constexpr
Fernando-A-Rocha Oct 31, 2024
832c6bd
Update CLodModels.cpp
Fernando-A-Rocha Nov 1, 2024
be36dc5
Update CLodModels.cpp
Fernando-A-Rocha Nov 1, 2024
765f7aa
rename GetObjectLowLODOfModel and GetObjectHighLODOfModel
Fernando-A-Rocha Nov 2, 2024
c3613f3
Merge branch 'add-lod-model-func' of github.com:Fernando-A-Rocha/mtas…
Fernando-A-Rocha Nov 2, 2024
71fb7f5
incomplete lod array sorted WIP
Fernando-A-Rocha Nov 2, 2024
26f980e
comment
Fernando-A-Rocha Nov 2, 2024
81c971a
Fixed LOD table WIP
Fernando-A-Rocha Nov 2, 2024
1e223ab
funcs refactor
Fernando-A-Rocha Nov 4, 2024
4225df7
uselesss include
Fernando-A-Rocha Nov 4, 2024
caec9d7
del getObjectCustomLowLODModel
Fernando-A-Rocha Nov 4, 2024
a6466f5
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Nov 10, 2024
a43f1ad
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Nov 18, 2024
9a1fece
Update Shared/mods/deathmatch/logic/CLodModels.h
Fernando-A-Rocha Nov 18, 2024
0b771df
Update Shared/mods/deathmatch/logic/CLodModels.h
Fernando-A-Rocha Nov 18, 2024
9c117fd
optimize lookups
Fernando-A-Rocha Nov 18, 2024
1f3ddc6
comments
Fernando-A-Rocha Nov 18, 2024
e563d71
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Nov 20, 2024
50e282e
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Nov 22, 2024
70809d5
Merge branch 'master' into add-lod-model-func
Fernando-A-Rocha Nov 25, 2024
5af6b06
rename funcs, add isValidModel WIP
Fernando-A-Rocha Nov 25, 2024
93c98c8
.
Fernando-A-Rocha Nov 25, 2024
cbad928
.
Fernando-A-Rocha Nov 26, 2024
ab63086
isValidModel update
Fernando-A-Rocha Nov 26, 2024
b03ea49
wip
Fernando-A-Rocha Nov 26, 2024
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
21 changes: 21 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "StdInc.h"
#include <lua/CLuaFunctionParser.h>
#include "CLodModels.h"

void CLuaObjectDefs::LoadFunctions()
{
Expand Down Expand Up @@ -38,6 +39,10 @@ void CLuaObjectDefs::LoadFunctions()
{"toggleObjectRespawn", ToggleObjectRespawn},
{"setObjectMass", SetObjectMass},
{"setObjectProperty", SetObjectProperty},

// Object util functions
{"getObjectLODOfModel", ArgumentParser<GetObjectLODOfModel>},
{"getObjectModelOfLOD", ArgumentParser<GetObjectModelOfLOD>},
};

// Add functions
Expand Down Expand Up @@ -721,3 +726,19 @@ bool CLuaObjectDefs::IsObjectRespawnable(CClientEntity* const pEntity) noexcept

return pObject->IsRespawnEnabled();
}

std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectLODOfModel(std::uint32_t objectID) noexcept
{
std::uint32_t lodModel = CLodModels::GetObjectLODOfModel(objectID);
if (lodModel == 0) // LOD Model not found for Object Model provided
return false;
return lodModel;
}

std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectModelOfLOD(std::uint32_t lodID) noexcept
{
std::uint32_t objModel = CLodModels::GetObjectModelOfLOD(lodID);
if (objModel == 0) // Object Model not found for LOD Model provided
return false;
return objModel;
}
4 changes: 4 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ class CLuaObjectDefs : public CLuaDefs
LUA_DECLARE(ToggleObjectRespawn);
LUA_DECLARE(SetObjectMass);
LUA_DECLARE(SetObjectProperty);

// Object util funcs
static std::variant<bool, std::uint32_t> GetObjectLODOfModel(std::uint32_t objectID) noexcept;
static std::variant<bool, std::uint32_t> GetObjectModelOfLOD(std::uint32_t lodID) noexcept;
};
21 changes: 21 additions & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "CLuaObjectDefs.h"
#include "CStaticFunctionDefinitions.h"
#include "CScriptArgReader.h"
#include "CLodModels.h"

void CLuaObjectDefs::LoadFunctions()
{
Expand All @@ -36,6 +37,10 @@ void CLuaObjectDefs::LoadFunctions()
{"stopObject", StopObject},
{"breakObject", ArgumentParser<BreakObject>},
{"toggleObjectRespawn", ArgumentParser<ToggleObjectRespawn>},

// Object util functions
{"getObjectLODOfModel", ArgumentParser<GetObjectLODOfModel>},
{"getObjectModelOfLOD", ArgumentParser<GetObjectModelOfLOD>},
};

// Add functions
Expand Down Expand Up @@ -333,3 +338,19 @@ bool CLuaObjectDefs::IsObjectRespawnable(CObject* const pObject) noexcept
{
return pObject->IsRespawnEnabled();
}

std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectLODOfModel(std::uint32_t objectID) noexcept
{
std::uint32_t lodModel = CLodModels::GetObjectLODOfModel(objectID);
if (lodModel == 0) // LOD Model not found for Object Model provided
return false;
return lodModel;
}

std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectModelOfLOD(std::uint32_t lodID) noexcept
{
std::uint32_t objModel = CLodModels::GetObjectModelOfLOD(lodID);
if (objModel == 0) // Object Model not found for LOD Model provided
return false;
return objModel;
}
4 changes: 4 additions & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ class CLuaObjectDefs : public CLuaDefs
LUA_DECLARE(StopObject);
static bool BreakObject(CObject* const pObject);
static bool ToggleObjectRespawn(CObject* const pObject, const bool bRespawn) noexcept;

// Object util funcs
static std::variant<bool, std::uint32_t> GetObjectLODOfModel(std::uint32_t objectID) noexcept;
static std::variant<bool, std::uint32_t> GetObjectModelOfLOD(std::uint32_t objectID) noexcept;
};
Loading
Loading