Skip to content
Browse files

You can now dequip weapons and armor and the graphic will be removed.

  • Loading branch information...
1 parent 761cd3d commit 8f323e8f62066f61fa4d3d931c4150bd49e12323 @Disastorm Disastorm committed Oct 18, 2011
Showing with 24 additions and 11 deletions.
  1. +15 −11 inventory.cpp
  2. +8 −0 manifestation.cpp
  3. +1 −0 manifestation.h
View
26 inventory.cpp
@@ -257,9 +257,13 @@ void item_recv_RequestEquipArmor(mapChannelClient_t *client, unsigned char *pySt
pyMarshalString_t pms;
item_t *item = (item_t*)entityMgr_get(client->inventory.equippedInventory[dstSlot]);
- if( !item )
- return;
- manifestation_setAppearanceItem(client->player, item->itemTemplate->classId, 0xFF808080);
+ if( !item ){
+ //remove item graphic if dequipped
+ item = (item_t*)entityMgr_get(swapId);
+ manifestation_removeAppearanceItem(client->player, item->itemTemplate->classId);
+ }else{
+ manifestation_setAppearanceItem(client->player, item->itemTemplate->classId, 0xFF808080);
+ }
manifestation_updateAppearance(client);
}
@@ -320,9 +324,13 @@ void item_recv_RequestEquipWeapon(mapChannelClient_t *client, unsigned char *pyS
{
inventory_notifyEquipmentUpdate(client);
item_t *item = (item_t*)entityMgr_get(client->inventory.weaponDrawer[dstSlot]);
- if( !item )
- return;
- manifestation_setAppearanceItem(client->player, item->itemTemplate->classId, 0xFF808080);
+ if( !item ){
+ //remove item graphic if dequipped
+ item = (item_t*)entityMgr_get(swapId);
+ manifestation_removeAppearanceItem(client->player, item->itemTemplate->classId);
+ }else{
+ manifestation_setAppearanceItem(client->player, item->itemTemplate->classId, 0xFF808080);
+ }
manifestation_updateAppearance(client);
}
}
@@ -615,36 +623,32 @@ void inventory_initForClient(mapChannelClient_t *client)
{
item_sendEquippedInfo(testA, client);
manifestation_setAppearanceItem(client->player, testA->itemTemplate->classId, 0xFF808080);
- manifestation_updateAppearance(client);
}
testA = item_createFromTemplate("Armor_T2_Reflective_V01_CMN_Vest_05_to_08");
if( testA )
{
item_sendEquippedInfo(testA, client);
manifestation_setAppearanceItem(client->player, testA->itemTemplate->classId, 0xFF808080);
- manifestation_updateAppearance(client);
}
testA = item_createFromTemplate("Armor_T2_Reflective_V01_CMN_Gloves_05_to_08");
if( testA )
{
item_sendEquippedInfo(testA, client);
manifestation_setAppearanceItem(client->player, testA->itemTemplate->classId, 0xFF808080);
- manifestation_updateAppearance(client);
}
testA = item_createFromTemplate("Armor_T2_Reflective_V01_CMN_Legs_05_to_08");
if( testA )
{
item_sendEquippedInfo(testA, client);
manifestation_setAppearanceItem(client->player, testA->itemTemplate->classId, 0xFF808080);
- manifestation_updateAppearance(client);
}
testA = item_createFromTemplate("Armor_T2_Reflective_V01_CMN_Boots_05_to_08");
if( testA )
{
item_sendEquippedInfo(testA, client);
manifestation_setAppearanceItem(client->player, testA->itemTemplate->classId, 0xFF808080);
- manifestation_updateAppearance(client);
}
+ manifestation_updateAppearance(client);
testB = item_createFromTemplate("Weapon_Avatar_Rifle_Physical_UNC_01_to_05");
if( testB )
{
View
8 manifestation.cpp
@@ -39,6 +39,14 @@ void manifestation_assignPlayer(mapChannel_t *mapChannel, mapChannelClient_t *ow
netMgr_pythonAddMethodCallRaw(owner->cgm, owner->player->actor->entityId, 568, pym_getData(&pms), pym_getLen(&pms));
}
+void manifestation_removeAppearanceItem(manifestation_t *manifestation, int itemClassId)
+{
+ int equipmentSlotId = gameData_getEquipmentClassIdSlot(itemClassId);
+ if( equipmentSlotId == 0 )
+ return;
+ manifestation->actor->appearanceData[equipmentSlotId-1].classId = 0;
+}
+
void manifestation_setAppearanceItem(manifestation_t *manifestation, int itemClassId, unsigned int hueAARRGGBB)
{
int equipmentSlotId = gameData_getEquipmentClassIdSlot(itemClassId);
View
1 manifestation.h
@@ -20,6 +20,7 @@ typedef struct _manifestation_t
void manifestation_createPlayerCharacter(mapChannel_t *mapChannel, mapChannelClient_t *owner, di_characterData_t *characterData);
void manifestation_removePlayerCharacter(mapChannel_t *mapChannel, mapChannelClient_t *owner);
+void manifestation_removeAppearanceItem(manifestation_t *manifestation, int itemClassId);
void manifestation_setAppearanceItem(manifestation_t *manifestation, int itemClassId, unsigned int hueAARRGGBB);
void manifestation_updateAppearance(mapChannelClient_t *owner);
void manifestation_updateWeaponReadyState(mapChannelClient_t *client);

0 comments on commit 8f323e8

Please sign in to comment.
Something went wrong with that request. Please try again.