diff --git a/JG/JohnnyGuitarNVSE.cpp b/JG/JohnnyGuitarNVSE.cpp index 0e15f32..0bd298a 100644 --- a/JG/JohnnyGuitarNVSE.cpp +++ b/JG/JohnnyGuitarNVSE.cpp @@ -44,60 +44,52 @@ _CaptureLambdaVars CaptureLambdaVars; _UncaptureLambdaVars UncaptureLambdaVars; NiTMap** g_gameFormEditorIDsMap = reinterpret_cast**>(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 @@ -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; } @@ -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); @@ -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; } diff --git a/JG/JohnnyGuitarNVSE.h b/JG/JohnnyGuitarNVSE.h index 8f235ee..795a0dd 100644 --- a/JG/JohnnyGuitarNVSE.h +++ b/JG/JohnnyGuitarNVSE.h @@ -57,35 +57,27 @@ std::unordered_set SaveGameUMap; uintptr_t g_canSaveNowAddr = 0; uintptr_t g_canSaveNowMenuAddr = 0; -TESObjectCELL* TESObjectREFR::GetParentCell() -{ +TESObjectCELL* TESObjectREFR::GetParentCell() { if (this->parentCell) return parentCell; ExtraPersistentCell* xPersistentCell = (ExtraPersistentCell*)this->extraDataList.GetByType(kExtraData_PersistentCell); if (xPersistentCell && xPersistentCell->persistentCell) return xPersistentCell->persistentCell; return nullptr; - } -double GetVectorAngle2D(NiPoint3* pt) -{ +double GetVectorAngle2D(NiPoint3* pt) { double angle; - if (pt->y == 0) - { - if (pt->x <= 0) - { + if (pt->y == 0) { + if (pt->x <= 0) { angle = kDblPIx3d2; } - else - { + else { angle = kDblPId2; } } - else - { + else { double ratio = pt->x / pt->y; angle = dAtan(ratio); - if (pt->y < 0.0) - { + if (pt->y < 0.0) { angle += kDblPI; } } @@ -93,30 +85,24 @@ double GetVectorAngle2D(NiPoint3* pt) return angle; } - -double GetAngleBetweenPoints(NiPoint3* actorPos, NiPoint3* playerPos, float offset) -{ +double GetAngleBetweenPoints(NiPoint3* actorPos, NiPoint3* playerPos, float offset) { NiPoint3 diff; diff.Init(actorPos); diff.Subtract(playerPos); double angle = GetVectorAngle2D(&diff) - offset; - if (angle > -kDblPI) - { - if (angle > kDblPI) - { + if (angle > -kDblPI) { + if (angle > kDblPI) { angle = kDblPIx2 - angle; } } - else - { + else { angle += kDblPIx2; } return angle * 57.295779513; } -ContChangesEntry* ExtraContainerChanges::EntryDataList::FindForItem(TESForm* item) -{ +ContChangesEntry* ExtraContainerChanges::EntryDataList::FindForItem(TESForm* item) { ListNode* iter = this->Head(); do { @@ -126,8 +112,7 @@ ContChangesEntry* ExtraContainerChanges::EntryDataList::FindForItem(TESForm* ite return nullptr; } -float __declspec(naked) __fastcall NiNodeComputeDistance(NiVector3* Vector1, NiVector3* Vector2) -{ +float __declspec(naked) __fastcall NiNodeComputeDistance(NiVector3* Vector1, NiVector3* Vector2) { __asm { movd xmm0, [ecx] @@ -149,31 +134,26 @@ float __declspec(naked) __fastcall NiNodeComputeDistance(NiVector3* Vector1, NiV ret } } -NiNode* NiNode::GetNode(const char* nodeName) -{ +NiNode* NiNode::GetNode(const char* nodeName) { NiAVObject* found = GetBlock(nodeName); return found ? found->GetNiNode() : NULL; } -__forceinline void NiPointAssign(NiPoint3* NiPointBuffer, float& xIn, float& yIn, float& zIn) -{ +__forceinline void NiPointAssign(NiPoint3* NiPointBuffer, float& xIn, float& yIn, float& zIn) { NiPointBuffer->x = xIn; NiPointBuffer->y = yIn; NiPointBuffer->z = zIn; } -UInt8 TESForm::GetOverridingModIdx() -{ +UInt8 TESForm::GetOverridingModIdx() { return mods.GetLastItem() ? mods.GetLastItem()->modIndex : 0xFF; } -NiAVObject* NiNode::GetBlock(const char* blockName) -{ +NiAVObject* NiNode::GetBlock(const char* blockName) { if (StrEqualCI(m_blockName, blockName)) return this; NiAVObject* found = NULL; - for (NiTArray::Iterator iter(m_children); !iter.End(); ++iter) - { + for (NiTArray::Iterator iter(m_children); !iter.End(); ++iter) { if (!*iter) continue; if (iter->GetNiNode()) found = ((NiNode*)*iter)->GetBlock(blockName); @@ -185,8 +165,7 @@ NiAVObject* NiNode::GetBlock(const char* blockName) return found; } -static void PatchMemoryNop(ULONG_PTR Address, SIZE_T Size) -{ +static void PatchMemoryNop(ULONG_PTR Address, SIZE_T Size) { DWORD d = 0; VirtualProtect((LPVOID)Address, Size, PAGE_EXECUTE_READWRITE, &d); @@ -198,33 +177,24 @@ static void PatchMemoryNop(ULONG_PTR Address, SIZE_T Size) FlushInstructionCache(GetCurrentProcess(), (LPVOID)Address, Size); } -bool __fastcall CanSaveNowHook(void* ThisObj, void* edx, int isAutoSave) -{ +bool __fastcall CanSaveNowHook(void* ThisObj, void* edx, int isAutoSave) { return ThisStdCall_B(g_canSaveNowAddr, ThisObj, isAutoSave) && SaveGameUMap.empty(); } -bool __fastcall CanSaveNowMenuHook(void* ThisObj, void* edx, int isAutoSave) -{ +bool __fastcall CanSaveNowMenuHook(void* ThisObj, void* edx, int isAutoSave) { return ThisStdCall_B(g_canSaveNowMenuAddr, ThisObj, isAutoSave) && SaveGameUMap.empty(); } -void __fastcall BipedModelUpdateWeapon(ValidBip01Names* BipedAnim, Character* fnCharacter, TESObjectWEAP* weap, int weapMods) -{ - - if (fnCharacter && fnCharacter->baseProcess) - { - if (auto weapInfo = fnCharacter->baseProcess->GetWeaponInfo()) - { +void __fastcall BipedModelUpdateWeapon(ValidBip01Names* BipedAnim, Character* fnCharacter, TESObjectWEAP* weap, int weapMods) { + if (fnCharacter && fnCharacter->baseProcess) { + if (auto weapInfo = fnCharacter->baseProcess->GetWeaponInfo()) { weapMods = ContChangesEntry_GetWeaponModFlags(weapInfo); - } - } OriginalBipedModelUpdateWeapon(BipedAnim, weap, weapMods); } -__declspec (naked) void BipedModelUpdateWeaponHook() -{ +__declspec (naked) void BipedModelUpdateWeaponHook() { __asm { mov edx, dword ptr[ebp + 0x8] @@ -234,24 +204,19 @@ __declspec (naked) void BipedModelUpdateWeaponHook() bool(__thiscall* GetPlayerInCombat)(Actor*, bool& IsNotDetected) = (bool(__thiscall*)(Actor*, bool&)) 0x0953C50; - -bool __fastcall FleeFixHook(PlayerCharacter* Player, void* unused, bool& IsHidden) -{ +bool __fastcall FleeFixHook(PlayerCharacter* Player, void* unused, bool& IsHidden) { return (GetPlayerInCombat(Player, IsHidden) && !IsHidden); } char** DefaultMarkers = (char**)0x11A0404; -char* __fastcall hk_GetMapMarker(TESObjectREFR* thisObj, UInt16 MapMarkerType) -{ - +char* __fastcall hk_GetMapMarker(TESObjectREFR* thisObj, UInt16 MapMarkerType) { auto it = markerIconMap.find(thisObj->refID); if (it != markerIconMap.end()) return it->second; return DefaultMarkers[MapMarkerType]; } -__declspec (naked) void AsmGetMapMarkerRoute() -{ +__declspec (naked) void AsmGetMapMarkerRoute() { //UInt32 static const retAddr = 0x079D337; __asm { @@ -261,8 +226,7 @@ __declspec (naked) void AsmGetMapMarkerRoute() } } -void __fastcall DisableMuzzleFlashLightsHook(ProjectileData* a1) -{ +void __fastcall DisableMuzzleFlashLightsHook(ProjectileData* a1) { if (*&a1->muzzleFlash && a1->projectile->lightMuzzleFlash) { if (!disableMuzzleLights || (disableMuzzleLights == 2 && a1->sourceActor != (Actor*)g_thePlayer) || (disableMuzzleLights == 3 && a1->sourceActor == (Actor*)g_thePlayer)) { NiNode* niNode = ThisStdCall(0x50D810, a1->projectile->lightMuzzleFlash, 0, *&a1->muzzleFlash, 1); @@ -270,25 +234,20 @@ void __fastcall DisableMuzzleFlashLightsHook(ProjectileData* a1) } } } -void SetCustomMapMarker(TESObjectREFR* marker, char* iconPath) -{ - +void SetCustomMapMarker(TESObjectREFR* marker, char* iconPath) { auto pos = markerIconMap.find(marker->refID); char* pathCopy = new char[strlen(iconPath) + 1]; strcpy(pathCopy, iconPath); - if (pos != markerIconMap.end()) - { + if (pos != markerIconMap.end()) { delete[] pos->second; pos->second = pathCopy; } - else - { + else { markerIconMap.insert({ marker->refID, pathCopy }); } } - _declspec(naked) void LevelUpHook() { static const UInt32 noShowAddr = 0x77D903; static const UInt32 showAddr = 0x77D618; @@ -302,7 +261,6 @@ _declspec(naked) void LevelUpHook() { } } - TESForm* __fastcall GetAmmoInInventory(TESObjectWEAP* weap) { if (weap->ammo.ammo) { if (IS_TYPE(weap->ammo.ammo, BGSListForm)) { @@ -330,10 +288,7 @@ __declspec(naked) void InventoryAmmoHook() { } } - - -__declspec(naked) void OnCloseContainerHook() -{ +__declspec(naked) void OnCloseContainerHook() { static const UInt32 retnAddr = 0x75B240; __asm { @@ -352,8 +307,7 @@ __declspec(naked) void OnCloseContainerHook() } } -void patchFixDisintegrationsStat() -{ +void patchFixDisintegrationsStat() { // check if user has Unnecessary Tweaks or lStewieAl's Tweaks installed if (*(UInt8*)0x8A1B4D == 0xE9 || *(UInt8*)0x8A1B51 == 0x26) return; // critical stage 1, jump to checks for IncPCMiscStat @@ -366,7 +320,6 @@ void patchFixDisintegrationsStat() SafeWriteBuf(0x8A1B6E, "\x82\xC0\x01\x00\x00\xFF\xD0\xEB\x53\x90", 10); } - float* __fastcall VATSSpreadMultHook(void* ecx) { return &vatsSpreadMultValue; } @@ -428,37 +381,32 @@ void __fastcall PlayQuestFailSound(Sound* sound, int dummy) { ListNode* iter = g_questUpdateManager->Head(); do { switch (iter->data->updateType) { - case QuestAdded: - if (questNewSound != nullptr) sound = &Sound(questNewSound->refID, 0x121); - break; - case QuestCompleted: - if (questCompeteSound != nullptr) sound = &Sound(questCompeteSound->refID, 0x121); - break; - case QuestFailed: - if (questFailSound != nullptr) sound = &Sound(questFailSound->refID, 0x121); - break; - case LocationDiscovered: - if (locationDiscoverSound != nullptr) sound = &Sound(locationDiscoverSound->refID, 0x121); - break; + case QuestAdded: + if (questNewSound != nullptr) sound = &Sound(questNewSound->refID, 0x121); + break; + case QuestCompleted: + if (questCompeteSound != nullptr) sound = &Sound(questCompeteSound->refID, 0x121); + break; + case QuestFailed: + if (questFailSound != nullptr) sound = &Sound(questFailSound->refID, 0x121); + break; + case LocationDiscovered: + if (locationDiscoverSound != nullptr) sound = &Sound(locationDiscoverSound->refID, 0x121); + break; } sound->Play(); } while (iter = iter->next); } } - - -void ResetVanityWheel() -{ +void ResetVanityWheel() { float* VanityWheel = (float*)0x11E0B5C; float* MaxChaseCam = (ThisStdCall((uintptr_t)0x0403E20, (void*)0x11CD568)); if (*MaxChaseCam < *VanityWheel) *VanityWheel = *MaxChaseCam; } - -__declspec (naked) void hk_VanityModeBug() -{ +__declspec (naked) void hk_VanityModeBug() { static uintptr_t jmpDest = 0x942D43; static uintptr_t getGS = 0x403E20; __asm @@ -467,7 +415,6 @@ __declspec (naked) void hk_VanityModeBug() call ResetVanityWheel jmp jmpDest } - } bool __fastcall ShouldPlayCombatMusic(UInt32* a1) { if (bCombatMusicDisabled) return false; @@ -477,8 +424,7 @@ TESRegionDataMap* GetMapData(TESRegion* region) { if (region->dataEntries->Empty()) return nullptr; ListNode* iter = region->dataEntries->Head(); TESRegionData* regData; - do - { + do { regData = iter->data; if ((*(UInt32*)regData == 0x1023D28)) return (TESRegionDataMap*)regData; @@ -490,8 +436,7 @@ TESRegionDataWeather* GetWeatherData(TESRegion* region) { if (region->dataEntries->Empty()) return nullptr; ListNode* iter = region->dataEntries->Head(); TESRegionData* regData; - do - { + do { regData = iter->data; if ((*(UInt32*)regData == 0x1023E18)) return (TESRegionDataWeather*)regData; @@ -507,11 +452,9 @@ void __fastcall DropItemHook(PlayerCharacter* a1, void* edx, TESForm* a2, BaseEx ThisStdCall(0x954610, a1, a2, a3, itemCount, a5, a6); } -void __fastcall TESRegionDataSoundLoadIncidentalID(ModInfo* info, void* edx, UInt32* refID) -{ +void __fastcall TESRegionDataSoundLoadIncidentalID(ModInfo* info, void* edx, UInt32* refID) { ThisStdCall(0x4727F0, info, refID); - if (*refID) - { + if (*refID) { CdeclCall(0x485D50, refID, info); } } @@ -521,11 +464,10 @@ float __fastcall FixDeathSounds(HighProcess* thisObj, Actor* actor) { bool isTalking = !(actor->unk80 & 1); if (isTalking && (dyingTimer <= FLT_EPSILON)) { dyingTimer = FLT_EPSILON; } return dyingTimer; - } __declspec (naked) void FixDeathSoundsHook() { __asm { - mov edx, dword ptr [ebp+8] + mov edx, dword ptr[ebp + 8] jmp FixDeathSounds } } @@ -552,7 +494,7 @@ char* __fastcall GetReputationIconHook(TESReputation* rep) { } return ThisStdCall(0x6167D0, rep); } -Setting*__fastcall GetINISettingHook(IniSettingCollection* ini, void* edx, char* name) { +Setting* __fastcall GetINISettingHook(IniSettingCollection* ini, void* edx, char* name) { Setting* result = ThisStdCall(0x5E02B0, ini, name); if (result) return result; IniSettingCollection* rendererSettings = *(IniSettingCollection**)0x11F35A4; @@ -563,7 +505,6 @@ Setting*__fastcall GetINISettingHook(IniSettingCollection* ini, void* edx, char* } while (iter = iter->next); } return nullptr; - } bool __fastcall MenuGetFlagHook(StartMenu* menu, UInt32 flags) { return menu != nullptr ? ((flags & menu->flags) != 0) : false; @@ -578,12 +519,11 @@ void __fastcall MenuSetFlagHook(StartMenu* menu, UInt32 flags, bool doSet) { } } } -void HandleGameHooks() -{ +void HandleGameHooks() { // FIXES - + // use available ammo in inventory instead of NULL when default ammo isn't present - WriteRelJump(0x70809E, (UInt32)InventoryAmmoHook); + WriteRelJump(0x70809E, (UInt32)InventoryAmmoHook); // fix for companions not saying the next topic after opening ContainerMenu through dialog SafeWrite32(0x10721AC, (UInt32)OnCloseContainerHook); @@ -625,7 +565,7 @@ void HandleGameHooks() WriteRelCall(0x4F49AB, UInt32(TESRegionDataSoundLoadIncidentalID)); // INI OPTIONS - + // for bReset3rdPersonCamera if (resetVanityCam) WriteRelJump(0x942D3D, (uintptr_t)hk_VanityModeBug); @@ -641,7 +581,6 @@ void HandleGameHooks() // for Runtime EDIDs if (loadEditorIDs) LoadEditorIDs(); - // for b60FPSDuringLoading if (capLoadScreensTo60)SafeWrite8(0x78D4A4, 0x10); @@ -669,10 +608,10 @@ void HandleGameHooks() WriteRelJump(0xC5244A, (UInt32)NiCameraGetAltHook); // ToggleLevelUpMenu - WriteRelJump(0x77D612, UInt32(LevelUpHook)); + WriteRelJump(0x77D612, UInt32(LevelUpHook)); // DisableMuzzleFlashLights - WriteRelCall(0x9BAFED, (UInt32)DisableMuzzleFlashLightsHook); + WriteRelCall(0x9BAFED, (UInt32)DisableMuzzleFlashLightsHook); // SetCustomMapMarkerIcon SafeWrite16(0x79D330, 0x9090); @@ -694,7 +633,6 @@ void HandleGameHooks() WriteRelCall(0x07CBDC7, (uintptr_t)CanSaveNowMenuHook); // for SetCustomReputationChangeIcon - WriteRelCall(0x6156A2, UInt32(GetReputationIconHook)); + WriteRelCall(0x6156A2, UInt32(GetReputationIconHook)); WriteRelCall(0x6156FB, UInt32(GetReputationIconHook)); - } diff --git a/JG/events/CustomEventFilters.h b/JG/events/CustomEventFilters.h index 44ae5f1..10dff09 100644 --- a/JG/events/CustomEventFilters.h +++ b/JG/events/CustomEventFilters.h @@ -1,91 +1,68 @@ #pragma once -class JohnnyEventFiltersOneFormOneInt : EventHandlerInterface -{ - - +class JohnnyEventFiltersOneFormOneInt : EventHandlerInterface { typedef std::unordered_set RefUnorderedSet; private: RefUnorderedSet* Filters = 0; - RefUnorderedSet* GetFilter(UInt32 filter) - { + RefUnorderedSet* GetFilter(UInt32 filter) { if (filter >= numFilters) return NULL; return &(Filters[filter]); } public: - - JohnnyEventFiltersOneFormOneInt(void** filters, UInt32 nuFilters) - { - + JohnnyEventFiltersOneFormOneInt(void** filters, UInt32 nuFilters) { numFilters = nuFilters; Filters = new RefUnorderedSet[numFilters]; GenFilters = new GenericFilters[numFilters]; for (int i = 0; i < nuFilters; i++) GenFilters[i].ptr = filters[i]; - } - virtual ~JohnnyEventFiltersOneFormOneInt() - { + virtual ~JohnnyEventFiltersOneFormOneInt() { delete[] Filters; delete[] GenFilters; } - virtual bool IsInFilter(UInt32 filterNum, GenericFilters toSearch) - { + virtual bool IsInFilter(UInt32 filterNum, GenericFilters toSearch) { RefUnorderedSet* FilterSet; if (!(FilterSet = GetFilter(filterNum))) return false; return FilterSet->empty() || (FilterSet->find(toSearch.refID) != FilterSet->end()); } - - virtual void InsertToFilter(UInt32 filterNum, GenericFilters toInsert) - { + virtual void InsertToFilter(UInt32 filterNum, GenericFilters toInsert) { RefUnorderedSet* FilterSet; if (!(FilterSet = GetFilter(filterNum))) return; FilterSet->insert(toInsert.refID); } - virtual void DeleteFromFilter(UInt32 filterNum, GenericFilters toDelete) - { + virtual void DeleteFromFilter(UInt32 filterNum, GenericFilters toDelete) { RefUnorderedSet* FilterSet; if (!(FilterSet = GetFilter(filterNum))) return; FilterSet->erase(toDelete.refID); - } - virtual bool IsFilterEmpty(UInt32 filterNum) - { + virtual bool IsFilterEmpty(UInt32 filterNum) { RefUnorderedSet* FilterSet = GetFilter(filterNum); if (!FilterSet) return true; return FilterSet->empty(); } - virtual bool IsFilterEqual(GenericFilters Filter, UInt32 nuFilter) - { + virtual bool IsFilterEqual(GenericFilters Filter, UInt32 nuFilter) { return (Filter.ptr == GenFilters[nuFilter].ptr); } - virtual bool IsAcceptedParameter(GenericFilters parameter) - { + virtual bool IsAcceptedParameter(GenericFilters parameter) { return parameter.form->refID != 0x3B; // xMarker - } - virtual void SetUpFiltering() - { + virtual void SetUpFiltering() { if (GenFilters[1].intVal != -1) InsertToFilter(1, GenFilters[1].intVal); TESForm* currentFilter = GenFilters[0].form; if (!currentFilter) return; - if (IS_TYPE(currentFilter, BGSListForm)) - { + if (IS_TYPE(currentFilter, BGSListForm)) { ListNode* iterator = ((BGSListForm*)currentFilter)->list.Head(); do { TESForm* it = iterator->data; if (IsAcceptedParameter(it)) InsertToFilter(0, it->refID); } while (iterator = iterator->next); - } else if (IsAcceptedParameter(currentFilter)) InsertToFilter(0, currentFilter->refID); - } - }; void* __fastcall CreateOneFormOneIntFilter(void** Filters, UInt32 numFilters) { return new JohnnyEventFiltersOneFormOneInt(Filters, numFilters); diff --git a/JG/events/EventFilteringInterface.h b/JG/events/EventFilteringInterface.h index b31d833..f5dbc47 100644 --- a/JG/events/EventFilteringInterface.h +++ b/JG/events/EventFilteringInterface.h @@ -1,46 +1,36 @@ #pragma once -union GenericFilters -{ +union GenericFilters { void* ptr; TESForm* form; UInt32 refID; int intVal; float fltVal; char* str; - GenericFilters() - { + GenericFilters() { this->ptr = NULL; } - GenericFilters(void* ptr) - { + GenericFilters(void* ptr) { this->ptr = ptr; } - GenericFilters(TESForm* form) - { + GenericFilters(TESForm* form) { this->form = form; } - GenericFilters(UInt32 refID) - { + GenericFilters(UInt32 refID) { this->refID = refID; } - GenericFilters(int intVal) - { + GenericFilters(int intVal) { this->intVal = intVal; } - GenericFilters(float fltVal) - { + GenericFilters(float fltVal) { this->fltVal = fltVal; } - GenericFilters(char* str) - { + GenericFilters(char* str) { this->str = str; } - }; -class EventHandlerInterface -{ +class EventHandlerInterface { public: //Framework passes the objects to add to filter here GenericFilters* GenFilters = 0; @@ -65,43 +55,34 @@ class EventHandlerInterface //Function used by the filter to check if the object passed is an accepted parameter virtual bool IsAcceptedParameter(GenericFilters toCheck) = 0; virtual UInt32 GetNumFilters() { return numFilters; } - }; - -class EventContainerInterface -{ +class EventContainerInterface { public: void virtual RegisterEvent(Script* script, void** filters); void virtual RemoveEvent(Script* script, void** filters); }; - EventContainerInterface* (_cdecl* CreateScriptEvent)(const char* EventName, UInt8 maxArgs, UInt8 maxFilters, void* (__fastcall* CustomConstructor)(void**, UInt32)); void(__cdecl* FreeScriptEvent)(EventContainerInterface*& toRemove); -class BaseEventClass -{ +class BaseEventClass { public: ULONG_PTR Flags = 0; Script* ScriptForEvent = NULL; EventHandlerInterface* eventFilter = NULL; LambdaVariableContext capturedLambdaVars; - BaseEventClass() : capturedLambdaVars(nullptr){} + BaseEventClass() : capturedLambdaVars(nullptr) {} - enum GlobalEventFlags - { + enum GlobalEventFlags { kEventFlag_Deleted = 1 << 0, }; - bool GetDeleted() - { + bool GetDeleted() { return Flags & kEventFlag_Deleted; } - void SetDeleted(bool doSet) - { - + void SetDeleted(bool doSet) { doSet ? Flags |= kEventFlag_Deleted : Flags &= ~kEventFlag_Deleted; } }; diff --git a/JG/events/JohnnyEventPredefinitions.h b/JG/events/JohnnyEventPredefinitions.h index ebe7eac..0c00c48 100644 --- a/JG/events/JohnnyEventPredefinitions.h +++ b/JG/events/JohnnyEventPredefinitions.h @@ -7,86 +7,67 @@ NVSEArrayElement EventResultPtr; class EventInformation; void* __fastcall GenericCreateFilter(void** maxFilters, UInt32 numFilters); -class JohnnyEventFiltersForm : EventHandlerInterface -{ +class JohnnyEventFiltersForm : EventHandlerInterface { typedef std::unordered_set RefUnorderedSet; private: RefUnorderedSet* Filters = 0; - RefUnorderedSet* GetFilter(UInt32 filter) - { + RefUnorderedSet* GetFilter(UInt32 filter) { if (filter >= numFilters) return NULL; return &(Filters[filter]); } public: - JohnnyEventFiltersForm(void** filters, UInt32 nuFilters) - { + JohnnyEventFiltersForm(void** filters, UInt32 nuFilters) { numFilters = nuFilters; Filters = new RefUnorderedSet[numFilters]; GenFilters = new GenericFilters[numFilters]; for (int i = 0; i < nuFilters; i++) GenFilters[i].ptr = filters[i]; - } - virtual ~JohnnyEventFiltersForm() - { + virtual ~JohnnyEventFiltersForm() { delete[] Filters; delete[] GenFilters; } - virtual bool IsInFilter(UInt32 filterNum, GenericFilters toSearch) - { + virtual bool IsInFilter(UInt32 filterNum, GenericFilters toSearch) { RefUnorderedSet* FilterSet; if (!(FilterSet = GetFilter(filterNum))) return false; //RefUnorderedSet::const_iterator got = FilterSet->find(toSearch); return FilterSet->empty() || (FilterSet->find(toSearch.refID) != FilterSet->end()); } - - virtual void InsertToFilter(UInt32 filterNum, GenericFilters toInsert) - { + virtual void InsertToFilter(UInt32 filterNum, GenericFilters toInsert) { RefUnorderedSet* FilterSet; if (!(FilterSet = GetFilter(filterNum))) return; FilterSet->insert(toInsert.refID); } - virtual void DeleteFromFilter(UInt32 filterNum, GenericFilters toDelete) - { + virtual void DeleteFromFilter(UInt32 filterNum, GenericFilters toDelete) { RefUnorderedSet* FilterSet; if (!(FilterSet = GetFilter(filterNum))) return; FilterSet->erase(toDelete.refID); - } - virtual bool IsFilterEmpty(UInt32 filterNum) - { + virtual bool IsFilterEmpty(UInt32 filterNum) { RefUnorderedSet* FilterSet = GetFilter(filterNum); if (!FilterSet) return true; return FilterSet->empty(); } - virtual bool IsFilterEqual(GenericFilters Filter, UInt32 nuFilter) - { + virtual bool IsFilterEqual(GenericFilters Filter, UInt32 nuFilter) { return (Filter.ptr == GenFilters[nuFilter].ptr); } - virtual bool IsAcceptedParameter(GenericFilters parameter) - { - + virtual bool IsAcceptedParameter(GenericFilters parameter) { return parameter.form->typeID != kFormType_TESObjectSTAT; - } - virtual void SetUpFiltering() - { - for (int i = 0; i < numFilters; i++) - { + virtual void SetUpFiltering() { + for (int i = 0; i < numFilters; i++) { TESForm* currentFilter = GenFilters[i].form; if (!currentFilter) continue; if (!(IsAcceptedParameter(currentFilter))) continue; - if (currentFilter->GetIsReference()) - { + if (currentFilter->GetIsReference()) { InsertToFilter(i, ((TESObjectREFR*)currentFilter)->baseForm->refID); continue; } - if (IS_TYPE(currentFilter, BGSListForm)) - { + if (IS_TYPE(currentFilter, BGSListForm)) { //Console_Print("filter looping"); ListNode* iterator = ((BGSListForm*)currentFilter)->list.Head(); do { @@ -95,21 +76,18 @@ class JohnnyEventFiltersForm : EventHandlerInterface if (IsAcceptedParameter(it)) InsertToFilter(i, it->refID); } while (iterator = iterator->next); - } else InsertToFilter(i, currentFilter->refID); } } - __forceinline bool IsBaseInFilter(UInt32 filterNum, TESForm* form) - { + __forceinline bool IsBaseInFilter(UInt32 filterNum, TESForm* form) { if (!form) return false; if (form->GetIsReference()) return IsInFilter(filterNum, ((TESObjectREFR*)form)->baseForm->refID); return IsInFilter(filterNum, form->refID); } - void insertFormList(BGSListForm* List, UInt32 filter) - { + void insertFormList(BGSListForm* List, UInt32 filter) { ListNode* iterator = ((BGSListForm*)List)->list.Head(); do { InsertToFilter(filter, iterator->data->refID); @@ -117,8 +95,7 @@ class JohnnyEventFiltersForm : EventHandlerInterface } }; -class EventInformation -{ +class EventInformation { private: void* (__fastcall* CreateFilter)(void**, UInt32); // supposed to be passing itself std::vector EventQueueAdd; @@ -128,116 +105,86 @@ class EventInformation UInt8 numMaxArgs; UInt8 numMaxFilters; std::vector EventCallbacks; - EventInformation(const char* EventName, UInt8& numMaxArgs, UInt8& numMaxFilters, void* (__fastcall* CreatorFunction)(void**, UInt32)) - { + EventInformation(const char* EventName, UInt8& numMaxArgs, UInt8& numMaxFilters, void* (__fastcall* CreatorFunction)(void**, UInt32)) { this->EventName = EventName; this->numMaxArgs = numMaxArgs; this->numMaxFilters = numMaxFilters; this->CreateFilter = GenericCreateFilter; if (CreatorFunction) this->CreateFilter = CreatorFunction; } - virtual ~EventInformation() - { + virtual ~EventInformation() { FlushEventCallbacks(); } - void FlushEventCallbacks() - { + void FlushEventCallbacks() { auto it = EventCallbacks.begin(); - while (it != EventCallbacks.end()) - { + while (it != EventCallbacks.end()) { delete it->eventFilter; ++it; } EventCallbacks.clear(); } - - void virtual RegisterEvent(Script* script, void** filters) - { + void virtual RegisterEvent(Script* script, void** filters) { UInt32 maxFilters = this->numMaxFilters; - for (std::vector::iterator it = this->EventCallbacks.begin(); it != this->EventCallbacks.end(); ++it) - { - if (script == it->ScriptForEvent) - { + for (std::vector::iterator it = this->EventCallbacks.begin(); it != this->EventCallbacks.end(); ++it) { + if (script == it->ScriptForEvent) { if (!maxFilters) return; if (!it->eventFilter->GetNumFilters()) continue; int i = 0; // filter iterator - for (; i < maxFilters; i++) - { + for (; i < maxFilters; i++) { if (!(it->eventFilter->IsFilterEqual(filters[i], i))) break; } if (i >= maxFilters) return; } - } std::shared_lock rLock(QueueRWLock); - for (std::vector::iterator it = this->EventQueueAdd.begin(); it != this->EventQueueAdd.end(); ++it) - { - - if (script == it->ScriptForEvent) - { + for (std::vector::iterator it = this->EventQueueAdd.begin(); it != this->EventQueueAdd.end(); ++it) { + if (script == it->ScriptForEvent) { if (!maxFilters) return; if (!it->eventFilter->GetNumFilters()) continue; int i = 0; // filter iterator - for (; i < maxFilters; i++) - { + for (; i < maxFilters; i++) { if (!(it->eventFilter->IsFilterEqual(filters[i], i))) break; } if (i >= maxFilters) return; } - } rLock.unlock(); BaseEventClass NewEvent; NewEvent.ScriptForEvent = script; NewEvent.capturedLambdaVars = LambdaVariableContext(script); - if (maxFilters) - { - + if (maxFilters) { *(void**)&(NewEvent.eventFilter) = this->CreateFilter(filters, maxFilters); NewEvent.eventFilter->SetUpFiltering(); } std::unique_lock wLock(QueueRWLock); this->EventQueueAdd.push_back(std::move(NewEvent)); } - void virtual RemoveEvent(Script* script, void** filters) - { + void virtual RemoveEvent(Script* script, void** filters) { auto it = EventCallbacks.begin(); - while (it != EventCallbacks.end()) - { - if (script == it->ScriptForEvent) - { - if (auto eventFilters = it->eventFilter) - { + while (it != EventCallbacks.end()) { + if (script == it->ScriptForEvent) { + if (auto eventFilters = it->eventFilter) { UInt32 maxFilters = eventFilters->GetNumFilters(); - for (int i = 0; i < maxFilters; i++) - { + for (int i = 0; i < maxFilters; i++) { if (!(it->eventFilter->IsFilterEqual(filters[i], i))) goto NotFound; - } } it->SetDeleted(true); } NotFound: it++; - } } - void virtual AddQueuedEvents() - { + void virtual AddQueuedEvents() { EventCallbacks.insert(EventCallbacks.end(), std::make_move_iterator(EventQueueAdd.begin()), std::make_move_iterator(EventQueueAdd.end())); EventQueueAdd.clear(); } - void virtual DeleteEvents() - { + void virtual DeleteEvents() { auto it = EventCallbacks.begin(); - while (it != EventCallbacks.end()) - { - if (it->GetDeleted()) - { - - if (it->eventFilter) - { + while (it != EventCallbacks.end()) { + if (it->GetDeleted()) { + if (it->eventFilter) { delete it->eventFilter; } @@ -245,7 +192,6 @@ class EventInformation continue; } it++; - } } int a = sizeof(std::unordered_set); @@ -254,19 +200,13 @@ typedef EventInformation* EventInfo; std::mutex EventsArrayMutex; std::vector EventsArray; - - void* __fastcall GenericCreateFilter(void** Filters, UInt32 numFilters) { return new JohnnyEventFiltersForm(Filters, numFilters); } - - -EventInfo FindHandlerInfoByChar(const char* nameToFind) -{ +EventInfo FindHandlerInfoByChar(const char* nameToFind) { auto it = EventsArray.begin(); - while (it != EventsArray.end()) - { + while (it != EventsArray.end()) { if (!(_stricmp((*it)->EventName, nameToFind))) return *it; it++; @@ -274,23 +214,18 @@ EventInfo FindHandlerInfoByChar(const char* nameToFind) return NULL; } -EventInfo __cdecl JGCreateEvent(const char* EventName, UInt8 maxArgs, UInt8 maxFilters, void* (__fastcall* CreatorFunction)(void**, UInt32)) -{ +EventInfo __cdecl JGCreateEvent(const char* EventName, UInt8 maxArgs, UInt8 maxFilters, void* (__fastcall* CreatorFunction)(void**, UInt32)) { std::lock_guard lock(EventsArrayMutex); EventInfo eventinfo = new EventInformation(EventName, maxArgs, maxFilters, CreatorFunction); EventsArray.push_back(eventinfo); return eventinfo; - } - -void __cdecl JGFreeEvent(EventInfo& toRemove) -{ +void __cdecl JGFreeEvent(EventInfo& toRemove) { std::lock_guard lock(EventsArrayMutex); if (!toRemove) return; auto it = std::find(std::begin(EventsArray), std::end(EventsArray), toRemove); - if (it != EventsArray.end()) - { + if (it != EventsArray.end()) { delete* it; it = EventsArray.erase(it); } diff --git a/JG/events/JohnnyEvents.h b/JG/events/JohnnyEvents.h index f8b7fcf..06aacc0 100644 --- a/JG/events/JohnnyEvents.h +++ b/JG/events/JohnnyEvents.h @@ -32,33 +32,25 @@ EventInformation* OnAVChangeHandler; UInt32 handlePreRenderEvent() { for (auto const& callback : OnRenderGamePreUpdateHandler->EventCallbacks) { - CallUDF(callback.ScriptForEvent, NULL, OnRenderGamePreUpdateHandler->numMaxArgs); - } return CdeclCall(0x7050D0); } -void __fastcall handleRemovePerkEvent(Actor* actor, int EDX, BGSPerk* perk, bool isTeammatePerk) -{ +void __fastcall handleRemovePerkEvent(Actor* actor, int EDX, BGSPerk* perk, bool isTeammatePerk) { if (!actor->GetPerkRank(perk, isTeammatePerk)) return; - for (auto const& callback : OnRemovePerkHandler->EventCallbacks) - { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, perk)) - { + for (auto const& callback : OnRemovePerkHandler->EventCallbacks) { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, perk)) { CallUDF(callback.ScriptForEvent, actor, OnRemovePerkHandler->numMaxArgs, perk); } } actor->RemovePerk(perk, isTeammatePerk); } -void __fastcall handleAddPerkEvent(Actor* actor, int EDX, BGSPerk* perk, UInt8 newRank, bool isTeammatePerk) -{ - for (auto const& callback : OnAddPerkHandler->EventCallbacks) - { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, perk)) - { +void __fastcall handleAddPerkEvent(Actor* actor, int EDX, BGSPerk* perk, UInt8 newRank, bool isTeammatePerk) { + for (auto const& callback : OnAddPerkHandler->EventCallbacks) { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, perk)) { CallUDF(callback.ScriptForEvent, actor, OnAddPerkHandler->numMaxArgs, perk, newRank - 1, newRank); } } @@ -68,8 +60,7 @@ void __fastcall handleAddPerkEvent(Actor* actor, int EDX, BGSPerk* perk, UInt8 n void __stdcall handleDyingEvent(Actor* thisObj) { if (thisObj->IsActor() && thisObj->lifeState == 1 && (*thisObj->GetTheName() || thisObj == g_thePlayer)) { for (auto const& callback : OnDyingHandler->EventCallbacks) { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, thisObj)) - { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, thisObj)) { CallUDF(callback.ScriptForEvent, NULL, OnDyingHandler->numMaxArgs, thisObj); } } @@ -79,8 +70,7 @@ UInt32 __fastcall handleCrosshairEvent(TESObjectREFR* crosshairRef) { if (crosshairRef) { for (auto const& callback : OnCrosshairHandler->EventCallbacks) { JohnnyEventFiltersOneFormOneInt* filter = reinterpret_cast(callback.eventFilter); - if ((filter->IsInFilter(0, crosshairRef->refID) || filter->IsInFilter(0, crosshairRef->baseForm->refID)) && filter->IsInFilter(1, crosshairRef->baseForm->typeID)) - { + if ((filter->IsInFilter(0, crosshairRef->refID) || filter->IsInFilter(0, crosshairRef->baseForm->refID)) && filter->IsInFilter(1, crosshairRef->baseForm->typeID)) { CallUDF(callback.ScriptForEvent, NULL, OnCrosshairHandler->numMaxArgs, crosshairRef); } } @@ -90,8 +80,7 @@ UInt32 __fastcall handleCrosshairEvent(TESObjectREFR* crosshairRef) { bool __fastcall HandleLimbGoneEvent(ExtraDismemberedLimbs* xData, Actor* actor, byte dummy, int limb, byte isExplode) { for (auto const& callback : OnLimbGoneHandler->EventCallbacks) { if (reinterpret_cast(callback.eventFilter)->IsInFilter(0, actor->refID) && - reinterpret_cast(callback.eventFilter)->IsInFilter(1, limb)) - { + reinterpret_cast(callback.eventFilter)->IsInFilter(1, limb)) { CallUDF(callback.ScriptForEvent, NULL, OnLimbGoneHandler->numMaxArgs, actor, limb); } } @@ -99,18 +88,16 @@ bool __fastcall HandleLimbGoneEvent(ExtraDismemberedLimbs* xData, Actor* actor, } void __fastcall handleQuestStartStop(TESQuest* Quest, bool IsStarted) { EventInformation* thisEvent = IsStarted ? OnStartQuestHandler : OnStopQuestHandler; - for (auto const& callback : thisEvent->EventCallbacks) { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, Quest)) - { - CallUDF(callback.ScriptForEvent, NULL, thisEvent->numMaxArgs, Quest); - } + for (auto const& callback : thisEvent->EventCallbacks) { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, Quest)) { + CallUDF(callback.ScriptForEvent, NULL, thisEvent->numMaxArgs, Quest); } + } } void __cdecl handleQuestComplete(TESQuest* Quest) { for (auto const& callback : OnCompleteQuestHandler->EventCallbacks) { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, Quest)) - { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, Quest)) { CallUDF(callback.ScriptForEvent, NULL, OnCompleteQuestHandler->numMaxArgs, Quest); } } @@ -119,8 +106,7 @@ void __cdecl handleQuestComplete(TESQuest* Quest) { void __cdecl handleQuestFail(TESQuest* Quest) { for (auto const& callback : OnFailQuestHandler->EventCallbacks) { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, Quest)) - { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, Quest)) { CallUDF(callback.ScriptForEvent, NULL, OnFailQuestHandler->numMaxArgs, Quest); } } @@ -135,8 +121,7 @@ void __cdecl handleSettingsUpdate() { } ExtraDataList* __fastcall HandleSeenDataUpdateEvent(TESObjectCELL* cell) { for (auto const& callback : OnSeenDataUpdateHandler->EventCallbacks) { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, cell)) - { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, cell)) { CallUDF(callback.ScriptForEvent, NULL, OnSeenDataUpdateHandler->numMaxArgs, cell); } } @@ -144,35 +129,28 @@ ExtraDataList* __fastcall HandleSeenDataUpdateEvent(TESObjectCELL* cell) { } UInt32 __fastcall HandleChallengeCompleteEvent(TESChallenge* challenge) { for (auto const& callback : OnChallengeCompleteHandler->EventCallbacks) { - if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, challenge)) - { + if (reinterpret_cast(callback.eventFilter)->IsBaseInFilter(0, challenge)) { CallUDF(callback.ScriptForEvent, NULL, OnChallengeCompleteHandler->numMaxArgs, challenge); } } return challenge->data.type; } - UInt32 __fastcall handlerRenderGameEvent(void* ECX, void* edx, int arg1, int arg2, int arg3) { for (auto const& callback : OnRenderGameModeUpdateHandler->EventCallbacks) { - - CallUDF(callback.ScriptForEvent, NULL, OnRenderGameModeUpdateHandler->numMaxArgs); - + CallUDF(callback.ScriptForEvent, NULL, OnRenderGameModeUpdateHandler->numMaxArgs); } return ThisStdCall(0x08706B0, ECX, arg1, arg2, arg3); } UInt32 __fastcall handlerRenderMenuEvent(void* ECX, void* edx, int arg1, int arg2, int arg3) { for (auto const& callback : OnRenderRenderedMenuUpdateHandler->EventCallbacks) { - CallUDF(callback.ScriptForEvent, NULL, OnRenderRenderedMenuUpdateHandler->numMaxArgs); - } return ThisStdCall(0x08706B0, ECX, arg1, arg2, arg3); } -void __stdcall HandleAVChangeEvent(int avCode, float previousVal, float modVal) -{ +void __stdcall HandleAVChangeEvent(int avCode, float previousVal, float modVal) { if (previousVal = 0.0) previousVal = g_thePlayer->avOwner.GetActorValue(avCode); float newVal = previousVal + modVal; for (auto const& callback : OnAVChangeHandler->EventCallbacks) { @@ -182,8 +160,7 @@ void __stdcall HandleAVChangeEvent(int avCode, float previousVal, float modVal) } } -__declspec(naked) void __cdecl AVChangeEventAsm(ActorValueOwner* avOwner, UInt32 avCode, float prevVal, float newVal, ActorValueOwner* attacker) -{ +__declspec(naked) void __cdecl AVChangeEventAsm(ActorValueOwner* avOwner, UInt32 avCode, float prevVal, float newVal, ActorValueOwner* attacker) { __asm { push ebp @@ -223,8 +200,7 @@ __declspec(naked) void OnCrosshairEventAsm() { jmp retnAddr } } -__declspec (naked) void OnDyingEventAsm() -{ +__declspec (naked) void OnDyingEventAsm() { static const UInt32 checkProtect = 0xEC408C; __asm { @@ -245,8 +221,7 @@ __declspec (naked) void OnDyingEventAsm() } } -__declspec (naked) void OnQuestStartStopEventAsm() -{ +__declspec (naked) void OnQuestStartStopEventAsm() { __asm { mov ecx, dword ptr[ebp - 4] @@ -257,251 +232,196 @@ __declspec (naked) void OnQuestStartStopEventAsm() ret 4 } } -bool Cmd_SetJohnnyOnLimbGoneEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnLimbGoneEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; EventFilterStructOneFormOneInt filter = { NULL, -1 }; // you always need to make a array of pointers the size of the maximum arguments in the filter, it doesn't matter if most are empty. Framework caveat. UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter.form, &filter.intID) && IS_TYPE(script, Script)) - { - if (OnLimbGoneHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter.form, &filter.intID) && IS_TYPE(script, Script)) { + if (OnLimbGoneHandler) { if (setOrRemove) OnLimbGoneHandler->RegisterEvent(script, (void**)&filter); else OnLimbGoneHandler->RemoveEvent(script, (void**)&filter); - } } return true; } -bool Cmd_SetJohnnyOnSettingsUpdateEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnSettingsUpdateEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags) && IS_TYPE(script, Script)) - { - if (OnSettingsUpdateHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags) && IS_TYPE(script, Script)) { + if (OnSettingsUpdateHandler) { if (setOrRemove) OnSettingsUpdateHandler->RegisterEvent(script, NULL); else OnSettingsUpdateHandler->RemoveEvent(script, NULL); - } } return true; } -bool Cmd_SetJohnnyOnCrosshairEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnCrosshairEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; EventFilterStructOneFormOneInt filter = { NULL, -1 }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter.form, &filter.intID) && IS_TYPE(script, Script)) - { - if (OnCrosshairHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter.form, &filter.intID) && IS_TYPE(script, Script)) { + if (OnCrosshairHandler) { if (setOrRemove) OnCrosshairHandler->RegisterEvent(script, (void**)&filter); else OnCrosshairHandler->RemoveEvent(script, (void**)&filter); - } } return true; } -bool Cmd_SetOnActorValueChangeEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetOnActorValueChangeEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; EventFilterStructOneFormOneInt filter = { g_thePlayer, -1 }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter.intID) && IS_TYPE(script, Script) && filter.intID <= kAVCode_DamageThreshold) - { - if (OnAVChangeHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter.intID) && IS_TYPE(script, Script) && filter.intID <= kAVCode_DamageThreshold) { + if (OnAVChangeHandler) { if (setOrRemove) OnAVChangeHandler->RegisterEvent(script, (void**)&filter); else OnAVChangeHandler->RemoveEvent(script, (void**)&filter); - } } return true; } -bool Cmd_SetJohnnyOnRemovePerkEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnRemovePerkEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnRemovePerkHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnRemovePerkHandler) { if (setOrRemove) OnRemovePerkHandler->RegisterEvent(script, (void**)filter); else OnRemovePerkHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnyOnAddPerkEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnAddPerkEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnAddPerkHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnAddPerkHandler) { if (setOrRemove) OnAddPerkHandler->RegisterEvent(script, (void**)filter); else OnAddPerkHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnyOnChallengeCompleteEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnChallengeCompleteEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnChallengeCompleteHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnChallengeCompleteHandler) { if (setOrRemove) OnChallengeCompleteHandler->RegisterEvent(script, (void**)filter); else OnChallengeCompleteHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnySeenDataEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnySeenDataEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; - TESForm* filter[1] = { NULL }; + TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnSeenDataUpdateHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnSeenDataUpdateHandler) { if (setOrRemove) OnSeenDataUpdateHandler->RegisterEvent(script, (void**)filter); else OnSeenDataUpdateHandler->RemoveEvent(script, (void**)filter); - } - } return true; } -bool Cmd_SetJohnnyOnDyingEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnDyingEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; - TESForm* filter[1] = { NULL }; + TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnDyingHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnDyingHandler) { if (setOrRemove) OnDyingHandler->RegisterEvent(script, (void**)filter); else OnDyingHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnyOnStartQuestEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnStartQuestEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; - TESForm* filter[1] = { NULL }; + TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnStartQuestHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnStartQuestHandler) { if (setOrRemove) OnStartQuestHandler->RegisterEvent(script, (void**)filter); else OnStartQuestHandler->RemoveEvent(script, (void**)filter); - } } return true; } - -bool Cmd_SetJohnnyOnStopQuestEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnStopQuestEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; - TESForm* filter[1] = { NULL }; + TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnStopQuestHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnStopQuestHandler) { if (setOrRemove) OnStopQuestHandler->RegisterEvent(script, (void**)filter); else OnStopQuestHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnyOnCompleteQuestEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnCompleteQuestEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnCompleteQuestHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnCompleteQuestHandler) { if (setOrRemove) OnCompleteQuestHandler->RegisterEvent(script, (void**)filter); else OnCompleteQuestHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnyOnFailQuestEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnFailQuestEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; TESForm* filter[1] = { NULL }; UInt32 flags = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) - { - if (OnFailQuestHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &filter[0]) && IS_TYPE(script, Script)) { + if (OnFailQuestHandler) { if (setOrRemove) OnFailQuestHandler->RegisterEvent(script, (void**)filter); else OnFailQuestHandler->RemoveEvent(script, (void**)filter); - } } return true; } -bool Cmd_SetJohnnyOnRenderUpdateEventHandler_Execute(COMMAND_ARGS) -{ +bool Cmd_SetJohnnyOnRenderUpdateEventHandler_Execute(COMMAND_ARGS) { UInt32 setOrRemove = 0; Script* script = NULL; UInt32 flags = 0; @@ -512,38 +432,31 @@ bool Cmd_SetJohnnyOnRenderUpdateEventHandler_Execute(COMMAND_ARGS) kDoNotFireInGameMode = 1 << 1, kUseGamePreEvent = 1 << 2, }; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &optionalFlags) && IS_TYPE(script, Script)) - { - if (!(optionalFlags & kDoNotFireInGameMode) && OnRenderGameModeUpdateHandler) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &setOrRemove, &script, &flags, &optionalFlags) && IS_TYPE(script, Script)) { + if (!(optionalFlags & kDoNotFireInGameMode) && OnRenderGameModeUpdateHandler) { if (!(optionalFlags & kUseGamePreEvent)) { if (setOrRemove) OnRenderGameModeUpdateHandler->RegisterEvent(script, NULL); else OnRenderGameModeUpdateHandler->RemoveEvent(script, NULL); } - else if (OnRenderGamePreUpdateHandler) - { + else if (OnRenderGamePreUpdateHandler) { if (setOrRemove) OnRenderGamePreUpdateHandler->RegisterEvent(script, NULL); else OnRenderGamePreUpdateHandler->RemoveEvent(script, NULL); } - } - if (!(optionalFlags & kDoNotFireInRenderMenu) && OnRenderRenderedMenuUpdateHandler) - { + if (!(optionalFlags & kDoNotFireInRenderMenu) && OnRenderRenderedMenuUpdateHandler) { if (setOrRemove) OnRenderRenderedMenuUpdateHandler->RegisterEvent(script, NULL); else OnRenderRenderedMenuUpdateHandler->RemoveEvent(script, NULL); - } } return true; } -void HandleEventHooks() -{ +void HandleEventHooks() { OnDyingHandler = JGCreateEvent("OnDying", 1, 1, NULL); OnStartQuestHandler = JGCreateEvent("OnStartQuest", 1, 1, NULL); OnStopQuestHandler = JGCreateEvent("OnStopQuest", 1, 1, NULL); @@ -581,7 +494,6 @@ void HandleEventHooks() SafeWrite8(0x60CA29, 0xCC); WriteRelJump(0x66EE50, (UINT)AVChangeEventAsm); - //testing OnRenderGamePreUpdateHandler = JGCreateEvent("OnRenderGamePreUpdateHandler", 0, 0, NULL); WriteRelCall(0x943748, (uintptr_t)handlePreRenderEvent); @@ -589,5 +501,4 @@ void HandleEventHooks() WriteRelCall(0x870244, (uintptr_t)handlerRenderGameEvent); OnRenderRenderedMenuUpdateHandler = JGCreateEvent("OnRenderRenderedMenuUpdateHandler", 0, 0, NULL); WriteRelCall(0x8702A9, (uintptr_t)handlerRenderMenuEvent); - } diff --git a/JG/events/LambdaVariableContext.cpp b/JG/events/LambdaVariableContext.cpp index 216e648..15e2525 100644 --- a/JG/events/LambdaVariableContext.cpp +++ b/JG/events/LambdaVariableContext.cpp @@ -1,18 +1,15 @@ #include "LambdaVariableContext.h" -LambdaVariableContext::LambdaVariableContext(Script* scriptLambda) : scriptLambda(scriptLambda) -{ +LambdaVariableContext::LambdaVariableContext(Script* scriptLambda) : scriptLambda(scriptLambda) { if (scriptLambda) CaptureLambdaVars(scriptLambda); } -LambdaVariableContext::LambdaVariableContext(LambdaVariableContext&& other) noexcept : scriptLambda(other.scriptLambda) -{ +LambdaVariableContext::LambdaVariableContext(LambdaVariableContext&& other) noexcept : scriptLambda(other.scriptLambda) { other.scriptLambda = nullptr; } -LambdaVariableContext& LambdaVariableContext::operator=(LambdaVariableContext&& other) noexcept -{ +LambdaVariableContext& LambdaVariableContext::operator=(LambdaVariableContext&& other) noexcept { if (this == &other) return *this; if (this->scriptLambda) @@ -22,8 +19,7 @@ LambdaVariableContext& LambdaVariableContext::operator=(LambdaVariableContext&& return *this; } -LambdaVariableContext::~LambdaVariableContext() -{ +LambdaVariableContext::~LambdaVariableContext() { if (this->scriptLambda) UncaptureLambdaVars(this->scriptLambda); -} +} \ No newline at end of file diff --git a/JG/events/LambdaVariableContext.h b/JG/events/LambdaVariableContext.h index 0545267..7f408b1 100644 --- a/JG/events/LambdaVariableContext.h +++ b/JG/events/LambdaVariableContext.h @@ -7,8 +7,7 @@ extern _CaptureLambdaVars CaptureLambdaVars; typedef void (*_UncaptureLambdaVars)(Script* scriptLambda); extern _UncaptureLambdaVars UncaptureLambdaVars; -class LambdaVariableContext -{ +class LambdaVariableContext { Script* scriptLambda; public: LambdaVariableContext(const LambdaVariableContext& other) = delete; diff --git a/JG/functions/fn_file.h b/JG/functions/fn_file.h index e1a2505..c5ce114 100644 --- a/JG/functions/fn_file.h +++ b/JG/functions/fn_file.h @@ -41,8 +41,7 @@ bool Cmd_GetTextureMipMapCount_Execute(COMMAND_ARGS) { if (useDataTextures) strcpy((char*)(strrchr(filepath, '\\') + 1), "Data\\Textures\\"); strcpy((char*)(strrchr(filepath, '\\') + 1), path); FileStream sourceFile; - if (sourceFile.OpenAt(filepath, 0x1C)) - { + if (sourceFile.OpenAt(filepath, 0x1C)) { DWORD mipMapCount; sourceFile.ReadBuf(&mipMapCount, 4); *result = mipMapCount; @@ -62,8 +61,7 @@ bool Cmd_GetTextureFormat_Execute(COMMAND_ARGS) { if (useDataTextures) strcpy((char*)(strrchr(filepath, '\\') + 1), "Data\\Textures\\"); strcpy((char*)(strrchr(filepath, '\\') + 1), path); FileStream sourceFile; - if (sourceFile.OpenAt(filepath, 0x57)) - { + if (sourceFile.OpenAt(filepath, 0x57)) { char format; sourceFile.ReadBuf(&format, 1); *result = format - '0'; @@ -83,8 +81,7 @@ bool Cmd_GetTextureWidth_Execute(COMMAND_ARGS) { if (useDataTextures) strcpy((char*)(strrchr(filepath, '\\') + 1), "Data\\Textures\\"); strcpy((char*)(strrchr(filepath, '\\') + 1), path); FileStream sourceFile; - if (sourceFile.OpenAt(filepath, 0x10)) - { + if (sourceFile.OpenAt(filepath, 0x10)) { DWORD width; sourceFile.ReadBuf(&width, 4); *result = width; @@ -105,8 +102,7 @@ bool Cmd_GetTextureHeight_Execute(COMMAND_ARGS) { if (useDataTextures) strcpy((char*)(strrchr(filepath, '\\') + 1), "Data\\Textures\\"); strcpy((char*)(strrchr(filepath, '\\') + 1), path); FileStream sourceFile; - if (sourceFile.OpenAt(filepath, 0x0C)) - { + if (sourceFile.OpenAt(filepath, 0x0C)) { DWORD height; sourceFile.ReadBuf(&height, 4); *result = height; diff --git a/JG/functions/fn_form.h b/JG/functions/fn_form.h index 1122da6..29ee54a 100644 --- a/JG/functions/fn_form.h +++ b/JG/functions/fn_form.h @@ -82,15 +82,12 @@ DEFINE_COMMAND_PLUGIN(ClearWeaponAltTexture, , 0, 2, kParams_OneForm_OneInt); float(__fastcall* GetBaseScale)(TESObjectREFR*) = (float(__fastcall*)(TESObjectREFR*)) 0x00567400; void* (__thiscall* TESNPC_GetFaceGenData)(TESNPC*) = (void* (__thiscall*)(TESNPC*)) 0x0601800; - -bool Cmd_RemoveScopeModelPath_Execute(COMMAND_ARGS) -{ +bool Cmd_RemoveScopeModelPath_Execute(COMMAND_ARGS) { TESObjectWEAP* weapon = NULL; TESModel* model = NULL; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &weapon) && IS_TYPE(weapon, TESObjectWEAP)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &weapon) && IS_TYPE(weapon, TESObjectWEAP)) { if (weapon && weapon->HasScope()) model = &(weapon->targetNIF); if (model) { model->nifPath.Set(""); @@ -101,7 +98,6 @@ bool Cmd_RemoveScopeModelPath_Execute(COMMAND_ARGS) return true; } - bool Cmd_SetLightingTemplateCell_Execute(COMMAND_ARGS) { *result = 0; BGSLightingTemplate* tmpl = nullptr; @@ -128,44 +124,44 @@ bool Cmd_SetLightingTemplateTraitNumeric_Execute(COMMAND_ARGS) { float value = 0.0; if (ExtractArgsEx(EXTRACT_ARGS_EX, &tmpl, &traitID, &value) && IS_TYPE(tmpl, BGSLightingTemplate) && traitID > 0) { switch (traitID) { - case 1: - case 2: - case 3: - tmpl->ambientRGB[traitID-1] = value; - break; - case 4: - case 5: - case 6: - tmpl->directionalRGB[traitID-4] = value; - break; - case 7: - case 8: - case 9: - tmpl->fogRGB[traitID-7] = value; - break; - case 10: - tmpl->fogNear = value; - break; - case 11: - tmpl->fogFar = value; - break; - case 12: - tmpl->directionalXY = value; - break; - case 13: - tmpl->directionalZ = value; - break; - case 14: - tmpl->directionalFade = value; - break; - case 15: - tmpl->fogClipDist = value; - break; - case 16: - tmpl->fogPower = value; - break; - default: - return true; + case 1: + case 2: + case 3: + tmpl->ambientRGB[traitID - 1] = value; + break; + case 4: + case 5: + case 6: + tmpl->directionalRGB[traitID - 4] = value; + break; + case 7: + case 8: + case 9: + tmpl->fogRGB[traitID - 7] = value; + break; + case 10: + tmpl->fogNear = value; + break; + case 11: + tmpl->fogFar = value; + break; + case 12: + tmpl->directionalXY = value; + break; + case 13: + tmpl->directionalZ = value; + break; + case 14: + tmpl->directionalFade = value; + break; + case 15: + tmpl->fogClipDist = value; + break; + case 16: + tmpl->fogPower = value; + break; + default: + return true; } } return true; @@ -177,44 +173,44 @@ bool Cmd_GetLightingTemplateTraitNumeric_Execute(COMMAND_ARGS) { BGSLightingTemplate* tmpl = nullptr; if (ExtractArgsEx(EXTRACT_ARGS_EX, &tmpl, &traitID) && IS_TYPE(tmpl, BGSLightingTemplate) && traitID > 0) { switch (traitID) { - case 1: - case 2: - case 3: - *result = tmpl->ambientRGB[traitID-1]; - break; - case 4: - case 5: - case 6: - *result = tmpl->directionalRGB[traitID-4]; - break; - case 7: - case 8: - case 9: - *result = tmpl->fogRGB[traitID-7]; - break; - case 10: - *result = tmpl->fogNear; - break; - case 11: - *result = tmpl->fogFar; - break; - case 12: - *result = tmpl->directionalXY; - break; - case 13: - *result = tmpl->directionalZ; - break; - case 14: - *result = tmpl->directionalFade; - break; - case 15: - *result = tmpl->fogClipDist; - break; - case 16: - *result = tmpl->fogPower; - break; - default: - return true; + case 1: + case 2: + case 3: + *result = tmpl->ambientRGB[traitID - 1]; + break; + case 4: + case 5: + case 6: + *result = tmpl->directionalRGB[traitID - 4]; + break; + case 7: + case 8: + case 9: + *result = tmpl->fogRGB[traitID - 7]; + break; + case 10: + *result = tmpl->fogNear; + break; + case 11: + *result = tmpl->fogFar; + break; + case 12: + *result = tmpl->directionalXY; + break; + case 13: + *result = tmpl->directionalZ; + break; + case 14: + *result = tmpl->directionalFade; + break; + case 15: + *result = tmpl->fogClipDist; + break; + case 16: + *result = tmpl->fogPower; + break; + default: + return true; } if (IsConsoleMode()) Console_Print("GetLightingTemplateTraitNumeric %d >> %f", traitID, *result); } @@ -272,7 +268,6 @@ bool Cmd_SetCellEncounterZone_Execute(COMMAND_ARGS) { return true; } - bool Cmd_SetRefEncounterZone_Execute(COMMAND_ARGS) { *result = 0; BGSEncounterZone* zone = nullptr; @@ -291,7 +286,6 @@ bool Cmd_GetRefEncounterZone_Execute(COMMAND_ARGS) { return true; } - bool Cmd_SetRefActivationPromptOverride_Execute(COMMAND_ARGS) { *result = 0; char newPrompt[MAX_PATH]; @@ -330,8 +324,7 @@ bool Cmd_GetWeaponAltTextures_Execute(COMMAND_ARGS) { NVSEArrayVar* txstArr = g_arrInterface->CreateArray(NULL, 0, scriptObj); ListNode* iter = model->textureList.Head(); - do - { + do { if (iter->data && iter->data->textureID) g_arrInterface->AppendElement(txstArr, NVSEArrayElement(iter->data->textureID)); } while (iter = iter->next); @@ -340,7 +333,6 @@ bool Cmd_GetWeaponAltTextures_Execute(COMMAND_ARGS) { return true; } - bool Cmd_GetIdleMarkerAnimations_Execute(COMMAND_ARGS) { *result = 0; BGSIdleMarker* marker; @@ -351,7 +343,7 @@ bool Cmd_GetIdleMarkerAnimations_Execute(COMMAND_ARGS) { } if (g_arrInterface->GetArraySize(idleArr)) g_arrInterface->AssignCommandResult(idleArr, result); } - + return true; } @@ -398,17 +390,17 @@ bool Cmd_GetIdleMarkerTraitNumeric_Execute(COMMAND_ARGS) { UInt32 traitID; if (ExtractArgsEx(EXTRACT_ARGS_EX, &marker, &traitID)) { switch (traitID) { - case 1: - *result = marker->idleCollection.flags; - break; - case 2: - *result = marker->idleCollection.idleTimer; - break; - case 3: - *result = marker->idleCollection.animCount; - break; - default: - return true; + case 1: + *result = marker->idleCollection.flags; + break; + case 2: + *result = marker->idleCollection.idleTimer; + break; + case 3: + *result = marker->idleCollection.animCount; + break; + default: + return true; } if (IsConsoleMode()) Console_Print("GetIdleMarkerTraitNumeric %d >> %.2f", traitID, *result); } @@ -422,14 +414,14 @@ bool Cmd_SetIdleMarkerTraitNumeric_Execute(COMMAND_ARGS) { float newVal; if (ExtractArgsEx(EXTRACT_ARGS_EX, &marker, &traitID, &newVal)) { switch (traitID) { - case 1: - marker->idleCollection.flags = newVal; - break; - case 2: - marker->idleCollection.idleTimer = newVal; - break; - default: - return true; + case 1: + marker->idleCollection.flags = newVal; + break; + case 2: + marker->idleCollection.idleTimer = newVal; + break; + default: + return true; } *result = 1; } @@ -437,14 +429,14 @@ bool Cmd_SetIdleMarkerTraitNumeric_Execute(COMMAND_ARGS) { } TESModelTextureSwap* GetArmorModel(TESObjectARMO* armor, UInt32 id) { switch (id) { - case 1: - return &armor->bipedModel.bipedModel[0]; // male biped - case 2: - return &armor->bipedModel.bipedModel[1]; // female biped - case 3: - return &armor->bipedModel.groundModel[0]; // male world - case 4: - return &armor->bipedModel.groundModel[1]; //female world + case 1: + return &armor->bipedModel.bipedModel[0]; // male biped + case 2: + return &armor->bipedModel.bipedModel[1]; // female biped + case 3: + return &armor->bipedModel.groundModel[0]; // male world + case 4: + return &armor->bipedModel.groundModel[1]; //female world } } bool Cmd_GetArmorAltTextures_Execute(COMMAND_ARGS) { @@ -453,14 +445,12 @@ bool Cmd_GetArmorAltTextures_Execute(COMMAND_ARGS) { UInt32 whichModel; if (ExtractArgsEx(EXTRACT_ARGS_EX, &armor, &whichModel) && IS_TYPE(armor, TESObjectARMO)) { - TESModelTextureSwap* model = GetArmorModel(armor, whichModel); if (!model) return true; NVSEArrayVar* txstArr = g_arrInterface->CreateArray(NULL, 0, scriptObj); ListNode* iter = model->textureList.Head(); - do - { + do { if (iter->data && iter->data->textureID) g_arrInterface->AppendElement(txstArr, NVSEArrayElement(iter->data->textureID)); } while (iter = iter->next); @@ -477,8 +467,7 @@ bool Cmd_SetWeaponAltTexture_Execute(COMMAND_ARGS) { TESModelTextureSwap* model = &weapon->textureSwap; if (!model) return true; ListNode* iter = model->textureList.Head(); - do - { + do { if (iter->data && iter->data->index3D == id) { iter->data->textureID = txst; *result = 1; @@ -498,8 +487,7 @@ bool Cmd_SetArmorAltTexture_Execute(COMMAND_ARGS) { TESModelTextureSwap* model = GetArmorModel(armor, whichModel); if (!model) return true; ListNode* iter = model->textureList.Head(); - do - { + do { if (iter->data && iter->data->index3D == id) { iter->data->textureID = txst; *result = 1; @@ -525,8 +513,7 @@ bool Cmd_ClearWeaponAltTexture_Execute(COMMAND_ARGS) { } ListNode* iter = model->textureList.Head(); - do - { + do { if (iter->data && iter->data->index3D == id) { model->textureList.Remove(iter->data); *result = 1; @@ -551,8 +538,7 @@ bool Cmd_ClearArmorAltTexture_Execute(COMMAND_ARGS) { return true; } ListNode* iter = model->textureList.Head(); - do - { + do { if (iter->data && iter->data->index3D == id) { model->textureList.Remove(iter->data); *result = 1; @@ -569,15 +555,15 @@ bool Cmd_SetEffectShaderTexturePath_Execute(COMMAND_ARGS) { char newPath[MAX_PATH]; if (ExtractArgsEx(EXTRACT_ARGS_EX, &shader, &traitID, &newPath) && traitID >= 0 && traitID <= 2) { switch (traitID) { - case 0: - shader->fillTexture.ddsPath.Set(newPath); - break; - case 1: - shader->particleShaderTexture.ddsPath.Set(newPath); - break; - case 2: - shader->holesTexture.ddsPath.Set(newPath); - break; + case 0: + shader->fillTexture.ddsPath.Set(newPath); + break; + case 1: + shader->particleShaderTexture.ddsPath.Set(newPath); + break; + case 2: + shader->holesTexture.ddsPath.Set(newPath); + break; } *result = 1; } @@ -591,15 +577,15 @@ bool Cmd_GetEffectShaderTexturePath_Execute(COMMAND_ARGS) { const char* resStr = NULL; if (ExtractArgsEx(EXTRACT_ARGS_EX, &shader, &traitID) && traitID >= 0 && traitID <= 2) { switch (traitID) { - case 0: - resStr = shader->fillTexture.ddsPath.m_data; - break; - case 1: - resStr = shader->particleShaderTexture.ddsPath.m_data; - break; - case 2: - resStr = shader->holesTexture.ddsPath.m_data; - break; + case 0: + resStr = shader->fillTexture.ddsPath.m_data; + break; + case 1: + resStr = shader->particleShaderTexture.ddsPath.m_data; + break; + case 2: + resStr = shader->holesTexture.ddsPath.m_data; + break; } g_strInterface->Assign(PASS_COMMAND_ARGS, resStr); } @@ -619,35 +605,35 @@ bool Cmd_SetEffectShaderTraitNumeric_Execute(COMMAND_ARGS) { float value; if (ExtractArgsEx(EXTRACT_ARGS_EX, &shader, &traitID, &value) && traitID >= 0 && traitID <= 76) { switch (traitID) { - case 0: - shader->shaderData.flags = (UInt8)value; - break; - case 61: - shader->shaderData.addonModels->refID = (UInt32)value; - break; - case 4: - case 14: - case 47: - case 48: - case 49: - ((UInt32*)shader)[6 + traitID] = SwapRGB((UInt32)value); - break; - case 1: - case 2: - case 3: - case 23: - case 24: - case 25: - case 26: - case 27: - case 67: - case 69: - case 70: - ((UInt32*)shader)[6 + traitID] = (UInt32)value; - break; - default: - ((float*)shader)[6 + traitID] = value; - break; + case 0: + shader->shaderData.flags = (UInt8)value; + break; + case 61: + shader->shaderData.addonModels->refID = (UInt32)value; + break; + case 4: + case 14: + case 47: + case 48: + case 49: + ((UInt32*)shader)[6 + traitID] = SwapRGB((UInt32)value); + break; + case 1: + case 2: + case 3: + case 23: + case 24: + case 25: + case 26: + case 27: + case 67: + case 69: + case 70: + ((UInt32*)shader)[6 + traitID] = (UInt32)value; + break; + default: + ((float*)shader)[6 + traitID] = value; + break; } *result = 1; } @@ -660,38 +646,38 @@ bool Cmd_GetEffectShaderTraitNumeric_Execute(COMMAND_ARGS) { UInt32 color; if (ExtractArgsEx(EXTRACT_ARGS_EX, &shader, &traitID) && traitID >= 0 && traitID <= 76) { switch (traitID) { - case 0: - *result = shader->shaderData.flags; - break; - case 61: - *result = shader->shaderData.addonModels->refID; - break; - case 4: - case 14: - case 47: - case 48: - case 49: - color = SwapRGB(((UInt32*)shader)[6 + traitID]); - *result = color; - if (IsConsoleMode()) Console_Print("GetEffectShaderTraitNumeric %d >> 0x%X", traitID, color); - return true; - break; - case 1: - case 2: - case 3: - case 23: - case 24: - case 25: - case 26: - case 27: - case 67: - case 69: - case 70: - *result = ((UInt32*)shader)[6 + traitID]; - break; - default: - *result = ((float*)shader)[6 + traitID]; - break; + case 0: + *result = shader->shaderData.flags; + break; + case 61: + *result = shader->shaderData.addonModels->refID; + break; + case 4: + case 14: + case 47: + case 48: + case 49: + color = SwapRGB(((UInt32*)shader)[6 + traitID]); + *result = color; + if (IsConsoleMode()) Console_Print("GetEffectShaderTraitNumeric %d >> 0x%X", traitID, color); + return true; + break; + case 1: + case 2: + case 3: + case 23: + case 24: + case 25: + case 26: + case 27: + case 67: + case 69: + case 70: + *result = ((UInt32*)shader)[6 + traitID]; + break; + default: + *result = ((float*)shader)[6 + traitID]; + break; } if (IsConsoleMode()) Console_Print("GetEffectShaderTraitNumeric %d >> %.2f", traitID, *result); } @@ -713,42 +699,35 @@ bool Cmd_GetAvailablePerks_Execute(COMMAND_ARGS) { ListNode* perkIter = g_dataHandler->perkList.Head(); BGSPerk* perk; int perkRank; - do - { + do { perk = perkIter->data; if (perk->data.isPlayable && perk->data.minLevel > 0 && perk->data.minLevel <= g_thePlayer->avOwner.GetLevel()) { perkRank = g_thePlayer->GetPerkRank(perk, 0); bool result = false; - if (perkRank < perk->data.numRanks && !perk->data.isTrait && IsApplicable(perk) + if (perkRank < perk->data.numRanks && !perk->data.isTrait && IsApplicable(perk) && perk->conditions.Evaluate(g_thePlayer, 0, &result, 0)) { g_arrInterface->AppendElement(perkArr, NVSEArrayElement(perk)); } } - } while (perkIter = perkIter->next); if (g_arrInterface->GetArraySize(perkArr)) g_arrInterface->AssignCommandResult(perkArr, result); return true; } -bool Cmd_FaceGenRefreshAppearance_Execute(COMMAND_ARGS) -{ +bool Cmd_FaceGenRefreshAppearance_Execute(COMMAND_ARGS) { *result = 0; - if (thisObj && thisObj->IsCharacter()) - { + if (thisObj && thisObj->IsCharacter()) { ThisStdCall(0x08D3FA0, thisObj); *result = 1; } return true; } -bool Cmd_GetFaceGenNthProperty_Execute(COMMAND_ARGS) -{ +bool Cmd_GetFaceGenNthProperty_Execute(COMMAND_ARGS) { TESNPC* npc = NULL; UInt32 PropertyListIndex = 0; UInt32 PropertyIndex = 0; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &npc, &PropertyListIndex, &PropertyIndex) && npc && IS_TYPE(npc, TESNPC) && PropertyListIndex < 3) - { - if (auto FaceGenPTR = TESNPC_GetFaceGenData(npc)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &npc, &PropertyListIndex, &PropertyIndex) && npc && IS_TYPE(npc, TESNPC) && PropertyListIndex < 3) { + if (auto FaceGenPTR = TESNPC_GetFaceGenData(npc)) { *result = CdeclCall(0x652230, FaceGenPTR, UInt32(PropertyListIndex < 1), UInt32(PropertyListIndex > 1), PropertyIndex); if (IsConsoleMode()) Console_Print("GetFaceGenNthProperty %.2f", *result); @@ -757,21 +736,17 @@ bool Cmd_GetFaceGenNthProperty_Execute(COMMAND_ARGS) return true; } -bool Cmd_SetFaceGenNthProperty_Execute(COMMAND_ARGS) -{ +bool Cmd_SetFaceGenNthProperty_Execute(COMMAND_ARGS) { TESNPC* npc = NULL; UInt32 PropertyListIndex = 0; UInt32 PropertyIndex = 0; float val = 0; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &npc, &PropertyListIndex, &PropertyIndex, &val) && npc && IS_TYPE(npc, TESNPC) && PropertyListIndex < 3) - { - if (auto FaceGenPTR = TESNPC_GetFaceGenData(npc)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &npc, &PropertyListIndex, &PropertyIndex, &val) && npc && IS_TYPE(npc, TESNPC) && PropertyListIndex < 3) { + if (auto FaceGenPTR = TESNPC_GetFaceGenData(npc)) { CdeclCall(0x652320, FaceGenPTR, (PropertyListIndex < 1), (PropertyListIndex > 1), PropertyIndex, val); *result = 1; - if (IsConsoleMode()) - { + if (IsConsoleMode()) { Console_Print("SetFaceGenNthProperty called"); } } @@ -781,27 +756,27 @@ bool Cmd_SetFaceGenNthProperty_Execute(COMMAND_ARGS) bool Cmd_GetPlayerKarmaTitle_Execute(COMMAND_ARGS) { *result = 0; - char *title; + char* title; UInt32 titleOrTier = 0; ExtractArgsEx(EXTRACT_ARGS_EX, &titleOrTier); if (titleOrTier == 1) { int karmaTier = CdeclCall(0x47E040, g_thePlayer->avOwner.GetActorValue(kAVCode_Karma)); // GetKarmaTier switch (karmaTier) { - case 0: - title = *(char**)0x11D41B4; // sAlignGood - break; - case 1: - title = *(char**)0x11D3208; // sAlignNeutral - break; - case 2: - title = *(char**)0x11D4580; // sAlignEvil - break; - case 3: - title = *(char**)0x11D5000; // sAlignVeryGood - break; - case 4: - title = *(char**)0x11D31D8; // sAlignVeryEvil - break; + case 0: + title = *(char**)0x11D41B4; // sAlignGood + break; + case 1: + title = *(char**)0x11D3208; // sAlignNeutral + break; + case 2: + title = *(char**)0x11D4580; // sAlignEvil + break; + case 3: + title = *(char**)0x11D5000; // sAlignVeryGood + break; + case 4: + title = *(char**)0x11D31D8; // sAlignVeryEvil + break; } } else { @@ -840,32 +815,30 @@ bool Cmd_GetBodyPartTraitString_Execute(COMMAND_ARGS) { UInt32 partID; UInt32 traitID; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &bpData, &partID, &traitID) && IS_ID(bpData, BGSBodyPartData) && (partID <= 14) && (traitID <= 5)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &bpData, &partID, &traitID) && IS_ID(bpData, BGSBodyPartData) && (partID <= 14) && (traitID <= 5)) { BGSBodyPart* bodyPart = bpData->bodyParts[partID]; if (bodyPart) { switch (traitID) { - case 1: - if (bodyPart->partNode.m_dataLen) resStr = bodyPart->partNode.m_data; - break; - case 2: - if (bodyPart->VATSTarget.m_dataLen) resStr = bodyPart->VATSTarget.m_data; - break; - case 3: - if (bodyPart->startNode.m_dataLen) resStr = bodyPart->startNode.m_data; - break; - case 4: - if (bodyPart->partName.m_dataLen) resStr = bodyPart->partName.m_data; - break; - case 5: - if (bodyPart->targetBone.m_dataLen) resStr = bodyPart->targetBone.m_data; - break; - default: - break; + case 1: + if (bodyPart->partNode.m_dataLen) resStr = bodyPart->partNode.m_data; + break; + case 2: + if (bodyPart->VATSTarget.m_dataLen) resStr = bodyPart->VATSTarget.m_data; + break; + case 3: + if (bodyPart->startNode.m_dataLen) resStr = bodyPart->startNode.m_data; + break; + case 4: + if (bodyPart->partName.m_dataLen) resStr = bodyPart->partName.m_data; + break; + case 5: + if (bodyPart->targetBone.m_dataLen) resStr = bodyPart->targetBone.m_data; + break; + default: + break; } g_strInterface->Assign(PASS_COMMAND_ARGS, resStr); } - } return true; } @@ -876,8 +849,7 @@ bool Cmd_GetMessageIconPath_Execute(COMMAND_ARGS) { const char* path = NULL; if (ExtractArgsEx(EXTRACT_ARGS_EX, &form, &isFemale)) { TESBipedModelForm* bipedModel = DYNAMIC_CAST(form, TESForm, TESBipedModelForm); - if (bipedModel) - { + if (bipedModel) { path = bipedModel->messageIcon[isFemale].icon.ddsPath.CStr(); } else { @@ -898,8 +870,7 @@ bool Cmd_SetMessageIconPath_Execute(COMMAND_ARGS) { TESForm* form = nullptr; if (ExtractArgsEx(EXTRACT_ARGS_EX, &path, &form, &isFemale)) { TESBipedModelForm* bipedModel = DYNAMIC_CAST(form, TESForm, TESBipedModelForm); - if (bipedModel) - { + if (bipedModel) { bipedModel->messageIcon[isFemale].icon.ddsPath.Set(path); *result = 1; } @@ -938,21 +909,21 @@ bool Cmd_GetWeaponVATSTraitNumeric_Execute(COMMAND_ARGS) { UInt32 traitID = 0; if (ExtractArgsEx(EXTRACT_ARGS_EX, &weap, &traitID) && IS_TYPE(weap, TESObjectWEAP)) { switch (traitID) { - case 1: - *result = weap->vatsSkill; - break; - case 2: - *result = weap->vatsDamMult; - break; - case 3: - *result = weap->vatsAP; - break; - case 4: - *result = weap->isSilent; - break; - case 5: - *result = weap->modRequired; - break; + case 1: + *result = weap->vatsSkill; + break; + case 2: + *result = weap->vatsDamMult; + break; + case 3: + *result = weap->vatsAP; + break; + case 4: + *result = weap->isSilent; + break; + case 5: + *result = weap->modRequired; + break; } if (IsConsoleMode()) Console_Print("GetWeaponVATSTraitNumeric %d >> %f", traitID, *result); } @@ -966,24 +937,24 @@ bool Cmd_SetWeaponVATSTraitNumeric_Execute(COMMAND_ARGS) { if (ExtractArgsEx(EXTRACT_ARGS_EX, &weap, &traitID, &value) && IS_TYPE(weap, TESObjectWEAP)) { *result = 1; switch (traitID) { - case 1: - weap->vatsSkill = value; - break; - case 2: - weap->vatsDamMult = value; - break; - case 3: - weap->vatsAP = value; - break; - case 4: - weap->isSilent = (value > 0 ? 1 : 0); - break; - case 5: - weap->modRequired = (value > 0 ? 1 : 0); - break; - default: - *result = 0; - break; + case 1: + weap->vatsSkill = value; + break; + case 2: + weap->vatsDamMult = value; + break; + case 3: + weap->vatsAP = value; + break; + case 4: + weap->isSilent = (value > 0 ? 1 : 0); + break; + case 5: + weap->modRequired = (value > 0 ? 1 : 0); + break; + default: + *result = 0; + break; } } return true; @@ -1033,18 +1004,18 @@ bool Cmd_SetProjectileSound_Execute(COMMAND_ARGS) { if (ExtractArgsEx(EXTRACT_ARGS_EX, &projectile, &soundID, &sound) && IS_TYPE(projectile, BGSProjectile) && soundID && soundID <= 3) { *result = 1; switch (soundID) { - case 1: - projectile->soundProjectile = sound; - break; - case 2: - projectile->soundCountDown = sound; - break; - case 3: - projectile->soundDisable = sound; - break; - default: - *result = 0; - break; + case 1: + projectile->soundProjectile = sound; + break; + case 2: + projectile->soundCountDown = sound; + break; + case 3: + projectile->soundDisable = sound; + break; + default: + *result = 0; + break; } } return true; @@ -1061,13 +1032,11 @@ bool Cmd_SetExplosionSound_Execute(COMMAND_ARGS) { } return true; } -bool Cmd_GetCreatureCombatSkill_Execute(COMMAND_ARGS) -{ +bool Cmd_GetCreatureCombatSkill_Execute(COMMAND_ARGS) { *result = 0; TESCreature* creature = NULL; if (!ExtractArgsEx(EXTRACT_ARGS_EX, &creature)) return true; - if (!creature) - { + if (!creature) { if (!thisObj || !thisObj->IsActor()) return true; creature = (TESCreature*)((Actor*)thisObj)->GetActorBase(); } @@ -1082,18 +1051,18 @@ bool Cmd_SetContainerSound_Execute(COMMAND_ARGS) { if (ExtractArgsEx(EXTRACT_ARGS_EX, &container, &whichSound, &newSound) && IS_TYPE(container, TESObjectCONT) && IS_TYPE(newSound, TESSound)) { *result = 1; switch (whichSound) { - case 0: - container->openSound = newSound; - break; - case 1: - container->closeSound = newSound; - break; - case 2: - container->randomLoopingSound = newSound; - break; - default: - *result = 0; - break; + case 0: + container->openSound = newSound; + break; + case 1: + container->closeSound = newSound; + break; + case 2: + container->randomLoopingSound = newSound; + break; + default: + *result = 0; + break; } } return true; @@ -1104,15 +1073,15 @@ bool Cmd_GetContainerSound_Execute(COMMAND_ARGS) { TESObjectCONT* container; if (ExtractArgsEx(EXTRACT_ARGS_EX, &container, &whichSound) && IS_TYPE(container, TESObjectCONT)) { switch (whichSound) { - case 0: - if (container->openSound) *(UInt32*)result = container->openSound->refID; - break; - case 1: - if (container->closeSound) *(UInt32*)result = container->closeSound->refID; - break; - case 2: - if (container->randomLoopingSound) *(UInt32*)result = container->randomLoopingSound->refID; - break; + case 0: + if (container->openSound) *(UInt32*)result = container->openSound->refID; + break; + case 1: + if (container->closeSound) *(UInt32*)result = container->closeSound->refID; + break; + case 2: + if (container->randomLoopingSound) *(UInt32*)result = container->randomLoopingSound->refID; + break; } } return true; @@ -1121,22 +1090,19 @@ bool Cmd_GetContainerSound_Execute(COMMAND_ARGS) { bool Cmd_GetRaceFlag_Execute(COMMAND_ARGS) { TESRace* race; UINT32 bit; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &race, &bit) && IS_TYPE(race, TESRace)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &race, &bit) && IS_TYPE(race, TESRace)) { *result = (race->raceFlags & 1 << bit); if (IsConsoleMode()) Console_Print("GetRaceFlag >> %.f", *result); } return true; } - bool Cmd_SetRaceFlag_Execute(COMMAND_ARGS) { TESRace* race; UINT32 bit; UINT32 setorclear; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &race, &bit, &setorclear) && IS_TYPE(race, TESRace)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &race, &bit, &setorclear) && IS_TYPE(race, TESRace)) { setorclear ? race->raceFlags |= (1 << bit) : race->raceFlags &= ~(1 << bit); *result = 1; } @@ -1160,14 +1126,12 @@ bool Cmd_GetFactionMembers_Execute(COMMAND_ARGS) { ExtractArgsEx(EXTRACT_ARGS_EX, &faction, &rank); if (faction) { NVSEArrayVar* factionMemberArr = g_arrInterface->CreateArray(NULL, 0, scriptObj); - for (TESBoundObject* object = g_dataHandler->boundObjectList->first; object; object = object->next) - { + for (TESBoundObject* object = g_dataHandler->boundObjectList->first; object; object = object->next) { TESActorBase* actorBase = DYNAMIC_CAST(object, TESBoundObject, TESActorBase); if (actorBase && actorBase->baseData.factionList.Count() != 0) { ListNode* fctIter = actorBase->baseData.factionList.Head(); FactionListData* factionData; - do - { + do { factionData = fctIter->data; if (factionData && factionData->faction && factionData->faction == faction) { if (rank == -1 || (rank == factionData->rank)) { @@ -1181,8 +1145,7 @@ bool Cmd_GetFactionMembers_Execute(COMMAND_ARGS) { } return true; } -bool Cmd_SetEquipType_Execute(COMMAND_ARGS) -{ +bool Cmd_SetEquipType_Execute(COMMAND_ARGS) { *result = 0; TESForm* pForm = 0; UInt32 newEquipType; @@ -1257,10 +1220,8 @@ bool Cmd_SetFacegenModelFlag_Execute(COMMAND_ARGS) { return true; } -bool Cmd_GetBaseScale_Eval(COMMAND_ARGS_EVAL) -{ - if (thisObj) - { +bool Cmd_GetBaseScale_Eval(COMMAND_ARGS_EVAL) { + if (thisObj) { *result = GetBaseScale(thisObj); if (IsConsoleMode()) Console_Print("GetBaseScale : %0.2f", *result); @@ -1268,8 +1229,7 @@ bool Cmd_GetBaseScale_Eval(COMMAND_ARGS_EVAL) return true; } -bool Cmd_GetBaseScale_Execute(COMMAND_ARGS) -{ +bool Cmd_GetBaseScale_Execute(COMMAND_ARGS) { return Cmd_GetBaseScale_Eval(thisObj, 0, 0, result); } @@ -1342,33 +1302,33 @@ bool Cmd_SetWeapon1stPersonModel_Execute(COMMAND_ARGS) { if (ExtractArgsEx(EXTRACT_ARGS_EX, &weap, &id, &model) && IS_TYPE(weap, TESObjectWEAP) && (!model || IS_TYPE(model, TESObjectSTAT)) && id <= 7) { *result = 1; switch (id) { - case 0: - weap->worldStatic = model; - break; - case 1: - weap->modStatics[0] = model; - break; - case 2: - weap->modStatics[1] = model; - break; - case 3: - weap->modStatics[3] = model; - break; - case 4: - weap->modStatics[2] = model; - break; - case 5: - weap->modStatics[5] = model; - break; - case 6: - weap->modStatics[4] = model; - break; - case 7: - weap->modStatics[6] = model; - break; - default: - *result = 0; - break; + case 0: + weap->worldStatic = model; + break; + case 1: + weap->modStatics[0] = model; + break; + case 2: + weap->modStatics[1] = model; + break; + case 3: + weap->modStatics[3] = model; + break; + case 4: + weap->modStatics[2] = model; + break; + case 5: + weap->modStatics[5] = model; + break; + case 6: + weap->modStatics[4] = model; + break; + case 7: + weap->modStatics[6] = model; + break; + default: + *result = 0; + break; } } return true; @@ -1378,30 +1338,30 @@ bool Cmd_GetWeapon1stPersonModel_Execute(COMMAND_ARGS) { int id = -1; if (ExtractArgsEx(EXTRACT_ARGS_EX, &weap, &id) && IS_TYPE(weap, TESObjectWEAP) && id <= 7) { switch (id) { - case 0: - *(UInt32*)result = weap->worldStatic->refID; - break; - case 1: - *(UInt32*)result = weap->modStatics[0]->refID; - break; - case 2: - *(UInt32*)result = weap->modStatics[1]->refID; - break; - case 3: - *(UInt32*)result = weap->modStatics[3]->refID; - break; - case 4: - *(UInt32*)result = weap->modStatics[2]->refID; - break; - case 5: - *(UInt32*)result = weap->modStatics[5]->refID; - break; - case 6: - *(UInt32*)result = weap->modStatics[4]->refID; - break; - case 7: - *(UInt32*)result = weap->modStatics[6]->refID; - break; + case 0: + *(UInt32*)result = weap->worldStatic->refID; + break; + case 1: + *(UInt32*)result = weap->modStatics[0]->refID; + break; + case 2: + *(UInt32*)result = weap->modStatics[1]->refID; + break; + case 3: + *(UInt32*)result = weap->modStatics[3]->refID; + break; + case 4: + *(UInt32*)result = weap->modStatics[2]->refID; + break; + case 5: + *(UInt32*)result = weap->modStatics[5]->refID; + break; + case 6: + *(UInt32*)result = weap->modStatics[4]->refID; + break; + case 7: + *(UInt32*)result = weap->modStatics[6]->refID; + break; } } return true; @@ -1430,22 +1390,19 @@ bool Cmd_SetIMODAnimatable_Execute(COMMAND_ARGS) { } // A modified version of GetCalculatedWeaponDamage, all credits go to JazzIsParis -bool Cmd_GetCalculatedWeaponDPS_Execute(COMMAND_ARGS) -{ +bool Cmd_GetCalculatedWeaponDPS_Execute(COMMAND_ARGS) { *result = 0; TESObjectWEAP* weapon = NULL; if (!ExtractArgsEx(EXTRACT_ARGS_EX, &weapon)) return true; float condition = 1.0F; ListNode* extendPtr = NULL; - if (!weapon) - { + if (!weapon) { if (!thisObj) return true; InventoryRef* invRef = InventoryRefGetForID(thisObj->refID); if (!invRef) return true; weapon = (TESObjectWEAP*)invRef->data.type; if NOT_ID(weapon, TESObjectWEAP) return true; - if (invRef->data.xData) - { + if (invRef->data.xData) { condition = invRef->data.entry->GetItemHealthPerc() / 100.0F; ListNode tempExtend(invRef->data.xData); extendPtr = &tempExtend; @@ -1505,16 +1462,14 @@ bool Cmd_IsCellExpired_Execute(COMMAND_ARGS) { return true; } -bool Cmd_GetBaseEffectAV_Execute(COMMAND_ARGS) -{ +bool Cmd_GetBaseEffectAV_Execute(COMMAND_ARGS) { *result = -1; EffectSetting* effect; if (ExtractArgsEx(EXTRACT_ARGS_EX, &effect) && IS_TYPE(effect, EffectSetting) && (effect->archtype == 0) && effect->actorVal) *result = effect->actorVal; return true; } -bool Cmd_GetBaseEffectArchetype_Execute(COMMAND_ARGS) -{ +bool Cmd_GetBaseEffectArchetype_Execute(COMMAND_ARGS) { *result = -1; EffectSetting* effect; if (ExtractArgsEx(EXTRACT_ARGS_EX, &effect) && IS_TYPE(effect, EffectSetting)) @@ -1530,56 +1485,56 @@ bool Cmd_GetInteriorLightingTraitNumeric_Execute(COMMAND_ARGS) { if (!cell->IsInterior() || traitID < 0 || traitID > 15) return true; TESObjectCELL::LightingData* lightingData = cell->coords.interior; switch (traitID) { - case 0: - *result = lightingData->ambientRGB.r; - break; - case 1: - *result = lightingData->ambientRGB.g; - break; - case 2: - *result = lightingData->ambientRGB.b; - break; - case 3: - *result = lightingData->directionalRGB.r; - break; - case 4: - *result = lightingData->directionalRGB.g; - break; - case 5: - *result = lightingData->directionalRGB.b; - break; - case 6: - *result = lightingData->directionalRotXY; - break; - case 7: - *result = lightingData->directionalRotZ; - break; - case 8: - *result = lightingData->directionalFade; - break; - case 9: - *result = lightingData->fogRGB.r; - break; - case 10: - *result = lightingData->fogRGB.g; - break; - case 11: - *result = lightingData->fogRGB.b; - break; - case 12: - *result = lightingData->fogNear; - break; - case 13: - *result = lightingData->fogFar; - break; - case 14: - *result = lightingData->fogPower; - break; - case 15: - *result = lightingData->fogClipDist; - break; - default: - return true; + case 0: + *result = lightingData->ambientRGB.r; + break; + case 1: + *result = lightingData->ambientRGB.g; + break; + case 2: + *result = lightingData->ambientRGB.b; + break; + case 3: + *result = lightingData->directionalRGB.r; + break; + case 4: + *result = lightingData->directionalRGB.g; + break; + case 5: + *result = lightingData->directionalRGB.b; + break; + case 6: + *result = lightingData->directionalRotXY; + break; + case 7: + *result = lightingData->directionalRotZ; + break; + case 8: + *result = lightingData->directionalFade; + break; + case 9: + *result = lightingData->fogRGB.r; + break; + case 10: + *result = lightingData->fogRGB.g; + break; + case 11: + *result = lightingData->fogRGB.b; + break; + case 12: + *result = lightingData->fogNear; + break; + case 13: + *result = lightingData->fogFar; + break; + case 14: + *result = lightingData->fogPower; + break; + case 15: + *result = lightingData->fogClipDist; + break; + default: + return true; } if (IsConsoleMode()) Console_Print("GetInteriorLightingTraitNumeric %d >> %.2f", traitID, *result); @@ -1596,62 +1551,60 @@ bool Cmd_SetInteriorLightingTraitNumeric_Execute(COMMAND_ARGS) { TESObjectCELL::LightingData* lightingData = cell->coords.interior; *result = 1; switch (traitID) { - case 0: - lightingData->ambientRGB.r = value; - break; - case 1: - lightingData->ambientRGB.g = value; - break; - case 2: - lightingData->ambientRGB.b = value; - break; - case 3: - lightingData->directionalRGB.r = value; - break; - case 4: - lightingData->directionalRGB.g = value; - break; - case 5: - lightingData->directionalRGB.b = value; - break; - case 6: - lightingData->directionalRotXY = value; - break; - case 7: - lightingData->directionalRotZ = value; - break; - case 8: - lightingData->directionalFade = value; - break; - case 9: - lightingData->fogRGB.r = value; - break; - case 10: - lightingData->fogRGB.g = value; - break; - case 11: - lightingData->fogRGB.b = value; - break; - case 12: - lightingData->fogNear = value; - break; - case 13: - lightingData->fogFar = value; - break; - case 14: - lightingData->fogPower = value; - break; - case 15: - lightingData->fogClipDist = value; - break; - default: - *result = 0; - return true; + case 0: + lightingData->ambientRGB.r = value; + break; + case 1: + lightingData->ambientRGB.g = value; + break; + case 2: + lightingData->ambientRGB.b = value; + break; + case 3: + lightingData->directionalRGB.r = value; + break; + case 4: + lightingData->directionalRGB.g = value; + break; + case 5: + lightingData->directionalRGB.b = value; + break; + case 6: + lightingData->directionalRotXY = value; + break; + case 7: + lightingData->directionalRotZ = value; + break; + case 8: + lightingData->directionalFade = value; + break; + case 9: + lightingData->fogRGB.r = value; + break; + case 10: + lightingData->fogRGB.g = value; + break; + case 11: + lightingData->fogRGB.b = value; + break; + case 12: + lightingData->fogNear = value; + break; + case 13: + lightingData->fogFar = value; + break; + case 14: + lightingData->fogPower = value; + break; + case 15: + lightingData->fogClipDist = value; + break; + default: + *result = 0; + return true; } if (IsConsoleMode()) Console_Print("SetInteriorLightingTraitNumeric %d >> %.2f", traitID, value); } return true; } - - diff --git a/JG/functions/fn_gameplay.h b/JG/functions/fn_gameplay.h index 3a4d837..4eedd54 100644 --- a/JG/functions/fn_gameplay.h +++ b/JG/functions/fn_gameplay.h @@ -46,7 +46,6 @@ void(__cdecl* HUDMainMenu_UpdateVisibilityState)(signed int) = (void(__cdecl*)(s #define NUM_ARGS *((UInt8*)scriptData + *opcodeOffsetPtr) bool Cmd_RemoveNavmeshObstacle_Execute(COMMAND_ARGS) { - *result = 0; NavMeshObstacleManager* g_nomgr = ThisStdCall(0x6C0720, nullptr); ThisStdCall(0x6C0C80, g_nomgr, thisObj); @@ -55,7 +54,6 @@ bool Cmd_RemoveNavmeshObstacle_Execute(COMMAND_ARGS) { } bool Cmd_AddNavmeshObstacle_Execute(COMMAND_ARGS) { - *result = 0; NavMeshObstacleManager* g_nomgr = ThisStdCall(0x6C0720, nullptr); ThisStdCall(0x6C0C30, g_nomgr, thisObj); @@ -67,8 +65,7 @@ bool Cmd_StopSoundLooping_Execute(COMMAND_ARGS) { TESSound* sound = nullptr; if (ExtractArgsEx(EXTRACT_ARGS_EX, &sound) && IS_TYPE(sound, TESSound)) { BSGameSound* gameSound; - for (auto sndIter = BSAudioManager::Get()->playingSounds.Begin(); !sndIter.End(); ++sndIter) - { + for (auto sndIter = BSAudioManager::Get()->playingSounds.Begin(); !sndIter.End(); ++sndIter) { gameSound = sndIter.Get(); if (!gameSound || (gameSound->sourceSound != sound)) continue; @@ -81,15 +78,13 @@ bool Cmd_StopSoundLooping_Execute(COMMAND_ARGS) { return true; } - bool Cmd_GetPlayingEffectShaders_Execute(COMMAND_ARGS) { *result = 0; ListNode* iter = g_processManager->tempEffects.Head(); MagicShaderHitEffect* effect; NVSEArrayVar* effArr = g_arrInterface->CreateArray(NULL, 0, scriptObj); - do - { + do { effect = (MagicShaderHitEffect*)iter->data; if (effect && IS_TYPE(effect, MagicShaderHitEffect) && effect->flags != 1 && effect->target && effect->target->refID == thisObj->refID) { g_arrInterface->AppendElement(effArr, NVSEArrayElement(effect->effectShader)); @@ -144,8 +139,7 @@ bool IsCombatTarget(Actor* source, Actor* toSearch) { Actor** actorsArr = source->combatTargets->data; UInt32 count = source->combatTargets->size; if (!actorsArr) return false; - for (; count; count--, actorsArr++) - { + for (; count; count--, actorsArr++) { if (*actorsArr == toSearch) return true; } } @@ -154,8 +148,7 @@ bool IsCombatTarget(Actor* source, Actor* toSearch) { bool IsHostileCompassTarget(Actor* toSearch) { auto iter = g_thePlayer->compassTargets->Begin(); - for (; !iter.End(); ++iter) - { + for (; !iter.End(); ++iter) { PlayerCharacter::CompassTarget* target = iter.Get(); if (target->isHostile && target->target == toSearch) return true; } @@ -176,7 +169,7 @@ bool Cmd_SendTrespassAlarmAlt_Execute(COMMAND_ARGS) { *result = 0; ExtraOwnership* xOwn = ThisStdCall(0x567790, thisObj); // TESObjectREFR::ResolveOwnership if (xOwn) { - ThisStdCall(0x8C0EC0, g_thePlayer, thisObj, xOwn, 0xFFFFFFFF); //TESObjectREFR::HandleMinorCrime + ThisStdCall(0x8C0EC0, g_thePlayer, thisObj, xOwn, 0xFFFFFFFF); //TESObjectREFR::HandleMinorCrime *result = 1; } return true; @@ -186,13 +179,12 @@ bool Cmd_GetCompassHostiles_Execute(COMMAND_ARGS) { UInt32 skipInvisible = 0; //If player has ImprovedDetection perk effect, then they'll see invisible actors in compass. - UInt32 accountForImprovedDetection = 0; + UInt32 accountForImprovedDetection = 0; ExtractArgsEx(EXTRACT_ARGS_EX, &skipInvisible, &accountForImprovedDetection); bool hasImprovedDetection = false; - if (accountForImprovedDetection) - { + if (accountForImprovedDetection) { float hasPerk = 0.0; //copying code at 0x77A0C4 ApplyPerkModifiers(kPerkEntry_HasImprovedDetection, g_thePlayer, &hasPerk); if (hasPerk > 0.0) @@ -201,14 +193,11 @@ bool Cmd_GetCompassHostiles_Execute(COMMAND_ARGS) { NVSEArrayVar* hostileArr = g_arrInterface->CreateArray(NULL, 0, scriptObj); auto iter = g_thePlayer->compassTargets->Begin(); - for (; !iter.End(); ++iter) - { + for (; !iter.End(); ++iter) { PlayerCharacter::CompassTarget* target = iter.Get(); - if (target->isHostile) - { + if (target->isHostile) { if (skipInvisible > 0 && !hasImprovedDetection && (target->target->avOwner.Fn_02(kAVCode_Invisibility) > 0 - || target->target->avOwner.Fn_02(kAVCode_Chameleon) > 0)) - { + || target->target->avOwner.Fn_02(kAVCode_Chameleon) > 0)) { continue; } g_arrInterface->AppendElement(hostileArr, NVSEArrayElement(target->target)); @@ -218,13 +207,11 @@ bool Cmd_GetCompassHostiles_Execute(COMMAND_ARGS) { return true; } -bool Cmd_SendStealingAlarm_Execute(COMMAND_ARGS) -{ +bool Cmd_SendStealingAlarm_Execute(COMMAND_ARGS) { TESObjectREFR* container; int checkItems = 0; *result = 0; - if (thisObj->IsActor() && ExtractArgsEx(EXTRACT_ARGS_EX, &container, &checkItems)) - { + if (thisObj->IsActor() && ExtractArgsEx(EXTRACT_ARGS_EX, &container, &checkItems)) { if (checkItems) { TESForm* containerOwner = ThisStdCall(0x567790, container); // TESObjectREFR::ResolveOwnership if (!containerOwner) return true; @@ -234,13 +221,11 @@ bool Cmd_SendStealingAlarm_Execute(COMMAND_ARGS) ListNode* contChangesIter = xChanges->data->objList->Head(); ContChangesEntry* entry; TESForm* item; - do - { + do { if (!(entry = contChangesIter->data) || !entry->extendData || !entry->type) continue; ListNode* xdlIter = entry->extendData->Head(); ExtraDataList* xData; - do - { + do { xData = xdlIter->data; if (xData && xData->HasType(kExtraData_Ownership)) { ExtraOwnership* xOwn = (ExtraOwnership*)xData->GetByType(kExtraData_Ownership); @@ -257,7 +242,7 @@ bool Cmd_SendStealingAlarm_Execute(COMMAND_ARGS) } else { TESForm* owner = ThisStdCall(0x567790, container); // TESObjectREFR::ResolveOwnership - ThisStdCall(0x8BFA40, thisObj, container, NULL, NULL, 1, owner); // Actor::HandleStealing, + ThisStdCall(0x8BFA40, thisObj, container, NULL, NULL, 1, owner); // Actor::HandleStealing, *result = 1; } } @@ -285,7 +270,7 @@ bool Cmd_GetCalculatedSpread_Execute(COMMAND_ARGS) { GameSettingCollection::GetSingleton()->GetGameSetting("fNPCMaxGunWobbleAngle", &fNPCMaxGunWobbleAngle); totalSpread += spreadPenalty * fNPCMaxGunWobbleAngle->data.f * 0.01745329238474369; - + float noIdea = ThisStdCall(0x8D8520, actor)->angle1D0; totalSpread = totalSpread + noIdea; @@ -299,16 +284,13 @@ bool Cmd_GetCalculatedSpread_Execute(COMMAND_ARGS) { return true; } - -bool __fastcall ValidTempEffect(EffectItem* effectItem) -{ +bool __fastcall ValidTempEffect(EffectItem* effectItem) { if (!effectItem || (effectItem->duration <= 0) || !effectItem->setting) return false; UInt8 archtype = effectItem->setting->archtype; return !archtype || ((archtype == 1) && (effectItem->setting->effectFlags & 0x2000)) || ((archtype > 10) && (archtype < 14)) || (archtype == 24) || (archtype > 33); } -bool Cmd_ModNthTempEffectTimeLeft_Execute(COMMAND_ARGS) -{ +bool Cmd_ModNthTempEffectTimeLeft_Execute(COMMAND_ARGS) { *result = 0; UInt32 index; float modTimeLeft; @@ -317,13 +299,11 @@ bool Cmd_ModNthTempEffectTimeLeft_Execute(COMMAND_ARGS) if (!effList) return true; ListNode* iter = effList->Head(); ActiveEffect* activeEff; - do - { + do { activeEff = iter->data; if (!activeEff || !activeEff->bApplied || !ValidTempEffect(activeEff->effectItem) || !activeEff->magicItem || !DYNAMIC_CAST(activeEff->magicItem, MagicItem, TESForm)) continue; - if (!index--) - { + if (!index--) { activeEff->timeElapsed += -modTimeLeft; if (activeEff->timeElapsed > activeEff->duration) activeEff->Remove(true); *result = 1; @@ -354,11 +334,9 @@ bool Cmd_IsCompassHostile_Execute(COMMAND_ARGS) { *result = 0; Actor* toCheck = (Actor*)thisObj; auto iter = g_thePlayer->compassTargets->Begin(); - for (; !iter.End(); ++iter) - { + for (; !iter.End(); ++iter) { PlayerCharacter::CompassTarget* target = iter.Get(); - if (target->isHostile && target->target == toCheck) - { + if (target->isHostile && target->target == toCheck) { *result = 1; break; } @@ -366,28 +344,23 @@ bool Cmd_IsCompassHostile_Execute(COMMAND_ARGS) { if (IsConsoleMode()) Console_Print("IsCompassHostile >> %.f", *result); return true; } -void RestoreDisabledPlayerControlsHUDFlags() -{ +void RestoreDisabledPlayerControlsHUDFlags() { SafeWrite32(0x771A53, HUDMainMenu::kXpMeter | HUDMainMenu::kSubtitles | HUDMainMenu::kMessages | HUDMainMenu::kQuestReminder | HUDMainMenu::kRadiationMeter); } -bool Cmd_SetDisablePlayerControlsHUDVisibilityFlags_Execute(COMMAND_ARGS) -{ +bool Cmd_SetDisablePlayerControlsHUDVisibilityFlags_Execute(COMMAND_ARGS) { UInt32 flags; - if (NUM_ARGS && ExtractArgsEx(EXTRACT_ARGS_EX, &flags)) - { + if (NUM_ARGS && ExtractArgsEx(EXTRACT_ARGS_EX, &flags)) { SafeWrite32(0x771A53, flags); HUDMainMenu_UpdateVisibilityState(HUDMainMenu::kHUDState_RECALCULATE); } - else - { + else { RestoreDisabledPlayerControlsHUDFlags(); } return true; } -bool Cmd_GetNearestCompassHostile_Execute(COMMAND_ARGS) -{ +bool Cmd_GetNearestCompassHostile_Execute(COMMAND_ARGS) { *result = -1; NiPoint3* playerPos = g_thePlayer->GetPos(); @@ -402,17 +375,14 @@ bool Cmd_GetNearestCompassHostile_Execute(COMMAND_ARGS) UInt32 skipInvisible = 0; ExtractArgsEx(EXTRACT_ARGS_EX, &skipInvisible); auto iter = g_thePlayer->compassTargets->Begin(); - for (; !iter.End(); ++iter) - { + for (; !iter.End(); ++iter) { PlayerCharacter::CompassTarget* target = iter.Get(); - if (target->isHostile) - { + if (target->isHostile) { if (skipInvisible > 0 && (target->target->avOwner.Fn_02(kAVCode_Invisibility) > 0 || target->target->avOwner.Fn_02(kAVCode_Chameleon) > 0)) { continue; } auto distToPlayer = target->target->GetPos()->CalculateDistSquared(playerPos); - if (distToPlayer < maxDist) - { + if (distToPlayer < maxDist) { maxDist = distToPlayer; closestHostile = target->target; } @@ -423,8 +393,7 @@ bool Cmd_GetNearestCompassHostile_Execute(COMMAND_ARGS) return true; } -bool Cmd_GetNearestCompassHostileDirection_Execute(COMMAND_ARGS) -{ +bool Cmd_GetNearestCompassHostileDirection_Execute(COMMAND_ARGS) { *result = -1; NiPoint3* playerPos = g_thePlayer->GetPos(); @@ -437,25 +406,21 @@ bool Cmd_GetNearestCompassHostileDirection_Execute(COMMAND_ARGS) UInt32 skipInvisible = 0; ExtractArgsEx(EXTRACT_ARGS_EX, &skipInvisible); auto iter = g_thePlayer->compassTargets->Begin(); - for (; !iter.End(); ++iter) - { + for (; !iter.End(); ++iter) { PlayerCharacter::CompassTarget* target = iter.Get(); - if (target->isHostile) - { + if (target->isHostile) { if (skipInvisible > 0 && (target->target->avOwner.Fn_02(kAVCode_Invisibility) > 0 || target->target->avOwner.Fn_02(kAVCode_Chameleon) > 0)) { continue; } auto distToPlayer = target->target->GetPos()->CalculateDistSquared(playerPos); - if (distToPlayer < maxDist) - { + if (distToPlayer < maxDist) { maxDist = distToPlayer; closestHostile = target->target; } } } - if (closestHostile) - { + if (closestHostile) { auto playerRotation = g_thePlayer->AdjustRot(0); double headingAngle = GetAngleBetweenPoints(closestHostile->GetPos(), playerPos, playerRotation); @@ -469,13 +434,11 @@ bool Cmd_GetNearestCompassHostileDirection_Execute(COMMAND_ARGS) return true; } -bool Cmd_HighlightBodyPartAlt_Execute(COMMAND_ARGS) -{ +bool Cmd_HighlightBodyPartAlt_Execute(COMMAND_ARGS) { return Cmd_HighLightBodyPart(PASS_COMMAND_ARGS); } -bool Cmd_DeactivateAllHighlightsAlt_Execute(COMMAND_ARGS) -{ +bool Cmd_DeactivateAllHighlightsAlt_Execute(COMMAND_ARGS) { return Cmd_DeactivateAllHighlights(PASS_COMMAND_ARGS); } @@ -498,21 +461,16 @@ bool Cmd_GetRunSpeed_Execute(COMMAND_ARGS) { if (IsConsoleMode()) Console_Print("GetRunSpeed >> %.2f", *result); return true; } -bool Cmd_ToggleNthPipboyLight_Execute(COMMAND_ARGS) -{ +bool Cmd_ToggleNthPipboyLight_Execute(COMMAND_ARGS) { UInt32 index, isVisible; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &index, &isVisible) && index < 3) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &index, &isVisible) && index < 3) { FOPipboyManager* pipboyManager = g_interfaceManager->pipboyManager; - if (pipboyManager->byte028) - { - if (isVisible) - { + if (pipboyManager->byte028) { + if (isVisible) { pipboyManager->pipboyLightGlow[index]->m_flags &= ~1; } - else - { + else { pipboyManager->pipboyLightGlow[index]->m_flags |= 1; } *result = 1; @@ -520,12 +478,10 @@ bool Cmd_ToggleNthPipboyLight_Execute(COMMAND_ARGS) } return true; } -bool Cmd_UnsetAV_Execute(COMMAND_ARGS) -{ +bool Cmd_UnsetAV_Execute(COMMAND_ARGS) { *result = 0; UInt32 avCode; - if (thisObj->IsActor() && ExtractArgsEx(EXTRACT_ARGS_EX, &avCode)) - { + if (thisObj->IsActor() && ExtractArgsEx(EXTRACT_ARGS_EX, &avCode)) { Actor* actor = (Actor*)thisObj; ActorValueOwner* avOwner = &actor->avOwner; float oldVal = avOwner->GetActorValue(avCode); @@ -535,11 +491,9 @@ bool Cmd_UnsetAV_Execute(COMMAND_ARGS) ThisStdCall(0x937400, actorPermSetAVList, avEntry); thisObj->MarkAsModified(0x400000); - if (!actor->IsPlayerRef()) - { + if (!actor->IsPlayerRef()) { BaseProcess* base = actor->baseProcess; - if (base) - { + if (base) { base->Unk_EC(avCode); } } @@ -552,12 +506,10 @@ bool Cmd_UnsetAV_Execute(COMMAND_ARGS) return true; } -bool Cmd_UnforceAV_Execute(COMMAND_ARGS) -{ +bool Cmd_UnforceAV_Execute(COMMAND_ARGS) { UInt32 avCode; *result = 0; - if (thisObj->IsActor() && ExtractArgsEx(EXTRACT_ARGS_EX, &avCode)) - { + if (thisObj->IsActor() && ExtractArgsEx(EXTRACT_ARGS_EX, &avCode)) { Actor* actor = (Actor*)thisObj; ActorValueOwner* avOwner = &actor->avOwner; float oldVal = avOwner->GetActorValue(avCode); @@ -567,11 +519,9 @@ bool Cmd_UnforceAV_Execute(COMMAND_ARGS) ThisStdCall(0x937400, actorPermForceAVList, avEntry); thisObj->MarkAsModified(0x800000); - if (!actor->IsPlayerRef()) - { + if (!actor->IsPlayerRef()) { BaseProcess* base = actor->baseProcess; - if (base) - { + if (base) { base->Unk_EC(avCode); } } @@ -589,19 +539,15 @@ bool Cmd_StopSoundAlt_Execute(COMMAND_ARGS) { TESObjectREFR* source; BSFadeNode* fadeNode; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &soundForm, &source)) - { - if (soundForm->soundFile.path.m_dataLen) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &soundForm, &source)) { + if (soundForm->soundFile.path.m_dataLen) { const char* soundPath = soundForm->soundFile.path.m_data; BSGameSound* gameSound; - for (auto sndIter = g_audioManager->playingSounds.Begin(); !sndIter.End(); ++sndIter) - { + for (auto sndIter = g_audioManager->playingSounds.Begin(); !sndIter.End(); ++sndIter) { gameSound = sndIter.Get(); if (gameSound && StrBeginsCI(gameSound->filePath + 0xB, soundPath)) { fadeNode = (BSFadeNode*)g_audioManager->soundPlayingObjects.Lookup(gameSound->mapKey); - if (fadeNode && fadeNode->GetFadeNode() && fadeNode->linkedObj && fadeNode->linkedObj == source) - { + if (fadeNode && fadeNode->GetFadeNode() && fadeNode->linkedObj && fadeNode->linkedObj == source) { gameSound->stateFlags &= 0xFFFFFF0F; gameSound->stateFlags |= 0x10; *result = 1; @@ -638,8 +584,7 @@ bool Cmd_ApplyWeaponPoison_Execute(COMMAND_ARGS) { } else { ContChangesEntry* wpnInfo = ((Actor*)thisObj)->baseProcess->GetWeaponInfo(); - if (wpnInfo && wpnInfo->extendData) - { + if (wpnInfo && wpnInfo->extendData) { weapon = ((TESObjectWEAP*)wpnInfo->type); xData = wpnInfo->extendData->GetFirstItem(); } @@ -647,8 +592,7 @@ bool Cmd_ApplyWeaponPoison_Execute(COMMAND_ARGS) { if (weapon) { UInt32 weaponSkill = weapon->weaponSkill; if (weaponSkill != kAVCode_Unarmed && weaponSkill != kAVCode_MeleeWeapons) return true; - if (xData) - { + if (xData) { ExtraPoison* xPoison = GetExtraType((*xData), Poison); if (!xPoison) { ThisStdCall(0x419D10, xData, poison); // ExtraDataList::UpdateExtraPoison @@ -668,7 +612,8 @@ bool Cmd_TogglePipBoy_Execute(COMMAND_ARGS) { if (g_interfaceManager) { if (!g_interfaceManager->pipBoyMode) { ThisStdCall(0x70F4E0, g_interfaceManager, 0, pipboyTab); - } else if (g_interfaceManager->pipBoyMode == 3) { + } + else if (g_interfaceManager->pipBoyMode == 3) { ThisStdCall(0x70F690, g_interfaceManager, 0); } *result = 1; @@ -677,8 +622,7 @@ bool Cmd_TogglePipBoy_Execute(COMMAND_ARGS) { return true; } -bool Cmd_ToggleLevelUpMenu_Execute(COMMAND_ARGS) -{ +bool Cmd_ToggleLevelUpMenu_Execute(COMMAND_ARGS) { UInt32 ToExtract; if (ExtractArgsEx(EXTRACT_ARGS_EX, &ToExtract)) isShowLevelUp = ToExtract; return true; @@ -690,8 +634,7 @@ bool Cmd_Jump_Execute(COMMAND_ARGS) { return true; } -bool Cmd_StopVATSCam_Execute(COMMAND_ARGS) -{ +bool Cmd_StopVATSCam_Execute(COMMAND_ARGS) { ThisStdCall(0x93E770, g_thePlayer, 2, 0); return true; } @@ -715,19 +658,15 @@ bool Cmd_DisableMuzzleFlashLights_Execute(COMMAND_ARGS) { if (IsConsoleMode()) Console_Print("DisableMuzzleFlashLights >> %.f", *result); return true; } -bool Cmd_ToggleDisableSaves_Execute(COMMAND_ARGS) -{ +bool Cmd_ToggleDisableSaves_Execute(COMMAND_ARGS) { int doDisable = 1; BYTE modIdx = scriptObj->GetModIndex(); *result = 0; - if (modIdx < 0xFF && ExtractArgsEx(EXTRACT_ARGS_EX, &doDisable)) - { - if (doDisable) - { + if (modIdx < 0xFF && ExtractArgsEx(EXTRACT_ARGS_EX, &doDisable)) { + if (doDisable) { SaveGameUMap.insert(modIdx); } - else - { + else { SaveGameUMap.erase(modIdx); } *result = 1; diff --git a/JG/functions/fn_math.h b/JG/functions/fn_math.h index a8f4ba5..38e385a 100644 --- a/JG/functions/fn_math.h +++ b/JG/functions/fn_math.h @@ -28,9 +28,8 @@ bool Cmd_GetRGBColor_Execute(COMMAND_ARGS) { bool Cmd_HSVtoRGB_Execute(COMMAND_ARGS) { *result = 0; double r = 0, g = 0, b = 0, h = 0, s = 0, v = 0; - ScriptVar *rOut, *gOut, *bOut, *hIn, *sIn, *vIn; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &hIn, &sIn, &vIn, &rOut, &gOut, &bOut)) - { + ScriptVar* rOut, * gOut, * bOut, * hIn, * sIn, * vIn; + if (ExtractArgsEx(EXTRACT_ARGS_EX, &hIn, &sIn, &vIn, &rOut, &gOut, &bOut)) { double hh, p, q, t, ff; long i; h = hIn->data; @@ -82,8 +81,7 @@ bool Cmd_HSVtoRGB_Execute(COMMAND_ARGS) { g = p; b = q; break; - } - + } } rOut->data = round(r * 255); gOut->data = round(g * 255); @@ -95,61 +93,59 @@ bool Cmd_HSVtoRGB_Execute(COMMAND_ARGS) { bool Cmd_RGBtoHSV_Execute(COMMAND_ARGS) { *result = 0; double r = 0, g = 0, b = 0, h = 0, s = 0, v = 0; - ScriptVar *rIn, *gIn, *bIn, *hOut, *sOut, *vOut; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &rIn, &gIn, &bIn, &hOut, &sOut, &vOut)) - { - r = (rIn->data) / 255; - g = (gIn->data) / 255; - b = (bIn->data) / 255; - double min, max, delta; + ScriptVar* rIn, * gIn, * bIn, * hOut, * sOut, * vOut; + if (ExtractArgsEx(EXTRACT_ARGS_EX, &rIn, &gIn, &bIn, &hOut, &sOut, &vOut)) { + r = (rIn->data) / 255; + g = (gIn->data) / 255; + b = (bIn->data) / 255; + double min, max, delta; - min = r < g ? r : g; - min = min < b ? min : b; + min = r < g ? r : g; + min = min < b ? min : b; - max = r > g ? r : g; - max = max > b ? max : b; + max = r > g ? r : g; + max = max > b ? max : b; - v = max; - delta = max - min; - if (delta < 0.00001) - { - s = 0; - h = 0; - hOut->data = h; - sOut->data = s; - vOut->data = v; - return true; - } - if (max > 0.0) { - s = (delta / max); - } - else { - s = 0.0; - h = 0; - hOut->data = h; - sOut->data = s; - vOut->data = v; - return true; - } - if (r >= max) { - h = (g - b) / delta; + v = max; + delta = max - min; + if (delta < 0.00001) { + s = 0; + h = 0; + hOut->data = h; + sOut->data = s; + vOut->data = v; + return true; + } + if (max > 0.0) { + s = (delta / max); + } + else { + s = 0.0; + h = 0; + hOut->data = h; + sOut->data = s; + vOut->data = v; + return true; + } + if (r >= max) { + h = (g - b) / delta; + } + else { + if (g >= max) { + h = 2.0 + (b - r) / delta; } else { - if (g >= max) { - h = 2.0 + (b - r) / delta; - } - else { - h = 4.0 + (r - g) / delta; - } + h = 4.0 + (r - g) / delta; } + } - h *= 60.0; - if (h < 0.0) h += 360.0; + h *= 60.0; + if (h < 0.0) h += 360.0; - hOut->data = h; - sOut->data = s; - vOut->data = v; - return true; + hOut->data = h; + sOut->data = s; + vOut->data = v; + return true; } return true; } @@ -185,10 +181,8 @@ bool Cmd_Clamp_Execute(COMMAND_ARGS) { else if (value > max) { *result = max; } - } return true; - } bool Cmd_GetVector3DDistance_Execute(COMMAND_ARGS) { @@ -202,17 +196,14 @@ bool Cmd_GetVector3DDistance_Execute(COMMAND_ARGS) { return true; } -bool Cmd_Get3DDistanceFromHitToNiNode_Execute(COMMAND_ARGS) -{ +bool Cmd_Get3DDistanceFromHitToNiNode_Execute(COMMAND_ARGS) { Actor* actor = (Actor*)thisObj; char NiName[MAX_PATH]; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &NiName) && actor->IsActor() && actor->baseProcess) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &NiName) && actor->IsActor() && actor->baseProcess) { NiAVObject* t_Node = thisObj->GetNiBlock(NiName); ActorHitData* hitData = actor->baseProcess->GetHitData(); if (!hitData || !t_Node) return true; *result = NiNodeComputeDistance(&(t_Node->m_worldTranslate), &(hitData->impactPos)); - } return true; @@ -232,7 +223,7 @@ bool Cmd_Get3DDistanceToNiNode_Execute(COMMAND_ARGS) { bool Cmd_Get3DDistanceBetweenNiNodes_Execute(COMMAND_ARGS) { *result = 0; char NiName1[MAX_PATH], NiName2[MAX_PATH]; - TESObjectREFR *ref1, *ref2; + TESObjectREFR* ref1, * ref2; if (!(ExtractArgsEx(EXTRACT_ARGS_EX, &ref1, &ref2, &NiName1, &NiName2))) return true; NiAVObject* Node1 = ref1->GetNiBlock(NiName1); NiAVObject* Node2 = ref2->GetNiBlock(NiName2); @@ -242,19 +233,15 @@ bool Cmd_Get3DDistanceBetweenNiNodes_Execute(COMMAND_ARGS) { return true; } -bool Cmd_JGLegacyWorldToScreen_Execute(COMMAND_ARGS) -{ - +bool Cmd_JGLegacyWorldToScreen_Execute(COMMAND_ARGS) { *result = 0; float xIn = 0, yIn = 0, zIn = 0; UInt32 HandleType = 0; char X_outS[VarNameSize], Y_outS[VarNameSize], Z_outS[VarNameSize]; TESObjectREFR* refr = NULL; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &X_outS, &Y_outS, &Z_outS, &xIn, &yIn, &zIn, &HandleType, &refr)) - { - if (refr) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &X_outS, &Y_outS, &Z_outS, &xIn, &yIn, &zIn, &HandleType, &refr)) { + if (refr) { xIn += refr->posX; yIn += refr->posY; zIn += refr->posZ; } NiPoint3 NiPointBuffer = { 0,0,0 }; @@ -268,19 +255,15 @@ bool Cmd_JGLegacyWorldToScreen_Execute(COMMAND_ARGS) return true; } -bool Cmd_WorldToScreen_Execute(COMMAND_ARGS) -{ - +bool Cmd_WorldToScreen_Execute(COMMAND_ARGS) { *result = 0; float xIn = 0, yIn = 0, zIn = 0; UInt32 HandleType = 0; NiPoint3 NiPosIn = { 0,0,0 }; TESObjectREFR* refr = NULL; - ScriptVar* X_outS, *Y_outS, *Z_outS; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &X_outS, &Y_outS, &Z_outS, &NiPosIn.x, &NiPosIn.y, &NiPosIn.z, &HandleType, &refr)) - { - if (refr) - { + ScriptVar* X_outS, * Y_outS, * Z_outS; + if (ExtractArgsEx(EXTRACT_ARGS_EX, &X_outS, &Y_outS, &Z_outS, &NiPosIn.x, &NiPosIn.y, &NiPosIn.z, &HandleType, &refr)) { + if (refr) { NiPosIn.x += refr->posX; NiPosIn.y += refr->posY; NiPosIn.z += refr->posZ; } NiPoint3 NiPosOut = { 0, 0, 0 }; @@ -292,33 +275,26 @@ bool Cmd_WorldToScreen_Execute(COMMAND_ARGS) return true; } -bool Cmd_GetCameraTranslation_Execute(COMMAND_ARGS) -{ - +bool Cmd_GetCameraTranslation_Execute(COMMAND_ARGS) { *result = 0; float xIn = 0, yIn = 0, zIn = 0; UInt32 doGetLocal = 0; char X_outS[VarNameSize], Y_outS[VarNameSize], Z_outS[VarNameSize]; TESObjectREFR* refr = NULL; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &X_outS, &Y_outS, &Z_outS, &doGetLocal)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &X_outS, &Y_outS, &Z_outS, &doGetLocal)) { if (auto m_GameCameraPos = JGGameCamera.CamPos) { - if (doGetLocal) - { + if (doGetLocal) { setVarByName(PASS_VARARGS, X_outS, m_GameCameraPos->m_localTranslate.x); setVarByName(PASS_VARARGS, Y_outS, m_GameCameraPos->m_localTranslate.y); setVarByName(PASS_VARARGS, Z_outS, m_GameCameraPos->m_localTranslate.z); } - else - { + else { setVarByName(PASS_VARARGS, X_outS, m_GameCameraPos->m_worldTranslate.x); setVarByName(PASS_VARARGS, Y_outS, m_GameCameraPos->m_worldTranslate.y); setVarByName(PASS_VARARGS, Z_outS, m_GameCameraPos->m_worldTranslate.z); } } - - } return true; } \ No newline at end of file diff --git a/JG/functions/fn_mediaset.h b/JG/functions/fn_mediaset.h index 32dc1a8..6134d93 100644 --- a/JG/functions/fn_mediaset.h +++ b/JG/functions/fn_mediaset.h @@ -12,40 +12,40 @@ bool Cmd_GetMediaSetTraitNumeric_Execute(COMMAND_ARGS) { int traitID = -1; if (ExtractArgsEx(EXTRACT_ARGS_EX, &mediaset, &traitID) && IS_TYPE(mediaset, MediaSet)) { switch (traitID) { - case 0: - *result = mediaset->type; - break; - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - *result = mediaset->data[traitID - 1].dB; - break; - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - *result = mediaset->data[traitID - 7].boundary; - break; - case 13: - *result = mediaset->flags; - break; - case 14: - *result = mediaset->DNAM; - break; - case 15: - *result = mediaset->ENAM; - break; - case 16: - *result = mediaset->FNAM; - break; - case 17: - *result = mediaset->GNAM; - break; + case 0: + *result = mediaset->type; + break; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + *result = mediaset->data[traitID - 1].dB; + break; + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + *result = mediaset->data[traitID - 7].boundary; + break; + case 13: + *result = mediaset->flags; + break; + case 14: + *result = mediaset->DNAM; + break; + case 15: + *result = mediaset->ENAM; + break; + case 16: + *result = mediaset->FNAM; + break; + case 17: + *result = mediaset->GNAM; + break; } if (IsConsoleMode()) Console_Print("GetMediaSetTraitNumeric %d >> %.2f", traitID, *result); @@ -60,43 +60,43 @@ bool Cmd_SetMediaSetTraitNumeric_Execute(COMMAND_ARGS) { if (ExtractArgsEx(EXTRACT_ARGS_EX, &mediaset, &traitID, &newVal) && IS_TYPE(mediaset, MediaSet)) { *result = 1; switch (traitID) { - case 0: - mediaset->type = newVal; - break; - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - mediaset->data[traitID - 1].dB = newVal; - break; - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - mediaset->data[traitID - 7].boundary = newVal; - break; - case 13: - mediaset->flags = newVal; - break; - case 14: - mediaset->DNAM = newVal; - break; - case 15: - mediaset->ENAM = newVal; - break; - case 16: - mediaset->FNAM = newVal; - break; - case 17: - mediaset->GNAM = newVal; - break; - default: - *result = 0; - break; + case 0: + mediaset->type = newVal; + break; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + mediaset->data[traitID - 1].dB = newVal; + break; + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + mediaset->data[traitID - 7].boundary = newVal; + break; + case 13: + mediaset->flags = newVal; + break; + case 14: + mediaset->DNAM = newVal; + break; + case 15: + mediaset->ENAM = newVal; + break; + case 16: + mediaset->FNAM = newVal; + break; + case 17: + mediaset->GNAM = newVal; + break; + default: + *result = 0; + break; } } return true; @@ -106,14 +106,13 @@ bool Cmd_GetMediaSetTraitSound_Execute(COMMAND_ARGS) { int traitID = -1; if (ExtractArgsEx(EXTRACT_ARGS_EX, &mediaset, &traitID) && IS_TYPE(mediaset, MediaSet)) { switch (traitID) { - case 0: - *(UInt32*)result = mediaset->HNAM->refID; - break; - case 1: - *(UInt32*)result = mediaset->INAM->refID; - break; + case 0: + *(UInt32*)result = mediaset->HNAM->refID; + break; + case 1: + *(UInt32*)result = mediaset->INAM->refID; + break; } - } return true; } @@ -124,14 +123,14 @@ bool Cmd_SetMediaSetTraitSound_Execute(COMMAND_ARGS) { *result = 0; if (ExtractArgsEx(EXTRACT_ARGS_EX, &mediaset, &traitID, &soundForm) && IS_TYPE(mediaset, MediaSet) && IS_TYPE(soundForm, TESSound)) { switch (traitID) { - case 0: - mediaset->HNAM = soundForm; - *result = 1; - break; - case 1: - mediaset->INAM = soundForm; - *result = 1; - break; + case 0: + mediaset->HNAM = soundForm; + *result = 1; + break; + case 1: + mediaset->INAM = soundForm; + *result = 1; + break; } } return true; diff --git a/JG/functions/fn_region.h b/JG/functions/fn_region.h index 36c9339..244ca0a 100644 --- a/JG/functions/fn_region.h +++ b/JG/functions/fn_region.h @@ -87,8 +87,7 @@ bool Cmd_GetRegionWeathers_Execute(COMMAND_ARGS) { if (weatherData) { NVSEArrayVar* weatherArr = g_arrInterface->CreateArray(NULL, 0, scriptObj); ListNode* iter = weatherData->weatherTypes.Head(); - do - { + do { if (iter->data) { g_arrInterface->AppendElement(weatherArr, NVSEArrayElement(iter->data->weather)); if (IsConsoleMode()) @@ -107,8 +106,7 @@ bool Cmd_ClearRegionWeathers_Execute(COMMAND_ARGS) { TESRegionDataWeather* weatherData = GetWeatherData(region); if (weatherData) { ListNode* headNode = weatherData->weatherTypes.Head(), * iter = headNode->next; - while (iter) - { + while (iter) { GameHeapFree(iter->data); iter = iter->RemoveMe(); } @@ -184,8 +182,7 @@ bool Cmd_IsWeatherInRegion_Execute(COMMAND_ARGS) { if (weatherData) { ListNode* iter = weatherData->weatherTypes.Head(); WeatherEntry* weatherType; - do - { + do { weatherType = iter->data; if (weatherType->weather == weather) { *result = 1; @@ -210,8 +207,7 @@ bool Cmd_RemoveRegionWeather_Execute(COMMAND_ARGS) { if (weatherData) { ListNode* iter = weatherData->weatherTypes.Head(); WeatherEntry* weatherType; - do - { + do { weatherType = iter->data; if (weatherType->weather == weather) { iter = iter->RemoveMe(); @@ -238,8 +234,7 @@ bool Cmd_AddRegionWeather_Execute(COMMAND_ARGS) { TESRegionDataWeather* weatherData = GetWeatherData(region); if (weatherData) { ListNode* iter = weatherData->weatherTypes.Head(); - do - { + do { if (iter->data && iter->data->weather == weather) return true; } while (iter = iter->next); entry = (WeatherEntry*)GameHeapAlloc(sizeof(WeatherEntry)); diff --git a/JG/functions/fn_ui.h b/JG/functions/fn_ui.h index 444c9f9..70da023 100644 --- a/JG/functions/fn_ui.h +++ b/JG/functions/fn_ui.h @@ -20,25 +20,22 @@ bool Cmd_SetCustomReputationChangeIcon_Execute(COMMAND_ARGS) { char* pathCopy = new char[strlen(path) + 1]; strcpy(pathCopy, path); - if (pos != factionRepIcons.end()) - { - if (*pos->second[tierID-1]) delete[] pos->second[tierID-1]; - pos->second[tierID-1] = pathCopy; + if (pos != factionRepIcons.end()) { + if (*pos->second[tierID - 1]) delete[] pos->second[tierID - 1]; + pos->second[tierID - 1] = pathCopy; } - else - { + else { std::vector v{ "", "", "", "" }; - v[tierID-1] = pathCopy; + v[tierID - 1] = pathCopy; factionRepIcons.insert(std::pair>(rep->refID, v)); } *result = 1; return true; - } bool Cmd_GetSystemColorAlt_Execute(COMMAND_ARGS) { *result = 0; - ScriptVar* rOut, *gOut, *bOut; + ScriptVar* rOut, * gOut, * bOut; UInt32 type; UInt8 color[3] = { 0, 0, 0 }; if (ExtractArgsEx(EXTRACT_ARGS_EX, &type, &rOut, &gOut, &bOut) && type > 0 && type <= 5) { @@ -62,21 +59,18 @@ bool Cmd_GetSystemColor_Execute(COMMAND_ARGS) { return true; }; -bool Cmd_QueueObjectiveText_Execute(COMMAND_ARGS) -{ +bool Cmd_QueueObjectiveText_Execute(COMMAND_ARGS) { char text[MAX_PATH]; UInt32 isCompleted, allowDisplayMultiple; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &text, &isCompleted, &allowDisplayMultiple)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &text, &isCompleted, &allowDisplayMultiple)) { CdeclCall(0x77A5B0, text, isCompleted, allowDisplayMultiple == 0); *result = 1; } return true; }; -bool Cmd_QueueCinematicText_Execute(COMMAND_ARGS) -{ +bool Cmd_QueueCinematicText_Execute(COMMAND_ARGS) { enum { kPriorityAppend = 0, kPriorityPrepend, @@ -94,8 +88,7 @@ bool Cmd_QueueCinematicText_Execute(COMMAND_ARGS) UInt32 justification = kJustifyLeft; int titleFont = -1, subTitleFont = -1; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &title, &subtitle, &soundEdid, &queuePriority, &justification, &titleFont, &subTitleFont)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &title, &subtitle, &soundEdid, &queuePriority, &justification, &titleFont, &subTitleFont)) { if (justification > kJustifyRight) justification = kJustifyRight; if (queuePriority == kPriorityClearQueueShowNow) CdeclCall(0x77F500); // HUDMainMenu::HideQuestLocationText @@ -111,12 +104,9 @@ bool Cmd_SetBipedIconPathAlt_Execute(COMMAND_ARGS) { TESForm* form = NULL; char newPath[MAX_PATH]; *result = 0; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &newPath, &isFemale, &form)) - { - + if (ExtractArgsEx(EXTRACT_ARGS_EX, &newPath, &isFemale, &form)) { TESBipedModelForm* bipedModel = DYNAMIC_CAST(form, TESForm, TESBipedModelForm); - if (bipedModel) - { + if (bipedModel) { bipedModel->icon[isFemale].ddsPath.Set(newPath); *result = 1; } @@ -161,21 +151,17 @@ bool Cmd_SetCustomMapMarkerIcon_Execute(COMMAND_ARGS) { TESObjectREFR* form; char iconPath[MAX_PATH]; if (!ExtractArgsEx(EXTRACT_ARGS_EX, &form, &iconPath) || (!IS_TYPE(form, BGSListForm) && (!form->GetIsReference() || !form->IsMapMarker() || !GetExtraType(form->extraDataList, MapMarker)))) return true; - if (IS_TYPE(form, BGSListForm)) - { + if (IS_TYPE(form, BGSListForm)) { ListNode* iterator = ((BGSListForm*)form)->list.Head(); - while (iterator) - { + while (iterator) { TESObjectREFR* ref = (TESObjectREFR*)(iterator->data); - if (ref->GetIsReference() && ref->IsMapMarker() && GetExtraType(ref->extraDataList, MapMarker)) - { + if (ref->GetIsReference() && ref->IsMapMarker() && GetExtraType(ref->extraDataList, MapMarker)) { SetCustomMapMarker(ref, iconPath); } iterator = iterator->next; } } - else - { + else { SetCustomMapMarker(form, iconPath); } if (IsConsoleMode()) Console_Print("SetCustomMapMarkerIcon >> %u, %s", form->refID, iconPath); diff --git a/JG/functions/fn_utility.h b/JG/functions/fn_utility.h index 27d19e7..e6384e6 100644 --- a/JG/functions/fn_utility.h +++ b/JG/functions/fn_utility.h @@ -46,8 +46,7 @@ bool Cmd_UpdateCrosshairPrompt_Execute(COMMAND_ARGS) { ThisStdCall(0x778B10, NULL); return true; } -enum EType -{ +enum EType { kSetting_Bool = 0, kSetting_c, kSetting_h, @@ -72,8 +71,7 @@ bool Cmd_DumpINI_Execute(COMMAND_ARGS) { const char* cvalue; csv << "fallout.ini" << std::endl; ListNode* istIter = ini->settings.Head(); - do - { + do { setting = istIter->data; if (setting && setting->ValidType()) { std::string name = setting->name; @@ -81,27 +79,26 @@ bool Cmd_DumpINI_Execute(COMMAND_ARGS) { std::string sname = name.substr(0, name.find(":")); std::string cat = name.substr(name.find(":") + 1); switch (setting->GetType()) { - case kSetting_Bool: - case kSetting_Integer: - csv << sname << ";" << cat << ";" << setting->data.i << std::endl; - break; - case kSetting_Unsigned: - csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; - break; - case kSetting_String: - csv << sname << ";" << cat << ";" << setting->data.str << std::endl; - break; - case kSetting_Float: - csv << sname << ";" << cat << ";" << setting->data.f << std::endl; - break; + case kSetting_Bool: + case kSetting_Integer: + csv << sname << ";" << cat << ";" << setting->data.i << std::endl; + break; + case kSetting_Unsigned: + csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; + break; + case kSetting_String: + csv << sname << ";" << cat << ";" << setting->data.str << std::endl; + break; + case kSetting_Float: + csv << sname << ";" << cat << ";" << setting->data.f << std::endl; + break; } } } } while (istIter = istIter->next); csv << "falloutprefs.ini" << std::endl; istIter = prefs->settings.Head(); - do - { + do { setting = istIter->data; if (setting && setting->ValidType()) { std::string name = setting->name; @@ -109,26 +106,25 @@ bool Cmd_DumpINI_Execute(COMMAND_ARGS) { std::string sname = name.substr(0, name.find(":")); std::string cat = name.substr(name.find(":") + 1); switch (setting->GetType()) { - case kSetting_Bool: - case kSetting_Integer: - csv << sname << ";" << cat << ";" << setting->data.i << std::endl; - break; - case kSetting_Unsigned: - csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; - break; - case kSetting_String: - csv << sname << ";" << cat << ";" << setting->data.str << std::endl; - break; - case kSetting_Float: - csv << sname << ";" << cat << ";" << setting->data.f << std::endl; - break; + case kSetting_Bool: + case kSetting_Integer: + csv << sname << ";" << cat << ";" << setting->data.i << std::endl; + break; + case kSetting_Unsigned: + csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; + break; + case kSetting_String: + csv << sname << ";" << cat << ";" << setting->data.str << std::endl; + break; + case kSetting_Float: + csv << sname << ";" << cat << ";" << setting->data.f << std::endl; + break; } } } } while (istIter = istIter->next); istIter = renderer->settings.Head(); - do - { + do { setting = istIter->data; if (setting && setting->ValidType()) { std::string name = setting->name; @@ -136,26 +132,25 @@ bool Cmd_DumpINI_Execute(COMMAND_ARGS) { std::string sname = name.substr(0, name.find(":")); std::string cat = name.substr(name.find(":") + 1); switch (setting->GetType()) { - case kSetting_Bool: - case kSetting_Integer: - csv << sname << ";" << cat << ";" << setting->data.i << std::endl; - break; - case kSetting_Unsigned: - csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; - break; - case kSetting_String: - csv << sname << ";" << cat << ";" << setting->data.str << std::endl; - break; - case kSetting_Float: - csv << sname << ";" << cat << ";" << setting->data.f << std::endl; - break; + case kSetting_Bool: + case kSetting_Integer: + csv << sname << ";" << cat << ";" << setting->data.i << std::endl; + break; + case kSetting_Unsigned: + csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; + break; + case kSetting_String: + csv << sname << ";" << cat << ";" << setting->data.str << std::endl; + break; + case kSetting_Float: + csv << sname << ";" << cat << ";" << setting->data.f << std::endl; + break; } } } } while (istIter = istIter->next); istIter = blend->settings.Head(); - do - { + do { setting = istIter->data; if (setting && setting->ValidType()) { std::string name = setting->name; @@ -163,19 +158,19 @@ bool Cmd_DumpINI_Execute(COMMAND_ARGS) { std::string sname = name.substr(0, name.find(":")); std::string cat = name.substr(name.find(":") + 1); switch (setting->GetType()) { - case kSetting_Bool: - case kSetting_Integer: - csv << sname << ";" << cat << ";" << setting->data.i << std::endl; - break; - case kSetting_Unsigned: - csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; - break; - case kSetting_String: - csv << sname << ";" << cat << ";" << setting->data.str << std::endl; - break; - case kSetting_Float: - csv << sname << ";" << cat << ";" << setting->data.f << std::endl; - break; + case kSetting_Bool: + case kSetting_Integer: + csv << sname << ";" << cat << ";" << setting->data.i << std::endl; + break; + case kSetting_Unsigned: + csv << sname << ";" << cat << ";" << setting->data.uint << std::endl; + break; + case kSetting_String: + csv << sname << ";" << cat << ";" << setting->data.str << std::endl; + break; + case kSetting_Float: + csv << sname << ";" << cat << ";" << setting->data.f << std::endl; + break; } } } @@ -235,8 +230,7 @@ bool Cmd_ar_IsFormInList_Execute(COMMAND_ARGS) { for (int i = 0; i < size; i++) { if (elements[i].Form() == NULL) return true; ListNode* listIter = formList->list.Head(); - do - { + do { if (elements[i].Form() == listIter->data) { *result = 1; delete[] elements; @@ -250,8 +244,7 @@ bool Cmd_ar_IsFormInList_Execute(COMMAND_ARGS) { if (elements[i].Form() == NULL) return true; int elementFound = 0; ListNode* listIter = formList->list.Head(); - do - { + do { if (elements[i].Form() == listIter->data) { elementFound = 1; break; @@ -275,31 +268,29 @@ bool Cmd_SetUIUpdateSound_Execute(COMMAND_ARGS) { if (ExtractArgsEx(EXTRACT_ARGS_EX, &sound, &type) && IS_TYPE(sound, TESSound)) { *result = 1; switch (type) { - case 1: - questFailSound = sound; - break; - case 2: - questNewSound = sound; - break; - case 3: - questCompeteSound = sound; - break; - case 4: - locationDiscoverSound = sound; - break; - default: - *result = 0; - break; + case 1: + questFailSound = sound; + break; + case 2: + questNewSound = sound; + break; + case 3: + questCompeteSound = sound; + break; + case 4: + locationDiscoverSound = sound; + break; + default: + *result = 0; + break; } } return true; } -struct cmp_str -{ +struct cmp_str { public: cmp_str(bool s_) : s(s_) {}; - bool operator()(char const* a, char const* b) const - { + bool operator()(char const* a, char const* b) const { return s ? std::strcmp(a, b) > 0 : std::strcmp(a, b) < 0; } private: @@ -330,16 +321,12 @@ bool Cmd_ar_SortEditor_Execute(COMMAND_ARGS) { delete[] elements; return true; } -bool Cmd_GetSequenceAnimGroup_Execute(COMMAND_ARGS) -{ +bool Cmd_GetSequenceAnimGroup_Execute(COMMAND_ARGS) { *result = -1; UInt32 sequenceID; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &sequenceID) && sequenceID < 8) - { - if (auto animData = thisObj->GetAnimData()) - { - if (auto sequence = animData->animSequence[sequenceID]) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &sequenceID) && sequenceID < 8) { + if (auto animData = thisObj->GetAnimData()) { + if (auto sequence = animData->animSequence[sequenceID]) { UInt16 groupID = animData->groupIDs[sequenceID] & 0xFF; *result = groupID; } @@ -348,12 +335,10 @@ bool Cmd_GetSequenceAnimGroup_Execute(COMMAND_ARGS) return true; } -bool Cmd_GetFormOverrideIndex_Execute(COMMAND_ARGS) -{ +bool Cmd_GetFormOverrideIndex_Execute(COMMAND_ARGS) { *result = 0; TESForm* form; - if (scriptObj && ExtractArgsEx(EXTRACT_ARGS_EX, &form)) - { + if (scriptObj && ExtractArgsEx(EXTRACT_ARGS_EX, &form)) { UInt8 overriding = form->GetOverridingModIdx(); *result = ((overriding > scriptObj->modIndex) ? overriding : 0); if (IsConsoleMode()) Console_Print("GetFormOverrideIndex >> %.f", *result); @@ -370,11 +355,9 @@ bool Cmd_GetPipBoyMode_Execute(COMMAND_ARGS) { bool Cmd_GetLinearVelocity_Execute(COMMAND_ARGS) { char X_outS[VarNameSize], Y_outS[VarNameSize], Z_outS[VarNameSize]; char nodeName[MAX_PATH]; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &nodeName, &X_outS, &Y_outS, &Z_outS)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &nodeName, &X_outS, &Y_outS, &Z_outS)) { hkpRigidBody* rigidBody = thisObj->GetRigidBody(nodeName); - if (rigidBody) - { + if (rigidBody) { NiVector4 linVelocity = rigidBody->motion.linVelocity; setVarByName(PASS_VARARGS, X_outS, linVelocity.x); setVarByName(PASS_VARARGS, Y_outS, linVelocity.y); @@ -426,15 +409,15 @@ bool Cmd_GetTimePlayed_Execute(COMMAND_ARGS) { tickCount = GetTickCount(); double timePlayed = tickCount - g_initialTickCount; switch (type) { - case 0: - *result = timePlayed; - break; - case 1: - *result = timePlayed / 1000; - break; - case 2: - *result = timePlayed / 60000; - break; + case 0: + *result = timePlayed; + break; + case 1: + *result = timePlayed / 1000; + break; + case 2: + *result = timePlayed / 60000; + break; } if (IsConsoleMode()) { Console_Print("%f", *result); @@ -442,12 +425,10 @@ bool Cmd_GetTimePlayed_Execute(COMMAND_ARGS) { return true; } -bool Cmd_GetJohnnyPatch_Execute(COMMAND_ARGS) -{ +bool Cmd_GetJohnnyPatch_Execute(COMMAND_ARGS) { int patch = 0; bool enabled = false; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &patch)) - { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &patch)) { switch (patch) { case 1: enabled = loadEditorIDs; @@ -491,24 +472,19 @@ bool Cmd_GetEditorID_Execute(COMMAND_ARGS) { } return true; } -bool Cmd_IsLevelUpMenuEnabled_Execute(COMMAND_ARGS) -{ +bool Cmd_IsLevelUpMenuEnabled_Execute(COMMAND_ARGS) { *result = isShowLevelUp; if (IsConsoleMode()) Console_Print("IsLevelUpMenuEnabled >> %.f", *result); return true; } -bool Cmd_ExitGameAlt_Execute(COMMAND_ARGS) -{ - +bool Cmd_ExitGameAlt_Execute(COMMAND_ARGS) { ThisStdCall(0x0703DA0, nullptr); ThisStdCall(0x07D0A70, nullptr); return true; } - -bool Cmd_SetOptionalBone_Execute(COMMAND_ARGS) -{ +bool Cmd_SetOptionalBone_Execute(COMMAND_ARGS) { uintptr_t optIdx = -1; *result = 0; char boneName[MAX_PATH] = { 0 }; @@ -516,8 +492,7 @@ bool Cmd_SetOptionalBone_Execute(COMMAND_ARGS) if (optIdx > 4) return true; auto doUpdateBone = [optIdx, &boneName, &result](ValidBip01Names* BipedAnim) { if (BipedAnim) { - if (BipedAnim->bip01 && BipedAnim->bip01->GetNiNode()) - { + if (BipedAnim->bip01 && BipedAnim->bip01->GetNiNode()) { auto vb = CdeclCall(0x04AAE30, BipedAnim->bip01, boneName); if (vb && vb->GetNiNode()) { BipedAnim->bones[optIdx].bone = vb; @@ -536,21 +511,18 @@ bool Cmd_SetOptionalBone_Execute(COMMAND_ARGS) return true; } - bool Cmd_GetOptionalBone_Execute(COMMAND_ARGS) { uintptr_t optIdx = -1; if (ExtractArgsEx(EXTRACT_ARGS_EX, &optIdx)) { if (thisObj && thisObj->IsCharacter() && optIdx <= 4) - if (auto BipedAnim = ((Character*)thisObj)->validBip01Names) { - if (BipedAnim->bones[optIdx].bone && BipedAnim->bones[optIdx].bone->GetNiNode()) - { - g_strInterface->Assign(PASS_COMMAND_ARGS, BipedAnim->bones[optIdx].bone->m_blockName); - if (IsConsoleMode()) - Console_Print("GetOptionalBone >> %s", BipedAnim->bones[optIdx].bone->m_blockName); + if (auto BipedAnim = ((Character*)thisObj)->validBip01Names) { + if (BipedAnim->bones[optIdx].bone && BipedAnim->bones[optIdx].bone->GetNiNode()) { + g_strInterface->Assign(PASS_COMMAND_ARGS, BipedAnim->bones[optIdx].bone->m_blockName); + if (IsConsoleMode()) + Console_Print("GetOptionalBone >> %s", BipedAnim->bones[optIdx].bone->m_blockName); + } } - } - } return true; } \ No newline at end of file diff --git a/JG/internal/containers.h b/JG/internal/containers.h index 812d9be..4f83a4d 100644 --- a/JG/internal/containers.h +++ b/JG/internal/containers.h @@ -2,8 +2,7 @@ #include "internal/utility.h" -enum -{ +enum { kMapDefaultAlloc = 8, kMapDefaultBucketNum = 11, @@ -12,23 +11,20 @@ enum kVectorDefaultAlloc = 2, }; -template class MappedKey -{ +template class MappedKey { T_Key key; public: T_Key Get() const { return key; } void Set(T_Key inKey) { key = inKey; } - char Compare(T_Key inKey) const - { + char Compare(T_Key inKey) const { if (inKey == key) return 0; return (inKey < key) ? -1 : 1; } void Clear() {} }; -template <> class MappedKey -{ +template <> class MappedKey { const char* key; public: @@ -38,8 +34,7 @@ template <> class MappedKey void Clear() {} }; -template <> class MappedKey -{ +template <> class MappedKey { char* key; public: @@ -49,18 +44,15 @@ template <> class MappedKey void Clear() { free(key); } }; -template class Map -{ +template class Map { protected: typedef MappedKey M_Key; - struct Entry - { + struct Entry { M_Key key; T_Data value; - void Clear() - { + void Clear() { key.Clear(); value.~T_Data(); } @@ -70,16 +62,13 @@ template class Map UInt32 numEntries; // 04 UInt32 alloc; // 08 - __declspec(noinline) bool GetIndex(T_Key key, UInt32& outIdx) const - { + __declspec(noinline) bool GetIndex(T_Key key, UInt32& outIdx) const { UInt32 lBound = 0, uBound = numEntries, index; char cmpr; - while (lBound != uBound) - { + while (lBound != uBound) { index = (lBound + uBound) / 2; cmpr = entries[index].key.Compare(key); - if (!cmpr) - { + if (!cmpr) { outIdx = index; return true; } @@ -90,17 +79,14 @@ template class Map return false; } - __declspec(noinline) bool InsertKey(T_Key key, T_Data*& outData) - { + __declspec(noinline) bool InsertKey(T_Key key, T_Data*& outData) { UInt32 index; - if (GetIndex(key, index)) - { + if (GetIndex(key, index)) { outData = &entries[index].value; return false; } if (!entries) entries = (Entry*)malloc(sizeof(Entry) * alloc); - else if (numEntries == alloc) - { + else if (numEntries == alloc) { alloc *= 2; entries = (Entry*)realloc(entries, sizeof(Entry) * alloc); } @@ -115,8 +101,7 @@ template class Map public: Map(UInt32 _alloc = kMapDefaultAlloc) : entries(NULL), numEntries(0), alloc(_alloc) {} - ~Map() - { + ~Map() { if (!entries) return; while (numEntries) entries[--numEntries].Clear(); @@ -127,15 +112,13 @@ template class Map UInt32 Size() const { return numEntries; } bool Empty() const { return !numEntries; } - bool Insert(T_Key key, T_Data*& outData) - { + bool Insert(T_Key key, T_Data*& outData) { if (!InsertKey(key, outData)) return false; new (outData) T_Data(); return true; } - T_Data& operator[](T_Key key) - { + T_Data& operator[](T_Key key) { T_Data* outData; if (InsertKey(key, outData)) new (outData) T_Data(); @@ -143,34 +126,29 @@ template class Map } template - T_Data* Emplace(T_Key key, Args&& ...args) - { + T_Data* Emplace(T_Key key, Args&& ...args) { T_Data* outData; if (InsertKey(key, outData)) new (outData) T_Data(std::forward(args)...); return outData; } - bool HasKey(T_Key key) const - { + bool HasKey(T_Key key) const { UInt32 index; return GetIndex(key, index); } - T_Data Get(T_Key key) const - { + T_Data Get(T_Key key) const { UInt32 index; return GetIndex(key, index) ? entries[index].value : NULL; } - T_Data* GetPtr(T_Key key) const - { + T_Data* GetPtr(T_Key key) const { UInt32 index; return GetIndex(key, index) ? &entries[index].value : NULL; } - bool Erase(T_Key key) - { + bool Erase(T_Key key) { UInt32 index; if (!GetIndex(key, index)) return false; Entry* entry = entries + index; @@ -181,14 +159,12 @@ template class Map return true; } - void Clear() - { + void Clear() { for (Entry* entry = entries; numEntries; numEntries--, entry++) entry->Clear(); } - class Iterator - { + class Iterator { protected: friend Map; @@ -202,13 +178,11 @@ template class Map T_Data operator->() const { return entry->value; } bool End() const { return !count; } - void operator++() - { + void operator++() { entry++; count--; } - void operator--() - { + void operator--() { entry--; count--; } @@ -217,20 +191,17 @@ template class Map Iterator(Map& source) : entry(source.entries), count(source.numEntries) {} }; - class OpIterator : public Iterator - { + class OpIterator : public Iterator { Map* table; // 08 public: Map* Table() const { return table; } - void Remove(bool frwrd = true) - { + void Remove(bool frwrd = true) { entry->Clear(); Entry* pEntry = entry; UInt32 index; - if (frwrd) - { + if (frwrd) { index = count - 1; entry--; } @@ -239,37 +210,30 @@ template class Map table->numEntries--; } - OpIterator(Map& source) : table(&source) - { + OpIterator(Map& source) : table(&source) { entry = source.entries; count = source.numEntries; } - OpIterator(Map& source, T_Key key) : table(&source) - { + OpIterator(Map& source, T_Key key) : table(&source) { UInt32 index; - if (source.GetIndex(key, index)) - { + if (source.GetIndex(key, index)) { entry = source.entries + index; count = source.numEntries - index; } else count = 0; } - OpIterator(Map& source, T_Key key, bool frwrd) : table(&source) - { - if (!source.numEntries) - { + OpIterator(Map& source, T_Key key, bool frwrd) : table(&source) { + if (!source.numEntries) { count = 0; return; } UInt32 index; bool match = source.GetIndex(key, index); - if (frwrd) - { + if (frwrd) { entry = source.entries + index; count = source.numEntries - index; } - else - { + else { entry = source.entries + (index - !match); count = index + match; } @@ -277,8 +241,7 @@ template class Map }; }; -template class Set -{ +template class Set { protected: typedef MappedKey M_Key; @@ -286,16 +249,13 @@ template class Set UInt32 numKeys; // 04 UInt32 alloc; // 08 - __declspec(noinline) bool GetIndex(T_Key key, UInt32& outIdx) const - { + __declspec(noinline) bool GetIndex(T_Key key, UInt32& outIdx) const { UInt32 lBound = 0, uBound = numKeys, index; char cmpr; - while (lBound != uBound) - { + while (lBound != uBound) { index = (lBound + uBound) / 2; cmpr = keys[index].Compare(key); - if (!cmpr) - { + if (!cmpr) { outIdx = index; return true; } @@ -308,8 +268,7 @@ template class Set public: Set(UInt32 _alloc = kVectorDefaultAlloc) : keys(NULL), numKeys(0), alloc(_alloc) {} - ~Set() - { + ~Set() { if (!keys) return; while (numKeys) keys[--numKeys].Clear(); @@ -320,13 +279,11 @@ template class Set UInt32 Size() const { return numKeys; } bool Empty() const { return !numKeys; } - __declspec(noinline) bool Insert(T_Key key) - { + __declspec(noinline) bool Insert(T_Key key) { UInt32 index; if (GetIndex(key, index)) return false; if (!keys) keys = (M_Key*)malloc(sizeof(M_Key) * alloc); - else if (numKeys == alloc) - { + else if (numKeys == alloc) { alloc *= 2; keys = (M_Key*)realloc(keys, sizeof(M_Key) * alloc); } @@ -338,14 +295,12 @@ template class Set return true; } - bool HasKey(T_Key key) const - { + bool HasKey(T_Key key) const { UInt32 index; return GetIndex(key, index); } - bool Erase(T_Key key) - { + bool Erase(T_Key key) { UInt32 index; if (!GetIndex(key, index)) return false; M_Key* pKey = keys + index; @@ -356,27 +311,22 @@ template class Set return true; } - void Clear(bool clrKeys = false) - { - if (clrKeys) - { + void Clear(bool clrKeys = false) { + if (clrKeys) { for (M_Key* pKey = keys; numKeys; numKeys--, pKey++) pKey->Clear(); } else numKeys = 0; } - __declspec(noinline) void CopyFrom(const Set& source) - { + __declspec(noinline) void CopyFrom(const Set& source) { numKeys = source.numKeys; if (!numKeys) return; - if (!keys) - { + if (!keys) { alloc = numKeys; keys = (M_Key*)malloc(sizeof(M_Key) * alloc); } - else if (numKeys > alloc) - { + else if (numKeys > alloc) { alloc = numKeys; free(keys); keys = (M_Key*)malloc(sizeof(M_Key) * alloc); @@ -384,14 +334,12 @@ template class Set memcpy(keys, source.keys, sizeof(M_Key) * numKeys); } - bool CompareTo(const Set& source) const - { + bool CompareTo(const Set& source) const { if (numKeys != source.numKeys) return false; return !numKeys || MemCmp(keys, source.keys, sizeof(M_Key) * numKeys); } - class Iterator - { + class Iterator { friend Set; M_Key* pKey; // 00 @@ -402,19 +350,16 @@ template class Set T_Key operator->() const { return pKey->Get(); } bool End() const { return !count; } - void operator++() - { + void operator++() { pKey++; count--; } Iterator() {} Iterator(Set& source) : pKey(source.keys), count(source.numKeys) {} - Iterator(Set& source, T_Key key) - { + Iterator(Set& source, T_Key key) { UInt32 index; - if (source.GetIndex(key, index)) - { + if (source.GetIndex(key, index)) { pKey = source.keys + index; count = source.numKeys - index; } @@ -422,15 +367,13 @@ template class Set } }; - class OpIterator : public Iterator - { + class OpIterator : public Iterator { Set* table; // 08 public: Set* Table() const { return table; } - void Remove() - { + void Remove() { pKey->Clear(); M_Key* _key = pKey; UInt32 index = count - 1; @@ -439,16 +382,14 @@ template class Set table->numKeys--; } - OpIterator(Set& source) : table(&source) - { + OpIterator(Set& source) : table(&source) { pKey = source.keys; count = source.numKeys; } }; }; -template class HashedKey -{ +template class HashedKey { T_Key key; public: @@ -459,8 +400,7 @@ template class HashedKey void Clear() {} }; -template <> class HashedKey -{ +template <> class HashedKey { UInt32 key; public: @@ -471,16 +411,14 @@ template <> class HashedKey void Clear() {} }; -template <> class HashedKey -{ +template <> class HashedKey { UInt32 hashVal; char* key; public: static UInt32 Hash(char* inKey) { return StrHash(inKey); } char* Get() const { return key; } - void Set(char* inKey, UInt32 inHash) - { + void Set(char* inKey, UInt32 inHash) { hashVal = inHash; key = CopyString(inKey); } @@ -488,47 +426,39 @@ template <> class HashedKey void Clear() { free(key); } }; -template class UnorderedMap -{ +template class UnorderedMap { protected: typedef HashedKey H_Key; - struct Entry - { + struct Entry { H_Key key; T_Data value; - void Clear() - { + void Clear() { key.Clear(); value.~T_Data(); } }; - struct Bucket - { + struct Bucket { Entry* entries; // 00 UInt8 numEntries; // 04 UInt8 alloc; // 05 UInt8 pad06[2]; // 06 - __declspec(noinline) Entry* AddEntry() - { - if (alloc == numEntries) - { + __declspec(noinline) Entry* AddEntry() { + if (alloc == numEntries) { alloc += kMapBucketSizeInc; entries = (Entry*)realloc(entries, sizeof(Entry) * alloc); } return entries + numEntries++; } - __declspec(noinline) void Clear(bool doFree = true) - { + __declspec(noinline) void Clear(bool doFree = true) { if (!entries) return; for (Entry* entry = entries; numEntries; numEntries--, entry++) entry->Clear(); - if (doFree) - { + if (doFree) { free(entries); entries = NULL; } @@ -539,16 +469,13 @@ template class UnorderedMap UInt32 numBuckets; // 04 UInt32 numItems; // 08 - __declspec(noinline) void ExpandTable() - { + __declspec(noinline) void ExpandTable() { UInt32 newCount = GetNextPrime(numBuckets * 2); Bucket* newBuckets = (Bucket*)calloc(newCount, sizeof(Bucket)); Entry* entry; UInt8 count; - for (Bucket* currBucket = buckets; numBuckets; numBuckets--, currBucket++) - { - if (entry = currBucket->entries) - { + for (Bucket* currBucket = buckets; numBuckets; numBuckets--, currBucket++) { + if (entry = currBucket->entries) { for (count = currBucket->numEntries; count; count--, entry++) *(newBuckets[entry->key.GetHash() % newCount].AddEntry()) = *entry; free(currBucket->entries); @@ -559,8 +486,7 @@ template class UnorderedMap numBuckets = newCount; } - __declspec(noinline) Entry* FindEntry(T_Key key) const - { + __declspec(noinline) Entry* FindEntry(T_Key key) const { if (!numItems) return NULL; UInt32 hashVal = H_Key::Hash(key); Bucket& bucket = buckets[hashVal % numBuckets]; @@ -570,15 +496,13 @@ template class UnorderedMap return NULL; } - __declspec(noinline) bool InsertKey(T_Key key, T_Data*& outData) - { + __declspec(noinline) bool InsertKey(T_Key key, T_Data*& outData) { if (!buckets) buckets = (Bucket*)calloc(numBuckets, sizeof(Bucket)); else if (numItems == numBuckets) ExpandTable(); UInt32 hashVal = H_Key::Hash(key); Bucket& bucket = buckets[hashVal % numBuckets]; Entry* entry = bucket.entries; - for (UInt8 count = bucket.numEntries; count; count--, entry++) - { + for (UInt8 count = bucket.numEntries; count; count--, entry++) { if (entry->key.GetHash() != hashVal) continue; outData = &entry->value; return false; @@ -592,8 +516,7 @@ template class UnorderedMap public: UnorderedMap(UInt32 _numBuckets = kMapDefaultBucketNum) : buckets(NULL), numBuckets(_numBuckets), numItems(0) {} - ~UnorderedMap() - { + ~UnorderedMap() { if (!buckets) return; for (Bucket* bucket = buckets; numBuckets; numBuckets--, bucket++) bucket->Clear(); @@ -604,15 +527,13 @@ template class UnorderedMap UInt32 Size() const { return numItems; } bool Empty() const { return !numItems; } - bool Insert(T_Key key, T_Data*& outData) - { + bool Insert(T_Key key, T_Data*& outData) { if (!InsertKey(key, outData)) return false; new (outData) T_Data(); return true; } - T_Data& operator[](T_Key key) - { + T_Data& operator[](T_Key key) { T_Data* outData; if (InsertKey(key, outData)) new (outData) T_Data(); @@ -620,16 +541,14 @@ template class UnorderedMap } template - T_Data* Emplace(T_Key key, Args&& ...args) - { + T_Data* Emplace(T_Key key, Args&& ...args) { T_Data* outData; if (InsertKey(key, outData)) new (outData) T_Data(std::forward(args)...); return outData; } - T_Data InsertNotIn(T_Key key, T_Data value) - { + T_Data InsertNotIn(T_Key key, T_Data value) { T_Data* outData; if (InsertKey(key, outData)) *outData = value; @@ -638,26 +557,22 @@ template class UnorderedMap bool HasKey(T_Key key) const { return FindEntry(key) ? true : false; } - T_Data Get(T_Key key) const - { + T_Data Get(T_Key key) const { Entry* entry = FindEntry(key); return entry ? entry->value : NULL; } - T_Data* GetPtr(T_Key key) const - { + T_Data* GetPtr(T_Key key) const { Entry* entry = FindEntry(key); return entry ? &entry->value : NULL; } - bool Erase(T_Key key) - { + bool Erase(T_Key key) { if (!numItems) return false; UInt32 hashVal = H_Key::Hash(key); Bucket& bucket = buckets[hashVal % numBuckets]; Entry* entry = bucket.entries; - for (UInt8 count = bucket.numEntries; count; count--, entry++) - { + for (UInt8 count = bucket.numEntries; count; count--, entry++) { if (entry->key.GetHash() != hashVal) continue; entry->Clear(); bucket.numEntries--; @@ -668,14 +583,12 @@ template class UnorderedMap return false; } - T_Data GetErase(T_Key key) - { + T_Data GetErase(T_Key key) { if (!numItems) return NULL; UInt32 hashVal = H_Key::Hash(key); Bucket& bucket = buckets[hashVal % numBuckets]; Entry* entry = bucket.entries; - for (UInt8 count = bucket.numEntries; count; count--, entry++) - { + for (UInt8 count = bucket.numEntries; count; count--, entry++) { if (entry->key.GetHash() != hashVal) continue; T_Data outVal = entry->value; entry->Clear(); @@ -687,13 +600,11 @@ template class UnorderedMap return NULL; } - bool Clear(bool clrBkt = true) - { + bool Clear(bool clrBkt = true) { if (!numItems) return false; numItems = 0; Bucket* bucket = buckets; - for (UInt32 count = numBuckets; count; count--, bucket++) - { + for (UInt32 count = numBuckets; count; count--, bucket++) { if (clrBkt) bucket->Clear(false); else bucket->numEntries = 0; } @@ -717,8 +628,7 @@ template class UnorderedMap loadArray[8], loadArray[9], loadArray[10], loadArray[11], loadArray[12], loadArray[13], loadArray[14], loadArray[15]); }*/ - class Iterator - { + class Iterator { friend UnorderedMap; UnorderedMap* table; // 00 @@ -729,8 +639,7 @@ template class UnorderedMap Bucket* bucket; // 0C Entry* entry; // 10 - void FindValid() - { + void FindValid() { if (table->numItems) for (; bucketIdx < table->numBuckets; bucketIdx++, bucket++) if (bucket->numEntries && (entry = bucket->entries)) return; @@ -738,11 +647,9 @@ template class UnorderedMap } public: - void Init(UnorderedMap& _table) - { + void Init(UnorderedMap& _table) { table = &_table; - if (table) - { + if (table) { bucketIdx = 0; entryIdx = 0; removed = false; @@ -752,11 +659,9 @@ template class UnorderedMap else entry = NULL; } - void Find(UnorderedMap& _table, T_Key key) - { + void Find(UnorderedMap& _table, T_Key key) { table = &_table; - if (table && table->numItems) - { + if (table && table->numItems) { UInt32 hashVal = H_Key::Hash(key); bucketIdx = hashVal % table->numBuckets; entryIdx = 0; @@ -776,12 +681,10 @@ template class UnorderedMap T_Data operator->() const { return entry->value; } bool End() const { return !entry; } - void operator++() - { + void operator++() { if (removed) removed = false; else entryIdx++; - if (entryIdx >= bucket->numEntries) - { + if (entryIdx >= bucket->numEntries) { bucketIdx++; entryIdx = 0; bucket++; @@ -792,11 +695,9 @@ template class UnorderedMap bool IsValid() const { return entry && (entryIdx < bucket->numEntries); } - void Remove() - { + void Remove() { entry->Clear(); - if (--bucket->numEntries > entryIdx) - { + if (--bucket->numEntries > entryIdx) { *entry = bucket->entries[bucket->numEntries]; removed = true; } @@ -809,35 +710,29 @@ template class UnorderedMap }; }; -template class UnorderedSet -{ +template class UnorderedSet { protected: typedef HashedKey H_Key; - struct Bucket - { + struct Bucket { H_Key* entries; // 00 UInt8 numEntries; // 04 UInt8 alloc; // 05 UInt8 pad06[2]; // 06 - __declspec(noinline) H_Key* AddEntry() - { - if (alloc == numEntries) - { + __declspec(noinline) H_Key* AddEntry() { + if (alloc == numEntries) { alloc += kMapBucketSizeInc; entries = (H_Key*)realloc(entries, sizeof(H_Key) * alloc); } return entries + numEntries++; } - __declspec(noinline) void Clear(bool doFree = true) - { + __declspec(noinline) void Clear(bool doFree = true) { if (!entries) return; for (H_Key* entry = entries; numEntries; numEntries--, entry++) entry->Clear(); - if (doFree) - { + if (doFree) { free(entries); entries = NULL; } @@ -848,16 +743,13 @@ template class UnorderedSet UInt32 numBuckets; // 04 UInt32 numItems; // 08 - __declspec(noinline) void ExpandTable() - { + __declspec(noinline) void ExpandTable() { UInt32 newCount = GetNextPrime(numBuckets * 2); Bucket* newBuckets = (Bucket*)calloc(newCount, sizeof(Bucket)); H_Key* entry; UInt8 count; - for (Bucket* currBucket = buckets; numBuckets; numBuckets--, currBucket++) - { - if (entry = currBucket->entries) - { + for (Bucket* currBucket = buckets; numBuckets; numBuckets--, currBucket++) { + if (entry = currBucket->entries) { for (count = currBucket->numEntries; count; count--, entry++) *(newBuckets[entry->GetHash() % newCount].AddEntry()) = *entry; free(currBucket->entries); @@ -870,8 +762,7 @@ template class UnorderedSet public: UnorderedSet(UInt32 _numBuckets = kMapDefaultBucketNum) : buckets(NULL), numBuckets(_numBuckets), numItems(0) {} - ~UnorderedSet() - { + ~UnorderedSet() { if (!buckets) return; for (Bucket* bucket = buckets; numBuckets; numBuckets--, bucket++) bucket->Clear(); @@ -882,8 +773,7 @@ template class UnorderedSet UInt32 Size() const { return numItems; } bool Empty() const { return !numItems; } - __declspec(noinline) bool Insert(T_Key key) - { + __declspec(noinline) bool Insert(T_Key key) { if (!buckets) buckets = (Bucket*)calloc(numBuckets, sizeof(Bucket)); else if (numItems == numBuckets) ExpandTable(); UInt32 hashVal = H_Key::Hash(key); @@ -897,8 +787,7 @@ template class UnorderedSet return true; } - bool HasKey(T_Key key) const - { + bool HasKey(T_Key key) const { if (!numItems) return false; UInt32 hashVal = H_Key::Hash(key); Bucket& bucket = buckets[hashVal % numBuckets]; @@ -908,14 +797,12 @@ template class UnorderedSet return false; } - bool Erase(T_Key key) - { + bool Erase(T_Key key) { if (!numItems) return false; UInt32 hashVal = H_Key::Hash(key); Bucket& bucket = buckets[hashVal % numBuckets]; H_Key* entry = bucket.entries; - for (UInt8 count = bucket.numEntries; count; count--, entry++) - { + for (UInt8 count = bucket.numEntries; count; count--, entry++) { if (entry->GetHash() != hashVal) continue; entry->Clear(); bucket.numEntries--; @@ -926,21 +813,18 @@ template class UnorderedSet return false; } - bool Clear(bool clrBkt = false) - { + bool Clear(bool clrBkt = false) { if (!numItems) return false; numItems = 0; Bucket* bucket = buckets; - for (UInt32 count = numBuckets; count; count--, bucket++) - { + for (UInt32 count = numBuckets; count; count--, bucket++) { if (clrBkt) bucket->Clear(false); else bucket->numEntries = 0; } return true; } - class Iterator - { + class Iterator { friend UnorderedSet; UnorderedSet* table; // 00 @@ -950,8 +834,7 @@ template class UnorderedSet Bucket* bucket; // 0C H_Key* entry; // 10 - void FindValid() - { + void FindValid() { if (table->numItems) for (; bucketIdx < table->numBuckets; bucketIdx++, bucket++) if (bucket->numEntries && (entry = bucket->entries)) return; @@ -959,11 +842,9 @@ template class UnorderedSet } public: - void Init(UnorderedSet& _table) - { + void Init(UnorderedSet& _table) { table = &_table; - if (table) - { + if (table) { bucketIdx = 0; entryIdx = 0; bucket = table->buckets; @@ -976,10 +857,8 @@ template class UnorderedSet T_Key operator->() const { return entry->Get(); } bool End() const { return !entry; } - void operator++() - { - if (++entryIdx >= bucket->numEntries) - { + void operator++() { + if (++entryIdx >= bucket->numEntries) { bucketIdx++; entryIdx = 0; bucket++; @@ -993,18 +872,15 @@ template class UnorderedSet }; }; -template class Vector -{ +template class Vector { protected: T_Data* data; // 00 UInt32 numItems; // 04 UInt32 alloc; // 08 - __declspec(noinline) T_Data* AllocateData() - { + __declspec(noinline) T_Data* AllocateData() { if (!data) data = (T_Data*)malloc(sizeof(T_Data) * alloc); - else if (numItems == alloc) - { + else if (numItems == alloc) { alloc *= 2; data = (T_Data*)realloc(data, sizeof(T_Data) * alloc); } @@ -1013,8 +889,7 @@ template class Vector public: Vector(UInt32 _alloc = kVectorDefaultAlloc) : alloc(_alloc), numItems(0), data(NULL) {} - ~Vector() - { + ~Vector() { if (!data) return; while (numItems) data[--numItems].~T_Data(); free(data); @@ -1030,23 +905,19 @@ template class Vector T_Data* Get(UInt32 index) const { return (index < numItems) ? (data + index) : NULL; } - void Append(const T_Data item) - { + void Append(const T_Data item) { T_Data* pData = AllocateData(); *pData = item; } - __declspec(noinline) void Concatenate(const Vector& source) - { + __declspec(noinline) void Concatenate(const Vector& source) { if (!source.numItems) return; UInt32 newCount = numItems + source.numItems; - if (!data) - { + if (!data) { if (alloc < newCount) alloc = newCount; data = (T_Data*)malloc(sizeof(T_Data) * alloc); } - else if (alloc < newCount) - { + else if (alloc < newCount) { alloc = newCount; data = (T_Data*)realloc(data, sizeof(T_Data) * alloc); } @@ -1054,14 +925,11 @@ template class Vector numItems = newCount; } - void Insert(const T_Data& item, UInt32 index) - { - if (index <= numItems) - { + void Insert(const T_Data& item, UInt32 index) { + if (index <= numItems) { UInt32 size = numItems - index; T_Data* pData = AllocateData(); - if (size) - { + if (size) { pData = data + index; memmove(pData + 1, pData, sizeof(T_Data) * size); } @@ -1069,19 +937,16 @@ template class Vector } } - UInt32 InsertSorted(const T_Data& item) - { + UInt32 InsertSorted(const T_Data& item) { UInt32 lBound = 0, uBound = numItems, index; - while (lBound != uBound) - { + while (lBound != uBound) { index = (lBound + uBound) / 2; if (item < data[index]) uBound = index; else lBound = index + 1; } uBound = numItems - lBound; T_Data* pData = AllocateData(); - if (uBound) - { + if (uBound) { pData = data + lBound; memmove(pData + 1, pData, sizeof(T_Data) * uBound); } @@ -1090,13 +955,11 @@ template class Vector } template - T_Data* Emplace(Args&& ...args) - { + T_Data* Emplace(Args&& ...args) { return new (AllocateData()) T_Data(std::forward(args)...); } - bool RemoveNth(UInt32 index) - { + bool RemoveNth(UInt32 index) { if ((index < 0) || (index >= numItems)) return false; T_Data* pData = data + index; pData->~T_Data(); @@ -1106,8 +969,7 @@ template class Vector return true; } - SInt32 GetIndexOf(T_Data item) const - { + SInt32 GetIndexOf(T_Data item) const { T_Data* pData = data; for (UInt32 count = numItems; count; count--, pData++) if (*pData == item) return numItems - count; @@ -1115,8 +977,7 @@ template class Vector } template - SInt32 GetIndexOf(Finder& finder) const - { + SInt32 GetIndexOf(Finder& finder) const { T_Data* pData = data; for (UInt32 count = numItems; count; count--, pData++) if (finder.Accept(*pData)) return numItems - count; @@ -1124,21 +985,18 @@ template class Vector } template - T_Data* Find(Finder& finder) const - { + T_Data* Find(Finder& finder) const { T_Data* pData = data; for (UInt32 count = numItems; count; count--, pData++) if (finder.Accept(*pData)) return pData; return NULL; } - bool Remove(T_Data item) - { + bool Remove(T_Data item) { if (!numItems) return false; T_Data* pData = data + numItems; UInt32 count = numItems; - for (; count; count--) - { + for (; count; count--) { pData--; if (*pData != item) continue; pData->~T_Data(); @@ -1151,13 +1009,11 @@ template class Vector } template - UInt32 Remove(Finder& finder) - { + UInt32 Remove(Finder& finder) { if (!numItems) return 0; UInt32 removed = 0, size; T_Data* pData = data + numItems; - for (UInt32 count = numItems; count; count--) - { + for (UInt32 count = numItems; count; count--) { pData--; if (!finder.Accept(*pData)) continue; pData->~T_Data(); @@ -1169,14 +1025,12 @@ template class Vector return removed; } - void RemoveRange(UInt32 beginIdx, UInt32 count) - { + void RemoveRange(UInt32 beginIdx, UInt32 count) { if (beginIdx >= numItems) return; if (count > (numItems - beginIdx)) count = numItems - beginIdx; T_Data* pData = data + beginIdx + count; - for (UInt32 index = count; index; index--) - { + for (UInt32 index = count; index; index--) { pData--; pData->~T_Data(); } @@ -1185,8 +1039,7 @@ template class Vector numItems -= count; } - bool Clear(bool delData = false) - { + bool Clear(bool delData = false) { if (!numItems) return false; if (delData) while (numItems) @@ -1197,13 +1050,11 @@ template class Vector typedef bool (*CompareFunc)(T_Data&, T_Data&); - void QuickSort(UInt32 p, UInt32 q, CompareFunc compareFunc) - { + void QuickSort(UInt32 p, UInt32 q, CompareFunc compareFunc) { if (p >= q) return; UInt32 i = p; T_Data temp; - for (UInt32 j = p + 1; j < q; j++) - { + for (UInt32 j = p + 1; j < q; j++) { if (compareFunc(data[p], data[j])) continue; i++; temp = data[i]; @@ -1217,8 +1068,7 @@ template class Vector QuickSort(i + 1, q, compareFunc); } - class Iterator - { + class Iterator { protected: friend Vector; @@ -1227,8 +1077,7 @@ template class Vector public: bool End() const { return !count; } - void operator++() - { + void operator++() { count--; pData++; } @@ -1239,10 +1088,8 @@ template class Vector Iterator() {} Iterator(Vector& source) : count(source.numItems), pData(source.data) {} - Iterator(Vector& source, UInt32 index) - { - if (source.numItems > index) - { + Iterator(Vector& source, UInt32 index) { + if (source.numItems > index) { count = source.numItems - index; pData = source.data + index; } @@ -1250,37 +1097,32 @@ template class Vector } }; - class RvIterator : public Iterator - { + class RvIterator : public Iterator { Vector* contObj; public: Vector* Container() const { return contObj; } - void operator--() - { + void operator--() { count--; pData--; } - void Remove() - { + void Remove() { pData->~T_Data(); UInt32 size = contObj->numItems - count; if (size) memmove(pData, pData + 1, sizeof(T_Data) * size); contObj->numItems--; } - RvIterator(Vector& source) : contObj(&source) - { + RvIterator(Vector& source) : contObj(&source) { count = source.numItems; if (count) pData = source.data + (count - 1); } }; }; -template class FixedTypeArray -{ +template class FixedTypeArray { protected: size_t size; T_Data data[N]; @@ -1292,15 +1134,13 @@ template class FixedTypeArray size_t Size() const { return size; } T_Data* Data() { return data; } - bool Append(T_Data item) - { + bool Append(T_Data item) { if (size >= N) return false; data[size++] = item; return true; } - class Iterator - { + class Iterator { protected: friend FixedTypeArray; @@ -1309,8 +1149,7 @@ template class FixedTypeArray public: bool End() const { return !count; } - void operator++() - { + void operator++() { count--; pData++; } diff --git a/JG/internal/decoding.h b/JG/internal/decoding.h index 27a1e30..ff56746 100644 --- a/JG/internal/decoding.h +++ b/JG/internal/decoding.h @@ -17,10 +17,7 @@ class BSAudioManagerThread; class ImageSpaceModifierInstanceRB; struct NavMeshClosedDoorInfo; - - -class ExtraDetachTime : public BSExtraData -{ +class ExtraDetachTime : public BSExtraData { public: ExtraDetachTime(); ~ExtraDetachTime(); @@ -28,8 +25,7 @@ class ExtraDetachTime : public BSExtraData SInt32 time; }; // 34 -class BGSPrimitive -{ +class BGSPrimitive { public: BGSPrimitive(); ~BGSPrimitive(); @@ -44,23 +40,21 @@ class BGSPrimitive UInt32 type; // 04 float unk08[4]; // 08 float bounds[3]; // 18 - NiRefObject *unk24; // 24 - NiRefObject *unk28; // 28 - NiRefObject *unk2C; // 2C + NiRefObject* unk24; // 24 + NiRefObject* unk28; // 28 + NiRefObject* unk2C; // 2C UInt32 unk30; // 30 }; // 34 -class BGSPrimitivePlane : public BGSPrimitive -{ +class BGSPrimitivePlane : public BGSPrimitive { public: BGSPrimitivePlane(); ~BGSPrimitivePlane(); }; // 4C -class BGSPrimitiveBox : public BGSPrimitive -{ +class BGSPrimitiveBox : public BGSPrimitive { public: BGSPrimitiveBox(); ~BGSPrimitiveBox(); @@ -69,16 +63,14 @@ class BGSPrimitiveBox : public BGSPrimitive }; // 34 -class BGSPrimitiveSphere : public BGSPrimitive -{ +class BGSPrimitiveSphere : public BGSPrimitive { public: BGSPrimitiveSphere(); ~BGSPrimitiveSphere(); }; // 18 -class BSTempEffect : public NiObject -{ +class BSTempEffect : public NiObject { public: BSTempEffect(); ~BSTempEffect(); @@ -99,15 +91,14 @@ class BSTempEffect : public NiObject virtual void Unk_30(void); float duration; // 08 - TESObjectCELL *cell; // 0C + TESObjectCELL* cell; // 0C float age; // 10 bool initialized;// 14 UInt8 pad15[3]; // 15 }; // 28 -class MagicHitEffect : public BSTempEffect -{ +class MagicHitEffect : public BSTempEffect { public: MagicHitEffect(); ~MagicHitEffect(); @@ -121,36 +112,34 @@ class MagicHitEffect : public BSTempEffect virtual void Unk_37(void); virtual void Unk_38(void); - ActiveEffect *activeEffect; // 18 - TESObjectREFR *target; // 1C + ActiveEffect* activeEffect; // 18 + TESObjectREFR* target; // 1C float timeElapsed; // 20 UInt8 flags; // 24 1 - Stop UInt8 pad25[3]; // 25 }; // 6C -class MagicShaderHitEffect : public MagicHitEffect -{ +class MagicShaderHitEffect : public MagicHitEffect { public: MagicShaderHitEffect(); ~MagicShaderHitEffect(); UInt32 unk28[2]; // 28 - TESEffectShader *effectShader; // 30 + TESEffectShader* effectShader; // 30 float timeElapsed; // 34 BSSimpleArray shaderProps; // 38 - NiNode *shaderNode; // 48 + NiNode* shaderNode; // 48 UInt32 unk4C; // 4C BSSimpleArray objects; // 50 Seen BSFadeNode float flt60; // 60 float flt64; // 64 - NiProperty *prop68; // 68 Seen 0x10AE0C8 + NiProperty* prop68; // 68 Seen 0x10AE0C8 }; STATIC_ASSERT(sizeof(MagicShaderHitEffect) == 0x6C); // 160 -struct ProcessManager -{ +struct ProcessManager { UInt32 unk000; // 000 NiTArray objects; // 004 UInt32 beginOffsets[4]; // 014 0: High, 1: Mid-High, 2: Mid-Low, 3: Low @@ -161,12 +150,11 @@ struct ProcessManager tList highActors; // 080 UInt32 unk088[54]; // 088 - int GetTotalDetectionValue(Actor *actor, bool arg2 = false); + int GetTotalDetectionValue(Actor* actor, bool arg2 = false); }; -struct DetectionData -{ - Actor *actor; // 00 +struct DetectionData { + Actor* actor; // 00 UInt8 detectionLevel; // 04 UInt8 byte05; // 05 UInt8 byte06; // 06 @@ -183,14 +171,12 @@ struct DetectionData }; // 46C -class HighProcess : public MiddleHighProcess -{ +class HighProcess : public MiddleHighProcess { public: HighProcess(); ~HighProcess(); - enum - { + enum { kAnimAction_None = -1, kAnimAction_Equip_Weapon, kAnimAction_Unequip_Weapon, @@ -208,11 +194,11 @@ class HighProcess : public MiddleHighProcess kAnimAction_Force_Script_Anim }; - tList *detectedActors; // 25C - tList *detectingActors; // 260 - void *ptr264; // 264 - void *ptr268; // 268 - void *ptr26C; // 26C + tList* detectedActors; // 25C + tList* detectingActors; // 260 + void* ptr264; // 264 + void* ptr268; // 268 + void* ptr26C; // 26C UInt32 unk270; // 270 tList list274; // 274 tList list27C; // 27C @@ -238,11 +224,11 @@ class HighProcess : public MiddleHighProcess float flt2D8; // 2D8 UInt32 unk2DC; // 2DC float flt2E0; // 2E0 - NiBSBoneLODController *ptr2E4; // 2E4 + NiBSBoneLODController* ptr2E4; // 2E4 UInt32 unk2E8; // 2E8 SInt16 currentAction; // 2EC UInt8 pad2EE[2]; // 2EE - BSAnimGroupSequence *currentSequence; // 2F0 + BSAnimGroupSequence* currentSequence; // 2F0 UInt32 unk2F4; // 2F4 float flt2F8; // 2F8 UInt32 unk2FC[5]; // 2FC @@ -256,9 +242,9 @@ class HighProcess : public MiddleHighProcess float flt344; // 344 UInt32 unk348; // 348 float flt34C; // 34C - TESIdleForm *idleForm350; // 350 + TESIdleForm* idleForm350; // 350 UInt32 unk354[4]; // 354 - NiBSplineCompTransformInterpolator **ptr364; // 364 + NiBSplineCompTransformInterpolator** ptr364; // 364 UInt32 unk368[4]; // 368 float flt378; // 378 float flt37C; // 37C @@ -281,16 +267,16 @@ class HighProcess : public MiddleHighProcess UInt32 unk3F0; // 3F0 UInt32 unk3F4; // 3F4 UInt32 unk3F8[3]; // 3F8 - Actor *combatTarget; // 404 + Actor* combatTarget; // 404 UInt32 unk408[4]; // 408 float flt418; // 418 - TESObjectREFR *packageTarget; // 41C + TESObjectREFR* packageTarget; // 41C UInt32 unk420; // 420 UInt32 queuedIdleFlags; // 424 UInt32 unk428; // 428 float flt42C; // 42C UInt32 unk430; // 430 - bhkShapePhantom *ptr434; // 434 + bhkShapePhantom* ptr434; // 434 UInt32 unk438; // 438 float unk43C; // 43C float radsSec440; // 440 @@ -304,15 +290,13 @@ class HighProcess : public MiddleHighProcess STATIC_ASSERT(sizeof(HighProcess) == 0x46C); // 150 -class Projectile : public MobileObject -{ +class Projectile : public MobileObject { public: Projectile(); ~Projectile(); - enum - { - kProjType_Beam = 1, + enum { + kProjType_Beam = 1, kProjType_Flame, kProjType_Grenade, kProjType_Missile, @@ -326,52 +310,49 @@ class Projectile : public MobileObject virtual bool ProcessImpact(); virtual bool IsProximityTriggered(); virtual void Unk_C7(void); - virtual bool DisarmPlacedExplosives(TESObjectREFR *refr, bool unk); + virtual bool DisarmPlacedExplosives(TESObjectREFR* refr, bool unk); virtual void Unk_C9(void); virtual void Unk_CA(void); virtual void Unk_CB(void); - enum - { - kProjFlag_Bit00Unk = 0x1, - kProjFlag_Bit01Unk = 0x2, - kProjFlag_Bit02Unk = 0x4, - kProjFlag_Bit03Unk = 0x8, - kProjFlag_Bit04Unk = 0x10, - kProjFlag_Bit05Unk = 0x20, - kProjFlag_Bit06Unk = 0x40, - kProjFlag_Bit07Unk = 0x80, - kProjFlag_Bit08Unk = 0x100, - kProjFlag_MineDisarmed = 0x200, - kProjFlag_Bit0AUnk = 0x400, - kProjFlag_Bit0BUnk = 0x800, - kProjFlag_Bit0CUnk = 0x1000, - kProjFlag_Bit0DUnk = 0x2000, - kProjFlag_Bit0EUnk = 0x4000, - kProjFlag_Bit0FUnk = 0x8000, // Don't apply source-weapon's damage upon impact - kProjFlag_Bit10Unk = 0x10000, - kProjFlag_Bit11Unk = 0x20000, - kProjFlag_Bit12Unk = 0x40000, - kProjFlag_Bit13Unk = 0x80000, - kProjFlag_Bit14Unk = 0x100000, + enum { + kProjFlag_Bit00Unk = 0x1, + kProjFlag_Bit01Unk = 0x2, + kProjFlag_Bit02Unk = 0x4, + kProjFlag_Bit03Unk = 0x8, + kProjFlag_Bit04Unk = 0x10, + kProjFlag_Bit05Unk = 0x20, + kProjFlag_Bit06Unk = 0x40, + kProjFlag_Bit07Unk = 0x80, + kProjFlag_Bit08Unk = 0x100, + kProjFlag_MineDisarmed = 0x200, + kProjFlag_Bit0AUnk = 0x400, + kProjFlag_Bit0BUnk = 0x800, + kProjFlag_Bit0CUnk = 0x1000, + kProjFlag_Bit0DUnk = 0x2000, + kProjFlag_Bit0EUnk = 0x4000, + kProjFlag_Bit0FUnk = 0x8000, // Don't apply source-weapon's damage upon impact + kProjFlag_Bit10Unk = 0x10000, + kProjFlag_Bit11Unk = 0x20000, + kProjFlag_Bit12Unk = 0x40000, + kProjFlag_Bit13Unk = 0x80000, + kProjFlag_Bit14Unk = 0x100000, }; - struct ImpactData - { - TESObjectREFR *refr; // 00 + struct ImpactData { + TESObjectREFR* refr; // 00 UInt32 unk04[2]; // 04 float unk0C; // 0C UInt32 unk10[2]; // 10 float unk18; // 18 - hkpRigidBody *rigidBody; // 1C + hkpRigidBody* rigidBody; // 1C UInt32 unk20; // 20 SInt32 hitLocation; // 24 UInt32 unk28; // 28 UInt32 unk2C; // 2C }; - struct Struct128 - { + struct Struct128 { UInt32 unk00; UInt8 byte04; UInt8 pad05[3]; @@ -394,17 +375,17 @@ class Projectile : public MobileObject float flt0EC; // 0EC float flt0F0; // 0F0 float wpnHealthPerc; // 0F4 - TESObjectWEAP *sourceWeap; // 0F8 - TESObjectREFR *sourceRef; // 0FC + TESObjectWEAP* sourceWeap; // 0F8 + TESObjectREFR* sourceRef; // 0FC UInt32 unk100; // 100 float flt104; // 104 float flt108; // 108 float flt10C; // 10C float distTravelled; // 110 - NiRefObject *object114; // 114 + NiRefObject* object114; // 114 UInt8 byte118; // 118 UInt8 pad119[3]; // 119 - NiNode *node11C; // 11C + NiNode* node11C; // 11C UInt32 unk120; // 120 float flt124; // 124 Struct128 unk128; // 128 @@ -417,8 +398,7 @@ class Projectile : public MobileObject }; STATIC_ASSERT(sizeof(Projectile) == 0x150); -struct ProjectileData -{ +struct ProjectileData { UInt8 byte00; UInt8 byte01; UInt8 byte02; @@ -433,29 +413,26 @@ struct ProjectileData }; // 154 -class BeamProjectile : public Projectile -{ +class BeamProjectile : public Projectile { public: BeamProjectile(); ~BeamProjectile(); - NiRefObject *object150; // 150 + NiRefObject* object150; // 150 }; // 158 -class ContinuousBeamProjectile : public Projectile -{ +class ContinuousBeamProjectile : public Projectile { public: ContinuousBeamProjectile(); ~ContinuousBeamProjectile(); - NiRefObject *object150; // 150 + NiRefObject* object150; // 150 UInt32 unk154; // 154 }; // 158 -class FlameProjectile : public Projectile -{ +class FlameProjectile : public Projectile { public: FlameProjectile(); ~FlameProjectile(); @@ -467,8 +444,7 @@ class FlameProjectile : public Projectile }; // 154 -class GrenadeProjectile : public Projectile -{ +class GrenadeProjectile : public Projectile { public: GrenadeProjectile(); ~GrenadeProjectile(); @@ -480,8 +456,7 @@ class GrenadeProjectile : public Projectile }; // 160 -class MissileProjectile : public Projectile -{ +class MissileProjectile : public Projectile { public: MissileProjectile(); ~MissileProjectile(); @@ -496,8 +471,7 @@ class MissileProjectile : public Projectile }; // 104 -class Explosion : public MobileObject -{ +class Explosion : public MobileObject { public: Explosion(); ~Explosion(); @@ -510,64 +484,56 @@ class Explosion : public MobileObject float unk094; // 094 float unk098; // 098 float unk09C; // 09C - NiRefObject *object0A0; // 0A0 + NiRefObject* object0A0; // 0A0 tList list0A4; // 0A4 UInt32 unk0AC[6]; // 0AC - NiRefObject *object0C4; // 0C4 + NiRefObject* object0C4; // 0C4 UInt32 unk0C8[2]; // 0C8 - NiRefObject *object0D0; // 0D0 + NiRefObject* object0D0; // 0D0 UInt32 unk0D4[11]; // 0D4 float unk100; // 100 }; STATIC_ASSERT(sizeof(Explosion) == 0x104); -template struct ListBoxItem -{ - Tile *tile; - Item *object; +template struct ListBoxItem { + Tile* tile; + Item* object; }; // 30 -template class ListBox : public BSSimpleList> -{ +template class ListBox : public BSSimpleList> { public: - Tile *parentTile; // 0C - Tile *selected; // 10 - Tile *scrollBar; // 14 - const char *templateName; // 18 + Tile* parentTile; // 0C + Tile* selected; // 10 + Tile* scrollBar; // 14 + const char* templateName; // 18 UInt16 itemCount; // 1C UInt16 pad1E; // 1E float unk20[3]; // 20 UInt16 unk2C; // 2C UInt16 pad2E; // 2E - Item *GetSelected() - { - ListNode> *iter = list.Head(); - ListBoxItem *item; - do - { + Item* GetSelected() { + ListNode>* iter = list.Head(); + ListBoxItem* item; + do { item = iter->data; if (item && (item->tile == selected)) return item->object; - } - while (iter = iter->next); + } while (iter = iter->next); return NULL; } - void Clear() - { - ListNode> *iter = list.Head(); - ListBoxItem *item; - do - { + void Clear() { + ListNode>* iter = list.Head(); + ListBoxItem* item; + do { item = iter->data; if (!item) continue; if (item->tile) item->tile->Destroy(true); GameHeapFree(item); - } - while (iter = iter->next); + } while (iter = iter->next); list.RemoveAll(); selected = NULL; itemCount = 0; @@ -581,12 +547,12 @@ class MessageMenu : public Menu // 1001 MessageMenu(); ~MessageMenu(); - TileRect *tile28; // 28 - TileText *tile2C; // 2C - TileImage *tile30; // 30 - TileText *tile34; // 34 - TileImage *tile38; // 38 - TileImage *tile3C; // 3C + TileRect* tile28; // 28 + TileText* tile2C; // 2C + TileImage* tile30; // 30 + TileText* tile34; // 34 + TileImage* tile38; // 38 + TileImage* tile3C; // 3C ListBox buttonList; // 40 UInt8 unk70; // 70 UInt8 pad71[3]; // 71 @@ -608,41 +574,41 @@ class InventoryMenu : public Menu // 1002 InventoryMenu(); ~InventoryMenu(); - TileRect *tile028; // 028 IM_Headline_PlayerCapsInfo - TileRect *tile02C; // 02C IM_Headline_PlayerHPInfo - TileRect *tile030; // 030 IM_Headline_PlayerDRInfo - TileRect *tile034; // 034 IM_Headline_PlayerWGInfo - TileImage *tile038; // 038 IM_InventoryList - TileRect *tile03C; // 03C IM_HotKeyWheel - TileImage *tile040; // 040 IM_EquipButton - TileImage *tile044; // 044 IM_DropButton - TileImage *tile048; // 048 IM_RepairButton - TileImage *tile04C; // 04C IM_HotkeyButton - TileImage *tile050; // 050 IM_CancelButton - TileImage *tile054; // 054 IM_ItemIcon - TileRect *tile058; // 058 IM_ItemInfoRect - TileRect *tile05C; // 05C IM_Tabline - TileRect *tile060; // 060 DAMInfo - TileRect *tile064; // 064 DPSInfo - TileRect *tile068; // 068 StrengthReqInfo - TileRect *tile06C; // 06C DamageResistInfo - TileRect *tile070; // 070 DamageThresholdInfo - TileImage *tile074; // 074 IM_ModButton - TileImage *tile078; // 078 IM_ItemIconBadge - TileRect *tile07C; // 07C IM_Headline_PlayerDTInfo - TileText *tile080; // 080 IM_StrReq + TileRect* tile028; // 028 IM_Headline_PlayerCapsInfo + TileRect* tile02C; // 02C IM_Headline_PlayerHPInfo + TileRect* tile030; // 030 IM_Headline_PlayerDRInfo + TileRect* tile034; // 034 IM_Headline_PlayerWGInfo + TileImage* tile038; // 038 IM_InventoryList + TileRect* tile03C; // 03C IM_HotKeyWheel + TileImage* tile040; // 040 IM_EquipButton + TileImage* tile044; // 044 IM_DropButton + TileImage* tile048; // 048 IM_RepairButton + TileImage* tile04C; // 04C IM_HotkeyButton + TileImage* tile050; // 050 IM_CancelButton + TileImage* tile054; // 054 IM_ItemIcon + TileRect* tile058; // 058 IM_ItemInfoRect + TileRect* tile05C; // 05C IM_Tabline + TileRect* tile060; // 060 DAMInfo + TileRect* tile064; // 064 DPSInfo + TileRect* tile068; // 068 StrengthReqInfo + TileRect* tile06C; // 06C DamageResistInfo + TileRect* tile070; // 070 DamageThresholdInfo + TileImage* tile074; // 074 IM_ModButton + TileImage* tile078; // 078 IM_ItemIconBadge + TileRect* tile07C; // 07C IM_Headline_PlayerDTInfo + TileText* tile080; // 080 IM_StrReq UInt32 filter; // 084 UInt32 unk088[12]; // 088 MenuItemEntryList itemList; // 0B8 - TileRect *tile0E8; // 0E8 - TileRect *tile0EC; // 0EC - TileRect *tile0F0; // 0F0 - TileRect *tile0F4; // 0F4 - TileRect *tile0F8; // 0F8 - TileRect *tile0FC; // 0FC - TileRect *tile100; // 100 - TileRect *tile104; // 104 - TileRect *tile108; // 108 + TileRect* tile0E8; // 0E8 + TileRect* tile0EC; // 0EC + TileRect* tile0F0; // 0F0 + TileRect* tile0F4; // 0F4 + TileRect* tile0F8; // 0F8 + TileRect* tile0FC; // 0FC + TileRect* tile100; // 100 + TileRect* tile104; // 104 + TileRect* tile108; // 108 UInt32 unk10C[6]; // 10C }; @@ -653,12 +619,11 @@ class StatsMenu : public Menu // 1003 StatsMenu(); ~StatsMenu(); - struct AlchItemData - { - AlchemyItem *alchItem; - TileImage *tileImg; - void *dataPtr; - bool (*callback)(void *arg); + struct AlchItemData { + AlchemyItem* alchItem; + TileImage* tileImg; + void* dataPtr; + bool (*callback)(void* arg); }; struct StatusEffect; @@ -667,66 +632,66 @@ class StatsMenu : public Menu // 1003 BSSimpleList effectList; // 068 UInt32 unk074[4]; // 074 BSSimpleList statusEffList; // 084 - TileImage *tile090; // 090 - TileImage *tile094; // 094 - TileImage *tile098; // 098 - TileImage *tile09C; // 09C - TileImage *tile0A0; // 0A0 - TileImage *tile0A4; // 0A4 - TileImage *tile0A8; // 0A8 - TileImage *tile0AC; // 0AC - TileImage *tile0B0; // 0B0 - TileImage *tile0B4; // 0B4 - TileImage *tile0B8; // 0B8 - TileImage *tile0BC; // 0BC - TileImage *tile0C0; // 0C0 - TileRect *tile0C4; // 0C4 - TileImage *tile0C8; // 0C8 - TileRect *tile0CC; // 0CC - TileImage *tile0D0; // 0D0 - TileRect *tile0D4; // 0D4 - TileImage *tile0D8; // 0D8 - TileRect *tile0DC; // 0DC - TileImage *tile0E0; // 0E0 - TileRect *tile0E4; // 0E4 - TileImage *tile0E8; // 0E8 - TileRect *tile0EC; // 0EC - TileImage *tile0F0; // 0F0 - TileImage *tile0F4; // 0F4 - TileImage *tile0F8; // 0F8 - TileText *tile0FC; // 0FC - TileImage *tile100; // 100 - TileImage *tile104; // 104 - TileImage *tile108; // 108 - TileImage *tile10C; // 10C - TileImage *tile110; // 110 - TileImage *tile114; // 114 - TileImage *tile118; // 118 - TileText *tile11C; // 11C - TileImage *tile120; // 120 - TileText *tile124; // 124 - TileText *tile128; // 128 - TileText *tile12C; // 12C - TileRect *tile130; // 130 - TileRect *tile134; // 134 - TileRect *tile138; // 138 - TileRect *tile13C; // 13C - TileText *tile140; // 140 - TileText *tile144; // 144 - TileImage *tile148; // 148 - TileImage *tile14C; // 14C - TileText *tile150; // 150 - TileImage *tile154; // 154 - TileImage *tile158; // 158 - TileText *tile15C; // 15C - TileImage *tile160; // 160 - TileImage *tile164; // 164 - TileImage *tile168; // 168 - TileImage *tile16C; // 16C - TileImage *tile170; // 170 - TileImage *tile174; // 174 - TileImage *tile178; // 178 - TileImage *tile17C; // 17C + TileImage* tile090; // 090 + TileImage* tile094; // 094 + TileImage* tile098; // 098 + TileImage* tile09C; // 09C + TileImage* tile0A0; // 0A0 + TileImage* tile0A4; // 0A4 + TileImage* tile0A8; // 0A8 + TileImage* tile0AC; // 0AC + TileImage* tile0B0; // 0B0 + TileImage* tile0B4; // 0B4 + TileImage* tile0B8; // 0B8 + TileImage* tile0BC; // 0BC + TileImage* tile0C0; // 0C0 + TileRect* tile0C4; // 0C4 + TileImage* tile0C8; // 0C8 + TileRect* tile0CC; // 0CC + TileImage* tile0D0; // 0D0 + TileRect* tile0D4; // 0D4 + TileImage* tile0D8; // 0D8 + TileRect* tile0DC; // 0DC + TileImage* tile0E0; // 0E0 + TileRect* tile0E4; // 0E4 + TileImage* tile0E8; // 0E8 + TileRect* tile0EC; // 0EC + TileImage* tile0F0; // 0F0 + TileImage* tile0F4; // 0F4 + TileImage* tile0F8; // 0F8 + TileText* tile0FC; // 0FC + TileImage* tile100; // 100 + TileImage* tile104; // 104 + TileImage* tile108; // 108 + TileImage* tile10C; // 10C + TileImage* tile110; // 110 + TileImage* tile114; // 114 + TileImage* tile118; // 118 + TileText* tile11C; // 11C + TileImage* tile120; // 120 + TileText* tile124; // 124 + TileText* tile128; // 128 + TileText* tile12C; // 12C + TileRect* tile130; // 130 + TileRect* tile134; // 134 + TileRect* tile138; // 138 + TileRect* tile13C; // 13C + TileText* tile140; // 140 + TileText* tile144; // 144 + TileImage* tile148; // 148 + TileImage* tile14C; // 14C + TileText* tile150; // 150 + TileImage* tile154; // 154 + TileImage* tile158; // 158 + TileText* tile15C; // 15C + TileImage* tile160; // 160 + TileImage* tile164; // 164 + TileImage* tile168; // 168 + TileImage* tile16C; // 16C + TileImage* tile170; // 170 + TileImage* tile174; // 174 + TileImage* tile178; // 178 + TileImage* tile17C; // 17C ListBox avIndexList180; // 180 ListBox avIndxeList1B0; // 1B0 ListBox perkRankList; // 1E0 @@ -737,8 +702,7 @@ class StatsMenu : public Menu // 1003 }; // 50 -class Tile3D : public Tile -{ +class Tile3D : public Tile { public: Tile3D(); ~Tile3D(); @@ -753,8 +717,7 @@ class HUDMainMenu : public Menu // 1004 HUDMainMenu(); ~HUDMainMenu(); - struct QueuedMessage - { + struct QueuedMessage { char msgText[0x204]; // 000 char iconPate[MAX_PATH]; // 204 char soundPath[MAX_PATH]; // 308 @@ -763,8 +726,7 @@ class HUDMainMenu : public Menu // 1004 struct SubtitleData; - struct Struct224 - { + struct Struct224 { UInt8 byte00; // 00 UInt8 pad01[3]; // 01 float flt04; // 04 @@ -777,8 +739,7 @@ class HUDMainMenu : public Menu // 1004 UInt8 byte1D; // 1D UInt8 pad1E[2]; // 1E }; - enum VisibilityFlags - { + enum VisibilityFlags { kActionPoints = 0x1, kHitPoints = 0x2, kRadiationMeter = 0x4, @@ -797,8 +758,7 @@ class HUDMainMenu : public Menu // 1004 kCrippledLimbIndicator = 0x8000, kHardcoreMode = 0x10000, }; - enum HUDStates - { + enum HUDStates { kHUDState_RECALCULATE = 0x1, kHUDState_Normal = 0x2, kHUDState_PipBoy = 0x3, @@ -827,118 +787,118 @@ class HUDMainMenu : public Menu // 1004 }; UInt32 unk028; // 028 - TileImage *tile02C; // 02C HitPoints\meter - TileText *tile030; // 030 HitPoints\justify_right_text - TileRect *tile034; // 034 HitPoints\compass_window\compass_icon_group - TileRect *tile038; // 038 HitPoints\compass_window\compass_icon_group - TileRect *tile03C; // 03C HitPoints\compass_window\compass_icon_group - TileImage *tile040; // 040 HitPoints\compass_window - TileImage *tile044; // 044 ActionPoints\meter - TileText *tile048; // 048 ActionPoints\justify_right_text - TileText *tile04C; // 04C ActionPoints\justify_right_text - TileImage *tile050; // 050 ActionPoints\meter - TileImage *tile054; // 054 ActionPoints\MeterBackground - TileText *tile058; // 058 ActionPoints\justify_right_text - TileRect *tile05C; // 05C QuestReminder\QuestStages - TileRect *tile060; // 060 QuestReminder\QuestAdded - TileText *tile064; // 064 Region_Location\justify_left_text - TileText *tile068; // 068 Region_Location\justify_left_text - TileImage *tile06C; // 06C RadiationMeter\radiation_bracket - TileImage *tile070; // 070 RadiationMeter\radiation_pointer - TileText *tile074; // 074 RadiationMeter\radiation_text_value - TileText *tile078; // 078 RadiationMeter\radiation_text - TileImage *tile07C; // 07C EnemyHealth\enemy_health_bracket - TileImage *tile080; // 080 EnemyHealth\meter - TileText *tile084; // 084 EnemyHealth\justify_center_text - TileText *sneakLabel; // 088 SneakMeter\sneak_nif - TileImage *tile08C; // 08C Messages\message_icon - TileText *tile090; // 090 Messages\justify_left_text - TileImage *tile094; // 094 Messages\message_bracket - TileText *tile098; // 098 Subtitles\justify_center_text - TileRect *tile09C; // 09C Info\justify_center_hotrect - TileText *tile0A0; // 0A0 Info\justify_center_hotrect\PCShortcutLabel - TileImage *tile0A4; // 0A4 Info\justify_center_hotrect\xbox_button - TileText *tile0A8; // 0A8 Info\justify_center_text - TileText *tile0AC; // 0AC Info\justify_center_text - TileText *tile0B0; // 0B0 Info\justify_center_text - TileText *tile0B4; // 0B4 Info\justify_right_text - TileText *tile0B8; // 0B8 Info\justify_left_text - TileText *tile0BC; // 0BC Info\justify_right_text - TileText *tile0C0; // 0C0 Info\justify_left_text - TileImage *tile0C4; // 0C4 Info\info_seperator - TileRect *tile0C8; // 0C8 Hokeys\hotkey_selector - TileText *tile0CC; // 0CC Hokeys\justify_center_text - TileImage *tile0D0; // 0D0 HitPoints\left_bracket - TileImage *tile0D4; // 0D4 ActionPoints\right_bracket - TileImage *tile0D8; // 0D8 XPMeter\XPBracket - TileText *tile0DC; // 0DC XPMeter\XPAmount - TileText *tile0E0; // 0E0 XPMeter\XPLabel - TileImage *tile0E4; // 0E4 XPMeter\XPPointer - TileText *tile0E8; // 0E8 XPMeter\XPLastLevel - TileText *tile0EC; // 0EC XPMeter\XPNextLevel - TileText *tile0F0; // 0F0 XPMeter\XPLevelUp - TileImage *tile0F4; // 0F4 ReticleCenter\reticle_center - TileImage *tile0F8; // 0F8 crippled_limb_indicator\Face - TileImage *tile0FC; // 0FC crippled_limb_indicator\Head - TileImage *tile100; // 100 crippled_limb_indicator\Torso - TileImage *tile104; // 104 crippled_limb_indicator\Left_Arm - TileImage *tile108; // 108 crippled_limb_indicator\Right_Arm - TileImage *tile10C; // 10C crippled_limb_indicator\Left_Leg - TileImage *tile110; // 110 crippled_limb_indicator\Right_Leg - TileRect *tile114; // 114 ActionPoints - TileRect *tile118; // 118 HitPoints - TileRect *tile11C; // 11C RadiationMeter - TileRect *tile120; // 120 EnemyHealth - TileRect *tile124; // 124 QuestReminder - TileRect *tile128; // 128 Region_Location - TileRect *tile12C; // 12C ReticleCenter - TileRect *tile130; // 130 SneakMeter - TileRect *tile134; // 134 Messages - TileRect *tile138; // 138 Info - TileRect *tile13C; // 13C Subtitles - TileRect *tile140; // 140 Hokeys - TileRect *tile144; // 144 XPMeter - Tile3D *tile148; // 148 BreathMeter - TileRect *tile14C; // 14C Explosive_positioning_rect - TileRect *tile150; // 150 crippled_limb_indicator - TileImage *tile154; // 154 DDTIcon - TileImage *tile158; // 158 DDTIconEnemy - TileText *tile15C; // 15C AmmoTypeLabel - TileRect *tile160; // 160 HardcoreMode - TileText *tile164; // 164 HardcoreMode\Dehydration - TileText *tile168; // 168 HardcoreMode\Sleep - TileText *tile16C; // 16C HardcoreMode\Hunger - TileImage *tile170; // 170 DDTIcon - TileImage *tile174; // 174 DDTIconEnemyAP - TileText *tile178; // 178 HardcoreMode\Rads - TileText *tile17C; // 17C HardcoreMode\LMBs - TileImage *tile180; // 180 CNDArrows + TileImage* tile02C; // 02C HitPoints\meter + TileText* tile030; // 030 HitPoints\justify_right_text + TileRect* tile034; // 034 HitPoints\compass_window\compass_icon_group + TileRect* tile038; // 038 HitPoints\compass_window\compass_icon_group + TileRect* tile03C; // 03C HitPoints\compass_window\compass_icon_group + TileImage* tile040; // 040 HitPoints\compass_window + TileImage* tile044; // 044 ActionPoints\meter + TileText* tile048; // 048 ActionPoints\justify_right_text + TileText* tile04C; // 04C ActionPoints\justify_right_text + TileImage* tile050; // 050 ActionPoints\meter + TileImage* tile054; // 054 ActionPoints\MeterBackground + TileText* tile058; // 058 ActionPoints\justify_right_text + TileRect* tile05C; // 05C QuestReminder\QuestStages + TileRect* tile060; // 060 QuestReminder\QuestAdded + TileText* tile064; // 064 Region_Location\justify_left_text + TileText* tile068; // 068 Region_Location\justify_left_text + TileImage* tile06C; // 06C RadiationMeter\radiation_bracket + TileImage* tile070; // 070 RadiationMeter\radiation_pointer + TileText* tile074; // 074 RadiationMeter\radiation_text_value + TileText* tile078; // 078 RadiationMeter\radiation_text + TileImage* tile07C; // 07C EnemyHealth\enemy_health_bracket + TileImage* tile080; // 080 EnemyHealth\meter + TileText* tile084; // 084 EnemyHealth\justify_center_text + TileText* sneakLabel; // 088 SneakMeter\sneak_nif + TileImage* tile08C; // 08C Messages\message_icon + TileText* tile090; // 090 Messages\justify_left_text + TileImage* tile094; // 094 Messages\message_bracket + TileText* tile098; // 098 Subtitles\justify_center_text + TileRect* tile09C; // 09C Info\justify_center_hotrect + TileText* tile0A0; // 0A0 Info\justify_center_hotrect\PCShortcutLabel + TileImage* tile0A4; // 0A4 Info\justify_center_hotrect\xbox_button + TileText* tile0A8; // 0A8 Info\justify_center_text + TileText* tile0AC; // 0AC Info\justify_center_text + TileText* tile0B0; // 0B0 Info\justify_center_text + TileText* tile0B4; // 0B4 Info\justify_right_text + TileText* tile0B8; // 0B8 Info\justify_left_text + TileText* tile0BC; // 0BC Info\justify_right_text + TileText* tile0C0; // 0C0 Info\justify_left_text + TileImage* tile0C4; // 0C4 Info\info_seperator + TileRect* tile0C8; // 0C8 Hokeys\hotkey_selector + TileText* tile0CC; // 0CC Hokeys\justify_center_text + TileImage* tile0D0; // 0D0 HitPoints\left_bracket + TileImage* tile0D4; // 0D4 ActionPoints\right_bracket + TileImage* tile0D8; // 0D8 XPMeter\XPBracket + TileText* tile0DC; // 0DC XPMeter\XPAmount + TileText* tile0E0; // 0E0 XPMeter\XPLabel + TileImage* tile0E4; // 0E4 XPMeter\XPPointer + TileText* tile0E8; // 0E8 XPMeter\XPLastLevel + TileText* tile0EC; // 0EC XPMeter\XPNextLevel + TileText* tile0F0; // 0F0 XPMeter\XPLevelUp + TileImage* tile0F4; // 0F4 ReticleCenter\reticle_center + TileImage* tile0F8; // 0F8 crippled_limb_indicator\Face + TileImage* tile0FC; // 0FC crippled_limb_indicator\Head + TileImage* tile100; // 100 crippled_limb_indicator\Torso + TileImage* tile104; // 104 crippled_limb_indicator\Left_Arm + TileImage* tile108; // 108 crippled_limb_indicator\Right_Arm + TileImage* tile10C; // 10C crippled_limb_indicator\Left_Leg + TileImage* tile110; // 110 crippled_limb_indicator\Right_Leg + TileRect* tile114; // 114 ActionPoints + TileRect* tile118; // 118 HitPoints + TileRect* tile11C; // 11C RadiationMeter + TileRect* tile120; // 120 EnemyHealth + TileRect* tile124; // 124 QuestReminder + TileRect* tile128; // 128 Region_Location + TileRect* tile12C; // 12C ReticleCenter + TileRect* tile130; // 130 SneakMeter + TileRect* tile134; // 134 Messages + TileRect* tile138; // 138 Info + TileRect* tile13C; // 13C Subtitles + TileRect* tile140; // 140 Hokeys + TileRect* tile144; // 144 XPMeter + Tile3D* tile148; // 148 BreathMeter + TileRect* tile14C; // 14C Explosive_positioning_rect + TileRect* tile150; // 150 crippled_limb_indicator + TileImage* tile154; // 154 DDTIcon + TileImage* tile158; // 158 DDTIconEnemy + TileText* tile15C; // 15C AmmoTypeLabel + TileRect* tile160; // 160 HardcoreMode + TileText* tile164; // 164 HardcoreMode\Dehydration + TileText* tile168; // 168 HardcoreMode\Sleep + TileText* tile16C; // 16C HardcoreMode\Hunger + TileImage* tile170; // 170 DDTIcon + TileImage* tile174; // 174 DDTIconEnemyAP + TileText* tile178; // 178 HardcoreMode\Rads + TileText* tile17C; // 17C HardcoreMode\LMBs + TileImage* tile180; // 180 CNDArrows UInt32 unk184; // 184 float flt188; // 188 tList queuedMessages; // 18C UInt32 currMsgKey; // 194 BSSimpleArray subtitlesArr; // 198 UInt32 unk1A8[4]; // 1A8 - TESObjectREFR *crosshairRef; // 1B8 + TESObjectREFR* crosshairRef; // 1B8 UInt32 unk1BC; // 1BC UInt32 unk1C0; // 1C0 Crosshair flags? UInt32 unk1C4; // 1C4 - TileRect *tile1C8; // 1C8 Hokeys\hotkey_selector - TileRect *tile1CC; // 1CC Hokeys\hotkey_selector\HK_Item_0 + TileRect* tile1C8; // 1C8 Hokeys\hotkey_selector + TileRect* tile1CC; // 1CC Hokeys\hotkey_selector\HK_Item_0 UInt32 unk1D0; // 1D0 - TileRect *tile1D4; // 1D4 Hokeys\hotkey_selector\HK_Item_2 - TileRect *tile1D8; // 1D8 Hokeys\hotkey_selector\HK_Item_3 - TileRect *tile1DC; // 1DC Hokeys\hotkey_selector\HK_Item_4 - TileRect *tile1E0; // 1E0 Hokeys\hotkey_selector\HK_Item_5 - TileRect *tile1E4; // 1E4 Hokeys\hotkey_selector\HK_Item_6 - TileRect *tile1E8; // 1E8 Hokeys\hotkey_selector\HK_Item_7 + TileRect* tile1D4; // 1D4 Hokeys\hotkey_selector\HK_Item_2 + TileRect* tile1D8; // 1D8 Hokeys\hotkey_selector\HK_Item_3 + TileRect* tile1DC; // 1DC Hokeys\hotkey_selector\HK_Item_4 + TileRect* tile1E0; // 1E0 Hokeys\hotkey_selector\HK_Item_5 + TileRect* tile1E4; // 1E4 Hokeys\hotkey_selector\HK_Item_6 + TileRect* tile1E8; // 1E8 Hokeys\hotkey_selector\HK_Item_7 UInt32 unk1EC[5]; // 1EC - NiControllerSequence *niContSeq; // 200 + NiControllerSequence* niContSeq; // 200 UInt8 byte204; // 204 UInt8 byte205; // 205 UInt8 pad206[2]; // 206 UInt32 unk208[5]; // 208 - Actor *healthTarget; // 21C + Actor* healthTarget; // 21C UInt32 unk220; // 220 Struct224 unk224; // 224 UInt32 unk244; // 244 @@ -960,44 +920,44 @@ class LoadingMenu : public Menu // 1007 LoadingMenu(); ~LoadingMenu(); - Tile3D *tile028; // 028 - TileText *tile02C; // 02C - TileText *tile030; // 030 - TileText *tile034; // 034 - TileText *tile038; // 038 - TileText *tile03C; // 03C - TileText *tile040; // 040 - TileText *tile044; // 044 - TileText *tile048; // 048 - TileText *tile04C; // 04C - TileImage *tile050; // 050 - Tile3D *tile054; // 054 - TileImage *tile058; // 058 - TileText *tile05C; // 05C - TileText *tile060; // 060 - TileText *tile064; // 064 - TileRect *tile068; // 068 - TileText *tile06C; // 06C - TileRect *tile070; // 070 - TileText *tile074; // 074 - TileText *tile078; // 078 - TileText *tile07C; // 07C - TileText *tile080; // 080 - TileText *tile084; // 084 - TileText *tile088; // 088 - TileText *tile08C; // 08C - TileText *tile090; // 090 - TileRect *tile094; // 094 - TileText *tile098; // 098 - TileText *tile09C; // 09C - TileText *tile0A0; // 0A0 - TileRect *tile0A4; // 0A4 - TileImage *tile0A8; // 0A8 - TileImage *tile0AC; // 0AC - TileText *tile0B0; // 0B0 - TileText *tile0B4; // 0B4 - TileImage *tile0B8; // 0B8 - TileImage *tile0BC; // 0BC + Tile3D* tile028; // 028 + TileText* tile02C; // 02C + TileText* tile030; // 030 + TileText* tile034; // 034 + TileText* tile038; // 038 + TileText* tile03C; // 03C + TileText* tile040; // 040 + TileText* tile044; // 044 + TileText* tile048; // 048 + TileText* tile04C; // 04C + TileImage* tile050; // 050 + Tile3D* tile054; // 054 + TileImage* tile058; // 058 + TileText* tile05C; // 05C + TileText* tile060; // 060 + TileText* tile064; // 064 + TileRect* tile068; // 068 + TileText* tile06C; // 06C + TileRect* tile070; // 070 + TileText* tile074; // 074 + TileText* tile078; // 078 + TileText* tile07C; // 07C + TileText* tile080; // 080 + TileText* tile084; // 084 + TileText* tile088; // 088 + TileText* tile08C; // 08C + TileText* tile090; // 090 + TileRect* tile094; // 094 + TileText* tile098; // 098 + TileText* tile09C; // 09C + TileText* tile0A0; // 0A0 + TileRect* tile0A4; // 0A4 + TileImage* tile0A8; // 0A8 + TileImage* tile0AC; // 0AC + TileText* tile0B0; // 0B0 + TileText* tile0B4; // 0B4 + TileImage* tile0B8; // 0B8 + TileImage* tile0BC; // 0BC UInt32 unk0C0; // 0C0 UInt32 unk0C4; // 0C4 UInt32 unk0C8; // 0C8 @@ -1008,15 +968,15 @@ class LoadingMenu : public Menu // 1007 DList list0F4; // 0F4 DList list100; // 100 UInt32 unk10C[49]; // 10C - TESLoadScreen *loadScr1D0; // 1D0 - void *ptr1D4; // 1D4 - void *ptr1D8; // 1D8 - TESLoadScreen *loadScr1DC; // 1DC + TESLoadScreen* loadScr1D0; // 1D0 + void* ptr1D4; // 1D4 + void* ptr1D8; // 1D8 + TESLoadScreen* loadScr1DC; // 1DC UInt32 unk1E0; // 1E0 UInt32 unk1E4; // 1E4 - TESWorldSpace *worldspace; // 1E8 + TESWorldSpace* worldspace; // 1E8 UInt32 unk1EC[8]; // 1EC - NiSourceTexture *srcTexture[4]; // 20C + NiSourceTexture* srcTexture[4]; // 20C UInt32 unk21C; // 21C UInt8 byte220[2]; // 220 UInt16 flags; // 222 @@ -1031,26 +991,26 @@ class ContainerMenu : public Menu // 1008 ContainerMenu(); ~ContainerMenu(); - TileImage *tile028; // 028 - TileText *tile02C; // 02C - TileImage *tile030; // 030 - TileText *tile034; // 034 - TileImage *tile038; // 038 - TileImage *tile03C; // 03C - TileText *tile040; // 040 - TileImage *tile044; // 044 - TileImage *tile048; // 048 - TileImage *tile04C; // 04C - TileImage *tile050; // 050 - TileImage *tile054; // 054 - TileImage *tile058; // 058 - TileRect *tile05C; // 05C - TileRect *tile060; // 060 - TileRect *tile064; // 064 - TileRect *tile068; // 068 - TileRect *tile06C; // 06C - TileRect *tile070; // 070 - TESObjectREFR *containerRef; // 074 + TileImage* tile028; // 028 + TileText* tile02C; // 02C + TileImage* tile030; // 030 + TileText* tile034; // 034 + TileImage* tile038; // 038 + TileImage* tile03C; // 03C + TileText* tile040; // 040 + TileImage* tile044; // 044 + TileImage* tile048; // 048 + TileImage* tile04C; // 04C + TileImage* tile050; // 050 + TileImage* tile054; // 054 + TileImage* tile058; // 058 + TileRect* tile05C; // 05C + TileRect* tile060; // 060 + TileRect* tile064; // 064 + TileRect* tile068; // 068 + TileRect* tile06C; // 06C + TileRect* tile070; // 070 + TESObjectREFR* containerRef; // 074 tList list078; // 078 UInt32 unk080; // 080 UInt32 unk084; // 084 @@ -1060,7 +1020,7 @@ class ContainerMenu : public Menu // 1008 UInt32 unk094; // 094 MenuItemEntryList leftItems; // 098 MenuItemEntryList rightItems; // 0C8 - MenuItemEntryList *currentItems; // 0F8 + MenuItemEntryList* currentItems; // 0F8 UInt32 unk0FC[4]; // 0FC }; STATIC_ASSERT(sizeof(ContainerMenu) == 0x10C); @@ -1073,27 +1033,27 @@ class DialogMenu : public Menu // 1009 ~DialogMenu(); UInt32 unk028[2]; // 028 - TileImage *tile030; // 030 - TileText *tile034; // 034 - TileText *tile038; // 038 - TileImage *tile03C; // 03C + TileImage* tile030; // 030 + TileText* tile034; // 034 + TileText* tile038; // 038 + TileImage* tile03C; // 03C ListBox topicList; // 040 - void *unk070; // 070 + void* unk070; // 070 UInt32 unk074; // 074 - TESTopicInfo *info078; // 078 + TESTopicInfo* info078; // 078 UInt32 unk07C; // 07C - TESObjectREFR *partnerRef; // 080 + TESObjectREFR* partnerRef; // 080 float unk084[2]; // 084 - void *unk08C; // 08C - void *unk090; // 090 - TESTopicInfo *infos094[16]; // 094 - void *unk0D4; // 0D4 + void* unk08C; // 08C + void* unk090; // 090 + TESTopicInfo* infos094[16]; // 094 + void* unk0D4; // 0D4 UInt32 unk0D8[3]; // 0D8 - TESTopicInfo *infos0E4[8]; // 0E4 + TESTopicInfo* infos0E4[8]; // 0E4 UInt32 unk104[3]; // 104 - TESTopicInfo *infos110[6]; // 110 + TESTopicInfo* infos110[6]; // 110 float unk128; // 128 - void *unk12C; // 12C ImageSpaceModifierInstanceDOF + void* unk12C; // 12C ImageSpaceModifierInstanceDOF UInt32 unk130[3]; // 130 }; @@ -1104,12 +1064,12 @@ class SleepWaitMenu : public Menu // 1012 SleepWaitMenu(); ~SleepWaitMenu(); - TileText *tile28; // 28 - TileImage *tile2C; // 2C - TileText *tile30; // 30 - TileText *tile34; // 34 - TileImage *tile38; // 38 - TileImage *tile3C; // 3C + TileText* tile28; // 28 + TileImage* tile2C; // 2C + TileText* tile30; // 30 + TileText* tile34; // 34 + TileImage* tile38; // 38 + TileImage* tile3C; // 3C UInt32 unk40; // 40 float flt44; // 44 float selectedHours; // 48 @@ -1124,56 +1084,54 @@ class StartMenu : public Menu // 1013 ~StartMenu(); // 10 - class Option - { + class Option { public: Option(); ~Option(); virtual void Destructor(bool doFree); - const char *optionName; // 04 + const char* optionName; // 04 void (*followupOption)(void); // 08 UInt32 unk0C; // 0C }; // 30 - class UserOption : public Option - { + class UserOption : public Option { public: UserOption(); ~UserOption(); - const char *templateName; // 10 + const char* templateName; // 10 UInt32 currValue; // 14 UInt32 unk18[4]; // 18 - const char **currValueName; // 28 + const char** currValueName; // 28 void (*onSelection)(UserOption*); // 2C }; - TileImage *tile028; // 028 - TileImage *tile02C; // 02C - TileImage *tile030; // 030 - TileImage *tile034; // 034 - TileImage *tile038; // 038 - TileImage *tile03C; // 03C - TileImage *tile040; // 040 - TileImage *tile044; // 044 - TileText *tile048; // 048 - TileText *tile04C; // 04C - TileText *tile050; // 050 - TileImage *tile054; // 054 - TileText *tile058; // 058 - Tile3D *tile05C; // 05C - TileImage *tile060; // 060 - TileImage *tile064; // 064 - TileText *tile068; // 068 - TileImage *tile06C; // 06C - TileText *tile070; // 070 - TileText *tile074; // 074 - TileText *tile078; // 078 - TileImage *tile07C; // 07C - TileText *tile080; // 080 + TileImage* tile028; // 028 + TileImage* tile02C; // 02C + TileImage* tile030; // 030 + TileImage* tile034; // 034 + TileImage* tile038; // 038 + TileImage* tile03C; // 03C + TileImage* tile040; // 040 + TileImage* tile044; // 044 + TileText* tile048; // 048 + TileText* tile04C; // 04C + TileText* tile050; // 050 + TileImage* tile054; // 054 + TileText* tile058; // 058 + Tile3D* tile05C; // 05C + TileImage* tile060; // 060 + TileImage* tile064; // 064 + TileText* tile068; // 068 + TileImage* tile06C; // 06C + TileText* tile070; // 070 + TileText* tile074; // 074 + TileText* tile078; // 078 + TileImage* tile07C; // 07C + TileText* tile080; // 080 ListBox