version 1.15 | | version 1.16 |
---|
| | |
/* | | /* |
* static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
* "$Id: weather.c,v 1.15 2002/11/26 21:53:29 garbled Exp $"; | | * "$Id: weather.c,v 1.16 2002/11/26 22:13:10 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
{NULL, NULL, NULL, 0}, | | {NULL, NULL, NULL, 0}, |
}; | | }; |
| | |
| | /* |
| | * Set the darkness level for a map. Requires the map pointer. |
| | */ |
| | |
void set_darkness_map(mapstruct *m) | | void set_darkness_map(mapstruct *m) |
{ | | { |
int i; | | int i; |
| | |
change_map_light(m, season_timechange[tod.season][i]); | | change_map_light(m, season_timechange[tod.season][i]); |
} | | } |
| | |
| | /* |
| | * Compute the darkness level for all maps in the game. Requires the |
| | * time of day as an argument. |
| | */ |
| | |
void dawn_to_dusk(timeofday_t *tod) | | void dawn_to_dusk(timeofday_t *tod) |
{ | | { |
mapstruct *m; | | mapstruct *m; |
| | |
fclose(fp); | | fclose(fp); |
} | | } |
| | |
/* initialize both humidity and elevation */ | | /* |
| | * initialize both humidity and elevation |
| | */ |
| | |
void init_humid_elev() | | void init_humid_elev() |
{ | | { |
| | |
int wmperformstartx; | | int wmperformstartx; |
int wmperformstarty; | | int wmperformstarty; |
| | |
| | /* |
| | * This function initializes the weather system. It should be called once, |
| | * at game startup only. |
| | */ |
| | |
| | |
void init_weather() | | void init_weather() |
{ | | { |
int x, y, tx, ty; | | int x, y, tx, ty; |
| | |
fclose(fp); | | fclose(fp); |
} | | } |
| | |
/* perform actual effect of weather. Should be called from perform_weather, | | /* |
or when a map is loaded. (player enter map). Filename is the name of | | * perform actual effect of weather. Should be called from perform_weather, |
the map. The map *must allready be loaded*. | | * or when a map is loaded. (player enter map). Filename is the name of |
| | * the map. The map *must allready be loaded*. |
This is where things like snow, herbs, earthly rototilling, etc should | | * |
occur. | | * This is where things like snow, herbs, earthly rototilling, etc should |
| | * occur. |
*/ | | */ |
| | |
void weather_effect(char *filename) | | void weather_effect(char *filename) |
| | |
| | |
} | | } |
| | |
| | /* |
| | * Check the current square to see if we should avoid this one for |
| | * weather processing. Must pass av and gs, which will be filled in |
| | * with 1 or 0. gs will be 1 if we found snow/rain here. av will be |
| | * 1 if we should avoid processing this tile. (don't rain on lakes) |
| | * x and y are the coordinates inside the current map m. Returns |
| | * the object pointer for any snow item it found, so you can destroy/melt it |
| | */ |
| | |
object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs) | | object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs) |
{ | | { |
int avoid, gotsnow, i; | | int avoid, gotsnow, i; |
| | |
return tmp; | | return tmp; |
} | | } |
| | |
| | /* |
| | * Process snow. m is the map we are currently processing. wx and wy are |
| | * 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 |
| | * weather_effect() |
| | */ |
| | |
void let_it_snow(mapstruct *m, int wx, int wy, char *filename) | | void let_it_snow(mapstruct *m, int wx, int wy, char *filename) |
{ | | { |
int x, y, i; | | int x, y, i; |
| | |
} | | } |
} | | } |
| | |
| | /* |
| | * Process rain. m is the map we are currently processing. wx and wy are |
| | * 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 |
| | * 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, char *filename) |
{ | | { |
int x, y, i; | | int x, y, i; |
| | |
return(mapname); | | return(mapname); |
} | | } |
| | |
| | /* |
| | * Calculates the distance to the nearest pole. x,y are the weathermap |
| | * coordinates, equator is the current location of the equator. returns |
| | * distance as an int. |
| | */ |
| | |
| | |
int polar_distance(int x, int y, int equator) | | int polar_distance(int x, int y, int equator) |
{ | | { |
if ((x+y) > equator) { /* south pole */ | | if ((x+y) > equator) { /* south pole */ |
| | |
} | | } |
} | | } |
| | |
/* update the humidity */ | | /* |
| | * update the humidity for all weathermap tiles. |
| | */ |
| | |
void update_humid() | | void update_humid() |
{ | | { |
| | |
weathermap[x][y].humid = humid_tile(x, y); | | weathermap[x][y].humid = humid_tile(x, y); |
} | | } |
| | |
/* calculate the humidity of this tile */ | | /* |
| | * calculate the humidity of this tile. x and y are the weathermap coordinates |
| | * we wish to calculate humidity for. Returns the humidity of the weathermap |
| | * square. |
| | */ |
| | |
int humid_tile(int x, int y) | | int humid_tile(int x, int y) |
{ | | { |
| | |
return humid; | | return humid; |
} | | } |
| | |
/* calculate temperature */ | | /* |
| | * calculate temperature of the weathermap square x,y. Requires the current |
| | * time of day in *tod. |
| | */ |
| | |
void temperature_calc(int x, int y, timeofday_t *tod) | | void temperature_calc(int x, int y, timeofday_t *tod) |
{ | | { |
| | |
} | | } |
| | |
/* Compute the real (adjusted) temperature of a given weathermap tile. | | /* Compute the real (adjusted) temperature of a given weathermap tile. |
This takes into account the wind, base temp, sunlight, and other fun | | * This takes into account the wind, base temp, sunlight, and other fun |
things. Seasons are automatically handled by moving the equator. | | * things. Seasons are automatically handled by moving the equator. |
Elevation is partially considered in the base temp. | | * Elevation is partially considered in the base temp. x and y are the |
| | * weathermap coordinates. |
*/ | | */ |
| | |
int real_temperature(int x, int y) | | int real_temperature(int x, int y) |
| | |
| | |
} | | } |
| | |
/* perform small randomizations in the pressure map. Then, apply the | | /* |
smoothing algorithim.. This causes the pressure to change very slowly | | * perform small randomizations in the pressure map. Then, apply the |
| | * smoothing algorithim.. This causes the pressure to change very slowly |
*/ | | */ |
| | |
void perform_pressure() | | void perform_pressure() |
| | |
} | | } |
| | |
| | |
/* is direction a similar to direction b? Find out in this exciting function | | /* |
below. | | * is direction a similar to direction b? Find out in this exciting function |
| | * below. Returns 1 if true, 0 for false. |
*/ | | */ |
| | |
int similar_direction(int a, int b) | | int similar_direction(int a, int b) |
| | |
} | | } |
| | |
/* | | /* |
It doesn't really smooth it as such. The main function of this is to | | * It doesn't really smooth it as such. The main function of this is to |
apply the pressuremap to the wind direction and speed. Then, we run | | * apply the pressuremap to the wind direction and speed. Then, we run |
a quick pass to update the windspeed. | | * a quick pass to update the windspeed. |
*/ | | */ |
| | |
void smooth_wind() | | void smooth_wind() |
| | |
} | | } |
} | | } |
| | |
| | /* |
| | * Plot the gulfstream map over the wind map. This is done after the wind, |
| | * to avoid the windsmoothing scrambling the jet stream. |
| | */ |
| | |
void plot_gulfstream() | | void plot_gulfstream() |
{ | | { |
int x, y, tx; | | int x, y, tx; |
| | |
| | |
} | | } |
| | |
/* let the madness, begin. */ | | /* |
| | * let the madness, begin. |
| | * |
| | * This function is the one that ties everything together. Here we loop |
| | * over all the weathermaps, and compare the various conditions we have |
| | * calculated up to now, to figure out what the sky conditions are for this |
| | * square. |
| | */ |
| | |
void compute_sky() | | void compute_sky() |
{ | | { |
| | |
} | | } |
} | | } |
| | |
| | /* |
| | * Keep track of how much rain has fallen in a given weathermap square. |
| | */ |
| | |
void process_rain() | | void process_rain() |
{ | | { |
int x, y, rain; | | int x, y, rain; |