… | |
… | |
60 | static void write_rainfallmap (void); |
60 | static void write_rainfallmap (void); |
61 | static void read_rainfallmap (void); |
61 | static void read_rainfallmap (void); |
62 | static void init_rainfall (void); |
62 | static void init_rainfall (void); |
63 | static void init_weatheravoid (weather_avoids_t wa[]); |
63 | static void init_weatheravoid (weather_avoids_t wa[]); |
64 | static void perform_weather (void); |
64 | static void perform_weather (void); |
65 | static object *avoid_weather (int *av, mapstruct *m, int x, int y, int *gs, int grow); |
65 | static object *avoid_weather (int *av, maptile *m, int x, int y, int *gs, int grow); |
66 | static void calculate_temperature (mapstruct *m, int wx, int wy); |
66 | static void calculate_temperature (maptile *m, int wx, int wy); |
67 | static void let_it_snow (mapstruct *m, int wx, int wy); |
67 | static void let_it_snow (maptile *m, int wx, int wy); |
68 | static void singing_in_the_rain (mapstruct *m, int wx, int wy); |
68 | static void singing_in_the_rain (maptile *m, int wx, int wy); |
69 | static void plant_a_garden (mapstruct *m, int wx, int wy); |
69 | static void plant_a_garden (maptile *m, int wx, int wy); |
70 | static void change_the_world (mapstruct *m, int wx, int wy); |
70 | static void change_the_world (maptile *m, int wx, int wy); |
71 | |
71 | |
72 | //static void feather_map(mapstruct *m, int wx, int wy); |
72 | //static void feather_map(maptile *m, int wx, int wy); |
73 | static const char *weathermap_to_worldmap_corner (int wx, int wy, int *x, int *y, int dir); |
73 | static const char *weathermap_to_worldmap_corner (int wx, int wy, int *x, int *y, int dir); |
74 | static int polar_distance (int x, int y, int equator); |
74 | static int polar_distance (int x, int y, int equator); |
75 | static void update_humid (void); |
75 | static void update_humid (void); |
76 | static int humid_tile (int x, int y); |
76 | static int humid_tile (int x, int y); |
77 | static void temperature_calc (int x, int y, const timeofday_t * tod); |
77 | static void temperature_calc (int x, int y, const timeofday_t * tod); |
… | |
… | |
342 | /* |
342 | /* |
343 | * Set the darkness level for a map. Requires the map pointer. |
343 | * Set the darkness level for a map. Requires the map pointer. |
344 | */ |
344 | */ |
345 | |
345 | |
346 | void |
346 | void |
347 | set_darkness_map (mapstruct *m) |
347 | set_darkness_map (maptile *m) |
348 | { |
348 | { |
349 | int i; |
349 | int i; |
350 | timeofday_t tod; |
350 | timeofday_t tod; |
351 | |
351 | |
352 | if (!m->outdoor) |
352 | if (!m->outdoor) |
… | |
… | |
366 | */ |
366 | */ |
367 | |
367 | |
368 | static void |
368 | static void |
369 | dawn_to_dusk (const timeofday_t * tod) |
369 | dawn_to_dusk (const timeofday_t * tod) |
370 | { |
370 | { |
371 | mapstruct *m; |
371 | maptile *m; |
372 | |
372 | |
373 | /* If the light level isn't changing, no reason to do all |
373 | /* If the light level isn't changing, no reason to do all |
374 | * the work below. |
374 | * the work below. |
375 | */ |
375 | */ |
376 | if (season_timechange[tod->season][tod->hour] == 0) |
376 | if (season_timechange[tod->season][tod->hour] == 0) |
… | |
… | |
1077 | int x, y, tx, ty, nx, ny, ax, ay, j; |
1077 | int x, y, tx, ty, nx, ny, ax, ay, j; |
1078 | int spwtx, spwty; |
1078 | int spwtx, spwty; |
1079 | const char *mapname; |
1079 | const char *mapname; |
1080 | long int elev; |
1080 | long int elev; |
1081 | int water, space; |
1081 | int water, space; |
1082 | mapstruct *m; |
1082 | maptile *m; |
1083 | |
1083 | |
1084 | /* handling of this is kinda nasty. For that reason, |
1084 | /* handling of this is kinda nasty. For that reason, |
1085 | * we do the elevation here too. Not because it makes the |
1085 | * we do the elevation here too. Not because it makes the |
1086 | * code cleaner, or makes handling easier, but because I do *not* |
1086 | * code cleaner, or makes handling easier, but because I do *not* |
1087 | * want to maintain two of these nightmares. |
1087 | * want to maintain two of these nightmares. |
… | |
… | |
1464 | */ |
1464 | */ |
1465 | |
1465 | |
1466 | static void |
1466 | static void |
1467 | perform_weather (void) |
1467 | perform_weather (void) |
1468 | { |
1468 | { |
1469 | mapstruct *m; |
1469 | maptile *m; |
1470 | char filename[MAX_BUF]; |
1470 | char filename[MAX_BUF]; |
1471 | FILE *fp; |
1471 | FILE *fp; |
1472 | |
1472 | |
1473 | if (!settings.dynamiclevel) |
1473 | if (!settings.dynamiclevel) |
1474 | return; |
1474 | return; |
… | |
… | |
1521 | */ |
1521 | */ |
1522 | |
1522 | |
1523 | void |
1523 | void |
1524 | weather_effect (const char *filename) |
1524 | weather_effect (const char *filename) |
1525 | { |
1525 | { |
1526 | mapstruct *m; |
1526 | maptile *m; |
1527 | int wx, wy, x, y; |
1527 | int wx, wy, x, y; |
1528 | |
1528 | |
1529 | /* if the dm shut off weather, go home */ |
1529 | /* if the dm shut off weather, go home */ |
1530 | if (settings.dynamiclevel < 1) |
1530 | if (settings.dynamiclevel < 1) |
1531 | return; |
1531 | return; |
… | |
… | |
1571 | * Returns the object pointer for any snow item it found, so you can |
1571 | * Returns the object pointer for any snow item it found, so you can |
1572 | * destroy/melt it. |
1572 | * destroy/melt it. |
1573 | */ |
1573 | */ |
1574 | |
1574 | |
1575 | static object * |
1575 | static object * |
1576 | avoid_weather (int *av, mapstruct *m, int x, int y, int *gs, int grow) |
1576 | avoid_weather (int *av, maptile *m, int x, int y, int *gs, int grow) |
1577 | { |
1577 | { |
1578 | int avoid, gotsnow, i, n; |
1578 | int avoid, gotsnow, i, n; |
1579 | |
1579 | |
1580 | object *tmp; |
1580 | object *tmp; |
1581 | |
1581 | |
… | |
… | |
1634 | |
1634 | |
1635 | /* Temperature is used in a lot of weather function. |
1635 | /* Temperature is used in a lot of weather function. |
1636 | * This need to be precalculated before used. |
1636 | * This need to be precalculated before used. |
1637 | */ |
1637 | */ |
1638 | static void |
1638 | static void |
1639 | calculate_temperature (mapstruct *m, int wx, int wy) |
1639 | calculate_temperature (maptile *m, int wx, int wy) |
1640 | { |
1640 | { |
1641 | uint32 x, y; |
1641 | uint32 x, y; |
1642 | |
1642 | |
1643 | for (x = 0; x < settings.worldmaptilesizex; x++) |
1643 | for (x = 0; x < settings.worldmaptilesizex; x++) |
1644 | { |
1644 | { |
… | |
… | |
1655 | * filename is the pathname for the current map. This should be called from |
1655 | * filename is the pathname for the current map. This should be called from |
1656 | * weather_effect() |
1656 | * weather_effect() |
1657 | */ |
1657 | */ |
1658 | |
1658 | |
1659 | static void |
1659 | static void |
1660 | let_it_snow (mapstruct *m, int wx, int wy) |
1660 | let_it_snow (maptile *m, int wx, int wy) |
1661 | { |
1661 | { |
1662 | int x, y, i; |
1662 | int x, y, i; |
1663 | uint32 nx, ny, j, d; |
1663 | uint32 nx, ny, j, d; |
1664 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1664 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1665 | const char *doublestack, *doublestack2; |
1665 | const char *doublestack, *doublestack2; |
… | |
… | |
1906 | * filename is the pathname for the current map. This should be called from |
1906 | * filename is the pathname for the current map. This should be called from |
1907 | * weather_effect() |
1907 | * weather_effect() |
1908 | */ |
1908 | */ |
1909 | |
1909 | |
1910 | static void |
1910 | static void |
1911 | singing_in_the_rain (mapstruct *m, int wx, int wy) |
1911 | singing_in_the_rain (maptile *m, int wx, int wy) |
1912 | { |
1912 | { |
1913 | int x, y, i; |
1913 | int x, y, i; |
1914 | uint32 nx, ny, d, j; |
1914 | uint32 nx, ny, d, j; |
1915 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1915 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1916 | object *ob, *tmp, *oldsnow, *topfloor; |
1916 | object *ob, *tmp, *oldsnow, *topfloor; |
… | |
… | |
2178 | * filename is the pathname for the current map. This should be called from |
2178 | * filename is the pathname for the current map. This should be called from |
2179 | * weather_effect() |
2179 | * weather_effect() |
2180 | */ |
2180 | */ |
2181 | |
2181 | |
2182 | static void |
2182 | static void |
2183 | plant_a_garden (mapstruct *m, int wx, int wy) |
2183 | plant_a_garden (maptile *m, int wx, int wy) |
2184 | { |
2184 | { |
2185 | uint32 x, y, i; |
2185 | uint32 x, y, i; |
2186 | int avoid, two, temp, sky, gotsnow, found, days; |
2186 | int avoid, two, temp, sky, gotsnow, found, days; |
2187 | object *ob, *tmp; |
2187 | object *ob, *tmp; |
2188 | archetype *at; |
2188 | archetype *at; |
… | |
… | |
2282 | * the weathermap coordinates for the weathermap square we want to work on. |
2282 | * the weathermap coordinates for the weathermap square we want to work on. |
2283 | * This should be called from weather_effect() |
2283 | * This should be called from weather_effect() |
2284 | */ |
2284 | */ |
2285 | |
2285 | |
2286 | static void |
2286 | static void |
2287 | change_the_world (mapstruct *m, int wx, int wy) |
2287 | change_the_world (maptile *m, int wx, int wy) |
2288 | { |
2288 | { |
2289 | int x, y, i; |
2289 | int x, y, i; |
2290 | uint32 nx, ny, j, d; |
2290 | uint32 nx, ny, j, d; |
2291 | int avoid, two, temp, sky, gotsnow, found, days; |
2291 | int avoid, two, temp, sky, gotsnow, found, days; |
2292 | object *ob, *tmp, *doublestack; |
2292 | object *ob, *tmp, *doublestack; |
… | |
… | |
2426 | * the weathermap coordinates for the weathermap square we want to work on. |
2426 | * the weathermap coordinates for the weathermap square we want to work on. |
2427 | * This should be called from weather_effect() |
2427 | * This should be called from weather_effect() |
2428 | */ |
2428 | */ |
2429 | #if 0 |
2429 | #if 0 |
2430 | static void |
2430 | static void |
2431 | feather_map (mapstruct *m, int wx, int wy) |
2431 | feather_map (maptile *m, int wx, int wy) |
2432 | { |
2432 | { |
2433 | uint32 x, y, i, nx, ny, j; |
2433 | uint32 x, y, i, nx, ny, j; |
2434 | int avoid, two, gotsnow, nodstk; |
2434 | int avoid, two, gotsnow, nodstk; |
2435 | object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; |
2435 | object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; |
2436 | archetype *at; |
2436 | archetype *at; |
… | |
… | |
2530 | the current mapname (must be a worldmap), and your coordinates on the |
2530 | the current mapname (must be a worldmap), and your coordinates on the |
2531 | map. returns -1 if you give it something it can't figure out. 0 normally. |
2531 | map. returns -1 if you give it something it can't figure out. 0 normally. |
2532 | */ |
2532 | */ |
2533 | |
2533 | |
2534 | int |
2534 | int |
2535 | worldmap_to_weathermap (int x, int y, int *wx, int *wy, mapstruct *m) |
2535 | worldmap_to_weathermap (int x, int y, int *wx, int *wy, maptile *m) |
2536 | { |
2536 | { |
2537 | int spwtx, spwty; |
2537 | int spwtx, spwty; |
2538 | uint32 fx, fy; |
2538 | uint32 fx, fy; |
2539 | uint32 nx, ny; |
2539 | uint32 nx, ny; |
2540 | char *filename = m->path; |
2540 | char *filename = m->path; |
… | |
… | |
2783 | /* Given a worldmap name, and x and y on that map, compute the temperature |
2783 | /* Given a worldmap name, and x and y on that map, compute the temperature |
2784 | for a specific square. Used to normalize elevation. |
2784 | for a specific square. Used to normalize elevation. |
2785 | */ |
2785 | */ |
2786 | |
2786 | |
2787 | int |
2787 | int |
2788 | real_world_temperature (int x, int y, mapstruct *m) |
2788 | real_world_temperature (int x, int y, maptile *m) |
2789 | { |
2789 | { |
2790 | int wx, wy, temp, eleva, elevb; |
2790 | int wx, wy, temp, eleva, elevb; |
2791 | object *op; |
2791 | object *op; |
2792 | |
2792 | |
2793 | /*LOG(llevDebug, "real_world_temperature: worldmaptoweathermap : %s\n",m->path); */ |
2793 | /*LOG(llevDebug, "real_world_temperature: worldmaptoweathermap : %s\n",m->path); */ |