Oolite
Loading...
Searching...
No Matches
OOQuiriumCascadeEntity Class Reference

#include <OOQuiriumCascadeEntity.h>

Inheritance diagram for OOQuiriumCascadeEntity:
Collaboration diagram for OOQuiriumCascadeEntity:

Instance Methods

(id) - initQuiriumCascadeFromShip: [implementation]
(NSString *) - descriptionComponents [implementation]
(void) - update: [implementation]
(void) - drawImmediate:translucent: [implementation]
(BOOL) - isEffect [implementation]
(BOOL) - isCascadeWeapon [implementation]
(BOOL) - canCollide [implementation]
(BOOL) - checkCloseCollisionWith: [implementation]
Instance Methods inherited from Entity
(NSUInteger) - sessionID
(BOOL) - isShip
(BOOL) - isDock
(BOOL) - isStation
(BOOL) - isSubEntity
(BOOL) - isPlayer
(BOOL) - isPlanet
(BOOL) - isSun
(BOOL) - isSunlit
(BOOL) - isStellarObject
(BOOL) - isSky
(BOOL) - isWormhole
(BOOL) - isVisualEffect
(BOOL) - isWaypoint
(BOOL) - validForAddToUniverse
(void) - addToLinkedLists
(void) - removeFromLinkedLists
(void) - updateLinkedLists
(void) - wasAddedToUniverse
(void) - wasRemovedFromUniverse
(void) - warnAboutHostiles
(CollisionRegion *) - collisionRegion
(void) - setCollisionRegion:
(void) - setUniversalID:
(OOUniversalID) - universalID
(BOOL) - throwingSparks
(void) - setThrowSparks:
(void) - throwSparks
(void) - setOwner:
(id) - owner
(ShipEntity *) - parentEntity
(ShipEntity *) - rootShipEntity
(void) - setPosition:
(void) - setPositionX:y:z:
(HPVector) - position
(Vector) - cameraRelativePosition
(GLfloat) - cameraRangeFront
(GLfloat) - cameraRangeBack
(void) - updateCameraRelativePosition
(Vector) - vectorTo:
(HPVector) - absolutePositionForSubentity
(HPVector) - absolutePositionForSubentityOffset:
(double) - zeroDistance
(double) - camZeroDistance
(NSComparisonResult) - compareZeroDistance:
(BoundingBox) - boundingBox
(GLfloat) - mass
(Quaternion) - orientation
(void) - setOrientation:
(Quaternion) - normalOrientation
(void) - setNormalOrientation:
(void) - orientationChanged
(void) - setVelocity:
(Vector) - velocity
(double) - speed
(GLfloat) - distanceTravelled
(void) - setDistanceTravelled:
(void) - setStatus:
(OOEntityStatus) - status
(void) - setScanClass:
(OOScanClass) - scanClass
(void) - setEnergy:
(GLfloat) - energy
(void) - setMaxEnergy:
(GLfloat) - maxEnergy
(void) - applyRoll:andClimb:
(void) - applyRoll:climb:andYaw:
(void) - moveForward:
(OOMatrix) - rotationMatrix
(OOMatrix) - drawRotationMatrix
(OOMatrix) - transformationMatrix
(OOMatrix) - drawTransformationMatrix
(GLfloat) - collisionRadius
(GLfloat) - frustumRadius
(void) - setCollisionRadius:
(NSMutableArray *) - collisionArray
(void) - applyVelocity:
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier:
(void) - dumpState
(void) - dumpSelfState
(NSUInteger) - lastDrawCounter
(void) - setLastDrawCounter:
(double) - findCollisionRadius
(BOOL) - isVisible
(BOOL) - isInSpace
(BOOL) - isImmuneToBreakPatternHide
(GLfloat) - universalTime
(GLfloat) - spawnTime
(GLfloat) - timeElapsedSinceSpawn
(void) - setAtmosphereFogging:
(OOColor *) - fogUniform
(id) - init [implementation]
(void) - dealloc [implementation]
(BOOL) - checkLinkedLists [implementation]
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
(Vector) - relativePosition [implementation]
(void) - subEntityReallyDied: [implementation]
(BOOL) - isBreakPattern
(BOOL) - isECMBlast
(BOOL) - isExhaust
(BOOL) - isFlasher
(BOOL) - isVisibleToScripts
(BOOL) - isVisibleToScripts
(NSString *) - oo_jsClassName
(NSString *) - oo_jsClassName
(void) - getJSClass:andPrototype:
(void) - deleteJSSelf
(void) - deleteJSSelf
(JSClassID) - oo_jsClassID
(jsval) - oo_jsValueInContext: [implementation]
(BOOL) - isPlayerLikeShip
(GLfloat) - clock [implementation]
(unsigned) - pseudoFixedD100 [implementation]
(unsigned) - pseudoFixedD256 [implementation]
(unsigned) - systemGovernment [implementation]
(unsigned) - systemEconomy [implementation]
(unsigned) - systemTechLevel [implementation]
(unsigned) - systemPopulation [implementation]
(unsigned) - systemProductivity [implementation]
(BOOL) - isShipWithSubEntityShip:
(void) - drawSubEntityImmediate:translucent: [implementation]
Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
(id) - weakRetain [implementation]
(void) - weakRefDied: [implementation]
Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED

