Commits

Anonymous committed afef2b8

Adding a bunch of changes not checked in 10 months ago. No idea
what these do. (Sorry.) Also included frontier.ini,
to set up the movement animations.

Comments (0)

Files changed (12)

Terrain/CTerrain.cpp

   //look for a delta between the center point and the average elevation
   delta = abs (average - center);
   //scale the delta based on the size of the quad we are dealing with
-  delta /= (float)size;
+  //delta /= (float)size;
   if (delta > TOLERANCE)
     PointActivate (xc, yc);
 

Terrain/CTree.cpp

       (ring + 0) + (segment_count - 1) * radial_edge);
   }
   DoFoliage (m, m->_vertex[m->_vertex.size () - 1] + glVector (0.0f, 0.0f, -0.0f), _current_height / 2, 0.0f);
-  if (!_canopy) {
+  //if (!_canopy) {
     //DoFoliage (TrunkPosition (vertical_pos, NULL), vertical_pos * _height, 0.0f);
     if (_evergreen) { //just rings of foliage, like an evergreen
       for (i = 0; i < (int)branch_list.size (); i++) {
         DoBranch (m, branch_list[i], angle, lod);
       }
     } 
-  }
+  //}
 
 }
 
 #define TIME_DUSK           20.5f // 8:30pm
 
 #define NIGHT_COLOR         glRgba (0.0f, 0.0f, 0.3f)
-#define DAY_COLOR           glRgba (0.4f, 0.7f, 1.0f)
+#define DAY_COLOR           glRgba (1.0f, 1.0f, 1.0f)
 
 #define NIGHT_SCALING       glRgba (0.0f, 0.1f, 0.4f)
 #define DAY_SCALING         glRgba (1.0f)
 
   max_distance = SceneVisibleRange ();
   r = (Region*)AvatarRegion ();
-  atmosphere = r->color_atmosphere;
-  humid_fog.rmax = MathInterpolate (max_distance, max_distance / 3, r->moisture);
-  humid_fog.rmin = humid_fog.rmax / 2.0f;
+  //atmosphere = r->color_atmosphere;
+  humid_fog.rmax = MathInterpolate (max_distance, max_distance * 0.75f, r->moisture);
+  humid_fog.rmin = MathInterpolate (max_distance * 0.85f, max_distance * 0.25f, r->moisture);
   if (r->climate == CLIMATE_SWAMP) {
     humid_fog.rmax /= 2.0f;
     humid_fog.rmin /= 2.0f;
   }
-  desired.cloud_cover = clamp (r->moisture, 0.15f, 0.85f);
+  desired.cloud_cover = clamp (r->moisture, 0.20f, 0.6f);
   desired.sunrise_fade = desired.sunset_fade = 0.0f;
   decimal_time = fmod (GameTime (), 24.0f);
   if (decimal_time >= TIME_DAWN && decimal_time < TIME_DAY) { //sunrise
     fade = (decimal_time - TIME_DAWN) / (TIME_DAY - TIME_DAWN);
     late_fade = max ((fade -0.5f) * 2.0f, 0);
     base_color = glRgbaInterpolate (NIGHT_COLOR, DAY_COLOR, late_fade);
-    atmosphere = glRgbaInterpolate (glRgba (0,0,0), atmosphere, late_fade);
-    //base_color = glRgbaInterpolate (NIGHT_COLOR, DAY_COLOR, fade);
+    atmosphere = glRgbaInterpolate (glRgba (0.0f), glRgba (1.0f), late_fade);
     time_fog.rmax = MathInterpolate (NIGHT_FOG, max_distance, fade);
     time_fog.rmin = time_fog.rmax / 2.0f;
     desired.star_fade = max (1.0f - fade * 2.0f, 0.0f);
     desired.draw_sun = true;
     desired.color[ENV_COLOR_AMBIENT] = glRgba (0.3f, 0.3f, 0.6f);
   } else if (decimal_time >= TIME_DAY && decimal_time < TIME_SUNSET)  { //day
+    atmosphere = glRgba (1.0f);
     fade = (decimal_time - TIME_DAY) / (TIME_SUNSET - TIME_DAY);
     base_color = DAY_COLOR;
     time_fog.rmax = max_distance;
     desired.light = glVectorInterpolate (VECTOR_MORNING, VECTOR_AFTERNOON, fade);
     desired.sun_angle = MathInterpolate (SUN_ANGLE_MORNING, SUN_ANGLE_AFTERNOON, fade);
     desired.draw_sun = true;
-    desired.color[ENV_COLOR_AMBIENT] = glRgba (0.3f, 0.3f, 0.6f);
+    desired.color[ENV_COLOR_AMBIENT] = glRgba (0.4f, 0.4f, 0.4f);
   } else if (decimal_time >= TIME_SUNSET && decimal_time < TIME_DUSK) { // sunset
     fade = (decimal_time - TIME_SUNSET) / (TIME_DUSK - TIME_SUNSET);
     base_color = glRgbaInterpolate (DAY_COLOR, NIGHT_COLOR, fade);
     if (fade > 0.5f)
       desired.star_fade = (fade - 0.5f) * 2.0f;
     //Sunset fades in, then back out
+    atmosphere = glRgbaInterpolate (glRgba (1.0f), glRgba (0.0f), min (1.0f, fade * 2.0f));
     desired.sunset_fade = 1.0f - abs (fade -0.5f) * 2.0f;
     color_scaling = glRgbaInterpolate (DAY_SCALING, NIGHT_SCALING, fade);
     desired.color[ENV_COLOR_LIGHT] = glRgba (1.0f, 0.5f, 0.5f);
     desired.draw_sun = true;
     desired.color[ENV_COLOR_AMBIENT] = glRgba (0.3f, 0.3f, 0.6f);
  } else { //night
-   atmosphere = glRgba (0,0,0);
+   atmosphere = glRgba (0.0f);
     color_scaling = NIGHT_SCALING;
     base_color = NIGHT_COLOR;
     time_fog.rmin = 1;
   desired.fog.rmax = min (humid_fog.rmax, time_fog.rmax);
   desired.fog.rmin = min (humid_fog.rmin, time_fog.rmin);
   for (i = 0; i < ENV_COLOR_COUNT; i++) {
-    if (i == ENV_COLOR_LIGHT) 
+    if (i == ENV_COLOR_LIGHT || i == ENV_COLOR_AMBIENT) 
       continue;
-    average = base_color + atmosphere;
-    average.Normalize ();
+    average = base_color * atmosphere;
+    //average.Normalize ();
+    //average /= 3;
     desired.color[i] = average;
     if (i == ENV_COLOR_SKY) 
       desired.color[i] = base_color * 0.75f;
     desired.color[i] *= color_scaling;
   }   
+  desired.color[ENV_COLOR_SKY] = r->color_atmosphere;
+  desired.color[ENV_COLOR_HORIZON] = (desired.color[ENV_COLOR_SKY] + atmosphere + atmosphere) / 3.0f;
   desired.color[ENV_COLOR_FOG] = desired.color[ENV_COLOR_HORIZON];//desired.color[ENV_COLOR_SKY];
+  //desired.color[ENV_COLOR_SKY] = desired.color[ENV_COLOR_HORIZON] * glRgba (0.2f, 0.2f, 0.8f);
 
 }
 

Terrain/Frontier.ini

+[Settings]
+Treepos=3611.557861 2473.824219 8.986277
+TreeSeed=654
+
+[Animations]
+Idle=idle
+Running=run
+Sprinting=run
+Falling=fall
+Jumping=fall
+Swimming=fall
+Floating=idle
+Flying=idle
+
+[Avatar]
+CameraDistance=11.00
+Angle=76.000000 0.000000 73.199890
+Position=7806.417969 4053.380615 -0.217506
+Flying=0
+MouseSensitivity=1.00
+InvertY=1
+
+[Shaders]
+ShaderNormal=standard.cg
+ShaderTrees=trees.cg
+standard=

Terrain/Render.cpp

 
 #include "stdafx.h"
 
-#include <math.h>
+#include <math.h> 
 #include "avatar.h"
 #include "cache.h"
 #include "cg.h"
   }
   SDL_WM_SetIcon (SDL_LoadBMP("textures/f.bmp"), NULL);
   SDL_WM_SetCaption ("", "");
-  RenderCreate (1600, 1024, 32, false);
+  RenderCreate (1400, 800, 32, false);
   //RenderCreate (1920, 1200, 32, true);
   //Here we initialize SDL as we would do with any SDL application.
 	SDL_Init(SDL_INIT_VIDEO);
 #define UP          glVector (0,0,1)
 #define STAR_TILE   3
 #define DISC        8
-#define SKY_GRID    12
+#define SKY_GRID    16
 #define SKY_EDGE    (SKY_GRID + 1)
 #define SKY_HALF    (SKY_GRID / 2)
-#define SKY_DOME    0.3f
-#define SKY_TILE    5
+#define SKY_DOME    0.5f
+#define SKY_TILE    3
 //How big the sunrise / set is. Higher = smaller. Don't set lower than near clip plane. 
 #define SUNSET_SIZE 0.35f
 //The size of the sun itself
     glBindTexture (GL_TEXTURE_2D, TextureIdFromName ("sun.bmp"));
     draw_sun (e->sun_angle, SUN_SIZE);  
   }
-  glBindTexture (GL_TEXTURE_2D, TextureIdFromName ("clouds.png"));
+  //glBindTexture (GL_TEXTURE_2D, TextureIdFromName ("clouds3.bmp"));
   CgShaderSelect (VSHADER_CLOUDS);
   CgShaderSelect (FSHADER_CLOUDS);
   glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Terrain/Terraform.cpp

 //The number of regions around the edge which should be ocean.
 #define OCEAN_BUFFER      (WORLD_GRID / 10) 
 //This affects the mapping of the coastline.  Higher = busier, more repetitive coast.
-#define FREQUENCY         3 
+#define FREQUENCY         1 
 //How many different colors of flowers are available
 #define FLOWER_PALETTE    (sizeof (flower_palette) / sizeof (GLrgba))
 
       r = WorldRegionGet (xx + x, yy + y);
       sprintf (r.title, "Plains");
       r.climate = CLIMATE_PLAINS;
-      r.color_atmosphere = glRgba (0.0f, 0.5f, 0.0f);
+      r.color_atmosphere = glRgba (0.9f, 0.9f, 0.6f);
       r.geo_water = water;
       r.geo_bias = 8.0f;
       r.moisture = 1.0f;
       r = WorldRegionGet (xx + x, yy + y);
       sprintf (r.title, "Swamp");
       r.climate = CLIMATE_SWAMP;
-      r.color_atmosphere = glRgba (0.0f, 0.5f, 0.0f);
+      r.color_atmosphere = glRgba (0.4f, 1.0f, 0.6f);
       r.geo_water = water;
       r.moisture = 1.0f;
       r.geo_detail = 8.0f;
       sprintf (r.title, "Field");
       r.climate = CLIMATE_FIELD;
       add_flowers (&r, 4);
-      /*
-      r.has_flowers = RandomVal () % 4 == 0;
-      shape = RandomVal ();
-      c = flower_palette[RandomVal () % FLOWER_PALETTE];
-      for (int i = 0; i < FLOWERS; i++) {
-        r.color_flowers[i] = c;
-        r.flower_shape[i] = shape;
-        if ((RandomVal () % 15) == 0) {
-          shape = RandomVal ();
-          c = flower_palette[RandomVal () % FLOWER_PALETTE];
-        }
-      }
-      */
-      r.color_atmosphere = glRgba (0.7f, 0.6f, 0.4f);
+      r.color_atmosphere = glRgba (0.8f, 0.7f, 0.2f);
       r.geo_detail = 8.0f;
       r.flags_shape |= REGION_FLAG_NOBLEND;
       WorldRegionSet (x + xx, y + yy, r);
 }
 
 
