Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ******************************************************************
- PapyrusActor.cpp (Slice - namespace)
- ******************************************************************
- */
- // PLB: Set 'bUseFaceGenPreprocessedHeads:General' to 0
- // before calling this to ensure it regenerates the head,
- // this can be done in script. For some reason it
- // completely disregarded the fact I set the INI at all
- // when using it here directly, alternatively it might be
- // a desired result to have only the body update without
- // completely regenerating the head. I believe increasing
- // weight would cause the head to not match the body
- // and 'gaps' may occur, so only decreasing would be
- // recommended. If the face is regenerated all actors
- // except for the player will lose their face tint.
- //
- void QueueNiNodeUpdate(Actor* thisActor)
- {
- Character * pChar = DYNAMIC_CAST(thisActor, Actor, Character);
- if(pChar) {
- CALL_MEMBER_FN(pChar, QueueNiNodeUpdate)(true);
- }
- }
- /*
- ******************************************************************
- PapyrusActor.cpp (Slice - RegisterFunctions)
- ******************************************************************
- */
- registry->RegisterFunction(
- new NativeFunction0 <Actor, void>("QueueNiNodeUpdate", "Actor", papyrusActor::QueueNiNodeUpdate, registry));
- /*
- ******************************************************************
- PapyrusUtility.cpp (Full File)
- ******************************************************************
- */
- #include "PapyrusUtility.h"
- #include "GameForms.h"
- #include "GameObjects.h"
- #include "GameReferences.h"
- #include "GameExtraData.h"
- #include "GameRTTI.h"
- #include "GameSettings.h"
- #include "PapyrusVM.h"
- #include "PapyrusNativeFunctions.h"
- namespace papyrusUtility
- {
- // This was taken from Hooks_Scaleform.cpp, maybe move this to somewhere it can be mutually defined
- static Setting * GetINISetting(const char * name)
- {
- Setting * setting = (*g_iniSettingCollection)->Get(name);
- if(!setting)
- setting = (*g_iniPrefSettingCollection)->Get(name);
- return setting;
- }
- float GetINIFloat(StaticFunctionTag* base, BSFixedString ini)
- {
- Setting * setting = GetINISetting(ini.data);
- if(!setting || setting->GetType() != Setting::kType_Float)
- return 0.0;
- return setting->data.f32;
- }
- UInt32 GetINIInt(StaticFunctionTag* base, BSFixedString ini)
- {
- Setting * setting = GetINISetting(ini.data);
- if(!setting || setting->GetType() != Setting::kType_Integer)
- return 0;
- return setting->data.s32;
- }
- bool GetINIBool(StaticFunctionTag* base, BSFixedString ini)
- {
- Setting * setting = GetINISetting(ini.data);
- if(!setting || setting->GetType() != Setting::kType_Bool)
- return false;
- return setting->data.u8 >= 1 ? true : false;
- }
- BSFixedString GetINIString(StaticFunctionTag* base, BSFixedString ini)
- {
- Setting * setting = GetINISetting(ini.data);
- if(!setting || setting->GetType() != Setting::kType_String)
- return NULL;
- return setting->data.s;
- }
- }
- void papyrusUtility::RegisterFuncs(VMClassRegistry* registry)
- {
- // PLB: Not really sure why these weren't in vanilla...
- registry->RegisterFunction(
- new NativeFunction1 <StaticFunctionTag, float, BSFixedString>("GetINIFloat", "Utility", papyrusUtility::GetINIFloat, registry));
- registry->RegisterFunction(
- new NativeFunction1 <StaticFunctionTag, UInt32, BSFixedString>("GetINIInt", "Utility", papyrusUtility::GetINIInt, registry));
- registry->RegisterFunction(
- new NativeFunction1 <StaticFunctionTag, bool, BSFixedString>("GetINIBool", "Utility", papyrusUtility::GetINIBool, registry));
- registry->RegisterFunction(
- new NativeFunction1 <StaticFunctionTag, BSFixedString, BSFixedString>("GetINIString", "Utility", papyrusUtility::GetINIString, registry));
- }
- /*
- ******************************************************************
- PapyrusUtility.h (Full File)
- ******************************************************************
- */
- #pragma once
- #include "GameTypes.h"
- struct StaticFunctionTag;
- class Setting;
- class VMClassRegistry;
- namespace papyrusUtility
- {
- void RegisterFuncs(VMClassRegistry* registry);
- static Setting * GetINISetting(const char * name);
- float GetINIFloat(StaticFunctionTag* base, BSFixedString ini);
- UInt32 GetINIInt(StaticFunctionTag* base, BSFixedString ini);
- bool GetINIBool(StaticFunctionTag* base, BSFixedString ini);
- BSFixedString GetINIString(StaticFunctionTag* base, BSFixedString ini);
- }
- /*
- ******************************************************************
- GameReferences.h (Slice)
- ******************************************************************
- */
- // 1B0
- // Character + 98 = process?
- class Character : public Actor
- {
- enum { kTypeID = kFormType_Character };
- public:
- MEMBER_FN_PREFIX(Character);
- DEFINE_MEMBER_FN(QueueNiNodeUpdate, void, 0x00727D80, bool); // PLB: shadeMe found this one, I just hooked it up to Papyrus
- };
- /*
- ******************************************************************
- Script Use Sample
- ******************************************************************
- */
- akTarget.GetActorBase().SetFacePreset(0, 3) ; Change a face preset, I think this is the nose
- akTarget.GetActorBase().SetWeight(0) ; Set the actors weight to zero
- string facegen = "bUseFaceGenPreprocessedHeads:General"
- bool value = Utility.GetINIBool(facegen) ; Retrieve the value of this setting
- Utility.SetINIBool(facegen, false) ; Set it to zero
- akTarget.QueueNiNodeUpdate() ; Invoke a node update
- Utility.SetINIBool(facegen, value) ; Restore the previous value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement