This commit is contained in:
Lwmte 2021-11-16 15:00:17 +03:00
parent a2fdd7418c
commit 77b45fb8cc
5 changed files with 21 additions and 21 deletions

View file

@ -67,9 +67,9 @@ const char* controlmsgs[] =
#define phd_centery phd_winymax / 2
/*
if you wanna add an object to the inventory, edit the inv_objects array then edit THIS inventry_objects_list array with the object IN THE RIGHT PLACE
if you wanna add an object to the inventory, edit the InventoryObjectTypes array then edit THIS inventry_objects_list array with the object IN THE RIGHT PLACE
the #s MUST MATCH.
i.e if uzi item is #2 in inv_objects (starting count from 0), IT HAS TO BE THE THIRD ELEMENT IN inventry_objects_list. thank you.
i.e if uzi item is #2 in InventoryObjectTypes (starting count from 0), IT HAS TO BE THE THIRD ELEMENT IN inventry_objects_list. thank you.
note: don't forget to add your object to the proper list construction function
and if it's a weapon, add its ammo handling shit. (look at vars at the beginning of the file)
@ -399,7 +399,7 @@ TitleSettings InventoryClass::GetCurrentSettings()
return CurrentSettings;
}
RINGME* InventoryClass::GetRings(char num)
InventoryRing* InventoryClass::GetRings(char num)
{
return rings[num];
}

View file

@ -55,7 +55,7 @@ enum ItemOptions : uint64_t
OPT_DIARY = 1 << 18
};
enum rotflags
enum RotationFlags
{
INV_ROT_X = 1,
INV_ROT_Y = 2,
@ -81,7 +81,7 @@ enum class Menu
Sound
};
enum inv_objects
enum InventoryObjectTypes
{
// Weapons and ammos
INV_OBJECT_PISTOLS,
@ -336,7 +336,7 @@ struct ObjectList
unsigned short bright;
};
struct RINGME
struct InventoryRing
{
ObjectList current_object_list[INVENTORY_TABLE_SIZE + 1];
int ringactive;
@ -401,7 +401,7 @@ public:
void DrawCompass();
//getters
RINGME* GetRings(char num);
InventoryRing* GetRings(char num);
short GetSelectedOption();
Menu GetMenuToDisplay();
InventoryMode GetInventoryMode();
@ -464,9 +464,9 @@ private:
char seperate_type_flag;
char combine_type_flag;
int compassNeedleAngle;
RINGME pcring1;
RINGME pcring2;
RINGME* rings[2];
InventoryRing pcring1;
InventoryRing pcring2;
InventoryRing* rings[2];
int current_selected_option;
int menu_active;
char ammo_selector_flag;

View file

@ -29,7 +29,7 @@ associated getters and setters.
@tparam ItemAction action is this usable, equippable, or examinable?
@return an InventoryObject
*/
GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, rotflags a_rotationFlags, int a_meshBits, ItemOptions a_action) :
GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, RotationFlags a_rotationFlags, int a_meshBits, ItemOptions a_action) :
name{ a_name },
slot{ a_slot.m_pair.second },
yOffset{ a_yOffset },
@ -44,7 +44,7 @@ GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name,
void GameScriptInventoryObject::Register(sol::state * lua)
{
lua->new_usertype<GameScriptInventoryObject>("InventoryObject",
sol::constructors<GameScriptInventoryObject(std::string const &, ItemEnumPair, short, float, GameScriptRotation const &, rotflags, int, ItemOptions), GameScriptInventoryObject()>(),
sol::constructors<GameScriptInventoryObject(std::string const &, ItemEnumPair, short, float, GameScriptRotation const &, RotationFlags, int, ItemOptions), GameScriptInventoryObject()>(),
/*** (string) string key for the item's (localised) name. Corresponds to an entry in strings.lua.
@mem nameKey
*/

View file

@ -4,10 +4,10 @@
#include "GameScriptRotation.h"
#include "newinv2.h"
static const std::unordered_map<std::string, rotflags> kRotAxes{
{"X", rotflags::INV_ROT_X},
{"Y", rotflags::INV_ROT_Y},
{"Z", rotflags::INV_ROT_Z}
static const std::unordered_map<std::string, RotationFlags> kRotAxes{
{"X", RotationFlags::INV_ROT_X},
{"Y", RotationFlags::INV_ROT_Y},
{"Z", RotationFlags::INV_ROT_Z}
};
static const std::unordered_map<std::string, ItemOptions> kItemActions{
@ -23,16 +23,16 @@ namespace sol {
struct GameScriptInventoryObject
{
std::string name{};
inv_objects slot{ INV_OBJECT_PISTOLS };
InventoryObjectTypes slot{ INV_OBJECT_PISTOLS };
short yOffset{ 0 };
float scale{ 1.0f };
GameScriptRotation rot{};
rotflags rotationFlags{ rotflags::INV_ROT_X };
RotationFlags rotationFlags{ RotationFlags::INV_ROT_X };
int meshBits{ 0 };
ItemOptions action{ ItemOptions::OPT_USE };
GameScriptInventoryObject() = default;
GameScriptInventoryObject(std::string const & a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, rotflags a_rotationFlags, int a_meshBits, ItemOptions a_actions);
GameScriptInventoryObject(std::string const & a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, RotationFlags a_rotationFlags, int a_meshBits, ItemOptions a_actions);
static void Register(sol::state* lua);

View file

@ -5,6 +5,6 @@
struct ItemEnumPair
{
std::pair<GAME_OBJECT_ID, inv_objects> m_pair;
ItemEnumPair(GAME_OBJECT_ID id, inv_objects id2) : m_pair { id, id2 } {}
std::pair<GAME_OBJECT_ID, InventoryObjectTypes> m_pair;
ItemEnumPair(GAME_OBJECT_ID id, InventoryObjectTypes id2) : m_pair { id, id2 } {}
};