-//Place a field of flowers
+//Place a forest
 static void do_forest (int x, int y, int size)
 {
 
       r = WorldRegionGet (xx + x, yy + y);
       sprintf (r.title, "Forest");
       r.climate = CLIMATE_FOREST;
-      r.color_atmosphere = glRgba (0.1f, 0.6f, 0.3f);
+      r.color_atmosphere = glRgba (0.0f, 0.0f, 0.5f);
       r.geo_detail = 8.0f;
       r.tree_threshold = 0.66f;
       //r.flags_shape |= REGION_FLAG_NOBLEND;
       r.color_dirt = TerraformColorGenerate (SURFACE_COLOR_DIRT, r.moisture, r.temperature, r.grid_pos.x + r.grid_pos.y * WORLD_GRID);
       r.color_rock = TerraformColorGenerate (SURFACE_COLOR_ROCK, r.moisture, r.temperature, r.grid_pos.x + r.grid_pos.y * WORLD_GRID);
       //"atmosphere" is the overall color of the lighting & fog. 
-      humid_air = glRgba (1.0f, 1.0f, 0.3f);
-      dry_air = glRgba (1.0f, 0.7f, 0.3f);
-      warm_air = glRgbaInterpolate (dry_air, humid_air, r.moisture);
-      cold_air = glRgba (0.3f, 0.7f, 1.0f);
-      r.color_atmosphere = glRgbaInterpolate (cold_air, warm_air, r.temperature);
+      warm_air = glRgba (0.0f, 0.2f, 1.0f);
+      cold_air = glRgba (0.7f, 0.9f, 1.0f);
+      //Only set the atmosphere color if it wasn't set elsewhere
+      if (r.color_atmosphere == glRgba (0.0f, 0.0f, 0.0f))
+        r.color_atmosphere = glRgbaInterpolate (cold_air, warm_air, r.temperature);
       //Color the map
       switch (r.climate) {
       case CLIMATE_MOUNTAIN:
         r.color_map = r.color_grass * 0.8f;
         r.color_map += r.color_rock * 0.2f;
         r.color_map.Normalize ();
+        r.color_map = r.color_rock;
         break;
       case CLIMATE_CANYON:
         r.color_map = r.color_rock * 0.3f;
         r.color_map *= (r.geo_scale * 0.5f + 0.5f);
       //if (r.geo_scale >= 0.0f)
         //r.color_map = glRgbaUnique (r.tree_type);
+      //r.color_map = r.color_atmosphere;
       WorldRegionSet (x, y, r);
     }
   }
         r.moisture = 1.0f;
         r.geo_water = 0.0f;
         r.flags_shape = REGION_FLAG_NOBLEND;
+        r.color_atmosphere = glRgba (0.7f, 0.7f, 1.0f);
         r.climate = CLIMATE_OCEAN;
         sprintf (r.title, "%s Ocean", get_direction_name (x, y));
         WorldRegionSet (x, y, r);
   int             radius;
   Climate         c;
   GLcoord         walk;
+  UINT            spinner;
 
   walk.Clear ();
