Skip to content

Commit

Permalink
Merge pull request #99 from shad0wshayd3/dev
Browse files Browse the repository at this point in the history
Misc Blood Magic Defs
  • Loading branch information
powerof3 authored Jan 2, 2024
2 parents 7f458ff + 06ed638 commit 8a77c6d
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 23 deletions.
3 changes: 3 additions & 0 deletions include/RE/A/AIProcess.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "RE/A/ActorPackage.h"
#include "RE/A/ActorValues.h"
#include "RE/B/BGSDefaultObjectManager.h"
#include "RE/B/BSTArray.h"
#include "RE/B/BSTList.h"
Expand Down Expand Up @@ -161,6 +162,7 @@ namespace RE
[[nodiscard]] bool GetIsSummonedCreature() const noexcept;
NiAVObject* GetMagicNode(const BSTSmartPointer<BipedAnim>& a_biped) const;
ObjectRefHandle GetOccupiedFurniture() const;
float GetRegenDelay(ActorValue a_actorvalue) const;
TESPackage* GetRunningPackage() const;
Actor* GetUserData() const;
float GetVoiceRecoveryTime() const;
Expand All @@ -181,6 +183,7 @@ namespace RE
bool SetupSpecialIdle(Actor* a_actor, DEFAULT_OBJECT a_action, TESIdleForm* a_idle, bool a_arg5, bool a_arg6, TESObjectREFR* a_target);
void StopCurrentIdle(Actor* a_actor, bool a_forceIdleStop);
void Update3DModel(Actor* a_actor);
void UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay);

// members
MiddleLowProcessData* middleLow; // 000
Expand Down
2 changes: 2 additions & 0 deletions include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ namespace RE
double GetMoveDirectionRelativeToFacing();
ObjectRefHandle GetOccupiedFurniture() const;
TESRace* GetRace() const;
float GetRegenDelay(ActorValue a_actorValue) const;
bool GetRider(NiPointer<Actor>& a_outRider);
[[nodiscard]] TESObjectARMO* GetSkin() const;
[[nodiscard]] TESObjectARMO* GetSkin(BGSBipedObjectForm::BipedObjectSlot a_slot, bool a_noInit = false);
Expand Down Expand Up @@ -616,6 +617,7 @@ namespace RE
void UpdateAwakeSound(NiAVObject* a_obj3D);
void Update3DModel();
void UpdateHairColor();
void UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay);
void UpdateSkinColor();
void UpdateWeaponAbility(TESForm* a_weapon, ExtraDataList* a_extraData, bool a_leftHand);
void VisitArmorAddon(TESObjectARMO* a_armor, TESObjectARMA* a_arma, std::function<void(bool a_firstPerson, NiAVObject& a_obj)> a_visitor);
Expand Down
2 changes: 2 additions & 0 deletions include/RE/G/GFxValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ namespace RE
bool SetText(void* a_data, const char* a_text, bool a_isHTML);

bool AttachMovie(void* a_data, GFxValue* a_movieClip, const char* a_symbolName, const char* a_instanceName, std::int32_t a_depth, const GFxValue* a_initObj);
bool CreateEmptyMovieClip(void* a_data, GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth);
bool GotoAndPlay(void* a_data, const char* a_frame, bool a_stop);

bool IsSameContext(const ObjectInterface* a_rhs) const;
Expand Down Expand Up @@ -399,6 +400,7 @@ namespace RE

// AS MovieClip support. Valid for MovieClips.
bool AttachMovie(GFxValue* a_movieClip, const char* a_symbolName, const char* a_instanceName, std::int32_t a_depth = -1, const GFxValue* a_initObj = nullptr);
bool CreateEmptyMovieClip(GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth = -1);
bool GotoAndPlay(const char* a_frame);
bool GotoAndStop(const char* a_frame);

Expand Down
7 changes: 7 additions & 0 deletions include/RE/H/HUDMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ namespace RE
// override (BSTEventSink<BSRemoteGamepadEvent>)
BSEventNotifyControl ProcessEvent(const BSRemoteGamepadEvent* a_event, BSTEventSource<BSRemoteGamepadEvent>* a_eventSource) override; // 01

