2016-04-19 00:17:49 +00:00
|
|
|
#ifndef __URDE_CMATERIALLIST_HPP__
|
|
|
|
#define __URDE_CMATERIALLIST_HPP__
|
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2016-04-22 20:22:45 +00:00
|
|
|
enum class EMaterialTypes
|
|
|
|
{
|
2016-04-24 01:10:47 +00:00
|
|
|
Zero = 0,
|
2016-07-25 06:24:57 +00:00
|
|
|
One = 1,
|
|
|
|
Two = 2,
|
2016-04-25 05:46:28 +00:00
|
|
|
Three = 3,
|
2016-07-25 06:24:57 +00:00
|
|
|
Four = 4,
|
|
|
|
Five = 5,
|
2016-04-22 20:22:45 +00:00
|
|
|
Six = 6,
|
2016-07-25 06:24:57 +00:00
|
|
|
Seven = 7,
|
2016-04-22 20:22:45 +00:00
|
|
|
Eight = 8,
|
2016-07-25 06:24:57 +00:00
|
|
|
Nine = 9,
|
2016-04-22 20:22:45 +00:00
|
|
|
Ten = 10,
|
|
|
|
Eleven = 11,
|
|
|
|
Twelve = 12,
|
|
|
|
Thirten = 13,
|
|
|
|
Fourteen = 14,
|
|
|
|
Fifteen = 15,
|
2016-12-22 19:57:21 +00:00
|
|
|
Eighteen = 18,
|
2016-04-22 20:22:45 +00:00
|
|
|
Nineteen = 19,
|
2016-04-24 02:46:13 +00:00
|
|
|
TwentyOne = 21,
|
2016-04-22 20:22:45 +00:00
|
|
|
ThirtyTwo = 32,
|
2016-04-25 05:46:28 +00:00
|
|
|
ThirtyThree = 33,
|
2016-04-22 20:22:45 +00:00
|
|
|
ThirtyFour = 34,
|
2016-12-22 19:57:21 +00:00
|
|
|
ThirtyFive = 35,
|
2016-04-25 05:46:28 +00:00
|
|
|
ThirtySeven = 37,
|
2016-07-25 06:24:57 +00:00
|
|
|
ThirtyEight = 38,
|
|
|
|
ThirtyNine = 39,
|
2016-04-25 05:46:28 +00:00
|
|
|
Fourty = 40,
|
2016-04-22 20:22:45 +00:00
|
|
|
FourtyOne = 41,
|
|
|
|
FourtyTwo = 42,
|
|
|
|
FourtyThree = 43,
|
2016-05-23 05:36:20 +00:00
|
|
|
FourtyFour = 44,
|
2016-04-22 20:22:45 +00:00
|
|
|
FourtyEight = 48,
|
|
|
|
FourtyNine = 49,
|
2016-05-03 08:27:28 +00:00
|
|
|
Fifty = 50,
|
|
|
|
FiftySix = 56,
|
2016-04-22 20:22:45 +00:00
|
|
|
SixtyThree = 63
|
|
|
|
};
|
2016-04-19 00:17:49 +00:00
|
|
|
|
|
|
|
class CMaterialList
|
|
|
|
{
|
2016-04-22 20:22:45 +00:00
|
|
|
friend class CMaterialFilter;
|
2016-07-25 17:58:47 +00:00
|
|
|
u64 x0_list = 0;
|
2016-04-22 20:22:45 +00:00
|
|
|
public:
|
2016-04-19 00:17:49 +00:00
|
|
|
CMaterialList() = default;
|
2016-07-25 17:58:47 +00:00
|
|
|
CMaterialList(u64 flags) : x0_list(flags) {}
|
2016-04-22 20:22:45 +00:00
|
|
|
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5, EMaterialTypes t6)
|
|
|
|
: CMaterialList(t1, t2, t3, t4, t5)
|
2016-07-25 17:58:47 +00:00
|
|
|
{ x0_list = 1ull << u64(t6); }
|
2016-04-22 20:22:45 +00:00
|
|
|
|
|
|
|
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5)
|
|
|
|
: CMaterialList(t1, t2, t3, t4)
|
2016-07-25 17:58:47 +00:00
|
|
|
{ x0_list = 1ull << u64(t5); }
|
2016-04-22 20:22:45 +00:00
|
|
|
|
|
|
|
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4)
|
|
|
|
: CMaterialList(t1, t2, t3)
|
2016-07-25 17:58:47 +00:00
|
|
|
{ x0_list = 1ull << u64(t4); }
|
2016-04-22 20:22:45 +00:00
|
|
|
|
|
|
|
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3)
|
|
|
|
: CMaterialList(t1, t2)
|
2016-07-25 17:58:47 +00:00
|
|
|
{ x0_list = 1ull << u64(t3); }
|
2016-04-22 20:22:45 +00:00
|
|
|
|
|
|
|
CMaterialList(EMaterialTypes t1, EMaterialTypes t2)
|
|
|
|
: CMaterialList(t1)
|
2016-07-25 17:58:47 +00:00
|
|
|
{ x0_list = 1ull << u64(t2); }
|
2016-04-22 20:22:45 +00:00
|
|
|
|
|
|
|
CMaterialList(EMaterialTypes t1)
|
2016-07-25 17:58:47 +00:00
|
|
|
: x0_list(1ull << u64(t1))
|
2016-04-22 20:22:45 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-09-16 22:21:19 +00:00
|
|
|
static s32 BitPosition(u64 flag)
|
2016-04-22 20:22:45 +00:00
|
|
|
{
|
2016-07-26 22:45:01 +00:00
|
|
|
for (u32 i = 0; i < 63; ++i)
|
|
|
|
if ((flag & (1ull << i)) != 0)
|
|
|
|
return i;
|
2016-04-22 20:22:45 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Add(EMaterialTypes type)
|
|
|
|
{
|
2016-07-25 17:58:47 +00:00
|
|
|
x0_list |= (1ull << u64(type));
|
2016-04-22 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Remove(EMaterialTypes type)
|
|
|
|
{
|
2016-07-25 17:58:47 +00:00
|
|
|
x0_list &= ~(1ull << u64(type));
|
2016-04-22 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Remove(const CMaterialList& other)
|
|
|
|
{
|
2016-07-25 17:58:47 +00:00
|
|
|
x0_list &= ~(other.x0_list);
|
2016-04-22 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
2016-12-26 07:58:44 +00:00
|
|
|
bool HasMaterial(EMaterialTypes type) const
|
2016-04-22 20:22:45 +00:00
|
|
|
{
|
2016-07-25 17:58:47 +00:00
|
|
|
return (x0_list & (1ull << u64(type))) != 0;
|
2016-04-22 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SharesMaterials(const CMaterialList& other)
|
|
|
|
{
|
|
|
|
for (u32 i = 0; i < 64; i++)
|
|
|
|
{
|
2016-07-25 17:58:47 +00:00
|
|
|
if ((x0_list & (1ull << i)) != 0 && (other.x0_list & (1ull << i)) != 0)
|
2016-04-22 20:22:45 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2016-04-19 00:17:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CMATERIALLIST_HPP__
|