Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / common / src / game_share / multi_target.h
blob5b3fd810184fbff1e6b006e1fa11495c37efa31d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef RY_MULTI_TARGET_H
20 #define RY_MULTI_TARGET_H
22 #include "entity_types.h"
24 const float MULTI_TARGET_DISTANCE_UNIT = 100.f / 127.f;
26 /** A list of targets, which can be packed/unpacked in visual properties (see PROPERTY_TARGET_LIST_x in entity_types.h)
28 * \author Nicolas Vizerie
29 * \author Nevrax France
30 * \date 2003
32 class CMultiTarget
34 public:
35 // a single target
36 class CTarget
38 public:
39 uint8 TargetSlot; // the slot that is targetted
40 uint8 Info; // Damage shield for melee 5:3 format (damage shield io : power )
41 // Distance for range attacks (that do not have damage shield) format is 7:1
42 public:
43 CTarget(uint8 slot = CLFECOMMON::INVALID_SLOT, bool resist = false, uint8 dist = 0) : TargetSlot(slot)
45 Info = (resist == 0 ? 0 : 0x80) | (dist & 0x7f);
47 uint16 getPacked() const;
48 void setPacked(uint16 value);
50 typedef std::vector<CTarget> TTargetVect;
51 // the list of targets
52 TTargetVect Targets;
53 public:
54 /** create packed version of targets (to store in visual properties)
55 * each VP encodes 4 targets
56 * caller must provide enough room to store the result (assertion is raised otherwise)
58 void pack(uint64 *destVP, uint numVP);
59 // build the target from their packed version
60 void unpack(const uint64 *srcVP, uint numVP);
63 ////////////
64 // INLINE //
65 ////////////
67 // *******************************************************************************************
68 inline uint16 CMultiTarget::CTarget::getPacked() const
70 //return (uint16) TargetSlot | ((uint16) (Resist ? 1 : 0) << 15) | ((uint16) Distance << 8);
71 return (uint16) TargetSlot | (uint16(Info) << 8);
74 // *******************************************************************************************
75 inline void CMultiTarget::CTarget::setPacked(uint16 value)
77 TargetSlot = uint8(value & 0xff);
78 /*Distance = (uint8) ((value >> 8) & 0x7f);
79 Resist = (value & 0x8000) != 0;*/
80 Info = value >> 8;
83 #endif