A mixed bag:

* change: specifically setting empty comms_log_gui & message_gui sections inside hud plists now resets those guis to Oolite's default. Updated standard huds accordingly.
 * bugfix: fixed crash with malformed gui declarations inside hud plists - trunk & maintenance.
 * change: internal name of commodity identifiers normalised: 'liquor/wines', 'alien items', 'gem-stones' are now expressed internally as 'liguor_wines', 'alien_items' and 'gem_stones' - in most cases the old identifiers are still recognised, for backward compatibility.
 - linux build and windows build directories separated, both can now share the same source directory without build conflicts.
 - updated copyright notice in shaders files, minor planet drawable cleanup.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4826 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2012-04-01 13:27:36 +00:00
parent 2c2e3b416a
commit b353faef84
15 changed files with 85 additions and 79 deletions

View File

@ -5,17 +5,20 @@ vpath %.m src/SDL:src/Core:src/Core/Entities:src/Core/Materials:src/Core/Scripti
vpath %.h src/SDL:src/Core:src/Core/Entities:src/Core/Materials:src/Core/Scripting:src/Core/OXPVerifier:src/Core/Debug
vpath %.c src/SDL:src/Core:src/BSDCompat:src/Core/Debug
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT)
ifeq ($(GNUSTEP_HOST_OS),mingw32)
GNUSTEP_OBJ_DIR_NAME := $(GNUSTEP_OBJ_DIR_NAME).win
endif
GNUSTEP_OBJ_DIR_BASENAME := $(GNUSTEP_OBJ_DIR_NAME)
HOST_ARCH := $(shell echo $(GNUSTEP_HOST_CPU) | sed -e s/i.86/x86/ -e s/amd64/x86_64/ )
ifeq ($(GNUSTEP_HOST_OS),mingw32)
JS_INCLUDE_DIR = deps/Windows-x86-deps/JS32ECMAv5/include
JS_INC_DIR = deps/Windows-x86-deps/JS32ECMAv5/include
JS_LIB_DIR = deps/Windows-x86-deps/JS32ECMAv5/lib
ifeq ($(debug),yes)
JS_IMPORT_LIBRARY = js32ECMAv5dbg
else
JS_IMPORT_LIBRARY = js32ECMAv5
endif
ADDITIONAL_INCLUDE_DIRS = -Ideps/Windows-x86-deps/include -I$(JS_INCLUDE_DIR) -Isrc/SDL -Isrc/Core -Isrc/BSDCompat -Isrc/Core/Scripting -Isrc/Core/Materials -Isrc/Core/Entities -Isrc/Core/OXPVerifier -Isrc/Core/Debug -Isrc/Core/Tables
ADDITIONAL_INCLUDE_DIRS = -Ideps/Windows-x86-deps/include -I$(JS_INC_DIR) -Isrc/SDL -Isrc/Core -Isrc/BSDCompat -Isrc/Core/Scripting -Isrc/Core/Materials -Isrc/Core/Entities -Isrc/Core/OXPVerifier -Isrc/Core/Debug -Isrc/Core/Tables
ADDITIONAL_OBJC_LIBS = -lglu32 -lopengl32 -lpng14.dll -lmingw32 -lSDLmain -lSDL -lSDL_mixer -lgnustep-base -l$(JS_IMPORT_LIBRARY) -lwinmm -mwindows
ADDITIONAL_CFLAGS = -DWIN32 -DNEED_STRLCPY `sdl-config --cflags`
# note the vpath stuff above isn't working for me, so adding src/SDL and src/Core explicitly

View File

@ -222,7 +222,8 @@
width = 8;
}
);
message_gui = {}; // resets the default settings
comm_log_gui = {}; // resets the default settings
overall_alpha = 0.75;
reticle_target_sensitive = no;
cloak_indicator_on_status_light = yes;

View File

@ -292,7 +292,8 @@
width = 9;
}
);
message_gui = {}; // resets the default settings
comm_log_gui = {}; // resets the default settings
overall_alpha = 0.75;
reticle_target_sensitive = no;
cloak_indicator_on_status_light = yes;

View File