static void FlashMeter(ActorValue a_actorValue)
{
using func_t = decltype(&HUDMenu::FlashMeter);
REL::Relocation<func_t> func{ RELOCATION_ID(51907, 52845) };
return func(a_actorValue);
}

static void UpdateCrosshairMagicTarget(bool a_valid)
{
using func_t = decltype(&HUDMenu::UpdateCrosshairMagicTarget);
Expand Down
1 change: 1 addition & 0 deletions include/RE/M/MagicCaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace RE
float GetCurrentSpellCost();
void InterruptCast(bool a_refund);
void PlayReleaseSound(MagicItem* a_item);
void SetCurrentSpell(MagicItem* a_item);
bool TestProjectilePlacement(const Effect& a_effect, const bhkPickData& a_pickData);
void UpdateImpl(float a_delta);

Expand Down
13 changes: 7 additions & 6 deletions include/RE/M/MagicTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ namespace RE
virtual float CheckResistance(MagicItem* a_magicItem, Effect* a_effect, TESBoundObject* a_object); // 0A - { return 1.0; }
virtual bool CheckAbsorb(Actor* a_actor, MagicItem* a_magicItem, const Effect* a_effect); // 0B - { return false; }

bool DispelEffect(MagicItem* a_spell, BSPointerHandle<Actor>& a_caster, ActiveEffect* a_effect = nullptr);
void DispelEffectsWithArchetype(Archetype a_type, bool a_force);
bool HasEffectWithArchetype(Archetype a_type);
bool HasMagicEffect(EffectSetting* a_effect);
bool HasMagicEffectWithKeyword(BGSKeyword* a_keyword, std::uint64_t a_arg2);
void VisitEffects(ForEachActiveEffectVisitor& visitor);
bool DispelEffect(MagicItem* a_spell, BSPointerHandle<Actor>& a_caster, ActiveEffect* a_effect = nullptr);
void DispelEffectsWithArchetype(Archetype a_type, bool a_force);
Actor* GetTargetAsActor();
bool HasEffectWithArchetype(Archetype a_type);
bool HasMagicEffect(EffectSetting* a_effect);
bool HasMagicEffectWithKeyword(BGSKeyword* a_keyword, std::uint64_t a_arg2);
void VisitEffects(ForEachActiveEffectVisitor& visitor);

// members
SpellDispelData* postUpdateDispelList; // 08
Expand Down
1 change: 1 addition & 0 deletions include/RE/P/PlayerCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ namespace RE
TintMask* GetTintMask(std::uint32_t a_tintType, std::uint32_t a_index);
bool HasActorDoingCommand() const;
bool IsGrabbing() const;
void PlayMagicFailureSound(MagicSystem::SpellType a_spellType);
void PlayPickupEvent(TESForm* a_item, TESForm* a_containerOwner, TESObjectREFR* a_containerRef, EventType a_eventType);
void SetAIDriven(bool a_enable);
void SetEscaping(bool a_flag, bool a_escaped);
Expand Down
1 change: 1 addition & 0 deletions include/RE/T/TESObjectREFR.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ namespace RE
ObjectRefHandle CreateRefHandle();
void DoTrap(TrapData& a_data);
void DoTrap(TrapEntry* a_trap, TargetEntry* a_target);
void Enable(bool a_resetInventory);
NiAVObject* Get3D() const;
NiAVObject* Get3D(bool a_firstPerson) const;
TESNPC* GetActorOwner();
Expand Down
7 changes: 7 additions & 0 deletions include/RE/T/TutorialMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ namespace RE
void Accept(CallbackProcessor* a_processor) override; // 01
UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04

static void OpenTutorialMenu(DEFAULT_OBJECT a_tutorial)
{
using func_t = decltype(&TutorialMenu::OpenTutorialMenu);
REL::Relocation<func_t> func{ RELOCATION_ID(51818, 52692) };
return func(a_tutorial);
}

// members
GFxValue root; // 30 - "Menu_mc"
};
Expand Down
36 changes: 36 additions & 0 deletions src/RE/A/AIProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ namespace RE
}
}

