/* * Copyright 1987 by Mark Weiser. * Permission to reproduce and use in any manner whatsoever is granted * so long as this copyright and other identifying marks of authorship * in the code and the game remain intact and visible. */ /* includes needed by definitions in here, and so may as well put here */ #include #include #include #include #include #include #include #include /* General Definitions */ #undef min #undef max #define ABS(x) (((x) < 0) ? -(x) : (x)) #define DOWN 1 #define UP -1 #define TRUE 1 #define FALSE 0 #define FIELD_MARGIN field_margin #define USER_NAME (user_name[0] == '\0' ? (char *)xv_get(user_name_item, PANEL_VALUE) : user_name) #define SAVE_FILE_NAME (save_file_name[0] == '\0' ? (char *)xv_get(save_file_item, PANEL_VALUE) : save_file_name) /* space to leave on either side of row of cities. */ #define MARGIN 30 /* minimum window size */ #define MINWIN 128+(MARGIN*2)+(FIELD_MARGIN*2) /* Definitions affecting blasts */ extern struct circ { int num_circles; Xv_Window *circles; Xv_Window *masks } *lasercircles, *laserkillcircles, *bigblastcircles, *littleblastcircles, *blastkillcircles, *citykillcircles, *littlerockcircles, *bigrockcircles, *init_circ(); extern Xv_Window *blankcircles; extern int blast_count; struct blast { Xv_Window pw; short x, y, circ, width; short orig_y; /* used only for hashing */ short x_inc, y_inc; short num_circles; Xv_Window *circles; Xv_Window *masks; struct blast *next; Rect r; }; #define MAX_LINES 1024 #define MAX_NUM_CIRCLES 8 #define MAX_CIRCLE 64 #define CIRCLE_SIZE_INC (MAX_CIRCLE/(MAX_NUM_CIRCLES+1)) #define B_WIDTH(bid) ((bid)->width) #define B_HEIGHT(bid) ((bid)->width) #define B_OFFSET_X(bid) ((bid)->x-(B_WIDTH(bid)/2)) #define B_OFFSET_Y(bid) ((bid)->y-(B_HEIGHT(bid)/2)) /* Definitions affecting missiles */ extern int missile_count, burst_distance; struct missile { Xv_Window pw; short start_x, start_y, old_x, old_y, x, y, inc_x, inc_y, slip_cnt, slip, speed, refs, destroyed; struct missile *next; }; /* Definitions affecting everybody */ extern int suspended; extern long blast_delay; extern Xv_Window citypw, launchpw; extern int max_x, max_y; extern int foe_value, running; extern Panel_item level_item, interceptor_item, foe_item, score_item, ballistic_item, btime_item, next_round_item, new_game_item, skill_item, resume_item, suspend_item, laser_item, non_stop_item, name_item, rock_item, user_name_item, save_file_item; extern char user_name[], save_file_name[]; extern Canvas citycanvas; extern Frame cityframe, controlframe, launchframe; extern char *panel_common[]; Xv_Window make_circle(); extern char *get_name(); extern char *getenv(); extern void next_round_proc(), quit_proc(), master_proc(), no_events(), suspend_proc(), resume_proc(), open_proc(), scores_proc(), end_proc(), help_proc(), about_proc(), higher_proc(), cycle_time_proc(), save_proc(), restore_proc(), text_options_proc(), instructions_proc(), cursor_notify_proc(), icon_option_proc(), misc_options_proc(), ballistic_time_proc(), new_game_proc(), non_stop_notify_proc(), version_proc(), new_game_proc(), draw_background(), do_with_delay(), round_time_proc(), missile_delay_proc(), realistic_proc(); extern Canvas launchcanvas; extern int launch_delay; extern int num_cities; void no_events(); extern int total_cities_lost; #define NUM_SCORES 10 extern struct scores { char name[64]; int score, level, skill; } sc[], *sc_end; extern float carryover_divisor, foe_divisor; extern int foe_factor; extern int min_missile_speed, max_missile_speed; extern char *scorefile; extern Xv_Font font; extern Xv_Window need_a_bell; extern int field_margin; extern Panel_item total_foe_item; char *build_scores(); extern Xv_Window city_pw, tmpcity_pw, melted_city_pw, another_city; extern int city_grow_speed; extern int continuous, ballistic_delay, round_duration, missile_delay, time_to_play, restoring_game, cursor_type, starting_skill, gamemaster; extern Panel_item round_item, launch_interval_item, cycle_item, ballistic_time_item; extern Cms sdi_colormap, sdi_panel_colormap; extern char *sdi_colormap_name, *sdi_panel_colormap_name; extern int coloroffset; extern Panel controlpanel; extern Menu things_to_read_menu;