Skip to content

Commit

Permalink
CodeMaid formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
c6-dev committed Jun 10, 2022
1 parent 6a93635 commit 2b4204d
Show file tree
Hide file tree
Showing 65 changed files with 8,874 additions and 11,523 deletions.
122 changes: 52 additions & 70 deletions JG/JohnnyGuitarNVSE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,60 +44,52 @@ _CaptureLambdaVars CaptureLambdaVars;
_UncaptureLambdaVars UncaptureLambdaVars;
NiTMap<const char*, TESForm*>** g_gameFormEditorIDsMap = reinterpret_cast<NiTMap<const char*, TESForm*>**>(0x11C54C8);
#define JG_VERSION 470
void MessageHandler(NVSEMessagingInterface::Message* msg)
{

switch (msg->type)
{

case NVSEMessagingInterface::kMessage_NewGame:
case NVSEMessagingInterface::kMessage_PreLoadGame:
{
disableMuzzleLights = 0; //reset the muzzle hook every time
bArrowKeysDisabled = false;
isShowLevelUp = true;
ThisStdCall(0x8C17C0, g_thePlayer); // reevaluate reload speed modifiers
ThisStdCall(0x8C1940, g_thePlayer); // reevaluate equip speed modifiers
void MessageHandler(NVSEMessagingInterface::Message* msg) {
switch (msg->type) {
case NVSEMessagingInterface::kMessage_NewGame:
case NVSEMessagingInterface::kMessage_PreLoadGame:
{
disableMuzzleLights = 0; //reset the muzzle hook every time
bArrowKeysDisabled = false;
isShowLevelUp = true;
ThisStdCall(0x8C17C0, g_thePlayer); // reevaluate reload speed modifiers
ThisStdCall(0x8C1940, g_thePlayer); // reevaluate equip speed modifiers

OnDyingHandler->FlushEventCallbacks();
OnLimbGoneHandler->FlushEventCallbacks();
OnCrosshairHandler->FlushEventCallbacks();
RestoreDisabledPlayerControlsHUDFlags();
SaveGameUMap.clear();
break;
}
case NVSEMessagingInterface::kMessage_MainGameLoop:
for (const auto& EventInfo : EventsArray)
OnDyingHandler->FlushEventCallbacks();
OnLimbGoneHandler->FlushEventCallbacks();
OnCrosshairHandler->FlushEventCallbacks();
RestoreDisabledPlayerControlsHUDFlags();
SaveGameUMap.clear();
break;
}
case NVSEMessagingInterface::kMessage_MainGameLoop:
for (const auto& EventInfo : EventsArray) {
EventInfo->AddQueuedEvents();
EventInfo->DeleteEvents();
}
break;
case NVSEMessagingInterface::kMessage_DeferredInit:
{
EventInfo->AddQueuedEvents();
EventInfo->DeleteEvents();
g_thePlayer = PlayerCharacter::GetSingleton();
g_processManager = (ProcessManager*)0x11E0E80;
g_interfaceManager = InterfaceManager::GetSingleton();
g_bsWin32Audio = BSWin32Audio::GetSingleton();
g_dataHandler = DataHandler::Get();
g_audioManager = (BSAudioManager*)0x11F6EF0;
g_currentSky = (Sky**)0x11DEA20;
g_gameTimeGlobals = (GameTimeGlobals*)0x11DE7B8;
g_VATSCameraData = (VATSCameraData*)0x11F2250;
g_initialTickCount = GetTickCount();
Console_Print("JohnnyGuitar version: %.2f", ((float)JG_VERSION / 100));
break;
}
break;
case NVSEMessagingInterface::kMessage_DeferredInit:
{
g_thePlayer = PlayerCharacter::GetSingleton();
g_processManager = (ProcessManager*)0x11E0E80;
g_interfaceManager = InterfaceManager::GetSingleton();
g_bsWin32Audio = BSWin32Audio::GetSingleton();
g_dataHandler = DataHandler::Get();
g_audioManager = (BSAudioManager*)0x11F6EF0;
g_currentSky = (Sky**)0x11DEA20;
g_gameTimeGlobals = (GameTimeGlobals*)0x11DE7B8;
g_VATSCameraData = (VATSCameraData*)0x11F2250;
g_initialTickCount = GetTickCount();
Console_Print("JohnnyGuitar version: %.2f", ((float)JG_VERSION / 100));
break;
}
default:
break;
default:
break;
}

}

extern "C" {

bool NVSEPlugin_Query(const NVSEInterface* nvse, PluginInfo* info)
{
bool NVSEPlugin_Query(const NVSEInterface* nvse, PluginInfo* info) {
// fill out the info structure
gLog.Create("JohnnyGuitarNVSE.log");
#if _DEBUG
Expand All @@ -107,30 +99,24 @@ extern "C" {
info->name = "JohnnyGuitarNVSE";
info->version = JG_VERSION;

if (nvse->isNogore)
{
if (nvse->isNogore) {
PrintLog("German NoGore release of the game is not supported");
return false;
}

if (nvse->nvseVersion < 0x6020030)
{
if (nvse->nvseVersion < 0x6020030) {
PrintLog("NVSE version is outdated. This plugin requires v6.2.3 minimum.");
return false;
}

if (!nvse->isEditor)
{
if (nvse->runtimeVersion < RUNTIME_VERSION_1_4_0_525)
{
if (!nvse->isEditor) {
if (nvse->runtimeVersion < RUNTIME_VERSION_1_4_0_525) {
PrintLog("incorrect New Vegas version (got %08X need at least %08X)", nvse->runtimeVersion, RUNTIME_VERSION_1_4_0_525);
return false;
}
}
else
{
if (nvse->editorVersion < CS_VERSION_1_4_0_518)
{
else {
if (nvse->editorVersion < CS_VERSION_1_4_0_518) {
PrintLog("incorrect GECK version (got %08X need at least %08X)", nvse->editorVersion, CS_VERSION_1_4_0_518);
return false;
}
Expand All @@ -143,9 +129,7 @@ extern "C" {
return true;
}


bool NVSEPlugin_Load(const NVSEInterface* nvse)
{
bool NVSEPlugin_Load(const NVSEInterface* nvse) {
((NVSEMessagingInterface*)nvse->QueryInterface(kInterface_Messaging))->RegisterListener(nvse->GetPluginHandle(), "NVSE", MessageHandler);
char filename[MAX_PATH];
GetModuleFileNameA(NULL, filename, MAX_PATH);
Expand Down Expand Up @@ -411,14 +395,12 @@ extern "C" {
HANDLE hDllHandle,
DWORD dwReason,
LPVOID lpreserved
)
{
switch (dwReason)
{
case (DLL_PROCESS_ATTACH):
JohnnyHandle = (HMODULE)hDllHandle;
DisableThreadLibraryCalls((HMODULE)hDllHandle);
break;
) {
switch (dwReason) {
case (DLL_PROCESS_ATTACH):
JohnnyHandle = (HMODULE)hDllHandle;
DisableThreadLibraryCalls((HMODULE)hDllHandle);
break;
}
return TRUE;
}
Expand Down
Loading

0 comments on commit 2b4204d

Please sign in to comment.