Class Methods

(instancetype) + quiriumCascadeFromShip:

Private Attributes

OOTimeDelta _timePassed
GLfloat _color [4]

Additional Inherited Members

Public Attributes inherited from Entity
OOUniversalID universalID
unsigned isShip: 1
unsigned isStation: 1
unsigned isPlayer: 1
unsigned isWormhole: 1
unsigned isSubEntity: 1
unsigned hasMoved: 1
unsigned hasRotated: 1
unsigned hasCollided: 1
unsigned isSunlit: 1
unsigned collisionTestFilter: 2
unsigned throw_sparks: 1
unsigned isImmuneToBreakPatternHide: 1
unsigned isExplicitlyNotMainStation: 1
unsigned isVisualEffect: 1
OOScanClass scanClass
GLfloat zero_distance
GLfloat cam_zero_distance
GLfloat no_draw_distance
GLfloat collision_radius
HPVector position
Vector cameraRelativePosition
Quaternion orientation
OOColor * atmosphereFogging
int zero_index
Entity * x_previous
Entity * x_next
Entity * y_previous
Entity * y_next
Entity * z_previous
Entity * z_next
Entity * collision_chain
OOUniversalID shadingEntityID
Entity * collider
CollisionRegion * collisionRegion
Protected Attributes inherited from Entity
HPVector lastPosition
Quaternion lastOrientation
GLfloat distanceTravelled
OOMatrix rotMatrix
Vector velocity
GLfloat energy
GLfloat maxEnergy
BoundingBox boundingBox
GLfloat mass
NSMutableArray * collidingEntities
OOTimeAbsolute spawnTime
struct JSObject * _jsSelf
NSUInteger lastDrawCounter
Protected Attributes inherited from OOWeakRefObject
OOWeakReference * weakSelf

Detailed Description

Definition at line 30 of file OOQuiriumCascadeEntity.h.

Method Documentation

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from Entity.

Definition at line 146 of file OOQuiriumCascadeEntity.m.

147{
149}
#define kQuiriumCollisionDelay

References _timePassed, canCollide, and kQuiriumCollisionDelay.

Referenced by canCollide.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkCloseCollisionWith:

- (BOOL) checkCloseCollisionWith: (Entity*) other
implementation

Reimplemented from Entity.

Definition at line 151 of file OOQuiriumCascadeEntity.m.

151 :(Entity*)other
152{
153 return YES;
154}

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Reimplemented from Entity.

Definition at line 64 of file OOQuiriumCascadeEntity.m.

65{
66 return [NSString stringWithFormat:@"%f seconds passed of %f", _timePassed, kQuiriumCascadeDuration];
67}

References descriptionComponents.

Referenced by descriptionComponents.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawImmediate:translucent:

- (void) drawImmediate: (bool) immediate
translucent: (bool) translucent 
implementation

Reimplemented from Entity.

Definition at line 110 of file OOQuiriumCascadeEntity.m.

110 :(bool)immediate translucent:(bool)translucent
111{
112 if (!translucent || [UNIVERSE breakPatternHide])
113 return;
114
117
118 OOGL(glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT));
119
120 OOGL(glDisable(GL_CULL_FACE));
121 OOGL(glDisable(GL_TEXTURE_2D));
122 OOGL(glEnable(GL_BLEND));
123 OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
124
125 OOGL(glColor4fv(_color));
126 OOGLBEGIN(GL_TRIANGLE_FAN);
128 OOGLEND();
129
130 OOGL(glPopAttrib());
131
133 OOCheckOpenGLErrors(@"OOQuiriumCascadeEntity after drawing %@", self);
134}
#define OO_ENTER_OPENGL()
#define OOGLBEGIN
Definition OOOpenGL.h:269
@ OPENGL_STATE_ADDITIVE_BLENDING
Definition OOOpenGL.h:123
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:133
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:38
void GLDrawBallBillboard(GLfloat radius, GLfloat step, GLfloat z_distance)
Definition OOOpenGL.m:107
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:132
#define OOGL(statement)
Definition OOOpenGL.h:262
#define OOGLEND
Definition OOOpenGL.h:270
#define UNIVERSE
Definition Universe.h:827
GLfloat collision_radius
Definition Entity.h:107
GLfloat cam_zero_distance
Definition Entity.h:105

References _color, Entity::cam_zero_distance, Entity::collision_radius, GLDrawBallBillboard(), OO_ENTER_OPENGL, OOCheckOpenGLErrors(), OOGL, OOGLBEGIN, OOGLEND, OOSetOpenGLState, OOVerifyOpenGLState, OPENGL_STATE_ADDITIVE_BLENDING, and UNIVERSE.

Here is the call graph for this function:

◆ initQuiriumCascadeFromShip:

