mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Avatar Clothing data => plString
This commit is contained in:
@ -4427,7 +4427,7 @@ PF_CONSOLE_CMD( Access,
|
||||
return;
|
||||
}
|
||||
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(params[0]);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((const char *)params[0]);
|
||||
if( !item )
|
||||
return;
|
||||
|
||||
@ -6557,7 +6557,7 @@ PF_CONSOLE_CMD( Clothing, // Group name
|
||||
{
|
||||
hsTArray<plClosetItem> items;
|
||||
items.SetCount(1);
|
||||
items[0].fItem = plClothingMgr::GetClothingMgr()->FindItemByName(params[0]);
|
||||
items[0].fItem = plClothingMgr::GetClothingMgr()->FindItemByName((const char *)params[0]);
|
||||
items[0].fOptions.fTint1.Set(params[1], params[2], params[3], 1.f);
|
||||
items[0].fOptions.fTint2.Set(params[4], params[5], params[6], 1.f);
|
||||
|
||||
@ -6570,7 +6570,7 @@ PF_CONSOLE_CMD( Clothing, // Group name
|
||||
"Has your avatar wear the item of clothing specified" ) // Help string
|
||||
{
|
||||
plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(params[0]);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((const char *)params[0]);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -6584,7 +6584,7 @@ PF_CONSOLE_CMD( Clothing, // Group name
|
||||
"Has your avatar remove the item of clothing specified" ) // Help string
|
||||
{
|
||||
plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(params[0]);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((const char *)params[0]);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -6598,7 +6598,7 @@ PF_CONSOLE_CMD( Clothing, // Group name
|
||||
"Change the color of an item of clothing you're wearing" ) // Help string
|
||||
{
|
||||
plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(params[0]);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((const char *)params[0]);
|
||||
uint8_t layer;
|
||||
if ((int)params[4] == 2)
|
||||
layer = plClothingElement::kLayerTint2;
|
||||
@ -6652,7 +6652,7 @@ PF_CONSOLE_CMD( Clothing,
|
||||
"string name",
|
||||
"Switch your avatar to a different gender ('Male' / 'Female')" )
|
||||
{
|
||||
plClothingMgr::ChangeAvatar(params[0]);
|
||||
plClothingMgr::ChangeAvatar((const char *)params[0]);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Clothing, // Group name
|
||||
|
@ -96,16 +96,15 @@ public:
|
||||
class plElementRefMsg : public plGenRefMsg
|
||||
{
|
||||
public:
|
||||
char *fElementName;
|
||||
uint32_t fLayer;
|
||||
plString fElementName;
|
||||
uint32_t fLayer;
|
||||
|
||||
plElementRefMsg() : plGenRefMsg(), fElementName(nil), fLayer(1) {}
|
||||
plElementRefMsg(const plKey &r, uint8_t c, int which, int type, char *name, uint8_t layer) : plGenRefMsg(r, c, which, type)
|
||||
plElementRefMsg() : plGenRefMsg(), fLayer(1) {}
|
||||
plElementRefMsg(const plKey &r, uint8_t c, int which, int type, const plString &name, uint8_t layer) : plGenRefMsg(r, c, which, type)
|
||||
{
|
||||
fLayer = layer;
|
||||
fElementName = hsStrcpy(name);
|
||||
fElementName = name;
|
||||
}
|
||||
~plElementRefMsg() { delete [] fElementName; }
|
||||
|
||||
CLASSNAME_REGISTER( plElementRefMsg );
|
||||
GETINTERFACE_ANY( plElementRefMsg, plGenRefMsg );
|
||||
|
@ -567,14 +567,14 @@ int32_t cyAvatar::GetAvatarClothingGroup()
|
||||
//
|
||||
// PURPOSE : Return a list of the wearable items for this avatar of that clothing_type
|
||||
//
|
||||
std::vector<std::string> cyAvatar::GetEntireClothingList(int32_t clothing_type)
|
||||
std::vector<plString> cyAvatar::GetEntireClothingList(int32_t clothing_type)
|
||||
{
|
||||
// Currently, just all the clothing available will be returned
|
||||
hsTArray<plClothingItem*> clothingList = plClothingMgr::GetClothingMgr()->GetItemList();
|
||||
int numItems = clothingList.GetCount();
|
||||
|
||||
// create the string list to send to python...
|
||||
std::vector<std::string> retVal;
|
||||
std::vector<plString> retVal;
|
||||
for (int i = 0; i < numItems; i++)
|
||||
retVal.push_back(clothingList[i]->GetName());
|
||||
|
||||
@ -621,16 +621,13 @@ std::vector<PyObject*> cyAvatar::GetClosetClothingList(int32_t clothing_type)
|
||||
PyObject* clothingItem = PyList_New(5);
|
||||
|
||||
// [0] = clothing name
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromString(item->GetName()));
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromPlString(item->GetName()));
|
||||
|
||||
// [1] = clothing type
|
||||
PyList_SetItem(clothingItem, 1, PyInt_FromLong(item->fType));
|
||||
|
||||
// [2] = description
|
||||
const char* description = ""; // assume an empty string
|
||||
if ( item->fDescription != nil )
|
||||
description = item->fDescription;
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromString(description));
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromPlString(item->fDescription));
|
||||
|
||||
// [3] = ptImage of icon
|
||||
if ( item->fThumbnail != nil )
|
||||
@ -640,11 +637,8 @@ std::vector<PyObject*> cyAvatar::GetClosetClothingList(int32_t clothing_type)
|
||||
PyList_SetItem(clothingItem, 3, PyInt_FromLong(0));
|
||||
|
||||
// [4] = fCustomText
|
||||
const char* custom = ""; // assume an empty string
|
||||
if ( item->fCustomText != nil )
|
||||
custom = item->fCustomText;
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromString(custom));
|
||||
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromPlString(item->fCustomText));
|
||||
|
||||
retVal.push_back(clothingItem);
|
||||
}
|
||||
}
|
||||
@ -689,16 +683,13 @@ std::vector<PyObject*> cyAvatar::GetAvatarClothingList()
|
||||
plClothingItem* item = clothingList[i];
|
||||
|
||||
// [0] = clothing name
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromString(item->GetName()));
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromPlString(item->GetName()));
|
||||
|
||||
// [1] = clothing type
|
||||
PyList_SetItem(clothingItem, 1, PyInt_FromLong(item->fType));
|
||||
|
||||
// [2] = description
|
||||
const char* description = ""; // assume an empty string
|
||||
if ( item->fDescription != nil )
|
||||
description = item->fDescription;
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromString(description));
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromPlString(item->fDescription));
|
||||
|
||||
// [3] = ptImage of icon
|
||||
if ( item->fThumbnail != nil )
|
||||
@ -708,10 +699,7 @@ std::vector<PyObject*> cyAvatar::GetAvatarClothingList()
|
||||
PyList_SetItem(clothingItem, 3, PyInt_FromLong(0));
|
||||
|
||||
// [4] = fCustomText
|
||||
const char* custom = ""; // assume an empty string
|
||||
if ( item->fCustomText != nil )
|
||||
custom = item->fCustomText;
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromString(custom));
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromPlString(item->fCustomText));
|
||||
|
||||
retVal.push_back(clothingItem);
|
||||
}
|
||||
@ -743,16 +731,13 @@ std::vector<PyObject*> cyAvatar::GetWardrobeClothingList()
|
||||
PyObject* closetItem = PyList_New(7);
|
||||
|
||||
// [0] = clothing name
|
||||
PyList_SetItem(closetItem, 0, PyString_FromString(closetList[i].fItem->GetName()));
|
||||
PyList_SetItem(closetItem, 0, PyString_FromPlString(closetList[i].fItem->GetName()));
|
||||
|
||||
// [1] = clothing type
|
||||
PyList_SetItem(closetItem, 1, PyInt_FromLong(closetList[i].fItem->fType));
|
||||
|
||||
// [2] = description
|
||||
const char* description = ""; // assume an empty string
|
||||
if ( closetList[i].fItem->fDescription != nil )
|
||||
description = closetList[i].fItem->fDescription;
|
||||
PyList_SetItem(closetItem, 2, PyString_FromString(description));
|
||||
PyList_SetItem(closetItem, 2, PyString_FromPlString(closetList[i].fItem->fDescription));
|
||||
|
||||
// [3] = ptImage of icon
|
||||
if ( closetList[i].fItem->fThumbnail != nil )
|
||||
@ -762,10 +747,7 @@ std::vector<PyObject*> cyAvatar::GetWardrobeClothingList()
|
||||
PyList_SetItem(closetItem, 3, PyInt_FromLong(0));
|
||||
|
||||
// [4] = fCustomText
|
||||
const char* custom = ""; // assume an empty string
|
||||
if ( closetList[i].fItem->fCustomText != nil )
|
||||
custom = closetList[i].fItem->fCustomText;
|
||||
PyList_SetItem(closetItem, 4, PyString_FromString(custom));
|
||||
PyList_SetItem(closetItem, 4, PyString_FromPlString(closetList[i].fItem->fCustomText));
|
||||
|
||||
// [5] = fTint1
|
||||
PyList_SetItem(closetItem, 5, pyColor::New(closetList[i].fOptions.fTint1));
|
||||
@ -787,9 +769,9 @@ std::vector<PyObject*> cyAvatar::GetWardrobeClothingList()
|
||||
//
|
||||
// PURPOSE : To add a clothing item to the avatar's wardrobe (closet)
|
||||
//
|
||||
void cyAvatar::AddWardrobeClothingItem(const char* clothing_name,pyColor& tint1,pyColor& tint2)
|
||||
void cyAvatar::AddWardrobeClothingItem(const plString& clothing_name,pyColor& tint1,pyColor& tint2)
|
||||
{
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
if ( item )
|
||||
{
|
||||
hsTArray<plClosetItem> items;
|
||||
@ -844,16 +826,13 @@ std::vector<PyObject*> cyAvatar::GetUniqueMeshList(int32_t clothing_type)
|
||||
PyObject* clothingItem = PyList_New(5);
|
||||
|
||||
// [0] = clothing name
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromString(item->GetName()));
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromPlString(item->GetName()));
|
||||
|
||||
// [1] = clothing type
|
||||
PyList_SetItem(clothingItem, 1, PyInt_FromLong(item->fType));
|
||||
|
||||
// [2] = description
|
||||
const char* description = ""; // assume an empty string
|
||||
if ( item->fDescription != nil )
|
||||
description = item->fDescription;
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromString(description));
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromPlString(item->fDescription));
|
||||
|
||||
// [3] = ptImage of icon
|
||||
if ( item->fThumbnail != nil )
|
||||
@ -863,10 +842,7 @@ std::vector<PyObject*> cyAvatar::GetUniqueMeshList(int32_t clothing_type)
|
||||
PyList_SetItem(clothingItem, 3, PyInt_FromLong(0));
|
||||
|
||||
// [4] = fCustomText
|
||||
const char* custom = ""; // assume an empty string
|
||||
if ( item->fCustomText != nil )
|
||||
custom = item->fCustomText;
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromString(custom));
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromPlString(item->fCustomText));
|
||||
|
||||
retVal.push_back(clothingItem);
|
||||
}
|
||||
@ -885,7 +861,7 @@ std::vector<PyObject*> cyAvatar::GetUniqueMeshList(int32_t clothing_type)
|
||||
// PURPOSE : Return a list of clothing items that have the same mesh as
|
||||
// : the item passed in
|
||||
//
|
||||
std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const char* clothing_name)
|
||||
std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const plString& clothing_name)
|
||||
{
|
||||
std::vector<PyObject*> retVal;
|
||||
|
||||
@ -903,7 +879,7 @@ std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const char* clothing_name)
|
||||
{
|
||||
// Get all clothes with the same mesh as the one passed in
|
||||
hsTArray<plClothingItem*> clothingList;
|
||||
plClothingMgr::GetClothingMgr()->GetAllWithSameMesh(plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name), clothingList);
|
||||
plClothingMgr::GetClothingMgr()->GetAllWithSameMesh(plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name), clothingList);
|
||||
int numItems = clothingList.GetCount();
|
||||
// create the string list to send to python... as a python object
|
||||
int i;
|
||||
@ -915,16 +891,13 @@ std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const char* clothing_name)
|
||||
plClothingItem* item = clothingList[i];
|
||||
|
||||
// [0] = clothing name
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromString(item->GetName()));
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromPlString(item->GetName()));
|
||||
|
||||
// [1] = clothing type
|
||||
PyList_SetItem(clothingItem, 1, PyInt_FromLong(item->fType));
|
||||
|
||||
// [2] = description
|
||||
const char* description = ""; // assume an empty string
|
||||
if ( item->fDescription != nil )
|
||||
description = item->fDescription;
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromString(description));
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromPlString(item->fDescription));
|
||||
|
||||
// [3] = ptImage of icon
|
||||
if ( item->fThumbnail != nil )
|
||||
@ -934,10 +907,7 @@ std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const char* clothing_name)
|
||||
PyList_SetItem(clothingItem, 3, PyInt_FromLong(0));
|
||||
|
||||
// [4] = fCustomText
|
||||
const char* custom = ""; // assume an empty string
|
||||
if ( item->fCustomText != nil )
|
||||
custom = item->fCustomText;
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromString(custom));
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromPlString(item->fCustomText));
|
||||
|
||||
retVal.push_back(clothingItem);
|
||||
}
|
||||
@ -955,27 +925,24 @@ std::vector<PyObject*> cyAvatar::GetAllWithSameMesh(const char* clothing_name)
|
||||
// PURPOSE : Return the clothing item that matches this one
|
||||
// : If no match then returns the number 0
|
||||
//
|
||||
PyObject* cyAvatar::GetMatchingClothingItem(const char* clothing_name)
|
||||
PyObject* cyAvatar::GetMatchingClothingItem(const plString& clothing_name)
|
||||
{
|
||||
// Get all the clothes that we can wear
|
||||
hsTArray<plClothingItem*> clothingList;
|
||||
plClothingItem* match = plClothingMgr::GetClothingMgr()->GetLRMatch(plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name));
|
||||
plClothingItem* match = plClothingMgr::GetClothingMgr()->GetLRMatch(plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name));
|
||||
if ( match )
|
||||
{
|
||||
// create list
|
||||
PyObject* clothingItem = PyList_New(5);
|
||||
|
||||
// [0] = clothing name
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromString(match->GetName()));
|
||||
PyList_SetItem(clothingItem, 0, PyString_FromPlString(match->GetName()));
|
||||
|
||||
// [1] = clothing type
|
||||
PyList_SetItem(clothingItem, 1, PyInt_FromLong(match->fType));
|
||||
|
||||
// [2] = description
|
||||
const char* description = ""; // assume an empty string
|
||||
if ( match->fDescription != nil )
|
||||
description = match->fDescription;
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromString(description));
|
||||
PyList_SetItem(clothingItem, 2, PyString_FromPlString(match->fDescription));
|
||||
|
||||
// [3] = ptImage of icon
|
||||
if ( match->fThumbnail != nil )
|
||||
@ -985,10 +952,7 @@ PyObject* cyAvatar::GetMatchingClothingItem(const char* clothing_name)
|
||||
PyList_SetItem(clothingItem, 3, PyInt_FromLong(0));
|
||||
|
||||
// [4] = fCustomText
|
||||
const char* custom = ""; // assume an empty string
|
||||
if ( match->fCustomText != nil )
|
||||
custom = match->fCustomText;
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromString(custom));
|
||||
PyList_SetItem(clothingItem, 4, PyString_FromPlString(match->fCustomText));
|
||||
|
||||
return clothingItem;
|
||||
}
|
||||
@ -1005,7 +969,7 @@ PyObject* cyAvatar::GetMatchingClothingItem(const char* clothing_name)
|
||||
// PURPOSE : Wear a particular piece of clothing based on name of clothing item
|
||||
// : returns 0, if clothing item was not found
|
||||
//
|
||||
bool cyAvatar::WearClothingItem(const char* clothing_name)
|
||||
bool cyAvatar::WearClothingItem(const plString& clothing_name)
|
||||
{
|
||||
return WearClothingItemU(clothing_name,true);
|
||||
}
|
||||
@ -1018,7 +982,7 @@ bool cyAvatar::WearClothingItem(const char* clothing_name)
|
||||
// PURPOSE : Wear a particular piece of clothing based on name of clothing item
|
||||
// : returns false, if clothing item was not found
|
||||
//
|
||||
bool cyAvatar::RemoveClothingItem(const char* clothing_name)
|
||||
bool cyAvatar::RemoveClothingItem(const plString& clothing_name)
|
||||
{
|
||||
return RemoveClothingItemU(clothing_name,true);
|
||||
}
|
||||
@ -1030,7 +994,7 @@ bool cyAvatar::RemoveClothingItem(const char* clothing_name)
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
bool cyAvatar::TintClothingItem(const char* clothing_name, pyColor& tint)
|
||||
bool cyAvatar::TintClothingItem(const plString& clothing_name, pyColor& tint)
|
||||
{
|
||||
return TintClothingItemU(clothing_name,tint,true);
|
||||
}
|
||||
@ -1044,7 +1008,7 @@ bool cyAvatar::TintClothingItem(const char* clothing_name, pyColor& tint)
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
bool cyAvatar::TintClothingItemLayer(const char* clothing_name, pyColor& tint, uint8_t layer)
|
||||
bool cyAvatar::TintClothingItemLayer(const plString& clothing_name, pyColor& tint, uint8_t layer)
|
||||
{
|
||||
return TintClothingItemLayerU(clothing_name,tint,layer,true);
|
||||
}
|
||||
@ -1058,7 +1022,7 @@ bool cyAvatar::TintClothingItemLayer(const char* clothing_name, pyColor& tint, u
|
||||
// PURPOSE : Wear a particular piece of clothing based on name of clothing item
|
||||
// : returns 0, if clothing item was not found
|
||||
//
|
||||
bool cyAvatar::WearClothingItemU(const char* clothing_name, bool update)
|
||||
bool cyAvatar::WearClothingItemU(const plString& clothing_name, bool update)
|
||||
{
|
||||
const plArmatureMod *avMod = nil;
|
||||
// we can really only talk to one avatar, so just get the first one (which is probably the only one)
|
||||
@ -1068,7 +1032,7 @@ bool cyAvatar::WearClothingItemU(const char* clothing_name, bool update)
|
||||
if (so != nil)
|
||||
{
|
||||
avMod = (plArmatureMod*)so->GetModifierByType(plArmatureMod::Index());
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -1092,7 +1056,7 @@ bool cyAvatar::WearClothingItemU(const char* clothing_name, bool update)
|
||||
// PURPOSE : Wear a particular piece of clothing based on name of clothing item
|
||||
// : returns false, if clothing item was not found
|
||||
//
|
||||
bool cyAvatar::RemoveClothingItemU(const char* clothing_name, bool update)
|
||||
bool cyAvatar::RemoveClothingItemU(const plString& clothing_name, bool update)
|
||||
{
|
||||
const plArmatureMod *avMod = nil;
|
||||
// we can really only talk to one avatar, so just get the first one (which is probably the only one)
|
||||
@ -1103,7 +1067,7 @@ bool cyAvatar::RemoveClothingItemU(const char* clothing_name, bool update)
|
||||
{
|
||||
avMod = (plArmatureMod*)so->GetModifierByType(plArmatureMod::Index());
|
||||
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -1126,7 +1090,7 @@ bool cyAvatar::RemoveClothingItemU(const char* clothing_name, bool update)
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
bool cyAvatar::TintClothingItemU(const char* clothing_name, pyColor& tint, bool update)
|
||||
bool cyAvatar::TintClothingItemU(const plString& clothing_name, pyColor& tint, bool update)
|
||||
{
|
||||
const plArmatureMod *avMod = nil;
|
||||
// we can really only talk to one avatar, so just get the first one (which is probably the only one)
|
||||
@ -1137,7 +1101,7 @@ bool cyAvatar::TintClothingItemU(const char* clothing_name, pyColor& tint, bool
|
||||
{
|
||||
avMod = (plArmatureMod*)so->GetModifierByType(plArmatureMod::Index());
|
||||
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -1159,7 +1123,7 @@ bool cyAvatar::TintClothingItemU(const char* clothing_name, pyColor& tint, bool
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
bool cyAvatar::TintClothingItemLayerU(const char* clothing_name, pyColor& tint, uint8_t layer, bool update)
|
||||
bool cyAvatar::TintClothingItemLayerU(const plString& clothing_name, pyColor& tint, uint8_t layer, bool update)
|
||||
{
|
||||
const plArmatureMod *avMod = nil;
|
||||
// we can really only talk to one avatar, so just get the first one (which is probably the only one)
|
||||
@ -1170,7 +1134,7 @@ bool cyAvatar::TintClothingItemLayerU(const char* clothing_name, pyColor& tint,
|
||||
{
|
||||
avMod = (plArmatureMod*)so->GetModifierByType(plArmatureMod::Index());
|
||||
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -1195,7 +1159,7 @@ bool cyAvatar::TintClothingItemLayerU(const char* clothing_name, pyColor& tint,
|
||||
//
|
||||
// PURPOSE : Get the custom parameter string for a clothing item
|
||||
//
|
||||
const char* cyAvatar::GetClothingItemParameterString(const char* clothing_name)
|
||||
plString cyAvatar::GetClothingItemParameterString(const plString& clothing_name)
|
||||
{
|
||||
const plArmatureMod *avMod = nil;
|
||||
// we can really only talk to one avatar, so just get the first one (which is probably the only one)
|
||||
@ -1206,14 +1170,11 @@ const char* cyAvatar::GetClothingItemParameterString(const char* clothing_name)
|
||||
{
|
||||
avMod = (plArmatureMod*)so->GetModifierByType(plArmatureMod::Index());
|
||||
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
if ( item->fCustomText != nil )
|
||||
return item->fCustomText;
|
||||
else
|
||||
return "";
|
||||
return item->fCustomText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1229,9 +1190,9 @@ const char* cyAvatar::GetClothingItemParameterString(const char* clothing_name)
|
||||
//
|
||||
// PURPOSE : Get the tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
PyObject* cyAvatar::GetTintClothingItem(const char* clothing_name)
|
||||
PyObject* cyAvatar::GetTintClothingItem(const plString& clothing_name)
|
||||
{
|
||||
return GetTintClothingItemL(clothing_name,1);
|
||||
return GetTintClothingItemL(clothing_name, 1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -1241,7 +1202,7 @@ PyObject* cyAvatar::GetTintClothingItem(const char* clothing_name)
|
||||
//
|
||||
// PURPOSE : Get the tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, uint8_t layer)
|
||||
PyObject* cyAvatar::GetTintClothingItemL(const plString& clothing_name, uint8_t layer)
|
||||
{
|
||||
const plArmatureMod *avMod = nil;
|
||||
// we can really only talk to one avatar, so just get the first one (which is probably the only one)
|
||||
@ -1252,7 +1213,7 @@ PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, uint8_t laye
|
||||
{
|
||||
avMod = (plArmatureMod*)so->GetModifierByType(plArmatureMod::Index());
|
||||
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName((char*)clothing_name);
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
|
||||
if (avMod && item)
|
||||
{
|
||||
@ -1267,7 +1228,7 @@ PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, uint8_t laye
|
||||
}
|
||||
}
|
||||
|
||||
plString errmsg = plString::Format("Cannot find clothing item %s to find out what tint it is", clothing_name);
|
||||
plString errmsg = plString::Format("Cannot find clothing item %s to find out what tint it is", clothing_name.c_str());
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
// returning nil means an error occurred
|
||||
return nil;
|
||||
@ -1371,7 +1332,7 @@ plMorphSequence* cyAvatar::LocalMorphSequence()
|
||||
//
|
||||
// PURPOSE : Set the morph value of a specific layer of clothing
|
||||
//
|
||||
void cyAvatar::SetMorph(const char* clothing_name, uint8_t layer, float value)
|
||||
void cyAvatar::SetMorph(const plString& clothing_name, uint8_t layer, float value)
|
||||
{
|
||||
plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name);
|
||||
if( !item )
|
||||
@ -1422,7 +1383,7 @@ void cyAvatar::SetMorph(const char* clothing_name, uint8_t layer, float value)
|
||||
//
|
||||
// PURPOSE : Returns the current morph value of the specific layer of clothing
|
||||
//
|
||||
float cyAvatar::GetMorph(const char* clothing_name, uint8_t layer)
|
||||
float cyAvatar::GetMorph(const plString& clothing_name, uint8_t layer)
|
||||
{
|
||||
plMorphSequence* seq = LocalMorphSequence();
|
||||
if( !seq )
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Return a list of the wearable items for this avatar of that clothing_type
|
||||
//
|
||||
virtual std::vector<std::string> GetEntireClothingList(int32_t clothing_type);
|
||||
virtual std::vector<plString> GetEntireClothingList(int32_t clothing_type);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -175,7 +175,7 @@ public:
|
||||
//
|
||||
// PURPOSE : To add a clothing item to the avatar's wardrobe (closet)
|
||||
//
|
||||
virtual void AddWardrobeClothingItem(const char* clothing_name,pyColor& tint1,pyColor& tint2);
|
||||
virtual void AddWardrobeClothingItem(const plString& clothing_name,pyColor& tint1,pyColor& tint2);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -196,7 +196,7 @@ public:
|
||||
// PURPOSE : Return a list of clothing items that have the same mesh as
|
||||
// : the item passed in
|
||||
//
|
||||
virtual std::vector<PyObject*> GetAllWithSameMesh(const char* clothing_name);
|
||||
virtual std::vector<PyObject*> GetAllWithSameMesh(const plString& clothing_name);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -205,7 +205,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Return the clothing item that matches this one
|
||||
//
|
||||
virtual PyObject* GetMatchingClothingItem(const char* clothing_name);
|
||||
virtual PyObject* GetMatchingClothingItem(const plString& clothing_name);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -215,7 +215,7 @@ public:
|
||||
// PURPOSE : Wear a particular piece of clothing based on name of clothing item
|
||||
// : returns 0, if clothing item was not found
|
||||
//
|
||||
virtual bool WearClothingItem(const char* clothing_name);
|
||||
virtual bool WearClothingItem(const plString& clothing_name);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -225,7 +225,7 @@ public:
|
||||
// PURPOSE : Remove (take off) a particular piece of clothing based on name of clothing item
|
||||
// : returns 0, if clothing item was not found
|
||||
//
|
||||
virtual bool RemoveClothingItem(const char* clothing_name);
|
||||
virtual bool RemoveClothingItem(const plString& clothing_name);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -234,7 +234,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
virtual bool TintClothingItem(const char* clothing_name, pyColor& tint);
|
||||
virtual bool TintClothingItem(const plString& clothing_name, pyColor& tint);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -245,7 +245,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
virtual bool TintClothingItemLayer(const char* clothing_name, pyColor& tint, uint8_t layer);
|
||||
virtual bool TintClothingItemLayer(const plString& clothing_name, pyColor& tint, uint8_t layer);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -255,7 +255,7 @@ public:
|
||||
// PURPOSE : Wear a particular piece of clothing based on name of clothing item
|
||||
// : returns 0, if clothing item was not found
|
||||
//
|
||||
virtual bool WearClothingItemU(const char* clothing_name, bool update);
|
||||
virtual bool WearClothingItemU(const plString& clothing_name, bool update);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -265,7 +265,7 @@ public:
|
||||
// PURPOSE : Remove (take off) a particular piece of clothing based on name of clothing item
|
||||
// : returns 0, if clothing item was not found
|
||||
//
|
||||
virtual bool RemoveClothingItemU(const char* clothing_name, bool update);
|
||||
virtual bool RemoveClothingItemU(const plString& clothing_name, bool update);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -274,7 +274,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
virtual bool TintClothingItemU(const char* clothing_name, pyColor& tint, bool update);
|
||||
virtual bool TintClothingItemU(const plString& clothing_name, pyColor& tint, bool update);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -285,7 +285,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
virtual bool TintClothingItemLayerU(const char* clothing_name, pyColor& tint, uint8_t layer, bool update);
|
||||
virtual bool TintClothingItemLayerU(const plString& clothing_name, pyColor& tint, uint8_t layer, bool update);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -294,7 +294,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Get the custom parameter string for a clothing item
|
||||
//
|
||||
virtual const char* GetClothingItemParameterString(const char* clothing_name);
|
||||
virtual plString GetClothingItemParameterString(const plString& clothing_name);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -303,7 +303,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Get the tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
virtual PyObject* GetTintClothingItem(const char* clothing_name);
|
||||
virtual PyObject* GetTintClothingItem(const plString& clothing_name);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -312,7 +312,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Get the tint a clothing item, i.e. change the color of it
|
||||
//
|
||||
virtual PyObject* GetTintClothingItemL(const char* clothing_name, uint8_t layer);
|
||||
virtual PyObject* GetTintClothingItemL(const plString& clothing_name, uint8_t layer);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -351,7 +351,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Set the morph value of a specific layer of clothing
|
||||
//
|
||||
virtual void SetMorph(const char* clothing_name, uint8_t layer, float value);
|
||||
virtual void SetMorph(const plString& clothing_name, uint8_t layer, float value);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -361,7 +361,7 @@ public:
|
||||
//
|
||||
// PURPOSE : Returns the current morph value of the specific layer of clothing
|
||||
//
|
||||
virtual float GetMorph(const char* clothing_name, uint8_t layer);
|
||||
virtual float GetMorph(const plString& clothing_name, uint8_t layer);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -223,10 +223,10 @@ PYTHON_METHOD_DEFINITION(ptAvatar, getEntireClothingList, args)
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::vector<std::string> clothingList = self->fThis->GetEntireClothingList(clothingType);
|
||||
std::vector<plString> clothingList = self->fThis->GetEntireClothingList(clothingType);
|
||||
PyObject* retVal = PyList_New(clothingList.size());
|
||||
for (int i = 0; i < clothingList.size(); i++)
|
||||
PyList_SetItem(retVal, i, PyString_FromString(clothingList[i].c_str()));
|
||||
PyList_SetItem(retVal, i, PyString_FromPlString(clothingList[i]));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plNetClientComm/plNetClientComm.h"
|
||||
|
||||
|
||||
plClothingItem::plClothingItem() : fName(nil), fGroup(0), fTileset(0), fType(0), fSortOrder(0),
|
||||
fDescription(nil), fCustomText(nil), fThumbnail(nil),
|
||||
fAccessory(nil), fAccessoryName(nil)
|
||||
plClothingItem::plClothingItem() : fGroup(0), fTileset(0), fType(0), fSortOrder(0),
|
||||
fThumbnail(nil), fAccessory(nil)
|
||||
{
|
||||
int i;
|
||||
fTextures.Reset();
|
||||
@ -99,16 +98,8 @@ plClothingItem::plClothingItem() : fName(nil), fGroup(0), fTileset(0), fType(0),
|
||||
|
||||
plClothingItem::~plClothingItem()
|
||||
{
|
||||
while (fElementNames.GetCount() > 0)
|
||||
delete [] fElementNames.Pop();
|
||||
|
||||
while (fTextures.GetCount() > 0)
|
||||
delete [] fTextures.Pop();
|
||||
|
||||
delete [] fName;
|
||||
delete [] fDescription;
|
||||
delete [] fCustomText;
|
||||
delete [] fAccessoryName;
|
||||
}
|
||||
|
||||
bool plClothingItem::CanWearWith(plClothingItem *item)
|
||||
@ -169,14 +160,14 @@ void plClothingItem::Read(hsStream *s, hsResMgr *mgr)
|
||||
{
|
||||
hsKeyedObject::Read(s, mgr);
|
||||
|
||||
fName = s->ReadSafeString();
|
||||
fName = s->ReadSafeString_TEMP();
|
||||
fGroup = s->ReadByte();
|
||||
fType = s->ReadByte();
|
||||
fTileset = s->ReadByte();
|
||||
fSortOrder = s->ReadByte();
|
||||
|
||||
fCustomText = s->ReadSafeString();
|
||||
fDescription = s->ReadSafeString();
|
||||
fCustomText = s->ReadSafeString_TEMP();
|
||||
fDescription = s->ReadSafeString_TEMP();
|
||||
if (s->ReadBool())
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // thumbnail
|
||||
|
||||
@ -184,13 +175,13 @@ void plClothingItem::Read(hsStream *s, hsResMgr *mgr)
|
||||
int i, j;
|
||||
for (i = 0; i < tileCount; i++)
|
||||
{
|
||||
fElementNames.Append(s->ReadSafeString());
|
||||
fElementNames.Append(s->ReadSafeString_TEMP());
|
||||
|
||||
int layerCount = s->ReadByte();
|
||||
for (j = 0; j < layerCount; j++)
|
||||
{
|
||||
int layer = s->ReadByte();
|
||||
mgr->ReadKeyNotifyMe(s, new plElementRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1, nil, layer), plRefFlags::kActiveRef); // texture
|
||||
mgr->ReadKeyNotifyMe(s, new plElementRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1, plString::Null, layer), plRefFlags::kActiveRef); // texture
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,13 +265,13 @@ void plClothingItem::Write(hsStream *s, hsResMgr *mgr)
|
||||
|
||||
// EXPORT ONLY
|
||||
plKey accessoryKey = nil;
|
||||
if (fAccessoryName)
|
||||
if (!fAccessoryName.IsEmpty())
|
||||
{
|
||||
plString strBuf = plString::Format("CItm_%s", fAccessoryName);
|
||||
plString strBuf = plString::Format("CItm_%s", fAccessoryName.c_str());
|
||||
accessoryKey = plKeyFinder::Instance().StupidSearch("GlobalClothing", "", plClothingItem::Index(), strBuf);
|
||||
if (accessoryKey == nil)
|
||||
{
|
||||
strBuf = plString::Format("Couldn't find accessory \"%s\". It won't show at runtime.", fAccessoryName);
|
||||
strBuf = plString::Format("Couldn't find accessory \"%s\". It won't show at runtime.", fAccessoryName.c_str());
|
||||
hsMessageBox(strBuf.c_str(), GetKeyName().c_str(), hsMessageBoxNormal);
|
||||
}
|
||||
}
|
||||
@ -306,10 +297,10 @@ bool plClothingItem::MsgReceive(plMessage* msg)
|
||||
if (fTextures.GetCount() <= eMsg->fWhich)
|
||||
fTextures.ExpandAndZero(eMsg->fWhich + 1);
|
||||
if (fElementNames.GetCount() <= eMsg->fWhich)
|
||||
fElementNames.ExpandAndZero(eMsg->fWhich + 1);
|
||||
fElementNames.Expand(eMsg->fWhich + 1);
|
||||
|
||||
if (fElementNames.Get(eMsg->fWhich) == nil)
|
||||
fElementNames.Set(eMsg->fWhich, hsStrcpy(eMsg->fElementName));
|
||||
if (fElementNames.Get(eMsg->fWhich).IsEmpty())
|
||||
fElementNames.Set(eMsg->fWhich, eMsg->fElementName);
|
||||
if (fTextures.Get(eMsg->fWhich) == nil)
|
||||
{
|
||||
plMipmap **layers = new plMipmap*[plClothingElement::kLayerMax];
|
||||
@ -378,22 +369,16 @@ bool plClosetItem::IsMatch(plClosetItem *other)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
plClothingBase::plClothingBase() : fName(nil), fBaseTexture(nil), fLayoutName(nil) {}
|
||||
|
||||
plClothingBase::~plClothingBase()
|
||||
{
|
||||
delete [] fName;
|
||||
delete [] fLayoutName;
|
||||
}
|
||||
plClothingBase::plClothingBase() : fBaseTexture(nil) {}
|
||||
|
||||
void plClothingBase::Read(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsKeyedObject::Read(s, mgr);
|
||||
|
||||
fName = s->ReadSafeString();
|
||||
fName = s->ReadSafeString_TEMP();
|
||||
if (s->ReadBool())
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
|
||||
fLayoutName = s->ReadSafeString();
|
||||
fLayoutName = s->ReadSafeString_TEMP();
|
||||
}
|
||||
|
||||
void plClothingBase::Write(hsStream* s, hsResMgr* mgr)
|
||||
@ -640,7 +625,7 @@ void plClothingOutfit::IAddItem(plClothingItem *item)
|
||||
|
||||
if (soundEffect)
|
||||
{
|
||||
if (!strcmp(item->fName, "03_MLFoot04_01") || !strcmp(item->fName, "03_FLFoot04_01"))
|
||||
if (item->fName == "03_MLFoot04_01" || item->fName == "03_FLFoot04_01")
|
||||
soundEffect->SetFootType(plArmatureEffectFootSound::kFootTypeBare);
|
||||
else
|
||||
soundEffect->SetFootType(plArmatureEffectFootSound::kFootTypeShoe);
|
||||
@ -1438,9 +1423,8 @@ void plClothingOutfit::IInstanceSharedMeshes(plClothingItem *item)
|
||||
if (fAvatar)
|
||||
fAvatar->ValidateMesh();
|
||||
|
||||
bool partialSort = item->fCustomText && strstr(item->fCustomText, "NeedsSort");
|
||||
int i;
|
||||
for (i = 0; i < plClothingItem::kMaxNumLODLevels; i++)
|
||||
bool partialSort = (item->fCustomText.Find("NeedsSort") >= 0);
|
||||
for (int i = 0; i < plClothingItem::kMaxNumLODLevels; i++)
|
||||
{
|
||||
const plSceneObject *so = fAvatar->GetClothingSO(i);
|
||||
if (so != nil && item->fMeshes[i] != nil)
|
||||
@ -1619,23 +1603,21 @@ plClothingMgr::~plClothingMgr()
|
||||
delete fItems.Pop();
|
||||
}
|
||||
|
||||
plClothingLayout *plClothingMgr::GetLayout(char *name)
|
||||
plClothingLayout *plClothingMgr::GetLayout(const plString &name) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fLayouts.GetCount(); i++)
|
||||
for (int i = 0; i < fLayouts.GetCount(); i++)
|
||||
{
|
||||
if (!strcmp(fLayouts.Get(i)->fName, name))
|
||||
if (fLayouts.Get(i)->fName == name)
|
||||
return fLayouts.Get(i);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
plClothingElement *plClothingMgr::FindElementByName(const char *name)
|
||||
plClothingElement *plClothingMgr::FindElementByName(const plString &name) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fElements.GetCount(); i++)
|
||||
for (int i = 0; i < fElements.GetCount(); i++)
|
||||
{
|
||||
if (!strcmp(fElements.Get(i)->fName, name))
|
||||
if (fElements.Get(i)->fName == name)
|
||||
return fElements.Get(i);
|
||||
}
|
||||
return nil;
|
||||
@ -1750,16 +1732,15 @@ void plClothingMgr::FilterUniqueMeshes(hsTArray<plClothingItem*> &items)
|
||||
}
|
||||
}
|
||||
|
||||
plClothingItem *plClothingMgr::FindItemByName(const char *name)
|
||||
plClothingItem *plClothingMgr::FindItemByName(const plString &name) const
|
||||
{
|
||||
if (!name)
|
||||
if (name.IsEmpty())
|
||||
return nil;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < fItems.GetCount(); i++)
|
||||
|
||||
for (int i = 0; i < fItems.GetCount(); i++)
|
||||
{
|
||||
plClothingItem* item = fItems.Get(i);
|
||||
if (!strcmp(item->fName, name))
|
||||
if (item->fName == name)
|
||||
return item;
|
||||
}
|
||||
return nil;
|
||||
@ -1902,7 +1883,7 @@ void plClothingMgr::IAddItem(plClothingItem *item)
|
||||
{
|
||||
for (j = 0; j < fElements.GetCount(); j++)
|
||||
{
|
||||
if (!strcmp(item->fElementNames.Get(i), fElements.Get(j)->fName))
|
||||
if (item->fElementNames.Get(i) == fElements.Get(j)->fName)
|
||||
{
|
||||
item->fElements.Set(i, fElements.Get(j));
|
||||
break;
|
||||
@ -1928,7 +1909,7 @@ void plClothingMgr::IAddItem(plClothingItem *item)
|
||||
hsAssert(false, "Couldn't match all elements of added clothing item.");
|
||||
}
|
||||
|
||||
void plClothingMgr::ChangeAvatar(const char* name, const plFileName &clothingFile)
|
||||
void plClothingMgr::ChangeAvatar(const plString& name, const plFileName &clothingFile)
|
||||
{
|
||||
plAvatarMgr::GetInstance()->UnLoadLocalPlayer();
|
||||
plAvatarMgr::GetInstance()->LoadPlayerFromFile(name, "", clothingFile);
|
||||
|
@ -85,23 +85,23 @@ public:
|
||||
|
||||
// If you change the format of a clothing item, chances are you need
|
||||
// to change plClothingMgr::IsLRMatch() as well
|
||||
char *fName;
|
||||
plString fName;
|
||||
plSharedMesh *fMeshes[kMaxNumLODLevels];
|
||||
hsTArray<plMipmap **> fTextures;
|
||||
hsTArray<char *> fElementNames;
|
||||
hsTArray<plString> fElementNames;
|
||||
hsTArray<plClothingElement *> fElements;
|
||||
uint8_t fGroup; // Each avatar can wear one of the available groups
|
||||
uint8_t fType; // Each group has multiple types of clothes (shirt/pants/etc)
|
||||
uint8_t fTileset;
|
||||
uint8_t fSortOrder;
|
||||
char *fDescription;
|
||||
char *fCustomText;
|
||||
plString fDescription;
|
||||
plString fCustomText;
|
||||
plMipmap *fThumbnail;
|
||||
plClothingItem *fAccessory; // Forced accessory to always wear with this item.
|
||||
uint8_t fDefaultTint1[3];
|
||||
uint8_t fDefaultTint2[3];
|
||||
|
||||
char *fAccessoryName; // Export only
|
||||
|
||||
plString fAccessoryName; // Export only
|
||||
|
||||
|
||||
|
||||
@ -111,8 +111,8 @@ public:
|
||||
CLASSNAME_REGISTER( plClothingItem );
|
||||
GETINTERFACE_ANY( plClothingItem, hsKeyedObject );
|
||||
|
||||
void SetName(char *name) { delete fName; fName = hsStrcpy(name); }
|
||||
const char* GetName() { return fName; }
|
||||
void SetName(const plString &name) { fName = name; }
|
||||
plString GetName() const { return fName; }
|
||||
bool CanWearWith(plClothingItem *item);
|
||||
bool WearBefore(plClothingItem *item); // Should we come before the arg item? (texture gen order)
|
||||
bool HasBaseAlpha();
|
||||
@ -138,17 +138,16 @@ public:
|
||||
class plClothingBase : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
char *fName;
|
||||
plString fName;
|
||||
plMipmap *fBaseTexture;
|
||||
char *fLayoutName;
|
||||
plString fLayoutName;
|
||||
|
||||
plClothingBase();
|
||||
~plClothingBase();
|
||||
|
||||
CLASSNAME_REGISTER( plClothingBase );
|
||||
GETINTERFACE_ANY( plClothingBase, hsKeyedObject );
|
||||
|
||||
void SetLayoutName(char *name) { delete fLayoutName; fLayoutName = hsStrcpy(name); }
|
||||
void SetLayoutName(const plString &name) { fLayoutName = name; }
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
@ -282,8 +281,8 @@ public:
|
||||
CLASSNAME_REGISTER( plClothingMgr );
|
||||
GETINTERFACE_ANY( plClothingMgr, hsKeyedObject );
|
||||
|
||||
plClothingLayout *GetLayout(char *name);
|
||||
plClothingElement *FindElementByName(const char *name);
|
||||
plClothingLayout *GetLayout(const plString &name) const;
|
||||
plClothingElement *FindElementByName(const plString &name) const;
|
||||
|
||||
|
||||
// Functions that just relate to the clothing you have permission to wear (closet)
|
||||
@ -291,7 +290,7 @@ public:
|
||||
void GetClosetItems(hsTArray<plClosetItem> &out);
|
||||
|
||||
// Functions that relate to all existing clothing
|
||||
plClothingItem *FindItemByName(const char *name);
|
||||
plClothingItem *FindItemByName(const plString &name) const;
|
||||
hsTArray<plClothingItem*>& GetItemList() { return fItems; }
|
||||
void GetItemsByGroup(uint8_t group, hsTArray<plClothingItem*> &out);
|
||||
void GetItemsByGroupAndType(uint8_t group, uint8_t type, hsTArray<plClothingItem*> &out);
|
||||
@ -305,7 +304,7 @@ public:
|
||||
plClothingItem *GetLRMatch(plClothingItem *item);
|
||||
bool IsLRMatch(plClothingItem *item1, plClothingItem *item2);
|
||||
|
||||
static void ChangeAvatar(const char* name, const plFileName &clothingFile = "");
|
||||
static void ChangeAvatar(const plString& name, const plFileName &clothingFile = "");
|
||||
|
||||
static plClothingMgr *GetClothingMgr() { return fInstance; }
|
||||
static void Init();
|
||||
|
@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "plString.h"
|
||||
|
||||
|
||||
// This file is intended to be an independent section so that plClothingMtl and plAvatarClothing
|
||||
@ -71,21 +72,14 @@ public:
|
||||
kLayerSkinLast = kLayerSkinBlend6,
|
||||
};
|
||||
|
||||
char *fName;
|
||||
plString fName;
|
||||
uint32_t fXPos;
|
||||
uint32_t fYPos;
|
||||
uint32_t fWidth;
|
||||
uint32_t fHeight;
|
||||
|
||||
plClothingElement(const char *name, uint32_t xPos, uint32_t yPos, uint32_t width, uint32_t height)
|
||||
{
|
||||
fName = hsStrcpy(name);
|
||||
fXPos = xPos;
|
||||
fYPos = yPos;
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
}
|
||||
~plClothingElement() { delete [] fName; }
|
||||
plClothingElement(const plString &name, uint32_t xPos, uint32_t yPos, uint32_t width, uint32_t height)
|
||||
: fName(name), fXPos(xPos), fYPos(yPos), fWidth(width), fHeight(height) { }
|
||||
|
||||
static void GetElements(hsTArray<plClothingElement *> &out)
|
||||
{
|
||||
@ -127,10 +121,10 @@ public:
|
||||
class plClothingLayout
|
||||
{
|
||||
public:
|
||||
plClothingLayout(const char *name, uint32_t origWidth) { fName = hsStrcpy(name); fOrigWidth = origWidth; }
|
||||
~plClothingLayout() { delete [] fName; }
|
||||
plClothingLayout(const plString &name, uint32_t origWidth)
|
||||
: fName(name), fOrigWidth(origWidth) { }
|
||||
|
||||
char *fName;
|
||||
plString fName;
|
||||
uint32_t fOrigWidth;
|
||||
hsTArray<plClothingElement*> fElements;
|
||||
/*
|
||||
|
@ -4527,12 +4527,12 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co
|
||||
{
|
||||
plString clothKeyName;
|
||||
plClothingItem *cloth = new plClothingItem();
|
||||
cloth->SetName(mtl->GetName());
|
||||
cloth->SetName((const char *)mtl->GetName());
|
||||
cloth->fSortOrder = (mtl->GetDefault() ? 0 : 1);
|
||||
|
||||
const char *accName = mtl->GetForcedAccessoryName();
|
||||
if (accName && strcmp(accName, ""))
|
||||
cloth->fAccessoryName = hsStrcpy(accName);
|
||||
cloth->fAccessoryName = accName;
|
||||
|
||||
Color tint1 = mtl->GetDefaultTint1();
|
||||
Color tint2 = mtl->GetDefaultTint2();
|
||||
@ -4543,7 +4543,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co
|
||||
cloth->fDefaultTint2[1] = (uint8_t)(tint2.g * 255.f);
|
||||
cloth->fDefaultTint2[2] = (uint8_t)(tint2.b * 255.f);
|
||||
|
||||
clothKeyName = plString::Format("CItm_%s", cloth->fName);
|
||||
clothKeyName = plString::Format("CItm_%s", cloth->fName.c_str());
|
||||
hsgResMgr::ResMgr()->NewKey(clothKeyName, cloth, loc);
|
||||
|
||||
plNodeRefMsg* nodeRefMsg = new plNodeRefMsg(plKeyFinder::Instance().FindSceneNodeKey(loc),
|
||||
@ -4560,7 +4560,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co
|
||||
{
|
||||
uint32_t clipLevels;
|
||||
uint32_t startWidth;
|
||||
char *elementName = tileset->fElements.Get(i)->fName;
|
||||
plString elementName = tileset->fElements.Get(i)->fName;
|
||||
plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)mtl->GetTexmap(i, j);
|
||||
if (layer == nil || layer->GetPBBitmap() == nil)
|
||||
continue;
|
||||
|
@ -565,12 +565,12 @@ Interval plClothingMtl::DisplacementValidity(TimeValue t)
|
||||
return iv;
|
||||
}
|
||||
|
||||
plClothingElement *plClothingMtl::FindElementByName(char *name)
|
||||
plClothingElement *plClothingMtl::FindElementByName(const plString &name) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fElements.GetCount(); i++)
|
||||
{
|
||||
if (!strcmp(fElements.Get(i)->fName, name))
|
||||
if (fElements.Get(i)->fName == name)
|
||||
return fElements.Get(i);
|
||||
}
|
||||
return nil;
|
||||
|
@ -48,6 +48,7 @@ class Bitmap;
|
||||
class plClothingItem;
|
||||
class plMaxNode;
|
||||
class plClothingElement;
|
||||
class plString;
|
||||
class Texmap;
|
||||
|
||||
#define CLOTHING_MTL_CLASS_ID Class_ID(0x792c6de4, 0x1f952b65)
|
||||
@ -130,7 +131,7 @@ public:
|
||||
hsTArray<plClothingElement *> fElements;
|
||||
virtual void InitTilesets();
|
||||
virtual void ReleaseTilesets();
|
||||
plClothingElement *FindElementByName(char *name);
|
||||
plClothingElement *FindElementByName(const plString &name) const;
|
||||
|
||||
int GetTilesetIndex() { return fBasicPB->GetInt(ParamID(kTileset)); }
|
||||
Texmap *GetTexmap(int index, int layer);
|
||||
|
@ -195,7 +195,7 @@ public:
|
||||
{
|
||||
plClothingElement *element = tileset->fElements.Get(i);
|
||||
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]),
|
||||
WM_SETTEXT, NULL, (LPARAM)element->fName);
|
||||
WM_SETTEXT, NULL, (LPARAM)element->fName.c_str());
|
||||
sprintf(buff, "(%d, %d)", element->fWidth, element->fHeight);
|
||||
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]),
|
||||
WM_SETTEXT, NULL, (LPARAM)buff);
|
||||
|
Reference in New Issue
Block a user