diff --git a/dat/ssys.xml b/dat/ssys.xml index e385982..0dec2da 100644 --- a/dat/ssys.xml +++ b/dat/ssys.xml @@ -32,7 +32,7 @@ 0 - 0 + 50 0 500 @@ -57,11 +57,11 @@ 0 - 0 + 50 0 160 - + Draktharr Vendetta @@ -92,7 +92,7 @@ 0 - 0 + 100 100 500 @@ -119,7 +119,7 @@ 0 - 0 + 250 250 400 @@ -142,7 +142,7 @@ 0 - 0 + 600 600 500 @@ -257,7 +257,7 @@ 0 - 0 + 100 0 120 @@ -310,7 +310,7 @@ 0 - 0 + 150 150 400 @@ -354,7 +354,7 @@ 0 - 0 + 400 400 400 @@ -432,7 +432,7 @@ 0 - 0 + 700 750 500 @@ -475,7 +475,7 @@ 0 - 0 + 300 250 400 @@ -552,7 +552,7 @@ 0 - 0 + 200 200 500 @@ -617,7 +617,7 @@ 0 - 0 + 50 0 400 @@ -656,7 +656,7 @@ 0 - 0 + 100 100 600 @@ -675,7 +675,7 @@ 0 - 0 + 800 800 400 @@ -720,7 +720,7 @@ 0 - 0 + 300 200 300 @@ -843,7 +843,7 @@ 0 - 0 + 100 100 500 @@ -886,7 +886,7 @@ 0 - 0 + 450 500 400 @@ -916,7 +916,7 @@ 0 - 0 + 100 100 600 @@ -935,7 +935,7 @@ 0 - 0 + 350 300 400 @@ -1050,7 +1050,7 @@ 0 - 0 + 500 500 400 @@ -1070,7 +1070,7 @@ 0 - 0 + 650 700 400 @@ -1101,7 +1101,7 @@ 0 - 0 + 200 150 500 @@ -1181,7 +1181,7 @@ 0 - 0 + 300 0 100 @@ -1199,7 +1199,7 @@ 0 - 0 + 800 800 400 @@ -1244,7 +1244,7 @@ 0 - 0 + 350 300 400 @@ -1278,7 +1278,7 @@ 0 - 0 + 50 0 400 @@ -1297,7 +1297,7 @@ 0 - 0 + 950 900 500 @@ -1318,7 +1318,7 @@ 0 - 0 + 50 0 140 @@ -1352,7 +1352,7 @@ 0 - 0 + 50 0 500 @@ -1476,7 +1476,7 @@ 0 - 0 + 50 0 500 @@ -1517,4 +1517,4 @@ 500 - \ No newline at end of file + diff --git a/src/player.c b/src/player.c index eddaa7c..dffccf6 100644 --- a/src/player.c +++ b/src/player.c @@ -96,7 +96,7 @@ static unsigned int player_timer = 0; /**< For death and such. */ static Vec2 player_cam; /**< Again, for death etc. */ /* For interference. */ static int interference_layer = 0; /**< Layer of the current interference. */ -static double interference_alpha = 0.; /**< Alpha of the current interference layer. */ +double interference_alpha = 0.; /**< Alpha of the current interference layer. */ static double interference_t = 0.; /**< Interference timer to control transitions. */ static int* missions_done = NULL; /**< Saves position of completed missions. */ diff --git a/src/space.c b/src/space.c index 635ac2d..2664716 100644 --- a/src/space.c +++ b/src/space.c @@ -78,6 +78,11 @@ static Star* stars = NULL; /* Star array. */ static int nstars = 0; /* Total stars. */ static int mstars = 0; /* Memory stars are taking. */ +/* Interference. */ +extern double interference_alpha; /* player.c */ +static double interference_target; /**< Target alpha level .*/ +static double interference_timer = 0.; /**< Interference timer. */ + extern int planet_target; /* player.c */ /* Intern. */ @@ -96,7 +101,7 @@ static PlanetClass planetclass_get(const char a); extern void player_message(const char* fmt, ...); void planets_minimap(const double res, const double w, - const double h, const RadarShape shape); + const double h, const RadarShape shape, double alpha); int space_sysSave(xmlTextWriterPtr writer); int space_sysLoad(xmlNodePtr parent); @@ -105,7 +110,7 @@ int space_sysLoad(xmlNodePtr parent); #define PIXEL(x,y) if((shape == RADAR_RECT && ABS(x)planets[i]->gfx_space->sw / res); @@ -416,6 +421,7 @@ void space_update(const double dt) { if(cur_system == NULL) return; /* Can't update a null system. */ + /* Spawning. */ if(space_spawn) { spawn_timer -= dt; @@ -444,6 +450,36 @@ void space_update(const double dt) { pilot_hit(player, NULL, 0, DAMAGE_TYPE_RADIATION, pow2(cur_system->nebu_volatility) / 500. * dt); } + + /* Interference. */ + if(cur_system->interference > 0.) { + /* Always dark. */ + if(cur_system->interference >= 1000.) + interference_alpha = 1.; + + /* Normal scenario. */ + else { + interference_timer -= dt; + if(interference_timer < 0.) { + interference_timer += (1000. - cur_system->interference) / 1000. * + (3. + NormalInverse(0.25 + 0.95*RNGF())); + interference_target = cur_system->interference/1000. * 3. * + (1. + NormalInverse(0.25 + 0.95*RNGF())); + } + + /* Head towards target. */ + if(fabs(interference_alpha - interference_target) > 1e-05) { + /* Assymptotic. */ + interference_alpha += (interference_target - interference_alpha) * dt; + + /* Limit alpha to [0. -1.]. */ + if(interference_alpha > 1.) + interference_alpha = 1.; + else if(interference_alpha < 0.) + interference_alpha = 0.; + } + } + } } /** @@ -551,6 +587,7 @@ void space_init(const char* sysname) { weapon_clear(); /* Get rid of all the weapons. */ spfx_clear(); /* Remove of explosions. */ space_spawn = 1; /* Spawn is enabled by default. */ + interference_timer = 0; /* Restart timer. */ /* Clear player escorts since they don't automatically follow. */ if(player) { @@ -974,7 +1011,7 @@ static StarSystem* system_parse(StarSystem* sys, const xmlNodePtr parent) { } else if(xml_isNode(cur, "interference")) { flags |= FLAG_INTEFERENCESET; - sys->interference = xml_getFloat(cur)/100; + sys->interference = xml_getFloat(cur); } else if(xml_isNode(cur, "nebulae")) { ptrc = xml_nodeProp(cur, "volatility"); diff --git a/src/weapon.c b/src/weapon.c index ad8aec9..c6c2cc7 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -106,7 +106,7 @@ static void think_seeker(Weapon* w, const double dt); static void think_beam(Weapon* w, const double dt); /* Extern. */ void weapon_minimap(const double res, const double w, - const double h, const RadarShape shape); + const double h, const RadarShape shape, double alpha); /** * @fn void weapon_minimap(const double res, const double w, @@ -123,13 +123,13 @@ void weapon_minimap(const double res, const double w, (shape == RADAR_CIRCLE && (((x)*(x)+(y)*(y)) <= rc))) \ glVertex2i((x),(y)) /**< Set a pixel if within range. */ void weapon_minimap(const double res, const double w, - const double h, const RadarShape shape) { + const double h, const RadarShape shape, double alpha) { int i, rc; double x, y; /* Begin the points. */ glBegin(GL_POINTS); - COLOUR(cRadar_weap); + ACOLOUR(cRadar_weap, alpha); if(shape == RADAR_CIRCLE) rc = (int)(w*w);