This commit is contained in:
Lwmte 2021-11-16 15:00:17 +03:00
parent 7f088caeda
commit 40d59cddf9
5 changed files with 21 additions and 21 deletions

View file

@ -67,9 +67,9 @@ const char* controlmsgs[] =
#define phd_centery phd_winymax / 2 #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. 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 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) 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; return CurrentSettings;
} }
RINGME* InventoryClass::GetRings(char num) InventoryRing* InventoryClass::GetRings(char num)
{ {
return rings[num]; return rings[num];
} }

View file

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

View file

@ -29,7 +29,7 @@ associated getters and setters.
@tparam ItemAction action is this usable, equippable, or examinable? @tparam ItemAction action is this usable, equippable, or examinable?
@return an InventoryObject @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 }, name{ a_name },
slot{ a_slot.m_pair.second }, slot{ a_slot.m_pair.second },
yOffset{ a_yOffset }, yOffset{ a_yOffset },
@ -44,7 +44,7 @@ GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name,
void GameScriptInventoryObject::Register(sol::state * lua) void GameScriptInventoryObject::Register(sol::state * lua)
{ {
lua->new_usertype<GameScriptInventoryObject>("InventoryObject", 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. /*** (string) string key for the item's (localised) name. Corresponds to an entry in strings.lua.
@mem nameKey @mem nameKey
*/ */

View file

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

View file

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