| version 1.39 | | version 1.40 |
|---|
| | |
| /* | | /* |
| * static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
| * "$Id: weather.c,v 1.39 2005/07/16 21:10:40 akirschbaum Exp $"; | | * "$Id: weather.c,v 1.40 2005/07/17 11:00:05 ryo_saeba Exp $"; |
| */ | | */ |
| /* | | /* |
| CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| * occur. | | * occur. |
| */ | | */ |
| | | |
| void weather_effect(char *filename) | | void weather_effect(const char *filename) |
| { | | { |
| mapstruct *m; | | mapstruct *m; |
| int wx, wy, x, y; | | int wx, wy, x, y; |
| | |
| x = 0; | | x = 0; |
| y = 0; | | y = 0; |
| /* for now, just bail if it's not the worldmap */ | | /* for now, just bail if it's not the worldmap */ |
| if (worldmap_to_weathermap(x, y, &wx, &wy, /*filename*/ m) != 0) | | if (worldmap_to_weathermap(x, y, &wx, &wy, m) != 0) |
| return; | | return; |
| /*First, calculate temperature*/ | | /*First, calculate temperature*/ |
| calculate_temperature(m, wx, wy); | | calculate_temperature(m, wx, wy); |
| /* we change the world first, if needed */ | | /* we change the world first, if needed */ |
| if (settings.dynamiclevel >= 5) { | | if (settings.dynamiclevel >= 5) { |
| change_the_world(m, wx, wy, filename); | | change_the_world(m, wx, wy); |
| } | | } |
| if (settings.dynamiclevel >= 2) { | | if (settings.dynamiclevel >= 2) { |
| let_it_snow(m, wx, wy, filename); | | let_it_snow(m, wx, wy); |
| singing_in_the_rain(m, wx, wy, filename); | | singing_in_the_rain(m, wx, wy); |
| } | | } |
| /* if (settings.dynamiclevel >= 4) { | | /* if (settings.dynamiclevel >= 4) { |
| feather_map(m, wx, wy, filename); | | feather_map(m, wx, wy, filename); |
| }*/ | | }*/ |
| if (settings.dynamiclevel >= 3) { | | if (settings.dynamiclevel >= 3) { |
| plant_a_garden(m, wx, wy, filename); | | plant_a_garden(m, wx, wy); |
| } | | } |
| } | | } |
| | | |
| | |
| * weather_effect() | | * weather_effect() |
| */ | | */ |
| | | |
| void let_it_snow(mapstruct *m, int wx, int wy, char *filename) | | void let_it_snow(mapstruct *m, int wx, int wy) |
| { | | { |
| int x, y, i; | | int x, y, i; |
| int nx, ny, j, d; | | int nx, ny, j, d; |
| | |
| y = ny; | | y = ny; |
| } | | } |
| /* we use the unjittered coordinates */ | | /* we use the unjittered coordinates */ |
| (void)worldmap_to_weathermap(nx, ny, &wx, &wy, /*filename*/ m); | | (void)worldmap_to_weathermap(nx, ny, &wx, &wy, m); |
| ob = NULL; | | ob = NULL; |
| at = NULL; | | at = NULL; |
| /* this will definately need tuning */ | | /* this will definately need tuning */ |
| | |
| * weather_effect() | | * weather_effect() |
| */ | | */ |
| | | |
| void singing_in_the_rain(mapstruct *m, int wx, int wy, char *filename) | | void singing_in_the_rain(mapstruct *m, int wx, int wy) |
| { | | { |
| int x, y, i; | | int x, y, i; |
| int nx, ny, d, j; | | int nx, ny, d, j; |
| | |
| y = ny; | | y = ny; |
| } | | } |
| /* we use the unjittered coordinates */ | | /* we use the unjittered coordinates */ |
| (void)worldmap_to_weathermap(nx, ny, &wx, &wy, /*filename*/m); | | (void)worldmap_to_weathermap(nx, ny, &wx, &wy, m); |
| ob = NULL; | | ob = NULL; |
| at = NULL; | | at = NULL; |
| avoid = 0; | | avoid = 0; |
| | |
| * weather_effect() | | * weather_effect() |
| */ | | */ |
| | | |
| void plant_a_garden(mapstruct *m, int wx, int wy, char *filename) | | void plant_a_garden(mapstruct *m, int wx, int wy) |
| { | | { |
| int x, y, i; | | int x, y, i; |
| int avoid, two, temp, sky, gotsnow, found, days; | | int avoid, two, temp, sky, gotsnow, found, days; |
| | |
| days = todtick / HOURS_PER_DAY; | | days = todtick / HOURS_PER_DAY; |
| for (x=0; x < settings.worldmaptilesizex; x++) { | | for (x=0; x < settings.worldmaptilesizex; x++) { |
| for (y=0; y < settings.worldmaptilesizey; y++) { | | for (y=0; y < settings.worldmaptilesizey; y++) { |
| (void)worldmap_to_weathermap(x, y, &wx, &wy, /*filename*/m); | | (void)worldmap_to_weathermap(x, y, &wx, &wy, m); |
| ob = NULL; | | ob = NULL; |
| at = NULL; | | at = NULL; |
| avoid = 0; | | avoid = 0; |
| | |
| * Process worldmap regrowth. m is the map we are currently processing. | | * Process worldmap regrowth. m is the map we are currently processing. |
| * wx and wy are | | * wx and wy are |
| * the weathermap coordinates for the weathermap square we want to work on. | | * the weathermap coordinates for the weathermap square we want to work on. |
| * filename is the pathname for the current map. This should be called from | | * This should be called from weather_effect() |
| * weather_effect() | | |
| */ | | */ |
| | | |
| void change_the_world(mapstruct *m, int wx, int wy, char *filename) | | void change_the_world(mapstruct *m, int wx, int wy) |
| { | | { |
| int x, y, i; | | int x, y, i; |
| int nx, ny, j, d; | | int nx, ny, j, d; |
| | |
| y = ny; | | y = ny; |
| } | | } |
| /* we use the unjittered coordinates */ | | /* we use the unjittered coordinates */ |
| (void)worldmap_to_weathermap(nx, ny, &wx, &wy, /*filename*/m); | | (void)worldmap_to_weathermap(nx, ny, &wx, &wy, m); |
| ob = NULL; | | ob = NULL; |
| at = NULL; | | at = NULL; |
| dat = NULL; | | dat = NULL; |
| | |
| * Reduce the blockiness of the maps. m is the map we are currently processing. | | * Reduce the blockiness of the maps. m is the map we are currently processing. |
| * wx and wy are | | * wx and wy are |
| * the weathermap coordinates for the weathermap square we want to work on. | | * the weathermap coordinates for the weathermap square we want to work on. |
| * filename is the pathname for the current map. This should be called from | | * This should be called from weather_effect() |
| * weather_effect() | | |
| */ | | */ |
| | | |
| void feather_map(mapstruct *m, int wx, int wy, char *filename) | | void feather_map(mapstruct *m, int wx, int wy) |
| { | | { |
| int x, y, i, nx, ny, j; | | int x, y, i, nx, ny, j; |
| int avoid, two, gotsnow, nodstk; | | int avoid, two, gotsnow, nodstk; |
| | |
| | | |
| for (x=0; x < settings.worldmaptilesizex; x++) { | | for (x=0; x < settings.worldmaptilesizex; x++) { |
| for (y=0; y < settings.worldmaptilesizey; y++) { | | for (y=0; y < settings.worldmaptilesizey; y++) { |
| (void)worldmap_to_weathermap(x, y, &wx, &wy, /*filename*/m); | | (void)worldmap_to_weathermap(x, y, &wx, &wy, m); |
| ob = NULL; | | ob = NULL; |
| at = NULL; | | at = NULL; |
| avoid = 0; | | avoid = 0; |
| | |
| 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, mapstruct* m) | | int worldmap_to_weathermap(int x, int y, int *wx, int *wy, mapstruct* m) |
| { | | { |
| int spwtx, spwty; | | int spwtx, spwty; |