+  spinner = 0;
   do {
     x = walk.x;
     y = walk.y;// + WorldNoisei (walk.x + walk.y * WORLD_GRID) % 4;
       //Rocky wastelands favor cold areas
       if (r.temperature < TEMP_TEMPERATE)
         climates.push_back (CLIMATE_ROCKY);
-      //if (radius > 1)
-        //climates.push_back (CLIMATE_CANYON);
+      if (radius > 1 && !(WorldNoisei (spinner++) % 10))
+        climates.push_back (CLIMATE_CANYON);
       if (r.temperature > TEMP_TEMPERATE && r.temperature < TEMP_HOT && r.moisture > 0.5f)
         climates.push_back (CLIMATE_FOREST);
       if (climates.empty ()) {
       r.tree_threshold = 0.15f;
       from_center.x = abs (x - WORLD_GRID_CENTER);
       from_center.y = abs (y - WORLD_GRID_CENTER);
-      //Geo scale is a number from -1 to 1. -1 is lowest ovean. 0 is sea level. 
+      //Geo scale is a number from -1 to 1. -1 is lowest ocean. 0 is sea level. 
       //+1 is highest elevation on the island. This is used to guide other derived numbers.
       r.geo_scale = glVectorLength (glVector ((float)from_center.x, (float)from_center.y));
       r.geo_scale /= (WORLD_GRID_CENTER - OCEAN_BUFFER);
       //Create a steep drop around the edge of the world
       if (r.geo_scale > 1.0f)
-        r.geo_scale = 1.0f + (r.geo_scale - 1.0f) * 2.0f;
+        r.geo_scale = 1.0f + (r.geo_scale - 1.0f) * 4.0f;
       r.geo_scale = 1.0f - r.geo_scale;
       r.geo_scale += (Entropy ((x + offset.x), (y + offset.y)) - 0.5f);
       r.geo_scale += (Entropy ((x + offset.x) * FREQUENCY, (y + offset.y) * FREQUENCY) - 0.2f);
       r.geo_scale = clamp (r.geo_scale, -1.0f, 1.0f);
       if (r.geo_scale > 0.0f)
         r.geo_water = 1.0f + r.geo_scale * 16.0f;
+      r.color_atmosphere = glRgba (0.0f, 0.0f, 0.0f);
       r.geo_bias = 0.0f;
       r.geo_detail = 0.0f;
       r.color_map = glRgba (0.0f);

Terrain/Terrain.vcxproj

     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalLibraryDirectories>C:\Work\SDK\SDL\lib;H:\SDK\Cg\lib</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>H:\SDK\SDL\lib;H:\SDK\Cg\lib</AdditionalLibraryDirectories>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

Terrain/World.cpp

   char      filename[256];
   WHeader   header;
 
+  return;
   sprintf (filename, "%sworld.sav", GameDirectory ());
   if (!(f = fopen (filename, "wb"))) {
     ConsoleLog ("WorldSave: Could not open file %s", filename);
   char      filename[256];
   WHeader   header;
 
+
   sprintf (filename, "%sworld.sav", GameDirectory ());
   if (!(f = fopen (filename, "rb"))) {
     ConsoleLog ("WorldLoad: Could not open file %s", filename);
   build_trees ();
   planet.wind_from_west = (RandomVal () % 2) ? true : false;
   planet.northern_hemisphere = (RandomVal () % 2) ? true : false;
-  planet.river_count = 1 + RandomVal () % 4;
+  planet.river_count = 4 + RandomVal () % 4;
   planet.lake_count = 1 + RandomVal () % 4;
   TerraformPrepare ();
   TerraformOceans ();
 #define REGION_FLAG_RIVERSW     (REGION_FLAG_RIVERS | REGION_FLAG_RIVERW)
 #define REGION_FLAG_RIVER_ANY   (REGION_FLAG_RIVERNS | REGION_FLAG_RIVEREW)
 
-#define REGION_SIZE             64
+#define REGION_SIZE             128
 #define REGION_HALF             (REGION_SIZE / 2)
-#define WORLD_GRID              128
+#define WORLD_GRID              256
 #define WORLD_GRID_EDGE         (WORLD_GRID + 1)
 #define WORLD_GRID_CENTER       (WORLD_GRID / 2)
 #define WORLD_SIZE_METERS       (REGION_SIZE * WORLD_GRID)

Terrain/glVector3.cpp

 
 }
 
-std::ostream &operator<<(std::ostream &stream, GLvector &v)
-{
-  stream << "[ " << v.x << ",  " << v.y << ",  " << v.z << " ]";
-  return stream;
-}
-
-/**
- * Overloaded stream in for Point3D. Converts it from a string
- */
-std::istream &operator>>(std::istream &stream, GLvector &v)
-{
-    char str[NAME_MAX] = {0};
-    stream.readsome( str, NAME_MAX );
-    sscanf( str, "[ %f, %f, %f ]", &v.x, &v.y, &v.z );
-
-    return stream;
-}
+std::ostream &operator<<(std::ostream &stream, GLvector &v)
+{
+  stream << "[ " << v.x << ",  " << v.y << ",  " << v.z << " ]";
+  return stream;
+}
+
+/**
+ * Overloaded stream in for Point3D. Converts it from a string
+ */
+std::istream &operator>>(std::istream &stream, GLvector &v)
+{
+    char str[NAME_MAX] = {0};
+    stream.readsome( str, NAME_MAX );
+    sscanf( str, "[ %f, %f, %f ]", &v.x, &v.y, &v.z );
+
+    return stream;
+}