- (id) initQuiriumCascadeFromShip: (ShipEntity*) ship
implementation

Definition at line 36 of file OOQuiriumCascadeEntity.m.

36 :(ShipEntity*)ship
37{
38 if (ship == nil) {
39 [self release];
40 return nil;
41 }
42
43 if ((self = [super init])) {
44 [self setPosition:[ship position]];
45
46 [self setStatus:STATUS_EFFECT];
47 scanClass = CLASS_MINE;
48
49 [self setOwner:[ship owner]];
50
51 // Red and green channels are animated.
52 _color[2] = 1.0f;
53 _color[3] = 0.5f;
54 }
55
56 return self;
57}
return nil
OOScanClass scanClass
Definition Entity.m:743
HPVector position
Definition Entity.m:576
id init()
Definition Entity.m:64
id owner()
Definition Entity.m:548

References _color, Entity::init, nil, Entity::owner, Entity::position, Entity::scanClass, Entity::setOwner:, Entity::setPosition:, and Entity::setStatus:.

Here is the call graph for this function:

◆ isCascadeWeapon

- (BOOL) isCascadeWeapon
implementation

Reimplemented from Entity.

Definition at line 141 of file OOQuiriumCascadeEntity.m.

142{
143 return YES;
144}

References isCascadeWeapon.

Referenced by isCascadeWeapon.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEffect

- (BOOL) isEffect
implementation

Reimplemented from Entity.

Definition at line 136 of file OOQuiriumCascadeEntity.m.

137{
138 return YES;
139}

References isEffect.

Referenced by isEffect.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quiriumCascadeFromShip:

+ (instancetype) quiriumCascadeFromShip: (ShipEntity*) ship

Definition at line 59 of file OOQuiriumCascadeEntity.m.

59 :(ShipEntity*)ship
60{
61 return [[[self alloc] initQuiriumCascadeFromShip:ship] autorelease];
62}

Referenced by ShipEntity::becomeEnergyBlast, and ShipEntity::cascadeIfAppropriateWithDamageAmount:cascadeOwner:.

Here is the caller graph for this function:

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from Entity.

Definition at line 69 of file OOQuiriumCascadeEntity.m.

69 :(OOTimeDelta)delta_t
70{
71 [super update:delta_t];
72 _timePassed += delta_t;
73
75
77 GLfloat stf = tf * tf;
78 GLfloat expansionSpeed = 0.0;
79 if (_timePassed > 0) // Avoid divide by 0
80 {
81 expansionSpeed = fmin(240.0f + 10.0f / (tf * tf), 1000.0f);
82 }
83
84 collision_radius += delta_t * expansionSpeed; // expand
85 energy = delta_t * (100000 - 90000 * tf); // adjusted to take into account delta_t
86
87 _color[3] = OOClamp_0_1_f(0.5f * ((0.025f / tf) + 1.0f - stf));
88
89 _color[0] = _color[1] = fmin(1.0f - 5.0f * tf, 1.0f);
90 if (_color[0] < 0.0f) {
91 _color[0] = 0.25f * tf * randf();
92 _color[1] = 0.0f;
93 }
94
95 // manage collisions
96 Entity* owner = [self owner];
97 Entity* e = nil;
98 foreach (e, collidingEntities) {
99 // we're going to force the weapon id to be the qbomb key here, because at this point the cascade entity isn't a ship any more
100 // and there's no link back to the original.
101 [e takeEnergyDamage:energy from:self becauseOf:owner weaponIdentifier:@"EQ_QC_MINE"];
102 }
103
104 // expire after ttl
106 [UNIVERSE removeEntity:self];
107 }
108}
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
OOMatrix OOMatrixForBillboard(HPVector bbPos, HPVector eyePos) CONST_FUNC
Definition OOMatrix.m:186
#define kQuiriumCascadeDuration
double OOTimeDelta
Definition OOTypes.h:193
#define PLAYER
NSMutableArray * collidingEntities
Definition Entity.h:144
GLfloat energy
Definition Entity.m:753
void takeEnergyDamage:from:becauseOf:weaponIdentifier:(double amount,[from] Entity *ent,[becauseOf] Entity *other,[weaponIdentifier] NSString *weaponIdentifier)
Definition Entity.m:899
OOMatrix rotMatrix
Definition Entity.h:134
float randf(void)

References _color, _timePassed, Entity::collidingEntities, Entity::collision_radius, Entity::energy, kQuiriumCascadeDuration, nil, OOClamp_0_1_f(), OOMatrixForBillboard(), Entity::owner, PLAYER, Entity::position, randf(), Entity::rotMatrix, Entity::takeEnergyDamage:from:becauseOf:weaponIdentifier:, and Entity::update:.

Here is the call graph for this function:

Member Data Documentation

◆ _color

- (GLfloat _color[4])
private

◆ _timePassed

- (OOTimeDelta) _timePassed
private

Definition at line 32 of file OOQuiriumCascadeEntity.h.

Referenced by canCollide, and update:.


The documentation for this class was generated from the following files: