mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-21 22:56:13 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
6fb823a9be
6 changed files with 65 additions and 3 deletions
|
@ -225,6 +225,17 @@ class CAHToggleCamera : public IActionHandler
|
|||
};
|
||||
REGISTER_ACTION_HANDLER (CAHToggleCamera, "toggle_camera");
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class CAHToggleForceFP : public IActionHandler
|
||||
{
|
||||
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
||||
{
|
||||
// Change the camera view to first person
|
||||
UserEntity->forceCamareaFirstPerson();
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CAHToggleForceFP, "force_camera_fp");
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class CAHToggleNames : public IActionHandler
|
||||
{
|
||||
|
@ -446,4 +457,3 @@ class CAHToggleDodgeParry : public IActionHandler
|
|||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CAHToggleDodgeParry, "toggle_dodge_parry");
|
||||
|
||||
|
|
|
@ -488,8 +488,9 @@ bool CItemGroupManager::moveGroup(std::string name, INVENTORIES::TInventory dst)
|
|||
for(int i=0;i<items.size();i++)
|
||||
{
|
||||
CInventoryItem item = items[i];
|
||||
//If an item is currently equipped, don't move it (or else crash !!)
|
||||
if(pIM->isBagItemWeared(item.indexInBag)) continue;
|
||||
//Workaround: sometimes item are marked as equipped by pIM->isBagItemWeared() even tho they aren't really
|
||||
//Because of a synchronisation error between client and server
|
||||
if(isItemReallyEquipped(item.pCS)) continue;
|
||||
CAHManager::getInstance()->runActionHandler("move_item", item.pCS, moveParams);
|
||||
}
|
||||
|
||||
|
@ -709,6 +710,33 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory)
|
|||
}
|
||||
}
|
||||
|
||||
bool CItemGroupManager::isItemReallyEquipped(CDBCtrlSheet* item)
|
||||
{
|
||||
CDBCtrlSheet* pCS;
|
||||
for (uint32 i = 0; i < MAX_EQUIPINV_ENTRIES; ++i)
|
||||
{
|
||||
SLOT_EQUIPMENT::TSlotEquipment slot = (SLOT_EQUIPMENT::TSlotEquipment)i;
|
||||
//Instead of doing two separate for, just be a bit tricky for hand equipment
|
||||
if(slot == SLOT_EQUIPMENT::HANDR)
|
||||
pCS = CInventoryManager::getInstance()->getHandSheet(0);
|
||||
else if(slot == SLOT_EQUIPMENT::HANDL)
|
||||
pCS = CInventoryManager::getInstance()->getHandSheet(1);
|
||||
else
|
||||
pCS = CInventoryManager::getInstance()->getEquipSheet(i);
|
||||
if(!pCS) continue;
|
||||
//Can't directly compare ID (as pCS is like "ui:interface:inv_equip:content:equip:armors:feet" and item is like "ui:interface:inv_pa3:content:iil:bag_list:list:sheet57")
|
||||
//Instead check inventory + slot
|
||||
if((pCS->getInventoryIndex() == item->getInventoryIndex())
|
||||
&& (pCS->getIndexInDB() == item->getIndexInDB()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<CInventoryItem> CItemGroupManager::matchingItems(CItemGroup *group, INVENTORIES::TInventory inventory)
|
||||
{
|
||||
//Not very clean, but no choice, it's ugly time
|
||||
|
|
|
@ -115,6 +115,10 @@ private:
|
|||
void validActions();
|
||||
NLMISC::TGameCycle _EndInvalidAction;
|
||||
NLMISC::TGameCycle _StartInvalidAction;
|
||||
//Workaround: sometimes item are marked as equipped by pIM->isBagItemWeared() even tho they aren't really
|
||||
//Because of a synchronisation error between client and server
|
||||
bool isItemReallyEquipped(CDBCtrlSheet *item);
|
||||
|
||||
|
||||
//Used to migrate old groups ; keep for compatibility purpose
|
||||
bool migrateGroups();
|
||||
|
|
|
@ -748,6 +748,7 @@ void displayHelp()
|
|||
// DISP_TEXT(0.0f, "SHIFT + F11 : Test");
|
||||
DISP_TEXT(0.0f, getActionKey("enter_modal", "group=ui:interface:quit_dialog") + " : Quit");
|
||||
DISP_TEXT(0.0f, getActionKey("toggle_camera") + " : First/Third Person View");
|
||||
DISP_TEXT(0.0f, getActionKey("force_camera_fp") + " : Force Camera to First Person View");
|
||||
|
||||
line = 1.f;
|
||||
TextContext->setHotSpot(UTextContext::TopRight);
|
||||
|
|
|
@ -3213,6 +3213,23 @@ void CUserEntity::toggleCamera()
|
|||
}
|
||||
}// toggleCamera //
|
||||
|
||||
//-----------------------------------------------
|
||||
// forceCamareaFirstPerson :
|
||||
// Force Camera to First Person View
|
||||
//-----------------------------------------------
|
||||
void CUserEntity::forceCamareaFirstPerson()
|
||||
{
|
||||
// You cannot change the camera view when dead.
|
||||
if(isDead())
|
||||
return;
|
||||
// Only if not inside a building.
|
||||
if(!UserEntity->forceIndoorFPV())
|
||||
{
|
||||
//Enter the 1st Person View Mode
|
||||
UserEntity->viewMode(CUserEntity::FirstPV);
|
||||
}
|
||||
}// forceCamareaFirstPerson //
|
||||
|
||||
//---------------------------------------------------
|
||||
// getScale :
|
||||
// Return the entity scale. (return 1.0 if there is any problem).
|
||||
|
|
|
@ -369,6 +369,8 @@ public:
|
|||
TView viewMode() const {return _ViewMode;}
|
||||
/// Toggle Camera (First/Third Person)
|
||||
void toggleCamera();
|
||||
/// Force Camera First Person View
|
||||
void forceCamareaFirstPerson();
|
||||
//@}
|
||||
|
||||
/// Return the entity scale. (return 1.0 if there is any problem).
|
||||
|
|
Loading…
Reference in a new issue