Cleaned up some junk, and added missing files to makefile.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2605 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
09843c8073
commit
251bdb1b07
@ -106,7 +106,10 @@ OOLITE_ENTITY_FILES = \
|
||||
OOFlasherEntity.m \
|
||||
OOExhaustPlumeEntity.m \
|
||||
OOSparkEntity.m \
|
||||
OOECMBlastEntity.m
|
||||
OOECMBlastEntity.m \
|
||||
OOPlasmaShotEntity.m \
|
||||
OOPlasmaBurstEntity.m \
|
||||
OOFlashEffectEntity.m
|
||||
|
||||
OOLITE_GRAPHICS_DRAWABLE_FILES = \
|
||||
OODrawable.m \
|
||||
|
@ -30,13 +30,9 @@ MA 02110-1301, USA.
|
||||
#import "OOMaths.h"
|
||||
|
||||
#define PARTICLE_LASER_DURATION 0.20
|
||||
#define PARTICLE_LASER_LENGTH 10000.0
|
||||
#define PARTICLE_LASER_RANGE_LIMIT 1000000000.0
|
||||
|
||||
#define LASER_FLASH_SIZE (1.0 + 2.0 * randf())
|
||||
|
||||
|
||||
#define OLD_FLASH 0
|
||||
#define SUPPORT_BILLBOARD 0
|
||||
|
||||
|
||||
@class OOTexture;
|
||||
@ -68,11 +64,9 @@ MA 02110-1301, USA.
|
||||
- (id) initHyperringFromShip:(ShipEntity *) ship;
|
||||
- (id) initFragburstSize:(GLfloat) fragSize fromPosition:(Vector) fragPos;
|
||||
- (id) initBurst2Size:(GLfloat) burstSize fromPosition:(Vector) fragPos;
|
||||
#if OLD_FLASH
|
||||
- (id) initFlashSize:(GLfloat) burstSize fromPosition:(Vector) fragPos;
|
||||
//- (id) initFlashSize:(GLfloat) flashSize fromPosition:(Vector) fragPos color:(OOColor*) flashColor;
|
||||
#endif
|
||||
#if SUPPORT_BILLBOARD
|
||||
- (id) initBillboard:(NSSize) billSize withTexture:(NSString*) textureFile;
|
||||
#endif
|
||||
|
||||
- (void) setColor:(OOColor *) a_color;
|
||||
|
||||
|
@ -37,7 +37,7 @@ MA 02110-1301, USA.
|
||||
|
||||
|
||||
/* Entities that can easily be migrated to OOLightParticleEntity:
|
||||
PARTICLE_FRAGBURST
|
||||
PARTICLE_FRAGBURST?
|
||||
PARTICLE_BURST2?
|
||||
*/
|
||||
|
||||
@ -48,11 +48,18 @@ typedef enum
|
||||
PARTICLE_FRAGBURST = 250,
|
||||
PARTICLE_BURST2 = 270,
|
||||
PARTICLE_ENERGY_MINE = 500,
|
||||
#if SUPPORT_BILLBOARD
|
||||
PARTICLE_BILLBOARD = 700,
|
||||
#endif
|
||||
PARTICLE_HYPERRING = 800
|
||||
} OOParticleType;
|
||||
|
||||
|
||||
#if OOLITE_LEOPARD
|
||||
#define OOPrivate // Turn private category into a continuation where possible.
|
||||
#endif
|
||||
|
||||
|
||||
@interface ParticleEntity (OOPrivate)
|
||||
|
||||
- (void) updateEnergyMine:(double) delta_t;
|
||||
@ -61,16 +68,16 @@ typedef enum
|
||||
- (void) updateHyperring:(double) delta_t;
|
||||
- (void) updateFragburst:(double) delta_t;
|
||||
- (void) updateBurst2:(double) delta_t;
|
||||
- (void) updateExhaust2:(double) delta_t;
|
||||
|
||||
- (void) drawParticle;
|
||||
- (void) drawLaser;
|
||||
- (void) drawExhaust2;
|
||||
- (void) drawHyperring;
|
||||
- (void) drawEnergyMine;
|
||||
- (void) drawFragburst;
|
||||
- (void) drawBurst2;
|
||||
#if SUPPORT_BILLBOARD
|
||||
- (void) drawBillboard;
|
||||
#endif
|
||||
|
||||
- (void) setTexture:(NSString *) filename;
|
||||
- (void) setParticleType:(OOParticleType) p_type;
|
||||
@ -79,37 +86,19 @@ typedef enum
|
||||
@end
|
||||
|
||||
|
||||
#ifndef ADDITIVE_BLENDING
|
||||
#define ADDITIVE_BLENDING 1
|
||||
#endif
|
||||
|
||||
#if ADDITIVE_BLENDING
|
||||
static inline void BeginAdditiveBlending(BOOL withGL_ONE)
|
||||
OOINLINE void BeginAdditiveBlending(BOOL withGL_ONE)
|
||||
{
|
||||
// OOGL(glPushAttrib(GL_COLOR_BUFFER_BIT));
|
||||
OOGL(glEnable(GL_BLEND));
|
||||
if (withGL_ONE)
|
||||
{
|
||||
OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
|
||||
}
|
||||
else
|
||||
{
|
||||
OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
|
||||
}
|
||||
OOGL(glBlendFunc(GL_SRC_ALPHA, withGL_ONE ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA));
|
||||
}
|
||||
|
||||
|
||||
static inline void EndAdditiveBlending(void)
|
||||
OOINLINE void EndAdditiveBlending(void)
|
||||
{
|
||||
// OOGL(glPopAttrib()); // Handled by "master" pop in drawEntity:
|
||||
}
|
||||
|
||||
#define GL_ONE_YES YES
|
||||
#define GL_ONE_NO NO
|
||||
#else
|
||||
#define BeginAdditiveBlending(x) do {} while (0)
|
||||
#define EndAdditiveBlending() do {} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
static void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat xx, GLfloat yy);
|
||||
@ -397,6 +386,7 @@ FAIL:
|
||||
}
|
||||
|
||||
|
||||
#if SUPPORT_BILLBOARD
|
||||
// used for background billboards
|
||||
- (id) initBillboard:(NSSize) billSize withTexture:(NSString*) textureFile
|
||||
{
|
||||
@ -431,6 +421,7 @@ FAIL:
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
- (void) dealloc
|
||||
@ -453,7 +444,9 @@ FAIL:
|
||||
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];
|
||||
@ -587,9 +580,11 @@ FAIL:
|
||||
case PARTICLE_BURST2:
|
||||
[self updateBurst2:delta_t];
|
||||
break;
|
||||
|
||||
|
||||
#if SUPPORT_BILLBOARD
|
||||
case PARTICLE_BILLBOARD:
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
OOLog(@"particle.unknown", @"Invalid particle %@, removing.", self);
|
||||
@ -768,9 +763,11 @@ FAIL:
|
||||
[self drawBurst2];
|
||||
break;
|
||||
|
||||
#if SUPPORT_BILLBOARD
|
||||
case PARTICLE_BILLBOARD:
|
||||
[self drawBillboard];
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
[self drawParticle];
|
||||
@ -1038,6 +1035,7 @@ FAIL:
|
||||
}
|
||||
|
||||
|
||||
#if SUPPORT_BILLBOARD
|
||||
- (void) drawBillboard
|
||||
{
|
||||
OOGL(glColor4fv(color_fv));
|
||||
@ -1051,6 +1049,7 @@ FAIL:
|
||||
|
||||
OOGL(glPopMatrix());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat xx, GLfloat yy)
|
||||
|
@ -2588,6 +2588,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
//
|
||||
if ([i_key isEqual:@"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
|
||||
|
||||
@ -2612,6 +2613,9 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
[billboard release];
|
||||
return YES;
|
||||
#else
|
||||
OOLogERR(@"scene.billboard", @"Scene billboards are disabled because Ahruman thought no-one was using them.");
|
||||
#endif
|
||||
}
|
||||
//
|
||||
// fall through..
|
||||
|
@ -5134,34 +5134,14 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
|
||||
|
||||
- (void)subEntityReallyDied:(ShipEntity *)sub
|
||||
{
|
||||
NSMutableArray *newSubs = nil;
|
||||
unsigned i, count;
|
||||
id element;
|
||||
|
||||
if ([self subEntityTakingDamage] == sub) [self setSubEntityTakingDamage:nil];
|
||||
|
||||
if ([self hasSubEntity:sub])
|
||||
{
|
||||
OOLogERR(@"shipEntity.bug.subEntityRetainUnderflow", @"Subentity died while still in subentity list! This is bad. Leaking subentity list to avoid crash. This is an internal error, please report it.");
|
||||
OOLogERR(@"shipEntity.bug.subEntityRetainUnderflow", @"Subentity of %@ died while still in subentity list! This is bad. Leaking subentity list to avoid crash. This is an internal error, please report it.", self);
|
||||
|
||||
count = [subEntities count];
|
||||
if (count != 1)
|
||||
{
|
||||
newSubs = [[NSMutableArray alloc] initWithCapacity:count - 1];
|
||||
for (i = 0; i != count; ++i)
|
||||
{
|
||||
element = [subEntities objectAtIndex:i];
|
||||
if (element != sub)
|
||||
{
|
||||
[newSubs addObject:element];
|
||||
// NOTE: next line causes a static analysis issue, but is intentional. -- Ahruman 2009-09-18
|
||||
[element release]; // Let it die later, even though there's a reference in the leaked array.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Leak old array, replace with new.
|
||||
subEntities = newSubs;
|
||||
// Leak subentity list.
|
||||
subEntities = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user