@ -3,7 +3,7 @@
Default fragment shader for Oolite NEW_PLANETS.
Copyright © 20092012 Jens Ayton
© 20092012 Jens Ayton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -2,23 +2,24 @@
oolite-default-planet.vertex
Default vertex shader for Oolite's NEW_PLANETS
Copyright © 20092012 Jens Ayton
© 20092012 Jens Ayton
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.
*/
*/
// No vNormal, because normal is always 0,0,1 in tangent space.
varying vec3 vEyeVector;

View File

@ -2,13 +2,14 @@
oolite-default-shader.fragment
Default fragment shader for Oolite ships.
© 20072012 Jens Ayton
This is similar to normal ship shaders, but has special controlling
macros (like OOSTD_DIFFUSE_MAP, OOSTD_SPECULAR etc.) which are specific
to the default shader.
Copyright © 20072011 Jens Ayton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights

View File

@ -1,21 +1,20 @@
/*
oolite-dust.fragment
Fragment shader for interplanetary dust.
© 2010 Jens Ayton
© 2010-2012 Jens Ayton
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,

View File

@ -1,21 +1,20 @@
/*
oolite-dust.vertex
Vertex shader for interplanetary dust.
© 2010-2012 Jens Ayton
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,

View File

@ -3,23 +3,23 @@
Basic vertex shader for Oolite ships.
© 2007 Jens Ayton
© 2007-2012 Jens Ayton
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.
*/
S*/
varying vec3 vNormal;
varying vec3 vEyeVector;

View File

@ -2,7 +2,8 @@
oolite-tangent-space-vertex.vertex
Basic vertex shader for Oolite ships using tangent-space effects.
Copyright © 2008 Jens Ayton
© 2008-2012 Jens Ayton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1121,6 +1121,8 @@ static GLfloat sBaseMass = 0.0;
target_memory_index = 0;
dockingReport = [[NSMutableString alloc] init];
[hud resetGuis:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:nil], @"message_gui",
[NSDictionary dictionaryWithObjectsAndKeys:nil], @"comm_log_gui", nil]];
[self initControls];
}

View File

