Batch #18562 by ragnarok-clanker: forced by an admin (31 lower score(s), 132 changed function(s)); checked with 230 compiled unit(s), including every includer of Source/Client/Mode/CGameMode.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GameObject.h, Source/Contents/Actors/GndRiser.h, Source/Contents/Actors/GroundScope.h, Source/Contents/Actors/Item.h, Source/Contents/Actors/MousePointer.h, Source/Contents/Actors/Npc.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObject.h, Source/Contents/Actors/Skill.h, Source/Contents/Effects/Core/DummyEffectLauncher.h, Source/Contents/Effects/Core/EffectActor.h, Source/Contents/Effects/Core/EffectMaker.h, Source/Contents/Effects/Core/MsgEffect.h, Source/Contents/Effects/Skills/ArrowEffect.h, Source/Contents/Effects/Skills/MandraAttackEffect.h, Source/Contents/SignBoard/SignBoard.h, Source/Contents/Skills/GraffiSkill.h, Source/Contents/Sound/SoundMaker.h.
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
#include "Contents/Actors/MousePointer.h"
|
|
#include "Client/Mode/CGameMode.h"
|
|
#include "Client/Mode/ModeMgr.h"
|
|
#include "Contents/World/World.h"
|
|
#include "Resource/Sprites/ActionResource.h"
|
|
#include "Resource/World/TerrainResource.h"
|
|
|
|
#include <windows.h>
|
|
#include <timeapi.h>
|
|
|
|
// OFFSET: 0x00CAFD30
|
|
// FUNCTION: fn_21088
|
|
bool CMousePointer::OnProcess() {
|
|
const float frame = static_cast<float>(static_cast<double>(timeGetTime() - this->render.motionStartTime) / 24.0);
|
|
this->render.previousAnimation = this->render.animation;
|
|
this->render.curMotion = static_cast<int>(frame / this->render.speed) % static_cast<int>(this->render.action->FrameCount(this->render.animation));
|
|
if (this->m_remainingFrames != 0) {
|
|
if (--this->m_remainingFrames == 0) {
|
|
this->render.visible = 0;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// OFFSET: 0x00CBF860
|
|
// FUNCTION: fn_21114
|
|
void CMousePointer::SendMsg(CGameObject*, std::int64_t message, std::int64_t b, std::int64_t c, std::int64_t, std::int64_t, std::int64_t, std::int64_t) {
|
|
if (message == 1) {
|
|
const float* const position = reinterpret_cast<const float*>(static_cast<std::intptr_t>(b));
|
|
this->render.position.x = position[0];
|
|
this->render.position.z = position[1];
|
|
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
|
this->render.position.y = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
|
this->render.visible = 1;
|
|
this->m_remainingFrames = 0;
|
|
if (c != 0) {
|
|
this->render.color = 0xFFFF0000;
|
|
} else {
|
|
this->render.color = 0xFFFFFFFF;
|
|
}
|
|
} else if (message == 2) {
|
|
if (b != 0) {
|
|
this->m_remainingFrames = static_cast<int>(b);
|
|
} else {
|
|
this->render.visible = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00CA8630
|
|
// FUNCTION: fn_20990
|
|
CMousePointer::CMousePointer() {
|
|
this->m_remainingFrames = 0;
|
|
this->render.flatDepth = 1;
|
|
this->render.visible = 0;
|
|
this->render.motionStartTime = timeGetTime();
|
|
|
|
if (this->render.sprite) {
|
|
this->render.sprite->Unlock();
|
|
}
|
|
this->render.sprite = static_cast<CSprRes*>(ResourceMgr::Instance().Load("cursors.spr"));
|
|
if (this->render.sprite) {
|
|
this->render.sprite->Lock();
|
|
}
|
|
|
|
if (this->render.action) {
|
|
this->render.action->Unlock();
|
|
}
|
|
this->render.action = static_cast<CActRes*>(ResourceMgr::Instance().Load("cursors.act"));
|
|
if (this->render.action) {
|
|
this->render.action->Lock();
|
|
}
|
|
|
|
this->SetAction(3, 2, 0);
|
|
}
|