Tiny tweaks: renamed AI methods scanFor{Nearest|Random}Merchantmen to ...Merchantman (with compatibility aliases). Removed all Light 0 stuff from shaders. Belatedly bumped cache format version for changed dust shader.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3314 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-05-09 23:13:12 +00:00
parent 1d7b85b918
commit 084248f98f
8 changed files with 19 additions and 49 deletions

View File

@ -162,7 +162,7 @@
"ODDS_GOOD" = (groupAttackTarget);
"CARGO_SCOOPED" = ("setStateTo: CHECK_CARGO");
RESTARTED = ("setStateTo: LURK");
UPDATE = (scanForRandomMerchantmen, "pauseAI: 10.0");
UPDATE = (scanForRandomMerchantman, "pauseAI: 10.0");
};
LURK = {
ENTER = ("setSpeedTo: 0.0", performIdle);
@ -177,7 +177,7 @@
"ODDS_LEVEL" = (groupAttackTarget);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"ENTER WORMHOLE" = ("setStateTo: ENTER_WORMHOLE");
UPDATE = (scanForRandomMerchantmen, "pauseAI: 5.0");
UPDATE = (scanForRandomMerchantman, "pauseAI: 5.0");
};
"SCAN_FOR_LOOT" = {
ENTER = ("setSpeedTo: 0.0", performIdle);
@ -197,7 +197,7 @@
"setSpeedFactorTo: 0.75",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (scanForRandomMerchantmen);
"DESIRED_RANGE_ACHIEVED" = (scanForRandomMerchantman);
"NOTHING_FOUND" = ("setStateTo: TRAVEL_TO_LURK_AREA");
"TARGET_FOUND" = (groupAttackTarget);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");

View File

@ -1,7 +1,7 @@
/* List of roles pirates will attack.
Ships whose primary role is among those listed can be located with the AI
methods scanForNearestMerchantmen and scanForRandomMerchantmen. They can
methods scanForNearestMerchantman and scanForRandomMerchantman. They can
also be identified with the JavaScript property isPirateVictim.
*/

View File

@ -98,8 +98,8 @@
"performHold",
"setTargetToPrimaryAggressor",
"performAttack",
"scanForNearestMerchantmen",
"scanForRandomMerchantmen",
"scanForNearestMerchantman",
"scanForRandomMerchantman",
"scanForLoot",
"scanForRandomLoot",
"setTargetToFoundTarget",
@ -438,5 +438,7 @@
"setStateMachine:" = "setAITo:";
"launchTrader" = ("launchIndependentShip:", "trader");
"launchIndependentShipWithRole:" = "launchIndependentShip:";
"scanForNearestMerchantmen" = "scanForNearestMerchantman";
"scanForRandomMerchantmen" = "scanForRandomMerchantman";
};
}

View File

