Gave quirium cascades an entity class of their very own.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4239 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2011-02-05 17:35:50 +00:00
parent 964fa0d6c3
commit badd140260
13 changed files with 248 additions and 279 deletions

View File

@ -229,7 +229,8 @@ OOLITE_ENTITY_FILES = \
OOPlasmaBurstEntity.m \
OOFlashEffectEntity.m \
ShipEntityLoadRestore.m \
OOLaserShotEntity.m
OOLaserShotEntity.m \
OOQuiriumCascadeEntity.m
OOLITE_GRAPHICS_DRAWABLE_FILES = \
OODrawable.m \

View File

@ -553,6 +553,7 @@
1A95338C0C02089E004EBB58 /* planetinfo.plist in Copy Config */ = {isa = PBXBuildFile; fileRef = 1A95338A0C02089E004EBB58 /* planetinfo.plist */; };
1A95C040118A450E002EE302 /* OOConvertCubeMapToLatLong.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A95C03E118A450E002EE302 /* OOConvertCubeMapToLatLong.h */; };
1A95C041118A450E002EE302 /* OOConvertCubeMapToLatLong.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A95C03F118A450E002EE302 /* OOConvertCubeMapToLatLong.m */; settings = {COMPILER_FLAGS = "-O3 -ftree-vectorize"; }; };
1A97D77F12FDBB9B0009D74A /* OOQuiriumCascadeEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A97D77312FDB6610009D74A /* OOQuiriumCascadeEntity.m */; };
1AA7FCAB10C2B9BA0058FBED /* OOPlanetDrawable.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA7FCA910C2B9BA0058FBED /* OOPlanetDrawable.h */; };
1AA7FCAC10C2B9BA0058FBED /* OOPlanetDrawable.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AA7FCAA10C2B9BA0058FBED /* OOPlanetDrawable.m */; };
1AA7FCAF10C2BA3B0058FBED /* OOPlanetData.c in Sources */ = {isa = PBXBuildFile; fileRef = 1AA7FCAD10C2BA3B0058FBED /* OOPlanetData.c */; };
@ -1820,6 +1821,8 @@
1A97302012E60F9B001F2406 /* OOGUIScreenID.tbl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OOGUIScreenID.tbl; sourceTree = "<group>"; };
1A97305C12E61427001F2406 /* OOGalacticHyperspaceBehaviour.tbl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OOGalacticHyperspaceBehaviour.tbl; sourceTree = "<group>"; };
1A97D68512FD83BD0009D74A /* OOShipDamageType.tbl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OOShipDamageType.tbl; sourceTree = "<group>"; };
1A97D77212FDB6610009D74A /* OOQuiriumCascadeEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOQuiriumCascadeEntity.h; sourceTree = "<group>"; };
1A97D77312FDB6610009D74A /* OOQuiriumCascadeEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOQuiriumCascadeEntity.m; sourceTree = "<group>"; };
1AA7FCA910C2B9BA0058FBED /* OOPlanetDrawable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOPlanetDrawable.h; sourceTree = "<group>"; };
1AA7FCAA10C2B9BA0058FBED /* OOPlanetDrawable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOPlanetDrawable.m; sourceTree = "<group>"; };
1AA7FCAD10C2BA3B0058FBED /* OOPlanetData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OOPlanetData.c; sourceTree = "<group>"; };
@ -2775,6 +2778,8 @@
1A817DC2106D443B00AA2F97 /* OOFlashEffectEntity.m */,
1AE7324E12F75D470045513D /* OOLaserShotEntity.h */,
1AE7324F12F75D470045513D /* OOLaserShotEntity.m */,
1A97D77212FDB6610009D74A /* OOQuiriumCascadeEntity.h */,
1A97D77312FDB6610009D74A /* OOQuiriumCascadeEntity.m */,
);
name = Particles;
sourceTree = "<group>";
@ -3918,6 +3923,7 @@
1A127F4412EC6A4400B65D9F /* OOTextureSprite.m in Sources */,
1A1280F912ECA4ED00B65D9F /* OOJSFont.m in Sources */,
1AE7325112F75D470045513D /* OOLaserShotEntity.m in Sources */,
1A97D77F12FDBB9B0009D74A /* OOQuiriumCascadeEntity.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -0,0 +1,47 @@
/*
OOQuiriumCascadeEntity.h
Droppings of a Q-mine, or one of its victims.
Oolite
Copyright (C) 2004-2011 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "Entity.h"
@interface OOQuiriumCascadeEntity: Entity
{
@private
OOTimeDelta _timePassed;
GLfloat _color[4];
}
+ (id) quiriumCascadeFromShip:(ShipEntity *)ship;
@end
@interface Entity (OOQuiriumCascadeExtensions)
- (BOOL) isCascadeWeapon;
@end

View File

@ -0,0 +1,174 @@
/*
OOQuiriumCascadeEntity.m
Oolite
Copyright (C) 2004-2011 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOQuiriumCascadeEntity.h"
#import "PlayerEntity.h"
#import "Universe.h"
#define kQuiriumCascadeDuration (20.0) // seconds
#define kQuiriumCollisionDelay (0.05) // seconds before we start colliding with and damaging things.
@implementation OOQuiriumCascadeEntity
- (id) initQuiriumCascadeFromShip:(ShipEntity *)ship
{
if (ship == nil)
{
[self release];
return nil;
}
if ((self = [super init]))
{
[self setPosition:[ship position]];
[self setStatus:STATUS_EFFECT];
scanClass = CLASS_MINE;
[self setOwner:[ship owner]];
// Red and green channels are animated.
_color[2] = 1.0f;
_color[3] = 0.5f;
}
return self;
}
+ (id) quiriumCascadeFromShip:(ShipEntity *)ship
{
return [[[self alloc] initQuiriumCascadeFromShip:ship] autorelease];
}
- (NSString *) descriptionComponents
{
return [NSString stringWithFormat:@"%f seconds passed of %f", _timePassed, kQuiriumCascadeDuration];
}
- (void) update:(OOTimeDelta) delta_t
{
_timePassed += delta_t;
rotMatrix = OOMatrixForBillboard(position, [PLAYER position]);
GLfloat tf = _timePassed / kQuiriumCascadeDuration;
GLfloat stf = tf * tf;
GLfloat expansionSpeed = 0.0;
if (_timePassed > 0) // Avoid divide by 0
{
expansionSpeed = fminf(240 + 10 / (tf * tf), 1000.0f);
}
velocity.z = expansionSpeed; // What's this for? Velocity is never applied. -- Ahruman 2011-02-05
collision_radius += delta_t * expansionSpeed; // expand
energy = delta_t * (100000 - 90000 * tf); // adjusted to take into account delta_t
_color[3] = OOClamp_0_1_f(0.5f * ((0.025f / tf) + 1.0f - stf));
_color[0] = _color[1] = fminf(1.0f - 5.0f * tf, 1.0f);
if (_color[0] < 0.0f)
{
_color[0] = 0.25f * tf * randf();
_color[1] = 0.0f;
}
// manage collisions
Entity *owner = [self owner];
Entity *e = nil;
foreach (e, collidingEntities)
{
[e takeEnergyDamage:energy from:self becauseOf:owner];
}
// expire after ttl
if (_timePassed > kQuiriumCascadeDuration)
{
[UNIVERSE removeEntity:self];
}
}
- (void) drawEntity:(BOOL)immediate :(BOOL)translucent
{
if (!translucent || [UNIVERSE breakPatternHide]) return;
OOGL(glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT));
OOGL(glDisable(GL_CULL_FACE)); // face culling
OOGL(glDisable(GL_TEXTURE_2D));
OOGL(glEnable(GL_BLEND));
OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
OOGL(glColor4fv(_color));
OOGLBEGIN(GL_TRIANGLE_FAN);
GLDrawBallBillboard(collision_radius, 4, sqrtf(zero_distance));
OOGLEND();
OOGL(glPopAttrib());
CheckOpenGLErrors(@"OOQuiriumCascadeEntity after drawing %@", self);
}
- (BOOL) isParticle
{
return YES;
}
- (BOOL) isCascadeWeapon
{
return YES;
}
- (BOOL) canCollide
{
return _timePassed > kQuiriumCollisionDelay;
}
- (BOOL) checkCloseCollisionWith:(Entity *)other
{
return YES;
}
@end
@implementation Entity (OOQuiriumCascadeExtensions)
- (BOOL) isCascadeWeapon
{
return NO;
}
@end

View File

@ -30,9 +30,6 @@ MA 02110-1301, USA.
#import "OOMaths.h"
#define SUPPORT_BILLBOARD 0
@class OOTexture;
@ -44,11 +41,9 @@ MA 02110-1301, USA.
GLfloat color_fv[4];
GLfloat alpha;
OOTimeDelta time_counter;
OOTimeDelta time_counter;
OOTimeDelta duration;
OOTimeDelta activation_time;
double growth_rate;
GLfloat ring_inner_radius, ring_outer_radius;
@ -57,13 +52,9 @@ MA 02110-1301, USA.
NSSize size;
}
- (id) initEnergyMineFromShip:(ShipEntity *) ship;
- (id) initHyperringFromShip:(ShipEntity *) ship;
- (id) initFragburstSize:(GLfloat) fragSize fromPosition:(Vector) fragPos;
- (id) initBurst2Size:(GLfloat) burstSize fromPosition:(Vector) fragPos;
#if SUPPORT_BILLBOARD
- (id) initBillboard:(NSSize) billSize withTexture:(NSString*) textureFile;
#endif
- (void) setColor:(OOColor *) a_color;
@ -78,6 +69,5 @@ MA 02110-1301, USA.
@interface Entity (OOParticleExtensions)
- (BOOL) isParticle;
- (BOOL) isCascadeWeapon;
@end

View File

@ -48,10 +48,6 @@ typedef enum
{
PARTICLE_FRAGBURST = 250,
PARTICLE_BURST2 = 270,
PARTICLE_ENERGY_MINE = 500,
#if SUPPORT_BILLBOARD
PARTICLE_BILLBOARD = 700,
#endif
PARTICLE_HYPERRING = 800
} OOParticleType;
@ -63,19 +59,14 @@ typedef enum
@interface ParticleEntity (OOPrivate)
- (void) updateEnergyMine:(double) delta_t;
- (void) updateSpark:(double) delta_t;
- (void) updateHyperring:(double) delta_t;
- (void) updateFragburst:(double) delta_t;
- (void) updateBurst2:(double) delta_t;
- (void) drawHyperring;
- (void) drawEnergyMine;
- (void) drawFragburst;
- (void) drawBurst2;
#if SUPPORT_BILLBOARD
- (void) drawBillboard;
#endif
- (void) setTexture:(NSString *) filename;
- (void) setParticleType:(OOParticleType) p_type;
@ -84,10 +75,10 @@ typedef enum
@end
OOINLINE void BeginAdditiveBlending(BOOL withGL_ONE)
OOINLINE void BeginAdditiveBlending(void)
{
OOGL(glEnable(GL_BLEND));
OOGL(glBlendFunc(GL_SRC_ALPHA, withGL_ONE ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA));
OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
}
@ -95,9 +86,6 @@ OOINLINE void EndAdditiveBlending(void)
{
}
#define GL_ONE_YES YES
#define GL_ONE_NO NO
static void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat xx, GLfloat yy);
@ -136,39 +124,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
}
- (id) initEnergyMineFromShip:(ShipEntity *) ship
{
if (ship == nil)
{
[self release];
return nil;
}
if ((self = [super init]))
{
time_counter = 0.0;
duration = 20.0;
position = ship->position;
[self setVelocity: kZeroVector];
[self setColor:[OOColor blueColor]];
alpha = 0.5;
collision_radius = 0;
[self setStatus:STATUS_EFFECT];
scanClass = CLASS_MINE;
particle_type = PARTICLE_ENERGY_MINE;
[self setOwner:[ship owner]];
}
return self;
}
- (id) initHyperringFromShip:(ShipEntity *) ship
{
if (ship == nil)
@ -306,44 +261,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
}
#if SUPPORT_BILLBOARD
// used for background billboards
- (id) initBillboard:(NSSize) billSize withTexture:(NSString*) textureFile
{
if ((self = [super init]))
{
basefile = @"Particle";
[self setTexture:textureFile];
if (texture == nil)
{
[self release];
return nil;
}
size = billSize;
time_counter = 0.0;
duration = 0.0; //infinite
[self setColor:[OOColor whiteColor]];
color_fv[3] = 1.0;
[self setStatus:STATUS_EFFECT];
scanClass = CLASS_NO_DRAW;
particle_type = PARTICLE_BILLBOARD;
collision_radius = 0;
energy = 0;
[self setVelocity: kZeroVector];
[self setPosition: make_vector(0.0f, 0.0f, 640.0f)];
}
return self;
}
#endif
- (void) dealloc
{
[texture release];
@ -362,10 +279,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
#define CASE(x) case x: type_string = @#x; break;
CASE(PARTICLE_FRAGBURST);
CASE(PARTICLE_BURST2);
CASE(PARTICLE_ENERGY_MINE);
#if SUPPORT_BILLBOARD
CASE(PARTICLE_BILLBOARD);
#endif
CASE(PARTICLE_HYPERRING);
}
if (type_string == nil) type_string = [NSString stringWithFormat:@"UNKNOWN (%i)", particle_type];
@ -379,20 +292,13 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
- (BOOL) canCollide
{
if (particle_type == PARTICLE_ENERGY_MINE)
{
return time_counter > 0.05;
}
return NO;
}
- (BOOL) checkCloseCollisionWith:(Entity *)other
{
if (particle_type == PARTICLE_ENERGY_MINE)
return YES;
if (other == [self owner])
return NO;
if (other == [self owner]) return NO;
return ![other isParticle];
}
@ -483,10 +389,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
case PARTICLE_HYPERRING:
[self updateHyperring:delta_t];
break;
case PARTICLE_ENERGY_MINE:
[self updateEnergyMine:delta_t];
break;
case PARTICLE_FRAGBURST:
[self updateFragburst:delta_t];
@ -495,65 +397,12 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
case PARTICLE_BURST2:
[self updateBurst2:delta_t];
break;
#if SUPPORT_BILLBOARD
case PARTICLE_BILLBOARD:
break;
#endif
default:
OOLog(@"particle.unknown", @"Invalid particle %@, removing.", self);
[UNIVERSE removeEntity:self];
}
}
}
- (void) updateEnergyMine:(double) delta_t
{
// new billboard routine (working at last!)
PlayerEntity *player = PLAYER;
assert(player != nil);
rotMatrix = OOMatrixForBillboard(position, [player position]);
GLfloat tf = time_counter / duration;
GLfloat stf = tf * tf;
GLfloat expansion_speed = 0.0;
if (time_counter > 0)
expansion_speed = 240 + 10 / (tf * tf);
if (expansion_speed > 1000.0)
expansion_speed = 1000.0;
velocity.z = expansion_speed;
collision_radius += delta_t * expansion_speed; // expand
// energy = 10000 - 9000 * tf; // 10000 -> 1000
energy = delta_t * (100000 - 90000 * tf); // adjusted to take into account delta_t
alpha = 0.5 * ((0.025 / tf) + 1.0 - stf);
if (alpha > 1.0) alpha = 1.0;
color_fv[0] = 1.0 - 5.0 * tf;
if (color_fv[0] > 1.0) color_fv[0] = 1.0;
if (color_fv[0] < 0.0) color_fv[0] = 0.25 * tf * randf();
color_fv[1] = 1.0 - 5.0 * tf;
if (color_fv[1] > 1.0) color_fv[1] = 1.0;
if (color_fv[1] < 0.0) color_fv[1] = 0.0;
// manageCollisions
if ([collidingEntities count] > 0)
{
unsigned i;
for (i = 0; i < [collidingEntities count]; i++)
{
Entity * e = (Entity *)[collidingEntities objectAtIndex:i];
[e takeEnergyDamage:energy from:self becauseOf:[self owner]];
}
}
// expire after ttl
if (time_counter > duration) // until the timer runs out!
[UNIVERSE removeEntity:self];
}
@ -648,10 +497,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
[self drawHyperring];
break;
case PARTICLE_ENERGY_MINE:
[self drawEnergyMine];
break;
case PARTICLE_FRAGBURST:
[self drawFragburst];
break;
@ -660,12 +505,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
[self drawBurst2];
break;
#if SUPPORT_BILLBOARD
case PARTICLE_BILLBOARD:
[self drawBillboard];
break;
#endif
default:
OOLog(@"particle.unknown", @"Invalid particle %@, removing.", self);
[UNIVERSE removeEntity:self];
@ -692,7 +531,7 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
OOGL(glDisable(GL_TEXTURE_2D));
OOGL(glShadeModel(GL_SMOOTH));
BeginAdditiveBlending(GL_ONE_YES);
BeginAdditiveBlending();
// movies:
// draw data required ring_inner_radius, ring_outer_radius
@ -713,35 +552,13 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
}
- (void) drawEnergyMine
{
double szd = sqrt(zero_distance);
color_fv[3] = alpha; // set alpha
OOGL(glDisable(GL_CULL_FACE)); // face culling
OOGL(glDisable(GL_TEXTURE_2D));
BeginAdditiveBlending(GL_ONE_YES);
int step = 4;
OOGL(glColor4fv(color_fv));
OOGLBEGIN(GL_TRIANGLE_FAN);
GLDrawBallBillboard(collision_radius, step, szd);
OOGLEND();
EndAdditiveBlending();
}
- (void) drawFragburst
{
OOGL(glEnable(GL_TEXTURE_2D));
[texture apply];
OOGL(glPushMatrix());
BeginAdditiveBlending(GL_ONE_YES);
BeginAdditiveBlending();
OOGLBEGIN(GL_QUADS);
OOMeshVertexCount i;
@ -764,7 +581,7 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
[texture apply];
OOGL(glPushMatrix());
BeginAdditiveBlending(GL_ONE_YES);
BeginAdditiveBlending();
OOGLBEGIN(GL_QUADS);
OOMeshVertexCount i;
@ -781,23 +598,6 @@ static Vector circleVertex[65]; // holds vector coordinates for a unit circle
}
#if SUPPORT_BILLBOARD
- (void) drawBillboard
{
OOGL(glColor4fv(color_fv));
OOGL(glEnable(GL_TEXTURE_2D));
[texture apply];
OOGL(glPushMatrix());
OOGLBEGIN(GL_QUADS);
DrawQuadForView(position.x, position.y, position.z, size.width, size.height);
OOGLEND();
OOGL(glPopMatrix());
}
#endif
static void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat xx, GLfloat yy)
{
int viewdir = [UNIVERSE viewDirection];
@ -854,12 +654,6 @@ static void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat xx, GLfloat
}
- (BOOL) isCascadeWeapon
{
return particle_type == PARTICLE_ENERGY_MINE;
}
#ifndef NDEBUG
- (NSSet *) allTextures
{
@ -884,10 +678,4 @@ static void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat xx, GLfloat
return NO;
}
- (BOOL) isCascadeWeapon
{
return NO;
}
@end

View File

@ -31,11 +31,12 @@ MA 02110-1301, USA.
#import "PlayerEntitySound.h"
#import "StationEntity.h"
#import "ParticleEntity.h"
#import "OOSunEntity.h"
#import "OOPlanetEntity.h"
#import "WormholeEntity.h"
#import "ProxyPlayerEntity.h"
#import "OOQuiriumCascadeEntity.h"
#import "OOMesh.h"
#import "OOMaths.h"
#import "GameController.h"

View File

@ -43,7 +43,6 @@ MA 02110-1301, USA.
#import "OOSunEntity.h"
#import "OOPlanetEntity.h"
#import "OOPlanetEntity.h"
#import "ParticleEntity.h"
#import "StationEntity.h"
#import "Comparison.h"
#import "OOLegacyScriptWhitelist.h"
@ -2658,43 +2657,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
return YES;
}
//
// Add billboard model:
//
if ([i_key isEqualToString:@"billboard"])
{
#if SUPPORT_BILLBOARD
if ([i_info count] != 6) // must be billboard_imagefile_x_y_w_h
return NO; // 0........ 1........ 2 3 4 5
NSString* texturefile = (NSString*)[i_info objectAtIndex:1];
NSSize billSize = NSMakeSize([[i_info objectAtIndex:4] floatValue], [[i_info objectAtIndex:5] floatValue]);
Vector model_p0;
model_p0.x = [[i_info objectAtIndex:2] floatValue] + off.x;
model_p0.y = [[i_info objectAtIndex:3] floatValue] + off.y;
model_p0.z = off.z;
ParticleEntity* billboard = [[ParticleEntity alloc] initBillboard:billSize withTexture:texturefile];
if (!billboard)
return NO;
[billboard setPosition:vector_add([billboard position], model_p0)];
OOLog(kOOLogDebugProcessSceneStringAddBillboard, @"::::: adding billboard:'%@' to scene.", billboard);
[UNIVERSE addEntity: billboard];
[UNIVERSE setMainLightPosition:(Vector){ DEMO_LIGHT_POSITION }]; // set light origine
[billboard setStatus: STATUS_COCKPIT_DISPLAY];
[billboard release];
return YES;
#else
OOLogERR(@"scene.billboard", @"Scene billboards are disabled because Ahruman thought no-one was using them.");
#endif
}
//
// fall through..
return NO;
}

View File

@ -72,6 +72,7 @@ MA 02110-1301, USA.
#import "OOFlashEffectEntity.h"
#import "ProxyPlayerEntity.h"
#import "OOLaserShotEntity.h"
#import "OOQuiriumCascadeEntity.h"
#import "PlayerEntityLegacyScriptEngine.h"
#import "PlayerEntitySound.h"
@ -6149,10 +6150,9 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
// Exposed to AI
- (void) becomeEnergyBlast
{
ParticleEntity* blast = [[ParticleEntity alloc] initEnergyMineFromShip:self];
ParticleEntity* blast = [OOQuiriumCascadeEntity quiriumCascadeFromShip:self];
[UNIVERSE addEntity:blast];
[blast setOwner: [self owner]];
[blast release];
[blast setOwner:[self owner]];
[UNIVERSE removeEntity:self];
}
@ -8665,10 +8665,9 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q
// ...start a chain reaction, if we're dying and have a non-trivial amount of energy.
if (energy < amount && energy > 10 && [self countsAsKill])
{
ParticleEntity *chainReaction = [[ParticleEntity alloc] initEnergyMineFromShip:self];
ParticleEntity *chainReaction = [OOQuiriumCascadeEntity quiriumCascadeFromShip:self];
[UNIVERSE addEntity:chainReaction];
[chainReaction setOwner:owner];
[chainReaction release];
}
break;
//no default thanks, we want the compiler to tell us if we missed a case.

View File

@ -33,8 +33,8 @@ MA 02110-1301, USA.
#import "PlayerEntityLegacyScriptEngine.h"
#import "OOLegacyScriptWhitelist.h"
#import "OOPlanetEntity.h"
#import "ParticleEntity.h"
#import "OOShipGroup.h"
#import "OOQuiriumCascadeEntity.h"
#import "AI.h"
#import "OOCharacter.h"
@ -1463,7 +1463,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
{
//...get angry
BOOL isEnergyMine = (ent && [ent isParticle] && [ent scanClass] == CLASS_MINE);
BOOL isEnergyMine = [ent isCascadeWeapon];
unsigned b=isEnergyMine ? 96 : 64;
if ([(ShipEntity*)other bounty] >= b) //already a hardened criminal?
{

View File

@ -459,7 +459,7 @@ static void DrawWormholeCorona(GLfloat inner_radius, GLfloat outer_radius, int s
if (translucent)
{
// for now, a simple copy of the energy bomb draw routine
double srzd = sqrt(zero_distance);
float srzd = sqrtf(zero_distance);
GLfloat color_fv[4] = { 0.0, 0.0, 1.0, 0.25};

View File

@ -30,7 +30,6 @@ MA 02110-1301, USA.
#import "OOTypes.h"
#import "OOMaths.h"
#import "MyOpenGLView.h"
#import "ParticleEntity.h"
#import "ShipEntity.h"
@class OOCrosshairs, OOColor;

View File

@ -28,6 +28,7 @@ MA 02110-1301, USA.
#import "OOSunEntity.h"
#import "OOPlanetEntity.h"
#import "StationEntity.h"
#import "OOQuiriumCascadeEntity.h"
#import "Universe.h"
#import "OOTrumble.h"
#import "OOColor.h"
@ -855,7 +856,7 @@ static BOOL hostiles;
{
DrawSpecialOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(16.0 * (1.0 - ms_blip), 8.0 * (1.0 - ms_blip)), 30, col);
}
if ([drawthing isParticle] && (drawClass == CLASS_MINE))
if ([drawthing isCascadeWeapon])
{
double r1 = 2.5 + drawthing->collision_radius * upscale;
double l2 = r1*r1 - relativePosition.y*relativePosition.y;