#include <CigiEntityCtrlV2.h>
Inheritance diagram for CigiEntityCtrlV2:
Public Types | |
LoadHideV2 = 0 | |
LoadShowV2 = 1 | |
UnloadV2 = 2 | |
StopV2 = 0 | |
PlayV2 = 1 | |
RestartV2 = 2 | |
enum | EntityStV2Grp { LoadHideV2 = 0, LoadShowV2 = 1, UnloadV2 = 2 } |
enum | EffectStV2Grp { StopV2 = 0, PlayV2 = 1, RestartV2 = 2 } |
Public Member Functions | |
CigiEntityCtrlV2 () | |
virtual | ~CigiEntityCtrlV2 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
int | SetOpacity (const float OpacityIn, bool bndchk=true) |
float | GetOpacity (void) const |
int | SetTemp (const float Temp, bool bndchk=true) |
float | GetTemp (void) const |
int | SetHeading (const float Heading, bool bndchk=true) |
float | GetHeading (void) const |
int | SetAlt (const double Alt, bool bndchk=true) |
double | GetAlt (void) const |
int | SetZoff (const double Zoff, bool bndchk=true) |
double | GetZoff (void) const |
int | SetEntityState (const EntityStV2Grp EntityStateIn, bool bndchk=true) |
EntityStV2Grp | GetEntityState (void) const |
int | SetEffectState (const EffectStV2Grp EffectStateIn, bool bndchk=true) |
EffectStV2Grp | GetEffectState (void) const |
Static Protected Attributes | |
static const EffectStV2Grp | V3toV2 [4] |
static const AnimationStateGrp | V2toV3 [3] |
Definition at line 69 of file CigiEntityCtrlV2.h.
The enumeration for the Effect State flag for CIGI 2
Definition at line 87 of file CigiEntityCtrlV2.h.
The enumeration for the Entity State flag for CIGI 2
Definition at line 77 of file CigiEntityCtrlV2.h.
00078 { 00079 LoadHideV2=0, 00080 LoadShowV2=1, 00081 UnloadV2=2 00082 };
CigiEntityCtrlV2::CigiEntityCtrlV2 | ( | ) |
General Constructor
Definition at line 98 of file CigiEntityCtrlV2.cpp.
References CigiBaseEntityCtrl::Alpha, CigiBaseEntityCtrl::AltOrZoff, CigiBaseEntityCtrl::AnimationDir, CigiBaseEntityCtrl::AnimationLoopMode, CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::AttachState, CIGI_ENTITY_CTRL_PACKET_ID_V2, CIGI_ENTITY_CTRL_PACKET_SIZE_V2, CigiBaseEntityCtrl::CollisionDetectEn, CigiBaseEntityCtrl::Detach, CigiBaseEntityCtrl::Disable, CigiBaseEntityCtrl::EntityID, CigiBaseEntityCtrl::EntityState, CigiBaseEntityCtrl::EntityType, CigiBaseEntityCtrl::Forward, CigiBaseEntityCtrl::GrndClamp, CigiBaseEntityCtrl::InheritAlpha, CigiBaseEntityCtrl::LatOrXoff, CigiBaseEntityCtrl::LonOrYoff, CigiBasePacket::MinorVersion, CigiBaseEntityCtrl::NoClamp, CigiBaseEntityCtrl::NoInherit, CigiBaseEntityCtrl::OneShot, CigiBaseEntityCtrl::Opacity, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseEntityCtrl::ParentID, CigiBaseEntityCtrl::PastAnimationState, CigiBaseEntityCtrl::Pitch, CigiBaseEntityCtrl::Roll, CigiBaseEntityCtrl::SmoothingEn, CigiBaseEntityCtrl::Standby, CigiBaseEntityCtrl::Stop, CigiBaseEntityCtrl::Temperature, CigiBasePacket::Version, and CigiBaseEntityCtrl::Yaw.
00099 { 00100 00101 PacketID = CIGI_ENTITY_CTRL_PACKET_ID_V2; 00102 PacketSize = CIGI_ENTITY_CTRL_PACKET_SIZE_V2; 00103 Version = 2; 00104 MinorVersion = 0; 00105 00106 00107 00108 EntityID = 0; 00109 EntityType = 0; 00110 ParentID = 0; 00111 00112 Alpha = 255; 00113 Opacity = 100.0f; 00114 Temperature = 0.0f; 00115 00116 Roll = 0.0f; 00117 Pitch = 0.0f; 00118 Yaw = 0.0f; 00119 LatOrXoff = 0.0f; 00120 LonOrYoff = 0.0f; 00121 AltOrZoff = 0.0f; 00122 00123 EntityState = Standby; 00124 AttachState = Detach; 00125 CollisionDetectEn = Disable; 00126 InheritAlpha = NoInherit; 00127 GrndClamp = NoClamp; 00128 AnimationDir = Forward; 00129 AnimationLoopMode = OneShot; 00130 AnimationState = Stop; 00131 PastAnimationState = Stop; 00132 SmoothingEn = false; 00133 00134 }
CigiEntityCtrlV2::~CigiEntityCtrlV2 | ( | ) | [virtual] |
double CigiEntityCtrlV2::GetAlt | ( | void | ) | const [inline] |
Gets the altitude value
Definition at line 226 of file CigiEntityCtrlV2.h.
00226 { return(AltOrZoff); }
CigiEntityCtrlV2::EffectStV2Grp CigiEntityCtrlV2::GetEffectState | ( | void | ) | const |
Gets the Effect State value
Definition at line 377 of file CigiEntityCtrlV2.cpp.
References CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::Continue, CigiBaseEntityCtrl::NoAction, CigiBaseEntityCtrl::PastAnimationState, CigiBaseEntityCtrl::Pause, CigiBaseEntityCtrl::Stop, CigiBaseEntityCtrl::ToV3, and V3toV2.
00378 { 00379 EffectStV2Grp rslt; 00380 00381 00382 AnimationStateGrp tAState = AnimationState; 00383 if((tAState >= 0)&&(tAState <= 9)) 00384 tAState = ToV3[tAState]; 00385 else 00386 tAState = NoAction; 00387 00388 if(tAState == NoAction) 00389 { 00390 unsigned int PastAState = PastAnimationState; 00391 if((PastAState == Stop) || 00392 (PastAState == Pause)) 00393 tAState = (AnimationStateGrp)PastAState; 00394 else 00395 tAState = Continue; 00396 } 00397 00398 rslt = V3toV2[tAState]; 00399 00400 return(rslt); 00401 00402 }
EntityStV2Grp CigiEntityCtrlV2::GetEntityState | ( | void | ) | const [inline] |
Gets the Entity State value
Definition at line 276 of file CigiEntityCtrlV2.h.
00276 { return((EntityStV2Grp)EntityState); }
float CigiEntityCtrlV2::GetHeading | ( | void | ) | const [inline] |
Gets the heading value
Definition at line 203 of file CigiEntityCtrlV2.h.
00203 { return(Yaw); }
float CigiEntityCtrlV2::GetOpacity | ( | void | ) | const [inline] |
Gets the Opacity value.
Definition at line 160 of file CigiEntityCtrlV2.h.
00160 { return(Opacity); }
float CigiEntityCtrlV2::GetTemp | ( | void | ) | const [inline] |
Gets the Temperature value
Definition at line 182 of file CigiEntityCtrlV2.h.
00182 { return(Temperature); }
double CigiEntityCtrlV2::GetZoff | ( | void | ) | const [inline] |
Gets the Z Offset value
Definition at line 251 of file CigiEntityCtrlV2.h.
00251 { return(AltOrZoff); }
int CigiEntityCtrlV2::Pack | ( | CigiBasePacket * | Base, | |
Cigi_uint8 * | Buff, | |||
void * | Spec | |||
) | const [virtual] |
The virtual Pack function for CIGI 1
Base | - A pointer to the instance of the packet to be packed. (Downcast to CigiBasePacket) | |
Buff | - A pointer to the current pack point. | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseEntityCtrl.
Definition at line 152 of file CigiEntityCtrlV2.cpp.
References CigiBaseEntityCtrl::AltOrZoff, CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::AttachState, PackPointerUnion::c, CIGI_ENTITY_CTRL_PACKET_SIZE_V2, CIGI_SCOPY2, CIGI_SCOPY4, CIGI_SCOPY8, CigiBaseEntityCtrl::CollisionDetectEn, CigiBaseEntityCtrl::Continue, PackPointerUnion::d, CigiBaseEntityCtrl::EntityID, CigiBaseEntityCtrl::EntityState, CigiBaseEntityCtrl::EntityType, PackPointerUnion::f, CigiAnimationTable::GetPastAnimation(), CigiBaseEntityCtrl::LatOrXoff, CigiBaseEntityCtrl::LonOrYoff, CigiBaseEntityCtrl::NoAction, CigiBaseEntityCtrl::Opacity, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseEntityCtrl::ParentID, CigiBaseEntityCtrl::Pause, CigiBaseEntityCtrl::Pitch, CigiBaseEntityCtrl::Roll, PackPointerUnion::s, CigiAnimationTable::SetPastAnimation(), CigiBaseEntityCtrl::Stop, CigiBaseEntityCtrl::Temperature, CigiBaseEntityCtrl::ToV3, V3toV2, and CigiBaseEntityCtrl::Yaw.
00153 { 00154 EffectStV2Grp rslt; 00155 00156 double DBuf[7]; 00157 00158 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00159 00160 PackPointer CDta; 00161 00162 00163 CigiAnimationTable *ATbl = (CigiAnimationTable *) Spec; 00164 00165 CigiBaseEntityCtrl * Data = ( CigiBaseEntityCtrl *)Base; 00166 00167 CDta.c = tBuf; 00168 00169 *CDta.c++ = PacketID; 00170 *CDta.c++ = PacketSize; 00171 CIGI_SCOPY2(CDta.s++, &Data->EntityID); 00172 00173 Cigi_uint8 HDta = (Cigi_uint8)(((Data->EntityState << 6) & 0xC0) | 00174 ((Data->AttachState << 5) & 0x20) | 00175 ((Data->CollisionDetectEn << 4) & 0x10)); 00176 00177 00178 AnimationStateGrp tAState = Data->AnimationState; 00179 if((tAState >= 0)&&(tAState <= 9)) 00180 tAState = ToV3[tAState]; 00181 else 00182 tAState = NoAction; 00183 00184 if(tAState == NoAction) 00185 { 00186 unsigned int PastAState = ATbl->GetPastAnimation(Data->EntityID); 00187 if((PastAState == Stop) || 00188 (PastAState == Pause)) 00189 tAState = (AnimationStateGrp)PastAState; 00190 else 00191 tAState = Continue; 00192 } 00193 00194 ATbl->SetPastAnimation(Data->EntityID,tAState); 00195 00196 rslt = V3toV2[tAState]; 00197 00198 HDta |= (Cigi_uint8)((rslt << 2) & 0x0C); 00199 00200 *CDta.c++ = HDta; 00201 00202 *CDta.c++ = 0; 00203 *CDta.s++ = 0; 00204 CIGI_SCOPY2(CDta.s++, &Data->EntityType); 00205 CIGI_SCOPY2(CDta.s++, &Data->ParentID); 00206 CIGI_SCOPY4(CDta.f++, &Data->Opacity); 00207 CIGI_SCOPY4(CDta.f++, &Data->Temperature); 00208 CIGI_SCOPY4(CDta.f++, &Data->Roll); 00209 CIGI_SCOPY4(CDta.f++, &Data->Pitch); 00210 CIGI_SCOPY4(CDta.f++, &Data->Yaw); 00211 CIGI_SCOPY8(CDta.d++, &Data->AltOrZoff); 00212 CIGI_SCOPY8(CDta.d++, &Data->LatOrXoff); 00213 CIGI_SCOPY8(CDta.d++, &Data->LonOrYoff); 00214 00215 memcpy(Buff,tBuf,CIGI_ENTITY_CTRL_PACKET_SIZE_V2); 00216 00217 return(PacketSize); 00218 00219 }
int CigiEntityCtrlV2::SetAlt | ( | const double | Alt, | |
bool | bndchk = true | |||
) | [inline] |
Sets the altitude with bound checking control
Alt | - The altitude above MSL of the entity in meters. | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 216 of file CigiEntityCtrlV2.h.
References CIGI_SUCCESS.
00217 { 00218 AltOrZoff = Alt; 00219 return(CIGI_SUCCESS); 00220 }
int CigiEntityCtrlV2::SetEffectState | ( | const EffectStV2Grp | EffectStateIn, | |
bool | bndchk = true | |||
) |
Sets the Effect State with bound checking control
EffectStateIn | - The current state of this entity's special effect. Stop=0, Play=1, Restart=2, | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 352 of file CigiEntityCtrlV2.cpp.
References CigiBaseEntityCtrl::AnimationState, CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, CigiBaseEntityCtrl::Play, and V2toV3.
00353 { 00354 00355 #ifndef CIGI_NO_BND_CHK 00356 if(bndchk && ((EffectStateIn < 0)||(EffectStateIn > 2))) 00357 { 00358 #ifndef CIGI_NO_EXCEPT 00359 throw CigiValueOutOfRangeException("EffectState",EffectStateIn,0,2); 00360 #endif 00361 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00362 } 00363 #endif 00364 00365 if((EffectStateIn >= 0)&&(EffectStateIn <= 2)) 00366 AnimationState = V2toV3[EffectStateIn]; 00367 else 00368 AnimationState = Play; 00369 00370 return(CIGI_SUCCESS); 00371 00372 }
int CigiEntityCtrlV2::SetEntityState | ( | const EntityStV2Grp | EntityStateIn, | |
bool | bndchk = true | |||
) |
Sets the Entity State with bound checking control
EntityStateIn | - The current state of this entity. LoadHide=0, LoadShow=1, Unload=2 | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 330 of file CigiEntityCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEntityCtrl::EntityState.
00331 { 00332 00333 #ifndef CIGI_NO_BND_CHK 00334 if(bndchk && ((EntityStateIn < 0)||(EntityStateIn > 2))) 00335 { 00336 #ifndef CIGI_NO_EXCEPT 00337 throw CigiValueOutOfRangeException("EntityState",EntityStateIn,0,2); 00338 #endif 00339 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00340 } 00341 #endif 00342 00343 EntityState = (EntityStateGrp)EntityStateIn; 00344 00345 return(CIGI_SUCCESS); 00346 00347 }
int CigiEntityCtrlV2::SetHeading | ( | const float | Heading, | |
bool | bndchk = true | |||
) |
Sets the heading with bound checking control
Heading | - The heading of the entity in degrees. (0 - 360.0) | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 308 of file CigiEntityCtrlV2.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEntityCtrl::Yaw.
00309 { 00310 00311 #ifndef CIGI_NO_BND_CHK 00312 if(bndchk && ((Heading < 0.0f)||(Heading > 360.0f))) 00313 { 00314 #ifndef CIGI_NO_EXCEPT 00315 throw CigiValueOutOfRangeException("Heading",(double)Heading,0.0,360.0); 00316 #endif 00317 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00318 } 00319 #endif 00320 00321 Yaw = Heading; 00322 return(CIGI_SUCCESS); 00323 00324 }
int CigiEntityCtrlV2::SetOpacity | ( | const float | OpacityIn, | |
bool | bndchk = true | |||
) |
Sets the Opacity with bound checking control
OpacityIn | - The percent opacity of the entity 0.0 - transparent 100.0 - fully visible | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 286 of file CigiEntityCtrlV2.cpp.
References CigiBaseEntityCtrl::Alpha, CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEntityCtrl::Opacity.
00287 { 00288 00289 #ifndef CIGI_NO_BND_CHK 00290 if(bndchk && ((OpacityIn < 0.0f)||(OpacityIn > 100.0f))) 00291 { 00292 #ifndef CIGI_NO_EXCEPT 00293 throw CigiValueOutOfRangeException("Opacity",(double)OpacityIn,0.0,100.0); 00294 #endif 00295 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00296 } 00297 #endif 00298 00299 Opacity = OpacityIn; 00300 Alpha = (unsigned int)(OpacityIn * 2.55f); 00301 return(CIGI_SUCCESS); 00302 00303 }
int CigiEntityCtrlV2::SetTemp | ( | const float | Temp, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Temperature with bound checking control
Temp | - The internal temperature of the entity in degrees C. | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 171 of file CigiEntityCtrlV2.h.
References CIGI_SUCCESS.
00172 { 00173 Temperature = Temp; 00174 return(CIGI_SUCCESS); 00175 }
int CigiEntityCtrlV2::SetZoff | ( | const double | Zoff, | |
bool | bndchk = true | |||
) | [inline] |
Sets the Z Offset with bound checking control
Zoff | - The Z offset from the origin of the parent entity in meters. | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 240 of file CigiEntityCtrlV2.h.
References CIGI_SUCCESS.
00241 { 00242 AltOrZoff = Zoff; 00243 return(CIGI_SUCCESS); 00244 }
int CigiEntityCtrlV2::Unpack | ( | Cigi_uint8 * | Buff, | |
bool | Swap, | |||
void * | Spec | |||
) | [virtual] |
The virtual Unpack function for CIGI 1
Buff | - A pointer to the current pack point. | |
Swap | - N/A for V1 & V2 | |
Spec | - A pointer to special data - This is not used in this class. |
Implements CigiBaseEntityCtrl.
Definition at line 225 of file CigiEntityCtrlV2.cpp.
References CigiBaseEntityCtrl::Alpha, CigiBaseEntityCtrl::AltOrZoff, CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::AttachState, PackPointerUnion::c, CIGI_ENTITY_CTRL_PACKET_SIZE_V2, CIGI_SCOPY2, CIGI_SCOPY4, CIGI_SCOPY8, CIGI_SUCCESS, CigiBaseEntityCtrl::CollisionDetectEn, PackPointerUnion::d, CigiBaseEntityCtrl::EntityID, CigiBaseEntityCtrl::EntityState, CigiBaseEntityCtrl::EntityType, PackPointerUnion::f, CigiAnimationTable::GetPastAnimation(), CigiBaseEntityCtrl::LatOrXoff, CigiBaseEntityCtrl::LonOrYoff, CigiBaseEntityCtrl::Opacity, CigiBaseEntityCtrl::ParentID, CigiBaseEntityCtrl::PastAnimationState, CigiBaseEntityCtrl::Pitch, CigiBaseEntityCtrl::Play, CigiBaseEntityCtrl::Roll, PackPointerUnion::s, CigiAnimationTable::SetPastAnimation(), CigiBaseEntityCtrl::Temperature, V2toV3, and CigiBaseEntityCtrl::Yaw.
00226 { 00227 00228 PackPointer CDta; 00229 00230 double DBuf[7]; 00231 00232 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00233 00234 CigiAnimationTable *ATbl = (CigiAnimationTable *) Spec; 00235 00236 memcpy(tBuf,Buff,CIGI_ENTITY_CTRL_PACKET_SIZE_V2); 00237 00238 CDta.c = tBuf; 00239 00240 CDta.c += 2; 00241 CIGI_SCOPY2(&EntityID, CDta.s++); 00242 00243 Cigi_uint8 HDta = *CDta.c; 00244 AttachState = (AttachStateGrp)((HDta >> 5) &0x01); 00245 CollisionDetectEn = (CollisionDetectGrp)((HDta >> 4) & 0x01); 00246 EntityState = (EntityStateGrp)((HDta >> 6) & 0x03); 00247 EffectStV2Grp EffectStateIn = (EffectStV2Grp)((HDta >> 2) & 0x03); 00248 00249 if((EffectStateIn >= 0)&&(EffectStateIn <= 2)) 00250 AnimationState = V2toV3[EffectStateIn]; 00251 else 00252 AnimationState = Play; 00253 00254 PastAnimationState = (AnimationStateGrp)ATbl->GetPastAnimation(EntityID); 00255 00256 ATbl->SetPastAnimation(EntityID,AnimationState); 00257 00258 CDta.c += 4; 00259 00260 CIGI_SCOPY2(&EntityType, CDta.s++); 00261 CIGI_SCOPY2(&ParentID, CDta.s++); 00262 CIGI_SCOPY4(&Opacity, CDta.f++); 00263 Alpha = (unsigned int)(Opacity * 2.55f); 00264 CIGI_SCOPY4(&Temperature, CDta.f++); 00265 CIGI_SCOPY4(&Roll, CDta.f++); 00266 CIGI_SCOPY4(&Pitch, CDta.f++); 00267 CIGI_SCOPY4(&Yaw, CDta.f++); 00268 CIGI_SCOPY8(&AltOrZoff, CDta.d++); 00269 CIGI_SCOPY8(&LatOrXoff, CDta.d++); 00270 CIGI_SCOPY8(&LonOrYoff, CDta.d++); 00271 00272 return(CIGI_SUCCESS); 00273 00274 }
const CigiBaseEntityCtrl::AnimationStateGrp CigiEntityCtrlV2::V2toV3 [static, protected] |
Initial value:
Definition at line 309 of file CigiEntityCtrlV2.h.
Referenced by SetEffectState(), and Unpack().
const CigiEntityCtrlV2::EffectStV2Grp CigiEntityCtrlV2::V3toV2 [static, protected] |
Initial value:
Definition at line 308 of file CigiEntityCtrlV2.h.
Referenced by GetEffectState(), and Pack().