@ -291,9 +291,9 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
if ([gui_info objectForKey:BACKGROUND_RGBA_KEY])
[gui setBackgroundColor:[OOColor colorFromString:[gui_info oo_stringForKey:BACKGROUND_RGBA_KEY]]];
if ([gui_info objectForKey:ALPHA_KEY])
[gui setMaxAlpha: [gui_info oo_floatForKey:ALPHA_KEY]];
[gui setMaxAlpha: OOClamp_0_max_f([gui_info oo_floatForKey:ALPHA_KEY],1.0f)];
else
[gui setMaxAlpha: 1.0];
[gui setMaxAlpha: 1.0f];
}
@ -303,41 +303,52 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
// then resize and reposition them accordingly.
GuiDisplayGen* gui = [UNIVERSE messageGUI];
NSDictionary* gui_info = [info objectForKey:@"message_gui"];
if (gui && gui_info)
NSDictionary* gui_info = [info oo_dictionaryForKey:@"message_gui"];
if (gui && [gui_info count] > 0)
{
/*
If switching message guis, remember the last 2 message lines.
Present GUI limitations make it impractical to transfer anything
more...
TODO: a more usable GUI code Post-MNSR... - Kaks 2011.11.05
TODO: a more usable GUI code! - Kaks 2011.11.05
*/
NSArray* lastLines = [gui getLastLines]; // text, colour, fade time - text, colour, fade time
BOOL line1 = ![[lastLines oo_stringAtIndex:0] isEqualToString:@""];
[self resetGui:gui withInfo:gui_info];
if (![[lastLines oo_stringAtIndex:0] isEqualToString:@""])
if (line1)
{
[gui printLongText:[lastLines oo_stringAtIndex:0] align:GUI_ALIGN_CENTER
color:[OOColor colorFromString:[lastLines oo_stringAtIndex:1]]
fadeTime:[lastLines oo_floatAtIndex:2] key:nil addToArray:nil];
}
if ([lastLines count] > 3 && ![[lastLines oo_stringAtIndex:3] isEqualToString:@""])
if ([lastLines count] > 3 && (line1 || ![[lastLines oo_stringAtIndex:3] isEqualToString:@""]))
{
[gui printLongText:[lastLines oo_stringAtIndex:3] align:GUI_ALIGN_CENTER
color:[OOColor colorFromString:[lastLines oo_stringAtIndex:4]]
fadeTime:[lastLines oo_floatAtIndex:5] key:nil addToArray:nil];
}
}
if (gui_info != nil && [gui_info count] == 0)
{
// exists and it's empty. complete reset.
[gui setCurrentRow:8];
[gui setDrawPosition: make_vector(0.0, -40.0, 640.0)];
[gui resizeTo:NSMakeSize(480, 160) characterHeight:19 title:nil];
[gui setCharacterSize:NSMakeSize(16,20)]; // narrow characters
}
[gui setAlpha: 1.0]; // message_gui is always visible.
// And now set up the comms log
gui = [UNIVERSE commLogGUI];
gui_info = [info objectForKey:@"comm_log_gui"];
if (gui && gui_info)
gui_info = [info oo_dictionaryForKey:@"comm_log_gui"];
if (gui && [gui_info count] > 0)
{
[UNIVERSE setAutoCommLog:[gui_info oo_boolForKey:@"automatic" defaultValue:YES]];
[UNIVERSE setPermanentCommLog:[gui_info oo_boolForKey:@"permanent" defaultValue:NO]];
@ -352,7 +363,7 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
Bottom line: colour information is lost on comms log gui reset.
And yes, this is yet another reason for the following
TODO: a more usable GUI code Post-MNSR... - Kaks 2011.11.05
TODO: a more usable GUI code! - Kaks 2011.11.05
*/
NSArray *cLog = [PLAYER commLog];
@ -366,14 +377,19 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
fadeTime:0.0 key:nil addToArray:nil];
}
}
// For consistency's sake, if there's no comm_log_gui section, don't override anything!
/*
else
if (gui_info != nil && [gui_info count] == 0)
{
// exists and it's empty. complete reset.
[UNIVERSE setAutoCommLog:YES];
[UNIVERSE setPermanentCommLog:NO];
[gui setCurrentRow:9];
[gui setDrawPosition: make_vector(0.0, 180.0, 640.0)];
[gui resizeTo:NSMakeSize(360, 120) characterHeight:12 title:nil];
[gui setBackgroundColor:[OOColor colorWithCalibratedRed:0.0 green:0.05 blue:0.45 alpha:0.5]];
[gui setTextColor:[OOColor whiteColor]];
[gui printLongText:DESC(@"communications-log-string") align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:0 key:nil addToArray:nil];
}
*/
if ([UNIVERSE permanentCommLog])
{

View File

@ -391,21 +391,18 @@ NSString *CommodityTypeToString(OOCommodityType commodity) // returns the commod
#define CO_CASE(foo) case COMMODITY_##foo: return [@""#foo lowercaseString];
switch (commodity)
{
/*
// 'old style' commodity identifiers.
case COMMODITY_LIQUOR_WINES: return @"liquor/wines";
case COMMODITY_GEM_STONES: return @"gem-stones";
case COMMODITY_ALIEN_ITEMS: return @"alien items";
/*
// normalised commodity identifiers, for post MNSR
//case COMMODITY_LIQUOR_WINES: return @"liquor_wines";
//case COMMODITY_GEM_STONES: return @"gem_stones";
//case COMMODITY_ALIEN_ITEMS: return @"alien_items";
*/
// normalised commodity identifiers
CO_CASE(LIQUOR_WINES);
CO_CASE(GEM_STONES);
CO_CASE(ALIEN_ITEMS);
*/
CO_CASE(FOOD);
CO_CASE(TEXTILES);
CO_CASE(RADIOACTIVES);
@ -424,7 +421,7 @@ NSString *CommodityTypeToString(OOCommodityType commodity) // returns the commod
case COMMODITY_UNDEFINED:
break;
}
return @"unknown commodity";
return @"goods"; // was "unknown commodity"
#undef CO_CASE
}
@ -433,14 +430,14 @@ OOCommodityType StringToCommodityType(NSString *string) // needs commodity ident
{
#define CO_REVERSE_CASE(foo) if ([[string uppercaseString] isEqual:@""#foo]) return COMMODITY_##foo;
// Backward compatibility - 'old style' commodity identifier strings.
if ([[string lowercaseString] isEqual:@"liquor/wines"]) return COMMODITY_LIQUOR_WINES;
if ([[string lowercaseString] isEqual:@"gem-stones"]) return COMMODITY_GEM_STONES;
if ([[string lowercaseString] isEqual:@"alien items"]) return COMMODITY_ALIEN_ITEMS;
// also test for normalised commodity identifiers - in readiness for post MNSR
if ([[string lowercaseString] isEqual:@"liquor_wines"]) return COMMODITY_LIQUOR_WINES;
if ([[string lowercaseString] isEqual:@"gem_stones"]) return COMMODITY_GEM_STONES;
if ([[string lowercaseString] isEqual:@"alien_items"]) return COMMODITY_ALIEN_ITEMS;
CO_REVERSE_CASE(LIQUOR_WINES);
CO_REVERSE_CASE(GEM_STONES);
CO_REVERSE_CASE(ALIEN_ITEMS);
CO_REVERSE_CASE(FOOD);
CO_REVERSE_CASE(TEXTILES);
CO_REVERSE_CASE(RADIOACTIVES);
@ -456,7 +453,7 @@ OOCommodityType StringToCommodityType(NSString *string) // needs commodity ident
CO_REVERSE_CASE(GOLD);
CO_REVERSE_CASE(PLATINUM);
return kOOCommodityTypeDefault;
return kOOCommodityTypeDefault; //COMMODITY_UNDEFINED
#undef CO_REVERSE_CASE
}

