mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-27 16:22:32 +03:00
Compare commits
2
Commits
master
..
f9643939d9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9643939d9 | ||
|
|
44bee4cbd7 |
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
name: PR
|
name: PR
|
||||||
|
|
||||||
on: [pull_request]
|
on: [pull_request_target]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -45,10 +45,14 @@ jobs:
|
|||||||
if: matrix.build.os == 'ubuntu-latest'
|
if: matrix.build.os == 'ubuntu-latest'
|
||||||
|
|
||||||
- name: Download Fixtures
|
- name: Download Fixtures
|
||||||
run: curl -o test/fixture/whoa-fixture.tgz https://whoa.reliquaryhq.com/whoa-fixture.tgz
|
run: aws s3 cp --endpoint-url ${{ env.AWS_ENDPOINT_URL }} s3://reliquaryhq-whoa/fixture.tgz test/fixture/
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.STORAGE_AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORAGE_AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_ENDPOINT_URL: ${{ vars.STORAGE_AWS_ENDPOINT_URL }}
|
||||||
|
|
||||||
- name: Unpack Fixtures
|
- name: Unpack Fixtures
|
||||||
run: tar -xvzf whoa-fixture.tgz
|
run: tar -xvzf fixture.tgz
|
||||||
working-directory: test/fixture
|
working-directory: test/fixture
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
|
|||||||
@@ -44,10 +44,14 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Download Fixtures
|
- name: Download Fixtures
|
||||||
run: curl -o test/fixture/whoa-fixture.tgz https://whoa.reliquaryhq.com/whoa-fixture.tgz
|
run: aws s3 cp --endpoint-url ${{ env.AWS_ENDPOINT_URL }} s3://reliquaryhq-whoa/fixture.tgz test/fixture/
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.STORAGE_AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORAGE_AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_ENDPOINT_URL: ${{ vars.STORAGE_AWS_ENDPOINT_URL }}
|
||||||
|
|
||||||
- name: Unpack Fixtures
|
- name: Unpack Fixtures
|
||||||
run: tar -xvzf whoa-fixture.tgz
|
run: tar -xvzf fixture.tgz
|
||||||
working-directory: test/fixture
|
working-directory: test/fixture
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
|
|||||||
+1
-1
Submodule lib/typhoon updated: c6ee931690...1e5366bbc6.
@@ -3,9 +3,9 @@
|
|||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
#include "glue/CRealmList.hpp"
|
#include "glue/CRealmList.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|||||||
+14
-11
@@ -33,11 +33,11 @@ void Blit_uint16_uint16(const C2iVector& size, const void* in, uint32_t inStride
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto in_ = static_cast<const char*>(in);
|
const char* in_ = reinterpret_cast<const char*>(in);
|
||||||
auto out_ = static_cast<char*>(out);
|
char* out_ = reinterpret_cast<char*>(out);
|
||||||
|
|
||||||
for (int32_t i = 0; i < size.y; i++) {
|
for (int32_t i = 0; i < size.y; i++) {
|
||||||
memcpy(out_, in_, 2 * size.x);
|
memcpy(out, in, 2 * size.x);
|
||||||
in_ += inStride;
|
in_ += inStride;
|
||||||
out_ += outStride;
|
out_ += outStride;
|
||||||
}
|
}
|
||||||
@@ -49,11 +49,11 @@ void Blit_uint32_uint32(const C2iVector& size, const void* in, uint32_t inStride
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto in_ = static_cast<const char*>(in);
|
const char* in_ = reinterpret_cast<const char*>(in);
|
||||||
auto out_ = static_cast<char*>(out);
|
char* out_ = reinterpret_cast<char*>(out);
|
||||||
|
|
||||||
for (int32_t i = 0; i < size.y; i++) {
|
for (int32_t i = 0; i < size.y; i++) {
|
||||||
memcpy(out_, in_, 4 * size.x);
|
memcpy(out, in, 4 * size.x);
|
||||||
in_ += inStride;
|
in_ += inStride;
|
||||||
out_ += outStride;
|
out_ += outStride;
|
||||||
}
|
}
|
||||||
@@ -180,10 +180,13 @@ void Blit_Dxt1_Rgb565(const C2iVector& size, const void* in, uint32_t inStride,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Blit_Dxt1_Dxt1(const C2iVector& size, const void* in, uint32_t inStride, void* out, uint32_t outStride) {
|
void Blit_Dxt1_Dxt1(const C2iVector& size, const void* in, uint32_t inStride, void* out, uint32_t outStride) {
|
||||||
|
const char* in_ = static_cast<const char*>(in);
|
||||||
|
char* out_ = static_cast<char*>(out);
|
||||||
|
|
||||||
int32_t v6 = std::max(size.x, 4);
|
int32_t v6 = std::max(size.x, 4);
|
||||||
int32_t v7 = std::max(size.y, 4);
|
int32_t v7 = std::max(size.y, 4);
|
||||||
|
|
||||||
memcpy(out, in, (4 * v6 * v7) >> 3);
|
memcpy(out_, in_, (4 * v6 * v7) >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Blit_Dxt3_Argb8888(const C2iVector& size, const void* in, uint32_t inStride, void* out, uint32_t outStride) {
|
void Blit_Dxt3_Argb8888(const C2iVector& size, const void* in, uint32_t inStride, void* out, uint32_t outStride) {
|
||||||
@@ -198,14 +201,14 @@ void Blit_Dxt35_Dxt35(const C2iVector& size, const void* in, uint32_t inStride,
|
|||||||
int32_t v5 = std::max(size.x, 4);
|
int32_t v5 = std::max(size.x, 4);
|
||||||
int32_t v6 = std::max(size.y / 4, 1);
|
int32_t v6 = std::max(size.y / 4, 1);
|
||||||
|
|
||||||
|
const char* in_ = static_cast<const char*>(in);
|
||||||
|
char* out_ = static_cast<char*>(out);
|
||||||
|
|
||||||
if (inStride == v5 * 4 && outStride == v5 * 4) {
|
if (inStride == v5 * 4 && outStride == v5 * 4) {
|
||||||
memcpy(out, in, v5 * v6 * 4);
|
memcpy(out_, in_, v5 * v6 * 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto in_ = static_cast<const char*>(in);
|
|
||||||
auto out_ = static_cast<char*>(out);
|
|
||||||
|
|
||||||
for (int32_t i = v6; i > 0; i--) {
|
for (int32_t i = v6; i > 0; i--) {
|
||||||
memcpy(out_, in_, v5 * 4);
|
memcpy(out_, in_, v5 * 4);
|
||||||
in_ += inStride;
|
in_ += inStride;
|
||||||
|
|||||||
@@ -1214,4 +1214,17 @@ struct CHARACTER_INFO {
|
|||||||
uint8_t firstLogin;
|
uint8_t firstLogin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CHARACTER_CREATE_INFO {
|
||||||
|
char name[48];
|
||||||
|
uint8_t raceID;
|
||||||
|
uint8_t classID;
|
||||||
|
uint8_t sexID;
|
||||||
|
uint8_t skinID;
|
||||||
|
uint8_t faceID;
|
||||||
|
uint8_t hairStyleID;
|
||||||
|
uint8_t hairColorID;
|
||||||
|
uint8_t facialHairStyleID;
|
||||||
|
uint8_t outfitID;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -111,14 +111,6 @@ C3Vector CGObject_C::GetPosition() const {
|
|||||||
return { 0.0f, 0.0f, 0.0f };
|
return { 0.0f, 0.0f, 0.0f };
|
||||||
}
|
}
|
||||||
|
|
||||||
float CGObject_C::GetRawFacing() const {
|
|
||||||
return this->GetFacing();
|
|
||||||
}
|
|
||||||
|
|
||||||
WOWGUID CGObject_C::GetTransportGUID() const {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGObject_C::IsInReenable() {
|
int32_t CGObject_C::IsInReenable() {
|
||||||
return this->m_inReenable;
|
return this->m_inReenable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,6 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
|||||||
virtual C3Vector GetPosition() const;
|
virtual C3Vector GetPosition() const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual float GetFacing() const;
|
virtual float GetFacing() const;
|
||||||
virtual float GetRawFacing() const;
|
|
||||||
// TODO
|
|
||||||
virtual WOWGUID GetTransportGUID() const;
|
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "object/client/CGUnit.hpp"
|
#include "object/client/CGUnit.hpp"
|
||||||
#include "object/client/CGObject.hpp"
|
#include "object/client/CGObject.hpp"
|
||||||
#include "object/client/CMovement_C.hpp"
|
|
||||||
|
|
||||||
uint32_t CGUnit::GetBaseOffset() {
|
uint32_t CGUnit::GetBaseOffset() {
|
||||||
return CGObject::TotalFields();
|
return CGObject::TotalFields();
|
||||||
@@ -30,22 +29,10 @@ int32_t CGUnit::GetDisplayID() const {
|
|||||||
return this->Unit()->displayID;
|
return this->Unit()->displayID;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CGUnit::GetFacing() const {
|
|
||||||
return this->m_move->GetFacing();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGUnit::GetNativeDisplayID() const {
|
int32_t CGUnit::GetNativeDisplayID() const {
|
||||||
return this->Unit()->nativeDisplayID;
|
return this->Unit()->nativeDisplayID;
|
||||||
}
|
}
|
||||||
|
|
||||||
C3Vector CGUnit::GetPosition() const {
|
|
||||||
return this->m_move->GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
float CGUnit::GetRawFacing() const {
|
|
||||||
return this->m_move->GetRawFacing();
|
|
||||||
}
|
|
||||||
|
|
||||||
CGUnitData* CGUnit::Unit() const {
|
CGUnitData* CGUnit::Unit() const {
|
||||||
return this->m_unit;
|
return this->m_unit;
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,8 @@
|
|||||||
#define OBJECT_CLIENT_CG_UNIT_HPP
|
#define OBJECT_CLIENT_CG_UNIT_HPP
|
||||||
|
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
#include <tempest/Vector.hpp>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class CMovement_C;
|
|
||||||
|
|
||||||
struct CGUnitData {
|
struct CGUnitData {
|
||||||
WOWGUID charm;
|
WOWGUID charm;
|
||||||
WOWGUID summon;
|
WOWGUID summon;
|
||||||
@@ -86,19 +83,13 @@ class CGUnit {
|
|||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGUnit(CMovement_C& move)
|
|
||||||
: m_move(&move) {};
|
|
||||||
int32_t GetDisplayID() const;
|
int32_t GetDisplayID() const;
|
||||||
float GetFacing() const;
|
|
||||||
int32_t GetNativeDisplayID() const;
|
int32_t GetNativeDisplayID() const;
|
||||||
C3Vector GetPosition() const;
|
|
||||||
float GetRawFacing() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
CGUnitData* m_unit;
|
CGUnitData* m_unit;
|
||||||
uint32_t* m_unitSaved;
|
uint32_t* m_unitSaved;
|
||||||
CMovement_C* m_move;
|
|
||||||
|
|
||||||
// Protected member functions
|
// Protected member functions
|
||||||
CGUnitData* Unit() const;
|
CGUnitData* Unit() const;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "object/client/CGUnit_C.hpp"
|
#include "object/client/CGUnit_C.hpp"
|
||||||
#include "component/CCharacterComponent.hpp"
|
#include "component/CCharacterComponent.hpp"
|
||||||
#include "db/Db.hpp"
|
|
||||||
#include "model/Model2.hpp"
|
#include "model/Model2.hpp"
|
||||||
#include "object/client/ObjMgr.hpp"
|
#include "object/client/ObjMgr.hpp"
|
||||||
|
#include "db/Db.hpp"
|
||||||
#include "ui/Game.hpp"
|
#include "ui/Game.hpp"
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
#include <tempest/Math.hpp>
|
|
||||||
|
|
||||||
WOWGUID CGUnit_C::s_activeMover;
|
WOWGUID CGUnit_C::s_activeMover;
|
||||||
|
|
||||||
@@ -99,8 +98,8 @@ const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, U
|
|||||||
|
|
||||||
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate)
|
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate)
|
||||||
: CGObject_C(time, objCreate)
|
: CGObject_C(time, objCreate)
|
||||||
, CGUnit(this->m_localMove)
|
, m_movement(&this->m_localMovement)
|
||||||
, m_localMove(objCreate.move.status.position28, objCreate.move.status.facing34, this->GetGUID(), this)
|
, m_localMovement(objCreate.move.status.position28, objCreate.move.status.facing34, this->GetGUID(), this)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
@@ -137,10 +136,6 @@ int32_t CGUnit_C::GetDisplayID() const {
|
|||||||
return this->CGUnit::GetDisplayID();
|
return this->CGUnit::GetDisplayID();
|
||||||
}
|
}
|
||||||
|
|
||||||
float CGUnit_C::GetFacing() const {
|
|
||||||
return this->CGUnit::GetFacing();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGUnit_C::GetLocalDisplayID() const {
|
int32_t CGUnit_C::GetLocalDisplayID() const {
|
||||||
return this->m_localDisplayID;
|
return this->m_localDisplayID;
|
||||||
}
|
}
|
||||||
@@ -180,22 +175,6 @@ int32_t CGUnit_C::GetModelFileName(const char*& name) const {
|
|||||||
return modelDataRec->m_modelName ? true : false;
|
return modelDataRec->m_modelName ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
C3Vector CGUnit_C::GetPosition() const {
|
|
||||||
return this->CGUnit::GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
float CGUnit_C::GetRawFacing() const {
|
|
||||||
return this->CGUnit::GetRawFacing();
|
|
||||||
}
|
|
||||||
|
|
||||||
float CGUnit_C::GetRawSmoothFacing() const {
|
|
||||||
return this->m_smoothFacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
WOWGUID CGUnit_C::GetTransportGUID() const {
|
|
||||||
return this->m_localMove.GetTransportGUID();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
@@ -213,10 +192,6 @@ void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
this->m_smoothFacing = CMath::normalizeangle0to2pi(this->GetRawFacing());
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "object/client/CClientObjCreate.hpp"
|
#include "object/client/CClientObjCreate.hpp"
|
||||||
#include "object/client/CGObject_C.hpp"
|
#include "object/client/CGObject_C.hpp"
|
||||||
#include "object/client/CGUnit.hpp"
|
#include "object/client/CGUnit.hpp"
|
||||||
#include "object/client/CMovement_C.hpp"
|
#include "object/client/CMovementData_C.hpp"
|
||||||
#include "object/Types.hpp"
|
#include "object/Types.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
|
||||||
@@ -28,13 +28,6 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
// Virtual public member functions
|
// Virtual public member functions
|
||||||
virtual ~CGUnit_C();
|
virtual ~CGUnit_C();
|
||||||
// TODO
|
// TODO
|
||||||
virtual C3Vector GetPosition() const;
|
|
||||||
// TODO
|
|
||||||
virtual float GetFacing() const;
|
|
||||||
virtual float GetRawFacing() const;
|
|
||||||
// TODO
|
|
||||||
virtual WOWGUID GetTransportGUID() const;
|
|
||||||
// TODO
|
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t CanHighlight();
|
virtual int32_t CanHighlight();
|
||||||
@@ -45,7 +38,6 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
||||||
int32_t GetDisplayID() const;
|
int32_t GetDisplayID() const;
|
||||||
CreatureModelDataRec* GetModelData() const;
|
CreatureModelDataRec* GetModelData() const;
|
||||||
float GetRawSmoothFacing() const;
|
|
||||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||||
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
|
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
|
||||||
void SetStorage(uint32_t* storage, uint32_t* saved);
|
void SetStorage(uint32_t* storage, uint32_t* saved);
|
||||||
@@ -57,20 +49,19 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Private member variables
|
// Private member variables
|
||||||
|
CMovementData_C* m_movement;
|
||||||
// TODO
|
// TODO
|
||||||
CMovement_C m_localMove;
|
CMovementData_C m_localMovement;
|
||||||
// TODO
|
// TODO
|
||||||
CreatureDisplayInfoRec* m_displayInfo = nullptr;
|
CreatureDisplayInfoRec* m_displayInfo;
|
||||||
CreatureDisplayInfoExtraRec* m_displayInfoExtra = nullptr;
|
CreatureDisplayInfoExtraRec* m_displayInfoExtra;
|
||||||
CreatureModelDataRec* m_modelData = nullptr;
|
CreatureModelDataRec* m_modelData;
|
||||||
CreatureSoundDataRec* m_soundData = nullptr;
|
CreatureSoundDataRec* m_soundData;
|
||||||
// TODO
|
// TODO
|
||||||
UnitBloodLevelsRec* m_bloodRec = nullptr;
|
UnitBloodLevelsRec* m_bloodRec;
|
||||||
// TODO
|
// TODO
|
||||||
int32_t m_localDisplayID = 0;
|
int32_t m_localDisplayID = 0;
|
||||||
// TODO
|
// TODO
|
||||||
float m_smoothFacing;
|
|
||||||
// TODO
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#include "object/client/CVehicleCamera_C.hpp"
|
|
||||||
#include "object/client/CGObject_C.hpp"
|
|
||||||
|
|
||||||
int32_t CVehicleCamera_C::ConvertSmoothFacingFromRawToWorld(float& smoothFacing, CGObject_C* relativeTo) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#ifndef OBJECT_CLIENT_C_VEHICLE_CAMERA_C_HPP
|
|
||||||
#define OBJECT_CLIENT_C_VEHICLE_CAMERA_C_HPP
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
class CGObject_C;
|
|
||||||
|
|
||||||
class CVehicleCamera_C {
|
|
||||||
public:
|
|
||||||
// Public static functions
|
|
||||||
static int32_t ConvertSmoothFacingFromRawToWorld(float& smoothFacing, CGObject_C* relativeTo);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,42 +1,18 @@
|
|||||||
#include "object/movement/CPassenger.hpp"
|
#include "object/movement/CPassenger.hpp"
|
||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
|
|
||||||
float CPassenger::GetFacing() const {
|
|
||||||
return this->GetFacing(this->m_facing);
|
|
||||||
}
|
|
||||||
|
|
||||||
float CPassenger::GetFacing(float facing) const {
|
|
||||||
// If on transport, transform facing by transport facing
|
|
||||||
if (this->m_transportGUID) {
|
|
||||||
float transportFacing = 0.0f;
|
|
||||||
// TODO MovementGetTransportFacing(this->m_transportGUID);
|
|
||||||
|
|
||||||
return facing + transportFacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
return facing;
|
|
||||||
}
|
|
||||||
|
|
||||||
C3Vector CPassenger::GetPosition() const {
|
C3Vector CPassenger::GetPosition() const {
|
||||||
return this->GetPosition(this->m_position);
|
return GetPosition(this->m_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
C3Vector CPassenger::GetPosition(const C3Vector& position) const {
|
C3Vector CPassenger::GetPosition(const C3Vector& position) const {
|
||||||
// If on transport, transform position by transport matrix
|
// If on transport, transform position by transport matrix
|
||||||
if (this->m_transportGUID) {
|
if (this->m_transportGUID) {
|
||||||
C44Matrix transportMatrix;
|
C44Matrix transportMatrix;
|
||||||
// TODO MovementGetTransportMtxX(this->m_transportGUID, &transportMatrix);
|
// MovementGetTransportMtxX(this->m_transportGUID, &transportMatrix);
|
||||||
|
|
||||||
return position * transportMatrix;
|
return position * transportMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CPassenger::GetRawFacing() const {
|
|
||||||
return this->m_facing;
|
|
||||||
}
|
|
||||||
|
|
||||||
WOWGUID CPassenger::GetTransportGUID() const {
|
|
||||||
return this->m_transportGUID;
|
|
||||||
}
|
|
||||||
@@ -12,12 +12,8 @@ class CPassenger {
|
|||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_facing(0.0f)
|
, m_facing(0.0f)
|
||||||
, m_guid(guid) {};
|
, m_guid(guid) {};
|
||||||
float GetFacing() const;
|
|
||||||
float GetFacing(float facing) const;
|
|
||||||
C3Vector GetPosition() const;
|
C3Vector GetPosition() const;
|
||||||
C3Vector GetPosition(const C3Vector& position) const;
|
C3Vector GetPosition(const C3Vector& position) const;
|
||||||
float GetRawFacing() const;
|
|
||||||
WOWGUID GetTransportGUID() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
#include "ui/Util.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "ui/CScriptRegion.hpp"
|
#include "ui/CScriptRegion.hpp"
|
||||||
#include "ui/FrameScript_Object.hpp"
|
#include "ui/FrameScript_Object.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "ui/simple/CSimpleTop.hpp"
|
#include "ui/simple/CSimpleTop.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <tempest/Rect.hpp>
|
#include <tempest/Rect.hpp>
|
||||||
|
|||||||
+46
-193
@@ -1,5 +1,5 @@
|
|||||||
#include "ui/Util.hpp"
|
#include "ui/Util.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include <type_traits>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
|
|
||||||
const char* LanguageProcess(const char* string) {
|
const char* LanguageProcess(const char* string) {
|
||||||
@@ -9,248 +9,101 @@ const char* LanguageProcess(const char* string) {
|
|||||||
|
|
||||||
int32_t StringToBlendMode(const char* string, EGxBlend& blend) {
|
int32_t StringToBlendMode(const char* string, EGxBlend& blend) {
|
||||||
struct BlendEntry {
|
struct BlendEntry {
|
||||||
const char* string;
|
|
||||||
EGxBlend value;
|
EGxBlend value;
|
||||||
|
const char* string;
|
||||||
};
|
};
|
||||||
|
|
||||||
static BlendEntry blendMap[] = {
|
static BlendEntry blendMap[] = {
|
||||||
{ "DISABLE", GxBlend_Opaque },
|
{ GxBlend_Opaque, "DISABLE" },
|
||||||
{ "BLEND", GxBlend_Alpha },
|
{ GxBlend_Alpha, "BLEND" },
|
||||||
{ "ALPHAKEY", GxBlend_AlphaKey },
|
{ GxBlend_AlphaKey, "ALPHAKEY" },
|
||||||
{ "ADD", GxBlend_Add },
|
{ GxBlend_Add, "ADD" },
|
||||||
{ "MOD", GxBlend_Mod },
|
{ GxBlend_Mod, "MOD" }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& entry : blendMap) {
|
for (int32_t i = 0; i < std::extent<decltype(blendMap)>::value; i++) {
|
||||||
if (!SStrCmpI(entry.string, string)) {
|
if (!SStrCmpI(blendMap[i].string, string, 0x7FFFFFFFu)) {
|
||||||
blend = entry.value;
|
blend = blendMap[i].value;
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t StringToBOOL(const char* string) {
|
|
||||||
return StringToBOOL(string, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool StringToBOOL(const char* string, int32_t def) {
|
|
||||||
if (!string) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (*string) {
|
|
||||||
case '0':
|
|
||||||
case 'F':
|
|
||||||
case 'N':
|
|
||||||
case 'f':
|
|
||||||
case 'n':
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case '1':
|
|
||||||
case '2':
|
|
||||||
case '3':
|
|
||||||
case '4':
|
|
||||||
case '5':
|
|
||||||
case '6':
|
|
||||||
case '7':
|
|
||||||
case '8':
|
|
||||||
case '9':
|
|
||||||
case 'T':
|
|
||||||
case 'Y':
|
|
||||||
case 't':
|
|
||||||
case 'y':
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (!SStrCmpI(string, "off") || !SStrCmpI(string, "disabled")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "on") || !SStrCmpI(string, "enabled")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool StringToBOOL(lua_State* L, int32_t idx, int32_t def) {
|
|
||||||
switch (lua_type(L, idx)) {
|
|
||||||
case LUA_TNIL:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case LUA_TBOOLEAN:
|
|
||||||
return lua_toboolean(L, idx);
|
|
||||||
|
|
||||||
case LUA_TNUMBER:
|
|
||||||
return lua_tonumber(L, idx) != 0;
|
|
||||||
|
|
||||||
case LUA_TSTRING:
|
|
||||||
return StringToBOOL(lua_tostring(L, idx), def);
|
|
||||||
|
|
||||||
default:
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t StringToClickAction(const char* string) {
|
|
||||||
if (!string || !*string) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "LeftButtonDown")) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "LeftButtonUp")) {
|
|
||||||
return 0x80000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "MiddleButtonDown")) {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "MiddleButtonUp")) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "RightButtonDown")) {
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(string, "RightButtonUp")) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO remaining buttons
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t StringToDrawLayer(const char* string, int32_t& layer) {
|
|
||||||
struct LayerEntry {
|
|
||||||
const char* string;
|
|
||||||
int32_t layer;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LayerEntry layerMap[] = {
|
|
||||||
{ "BACKGROUND", DRAWLAYER_BACKGROUND },
|
|
||||||
{ "BORDER", DRAWLAYER_BACKGROUND_BORDER },
|
|
||||||
{ "ARTWORK", DRAWLAYER_ARTWORK },
|
|
||||||
{ "OVERLAY", DRAWLAYER_ARTWORK_OVERLAY },
|
|
||||||
{ "HIGHLIGHT", DRAWLAYER_HIGHLIGHT },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const auto& entry : layerMap) {
|
|
||||||
if (!SStrCmpI(string, entry.string)) {
|
|
||||||
layer = entry.layer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t StringToFramePoint(const char* string, FRAMEPOINT& point) {
|
int32_t StringToFramePoint(const char* string, FRAMEPOINT& point) {
|
||||||
struct FramePointEntry {
|
struct FramePointEntry {
|
||||||
const char* string;
|
|
||||||
FRAMEPOINT value;
|
FRAMEPOINT value;
|
||||||
|
const char* string;
|
||||||
};
|
};
|
||||||
|
|
||||||
static FramePointEntry framePointMap[] = {
|
static FramePointEntry framePointMap[] = {
|
||||||
{ "BOTTOM", FRAMEPOINT_BOTTOM },
|
{ FRAMEPOINT_BOTTOM, "BOTTOM" },
|
||||||
{ "BOTTOMLEFT", FRAMEPOINT_BOTTOMLEFT },
|
{ FRAMEPOINT_BOTTOMLEFT, "BOTTOMLEFT" },
|
||||||
{ "BOTTOMRIGHT", FRAMEPOINT_BOTTOMRIGHT },
|
{ FRAMEPOINT_BOTTOMRIGHT, "BOTTOMRIGHT" },
|
||||||
{ "CENTER", FRAMEPOINT_CENTER },
|
{ FRAMEPOINT_CENTER, "CENTER" },
|
||||||
{ "TOP", FRAMEPOINT_TOP },
|
{ FRAMEPOINT_TOP, "TOP" },
|
||||||
{ "TOPRIGHT", FRAMEPOINT_TOPRIGHT },
|
{ FRAMEPOINT_TOPRIGHT, "TOPRIGHT" },
|
||||||
{ "TOPLEFT", FRAMEPOINT_TOPLEFT },
|
{ FRAMEPOINT_TOPLEFT, "TOPLEFT" },
|
||||||
{ "LEFT", FRAMEPOINT_LEFT },
|
{ FRAMEPOINT_LEFT, "LEFT" },
|
||||||
{ "RIGHT", FRAMEPOINT_RIGHT },
|
{ FRAMEPOINT_RIGHT, "RIGHT" }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& entry : framePointMap) {
|
for (int32_t i = 0; i < std::extent<decltype(framePointMap)>::value; i++) {
|
||||||
if (!SStrCmpI(entry.string, string)) {
|
if (!SStrCmpI(framePointMap[i].string, string, 0x7FFFFFFFu)) {
|
||||||
point = entry.value;
|
point = framePointMap[i].value;
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t StringToFrameStrata(const char* string, FRAME_STRATA& strata) {
|
int32_t StringToFrameStrata(const char* string, FRAME_STRATA& strata) {
|
||||||
struct FrameStrataEntry {
|
struct FrameStrataEntry {
|
||||||
const char* string;
|
|
||||||
FRAME_STRATA value;
|
FRAME_STRATA value;
|
||||||
|
const char* string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// FRAME_STRATA_WORLD is hardcoded
|
// FRAME_STRATA_WORLD is hardcoded
|
||||||
static FrameStrataEntry frameStrataMap[] = {
|
static FrameStrataEntry frameStrataMap[] = {
|
||||||
{ "BACKGROUND", FRAME_STRATA_BACKGROUND },
|
{ FRAME_STRATA_BACKGROUND, "BACKGROUND" },
|
||||||
{ "LOW", FRAME_STRATA_LOW },
|
{ FRAME_STRATA_LOW, "LOW" },
|
||||||
{ "MEDIUM", FRAME_STRATA_MEDIUM },
|
{ FRAME_STRATA_MEDIUM, "MEDIUM" },
|
||||||
{ "HIGH", FRAME_STRATA_HIGH },
|
{ FRAME_STRATA_HIGH, "HIGH" },
|
||||||
{ "DIALOG", FRAME_STRATA_DIALOG },
|
{ FRAME_STRATA_DIALOG, "DIALOG" },
|
||||||
{ "FULLSCREEN", FRAME_STRATA_FULLSCREEN },
|
{ FRAME_STRATA_FULLSCREEN, "FULLSCREEN" },
|
||||||
{ "FULLSCREEN_DIALOG", FRAME_STRATA_FULLSCREEN_DIALOG },
|
{ FRAME_STRATA_FULLSCREEN_DIALOG, "FULLSCREEN_DIALOG" },
|
||||||
{ "TOOLTIP", FRAME_STRATA_TOOLTIP },
|
{ FRAME_STRATA_TOOLTIP, "TOOLTIP" }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& entry : frameStrataMap) {
|
for (int32_t i = 0; i < std::extent<decltype(frameStrataMap)>::value; i++) {
|
||||||
if (!SStrCmpI(entry.string, string)) {
|
if (!SStrCmpI(frameStrataMap[i].string, string, 0x7FFFFFFFu)) {
|
||||||
strata = entry.value;
|
strata = frameStrataMap[i].value;
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
int32_t StringToJustify(const char* string, uint32_t& justify) {
|
|
||||||
struct JustifyEntry {
|
|
||||||
const char* string;
|
|
||||||
uint32_t value;
|
|
||||||
};
|
|
||||||
|
|
||||||
static JustifyEntry justifyMap[] = {
|
|
||||||
{ "LEFT", 0x1 },
|
|
||||||
{ "CENTER", 0x2 },
|
|
||||||
{ "RIGHT", 0x4 },
|
|
||||||
{ "TOP", 0x8 },
|
|
||||||
{ "MIDDLE", 0x10 },
|
|
||||||
{ "BOTTOM", 0x20 },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const auto& entry : justifyMap) {
|
|
||||||
if (!SStrCmpI(entry.string, string)) {
|
|
||||||
justify = entry.value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t StringToOrientation(const char* string, ORIENTATION& orientation) {
|
int32_t StringToOrientation(const char* string, ORIENTATION& orientation) {
|
||||||
struct OrientationEntry {
|
struct OrientationEntry {
|
||||||
const char* string;
|
|
||||||
ORIENTATION value;
|
ORIENTATION value;
|
||||||
|
const char* string;
|
||||||
};
|
};
|
||||||
|
|
||||||
static OrientationEntry orientationMap[] = {
|
static OrientationEntry orientationMap[] = {
|
||||||
{ "HORIZONTAL", ORIENTATION_HORIZONTAL },
|
{ ORIENTATION_HORIZONTAL, "HORIZONTAL" },
|
||||||
{ "VERTICAL", ORIENTATION_VERTICAL },
|
{ ORIENTATION_VERTICAL, "VERTICAL" },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& entry : orientationMap) {
|
for (auto& entry : orientationMap) {
|
||||||
if (!SStrCmpI(entry.string, string)) {
|
if (!SStrCmpI(entry.string, string)) {
|
||||||
orientation = entry.value;
|
orientation = entry.value;
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -5,28 +5,14 @@
|
|||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
struct lua_State;
|
|
||||||
|
|
||||||
const char* LanguageProcess(const char* string);
|
const char* LanguageProcess(const char* string);
|
||||||
|
|
||||||
int32_t StringToBlendMode(const char* string, EGxBlend& blend);
|
int32_t StringToBlendMode(const char* string, EGxBlend& blend);
|
||||||
|
|
||||||
int32_t StringToBOOL(const char* string);
|
|
||||||
|
|
||||||
bool StringToBOOL(const char* string, int32_t def);
|
|
||||||
|
|
||||||
bool StringToBOOL(lua_State* L, int32_t idx, int32_t def);
|
|
||||||
|
|
||||||
uint64_t StringToClickAction(const char* string);
|
|
||||||
|
|
||||||
int32_t StringToDrawLayer(const char* string, int32_t& layer);
|
|
||||||
|
|
||||||
int32_t StringToFramePoint(const char* string, FRAMEPOINT& point);
|
int32_t StringToFramePoint(const char* string, FRAMEPOINT& point);
|
||||||
|
|
||||||
int32_t StringToFrameStrata(const char* string, FRAME_STRATA& strata);
|
int32_t StringToFrameStrata(const char* string, FRAME_STRATA& strata);
|
||||||
|
|
||||||
int32_t StringToJustify(const char* string, uint32_t& justify);
|
|
||||||
|
|
||||||
int32_t StringToOrientation(const char* string, ORIENTATION& orientation);
|
int32_t StringToOrientation(const char* string, ORIENTATION& orientation);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
#include "ui/game/CGCamera.hpp"
|
#include "ui/game/CGCamera.hpp"
|
||||||
#include "common/Time.hpp"
|
|
||||||
#include "console/CVar.hpp"
|
|
||||||
#include "object/Client.hpp"
|
|
||||||
#include "object/client/CVehicleCamera_C.hpp"
|
|
||||||
#include "ui/game/Types.hpp"
|
#include "ui/game/Types.hpp"
|
||||||
|
#include "console/CVar.hpp"
|
||||||
#include "world/World.hpp"
|
#include "world/World.hpp"
|
||||||
#include <algorithm>
|
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
#include <tempest/Math.hpp>
|
#include <tempest/Math.hpp>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
static CVar* s_cameraView;
|
static CVar* s_cameraView;
|
||||||
|
|
||||||
@@ -40,56 +37,10 @@ bool ValidateCameraView(CVar* var, const char* oldValue, const char* value, void
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CGCamera::UpdateCallback(const void*, void* param) {
|
|
||||||
auto camera = static_cast<CGCamera*>(param);
|
|
||||||
|
|
||||||
if (!camera) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto timestamp = OsGetAsyncTimeMsPrecise();
|
|
||||||
|
|
||||||
camera->m_nearZ = CWorld::GetNearClip();
|
|
||||||
camera->m_farZ = CWorld::GetFarClip();
|
|
||||||
|
|
||||||
// Model camera
|
|
||||||
|
|
||||||
if (camera->HasModel()) {
|
|
||||||
camera->CalcModelCamera(timestamp);
|
|
||||||
camera->CheckUnderwater();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Target camera
|
|
||||||
|
|
||||||
auto target = ClntObjMgrObjectPtr(camera->m_target, TYPE_OBJECT, __FILE__, __LINE__);
|
|
||||||
|
|
||||||
if (target) {
|
|
||||||
camera->CalcTargetCamera(target, timestamp);
|
|
||||||
camera->CheckUnderwater();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unknown camera
|
|
||||||
|
|
||||||
auto object90 = ClntObjMgrObjectPtr(camera->guid90, TYPE_OBJECT, __FILE__, __LINE__);
|
|
||||||
|
|
||||||
if (object90) {
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
||||||
this->m_model = nullptr;
|
this->m_model = nullptr;
|
||||||
|
|
||||||
this->m_target = 0;
|
this->m_target = 0;
|
||||||
this->guid90 = 0;
|
|
||||||
this->m_relativeTo = 0;
|
this->m_relativeTo = 0;
|
||||||
|
|
||||||
this->m_view = s_cameraView->GetInt();
|
this->m_view = s_cameraView->GetInt();
|
||||||
@@ -102,18 +53,6 @@ CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip()
|
|||||||
this->m_fovOffset = 0.0f;
|
this->m_fovOffset = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGCamera::CalcModelCamera(uint32_t timestamp) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCamera::CalcTargetCamera(CGObject_C* target, uint32_t timestamp) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCamera::CheckUnderwater() {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
float CGCamera::FOV() const {
|
float CGCamera::FOV() const {
|
||||||
// Clamp offset-adjusted FOV between 0pi and 1pi
|
// Clamp offset-adjusted FOV between 0pi and 1pi
|
||||||
return std::min(std::max(this->m_fov + this->m_fovOffset, 0.0f), CMath::PI);
|
return std::min(std::max(this->m_fov + this->m_fovOffset, 0.0f), CMath::PI);
|
||||||
@@ -136,23 +75,8 @@ int32_t CGCamera::HasModel() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
C33Matrix CGCamera::ParentToWorld() const {
|
C33Matrix CGCamera::ParentToWorld() const {
|
||||||
auto relativeTo = ClntObjMgrObjectPtr(this->m_relativeTo, TYPE_OBJECT, __FILE__, __LINE__);
|
// TODO
|
||||||
|
return {};
|
||||||
if (!relativeTo) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
float facing;
|
|
||||||
|
|
||||||
if (relativeTo->IsA(TYPE_UNIT)) {
|
|
||||||
facing = static_cast<CGUnit_C*>(relativeTo)->GetRawSmoothFacing();
|
|
||||||
auto transport = ClntObjMgrObjectPtr(relativeTo->GetTransportGUID(), TYPE_OBJECT, __FILE__, __LINE__);
|
|
||||||
CVehicleCamera_C::ConvertSmoothFacingFromRawToWorld(facing, transport);
|
|
||||||
} else {
|
|
||||||
facing = relativeTo->GetFacing();
|
|
||||||
}
|
|
||||||
|
|
||||||
return C33Matrix::RotationAroundZ(facing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
C3Vector CGCamera::Right() const {
|
C3Vector CGCamera::Right() const {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "ui/simple/CSimpleCamera.hpp"
|
#include "ui/simple/CSimpleCamera.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
|
||||||
class CGObject_C;
|
|
||||||
class CM2Model;
|
class CM2Model;
|
||||||
|
|
||||||
class CGCamera : public CSimpleCamera {
|
class CGCamera : public CSimpleCamera {
|
||||||
@@ -19,9 +18,6 @@ class CGCamera : public CSimpleCamera {
|
|||||||
// Public static variables
|
// Public static variables
|
||||||
static CameraViewData s_cameraViewDataDefault[];
|
static CameraViewData s_cameraViewDataDefault[];
|
||||||
|
|
||||||
// Public static functions
|
|
||||||
static int32_t UpdateCallback(const void*, void* param);
|
|
||||||
|
|
||||||
// Virtual public member functions
|
// Virtual public member functions
|
||||||
virtual ~CGCamera() = default;
|
virtual ~CGCamera() = default;
|
||||||
virtual float FOV() const;
|
virtual float FOV() const;
|
||||||
@@ -31,9 +27,6 @@ class CGCamera : public CSimpleCamera {
|
|||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGCamera();
|
CGCamera();
|
||||||
void CalcModelCamera(uint32_t timestamp);
|
|
||||||
void CalcTargetCamera(CGObject_C* target, uint32_t timestamp);
|
|
||||||
void CheckUnderwater();
|
|
||||||
const WOWGUID& GetTarget() const;
|
const WOWGUID& GetTarget() const;
|
||||||
int32_t HasModel() const;
|
int32_t HasModel() const;
|
||||||
C33Matrix ParentToWorld() const;
|
C33Matrix ParentToWorld() const;
|
||||||
@@ -45,7 +38,6 @@ class CGCamera : public CSimpleCamera {
|
|||||||
CM2Model* m_model;
|
CM2Model* m_model;
|
||||||
// TODO
|
// TODO
|
||||||
WOWGUID m_target;
|
WOWGUID m_target;
|
||||||
WOWGUID guid90;
|
|
||||||
// TODO
|
// TODO
|
||||||
WOWGUID m_relativeTo;
|
WOWGUID m_relativeTo;
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -98,10 +98,6 @@ void CGWorldFrame::OnWorldUpdate() {
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CGCamera::UpdateCallback(nullptr, this->m_camera);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "ui/ScriptFunctionsShared.hpp"
|
#include "ui/ScriptFunctionsShared.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/game/CGGameUI.hpp"
|
#include "ui/game/CGGameUI.hpp"
|
||||||
#include "ui/game/Types.hpp"
|
#include "ui/game/Types.hpp"
|
||||||
#include "ui/simple/CSimpleTop.hpp"
|
#include "ui/simple/CSimpleTop.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -120,13 +120,7 @@ int32_t Script_GetDebugStats(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_IsDebugBuild(lua_State* L) {
|
int32_t Script_IsDebugBuild(lua_State* L) {
|
||||||
#if defined(NDEBUG)
|
WHOA_UNIMPLEMENTED(0);
|
||||||
lua_pushboolean(L, 0);
|
|
||||||
#else
|
|
||||||
lua_pushboolean(L, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_RegisterCVar(lua_State* L) {
|
int32_t Script_RegisterCVar(lua_State* L) {
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
#include "object/Client.hpp"
|
#include "object/Client.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "ui/ScriptFunctionsSystem.hpp"
|
#include "ui/ScriptFunctionsSystem.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/game/CGGameUI.hpp"
|
#include "ui/game/CGGameUI.hpp"
|
||||||
#include "ui/game/ScriptUtil.hpp"
|
#include "ui/game/ScriptUtil.hpp"
|
||||||
#include "ui/game/Types.hpp"
|
#include "ui/game/Types.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
#define NUM_SCRIPT_EVENTS 722
|
#define NUM_SCRIPT_EVENTS 722
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "ui/simple/CSimpleButtonScript.hpp"
|
#include "ui/simple/CSimpleButtonScript.hpp"
|
||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleButton.hpp"
|
#include "ui/simple/CSimpleButton.hpp"
|
||||||
#include "ui/simple/CSimpleFont.hpp"
|
#include "ui/simple/CSimpleFont.hpp"
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "ui/simple/CSimpleCheckbox.hpp"
|
#include "ui/simple/CSimpleCheckbox.hpp"
|
||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleCheckboxScript.hpp"
|
#include "ui/simple/CSimpleCheckboxScript.hpp"
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
|
|
||||||
int32_t CSimpleCheckbox::s_metatable;
|
int32_t CSimpleCheckbox::s_metatable;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "ui/simple/CSimpleCheckboxScript.hpp"
|
#include "ui/simple/CSimpleCheckboxScript.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleCheckbox.hpp"
|
#include "ui/simple/CSimpleCheckbox.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "gx/Gx.hpp"
|
#include "gx/Gx.hpp"
|
||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleEditBoxScript.hpp"
|
#include "ui/simple/CSimpleEditBoxScript.hpp"
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "ui/simple/CSimpleFontedFrameFont.hpp"
|
#include "ui/simple/CSimpleFontedFrameFont.hpp"
|
||||||
@@ -11,6 +10,7 @@
|
|||||||
#include "util/Byte.hpp"
|
#include "util/Byte.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
#include <storm/Unicode.hpp>
|
#include <storm/Unicode.hpp>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
#include "ui/FrameXML.hpp"
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleFontScript.hpp"
|
#include "ui/simple/CSimpleFontScript.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "ui/simple/CSimpleFrame.hpp"
|
#include "ui/simple/CSimpleFrame.hpp"
|
||||||
#include "ui/simple/CSimpleTop.hpp"
|
#include "ui/simple/CSimpleTop.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "ui/simple/CSimpleFontStringScript.hpp"
|
#include "ui/simple/CSimpleFontStringScript.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleFont.hpp"
|
#include "ui/simple/CSimpleFont.hpp"
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "ui/FrameScript_Object.hpp"
|
#include "ui/FrameScript_Object.hpp"
|
||||||
#include "ui/FrameXML.hpp"
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "ui/simple/CSimpleFrameScript.hpp"
|
#include "ui/simple/CSimpleFrameScript.hpp"
|
||||||
#include "ui/simple/CSimpleRender.hpp"
|
#include "ui/simple/CSimpleRender.hpp"
|
||||||
@@ -17,6 +16,7 @@
|
|||||||
#include "ui/simple/CSimpleTitleRegion.hpp"
|
#include "ui/simple/CSimpleTitleRegion.hpp"
|
||||||
#include "ui/simple/CSimpleTop.hpp"
|
#include "ui/simple/CSimpleTop.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
#include "ui/CBackdropGenerator.hpp"
|
#include "ui/CBackdropGenerator.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "ui/FrameXML.hpp"
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleFont.hpp"
|
#include "ui/simple/CSimpleFont.hpp"
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
#include "ui/simple/CSimpleFrame.hpp"
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "ui/simple/CSimpleHTML.hpp"
|
#include "ui/simple/CSimpleHTML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleFontString.hpp"
|
#include "ui/simple/CSimpleFontString.hpp"
|
||||||
#include "ui/simple/CSimpleFontedFrameFont.hpp"
|
#include "ui/simple/CSimpleFontedFrameFont.hpp"
|
||||||
#include "ui/simple/CSimpleHTMLScript.hpp"
|
#include "ui/simple/CSimpleHTMLScript.hpp"
|
||||||
#include "ui/simple/CSimpleTop.hpp"
|
#include "ui/simple/CSimpleTop.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/SFile.hpp"
|
#include "util/SFile.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
|
|
||||||
int32_t CSimpleHTML::s_metatable;
|
int32_t CSimpleHTML::s_metatable;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "ui/simple/CSimpleSlider.hpp"
|
#include "ui/simple/CSimpleSlider.hpp"
|
||||||
#include "math/Utils.hpp"
|
#include "math/Utils.hpp"
|
||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleSliderScript.hpp"
|
#include "ui/simple/CSimpleSliderScript.hpp"
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
#include <tempest/Math.hpp>
|
#include <tempest/Math.hpp>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "ui/simple/CSimpleStatusBar.hpp"
|
#include "ui/simple/CSimpleStatusBar.hpp"
|
||||||
#include "ui/LoadXML.hpp"
|
#include "ui/LoadXML.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleStatusBarScript.hpp"
|
#include "ui/simple/CSimpleStatusBarScript.hpp"
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
|
|
||||||
int32_t CSimpleStatusBar::s_metatable;
|
int32_t CSimpleStatusBar::s_metatable;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "ui/Util.hpp"
|
#include "ui/Util.hpp"
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
#include "ui/simple/CSimpleFrame.hpp"
|
||||||
#include "ui/simple/CSimpleTextureScript.hpp"
|
#include "ui/simple/CSimpleTextureScript.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "ui/simple/CSimpleTextureScript.hpp"
|
#include "ui/simple/CSimpleTextureScript.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "ui/Util.hpp"
|
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,161 @@
|
|||||||
|
#include "util/StringTo.hpp"
|
||||||
|
#include "util/Lua.hpp"
|
||||||
|
#include <storm/String.hpp>
|
||||||
|
|
||||||
|
uint64_t StringToClickAction(const char* actionStr) {
|
||||||
|
if (!actionStr || !*actionStr) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(actionStr, "LeftButtonDown", STORM_MAX_STR)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(actionStr, "LeftButtonUp", STORM_MAX_STR)) {
|
||||||
|
return 0x80000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(actionStr, "MiddleButtonDown", STORM_MAX_STR)) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(actionStr, "MiddleButtonUp", STORM_MAX_STR)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(actionStr, "RightButtonDown", STORM_MAX_STR)) {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(actionStr, "RightButtonUp", STORM_MAX_STR)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO remaining buttons
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t StringToBOOL(const char* str) {
|
||||||
|
return StringToBOOL(str, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StringToBOOL(const char* str, int32_t def) {
|
||||||
|
if (!str) {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (*str) {
|
||||||
|
case '0':
|
||||||
|
case 'F':
|
||||||
|
case 'N':
|
||||||
|
case 'f':
|
||||||
|
case 'n':
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':
|
||||||
|
case 'T':
|
||||||
|
case 'Y':
|
||||||
|
case 't':
|
||||||
|
case 'y':
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (!SStrCmpI(str, "off", 0x7FFFFFFFu) || !SStrCmpI(str, "disabled", 0x7FFFFFFFu)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(str, "on", 0x7FFFFFFFu) || !SStrCmpI(str, "enabled", 0x7FFFFFFFu)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StringToBOOL(lua_State* L, int32_t idx, int32_t def) {
|
||||||
|
bool result;
|
||||||
|
const char* str;
|
||||||
|
|
||||||
|
switch (lua_type(L, idx)) {
|
||||||
|
case LUA_TNIL:
|
||||||
|
result = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LUA_TBOOLEAN:
|
||||||
|
result = lua_toboolean(L, idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LUA_TNUMBER:
|
||||||
|
result = lua_tonumber(L, idx) != 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LUA_TSTRING:
|
||||||
|
str = lua_tostring(L, idx);
|
||||||
|
result = StringToBOOL(str, def);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
result = def;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t StringToDrawLayer(const char* string, int32_t& layer) {
|
||||||
|
struct drawlayer {
|
||||||
|
int32_t layer;
|
||||||
|
const char* string;
|
||||||
|
};
|
||||||
|
|
||||||
|
static drawlayer array_drawlayer[5] = {
|
||||||
|
{ 0, "BACKGROUND" },
|
||||||
|
{ 1, "BORDER" },
|
||||||
|
{ 2, "ARTWORK" },
|
||||||
|
{ 3, "OVERLAY" },
|
||||||
|
{ 4, "HIGHLIGHT" }
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < 5; i++) {
|
||||||
|
if (!SStrCmpI(array_drawlayer[i].string, string, 0x7FFFFFFFu)) {
|
||||||
|
layer = array_drawlayer[i].layer;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t StringToJustify(const char* string, uint32_t& justify) {
|
||||||
|
struct JustifyEntry {
|
||||||
|
uint32_t value;
|
||||||
|
const char* string;
|
||||||
|
};
|
||||||
|
|
||||||
|
static JustifyEntry justifyMap[6] = {
|
||||||
|
{ 0x1, "LEFT" },
|
||||||
|
{ 0x2, "CENTER" },
|
||||||
|
{ 0x4, "RIGHT" },
|
||||||
|
{ 0x8, "TOP" },
|
||||||
|
{ 0x10, "MIDDLE" },
|
||||||
|
{ 0x20, "BOTTOM" }
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < 5; i++) {
|
||||||
|
if (!SStrCmpI(justifyMap[i].string, string, 0x7FFFFFFFu)) {
|
||||||
|
justify = justifyMap[i].value;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef UTIL_STRING_TO_HPP
|
||||||
|
#define UTIL_STRING_TO_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
struct lua_State;
|
||||||
|
|
||||||
|
uint64_t StringToClickAction(const char* actionStr);
|
||||||
|
|
||||||
|
int32_t StringToBOOL(const char*);
|
||||||
|
|
||||||
|
bool StringToBOOL(const char*, int32_t);
|
||||||
|
|
||||||
|
bool StringToBOOL(lua_State*, int32_t, int32_t);
|
||||||
|
|
||||||
|
int32_t StringToDrawLayer(const char*, int32_t&);
|
||||||
|
|
||||||
|
int32_t StringToJustify(const char*, uint32_t&);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
#define UTIL_TIME_HPP
|
#define UTIL_TIME_HPP
|
||||||
|
|
||||||
#include "util/time/CGameTime.hpp"
|
#include "util/time/CGameTime.hpp"
|
||||||
#include "util/time/Types.hpp"
|
|
||||||
#include "util/time/WowTime.hpp"
|
#include "util/time/WowTime.hpp"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#ifndef UTIL_TIME_TYPES_HPP
|
|
||||||
#define UTIL_TIME_TYPES_HPP
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
typedef uint64_t whoa_tick_t;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in new issue
Block a user