float AIProcess::GetRegenDelay(ActorValue a_actorValue) const
{
if (high) {
switch (a_actorValue) {
case ActorValue::kHealth:
return high->healthRegenDelay;
case ActorValue::kMagicka:
return high->magickaRegenDelay;
case ActorValue::kStamina:
return high->staminaRegenDelay;
default:
break;
}
}
return 0.0f;
}

TESPackage* AIProcess::GetRunningPackage() const
{
TESPackage* package = nullptr;
Expand Down Expand Up @@ -254,4 +271,23 @@ namespace RE
REL::Relocation<func_t> func{ Offset::AIProcess::Update3DModel };
return func(this, a_actor);
}

void AIProcess::UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay)
{
if (high) {
switch (a_actorValue) {
case ActorValue::kHealth:
high->healthRegenDelay = a_regenDelay;
break;
case ActorValue::kMagicka:
high->magickaRegenDelay = a_regenDelay;
break;
case ActorValue::kStamina:
high->staminaRegenDelay = a_regenDelay;
break;
default:
break;
}
}
}
}
15 changes: 15 additions & 0 deletions src/RE/A/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ namespace RE
return base ? base->race : nullptr;
}

float Actor::GetRegenDelay(ActorValue a_actorValue) const
{
if (currentProcess) {
return currentProcess->GetRegenDelay(a_actorValue);
}
return 0.0f;
}

bool Actor::GetRider(NiPointer<Actor>& a_outRider)
{
using func_t = decltype(&Actor::GetRider);
Expand Down Expand Up @@ -1088,6 +1096,13 @@ namespace RE
}
}

void Actor::UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay)
{
if (currentProcess) {
currentProcess->UpdateRegenDelay(a_actorValue, a_regenDelay);
}
}

void Actor::UpdateSkinColor()
{
const auto* npc = GetActorBase();
Expand Down
13 changes: 13 additions & 0 deletions src/RE/G/GFxValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ namespace RE
return func(this, a_data, a_movieClip, a_symbolName, a_instanceName, a_depth, a_initObj);
}

bool GFxValue::ObjectInterface::CreateEmptyMovieClip(void* a_data, GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth)
{
using func_t = decltype(&GFxValue::ObjectInterface::CreateEmptyMovieClip);
REL::Relocation<func_t> func{ RELOCATION_ID(80201, 82224) };
return func(this, a_data, a_movieClip, a_instanceName, a_depth);
}

bool GFxValue::ObjectInterface::GotoAndPlay(void* a_data, const char* a_frame, bool a_stop)
{
using func_t = decltype(&GFxValue::ObjectInterface::GotoAndPlay);
Expand Down Expand Up @@ -967,6 +974,12 @@ namespace RE
return _objectInterface->AttachMovie(_value.obj, a_movieClip, a_symbolName, a_instanceName, a_depth, a_initObj);
}

bool GFxValue::CreateEmptyMovieClip(GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth)
{
assert(IsDisplayObject());
return _objectInterface->CreateEmptyMovieClip(_value.obj, a_movieClip, a_instanceName, a_depth);
}

bool GFxValue::GotoAndPlay(const char* a_frame)
{
assert(IsDisplayObject());
Expand Down
9 changes: 8 additions & 1 deletion src/RE/M/MagicCaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace RE
bool MagicCaster::FindTargets(float a_effectivenessMult, std::uint32_t& a_targetCount, TESBoundObject* a_source, bool a_loadCast, bool a_adjustOnlyHostileEffectiveness)
{
using func_t = decltype(&MagicCaster::FindTargets);
REL::Relocation<func_t> func{ RELOCATION_ID(33676, 34456) };
REL::Relocation<func_t> func{ RELOCATION_ID(33632, 34410) };
return func(this, a_effectivenessMult, a_targetCount, a_source, a_loadCast, a_adjustOnlyHostileEffectiveness);
}

Expand Down Expand Up @@ -48,6 +48,13 @@ namespace RE
return func(this, a_item);
}