View File

@ -194,9 +194,8 @@
{
assert(_lod < kOOPlanetDataLevels);
BOOL shaders = NO;//[UNIVERSE shaderEffectsLevel] > SHADERS_OFF;
const OOPlanetDataLevel *data = &kPlanetData[_lod];
OO_ENTER_OPENGL();
OOGL(glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT));
@ -239,13 +238,10 @@
}
#endif
if (!shaders)
{
// FIXME: instead of GL_RESCALE_NORMAL, consider copying and transforming the vertex array for each planet.
OOGL(glEnable(GL_RESCALE_NORMAL));
OOGL(glEnableClientState(GL_NORMAL_ARRAY));
OOGL(glNormalPointer(GL_FLOAT, 0, kOOPlanetVertices));
}
// FIXME: instead of GL_RESCALE_NORMAL, consider copying and transforming the vertex array for each planet.
OOGL(glEnable(GL_RESCALE_NORMAL));
OOGL(glEnableClientState(GL_NORMAL_ARRAY));
OOGL(glNormalPointer(GL_FLOAT, 0, kOOPlanetVertices));
OOGL(glDrawElements(GL_TRIANGLES, data->faceCount*3, data->type, data->indices));

View File

@ -8491,8 +8491,7 @@ Entity *gOOJSPlayerIfStale = nil;
[gui autorelease];
gui = [[GuiDisplayGen alloc] init];
// TODO: always take the message gui stuff from the standard hud settings! - Kaks 2011.11.05
// message_gui and comm_log_gui defaults are set up inside [hud resetGuis:] ( via [player deferredInit], called from the code that calls this method).
[message_gui autorelease];
message_gui = [[GuiDisplayGen alloc]
initWithPixelSize:NSMakeSize(480, 160)
@ -8501,10 +8500,6 @@ Entity *gOOJSPlayerIfStale = nil;
rowHeight:19
rowStart:20
title:nil];
[message_gui setCurrentRow:8];
[message_gui setCharacterSize:NSMakeSize(16,20)]; // slightly narrower characters
[message_gui setDrawPosition: make_vector(0.0, -40.0, 640.0)];
[message_gui setAlpha:1.0];
[comm_log_gui autorelease];
comm_log_gui = [[GuiDisplayGen alloc]
@ -8514,12 +8509,6 @@ Entity *gOOJSPlayerIfStale = nil;
rowHeight:12
rowStart:12
title:nil];
[comm_log_gui setCurrentRow:9];
[comm_log_gui setBackgroundColor:[OOColor colorWithCalibratedRed:0.0 green:0.05 blue:0.45 alpha:0.5]];
[comm_log_gui setTextColor:[OOColor whiteColor]];
[comm_log_gui setAlpha:0.0];
[comm_log_gui printLongText:DESC(@"communications-log-string") align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:0 key:nil addToArray:nil];
[comm_log_gui setDrawPosition: make_vector(0.0, 180.0, 640.0)];
//