@ -78,10 +78,6 @@
#define OOSTD_EMISSION_AND_ILLUMINATION_MAP 0
#endif
#ifndef OO_LIGHT_0_FIX
#define OO_LIGHT_0_FIX 0
#endif
#if OOSTD_EMISSION_AND_ILLUMINATION_MAP && !OOSTD_EMISSION_MAP
#undef OOSTD_EMISSION_MAP
@ -116,10 +112,6 @@ varying vec3 vEyeVector;
varying vec2 vTexCoord;
#if OO_LIGHT_0_FIX
varying vec3 vLight0Vector;
#endif
varying vec3 vLight1Vector;
#if OOSTD_DIFFUSE_MAP && !OOSTD_DIFFUSE_MAP_IS_CUBE_MAP
@ -253,10 +245,7 @@ void main(void)
#endif
// Get light vectors
#if OO_LIGHT_0_FIX
vec3 light0Vector = normalize(vLight0Vector);
#endif
vec3 light1Vector = normalize(vLight1Vector);
vec3 lightVector = normalize(vLight1Vector);
// Get ambient colour
vec4 ambientLight = gl_LightModel.ambient;
@ -290,10 +279,7 @@ void main(void)
#endif
vec4 diffuseLight = vec4(0);
#if OO_LIGHT_0_FIX
diffuseLight += CalcDiffuseLight(light0Vector, normal, gl_LightSource[0].diffuse);
#endif
diffuseLight += CalcDiffuseLight(light1Vector, normal, gl_LightSource[1].diffuse);
diffuseLight += CalcDiffuseLight(lightVector, normal, gl_LightSource[1].diffuse);
#if HAVE_ILLUMINATION
diffuseLight += illuminationMapLight;
@ -310,17 +296,11 @@ void main(void)
#endif
// Calculate specular light
#if OOSTD_SPECULAR && OO_LIGHT_0_FIX
#define SPECULAR_LIGHT_0 specularLight += CalcSpecularLight(light0Vector, eyeVector, exponent, normal, gl_LightSource[0].specular)
#else
#define SPECULAR_LIGHT_0
#endif
#if OOSTD_SPECULAR
vec4 specularLight = vec4(0);
float exponent = gl_FrontMaterial.shininess;
APPLY_MAPPED_EXPONENT;
SPECULAR_LIGHT_0;
specularLight += CalcSpecularLight(light1Vector, eyeVector, exponent, normal, gl_LightSource[1].specular);
specularLight += CalcSpecularLight(lightVector, eyeVector, exponent, normal, gl_LightSource[1].specular);
specularLight.a = 1.0;
#endif

View File

@ -26,17 +26,9 @@
attribute vec3 tangent;
#ifndef OO_LIGHT_0_FIX
#define OO_LIGHT_0_FIX 0
#endif
// No vNormal, because normal is always 0,0,1 in tangent space.
varying vec3 vEyeVector;
varying vec2 vTexCoord;
#if OO_LIGHT_0_FIX
varying vec3 vLight0Vector;
#endif
varying vec3 vLight1Vector;
#ifndef OOSTD_DIFFUSE_MAP_IS_CUBE_MAP
@ -60,13 +52,8 @@ void main(void)
vec3 eyeVector = -vec3(gl_ModelViewMatrix * gl_Vertex);
vEyeVector = eyeVector * TBN;
#if OO_LIGHT_0_FIX
vec3 light0Vector = gl_LightSource[0].position.xyz + eyeVector;
vLight0Vector = light0Vector * TBN;
#endif
vec3 light1Vector = gl_LightSource[1].position.xyz + eyeVector;
vLight1Vector = light1Vector * TBN;
vec3 lightVector = gl_LightSource[1].position.xyz + eyeVector;
vLight1Vector = lightVector * TBN;
vTexCoord = gl_MultiTexCoord0.st;

View File

@ -100,8 +100,8 @@ MA 02110-1301, USA.
- (void) performAttack;
- (void) scanForNearestMerchantmen;
- (void) scanForRandomMerchantmen;
- (void) scanForNearestMerchantman;
- (void) scanForRandomMerchantman;
- (void) scanForLoot;
@ -486,7 +486,7 @@ MA 02110-1301, USA.
}
- (void) scanForNearestMerchantmen
- (void) scanForNearestMerchantman
{
float d2, found_d2;
unsigned i;
@ -521,7 +521,7 @@ MA 02110-1301, USA.
}
- (void) scanForRandomMerchantmen
- (void) scanForRandomMerchantman
{
unsigned n_found, i;

View File

@ -75,7 +75,7 @@ static NSString * const kCacheKeyCaches = @"caches";
enum
{
kEndianTagValue = 0x0123456789ABCDEFULL,
kFormatVersionValue = 37
kFormatVersionValue = 38
};

View File

@ -118,6 +118,7 @@ void InitOOJSMission(JSContext *context, JSObject *global)
OO_AddJSGCRoot(context, &sCallbackThis, "Pending mission callback this");
}
void MissionRunCallback()
{
// don't do anything if we don't have a function.