Add CEventInventoryItemPickedUp (#21)

CEvent
CEventGroup
This commit is contained in:
maybegreat48 2024-07-07 15:32:27 +00:00 committed by GitHub
parent 22102c8ef5
commit 59eed0b48b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 112 additions and 5 deletions

View File

@ -4,6 +4,9 @@
#include "base/fwRefAwareBaseImpl.hpp" #include "base/fwRefAwareBaseImpl.hpp"
#include "base/pgBase.hpp" #include "base/pgBase.hpp"
#include "entity/fwEntity.hpp" #include "entity/fwEntity.hpp"
#include "event/CEvent.hpp"
#include "event/CEventGroup.hpp"
#include "event/CEventInventoryItemPickedUp.hpp"
#include "network/CNetGamePlayer.hpp" #include "network/CNetGamePlayer.hpp"
#include "network/CNetworkPlayerMgr.hpp" #include "network/CNetworkPlayerMgr.hpp"
#include "network/CScriptedGameEvent.hpp" #include "network/CScriptedGameEvent.hpp"

17
event/CEvent.hpp Normal file
View File

@ -0,0 +1,17 @@
#pragma once
class CEvent
{
public:
virtual ~CEvent() = default;
virtual CEvent* Clone() = 0;
virtual bool operator==(CEvent& other) = 0;
virtual int _0x18() = 0;
virtual float _0x20() = 0;
virtual float _0x28() = 0;
virtual bool IsEventScriptCommand() = 0;
virtual bool ExtractData(void* data, int size) = 0;
char m_pad[0x58];
};
static_assert(sizeof(CEvent) == 0x60);

15
event/CEventGroup.hpp Normal file
View File

@ -0,0 +1,15 @@
#pragma once
class CEvent;
class CEventGroup
{
public:
virtual ~CEventGroup() = default;
virtual void AddEvent(CEvent* event, bool) = 0;
virtual void Cleanup() = 0;
virtual int GetEventGroupType() = 0;
};
class CEventGroupNetwork : public CEventGroup
{
};

View File

@ -0,0 +1,14 @@
#pragma once
#include "CEvent.hpp"
#include "script/types.hpp"
class CEventInventoryItemPickedUp : public CEvent
{
SCR_INT m_Unk;
SCR_INT m_RewardHash;
SCR_INT m_ItemHash;
SCR_BOOL m_Unk2;
SCR_BOOL m_Unk3;
PICKUP_INDEX m_Pickup;
};
static_assert(sizeof(CEventInventoryItemPickedUp) == 0x90);

View File

@ -40,6 +40,58 @@ namespace rage
z() z()
{ {
} }
template<typename T>
vector3<T> operator+(const vector3<T>& other)
{
vector3<T> vec;
vec.x = this->x + other.x;
vec.y = this->y + other.y;
vec.z = this->z + other.z;
return vec;
}
template<typename T>
vector3<T> operator-(const vector3<T>& other)
{
vector3<T> vec;
vec.x = this->x - other.x;
vec.y = this->y - other.y;
vec.z = this->z - other.z;
return vec;
}
template<typename T>
vector3<T> operator*(const vector3<T>& other)
{
vector3<T> vec;
vec.x = this->x * other.x;
vec.y = this->y * other.y;
vec.z = this->z * other.z;
return vec;
}
template<typename T>
vector3<T> operator*(const float& other)
{
vector3<T> vec;
vec.x = this->x * other;
vec.y = this->y * other;
vec.z = this->z * other;
return vec;
}
template<typename T>
bool operator==(const vector3<T>& other)
{
return this->x == other.x && this->y == other.y && this->z == other.z;
}
template<typename T>
bool operator!=(const vector3<T>& other)
{
return this->x != other.x || this->y != other.y || this->z != other.z;
}
}; };
template<typename T> template<typename T>

View File

@ -80,6 +80,11 @@ namespace rage
return os; return os;
} }
operator rage::fvector3()
{
return { x, y, z };
}
alignas(8) float x{}; alignas(8) float x{};
alignas(8) float y{}; alignas(8) float y{};
alignas(8) float z{}; alignas(8) float z{};

View File

@ -41,11 +41,12 @@ typedef int PopZone;
typedef int PersChar; typedef int PersChar;
typedef int Prompt; typedef int Prompt;
#define PLAYER_INDEX alignas(8) Player #define PLAYER_INDEX alignas(8) int
#define ENTITY_INDEX alignas(8) Entity #define ENTITY_INDEX alignas(8) int
#define PED_INDEX alignas(8) Ped #define PED_INDEX alignas(8) int
#define VEHICLE_INDEX alignas(8) Vehicle #define PICKUP_INDEX alignas(8) int
#define INTERIOR_INDEX alignas(8) Interior #define VEHICLE_INDEX alignas(8) int
#define INTERIOR_INDEX alignas(8) int
#define NETWORK_INDEX alignas(8) int #define NETWORK_INDEX alignas(8) int
#define SCR_HASH alignas(8) Hash #define SCR_HASH alignas(8) Hash