version 1.37 | | version 1.38 |
---|
| | |
/* | | /* |
* static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
* "$Id: weather.c,v 1.37 2005/04/14 19:15:42 ryo_saeba Exp $"; | | * "$Id: weather.c,v 1.38 2005/05/07 11:51:20 tchize Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
!(tmp->material & M_ICE || tmp->material & M_LIQUID)) | | !(tmp->material & M_ICE || tmp->material & M_LIQUID)) |
gotsnow++; | | gotsnow++; |
for (i=0; growth_avoids[i].name != NULL; i++) { | | for (i=0; growth_avoids[i].name != NULL; i++) { |
//if (!strcmp(tmp->arch->name, growth_avoids[i].name)) { | | /*if (!strcmp(tmp->arch->name, growth_avoids[i].name)) {*/ |
if (tmp->arch== growth_avoids[i].what) { | | if (tmp->arch== growth_avoids[i].what) { |
avoid++; | | avoid++; |
break; | | break; |
| | |
} else { | | } else { |
for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) { | | for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) { |
for (i=0; weather_avoids[i].name != NULL; i++) { | | for (i=0; weather_avoids[i].name != NULL; i++) { |
//if (!strcmp(tmp->arch->name, weather_avoids[i].name)) { | | /*if (!strcmp(tmp->arch->name, weather_avoids[i].name)) {*/ |
if (tmp->arch == weather_avoids[i].what) { | | if (tmp->arch == weather_avoids[i].what) { |
if (weather_avoids[i].snow == 1) | | if (weather_avoids[i].snow == 1) |
gotsnow++; | | gotsnow++; |
| | |
two = 0; | | two = 0; |
gotsnow = 0; | | gotsnow = 0; |
nodstk = 0; | | nodstk = 0; |
//temp = real_world_temperature(x, y, m); | | /*temp = real_world_temperature(x, y, m);*/ |
temp = weathermap[wx][wy].realtemp; | | temp = weathermap[wx][wy].realtemp; |
sky = weathermap[wx][wy].sky; | | sky = weathermap[wx][wy].sky; |
if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG) | | if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG) |
| | |
two = 0; | | two = 0; |
gotsnow = 0; | | gotsnow = 0; |
nodstk = 0; | | nodstk = 0; |
//temp = real_world_temperature(x, y, m); | | /*temp = real_world_temperature(x, y, m);*/ |
temp = weathermap[wx][wy].realtemp; | | temp = weathermap[wx][wy].realtemp; |
sky = weathermap[wx][wy].sky; | | sky = weathermap[wx][wy].sky; |
/* it's probably allready snowing */ | | /* it's probably allready snowing */ |
| | |
avoid = 0; | | avoid = 0; |
two = 0; | | two = 0; |
gotsnow = 0; | | gotsnow = 0; |
//temp = real_world_temperature(x, y, m); | | /*temp = real_world_temperature(x, y, m);*/ |
temp = weathermap[wx][wy].realtemp; | | temp = weathermap[wx][wy].realtemp; |
sky = weathermap[wx][wy].sky; | | sky = weathermap[wx][wy].sky; |
(void)avoid_weather(&avoid, m, x, y, &gotsnow, 1); | | (void)avoid_weather(&avoid, m, x, y, &gotsnow, 1); |
| | |
avoid = 0; | | avoid = 0; |
two = 0; | | two = 0; |
gotsnow = 0; | | gotsnow = 0; |
//temp = real_world_temperature(x, y, m); | | /*temp = real_world_temperature(x, y, m);*/ |
temp = weathermap[wx][wy].realtemp; | | temp = weathermap[wx][wy].realtemp; |
sky = weathermap[wx][wy].sky; | | sky = weathermap[wx][wy].sky; |
(void)avoid_weather(&avoid, m, x, y, &gotsnow, 1); | | (void)avoid_weather(&avoid, m, x, y, &gotsnow, 1); |
| | |
map. returns -1 if you give it something it can't figure out. 0 normally. | | map. returns -1 if you give it something it can't figure out. 0 normally. |
*/ | | */ |
| | |
//int worldmap_to_weathermap(int x, int y, int *wx, int *wy, char *filename) | | /*int worldmap_to_weathermap(int x, int y, int *wx, int *wy, char *filename)*/ |
int worldmap_to_weathermap(int x, int y, int *wx, int *wy, mapstruct* m) | | int worldmap_to_weathermap(int x, int y, int *wx, int *wy, mapstruct* m) |
{ | | { |
int spwtx, spwty; | | int spwtx, spwty; |
| | |
{ | | { |
int wx, wy, temp, eleva, elevb; | | int wx, wy, temp, eleva, elevb; |
object *op; | | object *op; |
//printf ("real_world_temperature: worldmaptoweathermap : %s\n",m->path); | | /*printf ("real_world_temperature: worldmaptoweathermap : %s\n",m->path);*/ |
worldmap_to_weathermap(x, y, &wx, &wy, /*m->path*/m); | | worldmap_to_weathermap(x, y, &wx, &wy, /*m->path*/m); |
temp = real_temperature(wx, wy); | | temp = real_temperature(wx, wy); |
if (weathermap[wx][wy].avgelev < 0) | | if (weathermap[wx][wy].avgelev < 0) |
| | |
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + BLUE)] = speed; | | pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + BLUE)] = speed; |
} else { | | } else { |
speed = (speed - realmaxwind) * realscalewind; | | speed = (speed - realmaxwind) * realscalewind; |
// if (speed < 100) | | /* if (speed < 100)*/ |
// speed = 100; | | /* speed = 100;*/ |
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + RED)] = speed; | | pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + RED)] = speed; |
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + GREEN)] = 0; | | pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + GREEN)] = 0; |
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + BLUE)] = 0; | | pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + BLUE)] = 0; |