#include <CigiEntityCtrlV1.h>
Inheritance diagram for CigiEntityCtrlV1:
Public Types | |
DestructV1 = 0 | |
ConstructV1 = 1 | |
NoActionV1 = 0 | |
LoadV1 = 1 | |
LoadActivateV1 = 2 | |
ActivateV1 = 3 | |
DeactivateV1 = 4 | |
DeactivateUnloadV1 = 5 | |
enum | EntityStV1Grp { DestructV1 = 0, ConstructV1 = 1 } |
enum | EffectStateGrp { NoActionV1 = 0, LoadV1 = 1, LoadActivateV1 = 2, ActivateV1 = 3, DeactivateV1 = 4, DeactivateUnloadV1 = 5 } |
Public Member Functions | |
CigiEntityCtrlV1 () | |
virtual | ~CigiEntityCtrlV1 () |
virtual int | Pack (CigiBasePacket *Base, Cigi_uint8 *Buff, void *Spec) const |
virtual int | Unpack (Cigi_uint8 *Buff, bool Swap, void *Spec) |
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 float Alt, bool bndchk=true) |
float | GetAlt (void) const |
int | SetZoff (const float Zoff, bool bndchk=true) |
float | GetZoff (void) const |
int | SetEntityState (const EntityStV1Grp EntityStateIn, bool bndchk=true) |
EntityStV1Grp | GetEntityState (void) const |
int | SetEffectState (const EffectStateGrp EffectStateIn, bool bndchk=true) |
EffectStateGrp | GetEffectState (void) const |
Definition at line 61 of file CigiEntityCtrlV1.h.
The enumeration for the Effect State flag for CIGI 1
Definition at line 78 of file CigiEntityCtrlV1.h.
00079 { 00080 NoActionV1=0, 00081 LoadV1=1, 00082 LoadActivateV1=2, 00083 ActivateV1=3, 00084 DeactivateV1=4, 00085 DeactivateUnloadV1=5 00086 };
The enumeration for the Entity State flag for CIGI 1
Definition at line 69 of file CigiEntityCtrlV1.h.
00070 { 00071 DestructV1=0, 00072 ConstructV1=1 00073 };
CigiEntityCtrlV1::CigiEntityCtrlV1 | ( | ) |
General Constructor
Definition at line 85 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::Alpha, CigiBaseEntityCtrl::AltOrZoff, CigiBaseEntityCtrl::AnimationDir, CigiBaseEntityCtrl::AnimationLoopMode, CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::AttachState, CIGI_ENTITY_CTRL_PACKET_ID_V1, CIGI_ENTITY_CTRL_PACKET_SIZE_V1, 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.
00086 { 00087 00088 // use the #defines 00089 PacketID = CIGI_ENTITY_CTRL_PACKET_ID_V1; 00090 PacketSize = CIGI_ENTITY_CTRL_PACKET_SIZE_V1; 00091 Version = 1; 00092 MinorVersion = 0; 00093 00094 EntityID = 0; 00095 EntityType = 0; 00096 ParentID = 0; 00097 00098 Alpha = 255; 00099 Opacity = 100.0f; 00100 Temperature = 0.0f; 00101 00102 Roll = 0.0f; 00103 Pitch = 0.0f; 00104 Yaw = 0.0f; 00105 LatOrXoff = 0.0f; 00106 LonOrYoff = 0.0f; 00107 AltOrZoff = 0.0f; 00108 00109 EntityState = Standby; 00110 AttachState = Detach; 00111 CollisionDetectEn = Disable; 00112 InheritAlpha = NoInherit; 00113 GrndClamp = NoClamp; 00114 AnimationDir = Forward; 00115 AnimationLoopMode = OneShot; 00116 AnimationState = Stop; 00117 PastAnimationState = Stop; 00118 SmoothingEn = false; 00119 00120 00121 }
CigiEntityCtrlV1::~CigiEntityCtrlV1 | ( | ) | [virtual] |
float CigiEntityCtrlV1::GetAlt | ( | void | ) | const [inline] |
Gets the altitude value
Definition at line 201 of file CigiEntityCtrlV1.h.
00201 { return((float)AltOrZoff); }
CigiEntityCtrlV1::EffectStateGrp CigiEntityCtrlV1::GetEffectState | ( | void | ) | const |
Gets the Effect State value
Definition at line 373 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::Continue, CigiBaseEntityCtrl::LoadActivate, CigiBaseEntityCtrl::NoAction, CigiBaseEntityCtrl::PastAnimationState, CigiBaseEntityCtrl::Pause, CigiBaseEntityCtrl::Stop, and CigiBaseEntityCtrl::ToV1.
00374 { 00375 00376 AnimationStateGrp tAState = AnimationState; 00377 if((tAState >= 0)&&(tAState <= 9)) 00378 tAState = ToV1[tAState]; 00379 else 00380 tAState = NoAction; 00381 00382 if(tAState == Continue) 00383 { 00384 if((PastAnimationState == Stop) || 00385 (PastAnimationState == Pause)) 00386 tAState = LoadActivate; 00387 else 00388 tAState = NoAction; 00389 } 00390 00391 return((EffectStateGrp)(tAState - 4)); 00392 00393 }
CigiEntityCtrlV1::EntityStV1Grp CigiEntityCtrlV1::GetEntityState | ( | void | ) | const |
Gets the Entity State value
Definition at line 356 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::Active, ConstructV1, DestructV1, and CigiBaseEntityCtrl::EntityState.
00357 { 00358 EntityStV1Grp rslt; 00359 00360 if(EntityState == Active) 00361 rslt = ConstructV1; 00362 else // Standby & Remove 00363 rslt = DestructV1; 00364 00365 return(rslt); 00366 00367 }
float CigiEntityCtrlV1::GetHeading | ( | void | ) | const [inline] |
Gets the heading value
Definition at line 178 of file CigiEntityCtrlV1.h.
00178 { return(Yaw); }
float CigiEntityCtrlV1::GetTemp | ( | void | ) | const [inline] |
Gets the Temperature value
Definition at line 157 of file CigiEntityCtrlV1.h.
00157 { return(Temperature); }
float CigiEntityCtrlV1::GetZoff | ( | void | ) | const [inline] |
Gets the Z Offset value
Definition at line 226 of file CigiEntityCtrlV1.h.
00226 { return((float)AltOrZoff); }
int CigiEntityCtrlV1::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 139 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::Active, CigiBaseEntityCtrl::AltOrZoff, CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::AttachState, PackPointerUnion::c, CIGI_ENTITY_CTRL_PACKET_SIZE_V1, CIGI_SCOPY2, CIGI_SCOPY4, CIGI_SCOPY8, CigiBaseEntityCtrl::CollisionDetectEn, ConstructV1, CigiBaseEntityCtrl::Continue, PackPointerUnion::d, DestructV1, CigiBaseEntityCtrl::EntityID, CigiBaseEntityCtrl::EntityState, CigiBaseEntityCtrl::EntityType, PackPointerUnion::f, CigiAnimationTable::GetPastAnimation(), CigiBaseEntityCtrl::LatOrXoff, CigiBaseEntityCtrl::LoadActivate, CigiBaseEntityCtrl::LonOrYoff, CigiBaseEntityCtrl::NoAction, CigiBasePacket::PacketID, CigiBasePacket::PacketSize, CigiBaseEntityCtrl::ParentID, CigiBaseEntityCtrl::Pause, CigiBaseEntityCtrl::Pitch, CigiBaseEntityCtrl::Roll, PackPointerUnion::s, CigiAnimationTable::SetPastAnimation(), CigiBaseEntityCtrl::Stop, CigiBaseEntityCtrl::Temperature, CigiBaseEntityCtrl::ToV1, CigiBaseEntityCtrl::ToV3, and CigiBaseEntityCtrl::Yaw.
00140 { 00141 EntityStV1Grp en_rslt; 00142 EffectStateGrp ef_rslt; 00143 float talt; 00144 double DBuf[6]; 00145 00146 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00147 00148 PackPointer CDta; 00149 00150 00151 CigiAnimationTable *ATbl = (CigiAnimationTable *) Spec; 00152 00153 CigiBaseEntityCtrl * Data = ( CigiBaseEntityCtrl *)Base; 00154 00155 CDta.c = tBuf; 00156 00157 *CDta.c++ = PacketID; 00158 *CDta.c++ = PacketSize; 00159 CIGI_SCOPY2(CDta.s++, &Data->EntityID); 00160 00161 Cigi_uint8 HDta = (Cigi_uint8)(((Data->AttachState << 6) & 0x40) | 00162 ((Data->CollisionDetectEn << 5) & 0x20)); 00163 00164 00165 if(Data->EntityState == Active) 00166 en_rslt = ConstructV1; 00167 else // Standby & Remove 00168 en_rslt = DestructV1; 00169 00170 HDta |= (Cigi_uint8)((en_rslt << 7) & 0x80); 00171 00172 00173 AnimationStateGrp tAState = Data->AnimationState; 00174 if((tAState >= 0)&&(tAState <= 9)) 00175 tAState = ToV1[tAState]; 00176 else 00177 tAState = NoAction; 00178 00179 if(tAState == Continue) 00180 { 00181 unsigned int PastAState = ATbl->GetPastAnimation(Data->EntityID); 00182 if((PastAState == Stop) || 00183 (PastAState == Pause)) 00184 tAState = LoadActivate; 00185 else 00186 tAState = NoAction; 00187 } 00188 00189 ef_rslt = (EffectStateGrp)(tAState - 4); 00190 HDta |= (Cigi_uint8)((ef_rslt << 2) & 0x1C); 00191 00192 tAState = ToV3[tAState]; 00193 if(tAState != NoAction) 00194 ATbl->SetPastAnimation(Data->EntityID,tAState); 00195 00196 00197 *CDta.c++ = HDta; 00198 *CDta.c++ = 0; 00199 *CDta.s++ = 0; 00200 CIGI_SCOPY2(CDta.s++, &Data->EntityType); 00201 CIGI_SCOPY2(CDta.s++, &Data->ParentID); 00202 CIGI_SCOPY4(CDta.f++, &Data->Temperature); 00203 CIGI_SCOPY4(CDta.f++, &Data->Roll); 00204 CIGI_SCOPY4(CDta.f++, &Data->Pitch); 00205 CIGI_SCOPY4(CDta.f++, &Data->Yaw); 00206 talt = (float)Data->AltOrZoff; 00207 CIGI_SCOPY4(CDta.f++, &talt); 00208 CIGI_SCOPY8(CDta.d++, &Data->LatOrXoff); 00209 CIGI_SCOPY8(CDta.d++, &Data->LonOrYoff); 00210 00211 memcpy(Buff,tBuf,CIGI_ENTITY_CTRL_PACKET_SIZE_V1); 00212 00213 return(PacketSize); 00214 00215 }
int CigiEntityCtrlV1::SetAlt | ( | const float | 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 191 of file CigiEntityCtrlV1.h.
References CIGI_SUCCESS.
00192 { 00193 AltOrZoff = (double)Alt; 00194 return(CIGI_SUCCESS); 00195 }
int CigiEntityCtrlV1::SetEffectState | ( | const EffectStateGrp | EffectStateIn, | |
bool | bndchk = true | |||
) |
Sets the Effect State with bound checking control
EffectStateIn | - The current state of this entity's special effect. NoAction=0, Load=1, LoadActivate=2, Activate=3, Deactivate=4, DeactivateUnload=5 | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 333 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::AnimationState, CIGI_ERROR_VALUE_OUT_OF_RANGE, and CIGI_SUCCESS.
00334 { 00335 00336 #ifndef CIGI_NO_BND_CHK 00337 if(bndchk && ((EffectStateIn < 0)||(EffectStateIn > 5))) 00338 { 00339 #ifndef CIGI_NO_EXCEPT 00340 throw CigiValueOutOfRangeException("EffectState",EffectStateIn,0,5); 00341 #endif 00342 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00343 } 00344 #endif 00345 00346 AnimationState = (AnimationStateGrp)(EffectStateIn + 4); 00347 00348 return(CIGI_SUCCESS); 00349 00350 }
int CigiEntityCtrlV1::SetEntityState | ( | const EntityStV1Grp | EntityStateIn, | |
bool | bndchk = true | |||
) |
Sets the Entity State with bound checking control
EntityStateIn | - The current state of this entity. Destruct=0, Construct=1 | |
bndchk | - Enables (true) or disables (false) bounds checking |
Definition at line 307 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::Active, CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, ConstructV1, CigiBaseEntityCtrl::EntityState, and CigiBaseEntityCtrl::Remove.
Referenced by Unpack().
00308 { 00309 00310 #ifndef CIGI_NO_BND_CHK 00311 if(bndchk && ((EntityStateIn < 0)||(EntityStateIn > 1))) 00312 { 00313 #ifndef CIGI_NO_EXCEPT 00314 throw CigiValueOutOfRangeException("EntityState",EntityStateIn,0,1); 00315 #endif 00316 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00317 } 00318 #endif 00319 00320 if(EntityStateIn == ConstructV1) 00321 EntityState = Active; 00322 else 00323 EntityState = Remove; 00324 00325 return(CIGI_SUCCESS); 00326 00327 }
int CigiEntityCtrlV1::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 285 of file CigiEntityCtrlV1.cpp.
References CIGI_ERROR_VALUE_OUT_OF_RANGE, CIGI_SUCCESS, and CigiBaseEntityCtrl::Yaw.
00286 { 00287 00288 #ifndef CIGI_NO_BND_CHK 00289 if(bndchk && ((Heading < 0.0f)||(Heading > 360.0f))) 00290 { 00291 #ifndef CIGI_NO_EXCEPT 00292 throw CigiValueOutOfRangeException("Heading",(double)Heading,0.0,360.0); 00293 #endif 00294 return(CIGI_ERROR_VALUE_OUT_OF_RANGE); 00295 } 00296 #endif 00297 00298 Yaw = Heading; 00299 return(CIGI_SUCCESS); 00300 00301 }
int CigiEntityCtrlV1::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 146 of file CigiEntityCtrlV1.h.
References CIGI_SUCCESS.
00147 { 00148 Temperature = Temp; 00149 return(CIGI_SUCCESS); 00150 }
int CigiEntityCtrlV1::SetZoff | ( | const float | 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 215 of file CigiEntityCtrlV1.h.
References CIGI_SUCCESS.
00216 { 00217 AltOrZoff = (double)Zoff; 00218 return(CIGI_SUCCESS); 00219 }
int CigiEntityCtrlV1::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 221 of file CigiEntityCtrlV1.cpp.
References CigiBaseEntityCtrl::Alpha, CigiBaseEntityCtrl::AltOrZoff, CigiBaseEntityCtrl::AnimationState, CigiBaseEntityCtrl::AttachState, PackPointerUnion::c, CIGI_ENTITY_CTRL_PACKET_SIZE_V1, CIGI_SCOPY2, CIGI_SCOPY4, CIGI_SCOPY8, CIGI_SUCCESS, CigiBaseEntityCtrl::CollisionDetectEn, PackPointerUnion::d, CigiBaseEntityCtrl::EntityID, CigiBaseEntityCtrl::EntityType, PackPointerUnion::f, CigiAnimationTable::GetPastAnimation(), CigiBaseEntityCtrl::LatOrXoff, CigiBaseEntityCtrl::LonOrYoff, CigiBaseEntityCtrl::Opacity, CigiBaseEntityCtrl::ParentID, CigiBaseEntityCtrl::PastAnimationState, CigiBaseEntityCtrl::Pitch, CigiBaseEntityCtrl::Roll, PackPointerUnion::s, SetEntityState(), CigiAnimationTable::SetPastAnimation(), CigiBaseEntityCtrl::Temperature, CigiBaseEntityCtrl::ToV3, and CigiBaseEntityCtrl::Yaw.
00222 { 00223 float talt; 00224 00225 PackPointer CDta; 00226 00227 double DBuf[6]; 00228 00229 Cigi_uint8 *tBuf = (Cigi_uint8 *)DBuf; 00230 00231 CigiAnimationTable *ATbl = (CigiAnimationTable *) Spec; 00232 00233 memcpy(tBuf,Buff,CIGI_ENTITY_CTRL_PACKET_SIZE_V1); 00234 00235 CDta.c = tBuf; 00236 00237 CDta.c += 2; 00238 CIGI_SCOPY2(&EntityID, CDta.s++); 00239 00240 Cigi_uint8 HDta = *CDta.c; 00241 AttachState = (AttachStateGrp)((HDta >> 6) &0x01); 00242 CollisionDetectEn = (CollisionDetectGrp)((HDta >> 5) & 0x01); 00243 SetEntityState((EntityStV1Grp)((HDta >> 7) & 0x01),false); 00244 AnimationState = (AnimationStateGrp)(((HDta >> 2) & 0x07) + 4); 00245 00246 PastAnimationState = (AnimationStateGrp)ATbl->GetPastAnimation(EntityID); 00247 00248 AnimationStateGrp tAState = AnimationState; 00249 if((tAState >= 0)&&(tAState <= 9)) 00250 { 00251 tAState = ToV3[tAState]; 00252 if((tAState >= 0)&&(tAState <= 3)) 00253 ATbl->SetPastAnimation(EntityID,tAState); 00254 } 00255 00256 CDta.c += 4; 00257 00258 CIGI_SCOPY2(&EntityType, CDta.s++); 00259 CIGI_SCOPY2(&ParentID, CDta.s++); 00260 CIGI_SCOPY4(&Temperature, CDta.f++); 00261 CIGI_SCOPY4(&Roll, CDta.f++); 00262 CIGI_SCOPY4(&Pitch, CDta.f++); 00263 CIGI_SCOPY4(&Yaw, CDta.f++); 00264 CIGI_SCOPY4(&talt, CDta.f++); 00265 AltOrZoff = (double)talt; 00266 CIGI_SCOPY8(&LatOrXoff, CDta.d++); 00267 CIGI_SCOPY8(&LonOrYoff, CDta.d++); 00268 00269 Alpha = 255; 00270 Opacity = 100.0f; 00271 00272 return(CIGI_SUCCESS); 00273 }