2 * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
4 * ShapeFusion is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * ShapeFusion 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 General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with ShapeFusion; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef PHYSICSELEMENTS_H
20 #define PHYSICSELEMENTS_H
22 #include "../BigEndianBuffer.h"
31 // So that subclasses can change their status
35 PhysicsElement(bool verbose) : mVerboseLoading(verbose), mGoodData(false) {}
38 bool IsGood() const { return mGoodData; }
39 bool IsVerbose() const { return mVerboseLoading; }
42 class PhysicsConstants : public PhysicsElement
44 friend std::ostream& operator<<(std::ostream&, const PhysicsConstants&);
46 double mMaximumForwardVelocity;
47 double mMaximumBackwardVelocity;
48 double mMaximumPerpendicularVelocity;
52 double mAirborneDeceleration;
54 double mGravitationalAcceleration;
55 double mClimbingAcceleration;
56 double mTerminalVelocity;
58 double mExternalDeceleration;
60 double mAngularAcceleration;
61 double mAngularDeceleration;
62 double mMaximumAngularVelocity;
63 double mAngularRecenteringVelocity;
65 double mFastAngularVelocity;
66 double mFastAngularMaximum;
68 double mMaximumElevation;
69 double mExternalAngularDeceleration;
72 double mStepAmplitude;
80 double mHalfCameraSeparation;
83 double GetMaximumForwardVelocity() const { return mMaximumForwardVelocity; }
84 double GetMaximumBackwardVelocity() const { return mMaximumBackwardVelocity; }
85 double GetMaximumPerpendicularVelocity() const { return mMaximumPerpendicularVelocity; }
87 double GetAcceleration() const { return mAcceleration; }
88 double GetDeceleration() const { return mDeceleration; }
89 double GetAirborneDeceleration() const { return mAirborneDeceleration; }
91 double GetGravitationalAcceleration() const { return mGravitationalAcceleration; }
92 double GetClimbingAcceleration() const { return mClimbingAcceleration; }
93 double GetTerminalVelocity() const { return mTerminalVelocity; }
95 double GetExternalDeceleration() const { return mExternalDeceleration; }
97 double GetAngularAcceleration() const { return mAngularAcceleration; }
98 double GetAngularDeceleration() const { return mAngularDeceleration; }
99 double GetMaximumAngularVelocity() const { return mMaximumAngularVelocity; }
100 double GetAngularRecenteringVelocity() const { return mAngularRecenteringVelocity; }
103 double GetFastAngularVelocity() const { return mFastAngularVelocity; }
104 double GetFastAngularMaximum() const { return mFastAngularMaximum; }
106 double GetMaximumElevation() const { return mMaximumElevation; }
107 double GetExternalAngularDeceleration() const { return mExternalAngularDeceleration; }
109 double GetStepDelta() const { return mStepDelta; }
110 double GetStepAmplitude() const { return mStepAmplitude; }
112 double GetRadius() const { return mRadius; }
113 double GetHeight() const { return mHeight; }
114 double GetDeadHeight() const { return mDeadHeight; }
115 double GetCameraHeight() const { return mCameraHeight; }
116 double GetSplashHeight() const { return mSplashHeight; }
118 double GetHalfCameraSeparation() const { return mHalfCameraSeparation; }
121 void SetMaximumForwardVelocity(double v) { mMaximumForwardVelocity = v; }
122 void SetMaximumBackwardVelocity(double v) { mMaximumBackwardVelocity = v; }
123 void SetMaximumPerpendicularVelocity(double v) { mMaximumPerpendicularVelocity = v; }
125 void SetAcceleration(double v) { mAcceleration = v; }
126 void SetDeceleration(double v) { mDeceleration = v; }
127 void SetAirborneDeceleration(double v) { mAirborneDeceleration = v; }
129 void SetGravitationalAcceleration(double v) { mGravitationalAcceleration = v; }
130 void SetClimbingAcceleration(double v) { mClimbingAcceleration = v; }
131 void SetTerminalVelocity(double v) { mTerminalVelocity = v; }
133 void SetExternalDeceleration(double v) { mExternalDeceleration = v; }
135 void SetAngularAcceleration(double v) { mAngularAcceleration = v; }
136 void SetAngularDeceleration(double v) { mAngularDeceleration = v; }
137 void SetMaximumAngularVelocity(double v) { mMaximumAngularVelocity = v; }
138 void SetAngularRecenteringVelocity(double v) { mAngularRecenteringVelocity = v; }
140 void SetFastAngularVelocity(double v) { mFastAngularVelocity = v; }
141 void SetFastAngularMaximum(double v) { mFastAngularMaximum = v; }
143 void SetMaximumElevation(double v) { mMaximumElevation = v; }
144 void SetExternalAngularDeceleration(double v) { mExternalAngularDeceleration = v; }
146 void SetStepDelta(double v) { mStepDelta = v; }
147 void SetStepAmplitude(double v) { mStepAmplitude = v; }
149 void SetRadius(double v) { mRadius = v; }
150 void SetHeight(double v) { mHeight = v; }
151 void SetDeadHeight(double v) { mDeadHeight = v; }
152 void SetCameraHeight(double v) { mCameraHeight = v; }
153 void SetSplashHeight(double v) { mSplashHeight = v; }
155 void SetHalfCameraSeparation(double v) { mHalfCameraSeparation = v; }
158 PhysicsConstants(bool verbose = false) : PhysicsElement(verbose) { }
159 ~PhysicsConstants() { }
161 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
162 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
164 static const int kSize = 104;
167 class AttackDefinition : public PhysicsElement
169 friend std::ostream& operator<<(std::ostream&, const AttackDefinition&);
180 short GetType() { return mType; }
181 short GetRepetitions() { return mRepetitions; }
182 double GetError() { return mError; }
183 short GetRange() { return mRange; }
184 short GetShape() { return mAttackShape; }
185 short GetDx() { return mDx; }
186 short GetDy() { return mDy; }
187 short GetDz() { return mDz; }
190 void SetType(short v) { mType = v; }
191 void SetRepetitions(short v) { mRepetitions = v; }
192 void SetError(double d) { mError = d; }
193 void SetRange(short v) { mRange = v; }
194 void SetShape(short v) { mAttackShape = v; }
195 void SetDx(short v) { mDx = v; }
196 void SetDy(short v) { mDy = v; }
197 void SetDz(short v) { mDz = v; }
199 AttackDefinition(bool verbose = false) : PhysicsElement(verbose) { }
200 ~AttackDefinition() { }
202 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
203 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
206 class DamageDefinition : public PhysicsElement
208 friend std::ostream& operator<<(std::ostream&, const DamageDefinition&);
222 short GetType() { return mType; }
223 short GetBase() { return mBase; }
224 bool GetAlien() { return mFlags & kAlienDamage; }
225 short GetRandom() { return mRandom; }
226 double GetScale() { return mScale; }
229 void SetType(short v) { mType = v; }
230 void SetAlien(bool b) {
231 if (b) mFlags |= kAlienDamage;
232 else mFlags &= ~kAlienDamage;
235 void SetBase(short v) { mBase = v; }
236 void SetRandom(short v) { mRandom = v; }
237 void SetScale(double d) { mScale = d; }
239 DamageDefinition(bool verbose = false) : PhysicsElement(verbose) { }
240 ~DamageDefinition() { }
242 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
243 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
246 class EffectDefinition : public PhysicsElement
248 friend std::ostream& operator<<(std::ostream&, const EffectDefinition&);
250 unsigned short mCollection;
251 unsigned short mColorTable;
254 unsigned short mFlags;
259 kEndWhenAnimationLoops = 0x0001,
260 kEndWhenTransferAnimationLoops = 0x0002,
262 kMakeTwinVisible = 0x0008,
263 kMediaEffect = 0x0010
268 unsigned short GetCollection() { return mCollection; }
269 unsigned short GetColorTable() { return mColorTable; }
270 short GetShape() { return mShape; }
271 double GetSoundPitch() { return mSoundPitch; }
272 short GetDelay() { return mDelay; }
273 short GetDelaySound() { return mDelaySound; }
275 bool GetEndWhenAnimationLoops() { return mFlags & kEndWhenAnimationLoops; }
276 bool GetEndWhenTransferAnimationLoops() { return mFlags & kEndWhenTransferAnimationLoops; }
277 bool GetSoundOnly() { return mFlags & kSoundOnly; }
278 bool GetMediaEffect() { return mFlags & kMediaEffect; }
281 void SetCollection(unsigned short v) { mCollection = v; }
282 void SetColorTable(unsigned short v) { mColorTable = v; }
283 void SetShape(short v) { mShape = v; }
284 void SetSoundPitch(double v) { mSoundPitch = v; }
285 void SetDelay(short v) { mDelay = v; }
286 void SetDelaySound(short v) { mDelaySound = v; }
288 void SetEndWhenAnimationLoops(bool v) {
289 if (v) mFlags |= kEndWhenAnimationLoops;
290 else mFlags &= ~kEndWhenAnimationLoops;
293 void SetEndWhenTransferAnimationLoops(bool v) {
294 if (v) mFlags |= kEndWhenTransferAnimationLoops;
295 else mFlags &= ~kEndWhenTransferAnimationLoops;
298 void SetSoundOnly(bool v) {
299 if (v) mFlags |= kSoundOnly;
300 else mFlags &= ~kSoundOnly;
303 void SetMediaEffect(bool v) {
304 if (v) mFlags |= kMediaEffect;
305 else mFlags &= ~kMediaEffect;
308 EffectDefinition(bool verbose = false) : PhysicsElement(verbose) { }
309 ~EffectDefinition() { }
311 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
312 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
314 static const int kSize = 14;
317 class MonsterDefinition : public PhysicsElement
319 friend std::ostream& operator<<(std::ostream&, const MonsterDefinition&);
321 unsigned short mCollection;
322 unsigned short mColorTable;
325 unsigned long mImmunities;
326 unsigned long mWeaknesses;
327 unsigned long mFlags;
335 short mActivationSound;
336 short mFriendlyActivationSound;
340 short mFriendlyFireSound;
343 short mRandomSoundMask;
345 short mCarryingItemType;
349 short mPreferredHoverHeight;
350 short mMinimumLedgeDelta;
351 short mMaximumLedgeDelta;
352 double mExternalVelocityScale;
354 short mMeleeImpactEffect;
355 short mContrailEffect;
357 short mHalfVisualArc;
358 short mHalfVerticalVisualArc;
360 short mDarkVisualRange;
364 short mTerminalVelocity;
365 short mDoorRetryMask;
366 short mShrapnelRadius;
368 DamageDefinition mShrapnelDamage;
372 short mHardDyingShape;
373 short mSoftDyingShape;
374 short mHardDeadShapes;
375 short mSoftDeadShapes;
376 short mStationaryShape;
378 short mTeleportInShape;
379 short mTeleportOutShape;
381 short mAttackFrequency;
382 AttackDefinition mMeleeAttack;
383 AttackDefinition mRangedAttack;
387 unsigned short GetCollection() { return mCollection; }
388 unsigned short GetColorTable() { return mColorTable; }
390 short GetVitality() { return mVitality; }
391 bool GetImmunity(int index) { return mImmunities & (1 << index); }
392 bool GetWeakness(int index) { return mWeaknesses & (1 << index); }
393 bool GetFlag(int index) { return mFlags & (1 << index); }
395 long GetClass() { return mClass; }
396 bool GetFriend(int index) { return mFriends & (1 << index); }
397 bool GetEnemy(int index) { return mEnemies & (1 << index); }
399 double GetSoundPitch() { return mSoundPitch; }
401 short GetActivationSound() { return mActivationSound; }
402 short GetFriendlyActivationSound() { return mFriendlyActivationSound; }
403 short GetClearSound() { return mClearSound; }
404 short GetKillSound() { return mKillSound; }
405 short GetApologySound() { return mApologySound; }
406 short GetFriendlyFireSound() { return mFriendlyFireSound; }
407 short GetFlamingSound() { return mFlamingSound; }
408 short GetRandomSound() { return mRandomSound; }
409 short GetRandomSoundMask() { return mRandomSoundMask; }
411 short GetCarryingItemType() { return mCarryingItemType; }
413 short GetRadius() { return mRadius; }
414 short GetHeight() { return mHeight; }
415 short GetPreferredHoverHeight() { return mPreferredHoverHeight; }
416 short GetMinimumLedgeDelta() { return mMinimumLedgeDelta; }
417 short GetMaximumLedgeDelta() { return mMaximumLedgeDelta; }
418 double GetExternalVelocityScale() { return mExternalVelocityScale; }
419 short GetImpactEffect() { return mImpactEffect; }
420 short GetMeleeImpactEffect() { return mMeleeImpactEffect; }
421 short GetContrailEffect() { return mContrailEffect; }
423 short GetVisualRange() { return mVisualRange; }
424 short GetDarkVisualRange() { return mDarkVisualRange; }
425 short GetIntelligence() { return mIntelligence; }
426 short GetSpeed() { return mSpeed; }
427 short GetGravity() { return mGravity; }
428 short GetTerminalVelocity() { return mTerminalVelocity; }
429 short GetDoorRetryMask() { return mDoorRetryMask; }
430 short GetShrapnelRadius() { return mShrapnelRadius; }
432 DamageDefinition* GetShrapnelDamage() { return &mShrapnelDamage; }
434 short GetHitShapes() { return mHitShapes; }
435 short GetHardDyingShape() { return mHardDyingShape; }
436 short GetSoftDyingShape() { return mSoftDyingShape; }
437 short GetHardDeadShapes() { return mHardDeadShapes; }
438 short GetSoftDeadShapes() { return mSoftDeadShapes; }
439 short GetStationaryShape() { return mStationaryShape; }
440 short GetMovingShape() { return mMovingShape; }
441 short GetTeleportInShape() { return mTeleportInShape; }
442 short GetTeleportOutShape() { return mTeleportOutShape; }
444 short GetAttackFrequency() { return mAttackFrequency; }
445 AttackDefinition* GetMeleeAttack() { return &mMeleeAttack; }
446 AttackDefinition* GetRangedAttack() { return &mRangedAttack; }
449 void SetCollection(unsigned short v) { mCollection = v; }
450 void SetColorTable(unsigned short v) { mColorTable = v; }
452 void SetVitality(short v) { mVitality = v; }
453 void SetImmunity(int index, bool b) {
454 if (b) mImmunities |= (1 << index);
455 else mImmunities &= ~(1 << index);
458 void SetWeakness(int index, bool b) {
459 if (b) mWeaknesses |= (1 << index);
460 else mWeaknesses &= ~(1 << index);
463 void SetFlag(int index, bool b) {
464 if (b) mFlags |= (1 << index);
465 else mFlags &= ~(1 << index);
468 void SetClass(long v) { mClass = v; }
470 void SetFriend(int index, bool b) {
471 if (b) mFriends |= (1 << index);
472 else mFriends &= ~(1 << index);
475 void SetEnemy(int index, bool b) {
476 if (b) mEnemies |= (1 << index);
477 else mEnemies &= ~(1 << index);
480 void SetSoundPitch(double d) { mSoundPitch = d; }
482 void SetRadius(short v) { mRadius = v; }
483 void SetHeight(short v) { mHeight = v; }
484 void SetPreferredHoverHeight(short v) { mPreferredHoverHeight = v; }
485 void SetMinimumLedgeDelta(short v) { mMinimumLedgeDelta = v; }
486 void SetMaximumLedgeDelta(short v) { mMaximumLedgeDelta = v; }
487 void SetExternalVelocityScale(double d) { mExternalVelocityScale = d; }
488 void SetImpactEffect(short v) { mImpactEffect = v; }
489 void SetMeleeImpactEffect(short v) { mMeleeImpactEffect = v; }
490 void SetContrailEffect(short v) { mContrailEffect = v; }
492 void SetVisualRange(short v) { mVisualRange = v; }
493 void SetDarkVisualRange(short v) { mDarkVisualRange = v; }
494 void SetIntelligence(short v) { mIntelligence = v; }
495 void SetSpeed(short v) { mSpeed = v; }
496 void SetGravity(short v) { mGravity = v; }
497 void SetTerminalVelocity(short v) { mTerminalVelocity = v; }
498 void SetDoorRetryMask(short v) { mDoorRetryMask = v; }
499 void SetShrapnelRadius(short v) { mShrapnelRadius = v; }
502 void SetActivationSound(short v) { mActivationSound = v; }
503 void SetFriendlyActivationSound(short v) { mFriendlyActivationSound = v; }
504 void SetClearSound(short v) { mClearSound = v; }
505 void SetKillSound(short v) { mKillSound = v; }
506 void SetApologySound(short v) { mApologySound = v; }
507 void SetFriendlyFireSound(short v) { mFriendlyFireSound = v; }
508 void SetFlamingSound(short v) { mFlamingSound = v; }
509 void SetRandomSound(short v) { mRandomSound = v; }
510 void SetRandomSoundMask(short v) { mRandomSoundMask = v; }
512 void SetCarryingItemType(short v) { mCarryingItemType = v; }
514 void SetHitShapes(short v) { mHitShapes = v; }
515 void SetHardDyingShape(short v) { mHardDyingShape = v; }
516 void SetSoftDyingShape(short v) { mSoftDyingShape = v; }
517 void SetHardDeadShapes(short v) { mHardDeadShapes = v; }
518 void SetSoftDeadShapes(short v) { mSoftDeadShapes = v; }
519 void SetStationaryShape(short v) { mStationaryShape = v; }
520 void SetMovingShape(short v) { mMovingShape = v; }
521 void SetTeleportInShape(short v) { mTeleportInShape = v; }
522 void SetTeleportOutShape(short v) { mTeleportOutShape = v; }
524 void SetAttackFrequency(short v) { mAttackFrequency = v; }
526 MonsterDefinition(bool verbose = false) : PhysicsElement(verbose) { }
527 ~MonsterDefinition() { }
529 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
530 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
532 static const int kSize = 156;
535 class ProjectileDefinition : public PhysicsElement
537 friend std::ostream& operator<<(std::ostream&, const ProjectileDefinition&);
539 unsigned short mCollection;
540 unsigned short mColorTable;
543 short mDetonationEffect;
544 short mMediaDetonationEffect;
545 short mContrailEffect;
546 short mTicksBetweenContrails;
547 short mMaximumContrails;
548 short mMediaProjectilePromotion;
552 DamageDefinition mDamage;
554 unsigned long mFlags;
565 unsigned short GetCollection() { return mCollection; }
566 unsigned short GetColorTable() { return mColorTable; }
567 short GetShape() { return mShape; }
569 short GetDetonationEffect() { return mDetonationEffect; }
570 short GetMediaDetonationEffect() { return mMediaDetonationEffect; }
571 short GetContrailEffect() { return mContrailEffect; }
572 short GetTicksBetweenContrails() { return mTicksBetweenContrails; }
573 short GetMaximumContrails() { return mMaximumContrails; }
574 short GetMediaProjectilePromotion() { return mMediaProjectilePromotion; }
576 short GetRadius() { return mRadius; }
577 short GetAreaOfEffect() { return mAreaOfEffect; }
579 DamageDefinition* GetDamage() { return &mDamage; }
581 bool GetFlag(int flag_index) { return mFlags & (1 << flag_index); }
583 short GetSpeed() { return mSpeed; }
584 short GetMaximumRange() { return mMaximumRange; }
586 double GetSoundPitch() { return mSoundPitch; }
587 short GetFlybySound() { return mFlybySound; }
588 short GetReboundSound() { return mReboundSound; }
591 void SetCollection(unsigned short v) { mCollection = v; }
592 void SetColorTable(unsigned short v) { mColorTable = v; }
593 void SetShape(short v) { mShape = v; }
595 void SetDetonationEffect(short v) { mDetonationEffect = v; }
596 void SetMediaDetonationEffect(short v) { mMediaDetonationEffect = v; }
597 void SetContrailEffect(short v) { mContrailEffect = v; }
598 void SetTicksBetweenContrails(short v) { mTicksBetweenContrails = v; }
599 void SetMaximumContrails(short v) { mMaximumContrails = v; }
600 void SetMediaProjectilePromotion(short v) { mMediaProjectilePromotion = v; }
602 void SetRadius(short v) { mRadius = v; }
603 void SetAreaOfEffect(short v) { mAreaOfEffect = v; }
605 void SetFlag(int flag_index, bool f) {
606 if (f) mFlags |= (1 << flag_index);
607 else mFlags &= ~(1 << flag_index);
610 void SetSpeed(short v) { mSpeed = v; }
611 void SetMaximumRange(short v) { mMaximumRange = v; }
613 void SetSoundPitch(double v) { mSoundPitch = v; }
614 void SetFlybySound(short v) { mFlybySound = v; }
615 void SetReboundSound(short v) { mReboundSound = v; }
617 ProjectileDefinition(bool verbose = false) : PhysicsElement(verbose) { }
618 ~ProjectileDefinition() { }
620 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
621 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
623 static const int kSize = 48;
626 class TriggerDefinition : public PhysicsElement
628 friend std::ostream& operator<<(std::ostream&, const TriggerDefinition&);
630 short mRoundsPerMagazine;
631 short mAmmunitionType;
632 short mTicksPerRound;
633 short mRecoveryTicks;
634 short mChargingTicks;
635 short mRecoilMagnitude;
639 short mChargingSound;
640 short mShellCasingSound;
641 short mReloadingSound;
644 short mProjectileType;
648 short mShellCasingType;
652 short GetRoundsPerMagazine() { return mRoundsPerMagazine; }
653 short GetAmmunitionType() { return mAmmunitionType; }
654 short GetTicksPerRound() { return mTicksPerRound; }
655 short GetRecoveryTicks() { return mRecoveryTicks; }
656 short GetChargingTicks() { return mChargingTicks; }
657 short GetRecoilMagnitude() { return mRecoilMagnitude; }
659 short GetFiringSound() { return mFiringSound; }
660 short GetClickSound() { return mClickSound; }
661 short GetChargingSound() { return mChargingSound; }
662 short GetShellCasingSound() { return mShellCasingSound; }
663 short GetReloadingSound() { return mReloadingSound; }
664 short GetChargedSound() { return mChargedSound; }
666 short GetProjectileType() { return mProjectileType; }
667 short GetThetaError() { return mThetaError; }
668 short GetDx() { return mDx; }
669 short GetDz() { return mDz; }
670 short GetShellCasingType() { return mShellCasingType; }
671 short GetBurstCount() { return mBurstCount; }
674 void SetRoundsPerMagazine(short v) { mRoundsPerMagazine = v; }
675 void SetAmmunitionType(short v) { mAmmunitionType = v; }
676 void SetTicksPerRound(short v) { mTicksPerRound = v; }
677 void SetRecoveryTicks(short v) { mRecoveryTicks = v; }
678 void SetChargingTicks(short v) { mChargingTicks = v; }
679 void SetRecoilMagnitude(short v) { mRecoilMagnitude = v; }
681 void SetFiringSound(short v) { mFiringSound = v; }
682 void SetClickSound(short v) { mClickSound = v; }
683 void SetChargingSound(short v) { mChargingSound = v; }
684 void SetShellCasingSound(short v) { mShellCasingSound = v; }
685 void SetReloadingSound(short v) { mReloadingSound = v; }
686 void SetChargedSound(short v) { mChargedSound = v; }
688 void SetProjectileType(short v) { mProjectileType = v; }
689 void SetThetaError(short v) { mThetaError = v; }
690 void SetDx(short v) { mDx = v; }
691 void SetDz(short v) { mDz = v; }
692 void SetShellCasingType(short v) { mShellCasingType = v; }
693 void SetBurstCount(short v) { mBurstCount = v; }
695 TriggerDefinition(bool verbose = false) : PhysicsElement(verbose) { }
696 ~TriggerDefinition() { }
698 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
699 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
702 class WeaponDefinition : public PhysicsElement
704 friend std::ostream& operator<<(std::ostream&, const WeaponDefinition&);
711 double mFiringLightIntensity;
712 short mFiringIntensityDecayTicks;
715 double mBobAmplitude;
717 double mReloadHeight;
719 double mHorizontalAmplitude;
721 unsigned short mCollection;
722 unsigned short mColorTable;
726 short mReloadingShape;
728 short mChargingShape;
732 short mAwaitReloadTicks;
734 short mFinishLoadingTicks;
737 TriggerDefinition mPrimaryTrigger;
738 TriggerDefinition mSecondaryTrigger;
741 short GetItemType() { return mItemType; }
742 short GetPowerupType() { return mPowerupType; }
743 short GetWeaponClass() { return mWeaponClass; }
744 bool GetFlag(int index) { return mFlags & (1 << index); }
746 double GetFiringLightIntensity() { return mFiringLightIntensity; }
747 short GetFiringIntensityDecayTicks() { return mFiringIntensityDecayTicks; }
749 double GetIdleHeight() { return mIdleHeight; }
750 double GetBobAmplitude() { return mBobAmplitude; }
751 double GetKickHeight() { return mKickHeight; }
752 double GetReloadHeight() { return mReloadHeight; }
753 double GetIdleWidth() { return mIdleWidth; }
754 double GetHorizontalAmplitude() { return mHorizontalAmplitude; }
756 unsigned short GetCollection() { return mCollection; }
757 unsigned short GetColorTable() { return mColorTable; }
759 short GetIdleShape() { return mIdleShape; }
760 short GetFiringShape() { return mFiringShape; }
761 short GetReloadingShape() { return mReloadingShape; }
762 short GetChargingShape() { return mChargingShape; }
763 short GetChargedShape() { return mChargedShape; }
765 short GetReadyTicks() { return mReadyTicks; }
766 short GetAwaitReloadTicks() { return mAwaitReloadTicks; }
767 short GetLoadingTicks() { return mLoadingTicks; }
768 short GetFinishLoadingTicks() { return mFinishLoadingTicks; }
770 TriggerDefinition* GetPrimaryTrigger() { return &mPrimaryTrigger; }
771 TriggerDefinition* GetSecondaryTrigger() { return &mSecondaryTrigger; }
774 void SetItemType(short v) { mItemType = v; }
775 void SetPowerupType(short v) { mPowerupType = v; }
776 void SetWeaponClass(short v) { mWeaponClass = v; }
777 void SetFlag(int index, bool v) {
778 if (v) mFlags |= (1 << index);
779 else mFlags &= ~(1 << index);
782 void SetFiringLightIntensity(double v) { mFiringLightIntensity = v; }
783 void SetFiringIntensityDecayTicks(short v) { mFiringIntensityDecayTicks = v; }
785 void SetIdleHeight(double v) { mIdleHeight = v; }
786 void SetBobAmplitude(double v) { mBobAmplitude = v; }
787 void SetKickHeight(double v) { mKickHeight = v; }
788 void SetReloadHeight(double v) { mReloadHeight = v; }
789 void SetIdleWidth(double v) { mIdleWidth = v; }
790 void SetHorizontalAmplitude(double v) { mHorizontalAmplitude = v; }
792 void SetCollection(unsigned short v) { mCollection = v; }
793 void SetColorTable(unsigned short v) { mColorTable = v; }
795 void SetIdleShape(short v) { mIdleShape = v; }
796 void SetFiringShape(short v) { mFiringShape = v; }
797 void SetReloadingShape(short v) { mReloadingShape = v; }
798 void SetChargingShape(short v) { mChargingShape = v; }
799 void SetChargedShape(short v) { mChargedShape = v; }
801 void SetReadyTicks(short v) { mReadyTicks = v; }
802 void SetAwaitReloadTicks(short v) { mAwaitReloadTicks = v; }
803 void SetLoadingTicks(short v) { mLoadingTicks = v; }
804 void SetFinishLoadingTicks(short v) { mFinishLoadingTicks = v; }
807 WeaponDefinition(bool verbose = false) : PhysicsElement(verbose) { }
808 ~WeaponDefinition() { }
810 BigEndianBuffer& SaveObject(BigEndianBuffer& buffer) const;
811 BigEndianBuffer& LoadObject(BigEndianBuffer& buffer);
813 static const int kSize = 134;