void MagicCaster::SetCurrentSpell(MagicItem* a_item)
{
using func_t = decltype(&MagicCaster::SetCurrentSpell);
REL::Relocation<func_t> func{ RELOCATION_ID(33644, 34422) };
return func(this, a_item);
}

bool MagicCaster::TestProjectilePlacement(const Effect& a_effect, const bhkPickData& a_pickData)
{
if (auto baseEffect = a_effect.baseEffect) {
Expand Down
35 changes: 19 additions & 16 deletions src/RE/M/MagicSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@

namespace RE
{
const char* GetCannotCastString(MagicSystem::CannotCastReason a_reason)
namespace MagicSystem
{
using func_t = decltype(&MagicSystem::GetCannotCastString);
REL::Relocation<func_t> func{ RELOCATION_ID(11295, 11423) };
return func(a_reason);
}
const char* GetCannotCastString(MagicSystem::CannotCastReason a_reason)
{
using func_t = decltype(&MagicSystem::GetCannotCastString);
REL::Relocation<func_t> func{ RELOCATION_ID(11295, 11423) };
return func(a_reason);
}

float GetMagicCasterTargetUpdateInterval()
{
using func_t = decltype(&MagicSystem::GetMagicCasterTargetUpdateInterval);
REL::Relocation<func_t> func{ RELOCATION_ID(11294, 11422) };
return func();
}
float GetMagicCasterTargetUpdateInterval()
{
using func_t = decltype(&MagicSystem::GetMagicCasterTargetUpdateInterval);
REL::Relocation<func_t> func{ RELOCATION_ID(11294, 11422) };
return func();
}

BGSSoundDescriptorForm* GetMagicFailureSound(MagicSystem::SpellType a_type)
{
using func_t = decltype(&MagicSystem::GetMagicFailureSound);
REL::Relocation<func_t> func{ RELOCATION_ID(11286, 11411) };
return func(a_type);
BGSSoundDescriptorForm* GetMagicFailureSound(MagicSystem::SpellType a_type)
{
using func_t = decltype(&MagicSystem::GetMagicFailureSound);
REL::Relocation<func_t> func{ RELOCATION_ID(11286, 11411) };
return func(a_type);
}
}
}
10 changes: 10 additions & 0 deletions src/RE/M/MagicTarget.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "RE/M/MagicTarget.h"

#include "RE/A/ActiveEffect.h"
#include "RE/A/Actor.h"
#include "RE/B/BSTList.h"
#include "RE/E/EffectSetting.h"

Expand Down Expand Up @@ -33,6 +34,15 @@ namespace RE
}
}

Actor* MagicTarget::GetTargetAsActor()
{
if (MagicTargetIsActor()) {
return static_cast<Actor*>(this);
}

return nullptr;
}

bool MagicTarget::HasEffectWithArchetype(Archetype a_type)
{
auto effects = GetActiveEffectList();
Expand Down
7 changes: 7 additions & 0 deletions src/RE/P/PlayerCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ namespace RE
return static_cast<bool>(grabbedObject);
}

void PlayerCharacter::PlayMagicFailureSound(MagicSystem::SpellType a_spellType)
{
using func_t = decltype(&PlayerCharacter::PlayMagicFailureSound);
REL::Relocation<func_t> func{ RELOCATION_ID(39486, 40565) };
return func(this, a_spellType);
}

void PlayerCharacter::PlayPickupEvent(TESForm* a_item, TESForm* a_containerOwner, TESObjectREFR* a_containerRef, EventType a_eventType)
{
using func_t = decltype(&PlayerCharacter::PlayPickupEvent);
Expand Down
7 changes: 7 additions & 0 deletions src/RE/T/TESObjectREFR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ namespace RE
return DoTrap2(a_trap, a_target);
}

void TESObjectREFR::Enable(bool a_resetInventory)
{
using func_t = decltype(&TESObjectREFR::Enable);
REL::Relocation<func_t> func{ RELOCATION_ID(19373, 19800) };
return func(this, a_resetInventory);
}

NiAVObject* TESObjectREFR::Get3D() const
{
return Get3D2();
Expand Down

0 comments on commit 8a77c6d

Please sign in to comment.