-
Notifications
You must be signed in to change notification settings - Fork 12
Black Mesa support #78
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
Open
MyGamepedia
wants to merge
10
commits into
TF2-DMB:master
Choose a base branch
from
MyGamepedia:bms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
582a7c4
added Black Mesa data
MyGamepedia 3c1f83f
first working black mesa version, let's gooo!!!
MyGamepedia d34c45f
minor changes
MyGamepedia 97abd44
sensitive classname compare fix
MyGamepedia 7ebf2d7
now linux will use symbols for TheNavMesh and TheNavAreas
MyGamepedia 4982c2d
crash fixes
MyGamepedia 913e810
"Host_Error: DLL_SetView: not a client" crash fix and other changes
MyGamepedia d22c67b
added bms version for activity.inc
MyGamepedia 9c07ece
CBASENPC_BLACKMESA and CBASENPC_TF2 macro
MyGamepedia b83c19e
moved because it don't want to be detected for some reason
MyGamepedia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,9 @@ | |
| #include <CDetour/detours.h> | ||
| #include "helpers.h" | ||
| #include "sourcesdk/nav_mesh.h" | ||
| #include "sourcesdk/tf_gamerules.h" | ||
| #if SOURCE_ENGINE == SE_TF2 | ||
| #include "sourcesdk/tf_gamerules.h" | ||
| #endif | ||
| #include "sourcesdk/basetoggle.h" | ||
| #include "sourcesdk/funcbrush.h" | ||
| #include "natives.hpp" | ||
|
|
@@ -80,12 +82,20 @@ bool CBaseNPCExt::SDK_OnLoad(char* error, size_t maxlength, bool late) { | |
| || !CNavMesh::Init(g_pGameConf, error, maxlength) | ||
| || !CBaseCombatCharacter::Init(g_pGameConf, error, maxlength) | ||
| || !ToolsTraceFilterSimple::Init(g_pGameConf, error, maxlength) | ||
| || !CTFGameRules::Init(g_pGameConf, error, maxlength) | ||
| #if SOURCE_ENGINE == SE_TF2 | ||
| || !CTFGameRules::Init(g_pGameConf, error, maxlength) | ||
| #endif | ||
| || !CBaseEntityOutput::Init(g_pGameConf, error, maxlength) | ||
| || !CBaseNPC_Locomotion::Init(g_pGameConf, error, maxlength) | ||
| || !ToolsNextBot::Init(g_pGameConf, error, maxlength) | ||
| || !Tools_Refresh_Init(g_pGameConf, error, maxlength) | ||
| ) { | ||
| ) | ||
| { | ||
| // Some initialization stages install detours before all later | ||
| // stages have succeeded. Roll them back before SourceMod unloads | ||
| // the extension DLL. | ||
| CNavMesh::SDK_OnUnload(); | ||
| CBaseEntity::SDK_OnUnload(); | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -284,7 +294,11 @@ void CBaseNPCExt::NotifyInterfaceDrop(SMInterface* interface) { | |
| } | ||
| } | ||
|
|
||
| void CBaseNPCExt::SDK_OnUnload() { | ||
| void CBaseNPCExt::SDK_OnUnload() | ||
| { | ||
| CNavMesh::SDK_OnUnload(); | ||
| CBaseEntity::SDK_OnUnload(); | ||
|
Comment on lines
+299
to
+300
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. Ditto |
||
|
|
||
| gameconfs->CloseGameConfigFile(g_pGameConf); | ||
| forwards->ReleaseForward(g_pForwardEventKilled); | ||
|
|
||
|
|
@@ -299,8 +313,6 @@ void CBaseNPCExt::SDK_OnUnload() { | |
| if (g_pSDKHooks) { | ||
| g_pSDKHooks->RemoveEntityListener(this); | ||
| } | ||
|
|
||
| CNavMesh::SDK_OnUnload(); | ||
|
|
||
| FOR_EACH_MAP_FAST(g_EntitiesHooks, iHookID) | ||
| SH_REMOVE_HOOK_ID(iHookID); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,12 @@ int nothing; | |
|
|
||
| IPluginFunction *GetFunctionByNameEx(IPluginContext *pContext, const char *name) | ||
|
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. Is this helper even used anywhere anymore ? if it isn't, feel free to delete it outright. Otherwise ignore this comment. |
||
| { | ||
| IPluginRuntime *pRuntime = pContext->GetRuntime(); | ||
| for(uint32_t i = 0; i < pRuntime->GetPublicsNum(); i++) | ||
| if (!pContext || !name) | ||
| { | ||
| sp_public_t *pub = nullptr; | ||
| if(pRuntime->GetPublicByIndex(i, &pub) == SP_ERROR_NONE) | ||
| { | ||
| if(strstr(pub->name, name) != nullptr) | ||
| { | ||
| return pRuntime->GetFunctionById(pub->funcid); | ||
| } | ||
| } | ||
| return nullptr; | ||
| } | ||
| return nullptr; | ||
|
|
||
| return pContext->GetRuntime()->GetFunctionByName(name); | ||
| } | ||
|
|
||
| void MatrixToPawnMatrix(IPluginContext* context, cell_t* matAddr, const matrix3x4_t& mat) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #include "nav.hpp" | ||
| #include "nav/area.hpp" | ||
|
|
||
| namespace natives::bms::nav { | ||
|
|
||
| void setup(std::vector<sp_nativeinfo_t>& natives) | ||
| { | ||
| area::setup(natives); | ||
| } | ||
|
|
||
| } // namespace natives::bms::nav |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #pragma once | ||
|
|
||
| #include "natives.hpp" | ||
|
|
||
| namespace natives::bms::nav { | ||
|
|
||
| void setup(std::vector<sp_nativeinfo_t>& natives); | ||
|
|
||
| } // namespace natives::bms::nav |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #include "area.hpp" | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| #include "sourcesdk/bms_nav_area.h" | ||
|
|
||
| namespace natives::bms::nav::area { | ||
|
|
||
| inline CBlackMesaNavArea* Get(IPluginContext* context, const cell_t param) | ||
| { | ||
| auto* area = reinterpret_cast<CBlackMesaNavArea*>(PawnAddressToPtr(param)); | ||
| if (!area) | ||
| { | ||
| context->ThrowNativeError("Black Mesa nav area pointer is null!"); | ||
| return nullptr; | ||
| } | ||
|
|
||
| return area; | ||
| } | ||
|
|
||
| cell_t GetGameAttributes(IPluginContext* context, const cell_t* params) | ||
| { | ||
| auto* area = Get(context, params[1]); | ||
| return area ? static_cast<cell_t>(area->GetGameAttributes()) : 0; | ||
| } | ||
|
|
||
| cell_t SetGameAttribute(IPluginContext* context, const cell_t* params) | ||
| { | ||
| auto* area = Get(context, params[1]); | ||
| if (area) | ||
| { | ||
| area->SetGameAttribute(static_cast<std::uint32_t>(params[2])); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| cell_t ClearGameAttribute(IPluginContext* context, const cell_t* params) | ||
| { | ||
| auto* area = Get(context, params[1]); | ||
| if (area) | ||
| { | ||
| area->ClearGameAttribute(static_cast<std::uint32_t>(params[2])); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| cell_t HasGameAttribute(IPluginContext* context, const cell_t* params) | ||
| { | ||
| auto* area = Get(context, params[1]); | ||
| return area && area->HasGameAttribute(static_cast<std::uint32_t>(params[2])); | ||
| } | ||
|
|
||
| void setup(std::vector<sp_nativeinfo_t>& natives) | ||
| { | ||
| sp_nativeinfo_t list[] = { | ||
| {"CBlackMesaNavArea.GetGameAttributes", GetGameAttributes}, | ||
| {"CBlackMesaNavArea.SetGameAttribute", SetGameAttribute}, | ||
| {"CBlackMesaNavArea.ClearGameAttribute", ClearGameAttribute}, | ||
| {"CBlackMesaNavArea.HasGameAttribute", HasGameAttribute}, | ||
| }; | ||
|
|
||
| natives.insert(natives.end(), std::begin(list), std::end(list)); | ||
| } | ||
|
|
||
| } // namespace natives::bms::nav::area |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #pragma once | ||
|
|
||
| #include "natives.hpp" | ||
|
|
||
| namespace natives::bms::nav::area { | ||
|
|
||
| void setup(std::vector<sp_nativeinfo_t>& natives); | ||
|
|
||
| } // namespace natives::bms::nav::area |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to Unload and this is good.