-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58f565e
commit e29537e
Showing
33 changed files
with
800 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "ActorUpdateManager.h" | ||
|
||
#include "skse64/GameReferences.h" | ||
#include "skse64/GameRTTI.h" | ||
|
||
#include "NiTransformInterface.h" | ||
#include "OverrideInterface.h" | ||
#include "BodyMorphInterface.h" | ||
#include "OverlayInterface.h" | ||
|
||
#include "Utilities.h" | ||
|
||
extern BodyMorphInterface g_bodyMorphInterface; | ||
extern OverlayInterface g_overlayInterface; | ||
extern NiTransformInterface g_transformInterface; | ||
|
||
extern bool g_playerOnly; | ||
extern bool g_enableBodyGen; | ||
extern bool g_enableAutoTransforms; | ||
extern bool g_enableBodyInit; | ||
|
||
EventResult ActorUpdateManager::ReceiveEvent(TESObjectLoadedEvent * evn, EventDispatcher<TESObjectLoadedEvent>* dispatcher) | ||
{ | ||
if (evn) { | ||
TESForm * form = LookupFormByID(evn->formId); | ||
if (form) { | ||
if (form->formType == Character::kTypeID) { | ||
TESObjectREFR * reference = DYNAMIC_CAST(form, TESForm, TESObjectREFR); | ||
if (reference) { | ||
if (g_enableBodyGen && !g_bodyMorphInterface.HasMorphs(reference)) { | ||
UInt32 total = g_bodyMorphInterface.EvaluateBodyMorphs(reference); | ||
if (total) { | ||
_DMESSAGE("%s - ObjectLoad applied %d morph(s) to %s", __FUNCTION__, total, CALL_MEMBER_FN(reference, GetReferenceName)()); | ||
g_bodyMorphInterface.UpdateModelWeight(reference); | ||
} | ||
} | ||
|
||
if (g_enableAutoTransforms) { | ||
g_transformInterface.SetHandleNodeTransforms(VirtualMachine::GetHandle(form, TESObjectREFR::kTypeID)); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return kEvent_Continue; | ||
} | ||
|
||
EventResult ActorUpdateManager::ReceiveEvent(TESInitScriptEvent * evn, EventDispatcher<TESInitScriptEvent>* dispatcher) | ||
{ | ||
if (evn) { | ||
TESObjectREFR * reference = evn->reference; | ||
if (reference && g_enableBodyInit) { | ||
if (reference->formType == Character::kTypeID) { | ||
if (!g_bodyMorphInterface.HasMorphs(reference)) { | ||
UInt32 total = g_bodyMorphInterface.EvaluateBodyMorphs(reference); | ||
if (total) { | ||
_DMESSAGE("%s - ObjectInit applied %d morph(s) to %s", __FUNCTION__, total, CALL_MEMBER_FN(reference, GetReferenceName)()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return kEvent_Continue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include "skse64/GameEvents.h" | ||
|
||
class ActorUpdateManager | ||
: public BSTEventSink<TESObjectLoadedEvent> | ||
, public BSTEventSink<TESInitScriptEvent> | ||
{ | ||
virtual EventResult ReceiveEvent(TESObjectLoadedEvent * evn, EventDispatcher<TESObjectLoadedEvent> * dispatcher) override; | ||
virtual EventResult ReceiveEvent(TESInitScriptEvent * evn, EventDispatcher<TESInitScriptEvent> * dispatcher) override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.