Decompile 3 functions in Source/Contents/Effects/PartyMemberEffects.cpp, Source/Contents/Effects/EffectPrimitiveMotion.cpp, ...
Batch #2131 by ragnarok-clanker: 0 byte-identical, 3 confirmed by peer review. - fn_19841 CEffectPrim::PrimTanji2: logic confirmed by peer review - fn_19786 CEffectPrim::Prim3DTextureNoMaster: logic confirmed by peer review - fn_21069 EffectActor::LaunchEffect: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
d98cf6bf1e
commit
f8ee6dec15
6 changed files with 396 additions and 23 deletions
|
|
@ -1,32 +1,98 @@
|
|||
#include "Contents/Effects/RagEffect.h"
|
||||
#include "Contents/Effects/EffectActor.h"
|
||||
#include "Contents/Effects/PartyMemberEffects.h"
|
||||
#include "Contents/Effects/RagEffectInitialization.h"
|
||||
#include "Client/Application/LaunchInfo.h"
|
||||
#include "Client/Mode/CGameMode.h"
|
||||
#include "Client/Mode/ModeMgr.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Contents/World/World.h"
|
||||
#include "Script/LuaScript.h"
|
||||
#include "Utility/Math/AffineMatrix.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace {
|
||||
// OFFSET: 0x00CADD60
|
||||
// FUNCTION: fn_21069
|
||||
CRagEffect* CreatePartyEffect(EffectActor& actor, PartyEffectMode& mode) {
|
||||
mode.lastEffectId = 160;
|
||||
auto* effect = new CRagEffect();
|
||||
bool force = false;
|
||||
mode.effectScript.Call("IsForceRenderEffect", "d>b", 160, &force);
|
||||
effect->state.forceRender = force;
|
||||
struct CRollingCutterRagEffect : CRagEffect {
|
||||
CRollingCutterRagEffect() : duration(60), elapsed(0) {
|
||||
}
|
||||
|
||||
const float sine = ClientSine(0);
|
||||
const float cosine = ClientCosine(0);
|
||||
const float x = 0.0f * cosine - 0.0f * sine;
|
||||
const float z = 0.0f * cosine + 0.0f * sine;
|
||||
InitializeRagEffect(effect->state, effect->render, &actor, actor.render, 160, x, 0, z, mode.options, mode.resources);
|
||||
mode.objects.push_back(effect);
|
||||
actor.state.effects.push_back(&effect->state);
|
||||
/* 11CA8 */ int duration;
|
||||
/* 11CAC */ int elapsed;
|
||||
};
|
||||
|
||||
return effect;
|
||||
struct CWhirlwindEffect : CRagEffect {
|
||||
CWhirlwindEffect() : duration(250), first(0), second(0) {
|
||||
}
|
||||
|
||||
/* 11CA8 */ int duration;
|
||||
/* 11CAC */ int unknown_11CAC;
|
||||
/* 11CB0 */ int first;
|
||||
/* 11CB4 */ int second;
|
||||
};
|
||||
|
||||
void RecordLaunch(int effectId) {
|
||||
std::uint32_t recent[8];
|
||||
recent[0] = effectId;
|
||||
std::memcpy(recent + 1, g_launchInfo, sizeof(recent) - sizeof(recent[0]));
|
||||
std::memcpy(g_launchInfo, recent, sizeof(recent));
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00CADD60
|
||||
// FUNCTION: fn_21069
|
||||
CRagEffect* EffectActor::LaunchEffect(int effectId, vector3d deltaPos, float rotation) {
|
||||
CRagEffect* effect;
|
||||
|
||||
if (effectId == 127) {
|
||||
this->state.unknown_0140 = 1;
|
||||
RecordLaunch(effectId);
|
||||
effect = new CRagEffect();
|
||||
} else {
|
||||
if (effectId < 0 || effectId > 60000) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RecordLaunch(effectId);
|
||||
|
||||
if (effectId == 837) {
|
||||
effect = new CRollingCutterRagEffect();
|
||||
} else if (effectId == 2444) {
|
||||
effect = new CWhirlwindEffect();
|
||||
} else {
|
||||
effect = new CRagEffect();
|
||||
}
|
||||
}
|
||||
|
||||
if (!effect) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool force = false;
|
||||
g_session.m_hotkeyScript->Call("IsForceRenderEffect", "d>b", effectId, &force);
|
||||
effect->state.forceRender = force;
|
||||
|
||||
const int degrees = static_cast<int>(rotation);
|
||||
const float sine = ClientSine(degrees);
|
||||
const float cosine = ClientCosine(degrees);
|
||||
const float x = deltaPos.x * cosine - deltaPos.z * sine;
|
||||
const float z = deltaPos.z * cosine + deltaPos.x * sine;
|
||||
deltaPos.x = x;
|
||||
deltaPos.z = z;
|
||||
|
||||
if (effectId == 166 && this->render.unknown_00A8 == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!this) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
effect->Init(this, effectId, deltaPos);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->objects.push_back(effect);
|
||||
this->state.effects.push_back(&effect->state);
|
||||
return effect;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
bool PartyMemberEffects::Enabled() const {
|
||||
const auto* mode = this->activeMode;
|
||||
|
|
@ -40,7 +106,7 @@ void PartyMemberEffects::EnsurePartyEffect(std::uint32_t accountId) {
|
|||
for (EffectActor* actor : mode.actors) {
|
||||
if (actor->render.accountId == accountId) {
|
||||
if (!actor->state.Attachments().HasId(160)) {
|
||||
CreatePartyEffect(*actor, mode);
|
||||
actor->LaunchEffect(160, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue