From: nhmall Date: Wed, 27 Jan 2021 02:06:16 +0000 (-0500) Subject: switch source tree from k&r to c99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f963c5aca764596c2616d10e4ff2942fc31b5a88;p=nethack switch source tree from k&r to c99 --- diff --git a/include/decl.h b/include/decl.h index 42ae0eed6..b79a61760 100644 --- a/include/decl.h +++ b/include/decl.h @@ -707,8 +707,8 @@ struct instance_globals { struct entity occupants[ENTITIES]; /* decl.c */ - int NDECL((*occupation)); - int NDECL((*afternmv)); + int (*occupation)(void); + int (*afternmv)(void); const char *hname; /* name of the game (argv[0] of main) */ int hackpid; /* current process id */ char chosen_windowtype[WINTYPELEN]; diff --git a/include/dlb.h b/include/dlb.h index 4c1e5e583..2fff03046 100644 --- a/include/dlb.h +++ b/include/dlb.h @@ -44,7 +44,7 @@ typedef struct dlb_library { #define DLBFILE dlbfilename #define DLBBASENAME "nhdat" extern char dlbfilename[MAX_DLB_FILENAME]; -extern char *FDECL(build_dlb_filename, (const char *)); +extern char *build_dlb_filename(const char *); #endif #endif #ifndef FILENAME_CMP @@ -75,16 +75,16 @@ typedef struct dlb_handle { #define DLB_P dlb * #endif -boolean NDECL(dlb_init); -void NDECL(dlb_cleanup); +boolean dlb_init(void); +void dlb_cleanup(void); -dlb *FDECL(dlb_fopen, (const char *, const char *)); -int FDECL(dlb_fclose, (DLB_P)); -int FDECL(dlb_fread, (char *, int, int, DLB_P)); -int FDECL(dlb_fseek, (DLB_P, long, int)); -char *FDECL(dlb_fgets, (char *, int, DLB_P)); -int FDECL(dlb_fgetc, (DLB_P)); -long FDECL(dlb_ftell, (DLB_P)); +dlb *dlb_fopen(const char *, const char *); +int dlb_fclose(DLB_P); +int dlb_fread(char *, int, int, DLB_P); +int dlb_fseek(DLB_P, long, int); +char *dlb_fgets(char *, int, DLB_P); +int dlb_fgetc(DLB_P); +long dlb_ftell(DLB_P); /* Resource DLB entry points */ #ifdef DLBRSRC diff --git a/include/extern.h b/include/extern.h index b3eaec219..74870cb79 100644 --- a/include/extern.h +++ b/include/extern.h @@ -5,14 +5,12 @@ #ifndef EXTERN_H #define EXTERN_H -#define E extern - /* ### alloc.c ### */ #if 0 -E long *FDECL(alloc, (unsigned int)); +extern long *alloc(unsigned int); #endif -E char *FDECL(fmt_ptr, (const genericptr)); +extern char *fmt_ptr(const void *); /* This next pre-processor directive covers almost the entire file, * interrupted only occasionally to pick up specific functions as needed. */ @@ -20,126 +18,122 @@ E char *FDECL(fmt_ptr, (const genericptr)); /* ### allmain.c ### */ -E void FDECL(moveloop, (BOOLEAN_P)); -E void NDECL(stop_occupation); -E void NDECL(display_gamewindows); -E void NDECL(newgame); -E void FDECL(welcome, (BOOLEAN_P)); -E time_t NDECL(get_realtime); -E int FDECL(argcheck, (int, char **, enum earlyarg)); -E void NDECL(early_init); +extern void moveloop(boolean); +extern void stop_occupation(void); +extern void display_gamewindows(void); +extern void newgame(void); +extern void welcome(boolean); +extern time_t get_realtime(void); +extern int argcheck(int, char **, enum earlyarg); +extern void early_init(void); /* ### apply.c ### */ -E int NDECL(doapply); -E int NDECL(dorub); -E int NDECL(dojump); -E int FDECL(jump, (int)); -E int NDECL(number_leashed); -E void FDECL(o_unleash, (struct obj *)); -E void FDECL(m_unleash, (struct monst *, BOOLEAN_P)); -E void NDECL(unleash_all); -E boolean FDECL(leashable, (struct monst *)); -E boolean NDECL(next_to_u); -E struct obj *FDECL(get_mleash, (struct monst *)); -E const char *NDECL(beautiful); -E void FDECL(check_leash, (XCHAR_P, XCHAR_P)); -E boolean FDECL(um_dist, (XCHAR_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(snuff_candle, (struct obj *)); -E boolean FDECL(snuff_lit, (struct obj *)); -E boolean FDECL(splash_lit, (struct obj *)); -E boolean FDECL(catch_lit, (struct obj *)); -E void FDECL(use_unicorn_horn, (struct obj **)); -E boolean FDECL(tinnable, (struct obj *)); -E void NDECL(reset_trapset); -E void FDECL(fig_transform, (ANY_P *, long)); -E int FDECL(unfixable_trouble_count, (BOOLEAN_P)); +extern int doapply(void); +extern int dorub(void); +extern int dojump(void); +extern int jump(int); +extern int number_leashed(void); +extern void o_unleash(struct obj *); +extern void m_unleash(struct monst *, boolean); +extern void unleash_all(void); +extern boolean leashable(struct monst *); +extern boolean next_to_u(void); +extern struct obj *get_mleash(struct monst *); +extern const char *beautiful(void); +extern void check_leash(xchar, xchar); +extern boolean um_dist(xchar, xchar, xchar); +extern boolean snuff_candle(struct obj *); +extern boolean snuff_lit(struct obj *); +extern boolean splash_lit(struct obj *); +extern boolean catch_lit(struct obj *); +extern void use_unicorn_horn(struct obj **); +extern boolean tinnable(struct obj *); +extern void reset_trapset(void); +extern void fig_transform(union any *, long); +extern int unfixable_trouble_count(boolean); /* ### artifact.c ### */ -E void NDECL(init_artifacts); -E void FDECL(save_artifacts, (NHFILE *)); -E void FDECL(restore_artifacts, (NHFILE *)); -E const char *FDECL(artiname, (int)); -E struct obj *FDECL(mk_artifact, (struct obj *, ALIGNTYP_P)); -E const char *FDECL(artifact_name, (const char *, short *)); -E boolean FDECL(exist_artifact, (int, const char *)); -E void FDECL(artifact_exists, (struct obj *, const char *, BOOLEAN_P)); -E int NDECL(nartifact_exist); -E boolean FDECL(arti_immune, (struct obj *, int)); -E boolean FDECL(spec_ability, (struct obj *, unsigned long)); -E boolean FDECL(confers_luck, (struct obj *)); -E boolean FDECL(arti_reflects, (struct obj *)); -E boolean FDECL(shade_glare, (struct obj *)); -E boolean FDECL(restrict_name, (struct obj *, const char *)); -E boolean FDECL(defends, (int, struct obj *)); -E boolean FDECL(defends_when_carried, (int, struct obj *)); -E boolean FDECL(protects, (struct obj *, BOOLEAN_P)); -E void FDECL(set_artifact_intrinsic, (struct obj *, BOOLEAN_P, long)); -E int FDECL(touch_artifact, (struct obj *, struct monst *)); -E int FDECL(spec_abon, (struct obj *, struct monst *)); -E int FDECL(spec_dbon, (struct obj *, struct monst *, int)); -E void FDECL(discover_artifact, (XCHAR_P)); -E boolean FDECL(undiscovered_artifact, (XCHAR_P)); -E int FDECL(disp_artifact_discoveries, (winid)); -E boolean FDECL(artifact_hit, (struct monst *, struct monst *, struct obj *, - int *, int)); -E int NDECL(doinvoke); -E boolean FDECL(finesse_ahriman, (struct obj *)); -E void FDECL(arti_speak, (struct obj *)); -E boolean FDECL(artifact_light, (struct obj *)); -E long FDECL(spec_m2, (struct obj *)); -E boolean FDECL(artifact_has_invprop, (struct obj *, UCHAR_P)); -E long FDECL(arti_cost, (struct obj *)); -E struct obj *FDECL(what_gives, (long *)); -E const char *FDECL(glow_color, (int)); -E const char *FDECL(glow_verb, (int, BOOLEAN_P)); -E void FDECL(Sting_effects, (int)); -E int FDECL(retouch_object, (struct obj **, BOOLEAN_P)); -E void FDECL(retouch_equipment, (int)); -E void NDECL(mkot_trap_warn); -E boolean FDECL(is_magic_key, (struct monst *, struct obj *)); -E struct obj *FDECL(has_magic_key, (struct monst *)); +extern void init_artifacts(void); +extern void save_artifacts(NHFILE *); +extern void restore_artifacts(NHFILE *); +extern const char *artiname(int); +extern struct obj *mk_artifact(struct obj *, aligntyp); +extern const char *artifact_name(const char *, short *); +extern boolean exist_artifact(int, const char *); +extern void artifact_exists(struct obj *, const char *, boolean); +extern int nartifact_exist(void); +extern boolean arti_immune(struct obj *, int); +extern boolean spec_ability(struct obj *, unsigned long); +extern boolean confers_luck(struct obj *); +extern boolean arti_reflects(struct obj *); +extern boolean shade_glare(struct obj *); +extern boolean restrict_name(struct obj *, const char *); +extern boolean defends(int, struct obj *); +extern boolean defends_when_carried(int, struct obj *); +extern boolean protects(struct obj *, boolean); +extern void set_artifact_intrinsic(struct obj *, boolean, long); +extern int touch_artifact(struct obj *, struct monst *); +extern int spec_abon(struct obj *, struct monst *); +extern int spec_dbon(struct obj *, struct monst *, int); +extern void discover_artifact(xchar); +extern boolean undiscovered_artifact(xchar); +extern int disp_artifact_discoveries(winid); +extern boolean artifact_hit(struct monst *, struct monst *, struct obj *, + int *, int); +extern int doinvoke(void); +extern boolean finesse_ahriman(struct obj *); +extern void arti_speak(struct obj *); +extern boolean artifact_light(struct obj *); +extern long spec_m2(struct obj *); +extern boolean artifact_has_invprop(struct obj *, uchar); +extern long arti_cost(struct obj *); +extern struct obj *what_gives(long *); +extern const char *glow_color(int); +extern const char *glow_verb(int, boolean); +extern void Sting_effects(int); +extern int retouch_object(struct obj **, boolean); +extern void retouch_equipment(int); +extern void mkot_trap_warn(void); +extern boolean is_magic_key(struct monst *, struct obj *); +extern struct obj *has_magic_key(struct monst *); /* ### attrib.c ### */ -E boolean FDECL(adjattrib, (int, int, int)); -E void FDECL(gainstr, (struct obj *, int, BOOLEAN_P)); -E void FDECL(losestr, (int)); -E void FDECL(poisontell, (int, BOOLEAN_P)); -E void FDECL(poisoned, (const char *, int, const char *, int, BOOLEAN_P)); -E void FDECL(change_luck, (SCHAR_P)); -E int FDECL(stone_luck, (BOOLEAN_P)); -E void NDECL(set_moreluck); -E void NDECL(restore_attrib); -E void FDECL(exercise, (int, BOOLEAN_P)); -E void NDECL(exerchk); -E void FDECL(init_attr, (int)); -E void NDECL(redist_attr); -E void FDECL(adjabil, (int, int)); -E int NDECL(newhp); -E schar FDECL(acurr, (int)); -E schar NDECL(acurrstr); -E boolean FDECL(extremeattr, (int)); -E void FDECL(adjalign, (int)); -E int FDECL(is_innate, (int)); -E char *FDECL(from_what, (int)); -E void FDECL(uchangealign, (int, int)); +extern boolean adjattrib(int, int, int); +extern void gainstr(struct obj *, int, boolean); +extern void losestr(int); +extern void poisontell(int, boolean); +extern void poisoned(const char *, int, const char *, int, boolean); +extern void change_luck(schar); +extern int stone_luck(boolean); +extern void set_moreluck(void); +extern void restore_attrib(void); +extern void exercise(int, boolean); +extern void exerchk(void); +extern void init_attr(int); +extern void redist_attr(void); +extern void adjabil(int, int); +extern int newhp(void); +extern schar acurr(int); +extern schar acurrstr(void); +extern boolean extremeattr(int); +extern void adjalign(int); +extern int is_innate(int); +extern char *from_what(int); +extern void uchangealign(int, int); /* ### ball.c ### */ -E void FDECL(ballrelease, (BOOLEAN_P)); -E void NDECL(ballfall); +extern void ballrelease(boolean); +extern void ballfall(void); #ifndef BREADCRUMBS -E void NDECL(placebc); -E void NDECL(unplacebc); -E int NDECL(unplacebc_and_covet_placebc); -E void FDECL(lift_covet_and_placebc, (int)); +extern void placebc(void); +extern void unplacebc(void); +extern int unplacebc_and_covet_placebc(void); +extern void lift_covet_and_placebc(int); #else -E void FDECL(Placebc, (const char *, int)); -E void FDECL(Unplacebc, (const char *, int)); -E int FDECL(Unplacebc_and_covet_placebc, (const char *, int)); -E void FDECL(Lift_covet_and_placebc, (int, const char *, int)); #define placebc() Placebc(__FUNCTION__, __LINE__) #define unplacebc() Unplacebc(__FUNCTION__, __LINE__) #define unplacebc_and_covet_placebc() \ @@ -147,812 +141,803 @@ E void FDECL(Lift_covet_and_placebc, (int, const char *, int)); #define lift_covet_and_placebc(x) \ Lift_covet_and_placebc(x, __FUNCTION__, __LINE__) #endif -E void FDECL(set_bc, (int)); -E void FDECL(move_bc, (int, int, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(drag_ball, (XCHAR_P, XCHAR_P, int *, xchar *, xchar *, - xchar *, xchar *, boolean *, BOOLEAN_P)); -E void FDECL(drop_ball, (XCHAR_P, XCHAR_P)); -E void NDECL(drag_down); -E void NDECL(bc_sanity_check); +extern void set_bc(int); +extern void move_bc(int, int, xchar, xchar, xchar, xchar); +extern boolean drag_ball(xchar, xchar, int *, xchar *, xchar *, xchar *, + xchar *, boolean *, boolean); +extern void drop_ball(xchar, xchar); +extern void drag_down(void); +extern void bc_sanity_check(void); /* ### bones.c ### */ -E void FDECL(sanitize_name, (char *)); -E void FDECL(drop_upon_death, (struct monst *, struct obj *, int, int)); -E boolean NDECL(can_make_bones); -E void FDECL(savebones, (int, time_t, struct obj *)); -E int NDECL(getbones); -E boolean FDECL(bones_include_name, (const char *)); +extern void sanitize_name(char *); +extern void drop_upon_death(struct monst *, struct obj *, int, int); +extern boolean can_make_bones(void); +extern void savebones(int, time_t, struct obj *); +extern int getbones(void); +extern boolean bones_include_name(const char *); /* ### botl.c ### */ -E char *NDECL(do_statusline1); -E void NDECL(check_gold_symbol); -E char *NDECL(do_statusline2); -E void NDECL(bot); -E void NDECL(timebot); -E int FDECL(xlev_to_rank, (int)); -E int FDECL(rank_to_xlev, (int)); -E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P)); -E int FDECL(title_to_mon, (const char *, int *, int *)); -E void NDECL(max_rank_sz); +extern char *do_statusline1(void); +extern void check_gold_symbol(void); +extern char *do_statusline2(void); +extern void bot(void); +extern void timebot(void); +extern int xlev_to_rank(int); +extern int rank_to_xlev(int); +extern const char *rank_of(int, short, boolean); +extern int title_to_mon(const char *, int *, int *); +extern void max_rank_sz(void); #ifdef SCORE_ON_BOTL -E long NDECL(botl_score); -#endif -E int FDECL(describe_level, (char *)); -E void FDECL(status_initialize, (BOOLEAN_P)); -E void NDECL(status_finish); -E boolean NDECL(exp_percent_changing); -E int NDECL(stat_cap_indx); -E int NDECL(stat_hunger_indx); -E const char *FDECL(bl_idx_to_fldname, (int)); -E void FDECL(condopt, (int, boolean *, BOOLEAN_P)); -E int FDECL(parse_cond_option, (BOOLEAN_P, char *)); -E void NDECL(cond_menu); +extern long botl_score(void); +#endif +extern int describe_level(char *); +extern void status_initialize(boolean); +extern void status_finish(void); +extern boolean exp_percent_changing(void); +extern int stat_cap_indx(void); +extern int stat_hunger_indx(void); +extern const char *bl_idx_to_fldname(int); +extern void condopt(int, boolean *, boolean); +extern int parse_cond_option(boolean, char *); +extern void cond_menu(void); #ifdef STATUS_HILITES -E void NDECL(status_eval_next_unhilite); -E void NDECL(reset_status_hilites); -E boolean FDECL(parse_status_hl1, (char *op, BOOLEAN_P)); -E void FDECL(status_notify_windowport, (BOOLEAN_P)); -E void NDECL(clear_status_hilites); -E int NDECL(count_status_hilites); -E boolean NDECL(status_hilite_menu); -#endif +extern void status_eval_next_unhilite(void); +extern void reset_status_hilites(void); +extern boolean parse_status_hl1(char *op, boolean); +extern void status_notify_windowport(boolean); +extern void clear_status_hilites(void); +extern int count_status_hilites(void); +extern boolean status_hilite_menu(void); +#endif /* STATUS_HILITES */ /* ### cmd.c ### */ -E char NDECL(randomkey); -E void FDECL(random_response, (char *, int)); -E int NDECL(rnd_extcmd_idx); -E int NDECL(domonability); -E char FDECL(cmd_from_func, (int NDECL((*)))); -E const char *FDECL(cmdname_from_func, (int NDECL((*)), char *, BOOLEAN_P)); -E boolean FDECL(redraw_cmd, (CHAR_P)); -E const char *FDECL(levltyp_to_name, (int)); -E void NDECL(reset_occupations); -E void FDECL(set_occupation, (int (*)(void), const char *, int)); -E char NDECL(pgetchar); -E void FDECL(pushch, (CHAR_P)); -E void FDECL(savech, (CHAR_P)); -E const char *FDECL(key2extcmddesc, (UCHAR_P)); -E boolean FDECL(bind_specialkey, (UCHAR_P, const char *)); -E uchar FDECL(txt2key, (char *)); -E void FDECL(parseautocomplete, (char *, BOOLEAN_P)); -E void FDECL(reset_commands, (BOOLEAN_P)); -E void FDECL(rhack, (char *)); -E int NDECL(doextlist); -E int NDECL(extcmd_via_menu); -E int NDECL(enter_explore_mode); -E boolean FDECL(bind_key, (UCHAR_P, const char *)); -E void NDECL(dokeylist); -E int FDECL(xytod, (SCHAR_P, SCHAR_P)); -E void FDECL(dtoxy, (coord *, int)); -E int FDECL(movecmd, (CHAR_P)); -E int NDECL(dxdy_moveok); -E int FDECL(getdir, (const char *)); -E void NDECL(confdir); -E const char *FDECL(directionname, (int)); -E int FDECL(isok, (int, int)); -E int FDECL(get_adjacent_loc, - (const char *, const char *, XCHAR_P, XCHAR_P, coord *)); -E const char *FDECL(click_to_cmd, (int, int, int)); -E char FDECL(get_count, (char *, CHAR_P, long, long *, BOOLEAN_P)); +extern char randomkey(void); +extern void random_response(char *, int); +extern int rnd_extcmd_idx(void); +extern int domonability(void); +extern char cmd_from_func(int(*)(void)); +extern const char *cmdname_from_func(int(*)(void), char *, boolean); +extern boolean redraw_cmd(char); +extern const char *levltyp_to_name(int); +extern void reset_occupations(void); +extern void set_occupation(int(*)(void), const char *, int); +extern char pgetchar(void); +extern void pushch(char); +extern void savech(char); +extern const char *key2extcmddesc(uchar); +extern boolean bind_specialkey(uchar, const char *); +extern uchar txt2key(char *); +extern void parseautocomplete(char *, boolean); +extern void reset_commands(boolean); +extern void rhack(char *); +extern int doextlist(void); +extern int extcmd_via_menu(void); +extern int enter_explore_mode(void); +extern boolean bind_key(uchar, const char *); +extern void dokeylist(void); +extern int xytod(schar, schar); +extern void dtoxy(coord *, int); +extern int movecmd(char); +extern int dxdy_moveok(void); +extern int getdir(const char *); +extern void confdir(void); +extern const char *directionname(int); +extern int isok(int, int); +extern int get_adjacent_loc(const char *, const char *, xchar, xchar, coord *); +extern const char *click_to_cmd(int, int, int); +extern char get_count(char *, char, long, long *, boolean); #ifdef HANGUPHANDLING -E void FDECL(hangup, (int)); -E void NDECL(end_of_input); +extern void hangup(int); +extern void end_of_input(void); #endif -E char NDECL(readchar); -E void NDECL(sanity_check); -E char* FDECL(key2txt, (UCHAR_P, char *)); -E char FDECL(yn_function, (const char *, const char *, CHAR_P)); -E boolean FDECL(paranoid_query, (BOOLEAN_P, const char *)); -E void FDECL(makemap_prepost, (BOOLEAN_P, BOOLEAN_P)); +extern char readchar(void); +extern void sanity_check(void); +extern char* key2txt(uchar, char *); +extern char yn_function(const char *, const char *, char); +extern boolean paranoid_query(boolean, const char *); +extern void makemap_prepost(boolean, boolean); /* ### dbridge.c ### */ -E boolean FDECL(is_pool, (int, int)); -E boolean FDECL(is_lava, (int, int)); -E boolean FDECL(is_pool_or_lava, (int, int)); -E boolean FDECL(is_ice, (int, int)); -E boolean FDECL(is_moat, (int, int)); -E schar FDECL(db_under_typ, (int)); -E int FDECL(is_drawbridge_wall, (int, int)); -E boolean FDECL(is_db_wall, (int, int)); -E boolean FDECL(find_drawbridge, (int *, int *)); -E boolean FDECL(create_drawbridge, (int, int, int, BOOLEAN_P)); -E void FDECL(open_drawbridge, (int, int)); -E void FDECL(close_drawbridge, (int, int)); -E void FDECL(destroy_drawbridge, (int, int)); +extern boolean is_pool(int, int); +extern boolean is_lava(int, int); +extern boolean is_pool_or_lava(int, int); +extern boolean is_ice(int, int); +extern boolean is_moat(int, int); +extern schar db_under_typ(int); +extern int is_drawbridge_wall(int, int); +extern boolean is_db_wall(int, int); +extern boolean find_drawbridge(int *, int *); +extern boolean create_drawbridge(int, int, int, boolean); +extern void open_drawbridge(int, int); +extern void close_drawbridge(int, int); +extern void destroy_drawbridge(int, int); /* ### decl.c ### */ -E void NDECL(decl_globals_init); +extern void decl_globals_init(void); /* ### detect.c ### */ -E boolean FDECL(trapped_chest_at, (int, int, int)); -E boolean FDECL(trapped_door_at, (int, int, int)); -E struct obj *FDECL(o_in, (struct obj *, CHAR_P)); -E struct obj *FDECL(o_material, (struct obj *, unsigned)); -E int FDECL(gold_detect, (struct obj *)); -E int FDECL(food_detect, (struct obj *)); -E int FDECL(object_detect, (struct obj *, int)); -E int FDECL(monster_detect, (struct obj *, int)); -E int FDECL(trap_detect, (struct obj *)); -E const char *FDECL(level_distance, (d_level *)); -E void FDECL(use_crystal_ball, (struct obj **)); -E void NDECL(do_mapping); -E void FDECL(do_vicinity_map, (struct obj *)); -E void FDECL(cvt_sdoor_to_door, (struct rm *)); -E int NDECL(findit); -E int NDECL(openit); -E boolean FDECL(detecting, (void (*)(int, int, genericptr))); -E void FDECL(find_trap, (struct trap *)); -E void NDECL(warnreveal); -E int FDECL(dosearch0, (int)); -E int NDECL(dosearch); -E void NDECL(sokoban_detect); +extern boolean trapped_chest_at(int, int, int); +extern boolean trapped_door_at(int, int, int); +extern struct obj *o_in(struct obj *, char); +extern struct obj *o_material(struct obj *, unsigned); +extern int gold_detect(struct obj *); +extern int food_detect(struct obj *); +extern int object_detect(struct obj *, int); +extern int monster_detect(struct obj *, int); +extern int trap_detect(struct obj *); +extern const char *level_distance(d_level *); +extern void use_crystal_ball(struct obj **); +extern void do_mapping(void); +extern void do_vicinity_map(struct obj *); +extern void cvt_sdoor_to_door(struct rm *); +extern int findit(void); +extern int openit(void); +extern boolean detecting(void(*)(int, int, void *)); +extern void find_trap(struct trap *); +extern void warnreveal(void); +extern int dosearch0(int); +extern int dosearch(void); +extern void sokoban_detect(void); #ifdef DUMPLOG -E void NDECL(dump_map); +extern void dump_map(void); #endif -E void FDECL(reveal_terrain, (int, int)); -E int NDECL(wiz_mgender); +extern void reveal_terrain(int, int); +extern int wiz_mgender(void); /* ### dig.c ### */ -E int FDECL(dig_typ, (struct obj *, XCHAR_P, XCHAR_P)); -E boolean NDECL(is_digging); -E int NDECL(holetime); -E boolean FDECL(dig_check, (struct monst *, BOOLEAN_P, int, int)); -E void FDECL(digactualhole, (int, int, struct monst *, int)); -E boolean FDECL(dighole, (BOOLEAN_P, BOOLEAN_P, coord *)); -E int FDECL(use_pick_axe, (struct obj *)); -E int FDECL(use_pick_axe2, (struct obj *)); -E boolean FDECL(mdig_tunnel, (struct monst *)); -E void FDECL(draft_message, (BOOLEAN_P)); -E void FDECL(watch_dig, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void NDECL(zap_dig); -E struct obj *FDECL(bury_an_obj, (struct obj *, boolean *)); -E void FDECL(bury_objs, (int, int)); -E void FDECL(unearth_objs, (int, int)); -E void FDECL(rot_organic, (ANY_P *, long)); -E void FDECL(rot_corpse, (ANY_P *, long)); -E struct obj *FDECL(buried_ball, (coord *)); -E void NDECL(buried_ball_to_punishment); -E void NDECL(buried_ball_to_freedom); -E schar FDECL(fillholetyp, (int, int, BOOLEAN_P)); -E void FDECL(liquid_flow, - (XCHAR_P, XCHAR_P, SCHAR_P, struct trap *, const char *)); -E boolean FDECL(conjoined_pits, (struct trap *, struct trap *, BOOLEAN_P)); +extern int dig_typ(struct obj *, xchar, xchar); +extern boolean is_digging(void); +extern int holetime(void); +extern boolean dig_check(struct monst *, boolean, int, int); +extern void digactualhole(int, int, struct monst *, int); +extern boolean dighole(boolean, boolean, coord *); +extern int use_pick_axe(struct obj *); +extern int use_pick_axe2(struct obj *); +extern boolean mdig_tunnel(struct monst *); +extern void draft_message(boolean); +extern void watch_dig(struct monst *, xchar, xchar, boolean); +extern void zap_dig(void); +extern struct obj *bury_an_obj(struct obj *, boolean *); +extern void bury_objs(int, int); +extern void unearth_objs(int, int); +extern void rot_organic(union any *, long); +extern void rot_corpse(union any *, long); +extern struct obj *buried_ball(coord *); +extern void buried_ball_to_punishment(void); +extern void buried_ball_to_freedom(void); +extern schar fillholetyp(int, int, boolean); +extern void liquid_flow(xchar, xchar, schar, struct trap *, const char *); +extern boolean conjoined_pits(struct trap *, struct trap *, boolean); #if 0 -E void FDECL(bury_monst, (struct monst *)); -E void NDECL(bury_you); -E void NDECL(unearth_you); -E void NDECL(escape_tomb); -E void FDECL(bury_obj, (struct obj *)); +extern void bury_monst(struct monst *); +extern void bury_you(void); +extern void unearth_you(void); +extern void escape_tomb(void); +extern void bury_obj(struct obj *); #endif #ifdef DEBUG -extern int NDECL(wiz_debug_cmd_bury); +extern int wiz_debug_cmd_bury(void); #endif - /* ### display.c ### */ -E void FDECL(magic_map_background, (XCHAR_P, XCHAR_P, int)); -E void FDECL(map_background, (XCHAR_P, XCHAR_P, int)); -E void FDECL(map_trap, (struct trap *, int)); -E void FDECL(map_object, (struct obj *, int)); -E void FDECL(map_invisible, (XCHAR_P, XCHAR_P)); -E boolean FDECL(unmap_invisible, (int, int)); -E void FDECL(unmap_object, (int, int)); -E void FDECL(map_location, (int, int, int)); -E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P)); -E void FDECL(feel_location, (XCHAR_P, XCHAR_P)); -E void FDECL(newsym, (int, int)); -E void FDECL(newsym_force, (int, int)); -E void FDECL(shieldeff, (XCHAR_P, XCHAR_P)); -E void FDECL(tmp_at, (int, int)); -E void FDECL(flash_glyph_at, (int, int, int, int)); -E void FDECL(swallowed, (int)); -E void FDECL(under_ground, (int)); -E void FDECL(under_water, (int)); -E void NDECL(see_monsters); -E void NDECL(set_mimic_blocking); -E void NDECL(see_objects); -E void NDECL(see_traps); -E void NDECL(curs_on_u); -E int NDECL(doredraw); -E void NDECL(docrt); -E void NDECL(redraw_map); -E void FDECL(show_glyph, (int, int, int)); -E void NDECL(clear_glyph_buffer); -E void FDECL(row_refresh, (int, int, int)); -E void NDECL(cls); -E void FDECL(flush_screen, (int)); -E int FDECL(back_to_glyph, (XCHAR_P, XCHAR_P)); -E int FDECL(zapdir_to_glyph, (int, int, int)); -E int FDECL(glyph_at, (XCHAR_P, XCHAR_P)); -E void NDECL(reglyph_darkroom); -E void NDECL(set_wall_state); -E void FDECL(unset_seenv, (struct rm *, int, int, int, int)); -E int FDECL(warning_of, (struct monst *)); -E void FDECL(map_glyphinfo, (XCHAR_P, XCHAR_P, int, unsigned, glyph_info *)); +extern void magic_map_background(xchar, xchar, int); +extern void map_background(xchar, xchar, int); +extern void map_trap(struct trap *, int); +extern void map_object(struct obj *, int); +extern void map_invisible(xchar, xchar); +extern boolean unmap_invisible(int, int); +extern void unmap_object(int, int); +extern void map_location(int, int, int); +extern void feel_newsym(xchar, xchar); +extern void feel_location(xchar, xchar); +extern void newsym(int, int); +extern void newsym_force(int, int); +extern void shieldeff(xchar, xchar); +extern void tmp_at(int, int); +extern void flash_glyph_at(int, int, int, int); +extern void swallowed(int); +extern void under_ground(int); +extern void under_water(int); +extern void see_monsters(void); +extern void set_mimic_blocking(void); +extern void see_objects(void); +extern void see_traps(void); +extern void curs_on_u(void); +extern int doredraw(void); +extern void docrt(void); +extern void redraw_map(void); +extern void show_glyph(int, int, int); +extern void clear_glyph_buffer(void); +extern void row_refresh(int, int, int); +extern void cls(void); +extern void flush_screen(int); +extern int back_to_glyph(xchar, xchar); +extern int zapdir_to_glyph(int, int, int); +extern int glyph_at(xchar, xchar); +extern void reglyph_darkroom(void); +extern void set_wall_state(void); +extern void unset_seenv(struct rm *, int, int, int, int); +extern int warning_of(struct monst *); +extern void map_glyphinfo(xchar, xchar, int, unsigned, glyph_info *); /* ### do.c ### */ -E int NDECL(dodrop); -E boolean FDECL(boulder_hits_pool, (struct obj *, int, int, BOOLEAN_P)); -E boolean FDECL(flooreffects, (struct obj *, int, int, const char *)); -E void FDECL(doaltarobj, (struct obj *)); -E boolean FDECL(canletgo, (struct obj *, const char *)); -E void FDECL(dropx, (struct obj *)); -E void FDECL(dropy, (struct obj *)); -E void FDECL(dropz, (struct obj *, BOOLEAN_P)); -E void FDECL(obj_no_longer_held, (struct obj *)); -E int NDECL(doddrop); -E int NDECL(dodown); -E int NDECL(doup); +extern int dodrop(void); +extern boolean boulder_hits_pool(struct obj *, int, int, boolean); +extern boolean flooreffects(struct obj *, int, int, const char *); +extern void doaltarobj(struct obj *); +extern boolean canletgo(struct obj *, const char *); +extern void dropx(struct obj *); +extern void dropy(struct obj *); +extern void dropz(struct obj *, boolean); +extern void obj_no_longer_held(struct obj *); +extern int doddrop(void); +extern int dodown(void); +extern int doup(void); #ifdef INSURANCE -E void NDECL(save_currentstate); -#endif -E void FDECL(u_collide_m, (struct monst *)); -E void FDECL(goto_level, (d_level *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E void NDECL(maybe_lvltport_feedback); -E void FDECL(schedule_goto, (d_level *, int, - const char *, const char *)); -E void NDECL(deferred_goto); -E boolean FDECL(revive_corpse, (struct obj *)); -E void FDECL(revive_mon, (ANY_P *, long)); -E void FDECL(zombify_mon, (ANY_P *, long)); -E boolean FDECL(cmd_safety_prevention, (const char *, const char *, int *)); -E int NDECL(donull); -E int NDECL(dowipe); -E void FDECL(legs_in_no_shape, (const char *, BOOLEAN_P)); -E void FDECL(set_wounded_legs, (long, int)); -E void FDECL(heal_legs, (int)); +extern void save_currentstate(void); +#endif +extern void u_collide_m(struct monst *); +extern void goto_level(d_level *, boolean, boolean, boolean); +extern void maybe_lvltport_feedback(void); +extern void schedule_goto(d_level *, int, const char *, const char *); +extern void deferred_goto(void); +extern boolean revive_corpse(struct obj *); +extern void revive_mon(union any *, long); +extern void zombify_mon(union any *, long); +extern boolean cmd_safety_prevention(const char *, const char *, int *); +extern int donull(void); +extern int dowipe(void); +extern void legs_in_no_shape(const char *, boolean); +extern void set_wounded_legs(long, int); +extern void heal_legs(int); /* ### do_name.c ### */ -E char *FDECL(dxdy_to_dist_descr, (int, int, BOOLEAN_P)); -E char *FDECL(coord_desc, (int, int, char *, CHAR_P)); -E boolean FDECL(getpos_menu, (coord *, int)); -E int FDECL(getpos, (coord *, BOOLEAN_P, const char *)); -E void FDECL(getpos_sethilite, (void (*f)(int), boolean (*d)(int,int))); -E void FDECL(new_mgivenname, (struct monst *, int)); -E void FDECL(free_mgivenname, (struct monst *)); -E void FDECL(new_oname, (struct obj *, int)); -E void FDECL(free_oname, (struct obj *)); -E const char *FDECL(safe_oname, (struct obj *)); -E struct monst *FDECL(christen_monst, (struct monst *, const char *)); -E struct obj *FDECL(oname, (struct obj *, const char *)); -E boolean FDECL(objtyp_is_callable, (int)); -E int NDECL(docallcmd); -E void FDECL(docall, (struct obj *)); -E const char *NDECL(rndghostname); -E char *FDECL(x_monnam, (struct monst *, int, const char *, int, BOOLEAN_P)); -E char *FDECL(l_monnam, (struct monst *)); -E char *FDECL(mon_nam, (struct monst *)); -E char *FDECL(noit_mon_nam, (struct monst *)); -E char *FDECL(Monnam, (struct monst *)); -E char *FDECL(noit_Monnam, (struct monst *)); -E char *FDECL(noname_monnam, (struct monst *, int)); -E char *FDECL(m_monnam, (struct monst *)); -E char *FDECL(y_monnam, (struct monst *)); -E char *FDECL(Adjmonnam, (struct monst *, const char *)); -E char *FDECL(Amonnam, (struct monst *)); -E char *FDECL(a_monnam, (struct monst *)); -E char *FDECL(distant_monnam, (struct monst *, int, char *)); -E char *FDECL(mon_nam_too, (struct monst *, struct monst *)); -E char *FDECL(monverbself, (struct monst *, char *, - const char *, const char *)); -E char *FDECL(minimal_monnam, (struct monst *, BOOLEAN_P)); -E char *FDECL(bogusmon, (char *, char *)); -E char *FDECL(rndmonnam, (char *)); -E const char *FDECL(hcolor, (const char *)); -E const char *NDECL(rndcolor); -E const char *FDECL(hliquid, (const char *)); -E const char *NDECL(roguename); -E struct obj *FDECL(realloc_obj, - (struct obj *, int, genericptr_t, int, const char *)); -E char *FDECL(coyotename, (struct monst *, char *)); -E char *FDECL(rndorcname, (char *)); -E struct monst *FDECL(christen_orc, (struct monst *, const char *, - const char *)); -E const char *FDECL(noveltitle, (int *)); -E const char *FDECL(lookup_novel, (const char *, int *)); +extern char *dxdy_to_dist_descr(int, int, boolean); +extern char *coord_desc(int, int, char *, char); +extern boolean getpos_menu(coord *, int); +extern int getpos(coord *, boolean, const char *); +extern void getpos_sethilite(void(*f)(int), boolean(*d)(int,int)); +extern void new_mgivenname(struct monst *, int); +extern void free_mgivenname(struct monst *); +extern void new_oname(struct obj *, int); +extern void free_oname(struct obj *); +extern const char *safe_oname(struct obj *); +extern struct monst *christen_monst(struct monst *, const char *); +extern struct obj *oname(struct obj *, const char *); +extern boolean objtyp_is_callable(int); +extern int docallcmd(void); +extern void docall(struct obj *); +extern const char *rndghostname(void); +extern char *x_monnam(struct monst *, int, const char *, int, boolean); +extern char *l_monnam(struct monst *); +extern char *mon_nam(struct monst *); +extern char *noit_mon_nam(struct monst *); +extern char *Monnam(struct monst *); +extern char *noit_Monnam(struct monst *); +extern char *noname_monnam(struct monst *, int); +extern char *m_monnam(struct monst *); +extern char *y_monnam(struct monst *); +extern char *Adjmonnam(struct monst *, const char *); +extern char *Amonnam(struct monst *); +extern char *a_monnam(struct monst *); +extern char *distant_monnam(struct monst *, int, char *); +extern char *mon_nam_too(struct monst *, struct monst *); +extern char *monverbself(struct monst *, char *, const char *, const char *); +extern char *minimal_monnam(struct monst *, boolean); +extern char *bogusmon(char *, char *); +extern char *rndmonnam(char *); +extern const char *hcolor(const char *); +extern const char *rndcolor(void); +extern const char *hliquid(const char *); +extern const char *roguename(void); +extern struct obj *realloc_obj(struct obj *, int, genericptr_t, int, + const char *); +extern char *coyotename(struct monst *, char *); +extern char *rndorcname(char *); +extern struct monst *christen_orc(struct monst *, const char *, const char *); +extern const char *noveltitle(int *); +extern const char *lookup_novel(const char *, int *); #ifndef PMNAME_MACROS -E int FDECL(Mgender, (struct monst *)); -E const char *FDECL(pmname, (struct permonst *, int)); -#endif /* PMNAME_MACROS */ +extern int Mgender(struct monst *); +extern const char *pmname(struct permonst *, int); +#endif /* ### do_wear.c ### */ -E const char *FDECL(fingers_or_gloves, (BOOLEAN_P)); -E void FDECL(off_msg, (struct obj *)); -E void FDECL(toggle_displacement, (struct obj *, long, BOOLEAN_P)); -E void FDECL(set_wear, (struct obj *)); -E boolean FDECL(donning, (struct obj *)); -E boolean FDECL(doffing, (struct obj *)); -E void FDECL(cancel_doff, (struct obj *, long)); -E void NDECL(cancel_don); -E int FDECL(stop_donning, (struct obj *)); -E int NDECL(Armor_off); -E int NDECL(Armor_gone); -E int NDECL(Helmet_off); -E int NDECL(Gloves_off); -E int NDECL(Boots_on); -E int NDECL(Boots_off); -E int NDECL(Cloak_off); -E int NDECL(Shield_off); -E int NDECL(Shirt_off); -E void NDECL(Amulet_off); -E void FDECL(Ring_on, (struct obj *)); -E void FDECL(Ring_off, (struct obj *)); -E void FDECL(Ring_gone, (struct obj *)); -E void FDECL(Blindf_on, (struct obj *)); -E void FDECL(Blindf_off, (struct obj *)); -E int NDECL(dotakeoff); -E int NDECL(doremring); -E int FDECL(cursed, (struct obj *)); -E int FDECL(armoroff, (struct obj *)); -E int FDECL(canwearobj, (struct obj *, long *, BOOLEAN_P)); -E int NDECL(dowear); -E int NDECL(doputon); -E void NDECL(find_ac); -E void NDECL(glibr); -E struct obj *FDECL(some_armor, (struct monst *)); -E struct obj *FDECL(stuck_ring, (struct obj *, int)); -E struct obj *NDECL(unchanger); -E void NDECL(reset_remarm); -E int NDECL(doddoremarm); -E int FDECL(destroy_arm, (struct obj *)); -E void FDECL(adj_abon, (struct obj *, SCHAR_P)); -E boolean -FDECL(inaccessible_equipment, (struct obj *, const char *, BOOLEAN_P)); +extern const char *fingers_or_gloves(boolean); +extern void off_msg(struct obj *); +extern void toggle_displacement(struct obj *, long, boolean); +extern void set_wear(struct obj *); +extern boolean donning(struct obj *); +extern boolean doffing(struct obj *); +extern void cancel_doff(struct obj *, long); +extern void cancel_don(void); +extern int stop_donning(struct obj *); +extern int Armor_off(void); +extern int Armor_gone(void); +extern int Helmet_off(void); +extern int Gloves_off(void); +extern int Boots_on(void); +extern int Boots_off(void); +extern int Cloak_off(void); +extern int Shield_off(void); +extern int Shirt_off(void); +extern void Amulet_off(void); +extern void Ring_on(struct obj *); +extern void Ring_off(struct obj *); +extern void Ring_gone(struct obj *); +extern void Blindf_on(struct obj *); +extern void Blindf_off(struct obj *); +extern int dotakeoff(void); +extern int doremring(void); +extern int cursed(struct obj *); +extern int armoroff(struct obj *); +extern int canwearobj(struct obj *, long *, boolean); +extern int dowear(void); +extern int doputon(void); +extern void find_ac(void); +extern void glibr(void); +extern struct obj *some_armor(struct monst *); +extern struct obj *stuck_ring(struct obj *, int); +extern struct obj *unchanger(void); +extern void reset_remarm(void); +extern int doddoremarm(void); +extern int destroy_arm(struct obj *); +extern void adj_abon(struct obj *, schar); +extern boolean inaccessible_equipment(struct obj *, const char *, boolean); /* ### dog.c ### */ -E void FDECL(newedog, (struct monst *)); -E void FDECL(free_edog, (struct monst *)); -E void FDECL(initedog, (struct monst *)); -E struct monst *FDECL(make_familiar, - (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E struct monst *NDECL(makedog); -E void NDECL(update_mlstmv); -E void NDECL(losedogs); -E void FDECL(mon_arrive, (struct monst *, BOOLEAN_P)); -E void FDECL(mon_catchup_elapsed_time, (struct monst *, long)); -E void FDECL(keepdogs, (BOOLEAN_P)); -E void FDECL(migrate_to_level, (struct monst *, XCHAR_P, XCHAR_P, coord *)); -E int FDECL(dogfood, (struct monst *, struct obj *)); -E boolean FDECL(tamedog, (struct monst *, struct obj *)); -E void FDECL(abuse_dog, (struct monst *)); -E void FDECL(wary_dog, (struct monst *, BOOLEAN_P)); +extern void newedog(struct monst *); +extern void free_edog(struct monst *); +extern void initedog(struct monst *); +extern struct monst *make_familiar(struct obj *, xchar, xchar, boolean); +extern struct monst *makedog(void); +extern void update_mlstmv(void); +extern void losedogs(void); +extern void mon_arrive(struct monst *, boolean); +extern void mon_catchup_elapsed_time(struct monst *, long); +extern void keepdogs(boolean); +extern void migrate_to_level(struct monst *, xchar, xchar, coord *); +extern int dogfood(struct monst *, struct obj *); +extern boolean tamedog(struct monst *, struct obj *); +extern void abuse_dog(struct monst *); +extern void wary_dog(struct monst *, boolean); /* ### dogmove.c ### */ -E boolean FDECL(cursed_object_at, (int, int)); -E struct obj *FDECL(droppables, (struct monst *)); -E int FDECL(dog_nutrition, (struct monst *, struct obj *)); -E int FDECL(dog_eat, (struct monst *, struct obj *, int, int, BOOLEAN_P)); -E int FDECL(dog_move, (struct monst *, int)); -E void FDECL(finish_meating, (struct monst *)); +extern boolean cursed_object_at(int, int); +extern struct obj *droppables(struct monst *); +extern int dog_nutrition(struct monst *, struct obj *); +extern int dog_eat(struct monst *, struct obj *, int, int, boolean); +extern int dog_move(struct monst *, int); +extern void finish_meating(struct monst *); /* ### dokick.c ### */ -E boolean FDECL(ghitm, (struct monst *, struct obj *)); -E void FDECL(container_impact_dmg, (struct obj *, XCHAR_P, XCHAR_P)); -E int NDECL(dokick); -E boolean FDECL(ship_object, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(obj_delivery, (BOOLEAN_P)); -E void FDECL(deliver_obj_to_mon, (struct monst *mtmp, int, unsigned long)); -E schar FDECL(down_gate, (XCHAR_P, XCHAR_P)); -E void FDECL(impact_drop, (struct obj *, XCHAR_P, XCHAR_P, XCHAR_P)); +extern boolean ghitm(struct monst *, struct obj *); +extern void container_impact_dmg(struct obj *, xchar, xchar); +extern int dokick(void); +extern boolean ship_object(struct obj *, xchar, xchar, boolean); +extern void obj_delivery(boolean); +extern void deliver_obj_to_mon(struct monst *mtmp, int, unsigned long); +extern schar down_gate(xchar, xchar); +extern void impact_drop(struct obj *, xchar, xchar, xchar); /* ### dothrow.c ### */ -E int FDECL(multishot_class_bonus, (int, struct obj *, struct obj *)); -E int NDECL(dothrow); -E int NDECL(dofire); -E void FDECL(endmultishot, (BOOLEAN_P)); -E void FDECL(hitfloor, (struct obj *, BOOLEAN_P)); -E void FDECL(hurtle, (int, int, int, BOOLEAN_P)); -E void FDECL(mhurtle, (struct monst *, int, int, int)); -E boolean FDECL(throwing_weapon, (struct obj *)); -E void FDECL(throwit, (struct obj *, long, BOOLEAN_P, struct obj *)); -E int FDECL(omon_adj, (struct monst *, struct obj *, BOOLEAN_P)); -E int FDECL(thitmonst, (struct monst *, struct obj *)); -E int FDECL(hero_breaks, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E int FDECL(breaks, (struct obj *, XCHAR_P, XCHAR_P)); -E void FDECL(release_camera_demon, (struct obj *, XCHAR_P, XCHAR_P)); -E void FDECL(breakobj, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(breaktest, (struct obj *)); -E boolean FDECL(walk_path, (coord *, coord *, - boolean (*)(genericptr, int, int), genericptr_t)); -E boolean FDECL(hurtle_jump, (genericptr_t, int, int)); -E boolean FDECL(hurtle_step, (genericptr_t, int, int)); +extern int multishot_class_bonus(int, struct obj *, struct obj *); +extern int dothrow(void); +extern int dofire(void); +extern void endmultishot(boolean); +extern void hitfloor(struct obj *, boolean); +extern void hurtle(int, int, int, boolean); +extern void mhurtle(struct monst *, int, int, int); +extern boolean throwing_weapon(struct obj *); +extern void throwit(struct obj *, long, boolean, struct obj *); +extern int omon_adj(struct monst *, struct obj *, boolean); +extern int thitmonst(struct monst *, struct obj *); +extern int hero_breaks(struct obj *, xchar, xchar, boolean); +extern int breaks(struct obj *, xchar, xchar); +extern void release_camera_demon(struct obj *, xchar, xchar); +extern void breakobj(struct obj *, xchar, xchar, boolean, boolean); +extern boolean breaktest(struct obj *); +extern boolean walk_path(coord *, coord *, boolean(*)(void *, int, int), + genericptr_t); +extern boolean hurtle_jump(genericptr_t, int, int); +extern boolean hurtle_step(genericptr_t, int, int); /* ### drawing.c ### */ -E int FDECL(def_char_to_objclass, (CHAR_P)); -E int FDECL(def_char_to_monclass, (CHAR_P)); -E int FDECL(def_char_is_furniture, (CHAR_P)); +extern int def_char_to_objclass(char); +extern int def_char_to_monclass(char); +extern int def_char_is_furniture(char); /* ### dungeon.c ### */ -E void FDECL(save_dungeon, (NHFILE *, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(restore_dungeon, (NHFILE *)); -E void FDECL(insert_branch, (branch *, BOOLEAN_P)); -E void NDECL(init_dungeons); -E s_level *FDECL(find_level, (const char *)); -E s_level *FDECL(Is_special, (d_level *)); -E branch *FDECL(Is_branchlev, (d_level *)); -E boolean FDECL(builds_up, (d_level *)); -E xchar FDECL(ledger_no, (d_level *)); -E xchar NDECL(maxledgerno); -E schar FDECL(depth, (d_level *)); -E xchar FDECL(dunlev, (d_level *)); -E xchar FDECL(dunlevs_in_dungeon, (d_level *)); -E xchar FDECL(ledger_to_dnum, (XCHAR_P)); -E xchar FDECL(ledger_to_dlev, (XCHAR_P)); -E xchar FDECL(deepest_lev_reached, (BOOLEAN_P)); -E boolean FDECL(on_level, (d_level *, d_level *)); -E void FDECL(next_level, (BOOLEAN_P)); -E void FDECL(prev_level, (BOOLEAN_P)); -E void FDECL(u_on_newpos, (int, int)); -E void FDECL(u_on_rndspot, (int)); -E void FDECL(stairway_add, (int,int, BOOLEAN_P, BOOLEAN_P, d_level *)); -E void NDECL(stairway_print); -E void NDECL(stairway_free_all); -E stairway *FDECL(stairway_at, (int, int)); -E stairway *FDECL(stairway_find, (d_level *)); -E stairway *FDECL(stairway_find_from, (d_level *, BOOLEAN_P)); -E stairway *FDECL(stairway_find_dir, (BOOLEAN_P)); -E stairway *FDECL(stairway_find_type_dir, (BOOLEAN_P, BOOLEAN_P)); -E stairway *FDECL(stairway_find_special_dir, (BOOLEAN_P)); -E void FDECL(u_on_sstairs, (int)); -E void NDECL(u_on_upstairs); -E void NDECL(u_on_dnstairs); -E boolean FDECL(On_stairs, (XCHAR_P, XCHAR_P)); -E boolean FDECL(On_ladder, (XCHAR_P, XCHAR_P)); -E boolean FDECL(On_stairs_up, (XCHAR_P, XCHAR_P)); -E boolean FDECL(On_stairs_dn, (XCHAR_P, XCHAR_P)); -E void FDECL(get_level, (d_level *, int)); -E boolean FDECL(Is_botlevel, (d_level *)); -E boolean FDECL(Can_fall_thru, (d_level *)); -E boolean FDECL(Can_dig_down, (d_level *)); -E boolean FDECL(Can_rise_up, (int, int, d_level *)); -E boolean FDECL(has_ceiling, (d_level *)); -E boolean FDECL(In_quest, (d_level *)); -E boolean FDECL(In_mines, (d_level *)); -E branch *FDECL(dungeon_branch, (const char *)); -E boolean FDECL(at_dgn_entrance, (const char *)); -E boolean FDECL(In_hell, (d_level *)); -E boolean FDECL(In_V_tower, (d_level *)); -E boolean FDECL(On_W_tower_level, (d_level *)); -E boolean FDECL(In_W_tower, (int, int, d_level *)); -E void FDECL(find_hell, (d_level *)); -E void FDECL(goto_hell, (BOOLEAN_P, BOOLEAN_P)); -E void FDECL(assign_level, (d_level *, d_level *)); -E void FDECL(assign_rnd_level, (d_level *, d_level *, int)); -E int FDECL(induced_align, (int)); -E boolean FDECL(Invocation_lev, (d_level *)); -E xchar NDECL(level_difficulty); -E schar FDECL(lev_by_name, (const char *)); -E schar FDECL(print_dungeon, (BOOLEAN_P, schar *, xchar *)); -E char *FDECL(get_annotation, (d_level *)); -E int NDECL(donamelevel); -E int NDECL(dooverview); -E void FDECL(show_overview, (int, int)); -E void FDECL(rm_mapseen, (int)); -E void FDECL(init_mapseen, (d_level *)); -E void NDECL(recalc_mapseen); -E void FDECL(mapseen_temple, (struct monst *)); -E void FDECL(room_discovered, (int)); -E void FDECL(recbranch_mapseen, (d_level *, d_level *)); -E void FDECL(overview_stats, (winid, const char *, long *, long *)); -E void FDECL(remdun_mapseen, (int)); -E const char *FDECL(endgamelevelname, (char *, int)); +extern void save_dungeon(NHFILE *, boolean, boolean); +extern void restore_dungeon(NHFILE *); +extern void insert_branch(branch *, boolean); +extern void init_dungeons(void); +extern s_level *find_level(const char *); +extern s_level *Is_special(d_level *); +extern branch *Is_branchlev(d_level *); +extern boolean builds_up(d_level *); +extern xchar ledger_no(d_level *); +extern xchar maxledgerno(void); +extern schar depth(d_level *); +extern xchar dunlev(d_level *); +extern xchar dunlevs_in_dungeon(d_level *); +extern xchar ledger_to_dnum(xchar); +extern xchar ledger_to_dlev(xchar); +extern xchar deepest_lev_reached(boolean); +extern boolean on_level(d_level *, d_level *); +extern void next_level(boolean); +extern void prev_level(boolean); +extern void u_on_newpos(int, int); +extern void u_on_rndspot(int); +extern void stairway_add(int,int, boolean, boolean, d_level *); +extern void stairway_print(void); +extern void stairway_free_all(void); +extern stairway *stairway_at(int, int); +extern stairway *stairway_find(d_level *); +extern stairway *stairway_find_from(d_level *, boolean); +extern stairway *stairway_find_dir(boolean); +extern stairway *stairway_find_type_dir(boolean, boolean); +extern stairway *stairway_find_special_dir(boolean); +extern void u_on_sstairs(int); +extern void u_on_upstairs(void); +extern void u_on_dnstairs(void); +extern boolean On_stairs(xchar, xchar); +extern boolean On_ladder(xchar, xchar); +extern boolean On_stairs_up(xchar, xchar); +extern boolean On_stairs_dn(xchar, xchar); +extern void get_level(d_level *, int); +extern boolean Is_botlevel(d_level *); +extern boolean Can_fall_thru(d_level *); +extern boolean Can_dig_down(d_level *); +extern boolean Can_rise_up(int, int, d_level *); +extern boolean has_ceiling(d_level *); +extern boolean In_quest(d_level *); +extern boolean In_mines(d_level *); +extern branch *dungeon_branch(const char *); +extern boolean at_dgn_entrance(const char *); +extern boolean In_hell(d_level *); +extern boolean In_V_tower(d_level *); +extern boolean On_W_tower_level(d_level *); +extern boolean In_W_tower(int, int, d_level *); +extern void find_hell(d_level *); +extern void goto_hell(boolean, boolean); +extern void assign_level(d_level *, d_level *); +extern void assign_rnd_level(d_level *, d_level *, int); +extern int induced_align(int); +extern boolean Invocation_lev(d_level *); +extern xchar level_difficulty(void); +extern schar lev_by_name(const char *); +extern schar print_dungeon(boolean, schar *, xchar *); +extern char *get_annotation(d_level *); +extern int donamelevel(void); +extern int dooverview(void); +extern void show_overview(int, int); +extern void rm_mapseen(int); +extern void init_mapseen(d_level *); +extern void recalc_mapseen(void); +extern void mapseen_temple(struct monst *); +extern void room_discovered(int); +extern void recbranch_mapseen(d_level *, d_level *); +extern void overview_stats(winid, const char *, long *, long *); +extern void remdun_mapseen(int); +extern const char *endgamelevelname(char *, int); /* ### eat.c ### */ -E void NDECL(eatmupdate); -E boolean FDECL(is_edible, (struct obj *)); -E void NDECL(init_uhunger); -E int NDECL(Hear_again); -E void NDECL(reset_eat); -E int NDECL(doeat); -E int FDECL(use_tin_opener, (struct obj *)); -E void NDECL(gethungry); -E void FDECL(morehungry, (int)); -E void FDECL(lesshungry, (int)); -E boolean NDECL(is_fainted); -E void NDECL(reset_faint); -E void NDECL(violated_vegetarian); -E void FDECL(newuhs, (BOOLEAN_P)); -E struct obj *FDECL(floorfood, (const char *, int)); -E void NDECL(vomit); -E int FDECL(eaten_stat, (int, struct obj *)); -E void FDECL(food_disappears, (struct obj *)); -E void FDECL(food_substitution, (struct obj *, struct obj *)); -E void FDECL(eating_conducts, (struct permonst *)); -E int FDECL(eat_brains, (struct monst *, struct monst *, BOOLEAN_P, int *)); -E void NDECL(fix_petrification); -E void FDECL(consume_oeaten, (struct obj *, int)); -E boolean FDECL(maybe_finished_meal, (BOOLEAN_P)); -E void FDECL(set_tin_variety, (struct obj *, int)); -E int FDECL(tin_variety_txt, (char *, int *)); -E void FDECL(tin_details, (struct obj *, int, char *)); -E boolean FDECL(Popeye, (int)); +extern void eatmupdate(void); +extern boolean is_edible(struct obj *); +extern void init_uhunger(void); +extern int Hear_again(void); +extern void reset_eat(void); +extern int doeat(void); +extern int use_tin_opener(struct obj *); +extern void gethungry(void); +extern void morehungry(int); +extern void lesshungry(int); +extern boolean is_fainted(void); +extern void reset_faint(void); +extern void violated_vegetarian(void); +extern void newuhs(boolean); +extern struct obj *floorfood(const char *, int); +extern void vomit(void); +extern int eaten_stat(int, struct obj *); +extern void food_disappears(struct obj *); +extern void food_substitution(struct obj *, struct obj *); +extern void eating_conducts(struct permonst *); +extern int eat_brains(struct monst *, struct monst *, boolean, int *); +extern void fix_petrification(void); +extern void consume_oeaten(struct obj *, int); +extern boolean maybe_finished_meal(boolean); +extern void set_tin_variety(struct obj *, int); +extern int tin_variety_txt(char *, int *); +extern void tin_details(struct obj *, int, char *); +extern boolean Popeye(int); /* ### end.c ### */ -E void FDECL(done1, (int)); -E int NDECL(done2); -E void FDECL(done_in_by, (struct monst *, int)); +extern void done1(int); +extern int done2(void); +extern void done_in_by(struct monst *, int); #endif /* !MAKEDEFS_C && MDLIB_C */ -E void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2) NORETURN; +extern void panic(const char *, ...) NORETURN; #if !defined(MAKEDEFS_C) && !defined(MDLIB_C) -E void FDECL(done, (int)); -E void FDECL(container_contents, (struct obj *, BOOLEAN_P, - BOOLEAN_P, BOOLEAN_P)); -E void FDECL(nh_terminate, (int)) NORETURN; -E void FDECL(delayed_killer, (int, int, const char *)); -E struct kinfo *FDECL(find_delayed_killer, (int)); -E void FDECL(dealloc_killer, (struct kinfo *)); -E void FDECL(save_killers, (NHFILE *)); -E void FDECL(restore_killers, (NHFILE *)); -E char *FDECL(build_english_list, (char *)); +extern void done(int); +extern void container_contents(struct obj *, boolean, boolean, boolean); +extern void nh_terminate(int) NORETURN; +extern void delayed_killer(int, int, const char *); +extern struct kinfo *find_delayed_killer(int); +extern void dealloc_killer(struct kinfo *); +extern void save_killers(NHFILE *); +extern void restore_killers(NHFILE *); +extern char *build_english_list(char *); #if defined(PANICTRACE) && !defined(NO_SIGNAL) -E void FDECL(panictrace_setsignals, (BOOLEAN_P)); +extern void panictrace_setsignals(boolean); #endif /* ### engrave.c ### */ -E char *FDECL(random_engraving, (char *)); -E void FDECL(wipeout_text, (char *, int, unsigned)); -E boolean FDECL(can_reach_floor, (BOOLEAN_P)); -E void FDECL(cant_reach_floor, (int, int, BOOLEAN_P, BOOLEAN_P)); -E const char *FDECL(surface, (int, int)); -E const char *FDECL(ceiling, (int, int)); -E struct engr *FDECL(engr_at, (XCHAR_P, XCHAR_P)); -E int FDECL(sengr_at, (const char *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(u_wipe_engr, (int)); -E void FDECL(wipe_engr_at, (XCHAR_P, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(read_engr_at, (int, int)); -E void FDECL(make_engr_at, (int, int, const char *, long, XCHAR_P)); -E void FDECL(del_engr_at, (int, int)); -E int NDECL(freehand); -E int NDECL(doengrave); -E void NDECL(sanitize_engravings); -E void FDECL(save_engravings, (NHFILE *)); -E void FDECL(rest_engravings, (NHFILE *)); -E void FDECL(engr_stats, (const char *, char *, long *, long *)); -E void FDECL(del_engr, (struct engr *)); -E void FDECL(rloc_engr, (struct engr *)); -E void FDECL(make_grave, (int, int, const char *)); +extern char *random_engraving(char *); +extern void wipeout_text(char *, int, unsigned); +extern boolean can_reach_floor(boolean); +extern void cant_reach_floor(int, int, boolean, boolean); +extern const char *surface(int, int); +extern const char *ceiling(int, int); +extern struct engr *engr_at(xchar, xchar); +extern int sengr_at(const char *, xchar, xchar, boolean); +extern void u_wipe_engr(int); +extern void wipe_engr_at(xchar, xchar, xchar, boolean); +extern void read_engr_at(int, int); +extern void make_engr_at(int, int, const char *, long, xchar); +extern void del_engr_at(int, int); +extern int freehand(void); +extern int doengrave(void); +extern void sanitize_engravings(void); +extern void save_engravings(NHFILE *); +extern void rest_engravings(NHFILE *); +extern void engr_stats(const char *, char *, long *, long *); +extern void del_engr(struct engr *); +extern void rloc_engr(struct engr *); +extern void make_grave(int, int, const char *); /* ### exper.c ### */ -E long FDECL(newuexp, (int)); -E int NDECL(newpw); -E int FDECL(experience, (struct monst *, int)); -E void FDECL(more_experienced, (int, int)); -E void FDECL(losexp, (const char *)); -E void NDECL(newexplevel); -E void FDECL(pluslvl, (BOOLEAN_P)); -E long FDECL(rndexp, (BOOLEAN_P)); +extern long newuexp(int); +extern int newpw(void); +extern int experience(struct monst *, int); +extern void more_experienced(int, int); +extern void losexp(const char *); +extern void newexplevel(void); +extern void pluslvl(boolean); +extern long rndexp(boolean); /* ### explode.c ### */ -E void FDECL(explode, (int, int, int, int, CHAR_P, int)); -E long FDECL(scatter, (int, int, int, unsigned int, struct obj *)); -E void FDECL(splatter_burning_oil, (int, int, BOOLEAN_P)); -E void FDECL(explode_oil, (struct obj *, int, int)); +extern void explode(int, int, int, int, char, int); +extern long scatter(int, int, int, unsigned int, struct obj *); +extern void splatter_burning_oil(int, int, boolean); +extern void explode_oil(struct obj *, int, int); /* ### extralev.c ### */ -E void NDECL(makeroguerooms); -E void FDECL(corr, (int, int)); -E void NDECL(makerogueghost); +extern void makeroguerooms(void); +extern void corr(int, int); +extern void makerogueghost(void); /* ### files.c ### */ -E char *FDECL(fname_encode, (const char *, CHAR_P, char *, char *, int)); -E char *FDECL(fname_decode, (CHAR_P, char *, char *, int)); -E const char *FDECL(fqname, (const char *, int, int)); -E FILE *FDECL(fopen_datafile, (const char *, const char *, int)); -E void FDECL(zero_nhfile, (NHFILE *)); -E void FDECL(close_nhfile, (NHFILE *)); -E void FDECL(rewind_nhfile, (NHFILE *)); -E void FDECL(set_levelfile_name, (char *, int)); -E NHFILE *FDECL(create_levelfile, (int, char *)); -E NHFILE *FDECL(open_levelfile, (int, char *)); -E void FDECL(delete_levelfile, (int)); -E void NDECL(clearlocks); -E NHFILE *FDECL(create_bonesfile, (d_level *, char **, char *)); -E void FDECL(commit_bonesfile, (d_level *)); -E NHFILE *FDECL(open_bonesfile, (d_level *, char **)); -E int FDECL(delete_bonesfile, (d_level *)); -E void NDECL(compress_bonesfile); -E void FDECL(set_savefile_name, (BOOLEAN_P)); +extern char *fname_encode(const char *, char, char *, char *, int); +extern char *fname_decode(char, char *, char *, int); +extern const char *fqname(const char *, int, int); +extern FILE *fopen_datafile(const char *, const char *, int); +extern void zero_nhfile(NHFILE *); +extern void close_nhfile(NHFILE *); +extern void rewind_nhfile(NHFILE *); +extern void set_levelfile_name(char *, int); +extern NHFILE *create_levelfile(int, char *); +extern NHFILE *open_levelfile(int, char *); +extern void delete_levelfile(int); +extern void clearlocks(void); +extern NHFILE *create_bonesfile(d_level *, char **, char *); +extern void commit_bonesfile(d_level *); +extern NHFILE *open_bonesfile(d_level *, char **); +extern int delete_bonesfile(d_level *); +extern void compress_bonesfile(void); +extern void set_savefile_name(boolean); #ifdef INSURANCE -E void FDECL(save_savefile_name, (NHFILE *)); +extern void save_savefile_name(NHFILE *); #endif #ifndef MICRO -E void NDECL(set_error_savefile); -#endif -E NHFILE *NDECL(create_savefile); -E NHFILE *NDECL(open_savefile); -E int NDECL(delete_savefile); -E NHFILE *NDECL(restore_saved_game); -E void FDECL(nh_compress, (const char *)); -E void FDECL(nh_uncompress, (const char *)); -E boolean FDECL(lock_file, (const char *, int, int)); -E void FDECL(unlock_file, (const char *)); +extern void set_error_savefile(void); +#endif +extern NHFILE *create_savefile(void); +extern NHFILE *open_savefile(void); +extern int delete_savefile(void); +extern NHFILE *restore_saved_game(void); +extern void nh_compress(const char *); +extern void nh_uncompress(const char *); +extern boolean lock_file(const char *, int, int); +extern void unlock_file(const char *); #ifdef USER_SOUNDS -E boolean FDECL(can_read_file, (const char *)); -#endif -E void FDECL(config_error_init, (BOOLEAN_P, const char *, BOOLEAN_P)); -E void FDECL(config_erradd, (const char *)); -E int NDECL(config_error_done); -E boolean FDECL(read_config_file, (const char *, int)); -E void FDECL(check_recordfile, (const char *)); -E void NDECL(read_wizkit); -E int FDECL(read_sym_file, (int)); -E int FDECL(parse_sym_line, (char *, int)); -E void FDECL(paniclog, (const char *, const char *)); -E void FDECL(testinglog, (const char *, const char *, const char *)); -E int FDECL(validate_prefix_locations, (char *)); +extern boolean can_read_file(const char *); +#endif +extern void config_error_init(boolean, const char *, boolean); +extern void config_erradd(const char *); +extern int config_error_done(void); +extern boolean read_config_file(const char *, int); +extern void check_recordfile(const char *); +extern void read_wizkit(void); +extern int read_sym_file(int); +extern int parse_sym_line(char *, int); +extern void paniclog(const char *, const char *); +extern void testinglog(const char *, const char *, const char *); +extern int validate_prefix_locations(char *); #ifdef SELECTSAVED -E char *FDECL(plname_from_file, (const char *)); +extern char *plname_from_file(const char *); #endif -E char **NDECL(get_saved_games); -E void FDECL(free_saved_games, (char **)); +extern char **get_saved_games(void); +extern void free_saved_games(char **); #ifdef SELF_RECOVER -E boolean NDECL(recover_savefile); +extern boolean recover_savefile(void); +extern void assure_syscf_file(void); #endif #ifdef SYSCF_FILE -E void NDECL(assure_syscf_file); +extern void assure_syscf_file(void); #endif -E int FDECL(nhclose, (int)); +extern int nhclose(int); #ifdef DEBUG -E boolean FDECL(debugcore, (const char *, BOOLEAN_P)); +extern boolean debugcore(const char *, boolean); #endif -E void NDECL(reveal_paths); -E boolean FDECL(read_tribute, (const char *, const char *, int, - char *, int, unsigned)); -E boolean FDECL(Death_quote, (char *, int)); +extern void reveal_paths(void); +extern boolean read_tribute(const char *, const char *, int, char *, int, + unsigned); +extern boolean Death_quote(char *, int); /* ### fountain.c ### */ -E void FDECL(floating_above, (const char *)); -E void FDECL(dogushforth, (int)); -E void FDECL(dryup, (XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void NDECL(drinkfountain); -E void FDECL(dipfountain, (struct obj *)); -E void FDECL(breaksink, (int, int)); -E void NDECL(drinksink); +extern void floating_above(const char *); +extern void dogushforth(int); +extern void dryup(xchar, xchar, boolean); +extern void drinkfountain(void); +extern void dipfountain(struct obj *); +extern void breaksink(int, int); +extern void drinksink(void); /* ### hack.c ### */ -E boolean FDECL(is_valid_travelpt, (int,int)); -E anything *FDECL(uint_to_any, (unsigned)); -E anything *FDECL(long_to_any, (long)); -E anything *FDECL(monst_to_any, (struct monst *)); -E anything *FDECL(obj_to_any, (struct obj *)); -E boolean FDECL(revive_nasty, (int, int, const char *)); -E int FDECL(still_chewing, (XCHAR_P, XCHAR_P)); -E void FDECL(movobj, (struct obj *, XCHAR_P, XCHAR_P)); -E boolean FDECL(may_dig, (XCHAR_P, XCHAR_P)); -E boolean FDECL(may_passwall, (XCHAR_P, XCHAR_P)); -E boolean FDECL(bad_rock, (struct permonst *, XCHAR_P, XCHAR_P)); -E int FDECL(cant_squeeze_thru, (struct monst *)); -E boolean FDECL(invocation_pos, (XCHAR_P, XCHAR_P)); -E boolean FDECL(test_move, (int, int, int, int, int)); +extern boolean is_valid_travelpt(int,int); +extern anything *uint_to_any(unsigned); +extern anything *long_to_any(long); +extern anything *monst_to_any(struct monst *); +extern anything *obj_to_any(struct obj *); +extern boolean revive_nasty(int, int, const char *); +extern int still_chewing(xchar, xchar); +extern void movobj(struct obj *, xchar, xchar); +extern boolean may_dig(xchar, xchar); +extern boolean may_passwall(xchar, xchar); +extern boolean bad_rock(struct permonst *, xchar, xchar); +extern int cant_squeeze_thru(struct monst *); +extern boolean invocation_pos(xchar, xchar); +extern boolean test_move(int, int, int, int, int); #ifdef DEBUG -E int NDECL(wiz_debug_cmd_traveldisplay); -#endif -E boolean NDECL(u_rooted); -E void NDECL(domove); -E void NDECL(overexert_hp); -E boolean NDECL(overexertion); -E void NDECL(invocation_message); -E void NDECL(switch_terrain); -E void FDECL(set_uinwater, (int)); -E boolean FDECL(pooleffects, (BOOLEAN_P)); -E void FDECL(spoteffects, (BOOLEAN_P)); -E char *FDECL(in_rooms, (XCHAR_P, XCHAR_P, int)); -E boolean FDECL(in_town, (int, int)); -E void FDECL(check_special_room, (BOOLEAN_P)); -E int NDECL(dopickup); -E void NDECL(lookaround); -E boolean FDECL(crawl_destination, (int, int)); -E int NDECL(monster_nearby); -E void FDECL(end_running, (BOOLEAN_P)); -E void FDECL(nomul, (int)); -E void FDECL(unmul, (const char *)); -E void FDECL(losehp, (int, const char *, BOOLEAN_P)); -E int NDECL(weight_cap); -E int NDECL(inv_weight); -E int NDECL(near_capacity); -E int FDECL(calc_capacity, (int)); -E int NDECL(max_capacity); -E boolean FDECL(check_capacity, (const char *)); -E int FDECL(inv_cnt, (BOOLEAN_P)); -E long FDECL(money_cnt, (struct obj *)); +extern int wiz_debug_cmd_traveldisplay(void); +#endif +extern boolean u_rooted(void); +extern void domove(void); +extern void overexert_hp(void); +extern boolean overexertion(void); +extern void invocation_message(void); +extern void switch_terrain(void); +extern void set_uinwater(int); +extern boolean pooleffects(boolean); +extern void spoteffects(boolean); +extern char *in_rooms(xchar, xchar, int); +extern boolean in_town(int, int); +extern void check_special_room(boolean); +extern int dopickup(void); +extern void lookaround(void); +extern boolean crawl_destination(int, int); +extern int monster_nearby(void); +extern void end_running(boolean); +extern void nomul(int); +extern void unmul(const char *); +extern void losehp(int, const char *, boolean); +extern int weight_cap(void); +extern int inv_weight(void); +extern int near_capacity(void); +extern int calc_capacity(int); +extern int max_capacity(void); +extern boolean check_capacity(const char *); +extern int inv_cnt(boolean); +extern long money_cnt(struct obj *); /* ### hacklib.c ### */ -E boolean FDECL(digit, (CHAR_P)); -E boolean FDECL(letter, (CHAR_P)); -E char FDECL(highc, (CHAR_P)); -E char FDECL(lowc, (CHAR_P)); -E char *FDECL(lcase, (char *)); -E char *FDECL(ucase, (char *)); -E char *FDECL(upstart, (char *)); -E char *FDECL(mungspaces, (char *)); -E char *FDECL(trimspaces, (char *)); -E char *FDECL(strip_newline, (char *)); -E char *FDECL(stripchars, (char *, const char *, const char *)); -E char *FDECL(stripdigits, (char *)); -E char *FDECL(eos, (char *)); -E boolean FDECL(str_end_is, (const char *, const char *)); -E int FDECL(str_lines_maxlen, (const char *)); -E char *FDECL(strkitten, (char *, CHAR_P)); -E void FDECL(copynchars, (char *, const char *, int)); -E char FDECL(chrcasecpy, (int, int)); -E char *FDECL(strcasecpy, (char *, const char *)); -E char *FDECL(s_suffix, (const char *)); -E char *FDECL(ing_suffix, (const char *)); -E char *FDECL(xcrypt, (const char *, char *)); -E boolean FDECL(onlyspace, (const char *)); -E char *FDECL(tabexpand, (char *)); -E char *FDECL(visctrl, (CHAR_P)); -E char *FDECL(strsubst, (char *, const char *, const char *)); -E int FDECL(strNsubst, (char *, const char *, const char *, int)); -E const char *FDECL(ordin, (int)); -E char *FDECL(sitoa, (int)); -E int FDECL(sgn, (int)); -E int FDECL(rounddiv, (long, int)); -E int FDECL(dist2, (int, int, int, int)); -E int FDECL(isqrt, (int)); -E int FDECL(distmin, (int, int, int, int)); -E boolean FDECL(online2, (int, int, int, int)); -E boolean FDECL(pmatch, (const char *, const char *)); -E boolean FDECL(pmatchi, (const char *, const char *)); -E boolean FDECL(pmatchz, (const char *, const char *)); +extern boolean digit(char); +extern boolean letter(char); +extern char highc(char); +extern char lowc(char); +extern char *lcase(char *); +extern char *ucase(char *); +extern char *upstart(char *); +extern char *mungspaces(char *); +extern char *trimspaces(char *); +extern char *strip_newline(char *); +extern char *stripchars(char *, const char *, const char *); +extern char *stripdigits(char *); +extern char *eos(char *); +extern boolean str_end_is(const char *, const char *); +extern int str_lines_maxlen(const char *); +extern char *strkitten(char *, char); +extern void copynchars(char *, const char *, int); +extern char chrcasecpy(int, int); +extern char *strcasecpy(char *, const char *); +extern char *s_suffix(const char *); +extern char *ing_suffix(const char *); +extern char *xcrypt(const char *, char *); +extern boolean onlyspace(const char *); +extern char *tabexpand(char *); +extern char *visctrl(char); +extern char *strsubst(char *, const char *, const char *); +extern int strNsubst(char *, const char *, const char *, int); +extern const char *ordin(int); +extern char *sitoa(int); +extern int sgn(int); +extern int rounddiv(long, int); +extern int dist2(int, int, int, int); +extern int isqrt(int); +extern int distmin(int, int, int, int); +extern boolean online2(int, int, int, int); +extern boolean pmatch(const char *, const char *); +extern boolean pmatchi(const char *, const char *); +extern boolean pmatchz(const char *, const char *); #ifndef STRNCMPI -E int FDECL(strncmpi, (const char *, const char *, int)); +extern int strncmpi(const char *, const char *, int); #endif #ifndef STRSTRI -E char *FDECL(strstri, (const char *, const char *)); -#endif -E boolean -FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P)); -E void FDECL(init_random, (int FDECL((*fn), (int)))); -E void FDECL(reseed_random, (int FDECL((*fn), (int)))); -E time_t NDECL(getnow); -E int NDECL(getyear); +extern char *strstri(const char *, const char *); +#endif +extern boolean fuzzymatch(const char *, const char *, const char *, boolean); +extern void init_random(int(*fn)(int)); +extern void reseed_random(int(*fn)(int)); +extern time_t getnow(void); +extern int getyear(void); #if 0 -E char *FDECL(yymmdd, (time_t)); -#endif -E long FDECL(yyyymmdd, (time_t)); -E long FDECL(hhmmss, (time_t)); -E char *FDECL(yyyymmddhhmmss, (time_t)); -E time_t FDECL(time_from_yyyymmddhhmmss, (char *)); -E int NDECL(phase_of_the_moon); -E boolean NDECL(friday_13th); -E int NDECL(night); -E int NDECL(midnight); -E void FDECL(strbuf_init, (strbuf_t *)); -E void FDECL(strbuf_append, (strbuf_t *, const char *)); -E void FDECL(strbuf_reserve, (strbuf_t *, int)); -E void FDECL(strbuf_empty, (strbuf_t *)); -E void FDECL(strbuf_nl_to_crlf, (strbuf_t *)); -E char *FDECL(nonconst, (const char *, char *)); -E int FDECL(swapbits, (int, int, int)); -E void FDECL(shuffle_int_array, (int *, int)); +extern char *yymmdd(time_t); +#endif +extern long yyyymmdd(time_t); +extern long hhmmss(time_t); +extern char *yyyymmddhhmmss(time_t); +extern time_t time_from_yyyymmddhhmmss(char *); +extern int phase_of_the_moon(void); +extern boolean friday_13th(void); +extern int night(void); +extern int midnight(void); +extern void strbuf_init(strbuf_t *); +extern void strbuf_append(strbuf_t *, const char *); +extern void strbuf_reserve(strbuf_t *, int); +extern void strbuf_empty(strbuf_t *); +extern void strbuf_nl_to_crlf(strbuf_t *); +extern char *nonconst(const char *, char *); +extern int swapbits(int, int, int); +extern void shuffle_int_array(int *, int); /* note: the snprintf CPP wrapper includes the "fmt" argument in "..." (__VA_ARGS__) to allow for zero arguments after fmt */ #define Snprintf(str, size, ...) \ @@ -962,1331 +947,1295 @@ extern void nh_snprintf(const char *func, int line, char *str, size_t size, /* ### insight.c ### */ -E int NDECL(doattributes); -E void FDECL(enlightenment, (int, int)); -E void FDECL(youhiding, (BOOLEAN_P, int)); -E char *FDECL(trap_predicament, (char *, int, BOOLEAN_P)); -E int NDECL(doconduct); -E void FDECL(show_conduct, (int)); -E void FDECL(record_achievement, (SCHAR_P)); -E boolean FDECL(remove_achievement, (SCHAR_P)); -E int NDECL(count_achievements); -E schar FDECL(achieve_rank, (int)); -E boolean NDECL(sokoban_in_play); -E int NDECL(dovanquished); -E int NDECL(doborn); -E void FDECL(list_vanquished, (CHAR_P, BOOLEAN_P)); -E int NDECL(num_genocides); -E void FDECL(list_genocided, (CHAR_P, BOOLEAN_P)); -E const char *FDECL(align_str, (ALIGNTYP_P)); -E char *FDECL(piousness, (BOOLEAN_P, const char *)); -E void FDECL(mstatusline, (struct monst *)); -E void NDECL(ustatusline); +extern int doattributes(void); +extern void enlightenment(int, int); +extern void youhiding(boolean, int); +extern char *trap_predicament(char *, int, boolean); +extern int doconduct(void); +extern void show_conduct(int); +extern void record_achievement(schar); +extern boolean remove_achievement(schar); +extern int count_achievements(void); +extern schar achieve_rank(int); +extern boolean sokoban_in_play(void); +extern int dovanquished(void); +extern int doborn(void); +extern void list_vanquished(char, boolean); +extern int num_genocides(void); +extern void list_genocided(char, boolean); +extern const char *align_str(aligntyp); +extern char *piousness(boolean, const char *); +extern void mstatusline(struct monst *); +extern void ustatusline(void); /* ### invent.c ### */ -E void FDECL(loot_classify, (Loot *, struct obj *)); -E Loot *FDECL(sortloot, (struct obj **, unsigned, BOOLEAN_P, - boolean (*)(OBJ_P))); -E void FDECL(unsortloot, (Loot **)); -E void FDECL(assigninvlet, (struct obj *)); -E struct obj *FDECL(merge_choice, (struct obj *, struct obj *)); -E int FDECL(merged, (struct obj **, struct obj **)); -E void FDECL(addinv_core1, (struct obj *)); -E void FDECL(addinv_core2, (struct obj *)); -E struct obj *FDECL(addinv, (struct obj *)); -E struct obj *FDECL(addinv_before, (struct obj *, struct obj *)); -E struct obj *FDECL(hold_another_object, (struct obj *, const char *, - const char *, const char *)); -E void FDECL(useupall, (struct obj *)); -E void FDECL(useup, (struct obj *)); -E void FDECL(consume_obj_charge, (struct obj *, BOOLEAN_P)); -E void FDECL(freeinv_core, (struct obj *)); -E void FDECL(freeinv, (struct obj *)); -E void FDECL(delallobj, (int, int)); -E void FDECL(delobj, (struct obj *)); -E struct obj *FDECL(sobj_at, (int, int, int)); -E struct obj *FDECL(nxtobj, (struct obj *, int, BOOLEAN_P)); -E struct obj *FDECL(carrying, (int)); -E boolean NDECL(have_lizard); -E struct obj *NDECL(u_carried_gloves); -E struct obj *NDECL(u_have_novel); -E struct obj *FDECL(o_on, (unsigned int, struct obj *)); -E boolean FDECL(obj_here, (struct obj *, int, int)); -E boolean NDECL(wearing_armor); -E boolean FDECL(is_worn, (struct obj *)); -E struct obj *FDECL(g_at, (int, int)); -E boolean FDECL(splittable, (struct obj *)); -E int FDECL(any_obj_ok, (struct obj *)); -E struct obj *FDECL(getobj, (const char *, int (*)(OBJ_P), unsigned int)); -E int FDECL(ggetobj, (const char *, int (*)(OBJ_P), int, - BOOLEAN_P, unsigned *)); -E int FDECL(askchain, (struct obj **, const char *, int, int (*)(OBJ_P), - int (*)(OBJ_P), int, const char *)); -E void FDECL(set_cknown_lknown, (struct obj *)); -E void FDECL(fully_identify_obj, (struct obj *)); -E int FDECL(identify, (struct obj *)); -E int FDECL(count_unidentified, (struct obj *)); -E void FDECL(identify_pack, (int, BOOLEAN_P)); -E void NDECL(learn_unseen_invent); -E void NDECL(update_inventory); -E void FDECL(prinv, (const char *, struct obj *, long)); -E char *FDECL(xprname, - (struct obj *, const char *, CHAR_P, BOOLEAN_P, long, long)); -E int NDECL(ddoinv); -E char FDECL(display_inventory, (const char *, BOOLEAN_P)); -E int FDECL(display_binventory, (int, int, BOOLEAN_P)); -E struct obj *FDECL(display_cinventory, (struct obj *)); -E struct obj *FDECL(display_minventory, (struct monst *, int, char *)); -E int NDECL(dotypeinv); -E const char *FDECL(dfeature_at, (int, int, char *)); -E int FDECL(look_here, (int, unsigned)); -E int NDECL(dolook); -E boolean FDECL(will_feel_cockatrice, (struct obj *, BOOLEAN_P)); -E void FDECL(feel_cockatrice, (struct obj *, BOOLEAN_P)); -E void FDECL(stackobj, (struct obj *)); -E boolean FDECL(mergable, (struct obj *, struct obj *)); -E int NDECL(doprgold); -E int NDECL(doprwep); -E int NDECL(doprarm); -E int NDECL(doprring); -E int NDECL(dopramulet); -E int NDECL(doprtool); -E int NDECL(doprinuse); -E void FDECL(useupf, (struct obj *, long)); -E char *FDECL(let_to_name, (CHAR_P, BOOLEAN_P, BOOLEAN_P)); -E void NDECL(free_invbuf); -E void NDECL(reassign); -E int NDECL(doorganize); -E void NDECL(free_pickinv_cache); -E int FDECL(count_unpaid, (struct obj *)); -E int FDECL(count_buc, (struct obj *, int, boolean (*)(OBJ_P))); -E void FDECL(tally_BUCX, (struct obj *, BOOLEAN_P, - int *, int *, int *, int *, int *)); -E long FDECL(count_contents, (struct obj *, - BOOLEAN_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(carry_obj_effects, (struct obj *)); -E const char *FDECL(currency, (long)); -E void FDECL(silly_thing, (const char *, struct obj *)); +extern void loot_classify(Loot *, struct obj *); +extern Loot *sortloot(struct obj **, unsigned, boolean, + boolean(*)(struct obj *)); +extern void unsortloot(Loot **); +extern void assigninvlet(struct obj *); +extern struct obj *merge_choice(struct obj *, struct obj *); +extern int merged(struct obj **, struct obj **); +extern void addinv_core1(struct obj *); +extern void addinv_core2(struct obj *); +extern struct obj *addinv(struct obj *); +extern struct obj *addinv_before(struct obj *, struct obj *); +extern struct obj *hold_another_object(struct obj *, const char *, + const char *, const char *); +extern void useupall(struct obj *); +extern void useup(struct obj *); +extern void consume_obj_charge(struct obj *, boolean); +extern void freeinv_core(struct obj *); +extern void freeinv(struct obj *); +extern void delallobj(int, int); +extern void delobj(struct obj *); +extern struct obj *sobj_at(int, int, int); +extern struct obj *nxtobj(struct obj *, int, boolean); +extern struct obj *carrying(int); +extern boolean have_lizard(void); +extern struct obj *u_carried_gloves(void); +extern struct obj *u_have_novel(void); +extern struct obj *o_on(unsigned int, struct obj *); +extern boolean obj_here(struct obj *, int, int); +extern boolean wearing_armor(void); +extern boolean is_worn(struct obj *); +extern struct obj *g_at(int, int); +extern boolean splittable(struct obj *); +extern int any_obj_ok(struct obj *); +extern struct obj *getobj(const char *, int(*)(struct obj *), unsigned int); +extern int ggetobj(const char *, int(*)(struct obj *), int, boolean, + unsigned *); +extern int askchain(struct obj **, const char *, int, int(*)(struct obj *), + int(*)(struct obj *), int, const char *); +extern void set_cknown_lknown(struct obj *); +extern void fully_identify_obj(struct obj *); +extern int identify(struct obj *); +extern int count_unidentified(struct obj *); +extern void identify_pack(int, boolean); +extern void learn_unseen_invent(void); +extern void update_inventory(void); +extern void prinv(const char *, struct obj *, long); +extern char *xprname(struct obj *, const char *, char, boolean, long, long); +extern int ddoinv(void); +extern char display_inventory(const char *, boolean); +extern int display_binventory(int, int, boolean); +extern struct obj *display_cinventory(struct obj *); +extern struct obj *display_minventory(struct monst *, int, char *); +extern int dotypeinv(void); +extern const char *dfeature_at(int, int, char *); +extern int look_here(int, unsigned); +extern int dolook(void); +extern boolean will_feel_cockatrice(struct obj *, boolean); +extern void feel_cockatrice(struct obj *, boolean); +extern void stackobj(struct obj *); +extern boolean mergable(struct obj *, struct obj *); +extern int doprgold(void); +extern int doprwep(void); +extern int doprarm(void); +extern int doprring(void); +extern int dopramulet(void); +extern int doprtool(void); +extern int doprinuse(void); +extern void useupf(struct obj *, long); +extern char *let_to_name(char, boolean, boolean); +extern void free_invbuf(void); +extern void reassign(void); +extern int doorganize(void); +extern void free_pickinv_cache(void); +extern int count_unpaid(struct obj *); +extern int count_buc(struct obj *, int, boolean(*)(struct obj *)); +extern void tally_BUCX(struct obj *, boolean, int *, int *, int *, int *, + int *); +extern long count_contents(struct obj *, boolean, boolean, boolean, boolean); +extern void carry_obj_effects(struct obj *); +extern const char *currency(long); +extern void silly_thing(const char *, struct obj *); /* ### ioctl.c ### */ #if defined(UNIX) || defined(__BEOS__) -E void NDECL(getwindowsz); -E void NDECL(getioctls); -E void NDECL(setioctls); +extern void getwindowsz(void); +extern void getioctls(void); +extern void setioctls(void); #ifdef SUSPEND -E int NDECL(dosuspend); +extern int dosuspend(void); #endif /* SUSPEND */ #endif /* UNIX || __BEOS__ */ /* ### light.c ### */ -E void FDECL(new_light_source, (XCHAR_P, XCHAR_P, int, int, ANY_P *)); -E void FDECL(del_light_source, (int, ANY_P *)); -E void FDECL(do_light_sources, (xchar **)); -E void FDECL(show_transient_light, (struct obj *, int, int)); -E void NDECL(transient_light_cleanup); -E struct monst *FDECL(find_mid, (unsigned, unsigned)); -E void FDECL(save_light_sources, (NHFILE *, int)); -E void FDECL(restore_light_sources, (NHFILE *)); -E void FDECL(light_stats, (const char *, char *, long *, long *)); -E void FDECL(relink_light_sources, (BOOLEAN_P)); -E void NDECL(light_sources_sanity_check); -E void FDECL(obj_move_light_source, (struct obj *, struct obj *)); -E boolean NDECL(any_light_source); -E void FDECL(snuff_light_source, (int, int)); -E boolean FDECL(obj_sheds_light, (struct obj *)); -E boolean FDECL(obj_is_burning, (struct obj *)); -E void FDECL(obj_split_light_source, (struct obj *, struct obj *)); -E void FDECL(obj_merge_light_sources, (struct obj *, struct obj *)); -E void FDECL(obj_adjust_light_radius, (struct obj *, int)); -E int FDECL(candle_light_range, (struct obj *)); -E int FDECL(arti_light_radius, (struct obj *)); -E const char *FDECL(arti_light_description, (struct obj *)); -E int NDECL(wiz_light_sources); +extern void new_light_source(xchar, xchar, int, int, union any *); +extern void del_light_source(int, union any *); +extern void do_light_sources(xchar **); +extern void show_transient_light(struct obj *, int, int); +extern void transient_light_cleanup(void); +extern struct monst *find_mid(unsigned, unsigned); +extern void save_light_sources(NHFILE *, int); +extern void restore_light_sources(NHFILE *); +extern void light_stats(const char *, char *, long *, long *); +extern void relink_light_sources(boolean); +extern void light_sources_sanity_check(void); +extern void obj_move_light_source(struct obj *, struct obj *); +extern boolean any_light_source(void); +extern void snuff_light_source(int, int); +extern boolean obj_sheds_light(struct obj *); +extern boolean obj_is_burning(struct obj *); +extern void obj_split_light_source(struct obj *, struct obj *); +extern void obj_merge_light_sources(struct obj *, struct obj *); +extern void obj_adjust_light_radius(struct obj *, int); +extern int candle_light_range(struct obj *); +extern int arti_light_radius(struct obj *); +extern const char *arti_light_description(struct obj *); +extern int wiz_light_sources(void); /* ### lock.c ### */ -E boolean FDECL(picking_lock, (int *, int *)); -E boolean FDECL(picking_at, (int, int)); -E void FDECL(breakchestlock, (struct obj *, BOOLEAN_P)); -E void NDECL(reset_pick); -E void FDECL(maybe_reset_pick, (struct obj *)); -E struct obj *FDECL(autokey, (BOOLEAN_P)); -E int FDECL(pick_lock, (struct obj *, XCHAR_P, XCHAR_P, struct obj *)); -E int NDECL(doforce); -E boolean FDECL(boxlock, (struct obj *, struct obj *)); -E boolean FDECL(doorlock, (struct obj *, int, int)); -E int NDECL(doopen); -E boolean FDECL(stumble_on_door_mimic, (int, int)); -E int FDECL(doopen_indir, (int, int)); -E int NDECL(doclose); +extern boolean picking_lock(int *, int *); +extern boolean picking_at(int, int); +extern void breakchestlock(struct obj *, boolean); +extern void reset_pick(void); +extern void maybe_reset_pick(struct obj *); +extern struct obj *autokey(boolean); +extern int pick_lock(struct obj *, xchar, xchar, struct obj *); +extern int doforce(void); +extern boolean boxlock(struct obj *, struct obj *); +extern boolean doorlock(struct obj *, int, int); +extern int doopen(void); +extern boolean stumble_on_door_mimic(int, int); +extern int doopen_indir(int, int); +extern int doclose(void); #ifdef MAC -/* These declarations are here because the main code calls them. */ - +/* outdated functions removed */ /* ### macfile.c ### */ - -E int FDECL(maccreat, (const char *, long)); -E int FDECL(macopen, (const char *, int, long)); -E int FDECL(macclose, (int)); -E int FDECL(macread, (int, void *, unsigned)); -E int FDECL(macwrite, (int, void *, unsigned)); -E long FDECL(macseek, (int, long, short)); -E int FDECL(macunlink, (const char *)); - /* ### macmain.c ### */ - -E boolean NDECL(authorize_wizard_mode); - /* ### macunix.c ### */ - -E void FDECL(regularize, (char *)); -E void NDECL(getlock); - /* ### macwin.c ### */ - -E void FDECL(lock_mouse_cursor, (Boolean)); -E int NDECL(SanePositions); - /* ### mttymain.c ### */ - -E void FDECL(getreturn, (char *)); -E void VDECL(msmsg, (const char *, ...)); -E void NDECL(gettty); -E void NDECL(setftty); -E void FDECL(settty, (const char *)); -E int NDECL(tgetch); -E void FDECL(cmov, (int x, int y)); -E void FDECL(nocmov, (int x, int y)); - -#endif /* MAC */ +#endif /* ### mail.c ### */ #ifdef MAIL #ifdef UNIX -E void NDECL(free_maildata); -E void NDECL(getmailstatus); -E void NDECL(ck_server_admin_msg); +extern void free_maildata(void); +extern void getmailstatus(void); +extern void ck_server_admin_msg(void); #endif -E void NDECL(ckmailstatus); -E void FDECL(readmail, (struct obj *)); +extern void ckmailstatus(void); +extern void readmail(struct obj *); #endif /* MAIL */ /* ### makemon.c ### */ -E void FDECL(dealloc_monst, (struct monst *)); -E boolean FDECL(is_home_elemental, (struct permonst *)); -E struct monst *FDECL(clone_mon, (struct monst *, XCHAR_P, XCHAR_P)); -E int FDECL(monhp_per_lvl, (struct monst *)); -E void FDECL(newmonhp, (struct monst *, int)); -E struct mextra *NDECL(newmextra); -E void FDECL(copy_mextra, (struct monst *, struct monst *)); -E void FDECL(dealloc_mextra, (struct monst *)); -E struct monst *FDECL(makemon, (struct permonst *, int, int, long)); -E struct monst *FDECL(unmakemon, (struct monst *, long)); -E boolean FDECL(create_critters, (int, struct permonst *, BOOLEAN_P)); -E struct permonst *NDECL(rndmonst); -E struct permonst *FDECL(mkclass, (CHAR_P, int)); -E struct permonst *FDECL(mkclass_aligned, (CHAR_P, int, ALIGNTYP_P)); -E int FDECL(mkclass_poly, (int)); -E int FDECL(adj_lev, (struct permonst *)); -E struct permonst *FDECL(grow_up, (struct monst *, struct monst *)); -E struct obj* FDECL(mongets, (struct monst *, int)); -E int FDECL(golemhp, (int)); -E boolean FDECL(peace_minded, (struct permonst *)); -E void FDECL(set_malign, (struct monst *)); -E void FDECL(newmcorpsenm, (struct monst *)); -E void FDECL(freemcorpsenm, (struct monst *)); -E void FDECL(set_mimic_sym, (struct monst *)); -E int FDECL(mbirth_limit, (int)); -E void FDECL(mimic_hit_msg, (struct monst *, SHORT_P)); -E void FDECL(mkmonmoney, (struct monst *, long)); -E int FDECL(bagotricks, (struct obj *, BOOLEAN_P, int *)); -E boolean FDECL(propagate, (int, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(usmellmon, (struct permonst *)); +extern void dealloc_monst(struct monst *); +extern boolean is_home_elemental(struct permonst *); +extern struct monst *clone_mon(struct monst *, xchar, xchar); +extern int monhp_per_lvl(struct monst *); +extern void newmonhp(struct monst *, int); +extern struct mextra *newmextra(void); +extern void copy_mextra(struct monst *, struct monst *); +extern void dealloc_mextra(struct monst *); +extern struct monst *makemon(struct permonst *, int, int, long); +extern struct monst *unmakemon(struct monst *, long); +extern boolean create_critters(int, struct permonst *, boolean); +extern struct permonst *rndmonst(void); +extern struct permonst *mkclass(char, int); +extern struct permonst *mkclass_aligned(char, int, aligntyp); +extern int mkclass_poly(int); +extern int adj_lev(struct permonst *); +extern struct permonst *grow_up(struct monst *, struct monst *); +extern struct obj* mongets(struct monst *, int); +extern int golemhp(int); +extern boolean peace_minded(struct permonst *); +extern void set_malign(struct monst *); +extern void newmcorpsenm(struct monst *); +extern void freemcorpsenm(struct monst *); +extern void set_mimic_sym(struct monst *); +extern int mbirth_limit(int); +extern void mimic_hit_msg(struct monst *, short); +extern void mkmonmoney(struct monst *, long); +extern int bagotricks(struct obj *, boolean, int *); +extern boolean propagate(int, boolean, boolean); +extern boolean usmellmon(struct permonst *); /* ### mcastu.c ### */ -E int FDECL(castmu, (struct monst *, struct attack *, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(buzzmu, (struct monst *, struct attack *)); +extern int castmu(struct monst *, struct attack *, boolean, boolean); +extern int buzzmu(struct monst *, struct attack *); /* ### mdlib.c ### */ -E void NDECL(runtime_info_init); -E const char *FDECL(do_runtime_info, (int *)); +extern void runtime_info_init(void); +extern const char *do_runtime_info(int *); /* ### mhitm.c ### */ -E int FDECL(fightm, (struct monst *)); -E int FDECL(mdisplacem, (struct monst *, struct monst *, BOOLEAN_P)); -E int FDECL(mattackm, (struct monst *, struct monst *)); -E boolean FDECL(engulf_target, (struct monst *, struct monst *)); -E int FDECL(mon_poly, (struct monst *, struct monst *, int)); -E void FDECL(paralyze_monst, (struct monst *, int)); -E int FDECL(sleep_monst, (struct monst *, int, int)); -E void FDECL(slept_monst, (struct monst *)); -E void FDECL(xdrainenergym, (struct monst *, BOOLEAN_P)); -E long FDECL(attk_protection, (int)); -E void FDECL(rustm, (struct monst *, struct obj *)); +extern int fightm(struct monst *); +extern int mdisplacem(struct monst *, struct monst *, boolean); +extern int mattackm(struct monst *, struct monst *); +extern boolean engulf_target(struct monst *, struct monst *); +extern int mon_poly(struct monst *, struct monst *, int); +extern void paralyze_monst(struct monst *, int); +extern int sleep_monst(struct monst *, int, int); +extern void slept_monst(struct monst *); +extern void xdrainenergym(struct monst *, boolean); +extern long attk_protection(int); +extern void rustm(struct monst *, struct obj *); /* ### mhitu.c ### */ -E void FDECL(hitmsg, (struct monst *, struct attack *)); -E const char *FDECL(mpoisons_subj, (struct monst *, struct attack *)); -E void NDECL(u_slow_down); -E struct monst *NDECL(cloneu); -E void FDECL(expels, (struct monst *, struct permonst *, BOOLEAN_P)); -E struct attack *FDECL(getmattk, (struct monst *, struct monst *, - int, int *, struct attack *)); -E int FDECL(mattacku, (struct monst *)); -boolean FDECL(diseasemu, (struct permonst *)); -boolean FDECL(u_slip_free, (struct monst *, struct attack *)); -E int FDECL(magic_negation, (struct monst *)); -E boolean NDECL(gulp_blnd_check); -E int FDECL(gazemu, (struct monst *, struct attack *)); -E void FDECL(mdamageu, (struct monst *, int)); -E int FDECL(could_seduce, (struct monst *, struct monst *, struct attack *)); -E int FDECL(doseduce, (struct monst *)); +extern void hitmsg(struct monst *, struct attack *); +extern const char *mpoisons_subj(struct monst *, struct attack *); +extern void u_slow_down(void); +extern struct monst *cloneu(void); +extern void expels(struct monst *, struct permonst *, boolean); +extern struct attack *getmattk(struct monst *, struct monst *, int, int *, + struct attack *); +extern int mattacku(struct monst *); +boolean diseasemu(struct permonst *); +boolean u_slip_free(struct monst *, struct attack *); +extern int magic_negation(struct monst *); +extern boolean gulp_blnd_check(void); +extern int gazemu(struct monst *, struct attack *); +extern void mdamageu(struct monst *, int); +extern int could_seduce(struct monst *, struct monst *, struct attack *); +extern int doseduce(struct monst *); /* ### minion.c ### */ -E void FDECL(newemin, (struct monst *)); -E void FDECL(free_emin, (struct monst *)); -E int FDECL(monster_census, (BOOLEAN_P)); -E int FDECL(msummon, (struct monst *)); -E void FDECL(summon_minion, (ALIGNTYP_P, BOOLEAN_P)); -E int FDECL(demon_talk, (struct monst *)); -E long FDECL(bribe, (struct monst *)); -E int FDECL(dprince, (ALIGNTYP_P)); -E int FDECL(dlord, (ALIGNTYP_P)); -E int NDECL(llord); -E int FDECL(ndemon, (ALIGNTYP_P)); -E int NDECL(lminion); -E void FDECL(lose_guardian_angel, (struct monst *)); -E void NDECL(gain_guardian_angel); +extern void newemin(struct monst *); +extern void free_emin(struct monst *); +extern int monster_census(boolean); +extern int msummon(struct monst *); +extern void summon_minion(aligntyp, boolean); +extern int demon_talk(struct monst *); +extern long bribe(struct monst *); +extern int dprince(aligntyp); +extern int dlord(aligntyp); +extern int llord(void); +extern int ndemon(aligntyp); +extern int lminion(void); +extern void lose_guardian_angel(struct monst *); +extern void gain_guardian_angel(void); /* ### mklev.c ### */ -E void NDECL(sort_rooms); -E void FDECL(add_room, (int, int, int, int, BOOLEAN_P, SCHAR_P, BOOLEAN_P)); -E void FDECL(add_subroom, (struct mkroom *, int, int, int, int, BOOLEAN_P, - SCHAR_P, BOOLEAN_P)); -E void FDECL(free_luathemes, (BOOLEAN_P)); -E void NDECL(makecorridors); -E void FDECL(add_door, (int, int, struct mkroom *)); -E void NDECL(clear_level_structures); -E void NDECL(mklev); +extern void sort_rooms(void); +extern void add_room(int, int, int, int, boolean, schar, boolean); +extern void add_subroom(struct mkroom *, int, int, int, int, boolean, schar, + boolean); +extern void free_luathemes(boolean); +extern void makecorridors(void); +extern void add_door(int, int, struct mkroom *); +extern void clear_level_structures(void); +extern void mklev(void); #ifdef SPECIALIZATION -E void FDECL(topologize, (struct mkroom *, BOOLEAN_P)); +extern void topologize(struct mkroom *, boolean)); #else -E void FDECL(topologize, (struct mkroom *)); +extern void topologize(struct mkroom *); #endif -E void FDECL(place_branch, (branch *, XCHAR_P, XCHAR_P)); -E boolean FDECL(occupied, (XCHAR_P, XCHAR_P)); -E int FDECL(okdoor, (XCHAR_P, XCHAR_P)); -E void FDECL(dodoor, (int, int, struct mkroom *)); -E void FDECL(mktrap, (int, int, struct mkroom *, coord *)); -E void FDECL(mkstairs, (XCHAR_P, XCHAR_P, CHAR_P, struct mkroom *)); -E void NDECL(mkinvokearea); -E void FDECL(mineralize, (int, int, int, int, BOOLEAN_P)); +extern void place_branch(branch *, xchar, xchar); +extern boolean occupied(xchar, xchar); +extern int okdoor(xchar, xchar); +extern void dodoor(int, int, struct mkroom *); +extern void mktrap(int, int, struct mkroom *, coord *); +extern void mkstairs(xchar, xchar, char, struct mkroom *); +extern void mkinvokearea(void); +extern void mineralize(int, int, int, int, boolean); /* ### mkmap.c ### */ -E void FDECL(flood_fill_rm, (int, int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(remove_rooms, (int, int, int, int)); -E boolean FDECL(litstate_rnd, (int)); -/* E void FDECL(mkmap, (lev_init *)); -- need sp_lev.h for lev_init */ +extern void flood_fill_rm(int, int, int, boolean, boolean); +extern void remove_rooms(int, int, int, int); +extern boolean litstate_rnd(int); /* ### mkmaze.c ### */ -E void FDECL(create_maze, (int, int, BOOLEAN_P)); -E void FDECL(wallification, (int, int, int, int)); -E void FDECL(fix_wall_spines, (int, int, int, int)); -E void FDECL(walkfrom, (int, int, SCHAR_P)); -E void FDECL(makemaz, (const char *)); -E void FDECL(mazexy, (coord *)); -E void FDECL(get_level_extends, (int *, int *, int *, int *)); -E void NDECL(bound_digging); -E void FDECL(mkportal, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(bad_location, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P)); -E void FDECL(place_lregion, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, d_level *)); -E void NDECL(fixup_special); -E void NDECL(fumaroles); -E void NDECL(movebubbles); -E void NDECL(water_friction); -E void FDECL(save_waterlevel, (NHFILE *)); -E void FDECL(restore_waterlevel, (NHFILE *)); -E const char *FDECL(waterbody_name, (XCHAR_P, XCHAR_P)); +extern void create_maze(int, int, boolean); +extern void wallification(int, int, int, int); +extern void fix_wall_spines(int, int, int, int); +extern void walkfrom(int, int, schar); +extern void makemaz(const char *); +extern void mazexy(coord *); +extern void get_level_extends(int *, int *, int *, int *); +extern void bound_digging(void); +extern void mkportal(xchar, xchar, xchar, xchar); +extern boolean bad_location(xchar, xchar, xchar, xchar, xchar, xchar); +extern void place_lregion(xchar, xchar, xchar, xchar, xchar, xchar, xchar, + xchar, xchar, d_level *); +extern void fixup_special(void); +extern void fumaroles(void); +extern void movebubbles(void); +extern void water_friction(void); +extern void save_waterlevel(NHFILE *); +extern void restore_waterlevel(NHFILE *); +extern const char *waterbody_name(xchar, xchar); /* ### mkobj.c ### */ -E struct oextra *NDECL(newoextra); -E void FDECL(copy_oextra, (struct obj *, struct obj *)); -E void FDECL(dealloc_oextra, (struct obj *)); -E void FDECL(newomonst, (struct obj *)); -E void FDECL(free_omonst, (struct obj *)); -E void FDECL(newomid, (struct obj *)); -E void FDECL(free_omid, (struct obj *)); -E void FDECL(newolong, (struct obj *)); -E void FDECL(free_olong, (struct obj *)); -E void FDECL(new_omailcmd, (struct obj *, const char *)); -E void FDECL(free_omailcmd, (struct obj *)); -E struct obj *FDECL(mkobj_at, (CHAR_P, int, int, BOOLEAN_P)); -E struct obj *FDECL(mksobj_at, (int, int, int, BOOLEAN_P, BOOLEAN_P)); -E struct obj *FDECL(mksobj_migr_to_species, (int, unsigned, - BOOLEAN_P, BOOLEAN_P)); -E struct obj *FDECL(mkobj, (int, BOOLEAN_P)); -E int NDECL(rndmonnum); -E boolean FDECL(bogon_is_pname, (CHAR_P)); -E struct obj *FDECL(splitobj, (struct obj *, long)); -E struct obj *FDECL(unsplitobj, (struct obj *)); -E void NDECL(clear_splitobjs); -E void FDECL(replace_object, (struct obj *, struct obj *)); -E struct obj *FDECL(unknwn_contnr_contents, (struct obj *)); -E void FDECL(bill_dummy_object, (struct obj *)); -E void FDECL(costly_alteration, (struct obj *, int)); -E struct obj *FDECL(mksobj, (int, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(bcsign, (struct obj *)); -E int FDECL(weight, (struct obj *)); -E struct obj *FDECL(mkgold, (long, int, int)); -E struct obj *FDECL(mkcorpstat, (int, struct monst *, struct permonst *, int, - int, unsigned)); -E int FDECL(corpse_revive_type, (struct obj *)); -E struct obj *FDECL(obj_attach_mid, (struct obj *, unsigned)); -E struct monst *FDECL(get_mtraits, (struct obj *, BOOLEAN_P)); -E struct obj *FDECL(mk_tt_object, (int, int, int)); -E struct obj *FDECL(mk_named_object, - (int, struct permonst *, int, int, const char *)); -E struct obj *FDECL(rnd_treefruit_at, (int, int)); -E void FDECL(set_corpsenm, (struct obj *, int)); -E long FDECL(rider_revival_time, (struct obj *, BOOLEAN_P)); -E void FDECL(start_corpse_timeout, (struct obj *)); -E void FDECL(bless, (struct obj *)); -E void FDECL(unbless, (struct obj *)); -E void FDECL(curse, (struct obj *)); -E void FDECL(uncurse, (struct obj *)); -E void FDECL(blessorcurse, (struct obj *, int)); -E void FDECL(set_bknown, (struct obj *, unsigned)); -E boolean FDECL(is_flammable, (struct obj *)); -E boolean FDECL(is_rottable, (struct obj *)); -E void FDECL(place_object, (struct obj *, int, int)); -E void FDECL(remove_object, (struct obj *)); -E void FDECL(discard_minvent, (struct monst *, BOOLEAN_P)); -E void FDECL(obj_extract_self, (struct obj *)); -E void FDECL(extract_nobj, (struct obj *, struct obj **)); -E void FDECL(extract_nexthere, (struct obj *, struct obj **)); -E int FDECL(add_to_minv, (struct monst *, struct obj *)); -E struct obj *FDECL(add_to_container, (struct obj *, struct obj *)); -E void FDECL(add_to_migration, (struct obj *)); -E void FDECL(add_to_buried, (struct obj *)); -E void FDECL(dealloc_obj, (struct obj *)); -E void FDECL(obj_ice_effects, (int, int, BOOLEAN_P)); -E long FDECL(peek_at_iced_corpse_age, (struct obj *)); -E int FDECL(hornoplenty, (struct obj *, BOOLEAN_P)); -E void NDECL(obj_sanity_check); -E struct obj *FDECL(obj_nexto, (struct obj *)); -E struct obj *FDECL(obj_nexto_xy, (struct obj *, int, int, BOOLEAN_P)); -E struct obj *FDECL(obj_absorb, (struct obj **, struct obj **)); -E struct obj *FDECL(obj_meld, (struct obj **, struct obj **)); -E void FDECL(pudding_merge_message, (struct obj *, struct obj *)); -E struct obj *FDECL(init_dummyobj, (struct obj *, SHORT_P, long)); +extern struct oextra *newoextra(void); +extern void copy_oextra(struct obj *, struct obj *); +extern void dealloc_oextra(struct obj *); +extern void newomonst(struct obj *); +extern void free_omonst(struct obj *); +extern void newomid(struct obj *); +extern void free_omid(struct obj *); +extern void newolong(struct obj *); +extern void free_olong(struct obj *); +extern void new_omailcmd(struct obj *, const char *); +extern void free_omailcmd(struct obj *); +extern struct obj *mkobj_at(char, int, int, boolean); +extern struct obj *mksobj_at(int, int, int, boolean, boolean); +extern struct obj *mksobj_migr_to_species(int, unsigned, boolean, boolean); +extern struct obj *mkobj(int, boolean); +extern int rndmonnum(void); +extern boolean bogon_is_pname(char); +extern struct obj *splitobj(struct obj *, long); +extern struct obj *unsplitobj(struct obj *); +extern void clear_splitobjs(void); +extern void replace_object(struct obj *, struct obj *); +extern struct obj *unknwn_contnr_contents(struct obj *); +extern void bill_dummy_object(struct obj *); +extern void costly_alteration(struct obj *, int); +extern struct obj *mksobj(int, boolean, boolean); +extern int bcsign(struct obj *); +extern int weight(struct obj *); +extern struct obj *mkgold(long, int, int); +extern struct obj *mkcorpstat(int, struct monst *, struct permonst *, int, + int, unsigned); +extern int corpse_revive_type(struct obj *); +extern struct obj *obj_attach_mid(struct obj *, unsigned); +extern struct monst *get_mtraits(struct obj *, boolean); +extern struct obj *mk_tt_object(int, int, int); +extern struct obj *mk_named_object(int, struct permonst *, int, int, + const char *); +extern struct obj *rnd_treefruit_at(int, int); +extern void set_corpsenm(struct obj *, int); +extern long rider_revival_time(struct obj *, boolean); +extern void start_corpse_timeout(struct obj *); +extern void bless(struct obj *); +extern void unbless(struct obj *); +extern void curse(struct obj *); +extern void uncurse(struct obj *); +extern void blessorcurse(struct obj *, int); +extern void set_bknown(struct obj *, unsigned); +extern boolean is_flammable(struct obj *); +extern boolean is_rottable(struct obj *); +extern void place_object(struct obj *, int, int); +extern void remove_object(struct obj *); +extern void discard_minvent(struct monst *, boolean); +extern void obj_extract_self(struct obj *); +extern void extract_nobj(struct obj *, struct obj **); +extern void extract_nexthere(struct obj *, struct obj **); +extern int add_to_minv(struct monst *, struct obj *); +extern struct obj *add_to_container(struct obj *, struct obj *); +extern void add_to_migration(struct obj *); +extern void add_to_buried(struct obj *); +extern void dealloc_obj(struct obj *); +extern void obj_ice_effects(int, int, boolean); +extern long peek_at_iced_corpse_age(struct obj *); +extern int hornoplenty(struct obj *, boolean); +extern void obj_sanity_check(void); +extern struct obj *obj_nexto(struct obj *); +extern struct obj *obj_nexto_xy(struct obj *, int, int, boolean); +extern struct obj *obj_absorb(struct obj **, struct obj **); +extern struct obj *obj_meld(struct obj **, struct obj **); +extern void pudding_merge_message(struct obj *, struct obj *); +extern struct obj *init_dummyobj(struct obj *, short, long); /* ### mkroom.c ### */ -E void FDECL(mkroom, (int)); -E void FDECL(fill_zoo, (struct mkroom *)); -E struct permonst *NDECL(antholemon); -E boolean FDECL(nexttodoor, (int, int)); -E boolean FDECL(has_dnstairs, (struct mkroom *)); -E boolean FDECL(has_upstairs, (struct mkroom *)); -E int FDECL(somex, (struct mkroom *)); -E int FDECL(somey, (struct mkroom *)); -E boolean FDECL(inside_room, (struct mkroom *, XCHAR_P, XCHAR_P)); -E boolean FDECL(somexy, (struct mkroom *, coord *)); -E boolean FDECL(somexyspace, (struct mkroom *, coord *)); -E void FDECL(mkundead, (coord *, BOOLEAN_P, int)); -E struct permonst *NDECL(courtmon); -E void FDECL(save_rooms, (NHFILE *)); -E void FDECL(rest_rooms, (NHFILE *)); -E struct mkroom *FDECL(search_special, (SCHAR_P)); -E int FDECL(cmap_to_type, (int)); +extern void mkroom(int); +extern void fill_zoo(struct mkroom *); +extern struct permonst *antholemon(void); +extern boolean nexttodoor(int, int); +extern boolean has_dnstairs(struct mkroom *); +extern boolean has_upstairs(struct mkroom *); +extern int somex(struct mkroom *); +extern int somey(struct mkroom *); +extern boolean inside_room(struct mkroom *, xchar, xchar); +extern boolean somexy(struct mkroom *, coord *); +extern boolean somexyspace(struct mkroom *, coord *); +extern void mkundead(coord *, boolean, int); +extern struct permonst *courtmon(void); +extern void save_rooms(NHFILE *); +extern void rest_rooms(NHFILE *); +extern struct mkroom *search_special(schar); +extern int cmap_to_type(int); /* ### mon.c ### */ -E void NDECL(mon_sanity_check); -E boolean FDECL(zombie_maker, (struct permonst *)); -E int FDECL(zombie_form, (struct permonst *)); -E int FDECL(m_poisongas_ok, (struct monst *)); -E int FDECL(undead_to_corpse, (int)); -E int FDECL(genus, (int, int)); -E int FDECL(pm_to_cham, (int)); -E int FDECL(minliquid, (struct monst *)); -E int NDECL(movemon); -E int FDECL(meatmetal, (struct monst *)); -E int FDECL(meatobj, (struct monst *)); -E int FDECL(meatcorpse, (struct monst *)); -E void FDECL(mpickgold, (struct monst *)); -E boolean FDECL(mpickstuff, (struct monst *, const char *)); -E int FDECL(curr_mon_load, (struct monst *)); -E int FDECL(max_mon_load, (struct monst *)); -E int FDECL(can_carry, (struct monst *, struct obj *)); -E long FDECL(mon_allowflags, (struct monst *)); -E int FDECL(mfndpos, (struct monst *, coord *, long *, long)); -E boolean FDECL(monnear, (struct monst *, int, int)); -E void NDECL(dmonsfree); -E void FDECL(elemental_clog, (struct monst *)); -E int FDECL(mcalcmove, (struct monst *, BOOLEAN_P)); -E void NDECL(mcalcdistress); -E void FDECL(replmon, (struct monst *, struct monst *)); -E void FDECL(relmon, (struct monst *, struct monst **)); -E struct obj *FDECL(mlifesaver, (struct monst *)); -E boolean FDECL(corpse_chance, (struct monst *, struct monst *, BOOLEAN_P)); -E void FDECL(mondead, (struct monst *)); -E void FDECL(mondied, (struct monst *)); -E void FDECL(mongone, (struct monst *)); -E void FDECL(monstone, (struct monst *)); -E void FDECL(monkilled, (struct monst *, const char *, int)); -E void FDECL(set_ustuck, (struct monst *)); -E void FDECL(unstuck, (struct monst *)); -E void FDECL(killed, (struct monst *)); -E void FDECL(xkilled, (struct monst *, int)); -E void FDECL(mon_to_stone, (struct monst *)); -E void FDECL(m_into_limbo, (struct monst *)); -E void FDECL(mnexto, (struct monst *)); -E void FDECL(maybe_mnexto, (struct monst *)); -E int FDECL(mnearto, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(m_respond, (struct monst *)); -E void FDECL(setmangry, (struct monst *, BOOLEAN_P)); -E void FDECL(wakeup, (struct monst *, BOOLEAN_P)); -E void NDECL(wake_nearby); -E void FDECL(wake_nearto, (int, int, int)); -E void FDECL(seemimic, (struct monst *)); -E void NDECL(rescham); -E void NDECL(restartcham); -E void FDECL(restore_cham, (struct monst *)); -E void FDECL(maybe_unhide_at, (XCHAR_P, XCHAR_P)); -E boolean FDECL(hideunder, (struct monst *)); -E void FDECL(hide_monst, (struct monst *)); -E void FDECL(mon_animal_list, (BOOLEAN_P)); -E boolean FDECL(valid_vampshiftform, (int, int)); -E boolean FDECL(validvamp, (struct monst *, int *, int)); -E int FDECL(select_newcham_form, (struct monst *)); -E void FDECL(mgender_from_permonst, (struct monst *, struct permonst *)); -E int FDECL(newcham, (struct monst *, struct permonst *, BOOLEAN_P, - BOOLEAN_P)); -E int FDECL(can_be_hatched, (int)); -E int FDECL(egg_type_from_parent, (int, BOOLEAN_P)); -E boolean FDECL(dead_species, (int, BOOLEAN_P)); -E void NDECL(kill_genocided_monsters); -E void FDECL(golemeffects, (struct monst *, int, int)); -E boolean FDECL(angry_guards, (BOOLEAN_P)); -E void NDECL(pacify_guards); -E void FDECL(decide_to_shapeshift, (struct monst *, int)); -E boolean FDECL(vamp_stone, (struct monst *)); +extern void mon_sanity_check(void); +extern boolean zombie_maker(struct permonst *); +extern int zombie_form(struct permonst *); +extern int m_poisongas_ok(struct monst *); +extern int undead_to_corpse(int); +extern int genus(int, int); +extern int pm_to_cham(int); +extern int minliquid(struct monst *); +extern int movemon(void); +extern int meatmetal(struct monst *); +extern int meatobj(struct monst *); +extern int meatcorpse(struct monst *); +extern void mpickgold(struct monst *); +extern boolean mpickstuff(struct monst *, const char *); +extern int curr_mon_load(struct monst *); +extern int max_mon_load(struct monst *); +extern int can_carry(struct monst *, struct obj *); +extern long mon_allowflags(struct monst *); +extern int mfndpos(struct monst *, coord *, long *, long); +extern boolean monnear(struct monst *, int, int); +extern void dmonsfree(void); +extern void elemental_clog(struct monst *); +extern int mcalcmove(struct monst *, boolean); +extern void mcalcdistress(void); +extern void replmon(struct monst *, struct monst *); +extern void relmon(struct monst *, struct monst **); +extern struct obj *mlifesaver(struct monst *); +extern boolean corpse_chance(struct monst *, struct monst *, boolean); +extern void mondead(struct monst *); +extern void mondied(struct monst *); +extern void mongone(struct monst *); +extern void monstone(struct monst *); +extern void monkilled(struct monst *, const char *, int); +extern void set_ustuck(struct monst *); +extern void unstuck(struct monst *); +extern void killed(struct monst *); +extern void xkilled(struct monst *, int); +extern void mon_to_stone(struct monst *); +extern void m_into_limbo(struct monst *); +extern void mnexto(struct monst *); +extern void maybe_mnexto(struct monst *); +extern int mnearto(struct monst *, xchar, xchar, boolean); +extern void m_respond(struct monst *); +extern void setmangry(struct monst *, boolean); +extern void wakeup(struct monst *, boolean); +extern void wake_nearby(void); +extern void wake_nearto(int, int, int); +extern void seemimic(struct monst *); +extern void rescham(void); +extern void restartcham(void); +extern void restore_cham(struct monst *); +extern void maybe_unhide_at(xchar, xchar); +extern boolean hideunder(struct monst *); +extern void hide_monst(struct monst *); +extern void mon_animal_list(boolean); +extern boolean valid_vampshiftform(int, int); +extern boolean validvamp(struct monst *, int *, int); +extern int select_newcham_form(struct monst *); +extern void mgender_from_permonst(struct monst *, struct permonst *); +extern int newcham(struct monst *, struct permonst *, boolean, boolean); +extern int can_be_hatched(int); +extern int egg_type_from_parent(int, boolean); +extern boolean dead_species(int, boolean); +extern void kill_genocided_monsters(void); +extern void golemeffects(struct monst *, int, int); +extern boolean angry_guards(boolean); +extern void pacify_guards(void); +extern void decide_to_shapeshift(struct monst *, int); +extern boolean vamp_stone(struct monst *); /* ### mondata.c ### */ -E void FDECL(set_mon_data, (struct monst *, struct permonst *)); -E struct attack *FDECL(attacktype_fordmg, (struct permonst *, int, int)); -E boolean FDECL(attacktype, (struct permonst *, int)); -E boolean FDECL(noattacks, (struct permonst *)); -E boolean FDECL(poly_when_stoned, (struct permonst *)); -E boolean FDECL(resists_drli, (struct monst *)); -E boolean FDECL(resists_magm, (struct monst *)); -E boolean FDECL(resists_blnd, (struct monst *)); -E boolean FDECL(can_blnd, (struct monst *, struct monst *, - UCHAR_P, struct obj *)); -E boolean FDECL(ranged_attk, (struct permonst *)); -E boolean FDECL(hates_silver, (struct permonst *)); -E boolean FDECL(mon_hates_silver, (struct monst *)); -E boolean FDECL(mon_hates_light, (struct monst *)); -E boolean FDECL(passes_bars, (struct permonst *)); -E boolean FDECL(can_blow, (struct monst *)); -E boolean FDECL(can_chant, (struct monst *)); -E boolean FDECL(can_be_strangled, (struct monst *)); -E boolean FDECL(can_track, (struct permonst *)); -E boolean FDECL(breakarm, (struct permonst *)); -E boolean FDECL(sliparm, (struct permonst *)); -E boolean FDECL(sticks, (struct permonst *)); -E boolean FDECL(cantvomit, (struct permonst *)); -E int FDECL(num_horns, (struct permonst *)); -/* E boolean FDECL(canseemon, (struct monst *)); */ -E struct attack *FDECL(dmgtype_fromattack, (struct permonst *, int, int)); -E boolean FDECL(dmgtype, (struct permonst *, int)); -E int FDECL(max_passive_dmg, (struct monst *, struct monst *)); -E boolean FDECL(same_race, (struct permonst *, struct permonst *)); -E int FDECL(monsndx, (struct permonst *)); -E int FDECL(name_to_mon, (const char *, int *)); -E int FDECL(name_to_monplus, (const char *, const char **, int *)); -E int FDECL(name_to_monclass, (const char *, int *)); -E int FDECL(gender, (struct monst *)); -E int FDECL(pronoun_gender, (struct monst *, unsigned)); -E boolean FDECL(levl_follower, (struct monst *)); -E int FDECL(little_to_big, (int)); -E int FDECL(big_to_little, (int)); -E boolean FDECL(big_little_match, (int, int)); -E const char *FDECL(locomotion, (const struct permonst *, const char *)); -E const char *FDECL(stagger, (const struct permonst *, const char *)); -E const char *FDECL(on_fire, (struct permonst *, struct attack *)); -E const struct permonst *FDECL(raceptr, (struct monst *)); -E boolean FDECL(olfaction, (struct permonst *)); +extern void set_mon_data(struct monst *, struct permonst *); +extern struct attack *attacktype_fordmg(struct permonst *, int, int); +extern boolean attacktype(struct permonst *, int); +extern boolean noattacks(struct permonst *); +extern boolean poly_when_stoned(struct permonst *); +extern boolean resists_drli(struct monst *); +extern boolean resists_magm(struct monst *); +extern boolean resists_blnd(struct monst *); +extern boolean can_blnd(struct monst *, struct monst *, uchar, struct obj *); +extern boolean ranged_attk(struct permonst *); +extern boolean hates_silver(struct permonst *); +extern boolean mon_hates_silver(struct monst *); +extern boolean mon_hates_light(struct monst *); +extern boolean passes_bars(struct permonst *); +extern boolean can_blow(struct monst *); +extern boolean can_chant(struct monst *); +extern boolean can_be_strangled(struct monst *); +extern boolean can_track(struct permonst *); +extern boolean breakarm(struct permonst *); +extern boolean sliparm(struct permonst *); +extern boolean sticks(struct permonst *); +extern boolean cantvomit(struct permonst *); +extern int num_horns(struct permonst *); +extern struct attack *dmgtype_fromattack(struct permonst *, int, int); +extern boolean dmgtype(struct permonst *, int); +extern int max_passive_dmg(struct monst *, struct monst *); +extern boolean same_race(struct permonst *, struct permonst *); +extern int monsndx(struct permonst *); +extern int name_to_mon(const char *, int *); +extern int name_to_monplus(const char *, const char **, int *); +extern int name_to_monclass(const char *, int *); +extern int gender(struct monst *); +extern int pronoun_gender(struct monst *, unsigned); +extern boolean levl_follower(struct monst *); +extern int little_to_big(int); +extern int big_to_little(int); +extern boolean big_little_match(int, int); +extern const char *locomotion(const struct permonst *, const char *); +extern const char *stagger(const struct permonst *, const char *); +extern const char *on_fire(struct permonst *, struct attack *); +extern const struct permonst *raceptr(struct monst *); +extern boolean olfaction(struct permonst *); /* ### monmove.c ### */ -E boolean FDECL(itsstuck, (struct monst *)); -E boolean FDECL(mb_trapped, (struct monst *)); -E boolean FDECL(monhaskey, (struct monst *, BOOLEAN_P)); -E void FDECL(mon_regen, (struct monst *, BOOLEAN_P)); -E int FDECL(dochugw, (struct monst *)); -E boolean FDECL(onscary, (int, int, struct monst *)); -E struct monst *FDECL(find_pmmonst, (int)); -E int FDECL(bee_eat_jelly, (struct monst *, struct obj *)); -E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(mon_yells, (struct monst *, const char *)); -E int FDECL(dochug, (struct monst *)); -E boolean FDECL(m_digweapon_check, (struct monst *, XCHAR_P, XCHAR_P)); -E int FDECL(m_move, (struct monst *, int)); -E int FDECL(m_move_aggress, (struct monst *, XCHAR_P, XCHAR_P)); -E void FDECL(dissolve_bars, (int, int)); -E boolean FDECL(closed_door, (int, int)); -E boolean FDECL(accessible, (int, int)); -E void FDECL(set_apparxy, (struct monst *)); -E boolean FDECL(can_ooze, (struct monst *)); -E boolean FDECL(can_fog, (struct monst *)); -E boolean FDECL(should_displace, - (struct monst *, coord *, long *, int, XCHAR_P, XCHAR_P)); -E boolean FDECL(undesirable_disp, (struct monst *, XCHAR_P, XCHAR_P)); +extern boolean itsstuck(struct monst *); +extern boolean mb_trapped(struct monst *); +extern boolean monhaskey(struct monst *, boolean); +extern void mon_regen(struct monst *, boolean); +extern int dochugw(struct monst *); +extern boolean onscary(int, int, struct monst *); +extern struct monst *find_pmmonst(int); +extern int bee_eat_jelly(struct monst *, struct obj *); +extern void monflee(struct monst *, int, boolean, boolean); +extern void mon_yells(struct monst *, const char *); +extern int dochug(struct monst *); +extern boolean m_digweapon_check(struct monst *, xchar, xchar); +extern int m_move(struct monst *, int); +extern int m_move_aggress(struct monst *, xchar, xchar); +extern void dissolve_bars(int, int); +extern boolean closed_door(int, int); +extern boolean accessible(int, int); +extern void set_apparxy(struct monst *); +extern boolean can_ooze(struct monst *); +extern boolean can_fog(struct monst *); +extern boolean should_displace(struct monst *, coord *, long *, int, xchar, + xchar); +extern boolean undesirable_disp(struct monst *, xchar, xchar); /* ### monst.c ### */ -E void NDECL(monst_globals_init); +extern void monst_globals_init(void); /* ### mplayer.c ### */ -E struct monst *FDECL(mk_mplayer, - (struct permonst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(create_mplayers, (int, BOOLEAN_P)); -E void FDECL(mplayer_talk, (struct monst *)); +extern struct monst *mk_mplayer(struct permonst *, xchar, xchar, boolean); +extern void create_mplayers(int, boolean); +extern void mplayer_talk(struct monst *); #if defined(MICRO) || defined(WIN32) /* ### msdos.c,os2.c,tos.c,winnt.c ### */ #ifndef WIN32 -E int NDECL(tgetch); +extern int tgetch(void); #endif #ifndef TOS -E char NDECL(switchar); +extern char switchar(void); #endif #ifndef __GO32__ -E long FDECL(freediskspace, (char *)); +extern long freediskspace(char *); #ifdef MSDOS -E int FDECL(findfirst_file, (char *)); -E int NDECL(findnext_file); -E long FDECL(filesize_nh, (char *)); +extern int findfirst_file(char *); +extern int findnext_file(void); +extern long filesize_nh(char *); #else -E int FDECL(findfirst, (char *)); -E int NDECL(findnext); -E long FDECL(filesize, (char *)); +extern int findfirst(char *); +extern int findnext(void); +extern long filesize(char *); #endif /* MSDOS */ -E char *NDECL(foundfile_buffer); +extern char *foundfile_buffer(void); #endif /* __GO32__ */ -E void FDECL(chdrive, (char *)); +extern void chdrive(char *); #ifndef TOS -E void NDECL(disable_ctrlP); -E void NDECL(enable_ctrlP); +extern void disable_ctrlP(void); +extern void enable_ctrlP(void); #endif #if defined(MICRO) && !defined(WINNT) -E void NDECL(get_scr_size); +extern void get_scr_size(void); #ifndef TOS -E void FDECL(gotoxy, (int, int)); +extern void gotoxy(int, int); #endif #endif #ifdef TOS -E int FDECL(_copyfile, (char *, char *)); -E int NDECL(kbhit); -E void NDECL(set_colors); -E void NDECL(restore_colors); +extern int _copyfile(char *, char *); +extern int kbhit(void); +extern void set_colors(void); +extern void restore_colors(void); #ifdef SUSPEND -E int NDECL(dosuspend); +extern int dosuspend(void); #endif #endif /* TOS */ #ifdef WIN32 -E char *FDECL(get_username, (int *)); -E void FDECL(nt_regularize, (char *)); -E int NDECL((*nt_kbhit)); -E void FDECL(Delay, (int)); +extern char *get_username(int *); +extern void nt_regularize(char *); +extern int(*nt_kbhit)(void); +extern void Delay(int); #endif /* WIN32 */ + #endif /* MICRO || WIN32 */ /* ### mthrowu.c ### */ -E boolean FDECL(m_has_launcher_and_ammo, (struct monst *)); -E int FDECL(thitu, (int, int, struct obj **, const char *)); -E int FDECL(ohitmon, (struct monst *, struct obj *, int, BOOLEAN_P)); -E void FDECL(thrwmu, (struct monst *)); -E int FDECL(spitmu, (struct monst *, struct attack *)); -E int FDECL(breamu, (struct monst *, struct attack *)); -E boolean FDECL(linedup_callback, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, boolean FDECL((*), (int,int)))); -E boolean FDECL(linedup, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, int)); -E boolean FDECL(lined_up, (struct monst *)); -E struct obj *FDECL(m_carrying, (struct monst *, int)); -E int FDECL(thrwmm, (struct monst *, struct monst *)); -E int FDECL(spitmm, (struct monst *, struct attack *, struct monst *)); -E int FDECL(breamm, (struct monst *, struct attack *, struct monst *)); -E void FDECL(m_useupall, (struct monst *, struct obj *)); -E void FDECL(m_useup, (struct monst *, struct obj *)); -E void FDECL(m_throw, (struct monst *, int, int, int, int, int, struct obj *)); -E void FDECL(hit_bars, (struct obj **, int, int, int, int, - BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(hits_bars, (struct obj **, int, int, int, int, int, int)); +extern boolean m_has_launcher_and_ammo(struct monst *); +extern int thitu(int, int, struct obj **, const char *); +extern int ohitmon(struct monst *, struct obj *, int, boolean); +extern void thrwmu(struct monst *); +extern int spitmu(struct monst *, struct attack *); +extern int breamu(struct monst *, struct attack *); +extern boolean linedup_callback(xchar, xchar, xchar, xchar, + boolean(*)(int,int)); +extern boolean linedup(xchar, xchar, xchar, xchar, int); +extern boolean lined_up(struct monst *); +extern struct obj *m_carrying(struct monst *, int); +extern int thrwmm(struct monst *, struct monst *); +extern int spitmm(struct monst *, struct attack *, struct monst *); +extern int breamm(struct monst *, struct attack *, struct monst *); +extern void m_useupall(struct monst *, struct obj *); +extern void m_useup(struct monst *, struct obj *); +extern void m_throw(struct monst *, int, int, int, int, int, struct obj *); +extern void hit_bars(struct obj **, int, int, int, int, boolean, boolean); +extern boolean hits_bars(struct obj **, int, int, int, int, int, int); /* ### muse.c ### */ -E boolean FDECL(find_defensive, (struct monst *)); -E int FDECL(use_defensive, (struct monst *)); -E int FDECL(rnd_defensive_item, (struct monst *)); -E boolean FDECL(find_offensive, (struct monst *)); -E int FDECL(use_offensive, (struct monst *)); -E int FDECL(rnd_offensive_item, (struct monst *)); -E boolean FDECL(find_misc, (struct monst *)); -E int FDECL(use_misc, (struct monst *)); -E int FDECL(rnd_misc_item, (struct monst *)); -E boolean FDECL(searches_for_item, (struct monst *, struct obj *)); -E boolean FDECL(mon_reflects, (struct monst *, const char *)); -E boolean FDECL(ureflects, (const char *, const char *)); -E void FDECL(mcureblindness, (struct monst *, BOOLEAN_P)); -E boolean FDECL(munstone, (struct monst *, BOOLEAN_P)); -E boolean FDECL(munslime, (struct monst *, BOOLEAN_P)); +extern boolean find_defensive(struct monst *); +extern int use_defensive(struct monst *); +extern int rnd_defensive_item(struct monst *); +extern boolean find_offensive(struct monst *); +extern int use_offensive(struct monst *); +extern int rnd_offensive_item(struct monst *); +extern boolean find_misc(struct monst *); +extern int use_misc(struct monst *); +extern int rnd_misc_item(struct monst *); +extern boolean searches_for_item(struct monst *, struct obj *); +extern boolean mon_reflects(struct monst *, const char *); +extern boolean ureflects(const char *, const char *); +extern void mcureblindness(struct monst *, boolean); +extern boolean munstone(struct monst *, boolean); +extern boolean munslime(struct monst *, boolean); /* ### music.c ### */ -E void FDECL(awaken_soldiers, (struct monst *)); -E int FDECL(do_play_instrument, (struct obj *)); +extern void awaken_soldiers(struct monst *); +extern int do_play_instrument(struct obj *); /* ### nhlan.c ### */ + #ifdef LAN_FEATURES -E void NDECL(init_lan_features); -E char *NDECL(lan_username); +extern void init_lan_features(void); +extern char *lan_username(void); #endif /* ### nhlsel.c ### */ + #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) -E struct selectionvar *FDECL(l_selection_check, (lua_State *, int)); -E int FDECL(l_selection_register, (lua_State *)); +extern struct selectionvar *l_selection_check(lua_State *, int); +extern int l_selection_register(lua_State *); +extern void nhl_push_obj(lua_State *, struct obj *); +extern int nhl_obj_u_giveobj(lua_State *); +extern int l_obj_register(lua_State *); #endif /* ### nhlobj.c ### */ + #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) -E void FDECL(nhl_push_obj, (lua_State *, struct obj *)); -E int FDECL(nhl_obj_u_giveobj, (lua_State *)); -E int FDECL(l_obj_register, (lua_State *)); +extern void nhl_push_obj(lua_State *, struct obj *); +extern int nhl_obj_u_giveobj(lua_State *); +extern int l_obj_register(lua_State *); #endif /* ### nhlua.c ### */ #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) -E lua_State * NDECL(nhl_init); -E boolean FDECL(nhl_loadlua, (lua_State *, const char *)); -E boolean FDECL(load_lua, (const char *)); -E void FDECL(nhl_error, (lua_State *, const char *)) NORETURN; -E void FDECL(lcheck_param_table, (lua_State *)); -E schar FDECL(get_table_mapchr, (lua_State *, const char *)); -E schar FDECL(get_table_mapchr_opt, (lua_State *, const char *, SCHAR_P)); -E void FDECL(nhl_add_table_entry_int, (lua_State *, const char *, int)); -E void FDECL(nhl_add_table_entry_char, (lua_State *, const char *, CHAR_P)); -E void FDECL(nhl_add_table_entry_str, (lua_State *, const char *, const char *)); -E schar FDECL(splev_chr2typ, (CHAR_P)); -E schar FDECL(check_mapchr, (const char *)); -E int FDECL(get_table_int, (lua_State *, const char *)); -E int FDECL(get_table_int_opt, (lua_State *, const char *, int)); -E char *FDECL(get_table_str, (lua_State *, const char *)); -E char *FDECL(get_table_str_opt, (lua_State *, const char *, char *)); -E int FDECL(get_table_boolean, (lua_State *, const char *)); -E int FDECL(get_table_boolean_opt, (lua_State *, const char *, int)); -E int FDECL(get_table_option, (lua_State *, const char *, const char *, const char *const *)); -E int FDECL(str_lines_max_width, (const char *)); -E char *FDECL(stripdigits, (char *)); -E const char *NDECL(get_lua_version); +extern lua_State * nhl_init(void); +extern boolean nhl_loadlua(lua_State *, const char *); +extern boolean load_lua(const char *); +extern void nhl_error(lua_State *, const char *) NORETURN; +extern void lcheck_param_table(lua_State *); +extern schar get_table_mapchr(lua_State *, const char *); +extern schar get_table_mapchr_opt(lua_State *, const char *, schar); +extern void nhl_add_table_entry_int(lua_State *, const char *, int); +extern void nhl_add_table_entry_char(lua_State *, const char *, char); +extern void nhl_add_table_entry_str(lua_State *, const char *, const char *); +extern schar splev_chr2typ(char); +extern schar check_mapchr(const char *); +extern int get_table_int(lua_State *, const char *); +extern int get_table_int_opt(lua_State *, const char *, int); +extern char *get_table_str(lua_State *, const char *); +extern char *get_table_str_opt(lua_State *, const char *, char *); +extern int get_table_boolean(lua_State *, const char *); +extern int get_table_boolean_opt(lua_State *, const char *, int); +extern int get_table_option(lua_State *, const char *, const char *, + const char *const *); +extern int str_lines_max_width(const char *); +extern char *stripdigits(char *); +extern const char *get_lua_version(void); #endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ /* ### nhregex.c ### */ -E struct nhregex *NDECL(regex_init); -E boolean FDECL(regex_compile, (const char *, struct nhregex *)); -E const char *FDECL(regex_error_desc, (struct nhregex *)); -E boolean FDECL(regex_match, (const char *, struct nhregex *)); -E void FDECL(regex_free, (struct nhregex *)); +extern struct nhregex *regex_init(void); +extern boolean regex_compile(const char *, struct nhregex *); +extern const char *regex_error_desc(struct nhregex *); +extern boolean regex_match(const char *, struct nhregex *); +extern void regex_free(struct nhregex *); /* ### nttty.c ### */ #ifdef WIN32 -E void NDECL(get_scr_size); -E int NDECL(nttty_kbhit); -E void FDECL(nttty_open, (int)); -E void NDECL(nttty_rubout); -E int NDECL(tgetch); -E int FDECL(ntposkey, (int *, int *, int *)); -E void FDECL(set_output_mode, (int)); -E void NDECL(synch_cursor); -E void NDECL(nethack_enter_nttty); -E void NDECL(nttty_exit); -#endif +extern void get_scr_size(void); +extern int nttty_kbhit(void); +extern void nttty_open(int); +extern void nttty_rubout(void); +extern int tgetch(void); +extern int ntposkey(int *, int *, int *); +extern void set_output_mode(int); +extern void synch_cursor(void); +extern void nethack_enter_nttty(void); +extern void nttty_exit(void); +#endif /* WIN32 */ /* ### o_init.c ### */ -E void NDECL(init_objects); -E void FDECL(obj_shuffle_range, (int, int *, int *)); -E int NDECL(find_skates); -E boolean FDECL(objdescr_is, (struct obj *, const char *)); -E void NDECL(oinit); -E void FDECL(savenames, (NHFILE *)); -E void FDECL(restnames, (NHFILE *)); -E void FDECL(discover_object, (int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(undiscover_object, (int)); -E int FDECL(choose_disco_sort, (int)); -E int NDECL(dodiscovered); -E int NDECL(doclassdisco); -E void NDECL(rename_disco); +extern void init_objects(void); +extern void obj_shuffle_range(int, int *, int *); +extern int find_skates(void); +extern boolean objdescr_is(struct obj *, const char *); +extern void oinit(void); +extern void savenames(NHFILE *); +extern void restnames(NHFILE *); +extern void discover_object(int, boolean, boolean); +extern void undiscover_object(int); +extern int choose_disco_sort(int); +extern int dodiscovered(void); +extern int doclassdisco(void); +extern void rename_disco(void); /* ### objects.c ### */ -E void NDECL(objects_globals_init); +extern void objects_globals_init(void); /* ### objnam.c ### */ -E char *FDECL(obj_typename, (int)); -E char *FDECL(simple_typename, (int)); -E char *FDECL(safe_typename, (int)); -E boolean FDECL(obj_is_pname, (struct obj *)); -E char *FDECL(distant_name, (struct obj *, char *(*)(OBJ_P))); -E char *FDECL(fruitname, (BOOLEAN_P)); -E struct fruit *FDECL(fruit_from_indx, (int)); -E struct fruit *FDECL(fruit_from_name, (const char *, BOOLEAN_P, int *)); -E void FDECL(reorder_fruit, (BOOLEAN_P)); -E char *FDECL(xname, (struct obj *)); -E char *FDECL(mshot_xname, (struct obj *)); -E boolean FDECL(the_unique_obj, (struct obj *)); -E boolean FDECL(the_unique_pm, (struct permonst *)); -E boolean FDECL(erosion_matters, (struct obj *)); -E char *FDECL(doname, (struct obj *)); -E char *FDECL(doname_with_price, (struct obj *)); -E char *FDECL(doname_vague_quan, (struct obj *)); -E boolean FDECL(not_fully_identified, (struct obj *)); -E char *FDECL(corpse_xname, (struct obj *, const char *, unsigned)); -E char *FDECL(cxname, (struct obj *)); -E char *FDECL(cxname_singular, (struct obj *)); -E char *FDECL(killer_xname, (struct obj *)); -E char *FDECL(short_oname, - (struct obj *, char *(*)(OBJ_P), char *(*)(OBJ_P), unsigned)); -E const char *FDECL(singular, (struct obj *, char *(*)(OBJ_P))); -E char *FDECL(just_an, (char *, const char *)); -E char *FDECL(an, (const char *)); -E char *FDECL(An, (const char *)); -E char *FDECL(The, (const char *)); -E char *FDECL(the, (const char *)); -E char *FDECL(aobjnam, (struct obj *, const char *)); -E char *FDECL(yobjnam, (struct obj *, const char *)); -E char *FDECL(Yobjnam2, (struct obj *, const char *)); -E char *FDECL(Tobjnam, (struct obj *, const char *)); -E char *FDECL(otense, (struct obj *, const char *)); -E char *FDECL(vtense, (const char *, const char *)); -E char *FDECL(Doname2, (struct obj *)); -E char *FDECL(yname, (struct obj *)); -E char *FDECL(Yname2, (struct obj *)); -E char *FDECL(ysimple_name, (struct obj *)); -E char *FDECL(Ysimple_name2, (struct obj *)); -E char *FDECL(simpleonames, (struct obj *)); -E char *FDECL(ansimpleoname, (struct obj *)); -E char *FDECL(thesimpleoname, (struct obj *)); -E char *FDECL(bare_artifactname, (struct obj *)); -E char *FDECL(makeplural, (const char *)); -E char *FDECL(makesingular, (const char *)); -E struct obj *FDECL(readobjnam, (char *, struct obj *)); -E int FDECL(rnd_class, (int, int)); -E const char *FDECL(suit_simple_name, (struct obj *)); -E const char *FDECL(cloak_simple_name, (struct obj *)); -E const char *FDECL(helm_simple_name, (struct obj *)); -E const char *FDECL(gloves_simple_name, (struct obj *)); -E const char *FDECL(boots_simple_name, (struct obj *)); -E const char *FDECL(shield_simple_name, (struct obj *)); -E const char *FDECL(shirt_simple_name, (struct obj *)); -E const char *FDECL(mimic_obj_name, (struct monst *)); -E char *FDECL(safe_qbuf, (char *, const char *, const char *, struct obj *, - char *(*)(OBJ_P), char *(*)(OBJ_P), const char *)); -E int FDECL(shiny_obj, (CHAR_P)); +extern char *obj_typename(int); +extern char *simple_typename(int); +extern char *safe_typename(int); +extern boolean obj_is_pname(struct obj *); +extern char *distant_name(struct obj *, char *(*)(struct obj *)); +extern char *fruitname(boolean); +extern struct fruit *fruit_from_indx(int); +extern struct fruit *fruit_from_name(const char *, boolean, int *); +extern void reorder_fruit(boolean); +extern char *xname(struct obj *); +extern char *mshot_xname(struct obj *); +extern boolean the_unique_obj(struct obj *); +extern boolean the_unique_pm(struct permonst *); +extern boolean erosion_matters(struct obj *); +extern char *doname(struct obj *); +extern char *doname_with_price(struct obj *); +extern char *doname_vague_quan(struct obj *); +extern boolean not_fully_identified(struct obj *); +extern char *corpse_xname(struct obj *, const char *, unsigned); +extern char *cxname(struct obj *); +extern char *cxname_singular(struct obj *); +extern char *killer_xname(struct obj *); +extern char *short_oname(struct obj *, char *(*)(struct obj *), + char *(*)(struct obj *), unsigned); +extern const char *singular(struct obj *, char *(*)(struct obj *)); +extern char *just_an(char *, const char *); +extern char *an(const char *); +extern char *An(const char *); +extern char *The(const char *); +extern char *the(const char *); +extern char *aobjnam(struct obj *, const char *); +extern char *yobjnam(struct obj *, const char *); +extern char *Yobjnam2(struct obj *, const char *); +extern char *Tobjnam(struct obj *, const char *); +extern char *otense(struct obj *, const char *); +extern char *vtense(const char *, const char *); +extern char *Doname2(struct obj *); +extern char *yname(struct obj *); +extern char *Yname2(struct obj *); +extern char *ysimple_name(struct obj *); +extern char *Ysimple_name2(struct obj *); +extern char *simpleonames(struct obj *); +extern char *ansimpleoname(struct obj *); +extern char *thesimpleoname(struct obj *); +extern char *bare_artifactname(struct obj *); +extern char *makeplural(const char *); +extern char *makesingular(const char *); +extern struct obj *readobjnam(char *, struct obj *); +extern int rnd_class(int, int); +extern const char *suit_simple_name(struct obj *); +extern const char *cloak_simple_name(struct obj *); +extern const char *helm_simple_name(struct obj *); +extern const char *gloves_simple_name(struct obj *); +extern const char *boots_simple_name(struct obj *); +extern const char *shield_simple_name(struct obj *); +extern const char *shirt_simple_name(struct obj *); +extern const char *mimic_obj_name(struct monst *); +extern char *safe_qbuf(char *, const char *, const char *, struct obj *, + char *(*)(struct obj *), char *(*)(struct obj *), + const char *); +extern int shiny_obj(char); /* ### options.c ### */ -E boolean FDECL(match_optname, (const char *, const char *, int, BOOLEAN_P)); -E void NDECL(initoptions); -E void NDECL(initoptions_init); -E void NDECL(initoptions_finish); -E boolean FDECL(parseoptions, (char *, BOOLEAN_P, BOOLEAN_P)); -E int NDECL(doset); -E int NDECL(dotogglepickup); -E void NDECL(option_help); -E void FDECL(next_opt, (winid, const char *)); -E int FDECL(fruitadd, (char *, struct fruit *)); -E int FDECL(choose_classes_menu, (const char *, int, BOOLEAN_P, - char *, char *)); -E boolean FDECL(parsebindings, (char *)); -E void FDECL(oc_to_str, (char *, char *)); -E void FDECL(add_menu_cmd_alias, (CHAR_P, CHAR_P)); -E char FDECL(get_menu_cmd_key, (CHAR_P)); -E char FDECL(map_menu_cmd, (CHAR_P)); -E void FDECL(show_menu_controls, (winid, BOOLEAN_P)); -E void FDECL(assign_warnings, (uchar *)); -E char *FDECL(nh_getenv, (const char *)); -E void NDECL(reset_duplicate_opt_detection); -E void FDECL(set_wc_option_mod_status, (unsigned long, int)); -E void FDECL(set_wc2_option_mod_status, (unsigned long, int)); -E void FDECL(set_option_mod_status, (const char *, int)); -E int FDECL(add_autopickup_exception, (const char *)); -E void NDECL(free_autopickup_exceptions); -E int FDECL(load_symset, (const char *, int)); -E void NDECL(free_symsets); -E boolean FDECL(parsesymbols, (char *, int)); -E struct symparse *FDECL(match_sym, (char *)); -E void NDECL(set_playmode); -E int FDECL(sym_val, (const char *)); -E int FDECL(query_color, (const char *)); -E int FDECL(query_attr, (const char *)); -E const char *FDECL(clr2colorname, (int)); -E int FDECL(match_str2clr, (char *)); -E int FDECL(match_str2attr, (const char *, BOOLEAN_P)); -E boolean FDECL(add_menu_coloring, (char *)); -E boolean FDECL(get_menu_coloring, (const char *, int *, int *)); -E void NDECL(free_menu_coloring); -E boolean FDECL(msgtype_parse_add, (char *)); -E int FDECL(msgtype_type, (const char *, BOOLEAN_P)); -E void FDECL(hide_unhide_msgtypes, (BOOLEAN_P, int)); -E void NDECL(msgtype_free); +extern boolean match_optname(const char *, const char *, int, boolean); +extern void initoptions(void); +extern void initoptions_init(void); +extern void initoptions_finish(void); +extern boolean parseoptions(char *, boolean, boolean); +extern int doset(void); +extern int dotogglepickup(void); +extern void option_help(void); +extern void next_opt(winid, const char *); +extern int fruitadd(char *, struct fruit *); +extern int choose_classes_menu(const char *, int, boolean, char *, char *); +extern boolean parsebindings(char *); +extern void oc_to_str(char *, char *); +extern void add_menu_cmd_alias(char, char); +extern char get_menu_cmd_key(char); +extern char map_menu_cmd(char); +extern void show_menu_controls(winid, boolean); +extern void assign_warnings(uchar *); +extern char *nh_getenv(const char *); +extern void reset_duplicate_opt_detection(void); +extern void set_wc_option_mod_status(unsigned long, int); +extern void set_wc2_option_mod_status(unsigned long, int); +extern void set_option_mod_status(const char *, int); +extern int add_autopickup_exception(const char *); +extern void free_autopickup_exceptions(void); +extern int load_symset(const char *, int); +extern void free_symsets(void); +extern boolean parsesymbols(char *, int); +extern struct symparse *match_sym(char *); +extern void set_playmode(void); +extern int sym_val(const char *); +extern int query_color(const char *); +extern int query_attr(const char *); +extern const char *clr2colorname(int); +extern int match_str2clr(char *); +extern int match_str2attr(const char *, boolean); +extern boolean add_menu_coloring(char *); +extern boolean get_menu_coloring(const char *, int *, int *); +extern void free_menu_coloring(void); +extern boolean msgtype_parse_add(char *); +extern int msgtype_type(const char *, boolean); +extern void hide_unhide_msgtypes(boolean, int); +extern void msgtype_free(void); /* ### pager.c ### */ -E char *FDECL(self_lookat, (char *)); -E char *FDECL(monhealthdescr, (struct monst *mon, BOOLEAN_P, char *)); -E void FDECL(mhidden_description, (struct monst *, BOOLEAN_P, char *)); -E boolean FDECL(object_from_map, (int,int,int,struct obj **)); -E int FDECL(do_screen_description, (coord, BOOLEAN_P, int, char *, - const char **, struct permonst **)); -E int FDECL(do_look, (int, coord *)); -E int NDECL(dowhatis); -E int NDECL(doquickwhatis); -E int NDECL(doidtrap); -E int NDECL(dowhatdoes); -E char *FDECL(dowhatdoes_core, (CHAR_P, char *)); -E int NDECL(dohelp); -E int NDECL(dohistory); +extern char *self_lookat(char *); +extern char *monhealthdescr(struct monst *mon, boolean, char *); +extern void mhidden_description(struct monst *, boolean, char *); +extern boolean object_from_map(int,int,int,struct obj **); +extern int do_screen_description(coord, boolean, int, char *, const char **, + struct permonst **); +extern int do_look(int, coord *); +extern int dowhatis(void); +extern int doquickwhatis(void); +extern int doidtrap(void); +extern int dowhatdoes(void); +extern char *dowhatdoes_core(char, char *); +extern int dohelp(void); +extern int dohistory(void); /* ### xxmain.c ### */ #if defined(MICRO) || defined(WIN32) #ifdef CHDIR -E void FDECL(chdirx, (char *, BOOLEAN_P)); +extern void chdirx(char *, boolean); #endif /* CHDIR */ -E boolean NDECL(authorize_wizard_mode); -#endif /* MICRO || WIN32 */ +extern boolean authorize_wizard_mode(void); +#endif #if defined(WIN32) -E int NDECL(getlock); -E const char *NDECL(get_portable_device); +extern int getlock(void); +extern const char *get_portable_device(void); #endif /* ### pcsys.c ### */ #if defined(MICRO) || defined(WIN32) -E void NDECL(flushout); -E int NDECL(dosh); -E void FDECL(append_slash, (char *)); -E void FDECL(getreturn, (const char *)); +extern void flushout(void); +extern int dosh(void); +extern void append_slash(char *); +extern void getreturn(const char *); #ifndef AMIGA -E void VDECL(msmsg, (const char *, ...)); +extern void msmsg(const char *, ...); #endif -E FILE *FDECL(fopenp, (const char *, const char *)); -#endif /* MICRO || WIN32 */ +/* E FILE *fopenp(const char *, const char *); */ +#endif /* MICRO || WIN2 */ /* ### pctty.c ### */ #if defined(MICRO) || defined(WIN32) -E void NDECL(gettty); -E void FDECL(settty, (const char *)); -E void NDECL(setftty); -E void VDECL(error, (const char *, ...)); +extern void gettty(void); +extern void settty(const char *); +extern void setftty(void); +extern void error(const char *, ...); #if defined(TIMED_DELAY) && defined(_MSC_VER) -E void FDECL(msleep, (unsigned)); +extern void msleep(unsigned); #endif #endif /* MICRO || WIN32 */ /* ### pcunix.c ### */ - #if defined(MICRO) -E void FDECL(regularize, (char *)); +extern void regularize(char *); #if defined(PC_LOCKING) -E void NDECL(getlock); +extern void getlock(void); #endif #endif /* MICRO */ /* ### pickup.c ### */ -E int FDECL(collect_obj_classes, (char *, struct obj *, BOOLEAN_P, - boolean FDECL((*), (OBJ_P)), int *)); -E boolean FDECL(rider_corpse_revival, (struct obj *, BOOLEAN_P)); -E void FDECL(deferred_decor, (BOOLEAN_P)); -E boolean FDECL(menu_class_present, (int)); -E void FDECL(add_valid_menu_class, (int)); -E boolean FDECL(allow_all, (struct obj *)); -E boolean FDECL(allow_category, (struct obj *)); -E boolean FDECL(is_worn_by_type, (struct obj *)); -E int FDECL(ck_bag, (struct obj *)); -E void FDECL(removed_from_icebox, (struct obj *)); -E int FDECL(pickup, (int)); -E int FDECL(pickup_object, (struct obj *, long, BOOLEAN_P)); -E int FDECL(query_category, (const char *, struct obj *, int, - menu_item **, int)); -E int FDECL(query_objlist, (const char *, struct obj **, int, - menu_item **, int, boolean (*)(OBJ_P))); -E struct obj *FDECL(pick_obj, (struct obj *)); -E int NDECL(encumber_msg); -E int FDECL(container_at, (int, int, BOOLEAN_P)); -E int NDECL(doloot); -E void FDECL(observe_quantum_cat, (struct obj *, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(container_gone, (int (*)(OBJ_P))); -E boolean NDECL(u_handsy); -E int FDECL(use_container, (struct obj **, int, BOOLEAN_P)); -E int FDECL(loot_mon, (struct monst *, int *, boolean *)); -E int NDECL(dotip); -E struct autopickup_exception *FDECL(check_autopickup_exceptions, (struct obj *)); -E boolean FDECL(autopick_testobj, (struct obj *, BOOLEAN_P)); +extern int collect_obj_classes(char *, struct obj *, boolean, + boolean(*)(struct obj *), int *); +extern boolean rider_corpse_revival(struct obj *, boolean); +extern void deferred_decor(boolean); +extern boolean menu_class_present(int); +extern void add_valid_menu_class(int); +extern boolean allow_all(struct obj *); +extern boolean allow_category(struct obj *); +extern boolean is_worn_by_type(struct obj *); +extern int ck_bag(struct obj *); +extern void removed_from_icebox(struct obj *); +extern int pickup(int); +extern int pickup_object(struct obj *, long, boolean); +extern int query_category(const char *, struct obj *, int, menu_item **, int); +extern int query_objlist(const char *, struct obj **, int, menu_item **, int, + boolean(*)(struct obj *)); +extern struct obj *pick_obj(struct obj *); +extern int encumber_msg(void); +extern int container_at(int, int, boolean); +extern int doloot(void); +extern void observe_quantum_cat(struct obj *, boolean, boolean); +extern boolean container_gone(int(*)(struct obj *)); +extern boolean u_handsy(void); +extern int use_container(struct obj **, int, boolean); +extern int loot_mon(struct monst *, int *, boolean *); +extern int dotip(void); +extern struct autopickup_exception *check_autopickup_exceptions(struct obj *); +extern boolean autopick_testobj(struct obj *, boolean); /* ### pline.c ### */ #ifdef DUMPLOG -E void FDECL(dumplogmsg, (const char *)); -E void NDECL(dumplogfreemessages); -#endif -E void VDECL(pline, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(custompline, (unsigned, const char *, ...)) PRINTF_F(2, 3); -E void VDECL(Norep, (const char *, ...)) PRINTF_F(1, 2); -E void NDECL(free_youbuf); -E void VDECL(You, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(Your, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_feel, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_cant, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_hear, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_see, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(pline_The, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(There, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); -E void FDECL(nhassert_failed, (const char *, const char *, int)); +extern void dumplogmsg(const char *); +extern void dumplogfreemessages(void); +#endif +extern void pline(const char *, ...); +extern void custompline(unsigned, const char *, ...); +extern void Norep(const char *, ...); +extern void free_youbuf(void); +extern void You(const char *, ...); +extern void Your(const char *, ...); +extern void You_feel(const char *, ...); +extern void You_cant(const char *, ...); +extern void You_hear(const char *, ...); +extern void You_see(const char *, ...); +extern void pline_The(const char *, ...); +extern void There(const char *, ...); +extern void verbalize(const char *, ...); +extern void raw_printf(const char *, ...); +extern void impossible(const char *, ...); +extern void config_error_add(const char *, ...); +extern void nhassert_failed(const char *, const char *, int); /* ### polyself.c ### */ -E void NDECL(set_uasmon); -E void NDECL(float_vs_flight); -E void NDECL(change_sex); -E void FDECL(polyself, (int)); -E int FDECL(polymon, (int)); -E void NDECL(rehumanize); -E int NDECL(dobreathe); -E int NDECL(dospit); -E int NDECL(doremove); -E int NDECL(dospinweb); -E int NDECL(dosummon); -E int NDECL(dogaze); -E int NDECL(dohide); -E int NDECL(dopoly); -E int NDECL(domindblast); -E void NDECL(uunstick); -E void FDECL(skinback, (BOOLEAN_P)); -E const char *FDECL(mbodypart, (struct monst *, int)); -E const char *FDECL(body_part, (int)); -E int NDECL(poly_gender); -E void FDECL(ugolemeffects, (int, int)); -E boolean NDECL(ugenocided); -E const char *NDECL(udeadinside); +extern void set_uasmon(void); +extern void float_vs_flight(void); +extern void change_sex(void); +extern void polyself(int); +extern int polymon(int); +extern void rehumanize(void); +extern int dobreathe(void); +extern int dospit(void); +extern int doremove(void); +extern int dospinweb(void); +extern int dosummon(void); +extern int dogaze(void); +extern int dohide(void); +extern int dopoly(void); +extern int domindblast(void); +extern void uunstick(void); +extern void skinback(boolean); +extern const char *mbodypart(struct monst *, int); +extern const char *body_part(int); +extern int poly_gender(void); +extern void ugolemeffects(int, int); +extern boolean ugenocided(void); +extern const char *udeadinside(void); /* ### potion.c ### */ -E void FDECL(set_itimeout, (long *, long)); -E void FDECL(incr_itimeout, (long *, int)); -E void FDECL(make_confused, (long, BOOLEAN_P)); -E void FDECL(make_stunned, (long, BOOLEAN_P)); -E void FDECL(make_sick, (long, const char *, BOOLEAN_P, int)); -E void FDECL(make_slimed, (long, const char *)); -E void FDECL(make_stoned, (long, const char *, int, const char *)); -E void FDECL(make_vomiting, (long, BOOLEAN_P)); -E void FDECL(make_blinded, (long, BOOLEAN_P)); -E void NDECL(toggle_blindness); -E boolean FDECL(make_hallucinated, (long, BOOLEAN_P, long)); -E void FDECL(make_deaf, (long, BOOLEAN_P)); -E void FDECL(make_glib, (int)); -E void NDECL(self_invis_message); -E int NDECL(dodrink); -E int FDECL(dopotion, (struct obj *)); -E int FDECL(peffects, (struct obj *)); -E void FDECL(healup, (int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(strange_feeling, (struct obj *, const char *)); -E void FDECL(potionhit, (struct monst *, struct obj *, int)); -E void FDECL(potionbreathe, (struct obj *)); -E int NDECL(dodip); -E void FDECL(mongrantswish, (struct monst **)); -E void FDECL(djinni_from_bottle, (struct obj *)); -E struct monst *FDECL(split_mon, (struct monst *, struct monst *)); -E const char *NDECL(bottlename); +extern void set_itimeout(long *, long); +extern void incr_itimeout(long *, int); +extern void make_confused(long, boolean); +extern void make_stunned(long, boolean); +extern void make_sick(long, const char *, boolean, int); +extern void make_slimed(long, const char *); +extern void make_stoned(long, const char *, int, const char *); +extern void make_vomiting(long, boolean); +extern void make_blinded(long, boolean); +extern void toggle_blindness(void); +extern boolean make_hallucinated(long, boolean, long); +extern void make_deaf(long, boolean); +extern void make_glib(int); +extern void self_invis_message(void); +extern int dodrink(void); +extern int dopotion(struct obj *); +extern int peffects(struct obj *); +extern void healup(int, int, boolean, boolean); +extern void strange_feeling(struct obj *, const char *); +extern void potionhit(struct monst *, struct obj *, int); +extern void potionbreathe(struct obj *); +extern int dodip(void); +extern void mongrantswish(struct monst **); +extern void djinni_from_bottle(struct obj *); +extern struct monst *split_mon(struct monst *, struct monst *); +extern const char *bottlename(void); /* ### pray.c ### */ -E boolean FDECL(critically_low_hp, (BOOLEAN_P)); -E boolean NDECL(stuck_in_wall); -E int NDECL(dosacrifice); -E boolean FDECL(can_pray, (BOOLEAN_P)); -E int NDECL(dopray); -E const char *NDECL(u_gname); -E int NDECL(doturn); -E int FDECL(altarmask_at, (int, int)); -E const char *NDECL(a_gname); -E const char *FDECL(a_gname_at, (XCHAR_P x, XCHAR_P y)); -E const char *FDECL(align_gname, (ALIGNTYP_P)); -E const char *FDECL(halu_gname, (ALIGNTYP_P)); -E const char *FDECL(align_gtitle, (ALIGNTYP_P)); -E void FDECL(altar_wrath, (int, int)); +extern boolean critically_low_hp(boolean); +extern boolean stuck_in_wall(void); +extern int dosacrifice(void); +extern boolean can_pray(boolean); +extern int dopray(void); +extern const char *u_gname(void); +extern int doturn(void); +extern int altarmask_at(int, int); +extern const char *a_gname(void); +extern const char *a_gname_at(xchar x, xchar y); +extern const char *align_gname(aligntyp); +extern const char *halu_gname(aligntyp); +extern const char *align_gtitle(aligntyp); +extern void altar_wrath(int, int); /* ### priest.c ### */ -E int FDECL(move_special, (struct monst *, BOOLEAN_P, SCHAR_P, BOOLEAN_P, - BOOLEAN_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -E char FDECL(temple_occupied, (char *)); -E boolean FDECL(inhistemple, (struct monst *)); -E int FDECL(pri_move, (struct monst *)); -E void FDECL(priestini, (d_level *, struct mkroom *, int, int, BOOLEAN_P)); -E aligntyp FDECL(mon_aligntyp, (struct monst *)); -E char *FDECL(priestname, (struct monst *, char *)); -E boolean FDECL(p_coaligned, (struct monst *)); -E struct monst *FDECL(findpriest, (CHAR_P)); -E void FDECL(intemple, (int)); -E void FDECL(forget_temple_entry, (struct monst *)); -E void FDECL(priest_talk, (struct monst *)); -E struct monst *FDECL(mk_roamer, (struct permonst *, ALIGNTYP_P, XCHAR_P, - XCHAR_P, BOOLEAN_P)); -E void FDECL(reset_hostility, (struct monst *)); -E boolean FDECL(in_your_sanctuary, (struct monst *, XCHAR_P, XCHAR_P)); -E void FDECL(ghod_hitsu, (struct monst *)); -E void NDECL(angry_priest); -E void NDECL(clearpriests); -E void FDECL(restpriest, (struct monst *, BOOLEAN_P)); -E void FDECL(newepri, (struct monst *)); -E void FDECL(free_epri, (struct monst *)); +extern int move_special(struct monst *, boolean, schar, boolean, boolean, + xchar, xchar, xchar, xchar); +extern char temple_occupied(char *); +extern boolean inhistemple(struct monst *); +extern int pri_move(struct monst *); +extern void priestini(d_level *, struct mkroom *, int, int, boolean); +extern aligntyp mon_aligntyp(struct monst *); +extern char *priestname(struct monst *, char *); +extern boolean p_coaligned(struct monst *); +extern struct monst *findpriest(char); +extern void intemple(int); +extern void forget_temple_entry(struct monst *); +extern void priest_talk(struct monst *); +extern struct monst *mk_roamer(struct permonst *, aligntyp, xchar, xchar, + boolean); +extern void reset_hostility(struct monst *); +extern boolean in_your_sanctuary(struct monst *, xchar, xchar); +extern void ghod_hitsu(struct monst *); +extern void angry_priest(void); +extern void clearpriests(void); +extern void restpriest(struct monst *, boolean); +extern void newepri(struct monst *); +extern void free_epri(struct monst *); /* ### quest.c ### */ -E void NDECL(onquest); -E void NDECL(nemdead); -E void FDECL(artitouch, (struct obj *)); -E boolean NDECL(ok_to_quest); -E void FDECL(leader_speaks, (struct monst *)); -E void NDECL(nemesis_speaks); -E void FDECL(quest_chat, (struct monst *)); -E void FDECL(quest_talk, (struct monst *)); -E void FDECL(quest_stat_check, (struct monst *)); -E void FDECL(finish_quest, (struct obj *)); +extern void onquest(void); +extern void nemdead(void); +extern void artitouch(struct obj *); +extern boolean ok_to_quest(void); +extern void leader_speaks(struct monst *); +extern void nemesis_speaks(void); +extern void quest_chat(struct monst *); +extern void quest_talk(struct monst *); +extern void quest_stat_check(struct monst *); +extern void finish_quest(struct obj *); /* ### questpgr.c ### */ -E void NDECL(load_qtlist); -E void NDECL(unload_qtlist); -E short FDECL(quest_info, (int)); -E const char *NDECL(ldrname); -E boolean FDECL(is_quest_artifact, (struct obj *)); -E struct obj *FDECL(find_quest_artifact, (unsigned)); -E void FDECL(com_pager, (const char *)); -E void FDECL(qt_pager, (const char *)); -E struct permonst *NDECL(qt_montype); -E void NDECL(deliver_splev_message); - +extern void load_qtlist(void); +extern void unload_qtlist(void); +extern short quest_info(int); +extern const char *ldrname(void); +extern boolean is_quest_artifact(struct obj *); +extern struct obj *find_quest_artifact(unsigned); +extern void com_pager(const char *); +extern void qt_pager(const char *); +extern struct permonst *qt_montype(void); +extern void deliver_splev_message(void); /* ### random.c ### */ #if defined(RANDOM) && !defined(__GO32__) /* djgpp has its own random */ #ifndef CROSS_TO_AMIGA -E void FDECL(srandom, (unsigned)); -E char *FDECL(initstate, (unsigned, char *, int)); -E char *FDECL(setstate, (char *)); -E long NDECL(random); -#endif +extern void srandom(unsigned); +extern char *initstate(unsigned, char *, int); +extern char *setstate(char *); +extern long random(void); +#endif /* CROSS_TO_AMIGA */ #endif /* RANDOM */ /* ### read.c ### */ -E void FDECL(learnscroll, (struct obj *)); -E char *FDECL(tshirt_text, (struct obj *, char *)); -E char *FDECL(apron_text, (struct obj *, char *)); -E const char *FDECL(candy_wrapper_text, (struct obj *)); -E void FDECL(assign_candy_wrapper, (struct obj *)); -E int NDECL(doread); -E int FDECL(charge_ok, (struct obj *)); -E void FDECL(recharge, (struct obj *, int)); -E int FDECL(seffects, (struct obj *)); -E void FDECL(drop_boulder_on_player, - (BOOLEAN_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(drop_boulder_on_monster, (int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(wand_explode, (struct obj *, int)); -E void FDECL(litroom, (BOOLEAN_P, struct obj *)); -E void FDECL(do_genocide, (int)); -E void FDECL(punish, (struct obj *)); -E void NDECL(unpunish); -E boolean FDECL(cant_revive, (int *, BOOLEAN_P, struct obj *)); -E boolean NDECL(create_particular); +extern void learnscroll(struct obj *); +extern char *tshirt_text(struct obj *, char *); +extern char *apron_text(struct obj *, char *); +extern const char *candy_wrapper_text(struct obj *); +extern void assign_candy_wrapper(struct obj *); +extern int doread(void); +extern int charge_ok(struct obj *); +extern void recharge(struct obj *, int); +extern int seffects(struct obj *); +extern void drop_boulder_on_player(boolean, boolean, boolean, boolean); +extern boolean drop_boulder_on_monster(int, int, boolean, boolean); +extern void wand_explode(struct obj *, int); +extern void litroom(boolean, struct obj *); +extern void do_genocide(int); +extern void punish(struct obj *); +extern void unpunish(void); +extern boolean cant_revive(int *, boolean, struct obj *); +extern boolean create_particular(void); /* ### rect.c ### */ -E void NDECL(init_rect); -E NhRect *FDECL(get_rect, (NhRect *)); -E NhRect *NDECL(rnd_rect); -E void FDECL(remove_rect, (NhRect *)); -E void FDECL(add_rect, (NhRect *)); -E void FDECL(split_rects, (NhRect *, NhRect *)); +extern void init_rect(void); +extern NhRect *get_rect(NhRect *); +extern NhRect *rnd_rect(void); +extern void remove_rect(NhRect *); +extern void add_rect(NhRect *); +extern void split_rects(NhRect *, NhRect *); /* ## region.c ### */ -E void NDECL(clear_regions); -E void NDECL(run_regions); -E boolean FDECL(in_out_region, (XCHAR_P, XCHAR_P)); -E boolean FDECL(m_in_out_region, (struct monst *, XCHAR_P, XCHAR_P)); -E void NDECL(update_player_regions); -E void FDECL(update_monster_region, (struct monst *)); -E NhRegion *FDECL(visible_region_at, (XCHAR_P, XCHAR_P)); -E void FDECL(show_region, (NhRegion *, XCHAR_P, XCHAR_P)); -E void FDECL(save_regions, (NHFILE *)); -E void FDECL(rest_regions, (NHFILE *)); -E void FDECL(region_stats, (const char *, char *, long *, long *)); -E NhRegion *FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int)); -E boolean NDECL(region_danger); -E void NDECL(region_safety); + +extern void clear_regions(void); +extern void run_regions(void); +extern boolean in_out_region(xchar, xchar); +extern boolean m_in_out_region(struct monst *, xchar, xchar); +extern void update_player_regions(void); +extern void update_monster_region(struct monst *); +extern NhRegion *visible_region_at(xchar, xchar); +extern void show_region(NhRegion *, xchar, xchar); +extern void save_regions(NHFILE *); +extern void rest_regions(NHFILE *); +extern void region_stats(const char *, char *, long *, long *); +extern NhRegion *create_gas_cloud(xchar, xchar, int, int); +extern boolean region_danger(void); +extern void region_safety(void); /* ### restore.c ### */ -E void FDECL(inven_inuse, (BOOLEAN_P)); -E int FDECL(dorecover, (NHFILE *)); -E void FDECL(restcemetery, (NHFILE *, struct cemetery **)); -E void FDECL(trickery, (char *)); -E void FDECL(getlev, (NHFILE *, int, XCHAR_P)); -E void FDECL(get_plname_from_file, (NHFILE *, char *)); +extern void inven_inuse(boolean); +extern int dorecover(NHFILE *); +extern void restcemetery(NHFILE *, struct cemetery **); +extern void trickery(char *); +extern void getlev(NHFILE *, int, xchar); +extern void get_plname_from_file(NHFILE *, char *); #ifdef SELECTSAVED -E int FDECL(restore_menu, (winid)); +extern int restore_menu(winid); #endif -E void NDECL(minit); -E boolean FDECL(lookup_id_mapping, (unsigned, unsigned *)); -E int FDECL(validate, (NHFILE *, const char *)); -E void NDECL(reset_restpref); -E void FDECL(set_restpref, (const char *)); -E void FDECL(set_savepref, (const char *)); +extern void minit(void); +extern boolean lookup_id_mapping(unsigned, unsigned *); +extern int validate(NHFILE *, const char *); +extern void reset_restpref(void); +extern void set_restpref(const char *); +extern void set_savepref(const char *); /* ### rip.c ### */ -E void FDECL(genl_outrip, (winid, int, time_t)); +extern void genl_outrip(winid, int, time_t); /* ### rnd.c ### */ #ifdef USE_ISAAC64 -E void FDECL(init_isaac64, (unsigned long, int FDECL((*fn), (int)))); -E long NDECL(nhrand); +extern void init_isaac64(unsigned long, int(*fn)(int)); +extern long nhrand(void); #endif -E int FDECL(rn2, (int)); -E int FDECL(rn2_on_display_rng, (int)); -E int FDECL(rnl, (int)); -E int FDECL(rnd, (int)); -E int FDECL(d, (int, int)); -E int FDECL(rne, (int)); -E int FDECL(rnz, (int)); +extern int rn2(int); +extern int rn2_on_display_rng(int); +extern int rnl(int); +extern int rnd(int); +extern int d(int, int); +extern int rne(int); +extern int rnz(int); /* ### role.c ### */ -E boolean FDECL(validrole, (int)); -E boolean FDECL(validrace, (int, int)); -E boolean FDECL(validgend, (int, int, int)); -E boolean FDECL(validalign, (int, int, int)); -E int FDECL(randrole, (BOOLEAN_P)); -E int FDECL(randrace, (int)); -E int FDECL(randgend, (int, int)); -E int FDECL(randalign, (int, int)); -E int FDECL(str2role, (const char *)); -E int FDECL(str2race, (const char *)); -E int FDECL(str2gend, (const char *)); -E int FDECL(str2align, (const char *)); -E boolean FDECL(ok_role, (int, int, int, int)); -E int FDECL(pick_role, (int, int, int, int)); -E boolean FDECL(ok_race, (int, int, int, int)); -E int FDECL(pick_race, (int, int, int, int)); -E boolean FDECL(ok_gend, (int, int, int, int)); -E int FDECL(pick_gend, (int, int, int, int)); -E boolean FDECL(ok_align, (int, int, int, int)); -E int FDECL(pick_align, (int, int, int, int)); -E void NDECL(rigid_role_checks); -E boolean FDECL(setrolefilter, (const char *)); -E boolean NDECL(gotrolefilter); -E void NDECL(clearrolefilter); -E char *FDECL(build_plselection_prompt, (char *, int, int, int, int, int)); -E char *FDECL(root_plselection_prompt, (char *, int, int, int, int, int)); -E void NDECL(plnamesuffix); -E void FDECL(role_selection_prolog, (int, winid)); -E void FDECL(role_menu_extra, (int, winid, BOOLEAN_P)); -E void NDECL(role_init); -E const char *FDECL(Hello, (struct monst *)); -E const char *NDECL(Goodbye); +extern boolean validrole(int); +extern boolean validrace(int, int); +extern boolean validgend(int, int, int); +extern boolean validalign(int, int, int); +extern int randrole(boolean); +extern int randrace(int); +extern int randgend(int, int); +extern int randalign(int, int); +extern int str2role(const char *); +extern int str2race(const char *); +extern int str2gend(const char *); +extern int str2align(const char *); +extern boolean ok_role(int, int, int, int); +extern int pick_role(int, int, int, int); +extern boolean ok_race(int, int, int, int); +extern int pick_race(int, int, int, int); +extern boolean ok_gend(int, int, int, int); +extern int pick_gend(int, int, int, int); +extern boolean ok_align(int, int, int, int); +extern int pick_align(int, int, int, int); +extern void rigid_role_checks(void); +extern boolean setrolefilter(const char *); +extern boolean gotrolefilter(void); +extern void clearrolefilter(void); +extern char *build_plselection_prompt(char *, int, int, int, int, int); +extern char *root_plselection_prompt(char *, int, int, int, int, int); +extern void plnamesuffix(void); +extern void role_selection_prolog(int, winid); +extern void role_menu_extra(int, winid, boolean); +extern void role_init(void); +extern const char *Hello(struct monst *); +extern const char *Goodbye(void); /* ### rumors.c ### */ -E char *FDECL(getrumor, (int, char *, BOOLEAN_P)); -E char *FDECL(get_rnd_text, (const char *, char *, int FDECL((*), (int)))); -E void FDECL(outrumor, (int, int)); -E void FDECL(outoracle, (BOOLEAN_P, BOOLEAN_P)); -E void FDECL(save_oracles, (NHFILE *)); -E void FDECL(restore_oracles, (NHFILE *)); -E int FDECL(doconsult, (struct monst *)); -E void NDECL(rumor_check); +extern char *getrumor(int, char *, boolean); +extern char *get_rnd_text(const char *, char *, int(*)(int)); +extern void outrumor(int, int); +extern void outoracle(boolean, boolean); +extern void save_oracles(NHFILE *); +extern void restore_oracles(NHFILE *); +extern int doconsult(struct monst *); +extern void rumor_check(void); /* ### save.c ### */ -E int NDECL(dosave); -E int NDECL(dosave0); -E boolean FDECL(tricked_fileremoved, (NHFILE *, char *)); +extern int dosave(void); +extern int dosave0(void); +extern boolean tricked_fileremoved(NHFILE *, char *); #ifdef INSURANCE -E void NDECL(savestateinlock); -#endif -E void FDECL(savelev, (NHFILE *, XCHAR_P)); -E genericptr_t FDECL(mon_to_buffer, (struct monst *, int *)); -E boolean FDECL(close_check, (int)); -E void FDECL(savecemetery, (NHFILE *, struct cemetery **)); -E void FDECL(savefruitchn, (NHFILE *)); -E void FDECL(store_plname_in_file, (NHFILE *)); -E void NDECL(free_dungeons); -E void NDECL(freedynamicdata); -E void FDECL(store_savefileinfo, (NHFILE *)); -E void FDECL(store_savefileinfo, (NHFILE *)); -E int NDECL(nhdatatypes_size); -E void FDECL(assignlog, (char *, char*, int)); -E FILE *FDECL(getlog, (NHFILE *)); -E void FDECL(closelog, (NHFILE *)); - +extern void savestateinlock(void); +#endif +extern void savelev(NHFILE *, xchar); +extern genericptr_t mon_to_buffer(struct monst *, int *); +extern boolean close_check(int); +extern void savecemetery(NHFILE *, struct cemetery **); +extern void savefruitchn(NHFILE *); +extern void store_plname_in_file(NHFILE *); +extern void free_dungeons(void); +extern void freedynamicdata(void); +extern void store_savefileinfo(NHFILE *); +extern void store_savefileinfo(NHFILE *); +extern int nhdatatypes_size(void); +extern void assignlog(char *, char*, int); +extern FILE *getlog(NHFILE *); +extern void closelog(NHFILE *); /* ### sfstruct.c ### */ -#ifndef TRACE_BUFFERING -E void FDECL(newread, (NHFILE *, int, int, genericptr_t, unsigned int)); -E void FDECL(bufon, (int)); -E void FDECL(bufoff, (int)); -E void FDECL(bflush, (int)); -E void FDECL(bwrite, (int, genericptr_t, unsigned int)); -E void FDECL(mread, (int, genericptr_t, unsigned int)); -E void NDECL(minit); -E void FDECL(bclose, (int)); +#ifndef TRACEBUFFERING +extern void newread(NHFILE *, int, int, genericptr_t, unsigned int); +extern void bufon(int); +extern void bufoff(int); +extern void bflush(int); +extern void bwrite(int, genericptr_t, unsigned int); +extern void mread(int, genericptr_t, unsigned int); +extern void minit(void); +extern void bclose(int); #else #define bufon(x) Bufon(x,__FUNCTION__, __LINE__) #define bufoff(x) Bufoff(x,__FUNCTION__, __LINE__) @@ -2296,494 +2245,528 @@ E void FDECL(bclose, (int)); #define mread(x,y,z) Mread(x,y,z,__FUNCTION__, __LINE__) #define minit() Minit(__FUNCTION__, __LINE__) #endif -E void FDECL(Bufon, (int, const char *, int)); -E void FDECL(Bufoff, (int, const char *, int)); -E void FDECL(Bflush, (int, const char *, int)); -E void FDECL(Bwrite, (int, genericptr_t, unsigned int, const char *, int)); -E void FDECL(Bread, (int, genericptr_t, unsigned int, const char *, int)); -E void FDECL(Binit,(const char *, int)); -E void FDECL(Bclose, (int, const char *, int)); -E void FDECL(Mread, (int, genericptr_t, unsigned int, const char *, int)); -E void FDECL(Minit, (const char *, int)); +extern void Bufon(int, const char *, int); +extern void Bufoff(int, const char *, int); +extern void Bflush(int, const char *, int); +extern void Bwrite(int, genericptr_t, unsigned int, const char *, int); +extern void Bread(int, genericptr_t, unsigned int, const char *, int); +extern void Binit(const char *, int); +extern void Bclose(int, const char *, int); +extern void Mread(int, genericptr_t, unsigned int, const char *, int); +extern void Minit(const char *, int); #if defined(ZEROCOMP) -E void FDECL(zerocomp_bclose, (int)); +extern void zerocomp_bclose(int); #endif /* ### shk.c ### */ -E void FDECL(setpaid, (struct monst *)); -E long FDECL(money2mon, (struct monst *, long)); -E void FDECL(money2u, (struct monst *, long)); -E void FDECL(shkgone, (struct monst *)); -E void FDECL(set_residency, (struct monst *, BOOLEAN_P)); -E void FDECL(replshk, (struct monst *, struct monst *)); -E void FDECL(restshk, (struct monst *, BOOLEAN_P)); -E char FDECL(inside_shop, (XCHAR_P, XCHAR_P)); -E void FDECL(u_left_shop, (char *, BOOLEAN_P)); -E void FDECL(remote_burglary, (XCHAR_P, XCHAR_P)); -E void FDECL(u_entered_shop, (char *)); -E void FDECL(pick_pick, (struct obj *)); -E boolean FDECL(same_price, (struct obj *, struct obj *)); -E void NDECL(shopper_financial_report); -E int FDECL(inhishop, (struct monst *)); -E struct monst *FDECL(shop_keeper, (CHAR_P)); -E boolean FDECL(tended_shop, (struct mkroom *)); -E boolean FDECL(is_unpaid, (struct obj *)); -E void FDECL(delete_contents, (struct obj *)); -E void FDECL(obfree, (struct obj *, struct obj *)); -E void FDECL(home_shk, (struct monst *, BOOLEAN_P)); -E void FDECL(make_happy_shk, (struct monst *, BOOLEAN_P)); -E void FDECL(make_happy_shoppers, (BOOLEAN_P)); -E void FDECL(hot_pursuit, (struct monst *)); -E void FDECL(make_angry_shk, (struct monst *, XCHAR_P, XCHAR_P)); -E int NDECL(dopay); -E boolean FDECL(paybill, (int, BOOLEAN_P)); -E void NDECL(finish_paybill); -E struct obj *FDECL(find_oid, (unsigned)); -E long FDECL(contained_cost, - (struct obj *, struct monst *, long, BOOLEAN_P, BOOLEAN_P)); -E long FDECL(contained_gold, (struct obj *, BOOLEAN_P)); -E void FDECL(picked_container, (struct obj *)); -E void FDECL(gem_learned, (int)); -E void FDECL(alter_cost, (struct obj *, long)); -E long FDECL(unpaid_cost, (struct obj *, BOOLEAN_P)); -E boolean FDECL(billable, (struct monst **, struct obj *, CHAR_P, BOOLEAN_P)); -E void FDECL(addtobill, (struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(splitbill, (struct obj *, struct obj *)); -E void FDECL(subfrombill, (struct obj *, struct monst *)); -E long FDECL(stolen_value, (struct obj *, XCHAR_P, XCHAR_P, - BOOLEAN_P, BOOLEAN_P)); -E void FDECL(donate_gold, (long, struct monst *, BOOLEAN_P)); -E void FDECL(sellobj_state, (int)); -E void FDECL(sellobj, (struct obj *, XCHAR_P, XCHAR_P)); -E int FDECL(doinvbill, (int)); -E struct monst *FDECL(shkcatch, (struct obj *, XCHAR_P, XCHAR_P)); -E void FDECL(add_damage, (XCHAR_P, XCHAR_P, long)); -E int FDECL(repair_damage, (struct monst *, struct damage *, int *, - BOOLEAN_P)); -E int FDECL(shk_move, (struct monst *)); -E void FDECL(after_shk_move, (struct monst *)); -E boolean FDECL(is_fshk, (struct monst *)); -E void FDECL(shopdig, (int)); -E void FDECL(pay_for_damage, (const char *, BOOLEAN_P)); -E boolean FDECL(costly_spot, (XCHAR_P, XCHAR_P)); -E struct obj *FDECL(shop_object, (XCHAR_P, XCHAR_P)); -E void FDECL(price_quote, (struct obj *)); -E void FDECL(shk_chat, (struct monst *)); -E void FDECL(check_unpaid_usage, (struct obj *, BOOLEAN_P)); -E void FDECL(check_unpaid, (struct obj *)); -E void FDECL(costly_gold, (XCHAR_P, XCHAR_P, long)); -E long FDECL(get_cost_of_shop_item, (struct obj *, int *)); -E int FDECL(oid_price_adjustment, (struct obj *, unsigned)); -E boolean FDECL(block_door, (XCHAR_P, XCHAR_P)); -E boolean FDECL(block_entry, (XCHAR_P, XCHAR_P)); -E char *FDECL(shk_your, (char *, struct obj *)); -E char *FDECL(Shk_Your, (char *, struct obj *)); -E void FDECL(globby_bill_fixup, (struct obj *, struct obj *)); -E void FDECL(globby_donation, (struct obj *, struct obj *)); +extern void setpaid(struct monst *); +extern long money2mon(struct monst *, long); +extern void money2u(struct monst *, long); +extern void shkgone(struct monst *); +extern void set_residency(struct monst *, boolean); +extern void replshk(struct monst *, struct monst *); +extern void restshk(struct monst *, boolean); +extern char inside_shop(xchar, xchar); +extern void u_left_shop(char *, boolean); +extern void remote_burglary(xchar, xchar); +extern void u_entered_shop(char *); +extern void pick_pick(struct obj *); +extern boolean same_price(struct obj *, struct obj *); +extern void shopper_financial_report(void); +extern int inhishop(struct monst *); +extern struct monst *shop_keeper(char); +extern boolean tended_shop(struct mkroom *); +extern boolean is_unpaid(struct obj *); +extern void delete_contents(struct obj *); +extern void obfree(struct obj *, struct obj *); +extern void home_shk(struct monst *, boolean); +extern void make_happy_shk(struct monst *, boolean); +extern void make_happy_shoppers(boolean); +extern void hot_pursuit(struct monst *); +extern void make_angry_shk(struct monst *, xchar, xchar); +extern int dopay(void); +extern boolean paybill(int, boolean); +extern void finish_paybill(void); +extern struct obj *find_oid(unsigned); +extern long contained_cost(struct obj *, struct monst *, long, boolean, + boolean); +extern long contained_gold(struct obj *, boolean); +extern void picked_container(struct obj *); +extern void gem_learned(int); +extern void alter_cost(struct obj *, long); +extern long unpaid_cost(struct obj *, boolean); +extern boolean billable(struct monst **, struct obj *, char, boolean); +extern void addtobill(struct obj *, boolean, boolean, boolean); +extern void splitbill(struct obj *, struct obj *); +extern void subfrombill(struct obj *, struct monst *); +extern long stolen_value(struct obj *, xchar, xchar, boolean, boolean); +extern void donate_gold(long, struct monst *, boolean); +extern void sellobj_state(int); +extern void sellobj(struct obj *, xchar, xchar); +extern int doinvbill(int); +extern struct monst *shkcatch(struct obj *, xchar, xchar); +extern void add_damage(xchar, xchar, long); +extern int repair_damage(struct monst *, struct damage *, int *, boolean); +extern int shk_move(struct monst *); +extern void after_shk_move(struct monst *); +extern boolean is_fshk(struct monst *); +extern void shopdig(int); +extern void pay_for_damage(const char *, boolean); +extern boolean costly_spot(xchar, xchar); +extern struct obj *shop_object(xchar, xchar); +extern void price_quote(struct obj *); +extern void shk_chat(struct monst *); +extern void check_unpaid_usage(struct obj *, boolean); +extern void check_unpaid(struct obj *); +extern void costly_gold(xchar, xchar, long); +extern long get_cost_of_shop_item(struct obj *, int *); +extern int oid_price_adjustment(struct obj *, unsigned); +extern boolean block_door(xchar, xchar); +extern boolean block_entry(xchar, xchar); +extern char *shk_your(char *, struct obj *); +extern char *Shk_Your(char *, struct obj *); +extern void globby_bill_fixup(struct obj *, struct obj *); +extern void globby_donation(struct obj *, struct obj *); /* ### shknam.c ### */ -E void FDECL(neweshk, (struct monst *)); -E void FDECL(free_eshk, (struct monst *)); -E void FDECL(stock_room, (int, struct mkroom *)); -E boolean FDECL(saleable, (struct monst *, struct obj *)); -E int FDECL(get_shop_item, (int)); -E char *FDECL(Shknam, (struct monst *)); -E char *FDECL(shkname, (struct monst *)); -E boolean FDECL(shkname_is_pname, (struct monst *)); -E boolean FDECL(is_izchak, (struct monst *, BOOLEAN_P)); +extern void neweshk(struct monst *); +extern void free_eshk(struct monst *); +extern void stock_room(int, struct mkroom *); +extern boolean saleable(struct monst *, struct obj *); +extern int get_shop_item(int); +extern char *Shknam(struct monst *); +extern char *shkname(struct monst *); +extern boolean shkname_is_pname(struct monst *); +extern boolean is_izchak(struct monst *, boolean); /* ### sit.c ### */ -E void NDECL(take_gold); -E int NDECL(dosit); -E void NDECL(rndcurse); -E void NDECL(attrcurse); +extern void take_gold(void); +extern int dosit(void); +extern void rndcurse(void); +extern void attrcurse(void); /* ### sounds.c ### */ -E void NDECL(dosounds); -E const char *FDECL(growl_sound, (struct monst *)); -E void FDECL(growl, (struct monst *)); -E void FDECL(yelp, (struct monst *)); -E void FDECL(whimper, (struct monst *)); -E void FDECL(beg, (struct monst *)); -E const char *FDECL(maybe_gasp, (struct monst *)); -E int NDECL(dotalk); -E int NDECL(tiphat); +extern void dosounds(void); +extern const char *growl_sound(struct monst *); +extern void growl(struct monst *); +extern void yelp(struct monst *); +extern void whimper(struct monst *); +extern void beg(struct monst *); +extern const char *maybe_gasp(struct monst *); +extern int dotalk(void); +extern int tiphat(void); #ifdef USER_SOUNDS -E int FDECL(add_sound_mapping, (const char *)); -E void FDECL(play_sound_for_message, (const char *)); -E void FDECL(maybe_play_sound, (const char *)); -E void NDECL(release_sound_mappings); -#endif +extern int add_sound_mapping(const char *); +extern void play_sound_for_message(const char *); +extern void maybe_play_sound(const char *); +extern void release_sound_mappings(void); +#endif /* USER SOUNDS */ /* ### sp_lev.c ### */ + #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) -E void NDECL(create_des_coder); -E struct mapfragment *FDECL(mapfrag_fromstr, (char *)); -E void FDECL(mapfrag_free, (struct mapfragment **)); -E schar FDECL(mapfrag_get, (struct mapfragment *, int, int)); -E boolean FDECL(mapfrag_canmatch, (struct mapfragment *)); -E const char * FDECL(mapfrag_error, (struct mapfragment *)); -E boolean FDECL(mapfrag_match, (struct mapfragment *, int, int)); -E void FDECL(flip_level, (int, BOOLEAN_P)); -E void FDECL(flip_level_rnd, (int, BOOLEAN_P)); -E boolean FDECL(check_room, (xchar *, xchar *, xchar *, xchar *, BOOLEAN_P)); -E boolean FDECL(create_room, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P)); -E void FDECL(create_secret_door, (struct mkroom *, XCHAR_P)); -E boolean FDECL(dig_corridor, (coord *, coord *, BOOLEAN_P, SCHAR_P, SCHAR_P)); -E void FDECL(fill_special_room, (struct mkroom *)); -E void FDECL(wallify_map, (int, int, int, int)); -E boolean FDECL(load_special, (const char *)); -E xchar FDECL(selection_getpoint, (int, int, struct selectionvar *)); -E struct selectionvar *NDECL(selection_new); -E void FDECL(selection_free, (struct selectionvar *, BOOLEAN_P)); -E struct selectionvar *FDECL(selection_clone, (struct selectionvar *)); -E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int)))); -E void FDECL(selection_floodfill, (struct selectionvar *, int, int, - BOOLEAN_P)); -E boolean FDECL(pm_good_location, (int, int, struct permonst *)); -E void FDECL(get_location_coord, (xchar *, xchar *, int, struct mkroom *, - long)); -E void FDECL(selection_setpoint, (int, int, struct selectionvar *, XCHAR_P)); -E struct selectionvar * FDECL(selection_not, (struct selectionvar *)); -E void FDECL(selection_filter_percent, (struct selectionvar *, int)); -E int FDECL(selection_rndcoord, (struct selectionvar *, xchar *, xchar *, - BOOLEAN_P)); -E void FDECL(selection_do_grow, (struct selectionvar *, int)); -E void FDECL(selection_do_line, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - struct selectionvar *)); -E void FDECL(selection_do_randline, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - SCHAR_P, SCHAR_P, struct selectionvar *)); -E struct selectionvar *FDECL(selection_filter_mapchar, (struct selectionvar *, - XCHAR_P, int)); -E void FDECL(set_floodfillchk_match_under, (XCHAR_P)); -E void FDECL(selection_do_ellipse, (struct selectionvar *, - int, int, int, int, int)); -E void FDECL(selection_do_gradient, (struct selectionvar *, long, long, - long, long, long, long, long, long)); -E void NDECL(update_croom); -E const char *FDECL(get_trapname_bytype, (int)); -E void FDECL(l_register_des, (lua_State *)); +extern void create_des_coder(void); +extern struct mapfragment *mapfrag_fromstr(char *); +extern void mapfrag_free(struct mapfragment **); +extern schar mapfrag_get(struct mapfragment *, int, int); +extern boolean mapfrag_canmatch(struct mapfragment *); +extern const char * mapfrag_error(struct mapfragment *); +extern boolean mapfrag_match(struct mapfragment *, int, int); +extern void flip_level(int, boolean); +extern void flip_level_rnd(int, boolean); +extern boolean check_room(xchar *, xchar *, xchar *, xchar *, boolean); +extern boolean create_room(xchar, xchar, xchar, xchar, xchar, xchar, xchar, + xchar); +extern void create_secret_door(struct mkroom *, xchar); +extern boolean dig_corridor(coord *, coord *, boolean, schar, schar); +extern void fill_special_room(struct mkroom *); +extern void wallify_map(int, int, int, int); +extern boolean load_special(const char *); +extern xchar selection_getpoint(int, int, struct selectionvar *); +extern struct selectionvar *selection_new(void); +extern void selection_free(struct selectionvar *, boolean); +extern struct selectionvar *selection_clone(struct selectionvar *); +extern void set_selection_floodfillchk(int(*)(int,int)); +extern void selection_floodfill(struct selectionvar *, int, int, boolean); +extern boolean pm_good_location(int, int, struct permonst *); +extern void get_location_coord(xchar *, xchar *, int, struct mkroom *, long); +extern void selection_setpoint(int, int, struct selectionvar *, xchar); +extern struct selectionvar * selection_not(struct selectionvar *); +extern void selection_filter_percent(struct selectionvar *, int); +extern int selection_rndcoord(struct selectionvar *, xchar *, xchar *, + boolean); +extern void selection_do_grow(struct selectionvar *, int); +extern void selection_do_line(xchar, xchar, xchar, xchar, + struct selectionvar *); +extern void selection_do_randline(xchar, xchar, xchar, xchar, schar, schar, + struct selectionvar *); +extern struct selectionvar *selection_filter_mapchar(struct selectionvar *, + xchar, int); +extern void set_floodfillchk_match_under(xchar); +extern void selection_do_ellipse(struct selectionvar *, int, int, int, int, + int); +extern void selection_do_gradient(struct selectionvar *, long, long, long, + long, long, long, long, long); +extern void update_croom(void); +extern const char *get_trapname_bytype(int); +extern void l_register_des(lua_State *); #endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ /* ### spell.c ### */ -E void FDECL(book_cursed, (struct obj *)); -E int FDECL(study_book, (struct obj *)); -E void FDECL(book_disappears, (struct obj *)); -E void FDECL(book_substitution, (struct obj *, struct obj *)); -E void NDECL(age_spells); -E int NDECL(docast); -E int FDECL(spell_skilltype, (int)); -E int FDECL(spelleffects, (int, BOOLEAN_P)); -E int FDECL(tport_spell, (int)); -E void NDECL(losespells); -E int NDECL(dovspell); -E void FDECL(initialspell, (struct obj *)); +extern void book_cursed(struct obj *); +extern int study_book(struct obj *); +extern void book_disappears(struct obj *); +extern void book_substitution(struct obj *, struct obj *); +extern void age_spells(void); +extern int docast(void); +extern int spell_skilltype(int); +extern int spelleffects(int, boolean); +extern int tport_spell(int); +extern void losespells(void); +extern int dovspell(void); +extern void initialspell(struct obj *); /* ### steal.c ### */ -E long FDECL(somegold, (long)); -E void FDECL(stealgold, (struct monst *)); -E void NDECL(thiefdead); -E void FDECL(remove_worn_item, (struct obj *, BOOLEAN_P)); -E int FDECL(steal, (struct monst *, char *)); -E int FDECL(mpickobj, (struct monst *, struct obj *)); -E void FDECL(stealamulet, (struct monst *)); -E void FDECL(maybe_absorb_item, (struct monst *, struct obj *, int, int)); -E void FDECL(mdrop_obj, (struct monst *, struct obj *, BOOLEAN_P)); -E void FDECL(mdrop_special_objs, (struct monst *)); -E void FDECL(relobj, (struct monst *, int, BOOLEAN_P)); -E struct obj *FDECL(findgold, (struct obj *)); +extern long somegold(long); +extern void stealgold(struct monst *); +extern void thiefdead(void); +extern void remove_worn_item(struct obj *, boolean); +extern int steal(struct monst *, char *); +extern int mpickobj(struct monst *, struct obj *); +extern void stealamulet(struct monst *); +extern void maybe_absorb_item(struct monst *, struct obj *, int, int); +extern void mdrop_obj(struct monst *, struct obj *, boolean); +extern void mdrop_special_objs(struct monst *); +extern void relobj(struct monst *, int, boolean); +extern struct obj *findgold(struct obj *); /* ### steed.c ### */ -E void NDECL(rider_cant_reach); -E boolean FDECL(can_saddle, (struct monst *)); -E int FDECL(use_saddle, (struct obj *)); -E void FDECL(put_saddle_on_mon, (struct obj *, struct monst *)); -E boolean FDECL(can_ride, (struct monst *)); -E int NDECL(doride); -E boolean FDECL(mount_steed, (struct monst *, BOOLEAN_P)); -E void NDECL(exercise_steed); -E void NDECL(kick_steed); -E void FDECL(dismount_steed, (int)); -E void FDECL(place_monster, (struct monst *, int, int)); -E boolean FDECL(stucksteed, (BOOLEAN_P)); +extern void rider_cant_reach(void); +extern boolean can_saddle(struct monst *); +extern int use_saddle(struct obj *); +extern void put_saddle_on_mon(struct obj *, struct monst *); +extern boolean can_ride(struct monst *); +extern int doride(void); +extern boolean mount_steed(struct monst *, boolean); +extern void exercise_steed(void); +extern void kick_steed(void); +extern void dismount_steed(int); +extern void place_monster(struct monst *, int, int); +extern boolean stucksteed(boolean); /* ### symbols.c ### */ -E void FDECL(switch_symbols, (int)); -E void FDECL(assign_graphics, (int)); -E void NDECL(init_symbols); -E void NDECL(init_showsyms); -E void NDECL(init_primary_symbols); -E void NDECL(init_rogue_symbols); -E void NDECL(init_ov_primary_symbols); -E void NDECL(init_ov_rogue_symbols); -E void FDECL(clear_symsetentry, (int, BOOLEAN_P)); -E void FDECL(update_primary_symset, (struct symparse *, int)); -E void FDECL(update_rogue_symset, (struct symparse *, int)); -E void FDECL(update_ov_primary_symset, (struct symparse *, int)); -E void FDECL(update_ov_rogue_symset, (struct symparse *, int)); -E nhsym FDECL(get_othersym, (int, int)); +extern void switch_symbols(int); +extern void assign_graphics(int); +extern void init_symbols(void); +extern void init_showsyms(void); +extern void init_primary_symbols(void); +extern void init_rogue_symbols(void); +extern void init_ov_primary_symbols(void); +extern void init_ov_rogue_symbols(void); +extern void clear_symsetentry(int, boolean); +extern void update_primary_symset(struct symparse *, int); +extern void update_rogue_symset(struct symparse *, int); +extern void update_ov_primary_symset(struct symparse *, int); +extern void update_ov_rogue_symset(struct symparse *, int); +extern nhsym get_othersym(int, int); /* ### sys.c ### */ -E void NDECL(sys_early_init); -E void NDECL(sysopt_release); -E void FDECL(sysopt_seduce_set, (int)); +extern void sys_early_init(void); +extern void sysopt_release(void); +extern void sysopt_seduce_set(int); /* ### teleport.c ### */ -E boolean FDECL(noteleport_level, (struct monst *)); -E boolean FDECL(goodpos, (int, int, struct monst *, long)); -E boolean FDECL(enexto, (coord *, XCHAR_P, XCHAR_P, struct permonst *)); -E boolean FDECL(enexto_core, (coord *, XCHAR_P, XCHAR_P, - struct permonst *, long)); -E void FDECL(teleds, (int, int, int)); -E boolean FDECL(safe_teleds, (int)); -E boolean FDECL(teleport_pet, (struct monst *, BOOLEAN_P)); -E void NDECL(tele); -E void FDECL(scrolltele, (struct obj *)); -E int NDECL(dotelecmd); -E int FDECL(dotele, (BOOLEAN_P)); -E void NDECL(level_tele); -E void FDECL(domagicportal, (struct trap *)); -E void FDECL(tele_trap, (struct trap *)); -E void FDECL(level_tele_trap, (struct trap *, unsigned)); -E void FDECL(rloc_to, (struct monst *, int, int)); -E boolean FDECL(rloc, (struct monst *, BOOLEAN_P)); -E boolean FDECL(tele_restrict, (struct monst *)); -E void FDECL(mtele_trap, (struct monst *, struct trap *, int)); -E int FDECL(mlevel_tele_trap, (struct monst *, struct trap *, - BOOLEAN_P, int)); -E boolean FDECL(rloco, (struct obj *)); -E int NDECL(random_teleport_level); -E boolean FDECL(u_teleport_mon, (struct monst *, BOOLEAN_P)); +extern boolean noteleport_level(struct monst *); +extern boolean goodpos(int, int, struct monst *, long); +extern boolean enexto(coord *, xchar, xchar, struct permonst *); +extern boolean enexto_core(coord *, xchar, xchar, struct permonst *, long); +extern void teleds(int, int, int); +extern boolean safe_teleds(int); +extern boolean teleport_pet(struct monst *, boolean); +extern void tele(void); +extern void scrolltele(struct obj *); +extern int dotelecmd(void); +extern int dotele(boolean); +extern void level_tele(void); +extern void domagicportal(struct trap *); +extern void tele_trap(struct trap *); +extern void level_tele_trap(struct trap *, unsigned); +extern void rloc_to(struct monst *, int, int); +extern boolean rloc(struct monst *, boolean); +extern boolean tele_restrict(struct monst *); +extern void mtele_trap(struct monst *, struct trap *, int); +extern int mlevel_tele_trap(struct monst *, struct trap *, boolean, int); +extern boolean rloco(struct obj *); +extern int random_teleport_level(void); +extern boolean u_teleport_mon(struct monst *, boolean); /* ### tile.c ### */ + #ifdef USE_TILES -E void FDECL(substitute_tiles, (d_level *)); +extern void substitute_tiles(d_level *); #endif /* ### timeout.c ### */ -E void NDECL(burn_away_slime); -E void NDECL(nh_timeout); -E void FDECL(fall_asleep, (int, BOOLEAN_P)); -E void FDECL(attach_egg_hatch_timeout, (struct obj *, long)); -E void FDECL(attach_fig_transform_timeout, (struct obj *)); -E void FDECL(kill_egg, (struct obj *)); -E void FDECL(hatch_egg, (ANY_P *, long)); -E void FDECL(learn_egg_type, (int)); -E void FDECL(burn_object, (ANY_P *, long)); -E void FDECL(begin_burn, (struct obj *, BOOLEAN_P)); -E void FDECL(end_burn, (struct obj *, BOOLEAN_P)); -E void NDECL(do_storms); -E boolean FDECL(start_timer, (long, SHORT_P, SHORT_P, ANY_P *)); -E long FDECL(stop_timer, (SHORT_P, ANY_P *)); -E long FDECL(peek_timer, (SHORT_P, ANY_P *)); -E void NDECL(run_timers); -E void FDECL(obj_move_timers, (struct obj *, struct obj *)); -E void FDECL(obj_split_timers, (struct obj *, struct obj *)); -E void FDECL(obj_stop_timers, (struct obj *)); -E boolean FDECL(obj_has_timer, (struct obj *, SHORT_P)); -E void FDECL(spot_stop_timers, (XCHAR_P, XCHAR_P, SHORT_P)); -E long FDECL(spot_time_expires, (XCHAR_P, XCHAR_P, SHORT_P)); -E long FDECL(spot_time_left, (XCHAR_P, XCHAR_P, SHORT_P)); -E boolean FDECL(obj_is_local, (struct obj *)); -E void FDECL(save_timers, (NHFILE *, int)); -E void FDECL(restore_timers, (NHFILE *, int, long)); -E void FDECL(timer_stats, (const char *, char *, long *, long *)); -E void FDECL(relink_timers, (BOOLEAN_P)); -E int NDECL(wiz_timeout_queue); -E void NDECL(timer_sanity_check); +extern void burn_away_slime(void); +extern void nh_timeout(void); +extern void fall_asleep(int, boolean); +extern void attach_egg_hatch_timeout(struct obj *, long); +extern void attach_fig_transform_timeout(struct obj *); +extern void kill_egg(struct obj *); +extern void hatch_egg(union any *, long); +extern void learn_egg_type(int); +extern void burn_object(union any *, long); +extern void begin_burn(struct obj *, boolean); +extern void end_burn(struct obj *, boolean); +extern void do_storms(void); +extern boolean start_timer(long, short, short, union any *); +extern long stop_timer(short, union any *); +extern long peek_timer(short, union any *); +extern void run_timers(void); +extern void obj_move_timers(struct obj *, struct obj *); +extern void obj_split_timers(struct obj *, struct obj *); +extern void obj_stop_timers(struct obj *); +extern boolean obj_has_timer(struct obj *, short); +extern void spot_stop_timers(xchar, xchar, short); +extern long spot_time_expires(xchar, xchar, short); +extern long spot_time_left(xchar, xchar, short); +extern boolean obj_is_local(struct obj *); +extern void save_timers(NHFILE *, int); +extern void restore_timers(NHFILE *, int, long); +extern void timer_stats(const char *, char *, long *, long *); +extern void relink_timers(boolean); +extern int wiz_timeout_queue(void); +extern void timer_sanity_check(void); /* ### topten.c ### */ -E void FDECL(formatkiller, (char *, unsigned, int, BOOLEAN_P)); -E int FDECL(observable_depth, (d_level *)); -E void FDECL(topten, (int, time_t)); -E void FDECL(prscore, (int, char **)); -E struct toptenentry *NDECL(get_rnd_toptenentry); -E struct obj *FDECL(tt_oname, (struct obj *)); +extern void formatkiller(char *, unsigned, int, boolean); +extern int observable_depth(d_level *); +extern void topten(int, time_t); +extern void prscore(int, char **); +extern struct toptenentry *get_rnd_toptenentry(void); +extern struct obj *tt_oname(struct obj *); /* ### track.c ### */ -E void NDECL(initrack); -E void NDECL(settrack); -E coord *FDECL(gettrack, (int, int)); +extern void initrack(void); +extern void settrack(void); +extern coord *gettrack(int, int); /* ### trap.c ### */ -E boolean FDECL(burnarmor, (struct monst *)); -E int FDECL(erode_obj, (struct obj *, const char *, int, int)); -E boolean FDECL(grease_protect, (struct obj *, const char *, struct monst *)); -E struct trap *FDECL(maketrap, (int, int, int)); -E void FDECL(fall_through, (BOOLEAN_P, unsigned)); -E struct monst *FDECL(animate_statue, - (struct obj *, XCHAR_P, XCHAR_P, int, int *)); -E struct monst *FDECL(activate_statue_trap, - (struct trap *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(set_utrap, (unsigned, unsigned)); -E void FDECL(reset_utrap, (BOOLEAN_P)); -E void FDECL(dotrap, (struct trap *, unsigned)); -E void FDECL(seetrap, (struct trap *)); -E void FDECL(feeltrap, (struct trap *)); -E int FDECL(mintrap, (struct monst *)); -E void FDECL(instapetrify, (const char *)); -E void FDECL(minstapetrify, (struct monst *, BOOLEAN_P)); -E void FDECL(selftouch, (const char *)); -E void FDECL(mselftouch, (struct monst *, const char *, BOOLEAN_P)); -E void NDECL(float_up); -E void FDECL(fill_pit, (int, int)); -E int FDECL(float_down, (long, long)); -E void NDECL(climb_pit); -E boolean FDECL(fire_damage, (struct obj *, BOOLEAN_P, XCHAR_P, XCHAR_P)); -E int FDECL(fire_damage_chain, - (struct obj *, BOOLEAN_P, BOOLEAN_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(lava_damage, (struct obj *, XCHAR_P, XCHAR_P)); -E void acid_damage(struct obj *); -E int FDECL(water_damage, (struct obj *, const char *, BOOLEAN_P)); -E void FDECL(water_damage_chain, (struct obj *, BOOLEAN_P)); -E boolean NDECL(drown); -E void FDECL(drain_en, (int)); -E int NDECL(dountrap); -E void FDECL(cnv_trap_obj, (int, int, struct trap *, BOOLEAN_P)); -E int FDECL(untrap, (BOOLEAN_P)); -E boolean FDECL(openholdingtrap, (struct monst *, boolean *)); -E boolean FDECL(closeholdingtrap, (struct monst *, boolean *)); -E boolean FDECL(openfallingtrap, (struct monst *, BOOLEAN_P, boolean *)); -E boolean FDECL(chest_trap, (struct obj *, int, BOOLEAN_P)); -E void FDECL(deltrap, (struct trap *)); -E boolean FDECL(delfloortrap, (struct trap *)); -E struct trap *FDECL(t_at, (int, int)); -E void FDECL(b_trapped, (const char *, int)); -E boolean NDECL(unconscious); -E void FDECL(blow_up_landmine, (struct trap *)); -E int FDECL(launch_obj, (SHORT_P, int, int, int, int, int)); -E boolean NDECL(launch_in_progress); -E void NDECL(force_launch_placement); -E boolean FDECL(uteetering_at_seen_pit, (struct trap *)); -E boolean FDECL(uescaped_shaft, (struct trap *)); -E boolean NDECL(lava_effects); -E void NDECL(sink_into_lava); -E void NDECL(sokoban_guilt); -E const char * FDECL(trapname, (int, BOOLEAN_P)); -E void FDECL(ignite_items, (struct obj *)); +extern boolean burnarmor(struct monst *); +extern int erode_obj(struct obj *, const char *, int, int); +extern boolean grease_protect(struct obj *, const char *, struct monst *); +extern struct trap *maketrap(int, int, int); +extern void fall_through(boolean, unsigned); +extern struct monst *animate_statue(struct obj *, xchar, xchar, int, int *); +extern struct monst *activate_statue_trap(struct trap *, xchar, xchar, + boolean); +extern void set_utrap(unsigned, unsigned); +extern void reset_utrap(boolean); +extern void dotrap(struct trap *, unsigned); +extern void seetrap(struct trap *); +extern void feeltrap(struct trap *); +extern int mintrap(struct monst *); +extern void instapetrify(const char *); +extern void minstapetrify(struct monst *, boolean); +extern void selftouch(const char *); +extern void mselftouch(struct monst *, const char *, boolean); +extern void float_up(void); +extern void fill_pit(int, int); +extern int float_down(long, long); +extern void climb_pit(void); +extern boolean fire_damage(struct obj *, boolean, xchar, xchar); +extern int fire_damage_chain(struct obj *, boolean, boolean, xchar, xchar); +extern boolean lava_damage(struct obj *, xchar, xchar); +extern void acid_damage(struct obj *); +extern int water_damage(struct obj *, const char *, boolean); +extern void water_damage_chain(struct obj *, boolean); +extern boolean drown(void); +extern void drain_en(int); +extern int dountrap(void); +extern void cnv_trap_obj(int, int, struct trap *, boolean); +extern int untrap(boolean); +extern boolean openholdingtrap(struct monst *, boolean *); +extern boolean closeholdingtrap(struct monst *, boolean *); +extern boolean openfallingtrap(struct monst *, boolean, boolean *); +extern boolean chest_trap(struct obj *, int, boolean); +extern void deltrap(struct trap *); +extern boolean delfloortrap(struct trap *); +extern struct trap *t_at(int, int); +extern void b_trapped(const char *, int); +extern boolean unconscious(void); +extern void blow_up_landmine(struct trap *); +extern int launch_obj(short, int, int, int, int, int); +extern boolean launch_in_progress(void); +extern void force_launch_placement(void); +extern boolean uteetering_at_seen_pit(struct trap *); +extern boolean uescaped_shaft(struct trap *); +extern boolean lava_effects(void); +extern void sink_into_lava(void); +extern void sokoban_guilt(void); +extern const char * trapname(int, boolean); +extern void ignite_items(struct obj *); /* ### u_init.c ### */ -E void NDECL(u_init); +extern void u_init(void); /* ### uhitm.c ### */ -E void FDECL(erode_armor, (struct monst *, int)); -E boolean FDECL(attack_checks, (struct monst *, struct obj *)); -E void FDECL(check_caitiff, (struct monst *)); -E int FDECL(find_roll_to_hit, (struct monst *, UCHAR_P, struct obj *, - int *, int *)); -E boolean FDECL(attack, (struct monst *)); -E boolean FDECL(hmon, (struct monst *, struct obj *, int, int)); -E boolean FDECL(shade_miss, (struct monst *, struct monst *, struct obj *, - BOOLEAN_P, BOOLEAN_P)); -E void FDECL(mhitm_ad_rust, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_corr, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_dcay, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_dren, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_drli, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_fire, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_cold, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_elec, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_acid, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_sgld, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_tlpt, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_blnd, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_curs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_drst, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_stck, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_wrap, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_plys, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_slee, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_slim, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_ench, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_slow, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_conf, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_poly, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_famn, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_pest, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_deth, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_halu, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_phys, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_ston, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_were, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_heal, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_stun, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_legs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_dgst, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_samu, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_dise, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_sedu, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_ad_ssex, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E void FDECL(mhitm_adtyping, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E boolean FDECL(do_stone_u, (struct monst *)); -E void FDECL(do_stone_mon, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); -E int FDECL(damageum, (struct monst *, struct attack *, int)); -E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P)); -E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, BOOLEAN_P, - UCHAR_P, BOOLEAN_P)); -E void FDECL(passive_obj, (struct monst *, struct obj *, struct attack *)); -E void FDECL(stumble_onto_mimic, (struct monst *)); -E int FDECL(flash_hits_mon, (struct monst *, struct obj *)); -E void FDECL(light_hits_gremlin, (struct monst *, int)); +extern void erode_armor(struct monst *, int); +extern boolean attack_checks(struct monst *, struct obj *); +extern void check_caitiff(struct monst *); +extern int find_roll_to_hit(struct monst *, uchar, struct obj *, int *, int *); +extern boolean attack(struct monst *); +extern boolean hmon(struct monst *, struct obj *, int, int); +extern boolean shade_miss(struct monst *, struct monst *, struct obj *, + boolean, boolean); +extern void mhitm_ad_rust(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_corr(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_dcay(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_dren(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_drli(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_fire(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_cold(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_elec(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_acid(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_sgld(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_tlpt(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_blnd(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_curs(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_drst(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_drin(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_stck(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_wrap(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_plys(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_slee(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_slim(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_ench(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_slow(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_conf(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_poly(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_famn(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_pest(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_deth(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_halu(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_phys(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_ston(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_were(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_heal(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_stun(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_legs(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_dgst(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_samu(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_dise(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_sedu(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_ad_ssex(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern void mhitm_adtyping(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern boolean do_stone_u(struct monst *); +extern void do_stone_mon(struct monst *, struct attack *, struct monst *, + struct mhitm_data *); +extern int damageum(struct monst *, struct attack *, int); +extern void missum(struct monst *, struct attack *, boolean); +extern int passive(struct monst *, struct obj *, boolean, boolean, uchar, + boolean); +extern void passive_obj(struct monst *, struct obj *, struct attack *); +extern void stumble_onto_mimic(struct monst *); +extern int flash_hits_mon(struct monst *, struct obj *); +extern void light_hits_gremlin(struct monst *, int); -/* ### unixmain.c ### */ +/* ### unixmain.c ### */ #ifdef UNIX #ifdef PORT_HELP -E void NDECL(port_help); -#endif -E void FDECL(sethanguphandler, (void (*)(int))); -E boolean NDECL(authorize_wizard_mode); -E void FDECL(append_slash, (char *)); -E boolean FDECL(check_user_string, (const char *)); -E char *NDECL(get_login_name); -E unsigned long NDECL(sys_random_seed); +extern void port_help(void); +#endif +extern void sethanguphandler(void(*)(int)); +extern boolean authorize_wizard_mode(void); +extern void append_slash(char *); +extern boolean check_user_string(const char *); +extern char *get_login_name(void); +extern unsigned long sys_random_seed(void); #endif /* UNIX */ /* ### unixtty.c ### */ #if defined(UNIX) || defined(__BEOS__) -E void NDECL(gettty); -E void FDECL(settty, (const char *)); -E void NDECL(setftty); -E void NDECL(intron); -E void NDECL(introff); -E void VDECL(error, (const char *, ...)) PRINTF_F(1, 2); +extern void gettty(void); +extern void settty(const char *); +extern void setftty(void); +extern void intron(void); +extern void introff(void); +extern void error (const char *, ...); #endif /* UNIX || __BEOS__ */ /* ### unixunix.c ### */ #ifdef UNIX -E void NDECL(getlock); -E void FDECL(regularize, (char *)); +extern void getlock(void); +extern void regularize(char *); #if defined(TIMED_DELAY) && !defined(msleep) && defined(SYSV) -E void FDECL(msleep, (unsigned)); +extern void msleep(unsigned); #endif #ifdef SHELL -E int NDECL(dosh); +extern int dosh(void); #endif /* SHELL */ #if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER) -E int FDECL(child, (int)); +extern int child(int); #endif #ifdef PANICTRACE -E boolean FDECL(file_exists, (const char *)); +extern boolean file_exists(const char *); #endif #endif /* UNIX */ @@ -2791,400 +2774,396 @@ E boolean FDECL(file_exists, (const char *)); #ifdef UNIX #ifdef GNOME_GRAPHICS -E int FDECL(hide_privileges, (BOOLEAN_P)); +extern int hide_privileges(boolean); #endif #endif /* UNIX */ /* ### vault.c ### */ -E void FDECL(newegd, (struct monst *)); -E void FDECL(free_egd, (struct monst *)); -E boolean FDECL(grddead, (struct monst *)); -E struct monst *NDECL(findgd); -E void NDECL(vault_summon_gd); -E char FDECL(vault_occupied, (char *)); -E void FDECL(uleftvault, (struct monst *)); -E void NDECL(invault); -E int FDECL(gd_move, (struct monst *)); -E void FDECL(paygd, (BOOLEAN_P)); -E long FDECL(hidden_gold, (BOOLEAN_P)); -E boolean NDECL(gd_sound); -E void FDECL(vault_gd_watching, (unsigned int)); +extern void newegd(struct monst *); +extern void free_egd(struct monst *); +extern boolean grddead(struct monst *); +extern struct monst *findgd(void); +extern void vault_summon_gd(void); +extern char vault_occupied(char *); +extern void uleftvault(struct monst *); +extern void invault(void); +extern int gd_move(struct monst *); +extern void paygd(boolean); +extern long hidden_gold(boolean); +extern boolean gd_sound(void); +extern void vault_gd_watching(unsigned int); /* ### version.c ### */ -E char *FDECL(version_string, (char *)); -E char *FDECL(getversionstring, (char *)); -E int NDECL(doversion); -E int NDECL(doextversion); +extern char *version_string(char *); +extern char *getversionstring(char *); +extern int doversion(void); +extern int doextversion(void); #ifdef MICRO -E boolean FDECL(comp_times, (long)); -#endif -E boolean -FDECL(check_version, (struct version_info *, const char *, BOOLEAN_P, unsigned long)); -E boolean FDECL(uptodate, (NHFILE *, const char *, unsigned long)); -E void FDECL(store_formatindicator, (NHFILE *)); -E void FDECL(store_version, (NHFILE *)); -E unsigned long FDECL(get_feature_notice_ver, (char *)); -E unsigned long NDECL(get_current_feature_ver); -E const char *FDECL(copyright_banner_line, (int)); -E void FDECL(early_version_info, (BOOLEAN_P)); - +extern boolean comp_times(long); +#endif +extern boolean check_version(struct version_info *, const char *, boolean, + unsigned long); +extern boolean uptodate(NHFILE *, const char *, unsigned long); +extern void store_formatindicator(NHFILE *); +extern void store_version(NHFILE *); +extern unsigned long get_feature_notice_ver(char *); +extern unsigned long get_current_feature_ver(void); +extern const char *copyright_banner_line(int); +extern void early_version_info(boolean); #ifdef RUNTIME_PORT_ID -E char *FDECL(get_port_id, (char *)); +extern char *get_port_id(char *); #endif #ifdef RUNTIME_PASTEBUF_SUPPORT -E void FDECL(port_insert_pastebuf, (char *)); +extern void port_insert_pastebuf(char *); #endif /* ### video.c ### */ #ifdef MSDOS -E int FDECL(assign_video, (char *)); +extern int assign_video(char *); #ifdef NO_TERMS -E void NDECL(gr_init); -E void NDECL(gr_finish); +extern void gr_init(void); +extern void gr_finish(void); #endif -E void FDECL(tileview, (BOOLEAN_P)); +extern void tileview(boolean); #endif #ifdef VIDEOSHADES -E int FDECL(assign_videoshades, (char *)); -E int FDECL(assign_videocolors, (char *)); +extern int assign_videoshades(char *); +extern int assign_videocolors(char *); #endif /* ### vision.c ### */ -E void NDECL(vision_init); -E int FDECL(does_block, (int, int, struct rm *)); -E void NDECL(vision_reset); -E void FDECL(vision_recalc, (int)); -E void FDECL(block_point, (int, int)); -E void FDECL(unblock_point, (int, int)); -E boolean FDECL(clear_path, (int, int, int, int)); -E void FDECL(do_clear_area, (int, int, int, - void (*)(int, int, genericptr), genericptr_t)); -E unsigned FDECL(howmonseen, (struct monst *)); +extern void vision_init(void); +extern int does_block(int, int, struct rm *); +extern void vision_reset(void); +extern void vision_recalc(int); +extern void block_point(int, int); +extern void unblock_point(int, int); +extern boolean clear_path(int, int, int, int); +extern void do_clear_area(int, int, int, void(*)(int, int, void *), + genericptr_t); +extern unsigned howmonseen(struct monst *); #ifdef VMS /* ### vmsfiles.c ### */ -E int FDECL(vms_link, (const char *, const char *)); -E int FDECL(vms_unlink, (const char *)); -E int FDECL(vms_creat, (const char *, unsigned int)); -E int FDECL(vms_open, (const char *, int, unsigned int)); -E boolean FDECL(same_dir, (const char *, const char *)); -E int FDECL(c__translate, (int)); -E char *FDECL(vms_basename, (const char *)); +extern int vms_link(const char *, const char *); +extern int vms_unlink(const char *); +extern int vms_creat(const char *, unsigned int); +extern int vms_open(const char *, int, unsigned int); +extern boolean same_dir(const char *, const char *); +extern int c__translate(int); +extern char *vms_basename(const char *); /* ### vmsmail.c ### */ -E unsigned long NDECL(init_broadcast_trapping); -E unsigned long NDECL(enable_broadcast_trapping); -E unsigned long NDECL(disable_broadcast_trapping); +extern unsigned long init_broadcast_trapping(void); +extern unsigned long enable_broadcast_trapping(void); +extern unsigned long disable_broadcast_trapping(void); #if 0 -E struct mail_info *NDECL(parse_next_broadcast); +extern struct mail_info *parse_next_broadcast(void); #endif /*0*/ /* ### vmsmain.c ### */ -E int FDECL(main, (int, char **)); +extern int main(int, char **); #ifdef CHDIR -E void FDECL(chdirx, (const char *, BOOLEAN_P)); +extern void chdirx(const char *, boolean); #endif /* CHDIR */ -E void FDECL(sethanguphandler, (void (*)(int))); -E boolean NDECL(authorize_wizard_mode); +extern void sethanguphandler(void(*)(int)); +extern boolean authorize_wizard_mode(void); /* ### vmsmisc.c ### */ -E void NDECL(vms_abort) NORETURN; -E void FDECL(vms_exit, (int)) NORETURN; +extern void vms_abort(void) NORETURN; +extern void vms_exit(int) NORETURN; #ifdef PANICTRACE -E void FDECL(vms_traceback, (int)); +extern void vms_traceback(int); #endif /* ### vmstty.c ### */ -E int NDECL(vms_getchar); -E void NDECL(gettty); -E void FDECL(settty, (const char *)); -E void FDECL(shuttty, (const char *)); -E void NDECL(setftty); -E void NDECL(intron); -E void NDECL(introff); -E void VDECL(error, (const char *, ...)) PRINTF_F(1, 2); +extern int vms_getchar(void); +extern void gettty(void); +extern void settty(const char *); +extern void shuttty(const char *); +extern void setftty(void); +extern void intron(void); +extern void introff(void); +extern void error (const char *, ...); #ifdef TIMED_DELAY -E void FDECL(msleep, (unsigned)); +extern void msleep(unsigned); #endif /* ### vmsunix.c ### */ -E void NDECL(getlock); -E void FDECL(regularize, (char *)); -E int NDECL(vms_getuid); -E boolean FDECL(file_is_stmlf, (int)); -E int FDECL(vms_define, (const char *, const char *, int)); -E int FDECL(vms_putenv, (const char *)); -E char *NDECL(verify_termcap); +extern void getlock(void); +extern void regularize(char *); +extern int vms_getuid(void); +extern boolean file_is_stmlf(int); +extern int vms_define(const char *, const char *, int); +extern int vms_putenv(const char *); +extern char *verify_termcap(void); #if defined(CHDIR) || defined(SHELL) || defined(SECURE) -E void NDECL(privoff); -E void NDECL(privon); +extern void privoff(void); +extern void privon(void); #endif #ifdef SYSCF -E boolean FDECL(check_user_string, (const char *)); +extern boolean check_user_string(const char *); #endif #ifdef SHELL -E int NDECL(dosh); +extern int dosh(void); #endif #if defined(SHELL) || defined(MAIL) -E int FDECL(vms_doshell, (const char *, BOOLEAN_P)); +extern int vms_doshell(const char *, boolean); #endif #ifdef SUSPEND -E int NDECL(dosuspend); +extern int dosuspend(void); #endif #ifdef SELECTSAVED -E int FDECL(vms_get_saved_games, (const char *, char ***)); +extern int vms_get_saved_games(const char *, char ***); #endif #endif /* VMS */ /* ### weapon.c ### */ -E const char *FDECL(weapon_descr, (struct obj *)); -E int FDECL(hitval, (struct obj *, struct monst *)); -E int FDECL(dmgval, (struct obj *, struct monst *)); -E int FDECL(special_dmgval, (struct monst *, struct monst *, long, long *)); -E void FDECL(silver_sears, (struct monst *, struct monst *, long)); -E struct obj *FDECL(select_rwep, (struct monst *)); -E boolean FDECL(monmightthrowwep, (struct obj *)); -E struct obj *FDECL(select_hwep, (struct monst *)); -E void FDECL(possibly_unwield, (struct monst *, BOOLEAN_P)); -E void FDECL(mwepgone, (struct monst *)); -E int FDECL(mon_wield_item, (struct monst *)); -E int NDECL(abon); -E int NDECL(dbon); -E void FDECL(wet_a_towel, (struct obj *, int, BOOLEAN_P)); -E void FDECL(dry_a_towel, (struct obj *, int, BOOLEAN_P)); -E char *FDECL(skill_level_name, (int, char *)); -E const char *FDECL(skill_name, (int)); -E boolean FDECL(can_advance, (int, BOOLEAN_P)); -E int NDECL(enhance_weapon_skill); -E void FDECL(unrestrict_weapon_skill, (int)); -E void FDECL(use_skill, (int, int)); -E void FDECL(add_weapon_skill, (int)); -E void FDECL(lose_weapon_skill, (int)); -E void FDECL(drain_weapon_skill, (int)); -E int FDECL(weapon_type, (struct obj *)); -E int NDECL(uwep_skill_type); -E int FDECL(weapon_hit_bonus, (struct obj *)); -E int FDECL(weapon_dam_bonus, (struct obj *)); -E void FDECL(skill_init, (const struct def_skill *)); +extern const char *weapon_descr(struct obj *); +extern int hitval(struct obj *, struct monst *); +extern int dmgval(struct obj *, struct monst *); +extern int special_dmgval(struct monst *, struct monst *, long, long *); +extern void silver_sears(struct monst *, struct monst *, long); +extern struct obj *select_rwep(struct monst *); +extern boolean monmightthrowwep(struct obj *); +extern struct obj *select_hwep(struct monst *); +extern void possibly_unwield(struct monst *, boolean); +extern void mwepgone(struct monst *); +extern int mon_wield_item(struct monst *); +extern int abon(void); +extern int dbon(void); +extern void wet_a_towel(struct obj *, int, boolean); +extern void dry_a_towel(struct obj *, int, boolean); +extern char *skill_level_name(int, char *); +extern const char *skill_name(int); +extern boolean can_advance(int, boolean); +extern int enhance_weapon_skill(void); +extern void unrestrict_weapon_skill(int); +extern void use_skill(int, int); +extern void add_weapon_skill(int); +extern void lose_weapon_skill(int); +extern void drain_weapon_skill(int); +extern int weapon_type(struct obj *); +extern int uwep_skill_type(void); +extern int weapon_hit_bonus(struct obj *); +extern int weapon_dam_bonus(struct obj *); +extern void skill_init(const struct def_skill *); /* ### were.c ### */ -E void FDECL(were_change, (struct monst *)); -E int FDECL(counter_were, (int)); -E int FDECL(were_beastie, (int)); -E void FDECL(new_were, (struct monst *)); -E int FDECL(were_summon, (struct permonst *, BOOLEAN_P, int *, char *)); -E void NDECL(you_were); -E void FDECL(you_unwere, (BOOLEAN_P)); -E void FDECL(set_ulycn, (int)); +extern void were_change(struct monst *); +extern int counter_were(int); +extern int were_beastie(int); +extern void new_were(struct monst *); +extern int were_summon(struct permonst *, boolean, int *, char *); +extern void you_were(void); +extern void you_unwere(boolean); +extern void set_ulycn(int); /* ### wield.c ### */ -E void FDECL(setuwep, (struct obj *)); -E void FDECL(setuqwep, (struct obj *)); -E void FDECL(setuswapwep, (struct obj *)); -E int NDECL(dowield); -E int NDECL(doswapweapon); -E int NDECL(dowieldquiver); -E boolean FDECL(wield_tool, (struct obj *, const char *)); -E int NDECL(can_twoweapon); -E void NDECL(drop_uswapwep); -E int NDECL(dotwoweapon); -E void NDECL(uwepgone); -E void NDECL(uswapwepgone); -E void NDECL(uqwepgone); -E void FDECL(set_twoweap, (BOOLEAN_P)); -E void NDECL(untwoweapon); -E int FDECL(chwepon, (struct obj *, int)); -E int FDECL(welded, (struct obj *)); -E void FDECL(weldmsg, (struct obj *)); -E void FDECL(setmnotwielded, (struct monst *, struct obj *)); -E boolean FDECL(mwelded, (struct obj *)); +extern void setuwep(struct obj *); +extern void setuqwep(struct obj *); +extern void setuswapwep(struct obj *); +extern int dowield(void); +extern int doswapweapon(void); +extern int dowieldquiver(void); +extern boolean wield_tool(struct obj *, const char *); +extern int can_twoweapon(void); +extern void drop_uswapwep(void); +extern int dotwoweapon(void); +extern void uwepgone(void); +extern void uswapwepgone(void); +extern void uqwepgone(void); +extern void set_twoweap(boolean); +extern void untwoweapon(void); +extern int chwepon(struct obj *, int); +extern int welded(struct obj *); +extern void weldmsg(struct obj *); +extern void setmnotwielded(struct monst *, struct obj *); +extern boolean mwelded(struct obj *); /* ### windows.c ### */ -E void FDECL(choose_windows, (const char *)); +extern void choose_windows(const char *); #ifdef WINCHAIN -void FDECL(addto_windowchain, (const char *s)); -void NDECL(commit_windowchain); -#endif -E boolean NDECL(genl_can_suspend_no); -E boolean NDECL(genl_can_suspend_yes); -E char FDECL(genl_message_menu, (CHAR_P, int, const char *)); -E void FDECL(genl_preference_update, (const char *)); -E char *FDECL(genl_getmsghistory, (BOOLEAN_P)); -E void FDECL(genl_putmsghistory, (const char *, BOOLEAN_P)); +void addto_windowchain(const char *s); +void commit_windowchain(void); +#endif +extern boolean genl_can_suspend_no(void); +extern boolean genl_can_suspend_yes(void); +extern char genl_message_menu(char, int, const char *); +extern void genl_preference_update(const char *); +extern char *genl_getmsghistory(boolean); +extern void genl_putmsghistory(const char *, boolean); #ifdef HANGUPHANDLING -E void NDECL(nhwindows_hangup); -#endif -E void NDECL(genl_status_init); -E void NDECL(genl_status_finish); -E void FDECL(genl_status_enablefield, (int, const char *, const char *, - BOOLEAN_P)); -E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, - unsigned long *)); +extern void nhwindows_hangup(void); +#endif +extern void genl_status_init(void); +extern void genl_status_finish(void); +extern void genl_status_enablefield(int, const char *, const char *, boolean); +extern void genl_status_update(int, genericptr_t, int, int, int, + unsigned long *); #ifdef DUMPLOG -E char *FDECL(dump_fmtstr, (const char *, char *, BOOLEAN_P)); -#endif -E void FDECL(dump_open_log, (time_t)); -E void NDECL(dump_close_log); -E void FDECL(dump_redirect, (BOOLEAN_P)); -E void FDECL(dump_forward_putstr, (winid, int, const char*, int)); -E int FDECL(has_color, (int)); -E int FDECL(glyph2ttychar, (int)); -E int FDECL(glyph2symidx, (int)); -E char *FDECL(encglyph, (int)); -E char *FDECL(decode_mixed, (char *, const char *)); -E void FDECL(genl_putmixed, (winid, int, const char *)); -E boolean FDECL(menuitem_invert_test, (int, unsigned, BOOLEAN_P)); +extern char *dump_fmtstr(const char *, char *, boolean); +#endif +extern void dump_open_log(time_t); +extern void dump_close_log(void); +extern void dump_redirect(boolean); +extern void dump_forward_putstr(winid, int, const char*, int); +extern int has_color(int); +extern int glyph2ttychar(int); +extern int glyph2symidx(int); +extern char *encglyph(int); +extern char *decode_mixed(char *, const char *); +extern void genl_putmixed(winid, int, const char *); +extern boolean menuitem_invert_test(int, unsigned, boolean); /* ### winnt.c ### */ + #ifdef WIN32 -E void NDECL(nethack_enter_winnt); +extern void nethack_enter_winnt(void); #endif /* ### wizard.c ### */ -E void NDECL(amulet); -E int FDECL(mon_has_amulet, (struct monst *)); -E int FDECL(mon_has_special, (struct monst *)); -E int FDECL(tactics, (struct monst *)); -E boolean FDECL(has_aggravatables, (struct monst *)); -E void NDECL(aggravate); -E void NDECL(clonewiz); -E int FDECL(pick_nasty, (int)); -E int FDECL(nasty, (struct monst *)); -E void NDECL(resurrect); -E void NDECL(intervene); -E void NDECL(wizdead); -E void FDECL(cuss, (struct monst *)); +extern void amulet(void); +extern int mon_has_amulet(struct monst *); +extern int mon_has_special(struct monst *); +extern int tactics(struct monst *); +extern boolean has_aggravatables(struct monst *); +extern void aggravate(void); +extern void clonewiz(void); +extern int pick_nasty(int); +extern int nasty(struct monst *); +extern void resurrect(void); +extern void intervene(void); +extern void wizdead(void); +extern void cuss(struct monst *); /* ### worm.c ### */ -E int NDECL(get_wormno); -E void FDECL(initworm, (struct monst *, int)); -E void FDECL(worm_move, (struct monst *)); -E void FDECL(worm_nomove, (struct monst *)); -E void FDECL(wormgone, (struct monst *)); -E int FDECL(wormhitu, (struct monst *)); -E void FDECL(cutworm, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(see_wsegs, (struct monst *)); -E void FDECL(detect_wsegs, (struct monst *, BOOLEAN_P)); -E void FDECL(save_worm, (NHFILE *)); -E void FDECL(rest_worm, (NHFILE *)); -E void FDECL(place_wsegs, (struct monst *, struct monst *)); -E void FDECL(sanity_check_worm, (struct monst *)); -E void NDECL(wormno_sanity_check); -E void FDECL(remove_worm, (struct monst *)); -E void FDECL(place_worm_tail_randomly, (struct monst *, XCHAR_P, XCHAR_P)); -E int FDECL(size_wseg, (struct monst *)); -E int FDECL(count_wsegs, (struct monst *)); -E boolean FDECL(worm_known, (struct monst *)); -E boolean FDECL(worm_cross, (int, int, int, int)); -E int FDECL(wseg_at, (struct monst *, int, int)); -E void FDECL(flip_worm_segs_vertical, (struct monst *, int, int)); -E void FDECL(flip_worm_segs_horizontal, (struct monst *, int, int)); +extern int get_wormno(void); +extern void initworm(struct monst *, int); +extern void worm_move(struct monst *); +extern void worm_nomove(struct monst *); +extern void wormgone(struct monst *); +extern int wormhitu(struct monst *); +extern void cutworm(struct monst *, xchar, xchar, boolean); +extern void see_wsegs(struct monst *); +extern void detect_wsegs(struct monst *, boolean); +extern void save_worm(NHFILE *); +extern void rest_worm(NHFILE *); +extern void place_wsegs(struct monst *, struct monst *); +extern void sanity_check_worm(struct monst *); +extern void wormno_sanity_check(void); +extern void remove_worm(struct monst *); +extern void place_worm_tail_randomly(struct monst *, xchar, xchar); +extern int size_wseg(struct monst *); +extern int count_wsegs(struct monst *); +extern boolean worm_known(struct monst *); +extern boolean worm_cross(int, int, int, int); +extern int wseg_at(struct monst *, int, int); +extern void flip_worm_segs_vertical(struct monst *, int, int); +extern void flip_worm_segs_horizontal(struct monst *, int, int); /* ### worn.c ### */ -E void FDECL(setworn, (struct obj *, long)); -E void FDECL(setnotworn, (struct obj *)); -E void NDECL(allunworn); -E struct obj *FDECL(wearmask_to_obj, (long)); -E long FDECL(wearslot, (struct obj *)); -E void FDECL(mon_set_minvis, (struct monst *)); -E void FDECL(mon_adjust_speed, (struct monst *, int, struct obj *)); -E void FDECL(update_mon_intrinsics, - (struct monst *, struct obj *, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(find_mac, (struct monst *)); -E void FDECL(m_dowear, (struct monst *, BOOLEAN_P)); -E struct obj *FDECL(which_armor, (struct monst *, long)); -E void FDECL(mon_break_armor, (struct monst *, BOOLEAN_P)); -E void FDECL(bypass_obj, (struct obj *)); -E void NDECL(clear_bypasses); -E void FDECL(bypass_objlist, (struct obj *, BOOLEAN_P)); -E struct obj *FDECL(nxt_unbypassed_obj, (struct obj *)); -E struct obj *FDECL(nxt_unbypassed_loot, (Loot *, struct obj *)); -E int FDECL(racial_exception, (struct monst *, struct obj *)); +extern void setworn(struct obj *, long); +extern void setnotworn(struct obj *); +extern void allunworn(void); +extern struct obj *wearmask_to_obj(long); +extern long wearslot(struct obj *); +extern void mon_set_minvis(struct monst *); +extern void mon_adjust_speed(struct monst *, int, struct obj *); +extern void update_mon_intrinsics(struct monst *, struct obj *, boolean, + boolean); +extern int find_mac(struct monst *); +extern void m_dowear(struct monst *, boolean); +extern struct obj *which_armor(struct monst *, long); +extern void mon_break_armor(struct monst *, boolean); +extern void bypass_obj(struct obj *); +extern void clear_bypasses(void); +extern void bypass_objlist(struct obj *, boolean); +extern struct obj *nxt_unbypassed_obj(struct obj *); +extern struct obj *nxt_unbypassed_loot(Loot *, struct obj *); +extern int racial_exception(struct monst *, struct obj *); /* ### write.c ### */ -E int FDECL(dowrite, (struct obj *)); +extern int dowrite(struct obj *); /* ### zap.c ### */ -E void FDECL(learnwand, (struct obj *)); -E int FDECL(bhitm, (struct monst *, struct obj *)); -E void FDECL(probe_monster, (struct monst *)); -E boolean FDECL(get_obj_location, (struct obj *, xchar *, xchar *, int)); -E boolean FDECL(get_mon_location, (struct monst *, xchar *, xchar *, int)); -E struct monst *FDECL(get_container_location, - (struct obj * obj, int *, int *)); -E struct monst *FDECL(montraits, (struct obj *, coord *, BOOLEAN_P)); -E struct monst *FDECL(revive, (struct obj *, BOOLEAN_P)); -E int FDECL(unturn_dead, (struct monst *)); -E void NDECL(unturn_you); -E void FDECL(cancel_item, (struct obj *)); -E boolean FDECL(drain_item, (struct obj *, BOOLEAN_P)); -E boolean FDECL(obj_unpolyable, (struct obj *)); -E struct obj *FDECL(poly_obj, (struct obj *, int)); -E boolean FDECL(obj_resists, (struct obj *, int, int)); -E boolean FDECL(obj_shudders, (struct obj *)); -E void FDECL(do_osshock, (struct obj *)); -E int FDECL(bhito, (struct obj *, struct obj *)); -E int FDECL(bhitpile, - (struct obj *, int (*)(OBJ_P, OBJ_P), int, int, SCHAR_P)); -E int FDECL(zappable, (struct obj *)); -E void NDECL(do_enlightenment_effect); -E void FDECL(zapnodir, (struct obj *)); -E int NDECL(dozap); -E int FDECL(zapyourself, (struct obj *, BOOLEAN_P)); -E void FDECL(ubreatheu, (struct attack *)); -E int FDECL(lightdamage, (struct obj *, BOOLEAN_P, int)); -E boolean FDECL(flashburn, (long)); -E boolean FDECL(cancel_monst, (struct monst *, struct obj *, BOOLEAN_P, - BOOLEAN_P, BOOLEAN_P)); -E void NDECL(zapsetup); -E void NDECL(zapwrapup); -E void FDECL(weffects, (struct obj *)); -E int FDECL(spell_damage_bonus, (int)); -E const char *FDECL(exclam, (int force)); -E void FDECL(hit, (const char *, struct monst *, const char *)); -E void FDECL(miss, (const char *, struct monst *)); -E struct monst *FDECL(bhit, (int, int, int, enum bhit_call_types, - int (*)(MONST_P, OBJ_P), - int (*)(OBJ_P, OBJ_P), struct obj **)); -E struct monst *FDECL(boomhit, (struct obj *, int, int)); -E int FDECL(zhitm, (struct monst *, int, int, struct obj **)); -E int FDECL(burn_floor_objects, (int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(buzz, (int, int, XCHAR_P, XCHAR_P, int, int)); -E void FDECL(dobuzz, (int, int, XCHAR_P, XCHAR_P, int, int, BOOLEAN_P)); -E void FDECL(melt_ice, (XCHAR_P, XCHAR_P, const char *)); -E void FDECL(start_melt_ice_timeout, (XCHAR_P, XCHAR_P, long)); -E void FDECL(melt_ice_away, (ANY_P *, long)); -E int FDECL(zap_over_floor, (XCHAR_P, XCHAR_P, int, boolean *, SHORT_P)); -E void FDECL(fracture_rock, (struct obj *)); -E boolean FDECL(break_statue, (struct obj *)); -E void FDECL(destroy_item, (int, int)); -E int FDECL(destroy_mitem, (struct monst *, int, int)); -E int FDECL(resist, (struct monst *, CHAR_P, int, int)); -E void NDECL(makewish); +extern void learnwand(struct obj *); +extern int bhitm(struct monst *, struct obj *); +extern void probe_monster(struct monst *); +extern boolean get_obj_location(struct obj *, xchar *, xchar *, int); +extern boolean get_mon_location(struct monst *, xchar *, xchar *, int); +extern struct monst *get_container_location(struct obj * obj, int *, int *); +extern struct monst *montraits(struct obj *, coord *, boolean); +extern struct monst *revive(struct obj *, boolean); +extern int unturn_dead(struct monst *); +extern void unturn_you(void); +extern void cancel_item(struct obj *); +extern boolean drain_item(struct obj *, boolean); +extern boolean obj_unpolyable(struct obj *); +extern struct obj *poly_obj(struct obj *, int); +extern boolean obj_resists(struct obj *, int, int); +extern boolean obj_shudders(struct obj *); +extern void do_osshock(struct obj *); +extern int bhito(struct obj *, struct obj *); +extern int bhitpile(struct obj *, int(*)(struct obj *, struct obj *), int, + int, schar); +extern int zappable(struct obj *); +extern void do_enlightenment_effect(void); +extern void zapnodir(struct obj *); +extern int dozap(void); +extern int zapyourself(struct obj *, boolean); +extern void ubreatheu(struct attack *); +extern int lightdamage(struct obj *, boolean, int); +extern boolean flashburn(long); +extern boolean cancel_monst(struct monst *, struct obj *, boolean, boolean, + boolean); +extern void zapsetup(void); +extern void zapwrapup(void); +extern void weffects(struct obj *); +extern int spell_damage_bonus(int); +extern const char *exclam(int force); +extern void hit(const char *, struct monst *, const char *); +extern void miss(const char *, struct monst *); +extern struct monst *bhit(int, int, int, enum bhit_call_types, + int(*)(struct monst *, struct obj *), + int(*)(struct obj *, struct obj *), struct obj **); +extern struct monst *boomhit(struct obj *, int, int); +extern int zhitm(struct monst *, int, int, struct obj **); +extern int burn_floor_objects(int, int, boolean, boolean); +extern void buzz(int, int, xchar, xchar, int, int); +extern void dobuzz(int, int, xchar, xchar, int, int, boolean); +extern void melt_ice(xchar, xchar, const char *); +extern void start_melt_ice_timeout(xchar, xchar, long); +extern void melt_ice_away(union any *, long); +extern int zap_over_floor(xchar, xchar, int, boolean *, short); +extern void fracture_rock(struct obj *); +extern boolean break_statue(struct obj *); +extern void destroy_item(int, int); +extern int destroy_mitem(struct monst *, int, int); +extern int resist(struct monst *, char, int, int); +extern void makewish(void); #endif /* !MAKEDEFS_C && !MDLIB_C */ -#undef E - #endif /* EXTERN_H */ diff --git a/include/func_tab.h b/include/func_tab.h index 84539c559..439de8996 100644 --- a/include/func_tab.h +++ b/include/func_tab.h @@ -16,7 +16,7 @@ struct ext_func_tab { uchar key; const char *ef_txt, *ef_desc; - int NDECL((*ef_funct)); + int (*ef_funct)(void); int flags; const char *f_text; }; diff --git a/include/global.h b/include/global.h index 375618533..f5d13c78c 100644 --- a/include/global.h +++ b/include/global.h @@ -302,7 +302,7 @@ extern struct cross_target_s cross_target; if nethack is built with MONITOR_HEAP enabled and they aren't; this declaration has been moved out of the '#else' below to avoid getting a complaint from -Wmissing-prototypes when building with MONITOR_HEAP */ -extern char *FDECL(dupstr, (const char *)); +extern char *dupstr(const char *); /* * MONITOR_HEAP is conditionally used for primitive memory leak debugging. @@ -314,9 +314,9 @@ extern char *FDECL(dupstr, (const char *)); */ #ifdef MONITOR_HEAP /* plain alloc() is not declared except in alloc.c */ -extern long *FDECL(nhalloc, (unsigned int, const char *, int)); -extern void FDECL(nhfree, (genericptr_t, const char *, int)); -extern char *FDECL(nhdupstr, (const char *, const char *, int)); +extern long *nhalloc(unsigned int, const char *, int); +extern void nhfree(genericptr_t, const char *, int); +extern char *nhdupstr(const char *, const char *, int); /* this predates C99's __func__; that is trickier to use conditionally because it is not implemented as a preprocessor macro; MONITOR_HEAP wouldn't gain much benefit from it anyway so continue to live without it; @@ -332,7 +332,7 @@ extern char *FDECL(nhdupstr, (const char *, const char *, int)); #define dupstr(s) nhdupstr(s, __FILE__, (int) __LINE__) #else /* !MONITOR_HEAP */ /* declare alloc.c's alloc(); allocations made with it use ordinary free() */ -extern long *FDECL(alloc, (unsigned int)); /* alloc.c */ +extern long *alloc(unsigned int); /* alloc.c */ #endif /* ?MONITOR_HEAP */ /* Used for consistency checks of various data files; declare it here so diff --git a/include/mextra.h b/include/mextra.h index cc4d715ae..4d15157d9 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -18,15 +18,15 @@ * 2. Add a pointer to your new struct to the mextra struct in this * file. * 3. Add a referencing macro at bottom of this file after the mextra - * struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples). + * struct (see MGIVENNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples). * 4. If your new field isn't a pointer and requires a non-zero value * on initialization, add code to init_mextra() in src/makemon.c * 5. Create a newXX(mtmp) function and possibly a free_XX(mtmp) * function in an appropriate new or existing source file and add * a prototype for it to include/extern.h. * - * void FDECL(newXX, (struct monst *)); - * void FDECL(free_XX, (struct monst *)); + * void newXX(struct monst *); + * void free_XX(struct monst *); * * void * newXX(mtmp) diff --git a/include/ntconf.h b/include/ntconf.h index 67e675398..791720470 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -91,9 +91,8 @@ /* Stuff to help the user with some common, yet significant errors */ #define INTERJECT_PANIC 0 #define INTERJECTION_TYPES (INTERJECT_PANIC + 1) -extern void FDECL(interject_assistance, - (int, int, genericptr_t, genericptr_t)); -extern void FDECL(interject, (int)); +extern void interject_assistance(int, int, genericptr_t, genericptr_t); +extern void interject(int); /* *=============================================== @@ -108,7 +107,7 @@ extern void FDECL(interject, (int)); #ifdef strcasecmp #undef strcasecmp #endif -/* extern int NDECL(getlock); */ +/* extern int getlock(void); */ #endif #ifdef _MSC_VER @@ -223,14 +222,14 @@ extern const char *alllevels, *allbones; #define ABORT C('a') #define getuid() 1 #define getlogin() ((char *) 0) -extern void NDECL(win32_abort); -extern void FDECL(nttty_preference_update, (const char *)); -extern void NDECL(toggle_mouse_support); -extern void FDECL(map_subkeyvalue, (char *)); +extern void win32_abort(void); +extern void nttty_preference_update(const char *); +extern void toggle_mouse_support(void); +extern void map_subkeyvalue(char *); #if defined(WIN32CON) -extern void FDECL(set_altkeyhandler, (const char *)); +extern void set_altkeyhandler(const char *); #endif -extern void NDECL(raw_clear_screen); +extern void raw_clear_screen(void); #include #ifndef __BORLANDC__ @@ -265,19 +264,19 @@ int _RTLENTRY _EXPFUNC read(int __handle, void _FAR *__buf, unsigned __len); #define ALLOCA_HACK /* used in util/panic.c */ #endif -extern int FDECL(set_win32_option, (const char *, const char *)); +extern int set_win32_option(const char *, const char *); #define LEFTBUTTON FROM_LEFT_1ST_BUTTON_PRESSED #define RIGHTBUTTON RIGHTMOST_BUTTON_PRESSED #define MIDBUTTON FROM_LEFT_2ND_BUTTON_PRESSED #define MOUSEMASK (LEFTBUTTON | RIGHTBUTTON | MIDBUTTON) #ifdef CHANGE_COLOR -extern int FDECL(alternative_palette, (char *)); +extern int alternative_palette(char *); #endif #define nethack_enter(argc, argv) nethack_enter_winnt() -extern void FDECL(nethack_exit, (int)) NORETURN; -extern boolean FDECL(file_exists, (const char *)); -extern boolean FDECL(file_newer, (const char *, const char *)); +extern void nethack_exit(int) NORETURN; +extern boolean file_exists(const char *); +extern boolean file_newer(const char *, const char *); #ifndef SYSTEM_H #include "system.h" #endif @@ -287,7 +286,7 @@ extern boolean FDECL(file_newer, (const char *, const char *)); * compatible with compilers which do not support macro stringization (i.e. * #x to turn x into its string form). */ -extern void FDECL(nt_assert_failed, (const char *, const char *, int)); +extern void nt_assert_failed(const char *, const char *, int); #define nhassert(expression) (void)((!!(expression)) || \ (nt_assert_failed(#expression, __FILE__, __LINE__), 0)) diff --git a/include/obj.h b/include/obj.h index 5c969e018..0a434a66c 100644 --- a/include/obj.h +++ b/include/obj.h @@ -417,8 +417,8 @@ struct obj { * for it to include/extern.h. The majority of these are currently * located in mkobj.c for convenience. * - * void FDECL(newXX, (struct obj *)); - * void FDECL(free_XX, (struct obj *)); + * void newXX(struct obj *); + * void free_XX(struct obj *); * * void * newxx(otmp) diff --git a/include/optlist.h b/include/optlist.h index 5bc0e3519..0b9b066b4 100644 --- a/include/optlist.h +++ b/include/optlist.h @@ -12,7 +12,7 @@ * updates that should accompany your change. */ -static int FDECL(optfn_boolean, (int, int, BOOLEAN_P, char *, char *)); +static int optfn_boolean(int, int, boolean, char *, char *); enum OptType {BoolOpt, CompOpt}; enum Y_N {No, Yes}; enum Off_On {Off, On}; @@ -29,7 +29,7 @@ struct allopt_t { enum Y_N dupeok; enum Y_N pfx; boolean opt_in_out, *addr; - int FDECL((*optfn), (int, int, BOOLEAN_P, char *, char *)); + int (*optfn)(int, int, boolean, char *, char *); const char *alias; const char *descr; const char *prefixgw; @@ -45,9 +45,9 @@ struct allopt_t { #if defined(NHOPT_PROTO) #define NHOPTB(a, b, c, s, i, n, v, d, al, bp) #define NHOPTC(a, b, c, s, n, v, d, h, al, z) \ -static int FDECL(optfn_##a, (int, int, BOOLEAN_P, char *, char *)); +static int optfn_##a(int, int, boolean, char *, char *); #define NHOPTP(a, b, c, s, n, v, d, h, al, z) \ -static int FDECL(pfxfn_##a, (int, int, BOOLEAN_P, char *, char *)); +static int pfxfn_##a(int, int, boolean, char *, char *); #elif defined(NHOPT_ENUM) #define NHOPTB(a, b, c, s, i, n, v, d, al, bp) \ diff --git a/include/region.h b/include/region.h index 1303c7099..df558d2fe 100644 --- a/include/region.h +++ b/include/region.h @@ -7,7 +7,7 @@ /* generic callback function */ -typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t)); +typedef boolean (*callback_proc)(genericptr_t, genericptr_t); /* * player_flags diff --git a/include/rm.h b/include/rm.h index 3d303a5c4..22afb34c9 100644 --- a/include/rm.h +++ b/include/rm.h @@ -650,8 +650,8 @@ typedef struct { * includes config.h instead of hack.h so doesn't see extern.h. */ /* ### drawing.c ### */ -extern int FDECL(def_char_to_objclass, (CHAR_P)); -extern int FDECL(def_char_to_monclass, (CHAR_P)); -extern int FDECL(def_char_is_furniture, (CHAR_P)); +extern int def_char_to_objclass(char); +extern int def_char_to_monclass(char); +extern int def_char_is_furniture(char); #endif /* RM_H */ diff --git a/include/system.h b/include/system.h index ead454d69..dd53307de 100644 --- a/include/system.h +++ b/include/system.h @@ -60,7 +60,7 @@ typedef long off_t; #endif #ifndef SIG_RET_TYPE #if defined(NHSTDC) || defined(POSIX_TYPES) || defined(OS2) || defined(__DECC) -#define SIG_RET_TYPE void (*)() +#define SIG_RET_TYPE void (*)(int) #endif #endif #ifndef SIG_RET_TYPE @@ -95,8 +95,8 @@ E int FDECL(srandom, (unsigned int)); E long NDECL(lrand48); E void FDECL(srand48, (long)); #else -E long lrand48(); -E void srand48(); +extern long lrand48(void); +extern void srand48(long); #endif /* MACOSX */ #endif /* BSD || ULTRIX || RANDOM */ @@ -355,7 +355,7 @@ E char *FDECL(memset, (char *, int, int)); E void sleep(); #endif #if defined(ULTRIX) || defined(SYSV) -E unsigned sleep(); +extern unsigned int sleep(unsigned int); #endif #if defined(HPUX) E unsigned int FDECL(sleep, (unsigned int)); @@ -365,7 +365,7 @@ E int FDECL(sleep, (unsigned)); #endif E char *FDECL(getenv, (const char *)); -E char *getlogin(); +extern char *getlogin(void); #if defined(HPUX) && !defined(_POSIX_SOURCE) E long NDECL(getuid); E long NDECL(getgid); @@ -519,7 +519,7 @@ E char *FDECL(tgoto, (const char *, int, int)); #else #if !(defined(HPUX) && defined(_POSIX_SOURCE)) E int FDECL(tgetent, (char *, const char *)); -E void FDECL(tputs, (const char *, int, int (*)())); +extern void tputs(const char *, int, int (*)(int)); #endif E int FDECL(tgetnum, (const char *)); E int FDECL(tgetflag, (const char *)); diff --git a/include/tileset.h b/include/tileset.h index 92f40be9d..517aa0cc0 100644 --- a/include/tileset.h +++ b/include/tileset.h @@ -16,16 +16,16 @@ struct TileImage { unsigned char *indexes; /* for paletted images */ }; -boolean FDECL(read_tiles, (const char *filename, BOOLEAN_P true_color)); -const struct Pixel *NDECL(get_palette); -void FDECL(set_tile_type, (BOOLEAN_P true_color)); -void NDECL(free_tiles); -const struct TileImage *FDECL(get_tile, (unsigned tile_index)); +boolean read_tiles(const char *filename, boolean true_color); +const struct Pixel *get_palette(void); +void set_tile_type(boolean true_color); +void free_tiles(void); +const struct TileImage *get_tile(unsigned tile_index); /* For resizing tiles */ -struct TileImage *FDECL(stretch_tile, (const struct TileImage *, - unsigned, unsigned)); -void FDECL(free_tile, (struct TileImage *)); +struct TileImage *stretch_tile(const struct TileImage *, unsigned, + unsigned); +void free_tile(struct TileImage *); /* Used internally by the tile set code */ struct TileSetImage { @@ -42,11 +42,8 @@ struct TileSetImage { unsigned tile_width, tile_height; }; -boolean FDECL(read_bmp_tiles, (const char *filename, - struct TileSetImage *image)); -boolean FDECL(read_gif_tiles, (const char *filename, - struct TileSetImage *image)); -boolean FDECL(read_png_tiles, (const char *filename, - struct TileSetImage *image)); +boolean read_bmp_tiles(const char *filename, struct TileSetImage *image); +boolean read_gif_tiles(const char *filename, struct TileSetImage *image); +boolean read_png_tiles(const char *filename, struct TileSetImage *image); #endif diff --git a/include/timeout.h b/include/timeout.h index 3853c80d4..a9ef67c0a 100644 --- a/include/timeout.h +++ b/include/timeout.h @@ -6,7 +6,7 @@ #define TIMEOUT_H /* generic timeout function */ -typedef void FDECL((*timeout_proc), (ANY_P *, long)); +typedef void (*timeout_proc)(ANY_P *, long); /* kind of timer */ enum timer_type { diff --git a/include/winX.h b/include/winX.h index 03244d04d..79a11f667 100644 --- a/include/winX.h +++ b/include/winX.h @@ -16,10 +16,6 @@ #include "wintype.h" /* winid */ #endif -#ifndef E -#define E extern -#endif - #if defined(BOS) || defined(NHSTDC) #define DIMENSION_P int #else @@ -258,17 +254,17 @@ struct xwindow { #define MAX_HISTORY 60 /* max history saved on message window */ /* Window variables (winX.c). */ -E struct xwindow window_list[MAX_WINDOWS]; -E XtAppContext app_context; /* context of application */ -E Widget toplevel; /* toplevel widget */ -E Atom wm_delete_window; /* delete window protocol */ -E boolean exit_x_event; /* exit condition for event loop */ +extern struct xwindow window_list[MAX_WINDOWS]; +extern XtAppContext app_context; /* context of application */ +extern Widget toplevel; /* toplevel widget */ +extern Atom wm_delete_window; /* delete window protocol */ +extern boolean exit_x_event; /* exit condition for event loop */ #define EXIT_ON_KEY_PRESS 0 /* valid values for exit_x_event */ #define EXIT_ON_KEY_OR_BUTTON_PRESS 1 #define EXIT_ON_EXIT 2 #define EXIT_ON_SENT_EVENT 3 -E int click_x, click_y, click_button, updated_inventory; -E boolean plsel_ask_name; +extern int click_x, click_y, click_button, updated_inventory; +extern boolean plsel_ask_name; typedef struct { Boolean slow; /* issue prompts between map and message wins */ @@ -294,8 +290,8 @@ typedef struct { #endif } AppResources; -E AppResources appResources; -E void (*input_func)(); +extern AppResources appResources; +extern void (*input_func)(Widget, XEvent *, String *, Cardinal *); extern struct window_procs X11_procs; @@ -308,183 +304,178 @@ extern struct window_procs X11_procs; } while (0) /* ### Window.c ### */ -E Font FDECL(WindowFont, (Widget)); -E XFontStruct *FDECL(WindowFontStruct, (Widget)); +extern Font WindowFont(Widget); +extern XFontStruct *WindowFontStruct(Widget); /* ### dialogs.c ### */ -E Widget FDECL(CreateDialog, (Widget, String, XtCallbackProc, XtCallbackProc)); -E void FDECL(SetDialogPrompt, (Widget, String)); -E String FDECL(GetDialogResponse, (Widget)); -E void FDECL(SetDialogResponse, (Widget, String, unsigned)); -E void FDECL(positionpopup, (Widget, BOOLEAN_P)); +extern Widget CreateDialog(Widget, String, XtCallbackProc, XtCallbackProc); +extern void SetDialogPrompt(Widget, String); +extern String GetDialogResponse(Widget); +extern void SetDialogResponse(Widget, String, unsigned); +extern void positionpopup(Widget, boolean); /* ### winX.c ### */ -E struct xwindow *FDECL(find_widget, (Widget)); -E XColor FDECL(get_nhcolor, (struct xwindow *, int)); -E void FDECL(init_menu_nhcolors, (struct xwindow *)); -E void FDECL(load_boldfont, (struct xwindow *, Widget)); -E Boolean FDECL(nhApproxColor, (Screen *, Colormap, char *, XColor *)); -E Boolean FDECL(nhCvtStringToPixel, (Display *, XrmValuePtr, Cardinal *, - XrmValuePtr, XrmValuePtr, XtPointer *)); -E void FDECL(get_window_frame_extents, (Widget, - long *, long *, long *, long *)); -E void FDECL(get_widget_window_geometry, (Widget, int *, int *, int *, int *)); -E char *FDECL(fontname_boldify, (const char *)); -E Dimension FDECL(nhFontHeight, (Widget)); -E char FDECL(key_event_to_char, (XKeyEvent *)); -E void FDECL(msgkey, (Widget, XtPointer, XEvent *)); -E void FDECL(highlight_yn, (BOOLEAN_P)); -E void FDECL(nh_XtPopup, (Widget, int, Widget)); -E void FDECL(nh_XtPopdown, (Widget)); -E void FDECL(win_X11_init, (int)); -E void FDECL(find_scrollbars, (Widget, Widget *, Widget *)); -E void FDECL(nh_keyscroll, (Widget, XEvent *, String *, Cardinal *)); +extern struct xwindow *find_widget(Widget); +extern XColor get_nhcolor(struct xwindow *, int); +extern void init_menu_nhcolors(struct xwindow *); +extern void load_boldfont(struct xwindow *, Widget); +extern Boolean nhApproxColor(Screen *, Colormap, char *, XColor *); +extern Boolean nhCvtStringToPixel(Display *, XrmValuePtr, Cardinal *, + XrmValuePtr, XrmValuePtr, XtPointer *); +extern void get_window_frame_extents(Widget, long *, long *, long *, long *); +extern void get_widget_window_geometry(Widget, int *, int *, int *, int *); +extern char *fontname_boldify(const char *); +extern Dimension nhFontHeight(Widget); +extern char key_event_to_char(XKeyEvent *); +extern void msgkey(Widget, XtPointer, XEvent *); +extern void highlight_yn(boolean); +extern void nh_XtPopup(Widget, int, Widget); +extern void nh_XtPopdown(Widget); +extern void win_X11_init(int); +extern void find_scrollbars(Widget, Widget *, Widget *); +extern void nh_keyscroll(Widget, XEvent *, String *, Cardinal *); /* ### winmesg.c ### */ -E void FDECL(set_message_slider, (struct xwindow *)); -E void FDECL(create_message_window, (struct xwindow *, BOOLEAN_P, Widget)); -E void FDECL(destroy_message_window, (struct xwindow *)); -E void FDECL(display_message_window, (struct xwindow *)); -E void FDECL(append_message, (struct xwindow *, const char *)); -E void FDECL(set_last_pause, (struct xwindow *)); +extern void set_message_slider(struct xwindow *); +extern void create_message_window(struct xwindow *, boolean, Widget); +extern void destroy_message_window(struct xwindow *); +extern void display_message_window(struct xwindow *); +extern void append_message(struct xwindow *, const char *); +extern void set_last_pause(struct xwindow *); /* ### winmap.c ### */ -E void NDECL(post_process_tiles); -E void FDECL(check_cursor_visibility, (struct xwindow *)); -E void FDECL(display_map_window, (struct xwindow *)); -E void FDECL(clear_map_window, (struct xwindow *)); -E void FDECL(map_input, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(set_map_size, (struct xwindow *, DIMENSION_P, DIMENSION_P)); -E void FDECL(create_map_window, (struct xwindow *, BOOLEAN_P, Widget)); -E void FDECL(destroy_map_window, (struct xwindow *)); -E int FDECL(x_event, (int)); +extern void post_process_tiles(void); +extern void check_cursor_visibility(struct xwindow *); +extern void display_map_window(struct xwindow *); +extern void clear_map_window(struct xwindow *); +extern void map_input(Widget, XEvent *, String *, Cardinal *); +extern void set_map_size(struct xwindow *, Dimension, Dimension); +extern void create_map_window(struct xwindow *, boolean, Widget); +extern void destroy_map_window(struct xwindow *); +extern int x_event(int); /* ### winmenu.c ### */ -E void FDECL(menu_delete, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(menu_key, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(create_menu_window, (struct xwindow *)); -E void FDECL(destroy_menu_window, (struct xwindow *)); +extern void menu_delete(Widget, XEvent *, String *, Cardinal *); +extern void menu_key(Widget, XEvent *, String *, Cardinal *); +extern void create_menu_window(struct xwindow *); +extern void destroy_menu_window(struct xwindow *); /* ### winmisc.c ### */ -E XtPointer FDECL(i2xtp, (int)); -E int FDECL(xtp2i, (XtPointer)); -E void FDECL(ps_key, (Widget, XEvent *, String *, - Cardinal *)); /* player selection action */ -E void FDECL(race_key, (Widget, XEvent *, String *, - Cardinal *)); /* race selection action */ -E void FDECL(gend_key, (Widget, XEvent *, String *, Cardinal *)); /* gender */ -E void FDECL(algn_key, - (Widget, XEvent *, String *, Cardinal *)); /* alignment */ -E void FDECL(ec_delete, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(ec_key, (Widget, XEvent *, String *, - Cardinal *)); /* extended command action */ -E void FDECL(plsel_quit, (Widget, XEvent *, String *, - Cardinal *)); /* player selection dialog */ -E void FDECL(plsel_play, (Widget, XEvent *, String *, - Cardinal *)); /* player selection dialog */ -E void FDECL(plsel_randomize, (Widget, XEvent *, String *, - Cardinal *)); /* player selection dialog */ -E void NDECL(release_extended_cmds); +extern XtPointer i2xtp(int); +extern int xtp2i(XtPointer); +extern void ps_key(Widget, XEvent *, String *, + Cardinal *); /* player selection action */ +extern void race_key(Widget, XEvent *, String *, + Cardinal *); /* race selection action */ +extern void gend_key(Widget, XEvent *, String *, Cardinal *); /* gender */ +extern void algn_key(Widget, XEvent *, String *, Cardinal *); /* alignment */ +extern void ec_delete(Widget, XEvent *, String *, Cardinal *); +extern void ec_key(Widget, XEvent *, String *, + Cardinal *); /* extended command action */ +extern void plsel_quit(Widget, XEvent *, String *, + Cardinal *); /* player selection dialog */ +extern void plsel_play(Widget, XEvent *, String *, + Cardinal *); /* player selection dialog */ +extern void plsel_randomize(Widget, XEvent *, String *, + Cardinal *); /* player selection dialog */ +extern void release_extended_cmds(void); /* ### winstatus.c ### */ -E void FDECL(create_status_window, (struct xwindow *, BOOLEAN_P, Widget)); -E void FDECL(destroy_status_window, (struct xwindow *)); -E void FDECL(adjust_status, (struct xwindow *, const char *)); -E void NDECL(null_out_status); -E void NDECL(check_turn_events); +extern void create_status_window(struct xwindow *, boolean, Widget); +extern void destroy_status_window(struct xwindow *); +extern void adjust_status(struct xwindow *, const char *); +extern void null_out_status(void); +extern void check_turn_events(void); /* ### wintext.c ### */ -E void FDECL(delete_text, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(dismiss_text, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(key_dismiss_text, (Widget, XEvent *, String *, Cardinal *)); +extern void delete_text(Widget, XEvent *, String *, Cardinal *); +extern void dismiss_text(Widget, XEvent *, String *, Cardinal *); +extern void key_dismiss_text(Widget, XEvent *, String *, Cardinal *); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(rip_dismiss_text, (Widget, XEvent *, String *, Cardinal *)); +extern void rip_dismiss_text(Widget, XEvent *, String *, Cardinal *); #endif -E void FDECL(add_to_text_window, (struct xwindow *, int, const char *)); -E void FDECL(display_text_window, (struct xwindow *, BOOLEAN_P)); -E void FDECL(create_text_window, (struct xwindow *)); -E void FDECL(destroy_text_window, (struct xwindow *)); -E void FDECL(clear_text_window, (struct xwindow *)); -E void FDECL(append_text_buffer, (struct text_buffer *, const char *, - BOOLEAN_P)); /* text buffer routines */ -E void FDECL(init_text_buffer, (struct text_buffer *)); -E void FDECL(clear_text_buffer, (struct text_buffer *)); -E void FDECL(free_text_buffer, (struct text_buffer *)); +extern void add_to_text_window(struct xwindow *, int, const char *); +extern void display_text_window(struct xwindow *, boolean); +extern void create_text_window(struct xwindow *); +extern void destroy_text_window(struct xwindow *); +extern void clear_text_window(struct xwindow *); +extern void append_text_buffer(struct text_buffer *, const char *, + boolean); /* text buffer routines */ +extern void init_text_buffer(struct text_buffer *); +extern void clear_text_buffer(struct text_buffer *); +extern void free_text_buffer(struct text_buffer *); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(calculate_rip_text, (int, time_t)); +extern void calculate_rip_text(int, time_t); #endif /* ### winval.c ### */ -E Widget FDECL(create_value, (Widget, const char *)); -E void FDECL(set_name, (Widget, const char *)); -E void FDECL(set_name_width, (Widget, int)); -E int FDECL(get_name_width, (Widget)); -E Widget FDECL(get_value_widget, (Widget)); -E void FDECL(set_value, (Widget, const char *)); -E void FDECL(set_value_width, (Widget, int)); -E int FDECL(get_value_width, (Widget)); -E void FDECL(hilight_value, (Widget)); -E void FDECL(swap_fg_bg, (Widget)); - +extern Widget create_value(Widget, const char *); +extern void set_name(Widget, const char *); +extern void set_name_width(Widget, int); +extern int get_name_width(Widget); +extern Widget get_value_widget(Widget); +extern void set_value_width(Widget, int); +extern int get_value_width(Widget); +extern void hilight_value(Widget); +extern void swap_fg_bg(Widget); +extern void set_value(Widget w, const char *new_value); /* external declarations */ -E char *FDECL(X11_getmsghistory, (BOOLEAN_P)); -E void FDECL(X11_putmsghistory, (const char *, BOOLEAN_P)); -E void FDECL(X11_init_nhwindows, (int *, char **)); -E void NDECL(X11_player_selection); -E void NDECL(X11_askname); -E void NDECL(X11_get_nh_event); -E void FDECL(X11_exit_nhwindows, (const char *)); -E void FDECL(X11_suspend_nhwindows, (const char *)); -E void NDECL(X11_resume_nhwindows); -E winid FDECL(X11_create_nhwindow, (int)); -E void FDECL(X11_clear_nhwindow, (winid)); -E void FDECL(X11_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(X11_destroy_nhwindow, (winid)); -E void FDECL(X11_curs, (winid, int, int)); -E void FDECL(X11_putstr, (winid, int, const char *)); -E void FDECL(X11_display_file, (const char *, BOOLEAN_P)); -E void FDECL(X11_start_menu, (winid, unsigned long)); -E void FDECL(X11_add_menu, (winid, const glyph_info *, const ANY_P *, - CHAR_P, CHAR_P, int, - const char *, unsigned int)); -E void FDECL(X11_end_menu, (winid, const char *)); -E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **)); -E void NDECL(X11_update_inventory); -E void NDECL(X11_mark_synch); -E void NDECL(X11_wait_synch); +extern char *X11_getmsghistory(boolean); +extern void X11_putmsghistory(const char *, boolean); +extern void X11_init_nhwindows(int *, char **); +extern void X11_player_selection(void); +extern void X11_askname(void); +extern void X11_get_nh_event(void); +extern void X11_exit_nhwindows(const char *); +extern void X11_suspend_nhwindows(const char *); +extern void X11_resume_nhwindows(void); +extern winid X11_create_nhwindow(int); +extern void X11_clear_nhwindow(winid); +extern void X11_display_nhwindow(winid, boolean); +extern void X11_destroy_nhwindow(winid); +extern void X11_curs(winid, int, int); +extern void X11_putstr(winid, int, const char *); +extern void X11_display_file(const char *, boolean); +extern void X11_start_menu(winid, unsigned long); +extern void X11_add_menu(winid, const glyph_info *, const ANY_P *, char, + char, int, const char *, unsigned int); +extern void X11_end_menu(winid, const char *); +extern int X11_select_menu(winid, int, MENU_ITEM_P **); +extern void X11_update_inventory(void); +extern void X11_mark_synch(void); +extern void X11_wait_synch(void); #ifdef CLIPPING -E void FDECL(X11_cliparound, (int, int)); +extern void X11_cliparound(int, int); #endif -E void FDECL(X11_print_glyph, (winid, XCHAR_P, XCHAR_P, - const glyph_info *, const glyph_info *)); -E void FDECL(X11_raw_print, (const char *)); -E void FDECL(X11_raw_print_bold, (const char *)); -E int NDECL(X11_nhgetch); -E int FDECL(X11_nh_poskey, (int *, int *, int *)); -E void NDECL(X11_nhbell); -E int NDECL(X11_doprev_message); -E char FDECL(X11_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(X11_getlin, (const char *, char *)); -E int NDECL(X11_get_ext_cmd); -E void FDECL(X11_number_pad, (int)); -E void NDECL(X11_delay_output); -E void NDECL(X11_status_init); -E void NDECL(X11_status_finish); -E void FDECL(X11_status_enablefield, (int, const char *, const char *, - BOOLEAN_P)); -E void FDECL(X11_status_update, (int, genericptr_t, int, int, int, - unsigned long *)); +extern void X11_print_glyph(winid, xchar, xchar, const glyph_info *, + const glyph_info *); +extern void X11_raw_print(const char *); +extern void X11_raw_print_bold(const char *); +extern int X11_nhgetch(void); +extern int X11_nh_poskey(int *, int *, int *); +extern void X11_nhbell(void); +extern int X11_doprev_message(void); +extern char X11_yn_function(const char *, const char *, char); +extern void X11_getlin(const char *, char *); +extern int X11_get_ext_cmd(void); +extern void X11_number_pad(int); +extern void X11_delay_output(void); +extern void X11_status_init(void); +extern void X11_status_finish(void); +extern void X11_status_enablefield(int, const char *, const char *, boolean); +extern void X11_status_update(int, genericptr_t, int, int, int, + unsigned long *); /* other defs that really should go away (they're tty specific) */ -E void NDECL(X11_start_screen); -E void NDECL(X11_end_screen); +extern void X11_start_screen(void); +extern void X11_end_screen(void); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(X11_outrip, (winid, int, time_t)); +extern void X11_outrip(winid, int, time_t); #else -E void FDECL(genl_outrip, (winid, int, time_t)); +extern void genl_outrip(winid, int, time_t); #endif -E void FDECL(X11_preference_update, (const char *)); +extern void X11_preference_update(const char *); #endif /* WINX_H */ diff --git a/include/wincurs.h b/include/wincurs.h index bbdb5caa8..6820c969e 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -74,15 +74,15 @@ extern void curses_suspend_nhwindows(const char *str); extern void curses_resume_nhwindows(void); extern winid curses_create_nhwindow(int type); extern void curses_clear_nhwindow(winid wid); -extern void curses_display_nhwindow(winid wid, BOOLEAN_P block); +extern void curses_display_nhwindow(winid wid, boolean block); extern void curses_destroy_nhwindow(winid wid); extern void curses_curs(winid wid, int x, int y); extern void curses_putstr(winid wid, int attr, const char *text); -extern void curses_display_file(const char *filename, BOOLEAN_P must_exist); +extern void curses_display_file(const char *filename, boolean must_exist); extern void curses_start_menu(winid wid, unsigned long); extern void curses_add_menu(winid wid, const glyph_info *, const ANY_P * identifier, - CHAR_P accelerator, CHAR_P group_accel, int attr, + char accelerator, char group_accel, int attr, const char *str, unsigned int itemflags); extern void curses_end_menu(winid wid, const char *prompt); extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); @@ -90,7 +90,7 @@ extern void curses_update_inventory(void); extern void curses_mark_synch(void); extern void curses_wait_synch(void); extern void curses_cliparound(int x, int y); -extern void curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, +extern void curses_print_glyph(winid wid, xchar x, xchar y, const glyph_info *, const glyph_info *); extern void curses_raw_print(const char *str); extern void curses_raw_print_bold(const char *str); @@ -99,7 +99,7 @@ extern int curses_nh_poskey(int *x, int *y, int *mod); extern void curses_nhbell(void); extern int curses_doprev_message(void); extern char curses_yn_function(const char *question, const char *choices, - CHAR_P def); + char def); extern void curses_getlin(const char *question, char *input); extern int curses_get_ext_cmd(void); extern void curses_number_pad(int state); @@ -172,12 +172,12 @@ extern void curses_mouse_support(int); extern void curses_line_input_dialog(const char *prompt, char *answer, int buffer); extern int curses_character_input_dialog(const char *prompt, - const char *choices, CHAR_P def); + const char *choices, char def); extern int curses_ext_cmd(void); extern void curses_create_nhmenu(winid wid, unsigned long); extern void curses_add_nhmenu_item(winid wid, const glyph_info *, - const ANY_P *identifier, CHAR_P accelerator, - CHAR_P group_accel, int attr, + const ANY_P *identifier, char accelerator, + char group_accel, int attr, const char *str, unsigned itemflags); extern void curs_menu_set_bottom_heavy(winid); extern void curses_finalize_nhmenu(winid wid, const char *prompt); @@ -196,7 +196,7 @@ extern void curses_status_update(int, genericptr_t, int, int, int, extern void curses_update_inv(void); extern void curses_add_inv(int, const glyph_info *, - CHAR_P, attr_t, const char *); + char, attr_t, const char *); /* cursinit.c */ @@ -222,8 +222,8 @@ extern void curses_init_mesg_history(void); extern void curses_teardown_messages(void); extern void curses_prev_mesg(void); extern void curses_count_window(const char *count_text); -char *curses_getmsghistory(BOOLEAN_P); -void curses_putmsghistory(const char *, BOOLEAN_P); +char *curses_getmsghistory(boolean); +void curses_putmsghistory(const char *, boolean); #endif /* WINCURS_H */ diff --git a/include/wingem.h b/include/wingem.h index fbc30bd16..86b3f6ba3 100644 --- a/include/wingem.h +++ b/include/wingem.h @@ -5,8 +5,6 @@ #ifndef WINGEM_H #define WINGEM_H -#define E extern - /* menu structure */ typedef struct Gmi { struct Gmi *Gmi_next; @@ -25,90 +23,89 @@ extern struct window_procs Gem_procs; /* ### wingem1.c ### */ #ifdef CLIPPING -E void NDECL(setclipped); +extern void setclipped(void); #endif -E void FDECL(docorner, (int, int)); -E void NDECL(end_glyphout); -E void FDECL(g_putch, (int)); -E void FDECL(win_Gem_init, (int)); -E int NDECL(mar_gem_init); -E char NDECL(mar_ask_class); -E char *NDECL(mar_ask_name); -E int FDECL(mar_create_window, (int)); -E void FDECL(mar_destroy_nhwindow, (int)); -E void FDECL(mar_print_glyph, (int, int, int, const glyph_info *, const glyph_info *)); -E void FDECL(mar_print_line, (int, int, int, char *)); -E void FDECL(mar_set_message, (char *, char *, char *)); -E Gem_menu_item *NDECL(mar_hol_inv); -E void FDECL(mar_set_menu_type, (int)); -E void NDECL(mar_reverse_menu); -E void FDECL(mar_set_menu_title, (const char *)); -E void NDECL(mar_set_accelerators); -E void FDECL(mar_add_menu, (winid, Gem_menu_item *)); -E void FDECL(mar_change_menu_2_text, (winid)); -E void FDECL(mar_add_message, (const char *)); -E void NDECL(mar_status_dirty); -E int FDECL(mar_hol_win_type, (int)); -E void NDECL(mar_clear_messagewin); -E void FDECL(mar_set_no_glyph, (int)); -E void NDECL(mar_map_curs_weiter); +extern void docorner(int, int); +extern void end_glyphout(void); +extern void g_putch(int); +extern void win_Gem_init(int); +extern int mar_gem_init(void); +extern char mar_ask_class(void); +extern char *mar_ask_name(void); +extern int mar_create_window(int); +extern void mar_destroy_nhwindow(int); +extern void mar_print_glyph(int, int, int, const glyph_info *, + const glyph_info *); +extern void mar_print_line(int, int, int, char *); +extern void mar_set_message(char *, char *, char *); +extern Gem_menu_item *mar_hol_inv(void); +extern void mar_set_menu_type(int); +extern void mar_reverse_menu(void); +extern void mar_set_menu_title(const char *); +extern void mar_set_accelerators(void); +extern void mar_add_menu(winid, Gem_menu_item *); +extern void mar_change_menu_2_text(winid); +extern void mar_add_message(const char *); +extern void mar_status_dirty(void); +extern int mar_hol_win_type(int); +extern void mar_clear_messagewin(void); +extern void mar_set_no_glyph(int); +extern void mar_map_curs_weiter(void); /* external declarations */ -E void FDECL(Gem_init_nhwindows, (int *, char **)); -E void NDECL(Gem_player_selection); -E void NDECL(Gem_askname); -E void NDECL(Gem_get_nh_event); -E void FDECL(Gem_exit_nhwindows, (const char *)); -E void FDECL(Gem_suspend_nhwindows, (const char *)); -E void NDECL(Gem_resume_nhwindows); -E winid FDECL(Gem_create_nhwindow, (int)); -E void FDECL(Gem_clear_nhwindow, (winid)); -E void FDECL(Gem_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(Gem_dismiss_nhwindow, (winid)); -E void FDECL(Gem_destroy_nhwindow, (winid)); -E void FDECL(Gem_curs, (winid, int, int)); -E void FDECL(Gem_putstr, (winid, int, const char *)); -E void FDECL(Gem_display_file, (const char *, BOOLEAN_P)); -E void FDECL(Gem_start_menu, (winid, unsigned long)); -E void FDECL(Gem_add_menu, (winid, const glyph_info *, - const ANY_P *, CHAR_P, CHAR_P, int, - const char *, unsigned int)); -E void FDECL(Gem_end_menu, (winid, const char *)); -E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **)); -E char FDECL(Gem_message_menu, (CHAR_P, int, const char *)); -E void NDECL(Gem_update_inventory); -E void NDECL(Gem_mark_synch); -E void NDECL(Gem_wait_synch); +extern void Gem_init_nhwindows(int *, char **); +extern void Gem_player_selection(void); +extern void Gem_askname(void); +extern void Gem_get_nh_event(void); +extern void Gem_exit_nhwindows(const char *); +extern void Gem_suspend_nhwindows(const char *); +extern void Gem_resume_nhwindows(void); +extern winid Gem_create_nhwindow(int); +extern void Gem_clear_nhwindow(winid); +extern void Gem_display_nhwindow(winid, boolean); +extern void Gem_dismiss_nhwindow(winid); +extern void Gem_destroy_nhwindow(winid); +extern void Gem_curs(winid, int, int); +extern void Gem_putstr(winid, int, const char *); +extern void Gem_display_file(const char *, boolean); +extern void Gem_start_menu(winid, unsigned long); +extern void Gem_add_menu(winid, const glyph_info *, const ANY_P *, char, char, + int, const char *, unsigned int); +extern void Gem_end_menu(winid, const char *); +extern int Gem_select_menu(winid, int, MENU_ITEM_P **); +extern char Gem_message_menu(char, int, const char *); +extern void Gem_update_inventory(void); +extern void Gem_mark_synch(void); +extern void Gem_wait_synch(void); #ifdef CLIPPING -E void FDECL(Gem_cliparound, (int, int)); +extern void Gem_cliparound(int, int); #endif #ifdef POSITIONBAR -E void FDECL(Gem_update_positionbar, (char *)); +extern void Gem_update_positionbar(char *); #endif -E void FDECL(Gem_print_glyph, (winid, XCHAR_P, XCHAR_P, - const glyph_info *, const glyph_info *)); -E void FDECL(Gem_raw_print, (const char *)); -E void FDECL(Gem_raw_print_bold, (const char *)); -E int NDECL(Gem_nhgetch); -E int FDECL(Gem_nh_poskey, (int *, int *, int *)); -E void NDECL(Gem_nhbell); -E int NDECL(Gem_doprev_message); -E char FDECL(Gem_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(Gem_getlin, (const char *, char *)); -E int NDECL(Gem_get_ext_cmd); -E void FDECL(Gem_number_pad, (int)); -E void NDECL(Gem_delay_output); +extern void Gem_print_glyph(winid, xchar, xchar, const glyph_info *, + const glyph_info *); +extern void Gem_raw_print(const char *); +extern void Gem_raw_print_bold(const char *); +extern int Gem_nhgetch(void); +extern int Gem_nh_poskey(int *, int *, int *); +extern void Gem_nhbell(void); +extern int Gem_doprev_message(void); +extern char Gem_yn_function(const char *, const char *, char); +extern void Gem_getlin(const char *, char *); +extern int Gem_get_ext_cmd(void); +extern void Gem_number_pad(int); +extern void Gem_delay_output(void); #ifdef CHANGE_COLOR -E void FDECL(Gem_change_color, (int color, long rgb, int reverse)); -E char *NDECL(Gem_get_color_string); +extern void Gem_change_color(int color, long rgb, int reverse); +extern char *Gem_get_color_string(void); #endif /* other defs that really should go away (they're tty specific) */ -E void NDECL(Gem_start_screen); -E void NDECL(Gem_end_screen); +extern void Gem_start_screen(void); +extern void Gem_end_screen(void); -E void FDECL(genl_outrip, (winid, int, time_t)); +extern void genl_outrip(winid, int, time_t); -#undef E #endif /* WINGEM_H */ diff --git a/include/winprocs.h b/include/winprocs.h index e304b8a1c..ca0b0387a 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -15,74 +15,74 @@ struct window_procs { unsigned long wincap; /* window port capability options supported */ unsigned long wincap2; /* additional window port capability options */ boolean has_color[CLR_MAX]; - void FDECL((*win_init_nhwindows), (int *, char **)); - void NDECL((*win_player_selection)); - void NDECL((*win_askname)); - void NDECL((*win_get_nh_event)); - void FDECL((*win_exit_nhwindows), (const char *)); - void FDECL((*win_suspend_nhwindows), (const char *)); - void NDECL((*win_resume_nhwindows)); - winid FDECL((*win_create_nhwindow), (int)); - void FDECL((*win_clear_nhwindow), (winid)); - void FDECL((*win_display_nhwindow), (winid, BOOLEAN_P)); - void FDECL((*win_destroy_nhwindow), (winid)); - void FDECL((*win_curs), (winid, int, int)); - void FDECL((*win_putstr), (winid, int, const char *)); - void FDECL((*win_putmixed), (winid, int, const char *)); - void FDECL((*win_display_file), (const char *, BOOLEAN_P)); - void FDECL((*win_start_menu), (winid, unsigned long)); - void FDECL((*win_add_menu), (winid, const glyph_info *, const ANY_P *, - CHAR_P, CHAR_P, int, - const char *, unsigned int)); - void FDECL((*win_end_menu), (winid, const char *)); - int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **)); - char FDECL((*win_message_menu), (CHAR_P, int, const char *)); - void NDECL((*win_update_inventory)); - void NDECL((*win_mark_synch)); - void NDECL((*win_wait_synch)); + void (*win_init_nhwindows)(int *, char **); + void (*win_player_selection)(void); + void (*win_askname)(void); + void (*win_get_nh_event)(void); + void (*win_exit_nhwindows)(const char *); + void (*win_suspend_nhwindows)(const char *); + void (*win_resume_nhwindows)(void); + winid (*win_create_nhwindow)(int); + void (*win_clear_nhwindow)(winid); + void (*win_display_nhwindow)(winid, boolean); + void (*win_destroy_nhwindow)(winid); + void (*win_curs)(winid, int, int); + void (*win_putstr)(winid, int, const char *); + void (*win_putmixed)(winid, int, const char *); + void (*win_display_file)(const char *, boolean); + void (*win_start_menu)(winid, unsigned long); + void (*win_add_menu)(winid, const glyph_info *, const ANY_P *, + char, char, int, + const char *, unsigned int); + void (*win_end_menu)(winid, const char *); + int (*win_select_menu)(winid, int, MENU_ITEM_P **); + char (*win_message_menu)(char, int, const char *); + void (*win_update_inventory)(void); + void (*win_mark_synch)(void); + void (*win_wait_synch)(void); #ifdef CLIPPING - void FDECL((*win_cliparound), (int, int)); + void (*win_cliparound)(int, int); #endif #ifdef POSITIONBAR - void FDECL((*win_update_positionbar), (char *)); + void (*win_update_positionbar)(char *); #endif - void FDECL((*win_print_glyph), (winid, XCHAR_P, XCHAR_P, - const glyph_info *, const glyph_info *)); - void FDECL((*win_raw_print), (const char *)); - void FDECL((*win_raw_print_bold), (const char *)); - int NDECL((*win_nhgetch)); - int FDECL((*win_nh_poskey), (int *, int *, int *)); - void NDECL((*win_nhbell)); - int NDECL((*win_doprev_message)); - char FDECL((*win_yn_function), (const char *, const char *, CHAR_P)); - void FDECL((*win_getlin), (const char *, char *)); - int NDECL((*win_get_ext_cmd)); - void FDECL((*win_number_pad), (int)); - void NDECL((*win_delay_output)); + void (*win_print_glyph)(winid, xchar, xchar, + const glyph_info *, const glyph_info *); + void (*win_raw_print)(const char *); + void (*win_raw_print_bold)(const char *); + int (*win_nhgetch)(void); + int (*win_nh_poskey)(int *, int *, int *); + void (*win_nhbell)(void); + int (*win_doprev_message)(void); + char (*win_yn_function)(const char *, const char *, char); + void (*win_getlin)(const char *, char *); + int (*win_get_ext_cmd)(void); + void (*win_number_pad)(int); + void (*win_delay_output)(void); #ifdef CHANGE_COLOR - void FDECL((*win_change_color), (int, long, int)); + void (*win_change_color)(int, long, int); #ifdef MAC - void FDECL((*win_change_background), (int)); - short FDECL((*win_set_font_name), (winid, char *)); + void (*win_change_background)(int); + short (*win_set_font_name)(winid, char *); #endif - char *NDECL((*win_get_color_string)); + char *(*win_get_color_string)(void); #endif /* other defs that really should go away (they're tty specific) */ - void NDECL((*win_start_screen)); - void NDECL((*win_end_screen)); + void (*win_start_screen)(void); + void (*win_end_screen)(void); - void FDECL((*win_outrip), (winid, int, time_t)); - void FDECL((*win_preference_update), (const char *)); - char *FDECL((*win_getmsghistory), (BOOLEAN_P)); - void FDECL((*win_putmsghistory), (const char *, BOOLEAN_P)); - void NDECL((*win_status_init)); - void NDECL((*win_status_finish)); - void FDECL((*win_status_enablefield), - (int, const char *, const char *, BOOLEAN_P)); - void FDECL((*win_status_update), (int, genericptr_t, int, int, int, - unsigned long *)); - boolean NDECL((*win_can_suspend)); + void (*win_outrip)(winid, int, time_t); + void (*win_preference_update)(const char *); + char *(*win_getmsghistory)(boolean); + void (*win_putmsghistory)(const char *, boolean); + void (*win_status_init)(void); + void (*win_status_finish)(void); + void (*win_status_enablefield)(int, const char *, const char *, + boolean); + void (*win_status_update)(int, genericptr_t, int, int, int, + unsigned long *); + boolean (*win_can_suspend)(void); }; extern @@ -317,76 +317,76 @@ struct chain_procs { * '+' are reserved for processors. */ unsigned long wincap; /* window port capability options supported */ unsigned long wincap2; /* additional window port capability options */ - void FDECL((*win_init_nhwindows), (CARGS, int *, char **)); - void FDECL((*win_player_selection), (CARGS)); - void FDECL((*win_askname), (CARGS)); - void FDECL((*win_get_nh_event), (CARGS)); - void FDECL((*win_exit_nhwindows), (CARGS, const char *)); - void FDECL((*win_suspend_nhwindows), (CARGS, const char *)); - void FDECL((*win_resume_nhwindows), (CARGS)); - winid FDECL((*win_create_nhwindow), (CARGS, int)); - void FDECL((*win_clear_nhwindow), (CARGS, winid)); - void FDECL((*win_display_nhwindow), (CARGS, winid, BOOLEAN_P)); - void FDECL((*win_destroy_nhwindow), (CARGS, winid)); - void FDECL((*win_curs), (CARGS, winid, int, int)); - void FDECL((*win_putstr), (CARGS, winid, int, const char *)); - void FDECL((*win_putmixed), (CARGS, winid, int, const char *)); - void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P)); - void FDECL((*win_start_menu), (CARGS, winid, unsigned long)); - void FDECL((*win_add_menu), (CARGS, winid, const glyph_info *, - const ANY_P *, CHAR_P, CHAR_P, int, - const char *, unsigned int)); - void FDECL((*win_end_menu), (CARGS, winid, const char *)); - int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **)); - char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *)); - void FDECL((*win_update_inventory), (CARGS)); - void FDECL((*win_mark_synch), (CARGS)); - void FDECL((*win_wait_synch), (CARGS)); + void (*win_init_nhwindows)(CARGS, int *, char **); + void (*win_player_selection)(CARGS); + void (*win_askname)(CARGS); + void (*win_get_nh_event)(CARGS); + void (*win_exit_nhwindows)(CARGS, const char *); + void (*win_suspend_nhwindows)(CARGS, const char *); + void (*win_resume_nhwindows)(CARGS); + winid (*win_create_nhwindow)(CARGS, int); + void (*win_clear_nhwindow)(CARGS, winid); + void (*win_display_nhwindow)(CARGS, winid, boolean); + void (*win_destroy_nhwindow)(CARGS, winid); + void (*win_curs)(CARGS, winid, int, int); + void (*win_putstr)(CARGS, winid, int, const char *); + void (*win_putmixed)(CARGS, winid, int, const char *); + void (*win_display_file)(CARGS, const char *, boolean); + void (*win_start_menu)(CARGS, winid, unsigned long); + void (*win_add_menu)(CARGS, winid, const glyph_info *, + const ANY_P *, char, char, int, + const char *, unsigned int); + void (*win_end_menu)(CARGS, winid, const char *); + int (*win_select_menu)(CARGS, winid, int, MENU_ITEM_P **); + char (*win_message_menu)(CARGS, char, int, const char *); + void (*win_update_inventory)(CARGS); + void (*win_mark_synch)(CARGS); + void (*win_wait_synch)(CARGS); #ifdef CLIPPING - void FDECL((*win_cliparound), (CARGS, int, int)); + void (*win_cliparound)(CARGS, int, int); #endif #ifdef POSITIONBAR - void FDECL((*win_update_positionbar), (CARGS, char *)); + void (*win_update_positionbar)(CARGS, char *); #endif - void FDECL((*win_print_glyph), (CARGS, winid, XCHAR_P, XCHAR_P, - const glyph_info *, - const glyph_info *)); - void FDECL((*win_raw_print), (CARGS, const char *)); - void FDECL((*win_raw_print_bold), (CARGS, const char *)); - int FDECL((*win_nhgetch), (CARGS)); - int FDECL((*win_nh_poskey), (CARGS, int *, int *, int *)); - void FDECL((*win_nhbell), (CARGS)); - int FDECL((*win_doprev_message), (CARGS)); - char FDECL((*win_yn_function), - (CARGS, const char *, const char *, CHAR_P)); - void FDECL((*win_getlin), (CARGS, const char *, char *)); - int FDECL((*win_get_ext_cmd), (CARGS)); - void FDECL((*win_number_pad), (CARGS, int)); - void FDECL((*win_delay_output), (CARGS)); + void (*win_print_glyph)(CARGS, winid, xchar, xchar, + const glyph_info *, + const glyph_info *); + void (*win_raw_print)(CARGS, const char *); + void (*win_raw_print_bold)(CARGS, const char *); + int (*win_nhgetch)(CARGS); + int (*win_nh_poskey)(CARGS, int *, int *, int *); + void (*win_nhbell)(CARGS); + int (*win_doprev_message)(CARGS); + char (*win_yn_function), + (CARGS, const char *, const char *, char); + void (*win_getlin)(CARGS, const char *, char *); + int (*win_get_ext_cmd)(CARGS); + void (*win_number_pad)(CARGS, int); + void (*win_delay_output)(CARGS); #ifdef CHANGE_COLOR - void FDECL((*win_change_color), (CARGS, int, long, int)); + void (*win_change_color)(CARGS, int, long, int); #ifdef MAC - void FDECL((*win_change_background), (CARGS, int)); - short FDECL((*win_set_font_name), (CARGS, winid, char *)); + void (*win_change_background)(CARGS, int); + short (*win_set_font_name)(CARGS, winid, char *); #endif - char *FDECL((*win_get_color_string), (CARGS)); + char *(*win_get_color_string)(CARGS); #endif /* other defs that really should go away (they're tty specific) */ - void FDECL((*win_start_screen), (CARGS)); - void FDECL((*win_end_screen), (CARGS)); + void (*win_start_screen)(CARGS); + void (*win_end_screen)(CARGS); - void FDECL((*win_outrip), (CARGS, winid, int, time_t)); - void FDECL((*win_preference_update), (CARGS, const char *)); - char *FDECL((*win_getmsghistory), (CARGS, BOOLEAN_P)); - void FDECL((*win_putmsghistory), (CARGS, const char *, BOOLEAN_P)); - void FDECL((*win_status_init), (CARGS)); - void FDECL((*win_status_finish), (CARGS)); - void FDECL((*win_status_enablefield), - (CARGS, int, const char *, const char *, BOOLEAN_P)); - void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, - unsigned long *)); - boolean FDECL((*win_can_suspend), (CARGS)); + void (*win_outrip)(CARGS, winid, int, time_t); + void (*win_preference_update)(CARGS, const char *); + char *(*win_getmsghistory)(CARGS, boolean); + void (*win_putmsghistory)(CARGS, const char *, boolean); + void (*win_status_init)(CARGS); + void (*win_status_finish)(CARGS); + void (*win_status_enablefield), + (CARGS, int, const char *, const char *, boolean); + void (*win_status_update)(CARGS, int, genericptr_t, int, int, int, + unsigned long *); + boolean (*win_can_suspend)(CARGS); }; #endif /* WINCHAIN */ @@ -394,76 +394,76 @@ struct chain_procs { /* * window port routines available in sys/share/safeproc.c */ -extern struct window_procs *FDECL(get_safe_procs, (int)); -extern void FDECL(safe_init_nhwindows, (int *, char **)); -extern void NDECL(safe_player_selection); -extern void NDECL(safe_askname); -extern void NDECL(safe_get_nh_event); -extern void FDECL(safe_exit_nhwindows, (const char *)); -extern void FDECL(safe_suspend_nhwindows, (const char *)); -extern void NDECL(safe_resume_nhwindows); -extern winid FDECL(safe_create_nhwindow, (int)); -extern void FDECL(safe_clear_nhwindow, (winid)); -extern void FDECL(safe_display_nhwindow, (winid, BOOLEAN_P)); -extern void FDECL(safe_destroy_nhwindow, (winid)); -extern void FDECL(safe_curs, (winid, int, int)); -extern void FDECL(safe_putstr, (winid, int, const char *)); -extern void FDECL(safe_putmixed, (winid, int, const char *)); -extern void FDECL(safe_display_file, (const char *, BOOLEAN_P)); -extern void FDECL(safe_start_menu, (winid, unsigned long)); -extern void FDECL(safe_add_menu, (winid, const glyph_info *, const ANY_P *, - CHAR_P, CHAR_P, int, const char *, - unsigned int)); -extern void FDECL(safe_end_menu, (winid, const char *)); -extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **)); -extern char FDECL(safe_message_menu, (CHAR_P, int, const char *)); -extern void NDECL(safe_update_inventory); -extern void NDECL(safe_mark_synch); -extern void NDECL(safe_wait_synch); +extern struct window_procs *get_safe_procs(int); +extern void safe_init_nhwindows(int *, char **); +extern void safe_player_selection(void); +extern void safe_askname(void); +extern void safe_get_nh_event(void); +extern void safe_exit_nhwindows(const char *); +extern void safe_suspend_nhwindows(const char *); +extern void safe_resume_nhwindows(void); +extern winid safe_create_nhwindow(int); +extern void safe_clear_nhwindow(winid); +extern void safe_display_nhwindow(winid, boolean); +extern void safe_destroy_nhwindow(winid); +extern void safe_curs(winid, int, int); +extern void safe_putstr(winid, int, const char *); +extern void safe_putmixed(winid, int, const char *); +extern void safe_display_file(const char *, boolean); +extern void safe_start_menu(winid, unsigned long); +extern void safe_add_menu(winid, const glyph_info *, const ANY_P *, + char, char, int, const char *, + unsigned int); +extern void safe_end_menu(winid, const char *); +extern int safe_select_menu(winid, int, MENU_ITEM_P **); +extern char safe_message_menu(char, int, const char *); +extern void safe_update_inventory(void); +extern void safe_mark_synch(void); +extern void safe_wait_synch(void); #ifdef CLIPPING -extern void FDECL(safe_cliparound, (int, int)); +extern void safe_cliparound(int, int); #endif #ifdef POSITIONBAR -extern void FDECL(safe_update_positionbar, (char *)); +extern void safe_update_positionbar(char *); #endif -extern void FDECL(safe_print_glyph, (winid, XCHAR_P, XCHAR_P, - const glyph_info *, const glyph_info *)); -extern void FDECL(safe_raw_print, (const char *)); -extern void FDECL(safe_raw_print_bold, (const char *)); -extern int NDECL(safe_nhgetch); -extern int FDECL(safe_nh_poskey, (int *, int *, int *)); -extern void NDECL(safe_nhbell); -extern int NDECL(safe_doprev_message); -extern char FDECL(safe_yn_function, (const char *, const char *, CHAR_P)); -extern void FDECL(safe_getlin, (const char *, char *)); -extern int NDECL(safe_get_ext_cmd); -extern void FDECL(safe_number_pad, (int)); -extern void NDECL(safe_delay_output); +extern void safe_print_glyph(winid, xchar, xchar, + const glyph_info *, const glyph_info *); +extern void safe_raw_print(const char *); +extern void safe_raw_print_bold(const char *); +extern int safe_nhgetch(void); +extern int safe_nh_poskey(int *, int *, int *); +extern void safe_nhbell(void); +extern int safe_doprev_message(void); +extern char safe_yn_function(const char *, const char *, char); +extern void safe_getlin(const char *, char *); +extern int safe_get_ext_cmd(void); +extern void safe_number_pad(int); +extern void safe_delay_output(void); #ifdef CHANGE_COLOR -extern void FDECL(safe_change_color, (int, long, int)); +extern void safe_change_color(int, long, int); #ifdef MAC -extern void FDECL(safe_change_background, (int)); -extern short FDECL(safe_set_font_name, (winid, char *)); +extern void safe_change_background(int); +extern short safe_set_font_name(winid, char *); #endif -extern char *NDECL(safe_get_color_string); +extern char *safe_get_color_string(void); #endif -extern void NDECL(safe_start_screen); -extern void NDECL(safe_end_screen); -extern void FDECL(safe_outrip, (winid, int, time_t)); -extern void FDECL(safe_preference_update, (const char *)); -extern char *FDECL(safe_getmsghistory, (BOOLEAN_P)); -extern void FDECL(safe_putmsghistory, (const char *, BOOLEAN_P)); -extern void NDECL(safe_status_init); -extern void NDECL(safe_status_finish); -extern void FDECL(safe_status_enablefield, (int, const char *, const char *, - BOOLEAN_P)); -extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, - unsigned long *)); -extern boolean NDECL(safe_can_suspend); -extern void FDECL(stdio_raw_print, (const char *)); -extern void FDECL(stdio_nonl_raw_print, (const char *)); -extern void FDECL(stdio_raw_print_bold, (const char *)); -extern void NDECL(stdio_wait_synch); -extern int NDECL(stdio_nhgetch); +extern void safe_start_screen(void); +extern void safe_end_screen(void); +extern void safe_outrip(winid, int, time_t); +extern void safe_preference_update(const char *); +extern char *safe_getmsghistory(boolean); +extern void safe_putmsghistory(const char *, boolean); +extern void safe_status_init(void); +extern void safe_status_finish(void); +extern void safe_status_enablefield(int, const char *, const char *, + boolean); +extern void safe_status_update(int, genericptr_t, int, int, int, + unsigned long *); +extern boolean safe_can_suspend(void); +extern void stdio_raw_print(const char *); +extern void stdio_nonl_raw_print(const char *); +extern void stdio_raw_print_bold(const char *); +extern void stdio_wait_synch(void); +extern int stdio_nhgetch(void); #endif /* SAFEPROCS */ #endif /* WINPROCS_H */ diff --git a/include/wintty.h b/include/wintty.h index 0144475a7..31b68c503 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -114,35 +114,35 @@ extern char defmorestr[]; /* default --more-- prompt */ /* port specific external function references */ /* ### getline.c ### */ -E void FDECL(xwaitforspace, (const char *)); +E void xwaitforspace(const char *); /* ### termcap.c, video.c ### */ -E void FDECL(tty_startup, (int *, int *)); +E void tty_startup(int *, int *); #ifndef NO_TERMS -E void NDECL(tty_shutdown); +E void tty_shutdown(void); #endif -E int FDECL(xputc, (int)); -E void FDECL(xputs, (const char *)); +E int xputc(int); +E void xputs(const char *); #if defined(SCREEN_VGA) || defined(SCREEN_8514) -E void FDECL(xputg, (int, int, unsigned)); +E void xputg(int, int, unsigned); #endif -E void NDECL(cl_end); -E void NDECL(clear_screen); -E void NDECL(home); -E void NDECL(standoutbeg); -E void NDECL(standoutend); +E void cl_end(void); +E void clear_screen(void); +E void home(void); +E void standoutbeg(void); +E void standoutend(void); #if 0 -E void NDECL(revbeg); -E void NDECL(boldbeg); -E void NDECL(blinkbeg); -E void NDECL(dimbeg); -E void NDECL(m_end); +E void revbeg(void); +E void boldbeg(void); +E void blinkbeg(void); +E void dimbeg(void); +E void m_end(void); #endif -E void NDECL(backsp); -E void NDECL(graph_on); -E void NDECL(graph_off); -E void NDECL(cl_eos); +E void backsp(void); +E void graph_on(void); +E void graph_off(void); +E void cl_eos(void); /* * termcap.c (or facsimiles in other ports) is the right place for doing @@ -150,102 +150,100 @@ E void NDECL(cl_eos); * a color or whatever. wintty.c should concern itself with WHERE to put * stuff in a window. */ -E int FDECL(term_attr_fixup, (int)); -E void FDECL(term_start_attr, (int attr)); -E void FDECL(term_end_attr, (int attr)); -E void NDECL(term_start_raw_bold); -E void NDECL(term_end_raw_bold); +E int term_attr_fixup(int); +E void term_start_attr(int attr); +E void term_end_attr(int attr); +E void term_start_raw_bold(void); +E void term_end_raw_bold(void); #ifdef TEXTCOLOR -E void NDECL(term_end_color); -E void FDECL(term_start_color, (int color)); +E void term_end_color(void); +E void term_start_color(int color); #endif /* TEXTCOLOR */ /* ### topl.c ### */ -E void FDECL(show_topl, (const char *)); -E void NDECL(remember_topl); -E void FDECL(addtopl, (const char *)); -E void NDECL(more); -E void FDECL(update_topl, (const char *)); -E void FDECL(putsyms, (const char *)); +E void show_topl(const char *); +E void remember_topl(void); +E void addtopl(const char *); +E void more(void); +E void update_topl(const char *); +E void putsyms(const char *); /* ### wintty.c ### */ #ifdef CLIPPING -E void NDECL(setclipped); +E void setclipped(void); #endif -E void FDECL(docorner, (int, int)); -E void NDECL(end_glyphout); -E void FDECL(g_putch, (int)); -E void FDECL(win_tty_init, (int)); +E void docorner(int, int); +E void end_glyphout(void); +E void g_putch(int); +E void win_tty_init(int); /* external declarations */ -E void FDECL(tty_init_nhwindows, (int *, char **)); -E void FDECL(tty_preference_update, (const char *)); -E void NDECL(tty_player_selection); -E void NDECL(tty_askname); -E void NDECL(tty_get_nh_event); -E void FDECL(tty_exit_nhwindows, (const char *)); -E void FDECL(tty_suspend_nhwindows, (const char *)); -E void NDECL(tty_resume_nhwindows); -E winid FDECL(tty_create_nhwindow, (int)); -E void FDECL(tty_clear_nhwindow, (winid)); -E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(tty_dismiss_nhwindow, (winid)); -E void FDECL(tty_destroy_nhwindow, (winid)); -E void FDECL(tty_curs, (winid, int, int)); -E void FDECL(tty_putstr, (winid, int, const char *)); -E void FDECL(tty_display_file, (const char *, BOOLEAN_P)); -E void FDECL(tty_start_menu, (winid, unsigned long)); -E void FDECL(tty_add_menu, (winid, const glyph_info *, const ANY_P *, - CHAR_P, CHAR_P, int, const char *, - unsigned int)); -E void FDECL(tty_end_menu, (winid, const char *)); -E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **)); -E char FDECL(tty_message_menu, (CHAR_P, int, const char *)); -E void NDECL(tty_update_inventory); -E void NDECL(tty_mark_synch); -E void NDECL(tty_wait_synch); +E void tty_init_nhwindows(int *, char **); +E void tty_preference_update(const char *); +E void tty_player_selection(void); +E void tty_askname(void); +E void tty_get_nh_event(void); +E void tty_exit_nhwindows(const char *); +E void tty_suspend_nhwindows(const char *); +E void tty_resume_nhwindows(void); +E winid tty_create_nhwindow(int); +E void tty_clear_nhwindow(winid); +E void tty_display_nhwindow(winid, boolean); +E void tty_dismiss_nhwindow(winid); +E void tty_destroy_nhwindow(winid); +E void tty_curs(winid, int, int); +E void tty_putstr(winid, int, const char *); +E void tty_display_file(const char *, boolean); +E void tty_start_menu(winid, unsigned long); +E void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, char, + int, const char *, unsigned int); +E void tty_end_menu(winid, const char *); +E int tty_select_menu(winid, int, MENU_ITEM_P **); +E char tty_message_menu(char, int, const char *); +E void tty_update_inventory(void); +E void tty_mark_synch(void); +E void tty_wait_synch(void); #ifdef CLIPPING -E void FDECL(tty_cliparound, (int, int)); +E void tty_cliparound(int, int); #endif #ifdef POSITIONBAR -E void FDECL(tty_update_positionbar, (char *)); +E void tty_update_positionbar(char *); #endif -E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P, - const glyph_info *, const glyph_info *)); -E void FDECL(tty_raw_print, (const char *)); -E void FDECL(tty_raw_print_bold, (const char *)); -E int NDECL(tty_nhgetch); -E int FDECL(tty_nh_poskey, (int *, int *, int *)); -E void NDECL(tty_nhbell); -E int NDECL(tty_doprev_message); -E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(tty_getlin, (const char *, char *)); -E int NDECL(tty_get_ext_cmd); -E void FDECL(tty_number_pad, (int)); -E void NDECL(tty_delay_output); +E void tty_print_glyph(winid, xchar, xchar, const glyph_info *, + const glyph_info *); +E void tty_raw_print(const char *); +E void tty_raw_print_bold(const char *); +E int tty_nhgetch(void); +E int tty_nh_poskey(int *, int *, int *); +E void tty_nhbell(void); +E int tty_doprev_message(void); +E char tty_yn_function(const char *, const char *, char); +E void tty_getlin(const char *, char *); +E int tty_get_ext_cmd(void); +E void tty_number_pad(int); +E void tty_delay_output(void); #ifdef CHANGE_COLOR -E void FDECL(tty_change_color, (int color, long rgb, int reverse)); +E void tty_change_color(int color, long rgb, int reverse); #ifdef MAC -E void FDECL(tty_change_background, (int white_or_black)); -E short FDECL(set_tty_font_name, (winid, char *)); +E void tty_change_background(int white_or_black); +E short set_tty_font_name(winid, char *); #endif -E char *NDECL(tty_get_color_string); +E char *tty_get_color_string(void); #endif -E void FDECL(tty_status_enablefield, - (int, const char *, const char *, BOOLEAN_P)); -E void NDECL(tty_status_init); -E void FDECL(tty_status_update, (int, genericptr_t, int, int, int, unsigned long *)); +E void tty_status_enablefield(int, const char *, const char *, boolean); +E void tty_status_init(void); +E void tty_status_update(int, genericptr_t, int, int, int, unsigned long *); /* other defs that really should go away (they're tty specific) */ -E void NDECL(tty_start_screen); -E void NDECL(tty_end_screen); +E void tty_start_screen(void); +E void tty_end_screen(void); -E void FDECL(genl_outrip, (winid, int, time_t)); +E void genl_outrip(winid, int, time_t); -E char *FDECL(tty_getmsghistory, (BOOLEAN_P)); -E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); +E char *tty_getmsghistory(boolean); +E void tty_putmsghistory(const char *, boolean); #ifdef NO_TERMS #ifdef MAC @@ -256,9 +254,9 @@ E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); #define putchar term_putc #define fflush term_flush #define puts term_puts -E int FDECL(term_putc, (int c)); -E int FDECL(term_flush, (void *desc)); -E int FDECL(term_puts, (const char *str)); +E int term_putc(int c); +E int term_flush(void *desc); +E int term_puts(const char *str); #endif /* MAC */ #if defined(MSDOS) || defined(WIN32) #if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32) @@ -270,7 +268,7 @@ E int FDECL(term_puts, (const char *str)); #define puts(x) xputs(x) #endif /*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32 */ #ifdef POSITIONBAR -E void FDECL(video_update_positionbar, (char *)); +E void video_update_positionbar(char *); #endif #endif /*MSDOS*/ #endif /*NO_TERMS*/ diff --git a/include/wintype.h b/include/wintype.h index bc58f7afe..47b0b39bf 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -24,7 +24,7 @@ typedef union any { unsigned long *a_ulptr; unsigned *a_uptr; const char *a_string; - int NDECL((*a_nfunc)); + int (*a_nfunc)(void); unsigned long a_mask32; /* used by status highlighting */ /* add types as needed */ } anything; diff --git a/src/allmain.c b/src/allmain.c index 6cdf9bd4d..c5221ec06 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -13,14 +13,14 @@ #endif #ifdef POSITIONBAR -static void NDECL(do_positionbar); +static void do_positionbar(void); #endif -static void FDECL(regen_hp, (int)); -static void FDECL(interrupt_multi, (const char *)); -static void FDECL(debug_fields, (const char *)); +static void regen_hp(int); +static void interrupt_multi(const char *); +static void debug_fields(const char *); void -early_init() +early_init(void) { decl_globals_init(); objects_globals_init(); @@ -29,8 +29,7 @@ early_init() } void -moveloop(resuming) -boolean resuming; +moveloop(boolean resuming) { #if defined(MICRO) || defined(WIN32) char ch; @@ -465,8 +464,7 @@ boolean resuming; /* maybe recover some lost health (or lose some when an eel out of water) */ static void -regen_hp(wtcap) -int wtcap; +regen_hp(int wtcap) { int heal = 0; boolean reached_full = FALSE, @@ -538,7 +536,7 @@ int wtcap; #undef U_CAN_REGEN void -stop_occupation() +stop_occupation(void) { if (g.occupation) { if (!maybe_finished_meal(TRUE)) @@ -553,7 +551,7 @@ stop_occupation() } void -display_gamewindows() +display_gamewindows(void) { WIN_MESSAGE = create_nhwindow(NHW_MESSAGE); if (VIA_WINDOWPORT()) { @@ -589,7 +587,7 @@ display_gamewindows() } void -newgame() +newgame(void) { int i; @@ -657,8 +655,7 @@ newgame() /* show "welcome [back] to nethack" message at program startup */ void -welcome(new_game) -boolean new_game; /* false => restoring an old game */ +welcome(boolean new_game) /* false => restoring an old game */ { char buf[BUFSZ]; boolean currentgend = Upolyd ? u.mfemale : flags.female; @@ -698,7 +695,7 @@ boolean new_game; /* false => restoring an old game */ #ifdef POSITIONBAR static void -do_positionbar() +do_positionbar(void) { static char pbar[COLNO]; char *p; @@ -731,8 +728,7 @@ do_positionbar() #endif static void -interrupt_multi(msg) -const char *msg; +interrupt_multi(const char *msg) { if (g.multi > 0 && !g.context.travel && !g.context.run) { nomul(0); @@ -764,7 +760,7 @@ static const struct early_opt earlyopts[] = { }; #ifdef WIN32 -extern int FDECL(windows_early_options, (const char *)); +extern int windows_early_options(const char *); #endif /* @@ -775,10 +771,7 @@ extern int FDECL(windows_early_options, (const char *)); */ int -argcheck(argc, argv, e_arg) -int argc; -char *argv[]; -enum earlyarg e_arg; +argcheck(int argc, char *argv[], enum earlyarg e_arg) { int i, idx; boolean match = FALSE; @@ -867,8 +860,7 @@ enum earlyarg e_arg; * can be debugged without buffering. */ static void -debug_fields(opts) -const char *opts; +debug_fields(const char *opts) { char *op; boolean negated = FALSE; diff --git a/src/alloc.c b/src/alloc.c index a1792e1f9..872188cdf 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -10,24 +10,23 @@ #define EXTERN_H /* comment line for pre-compiled headers */ #include "config.h" -char *FDECL(fmt_ptr, (const genericptr)); +char *fmt_ptr(const genericptr); #ifdef MONITOR_HEAP #undef alloc #undef free -extern void FDECL(free, (genericptr_t)); -static void NDECL(heapmon_init); +extern void free(genericptr_t); +static void heapmon_init(void); static FILE *heaplog = 0; static boolean tried_heaplog = FALSE; #endif -long *FDECL(alloc, (unsigned int)); -extern void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2); +long *alloc(unsigned int); +extern void panic(const char *, ...); long * -alloc(lth) -register unsigned int lth; +alloc(unsigned int lth) { #ifdef LINT /* @@ -76,8 +75,7 @@ static int ptrbufidx = 0; /* format a pointer for display purposes; returns a static buffer */ char * -fmt_ptr(ptr) -const genericptr ptr; +fmt_ptr(const genericptr ptr) { char *buf; @@ -94,7 +92,7 @@ const genericptr ptr; /* If ${NH_HEAPLOG} is defined and we can create a file by that name, then we'll log the allocation and release information to that file. */ static void -heapmon_init() +heapmon_init(void) { char *logname = getenv("NH_HEAPLOG"); @@ -104,10 +102,7 @@ heapmon_init() } long * -nhalloc(lth, file, line) -unsigned int lth; -const char *file; -int line; +nhalloc(unsigned int lth, const char *file, int line) { long *ptr = alloc(lth); @@ -124,10 +119,7 @@ int line; } void -nhfree(ptr, file, line) -genericptr_t ptr; -const char *file; -int line; +nhfree(genericptr_t ptr, const char *file, int line) { if (!tried_heaplog) heapmon_init(); @@ -141,10 +133,7 @@ int line; /* strdup() which uses our alloc() rather than libc's malloc(), with caller tracking */ char * -nhdupstr(string, file, line) -const char *string; -const char *file; -int line; +nhdupstr(const char *string, const char *file, int line) { return strcpy((char *) nhalloc(strlen(string) + 1, file, line), string); } @@ -156,8 +145,7 @@ int line; not used when MONITOR_HEAP is enabled, but included unconditionally in case utility programs get built using a different setting for that */ char * -dupstr(string) -const char *string; +dupstr(const char *string) { return strcpy((char *) alloc(strlen(string) + 1), string); } diff --git a/src/apply.c b/src/apply.c index f821e4a28..a82d4aa15 100644 --- a/src/apply.c +++ b/src/apply.c @@ -5,53 +5,51 @@ #include "hack.h" -static int FDECL(use_camera, (struct obj *)); -static int FDECL(use_towel, (struct obj *)); -static boolean FDECL(its_dead, (int, int, int *)); -static int FDECL(use_stethoscope, (struct obj *)); -static void FDECL(use_whistle, (struct obj *)); -static void FDECL(use_magic_whistle, (struct obj *)); -static int FDECL(use_leash, (struct obj *)); -static int FDECL(use_mirror, (struct obj *)); -static void FDECL(use_bell, (struct obj **)); -static void FDECL(use_candelabrum, (struct obj *)); -static void FDECL(use_candle, (struct obj **)); -static void FDECL(use_lamp, (struct obj *)); -static void FDECL(light_cocktail, (struct obj **)); -static int FDECL(rub_ok, (struct obj *)); -static void FDECL(display_jump_positions, (int)); -static void FDECL(use_tinning_kit, (struct obj *)); -static void FDECL(use_figurine, (struct obj **)); -static int FDECL(grease_ok, (struct obj *)); -static void FDECL(use_grease, (struct obj *)); -static void FDECL(use_trap, (struct obj *)); -static int FDECL(touchstone_ok, (struct obj *)); -static void FDECL(use_stone, (struct obj *)); -static int NDECL(set_trap); /* occupation callback */ -static int FDECL(use_whip, (struct obj *)); -static void FDECL(display_polearm_positions, (int)); -static int FDECL(use_pole, (struct obj *)); -static int FDECL(use_cream_pie, (struct obj *)); -static int FDECL(jelly_ok, (struct obj *)); -static int FDECL(use_royal_jelly, (struct obj *)); -static int FDECL(use_grapple, (struct obj *)); -static int FDECL(do_break_wand, (struct obj *)); -static int FDECL(apply_ok, (struct obj *)); -static int FDECL(flip_through_book, (struct obj *)); -static boolean FDECL(figurine_location_checks, (struct obj *, - coord *, BOOLEAN_P)); -static boolean FDECL(check_jump, (genericptr_t, int, int)); -static boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P)); -static boolean FDECL(get_valid_jump_position, (int, int)); -static boolean FDECL(get_valid_polearm_position, (int, int)); -static boolean FDECL(find_poleable_mon, (coord *, int, int)); +static int use_camera(struct obj *); +static int use_towel(struct obj *); +static boolean its_dead(int, int, int *); +static int use_stethoscope(struct obj *); +static void use_whistle(struct obj *); +static void use_magic_whistle(struct obj *); +static int use_leash(struct obj *); +static int use_mirror(struct obj *); +static void use_bell(struct obj **); +static void use_candelabrum(struct obj *); +static void use_candle(struct obj **); +static void use_lamp(struct obj *); +static void light_cocktail(struct obj **); +static int rub_ok(struct obj *); +static void display_jump_positions(int); +static void use_tinning_kit(struct obj *); +static void use_figurine(struct obj **); +static int grease_ok(struct obj *); +static void use_grease(struct obj *); +static void use_trap(struct obj *); +static int touchstone_ok(struct obj *); +static void use_stone(struct obj *); +static int set_trap(void); /* occupation callback */ +static int use_whip(struct obj *); +static void display_polearm_positions(int); +static int use_pole(struct obj *); +static int use_cream_pie(struct obj *); +static int jelly_ok(struct obj *); +static int use_royal_jelly(struct obj *); +static int use_grapple(struct obj *); +static int do_break_wand(struct obj *); +static int apply_ok(struct obj *); +static int flip_through_book(struct obj *); +static boolean figurine_location_checks(struct obj *, coord *, boolean); +static boolean check_jump(genericptr_t, int, int); +static boolean is_valid_jump_pos(int, int, int, boolean); +static boolean get_valid_jump_position(int, int); +static boolean get_valid_polearm_position(int, int); +static boolean find_poleable_mon(coord *, int, int); static const char no_elbow_room[] = "don't have enough elbow-room to maneuver."; static int -use_camera(obj) -struct obj *obj; +use_camera(struct obj *obj) { struct monst *mtmp; @@ -80,8 +78,8 @@ struct obj *obj; (void) zapyourself(obj, TRUE); } else { mtmp = bhit(u.dx, u.dy, COLNO, FLASHED_LIGHT, - (int FDECL((*), (MONST_P, OBJ_P))) 0, - (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj); + (int (*) (MONST_P, OBJ_P)) 0, + (int (*) (OBJ_P, OBJ_P)) 0, &obj); obj->ox = u.ux, obj->oy = u.uy; /* flash_hits_mon() wants this */ if (mtmp) (void) flash_hits_mon(mtmp, obj); @@ -93,8 +91,7 @@ struct obj *obj; } static int -use_towel(obj) -struct obj *obj; +use_towel(struct obj *obj) { boolean drying_feedback = (obj == uwep); @@ -180,8 +177,7 @@ struct obj *obj; /* maybe give a stethoscope message based on floor objects */ static boolean -its_dead(rx, ry, resp) -int rx, ry, *resp; +its_dead(int rx, int ry, int *resp) { char buf[BUFSZ]; boolean more_corpses; @@ -302,8 +298,7 @@ static const char hollow_str[] = "a hollow sound. This must be a secret %s!"; almost useless. As a compromise, one use per turn is free, another uses up the turn; this makes curse status have a tangible effect. */ static int -use_stethoscope(obj) -register struct obj *obj; +use_stethoscope(struct obj *obj) { struct monst *mtmp; struct rm *lev; @@ -457,8 +452,7 @@ static const char whistle_str[] = "produce a %s whistling sound.", alt_whistle_str[] = "produce a %s, sharp vibration."; static void -use_whistle(obj) -struct obj *obj; +use_whistle(struct obj *obj) { if (!can_blow(&g.youmonst)) { You("are incapable of using the whistle."); @@ -476,8 +470,7 @@ struct obj *obj; } static void -use_magic_whistle(obj) -struct obj *obj; +use_magic_whistle(struct obj *obj) { register struct monst *mtmp, *nextmon; @@ -530,14 +523,13 @@ struct obj *obj; } boolean -um_dist(x, y, n) -xchar x, y, n; +um_dist(xchar x, xchar y, xchar n) { return (boolean) (abs(u.ux - x) > n || abs(u.uy - y) > n); } int -number_leashed() +number_leashed(void) { int i = 0; struct obj *obj; @@ -550,8 +542,7 @@ number_leashed() /* otmp is about to be destroyed or stolen */ void -o_unleash(otmp) -struct obj *otmp; +o_unleash(struct obj *otmp) { register struct monst *mtmp; @@ -566,9 +557,7 @@ struct obj *otmp; /* mtmp is about to die, or become untame */ void -m_unleash(mtmp, feedback) -struct monst *mtmp; -boolean feedback; +m_unleash(struct monst *mtmp, boolean feedback) { register struct obj *otmp; @@ -589,7 +578,7 @@ boolean feedback; /* player is about to die (for bones) */ void -unleash_all() +unleash_all(void) { register struct obj *otmp; register struct monst *mtmp; @@ -604,8 +593,7 @@ unleash_all() #define MAXLEASHED 2 boolean -leashable(mtmp) -struct monst *mtmp; +leashable(struct monst *mtmp) { return (boolean) (mtmp->mnum != PM_LONG_WORM && !unsolid(mtmp->data) @@ -614,8 +602,7 @@ struct monst *mtmp; /* ARGSUSED */ static int -use_leash(obj) -struct obj *obj; +use_leash(struct obj *obj) { coord cc; struct monst *mtmp; @@ -717,8 +704,7 @@ struct obj *obj; /* assuming mtmp->mleashed has been checked */ struct obj * -get_mleash(mtmp) -struct monst *mtmp; +get_mleash(struct monst *mtmp) { struct obj *otmp; @@ -729,7 +715,7 @@ struct monst *mtmp; } boolean -next_to_u() +next_to_u(void) { register struct monst *mtmp; register struct obj *otmp; @@ -762,8 +748,7 @@ next_to_u() } void -check_leash(x, y) -register xchar x, y; +check_leash(xchar x, xchar y) { register struct obj *otmp; register struct monst *mtmp; @@ -833,7 +818,7 @@ register xchar x, y; /* charisma is supposed to include qualities like leadership and personal magnetism rather than just appearance, but it has devolved to this... */ const char * -beautiful() +beautiful(void) { const char *res; int cha = ACURR(A_CHA); @@ -854,8 +839,7 @@ beautiful() static const char look_str[] = "look %s."; static int -use_mirror(obj) -struct obj *obj; +use_mirror(struct obj *obj) { const char *mirror, *uvisage; struct monst *mtmp; @@ -933,8 +917,8 @@ struct obj *obj; return 1; } mtmp = bhit(u.dx, u.dy, COLNO, INVIS_BEAM, - (int FDECL((*), (MONST_P, OBJ_P))) 0, - (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj); + (int (*) (MONST_P, OBJ_P)) 0, + (int (*) (OBJ_P, OBJ_P)) 0, &obj); if (!mtmp || !haseyes(mtmp->data) || g.notonhead) return 1; @@ -1036,8 +1020,7 @@ struct obj *obj; } static void -use_bell(optr) -struct obj **optr; +use_bell(struct obj **optr) { register struct obj *obj = *optr; struct monst *mtmp; @@ -1153,8 +1136,7 @@ struct obj **optr; } static void -use_candelabrum(obj) -register struct obj *obj; +use_candelabrum(struct obj *obj) { const char *s = (obj->spe != 1) ? "candles" : "candle"; @@ -1222,8 +1204,7 @@ register struct obj *obj; } static void -use_candle(optr) -struct obj **optr; +use_candle(struct obj **optr) { register struct obj *obj = *optr; register struct obj *otmp; @@ -1303,8 +1284,7 @@ struct obj **optr; /* call in drop, throw, and put in box, etc. */ boolean -snuff_candle(otmp) -struct obj *otmp; +snuff_candle(struct obj *otmp) { boolean candle = Is_candle(otmp); @@ -1329,8 +1309,7 @@ struct obj *otmp; you've been swallowed by a monster; obj might be in transit while being thrown or dropped so don't assume that its location is valid */ boolean -snuff_lit(obj) -struct obj *obj; +snuff_lit(struct obj *obj) { xchar x, y; @@ -1351,8 +1330,7 @@ struct obj *obj; /* called when lit object is hit by water */ boolean -splash_lit(obj) -struct obj *obj; +splash_lit(struct obj *obj) { boolean result, dunk = FALSE; @@ -1409,8 +1387,7 @@ struct obj *obj; /* Called when potentially lightable object is affected by fire_damage(). Return TRUE if object becomes lit and FALSE otherwise --ALI */ boolean -catch_lit(obj) -struct obj *obj; +catch_lit(struct obj *obj) { xchar x, y; @@ -1453,8 +1430,7 @@ struct obj *obj; } static void -use_lamp(obj) -struct obj *obj; +use_lamp(struct obj *obj) { char buf[BUFSZ]; @@ -1506,8 +1482,7 @@ struct obj *obj; } static void -light_cocktail(optr) -struct obj **optr; +light_cocktail(struct obj **optr) { struct obj *obj = *optr; /* obj is a potion of oil */ char buf[BUFSZ]; @@ -1566,8 +1541,7 @@ struct obj **optr; /* getobj callback for object to be rubbed - not selecting a secondary object to * rub on a gray stone or rub jelly on */ static int -rub_ok(obj) -struct obj *obj; +rub_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -1581,7 +1555,7 @@ struct obj *obj; } int -dorub() +dorub(void) { struct obj *obj; @@ -1639,7 +1613,7 @@ dorub() } int -dojump() +dojump(void) { /* Physical jump */ return jump(0); @@ -1654,9 +1628,7 @@ enum jump_trajectory { /* callback routine for walk_path() */ static boolean -check_jump(arg, x, y) -genericptr arg; -int x, y; +check_jump(genericptr arg, int x, int y) { int traj = *(int *) arg; struct rm *lev = &levl[x][y]; @@ -1687,9 +1659,7 @@ int x, y; } static boolean -is_valid_jump_pos(x, y, magic, showmsg) -int x, y, magic; -boolean showmsg; +is_valid_jump_pos(int x, int y, int magic, boolean showmsg) { if (!magic && !(HJumping & ~INTRINSIC) && !EJumping && distu(x, y) != 5) { /* The Knight jumping restriction still applies when riding a @@ -1755,8 +1725,7 @@ boolean showmsg; } static boolean -get_valid_jump_position(x,y) -int x,y; +get_valid_jump_position(int x, int y) { return (isok(x, y) && (ACCESSIBLE(levl[x][y].typ) || Passes_walls) @@ -1764,8 +1733,7 @@ int x,y; } static void -display_jump_positions(state) -int state; +display_jump_positions(int state) { if (state == 0) { tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); @@ -1785,8 +1753,7 @@ int state; } int -jump(magic) -int magic; /* 0=Physical, otherwise skill level */ +jump(int magic) /* 0=Physical, otherwise skill level */ { coord cc; @@ -1940,8 +1907,7 @@ int magic; /* 0=Physical, otherwise skill level */ } boolean -tinnable(corpse) -struct obj *corpse; +tinnable(struct obj *corpse) { if (corpse->oeaten) return 0; @@ -1951,8 +1917,7 @@ struct obj *corpse; } static void -use_tinning_kit(obj) -struct obj *obj; +use_tinning_kit(struct obj *obj) { struct obj *corpse, *can; @@ -2023,8 +1988,7 @@ struct obj *obj; } void -use_unicorn_horn(optr) -struct obj **optr; +use_unicorn_horn(struct obj **optr) { #define PROP_COUNT 7 /* number of properties we're dealing with */ int idx, val, val_limit, trouble_count, unfixable_trbl, did_prop; @@ -2166,9 +2130,7 @@ struct obj **optr; * Timer callback routine: turn figurine into monster */ void -fig_transform(arg, timeout) -anything *arg; -long timeout; +fig_transform(anything *arg, long timeout) { struct obj *figurine = arg->a_obj; struct monst *mtmp; @@ -2280,10 +2242,7 @@ long timeout; } static boolean -figurine_location_checks(obj, cc, quietly) -struct obj *obj; -coord *cc; -boolean quietly; +figurine_location_checks(struct obj *obj, coord *cc, boolean quietly) { xchar x, y; @@ -2316,8 +2275,7 @@ boolean quietly; } static void -use_figurine(optr) -struct obj **optr; +use_figurine(struct obj **optr) { register struct obj *obj = *optr; xchar x, y; @@ -2357,8 +2315,7 @@ struct obj **optr; /* getobj callback for object to apply grease to */ static int -grease_ok(obj) -struct obj *obj; +grease_ok(struct obj *obj) { if (!obj) return GETOBJ_SUGGEST; @@ -2375,8 +2332,7 @@ struct obj *obj; } static void -use_grease(obj) -struct obj *obj; +use_grease(struct obj *obj) { struct obj *otmp; @@ -2429,8 +2385,7 @@ struct obj *obj; /* getobj callback for object to rub on a known touchstone */ static int -touchstone_ok(obj) -struct obj *obj; +touchstone_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -2452,8 +2407,7 @@ struct obj *obj; /* touchstones - by Ken Arnold */ static void -use_stone(tstone) -struct obj *tstone; +use_stone(struct obj *tstone) { static const char scritch[] = "\"scritch, scritch\""; struct obj *obj; @@ -2586,7 +2540,7 @@ struct obj *tstone; } void -reset_trapset() +reset_trapset(void) { g.trapinfo.tobj = 0; g.trapinfo.force_bungle = 0; @@ -2594,8 +2548,7 @@ reset_trapset() /* Place a landmine/bear trap. Helge Hafting */ static void -use_trap(otmp) -struct obj *otmp; +use_trap(struct obj *otmp) { int ttyp, tmp; const char *what = (char *) 0; @@ -2690,7 +2643,7 @@ struct obj *otmp; } static int -set_trap() +set_trap(void) { struct obj *otmp = g.trapinfo.tobj; struct trap *ttmp; @@ -2730,8 +2683,7 @@ set_trap() } static int -use_whip(obj) -struct obj *obj; +use_whip(struct obj *obj) { char buf[BUFSZ]; struct monst *mtmp; @@ -3012,9 +2964,7 @@ static const char /* find pos of monster in range, if only one monster */ static boolean -find_poleable_mon(pos, min_range, max_range) -coord *pos; -int min_range, max_range; +find_poleable_mon(coord *pos, int min_range, int max_range) { struct monst *mtmp; coord mpos; @@ -3052,8 +3002,7 @@ int min_range, max_range; } static boolean -get_valid_polearm_position(x, y) -int x, y; +get_valid_polearm_position(int x, int y) { int glyph; @@ -3066,8 +3015,7 @@ int x, y; } static void -display_polearm_positions(state) -int state; +display_polearm_positions(int state) { if (state == 0) { tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); @@ -3089,8 +3037,7 @@ int state; /* Distance attacks by pole-weapons */ static int -use_pole(obj) -struct obj *obj; +use_pole(struct obj *obj) { int res = 0, typ, max_range, min_range, glyph; coord cc; @@ -3205,8 +3152,7 @@ struct obj *obj; } static int -use_cream_pie(obj) -struct obj *obj; +use_cream_pie(struct obj *obj) { boolean wasblind = Blind; boolean wascreamed = u.ucreamed; @@ -3244,8 +3190,7 @@ struct obj *obj; /* getobj callback for object to rub royal jelly on */ static int -jelly_ok(obj) -struct obj *obj; +jelly_ok(struct obj *obj) { if (obj && obj->otyp == EGG) return GETOBJ_SUGGEST; @@ -3254,8 +3199,7 @@ struct obj *obj; } static int -use_royal_jelly(obj) -struct obj *obj; +use_royal_jelly(struct obj *obj) { int oldcorpsenm; unsigned was_timed; @@ -3319,8 +3263,7 @@ struct obj *obj; } static int -use_grapple(obj) -struct obj *obj; +use_grapple(struct obj *obj) { int res = 0, typ, max_range = 4, tohit; boolean save_confirm; @@ -3469,8 +3412,7 @@ struct obj *obj; /* return 1 if the wand is broken, hence some time elapsed */ static int -do_break_wand(obj) -struct obj *obj; +do_break_wand(struct obj *obj) { static const char nothing_else_happens[] = "But nothing else happens..."; register int i, x, y; @@ -3699,8 +3641,7 @@ discard_broken_wand: /* getobj callback for object to apply - this is more complex than most other * callbacks because there are a lot of appliables */ static int -apply_ok(obj) -struct obj *obj; +apply_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -3747,7 +3688,7 @@ struct obj *obj; /* the 'a' command */ int -doapply() +doapply(void) { struct obj *obj; register int res = 1; @@ -3950,8 +3891,7 @@ doapply() * great. */ int -unfixable_trouble_count(is_horn) -boolean is_horn; +unfixable_trouble_count(boolean is_horn) { int unfixable_trbl = 0; @@ -3991,8 +3931,7 @@ boolean is_horn; } static int -flip_through_book(obj) -struct obj *obj; +flip_through_book(struct obj *obj) { if (Underwater) { pline("You don't want to get the pages even more soggy, do you?"); diff --git a/src/artifact.c b/src/artifact.c index e2433c8c1..1202369e1 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -17,18 +17,17 @@ #define get_artifact(o) \ (((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] : 0) -static boolean FDECL(bane_applies, (const struct artifact *, - struct monst *)); -static int FDECL(spec_applies, (const struct artifact *, struct monst *)); -static int FDECL(invoke_ok, (struct obj *)); -static int FDECL(arti_invoke, (struct obj *)); -static boolean FDECL(Mb_hit, (struct monst * magr, struct monst *mdef, - struct obj *, int *, int, BOOLEAN_P, char *)); -static unsigned long FDECL(abil_to_spfx, (long *)); -static uchar FDECL(abil_to_adtyp, (long *)); -static int FDECL(glow_strength, (int)); -static boolean FDECL(untouchable, (struct obj *, BOOLEAN_P)); -static int FDECL(count_surround_traps, (int, int)); +static boolean bane_applies(const struct artifact *, struct monst *); +static int spec_applies(const struct artifact *, struct monst *); +static int invoke_ok(struct obj *); +static int arti_invoke(struct obj *); +static boolean Mb_hit(struct monst * magr, struct monst *mdef, + struct obj *, int *, int, boolean, char *); +static unsigned long abil_to_spfx(long *); +static uchar abil_to_adtyp(long *); +static int glow_strength(int); +static boolean untouchable(struct obj *, boolean); +static int count_surround_traps(int, int); /* The amount added to the victim's total hit points to insure that the victim will be killed even after damage bonus/penalty adjustments. @@ -40,12 +39,12 @@ static int FDECL(count_surround_traps, (int, int)); of hit points that will fit in a 15 bit integer. */ #define FATAL_DAMAGE_MODIFIER 200 -static void NDECL(hack_artifacts); -static boolean FDECL(attacks, (int, struct obj *)); +static void hack_artifacts(void); +static boolean attacks(int, struct obj *); /* handle some special cases; must be called after u_init() */ static void -hack_artifacts() +hack_artifacts(void) { struct artifact *art; int alignmnt = aligns[flags.initalign].value; @@ -69,7 +68,7 @@ hack_artifacts() /* zero out the artifact existence list */ void -init_artifacts() +init_artifacts(void) { (void) memset((genericptr_t) g.artiexist, 0, sizeof g.artiexist); (void) memset((genericptr_t) g.artidisco, 0, sizeof g.artidisco); @@ -77,8 +76,7 @@ init_artifacts() } void -save_artifacts(nhfp) -NHFILE *nhfp; +save_artifacts(NHFILE *nhfp) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) g.artiexist, sizeof g.artiexist); @@ -87,8 +85,7 @@ NHFILE *nhfp; } void -restore_artifacts(nhfp) -NHFILE *nhfp; +restore_artifacts(NHFILE *nhfp) { if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.artiexist, sizeof g.artiexist); @@ -98,8 +95,7 @@ NHFILE *nhfp; } const char * -artiname(artinum) -int artinum; +artiname(int artinum) { if (artinum <= 0 || artinum > NROFARTIFACTS) return ""; @@ -118,9 +114,8 @@ int artinum; for the 1st, ``obj = mk_artifact((struct obj *)0, some_alignment);''. */ struct obj * -mk_artifact(otmp, alignment) -struct obj *otmp; /* existing object; ignored if alignment specified */ -aligntyp alignment; /* target alignment, or A_NONE */ +mk_artifact(struct obj *otmp, /* existing object; ignored if alignment specified */ + aligntyp alignment) /* target alignment, or A_NONE */ { const struct artifact *a; int m, n, altn; @@ -211,9 +206,7 @@ aligntyp alignment; /* target alignment, or A_NONE */ * is non-NULL. */ const char * -artifact_name(name, otyp) -const char *name; -short *otyp; +artifact_name(const char *name, short *otyp) { register const struct artifact *a; register const char *aname; @@ -235,9 +228,7 @@ short *otyp; } boolean -exist_artifact(otyp, name) -int otyp; -const char *name; +exist_artifact(int otyp, const char *name) { register const struct artifact *a; boolean *arex; @@ -250,10 +241,7 @@ const char *name; } void -artifact_exists(otmp, name, mod) -struct obj *otmp; -const char *name; -boolean mod; +artifact_exists(struct obj *otmp, const char *name, boolean mod) { register const struct artifact *a; @@ -272,7 +260,7 @@ boolean mod; } int -nartifact_exist() +nartifact_exist(void) { int a = 0; int n = SIZE(g.artiexist); @@ -285,9 +273,7 @@ nartifact_exist() } boolean -spec_ability(otmp, abil) -struct obj *otmp; -unsigned long abil; +spec_ability(struct obj *otmp, unsigned long abil) { const struct artifact *arti = get_artifact(otmp); @@ -296,8 +282,7 @@ unsigned long abil; /* used so that callers don't need to known about SPFX_ codes */ boolean -confers_luck(obj) -struct obj *obj; +confers_luck(struct obj *obj) { /* might as well check for this too */ if (obj->otyp == LUCKSTONE) @@ -308,8 +293,7 @@ struct obj *obj; /* used to check whether a monster is getting reflection from an artifact */ boolean -arti_reflects(obj) -struct obj *obj; +arti_reflects(struct obj *obj) { const struct artifact *arti = get_artifact(obj); @@ -327,8 +311,7 @@ struct obj *obj; /* decide whether this obj is effective when attacking against shades; does not consider the bonus for blessed objects versus undead */ boolean -shade_glare(obj) -struct obj *obj; +shade_glare(struct obj *obj) { const struct artifact *arti; @@ -347,9 +330,7 @@ struct obj *obj; /* returns 1 if name is restricted for otmp->otyp */ boolean -restrict_name(otmp, name) -struct obj *otmp; -const char *name; +restrict_name(struct obj *otmp, const char *name) { register const struct artifact *a; const char *aname, *odesc, *other; @@ -400,9 +381,7 @@ const char *name; } static boolean -attacks(adtyp, otmp) -int adtyp; -struct obj *otmp; +attacks(int adtyp, struct obj *otmp) { register const struct artifact *weap; @@ -412,9 +391,7 @@ struct obj *otmp; } boolean -defends(adtyp, otmp) -int adtyp; -struct obj *otmp; +defends(int adtyp, struct obj *otmp) { register const struct artifact *weap; @@ -425,9 +402,7 @@ struct obj *otmp; /* used for monsters */ boolean -defends_when_carried(adtyp, otmp) -int adtyp; -struct obj *otmp; +defends_when_carried(int adtyp, struct obj *otmp) { register const struct artifact *weap; @@ -438,9 +413,7 @@ struct obj *otmp; /* determine whether an item confers Protection */ boolean -protects(otmp, being_worn) -struct obj *otmp; -boolean being_worn; +protects(struct obj *otmp, boolean being_worn) { const struct artifact *arti; @@ -458,10 +431,7 @@ boolean being_worn; * unworn/unwielded/dropped. Pickup/drop only set/reset the W_ART mask. */ void -set_artifact_intrinsic(otmp, on, wp_mask) -struct obj *otmp; -boolean on; -long wp_mask; +set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask) { long *mask = 0; register const struct artifact *art, *oart = get_artifact(otmp); @@ -641,9 +611,7 @@ static boolean touch_blasted; /* for retouch_object() */ * fooled by such trappings. */ int -touch_artifact(obj, mon) -struct obj *obj; -struct monst *mon; +touch_artifact(struct obj *obj, struct monst *mon) { register const struct artifact *oart = get_artifact(obj); boolean badclass, badalign, self_willed, yours; @@ -714,9 +682,7 @@ struct monst *mon; /* decide whether an artifact itself is vulnerable to a particular type of erosion damage, independent of the properties of its bearer */ boolean -arti_immune(obj, dtyp) -struct obj *obj; -int dtyp; +arti_immune(struct obj *obj, int dtyp) { register const struct artifact *weap = get_artifact(obj); @@ -730,9 +696,7 @@ int dtyp; } static boolean -bane_applies(oart, mon) -const struct artifact *oart; -struct monst *mon; +bane_applies(const struct artifact *oart, struct monst *mon) { struct artifact atmp; @@ -747,9 +711,7 @@ struct monst *mon; /* decide whether an artifact's special attacks apply against mtmp */ static int -spec_applies(weap, mtmp) -register const struct artifact *weap; -struct monst *mtmp; +spec_applies(const struct artifact *weap, struct monst *mtmp) { struct permonst *ptr; boolean yours; @@ -807,8 +769,7 @@ struct monst *mtmp; /* return the M2 flags of monster that an artifact's special attacks apply * against */ long -spec_m2(otmp) -struct obj *otmp; +spec_m2(struct obj *otmp) { const struct artifact *artifact = get_artifact(otmp); @@ -819,9 +780,7 @@ struct obj *otmp; /* special attack bonus */ int -spec_abon(otmp, mon) -struct obj *otmp; -struct monst *mon; +spec_abon(struct obj *otmp, struct monst *mon) { const struct artifact *weap = get_artifact(otmp); @@ -835,10 +794,7 @@ struct monst *mon; /* special damage bonus */ int -spec_dbon(otmp, mon, tmp) -struct obj *otmp; -struct monst *mon; -int tmp; +spec_dbon(struct obj *otmp, struct monst *mon, int tmp) { register const struct artifact *weap = get_artifact(otmp); @@ -859,8 +815,7 @@ int tmp; /* add identified artifact to discoveries list */ void -discover_artifact(m) -xchar m; +discover_artifact(xchar m) { int i; @@ -878,8 +833,7 @@ xchar m; /* used to decide whether an artifact has been fully identified */ boolean -undiscovered_artifact(m) -xchar m; +undiscovered_artifact(xchar m) { int i; @@ -895,8 +849,7 @@ xchar m; /* display a list of discovered artifacts; return their count */ int -disp_artifact_discoveries(tmpwin) -winid tmpwin; /* supplied by dodiscover() */ +disp_artifact_discoveries(winid tmpwin) /* supplied by dodiscover() */ { int i, m, otyp; char buf[BUFSZ]; @@ -956,13 +909,13 @@ static const char *const mb_verb[2][NUM_MB_INDICES] = { /* called when someone is being hit by Magicbane */ static boolean -Mb_hit(magr, mdef, mb, dmgptr, dieroll, vis, hittee) -struct monst *magr, *mdef; /* attacker and defender */ -struct obj *mb; /* Magicbane */ -int *dmgptr; /* extra damage target will suffer */ -int dieroll; /* d20 that has already scored a hit */ -boolean vis; /* whether the action can be seen */ -char *hittee; /* target's name: "you" or mon_nam(mdef) */ +Mb_hit(struct monst *magr, /* attacker */ + struct monst *mdef, /* defender */ + struct obj *mb, /* Magicbane */ + int *dmgptr, /* extra damage target will suffer */ + int dieroll, /* d20 that has already scored a hit */ + boolean vis, /* whether the action can be seen */ + char *hittee) /* target's name: "you" or mon_nam(mdef) */ { struct permonst *old_uasmon; const char *verb; @@ -1145,11 +1098,9 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */ * Stormbringer it's "killed by Stormbringer" instead of "killed by an orc". */ boolean -artifact_hit(magr, mdef, otmp, dmgptr, dieroll) -struct monst *magr, *mdef; -struct obj *otmp; -int *dmgptr; -int dieroll; /* needed for Magicbane and vorpal blades */ +artifact_hit(struct monst *magr, struct monst *mdef, struct obj *otmp, + int *dmgptr, + int dieroll) /* needed for Magicbane and vorpal blades */ { boolean youattack = (magr == &g.youmonst); boolean youdefend = (mdef == &g.youmonst); @@ -1414,8 +1365,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */ /* getobj callback for object to be invoked */ static int -invoke_ok(obj) -struct obj *obj; +invoke_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -1437,7 +1387,7 @@ struct obj *obj; /* the #invoke command */ int -doinvoke() +doinvoke(void) { struct obj *obj; @@ -1450,8 +1400,7 @@ doinvoke() } static int -arti_invoke(obj) -struct obj *obj; +arti_invoke(struct obj *obj) { register const struct artifact *oart = get_artifact(obj); if (!obj) { @@ -1697,8 +1646,7 @@ struct obj *obj; /* will freeing this object from inventory cause levitation to end? */ boolean -finesse_ahriman(obj) -struct obj *obj; +finesse_ahriman(struct obj *obj) { const struct artifact *oart; struct prop save_Lev; @@ -1725,16 +1673,14 @@ struct obj *obj; /* WAC return TRUE if artifact is always lit */ boolean -artifact_light(obj) -struct obj *obj; +artifact_light(struct obj *obj) { return (boolean) (get_artifact(obj) && obj->oartifact == ART_SUNSWORD); } /* KMH -- Talking artifacts are finally implemented */ void -arti_speak(obj) -struct obj *obj; +arti_speak(struct obj *obj) { register const struct artifact *oart = get_artifact(obj); const char *line; @@ -1753,9 +1699,7 @@ struct obj *obj; } boolean -artifact_has_invprop(otmp, inv_prop) -struct obj *otmp; -uchar inv_prop; +artifact_has_invprop(struct obj *otmp, uchar inv_prop) { const struct artifact *arti = get_artifact(otmp); @@ -1764,8 +1708,7 @@ uchar inv_prop; /* Return the price sold to the hero of a given artifact or unique item */ long -arti_cost(otmp) -struct obj *otmp; +arti_cost(struct obj *otmp) { if (!otmp->oartifact) return (long) objects[otmp->otyp].oc_cost; @@ -1776,8 +1719,7 @@ struct obj *otmp; } static uchar -abil_to_adtyp(abil) -long *abil; +abil_to_adtyp(long *abil) { struct abil2adtyp_tag { long *abil; @@ -1801,8 +1743,7 @@ long *abil; } static unsigned long -abil_to_spfx(abil) -long *abil; +abil_to_spfx(long *abil) { static const struct abil2spfx_tag { long *abil; @@ -1834,8 +1775,7 @@ long *abil; * Return the first item that is conveying a particular intrinsic. */ struct obj * -what_gives(abil) -long *abil; +what_gives(long *abil) { struct obj *obj; uchar dtyp; @@ -1882,8 +1822,7 @@ long *abil; } const char * -glow_color(arti_indx) -int arti_indx; +glow_color(int arti_indx) { int colornum = artilist[arti_indx].acolor; const char *colorstr = clr2colorname(colornum); @@ -1898,8 +1837,7 @@ static const char *glow_verbs[] = { /* relative strength that Sting is glowing (0..3), to select verb */ static int -glow_strength(count) -int count; +glow_strength(int count) { /* glow strength should also be proportional to proximity and probably difficulty, but we don't have that information and @@ -1908,9 +1846,8 @@ int count; } const char * -glow_verb(count, ingsfx) -int count; /* 0 means blind rather than no applicable creatures */ -boolean ingsfx; +glow_verb(int count, /* 0 means blind rather than no applicable creatures */ + boolean ingsfx) { static char resbuf[20]; @@ -1924,8 +1861,7 @@ boolean ingsfx; /* use for warning "glow" for Sting, Orcrist, and Grimtooth */ void -Sting_effects(orc_count) -int orc_count; /* new count (warn_obj_cnt is old count); -1 is a flag value */ +Sting_effects(int orc_count) /* new count (warn_obj_cnt is old count); -1 is a flag value */ { if (uwep && (uwep->oartifact == ART_STING @@ -1966,9 +1902,8 @@ int orc_count; /* new count (warn_obj_cnt is old count); -1 is a flag value */ after undergoing a transformation (alignment change, lycanthropy, polymorph) which might affect item access */ int -retouch_object(objp, loseit) -struct obj **objp; /* might be destroyed or unintentionally dropped */ -boolean loseit; /* whether to drop it if hero can longer touch it */ +retouch_object(struct obj **objp, /* might be destroyed or unintentionally dropped */ + boolean loseit) /* whether to drop it if hero can longer touch it */ { struct obj *obj = *objp; @@ -2042,9 +1977,7 @@ boolean loseit; /* whether to drop it if hero can longer touch it */ currently in operation undergoes a touch test; if it fails, it will be unworn/unwielded and revoked but not dropped */ static boolean -untouchable(obj, drop_untouchable) -struct obj *obj; -boolean drop_untouchable; +untouchable(struct obj *obj, boolean drop_untouchable) { struct artifact *art; boolean beingworn, carryeffect, invoked; @@ -2081,8 +2014,7 @@ boolean drop_untouchable; /* check all items currently in use (mostly worn) for touchability */ void -retouch_equipment(dropflag) -int dropflag; /* 0==don't drop, 1==drop all, 2==drop weapon */ +retouch_equipment(int dropflag) /* 0==don't drop, 1==drop all, 2==drop weapon */ { static int nesting = 0; /* recursion control */ struct obj *obj; @@ -2149,8 +2081,7 @@ int dropflag; /* 0==don't drop, 1==drop all, 2==drop weapon */ } static int -count_surround_traps(x, y) -int x, y; +count_surround_traps(int x, int y) { struct rm *levp; struct obj *otmp; @@ -2195,7 +2126,7 @@ int x, y; /* sense adjacent traps if wielding MKoT without wearing gloves */ void -mkot_trap_warn() +mkot_trap_warn(void) { static const char *const heat[7] = { "cool", "slightly warm", "warm", "very warm", @@ -2217,9 +2148,8 @@ mkot_trap_warn() /* Master Key is magic key if its bless/curse state meets our criteria: not cursed for rogues or blessed for non-rogues */ boolean -is_magic_key(mon, obj) -struct monst *mon; /* if null, non-rogue is assumed */ -struct obj *obj; +is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */ + struct obj *obj) { if (((obj && obj->oartifact == ART_MASTER_KEY_OF_THIEVERY) && ((mon == &g.youmonst) ? Role_if(PM_ROGUE) @@ -2231,8 +2161,7 @@ struct obj *obj; /* figure out whether 'mon' (usually youmonst) is carrying the magic key */ struct obj * -has_magic_key(mon) -struct monst *mon; /* if null, hero assumed */ +has_magic_key(struct monst *mon) /* if null, hero assumed */ { struct obj *o; short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp; diff --git a/src/attrib.c b/src/attrib.c index 759296702..6bc92b3c1 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -103,17 +103,15 @@ static const struct innate { hum_abil[] = { { 0, 0, 0, 0 } }; -static void NDECL(exerper); -static void FDECL(postadjabil, (long *)); -static const struct innate *FDECL(role_abil, (int)); -static const struct innate *FDECL(check_innate_abil, (long *, long)); -static int FDECL(innately, (long *)); +static void exerper(void); +static void postadjabil(long *); +static const struct innate *role_abil(int); +static const struct innate *check_innate_abil(long *, long); +static int innately(long *); /* adjust an attribute; return TRUE if change is made, FALSE otherwise */ boolean -adjattrib(ndx, incr, msgflg) -int ndx, incr; -int msgflg; /* positive => no message, zero => message, and */ +adjattrib(int ndx, int incr, int msgflg) /* positive => no message, zero => message, and */ { /* negative => conditional (msg if change made) */ int old_acurr, old_abase, old_amax, decr; boolean abonflg; @@ -192,10 +190,7 @@ int msgflg; /* positive => no message, zero => message, and */ } void -gainstr(otmp, incr, givemsg) -struct obj *otmp; -int incr; -boolean givemsg; +gainstr(struct obj *otmp, int incr, boolean givemsg) { int num = incr; @@ -213,8 +208,7 @@ boolean givemsg; /* may kill you; cause may be poison or monster like 'a' */ void -losestr(num) -register int num; +losestr(int num) { int ustr = ABASE(A_STR) - num; @@ -233,7 +227,7 @@ register int num; } static const struct poison_effect_message { - void VDECL((*delivery_func), (const char *, ...)); + void (*delivery_func)(const char *, ...); const char *effect_msg; } poiseff[] = { { You_feel, "weaker" }, /* A_STR */ @@ -246,11 +240,10 @@ static const struct poison_effect_message { /* feedback for attribute loss due to poisoning */ void -poisontell(typ, exclaim) -int typ; /* which attribute */ -boolean exclaim; /* emphasis */ +poisontell(int typ, /* which attribute */ + boolean exclaim) /* emphasis */ { - void VDECL((*func), (const char *, ...)) = poiseff[typ].delivery_func; + void (*func)(const char *, ...) = poiseff[typ].delivery_func; const char *msg_txt = poiseff[typ].effect_msg; /* @@ -270,11 +263,11 @@ boolean exclaim; /* emphasis */ /* called when an attack or trap has poisoned hero (used to be in mon.c) */ void -poisoned(reason, typ, pkiller, fatal, thrown_weapon) -const char *reason, /* controls what messages we display */ - *pkiller; /* for score+log file if fatal */ -int typ, fatal; /* if fatal is 0, limit damage to adjattrib */ -boolean thrown_weapon; /* thrown weapons are less deadly */ +poisoned(const char *reason, /* controls what messages we display */ + int typ, + const char *pkiller, /* for score+log file if fatal */ + int fatal, /* if fatal is 0, limit damage to adjattrib */ + boolean thrown_weapon) /* thrown weapons are less deadly */ { int i, loss, kprefix = KILLED_BY_AN; boolean blast = !strcmp(reason, "blast"); @@ -342,8 +335,7 @@ boolean thrown_weapon; /* thrown weapons are less deadly */ } void -change_luck(n) -register schar n; +change_luck(schar n) { u.uluck += n; if (u.uluck < 0 && u.uluck < LUCKMIN) @@ -353,8 +345,7 @@ register schar n; } int -stone_luck(parameter) -boolean parameter; /* So I can't think up of a good name. So sue me. --KAA */ +stone_luck(boolean parameter) /* So I can't think up of a good name. So sue me. --KAA */ { register struct obj *otmp; register long bonchance = 0; @@ -374,7 +365,7 @@ boolean parameter; /* So I can't think up of a good name. So sue me. --KAA */ /* there has just been an inventory change affecting a luck-granting item */ void -set_moreluck() +set_moreluck(void) { int luckbon = stone_luck(TRUE); @@ -387,7 +378,7 @@ set_moreluck() } void -restore_attrib() +restore_attrib(void) { int i, equilibrium;; @@ -415,9 +406,7 @@ restore_attrib() #define AVAL 50 /* tune value for exercise gains */ void -exercise(i, inc_or_dec) -int i; -boolean inc_or_dec; +exercise(int i, boolean inc_or_dec) { debugpline0("Exercise:"); if (i == A_INT || i == A_CHA) @@ -449,7 +438,7 @@ boolean inc_or_dec; } static void -exerper() +exerper(void) { if (!(g.moves % 10)) { /* Hunger Checks */ @@ -529,7 +518,7 @@ static NEARDATA const char *const exertext[A_MAX][2] = { }; void -exerchk() +exerchk(void) { int i, ax, mod_val, lolim, hilim; @@ -616,8 +605,7 @@ exerchk() } void -init_attr(np) -register int np; +init_attr(int np) { register int i, x, tryct; @@ -666,7 +654,7 @@ register int np; } void -redist_attr() +redist_attr(void) { register int i, tmp; @@ -690,8 +678,7 @@ redist_attr() static void -postadjabil(ability) -long *ability; +postadjabil(long *ability) { if (!ability) return; @@ -700,8 +687,7 @@ long *ability; } static const struct innate * -role_abil(r) -int r; +role_abil(int r) { const struct { short role; @@ -730,9 +716,7 @@ int r; } static const struct innate * -check_innate_abil(ability, frommask) -long *ability; -long frommask; +check_innate_abil(long *ability, long frommask) { const struct innate *abil = 0; @@ -778,8 +762,7 @@ long frommask; /* check whether particular ability has been obtained via innate attribute */ static int -innately(ability) -long *ability; +innately(long *ability) { const struct innate *iptr; @@ -795,8 +778,7 @@ long *ability; } int -is_innate(propidx) -int propidx; +is_innate(int propidx) { int innateness; @@ -818,8 +800,7 @@ int propidx; } char * -from_what(propidx) -int propidx; /* special cases can have negative values */ +from_what(int propidx) /* special cases can have negative values */ { static char buf[BUFSZ]; @@ -911,8 +892,7 @@ int propidx; /* special cases can have negative values */ } void -adjabil(oldlevel, newlevel) -int oldlevel, newlevel; +adjabil(int oldlevel, int newlevel) { register const struct innate *abil, *rabil; long prevabil, mask = FROMEXPER; @@ -983,7 +963,7 @@ int oldlevel, newlevel; } int -newhp() +newhp(void) { int hp, conplus; @@ -1038,8 +1018,7 @@ newhp() } schar -acurr(x) -int x; +acurr(int x) { register int tmp = (u.abon.a[x] + u.atemp.a[x] + u.acurr.a[x]); @@ -1077,7 +1056,7 @@ int x; /* condense clumsy ACURR(A_STR) value into value that fits into game formulas */ schar -acurrstr() +acurrstr(void) { register int str = ACURR(A_STR); @@ -1093,8 +1072,7 @@ acurrstr() to distinguish between observable +0 result and no-visible-effect due to an attribute not being able to exceed maximum or minimum */ boolean -extremeattr(attrindx) /* does attrindx's value match its max or min? */ -int attrindx; +extremeattr(int attrindx) /* does attrindx's value match its max or min? */ { /* Fixed_abil and racial MINATTR/MAXATTR aren't relevant here */ int lolimit = 3, hilimit = 25, curval = ACURR(attrindx); @@ -1123,8 +1101,7 @@ int attrindx; /* avoid possible problems with alignment overflow, and provide a centralized location for any future alignment limits */ void -adjalign(n) -int n; +adjalign(int n) { int newalign = u.ualign.record + n; @@ -1140,9 +1117,8 @@ int n; /* change hero's alignment type, possibly losing use of artifacts */ void -uchangealign(newalign, reason) -int newalign; -int reason; /* 0==conversion, 1==helm-of-OA on, 2==helm-of-OA off */ +uchangealign(int newalign, + int reason) /* 0==conversion, 1==helm-of-OA on, 2==helm-of-OA off */ { aligntyp oldalign = u.ualign.type; diff --git a/src/ball.c b/src/ball.c index 6eeafe6fa..94428e9cb 100644 --- a/src/ball.c +++ b/src/ball.c @@ -8,11 +8,11 @@ #include "hack.h" -static int NDECL(bc_order); -static void NDECL(litter); -static void NDECL(placebc_core); -static void NDECL(unplacebc_core); -static boolean FDECL(check_restriction, (int)); +static int bc_order(void); +static void litter(void); +static void placebc_core(void); +static void unplacebc_core(void); +static boolean check_restriction(int); static int bcrestriction = 0; #ifdef BREADCRUMBS @@ -20,8 +20,7 @@ static struct breadcrumbs bcpbreadcrumbs = {0}, bcubreadcrumbs = {0}; #endif void -ballrelease(showmsg) -boolean showmsg; +ballrelease(boolean showmsg) { if (carried(uball)) { if (showmsg) @@ -41,7 +40,7 @@ boolean showmsg; /* ball&chain might hit hero when falling through a trap door */ void -ballfall() +ballfall(void) { boolean gets_hit; @@ -115,7 +114,7 @@ ballfall() * Should not be called while swallowed except on waterlevel. */ static void -placebc_core() +placebc_core(void) { if (!uchain || !uball) { impossible("Where are your ball and chain?"); @@ -142,7 +141,7 @@ placebc_core() } static void -unplacebc_core() +unplacebc_core(void) { if (u.uswallow) { if (Is_waterlevel(&u.uz)) { @@ -175,8 +174,7 @@ unplacebc_core() } static boolean -check_restriction(restriction) -int restriction; +check_restriction(int restriction) { boolean ret = FALSE; @@ -189,7 +187,7 @@ int restriction; #ifndef BREADCRUMBS void -placebc() +placebc(void) { if (!check_restriction(0)) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) @@ -208,7 +206,7 @@ placebc() } void -unplacebc() +unplacebc(void) { if (bcrestriction) { impossible("unplacebc denied, restriction in place"); @@ -218,7 +216,7 @@ unplacebc() } int -unplacebc_and_covet_placebc() +unplacebc_and_covet_placebc(void) { int restriction = 0; @@ -232,8 +230,7 @@ unplacebc_and_covet_placebc() } void -lift_covet_and_placebc(pin) -int pin; +lift_covet_and_placebc(int pin) { if (!check_restriction(pin)) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) @@ -256,9 +253,7 @@ int pin; #else /* BREADCRUMBS */ void -Placebc(funcnm, linenum) -const char *funcnm; -int linenum; +Placebc(const char *funcnm, int linenum) { if (!check_restriction(0)) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) @@ -286,9 +281,7 @@ int linenum; } void -Unplacebc(funcnm, linenum) -const char *funcnm; -int linenum; +Unplacebc(const char *funcnm, int linenum) { if (bcrestriction) { @@ -307,9 +300,7 @@ int linenum; } int -Unplacebc_and_covet_placebc(funcnm, linenum) -const char *funcnm; -int linenum; +Unplacebc_and_covet_placebc(const char *funcnm, int linenum) { int restriction = 0; @@ -330,10 +321,7 @@ int linenum; } void -Lift_covet_and_placebc(pin, funcnm, linenum) -int pin; -char *funcnm; -int linenum; +Lift_covet_and_placebc(int pin, char *funcnm, int linenum) { if (!check_restriction(pin)) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) @@ -360,7 +348,7 @@ int linenum; * hero is being punished. */ static int -bc_order() +bc_order(void) { struct obj *obj; @@ -386,8 +374,7 @@ bc_order() * Set up the ball and chain variables so that the ball and chain are "felt". */ void -set_bc(already_blind) -int already_blind; +set_bc(int already_blind) { int ball_on_floor = !carried(uball); @@ -444,9 +431,8 @@ int already_blind; * Should not be called while swallowed. */ void -move_bc(before, control, ballx, bally, chainx, chainy) -int before, control; -xchar ballx, bally, chainx, chainy; /* only matter !before */ +move_bc(int before, int control, xchar ballx, xchar bally, + xchar chainx, xchar chainy) { if (Blind) { /* @@ -568,13 +554,9 @@ xchar ballx, bally, chainx, chainy; /* only matter !before */ /* return TRUE if the caller needs to place the ball and chain down again */ boolean -drag_ball(x, y, bc_control, ballx, bally, chainx, chainy, cause_delay, - allow_drag) -xchar x, y; -int *bc_control; -xchar *ballx, *bally, *chainx, *chainy; -boolean *cause_delay; -boolean allow_drag; +drag_ball(xchar x, xchar y, int *bc_control, + xchar *ballx, xchar *bally, xchar *chainx, xchar *chainy, + boolean *cause_delay, boolean allow_drag) { struct trap *t = (struct trap *) 0; boolean already_in_rock; @@ -893,8 +875,7 @@ boolean allow_drag; * Should not be called while swallowed. */ void -drop_ball(x, y) -xchar x, y; +drop_ball(xchar x, xchar y) { if (Blind) { /* get the order */ @@ -976,7 +957,7 @@ xchar x, y; /* ball&chain cause hero to randomly lose stuff from inventory */ static void -litter() +litter(void) { struct obj *otmp, *nextobj = 0; int capacity = weight_cap(); @@ -997,7 +978,7 @@ litter() } void -drag_down() +drag_down(void) { boolean forward; uchar dragchance = 3; @@ -1044,7 +1025,7 @@ drag_down() } void -bc_sanity_check() +bc_sanity_check(void) { int otyp, freeball, freechain; const char *onam; diff --git a/src/bones.c b/src/bones.c index d497343f4..08bb5f0f9 100644 --- a/src/bones.c +++ b/src/bones.c @@ -5,14 +5,13 @@ #include "hack.h" -static boolean FDECL(no_bones_level, (d_level *)); -static void FDECL(goodfruit, (int)); -static void FDECL(resetobjs, (struct obj *, BOOLEAN_P)); -static boolean FDECL(fixuporacle, (struct monst *)); +static boolean no_bones_level(d_level *); +static void goodfruit(int); +static void resetobjs(struct obj *, boolean); +static boolean fixuporacle(struct monst *); static boolean -no_bones_level(lev) -d_level *lev; +no_bones_level(d_level *lev) { s_level *sptr; @@ -36,8 +35,7 @@ d_level *lev; * chain of fruit types, we know to only save the types that exist. */ static void -goodfruit(id) -int id; +goodfruit(int id) { struct fruit *f = fruit_from_indx(-id); @@ -46,9 +44,7 @@ int id; } static void -resetobjs(ochain, restore) -struct obj *ochain; -boolean restore; +resetobjs(struct obj *ochain, boolean restore) { struct obj *otmp, *nobj; @@ -193,8 +189,7 @@ boolean restore; /* while loading bones, strip out text possibly supplied by old player that might accidentally or maliciously disrupt new player's display */ void -sanitize_name(namebuf) -char *namebuf; +sanitize_name(char *namebuf) { int c; boolean strip_8th_bit = (WINDOWPORT("tty") @@ -220,10 +215,9 @@ char *namebuf; /* called by savebones(); also by finish_paybill(shk.c) */ void -drop_upon_death(mtmp, cont, x, y) -struct monst *mtmp; /* monster if hero turned into one (other than ghost) */ -struct obj *cont; /* container if hero is turned into a statue */ -int x, y; +drop_upon_death(struct monst *mtmp, /* monster if hero turned into one (other than ghost) */ + struct obj *cont, /* container if hero is turned into a statue */ + int x, int y) { struct obj *otmp; @@ -265,8 +259,7 @@ int x, y; /* possibly restore oracle's room and/or put her back inside it; returns False if she's on the wrong level and should be removed, True otherwise */ static boolean -fixuporacle(oracle) -struct monst *oracle; +fixuporacle(struct monst *oracle) { coord cc; int ridx, o_ridx; @@ -314,7 +307,7 @@ struct monst *oracle; /* check whether bones are feasible */ boolean -can_make_bones() +can_make_bones(void) { register struct trap *ttmp; @@ -347,10 +340,7 @@ can_make_bones() /* save bones and possessions of a deceased adventurer */ void -savebones(how, when, corpse) -int how; -time_t when; -struct obj *corpse; +savebones(int how, time_t when, struct obj *corpse) { int x, y; struct trap *ttmp; @@ -545,7 +535,7 @@ struct obj *corpse; } int -getbones() +getbones(void) { int ok; NHFILE *nhfp = (NHFILE *) 0; @@ -658,8 +648,7 @@ getbones() /* check whether current level contains bones from a particular player */ boolean -bones_include_name(name) -const char *name; +bones_include_name(const char *name) { struct cemetery *bp; int len; diff --git a/src/botl.c b/src/botl.c index 413f912ce..4a2c8e26b 100644 --- a/src/botl.c +++ b/src/botl.c @@ -13,18 +13,18 @@ extern const char *hu_stat[]; /* defined in eat.c */ const char *const enc_stat[] = { "", "Burdened", "Stressed", "Strained", "Overtaxed", "Overloaded" }; -static const char *NDECL(rank); -static void NDECL(bot_via_windowport); -static void NDECL(stat_update_time); +static const char *rank(void); +static void bot_via_windowport(void); +static void stat_update_time(void); #ifdef STATUS_HILITES -static unsigned long NDECL(query_conditions); -static boolean FDECL(status_hilite_remove, (int)); -static boolean FDECL(status_hilite_menu_fld, (int)); -static void NDECL(status_hilites_viewall); +static unsigned long query_conditions(void); +static boolean status_hilite_remove(int); +static boolean status_hilite_menu_fld(int); +static void status_hilites_viewall(void); #endif static char * -get_strength_str() +get_strength_str(void) { static char buf[32]; int st = ACURR(A_STR); @@ -43,7 +43,7 @@ get_strength_str() } void -check_gold_symbol() +check_gold_symbol(void) { nhsym goldch = g.showsyms[COIN_CLASS + SYM_OFF_O]; @@ -51,7 +51,7 @@ check_gold_symbol() } char * -do_statusline1() +do_statusline1(void) { static char newbot1[BUFSZ]; register char *nb; @@ -100,7 +100,7 @@ do_statusline1() } char * -do_statusline2() +do_statusline2(void) { static char newbot2[BUFSZ], /* MAXCO: botl.h */ /* dungeon location (and gold), hero health (HP, PW, AC), @@ -239,7 +239,7 @@ do_statusline2() } void -bot() +bot(void) { /* dosave() flags completion by setting u.uhp to -1 */ if (u.uhp != -1 && g.youmonst.data && iflags.status_updates @@ -257,7 +257,7 @@ bot() } void -timebot() +timebot(void) { if (flags.time && iflags.status_updates && !g.program_state.saving && !g.program_state.restoring) { @@ -273,8 +273,7 @@ timebot() /* convert experience level (1..30) to rank index (0..8) */ int -xlev_to_rank(xlev) -int xlev; +xlev_to_rank(int xlev) { /* * 1..2 => 0 @@ -291,8 +290,7 @@ int xlev; /* convert rank index (0..8) to experience level (1..30) */ int -rank_to_xlev(rank) -int rank; +rank_to_xlev(int rank) { /* * 0 => 1..2 @@ -309,10 +307,7 @@ int rank; } const char * -rank_of(lev, monnum, female) -int lev; -short monnum; -boolean female; +rank_of(int lev, short monnum, boolean female) { register const struct Role *role; register int i; @@ -341,15 +336,13 @@ boolean female; } static const char * -rank() +rank(void) { return rank_of(u.ulevel, Role_switch, flags.female); } int -title_to_mon(str, rank_indx, title_length) -const char *str; -int *rank_indx, *title_length; +title_to_mon(const char *str, int *rank_indx, int *title_length) { register int i, j; @@ -384,7 +377,7 @@ int *rank_indx, *title_length; } void -max_rank_sz() +max_rank_sz(void) { register int i, r, maxr = 0; for (i = 0; i < 9; i++) { @@ -399,7 +392,7 @@ max_rank_sz() #ifdef SCORE_ON_BOTL long -botl_score() +botl_score(void) { long deepest = deepest_lev_reached(FALSE); long utotal; @@ -418,8 +411,7 @@ botl_score() /* provide the name of the current level for display by various ports */ int -describe_level(buf) -char *buf; +describe_level(char *buf) { int ret = 1; @@ -450,51 +442,48 @@ char *buf; #ifdef STATUS_HILITES #endif /* STATUS_HILITES */ -static boolean FDECL(eval_notify_windowport_field, (int, boolean *, int)); -static void FDECL(evaluate_and_notify_windowport, (boolean *, int)); -static void NDECL(init_blstats); -static int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); -static char *FDECL(anything_to_s, (char *, anything *, int)); -static int FDECL(percentage, (struct istat_s *, struct istat_s *)); -static int NDECL(exp_percentage); -static int FDECL(CFDECLSPEC cond_cmp, (const genericptr, const genericptr)); -static int FDECL(CFDECLSPEC menualpha_cmp, (const genericptr, const genericptr)); +static boolean eval_notify_windowport_field(int, boolean *, int); +static void evaluate_and_notify_windowport(boolean *, int); +static void init_blstats(void); +static int compare_blstats(struct istat_s *, struct istat_s *); +static char *anything_to_s(char *, anything *, int); +static int percentage(struct istat_s *, struct istat_s *); +static int exp_percentage(void); +static int CFDECLSPEC cond_cmp(const genericptr, const genericptr); +static int CFDECLSPEC menualpha_cmp(const genericptr, const genericptr); #ifdef STATUS_HILITES -static void FDECL(s_to_anything, (anything *, char *, int)); -static enum statusfields FDECL(fldname_to_bl_indx, (const char *)); -static boolean FDECL(hilite_reset_needed, (struct istat_s *, long)); -static boolean FDECL(noneoftheabove, (const char *)); -static struct hilite_s *FDECL(get_hilite, (int, int, genericptr_t, - int, int, int *)); -static void FDECL(split_clridx, (int, int *, int *)); -static boolean FDECL(is_ltgt_percentnumber, (const char *)); -static boolean FDECL(has_ltgt_percentnumber, (const char *)); -static int FDECL(splitsubfields, (char *, char ***, int)); -static boolean FDECL(is_fld_arrayvalues, (const char *, - const char *const *, - int, int, int *)); -static int FDECL(query_arrayvalue, (const char *, const char *const *, - int, int)); -static void FDECL(status_hilite_add_threshold, (int, struct hilite_s *)); -static boolean FDECL(parse_status_hl2, (char (*)[QBUFSZ], BOOLEAN_P)); -static char *FDECL(conditionbitmask2str, (unsigned long)); -static unsigned long FDECL(match_str2conditionbitmask, (const char *)); -static unsigned long FDECL(str2conditionbitmask, (char *)); -static boolean FDECL(parse_condition, (char (*)[QBUFSZ], int)); -static char *FDECL(hlattr2attrname, (int, char *, int)); -static void FDECL(status_hilite_linestr_add, (int, struct hilite_s *, - unsigned long, const char *)); -static void NDECL(status_hilite_linestr_done); -static int FDECL(status_hilite_linestr_countfield, (int)); -static void NDECL(status_hilite_linestr_gather_conditions); -static void NDECL(status_hilite_linestr_gather); -static char *FDECL(status_hilite2str, (struct hilite_s *)); -static int NDECL(status_hilite_menu_choose_field); -static int FDECL(status_hilite_menu_choose_behavior, (int)); -static int FDECL(status_hilite_menu_choose_updownboth, (int, const char *, - BOOLEAN_P, BOOLEAN_P)); -static boolean FDECL(status_hilite_menu_add, (int)); +static void s_to_anything(anything *, char *, int); +static enum statusfields fldname_to_bl_indx(const char *); +static boolean hilite_reset_needed(struct istat_s *, long); +static boolean noneoftheabove(const char *); +static struct hilite_s *get_hilite(int, int, genericptr_t, int, int, int *); +static void split_clridx(int, int *, int *); +static boolean is_ltgt_percentnumber(const char *); +static boolean has_ltgt_percentnumber(const char *); +static int splitsubfields(char *, char ***, int); +static boolean is_fld_arrayvalues(const char *, const char *const *, int, int, + int *); +static int query_arrayvalue(const char *, const char *const *, int, int); +static void status_hilite_add_threshold(int, struct hilite_s *); +static boolean parse_status_hl2(char (*)[QBUFSZ], boolean); +static char *conditionbitmask2str(unsigned long); +static unsigned long match_str2conditionbitmask(const char *); +static unsigned long str2conditionbitmask(char *); +static boolean parse_condition(char (*)[QBUFSZ], int); +static char *hlattr2attrname(int, char *, int); +static void status_hilite_linestr_add(int, struct hilite_s *, unsigned long, + const char *); +static void status_hilite_linestr_done(void); +static int status_hilite_linestr_countfield(int); +static void status_hilite_linestr_gather_conditions(void); +static void status_hilite_linestr_gather(void); +static char *status_hilite2str(struct hilite_s *); +static int status_hilite_menu_choose_field(void); +static int status_hilite_menu_choose_behavior(int); +static int status_hilite_menu_choose_updownboth(int, const char *, boolean, + boolean); +static boolean status_hilite_menu_add(int); #define has_hilite(i) (g.blstats[0][(i)].thresholds) /* TH_UPDOWN encompasses specific 'up' and 'down' also general 'changed' */ #define Is_Temp_Hilite(rule) ((rule) && (rule)->behavior == BL_TH_UPDOWN) @@ -694,7 +683,7 @@ do { \ */ static void -bot_via_windowport() +bot_via_windowport(void) { char buf[BUFSZ]; const char *titl; @@ -952,7 +941,7 @@ bot_via_windowport() /* update just the status lines' 'time' field */ static void -stat_update_time() +stat_update_time(void) { int idx = g.now_or_before_idx; /* no 0/1 toggle */ int fld = BL_TIME; @@ -970,10 +959,7 @@ stat_update_time() /* deal with player's choice to change processing of a condition */ void -condopt(idx, addr, negated) -int idx; -boolean *addr; -boolean negated; +condopt(int idx, boolean *addr, boolean negated) { int i; @@ -1004,9 +990,7 @@ boolean negated; /* qsort callback routine for sorting the condition index */ static int CFDECLSPEC -cond_cmp(vptr1, vptr2) -const genericptr vptr1; -const genericptr vptr2; +cond_cmp(const genericptr vptr1, const genericptr vptr2) { int indx1 = *(int *) vptr1, indx2 = *(int *) vptr2, c1 = conditions[indx1].ranking, c2 = conditions[indx2].ranking; @@ -1019,9 +1003,7 @@ const genericptr vptr2; /* qsort callback routine for alphabetical sorting of index */ static int CFDECLSPEC -menualpha_cmp(vptr1, vptr2) -const genericptr vptr1; -const genericptr vptr2; +menualpha_cmp(const genericptr vptr1, const genericptr vptr2) { int indx1 = *(int *) vptr1, indx2 = *(int *) vptr2; @@ -1029,9 +1011,7 @@ const genericptr vptr2; } int -parse_cond_option(negated, opts) -boolean negated; -char *opts; +parse_cond_option(boolean negated, char *opts) { int i; size_t sl; @@ -1052,7 +1032,7 @@ char *opts; } void -cond_menu(VOID_ARGS) +cond_menu(void) { static const char *menutitle[2] = { "alphabetically", "by ranking"}; int i, res, idx = 0; @@ -1129,9 +1109,7 @@ cond_menu(VOID_ARGS) } static boolean -eval_notify_windowport_field(fld, valsetlist, idx) -int fld, idx; -boolean *valsetlist; +eval_notify_windowport_field(int fld, boolean *valsetlist, int idx) { static int oldrndencode = 0; static nhsym oldgoldsym = 0; @@ -1252,9 +1230,7 @@ boolean *valsetlist; } static void -evaluate_and_notify_windowport(valsetlist, idx) -int idx; -boolean *valsetlist; +evaluate_and_notify_windowport(boolean *valsetlist, int idx) { int i, updated = 0, notpresent = 0; @@ -1309,8 +1285,7 @@ boolean *valsetlist; } void -status_initialize(reassessment) -boolean reassessment; /* TRUE: just recheck fields w/o other initialization */ +status_initialize(boolean reassessment) /* TRUE: just recheck fields w/o other initialization */ { enum statusfields fld; boolean fldenabl; @@ -1345,7 +1320,7 @@ boolean reassessment; /* TRUE: just recheck fields w/o other initialization */ } void -status_finish() +status_finish(void) { int i; @@ -1377,7 +1352,7 @@ status_finish() } static void -init_blstats() +init_blstats(void) { static boolean initalready = FALSE; int i, j; @@ -1426,8 +1401,7 @@ init_blstats() * */ static int -compare_blstats(bl1, bl2) -struct istat_s *bl1, *bl2; +compare_blstats(struct istat_s *bl1, struct istat_s*bl2) { int anytype, result = 0; @@ -1499,10 +1473,7 @@ struct istat_s *bl1, *bl2; } static char * -anything_to_s(buf, a, anytype) -char *buf; -anything *a; -int anytype; +anything_to_s(char *buf, anything *a, int anytype) { if (!buf) return (char *) 0; @@ -1546,10 +1517,7 @@ int anytype; #ifdef STATUS_HILITES static void -s_to_anything(a, buf, anytype) -anything *a; -char *buf; -int anytype; +s_to_anything(anything *a, char *buf, int anytype) { if (!buf || !a) return; @@ -1595,8 +1563,7 @@ int anytype; #endif /* STATUS_HILITES */ static int -percentage(bl, maxbl) -struct istat_s *bl, *maxbl; +percentage(struct istat_s *bl, struct istat_s *maxbl) { int result = 0; int anytype; @@ -1662,7 +1629,7 @@ struct istat_s *bl, *maxbl; /* percentage for both xp (level) and exp (points) is the percentage for (curr_exp - this_level_start) in (next_level_start - this_level_start) */ static int -exp_percentage() +exp_percentage(void) { int res = 0; @@ -1699,7 +1666,7 @@ exp_percentage() /* experience points have changed but experience level hasn't; decide whether botl update is needed for a different percentage highlight rule for Xp */ boolean -exp_percent_changing() +exp_percent_changing(void) { int pc; anything a; @@ -1740,7 +1707,7 @@ exp_percent_changing() to reconstruct that from the encumbrance string or asking the general core what the value is */ int -stat_cap_indx() +stat_cap_indx(void) { int cap; @@ -1755,7 +1722,7 @@ stat_cap_indx() /* callback so that interface can get hunger index rather than trying to reconstruct that from the hunger string or dipping into core internals */ int -stat_hunger_indx() +stat_hunger_indx(void) { int uhs; @@ -1769,8 +1736,7 @@ stat_hunger_indx() /* used by X11 for "tty status" even when STATUS_HILITES is disabled */ const char * -bl_idx_to_fldname(idx) -int idx; +bl_idx_to_fldname(int idx) { if (idx >= 0 && idx < MAXBLSTATS) return initblstats[idx].fldname; @@ -1818,8 +1784,7 @@ static const char threshold_value[] = "hilite_status threshold ", /* field name to bottom line index */ static enum statusfields -fldname_to_bl_indx(name) -const char *name; +fldname_to_bl_indx(const char *name) { int i, nmatches = 0, fld = 0; @@ -1857,10 +1822,10 @@ const char *name; } static boolean -hilite_reset_needed(bl_p, augmented_time) -struct istat_s *bl_p; -long augmented_time; /* no longer augmented; it once encoded fractional - * amounts for multiple moves within same turn */ +hilite_reset_needed(struct istat_s *bl_p, + long augmented_time) /* no longer augmented; it once + * encoded fractional amounts for + * multiple moves within same turn */ { /* * This 'multi' handling may need some tuning... @@ -1879,7 +1844,7 @@ long augmented_time; /* no longer augmented; it once encoded fractional /* called from moveloop(); sets context.botl if temp hilites have timed out */ void -status_eval_next_unhilite() +status_eval_next_unhilite(void) { int i; struct istat_s *curr; @@ -1920,7 +1885,7 @@ status_eval_next_unhilite() /* called by options handling when 'statushilites' value is changed */ void -reset_status_hilites() +reset_status_hilites(void) { if (iflags.hilite_delta) { int i; @@ -1935,8 +1900,7 @@ reset_status_hilites() /* test whether the text from a title rule matches the string for title-while-polymorphed in the 'textmatch' menu */ static boolean -noneoftheabove(hl_text) -const char *hl_text; +noneoftheabove(const char *hl_text) { if (fuzzymatch(hl_text, "none of the above", "\" -_", TRUE) || fuzzymatch(hl_text, "(polymorphed)", "\"()", TRUE) @@ -1964,10 +1928,8 @@ const char *hl_text; * pointer to rule that applies; Null if no rule does. */ static struct hilite_s * -get_hilite(idx, fldidx, vp, chg, pc, colorptr) -int idx, fldidx, chg, pc; -genericptr_t vp; -int *colorptr; +get_hilite(int idx, int fldidx, genericptr_t vp, int chg, int pc, + int *colorptr) { struct hilite_s *hl, *rule = 0; anything *value = (anything *) vp; @@ -2156,9 +2118,7 @@ int *colorptr; } static void -split_clridx(idx, coloridx, attrib) -int idx; -int *coloridx, *attrib; +split_clridx(int idx, int *coloridx, int *attrib) { if (coloridx) *coloridx = idx & 0x00FF; @@ -2175,9 +2135,7 @@ int *coloridx, *attrib; * and configure the hilite. */ boolean -parse_status_hl1(op, from_configfile) -char *op; -boolean from_configfile; +parse_status_hl1(char *op, boolean from_configfile) { #define MAX_THRESH 21 char hsbuf[MAX_THRESH][QBUFSZ]; @@ -2232,8 +2190,7 @@ boolean from_configfile; /* is str in the format of "[<>]?=?[-+]?[0-9]+%?" regex */ static boolean -is_ltgt_percentnumber(str) -const char *str; +is_ltgt_percentnumber(const char *str) { const char *s = str; @@ -2254,8 +2211,7 @@ const char *str; /* does str only contain "<>=-+0-9%" chars */ static boolean -has_ltgt_percentnumber(str) -const char *str; +has_ltgt_percentnumber(const char *str) { const char *s = str; @@ -2272,10 +2228,7 @@ const char *str; */ #define MAX_SUBFIELDS 16 static int -splitsubfields(str, sfarr, maxsf) -char *str; -char ***sfarr; -int maxsf; +splitsubfields(char *str, char ***sfarr, int maxsf) { static char *subfields[MAX_SUBFIELDS]; char *st = (char *) 0; @@ -2316,11 +2269,8 @@ int maxsf; #undef MAX_SUBFIELDS static boolean -is_fld_arrayvalues(str, arr, arrmin, arrmax, retidx) -const char *str; -const char *const *arr; -int arrmin, arrmax; -int *retidx; +is_fld_arrayvalues(const char *str, const char *const *arr, + int arrmin, int arrmax, int *retidx) { int i; @@ -2333,10 +2283,7 @@ int *retidx; } static int -query_arrayvalue(querystr, arr, arrmin, arrmax) -const char *querystr; -const char *const *arr; -int arrmin, arrmax; +query_arrayvalue(const char *querystr, const char *const *arr, int arrmin, int arrmax) { int i, res, ret = arrmin - 1; winid tmpwin; @@ -2367,9 +2314,7 @@ int arrmin, arrmax; } static void -status_hilite_add_threshold(fld, hilite) -int fld; -struct hilite_s *hilite; +status_hilite_add_threshold(int fld, struct hilite_s *hilite) { struct hilite_s *new_hilite; @@ -2392,9 +2337,7 @@ struct hilite_s *hilite; static boolean -parse_status_hl2(s, from_configfile) -char (*s)[QBUFSZ]; -boolean from_configfile; +parse_status_hl2(char (*s)[QBUFSZ], boolean from_configfile) { char *tmp, *how; int sidx = 0, i = -1, dt = -1; @@ -2681,7 +2624,7 @@ boolean from_configfile; #ifdef STATUS_HILITES static unsigned long -query_conditions() +query_conditions(void) { int i,res; unsigned long ret = 0UL; @@ -2712,8 +2655,7 @@ query_conditions() } static char * -conditionbitmask2str(ul) -unsigned long ul; +conditionbitmask2str(unsigned long ul) { static char buf[BUFSZ]; int i; @@ -2743,8 +2685,7 @@ unsigned long ul; } static unsigned long -match_str2conditionbitmask(str) -const char *str; +match_str2conditionbitmask(const char *str) { int i, nmatches = 0; unsigned long mask = 0UL; @@ -2782,8 +2723,7 @@ const char *str; } static unsigned long -str2conditionbitmask(str) -char *str; +str2conditionbitmask(char *str) { unsigned long conditions_bitmask = 0UL; char **subfields; @@ -2807,9 +2747,7 @@ char *str; } static boolean -parse_condition(s, sidx) -char (*s)[QBUFSZ]; -int sidx; +parse_condition(char (*s)[QBUFSZ], int sidx) { int i; int coloridx = NO_COLOR; @@ -2930,7 +2868,7 @@ int sidx; } void -clear_status_hilites() +clear_status_hilites(void) { int i; @@ -2948,9 +2886,7 @@ clear_status_hilites() } static char * -hlattr2attrname(attrib, buf, bufsz) -int attrib, bufsz; -char *buf; +hlattr2attrname(int attrib, char *buf, int bufsz) { if (attrib && buf) { char attbuf[BUFSZ]; @@ -2995,11 +2931,8 @@ static struct _status_hilite_line_str *status_hilite_str = 0; static int status_hilite_str_id = 0; static void -status_hilite_linestr_add(fld, hl, mask, str) -int fld; -struct hilite_s *hl; -unsigned long mask; -const char *str; +status_hilite_linestr_add(int fld, struct hilite_s *hl, + unsigned long mask, const char *str) { struct _status_hilite_line_str *tmp, *nxt; @@ -3026,7 +2959,7 @@ const char *str; } static void -status_hilite_linestr_done() +status_hilite_linestr_done(void) { struct _status_hilite_line_str *nxt, *tmp = status_hilite_str; @@ -3040,8 +2973,7 @@ status_hilite_linestr_done() } static int -status_hilite_linestr_countfield(fld) -int fld; +status_hilite_linestr_countfield(int fld) { struct _status_hilite_line_str *tmp; boolean countall = (fld == BL_FLUSH); @@ -3056,7 +2988,7 @@ int fld; /* used by options handling, doset(options.c) */ int -count_status_hilites(VOID_ARGS) +count_status_hilites(void) { int count; @@ -3067,7 +2999,7 @@ count_status_hilites(VOID_ARGS) } static void -status_hilite_linestr_gather_conditions() +status_hilite_linestr_gather_conditions(void) { int i; struct _cond_map { @@ -3147,7 +3079,7 @@ status_hilite_linestr_gather_conditions() } static void -status_hilite_linestr_gather() +status_hilite_linestr_gather(void) { int i; struct hilite_s *hl; @@ -3167,8 +3099,7 @@ status_hilite_linestr_gather() static char * -status_hilite2str(hl) -struct hilite_s *hl; +status_hilite2str(struct hilite_s *hl) { static char buf[BUFSZ]; int clr = 0, attr = 0; @@ -3247,7 +3178,7 @@ struct hilite_s *hl; } static int -status_hilite_menu_choose_field() +status_hilite_menu_choose_field(void) { winid tmpwin; int i, res, fld = BL_FLUSH; @@ -3281,8 +3212,7 @@ status_hilite_menu_choose_field() } static int -status_hilite_menu_choose_behavior(fld) -int fld; +status_hilite_menu_choose_behavior(int fld) { winid tmpwin; int res = 0, beh = BL_TH_NONE-1; @@ -3373,10 +3303,8 @@ int fld; } static int -status_hilite_menu_choose_updownboth(fld, str, ltok, gtok) -int fld; -const char *str; -boolean ltok, gtok; +status_hilite_menu_choose_updownboth(int fld, const char *str, + boolean ltok, boolean gtok) { int res, ret = NO_LTEQGT; winid tmpwin; @@ -3451,8 +3379,7 @@ boolean ltok, gtok; } static boolean -status_hilite_menu_add(origfld) -int origfld; +status_hilite_menu_add(int origfld) { int fld; int behavior; @@ -3856,8 +3783,7 @@ choose_color: } static boolean -status_hilite_remove(id) -int id; +status_hilite_remove(int id) { struct _status_hilite_line_str *hlstr = status_hilite_str; @@ -3906,8 +3832,7 @@ int id; } static boolean -status_hilite_menu_fld(fld) -int fld; +status_hilite_menu_fld(int fld) { winid tmpwin; int i, res; @@ -4028,7 +3953,7 @@ shlmenu_free: } static void -status_hilites_viewall() +status_hilites_viewall(void) { winid datawin; struct _status_hilite_line_str *hlstr = status_hilite_str; @@ -4049,7 +3974,7 @@ status_hilites_viewall() } boolean -status_hilite_menu() +status_hilite_menu(void) { winid tmpwin; int i, res; diff --git a/src/cmd.c b/src/cmd.c index c672d6632..cd172b57c 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -43,152 +43,149 @@ static boolean alt_esc = FALSE; #define CMD_CLICKLOOK (char) 0x8F #ifdef DUMB /* stuff commented out in extern.h, but needed here */ -extern int NDECL(doapply); /**/ -extern int NDECL(dorub); /**/ -extern int NDECL(dojump); /**/ -extern int NDECL(doextlist); /**/ -extern int NDECL(enter_explore_mode); /**/ -extern int NDECL(dodrop); /**/ -extern int NDECL(doddrop); /**/ -extern int NDECL(dodown); /**/ -extern int NDECL(doup); /**/ -extern int NDECL(donull); /**/ -extern int NDECL(dowipe); /**/ -extern int NDECL(docallcnd); /**/ -extern int NDECL(dotakeoff); /**/ -extern int NDECL(doremring); /**/ -extern int NDECL(dowear); /**/ -extern int NDECL(doputon); /**/ -extern int NDECL(doddoremarm); /**/ -extern int NDECL(dokick); /**/ -extern int NDECL(dofire); /**/ -extern int NDECL(dothrow); /**/ -extern int NDECL(doeat); /**/ -extern int NDECL(done2); /**/ -extern int NDECL(vanquished); /**/ -extern int NDECL(doengrave); /**/ -extern int NDECL(dopickup); /**/ -extern int NDECL(ddoinv); /**/ -extern int NDECL(dotypeinv); /**/ -extern int NDECL(dolook); /**/ -extern int NDECL(doprgold); /**/ -extern int NDECL(doprwep); /**/ -extern int NDECL(doprarm); /**/ -extern int NDECL(doprring); /**/ -extern int NDECL(dopramulet); /**/ -extern int NDECL(doprtool); /**/ -extern int NDECL(dosuspend); /**/ -extern int NDECL(doforce); /**/ -extern int NDECL(doopen); /**/ -extern int NDECL(doclose); /**/ -extern int NDECL(dosh); /**/ -extern int NDECL(dodiscovered); /**/ -extern int NDECL(doclassdisco); /**/ -extern int NDECL(doset); /**/ -extern int NDECL(dotogglepickup); /**/ -extern int NDECL(dowhatis); /**/ -extern int NDECL(doquickwhatis); /**/ -extern int NDECL(dowhatdoes); /**/ -extern int NDECL(dohelp); /**/ -extern int NDECL(dohistory); /**/ -extern int NDECL(doloot); /**/ -extern int NDECL(dodrink); /**/ -extern int NDECL(dodip); /**/ -extern int NDECL(dosacrifice); /**/ -extern int NDECL(dopray); /**/ -extern int NDECL(dotip); /**/ -extern int NDECL(doturn); /**/ -extern int NDECL(doredraw); /**/ -extern int NDECL(doread); /**/ -extern int NDECL(dosave); /**/ -extern int NDECL(dosearch); /**/ -extern int NDECL(doidtrap); /**/ -extern int NDECL(dopay); /**/ -extern int NDECL(dosit); /**/ -extern int NDECL(dotalk); /**/ -extern int NDECL(docast); /**/ -extern int NDECL(dovspell); /**/ -extern int NDECL(dotelecmd); /**/ -extern int NDECL(dountrap); /**/ -extern int NDECL(doversion); /**/ -extern int NDECL(doextversion); /**/ -extern int NDECL(doswapweapon); /**/ -extern int NDECL(dowield); /**/ -extern int NDECL(dowieldquiver); /**/ -extern int NDECL(dozap); /**/ -extern int NDECL(doorganize); /**/ +extern int doapply(void); /**/ +extern int dorub(void); /**/ +extern int dojump(void); /**/ +extern int doextlist(void); /**/ +extern int enter_explore_mode(void); /**/ +extern int dodrop(void); /**/ +extern int doddrop(void); /**/ +extern int dodown(void); /**/ +extern int doup(void); /**/ +extern int donull(void); /**/ +extern int dowipe(void); /**/ +extern int docallcnd(void); /**/ +extern int dotakeoff(void); /**/ +extern int doremring(void); /**/ +extern int dowear(void); /**/ +extern int doputon(void); /**/ +extern int doddoremarm(void); /**/ +extern int dokick(void); /**/ +extern int dofire(void); /**/ +extern int dothrow(void); /**/ +extern int doeat(void); /**/ +extern int done2(void); /**/ +extern int vanquished(void); /**/ +extern int doengrave(void); /**/ +extern int dopickup(void); /**/ +extern int ddoinv(void); /**/ +extern int dotypeinv(void); /**/ +extern int dolook(void); /**/ +extern int doprgold(void); /**/ +extern int doprwep(void); /**/ +extern int doprarm(void); /**/ +extern int doprring(void); /**/ +extern int dopramulet(void); /**/ +extern int doprtool(void); /**/ +extern int dosuspend(void); /**/ +extern int doforce(void); /**/ +extern int doopen(void); /**/ +extern int doclose(void); /**/ +extern int dosh(void); /**/ +extern int dodiscovered(void); /**/ +extern int doclassdisco(void); /**/ +extern int doset(void); /**/ +extern int dotogglepickup(void); /**/ +extern int dowhatis(void); /**/ +extern int doquickwhatis(void); /**/ +extern int dowhatdoes(void); /**/ +extern int dohelp(void); /**/ +extern int dohistory(void); /**/ +extern int doloot(void); /**/ +extern int dodrink(void); /**/ +extern int dodip(void); /**/ +extern int dosacrifice(void); /**/ +extern int dopray(void); /**/ +extern int dotip(void); /**/ +extern int doturn(void); /**/ +extern int doredraw(void); /**/ +extern int doread(void); /**/ +extern int dosave(void); /**/ +extern int dosearch(void); /**/ +extern int doidtrap(void); /**/ +extern int dopay(void); /**/ +extern int dosit(void); /**/ +extern int dotalk(void); /**/ +extern int docast(void); /**/ +extern int dovspell(void); /**/ +extern int dotelecmd(void); /**/ +extern int dountrap(void); /**/ +extern int doversion(void); /**/ +extern int doextversion(void); /**/ +extern int doswapweapon(void); /**/ +extern int dowield(void); /**/ +extern int dowieldquiver(void); /**/ +extern int dozap(void); /**/ +extern int doorganize(void); /**/ #endif /* DUMB */ -static int NDECL(dosuspend_core); -static int NDECL(dosh_core); -static int NDECL(doherecmdmenu); -static int NDECL(dotherecmdmenu); -static int NDECL(doprev_message); -static int NDECL(timed_occupation); -static int NDECL(doextcmd); -static int NDECL(dotravel); -static int NDECL(doterrain); -static int NDECL(wiz_wish); -static int NDECL(wiz_identify); -static int NDECL(wiz_map); -static int NDECL(wiz_makemap); -static int NDECL(wiz_genesis); -static int NDECL(wiz_where); -static int NDECL(wiz_detect); -static int NDECL(wiz_panic); -static int NDECL(wiz_polyself); -static int NDECL(wiz_load_lua); -static int NDECL(wiz_level_tele); -static int NDECL(wiz_level_change); -static int NDECL(wiz_flip_level); -static int NDECL(wiz_show_seenv); -static int NDECL(wiz_show_vision); -static int NDECL(wiz_smell); -static int NDECL(wiz_intrinsic); -static int NDECL(wiz_show_wmodes); -static int NDECL(wiz_show_stats); -static int NDECL(wiz_rumor_check); +static int dosuspend_core(void); +static int dosh_core(void); +static int doherecmdmenu(void); +static int dotherecmdmenu(void); +static int doprev_message(void); +static int timed_occupation(void); +static int doextcmd(void); +static int dotravel(void); +static int doterrain(void); +static int wiz_wish(void); +static int wiz_identify(void); +static int wiz_map(void); +static int wiz_makemap(void); +static int wiz_genesis(void); +static int wiz_where(void); +static int wiz_detect(void); +static int wiz_panic(void); +static int wiz_polyself(void); +static int wiz_load_lua(void); +static int wiz_level_tele(void); +static int wiz_level_change(void); +static int wiz_flip_level(void); +static int wiz_show_seenv(void); +static int wiz_show_vision(void); +static int wiz_smell(void); +static int wiz_intrinsic(void); +static int wiz_show_wmodes(void); +static int wiz_show_stats(void); +static int wiz_rumor_check(void); #ifdef DEBUG_MIGRATING_MONS -static int NDECL(wiz_migrate_mons); +static int wiz_migrate_mons(void); #endif -static void NDECL(wiz_map_levltyp); -static void NDECL(wiz_levltyp_legend); +static void wiz_map_levltyp(void); +static void wiz_levltyp_legend(void); #if defined(__BORLANDC__) && !defined(_WIN32) -extern void FDECL(show_borlandc_stats, (winid)); +extern void show_borlandc_stats(winid); #endif -static int FDECL(size_monst, (struct monst *, BOOLEAN_P)); -static int FDECL(size_obj, (struct obj *)); -static void FDECL(count_obj, (struct obj *, long *, long *, - BOOLEAN_P, BOOLEAN_P)); -static void FDECL(obj_chain, (winid, const char *, struct obj *, - BOOLEAN_P, long *, long *)); -static void FDECL(mon_invent_chain, (winid, const char *, struct monst *, - long *, long *)); -static void FDECL(mon_chain, (winid, const char *, struct monst *, - BOOLEAN_P, long *, long *)); -static void FDECL(contained_stats, (winid, const char *, long *, long *)); -static void FDECL(misc_stats, (winid, long *, long *)); -static boolean FDECL(accept_menu_prefix, (int NDECL((*)))); - -static void FDECL(add_herecmd_menuitem, (winid, int NDECL((*)), - const char *)); -static char FDECL(here_cmd_menu, (BOOLEAN_P)); -static char FDECL(there_cmd_menu, (BOOLEAN_P, int, int)); -static char *NDECL(parse); -static void FDECL(show_direction_keys, (winid, CHAR_P, BOOLEAN_P)); -static boolean FDECL(help_dir, (CHAR_P, int, const char *)); - -static void NDECL(commands_init); -static boolean FDECL(keylist_func_has_key, (const struct ext_func_tab *, - boolean *)); -static int FDECL(keylist_putcmds, (winid, BOOLEAN_P, int, int, boolean *)); -static int FDECL(ch2spkeys, (CHAR_P, int, int)); -static boolean FDECL(prefix_cmd, (CHAR_P)); -static const char *FDECL(spkey_name, (int)); - -static int NDECL((*timed_occ_fn)); -static char *FDECL(doc_extcmd_flagstr, (winid, const struct ext_func_tab *)); +static int size_monst(struct monst *, boolean); +static int size_obj(struct obj *); +static void count_obj(struct obj *, long *, long *, boolean, boolean); +static void obj_chain(winid, const char *, struct obj *, boolean, long *, + long *); +static void mon_invent_chain(winid, const char *, struct monst *, long *, + long *); +static void mon_chain(winid, const char *, struct monst *, boolean, long *, + long *); +static void contained_stats(winid, const char *, long *, long *); +static void misc_stats(winid, long *, long *); +static boolean accept_menu_prefix(int (*)(void)); + +static void add_herecmd_menuitem(winid, int (*)(void), const char *); +static char here_cmd_menu(boolean); +static char there_cmd_menu(boolean, int, int); +static char *parse(void); +static void show_direction_keys(winid, char, boolean); +static boolean help_dir(char, int, const char *); + +static void commands_init(void); +static boolean keylist_func_has_key(const struct ext_func_tab *, boolean *); +static int keylist_putcmds(winid, boolean, int, int, boolean *); +static int ch2spkeys(char, int, int); +static boolean prefix_cmd(char); +static const char *spkey_name(int); + +static int (*timed_occ_fn)(void); +static char *doc_extcmd_flagstr(winid, const struct ext_func_tab *); static const char *readchar_queue = ""; /* for rejecting attempts to use wizard mode commands */ @@ -197,14 +194,14 @@ static const char unavailcmd[] = "Unavailable command '%s'."; static const char cmdnotavail[] = "'%s' command not available."; static int -doprev_message(VOID_ARGS) +doprev_message(void) { return nh_doprev_message(); } /* Count down by decrementing multi */ static int -timed_occupation(VOID_ARGS) +timed_occupation(void) { (*timed_occ_fn)(); if (g.multi > 0) @@ -227,7 +224,7 @@ timed_occupation(VOID_ARGS) * Setting traps. */ void -reset_occupations() +reset_occupations(void) { reset_remarm(); reset_pick(); @@ -238,10 +235,7 @@ reset_occupations() * function times out by its own means. */ void -set_occupation(fn, txt, xtime) -int NDECL((*fn)); -const char *txt; -int xtime; +set_occupation(int (*fn)(void), const char *txt, int xtime) { if (xtime) { g.occupation = timed_occupation; @@ -253,10 +247,10 @@ int xtime; return; } -static char NDECL(popch); +static char popch(void); static char -popch() +popch(void) { /* If occupied, return '\0', letting tgetch know a character should * be read from the keyboard. If the character read is not the @@ -272,7 +266,7 @@ popch() } char -pgetchar() /* courtesy of aeb@cwi.nl */ +pgetchar(void) /* courtesy of aeb@cwi.nl */ { register int ch; @@ -285,8 +279,7 @@ pgetchar() /* courtesy of aeb@cwi.nl */ /* A ch == 0 resets the pushq */ void -pushch(ch) -char ch; +pushch(char ch) { if (!ch) g.phead = g.ptail = 0; @@ -299,8 +292,7 @@ char ch; * replaying a previous command. */ void -savech(ch) -char ch; +savech(char ch) { if (!g.in_doagain) { if (!ch) @@ -313,10 +305,10 @@ char ch; /* here after # - now read a full-word command */ static int -doextcmd(VOID_ARGS) +doextcmd(void) { int idx, retval; - int NDECL((*func)); + int (*func)(void); /* keep repeating until we don't run help or quit */ do { @@ -343,9 +335,9 @@ doextcmd(VOID_ARGS) /* format extended command flags for display */ static char * -doc_extcmd_flagstr(menuwin, efp) -winid menuwin; -const struct ext_func_tab *efp; /* if Null, add a footnote to the menu */ +doc_extcmd_flagstr(winid menuwin, + /* if Null, add a footnote to the menu */ + const struct ext_func_tab *efp) { static char Abuf[10]; /* 5 would suffice: {'[','m','A',']','\0'} */ @@ -384,7 +376,7 @@ const struct ext_func_tab *efp; /* if Null, add a footnote to the menu */ /* here after #? - now list all full-word commands and provide some navigation capability through the long list */ int -doextlist(VOID_ARGS) +doextlist(void) { register const struct ext_func_tab *efp = (struct ext_func_tab *) 0; char buf[BUFSZ], searchbuf[BUFSZ], promptbuf[QBUFSZ]; @@ -570,7 +562,7 @@ doextlist(VOID_ARGS) * Here after # - now show pick-list of possible commands. */ int -extcmd_via_menu() +extcmd_via_menu(void) { const struct ext_func_tab *efp; menu_item *pick_list = (menu_item *) 0; @@ -704,7 +696,7 @@ extcmd_via_menu() /* #monster command - use special monster ability while polymorphed */ int -domonability(VOID_ARGS) +domonability(void) { if (can_breathe(g.youmonst.data)) return dobreathe(); @@ -748,7 +740,7 @@ domonability(VOID_ARGS) } int -enter_explore_mode(VOID_ARGS) +enter_explore_mode(void) { if (discover) { You("are already in explore mode."); @@ -788,7 +780,7 @@ enter_explore_mode(VOID_ARGS) /* ^W command - wish for something */ static int -wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */ +wiz_wish(void) /* Unlimited wishes for debug mode by Paul Polderman */ { if (wizard) { boolean save_verbose = flags.verbose; @@ -804,7 +796,7 @@ wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */ /* ^I command - reveal and optionally identify hero's inventory */ static int -wiz_identify(VOID_ARGS) +wiz_identify(void) { if (wizard) { iflags.override_ID = (int) cmd_from_func(wiz_identify); @@ -823,8 +815,7 @@ wiz_identify(VOID_ARGS) } void -makemap_prepost(pre, wiztower) -boolean pre, wiztower; +makemap_prepost(boolean pre, boolean wiztower) { NHFILE tmpnhfp; struct monst *mtmp; @@ -926,7 +917,7 @@ boolean pre, wiztower; /* #wizmakemap - discard current dungeon level and replace with a new one */ static int -wiz_makemap(VOID_ARGS) +wiz_makemap(void) { if (wizard) { boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); @@ -945,7 +936,7 @@ wiz_makemap(VOID_ARGS) /* ^F command - reveal the level map and any traps on it */ static int -wiz_map(VOID_ARGS) +wiz_map(void) { if (wizard) { struct trap *t; @@ -966,7 +957,7 @@ wiz_map(VOID_ARGS) /* ^G command - generate monster(s); a count prefix will be honored */ static int -wiz_genesis(VOID_ARGS) +wiz_genesis(void) { if (wizard) (void) create_particular(); @@ -977,7 +968,7 @@ wiz_genesis(VOID_ARGS) /* ^O command - display dungeon layout */ static int -wiz_where(VOID_ARGS) +wiz_where(void) { if (wizard) (void) print_dungeon(FALSE, (schar *) 0, (xchar *) 0); @@ -988,7 +979,7 @@ wiz_where(VOID_ARGS) /* ^E command - detect unseen (secret doors, traps, hidden monsters) */ static int -wiz_detect(VOID_ARGS) +wiz_detect(void) { if (wizard) (void) findit(); @@ -998,7 +989,7 @@ wiz_detect(VOID_ARGS) } static int -wiz_load_lua(VOID_ARGS) +wiz_load_lua(void) { if (wizard && !iflags.debug_fuzzer) { char buf[BUFSZ]; @@ -1016,7 +1007,7 @@ wiz_load_lua(VOID_ARGS) } static int -wiz_load_splua(VOID_ARGS) +wiz_load_splua(void) { if (wizard && !iflags.debug_fuzzer) { boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); @@ -1067,7 +1058,7 @@ wiz_load_splua(VOID_ARGS) /* ^V command - level teleport */ static int -wiz_level_tele(VOID_ARGS) +wiz_level_tele(void) { if (wizard) level_tele(); @@ -1078,7 +1069,7 @@ wiz_level_tele(VOID_ARGS) /* #wizfliplevel - transpose the current level */ static int -wiz_flip_level(VOID_ARGS) +wiz_flip_level(void) { static const char choices[] = "0123", prmpt[] = "Flip 0=randomly, 1=vertically, 2=horizonally, 3=both:"; @@ -1112,7 +1103,7 @@ wiz_flip_level(VOID_ARGS) /* #levelchange command - adjust hero's experience level */ static int -wiz_level_change(VOID_ARGS) +wiz_level_change(void) { char buf[BUFSZ] = DUMMY; int newlevel = 0; @@ -1156,7 +1147,7 @@ wiz_level_change(VOID_ARGS) /* #panic command - test program's panic handling */ static int -wiz_panic(VOID_ARGS) +wiz_panic(void) { if (iflags.debug_fuzzer) { u.uhp = u.uhpmax = 1000; @@ -1171,7 +1162,7 @@ wiz_panic(VOID_ARGS) /* #polyself command - change hero's form */ static int -wiz_polyself(VOID_ARGS) +wiz_polyself(void) { polyself(1); return 0; @@ -1179,7 +1170,7 @@ wiz_polyself(VOID_ARGS) /* #seenv command */ static int -wiz_show_seenv(VOID_ARGS) +wiz_show_seenv(void) { winid win; int x, y, v, startx, stopx, curx; @@ -1223,7 +1214,7 @@ wiz_show_seenv(VOID_ARGS) /* #vision command */ static int -wiz_show_vision(VOID_ARGS) +wiz_show_vision(void) { winid win; int x, y, v; @@ -1261,7 +1252,7 @@ wiz_show_vision(VOID_ARGS) /* #wmode command */ static int -wiz_show_wmodes(VOID_ARGS) +wiz_show_wmodes(void) { winid win; int x, y; @@ -1297,7 +1288,7 @@ wiz_show_wmodes(VOID_ARGS) /* wizard mode variant of #terrain; internal levl[][].typ values in base-36 */ static void -wiz_map_levltyp(VOID_ARGS) +wiz_map_levltyp(void) { winid win; int x, y, terrain; @@ -1459,8 +1450,7 @@ const char *levltyp[] = { }; const char * -levltyp_to_name(typ) -int typ; +levltyp_to_name(int typ) { if (typ >= 0 && typ < MAX_TYPE) return levltyp[typ]; @@ -1469,7 +1459,7 @@ int typ; /* explanation of base-36 output from wiz_map_levltyp() */ static void -wiz_levltyp_legend(VOID_ARGS) +wiz_levltyp_legend(void) { winid win; int i, j, last, c; @@ -1509,7 +1499,7 @@ wiz_levltyp_legend(VOID_ARGS) /* #wizsmell command - test usmellmon(). */ static int -wiz_smell(VOID_ARGS) +wiz_smell(void) { int ans = 0; int mndx; /* monster index */ @@ -1551,7 +1541,7 @@ wiz_smell(VOID_ARGS) /* #wizinstrinsic command to set some intrinsics for testing */ static int -wiz_intrinsic(VOID_ARGS) +wiz_intrinsic(void) { if (wizard) { extern const struct propname { @@ -1703,7 +1693,7 @@ wiz_intrinsic(VOID_ARGS) /* #wizrumorcheck command - verify each rumor access */ static int -wiz_rumor_check(VOID_ARGS) +wiz_rumor_check(void) { rumor_check(); return 0; @@ -1711,7 +1701,7 @@ wiz_rumor_check(VOID_ARGS) /* #terrain command -- show known map, inspired by crawl's '|' command */ static int -doterrain(VOID_ARGS) +doterrain(void) { winid men; menu_item *sel; @@ -2070,8 +2060,7 @@ static const struct movcmd movtab[] = { int extcmdlist_length = SIZE(extcmdlist) - 1; const char * -key2extcmddesc(key) -uchar key; +key2extcmddesc(uchar key) { static char key2cmdbuf[QBUFSZ]; const struct movcmd *mov; @@ -2127,9 +2116,7 @@ uchar key; } boolean -bind_key(key, command) -uchar key; -const char *command; +bind_key(uchar key, const char *command) { struct ext_func_tab *extcmd; @@ -2159,7 +2146,7 @@ const char *command; /* initialize all keyboard commands */ static void -commands_init() +commands_init(void) { struct ext_func_tab *extcmd; @@ -2191,9 +2178,8 @@ commands_init() } static boolean -keylist_func_has_key(extcmd, skip_keys_used) -const struct ext_func_tab *extcmd; -boolean *skip_keys_used; /* boolean keys_used[256] */ +keylist_func_has_key(const struct ext_func_tab *extcmd, + boolean *skip_keys_used) /* boolean keys_used[256] */ { int i; @@ -2208,11 +2194,8 @@ boolean *skip_keys_used; /* boolean keys_used[256] */ } static int -keylist_putcmds(datawin, docount, incl_flags, excl_flags, keys_used) -winid datawin; -boolean docount; -int incl_flags, excl_flags; -boolean *keys_used; /* boolean keys_used[256] */ +keylist_putcmds(winid datawin, boolean docount, int incl_flags, int excl_flags, + boolean *keys_used) /* boolean keys_used[256] */ { const struct ext_func_tab *extcmd; int i; @@ -2268,7 +2251,7 @@ boolean *keys_used; /* boolean keys_used[256] */ /* list all keys and their bindings, like dat/hh but dynamic */ void -dokeylist(VOID_ARGS) +dokeylist(void) { const struct ext_func_tab *extcmd; winid datawin; @@ -2442,8 +2425,7 @@ dokeylist(VOID_ARGS) } char -cmd_from_func(fn) -int NDECL((*fn)); +cmd_from_func(int (*fn)(void)) { int i; @@ -2464,10 +2446,8 @@ int NDECL((*fn)); /* return extended command name (without leading '#') for command (*fn)() */ const char * -cmdname_from_func(fn, outbuf, fullname) -int NDECL((*fn)); -char outbuf[]; -boolean fullname; /* False: just enough to disambiguate */ +cmdname_from_func(int (*fn)(void), char outbuf[], + boolean fullname) /* False: just enough to disambiguate */ { const struct ext_func_tab *extcmd, *cmdptr = 0; const char *res = 0; @@ -2522,8 +2502,7 @@ static const char stats_hdr[] = " count bytes"; static const char stats_sep[] = "--------------------------- ----- -------"; static int -size_obj(otmp) -struct obj *otmp; +size_obj(struct obj *otmp) { int sz = (int) sizeof (struct obj); @@ -2541,12 +2520,8 @@ struct obj *otmp; } static void -count_obj(chain, total_count, total_size, top, recurse) -struct obj *chain; -long *total_count; -long *total_size; -boolean top; -boolean recurse; +count_obj(struct obj *chain, long *total_count, long *total_size, + boolean top, boolean recurse) { long count, size; struct obj *obj; @@ -2564,13 +2539,8 @@ boolean recurse; } static void -obj_chain(win, src, chain, force, total_count, total_size) -winid win; -const char *src; -struct obj *chain; -boolean force; -long *total_count; -long *total_size; +obj_chain(winid win, const char *src, struct obj *chain, boolean force, + long *total_count, long *total_size) { char buf[BUFSZ]; long count = 0L, size = 0L; @@ -2586,12 +2556,8 @@ long *total_size; } static void -mon_invent_chain(win, src, chain, total_count, total_size) -winid win; -const char *src; -struct monst *chain; -long *total_count; -long *total_size; +mon_invent_chain(winid win, const char *src, struct monst *chain, + long *total_count, long *total_size) { char buf[BUFSZ]; long count = 0, size = 0; @@ -2609,11 +2575,8 @@ long *total_size; } static void -contained_stats(win, src, total_count, total_size) -winid win; -const char *src; -long *total_count; -long *total_size; +contained_stats(winid win, const char *src, long *total_count, + long *total_size) { char buf[BUFSZ]; long count = 0, size = 0; @@ -2639,9 +2602,7 @@ long *total_size; } static int -size_monst(mtmp, incl_wsegs) -struct monst *mtmp; -boolean incl_wsegs; +size_monst(struct monst *mtmp, boolean incl_wsegs) { int sz = (int) sizeof (struct monst); @@ -2668,13 +2629,8 @@ boolean incl_wsegs; } static void -mon_chain(win, src, chain, force, total_count, total_size) -winid win; -const char *src; -struct monst *chain; -boolean force; -long *total_count; -long *total_size; +mon_chain(winid win, const char *src, struct monst *chain, + boolean force, long *total_count, long *total_size) { char buf[BUFSZ]; long count, size; @@ -2696,10 +2652,7 @@ long *total_size; } static void -misc_stats(win, total_count, total_size) -winid win; -long *total_count; -long *total_size; +misc_stats(winid win, long *total_count, long *total_size) { char buf[BUFSZ], hdrbuf[QBUFSZ]; long count, size; @@ -2818,7 +2771,7 @@ long *total_size; * Display memory usage of all monsters and objects on the level. */ static int -wiz_show_stats() +wiz_show_stats(void) { char buf[BUFSZ]; winid win; @@ -2902,7 +2855,7 @@ wiz_show_stats() } void -sanity_check() +sanity_check(void) { obj_sanity_check(); timer_sanity_check(); @@ -2913,7 +2866,7 @@ sanity_check() #ifdef DEBUG_MIGRATING_MONS static int -wiz_migrate_mons() +wiz_migrate_mons(void) { int mcount = 0; char inbuf[BUFSZ] = DUMMY; @@ -2998,9 +2951,7 @@ static struct { }; boolean -bind_specialkey(key, command) -uchar key; -const char *command; +bind_specialkey(uchar key, const char *command) { int i; @@ -3014,8 +2965,7 @@ const char *command; } static const char * -spkey_name(nhkf) -int nhkf; +spkey_name(int nhkf) { const char *name = 0; int i; @@ -3031,8 +2981,7 @@ int nhkf; /* returns a one-byte character from the text; may change txt[] */ uchar -txt2key(txt) -char *txt; +txt2key(char *txt) { uchar uc; boolean makemeta = FALSE; @@ -3123,9 +3072,7 @@ char *txt; /* returns the text for a one-byte encoding; * must be shorter than a tab for proper formatting */ char * -key2txt(c, txt) -uchar c; -char *txt; /* sufficiently long buffer */ +key2txt(uchar c, char *txt) /* sufficiently long buffer */ { /* should probably switch to "SPC", "ESC", "RET" since nethack's documentation uses ESC for */ @@ -3144,9 +3091,7 @@ char *txt; /* sufficiently long buffer */ void -parseautocomplete(autocomplete, condition) -char *autocomplete; -boolean condition; +parseautocomplete(char *autocomplete, boolean condition) { struct ext_func_tab *efp; register char *autoc; @@ -3192,8 +3137,7 @@ boolean condition; /* called at startup and after number_pad is twiddled */ void -reset_commands(initial) -boolean initial; +reset_commands(boolean initial) { static const char sdir[] = "hykulnjb><", sdir_swap_yz[] = "hzkulnjb><", @@ -3314,8 +3258,7 @@ boolean initial; /* non-movement commands which accept 'm' prefix to request menu operation */ static boolean -accept_menu_prefix(cmd_func) -int NDECL((*cmd_func)); +accept_menu_prefix(int (*cmd_func)(void)) { if (cmd_func == dopickup || cmd_func == dotip /* eat, #offer, and apply tinning-kit all use floorfood() to pick @@ -3340,7 +3283,7 @@ int NDECL((*cmd_func)); } char -randomkey() +randomkey(void) { static unsigned i = 0; char c; @@ -3392,9 +3335,7 @@ randomkey() } void -random_response(buf, sz) -char *buf; -int sz; +random_response(char *buf, int sz) { char c; int count = 0; @@ -3414,15 +3355,13 @@ int sz; } int -rnd_extcmd_idx(VOID_ARGS) +rnd_extcmd_idx(void) { return rn2(extcmdlist_length + 1) - 1; } static int -ch2spkeys(c, start, end) -char c; -int start,end; +ch2spkeys(char c, int start, int end) { int i; @@ -3433,8 +3372,7 @@ int start,end; } void -rhack(cmd) -register char *cmd; +rhack(char *cmd) { int spkey; boolean prefix_seen, bad_command, @@ -3571,7 +3509,7 @@ register char *cmd; if (cmd[0] == g.Cmd.spkeys[NHKF_REQMENU]) { /* (for func_tab cast, see below) */ const struct ext_func_tab *ft = g.Cmd.commands[cmd[1] & 0xff]; - int NDECL((*func)) = ft ? ((struct ext_func_tab *) ft)->ef_funct : 0; + int (*func)(void) = ft ? ((struct ext_func_tab *) ft)->ef_funct : 0; if (func && accept_menu_prefix(func)) { iflags.menu_requested = TRUE; @@ -3626,7 +3564,7 @@ register char *cmd; /* handle all other commands */ } else { register const struct ext_func_tab *tlist; - int res, NDECL((*func)); + int res, (*func)(void); /* current - use *cmd to directly index cmdlist array */ if ((tlist = g.Cmd.commands[*cmd & 0xff]) != 0) { @@ -3673,8 +3611,7 @@ register char *cmd; /* convert an x,y pair into a direction code */ int -xytod(x, y) -schar x, y; +xytod(schar x, schar y) { register int dd; @@ -3686,9 +3623,7 @@ schar x, y; /* convert a direction code into an x,y pair */ void -dtoxy(cc, dd) -coord *cc; -register int dd; +dtoxy(coord *cc, int dd) { cc->x = xdir[dd]; cc->y = ydir[dd]; @@ -3697,8 +3632,7 @@ register int dd; /* also sets u.dz, but returns false for <> */ int -movecmd(sym) -char sym; +movecmd(char sym) { register const char *dp = index(g.Cmd.dirchars, sym); @@ -3719,7 +3653,7 @@ char sym; /* grid bug handling which used to be in movecmd() */ int -dxdy_moveok() +dxdy_moveok(void) { if (u.dx && u.dy && NODIAG(u.umonnum)) u.dx = u.dy = 0; @@ -3728,16 +3662,14 @@ dxdy_moveok() /* decide whether character (user input keystroke) requests screen repaint */ boolean -redraw_cmd(c) -char c; +redraw_cmd(char c) { return (boolean) (c == g.Cmd.spkeys[NHKF_REDRAW] || (g.Cmd.num_pad && c == g.Cmd.spkeys[NHKF_REDRAW2])); } static boolean -prefix_cmd(c) -char c; +prefix_cmd(char c) { return (c == g.Cmd.spkeys[NHKF_REQMENU] || c == g.Cmd.spkeys[NHKF_RUSH] @@ -3761,10 +3693,8 @@ char c; * Returns non-zero if coordinates in cc are valid. */ int -get_adjacent_loc(prompt, emsg, x, y, cc) -const char *prompt, *emsg; -xchar x, y; -coord *cc; +get_adjacent_loc(const char *prompt, const char *emsg, + xchar x, xchar y, coord *cc) { xchar new_x, new_y; if (!getdir(prompt)) { @@ -3785,8 +3715,7 @@ coord *cc; } int -getdir(s) -const char *s; +getdir(const char *s) { char dirsym; int is_mov; @@ -3836,10 +3765,9 @@ const char *s; } static void -show_direction_keys(win, centerchar, nodiag) -winid win; /* should specify a window which is using a fixed-width font... */ -char centerchar; /* '.' or '@' or ' ' */ -boolean nodiag; +show_direction_keys(winid win, /* should specify a window which is using a fixed-width font... */ + char centerchar, /* '.' or '@' or ' ' */ + boolean nodiag) { char buf[BUFSZ]; @@ -3875,10 +3803,9 @@ boolean nodiag; an invalid direction after a prefix key ('F', 'g', 'm', &c), which might be bogus but could be up, down, or self when not applicable */ static boolean -help_dir(sym, spkey, msg) -char sym; -int spkey; /* NHKF_ code for prefix key, if one was used, or for ESC */ -const char *msg; +help_dir(char sym, + int spkey, /* NHKF_ code for prefix key, if one was used, or for ESC */ + const char *msg) { static const char wiz_only_list[] = "EFGIVW"; char ctrl; @@ -4028,7 +3955,7 @@ const char *msg; } void -confdir() +confdir(void) { register int x = NODIAG(u.umonnum) ? 2 * rn2(4) : rn2(8); @@ -4038,8 +3965,7 @@ confdir() } const char * -directionname(dir) -int dir; +directionname(int dir) { static NEARDATA const char *const dirnames[] = { "west", "northwest", "north", "northeast", "east", @@ -4052,8 +3978,7 @@ int dir; } int -isok(x, y) -register int x, y; +isok(register int x, register int y) { /* x corresponds to curx, so x==1 is the first column. Ach. %% */ return x >= 1 && x <= COLNO - 1 && y >= 0 && y <= ROWNO - 1; @@ -4061,7 +3986,7 @@ register int x, y; /* #herecmdmenu command */ static int -doherecmdmenu(VOID_ARGS) +doherecmdmenu(void) { char ch = here_cmd_menu(TRUE); @@ -4070,7 +3995,7 @@ doherecmdmenu(VOID_ARGS) /* #therecmdmenu command, a way to test there_cmd_menu without mouse */ static int -dotherecmdmenu(VOID_ARGS) +dotherecmdmenu(void) { char ch; @@ -4086,10 +4011,7 @@ dotherecmdmenu(VOID_ARGS) } static void -add_herecmd_menuitem(win, func, text) -winid win; -int NDECL((*func)); -const char *text; +add_herecmd_menuitem(winid win, int (*func)(void), const char *text) { char ch; anything any; @@ -4106,9 +4028,7 @@ const char *text; does not work as intended because the actions that get invoked ask for a direction or target instead of using our */ static char -there_cmd_menu(doit, x, y) -boolean doit; -int x, y; +there_cmd_menu(boolean doit, int x, int y) { winid win; char ch; @@ -4207,7 +4127,7 @@ int x, y; destroy_nhwindow(win); ch = '\033'; if (npick > 0) { - int NDECL((*func)) = picks->item.a_nfunc; + int (*func)(void) = picks->item.a_nfunc; free((genericptr_t) picks); if (doit) { @@ -4222,8 +4142,7 @@ int x, y; } static char -here_cmd_menu(doit) -boolean doit; +here_cmd_menu(boolean doit) { winid win; char ch; @@ -4301,7 +4220,7 @@ boolean doit; destroy_nhwindow(win); ch = '\033'; if (npick > 0) { - int NDECL((*func)) = picks->item.a_nfunc; + int (*func)(void) = picks->item.a_nfunc; free((genericptr_t) picks); if (doit) { @@ -4319,8 +4238,7 @@ boolean doit; * convert a MAP window position into a movecmd */ const char * -click_to_cmd(x, y, mod) -int x, y, mod; +click_to_cmd(int x, int y, int mod) { static char cmd[4]; struct obj *o; @@ -4449,12 +4367,9 @@ int x, y, mod; } char -get_count(allowchars, inkey, maxcount, count, historicmsg) -char *allowchars; -char inkey; -long maxcount; -long *count; -boolean historicmsg; /* whether to include in message history: True => yes */ +get_count(char *allowchars, char inkey, + long maxcount, long *count, + boolean historicmsg) /* whether to include in message history: True => yes */ { char qbuf[QBUFSZ]; int key; @@ -4511,7 +4426,7 @@ boolean historicmsg; /* whether to include in message history: True => yes */ static char * -parse() +parse(void) { #ifdef LINT /* static char in_line[COLNO]; */ char in_line[COLNO]; @@ -4602,8 +4517,8 @@ parse() the return value so we should be safe using `void' unconditionally */ /*ARGUSED*/ void -hangup(sig_unused) /* called as signal() handler, so sent at least one arg */ -int sig_unused UNUSED; +hangup(int sig_unused UNUSED) /* called as signal() handler, so sent + at least one arg */ { if (g.program_state.exiting) g.program_state.in_moveloop = 0; @@ -4624,7 +4539,7 @@ int sig_unused UNUSED; } void -end_of_input() +end_of_input(void) { #ifdef NOSAVEONHANGUP #ifdef INSURANCE @@ -4649,7 +4564,7 @@ end_of_input() #endif /* HANGUPHANDLING */ char -readchar() +readchar(void) { register int sym; int x = u.ux, y = u.uy, mod = 0; @@ -4700,7 +4615,7 @@ readchar() /* '_' command, #travel, via keyboard rather than mouse click */ static int -dotravel(VOID_ARGS) +dotravel(void) { static char cmd[2]; coord cc; @@ -4756,9 +4671,7 @@ dotravel(VOID_ARGS) * window port causing a buffer overflow there. */ char -yn_function(query, resp, def) -const char *query, *resp; -char def; +yn_function(const char *query, const char *resp, char def) { char res, qbuf[QBUFSZ]; #ifdef DUMPLOG @@ -4793,9 +4706,7 @@ char def; /* for paranoid_confirm:quit,die,attack prompting */ boolean -paranoid_query(be_paranoid, prompt) -boolean be_paranoid; -const char *prompt; +paranoid_query(boolean be_paranoid, const char *prompt) { boolean confirmed_ok; @@ -4840,7 +4751,7 @@ const char *prompt; /* ^Z command, #suspend */ static int -dosuspend_core(VOID_ARGS) +dosuspend_core(void) { #ifdef SUSPEND /* Does current window system support suspend? */ @@ -4855,7 +4766,7 @@ dosuspend_core(VOID_ARGS) /* '!' command, #shell */ static int -dosh_core(VOID_ARGS) +dosh_core(void) { #ifdef SHELL /* access restrictions, if any, are handled in port code */ diff --git a/src/dbridge.c b/src/dbridge.c index fd234e801..c4da8319e 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -19,23 +19,22 @@ #include "hack.h" -static void FDECL(get_wall_for_db, (int *, int *)); -static struct entity *FDECL(e_at, (int, int)); -static void FDECL(m_to_e, (struct monst *, int, int, struct entity *)); -static void FDECL(u_to_e, (struct entity *)); -static void FDECL(set_entity, (int, int, struct entity *)); -static const char *FDECL(e_nam, (struct entity *)); -static const char *FDECL(E_phrase, (struct entity *, const char *)); -static boolean FDECL(e_survives_at, (struct entity *, int, int)); -static void FDECL(e_died, (struct entity *, int, int)); -static boolean FDECL(automiss, (struct entity *)); -static boolean FDECL(e_missed, (struct entity *, BOOLEAN_P)); -static boolean FDECL(e_jumps, (struct entity *)); -static void FDECL(do_entity, (struct entity *)); +static void get_wall_for_db(int *, int *); +static struct entity *e_at(int, int); +static void m_to_e(struct monst *, int, int, struct entity *); +static void u_to_e(struct entity *); +static void set_entity(int, int, struct entity *); +static const char *e_nam(struct entity *); +static const char *E_phrase(struct entity *, const char *); +static boolean e_survives_at(struct entity *, int, int); +static void e_died(struct entity *, int, int); +static boolean automiss(struct entity *); +static boolean e_missed(struct entity *, boolean); +static boolean e_jumps(struct entity *); +static void do_entity(struct entity *); boolean -is_pool(x, y) -int x, y; +is_pool(int x, int y) { schar ltyp; @@ -51,8 +50,7 @@ int x, y; } boolean -is_lava(x, y) -int x, y; +is_lava(int x, int y) { schar ltyp; @@ -67,8 +65,7 @@ int x, y; } boolean -is_pool_or_lava(x, y) -int x, y; +is_pool_or_lava(int x, int y) { if (is_pool(x, y) || is_lava(x, y)) return TRUE; @@ -77,8 +74,7 @@ int x, y; } boolean -is_ice(x, y) -int x, y; +is_ice(int x, int y) { schar ltyp; @@ -92,8 +88,7 @@ int x, y; } boolean -is_moat(x, y) -int x, y; +is_moat(int x, int y) { schar ltyp; @@ -109,8 +104,7 @@ int x, y; } schar -db_under_typ(mask) -int mask; +db_under_typ(int mask) { switch (mask & DB_UNDER) { case DB_ICE: @@ -132,8 +126,7 @@ int mask; */ int -is_drawbridge_wall(x, y) -int x, y; +is_drawbridge_wall(int x, int y) { struct rm *lev; @@ -163,8 +156,7 @@ int x, y; * (instead of UP or DOWN, as with is_drawbridge_wall). */ boolean -is_db_wall(x, y) -int x, y; +is_db_wall(int x, int y) { return (boolean) (levl[x][y].typ == DBWALL); } @@ -174,8 +166,7 @@ int x, y; * a drawbridge or drawbridge wall. */ boolean -find_drawbridge(x, y) -int *x, *y; +find_drawbridge(int *x, int *y) { int dir; @@ -206,8 +197,7 @@ int *x, *y; * Find the drawbridge wall associated with a drawbridge. */ static void -get_wall_for_db(x, y) -int *x, *y; +get_wall_for_db(int *x, int *y) { switch (levl[*x][*y].drawbridgemask & DB_DIR) { case DB_NORTH: @@ -231,9 +221,7 @@ int *x, *y; * flag must be put to TRUE if we want the drawbridge to be opened. */ boolean -create_drawbridge(x, y, dir, flag) -int x, y, dir; -boolean flag; +create_drawbridge(int x, int y, int dir, boolean flag) { int x2, y2; boolean horiz; @@ -282,10 +270,8 @@ boolean flag; return TRUE; } -static -struct entity * -e_at(x, y) -int x, y; +static struct entity * +e_at(int x, int y) { int entitycnt; @@ -302,10 +288,7 @@ int x, y; } static void -m_to_e(mtmp, x, y, etmp) -struct monst *mtmp; -int x, y; -struct entity *etmp; +m_to_e(struct monst *mtmp, int x, int y, struct entity *etmp) { etmp->emon = mtmp; if (mtmp) { @@ -320,8 +303,7 @@ struct entity *etmp; } static void -u_to_e(etmp) -struct entity *etmp; +u_to_e(struct entity *etmp) { etmp->emon = &g.youmonst; etmp->ex = u.ux; @@ -330,9 +312,7 @@ struct entity *etmp; } static void -set_entity(x, y, etmp) -int x, y; -struct entity *etmp; +set_entity(int x, int y, struct entity *etmp) { if ((x == u.ux) && (y == u.uy)) u_to_e(etmp); @@ -354,8 +334,7 @@ struct entity *etmp; /* #define e_strg(etmp, func) (is_u(etmp)? (char *)0 : func(etmp->emon)) */ static const char * -e_nam(etmp) -struct entity *etmp; +e_nam(struct entity *etmp) { return is_u(etmp) ? "you" : mon_nam(etmp->emon); } @@ -365,9 +344,7 @@ struct entity *etmp; * verb, where necessary. */ static const char * -E_phrase(etmp, verb) -struct entity *etmp; -const char *verb; +E_phrase(struct entity *etmp, const char *verb) { static char wholebuf[80]; @@ -386,9 +363,7 @@ const char *verb; * Simple-minded "can it be here?" routine */ static boolean -e_survives_at(etmp, x, y) -struct entity *etmp; -int x, y; +e_survives_at(struct entity *etmp, int x, int y) { if (noncorporeal(etmp->edata)) return TRUE; @@ -410,9 +385,7 @@ int x, y; } static void -e_died(etmp, xkill_flags, how) -struct entity *etmp; -int xkill_flags, how; +e_died(struct entity *etmp, int xkill_flags, int how) { if (is_u(etmp)) { if (how == DROWNING) { @@ -474,8 +447,7 @@ int xkill_flags, how; * These are never directly affected by a bridge or portcullis. */ static boolean -automiss(etmp) -struct entity *etmp; +automiss(struct entity *etmp) { return (boolean) ((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata)) || noncorporeal(etmp->edata)); @@ -485,9 +457,7 @@ struct entity *etmp; * Does falling drawbridge or portcullis miss etmp? */ static boolean -e_missed(etmp, chunks) -struct entity *etmp; -boolean chunks; +e_missed(struct entity *etmp, boolean chunks) { int misses; @@ -522,8 +492,7 @@ boolean chunks; * Can etmp jump from death? */ static boolean -e_jumps(etmp) -struct entity *etmp; +e_jumps(struct entity *etmp) { int tmp = 4; /* out of 10 */ @@ -546,8 +515,7 @@ struct entity *etmp; } static void -do_entity(etmp) -struct entity *etmp; +do_entity(struct entity *etmp) { int newx, newy, at_portcullis, oldx, oldy; boolean must_jump = FALSE, relocates = FALSE, e_inview; @@ -756,8 +724,7 @@ struct entity *etmp; * Close the drawbridge located at x,y */ void -close_drawbridge(x, y) -int x, y; +close_drawbridge(int x, int y) { register struct rm *lev1, *lev2; struct trap *t; @@ -818,8 +785,7 @@ int x, y; * Open the drawbridge located at x,y */ void -open_drawbridge(x, y) -int x, y; +open_drawbridge(int x, int y) { register struct rm *lev1, *lev2; struct trap *t; @@ -865,8 +831,7 @@ int x, y; * Let's destroy the drawbridge located at x,y */ void -destroy_drawbridge(x, y) -int x, y; +destroy_drawbridge(int x, int y) { register struct rm *lev1, *lev2; struct trap *t; diff --git a/src/decl.c b/src/decl.c index c257fadb7..2f0193607 100644 --- a/src/decl.c +++ b/src/decl.c @@ -704,7 +704,7 @@ const glyph_info nul_glyphinfo = #define ZERO(x) memset(&x, 0, sizeof(x)) void -decl_globals_init() +decl_globals_init(void) { g = g_init; diff --git a/src/detect.c b/src/detect.c index 8dcf00b88..57c693fff 100644 --- a/src/detect.c +++ b/src/detect.c @@ -11,23 +11,22 @@ #include "hack.h" #include "artifact.h" -static boolean NDECL(unconstrain_map); -static void NDECL(reconstrain_map); -static void NDECL(map_redisplay); -static void FDECL(browse_map, (int, const char *)); -static void FDECL(map_monst, (struct monst *, BOOLEAN_P)); -static void FDECL(do_dknown_of, (struct obj *)); -static boolean FDECL(check_map_spot, (int, int, CHAR_P, unsigned)); -static boolean FDECL(clear_stale_map, (CHAR_P, unsigned)); -static void FDECL(sense_trap, (struct trap *, XCHAR_P, XCHAR_P, int)); -static int FDECL(detect_obj_traps, (struct obj *, BOOLEAN_P, int)); -static int NDECL(furniture_detect); -static void FDECL(show_map_spot, (int, int)); -static void FDECL(findone, (int, int, genericptr_t)); -static void FDECL(openone, (int, int, genericptr_t)); -static int FDECL(mfind0, (struct monst *, BOOLEAN_P)); -static int FDECL(reveal_terrain_getglyph, (int, int, int, - unsigned, int, int)); +static boolean unconstrain_map(void); +static void reconstrain_map(void); +static void map_redisplay(void); +static void browse_map(int, const char *); +static void map_monst(struct monst *, boolean); +static void do_dknown_of(struct obj *); +static boolean check_map_spot(int, int, char, unsigned); +static boolean clear_stale_map(char, unsigned); +static void sense_trap(struct trap *, xchar, xchar, int); +static int detect_obj_traps(struct obj *, boolean, int); +static int furniture_detect(void); +static void show_map_spot(int, int); +static void findone(int, int, genericptr_t); +static void openone(int, int, genericptr_t); +static int mfind0(struct monst *, boolean); +static int reveal_terrain_getglyph(int, int, int, unsigned, int, int); /* wildcard class for clear_stale_map - this used to be used as a getobj() input * but it's no longer used for that function */ @@ -36,7 +35,7 @@ static int FDECL(reveal_terrain_getglyph, (int, int, int, /* bring hero out from underwater or underground or being engulfed; return True iff any change occurred */ static boolean -unconstrain_map() +unconstrain_map(void) { boolean res = u.uinwater || u.uburied || u.uswallow; @@ -50,7 +49,7 @@ unconstrain_map() /* put hero back underwater or underground or engulfed */ static void -reconstrain_map() +reconstrain_map(void) { u.uinwater = iflags.save_uinwater, iflags.save_uinwater = 0; /* set_uinwater() */ u.uburied = iflags.save_uburied, iflags.save_uburied = 0; @@ -58,7 +57,7 @@ reconstrain_map() } static void -map_redisplay() +map_redisplay(void) { reconstrain_map(); docrt(); /* redraw the screen to remove unseen traps from the map */ @@ -70,9 +69,7 @@ map_redisplay() /* use getpos()'s 'autodescribe' to view whatever is currently shown on map */ static void -browse_map(ter_typ, ter_explain) -int ter_typ; -const char *ter_explain; +browse_map(int ter_typ, const char *ter_explain) { coord dummy_pos; /* don't care whether player actually picks a spot */ boolean save_autodescribe; @@ -88,9 +85,7 @@ const char *ter_explain; /* extracted from monster_detection() so can be shared by do_vicinity_map() */ static void -map_monst(mtmp, showtail) -struct monst *mtmp; -boolean showtail; +map_monst(struct monst *mtmp, boolean showtail) { if (def_monsyms[(int) mtmp->data->mlet].sym == ' ') show_glyph(mtmp->mx, mtmp->my, @@ -107,9 +102,7 @@ boolean showtail; /* this is checking whether a trap symbol represents a trapped chest, not whether a trapped chest is actually present */ boolean -trapped_chest_at(ttyp, x, y) -int ttyp; -int x, y; +trapped_chest_at(int ttyp, int x, int y) { struct monst *mtmp; struct obj *otmp; @@ -152,9 +145,7 @@ int x, y; /* this is checking whether a trap symbol represents a trapped door, not whether the door here is actually trapped */ boolean -trapped_door_at(ttyp, x, y) -int ttyp; -int x, y; +trapped_door_at(int ttyp, int x, int y) { struct rm *lev; @@ -173,9 +164,7 @@ int x, y; /* recursively search obj for an object in class oclass, return 1st found */ struct obj * -o_in(obj, oclass) -struct obj *obj; -char oclass; +o_in(struct obj *obj, char oclass) { register struct obj *otmp; struct obj *temp; @@ -203,9 +192,7 @@ char oclass; * Return first found. */ struct obj * -o_material(obj, material) -struct obj *obj; -unsigned material; +o_material(struct obj *obj, unsigned material) { register struct obj *otmp; struct obj *temp; @@ -225,8 +212,7 @@ unsigned material; } static void -do_dknown_of(obj) -struct obj *obj; +do_dknown_of(struct obj *obj) { struct obj *otmp; @@ -239,10 +225,7 @@ struct obj *obj; /* Check whether the location has an outdated object displayed on it. */ static boolean -check_map_spot(x, y, oclass, material) -int x, y; -char oclass; -unsigned material; +check_map_spot(int x, int y, char oclass, unsigned material) { int glyph; register struct obj *otmp; @@ -296,9 +279,7 @@ unsigned material; * change occurs. */ static boolean -clear_stale_map(oclass, material) -char oclass; -unsigned material; +clear_stale_map(char oclass, unsigned material) { register int zx, zy; boolean change_made = FALSE; @@ -315,8 +296,7 @@ unsigned material; /* look for gold, on the floor or in monsters' possession */ int -gold_detect(sobj) -register struct obj *sobj; +gold_detect(struct obj *sobj) { register struct obj *obj; register struct monst *mtmp; @@ -462,8 +442,7 @@ register struct obj *sobj; /* returns 1 if nothing was detected, 0 if something was detected */ int -food_detect(sobj) -register struct obj *sobj; +food_detect(struct obj *sobj) { register struct obj *obj; register struct monst *mtmp; @@ -587,9 +566,8 @@ register struct obj *sobj; * 0 - something was detected */ int -object_detect(detector, class) -struct obj *detector; /* object doing the detecting */ -int class; /* an object class, 0 for all */ +object_detect(struct obj *detector, /* object doing the detecting */ + int class) /* an object class, 0 for all */ { register int x, y; char stuff[BUFSZ]; @@ -782,9 +760,8 @@ int class; /* an object class, 0 for all */ * Returns 0 if something was detected. */ int -monster_detect(otmp, mclass) -register struct obj *otmp; /* detecting object (if any) */ -int mclass; /* monster class, 0 for all */ +monster_detect(struct obj *otmp, /* detecting object (if any) */ + int mclass) /* monster class, 0 for all */ { register struct monst *mtmp; int mcnt = 0; @@ -851,10 +828,7 @@ int mclass; /* monster class, 0 for all */ } static void -sense_trap(trap, x, y, src_cursed) -struct trap *trap; -xchar x, y; -int src_cursed; +sense_trap(struct trap *trap, xchar x, xchar y, int src_cursed) { if (Hallucination || src_cursed) { struct obj obj; /* fake object */ @@ -894,10 +868,8 @@ int src_cursed; 2 if found at some other spot, 3 if both, 0 otherwise; optionally update the map to show where such traps were found */ static int -detect_obj_traps(objlist, show_them, how) -struct obj *objlist; -boolean show_them; -int how; /* 1 for misleading map feedback */ +detect_obj_traps(struct obj *objlist, boolean show_them, + int how) /* 1 for misleading map feedback */ { struct obj *otmp; xchar x, y; @@ -927,8 +899,8 @@ int how; /* 1 for misleading map feedback */ * returns 0 if something was detected */ int -trap_detect(sobj) -struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */ +trap_detect(struct obj *sobj) /* null if crystal ball, + *scroll if gold detection scroll */ { register struct trap *ttmp; struct monst *mon; @@ -1033,7 +1005,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */ } static int -furniture_detect() +furniture_detect(void) { struct monst *mon; int x, y, glyph, sym, found = 0, revealed = 0; @@ -1078,8 +1050,7 @@ furniture_detect() } const char * -level_distance(where) -d_level *where; +level_distance(d_level *where) { register schar ll = depth(&u.uz) - depth(where); register boolean indun = (u.uz.dnum == where->dnum); @@ -1139,8 +1110,7 @@ static const struct crystalballlevels { }; void -use_crystal_ball(optr) -struct obj **optr; +use_crystal_ball(struct obj **optr) { char ch; int oops; @@ -1305,8 +1275,7 @@ struct obj **optr; } static void -show_map_spot(x, y) -register int x, y; +show_map_spot(int x, int y) { struct rm *lev; struct trap *t; @@ -1350,7 +1319,7 @@ register int x, y; } void -do_mapping() +do_mapping(void) { register int zx, zy; boolean unconstrained; @@ -1373,8 +1342,7 @@ do_mapping() /* clairvoyance */ void -do_vicinity_map(sobj) -struct obj *sobj; /* scroll--actually fake spellbook--object */ +do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */ { register int zx, zy; struct monst *mtmp; @@ -1514,8 +1482,7 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ /* convert a secret door into a normal door */ void -cvt_sdoor_to_door(lev) -struct rm *lev; +cvt_sdoor_to_door(struct rm *lev) { int newmask = lev->doormask & ~WM_MASK; @@ -1534,9 +1501,7 @@ struct rm *lev; /* find something at one location; it should find all somethings there since it is used for magical detection rather than physical searching */ static void -findone(zx, zy, num) -int zx, zy; -genericptr_t num; +findone(int zx, int zy, genericptr_t num) { register struct trap *ttmp; register struct monst *mtmp; @@ -1590,9 +1555,7 @@ genericptr_t num; } static void -openone(zx, zy, num) -int zx, zy; -genericptr_t num; +openone(int zx, int zy, genericptr_t num) { register struct trap *ttmp; register struct obj *otmp; @@ -1653,7 +1616,7 @@ genericptr_t num; /* returns number of things found */ int -findit() +findit(void) { int num = 0; @@ -1665,7 +1628,7 @@ findit() /* returns number of things found and opened */ int -openit() +openit(void) { int num = 0; @@ -1686,15 +1649,13 @@ openit() /* callback hack for overriding vision in do_clear_area() */ boolean -detecting(func) -void FDECL((*func), (int, int, genericptr_t)); +detecting(void (*func)(int, int, genericptr_t)) { return (func == findone || func == openone); } void -find_trap(trap) -struct trap *trap; +find_trap(struct trap *trap) { boolean cleared = FALSE; @@ -1723,9 +1684,7 @@ struct trap *trap; } static int -mfind0(mtmp, via_warning) -struct monst *mtmp; -boolean via_warning; +mfind0(struct monst *mtmp, boolean via_warning) { int x = mtmp->mx, y = mtmp->my; boolean found_something = FALSE; @@ -1773,8 +1732,7 @@ boolean via_warning; } int -dosearch0(aflag) -register int aflag; /* intrinsic autosearch vs explicit searching */ +dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */ { xchar x, y; register struct trap *trap; @@ -1852,7 +1810,7 @@ register int aflag; /* intrinsic autosearch vs explicit searching */ /* the 's' command -- explicit searching */ int -dosearch() +dosearch(void) { if (cmd_safety_prevention("another search", "You already found a monster.", @@ -1862,7 +1820,7 @@ dosearch() } void -warnreveal() +warnreveal(void) { int x, y; struct monst *mtmp; @@ -1879,7 +1837,7 @@ warnreveal() /* Pre-map the sokoban levels */ void -sokoban_detect() +sokoban_detect(void) { register int x, y; register struct trap *ttmp; @@ -1906,10 +1864,8 @@ sokoban_detect() } static int -reveal_terrain_getglyph(x, y, full, swallowed, default_glyph, which_subset) -int x, y, full; -unsigned swallowed; -int default_glyph, which_subset; +reveal_terrain_getglyph(int x, int y, int full, unsigned swallowed, + int default_glyph, int which_subset) { int glyph, levl_glyph; uchar seenv; @@ -1987,7 +1943,7 @@ int default_glyph, which_subset; #ifdef DUMPLOG void -dump_map() +dump_map(void) { int x, y, glyph, skippedrows, lastnonblank; int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON; @@ -2044,9 +2000,10 @@ dump_map() /* idea from crawl; show known portion of map without any monsters, objects, or traps occluding the view of the underlying terrain */ void -reveal_terrain(full, which_subset) -int full; /* wizard|explore modes allow player to request full map */ -int which_subset; /* when not full, whether to suppress objs and/or traps */ +reveal_terrain(int full, /* wizard|explore modes allow player + to request full map */ + int which_subset) /* when not full, whether to suppress + objs and/or traps */ { if ((Hallucination || Stunned || Confusion) && !full) { You("are too disoriented for this."); @@ -2101,7 +2058,7 @@ int which_subset; /* when not full, whether to suppress objs and/or traps */ } int -wiz_mgender(VOID_ARGS) +wiz_mgender(void) { iflags.wizmgender = !iflags.wizmgender; pline("wizmgender toggled %s", iflags.wizmgender ? "on" : "off"); diff --git a/src/dig.c b/src/dig.c index 15553d11b..63f51b5a4 100644 --- a/src/dig.c +++ b/src/dig.c @@ -5,15 +5,14 @@ #include "hack.h" -static boolean NDECL(rm_waslit); -static void FDECL(mkcavepos, - (XCHAR_P, XCHAR_P, int, BOOLEAN_P, BOOLEAN_P)); -static void FDECL(mkcavearea, (BOOLEAN_P)); -static int NDECL(dig); -static void FDECL(dig_up_grave, (coord *)); -static int FDECL(adj_pit_checks, (coord *, char *)); -static void FDECL(pit_flow, (struct trap *, SCHAR_P)); -static boolean FDECL(furniture_handled, (int, int, BOOLEAN_P)); +static boolean rm_waslit(void); +static void mkcavepos(xchar, xchar, int, boolean, boolean); +static void mkcavearea(boolean); +static int dig(void); +static void dig_up_grave(coord *); +static int adj_pit_checks(coord *, char *); +static void pit_flow(struct trap *, schar); +static boolean furniture_handled(int, int, boolean); /* Indices returned by dig_typ() */ enum dig_types { @@ -26,7 +25,7 @@ enum dig_types { }; static boolean -rm_waslit() +rm_waslit(void) { register xchar x, y; @@ -44,10 +43,7 @@ rm_waslit() * immediately after the effect is complete. */ static void -mkcavepos(x, y, dist, waslit, rockit) -xchar x, y; -int dist; -boolean waslit, rockit; +mkcavepos(xchar x, xchar y, int dist, boolean waslit, boolean rockit) { register struct rm *lev; @@ -87,8 +83,7 @@ boolean waslit, rockit; } static void -mkcavearea(rockit) -register boolean rockit; +mkcavearea(boolean rockit) { int dist; xchar xmin = u.ux, xmax = u.ux; @@ -139,9 +134,7 @@ register boolean rockit; /* When digging into location , what are you actually digging into? */ int -dig_typ(otmp, x, y) -struct obj *otmp; -xchar x, y; +dig_typ(struct obj *otmp, xchar x, xchar y) { boolean ispick; @@ -167,7 +160,7 @@ xchar x, y; } boolean -is_digging() +is_digging(void) { if (g.occupation == dig) { return TRUE; @@ -179,10 +172,7 @@ is_digging() #define BY_OBJECT ((struct monst *) 0) boolean -dig_check(madeby, verbose, x, y) -struct monst *madeby; -boolean verbose; -int x, y; +dig_check(struct monst *madeby, boolean verbose, int x, int y) { struct trap *ttmp = t_at(x, y); const char *verb = @@ -238,7 +228,7 @@ int x, y; } static int -dig(VOID_ARGS) +dig(void) { register struct rm *lev; register xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y; @@ -491,9 +481,7 @@ dig(VOID_ARGS) } static boolean -furniture_handled(x, y, madeby_u) -int x, y; -boolean madeby_u; +furniture_handled(int x, int y, boolean madeby_u) { struct rm *lev = &levl[x][y]; @@ -519,7 +507,7 @@ boolean madeby_u; /* When will hole be finished? Very rough indication used by shopkeeper. */ int -holetime() +holetime(void) { if (g.occupation != dig || !*u.ushops) return -1; @@ -528,9 +516,8 @@ holetime() /* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */ schar -fillholetyp(x, y, fill_if_any) -int x, y; -boolean fill_if_any; /* force filling if it exists at all */ +fillholetyp(int x, int y, + boolean fill_if_any) /* force filling if it exists at all */ { register int x1, y1; int lo_x = max(1, x - 1), hi_x = min(x + 1, COLNO - 1), @@ -563,10 +550,7 @@ boolean fill_if_any; /* force filling if it exists at all */ } void -digactualhole(x, y, madeby, ttyp) -register int x, y; -struct monst *madeby; -int ttyp; +digactualhole(int x, int y, struct monst *madeby, int ttyp) { struct obj *oldobjs, *newobjs; register struct trap *ttmp; @@ -745,11 +729,8 @@ int ttyp; * in apply.c. */ void -liquid_flow(x, y, typ, ttmp, fillmsg) -xchar x, y; -schar typ; -struct trap *ttmp; -const char *fillmsg; +liquid_flow(xchar x, xchar y, schar typ, struct trap *ttmp, + const char *fillmsg) { struct obj *objchain; struct monst *mon; @@ -779,9 +760,7 @@ const char *fillmsg; /* return TRUE if digging succeeded, FALSE otherwise */ boolean -dighole(pit_only, by_magic, cc) -boolean pit_only, by_magic; -coord *cc; +dighole(boolean pit_only, boolean by_magic, coord *cc) { register struct trap *ttmp; struct rm *lev; @@ -917,8 +896,7 @@ coord *cc; } static void -dig_up_grave(cc) -coord *cc; +dig_up_grave(coord *cc) { struct obj *otmp; xchar dig_x, dig_y; @@ -977,8 +955,7 @@ coord *cc; } int -use_pick_axe(obj) -struct obj *obj; +use_pick_axe(struct obj *obj) { const char *sdp, *verb; char *dsp, dirsyms[12], qbuf[BUFSZ]; @@ -1043,8 +1020,7 @@ struct obj *obj; /* the "In what direction do you want to dig?" query. */ /* use_pick_axe2() uses the existing u.dx, u.dy and u.dz */ int -use_pick_axe2(obj) -struct obj *obj; +use_pick_axe2(struct obj *obj) { register int rx, ry; register struct rm *lev; @@ -1232,10 +1208,7 @@ struct obj *obj; * zap == TRUE if wand/spell of digging, FALSE otherwise (chewing) */ void -watch_dig(mtmp, x, y, zap) -struct monst *mtmp; -xchar x, y; -boolean zap; +watch_dig(struct monst *mtmp, xchar x, xchar y, boolean zap) { struct rm *lev = &levl[x][y]; @@ -1278,8 +1251,7 @@ boolean zap; /* Return TRUE if monster died, FALSE otherwise. Called from m_move(). */ boolean -mdig_tunnel(mtmp) -register struct monst *mtmp; +mdig_tunnel(struct monst *mtmp) { register struct rm *here; int pile = rnd(12); @@ -1361,8 +1333,7 @@ register struct monst *mtmp; /* draft refers to air currents, but can be a pun on "draft" as conscription for military service (probably not a good pun if it has to be explained) */ void -draft_message(unexpected) -boolean unexpected; +draft_message(boolean unexpected) { /* * [Bug or TODO? Have caller pass coordinates and use the travel @@ -1406,7 +1377,7 @@ boolean unexpected; /* digging via wand zap or spell cast */ void -zap_dig() +zap_dig(void) { struct rm *room; struct monst *mtmp; @@ -1620,9 +1591,7 @@ zap_dig() * down in the pit. */ static int -adj_pit_checks(cc, msg) -coord *cc; -char *msg; +adj_pit_checks(coord *cc, char *msg) { int ltyp; struct rm *room; @@ -1704,9 +1673,7 @@ char *msg; * Ensure that all conjoined pits fill up. */ static void -pit_flow(trap, filltyp) -struct trap *trap; -schar filltyp; +pit_flow(struct trap *trap, schar filltyp) { /* * FIXME? @@ -1747,8 +1714,7 @@ schar filltyp; } struct obj * -buried_ball(cc) -coord *cc; +buried_ball(coord *cc) { int odist, bdist = COLNO; struct obj *otmp, *ball = 0; @@ -1798,7 +1764,7 @@ coord *cc; } void -buried_ball_to_punishment() +buried_ball_to_punishment(void) { coord cc; struct obj *ball; @@ -1821,7 +1787,7 @@ buried_ball_to_punishment() } void -buried_ball_to_freedom() +buried_ball_to_freedom(void) { coord cc; struct obj *ball; @@ -1847,9 +1813,7 @@ buried_ball_to_freedom() /* move objects from fobj/nexthere lists to buriedobjlist, keeping position information */ struct obj * -bury_an_obj(otmp, dealloced) -struct obj *otmp; -boolean *dealloced; +bury_an_obj(struct obj *otmp, boolean *dealloced) { struct obj *otmp2; boolean under_ice; @@ -1915,8 +1879,7 @@ boolean *dealloced; } void -bury_objs(x, y) -int x, y; +bury_objs(int x, int y) { struct obj *otmp, *otmp2; struct monst *shkp; @@ -1950,8 +1913,7 @@ int x, y; /* move objects from buriedobjlist to fobj/nexthere lists */ void -unearth_objs(x, y) -int x, y; +unearth_objs(int x, int y) { struct obj *otmp, *otmp2, *bball; coord cc; @@ -1990,9 +1952,7 @@ int x, y; */ /* ARGSUSED */ void -rot_organic(arg, timeout) -anything *arg; -long timeout UNUSED; +rot_organic(anything *arg, long timeout UNUSED) { struct obj *obj = arg->a_obj; @@ -2013,9 +1973,7 @@ long timeout UNUSED; * Called when a corpse has rotted completely away. */ void -rot_corpse(arg, timeout) -anything *arg; -long timeout; +rot_corpse(anything *arg, long timeout) { xchar x = 0, y = 0; struct obj *obj = arg->a_obj; @@ -2067,8 +2025,7 @@ long timeout; #if 0 void -bury_monst(mtmp) -struct monst *mtmp; +bury_monst(struct monst *mtmp) { debugpline1("bury_monst: %s", mon_nam(mtmp)); if (canseemon(mtmp)) { @@ -2087,7 +2044,7 @@ struct monst *mtmp; } void -bury_you() +bury_you(void) { debugpline0("bury_you"); if (!Levitation && !Flying) { @@ -2105,7 +2062,7 @@ bury_you() } void -unearth_you() +unearth_you(void) { debugpline0("unearth_you"); u.uburied = FALSE; @@ -2116,7 +2073,7 @@ unearth_you() } void -escape_tomb() +escape_tomb(void) { debugpline0("escape_tomb"); if ((Teleportation || can_teleport(g.youmonst.data)) @@ -2163,7 +2120,7 @@ struct obj *otmp; #ifdef DEBUG /* bury everything at your loc and around */ int -wiz_debug_cmd_bury() +wiz_debug_cmd_bury(void) { int x, y; diff --git a/src/display.c b/src/display.c index d2bbe9cbe..1b766f4f4 100644 --- a/src/display.c +++ b/src/display.c @@ -123,31 +123,30 @@ */ #include "hack.h" -static void FDECL(show_mon_or_warn, (int, int, int)); -static void FDECL(display_monster, (XCHAR_P, XCHAR_P, struct monst *, int, - BOOLEAN_P)); -static int FDECL(swallow_to_glyph, (int, int)); -static void FDECL(display_warning, (struct monst *)); - -static int FDECL(check_pos, (int, int, int)); -static int FDECL(get_bk_glyph, (XCHAR_P, XCHAR_P)); -static int FDECL(tether_glyph, (int, int)); +static void show_mon_or_warn(int, int, int); +static void display_monster(xchar, xchar, struct monst *, int, boolean); +static int swallow_to_glyph(int, int); +static void display_warning(struct monst *); + +static int check_pos(int, int, int); +static int get_bk_glyph(xchar, xchar); +static int tether_glyph(int, int); #ifdef UNBUFFERED_GLYPHINFO -static glyph_info *FDECL(glyphinfo_at, (XCHAR_P, XCHAR_P, int)); +static glyph_info *glyphinfo_at(xchar, xchar, int); #endif /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ #ifdef WA_VERBOSE -static boolean FDECL(more_than_one, (int, int, int, int, int)); +static boolean more_than_one(int, int, int, int, int); #endif -static int FDECL(set_twall, (int, int, int, int, int, int, int, int)); -static int FDECL(set_wall, (int, int, int)); -static int FDECL(set_corn, (int, int, int, int, int, int, int, int)); -static int FDECL(set_crosswall, (int, int)); -static void FDECL(set_seenv, (struct rm *, int, int, int, int)); -static void FDECL(t_warn, (struct rm *)); -static int FDECL(wall_angle, (struct rm *)); +static int set_twall(int, int, int, int, int, int, int, int); +static int set_wall(int, int, int); +static int set_corn(int, int, int, int, int, int, int, int); +static int set_crosswall(int, int); +static void set_seenv(struct rm *, int, int, int, int); +static void t_warn(struct rm *); +static int wall_angle(struct rm *); #define remember_topology(x, y) (g.lastseentyp[x][y] = levl[x][y].typ) @@ -158,9 +157,7 @@ static int FDECL(wall_angle, (struct rm *)); * attention to and correct unexplored, lit ROOM and CORR spots. */ void -magic_map_background(x, y, show) -xchar x, y; -int show; +magic_map_background(xchar x, xchar y, int show) { int glyph = back_to_glyph(x, y); /* assumes hero can see x,y */ struct rm *lev = &levl[x][y]; @@ -208,9 +205,7 @@ int show; * the hero can physically see the location. Update the screen if directed. */ void -map_background(x, y, show) -register xchar x, y; -register int show; +map_background(register xchar x, register xchar y, register int show) { register int glyph = back_to_glyph(x, y); @@ -227,9 +222,7 @@ register int show; * hero can physically see the location. */ void -map_trap(trap, show) -register struct trap *trap; -register int show; +map_trap(register struct trap *trap, register int show) { register int x = trap->tx, y = trap->ty; register int glyph = trap_to_glyph(trap); @@ -247,9 +240,7 @@ register int show; * see the location of the object. Update the screen if directed. */ void -map_object(obj, show) -register struct obj *obj; -register int show; +map_object(register struct obj *obj, register int show) { register int x = obj->ox, y = obj->oy; register int glyph = obj_to_glyph(obj, newsym_rn2); @@ -278,8 +269,7 @@ register int show; * by newsym() if necessary. */ void -map_invisible(x, y) -register xchar x, y; +map_invisible(register xchar x, register xchar y) { if (x != u.ux || y != u.uy) { /* don't display I at hero's location */ if (g.level.flags.hero_memory) @@ -289,8 +279,7 @@ register xchar x, y; } boolean -unmap_invisible(x, y) -int x, y; +unmap_invisible(int x, int y) { if (isok(x,y) && glyph_is_invisible(levl[x][y].glyph)) { unmap_object(x, y); @@ -311,8 +300,7 @@ int x, y; * to call newsym(). */ void -unmap_object(x, y) -register int x, y; +unmap_object(register int x, register int y) { register struct trap *trap; @@ -359,16 +347,14 @@ register int x, y; } void -map_location(x, y, show) -int x, y, show; +map_location(int x, int y, int show) { _map_location(x, y, show); } /* display something on monster layer; may need to fixup object layer */ static void -show_mon_or_warn(x, y, monglyph) -int x, y, monglyph; +show_mon_or_warn(int x, int y, int monglyph) { struct obj *o; @@ -400,12 +386,11 @@ int x, y, monglyph; * */ static void -display_monster(x, y, mon, sightflags, worm_tail) -register xchar x, y; /* display position */ -register struct monst *mon; /* monster to display */ -int sightflags; /* 1 if the monster is physically seen; - 2 if detected using Detect_monsters */ -boolean worm_tail; /* mon is actually a worm tail */ +display_monster(xchar x, xchar y, /* display position */ + struct monst *mon, /* monster to display */ + int sightflags, /* 1 if the monster is physically seen; + 2 if detected using Detect_monsters */ + boolean worm_tail) /* mon is actually a worm tail */ { boolean mon_mimic = (M_AP_TYPE(mon) != M_AP_NOTHING); int sensed = (mon_mimic && (Protection_from_shape_changers @@ -514,8 +499,7 @@ boolean worm_tail; /* mon is actually a worm tail */ * Do not call for worm tails. */ static void -display_warning(mon) -register struct monst *mon; +display_warning(struct monst *mon) { int x = mon->mx, y = mon->my; int glyph; @@ -534,8 +518,7 @@ register struct monst *mon; } int -warning_of(mon) -struct monst *mon; +warning_of(struct monst *mon) { int wl = 0, tmp = 0; @@ -553,8 +536,7 @@ struct monst *mon; * When hero knows what happened to location, even when blind. */ void -feel_newsym(x, y) -xchar x, y; +feel_newsym(xchar x, xchar y) { if (Blind) feel_location(x, y); @@ -574,8 +556,7 @@ xchar x, y; * searching only finds one monster per turn so we must check that separately. */ void -feel_location(x, y) -xchar x, y; +feel_location(xchar x, xchar y) { struct rm *lev; struct obj *boulder; @@ -733,8 +714,7 @@ xchar x, y; * Possibly put a new glyph at the given location. */ void -newsym(x, y) -register int x, y; +newsym(register int x, register int y) { struct monst *mon; int see_it; @@ -901,8 +881,7 @@ register int x, y; * pulled into a platform dependent routine for fancier graphics if desired. */ void -shieldeff(x, y) -xchar x, y; +shieldeff(xchar x, xchar y) { register int i; @@ -919,8 +898,7 @@ xchar x, y; } static int -tether_glyph(x, y) -int x, y; +tether_glyph(int x, int y) { int tdx, tdy; tdx = u.ux - x; @@ -965,8 +943,7 @@ static struct tmp_glyph { } tgfirst; void -tmp_at(x, y) -int x, y; +tmp_at(int x, int y) { static struct tmp_glyph *tglyph = (struct tmp_glyph *) 0; struct tmp_glyph *tmp; @@ -1095,9 +1072,7 @@ int x, y; * meant to be at the location. */ void -flash_glyph_at(x, y, tg, rpt) -int x, y; -int tg, rpt; +flash_glyph_at(int x, int y, int tg, int rpt) { int i, glyph[2]; @@ -1124,8 +1099,7 @@ int tg, rpt; * being swallowed. */ void -swallowed(first) -int first; +swallowed(int first) { static xchar lastx, lasty; /* last swallowed position */ int swallower, left_ok, rght_ok; @@ -1188,8 +1162,7 @@ int first; * except when in water level. Special routines exist for that. */ void -under_water(mode) -int mode; +under_water(int mode) { static xchar lastx, lasty; static boolean dela; @@ -1239,8 +1212,7 @@ int mode; * Very restricted display. You can only see yourself. */ void -under_ground(mode) -int mode; +under_ground(int mode) { static boolean dela; @@ -1281,7 +1253,7 @@ int mode; * sit.c] */ void -see_monsters() +see_monsters(void) { register struct monst *mon; int new_warn_obj_cnt = 0; @@ -1318,7 +1290,7 @@ see_monsters() * changes. */ void -set_mimic_blocking() +set_mimic_blocking(void) { register struct monst *mon; @@ -1339,7 +1311,7 @@ set_mimic_blocking() * + hallucinating. */ void -see_objects() +see_objects(void) { register struct obj *obj; @@ -1358,7 +1330,7 @@ see_objects() * Update hallucinated traps. */ void -see_traps() +see_traps(void) { struct trap *trap; int glyph; @@ -1387,20 +1359,20 @@ static glyph_info ginfo; * Put the cursor on the hero. Flush all accumulated glyphs before doing it. */ void -curs_on_u() +curs_on_u(void) { flush_screen(1); /* Flush waiting glyphs & put cursor on hero */ } int -doredraw() +doredraw(void) { docrt(); return 0; } void -docrt() +docrt(void) { register int x, y; register struct rm *lev; @@ -1455,7 +1427,7 @@ docrt() /* for panning beyond a clipped region; resend the current map data to the interface rather than use docrt()'s regeneration of that data */ void -redraw_map() +redraw_map(void) { int x, y, glyph; glyph_info bkglyphinfo = nul_glyphinfo; @@ -1493,7 +1465,7 @@ redraw_map() * ======================================================= */ void -reglyph_darkroom() +reglyph_darkroom(void) { xchar x, y; @@ -1528,8 +1500,7 @@ reglyph_darkroom() * between object piles and single objects, it doesn't mark the location * for update. */ void -newsym_force(x, y) -register int x, y; +newsym_force(int x, int y) { newsym(x, y); g.gbuf[y][x].gnew = 1; @@ -1543,8 +1514,7 @@ register int x, y; * Store the glyph in the 3rd screen for later flushing. */ void -show_glyph(x, y, glyph) -int x, y, glyph; +show_glyph(int x, int y, int glyph) { #ifndef UNBUFFERED_GLYPHINFO glyph_info glyphinfo; @@ -1669,7 +1639,7 @@ static gbuf_entry nul_gbuf = { * Turn the 3rd screen into UNEXPLORED that needs to be refreshed. */ void -clear_glyph_buffer() +clear_glyph_buffer(void) { register int x, y; gbuf_entry *gptr = &g.gbuf[0][0]; @@ -1704,8 +1674,7 @@ clear_glyph_buffer() /* used by tty after menu or text popup has temporarily overwritten the map and it has been erased so shows spaces, not necessarily S_unexplored */ void -row_refresh(start, stop, y) -int start, stop, y; +row_refresh(int start, int stop, int y) { register int x, glyph; register boolean force; @@ -1741,7 +1710,7 @@ int start, stop, y; } void -cls() +cls(void) { static boolean in_cls = 0; @@ -1760,8 +1729,7 @@ cls() * Synch the third screen with the display. */ void -flush_screen(cursor_on_u) -int cursor_on_u; +flush_screen(int cursor_on_u) { /* Prevent infinite loops on errors: * flush_screen->print_glyph->impossible->pline->flush_screen @@ -1828,8 +1796,7 @@ int cursor_on_u; * variables. */ int -back_to_glyph(x, y) -xchar x, y; +back_to_glyph(xchar x, xchar y) { int idx; struct rm *ptr = &(levl[x][y]); @@ -1960,9 +1927,7 @@ xchar x, y; * a random monster in swallowed() and don't use what_mon() here. */ static int -swallow_to_glyph(mnum, loc) -int mnum; -int loc; +swallow_to_glyph(int mnum, int loc) { if (loc < S_sw_tl || S_sw_br < loc) { impossible("swallow_to_glyph: bad swallow location"); @@ -1985,9 +1950,7 @@ int loc; * / S_rslant (-1, 1) or ( 1,-1) */ int -zapdir_to_glyph(dx, dy, beam_type) -register int dx, dy; -int beam_type; +zapdir_to_glyph(int dx, int dy, int beam_type) { if (beam_type >= NUM_ZAP) { impossible("zapdir_to_glyph: illegal beam type"); @@ -2004,8 +1967,7 @@ int beam_type; * structure, so we must check the "third screen". */ int -glyph_at(x, y) -xchar x, y; +glyph_at(xchar x, xchar y) { if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) return cmap_to_glyph(S_room); /* XXX */ @@ -2014,9 +1976,7 @@ xchar x, y; #ifdef UNBUFFERED_GLYPHINFO glyph_info * -glyphinfo_at(x, y, glyph) -xchar x, y; -int glyph; +glyphinfo_at(xchar x, xchar y, int glyph) { map_glyphinfo(x, y, glyph, 0, &ginfo); return &ginfo; @@ -2037,8 +1997,7 @@ int glyph; */ static int -get_bk_glyph(x, y) -xchar x, y; +get_bk_glyph(xchar x, xchar y) { int idx, bkglyph = GLYPH_UNEXPLORED; struct rm *lev = &levl[x][y]; @@ -2145,11 +2104,8 @@ static const int explcolors[] = { #define GMAP_ALTARCOLOR 0x00000004 void -map_glyphinfo(x, y, glyph, mgflags, glyphinfo) -xchar x, y; -int glyph; -unsigned mgflags; -glyph_info *glyphinfo; +map_glyphinfo(xchar x, xchar y, int glyph, + unsigned mgflags, glyph_info *glyphinfo) { register int offset, idx; int color = NO_COLOR; @@ -2456,8 +2412,8 @@ glyph_info *glyphinfo; #ifdef WA_VERBOSE -static const char *FDECL(type_to_name, (int)); -static void FDECL(error4, (int, int, int, int, int, int)); +static const char *type_to_name(int); +static void error4(int, int, int, int, int, int); static int bad_count[MAX_TYPE]; /* count of positions flagged as bad */ static const char *type_names[MAX_TYPE] = { @@ -2470,15 +2426,13 @@ static const char *type_names[MAX_TYPE] = { }; static const char * -type_to_name(type) -int type; +type_to_name(int type) { return (type < 0 || type >= MAX_TYPE) ? "unknown" : type_names[type]; } static void -error4(x, y, a, b, c, dd) -int x, y, a, b, c, dd; +error4(int x, int y, int a, int b, int c, int dd) { pline("set_wall_state: %s @ (%d,%d) %s%s%s%s", type_to_name(levl[x][y].typ), x, y, @@ -2494,8 +2448,7 @@ int x, y, a, b, c, dd; * Things that are ambiguous: lava */ static int -check_pos(x, y, which) -int x, y, which; +check_pos(int x, int y, int which) { int type; @@ -2511,8 +2464,7 @@ int x, y, which; /*ARGSUSED*/ #ifdef WA_VERBOSE static boolean -more_than_one(x, y, a, b, c) -int x, y, a, b, c; +more_than_one(int x, int y, int a, int b, int c) { if ((a && (b | c)) || (b && (a | c)) || (c && (a | b))) { error4(x, y, a, b, c, 0); @@ -2527,13 +2479,13 @@ int x, y, a, b, c; /* Return the wall mode for a T wall. */ static int -set_twall(x0, y0, x1, y1, x2, y2, x3, y3) +set_twall( #ifdef WA_VERBOSE -int x0, y0; /* used #if WA_VERBOSE */ + int x0, int y0, /* used #if WA_VERBOSE */ #else -int x0 UNUSED, y0 UNUSED; + int x0 UNUSED, int y0 UNUSED, #endif -int x1, y1, x2, y2, x3, y3; + int x1, int y1, int x2, int y2, int x3, int y3) { int wmode, is_1, is_2, is_3; @@ -2550,8 +2502,7 @@ int x1, y1, x2, y2, x3, y3; /* Return wall mode for a horizontal or vertical wall. */ static int -set_wall(x, y, horiz) -int x, y, horiz; +set_wall(int x, int y, int horiz) { int wmode, is_1, is_2; @@ -2572,8 +2523,7 @@ int x, y, horiz; /* Return a wall mode for a corner wall. (x4,y4) is the "inner" position. */ static int -set_corn(x1, y1, x2, y2, x3, y3, x4, y4) -int x1, y1, x2, y2, x3, y3, x4, y4; +set_corn(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { int wmode, is_1, is_2, is_3, is_4; @@ -2601,8 +2551,7 @@ int x1, y1, x2, y2, x3, y3, x4, y4; /* Return mode for a crosswall. */ static int -set_crosswall(x, y) -int x, y; +set_crosswall(int x, int y) { int wmode, is_1, is_2, is_3, is_4; @@ -2637,7 +2586,7 @@ int x, y; /* Called from mklev. Scan the level and set the wall modes. */ void -set_wall_state() +set_wall_state(void) { int x, y; int wmode; @@ -2724,9 +2673,8 @@ unsigned char seenv_matrix[3][3] = { { SV2, SV1, SV0 }, /* Set the seen vector of lev as if seen from (x0,y0) to (x,y). */ static void -set_seenv(lev, x0, y0, x, y) -struct rm *lev; -int x0, y0, x, y; /* from, to */ +set_seenv(struct rm *lev, + int x0, int y0, int x, int y) /* from, to */ { int dx = x - x0, dy = y0 - y; @@ -2736,9 +2684,9 @@ int x0, y0, x, y; /* from, to */ /* Called by blackout(vault.c) when vault guard removes temporary corridor, turning spot back into stone; is an adjacent spot. */ void -unset_seenv(lev, x0, y0, x1, y1) -struct rm *lev; /* &levl[x1][y1] */ -int x0, y0, x1, y1; /* from, to; abs(x1-x0)==1 && abs(y0-y1)==1 */ +unset_seenv(struct rm *lev, /* &levl[x1][y1] */ + int x0, int y0, int x1, int y1) /* from, to; abs(x1-x0)==1 + && abs(y0-y1)==1 */ { int dx = x1 - x0, dy = y0 - y1; @@ -2803,8 +2751,7 @@ static const int cross_matrix[4][6] = { /* Print out a T wall warning and all interesting info. */ static void -t_warn(lev) -struct rm *lev; +t_warn(struct rm *lev) { static const char warn_str[] = "wall_angle: %s: case %d: seenv = 0x%x"; const char *wname; @@ -2836,8 +2783,7 @@ struct rm *lev; * seen vector (SV). */ static int -wall_angle(lev) -struct rm *lev; +wall_angle(struct rm *lev) { register unsigned int seenv = lev->seenv & 0xff; const int *row; diff --git a/src/dlb.c b/src/dlb.c index a2bb28bdb..6b631796a 100644 --- a/src/dlb.c +++ b/src/dlb.c @@ -19,15 +19,15 @@ */ typedef struct dlb_procs { - boolean NDECL((*dlb_init_proc)); - void NDECL((*dlb_cleanup_proc)); - boolean FDECL((*dlb_fopen_proc), (DLB_P, const char *, const char *)); - int FDECL((*dlb_fclose_proc), (DLB_P)); - int FDECL((*dlb_fread_proc), (char *, int, int, DLB_P)); - int FDECL((*dlb_fseek_proc), (DLB_P, long, int)); - char *FDECL((*dlb_fgets_proc), (char *, int, DLB_P)); - int FDECL((*dlb_fgetc_proc), (DLB_P)); - long FDECL((*dlb_ftell_proc), (DLB_P)); + boolean (*dlb_init_proc)(void); + void (*dlb_cleanup_proc)(void); + boolean (*dlb_fopen_proc)(DLB_P, const char *, const char *); + int (*dlb_fclose_proc)(DLB_P); + int (*dlb_fread_proc)(char *, int, int, DLB_P); + int (*dlb_fseek_proc)(DLB_P, long, int); + char *(*dlb_fgets_proc)(char *, int, DLB_P); + int (*dlb_fgetc_proc)(DLB_P); + long (*dlb_ftell_proc)(DLB_P); } dlb_procs_t; #if defined(VERSION_IN_DLB_FILENAME) @@ -35,7 +35,7 @@ char dlbfilename[MAX_DLB_FILENAME]; #endif /* without extern.h via hack.h, these haven't been declared for us */ -extern FILE *FDECL(fopen_datafile, (const char *, const char *, int)); +extern FILE *fopen_datafile(const char *, const char *, int); #ifdef DLBLIB /* @@ -57,25 +57,25 @@ extern FILE *FDECL(fopen_datafile, (const char *, const char *, int)); #define MAX_LIBS 4 static library dlb_libs[MAX_LIBS]; -static boolean FDECL(readlibdir, (library * lp)); -static boolean FDECL(find_file, (const char *name, library **lib, - long *startp, long *sizep)); -static boolean NDECL(lib_dlb_init); -static void NDECL(lib_dlb_cleanup); -static boolean FDECL(lib_dlb_fopen, (dlb *, const char *, const char *)); -static int FDECL(lib_dlb_fclose, (dlb *)); -static int FDECL(lib_dlb_fread, (char *, int, int, dlb *)); -static int FDECL(lib_dlb_fseek, (dlb *, long, int)); -static char *FDECL(lib_dlb_fgets, (char *, int, dlb *)); -static int FDECL(lib_dlb_fgetc, (dlb *)); -static long FDECL(lib_dlb_ftell, (dlb *)); +static boolean readlibdir(library * lp); +static boolean find_file(const char *name, library **lib, long *startp, + long *sizep); +static boolean lib_dlb_init(void); +static void lib_dlb_cleanup(void); +static boolean lib_dlb_fopen(dlb *, const char *, const char *); +static int lib_dlb_fclose(dlb *); +static int lib_dlb_fread(char *, int, int, dlb *); +static int lib_dlb_fseek(dlb *, long, int); +static char *lib_dlb_fgets(char *, int, dlb *); +static int lib_dlb_fgetc(dlb *); +static long lib_dlb_ftell(dlb *); /* not static because shared with dlb_main.c */ -boolean FDECL(open_library, (const char *lib_name, library *lp)); -void FDECL(close_library, (library * lp)); +boolean open_library(const char *lib_name, library *lp); +void close_library(library * lp); /* without extern.h via hack.h, these haven't been declared for us */ -extern char *FDECL(eos, (char *)); +extern char *eos(char *); /* * Read the directory out of the library. Return 1 if successful, @@ -120,8 +120,7 @@ extern char *FDECL(eos, (char *)); * Return TRUE on success, FALSE on failure. */ static boolean -readlibdir(lp) -library *lp; /* library pointer to fill in */ +readlibdir(library *lp) /* library pointer to fill in */ { int i; char *sp; @@ -169,10 +168,7 @@ library *lp; /* library pointer to fill in */ * 0 if not found. Fill in the size and starting position. */ static boolean -find_file(name, lib, startp, sizep) -const char *name; -library **lib; -long *startp, *sizep; +find_file(const char *name, library **lib, long *startp, long *sizep) { int i, j; library *lp; @@ -198,9 +194,7 @@ long *startp, *sizep; * structure. Return TRUE if successful, FALSE otherwise. */ boolean -open_library(lib_name, lp) -const char *lib_name; -library *lp; +open_library(const char *lib_name, library *lp) { boolean status = FALSE; @@ -217,8 +211,7 @@ library *lp; } void -close_library(lp) -library *lp; +close_library(library *lp) { (void) fclose(lp->fdata); free((genericptr_t) lp->dir); @@ -232,7 +225,7 @@ library *lp; * keep track of the file position. */ static boolean -lib_dlb_init(VOID_ARGS) +lib_dlb_init(void) { /* zero out array */ (void) memset((char *) &dlb_libs[0], 0, sizeof(dlb_libs)); @@ -252,7 +245,7 @@ lib_dlb_init(VOID_ARGS) } static void -lib_dlb_cleanup(VOID_ARGS) +lib_dlb_cleanup(void) { int i; @@ -263,8 +256,7 @@ lib_dlb_cleanup(VOID_ARGS) #ifdef VERSION_IN_DLB_FILENAME char * -build_dlb_filename(lf) -const char *lf; +build_dlb_filename(const char *lf) { Sprintf(dlbfilename, "%s%d%d%d", lf ? lf : DLBBASENAME, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL); @@ -274,10 +266,7 @@ const char *lf; /*ARGSUSED*/ static boolean -lib_dlb_fopen(dp, name, mode) -dlb *dp; -const char *name; -const char *mode UNUSED; +lib_dlb_fopen(dlb *dp, const char *name, const char *mode UNUSED) { long start, size; library *lp; @@ -296,18 +285,14 @@ const char *mode UNUSED; /*ARGUSED*/ static int -lib_dlb_fclose(dp) -dlb *dp UNUSED; +lib_dlb_fclose(dlb *dp UNUSED) { /* nothing needs to be done */ return 0; } static int -lib_dlb_fread(buf, size, quan, dp) -char *buf; -int size, quan; -dlb *dp; +lib_dlb_fread(char *buf, int size, int quan, dlb *dp) { long pos, nread, nbytes; @@ -332,10 +317,7 @@ dlb *dp; } static int -lib_dlb_fseek(dp, pos, whence) -dlb *dp; -long pos; -int whence; +lib_dlb_fseek(dlb *dp, long pos, int whence) { long curpos; @@ -360,10 +342,7 @@ int whence; } static char * -lib_dlb_fgets(buf, len, dp) -char *buf; -int len; -dlb *dp; +lib_dlb_fgets(char *buf, int len, dlb *dp) { int i; char *bp, c = 0; @@ -395,8 +374,7 @@ dlb *dp; } static int -lib_dlb_fgetc(dp) -dlb *dp; +lib_dlb_fgetc(dlb *dp) { char c; @@ -406,8 +384,7 @@ dlb *dp; } static long -lib_dlb_ftell(dp) -dlb *dp; +lib_dlb_ftell(dlb *dp) { return dp->mark; } @@ -445,7 +422,7 @@ static const dlb_procs_t *dlb_procs; static boolean dlb_initialized = FALSE; boolean -dlb_init() +dlb_init(void) { if (!dlb_initialized) { #ifdef DLBLIB @@ -463,7 +440,7 @@ dlb_init() } void -dlb_cleanup() +dlb_cleanup(void) { if (dlb_initialized) { do_dlb_cleanup(); @@ -472,8 +449,7 @@ dlb_cleanup() } dlb * -dlb_fopen(name, mode) -const char *name, *mode; +dlb_fopen(const char *name, const char *mode) { FILE *fp; dlb *dp; @@ -500,8 +476,7 @@ const char *name, *mode; } int -dlb_fclose(dp) -dlb *dp; +dlb_fclose(dlb *dp) { int ret = 0; @@ -517,10 +492,7 @@ dlb *dp; } int -dlb_fread(buf, size, quan, dp) -char *buf; -int size, quan; -dlb *dp; +dlb_fread(char *buf, int size, int quan, dlb *dp) { if (!dlb_initialized || size <= 0 || quan <= 0) return 0; @@ -530,10 +502,7 @@ dlb *dp; } int -dlb_fseek(dp, pos, whence) -dlb *dp; -long pos; -int whence; +dlb_fseek(dlb *dp, long pos, int whence) { if (!dlb_initialized) return EOF; @@ -543,10 +512,7 @@ int whence; } char * -dlb_fgets(buf, len, dp) -char *buf; -int len; -dlb *dp; +dlb_fgets(char *buf, int len, dlb *dp) { if (!dlb_initialized) return (char *) 0; @@ -556,8 +522,7 @@ dlb *dp; } int -dlb_fgetc(dp) -dlb *dp; +dlb_fgetc(dlb *dp) { if (!dlb_initialized) return EOF; @@ -567,8 +532,7 @@ dlb *dp; } long -dlb_ftell(dp) -dlb *dp; +dlb_ftell(dlb *dp) { if (!dlb_initialized) return 0; diff --git a/src/do.c b/src/do.c index c637569fb..b3e5530fb 100644 --- a/src/do.c +++ b/src/do.c @@ -7,21 +7,22 @@ #include "hack.h" -static void FDECL(trycall, (struct obj *)); -static void NDECL(polymorph_sink); -static boolean NDECL(teleport_sink); -static void FDECL(dosinkring, (struct obj *)); -static int FDECL(drop, (struct obj *)); -static boolean FDECL(engulfer_digests_food, (struct obj *)); -static int NDECL(wipeoff); -static int FDECL(menu_drop, (int)); -static NHFILE *NDECL(currentlevel_rewrite); -static void NDECL(final_level); -/* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */ +static void trycall(struct obj *); +static void polymorph_sink(void); +static boolean teleport_sink(void); +static void dosinkring(struct obj *); +static int drop(struct obj *); +static boolean engulfer_digests_food(struct obj *); +static int wipeoff(void); +static int menu_drop(int); +static NHFILE *currentlevel_rewrite(void); +static void final_level(void); + +/* static boolean badspot(xchar,xchar); */ /* 'd' command: drop one inventory item */ int -dodrop() +dodrop(void) { int result; @@ -42,10 +43,7 @@ dodrop() * it's gone for good... If the destination is not a pool, returns FALSE. */ boolean -boulder_hits_pool(otmp, rx, ry, pushing) -struct obj *otmp; -register int rx, ry; -boolean pushing; +boulder_hits_pool(struct obj *otmp, int rx, int ry, boolean pushing) { if (!otmp || otmp->otyp != BOULDER) { impossible("Not a boulder?"); @@ -127,10 +125,7 @@ boolean pushing; * away. */ boolean -flooreffects(obj, x, y, verb) -struct obj *obj; -int x, y; -const char *verb; +flooreffects(struct obj *obj, int x, int y, const char *verb) { struct trap *t; struct monst *mtmp; @@ -269,8 +264,7 @@ deletedwithboulder: /* obj is an object dropped on an altar */ void -doaltarobj(obj) -register struct obj *obj; +doaltarobj(struct obj *obj) { if (Blind) return; @@ -297,8 +291,7 @@ register struct obj *obj; } static void -trycall(obj) -register struct obj *obj; +trycall(struct obj *obj) { if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname) docall(obj); @@ -307,7 +300,7 @@ register struct obj *obj; /* Transforms the sink at the player's position into a fountain, throne, altar or grave. */ static void -polymorph_sink() +polymorph_sink(void) { uchar sym = S_sink; boolean sinklooted; @@ -364,7 +357,7 @@ polymorph_sink() /* Teleports the sink at the player's position; return True if sink teleported. */ static boolean -teleport_sink() +teleport_sink(void) { int cx, cy; int cnt = 0; @@ -395,8 +388,7 @@ teleport_sink() /* obj is a ring being dropped over a kitchen sink */ static void -dosinkring(obj) -register struct obj *obj; +dosinkring(struct obj *obj) { struct obj *otmp, *otmp2; boolean ideed = TRUE; @@ -561,9 +553,7 @@ register struct obj *obj; /* some common tests when trying to drop or throw items */ boolean -canletgo(obj, word) -struct obj *obj; -const char *word; +canletgo(struct obj *obj, const char *word) { if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) { if (*word) @@ -599,8 +589,7 @@ const char *word; } static int -drop(obj) -register struct obj *obj; +drop(struct obj *obj) { if (!obj) return 0; @@ -664,8 +653,7 @@ register struct obj *obj; called in several places - may produce output (eg ship_object() and dropy() -> sellobj() both produce output) */ void -dropx(obj) -register struct obj *obj; +dropx(struct obj *obj) { freeinv(obj); if (!u.uswallow) { @@ -679,17 +667,14 @@ register struct obj *obj; /* dropy - put dropped object at destination; called from lots of places */ void -dropy(obj) -struct obj *obj; +dropy(struct obj *obj) { dropz(obj, FALSE); } /* dropz - really put dropped object at its destination... */ void -dropz(obj, with_impact) -struct obj *obj; -boolean with_impact; +dropz(struct obj *obj, boolean with_impact) { if (obj == uwep) setuwep((struct obj *) 0); @@ -729,8 +714,7 @@ boolean with_impact; for purple worm, immediately eat any corpse, glob, or special meat item from object polymorph; return True if object is used up, False otherwise */ static boolean -engulfer_digests_food(obj) -struct obj *obj; +engulfer_digests_food(struct obj *obj) { /* animal swallower (purple worn, trapper, lurker above) eats any corpse, glob, or meat but not other types of food */ @@ -774,8 +758,7 @@ struct obj *obj; /* things that must change when not held; recurse into containers. Called for both player and monsters */ void -obj_no_longer_held(obj) -struct obj *obj; +obj_no_longer_held(struct obj *obj) { if (!obj) { return; @@ -806,7 +789,7 @@ struct obj *obj; /* 'D' command: drop several things */ int -doddrop() +doddrop(void) { int result = 0; @@ -830,8 +813,7 @@ doddrop() /* Drop things from the hero's inventory, using a menu. */ static int -menu_drop(retry) -int retry; +menu_drop(int retry) { int n, i, n_dropped = 0; long cnt; @@ -947,7 +929,7 @@ int retry; /* the '>' command */ int -dodown() +dodown(void) { struct trap *trap = 0; stairway *stway = stairway_at(u.ux, u.uy); @@ -1102,7 +1084,7 @@ dodown() /* the '<' command */ int -doup() +doup(void) { stairway *stway = stairway_at(u.ux,u.uy); @@ -1153,7 +1135,7 @@ doup() /* check that we can write out the current level */ static NHFILE * -currentlevel_rewrite() +currentlevel_rewrite(void) { NHFILE *nhfp; char whynot[BUFSZ]; @@ -1180,7 +1162,7 @@ currentlevel_rewrite() #ifdef INSURANCE void -save_currentstate() +save_currentstate(void) { NHFILE *nhfp; @@ -1203,8 +1185,7 @@ save_currentstate() /* static boolean -badspot(x, y) -register xchar x, y; +badspot(register xchar x, register xchar y) { return (boolean) ((levl[x][y].typ != ROOM && levl[x][y].typ != AIR @@ -1216,8 +1197,7 @@ register xchar x, y; /* when arriving on a level, if hero and a monster are trying to share same spot, move one; extracted from goto_level(); also used by wiz_makemap() */ void -u_collide_m(mtmp) -struct monst *mtmp; +u_collide_m(struct monst *mtmp) { coord cc; @@ -1253,9 +1233,7 @@ struct monst *mtmp; } void -goto_level(newlevel, at_stairs, falling, portal) -d_level *newlevel; -boolean at_stairs, falling, portal; +goto_level(d_level *newlevel, boolean at_stairs, boolean falling, boolean portal) { int l_idx, save_mode; NHFILE *nhfp; @@ -1754,7 +1732,7 @@ boolean at_stairs, falling, portal; /* usually called from goto_level(); might be called from Sting_effects() */ void -maybe_lvltport_feedback() +maybe_lvltport_feedback(void) { if (g.dfr_post_msg && !strncmpi(g.dfr_post_msg, "You materialize", 15)) { /* "You materialize on a different level." */ @@ -1764,7 +1742,7 @@ maybe_lvltport_feedback() } static void -final_level() +final_level(void) { struct monst *mtmp; @@ -1784,10 +1762,8 @@ final_level() /* change levels at the end of this turn, after monsters finish moving */ void -schedule_goto(tolev, utotype_flags, pre_msg, post_msg) -d_level *tolev; -int utotype_flags; -const char *pre_msg, *post_msg; +schedule_goto(d_level *tolev, int utotype_flags, + const char *pre_msg, const char *post_msg) { /* UTOTYPE_DEFERRED is used, so UTOTYPE_NONE can trigger deferred_goto() */ u.utotype = utotype_flags | UTOTYPE_DEFERRED; @@ -1802,7 +1778,7 @@ const char *pre_msg, *post_msg; /* handle something like portal ejection */ void -deferred_goto() +deferred_goto(void) { if (!on_level(&u.uz, &u.utolev)) { d_level dest, oldlev; @@ -1838,8 +1814,7 @@ deferred_goto() * corpse is gone. */ boolean -revive_corpse(corpse) -struct obj *corpse; +revive_corpse(struct obj *corpse) { struct monst *mtmp, *mcarry; boolean is_uwep, chewed; @@ -1927,9 +1902,7 @@ struct obj *corpse; /* Revive the corpse via a timeout. */ /*ARGSUSED*/ void -revive_mon(arg, timeout) -anything *arg; -long timeout UNUSED; +revive_mon(anything *arg, long timeout UNUSED) { struct obj *body = arg->a_obj; struct permonst *mptr = &mons[body->corpsenm]; @@ -1975,9 +1948,7 @@ long timeout UNUSED; /* Timeout callback. Revive the corpse as a zombie. */ /*ARGSUSED*/ void -zombify_mon(arg, timeout) -anything *arg; -long timeout UNUSED; +zombify_mon(anything *arg, long timeout UNUSED) { struct obj *body = arg->a_obj; int zmon = zombie_form(&mons[body->corpsenm]); @@ -1995,10 +1966,7 @@ long timeout UNUSED; } boolean -cmd_safety_prevention(cmddesc, act, flagcounter) -const char *cmddesc; -const char *act; -int *flagcounter; +cmd_safety_prevention(const char *cmddesc, const char *act, int *flagcounter) { if (flags.safe_wait && !iflags.menu_requested && !g.multi && monster_nearby()) { @@ -2018,7 +1986,7 @@ int *flagcounter; /* '.' command: do nothing == rest; also the ' ' command iff 'rest_on_space' option is On */ int -donull() +donull(void) { if (cmd_safety_prevention("a no-op (to rest)", "Are you waiting to get hit?", @@ -2028,7 +1996,7 @@ donull() } static int -wipeoff(VOID_ARGS) +wipeoff(void) { if (u.ucreamed < 4) u.ucreamed = 0; @@ -2054,7 +2022,7 @@ wipeoff(VOID_ARGS) } int -dowipe() +dowipe(void) { if (u.ucreamed) { static NEARDATA char buf[39]; @@ -2072,9 +2040,8 @@ dowipe() /* common wounded legs feedback */ void -legs_in_no_shape(for_what, by_steed) -const char *for_what; /* jumping, kicking, riding */ -boolean by_steed; +legs_in_no_shape(const char *for_what, /* jumping, kicking, riding */ + boolean by_steed) { if (by_steed && u.usteed) { pline("%s is in no shape for %s.", Monnam(u.usteed), for_what); @@ -2091,9 +2058,7 @@ boolean by_steed; } void -set_wounded_legs(side, timex) -long side; -int timex; +set_wounded_legs(long side, int timex) { /* KMH -- STEED * If you are riding, your steed gets the wounded legs instead. @@ -2112,8 +2077,8 @@ int timex; } void -heal_legs(how) -int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */ +heal_legs(int how) /* 0: ordinary, 1: dismounting steed, + 2: limbs turn to stone */ { if (Wounded_legs) { g.context.botl = 1; diff --git a/src/do_name.c b/src/do_name.c index d74818069..d9cae76e5 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -5,26 +5,25 @@ #include "hack.h" -static char *NDECL(nextmbuf); -static void FDECL(getpos_help_keyxhelp, (winid, const char *, - const char *, int)); -static void FDECL(getpos_help, (BOOLEAN_P, const char *)); -static int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *)); -static int FDECL(gloc_filter_classify_glyph, (int)); -static int FDECL(gloc_filter_floodfill_matcharea, (int, int)); -static void FDECL(gloc_filter_floodfill, (int, int)); -static void NDECL(gloc_filter_init); -static void NDECL(gloc_filter_done); -static boolean FDECL(gather_locs_interesting, (int, int, int)); -static void FDECL(gather_locs, (coord **, int *, int)); -static void FDECL(auto_describe, (int, int)); -static void NDECL(do_mgivenname); -static boolean FDECL(alreadynamed, (struct monst *, char *, char *)); -static void FDECL(do_oname, (struct obj *)); -static int FDECL(name_ok, (struct obj *)); -static int FDECL(call_ok, (struct obj *)); -static char *FDECL(docall_xname, (struct obj *)); -static void NDECL(namefloorobj); +static char *nextmbuf(void); +static void getpos_help_keyxhelp(winid, const char *, const char *, int); +static void getpos_help(boolean, const char *); +static int CFDECLSPEC cmp_coord_distu(const void *, const void *); +static int gloc_filter_classify_glyph(int); +static int gloc_filter_floodfill_matcharea(int, int); +static void gloc_filter_floodfill(int, int); +static void gloc_filter_init(void); +static void gloc_filter_done(void); +static boolean gather_locs_interesting(int, int, int); +static void gather_locs(coord **, int *, int); +static void auto_describe(int, int); +static void do_mgivenname(void); +static boolean alreadynamed(struct monst *, char *, char *); +static void do_oname(struct obj *); +static int name_ok(struct obj *); +static int call_ok(struct obj *); +static char *docall_xname(struct obj *); +static void namefloorobj(void); extern const char what_is_an_unknown_object[]; /* from pager.c */ @@ -32,7 +31,7 @@ extern const char what_is_an_unknown_object[]; /* from pager.c */ /* manage a pool of BUFSZ buffers, so callers don't have to */ static char * -nextmbuf() +nextmbuf(void) { static char NEARDATA bufs[NUMMBUF][BUFSZ]; static int bufidx = 0; @@ -44,14 +43,11 @@ nextmbuf() /* function for getpos() to highlight desired map locations. * parameter value 0 = initialize, 1 = highlight, 2 = done */ -static void FDECL((*getpos_hilitefunc), (int)) = (void FDECL((*), (int))) 0; -static boolean FDECL((*getpos_getvalid), (int, int)) = - (boolean FDECL((*), (int, int))) 0; +static void (*getpos_hilitefunc)(int) = (void (*)(int)) 0; +static boolean (*getpos_getvalid)(int, int) = (boolean (*)(int, int)) 0; void -getpos_sethilite(gp_hilitef, gp_getvalidf) -void FDECL((*gp_hilitef), (int)); -boolean FDECL((*gp_getvalidf), (int, int)); +getpos_sethilite(void (*gp_hilitef)(int), boolean (*gp_getvalidf)(int, int)) { getpos_hilitefunc = gp_hilitef; getpos_getvalid = gp_getvalidf; @@ -77,11 +73,7 @@ static const char *const gloc_filtertxt[NUM_GFILTER] = { }; static void -getpos_help_keyxhelp(tmpwin, k1, k2, gloc) -winid tmpwin; -const char *k1; -const char *k2; -int gloc; +getpos_help_keyxhelp(winid tmpwin, const char *k1, const char *k2, int gloc) { char sbuf[BUFSZ], fbuf[QBUFSZ]; const char *move_cursor_to = "move the cursor to ", @@ -106,9 +98,7 @@ int gloc; /* the response for '?' help request in getpos() */ static void -getpos_help(force, goal) -boolean force; -const char *goal; +getpos_help(boolean force, const char *goal) { static const char *const fastmovemode[2] = { "8 units at a time", "skipping same glyphs" }; @@ -236,9 +226,7 @@ const char *goal; } static int -cmp_coord_distu(a, b) -const void *a; -const void *b; +cmp_coord_distu(const void *a, const void *b) { const coord *c1 = a; const coord *c2 = b; @@ -267,8 +255,7 @@ const void *b; && (selection_getpoint((x),(y), g.gloc_filter_map))) static int -gloc_filter_classify_glyph(glyph) -int glyph; +gloc_filter_classify_glyph(int glyph) { int c; @@ -291,8 +278,7 @@ int glyph; } static int -gloc_filter_floodfill_matcharea(x, y) -int x, y; +gloc_filter_floodfill_matcharea(int x, int y) { int glyph = back_to_glyph(x, y); @@ -310,8 +296,7 @@ int x, y; } static void -gloc_filter_floodfill(x, y) -int x, y; +gloc_filter_floodfill(int x, int y) { g.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y); @@ -320,7 +305,7 @@ int x, y; } static void -gloc_filter_init() +gloc_filter_init(void) { if (iflags.getloc_filter == GFILTER_AREA) { if (!g.gloc_filter_map) { @@ -341,7 +326,7 @@ gloc_filter_init() } static void -gloc_filter_done() +gloc_filter_done(void) { if (g.gloc_filter_map) { selection_free(g.gloc_filter_map, TRUE); @@ -351,8 +336,7 @@ gloc_filter_done() } static boolean -gather_locs_interesting(x, y, gloc) -int x, y, gloc; +gather_locs_interesting(int x, int y, int gloc) { int glyph, sym; @@ -420,10 +404,7 @@ int x, y, gloc; /* gather locations for monsters or objects shown on the map */ static void -gather_locs(arr_p, cnt_p, gloc) -coord **arr_p; -int *cnt_p; -int gloc; +gather_locs(coord **arr_p, int *cnt_p, int gloc) { int x, y, pass, idx; @@ -467,9 +448,7 @@ int gloc; } char * -dxdy_to_dist_descr(dx, dy, fulldir) -int dx, dy; -boolean fulldir; +dxdy_to_dist_descr(int dx, int dy, boolean fulldir) { static char buf[30]; int dst; @@ -505,9 +484,7 @@ boolean fulldir; /* coordinate formatting for 'whatis_coord' option */ char * -coord_desc(x, y, outbuf, cmode) -int x, y; -char *outbuf, cmode; +coord_desc(int x, int y, char *outbuf, char cmode) { static char screen_fmt[16]; /* [12] suffices: "[%02d,%02d]" */ int dx, dy; @@ -547,8 +524,7 @@ char *outbuf, cmode; } static void -auto_describe(cx, cy) -int cx, cy; +auto_describe(int cx, int cy) { coord cc; int sym = 0; @@ -573,9 +549,7 @@ int cx, cy; } boolean -getpos_menu(ccp, gloc) -coord *ccp; -int gloc; +getpos_menu(coord *ccp, int gloc) { coord *garr = DUMMY; int gcount = 0; @@ -637,10 +611,7 @@ int gloc; } int -getpos(ccp, force, goal) -coord *ccp; -boolean force; -const char *goal; +getpos(coord *ccp, boolean force, const char *goal) { const char *cp; static struct { @@ -992,16 +963,16 @@ const char *goal; for (i = 0; i < NUM_GLOCS; i++) if (garr[i]) free((genericptr_t) garr[i]); - getpos_hilitefunc = (void FDECL((*), (int))) 0; - getpos_getvalid = (boolean FDECL((*), (int, int))) 0; + getpos_hilitefunc = (void (*)(int)) 0; + getpos_getvalid = (boolean (*)(int, int)) 0; return result; } /* allocate space for a monster's name; removes old name if there is one */ void -new_mgivenname(mon, lth) -struct monst *mon; -int lth; /* desired length (caller handles adding 1 for terminator) */ +new_mgivenname(struct monst *mon, + int lth) /* desired length (caller handles adding 1 + for terminator) */ { if (lth) { /* allocate mextra if necessary; otherwise get rid of old name */ @@ -1019,8 +990,7 @@ int lth; /* desired length (caller handles adding 1 for terminator) */ /* release a monster's name; retains mextra even if all fields are now null */ void -free_mgivenname(mon) -struct monst *mon; +free_mgivenname(struct monst *mon) { if (has_mgivenname(mon)) { free((genericptr_t) MGIVENNAME(mon)); @@ -1030,9 +1000,9 @@ struct monst *mon; /* allocate space for an object's name; removes old name if there is one */ void -new_oname(obj, lth) -struct obj *obj; -int lth; /* desired length (caller handles adding 1 for terminator) */ +new_oname(struct obj *obj, + int lth) /* desired length (caller handles adding 1 + for terminator) */ { if (lth) { /* allocate oextra if necessary; otherwise get rid of old name */ @@ -1050,8 +1020,7 @@ int lth; /* desired length (caller handles adding 1 for terminator) */ /* release an object's name; retains oextra even if all fields are now null */ void -free_oname(obj) -struct obj *obj; +free_oname(struct obj *obj) { if (has_oname(obj)) { free((genericptr_t) ONAME(obj)); @@ -1065,8 +1034,7 @@ struct obj *obj; * if it doesn't. */ const char * -safe_oname(obj) -struct obj *obj; +safe_oname(struct obj *obj) { if (has_oname(obj)) return ONAME(obj); @@ -1076,9 +1044,7 @@ struct obj *obj; /* historical note: this returns a monster pointer because it used to allocate a new bigger block of memory to hold the monster and its name */ struct monst * -christen_monst(mtmp, name) -struct monst *mtmp; -const char *name; +christen_monst(struct monst *mtmp, const char *name) { int lth; char buf[PL_PSIZ]; @@ -1099,9 +1065,7 @@ const char *name; /* check whether user-supplied name matches or nearly matches an unnameable monster's name; if so, give an alternate reject message for do_mgivenname() */ static boolean -alreadynamed(mtmp, monnambuf, usrbuf) -struct monst *mtmp; -char *monnambuf, *usrbuf; +alreadynamed(struct monst *mtmp, char *monnambuf, char *usrbuf) { char pronounbuf[10], *p; @@ -1129,7 +1093,7 @@ char *monnambuf, *usrbuf; /* allow player to assign a name to some chosen monster */ static void -do_mgivenname() +do_mgivenname(void) { char buf[BUFSZ], monnambuf[BUFSZ], qbuf[QBUFSZ]; coord cc; @@ -1213,10 +1177,8 @@ do_mgivenname() * used with extreme care. Applying a name to an object no longer * allocates a replacement object, so that old risk is gone. */ -static -void -do_oname(obj) -register struct obj *obj; +static void +do_oname(register struct obj *obj) { char *bufp, buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ]; const char *aname; @@ -1291,9 +1253,7 @@ register struct obj *obj; } struct obj * -oname(obj, name) -struct obj *obj; -const char *name; +oname(struct obj *obj, const char *name) { int lth; char buf[PL_PSIZ]; @@ -1338,8 +1298,7 @@ const char *name; } boolean -objtyp_is_callable(i) -int i; +objtyp_is_callable(int i) { if (objects[i].oc_uname) return TRUE; @@ -1366,8 +1325,7 @@ int i; /* getobj callback for object to name (specific item) - anything but gold */ static int -name_ok(obj) -struct obj *obj; +name_ok(struct obj *obj) { if (!obj || obj->oclass == COIN_CLASS) return GETOBJ_EXCLUDE; @@ -1377,8 +1335,7 @@ struct obj *obj; /* getobj callback for object to call (name its type) */ static int -call_ok(obj) -struct obj *obj; +call_ok(struct obj *obj) { if (!obj || !objtyp_is_callable(obj->otyp)) return GETOBJ_EXCLUDE; @@ -1388,7 +1345,7 @@ struct obj *obj; /* C and #name commands - player can name monster or object or type of obj */ int -docallcmd() +docallcmd(void) { struct obj *obj; winid win; @@ -1482,8 +1439,7 @@ docallcmd() /* for use by safe_qbuf() */ static char * -docall_xname(obj) -struct obj *obj; +docall_xname(struct obj *obj) { struct obj otemp; @@ -1514,8 +1470,7 @@ struct obj *obj; } void -docall(obj) -struct obj *obj; +docall(struct obj *obj) { char buf[BUFSZ], qbuf[QBUFSZ]; char **str1; @@ -1563,7 +1518,7 @@ struct obj *obj; } static void -namefloorobj() +namefloorobj(void) { coord cc; int glyph; @@ -1655,7 +1610,7 @@ static const char *const ghostnames[] = { /* ghost names formerly set by x_monnam(), now by makemon() instead */ const char * -rndghostname() +rndghostname(void) { return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) g.plname; } @@ -1678,27 +1633,28 @@ rndghostname() * article newt art xan art invisible orc art dog */ -/* Bug: if the monster is a priest or shopkeeper, not every one of these - * options works, since those are special cases. - */ -char * -x_monnam(mtmp, article, adjective, suppress, called) -register struct monst *mtmp; -int article; -/* ARTICLE_NONE, ARTICLE_THE, ARTICLE_A: obvious +/* + * article + * + * ARTICLE_NONE, ARTICLE_THE, ARTICLE_A: obvious * ARTICLE_YOUR: "your" on pets, "the" on everything else * * If the monster would be referred to as "it" or if the monster has a name * _and_ there is no adjective, "invisible", "saddled", etc., override this * and always use no article. - */ -const char *adjective; -int suppress; -/* SUPPRESS_IT, SUPPRESS_INVISIBLE, SUPPRESS_HALLUCINATION, SUPPRESS_SADDLE. + * + * suppress + * + * SUPPRESS_IT, SUPPRESS_INVISIBLE, SUPPRESS_HALLUCINATION, SUPPRESS_SADDLE. * EXACT_NAME: combination of all the above * SUPPRESS_NAME: omit monster's assigned name (unless uniq w/ pname). + * + * Bug: if the monster is a priest or shopkeeper, not every one of these + * options works, since those are special cases. */ -boolean called; +char * +x_monnam(register struct monst *mtmp, int article, + const char *adjective, int suppress, boolean called) { char *buf = nextmbuf(); struct permonst *mdat = mtmp->data; @@ -1868,16 +1824,14 @@ boolean called; } char * -l_monnam(mtmp) -struct monst *mtmp; +l_monnam(struct monst *mtmp) { return x_monnam(mtmp, ARTICLE_NONE, (char *) 0, (has_mgivenname(mtmp)) ? SUPPRESS_SADDLE : 0, TRUE); } char * -mon_nam(mtmp) -struct monst *mtmp; +mon_nam(struct monst *mtmp) { return x_monnam(mtmp, ARTICLE_THE, (char *) 0, (has_mgivenname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE); @@ -1888,8 +1842,7 @@ struct monst *mtmp; * the player with a cursed potion of invisibility */ char * -noit_mon_nam(mtmp) -struct monst *mtmp; +noit_mon_nam(struct monst *mtmp) { return x_monnam(mtmp, ARTICLE_THE, (char *) 0, (has_mgivenname(mtmp)) ? (SUPPRESS_SADDLE | SUPPRESS_IT) @@ -1898,8 +1851,7 @@ struct monst *mtmp; } char * -Monnam(mtmp) -struct monst *mtmp; +Monnam(struct monst *mtmp) { register char *bp = mon_nam(mtmp); @@ -1908,8 +1860,7 @@ struct monst *mtmp; } char * -noit_Monnam(mtmp) -struct monst *mtmp; +noit_Monnam(struct monst *mtmp) { register char *bp = noit_mon_nam(mtmp); @@ -1919,9 +1870,7 @@ struct monst *mtmp; /* return "a dog" rather than "Fido", honoring hallucination and visibility */ char * -noname_monnam(mtmp, article) -struct monst *mtmp; -int article; +noname_monnam(struct monst *mtmp, int article) { return x_monnam(mtmp, article, (char *) 0, SUPPRESS_NAME, FALSE); } @@ -1929,16 +1878,14 @@ int article; /* monster's own name -- overrides hallucination and [in]visibility so shouldn't be used in ordinary messages (mainly for disclosure) */ char * -m_monnam(mtmp) -struct monst *mtmp; +m_monnam(struct monst *mtmp) { return x_monnam(mtmp, ARTICLE_NONE, (char *) 0, EXACT_NAME, FALSE); } /* pet name: "your little dog" */ char * -y_monnam(mtmp) -struct monst *mtmp; +y_monnam(struct monst *mtmp) { int prefix, suppression_flag; @@ -1953,9 +1900,7 @@ struct monst *mtmp; } char * -Adjmonnam(mtmp, adj) -struct monst *mtmp; -const char *adj; +Adjmonnam(struct monst *mtmp, const char *adj) { char *bp = x_monnam(mtmp, ARTICLE_THE, adj, has_mgivenname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE); @@ -1965,16 +1910,14 @@ const char *adj; } char * -a_monnam(mtmp) -struct monst *mtmp; +a_monnam(struct monst *mtmp) { return x_monnam(mtmp, ARTICLE_A, (char *) 0, has_mgivenname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE); } char * -Amonnam(mtmp) -struct monst *mtmp; +Amonnam(struct monst *mtmp) { char *bp = a_monnam(mtmp); @@ -1985,10 +1928,10 @@ struct monst *mtmp; /* used for monster ID by the '/', ';', and 'C' commands to block remote identification of the endgame altars via their attending priests */ char * -distant_monnam(mon, article, outbuf) -struct monst *mon; -int article; /* only ARTICLE_NONE and ARTICLE_THE are handled here */ -char *outbuf; +distant_monnam(struct monst *mon, + int article, /* only ARTICLE_NONE and ARTICLE_THE + are handled here */ + char *outbuf) { /* high priest(ess)'s identity is concealed on the Astral Plane, unless you're adjacent (overridden for hallucination which does @@ -2006,8 +1949,7 @@ char *outbuf; /* returns mon_nam(mon) relative to other_mon; normal name unless they're the same, in which case the reference is to {him|her|it} self */ char * -mon_nam_too(mon, other_mon) -struct monst *mon, *other_mon; +mon_nam_too(struct monst *mon, struct monst *other_mon) { char *outbuf; @@ -2037,10 +1979,9 @@ struct monst *mon, *other_mon; /* construct " {him|her|it}self" which might be distorted by Hallu; if that's plural, adjust monnamtext and verb */ char * -monverbself(mon, monnamtext, verb, othertext) -struct monst *mon; -char *monnamtext; /* modifiable 'mbuf' with adequare room at end */ -const char *verb, *othertext; +monverbself(struct monst *mon, + char *monnamtext, /* modifiable 'mbuf' with adequare room at end */ + const char *verb, const char *othertext) { char *verbs, selfbuf[40]; /* sizeof "themselves" suffices */ @@ -2069,9 +2010,7 @@ const char *verb, *othertext; /* for debugging messages, where data might be suspect and we aren't taking what the hero does or doesn't know into consideration */ char * -minimal_monnam(mon, ckloc) -struct monst *mon; -boolean ckloc; +minimal_monnam(struct monst *mon, boolean ckloc) { struct permonst *ptr; char *outbuf = nextmbuf(); @@ -2104,8 +2043,7 @@ boolean ckloc; #ifndef PMNAME_MACROS int -Mgender(mtmp) -struct monst *mtmp; +Mgender(struct monst *mtmp) { int mgender = MALE; @@ -2119,9 +2057,7 @@ struct monst *mtmp; } const char * -pmname(pm, mgender) -struct permonst *pm; -int mgender; +pmname(struct permonst *pm, int mgender) { if ((mgender >= MALE && mgender < NUM_MGENDERS) && pm->pmnames[mgender]) return pm->pmnames[mgender]; @@ -2132,8 +2068,7 @@ int mgender; /* fake monsters used to be in a hard-coded array, now in a data file */ char * -bogusmon(buf, code) -char *buf, *code; +bogusmon(char *buf, char *code) { static const char bogon_codes[] = "-_+|="; /* see dat/bonusmon.txt */ char *mnam = buf; @@ -2154,8 +2089,7 @@ char *buf, *code; /* return a random monster name, for hallucination */ char * -rndmonnam(code) -char *code; +rndmonnam(char *code) { static char buf[BUFSZ]; char *mnam; @@ -2181,8 +2115,7 @@ char *code; /* check bogusmon prefix to decide whether it's a personal name */ boolean -bogon_is_pname(code) -char code; +bogon_is_pname(char code) { if (!code) return FALSE; @@ -2191,7 +2124,7 @@ char code; /* name of a Rogue player */ const char * -roguename() +roguename(void) { char *i, *opts; @@ -2220,8 +2153,7 @@ static NEARDATA const char *const hcolors[] = { }; const char * -hcolor(colorpref) -const char *colorpref; +hcolor(const char *colorpref) { return (Hallucination || !colorpref) ? hcolors[rn2_on_display_rng(SIZE(hcolors))] @@ -2230,7 +2162,7 @@ const char *colorpref; /* return a random real color unless hallucinating */ const char * -rndcolor() +rndcolor(void) { int k = rn2(CLR_MAX); @@ -2252,8 +2184,7 @@ static NEARDATA const char *const hliquids[] = { /* if hallucinating, return a random liquid instead of 'liquidpref' */ const char * -hliquid(liquidpref) -const char *liquidpref; /* use as-is when not hallucinating (unless empty) */ +hliquid(const char *liquidpref) /* use as-is when not hallucinating (unless empty) */ { if (Hallucination || !liquidpref || !*liquidpref) { int indx, count = SIZE(hliquids); @@ -2283,9 +2214,7 @@ static const char *const coynames[] = { }; char * -coyotename(mtmp, buf) -struct monst *mtmp; -char *buf; +coyotename(struct monst *mtmp, char *buf) { if (mtmp && buf) { Sprintf(buf, "%s - %s", @@ -2297,8 +2226,7 @@ char *buf; } char * -rndorcname(s) -char *s; +rndorcname(char *s) { static const char *v[] = { "a", "ai", "og", "u" }; static const char *snd[] = { "gor", "gris", "un", "bane", "ruk", @@ -2317,9 +2245,7 @@ char *s; } struct monst * -christen_orc(mtmp, gang, other) -struct monst *mtmp; -const char *gang, *other; +christen_orc(struct monst *mtmp, const char *gang, const char *other) { int sz = 0; char buf[BUFSZ], buf2[BUFSZ], *orcname; @@ -2365,8 +2291,7 @@ static const char *const sir_Terry_novels[] = { }; const char * -noveltitle(novidx) -int *novidx; +noveltitle(int *novidx) { int j, k = SIZE(sir_Terry_novels); @@ -2381,9 +2306,7 @@ int *novidx; } const char * -lookup_novel(lookname, idx) -const char *lookname; -int *idx; +lookup_novel(const char *lookname, int *idx) { int k; diff --git a/src/do_wear.c b/src/do_wear.c index c8b84e1fe..2695b3bf5 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -20,38 +20,37 @@ static NEARDATA const long takeoff_order[] = { WORN_SHIRT, WORN_BOOTS, W_SWAPWEP, W_QUIVER, 0L }; -static void FDECL(on_msg, (struct obj *)); -static void FDECL(toggle_stealth, (struct obj *, long, BOOLEAN_P)); -static int NDECL(Armor_on); -/* int NDECL(Boots_on); -- moved to extern.h */ -static int NDECL(Cloak_on); -static int NDECL(Helmet_on); -static int NDECL(Gloves_on); -static void FDECL(wielding_corpse, (struct obj *, BOOLEAN_P)); -static int NDECL(Shield_on); -static int NDECL(Shirt_on); -static void NDECL(Amulet_on); -static void FDECL(learnring, (struct obj *, BOOLEAN_P)); -static void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P)); -static int FDECL(select_off, (struct obj *)); -static struct obj *NDECL(do_takeoff); -static int NDECL(take_off); -static int FDECL(menu_remarm, (int)); -static void FDECL(count_worn_stuff, (struct obj **, BOOLEAN_P)); -static int FDECL(armor_or_accessory_off, (struct obj *)); -static int FDECL(accessory_or_armor_on, (struct obj *)); -static void FDECL(already_wearing, (const char *)); -static void FDECL(already_wearing2, (const char *, const char *)); -static int FDECL(equip_ok, (struct obj *, BOOLEAN_P, BOOLEAN_P)); -static int FDECL(puton_ok, (struct obj *)); -static int FDECL(remove_ok, (struct obj *)); -static int FDECL(wear_ok, (struct obj *)); -static int FDECL(takeoff_ok, (struct obj *)); +static void on_msg(struct obj *); +static void toggle_stealth(struct obj *, long, boolean); +static int Armor_on(void); +/* int Boots_on(void); -- moved to extern.h */ +static int Cloak_on(void); +static int Helmet_on(void); +static int Gloves_on(void); +static void wielding_corpse(struct obj *, boolean); +static int Shield_on(void); +static int Shirt_on(void); +static void Amulet_on(void); +static void learnring(struct obj *, boolean); +static void Ring_off_or_gone(struct obj *, boolean); +static int select_off(struct obj *); +static struct obj *do_takeoff(void); +static int take_off(void); +static int menu_remarm(int); +static void count_worn_stuff(struct obj **, boolean); +static int armor_or_accessory_off(struct obj *); +static int accessory_or_armor_on(struct obj *); +static void already_wearing(const char *); +static void already_wearing2(const char *, const char *); +static int equip_ok(struct obj *, boolean, boolean); +static int puton_ok(struct obj *); +static int remove_ok(struct obj *); +static int wear_ok(struct obj *); +static int takeoff_ok(struct obj *); /* plural "fingers" or optionally "gloves" */ const char * -fingers_or_gloves(check_gloves) -boolean check_gloves; +fingers_or_gloves(boolean check_gloves) { return ((check_gloves && uarmg) ? gloves_simple_name(uarmg) /* "gloves" or "gauntlets" */ @@ -59,8 +58,7 @@ boolean check_gloves; } void -off_msg(otmp) -struct obj *otmp; +off_msg(struct obj *otmp) { if (flags.verbose) You("were wearing %s.", doname(otmp)); @@ -68,8 +66,7 @@ struct obj *otmp; /* for items that involve no delay */ static void -on_msg(otmp) -struct obj *otmp; +on_msg(struct obj *otmp) { if (flags.verbose) { char how[BUFSZ]; @@ -89,10 +86,10 @@ struct obj *otmp; give feedback and discover it iff stealth state is changing */ static void -toggle_stealth(obj, oldprop, on) -struct obj *obj; -long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */ -boolean on; +toggle_stealth(struct obj *obj, + long oldprop, /* prop[].extrinsic, with obj->owornmask + stripped by caller */ + boolean on) { if (on ? g.initial_don : g.context.takeoff.cancelled_don) return; @@ -124,10 +121,10 @@ boolean on; hero is able to see self (or sense monsters); for timed, 'obj' is Null and this is only called for the message */ void -toggle_displacement(obj, oldprop, on) -struct obj *obj; -long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */ -boolean on; +toggle_displacement(struct obj *obj, + long oldprop, /* prop[].extrinsic, with obj->owornmask + stripped by caller */ + boolean on) { if (on ? g.initial_don : g.context.takeoff.cancelled_don) return; @@ -162,7 +159,7 @@ boolean on; */ int -Boots_on(VOID_ARGS) +Boots_on(void) { long oldprop = u.uprops[objects[uarmf->otyp].oc_oprop].extrinsic & ~WORN_BOOTS; @@ -220,7 +217,7 @@ Boots_on(VOID_ARGS) } int -Boots_off(VOID_ARGS) +Boots_off(void) { struct obj *otmp = uarmf; int otyp = otmp->otyp; @@ -280,7 +277,7 @@ Boots_off(VOID_ARGS) } static int -Cloak_on(VOID_ARGS) +Cloak_on(void) { long oldprop = u.uprops[objects[uarmc->otyp].oc_oprop].extrinsic & ~WORN_CLOAK; @@ -335,7 +332,7 @@ Cloak_on(VOID_ARGS) } int -Cloak_off(VOID_ARGS) +Cloak_off(void) { struct obj *otmp = uarmc; int otyp = otmp->otyp; @@ -385,9 +382,8 @@ Cloak_off(VOID_ARGS) return 0; } -static -int -Helmet_on(VOID_ARGS) +static int +Helmet_on(void) { switch (uarmh->otyp) { case FEDORA: @@ -462,7 +458,7 @@ Helmet_on(VOID_ARGS) } int -Helmet_off(VOID_ARGS) +Helmet_off(void) { g.context.takeoff.mask &= ~W_ARMH; @@ -506,9 +502,8 @@ Helmet_off(VOID_ARGS) return 0; } -static -int -Gloves_on(VOID_ARGS) +static int +Gloves_on(void) { long oldprop = u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES; @@ -536,9 +531,8 @@ Gloves_on(VOID_ARGS) } static void -wielding_corpse(obj, voluntary) -struct obj *obj; -boolean voluntary; /* taking gloves off on purpose? */ +wielding_corpse(struct obj *obj, + boolean voluntary) /* taking gloves off on purpose? */ { char kbuf[BUFSZ]; @@ -560,7 +554,7 @@ boolean voluntary; /* taking gloves off on purpose? */ } int -Gloves_off(VOID_ARGS) +Gloves_off(void) { long oldprop = u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES; @@ -614,7 +608,7 @@ Gloves_off(VOID_ARGS) } static int -Shield_on(VOID_ARGS) +Shield_on(void) { /* no shield currently requires special handling when put on, but we keep this uncommented in case somebody adds a new one which does @@ -638,7 +632,7 @@ Shield_on(VOID_ARGS) } int -Shield_off(VOID_ARGS) +Shield_off(void) { g.context.takeoff.mask &= ~W_ARMS; @@ -662,7 +656,7 @@ Shield_off(VOID_ARGS) } static int -Shirt_on(VOID_ARGS) +Shirt_on(void) { /* no shirt currently requires special handling when put on, but we keep this uncommented in case somebody adds a new one which does */ @@ -679,7 +673,7 @@ Shirt_on(VOID_ARGS) } int -Shirt_off(VOID_ARGS) +Shirt_off(void) { g.context.takeoff.mask &= ~W_ARMU; @@ -697,9 +691,8 @@ Shirt_off(VOID_ARGS) return 0; } -static -int -Armor_on(VOID_ARGS) +static int +Armor_on(void) { /* * No suits require special handling. Special properties conferred by @@ -712,7 +705,7 @@ Armor_on(VOID_ARGS) } int -Armor_off(VOID_ARGS) +Armor_off(void) { g.context.takeoff.mask &= ~W_ARM; setworn((struct obj *) 0, W_ARM); @@ -727,7 +720,7 @@ Armor_off(VOID_ARGS) * repeating.] */ int -Armor_gone() +Armor_gone(void) { g.context.takeoff.mask &= ~W_ARM; setnotworn(uarm); @@ -736,7 +729,7 @@ Armor_gone() } static void -Amulet_on() +Amulet_on(void) { /* make sure amulet isn't wielded; can't use remove_worn_item() here because it has already been set worn in amulet slot */ @@ -831,7 +824,7 @@ Amulet_on() } void -Amulet_off() +Amulet_off(void) { g.context.takeoff.mask &= ~W_AMUL; @@ -907,9 +900,7 @@ Amulet_off() /* handle ring discovery; comparable to learnwand() */ static void -learnring(ring, observed) -struct obj *ring; -boolean observed; +learnring(struct obj *ring, boolean observed) { int ringtype = ring->otyp; @@ -939,8 +930,7 @@ boolean observed; } void -Ring_on(obj) -register struct obj *obj; +Ring_on(register struct obj *obj) { long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic; int old_attrib, which; @@ -1056,9 +1046,7 @@ register struct obj *obj; } static void -Ring_off_or_gone(obj, gone) -register struct obj *obj; -boolean gone; +Ring_off_or_gone(register struct obj *obj, boolean gone) { long mask = (obj->owornmask & W_RING); int old_attrib, which; @@ -1168,22 +1156,19 @@ boolean gone; } void -Ring_off(obj) -struct obj *obj; +Ring_off(struct obj *obj) { Ring_off_or_gone(obj, FALSE); } void -Ring_gone(obj) -struct obj *obj; +Ring_gone(struct obj *obj) { Ring_off_or_gone(obj, TRUE); } void -Blindf_on(otmp) -struct obj *otmp; +Blindf_on(struct obj *otmp) { boolean already_blind = Blind, changed = FALSE; @@ -1218,8 +1203,7 @@ struct obj *otmp; } void -Blindf_off(otmp) -struct obj *otmp; +Blindf_off(struct obj *otmp) { boolean was_blind = Blind, changed = FALSE, nooffmsg = !otmp; @@ -1263,8 +1247,8 @@ struct obj *otmp; /* called in moveloop()'s prologue to set side-effects of worn start-up items; also used by poly_obj() when a worn item gets transformed */ void -set_wear(obj) -struct obj *obj; /* if null, do all worn items; otherwise just obj itself */ +set_wear(struct obj *obj) /* if null, do all worn items; + otherwise just obj itself */ { g.initial_don = !obj; @@ -1298,8 +1282,7 @@ struct obj *obj; /* if null, do all worn items; otherwise just obj itself */ /* check whether the target object is currently being put on (or taken off-- also checks for doffing--[why?]) */ boolean -donning(otmp) -struct obj *otmp; +donning(struct obj *otmp) { boolean result = FALSE; @@ -1328,8 +1311,7 @@ struct obj *otmp; so that stop_donning() and steal() can vary messages and doname() can vary "(being worn)" suffix */ boolean -doffing(otmp) -struct obj *otmp; +doffing(struct obj *otmp) { long what = g.context.takeoff.what; boolean result = FALSE; @@ -1371,9 +1353,7 @@ struct obj *otmp; /* despite their names, cancel_don() and cancel_doff() both apply to both donning and doffing... */ void -cancel_doff(obj, slotmask) -struct obj *obj; -long slotmask; +cancel_doff(struct obj *obj, long slotmask) { /* Called by setworn() for old item in specified slot or by setnotworn() * for specified item. We don't want to call cancel_don() if we got @@ -1392,7 +1372,7 @@ long slotmask; /* despite their names, cancel_don() and cancel_doff() both apply to both donning and doffing... */ void -cancel_don() +cancel_don(void) { /* the piece of armor we were donning/doffing has vanished, so stop * wasting time on it (and don't dereference it when donning would @@ -1401,7 +1381,7 @@ cancel_don() g.context.takeoff.cancelled_don = (g.afternmv == Boots_on || g.afternmv == Helmet_on || g.afternmv == Gloves_on || g.afternmv == Armor_on); - g.afternmv = (int NDECL((*))) 0; + g.afternmv = (int (*)(void)) 0; g.nomovemsg = (char *) 0; g.multi = 0; g.context.takeoff.delay = 0; @@ -1410,8 +1390,8 @@ cancel_don() /* called by steal() during theft from hero; interrupt donning/doffing */ int -stop_donning(stolenobj) -struct obj *stolenobj; /* no message if stolenobj is already being doffing */ +stop_donning(struct obj *stolenobj) /* no message if stolenobj is already + being doffing */ { char buf[BUFSZ]; struct obj *otmp; @@ -1431,7 +1411,7 @@ struct obj *stolenobj; /* no message if stolenobj is already being doffing */ cancel_don(); /* don't want _on() or _off() being called by unmul() since the on or off action isn't completing */ - g.afternmv = (int NDECL((*))) 0; + g.afternmv = (int (*)(void)) 0; if (putting_on || otmp != stolenobj) { Sprintf(buf, "You stop %s %s.", putting_on ? "putting on" : "taking off", @@ -1455,9 +1435,8 @@ static NEARDATA int Narmorpieces, Naccessories; /* assign values to Narmorpieces and Naccessories */ static void -count_worn_stuff(which, accessorizing) -struct obj **which; /* caller wants this when count is 1 */ -boolean accessorizing; +count_worn_stuff(struct obj **which, /* caller wants this when count is 1 */ + boolean accessorizing) { struct obj *otmp; @@ -1493,8 +1472,7 @@ boolean accessorizing; /* take off one piece or armor or one accessory; shared by dotakeoff('T') and doremring('R') */ static int -armor_or_accessory_off(obj) -struct obj *obj; +armor_or_accessory_off(struct obj *obj) { if (!(obj->owornmask & (W_ARMOR | W_ACCESSORY))) { You("are not wearing that."); @@ -1556,7 +1534,7 @@ struct obj *obj; /* the 'T' command */ int -dotakeoff() +dotakeoff(void) { struct obj *otmp = (struct obj *) 0; @@ -1582,7 +1560,7 @@ dotakeoff() /* the 'R' command */ int -doremring() +doremring(void) { struct obj *otmp = 0; @@ -1601,8 +1579,7 @@ doremring() /* Check if something worn is cursed _and_ unremovable. */ int -cursed(otmp) -struct obj *otmp; +cursed(struct obj *otmp) { if (!otmp) { impossible("cursed without otmp"); @@ -1629,8 +1606,7 @@ struct obj *otmp; } int -armoroff(otmp) -struct obj *otmp; +armoroff(struct obj *otmp) { static char offdelaybuf[60]; int delay = -objects[otmp->otyp].oc_delay; @@ -1720,15 +1696,13 @@ struct obj *otmp; } static void -already_wearing(cc) -const char *cc; +already_wearing(const char *cc) { You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.'); } static void -already_wearing2(cc1, cc2) -const char *cc1, *cc2; +already_wearing2(const char *cc1, const char *cc2) { You_cant("wear %s because you're wearing %s there already.", cc1, cc2); } @@ -1741,10 +1715,7 @@ const char *cc1, *cc2; * output: mask (otmp's armor type) */ int -canwearobj(otmp, mask, noisy) -struct obj *otmp; -long *mask; -boolean noisy; +canwearobj(struct obj *otmp, long *mask, boolean noisy) { int err = 0; const char *which; @@ -1923,8 +1894,7 @@ boolean noisy; } static int -accessory_or_armor_on(obj) -struct obj *obj; +accessory_or_armor_on(struct obj *obj) { long mask = 0L; boolean armor, ring, eyewear; @@ -2141,7 +2111,7 @@ struct obj *obj; /* the 'W' command */ int -dowear() +dowear(void) { struct obj *otmp; @@ -2163,7 +2133,7 @@ dowear() /* the 'P' command */ int -doputon() +doputon(void) { struct obj *otmp; @@ -2182,7 +2152,7 @@ doputon() /* calculate current armor class */ void -find_ac() +find_ac(void) { int uac = mons[u.umonnum].ac; /* base armor class for current form */ @@ -2237,7 +2207,7 @@ find_ac() } void -glibr() +glibr(void) { register struct obj *otmp; int xfl = 0; @@ -2324,8 +2294,7 @@ glibr() } struct obj * -some_armor(victim) -struct monst *victim; +some_armor(struct monst *victim) { register struct obj *otmph, *otmp; @@ -2352,9 +2321,7 @@ struct monst *victim; /* used for praying to check and fix levitation trouble */ struct obj * -stuck_ring(ring, otyp) -struct obj *ring; -int otyp; +stuck_ring(struct obj *ring, int otyp) { if (ring != uleft && ring != uright) { impossible("stuck_ring: neither left nor right?"); @@ -2384,7 +2351,7 @@ int otyp; /* also for praying; find worn item that confers "Unchanging" attribute */ struct obj * -unchanger() +unchanger(void) { if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) return uamul; @@ -2393,8 +2360,7 @@ unchanger() static int -select_off(otmp) -register struct obj *otmp; +select_off(register struct obj *otmp) { struct obj *why; char buf[BUFSZ]; @@ -2520,7 +2486,7 @@ register struct obj *otmp; } static struct obj * -do_takeoff() +do_takeoff(void) { struct obj *otmp = (struct obj *) 0; boolean was_twoweap = u.twoweap; @@ -2595,9 +2561,8 @@ do_takeoff() } /* occupation callback for 'A' */ -static -int -take_off(VOID_ARGS) +static int +take_off(void) { register int i; register struct obj *otmp; @@ -2688,7 +2653,7 @@ take_off(VOID_ARGS) /* clear saved context to avoid inappropriate resumption of interrupted 'A' */ void -reset_remarm() +reset_remarm(void) { g.context.takeoff.what = g.context.takeoff.mask = 0L; g.context.takeoff.disrobing[0] = '\0'; @@ -2696,7 +2661,7 @@ reset_remarm() /* the 'A' command -- remove multiple worn items */ int -doddoremarm() +doddoremarm(void) { int result = 0; @@ -2734,8 +2699,7 @@ doddoremarm() } static int -menu_remarm(retry) -int retry; +menu_remarm(int retry) { int n, i = 0; menu_item *pick_list; @@ -2787,8 +2751,7 @@ int retry; /* hit by destroy armor scroll/black dragon breath/monster spell */ int -destroy_arm(atmp) -register struct obj *atmp; +destroy_arm(register struct obj *atmp) { register struct obj *otmp; #define DESTROY_ARM(o) \ @@ -2850,9 +2813,7 @@ register struct obj *atmp; } void -adj_abon(otmp, delta) -register struct obj *otmp; -register schar delta; +adj_abon(register struct obj *otmp, register schar delta) { if (uarmg && uarmg == otmp && otmp->otyp == GAUNTLETS_OF_DEXTERITY) { if (delta) { @@ -2875,10 +2836,11 @@ register schar delta; used for dipping into liquid and applying grease; some criteria are different than select_off()'s */ boolean -inaccessible_equipment(obj, verb, only_if_known_cursed) -struct obj *obj; -const char *verb; /* "dip" or "grease", or null to avoid messages */ -boolean only_if_known_cursed; /* ignore covering unless known to be cursed */ +inaccessible_equipment(struct obj *obj, + const char *verb, /* "dip" or "grease", or null to + avoid messages */ + boolean only_if_known_cursed) /* ignore covering unless + known to be cursed */ { static NEARDATA const char need_to_take_off_outer_armor[] = "need to take off %s to %s %s."; @@ -2934,10 +2896,7 @@ boolean only_if_known_cursed; /* ignore covering unless known to be cursed */ /* not a getobj callback - unifies code among the other four getobj callbacks */ static int -equip_ok(obj, removing, accessory) -struct obj *obj; -boolean removing; -boolean accessory; +equip_ok(struct obj *obj, boolean removing, boolean accessory) { boolean is_worn; long dummymask = 0; @@ -2982,32 +2941,28 @@ boolean accessory; /* getobj callback for P command */ static int -puton_ok(obj) -struct obj *obj; +puton_ok(struct obj *obj) { return equip_ok(obj, FALSE, TRUE); } /* getobj callback for R command */ static int -remove_ok(obj) -struct obj *obj; +remove_ok(struct obj *obj) { return equip_ok(obj, TRUE, TRUE); } /* getobj callback for W command */ static int -wear_ok(obj) -struct obj *obj; +wear_ok(struct obj *obj) { return equip_ok(obj, FALSE, FALSE); } /* getobj callback for T command */ static int -takeoff_ok(obj) -struct obj *obj; +takeoff_ok(struct obj *obj) { return equip_ok(obj, TRUE, FALSE); } diff --git a/src/dog.c b/src/dog.c index 50ffd00c9..5657c4503 100644 --- a/src/dog.c +++ b/src/dog.c @@ -5,11 +5,10 @@ #include "hack.h" -static int NDECL(pet_type); +static int pet_type(void); void -newedog(mtmp) -struct monst *mtmp; +newedog(struct monst *mtmp) { if (!mtmp->mextra) mtmp->mextra = newmextra(); @@ -20,8 +19,7 @@ struct monst *mtmp; } void -free_edog(mtmp) -struct monst *mtmp; +free_edog(struct monst *mtmp) { if (mtmp->mextra && EDOG(mtmp)) { free((genericptr_t) EDOG(mtmp)); @@ -31,8 +29,7 @@ struct monst *mtmp; } void -initedog(mtmp) -register struct monst *mtmp; +initedog(struct monst *mtmp) { mtmp->mtame = is_domestic(mtmp->data) ? 10 : 5; mtmp->mpeaceful = 1; @@ -54,7 +51,7 @@ register struct monst *mtmp; } static int -pet_type() +pet_type(void) { if (g.urole.petnum != NON_PM) return g.urole.petnum; @@ -67,10 +64,7 @@ pet_type() } struct monst * -make_familiar(otmp, x, y, quietly) -register struct obj *otmp; -xchar x, y; -boolean quietly; +make_familiar(struct obj *otmp, xchar x, xchar y, boolean quietly) { struct permonst *pm; struct monst *mtmp = 0; @@ -149,7 +143,7 @@ boolean quietly; } struct monst * -makedog() +makedog(void) { register struct monst *mtmp; register struct obj *otmp; @@ -202,7 +196,7 @@ makedog() /* record `last move time' for all monsters prior to level save so that mon_arrive() can catch up for lost time when they're restored later */ void -update_mlstmv() +update_mlstmv(void) { struct monst *mon; @@ -216,7 +210,7 @@ update_mlstmv() } void -losedogs() +losedogs(void) { register struct monst *mtmp, *mtmp0, *mtmp2; int dismissKops = 0; @@ -298,9 +292,7 @@ losedogs() /* called from resurrect() in addition to losedogs() */ void -mon_arrive(mtmp, with_you) -struct monst *mtmp; -boolean with_you; +mon_arrive(struct monst *mtmp, boolean with_you) { struct trap *t; xchar xlocale, ylocale, xyloc, xyflags, wander; @@ -481,9 +473,8 @@ boolean with_you; /* heal monster for time spent elsewhere */ void -mon_catchup_elapsed_time(mtmp, nmv) -struct monst *mtmp; -long nmv; /* number of moves */ +mon_catchup_elapsed_time(struct monst *mtmp, + long nmv) /* number of moves */ { int imv = 0; /* avoid zillions of casts and lint warnings */ @@ -581,8 +572,7 @@ long nmv; /* number of moves */ /* called when you move to another level */ void -keepdogs(pets_only) -boolean pets_only; /* true for ascension or final escape */ +keepdogs(boolean pets_only) /* true for ascension or final escape */ { register struct monst *mtmp, *mtmp2; register struct obj *obj; @@ -692,11 +682,10 @@ boolean pets_only; /* true for ascension or final escape */ } void -migrate_to_level(mtmp, tolev, xyloc, cc) -register struct monst *mtmp; -xchar tolev; /* destination level */ -xchar xyloc; /* MIGR_xxx destination xy location: */ -coord *cc; /* optional destination coordinates */ +migrate_to_level(struct monst *mtmp, + xchar tolev, /* destination level */ + xchar xyloc, /* MIGR_xxx destination xy location: */ + coord *cc) /* optional destination coordinates */ { struct obj *obj; d_level new_lev; @@ -752,9 +741,7 @@ coord *cc; /* optional destination coordinates */ /* return quality of food; the lower the better */ /* fungi will eat even tainted food */ int -dogfood(mon, obj) -struct monst *mon; -register struct obj *obj; +dogfood(struct monst *mon, struct obj *obj) { struct permonst *mptr = mon->data, *fptr = 0; boolean carni = carnivorous(mptr), herbi = herbivorous(mptr), @@ -900,9 +887,7 @@ register struct obj *obj; * succeeded. */ boolean -tamedog(mtmp, obj) -register struct monst *mtmp; -register struct obj *obj; +tamedog(struct monst *mtmp, struct obj *obj) { /* The Wiz, Medusa and the quest nemeses aren't even made peaceful. */ if (mtmp->iswiz || mtmp->data == &mons[PM_MEDUSA] @@ -996,9 +981,7 @@ register struct obj *obj; * If the pet wasn't abused and was very tame, it might revive tame. */ void -wary_dog(mtmp, was_dead) -struct monst *mtmp; -boolean was_dead; +wary_dog(struct monst *mtmp, boolean was_dead) { struct edog *edog; boolean quietly = was_dead; @@ -1067,8 +1050,7 @@ boolean was_dead; } void -abuse_dog(mtmp) -struct monst *mtmp; +abuse_dog(struct monst *mtmp) { if (!mtmp->mtame) return; diff --git a/src/dogmove.c b/src/dogmove.c index 2b012864e..120f4156c 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -7,22 +7,21 @@ #include "mfndpos.h" -static boolean FDECL(dog_hunger, (struct monst *, struct edog *)); -static int FDECL(dog_invent, (struct monst *, struct edog *, int)); -static int FDECL(dog_goal, (struct monst *, struct edog *, int, int, int)); -static struct monst *FDECL(find_targ, (struct monst *, int, int, int)); -static int FDECL(find_friends, (struct monst *, struct monst *, int)); -static struct monst *FDECL(best_target, (struct monst *)); -static long FDECL(score_targ, (struct monst *, struct monst *)); -static boolean FDECL(can_reach_location, (struct monst *, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P)); -static boolean FDECL(could_reach_item, (struct monst *, XCHAR_P, XCHAR_P)); -static void FDECL(quickmimic, (struct monst *)); +static boolean dog_hunger(struct monst *, struct edog *); +static int dog_invent(struct monst *, struct edog *, int); +static int dog_goal(struct monst *, struct edog *, int, int, int); +static struct monst *find_targ(struct monst *, int, int, int); +static int find_friends(struct monst *, struct monst *, int); +static struct monst *best_target(struct monst *); +static long score_targ(struct monst *, struct monst *); +static boolean can_reach_location(struct monst *, xchar, xchar, xchar, + xchar); +static boolean could_reach_item(struct monst *, xchar, xchar); +static void quickmimic(struct monst *); /* pick a carried item for pet to drop */ struct obj * -droppables(mon) -struct monst *mon; +droppables(struct monst *mon) { struct obj *obj, *wep, dummy, *pickaxe, *unihorn, *key; @@ -121,11 +120,10 @@ static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS, 0 }; -static void FDECL(wantdoor, (int, int, genericptr_t)); +static void wantdoor(int, int, genericptr_t); boolean -cursed_object_at(x, y) -int x, y; +cursed_object_at(int x, int y) { struct obj *otmp; @@ -136,9 +134,7 @@ int x, y; } int -dog_nutrition(mtmp, obj) -struct monst *mtmp; -struct obj *obj; +dog_nutrition(struct monst *mtmp, struct obj *obj) { int nutrit; @@ -200,11 +196,11 @@ struct obj *obj; /* returns 2 if pet dies, otherwise 1 */ int -dog_eat(mtmp, obj, x, y, devour) -register struct monst *mtmp; -register struct obj *obj; /* if unpaid, then thrown or kicked by hero */ -int x, y; /* dog's starting location, might be different from current */ -boolean devour; +dog_eat(struct monst *mtmp, + struct obj *obj, /* if unpaid, then thrown or kicked by hero */ + int x, /* dog's starting location, */ + int y, /* might be different from current */ + boolean devour) { register struct edog *edog = EDOG(mtmp); boolean poly, grow, heal, eyes, slimer, deadmimic; @@ -356,9 +352,7 @@ boolean devour; /* hunger effects -- returns TRUE on starvation */ static boolean -dog_hunger(mtmp, edog) -struct monst *mtmp; -struct edog *edog; +dog_hunger(struct monst *mtmp, struct edog *edog) { if (g.monstermoves > edog->hungrytime + 500) { if (!carnivorous(mtmp->data) && !herbivorous(mtmp->data)) { @@ -402,10 +396,7 @@ struct edog *edog; * returns 1 if object eaten (since that counts as dog's move), 2 if died */ static int -dog_invent(mtmp, edog, udist) -register struct monst *mtmp; -register struct edog *edog; -int udist; +dog_invent(struct monst *mtmp, struct edog *edog, int udist) { register int omx, omy, carryamt = 0; struct obj *obj, *otmp; @@ -475,10 +466,8 @@ int udist; /* set dog's goal -- gtyp, gx, gy; returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */ static int -dog_goal(mtmp, edog, after, udist, whappr) -register struct monst *mtmp; -struct edog *edog; -int after, udist, whappr; +dog_goal(register struct monst *mtmp, struct edog *edog, + int after, int udist, int whappr) { register int omx, omy; boolean in_masters_sight, dog_has_minvent; @@ -619,10 +608,7 @@ int after, udist, whappr; } static struct monst * -find_targ(mtmp, dx, dy, maxdist) -register struct monst *mtmp; -int dx, dy; -int maxdist; +find_targ(register struct monst *mtmp, int dx, int dy, int maxdist) { struct monst *targ = 0; int curx = mtmp->mx, cury = mtmp->my; @@ -662,9 +648,7 @@ int maxdist; } static int -find_friends(mtmp, mtarg, maxdist) -struct monst *mtmp, *mtarg; -int maxdist; +find_friends(struct monst *mtmp, struct monst *mtarg, int maxdist) { struct monst *pal; int dx = sgn(mtarg->mx - mtmp->mx), @@ -708,8 +692,7 @@ int maxdist; } static long -score_targ(mtmp, mtarg) -struct monst *mtmp, *mtarg; +score_targ(struct monst *mtmp, struct monst *mtarg) { long score = 0L; @@ -809,8 +792,7 @@ struct monst *mtmp, *mtarg; } static struct monst * -best_target(mtmp) -struct monst *mtmp; /* Pet */ +best_target(struct monst *mtmp) /* Pet */ { int dx, dy; long bestscore = -40000L, currscore; @@ -867,9 +849,8 @@ struct monst *mtmp; /* Pet */ * (may have attacked something) */ int -dog_move(mtmp, after) -register struct monst *mtmp; -int after; /* this is extra fast monster movement */ +dog_move(register struct monst *mtmp, + int after) /* this is extra fast monster movement */ { int omx, omy; /* original mtmp position */ int appr, whappr, udist; @@ -1272,9 +1253,7 @@ int after; /* this is extra fast monster movement */ /* check if a monster could pick up objects from a location */ static boolean -could_reach_item(mon, nx, ny) -struct monst *mon; -xchar nx, ny; +could_reach_item(struct monst *mon, xchar nx, xchar ny) { if ((!is_pool(nx, ny) || is_swimmer(mon->data)) && (!is_lava(nx, ny) || likes_lava(mon->data)) @@ -1291,9 +1270,7 @@ xchar nx, ny; * calls deep. */ static boolean -can_reach_location(mon, mx, my, fx, fy) -struct monst *mon; -xchar mx, my, fx, fy; +can_reach_location(struct monst *mon, xchar mx, xchar my, xchar fx, xchar fy) { int i, j; int dist; @@ -1329,9 +1306,7 @@ xchar mx, my, fx, fy; /* do_clear_area client */ static void -wantdoor(x, y, distance) -int x, y; -genericptr_t distance; +wantdoor(int x, int y, genericptr_t distance) { int ndist, *dist_ptr = (int *) distance; @@ -1361,8 +1336,7 @@ static const struct qmchoices { }; void -finish_meating(mtmp) -struct monst *mtmp; +finish_meating(struct monst *mtmp) { mtmp->meating = 0; if (M_AP_TYPE(mtmp) && mtmp->mappearance && mtmp->cham == NON_PM) { @@ -1374,8 +1348,7 @@ struct monst *mtmp; } static void -quickmimic(mtmp) -struct monst *mtmp; +quickmimic(struct monst *mtmp) { int idx = 0, trycnt = 5, spotted, seeloc; char buf[BUFSZ]; diff --git a/src/dokick.c b/src/dokick.c index 922e24888..387c7037a 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -11,23 +11,20 @@ /* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */ -static void FDECL(kickdmg, (struct monst *, BOOLEAN_P)); -static boolean FDECL(maybe_kick_monster, (struct monst *, - XCHAR_P, XCHAR_P)); -static void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); -static int FDECL(kick_object, (XCHAR_P, XCHAR_P, char *)); -static int FDECL(really_kick_object, (XCHAR_P, XCHAR_P)); -static char *FDECL(kickstr, (char *, const char *)); -static void FDECL(otransit_msg, (struct obj *, BOOLEAN_P, BOOLEAN_P, long)); -static void FDECL(drop_to, (coord *, SCHAR_P, XCHAR_P, XCHAR_P)); +static void kickdmg(struct monst *, boolean); +static boolean maybe_kick_monster(struct monst *, xchar, xchar); +static void kick_monster(struct monst *, xchar, xchar); +static int kick_object(xchar, xchar, char *); +static int really_kick_object(xchar, xchar); +static char *kickstr(char *, const char *); +static void otransit_msg(struct obj *, boolean, boolean, long); +static void drop_to(coord *, schar, xchar, xchar); static const char kick_passes_thru[] = "kick passes harmlessly through"; /* kicking damage when not poly'd into a form with a kick attack */ static void -kickdmg(mon, clumsy) -struct monst *mon; -boolean clumsy; +kickdmg(struct monst *mon, boolean clumsy) { int mdx, mdy; int dmg = (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 15; @@ -118,9 +115,7 @@ boolean clumsy; } static boolean -maybe_kick_monster(mon, x, y) -struct monst *mon; -xchar x, y; +maybe_kick_monster(struct monst *mon, xchar x, xchar y) { if (mon) { boolean save_forcefight = g.context.forcefight; @@ -140,9 +135,7 @@ xchar x, y; } static void -kick_monster(mon, x, y) -struct monst *mon; -xchar x, y; +kick_monster(struct monst *mon, xchar x, xchar y) { boolean clumsy = FALSE; int i, j; @@ -281,9 +274,7 @@ xchar x, y; * The gold object is *not* attached to the fobj chain! */ boolean -ghitm(mtmp, gold) -register struct monst *mtmp; -register struct obj *gold; +ghitm(register struct monst *mtmp, register struct obj *gold) { boolean msg_given = FALSE; @@ -384,9 +375,8 @@ register struct obj *gold; /* container is kicked, dropped, thrown or otherwise impacted by player. * Assumes container is on floor. Checks contents for possible damage. */ void -container_impact_dmg(obj, x, y) -struct obj *obj; -xchar x, y; /* coordinates where object was before the impact, not after */ +container_impact_dmg(struct obj *obj, xchar x, + xchar y) /* coordinates where object was before the impact, not after */ { struct monst *shkp; struct obj *otmp, *otmp2; @@ -452,9 +442,7 @@ xchar x, y; /* coordinates where object was before the impact, not after */ /* jacket around really_kick_object */ static int -kick_object(x, y, kickobjnam) -xchar x, y; -char *kickobjnam; +kick_object(xchar x, xchar y, char *kickobjnam) { int res = 0; @@ -472,8 +460,7 @@ char *kickobjnam; /* guts of kick_object */ static int -really_kick_object(x, y) -xchar x, y; +really_kick_object(xchar x, xchar y) { int range; struct monst *mon, *shkp = 0; @@ -678,8 +665,8 @@ xchar x, y; (void) snuff_candle(g.kickedobj); newsym(x, y); mon = bhit(u.dx, u.dy, range, KICKED_WEAPON, - (int FDECL((*), (MONST_P, OBJ_P))) 0, - (int FDECL((*), (OBJ_P, OBJ_P))) 0, &g.kickedobj); + (int (*) (struct monst *, struct obj *)) 0, + (int (*) (struct obj *, struct obj *)) 0, &g.kickedobj); if (!g.kickedobj) return 1; /* object broken */ @@ -731,9 +718,7 @@ xchar x, y; /* cause of death if kicking kills kicker */ static char * -kickstr(buf, kickobjnam) -char *buf; -const char *kickobjnam; +kickstr(char *buf, const char *kickobjnam) { const char *what; @@ -773,7 +758,7 @@ const char *kickobjnam; } int -dokick() +dokick(void) { int x, y; int avrg_attrib; @@ -1331,10 +1316,7 @@ dokick() } static void -drop_to(cc, loc, x,y) -coord *cc; -schar loc; -xchar x,y; +drop_to(coord *cc, schar loc, xchar x, xchar y) { stairway *stway = stairway_at(x, y); @@ -1371,10 +1353,9 @@ xchar x,y; /* player or missile impacts location, causing objects to fall down */ void -impact_drop(missile, x, y, dlev) -struct obj *missile; /* caused impact, won't drop itself */ -xchar x, y; /* location affected */ -xchar dlev; /* if !0 send to dlev near player */ +impact_drop(struct obj *missile, /* caused impact, won't drop itself */ + xchar x, xchar y, /* location affected */ + xchar dlev) /* if !0 send to dlev near player */ { schar toloc; register struct obj *obj, *obj2; @@ -1499,10 +1480,7 @@ xchar dlev; /* if !0 send to dlev near player */ * otmp is either a kicked, dropped, or thrown object. */ boolean -ship_object(otmp, x, y, shop_floor_obj) -xchar x, y; -struct obj *otmp; -boolean shop_floor_obj; +ship_object(struct obj *otmp, xchar x, xchar y, boolean shop_floor_obj) { schar toloc; xchar ox, oy; @@ -1625,8 +1603,7 @@ boolean shop_floor_obj; } void -obj_delivery(near_hero) -boolean near_hero; +obj_delivery(boolean near_hero) { register struct obj *otmp, *otmp2; int nx = 0, ny = 0; @@ -1710,10 +1687,7 @@ boolean near_hero; } void -deliver_obj_to_mon(mtmp, cnt, deliverflags) -int cnt; -struct monst *mtmp; -unsigned long deliverflags; +deliver_obj_to_mon(struct monst *mtmp, int cnt, unsigned long deliverflags) { struct obj *otmp, *otmp2; int where, maxobj = 1; @@ -1768,10 +1742,7 @@ unsigned long deliverflags; } static void -otransit_msg(otmp, nodrop, chainthere, num) -register struct obj *otmp; -boolean nodrop, chainthere; -long num; +otransit_msg(register struct obj *otmp, boolean nodrop, boolean chainthere, long num) { char *optr = 0, obuf[BUFSZ], xbuf[BUFSZ]; @@ -1805,8 +1776,7 @@ long num; /* migration destination for objects which fall down to next level */ schar -down_gate(x, y) -xchar x, y; +down_gate(xchar x, xchar y) { struct trap *ttmp; stairway *stway = stairway_at(x, y); diff --git a/src/dothrow.c b/src/dothrow.c index ec325bb36..0a4c53904 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -7,27 +7,24 @@ #include "hack.h" -static int FDECL(throw_obj, (struct obj *, int)); -static boolean FDECL(ok_to_throw, (int *)); -static int FDECL(throw_ok, (struct obj *)); -static void NDECL(autoquiver); -static int FDECL(gem_accept, (struct monst *, struct obj *)); -static void FDECL(tmiss, (struct obj *, struct monst *, BOOLEAN_P)); -static int FDECL(throw_gold, (struct obj *)); -static void FDECL(check_shop_obj, (struct obj *, XCHAR_P, XCHAR_P, - BOOLEAN_P)); -static void FDECL(breakmsg, (struct obj *, BOOLEAN_P)); -static boolean FDECL(toss_up, (struct obj *, BOOLEAN_P)); -static void FDECL(sho_obj_return_to_u, (struct obj * obj)); -static boolean FDECL(mhurtle_step, (genericptr_t, int, int)); +static int throw_obj(struct obj *, int); +static boolean ok_to_throw(int *); +static int throw_ok(struct obj *); +static void autoquiver(void); +static int gem_accept(struct monst *, struct obj *); +static void tmiss(struct obj *, struct monst *, boolean); +static int throw_gold(struct obj *); +static void check_shop_obj(struct obj *, xchar, xchar, boolean); +static void breakmsg(struct obj *, boolean); +static boolean toss_up(struct obj *, boolean); +static void sho_obj_return_to_u(struct obj * obj); +static boolean mhurtle_step(genericptr_t, int, int); /* g.thrownobj (decl.c) tracks an object until it lands */ int -multishot_class_bonus(pm, ammo, launcher) -int pm; -struct obj *ammo; -struct obj *launcher; /* can be NULL */ +multishot_class_bonus(int pm, struct obj *ammo, + struct obj *launcher) /* can be NULL */ { int multishot = 0; schar skill = objects[ammo->otyp].oc_skill; @@ -71,9 +68,7 @@ struct obj *launcher; /* can be NULL */ /* Throw the selected object, asking for direction */ static int -throw_obj(obj, shotlimit) -struct obj *obj; -int shotlimit; +throw_obj(struct obj *obj, int shotlimit) { struct obj *otmp, *oldslot; int multishot; @@ -249,8 +244,7 @@ int shotlimit; /* common to dothrow() and dofire() */ static boolean -ok_to_throw(shotlimit_p) -int *shotlimit_p; /* (see dothrow()) */ +ok_to_throw(int *shotlimit_p) /* (see dothrow()) */ { /* kludge to work around parse()'s pre-decrement of `multi' */ *shotlimit_p = (g.multi || g.save_cm) ? g.multi + 1 : 0; @@ -271,8 +265,7 @@ int *shotlimit_p; /* (see dothrow()) */ /* getobj callback for object to be thrown */ static int -throw_ok(obj) -struct obj *obj; +throw_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -301,7 +294,7 @@ struct obj *obj; /* t command - throw */ int -dothrow() +dothrow(void) { register struct obj *obj; int shotlimit; @@ -330,7 +323,7 @@ dothrow() /* KMH -- Automatically fill quiver */ /* Suggested by Jeffrey Bay */ static void -autoquiver() +autoquiver(void) { struct obj *otmp, *oammo = 0, *omissile = 0, *omisc = 0, *altammo = 0; @@ -393,7 +386,7 @@ autoquiver() /* f command -- fire: throw from the quiver */ int -dofire() +dofire(void) { int shotlimit; struct obj *obj; @@ -450,8 +443,7 @@ dofire() /* if in midst of multishot shooting/throwing, stop early */ void -endmultishot(verbose) -boolean verbose; +endmultishot(boolean verbose) { if (g.m_shot.i < g.m_shot.n) { if (verbose && !g.context.mon_moving) { @@ -467,9 +459,9 @@ boolean verbose; /* Object hits floor at hero's feet. Called from drop(), throwit(), hold_another_object(), litter(). */ void -hitfloor(obj, verbosely) -struct obj *obj; -boolean verbosely; /* usually True; False if caller has given drop message */ +hitfloor(struct obj *obj, + boolean verbosely) /* usually True; False if caller has given + drop message */ { if (IS_SOFT(levl[u.ux][u.uy].typ) || u.uinwater || u.uswallow) { dropy(obj); @@ -516,11 +508,9 @@ boolean verbosely; /* usually True; False if caller has given drop message */ * before the failed callback. */ boolean -walk_path(src_cc, dest_cc, check_proc, arg) -coord *src_cc; -coord *dest_cc; -boolean FDECL((*check_proc), (genericptr_t, int, int)); -genericptr_t arg; +walk_path(coord *src_cc, coord *dest_cc, + boolean (*check_proc)(genericptr_t, int, int), + genericptr_t arg) { int x, y, dx, dy, x_change, y_change, err, i, prev_x, prev_y; boolean keep_going = TRUE; @@ -601,9 +591,7 @@ genericptr_t arg; vs drag-to-dest; original callers use first mode, jumping wants second, grappling hook backfire and thrown chained ball need third */ boolean -hurtle_jump(arg, x, y) -genericptr_t arg; -int x, y; +hurtle_jump(genericptr_t arg, int x, int y) { boolean res; long save_EWwalking = EWwalking; @@ -634,9 +622,7 @@ int x, y; * o let jumps go over boulders */ boolean -hurtle_step(arg, x, y) -genericptr_t arg; -int x, y; +hurtle_step(genericptr_t arg, int x, int y) { int ox, oy, *range = (int *) arg; struct obj *obj; @@ -836,9 +822,7 @@ int x, y; } static boolean -mhurtle_step(arg, x, y) -genericptr_t arg; -int x, y; +mhurtle_step(genericptr_t arg, int x, int y) { struct monst *mon = (struct monst *) arg; @@ -865,9 +849,7 @@ int x, y; * kick or throw and be only. */ void -hurtle(dx, dy, range, verbose) -int dx, dy, range; -boolean verbose; +hurtle(int dx, int dy, int range, boolean verbose) { coord uc, cc; @@ -921,9 +903,7 @@ boolean verbose; /* Move a monster through the air for a few squares. */ void -mhurtle(mon, dx, dy, range) -struct monst *mon; -int dx, dy, range; +mhurtle(struct monst *mon, int dx, int dy, int range) { coord mc, cc; @@ -956,10 +936,7 @@ int dx, dy, range; } static void -check_shop_obj(obj, x, y, broken) -struct obj *obj; -xchar x, y; -boolean broken; +check_shop_obj(struct obj *obj, xchar x, xchar y, boolean broken) { boolean costly_xy; struct monst *shkp = shop_keeper(*u.ushops); @@ -1000,9 +977,7 @@ boolean broken; * Returns FALSE if the object is gone. */ static boolean -toss_up(obj, hitsroof) -struct obj *obj; -boolean hitsroof; +toss_up(struct obj *obj, boolean hitsroof) { const char *action; boolean petrifier = ((obj->otyp == EGG || obj->otyp == CORPSE) @@ -1129,8 +1104,7 @@ boolean hitsroof; /* return true for weapon meant to be thrown; excludes ammo */ boolean -throwing_weapon(obj) -struct obj *obj; +throwing_weapon(struct obj *obj) { return (boolean) (is_missile(obj) || is_spear(obj) /* daggers and knife (excludes scalpel) */ @@ -1142,8 +1116,7 @@ struct obj *obj; /* the currently thrown object is returning to you (not for boomerangs) */ static void -sho_obj_return_to_u(obj) -struct obj *obj; +sho_obj_return_to_u(struct obj *obj) { /* might already be our location (bounced off a wall) */ if ((u.dx || u.dy) && (g.bhitpos.x != u.ux || g.bhitpos.y != u.uy)) { @@ -1162,11 +1135,11 @@ struct obj *obj; /* throw an object, NB: obj may be consumed in the process */ void -throwit(obj, wep_mask, twoweap, oldslot) -struct obj *obj; -long wep_mask; /* used to re-equip returning boomerang */ -boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ -struct obj *oldslot; /* for thrown-and-return used with !fixinv */ +throwit(struct obj *obj, + long wep_mask, /* used to re-equip returning boomerang */ + boolean twoweap, /* used to restore twoweapon mode if + wielded weapon returns */ + struct obj *oldslot) /* for thrown-and-return used with !fixinv */ { register struct monst *mon; int range, urange; @@ -1332,8 +1305,8 @@ struct obj *oldslot; /* for thrown-and-return used with !fixinv */ mon = bhit(u.dx, u.dy, range, tethered_weapon ? THROWN_TETHERED_WEAPON : THROWN_WEAPON, - (int FDECL((*), (MONST_P, OBJ_P))) 0, - (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj); + (int (*)(MONST_P, OBJ_P)) 0, + (int (*)(OBJ_P, OBJ_P)) 0, &obj); g.thrownobj = obj; /* obj may be null now */ /* have to do this after bhit() so u.ux & u.uy are correct */ @@ -1516,10 +1489,7 @@ struct obj *oldslot; /* for thrown-and-return used with !fixinv */ /* an object may hit a monster; various factors adjust chance of hitting */ int -omon_adj(mon, obj, mon_notices) -struct monst *mon; -struct obj *obj; -boolean mon_notices; +omon_adj(struct monst *mon, struct obj *obj, boolean mon_notices) { int tmp = 0; @@ -1559,10 +1529,7 @@ boolean mon_notices; /* thrown object misses target monster */ static void -tmiss(obj, mon, maybe_wakeup) -struct obj *obj; -struct monst *mon; -boolean maybe_wakeup; +tmiss(struct obj *obj, struct monst *mon, boolean maybe_wakeup) { const char *missile = mshot_xname(obj); @@ -1591,9 +1558,8 @@ boolean maybe_wakeup; * Also used for kicked objects and for polearms/grapnel applied at range. */ int -thitmonst(mon, obj) -register struct monst *mon; -register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */ +thitmonst(register struct monst *mon, + register struct obj *obj) /* g.thrownobj or g.kickedobj or uwep */ { register int tmp; /* Base chance to hit */ register int disttmp; /* distance modifier */ @@ -1876,9 +1842,7 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */ } static int -gem_accept(mon, obj) -register struct monst *mon; -register struct obj *obj; +gem_accept(register struct monst *mon, register struct obj *obj) { static NEARDATA const char nogood[] = " is not interested in your junk.", @@ -1986,10 +1950,10 @@ register struct obj *obj; * Return 0 if the object didn't break, 1 if the object broke. */ int -hero_breaks(obj, x, y, from_invent) -struct obj *obj; -xchar x, y; /* object location (ox, oy may not be right) */ -boolean from_invent; /* thrown or dropped by player; maybe on shop bill */ +hero_breaks(struct obj *obj, + xchar x, xchar y, /* object location (ox, oy may not be right) */ + boolean from_invent) /* thrown or dropped by player; + maybe on shop bill */ { boolean in_view = Blind ? FALSE : (from_invent || cansee(x, y)); @@ -2006,9 +1970,8 @@ boolean from_invent; /* thrown or dropped by player; maybe on shop bill */ * Return 0 if the object doesn't break, 1 if the object broke. */ int -breaks(obj, x, y) -struct obj *obj; -xchar x, y; /* object location (ox, oy may not be right) */ +breaks(struct obj *obj, + xchar x, xchar y) /* object location (ox, oy may not be right) */ { boolean in_view = Blind ? FALSE : cansee(x, y); @@ -2020,9 +1983,7 @@ xchar x, y; /* object location (ox, oy may not be right) */ } void -release_camera_demon(obj, x, y) -struct obj *obj; -xchar x, y; +release_camera_demon(struct obj *obj, xchar x, xchar y) { struct monst *mtmp; if (!rn2(3) @@ -2042,11 +2003,10 @@ xchar x, y; * and break messages have been delivered prior to getting here. */ void -breakobj(obj, x, y, hero_caused, from_invent) -struct obj *obj; -xchar x, y; /* object location (ox, oy may not be right) */ -boolean hero_caused; /* is this the hero's fault? */ -boolean from_invent; +breakobj(struct obj *obj, + xchar x, xchar y, /* object location (ox, oy may not be right) */ + boolean hero_caused, /* is this the hero's fault? */ + boolean from_invent) { boolean fracture = FALSE; @@ -2132,8 +2092,7 @@ boolean from_invent; * Return 0 if the object isn't going to break, 1 if it is. */ boolean -breaktest(obj) -struct obj *obj; +breaktest(struct obj *obj) { if (obj_resists(obj, 1, 99)) return 0; @@ -2155,9 +2114,7 @@ struct obj *obj; } static void -breakmsg(obj, in_view) -struct obj *obj; -boolean in_view; +breakmsg(struct obj *obj, boolean in_view) { const char *to_pieces; @@ -2197,8 +2154,7 @@ boolean in_view; } static int -throw_gold(obj) -struct obj *obj; +throw_gold(struct obj *obj) { int range, odx, ody; register struct monst *mon; @@ -2240,8 +2196,8 @@ struct obj *obj; g.bhitpos.y = u.uy; } else { mon = bhit(u.dx, u.dy, range, THROWN_WEAPON, - (int FDECL((*), (MONST_P, OBJ_P))) 0, - (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj); + (int (*)(MONST_P, OBJ_P)) 0, + (int (*)(OBJ_P, OBJ_P)) 0, &obj); if (!obj) return 1; /* object is gone */ if (mon) { diff --git a/src/drawing.c b/src/drawing.c index 421f466f7..495fb5119 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -252,8 +252,7 @@ const uchar def_r_oc_syms[MAXOCLASSES] = { * objnam.c, options.c, pickup.c, sp_lev.c, lev_main.c, and tilemap.c. */ int -def_char_to_objclass(ch) -char ch; +def_char_to_objclass(char ch) { int i; @@ -269,8 +268,7 @@ char ch; * Used in detect.c, options.c, read.c, sp_lev.c, and lev_main.c */ int -def_char_to_monclass(ch) -char ch; +def_char_to_monclass(char ch) { int i; @@ -282,8 +280,7 @@ char ch; /* does 'ch' represent a furniture character? returns index into defsyms[] */ int -def_char_is_furniture(ch) -char ch; +def_char_is_furniture(char ch) { /* note: these refer to defsyms[] order which is much different from levl[][].typ order but both keep furniture in a contiguous block */ diff --git a/src/dungeon.c b/src/dungeon.c index b5b02a16f..eef9a6f16 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -33,50 +33,47 @@ struct lchoice { }; #if 0 -static void FDECL(Fread, (genericptr_t, int, int, dlb *)); +static void Fread(genericptr_t, int, int, dlb *); #endif -static xchar FDECL(dname_to_dnum, (const char *)); -static int FDECL(find_branch, (const char *, struct proto_dungeon *)); -static xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *)); -static int FDECL(level_range, (XCHAR_P, int, int, int, - struct proto_dungeon *, int *)); -static xchar FDECL(parent_dlevel, (const char *, struct proto_dungeon *)); -static int FDECL(correct_branch_type, (struct tmpbranch *)); -static branch *FDECL(add_branch, (int, int, struct proto_dungeon *)); -static void FDECL(add_level, (s_level *)); -static void FDECL(init_level, (int, int, struct proto_dungeon *)); -static int FDECL(possible_places, (int, boolean *, - struct proto_dungeon *)); -static xchar FDECL(pick_level, (boolean *, int)); -static boolean FDECL(place_level, (int, struct proto_dungeon *)); -static int FDECL(get_dgn_flags, (lua_State *)); -static boolean FDECL(unplaced_floater, (struct dungeon *)); -static boolean FDECL(unreachable_level, (d_level *, BOOLEAN_P)); -static void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *, - BOOLEAN_P)); -static const char *FDECL(br_string, (int)); -static char FDECL(chr_u_on_lvl, (d_level *)); -static void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, - struct lchoice *)); -static mapseen *FDECL(load_mapseen, (NHFILE *)); -static void FDECL(save_mapseen, (NHFILE *, mapseen *)); -static mapseen *FDECL(find_mapseen, (d_level *)); -static mapseen *FDECL(find_mapseen_by_str, (const char *)); -static void FDECL(print_mapseen, (winid, mapseen *, int, int, BOOLEAN_P)); -static boolean FDECL(interest_mapseen, (mapseen *)); -static void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid, - int, int, int *)); -static const char *FDECL(seen_string, (XCHAR_P, const char *)); -static const char *FDECL(br_string2, (branch *)); -static const char *FDECL(shop_string, (int)); -static char *FDECL(tunesuffix, (mapseen *, char *)); +static xchar dname_to_dnum(const char *); +static int find_branch(const char *, struct proto_dungeon *); +static xchar parent_dnum(const char *, struct proto_dungeon *); +static int level_range(xchar, int, int, int, struct proto_dungeon *, + int *); +static xchar parent_dlevel(const char *, struct proto_dungeon *); +static int correct_branch_type(struct tmpbranch *); +static branch *add_branch(int, int, struct proto_dungeon *); +static void add_level(s_level *); +static void init_level(int, int, struct proto_dungeon *); +static int possible_places(int, boolean *, struct proto_dungeon *); +static xchar pick_level(boolean *, int); +static boolean place_level(int, struct proto_dungeon *); +static int get_dgn_flags(lua_State *); +static boolean unplaced_floater(struct dungeon *); +static boolean unreachable_level(d_level *, boolean); +static void tport_menu(winid, char *, struct lchoice *, d_level *, + boolean); +static const char *br_string(int); +static char chr_u_on_lvl(d_level *); +static void print_branch(winid, int, int, int, boolean, struct lchoice *); +static mapseen *load_mapseen(NHFILE *); +static void save_mapseen(NHFILE *, mapseen *); +static mapseen *find_mapseen(d_level *); +static mapseen *find_mapseen_by_str(const char *); +static void print_mapseen(winid, mapseen *, int, int, boolean); +static boolean interest_mapseen(mapseen *); +static void traverse_mapseenchn(boolean, winid, int, int, int *); +static const char *seen_string(xchar, const char *); +static const char *br_string2(branch *); +static const char *shop_string(int); +static char *tunesuffix(mapseen *, char *); #ifdef DEBUG #define DD g.dungeons[i] -static void NDECL(dumpit); +static void dumpit(void); static void -dumpit() +dumpit(void) { int i; s_level *x; @@ -131,9 +128,7 @@ dumpit() /* Save the dungeon structures. */ void -save_dungeon(nhfp, perform_write, free_data) -NHFILE *nhfp; -boolean perform_write, free_data; +save_dungeon(NHFILE *nhfp, boolean perform_write, boolean free_data) { int count; branch *curr, *next; @@ -196,8 +191,7 @@ boolean perform_write, free_data; /* Restore the dungeon structures. */ void -restore_dungeon(nhfp) -NHFILE *nhfp; +restore_dungeon(NHFILE *nhfp) { branch *curr, *last; int count = 0, i; @@ -257,10 +251,7 @@ NHFILE *nhfp; #if 0 static void -Fread(ptr, size, nitems, stream) -genericptr_t ptr; -int size, nitems; -dlb *stream; +Fread(genericptr_t ptr, int size, int nitems, dlb *stream) { int cnt; @@ -274,8 +265,7 @@ dlb *stream; #endif static xchar -dname_to_dnum(s) -const char *s; +dname_to_dnum(const char *s) { xchar i; @@ -289,8 +279,7 @@ const char *s; } s_level * -find_level(s) -const char *s; +find_level(const char *s) { s_level *curr; for (curr = g.sp_levchn; curr; curr = curr->next) @@ -301,9 +290,8 @@ const char *s; /* Find the branch that links the named dungeon. */ static int -find_branch(s, pd) -const char *s; /* dungeon name */ -struct proto_dungeon *pd; +find_branch(const char *s, /* dungeon name */ + struct proto_dungeon *pd) { int i; @@ -334,9 +322,8 @@ struct proto_dungeon *pd; * listing, then figuring out to which dungeon it belongs. */ static xchar -parent_dnum(s, pd) -const char *s; /* dungeon name */ -struct proto_dungeon *pd; +parent_dnum(const char *s, /* dungeon name */ + struct proto_dungeon *pd) { int i; xchar pdnum; @@ -366,11 +353,8 @@ struct proto_dungeon *pd; * end of the dungeon. */ static int -level_range(dgn, base, randc, chain, pd, adjusted_base) -xchar dgn; -int base, randc, chain; -struct proto_dungeon *pd; -int *adjusted_base; +level_range(xchar dgn, int base, int randc, int chain, + struct proto_dungeon *pd, int *adjusted_base) { int lmax = g.dungeons[dgn].num_dunlevs; @@ -401,9 +385,7 @@ int *adjusted_base; } static xchar -parent_dlevel(s, pd) -const char *s; -struct proto_dungeon *pd; +parent_dlevel(const char *s, struct proto_dungeon *pd) { int i, j, num, base, dnum = parent_dnum(s, pd); branch *curr; @@ -428,8 +410,7 @@ struct proto_dungeon *pd; /* Convert from the temporary branch type to the dungeon branch type. */ static int -correct_branch_type(tbr) -struct tmpbranch *tbr; +correct_branch_type(struct tmpbranch *tbr) { switch (tbr->type) { case TBR_STAIR: @@ -452,9 +433,7 @@ struct tmpbranch *tbr; * but needs to be repositioned. */ void -insert_branch(new_branch, extract_first) -branch *new_branch; -boolean extract_first; +insert_branch(branch *new_branch, boolean extract_first) { branch *curr, *prev; long new_val, curr_val, prev_val; @@ -502,10 +481,7 @@ boolean extract_first; /* Add a dungeon branch to the branch list. */ static branch * -add_branch(dgn, child_entry_level, pd) -int dgn; -int child_entry_level; -struct proto_dungeon *pd; +add_branch(int dgn, int child_entry_level, struct proto_dungeon *pd) { static int branch_id = 0; int branch_num; @@ -534,8 +510,7 @@ struct proto_dungeon *pd; * last entry. */ static void -add_level(new_lev) -s_level *new_lev; +add_level(s_level *new_lev) { s_level *prev, *curr; @@ -556,9 +531,7 @@ s_level *new_lev; } static void -init_level(dgn, proto_index, pd) -int dgn, proto_index; -struct proto_dungeon *pd; +init_level(int dgn, int proto_index, struct proto_dungeon *pd) { s_level *new_level; struct tmplevel *tlevel = &pd->tmplevel[proto_index]; @@ -590,10 +563,9 @@ struct proto_dungeon *pd; } static int -possible_places(idx, map, pd) -int idx; /* prototype index */ -boolean *map; /* array MAXLEVEL+1 in length */ -struct proto_dungeon *pd; +possible_places(int idx, /* prototype index */ + boolean *map, /* array MAXLEVEL+1 in length */ + struct proto_dungeon *pd) { int i, start, count; s_level *lev = pd->final_lev[idx]; @@ -622,9 +594,8 @@ struct proto_dungeon *pd; /* Pick the nth TRUE entry in the given boolean array. */ static xchar -pick_level(map, nth) -boolean *map; /* an array MAXLEVEL+1 in size */ -int nth; +pick_level(boolean *map, /* an array MAXLEVEL+1 in size */ + int nth) { int i; for (i = 1; i <= MAXLEVEL; i++) @@ -635,11 +606,10 @@ int nth; } #ifdef DDEBUG -static void FDECL(indent, (int)); +static void indent(int); static void -indent(d) -int d; +indent(int d) { while (d-- > 0) fputs(" ", stderr); @@ -654,9 +624,7 @@ int d; * been exhausted, return false. */ static boolean -place_level(proto_index, pd) -int proto_index; -struct proto_dungeon *pd; +place_level(int proto_index, struct proto_dungeon *pd) { boolean map[MAXLEVEL + 1]; /* valid levels are 1..MAXLEVEL inclusive */ s_level *lev; @@ -729,8 +697,7 @@ static struct level_map { { "", (d_level *) 0 } }; int -get_dgn_flags(L) -lua_State *L; +get_dgn_flags(lua_State *L) { int dgn_flags = 0; static const char *const flagstrs[] = { @@ -766,7 +733,7 @@ lua_State *L; /* initialize the "dungeon" structs */ void -init_dungeons() +init_dungeons(void) { static const char *const dgnaligns[] = { "unaligned", "noalign", "lawful", "neutral", "chaotic", NULL @@ -1226,24 +1193,21 @@ init_dungeons() /* return the level number for lev in *this* dungeon */ xchar -dunlev(lev) -d_level *lev; +dunlev(d_level *lev) { return lev->dlevel; } /* return the lowest level number for *this* dungeon */ xchar -dunlevs_in_dungeon(lev) -d_level *lev; +dunlevs_in_dungeon(d_level *lev) { return g.dungeons[lev->dnum].num_dunlevs; } /* return the lowest level explored in the game*/ xchar -deepest_lev_reached(noquest) -boolean noquest; +deepest_lev_reached(boolean noquest) { /* this function is used for three purposes: to provide a factor * of difficulty in monster generation; to provide a factor of @@ -1280,8 +1244,7 @@ boolean noquest; /* return a bookkeeping level number for purpose of comparisons and save/restore */ xchar -ledger_no(lev) -d_level *lev; +ledger_no(d_level *lev) { return (xchar) (lev->dlevel + g.dungeons[lev->dnum].ledger_start); } @@ -1297,7 +1260,7 @@ d_level *lev; * depth visited by the player. */ xchar -maxledgerno() +maxledgerno(void) { return (xchar) (g.dungeons[g.n_dgns - 1].ledger_start + g.dungeons[g.n_dgns - 1].num_dunlevs); @@ -1305,8 +1268,7 @@ maxledgerno() /* return the dungeon that this ledgerno exists in */ xchar -ledger_to_dnum(ledgerno) -xchar ledgerno; +ledger_to_dnum(xchar ledgerno) { register int i; @@ -1323,8 +1285,7 @@ xchar ledgerno; /* return the level of the dungeon this ledgerno exists in */ xchar -ledger_to_dlev(ledgerno) -xchar ledgerno; +ledger_to_dlev(xchar ledgerno) { return (xchar) (ledgerno - g.dungeons[ledger_to_dnum(ledgerno)].ledger_start); @@ -1333,16 +1294,14 @@ xchar ledgerno; /* returns the depth of a level, in floors below the surface (note levels in different dungeons can have the same depth) */ schar -depth(lev) -d_level *lev; +depth(d_level *lev) { return (schar) (g.dungeons[lev->dnum].depth_start + lev->dlevel - 1); } /* are "lev1" and "lev2" actually the same? */ boolean -on_level(lev1, lev2) -d_level *lev1, *lev2; +on_level(d_level *lev1, d_level *lev2) { return (boolean) (lev1->dnum == lev2->dnum && lev1->dlevel == lev2->dlevel); @@ -1350,8 +1309,7 @@ d_level *lev1, *lev2; /* is this level referenced in the special level chain? */ s_level * -Is_special(lev) -d_level *lev; +Is_special(d_level *lev) { s_level *levtmp; @@ -1367,8 +1325,7 @@ d_level *lev; * branch. Otherwise, return null. */ branch * -Is_branchlev(lev) -d_level *lev; +Is_branchlev(d_level *lev) { branch *curr; @@ -1381,8 +1338,7 @@ d_level *lev; /* returns True iff the branch 'lev' is in a branch which builds up */ boolean -builds_up(lev) -d_level *lev; +builds_up(d_level *lev) { dungeon *dptr = &g.dungeons[lev->dnum]; /* @@ -1395,8 +1351,7 @@ d_level *lev; /* goto the next level (or appropriate dungeon) */ void -next_level(at_stairs) -boolean at_stairs; +next_level(boolean at_stairs) { stairway *stway = stairway_at(u.ux, u.uy); d_level newlevel; @@ -1414,8 +1369,7 @@ boolean at_stairs; /* goto the previous level (or appropriate dungeon) */ void -prev_level(at_stairs) -boolean at_stairs; +prev_level(boolean at_stairs) { stairway *stway = stairway_at(u.ux, u.uy); d_level newlevel; @@ -1440,11 +1394,10 @@ boolean at_stairs; } void -u_on_newpos(x, y) -int x, y; +u_on_newpos(int x, int y) { if (!isok(x, y)) { /* validate location */ - void VDECL((*func), (const char *, ...)) PRINTF_F(1, 2); + void (*func)(const char *, ...); func = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic : impossible; @@ -1467,8 +1420,7 @@ int x, y; /* place you on a random location when arriving on a level */ void -u_on_rndspot(upflag) -int upflag; +u_on_rndspot(int upflag) { int up = (upflag & 1), was_in_W_tower = (upflag & 2); @@ -1499,10 +1451,7 @@ int upflag; } void -stairway_add(x, y, up, isladder, dest) -int x, y; -boolean up, isladder; -d_level *dest; +stairway_add(int x, int y, boolean up, boolean isladder, d_level *dest) { stairway *tmp = (stairway *)alloc(sizeof(stairway)); @@ -1516,7 +1465,7 @@ d_level *dest; } void -stairway_free_all() +stairway_free_all(void) { stairway *tmp = g.stairs; @@ -1529,8 +1478,7 @@ stairway_free_all() } stairway * -stairway_at(x,y) -int x,y; +stairway_at(int x, int y) { stairway *tmp = g.stairs; @@ -1540,8 +1488,7 @@ int x,y; } stairway * -stairway_find(fromdlev) -d_level *fromdlev; +stairway_find(d_level *fromdlev) { stairway *tmp = g.stairs; @@ -1555,9 +1502,7 @@ d_level *fromdlev; } stairway * -stairway_find_from(fromdlev, isladder) -d_level *fromdlev; -boolean isladder; +stairway_find_from(d_level *fromdlev, boolean isladder) { stairway *tmp = g.stairs; @@ -1572,8 +1517,7 @@ boolean isladder; } stairway * -stairway_find_dir(up) -boolean up; +stairway_find_dir(boolean up) { stairway *tmp = g.stairs; @@ -1583,8 +1527,7 @@ boolean up; } stairway * -stairway_find_type_dir(isladder, up) -boolean isladder, up; +stairway_find_type_dir(boolean isladder, boolean up) { stairway *tmp = g.stairs; @@ -1594,8 +1537,7 @@ boolean isladder, up; } stairway * -stairway_find_special_dir(up) -boolean up; +stairway_find_special_dir(boolean up) { stairway *tmp = g.stairs; @@ -1609,8 +1551,7 @@ boolean up; /* place you on the special staircase */ void -u_on_sstairs(upflag) -int upflag; +u_on_sstairs(int upflag) { stairway *stway = stairway_find_special_dir(upflag); @@ -1622,7 +1563,7 @@ int upflag; /* place you on upstairs (or special equivalent) */ void -u_on_upstairs() +u_on_upstairs(void) { stairway *stway = stairway_find_dir(TRUE); @@ -1634,7 +1575,7 @@ u_on_upstairs() /* place you on dnstairs (or special equivalent) */ void -u_on_dnstairs() +u_on_dnstairs(void) { stairway *stway = stairway_find_dir(FALSE); @@ -1645,15 +1586,13 @@ u_on_dnstairs() } boolean -On_stairs(x, y) -xchar x, y; +On_stairs(xchar x, xchar y) { return (stairway_at(x,y) != NULL); } boolean -On_ladder(x, y) -xchar x, y; +On_ladder(xchar x, xchar y) { stairway *stway = stairway_at(x,y); @@ -1661,8 +1600,7 @@ xchar x, y; } boolean -On_stairs_up(x, y) -xchar x, y; +On_stairs_up(xchar x, xchar y) { stairway *stway = stairway_at(x,y); @@ -1670,8 +1608,7 @@ xchar x, y; } boolean -On_stairs_dn(x, y) -xchar x, y; +On_stairs_dn(xchar x, xchar y) { stairway *stway = stairway_at(x,y); @@ -1679,15 +1616,13 @@ xchar x, y; } boolean -Is_botlevel(lev) -d_level *lev; +Is_botlevel(d_level *lev) { return (boolean) (lev->dlevel == g.dungeons[lev->dnum].num_dunlevs); } boolean -Can_dig_down(lev) -d_level *lev; +Can_dig_down(d_level *lev) { return (boolean) (!g.level.flags.hardfloor && !Is_botlevel(lev) @@ -1700,8 +1635,7 @@ d_level *lev; * both digging and falling. */ boolean -Can_fall_thru(lev) -d_level *lev; +Can_fall_thru(d_level *lev) { return (boolean) (Can_dig_down(lev) || Is_stronghold(lev)); } @@ -1713,9 +1647,7 @@ d_level *lev; * Checks for amulets and such must be done elsewhere. */ boolean -Can_rise_up(x, y, lev) -int x, y; -d_level *lev; +Can_rise_up(int x, int y, d_level *lev) { stairway *stway = stairway_find_special_dir(FALSE); @@ -1731,8 +1663,7 @@ d_level *lev; } boolean -has_ceiling(lev) -d_level *lev; +has_ceiling(d_level *lev) { /* [what about level 1 of the quest?] */ return (boolean) (!Is_airlevel(lev) && !Is_waterlevel(lev)); @@ -1750,9 +1681,7 @@ d_level *lev; * in dungeons that build up is confined within them. */ void -get_level(newlevel, levnum) -d_level *newlevel; -int levnum; +get_level(d_level *newlevel, int levnum) { branch *br; xchar dgn = u.uz.dnum; @@ -1799,16 +1728,14 @@ int levnum; /* are you in the quest dungeon? */ boolean -In_quest(lev) -d_level *lev; +In_quest(d_level *lev) { return (boolean) (lev->dnum == quest_dnum); } /* are you in the mines dungeon? */ boolean -In_mines(lev) -d_level *lev; +In_mines(d_level *lev) { return (boolean) (lev->dnum == mines_dnum); } @@ -1822,8 +1749,7 @@ d_level *lev; * + Field end2 is the "child" dungeon. */ branch * -dungeon_branch(s) -const char *s; +dungeon_branch(const char *s) { branch *br; xchar dnum; @@ -1850,8 +1776,7 @@ const char *s; * Assumes that end1 is always the "parent". */ boolean -at_dgn_entrance(s) -const char *s; +at_dgn_entrance(const char *s) { branch *br; @@ -1861,16 +1786,14 @@ const char *s; /* is `lev' part of Vlad's tower? */ boolean -In_V_tower(lev) -d_level *lev; +In_V_tower(d_level *lev) { return (boolean) (lev->dnum == tower_dnum); } /* is `lev' a level containing the Wizard's tower? */ boolean -On_W_tower_level(lev) -d_level *lev; +On_W_tower_level(d_level *lev) { return (boolean) (Is_wiz1_level(lev) || Is_wiz2_level(lev) @@ -1879,9 +1802,7 @@ d_level *lev; /* is of `lev' inside the Wizard's tower? */ boolean -In_W_tower(x, y, lev) -int x, y; -d_level *lev; +In_W_tower(int x, int y, d_level *lev) { if (!On_W_tower_level(lev)) return FALSE; @@ -1900,16 +1821,14 @@ d_level *lev; /* are you in one of the Hell levels? */ boolean -In_hell(lev) -d_level *lev; +In_hell(d_level *lev) { return (boolean) (g.dungeons[lev->dnum].flags.hellish); } /* sets *lev to be the gateway to Gehennom... */ void -find_hell(lev) -d_level *lev; +find_hell(d_level *lev) { lev->dnum = valley_level.dnum; lev->dlevel = 1; @@ -1917,8 +1836,7 @@ d_level *lev; /* go directly to hell... */ void -goto_hell(at_stairs, falling) -boolean at_stairs, falling; +goto_hell(boolean at_stairs, boolean falling) { d_level lev; @@ -1928,8 +1846,7 @@ boolean at_stairs, falling; /* equivalent to dest = source */ void -assign_level(dest, src) -d_level *dest, *src; +assign_level(d_level *dest, d_level *src) { dest->dnum = src->dnum; dest->dlevel = src->dlevel; @@ -1937,9 +1854,7 @@ d_level *dest, *src; /* dest = src + rn1(range) */ void -assign_rnd_level(dest, src, range) -d_level *dest, *src; -int range; +assign_rnd_level(d_level *dest, d_level *src, int range) { dest->dnum = src->dnum; dest->dlevel = src->dlevel + ((range > 0) ? rnd(range) : -rnd(-range)); @@ -1951,8 +1866,7 @@ int range; } int -induced_align(pct) -int pct; +induced_align(int pct) { s_level *lev = Is_special(&u.uz); aligntyp al; @@ -1970,8 +1884,7 @@ int pct; } boolean -Invocation_lev(lev) -d_level *lev; +Invocation_lev(d_level *lev) { return (boolean) (In_hell(lev) && lev->dlevel == g.dungeons[lev->dnum].num_dunlevs - 1); @@ -1981,7 +1894,7 @@ d_level *lev; * dependent on the location in the dungeon (eg. monster creation). */ xchar -level_difficulty() +level_difficulty(void) { int res; @@ -2041,8 +1954,7 @@ level_difficulty() * Recognized levels are as shown by print_dungeon(). */ schar -lev_by_name(nam) -const char *nam; +lev_by_name(const char *nam) { schar lev = 0; s_level *slev = (s_level *)0; @@ -2119,8 +2031,7 @@ const char *nam; } static boolean -unplaced_floater(dptr) -struct dungeon *dptr; +unplaced_floater(struct dungeon *dptr) { branch *br; int idx = (int) (dptr - g.dungeons); @@ -2135,9 +2046,7 @@ struct dungeon *dptr; } static boolean -unreachable_level(lvl_p, unplaced) -d_level *lvl_p; -boolean unplaced; +unreachable_level(d_level *lvl_p, boolean unplaced) { s_level *dummy; @@ -2151,12 +2060,8 @@ boolean unplaced; } static void -tport_menu(win, entry, lchoices, lvl_p, unreachable) -winid win; -char *entry; -struct lchoice *lchoices; -d_level *lvl_p; -boolean unreachable; +tport_menu(winid win, char *entry, struct lchoice *lchoices, + d_level *lvl_p, boolean unreachable) { char tmpbuf[BUFSZ]; anything any; @@ -2186,8 +2091,7 @@ boolean unreachable; /* Convert a branch type to a string usable by print_dungeon(). */ static const char * -br_string(type) -int type; +br_string(int type) { switch (type) { case BR_PORTAL: @@ -2203,21 +2107,15 @@ int type; } static char -chr_u_on_lvl(dlev) -d_level *dlev; +chr_u_on_lvl(d_level *dlev) { return u.uz.dnum == dlev->dnum && u.uz.dlevel == dlev->dlevel ? '*' : ' '; } /* Print all child branches between the lower and upper bounds. */ static void -print_branch(win, dnum, lower_bound, upper_bound, bymenu, lchoices_p) -winid win; -int dnum; -int lower_bound; -int upper_bound; -boolean bymenu; -struct lchoice *lchoices_p; +print_branch(winid win, int dnum, int lower_bound, int upper_bound, + boolean bymenu, struct lchoice *lchoices_p) { branch *br; char buf[BUFSZ]; @@ -2241,10 +2139,7 @@ struct lchoice *lchoices_p; /* Print available dungeon information. */ schar -print_dungeon(bymenu, rlev, rdgn) -boolean bymenu; -schar *rlev; -xchar *rdgn; +print_dungeon(boolean bymenu, schar *rlev, xchar *rdgn) { int i, last_level, nlev; char buf[BUFSZ]; @@ -2401,9 +2296,7 @@ xchar *rdgn; * teleport or via the Eye. */ void -recbranch_mapseen(source, dest) -d_level *source; -d_level *dest; +recbranch_mapseen(d_level *source, d_level *dest) { mapseen *mptr; branch *br; @@ -2435,8 +2328,7 @@ d_level *dest; } char * -get_annotation(lev) -d_level *lev; +get_annotation(d_level *lev) { mapseen *mptr; @@ -2447,7 +2339,7 @@ d_level *lev; /* #annotate command - add a custom name to the current level */ int -donamelevel() +donamelevel(void) { mapseen *mptr; char nbuf[BUFSZ]; /* Buffer for response */ @@ -2496,8 +2388,7 @@ donamelevel() /* find the particular mapseen object in the chain; may return null */ static mapseen * -find_mapseen(lev) -d_level *lev; +find_mapseen(d_level *lev) { mapseen *mptr; @@ -2509,8 +2400,7 @@ d_level *lev; } static mapseen * -find_mapseen_by_str(s) -const char *s; +find_mapseen_by_str(const char *s) { mapseen *mptr; @@ -2523,8 +2413,7 @@ const char *s; void -rm_mapseen(ledger_num) -int ledger_num; +rm_mapseen(int ledger_num) { mapseen *mptr, *mprev = (mapseen *)0; struct cemetery *bp, *bpnext; @@ -2557,9 +2446,7 @@ int ledger_num; } static void -save_mapseen(nhfp, mptr) -NHFILE *nhfp; -mapseen *mptr; +save_mapseen(NHFILE *nhfp, mapseen *mptr) { branch *curr; int brindx; @@ -2589,8 +2476,7 @@ mapseen *mptr; } static mapseen * -load_mapseen(nhfp) -NHFILE *nhfp; +load_mapseen(NHFILE *nhfp) { int branchnum = 0, brindx; mapseen *load; @@ -2630,10 +2516,8 @@ NHFILE *nhfp; /* to support '#stats' wizard-mode command */ void -overview_stats(win, statsfmt, total_count, total_size) -winid win; -const char *statsfmt; -long *total_count, *total_size; +overview_stats(winid win, const char *statsfmt, + long *total_count, long *total_size) { char buf[BUFSZ], hdrbuf[QBUFSZ]; long ocount, osize, bcount, bsize, acount, asize; @@ -2678,8 +2562,7 @@ long *total_count, *total_size; * ignore such levels, end of game disclosure will include them.] */ void -remdun_mapseen(dnum) -int dnum; +remdun_mapseen(int dnum) { mapseen *mptr, **mptraddr; @@ -2703,8 +2586,7 @@ int dnum; } void -init_mapseen(lev) -d_level *lev; +init_mapseen(d_level *lev) { /* Create a level and insert in "sorted" order. This is an insertion * sort first by dungeon (in order of discovery) and then by level number. @@ -2747,8 +2629,7 @@ d_level *lev; /* returns true if this level has something interesting to print out */ static boolean -interest_mapseen(mptr) -mapseen *mptr; +interest_mapseen(mapseen *mptr) { if (on_level(&u.uz, &mptr->lev)) return TRUE; @@ -2786,7 +2667,7 @@ mapseen *mptr; /* recalculate mapseen for the current level */ void -recalc_mapseen() +recalc_mapseen(void) { mapseen *mptr, *oth_mptr; struct monst *mtmp; @@ -3092,8 +2973,8 @@ recalc_mapseen() /*ARGUSED*/ /* valley and sanctum levels get automatic annotation once temple is entered */ void -mapseen_temple(priest) -struct monst *priest UNUSED; /* currently unused; might be useful someday */ +mapseen_temple(struct monst *priest UNUSED) /* currently unused; + might be useful someday */ { mapseen *mptr = find_mapseen(&u.uz); @@ -3105,8 +2986,7 @@ struct monst *priest UNUSED; /* currently unused; might be useful someday */ /* room entry message has just been delivered so learn room even if blind */ void -room_discovered(roomno) -int roomno; +room_discovered(int roomno) { mapseen *mptr = find_mapseen(&u.uz); @@ -3115,7 +2995,7 @@ int roomno; /* #overview command */ int -dooverview() +dooverview(void) { show_overview(0, 0); return 0; @@ -3123,10 +3003,10 @@ dooverview() /* called for #overview or for end of game disclosure */ void -show_overview(why, reason) -int why; /* 0 => #overview command, - 1 or 2 => final disclosure (1: hero lived, 2: hero died) */ -int reason; /* how hero died; used when disclosing end-of-game level */ +show_overview(int why, /* 0 => #overview command, + 1 or 2 => final disclosure + (1: hero lived, 2: hero died) */ + int reason) /* how hero died; used when disclosing end-of-game level */ { winid win; int lastdun = -1; @@ -3148,10 +3028,8 @@ int reason; /* how hero died; used when disclosing end-of-game level */ /* display endgame levels or non-endgame levels, not both */ static void -traverse_mapseenchn(viewendgame, win, why, reason, lastdun_p) -boolean viewendgame; -winid win; -int why, reason, *lastdun_p; +traverse_mapseenchn(boolean viewendgame, winid win, int why, int reason, + int *lastdun_p) { mapseen *mptr; boolean showheader; @@ -3170,9 +3048,7 @@ int why, reason, *lastdun_p; } static const char * -seen_string(x, obj) -xchar x; -const char *obj; +seen_string(xchar x, const char *obj) { /* players are computer scientists: 0, 1, 2, n */ switch (x) { @@ -3192,8 +3068,7 @@ const char *obj; /* better br_string */ static const char * -br_string2(br) -branch *br; +br_string2(branch *br) { /* Special case: quest portal says closed if kicked from quest */ boolean closed_portal = (br->end2.dnum == quest_dnum @@ -3215,9 +3090,7 @@ branch *br; /* get the name of an endgame level; topten.c does something similar */ const char * -endgamelevelname(outbuf, indx) -char *outbuf; -int indx; +endgamelevelname(char *outbuf, int indx) { const char *planename = 0; @@ -3247,8 +3120,7 @@ int indx; } static const char * -shop_string(rtype) -int rtype; +shop_string(int rtype) { const char *str = "shop"; /* catchall */ @@ -3299,9 +3171,7 @@ int rtype; /* if player knows about the mastermind tune, append it to Castle annotation; if drawbridge has been destroyed, flags.castletune will be zero */ static char * -tunesuffix(mptr, outbuf) -mapseen *mptr; -char *outbuf; +tunesuffix(mapseen *mptr, char *outbuf) { *outbuf = '\0'; if (mptr->flags.castletune && u.uevent.uheard_tune) { @@ -3340,12 +3210,12 @@ char *outbuf; } while (0) static void -print_mapseen(win, mptr, final, how, printdun) -winid win; -mapseen *mptr; -int final; /* 0: not final; 1: game over, alive; 2: game over, dead */ -int how; /* cause of death; only used if final==2 and mptr->lev==u.uz */ -boolean printdun; +print_mapseen(winid win, mapseen *mptr, + int final, /* 0: not final; 1: game over, alive; + 2: game over, dead */ + int how, /* cause of death; only used if final==2 + and mptr->lev==u.uz */ + boolean printdun) { char buf[BUFSZ], tmpbuf[BUFSZ]; int i, depthstart, dnum; diff --git a/src/eat.c b/src/eat.c index 77b7b1c6c..7bdb450a8 100644 --- a/src/eat.c +++ b/src/eat.c @@ -5,43 +5,43 @@ #include "hack.h" -static int NDECL(eatmdone); -static int NDECL(eatfood); -static struct obj *FDECL(costly_tin, (int)); -static int NDECL(opentin); -static int NDECL(unfaint); - -static const char *FDECL(food_xname, (struct obj *, BOOLEAN_P)); -static void FDECL(choke, (struct obj *)); -static void NDECL(recalc_wt); -static unsigned FDECL(obj_nutrition, (struct obj *)); -static struct obj *FDECL(touchfood, (struct obj *)); -static void NDECL(do_reset_eat); -static void FDECL(done_eating, (BOOLEAN_P)); -static void FDECL(cprefx, (int)); -static int FDECL(intrinsic_possible, (int, struct permonst *)); -static void FDECL(givit, (int, struct permonst *)); -static void FDECL(cpostfx, (int)); -static void FDECL(consume_tin, (const char *)); -static void FDECL(start_tin, (struct obj *)); -static int FDECL(eatcorpse, (struct obj *)); -static void FDECL(start_eating, (struct obj *, BOOLEAN_P)); -static void FDECL(fprefx, (struct obj *)); -static void FDECL(fpostfx, (struct obj *)); -static int NDECL(bite); -static int FDECL(edibility_prompts, (struct obj *)); -static int FDECL(tinopen_ok, (struct obj *)); -static int FDECL(rottenfood, (struct obj *)); -static void NDECL(eatspecial); -static int FDECL(bounded_increase, (int, int, int)); -static void FDECL(accessory_has_effect, (struct obj *)); -static void FDECL(eataccessory, (struct obj *)); -static const char *FDECL(foodword, (struct obj *)); -static int FDECL(tin_variety, (struct obj *, BOOLEAN_P)); -static boolean FDECL(maybe_cannibal, (int, BOOLEAN_P)); -static int FDECL(eat_ok, (struct obj *)); -static int FDECL(offer_ok, (struct obj *)); -static int FDECL(tin_ok, (struct obj *)); +static int eatmdone(void); +static int eatfood(void); +static struct obj *costly_tin(int); +static int opentin(void); +static int unfaint(void); + +static const char *food_xname(struct obj *, boolean); +static void choke(struct obj *); +static void recalc_wt(void); +static unsigned obj_nutrition(struct obj *); +static struct obj *touchfood(struct obj *); +static void do_reset_eat(void); +static void done_eating(boolean); +static void cprefx(int); +static int intrinsic_possible(int, struct permonst *); +static void givit(int, struct permonst *); +static void cpostfx(int); +static void consume_tin(const char *); +static void start_tin(struct obj *); +static int eatcorpse(struct obj *); +static void start_eating(struct obj *, boolean); +static void fprefx(struct obj *); +static void fpostfx(struct obj *); +static int bite(void); +static int edibility_prompts(struct obj *); +static int tinopen_ok(struct obj *); +static int rottenfood(struct obj *); +static void eatspecial(void); +static int bounded_increase(int, int, int); +static void accessory_has_effect(struct obj *); +static void eataccessory(struct obj *); +static const char *foodword(struct obj *); +static int tin_variety(struct obj *, boolean); +static boolean maybe_cannibal(int, boolean); +static int eat_ok(struct obj *); +static int offer_ok(struct obj *); +static int tin_ok(struct obj *); /* also used to see if you're allowed to eat cats and dogs */ #define CANNIBAL_ALLOWED() (Role_if(PM_CAVE_DWELLER) || Race_if(PM_ORC)) @@ -68,8 +68,7 @@ const char *hu_stat[] = { "Satiated", " ", "Hungry ", "Weak ", * polymorphed character. Not used for monster checks. */ boolean -is_edible(obj) -register struct obj *obj; +is_edible(register struct obj *obj) { /* protect invocation tools but not Rider corpses (handled elsewhere)*/ /* if (obj->oclass != FOOD_CLASS && obj_resists(obj, 0, 0)) */ @@ -100,7 +99,7 @@ register struct obj *obj; /* used for hero init, life saving (if choking), and prayer results of fix starving, fix weak from hunger, or golden glow boon (if u.uhunger < 900) */ void -init_uhunger() +init_uhunger(void) { g.context.botl = (u.uhs != NOT_HUNGRY || ATEMP(A_STR) < 0); u.uhunger = 900; @@ -137,7 +136,7 @@ static const struct { /* called after mimicing is over */ static int -eatmdone(VOID_ARGS) +eatmdone(void) { /* release `eatmbuf' */ if (g.eatmbuf) { @@ -155,7 +154,7 @@ eatmdone(VOID_ARGS) /* called when hallucination is toggled */ void -eatmupdate() +eatmupdate(void) { const char *altmsg = 0; int altapp = 0; /* lint suppression */ @@ -190,9 +189,7 @@ eatmupdate() /* ``[the(] singular(food, xname) [)]'' */ static const char * -food_xname(food, the_pfx) -struct obj *food; -boolean the_pfx; +food_xname(struct obj *food, boolean the_pfx) { const char *result; @@ -220,8 +217,7 @@ boolean the_pfx; * To a full belly all food is bad. (It.) */ static void -choke(food) -struct obj *food; +choke(struct obj *food) { /* only happens if you were satiated */ if (u.uhs != SATIATED) { @@ -268,7 +264,7 @@ struct obj *food; /* modify object wt. depending on time spent consuming it */ static void -recalc_wt() +recalc_wt(void) { struct obj *piece = g.context.victual.piece; if (!piece) { @@ -284,7 +280,7 @@ recalc_wt() /* called when eating interrupted by an event */ void -reset_eat() +reset_eat(void) { /* we only set a flag here - the actual reset process is done after * the round is spent eating. @@ -298,8 +294,7 @@ reset_eat() /* base nutrition of a food-class object */ static unsigned -obj_nutrition(otmp) -struct obj *otmp; +obj_nutrition(struct obj *otmp) { unsigned nut = (otmp->otyp == CORPSE) ? mons[otmp->corpsenm].cnutrit : otmp->globby ? otmp->owt @@ -323,8 +318,7 @@ struct obj *otmp; } static struct obj * -touchfood(otmp) -struct obj *otmp; +touchfood(struct obj *otmp) { if (otmp->quan > 1L) { if (!carried(otmp)) @@ -360,8 +354,7 @@ struct obj *otmp; * in do_reset_eat(). */ void -food_disappears(obj) -struct obj *obj; +food_disappears(struct obj *obj) { if (obj == g.context.victual.piece) { g.context.victual.piece = (struct obj *) 0; @@ -375,8 +368,7 @@ struct obj *obj; so the sequence start eating/opening, get interrupted, name the food, resume eating/opening would restart from scratch */ void -food_substitution(old_obj, new_obj) -struct obj *old_obj, *new_obj; +food_substitution(struct obj *old_obj, struct obj *new_obj) { if (old_obj == g.context.victual.piece) { g.context.victual.piece = new_obj; @@ -389,7 +381,7 @@ struct obj *old_obj, *new_obj; } static void -do_reset_eat() +do_reset_eat(void) { debugpline0("do_reset_eat..."); if (g.context.victual.piece) { @@ -412,7 +404,7 @@ do_reset_eat() /* called each move during eating process */ static int -eatfood(VOID_ARGS) +eatfood(void) { if (!g.context.victual.piece || (!carried(g.context.victual.piece) @@ -435,8 +427,7 @@ eatfood(VOID_ARGS) } static void -done_eating(message) -boolean message; +done_eating(boolean message) { struct obj *piece = g.context.victual.piece; @@ -466,8 +457,7 @@ boolean message; } void -eating_conducts(pd) -struct permonst *pd; +eating_conducts(struct permonst *pd) { u.uconduct.food++; if (!vegan(pd)) @@ -478,10 +468,9 @@ struct permonst *pd; /* handle side-effects of mind flayer's tentacle attack */ int -eat_brains(magr, mdef, visflag, dmg_p) -struct monst *magr, *mdef; -boolean visflag; -int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ +eat_brains(struct monst *magr, struct monst *mdef, + boolean visflag, + int *dmg_p) /* for dishing out extra damage in lieu of Int loss */ { struct permonst *pd = mdef->data; boolean give_nutrit = FALSE; @@ -626,9 +615,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ /* eating a corpse or egg of one's own species is usually naughty */ static boolean -maybe_cannibal(pm, allowmsg) -int pm; -boolean allowmsg; +maybe_cannibal(int pm, boolean allowmsg) { static NEARDATA long ate_brains = 0L; struct permonst *fptr = &mons[pm]; /* food type */ @@ -661,8 +648,7 @@ boolean allowmsg; } static void -cprefx(pm) -register int pm; +cprefx(register int pm) { (void) maybe_cannibal(pm, TRUE); if (flesh_petrifies(&mons[pm])) { @@ -735,7 +721,7 @@ register int pm; } void -fix_petrification() +fix_petrification(void) { char buf[BUFSZ]; @@ -758,9 +744,7 @@ fix_petrification() /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */ static int -intrinsic_possible(type, ptr) -int type; -register struct permonst *ptr; +intrinsic_possible(int type, register struct permonst *ptr) { int res = 0; @@ -822,9 +806,7 @@ register struct permonst *ptr; * and what type of intrinsic it is trying to give you. */ static void -givit(type, ptr) -int type; -register struct permonst *ptr; +givit(int type, register struct permonst *ptr) { register int chance; @@ -935,8 +917,7 @@ register struct permonst *ptr; /* called after completely consuming a corpse */ static void -cpostfx(pm) -int pm; +cpostfx(int pm) { int tmp = 0; int catch_lycanthropy = NON_PM; @@ -1162,7 +1143,7 @@ int pm; } void -violated_vegetarian() +violated_vegetarian(void) { u.uconduct.unvegetarian++; if (Role_if(PM_MONK)) { @@ -1175,8 +1156,7 @@ violated_vegetarian() /* common code to check and possibly charge for 1 g.context.tin.tin, * will split() g.context.tin.tin if necessary */ static struct obj * -costly_tin(alter_type) -int alter_type; /* COST_xxx */ +costly_tin(int alter_type) /* COST_xxx */ { struct obj *tin = g.context.tin.tin; @@ -1192,9 +1172,7 @@ int alter_type; /* COST_xxx */ } int -tin_variety_txt(s, tinvariety) -char *s; -int *tinvariety; +tin_variety_txt(char *s, int *tinvariety) { int k, l; @@ -1217,10 +1195,7 @@ int *tinvariety; * as is the case with caller xname(). */ void -tin_details(obj, mnum, buf) -struct obj *obj; -int mnum; -char *buf; +tin_details(struct obj *obj, int mnum, char *buf) { char buf2[BUFSZ]; int r = tin_variety(obj, TRUE); @@ -1251,9 +1226,7 @@ char *buf; } void -set_tin_variety(obj, forcetype) -struct obj *obj; -int forcetype; +set_tin_variety(struct obj *obj, int forcetype) { register int r; @@ -1281,9 +1254,8 @@ int forcetype; } static int -tin_variety(obj, disp) -struct obj *obj; -boolean disp; /* we're just displaying so leave things alone */ +tin_variety(struct obj *obj, + boolean disp) /* we're just displaying so leave things alone */ { register int r; @@ -1306,8 +1278,7 @@ boolean disp; /* we're just displaying so leave things alone */ } static void -consume_tin(mesg) -const char *mesg; +consume_tin(const char *mesg) { const char *what; int which, mnum, r; @@ -1441,7 +1412,7 @@ const char *mesg; /* called during each move whilst opening a tin */ static int -opentin(VOID_ARGS) +opentin(void) { /* perhaps it was stolen (although that should cause interruption) */ if (!carried(g.context.tin.tin) @@ -1461,8 +1432,7 @@ opentin(VOID_ARGS) /* called when starting to open a tin */ static void -start_tin(otmp) -struct obj *otmp; +start_tin(struct obj *otmp) { const char *mesg = 0; register int tmp; @@ -1539,7 +1509,7 @@ struct obj *otmp; /* called when waking up after fainting */ int -Hear_again(VOID_ARGS) +Hear_again(void) { /* Chance of deafness going away while fainted/sleeping/etc. */ if (!rn2(2)) { @@ -1551,8 +1521,7 @@ Hear_again(VOID_ARGS) /* called on the "first bite" of rotten food */ static int -rottenfood(obj) -struct obj *obj; +rottenfood(struct obj *obj) { pline("Blecch! Rotten %s!", foodword(obj)); if (!rn2(4)) { @@ -1593,8 +1562,7 @@ struct obj *obj; /* called when a corpse is selected as food */ static int -eatcorpse(otmp) -struct obj *otmp; +eatcorpse(struct obj *otmp) { int retcode = 0, tp = 0, mnum = otmp->corpsenm; long rotted = 0L; @@ -1733,9 +1701,7 @@ struct obj *otmp; /* called as you start to eat */ static void -start_eating(otmp, already_partly_eaten) -struct obj *otmp; -boolean already_partly_eaten; +start_eating(struct obj *otmp, boolean already_partly_eaten) { const char *old_nomovemsg, *save_nomovemsg; static char msgbuf[BUFSZ]; @@ -1796,8 +1762,7 @@ boolean already_partly_eaten; * finishing at the time they're issued. */ static void -fprefx(otmp) -struct obj *otmp; +fprefx(struct obj *otmp) { switch (otmp->otyp) { case FOOD_RATION: /* nutrition 800 */ @@ -1905,8 +1870,7 @@ struct obj *otmp; /* increment a combat intrinsic with limits on its growth */ static int -bounded_increase(old, inc, typ) -int old, inc, typ; +bounded_increase(int old, int inc, int typ) { int absold, absinc, sgnold, sgninc; @@ -1943,16 +1907,14 @@ int old, inc, typ; } static void -accessory_has_effect(otmp) -struct obj *otmp; +accessory_has_effect(struct obj *otmp) { pline("Magic spreads through your body as you digest the %s.", (otmp->oclass == RING_CLASS) ? "ring" : "amulet"); } static void -eataccessory(otmp) -struct obj *otmp; +eataccessory(struct obj *otmp) { int typ = otmp->otyp; long oldprop; @@ -2100,7 +2062,7 @@ struct obj *otmp; /* called after eating non-food */ static void -eatspecial() +eatspecial(void) { struct obj *otmp = g.context.victual.piece; @@ -2185,8 +2147,7 @@ static const char *foodwords[] = { }; static const char * -foodword(otmp) -struct obj *otmp; +foodword(struct obj *otmp) { if (otmp->oclass == FOOD_CLASS) return "food"; @@ -2198,8 +2159,7 @@ struct obj *otmp; /* called after consuming (non-corpse) food */ static void -fpostfx(otmp) -struct obj *otmp; +fpostfx(struct obj *otmp) { switch (otmp->otyp) { case SPRIG_OF_WOLFSBANE: @@ -2285,11 +2245,10 @@ struct obj *otmp; /* intended for eating a spellbook while polymorphed, but not used; "leather" applied to appearance, not composition, and has been changed to "leathery" to reflect that */ -static boolean FDECL(leather_cover, (struct obj *)); +static boolean leather_cover(struct obj *); static boolean -leather_cover(otmp) -struct obj *otmp; +leather_cover(struct obj *otmp) { const char *odesc = OBJ_DESCR(objects[otmp->otyp]); @@ -2307,8 +2266,7 @@ struct obj *otmp; * return 2 if the food was dangerous and you chose to eat it anyway. */ static int -edibility_prompts(otmp) -struct obj *otmp; +edibility_prompts(struct obj *otmp) { /* Blessed food detection grants hero a one-use * ability to detect food that is unfit for consumption @@ -2460,7 +2418,7 @@ struct obj *otmp; /* 'e' command */ int -doeat() +doeat(void) { struct obj *otmp; int basenutrit; /* nutrition of full item */ @@ -2760,8 +2718,7 @@ doeat() /* getobj callback for object to be opened with a tin opener */ static int -tinopen_ok(obj) -struct obj *obj; +tinopen_ok(struct obj *obj) { if (obj && obj->otyp == TIN) return GETOBJ_SUGGEST; @@ -2771,8 +2728,7 @@ struct obj *obj; int -use_tin_opener(obj) -struct obj *obj; +use_tin_opener(struct obj *obj) { struct obj *otmp; int res = 0; @@ -2807,7 +2763,7 @@ struct obj *obj; * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise. */ static int -bite() +bite(void) { if (g.context.victual.canchoke && u.uhunger >= 2000) { choke(g.context.victual.piece); @@ -2834,7 +2790,7 @@ bite() /* as time goes by - called by moveloop(every move) & domove(melee attack) */ void -gethungry() +gethungry(void) { int accessorytime; @@ -2934,8 +2890,7 @@ gethungry() /* called after vomiting and after performing feats of magic */ void -morehungry(num) -int num; +morehungry(int num) { u.uhunger -= num; newuhs(TRUE); @@ -2943,8 +2898,7 @@ int num; /* called after eating (and after drinking fruit juice) */ void -lesshungry(num) -int num; +lesshungry(int num) { /* See comments in newuhs() for discussion on force_save_hs */ boolean iseating = (g.occupation == eatfood) || g.force_save_hs; @@ -2990,7 +2944,7 @@ int num; } static int -unfaint(VOID_ARGS) +unfaint(void) { (void) Hear_again(); if (u.uhs > FAINTING) @@ -3001,14 +2955,14 @@ unfaint(VOID_ARGS) } boolean -is_fainted() +is_fainted(void) { return (boolean) (u.uhs == FAINTED); } /* call when a faint must be prematurely terminated */ void -reset_faint() +reset_faint(void) { if (g.afternmv == unfaint) unmul("You revive."); @@ -3016,8 +2970,7 @@ reset_faint() /* compute and comment on your (new?) hunger status */ void -newuhs(incr) -boolean incr; +newuhs(boolean incr) { unsigned newhs; static unsigned save_hs; @@ -3172,8 +3125,7 @@ boolean incr; /* getobj callback for object to eat - effectively just wraps is_edible() */ static int -eat_ok(obj) -struct obj *obj; +eat_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -3192,8 +3144,7 @@ struct obj *obj; /* getobj callback for object to be offered (corpses and things that look like * the Amulet only */ static int -offer_ok(obj) -struct obj *obj; +offer_ok(struct obj *obj) { if (!obj || (obj->oclass != FOOD_CLASS && obj->oclass != AMULET_CLASS)) return GETOBJ_EXCLUDE; @@ -3212,8 +3163,7 @@ struct obj *obj; /* getobj callback for object to be tinned */ static int -tin_ok(obj) -struct obj *obj; +tin_ok(struct obj *obj) { if (!obj || obj->oclass != FOOD_CLASS) return GETOBJ_EXCLUDE; @@ -3228,9 +3178,8 @@ struct obj *obj; * Object may be either on floor or in inventory. */ struct obj * -floorfood(verb, corpsecheck) -const char *verb; -int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */ +floorfood(const char *verb, + int corpsecheck) /* 0, no check, 1, corpses, 2, tinnable corpses */ { register struct obj *otmp; char qbuf[QBUFSZ]; @@ -3362,7 +3311,7 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */ /* Side effects of vomiting */ /* added nomul (MRS) - it makes sense, you're too busy being sick! */ void -vomit() /* A good idea from David Neves */ +vomit(void) /* A good idea from David Neves */ { if (cantvomit(g.youmonst.data)) { /* doesn't cure food poisoning; message assumes that we aren't @@ -3389,9 +3338,7 @@ vomit() /* A good idea from David Neves */ } int -eaten_stat(base, obj) -int base; -struct obj *obj; +eaten_stat(int base, struct obj *obj) { long uneaten_amt, full_amount; @@ -3411,9 +3358,7 @@ struct obj *obj; /* reduce obj's oeaten field, making sure it never hits or passes 0 */ void -consume_oeaten(obj, amt) -struct obj *obj; -int amt; +consume_oeaten(struct obj *obj, int amt) { /* * This is a hack to try to squelch several long standing mystery @@ -3463,8 +3408,7 @@ int amt; /* called when eatfood occupation has been interrupted, or in the case of theft, is about to be interrupted */ boolean -maybe_finished_meal(stopping) -boolean stopping; +maybe_finished_meal(boolean stopping) { /* in case consume_oeaten() has decided that the food is all gone */ if (g.occupation == eatfood @@ -3484,8 +3428,7 @@ boolean stopping; effects there take place on first bite rather than at end of occupation. [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */ boolean -Popeye(threat) -int threat; +Popeye(int threat) { struct obj *otin; int mndx; diff --git a/src/end.c b/src/end.c index f362a07c6..28cb12a76 100644 --- a/src/end.c +++ b/src/end.c @@ -20,26 +20,26 @@ #define nowrap_add(a, b) (a = ((a + b) < 0 ? LONG_MAX : (a + b))) #ifndef NO_SIGNAL -static void FDECL(done_intr, (int)); +static void done_intr(int); #if defined(UNIX) || defined(VMS) || defined(__EMX__) -static void FDECL(done_hangup, (int)); +static void done_hangup(int); #endif #endif -static void FDECL(disclose, (int, BOOLEAN_P)); -static void FDECL(get_valuables, (struct obj *)); -static void FDECL(sort_valuables, (struct valuable_data *, int)); -static void NDECL(done_object_cleanup); -static void FDECL(artifact_score, (struct obj *, BOOLEAN_P, winid)); -static void FDECL(really_done, (int)) NORETURN; -static void FDECL(savelife, (int)); -static boolean FDECL(should_query_disclose_option, (int, char *)); +static void disclose(int, boolean); +static void get_valuables(struct obj *); +static void sort_valuables(struct valuable_data *, int); +static void done_object_cleanup(void); +static void artifact_score(struct obj *, boolean, winid); +static void really_done(int) NORETURN; +static void savelife(int); +static boolean should_query_disclose_option(int, char *); #ifdef DUMPLOG -static void NDECL(dump_plines); +static void dump_plines(void); #endif -static void FDECL(dump_everything, (int, time_t)); +static void dump_everything(int, time_t); #if defined(__BEOS__) || defined(MICRO) || defined(OS2) || defined(WIN32) -extern void FDECL(nethack_exit, (int)) NORETURN; +extern void nethack_exit(int) NORETURN; #else #define nethack_exit exit #endif @@ -94,19 +94,18 @@ extern void FDECL(nethack_exit, (int)) NORETURN; #endif #endif -static void NDECL(NH_abort); +static void NH_abort(void); #ifndef NO_SIGNAL -static void FDECL(panictrace_handler, (int)); +static void panictrace_handler(int); #endif -static boolean NDECL(NH_panictrace_libc); -static boolean NDECL(NH_panictrace_gdb); +static boolean NH_panictrace_libc(void); +static boolean NH_panictrace_gdb(void); #ifndef NO_SIGNAL /* called as signal() handler, so sent at least one arg */ /*ARGUSED*/ void -panictrace_handler(sig_unused) -int sig_unused UNUSED; +panictrace_handler(int sig_unused UNUSED) { #define SIG_MSG "\nSignal received.\n" int f2; @@ -117,8 +116,7 @@ int sig_unused UNUSED; } void -panictrace_setsignals(set) -boolean set; +panictrace_setsignals(boolean set) { #define SETSIGNAL(sig) \ (void) signal(sig, set ? (SIG_RET_TYPE) panictrace_handler : SIG_DFL); @@ -154,7 +152,7 @@ boolean set; #endif /* NO_SIGNAL */ static void -NH_abort() +NH_abort(void) { int gdb_prio = SYSOPT_PANICTRACE_GDB; int libc_prio = SYSOPT_PANICTRACE_LIBC; @@ -190,7 +188,7 @@ NH_abort() } static boolean -NH_panictrace_libc() +NH_panictrace_libc(void) { #ifdef PANICTRACE_LIBC void *bt[20]; @@ -229,7 +227,7 @@ NH_panictrace_libc() #endif /* PANICTRACE_GDB */ static boolean -NH_panictrace_gdb() +NH_panictrace_gdb(void) { #ifdef PANICTRACE_GDB /* A (more) generic method to get a stack trace - invoke @@ -287,10 +285,10 @@ static NEARDATA const char *ends[] = { static boolean Schroedingers_cat = FALSE; +/* called as signal() handler, so sent at least one arg */ /*ARGSUSED*/ void -done1(sig_unused) /* called as signal() handler, so sent at least one arg */ -int sig_unused UNUSED; +done1(int sig_unused UNUSED) { #ifndef NO_SIGNAL (void) signal(SIGINT, SIG_IGN); @@ -311,7 +309,7 @@ int sig_unused UNUSED; /* "#quit" command or keyboard interrupt */ int -done2() +done2(void) { if (iflags.debug_fuzzer) return 0; @@ -361,10 +359,10 @@ done2() } #ifndef NO_SIGNAL +/* called as signal() handler, so sent at least 1 arg */ /*ARGSUSED*/ static void -done_intr(sig_unused) /* called as signal() handler, so sent at least 1 arg */ -int sig_unused UNUSED; +done_intr(int sig_unused UNUSED) { done_stopprint++; (void) signal(SIGINT, SIG_IGN); @@ -377,11 +375,10 @@ int sig_unused UNUSED; #if defined(UNIX) || defined(VMS) || defined(__EMX__) /* signal() handler */ static void -done_hangup(sig) -int sig; +done_hangup(int sig) { g.program_state.done_hup++; - sethanguphandler((void FDECL((*), (int) )) SIG_IGN); + sethanguphandler((void (*)(int)) SIG_IGN); done_intr(sig); return; } @@ -389,9 +386,7 @@ int sig; #endif /* NO_SIGNAL */ void -done_in_by(mtmp, how) -struct monst *mtmp; -int how; +done_in_by(struct monst *mtmp, int how) { char buf[BUFSZ]; struct permonst *mptr = mtmp->data, @@ -527,8 +522,7 @@ static const struct { /* clear away while-helpless when the cause of death caused that helplessness (ie, "petrified by while getting stoned") */ static void -fixup_death(how) -int how; +fixup_death(int how) { int i; @@ -632,9 +626,7 @@ VA_DECL(const char *, str) } static boolean -should_query_disclose_option(category, defquery) -int category; -char *defquery; +should_query_disclose_option(int category, char *defquery) { int idx; char disclose, *dop; @@ -676,7 +668,7 @@ char *defquery; #ifdef DUMPLOG static void -dump_plines() +dump_plines(void) { int i, j; char buf[BUFSZ], **strp; @@ -699,9 +691,8 @@ dump_plines() /*ARGSUSED*/ static void -dump_everything(how, when) -int how; -time_t when; /* date+time at end of game */ +dump_everything(int how, + time_t when) /* date+time at end of game */ { #ifdef DUMPLOG char pbuf[BUFSZ], datetimebuf[24]; /* [24]: room for 64-bit bogus value */ @@ -769,9 +760,7 @@ time_t when; /* date+time at end of game */ } static void -disclose(how, taken) -int how; -boolean taken; +disclose(int how, boolean taken) { char c = '\0', defquery; char qbuf[QBUFSZ]; @@ -854,8 +843,7 @@ boolean taken; /* try to get the player back in a viable state after being killed */ static void -savelife(how) -int how; +savelife(int how) { int uhpmin = max(2 * u.ulevel, 10); @@ -902,8 +890,7 @@ int how; * intact. */ static void -get_valuables(list) -struct obj *list; /* inventory or container contents */ +get_valuables(struct obj *list) /* inventory or container contents */ { register struct obj *obj; register int i; @@ -937,9 +924,8 @@ struct obj *list; /* inventory or container contents */ * as easily use qsort, but we don't care about efficiency here. */ static void -sort_valuables(list, size) -struct valuable_data list[]; -int size; /* max value is less than 20 */ +sort_valuables(struct valuable_data list[], + int size) /* max value is less than 20 */ { register int i, j; struct valuable_data ltmp; @@ -965,14 +951,12 @@ int size; /* max value is less than 20 */ * odds_and_ends() was used for 3.6.0 and 3.6.1. * Schroedinger's Cat is handled differently as of 3.6.2. */ -static boolean FDECL(odds_and_ends, (struct obj *, int)); +static boolean odds_and_ends(struct obj *, int); #define CAT_CHECK 2 static boolean -odds_and_ends(list, what) -struct obj *list; -int what; +odds_and_ends(struct obj *list, int what) { struct obj *otmp; @@ -993,7 +977,7 @@ int what; /* deal with some objects which may be in an abnormal state at end of game */ static void -done_object_cleanup() +done_object_cleanup(void) { int ox, oy; @@ -1049,10 +1033,10 @@ done_object_cleanup() /* called twice; first to calculate total, then to list relevant items */ static void -artifact_score(list, counting, endwin) -struct obj *list; -boolean counting; /* true => add up points; false => display them */ -winid endwin; +artifact_score(struct obj *list, + boolean counting, /* true => add up points; + false => display them */ + winid endwin) { char pbuf[BUFSZ]; struct obj *otmp; @@ -1086,8 +1070,7 @@ winid endwin; /* Be careful not to call panic from here! */ void -done(how) -int how; +done(int how) { boolean survive = FALSE; @@ -1195,8 +1178,7 @@ int how; /* separated from done() in order to specify the __noreturn__ attribute */ static void -really_done(how) -int how; +really_done(int how) { boolean taken; char pbuf[BUFSZ]; @@ -1629,9 +1611,8 @@ int how; } void -container_contents(list, identified, all_containers, reportempty) -struct obj *list; -boolean identified, all_containers, reportempty; +container_contents(struct obj *list, boolean identified, + boolean all_containers, boolean reportempty) { register struct obj *box, *obj; char buf[BUFSZ]; @@ -1671,7 +1652,7 @@ boolean identified, all_containers, reportempty; ? SORTLOOT_LOOT : 0) | (flags.sortpack ? SORTLOOT_PACK : 0)); sortedcobj = sortloot(&box->cobj, sortflags, FALSE, - (boolean FDECL((*), (OBJ_P))) 0); + (boolean (*)(OBJ_P)) 0); for (srtc = sortedcobj; ((obj = srtc->obj) != 0); ++srtc) { if (identified) { discover_object(obj->otyp, TRUE, FALSE); @@ -1707,8 +1688,7 @@ boolean identified, all_containers, reportempty; /* should be called with either EXIT_SUCCESS or EXIT_FAILURE */ void -nh_terminate(status) -int status; +nh_terminate(int status) { g.program_state.in_moveloop = 0; /* won't be returning to normal play */ #ifdef MAC @@ -1738,10 +1718,7 @@ int status; /* set a delayed killer, ensure non-delayed killer is cleared out */ void -delayed_killer(id, format, killername) -int id; -int format; -const char *killername; +delayed_killer(int id, int format, const char *killername) { struct kinfo *k = find_delayed_killer(id); @@ -1760,8 +1737,7 @@ const char *killername; } struct kinfo * -find_delayed_killer(id) -int id; +find_delayed_killer(int id) { struct kinfo *k; @@ -1773,8 +1749,7 @@ int id; } void -dealloc_killer(kptr) -struct kinfo *kptr; +dealloc_killer(struct kinfo *kptr) { struct kinfo *prev = &g.killer, *k; @@ -1796,8 +1771,7 @@ struct kinfo *kptr; } void -save_killers(nhfp) -NHFILE *nhfp; +save_killers(NHFILE *nhfp) { struct kinfo *kptr; @@ -1817,8 +1791,7 @@ NHFILE *nhfp; } void -restore_killers(nhfp) -NHFILE *nhfp; +restore_killers(NHFILE *nhfp) { struct kinfo *kptr; @@ -1832,8 +1805,7 @@ NHFILE *nhfp; } static int -wordcount(p) -char *p; +wordcount(char *p) { int words = 0; @@ -1849,8 +1821,7 @@ char *p; } static void -bel_copy1(inp, out) -char **inp, *out; +bel_copy1(char **inp, char *out) { char *in = *inp; @@ -1864,8 +1835,7 @@ char **inp, *out; } char * -build_english_list(in) -char *in; +build_english_list(char *in) { char *out, *p = in; int len = (int) strlen(p), words = wordcount(p); diff --git a/src/engrave.c b/src/engrave.c index fb3a163c6..261ca9fe2 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -5,12 +5,11 @@ #include "hack.h" -static int FDECL(stylus_ok, (struct obj *)); -static const char *NDECL(blengr); +static int stylus_ok(struct obj *); +static const char *blengr(void); char * -random_engraving(outbuf) -char *outbuf; +random_engraving(char *outbuf) { const char *rumor; @@ -78,10 +77,8 @@ static const struct { /* degrade some of the characters in a string */ void -wipeout_text(engr, cnt, seed) -char *engr; -int cnt; -unsigned seed; /* for semi-controlled randomization */ +wipeout_text(char *engr, int cnt, + unsigned seed) /* for semi-controlled randomization */ { char *s; int i, j, nxt, use_rubout, lth = (int) strlen(engr); @@ -142,8 +139,7 @@ unsigned seed; /* for semi-controlled randomization */ /* check whether hero can reach something at ground level */ boolean -can_reach_floor(check_pit) -boolean check_pit; +can_reach_floor(boolean check_pit) { struct trap *t; @@ -168,9 +164,7 @@ boolean check_pit; /* give a message after caller has determined that hero can't reach */ void -cant_reach_floor(x, y, up, check_pit) -int x, y; -boolean up, check_pit; +cant_reach_floor(int x, int y, boolean up, boolean check_pit) { You("can't reach the %s.", up ? ceiling(x, y) @@ -180,8 +174,7 @@ boolean up, check_pit; } const char * -surface(x, y) -register int x, y; +surface(register int x, register int y) { register struct rm *lev = &levl[x][y]; @@ -212,8 +205,7 @@ register int x, y; } const char * -ceiling(x, y) -register int x, y; +ceiling(register int x, register int y) { register struct rm *lev = &levl[x][y]; const char *what; @@ -244,8 +236,7 @@ register int x, y; } struct engr * -engr_at(x, y) -xchar x, y; +engr_at(xchar x, xchar y) { register struct engr *ep = head_engr; @@ -265,10 +256,7 @@ xchar x, y; * present if it is intact and is the entire content of the engraving. */ int -sengr_at(s, x, y, strict) -const char *s; -xchar x, y; -boolean strict; +sengr_at(const char *s, xchar x, xchar y, boolean strict) { register struct engr *ep = engr_at(x, y); @@ -281,17 +269,14 @@ boolean strict; } void -u_wipe_engr(cnt) -int cnt; +u_wipe_engr(int cnt) { if (can_reach_floor(TRUE)) wipe_engr_at(u.ux, u.uy, cnt, FALSE); } void -wipe_engr_at(x, y, cnt, magical) -xchar x, y, cnt; -boolean magical; +wipe_engr_at(xchar x, xchar y, xchar cnt, boolean magical) { register struct engr *ep = engr_at(x, y); @@ -313,8 +298,7 @@ boolean magical; } void -read_engr_at(x, y) -int x, y; +read_engr_at(int x, int y) { register struct engr *ep = engr_at(x, y); int sensed = 0; @@ -388,11 +372,7 @@ int x, y; } void -make_engr_at(x, y, s, e_time, e_type) -int x, y; -const char *s; -long e_time; -xchar e_type; +make_engr_at(int x, int y, const char *s, long e_time, xchar e_type) { struct engr *ep; unsigned smem = strlen(s) + 1; @@ -417,8 +397,7 @@ xchar e_type; /* delete any engraving at location */ void -del_engr_at(x, y) -int x, y; +del_engr_at(int x, int y) { register struct engr *ep = engr_at(x, y); @@ -430,7 +409,7 @@ int x, y; * freehand - returns true if player has a free hand */ int -freehand() +freehand(void) { return (!uwep || !welded(uwep) || (!bimanual(uwep) && (!uarms || !uarms->cursed))); @@ -438,8 +417,7 @@ freehand() /* getobj callback for an object to engrave with */ static int -stylus_ok(obj) -struct obj *obj; +stylus_ok(struct obj *obj) { if (!obj) return GETOBJ_SUGGEST; @@ -488,7 +466,7 @@ struct obj *obj; /* return 1 if action took 1 (or more) moves, 0 if error or aborted */ int -doengrave() +doengrave(void) { boolean dengr = FALSE; /* TRUE if we wipe out the current engraving */ boolean doblind = FALSE; /* TRUE if engraving blinds the player */ @@ -1189,7 +1167,7 @@ doengrave() /* while loading bones, clean up text which might accidentally or maliciously disrupt player's terminal when displayed */ void -sanitize_engravings() +sanitize_engravings(void) { struct engr *ep; @@ -1199,8 +1177,7 @@ sanitize_engravings() } void -save_engravings(nhfp) -NHFILE *nhfp; +save_engravings(NHFILE *nhfp) { struct engr *ep, *ep2; unsigned no_more_engr = 0; @@ -1225,8 +1202,7 @@ NHFILE *nhfp; } void -rest_engravings(nhfp) -NHFILE *nhfp; +rest_engravings(NHFILE *nhfp) { struct engr *ep; unsigned lth = 0; @@ -1254,10 +1230,7 @@ NHFILE *nhfp; /* to support '#stats' wizard-mode command */ void -engr_stats(hdrfmt, hdrbuf, count, size) -const char *hdrfmt; -char *hdrbuf; -long *count, *size; +engr_stats(const char *hdrfmt, char *hdrbuf, long *count, long *size) { struct engr *ep; @@ -1270,8 +1243,7 @@ long *count, *size; } void -del_engr(ep) -register struct engr *ep; +del_engr(register struct engr *ep) { if (ep == head_engr) { head_engr = ep->nxt_engr; @@ -1293,8 +1265,7 @@ register struct engr *ep; /* randomly relocate an engraving */ void -rloc_engr(ep) -struct engr *ep; +rloc_engr(struct engr *ep) { int tx, ty, tryct = 200; @@ -1313,9 +1284,7 @@ struct engr *ep; * The caller is responsible for newsym(x, y). */ void -make_grave(x, y, str) -int x, y; -const char *str; +make_grave(int x, int y, const char *str) { char buf[BUFSZ]; @@ -1354,7 +1323,7 @@ static const char blind_writing[][21] = { }; static const char * -blengr(VOID_ARGS) +blengr(void) { return blind_writing[rn2(SIZE(blind_writing))]; } diff --git a/src/exper.c b/src/exper.c index ea2dcc6bb..be3e11da7 100644 --- a/src/exper.c +++ b/src/exper.c @@ -8,11 +8,10 @@ #include #endif -static int FDECL(enermod, (int)); +static int enermod(int); long -newuexp(lev) -int lev; +newuexp(int lev) { if (lev < 1) /* for newuexp(u.ulevel - 1) when u.ulevel is 1 */ return 0L; @@ -24,8 +23,7 @@ int lev; } static int -enermod(en) -int en; +enermod(int en) { switch (Role_switch) { case PM_CLERIC: @@ -44,7 +42,7 @@ int en; /* calculate spell power/energy points for new level */ int -newpw() +newpw(void) { int en = 0, enrnd, enfix; @@ -74,9 +72,7 @@ newpw() /* return # of exp points for mtmp after nk killed */ int -experience(mtmp, nk) -register struct monst *mtmp; -register int nk; +experience(register struct monst *mtmp, register int nk) { register struct permonst *ptr = mtmp->data; int i, tmp, tmp2; @@ -160,8 +156,7 @@ register int nk; } void -more_experienced(exper, rexp) -register int exper, rexp; +more_experienced(register int exper, register int rexp) { long oldexp = u.uexp, oldrexp = u.urexp, @@ -199,8 +194,7 @@ register int exper, rexp; /* e.g., hit by drain life attack */ void -losexp(drainer) -const char *drainer; /* cause of death, if drain should be fatal */ +losexp(const char *drainer) /* cause of death, if drain should be fatal */ { register int num; @@ -266,16 +260,15 @@ const char *drainer; /* cause of death, if drain should be fatal */ * at a dragon created with a wand of polymorph?? */ void -newexplevel() +newexplevel(void) { if (u.ulevel < MAXULEV && u.uexp >= newuexp(u.ulevel)) pluslvl(TRUE); } void -pluslvl(incr) -boolean incr; /* true iff via incremental experience growth */ -{ /* (false for potion of gain level) */ +pluslvl(boolean incr) /* true iff via incremental experience growth */ +{ /* (false for potion of gain level) */ int hpinc, eninc; if (!incr) @@ -328,8 +321,7 @@ boolean incr; /* true iff via incremental experience growth */ experience level: base number of points needed to reach the current level plus a random portion of what it takes to get to the next level */ long -rndexp(gaining) -boolean gaining; /* gaining XP via potion vs setting XP for polyself */ +rndexp(boolean gaining) /* gaining XP via potion vs setting XP for polyself */ { long minexp, maxexp, diff, factor, result; diff --git a/src/explode.c b/src/explode.c index 30dc6b92c..27c7fad31 100644 --- a/src/explode.c +++ b/src/explode.c @@ -25,12 +25,9 @@ static const int explosion[3][3] = { { S_explode1, S_explode4, S_explode7 }, * that Half_physical_damage only affects the damage applied to the hero. */ void -explode(x, y, type, dam, olet, expltype) -int x, y; -int type; /* the same as in zap.c; passes -(wand typ) for some WAND_CLASS */ -int dam; -char olet; -int expltype; +explode(int x, int y, + int type, /* the same as in zap.c; passes -(wand typ) for some WAND_CLASS */ + int dam, char olet, int expltype) { int i, j, k, damu = dam; boolean starting = 1; @@ -603,11 +600,10 @@ struct scatter_chain { /* returns number of scattered objects */ long -scatter(sx, sy, blastforce, scflags, obj) -int sx, sy; /* location of objects to scatter */ -int blastforce; /* force behind the scattering */ -unsigned int scflags; -struct obj *obj; /* only scatter this obj */ +scatter(int sx, int sy, /* location of objects to scatter */ + int blastforce, /* force behind the scattering */ + unsigned int scflags, + struct obj *obj) /* only scatter this obj */ { register struct obj *otmp; register int tmp; @@ -797,9 +793,7 @@ struct obj *obj; /* only scatter this obj */ * For now, just perform a "regular" explosion. */ void -splatter_burning_oil(x, y, diluted_oil) -int x, y; -boolean diluted_oil; +splatter_burning_oil(int x, int y, boolean diluted_oil) { int dmg = d(diluted_oil ? 3 : 4, 4); @@ -811,9 +805,7 @@ boolean diluted_oil; /* lit potion of oil is exploding; extinguish it as a light source before possibly killing the hero and attempting to save bones */ void -explode_oil(obj, x, y) -struct obj *obj; -int x, y; +explode_oil(struct obj *obj, int x, int y) { boolean diluted_oil = obj->odiluted; diff --git a/src/extralev.c b/src/extralev.c index 4e03acac0..ec9299ada 100644 --- a/src/extralev.c +++ b/src/extralev.c @@ -13,15 +13,13 @@ #define LEFT 4 #define RIGHT 8 -static void FDECL(roguejoin, (int, int, int, int, int)); -static void FDECL(roguecorr, (int, int, int)); -static void FDECL(miniwalk, (int, int)); +static void roguejoin(int, int, int, int, int); +static void roguecorr(int, int, int); +static void miniwalk(int, int); static void -roguejoin(x1, y1, x2, y2, horiz) -int x1, y1, x2, y2; -int horiz; +roguejoin(int x1, int y1, int x2, int y2, int horiz) { register int x, y, middle; if (horiz) { @@ -45,8 +43,7 @@ int horiz; static void -roguecorr(x, y, dir) -int x, y, dir; +roguecorr(int x, int y, int dir) { register int fromx, fromy, tox, toy; @@ -141,8 +138,7 @@ int x, y, dir; /* Modified walkfrom() from mkmaze.c */ static void -miniwalk(x, y) -int x, y; +miniwalk(int x, int y) { register int q, dir; int dirs[4]; @@ -195,7 +191,7 @@ int x, y; } void -makeroguerooms() +makeroguerooms(void) { register int x, y; /* Rogue levels are structured 3 by 3, with each section containing @@ -279,8 +275,7 @@ makeroguerooms() } void -corr(x, y) -int x, y; +corr(int x, int y) { if (rn2(50)) { levl[x][y].typ = CORR; @@ -290,7 +285,7 @@ int x, y; } void -makerogueghost() +makerogueghost(void) { register struct monst *ghost; struct obj *ghostobj; diff --git a/src/files.c b/src/files.c index 78c9f894f..86b99caee 100644 --- a/src/files.c +++ b/src/files.c @@ -81,8 +81,8 @@ static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME]; #include #endif -static FILE *NDECL(fopen_wizkit_file); -static void FDECL(wizkit_addinv, (struct obj *)); +static FILE *fopen_wizkit_file(void); +static void wizkit_addinv(struct obj *); #ifdef AMIGA extern char PATH[]; /* see sys/amiga/amidos.c */ @@ -92,7 +92,7 @@ extern char bbs_id[]; #endif #include -extern void FDECL(amii_set_text_font, (char *, int)); +extern void amii_set_text_font(char *, int); #endif #if defined(WIN32) || defined(MSDOS) @@ -105,7 +105,7 @@ extern void FDECL(amii_set_text_font, (char *, int)); #endif #ifdef WIN32 /*from windmain.c */ -extern char *FDECL(translate_path_variables, (const char *, char *)); +extern char *translate_path_variables(const char *, char *); #endif #endif @@ -123,51 +123,49 @@ extern char *FDECL(translate_path_variables, (const char *, char *)); extern char *sounddir; /* defined in sounds.c */ #endif -static NHFILE *NDECL(new_nhfile); -static void FDECL(free_nhfile, (NHFILE *)); +static NHFILE *new_nhfile(void); +static void free_nhfile(NHFILE *); #ifdef SELECTSAVED -static int FDECL(CFDECLSPEC strcmp_wrap, (const void *, const void *)); +static int CFDECLSPEC strcmp_wrap(const void *, const void *); #endif -static char *FDECL(set_bonesfile_name, (char *, d_level *)); -static char *NDECL(set_bonestemp_name); +static char *set_bonesfile_name(char *, d_level *); +static char *set_bonestemp_name(void); #ifdef COMPRESS -static void FDECL(redirect, (const char *, const char *, FILE *, - BOOLEAN_P)); +static void redirect(const char *, const char *, FILE *, boolean); #endif #if defined(COMPRESS) || defined(ZLIB_COMP) -static void FDECL(docompress_file, (const char *, BOOLEAN_P)); +static void docompress_file(const char *, boolean); #endif #if defined(ZLIB_COMP) -static boolean FDECL(make_compressed_name, (const char *, char *)); +static boolean make_compressed_name(const char *, char *); #endif #ifndef USE_FCNTL -static char *FDECL(make_lockname, (const char *, char *)); -#endif -static void FDECL(set_configfile_name, (const char *)); -static FILE *FDECL(fopen_config_file, (const char *, int)); -static int FDECL(get_uchars, (char *, uchar *, BOOLEAN_P, - int, const char *)); -boolean FDECL(proc_wizkit_line, (char *)); -boolean FDECL(parse_config_line, (char *)); -static boolean FDECL(parse_conf_file, (FILE *, boolean (*proc)(char *))); -static FILE *NDECL(fopen_sym_file); -boolean FDECL(proc_symset_line, (char *)); -static void FDECL(set_symhandling, (char *, int)); +static char *make_lockname(const char *, char *); +#endif +static void set_configfile_name(const char *); +static FILE *fopen_config_file(const char *, int); +static int get_uchars(char *, uchar *, boolean, int, const char *); +boolean proc_wizkit_line(char *); +boolean parse_config_line(char *); +static boolean parse_conf_file(FILE *, boolean (*proc)(char *)); +static FILE *fopen_sym_file(void); +boolean proc_symset_line(char *); +static void set_symhandling(char *, int); #ifdef NOCWD_ASSUMPTIONS -static void FDECL(adjust_prefix, (char *, int)); +static void adjust_prefix(char *, int); #endif -static boolean FDECL(config_error_nextline, (const char *)); -static void NDECL(free_config_sections); -static char *FDECL(choose_random_part, (char *, CHAR_P)); -static char *FDECL(is_config_section, (char *)); -static boolean FDECL(handle_config_section, (char *)); -static char *FDECL(find_optparam, (const char *)); -static void FDECL(parseformat, (int *, char *)); +static boolean config_error_nextline(const char *); +static void free_config_sections(void); +static char *choose_random_part(char *, char); +static char *is_config_section(char *); +static boolean handle_config_section(char *); +static char *find_optparam(const char *); +static void parseformat(int *, char *); #ifdef SELF_RECOVER -static boolean FDECL(copy_bytes, (int, int)); +static boolean copy_bytes(int, int); #endif -static NHFILE *FDECL(viable_nhfile, (NHFILE *)); +static NHFILE *viable_nhfile(NHFILE *); /* * fname_encode() @@ -193,11 +191,7 @@ static NHFILE *FDECL(viable_nhfile, (NHFILE *)); * "This%20is%20a%20%25%20test%21" */ char * -fname_encode(legal, quotechar, s, callerbuf, bufsz) -const char *legal; -char quotechar; -char *s, *callerbuf; -int bufsz; +fname_encode(const char *legal, char quotechar, char *s, char *callerbuf, int bufsz) { char *sp, *op; int cnt = 0; @@ -241,10 +235,7 @@ int bufsz; * bufsz size of callerbuf */ char * -fname_decode(quotechar, s, callerbuf, bufsz) -char quotechar; -char *s, *callerbuf; -int bufsz; +fname_decode(char quotechar, char *s, char *callerbuf, int bufsz) { char *sp, *op; int k, calc, cnt = 0; @@ -294,10 +285,9 @@ int bufsz; /*ARGSUSED*/ const char * -fqname(basenam, whichprefix, buffnum) -const char *basenam; -int whichprefix UNUSED_if_not_PREFIXES_IN_USE; -int buffnum UNUSED_if_not_PREFIXES_IN_USE; +fqname(const char *basenam, + int whichprefix UNUSED_if_not_PREFIXES_IN_USE, + int buffnum UNUSED_if_not_PREFIXES_IN_USE) { #ifdef PREFIXES_IN_USE char *bufptr; @@ -332,9 +322,9 @@ int buffnum UNUSED_if_not_PREFIXES_IN_USE; #endif /* !PREFIXES_IN_USE */ } +/* reasonbuf must be at least BUFSZ, supplied by caller */ int -validate_prefix_locations(reasonbuf) -char *reasonbuf; /* reasonbuf must be at least BUFSZ, supplied by caller */ +validate_prefix_locations(char *reasonbuf) { #if defined(NOCWD_ASSUMPTIONS) FILE *fp; @@ -384,9 +374,7 @@ char *reasonbuf; /* reasonbuf must be at least BUFSZ, supplied by caller */ /* fopen a file, with OS-dependent bells and whistles */ /* NOTE: a simpler version of this routine also exists in util/dlb_main.c */ FILE * -fopen_datafile(filename, mode, prefix) -const char *filename, *mode; -int prefix; +fopen_datafile(const char *filename, const char *mode, int prefix) { FILE *fp; @@ -402,8 +390,7 @@ const int bei = 1; #define IS_BIGENDIAN() ( (*(char*)&bei) == 0 ) void -zero_nhfile(nhfp) -NHFILE *nhfp; +zero_nhfile(NHFILE *nhfp) { if (nhfp) { nhfp->fd = -1; @@ -422,7 +409,7 @@ NHFILE *nhfp; } static NHFILE * -new_nhfile() +new_nhfile(void) { NHFILE *nhfp = (NHFILE *)alloc(sizeof(NHFILE)); @@ -431,8 +418,7 @@ new_nhfile() } static void -free_nhfile(nhfp) -NHFILE *nhfp; +free_nhfile(NHFILE *nhfp) { if (nhfp) { zero_nhfile(nhfp); @@ -441,8 +427,7 @@ NHFILE *nhfp; } void -close_nhfile(nhfp) -NHFILE *nhfp; +close_nhfile(NHFILE *nhfp) { if (nhfp) { if (nhfp->structlevel && nhfp->fd != -1) @@ -453,8 +438,7 @@ NHFILE *nhfp; } void -rewind_nhfile(nhfp) -NHFILE *nhfp; +rewind_nhfile(NHFILE *nhfp) { if (nhfp->structlevel) { #ifdef BSD @@ -467,8 +451,7 @@ NHFILE *nhfp; static NHFILE * -viable_nhfile(nhfp) -NHFILE *nhfp; +viable_nhfile(NHFILE *nhfp) { /* perform some sanity checks before returning the pointer to the nethack file descriptor */ @@ -495,9 +478,7 @@ NHFILE *nhfp; * but be careful if you use it for other things -dgk */ void -set_levelfile_name(file, lev) -char *file; -int lev; +set_levelfile_name(char *file, int lev) { char *tf; @@ -512,9 +493,7 @@ int lev; } NHFILE * -create_levelfile(lev, errbuf) -int lev; -char errbuf[]; +create_levelfile(int lev, char errbuf[]) { const char *fq_lock; NHFILE *nhfp = (NHFILE *) 0; @@ -559,9 +538,7 @@ char errbuf[]; } NHFILE * -open_levelfile(lev, errbuf) -int lev; -char errbuf[]; +open_levelfile(int lev, char errbuf[]) { const char *fq_lock; NHFILE *nhfp = (NHFILE *) 0; @@ -601,8 +578,7 @@ char errbuf[]; } void -delete_levelfile(lev) -int lev; +delete_levelfile(int lev) { /* * Level 0 might be created by port specific code that doesn't @@ -616,7 +592,7 @@ int lev; } void -clearlocks() +clearlocks(void) { int x; @@ -627,7 +603,7 @@ clearlocks() #ifndef NO_SIGNAL (void) signal(SIGINT, SIG_IGN); #if defined(UNIX) || defined(VMS) - sethanguphandler((void FDECL((*), (int) )) SIG_IGN); + sethanguphandler((void (*)(int)) SIG_IGN); #endif #endif /* NO_SIGNAL */ /* can't access maxledgerno() before dungeons are created -dlc */ @@ -638,9 +614,7 @@ clearlocks() #if defined(SELECTSAVED) /* qsort comparison routine */ static int CFDECLSPEC -strcmp_wrap(p, q) -const void *p; -const void *q; +strcmp_wrap(const void *p, const void *q) { #if defined(UNIX) && defined(QT_GRAPHICS) return strncasecmp(*(char **) p, *(char **) q, 16); @@ -651,8 +625,7 @@ const void *q; #endif int -nhclose(fd) -int fd; +nhclose(int fd) { int retval = 0; @@ -673,9 +646,7 @@ int fd; * bonesid to be read/written in the bones file. */ static char * -set_bonesfile_name(file, lev) -char *file; -d_level *lev; +set_bonesfile_name(char *file, d_level *lev) { s_level *sptr; char *dptr; @@ -724,7 +695,7 @@ d_level *lev; * the same array may be used instead of copying.) */ static char * -set_bonestemp_name() +set_bonestemp_name(void) { char *tf; @@ -739,10 +710,7 @@ set_bonestemp_name() } NHFILE * -create_bonesfile(lev, bonesid, errbuf) -d_level *lev; -char **bonesid; -char errbuf[]; +create_bonesfile(d_level *lev, char **bonesid, char errbuf[]) { const char *file; NHFILE *nhfp = (NHFILE *) 0; @@ -799,8 +767,7 @@ char errbuf[]; /* move completed bones file to proper name */ void -commit_bonesfile(lev) -d_level *lev; +commit_bonesfile(d_level *lev) { const char *fq_bones, *tempname; int ret; @@ -825,9 +792,7 @@ d_level *lev; } NHFILE * -open_bonesfile(lev, bonesid) -d_level *lev; -char **bonesid; +open_bonesfile(d_level *lev, char **bonesid) { const char *fq_bones; NHFILE *nhfp = (NHFILE *) 0; @@ -855,8 +820,7 @@ char **bonesid; } int -delete_bonesfile(lev) -d_level *lev; +delete_bonesfile(d_level *lev) { (void) set_bonesfile_name(g.bones, lev); return !(unlink(fqname(g.bones, BONESPREFIX, 0)) < 0); @@ -865,7 +829,7 @@ d_level *lev; /* assume we're compressing the recently read or created bonesfile, so the * file name is already set properly */ void -compress_bonesfile() +compress_bonesfile(void) { nh_compress(fqname(g.bones, BONESPREFIX, 0)); } @@ -877,8 +841,7 @@ compress_bonesfile() /* set savefile name in OS-dependent manner from pre-existing g.plname, * avoiding troublesome characters */ void -set_savefile_name(regularize_it) -boolean regularize_it; +set_savefile_name(boolean regularize_it) { int regoffset = 0, overflow = 0, indicator_spot = 0; /* 0=no indicator, 1=before ext, 2=after ext */ @@ -985,8 +948,7 @@ boolean regularize_it; #ifdef INSURANCE void -save_savefile_name(nhfp) -NHFILE *nhfp; +save_savefile_name(NHFILE *nhfp) { if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) g.SAVEF, sizeof(g.SAVEF)); @@ -996,7 +958,7 @@ NHFILE *nhfp; #ifndef MICRO /* change pre-existing savefile name to indicate an error savefile */ void -set_error_savefile() +set_error_savefile(void) { #ifdef VMS { @@ -1018,7 +980,7 @@ set_error_savefile() /* create save file, overwriting one if it already exists */ NHFILE * -create_savefile() +create_savefile(void) { const char *fq_save; NHFILE *nhfp = (NHFILE *) 0; @@ -1071,7 +1033,7 @@ create_savefile() /* open savefile for reading */ NHFILE * -open_savefile() +open_savefile(void) { const char *fq_save; NHFILE *nhfp = (NHFILE *) 0; @@ -1109,7 +1071,7 @@ open_savefile() /* delete savefile */ int -delete_savefile() +delete_savefile(void) { (void) unlink(fqname(g.SAVEF, SAVEPREFIX, 0)); return 0; /* for restore_saved_game() (ex-xxxmain.c) test */ @@ -1117,7 +1079,7 @@ delete_savefile() /* try to open up a save file and prepare to restore it */ NHFILE * -restore_saved_game() +restore_saved_game(void) { const char *fq_save; NHFILE *nhfp = (NHFILE *) 0; @@ -1138,8 +1100,7 @@ restore_saved_game() #if defined(SELECTSAVED) char * -plname_from_file(filename) -const char *filename; +plname_from_file(const char *filename) { NHFILE *nhfp = (NHFILE *) 0; char *result = 0; @@ -1201,7 +1162,7 @@ const char *filename; #endif /* defined(SELECTSAVED) */ char ** -get_saved_games() +get_saved_games(void) { #if defined(SELECTSAVED) #if defined(WIN32) || defined(UNIX) @@ -1330,8 +1291,7 @@ get_saved_games() } void -free_saved_games(saved) -char **saved; +free_saved_games(char **saved) { if (saved) { int i = 0; @@ -1349,10 +1309,7 @@ char **saved; #ifdef COMPRESS static void -redirect(filename, mode, stream, uncomp) -const char *filename, *mode; -FILE *stream; -boolean uncomp; +redirect(const char *filename, const char *mode, FILE *stream, boolean uncomp) { if (freopen(filename, mode, stream) == (FILE *) 0) { const char *details; @@ -1376,9 +1333,7 @@ boolean uncomp; * cf. child() in unixunix.c. */ static void -docompress_file(filename, uncomp) -const char *filename; -boolean uncomp; +docompress_file(const char *filename, boolean uncomp) { char cfn[SAVESIZE]; FILE *cf; @@ -1533,8 +1488,7 @@ boolean uncomp; /* compress file */ void -nh_compress(filename) -const char *filename UNUSED_if_not_COMPRESS; +nh_compress(const char *filename UNUSED_if_not_COMPRESS) { #if !defined(COMPRESS) && !defined(ZLIB_COMP) #ifdef PRAGMA_UNUSED @@ -1547,8 +1501,7 @@ const char *filename UNUSED_if_not_COMPRESS; /* uncompress file if it exists */ void -nh_uncompress(filename) -const char *filename UNUSED_if_not_COMPRESS; +nh_uncompress(const char *filename UNUSED_if_not_COMPRESS) { #if !defined(COMPRESS) && !defined(ZLIB_COMP) #ifdef PRAGMA_UNUSED @@ -1561,9 +1514,7 @@ const char *filename UNUSED_if_not_COMPRESS; #ifdef ZLIB_COMP /* RLC 09 Mar 1999: Support internal ZLIB */ static boolean -make_compressed_name(filename, cfn) -const char *filename; -char *cfn; +make_compressed_name(const char *filename, char *cfn) { #ifndef SHORT_FILENAMES /* Assume free-form filename with no 8.3 restrictions */ @@ -1594,9 +1545,7 @@ char *cfn; } static void -docompress_file(filename, uncomp) -const char *filename; -boolean uncomp; +docompress_file(const char *filename, boolean uncomp) { gzFile compressedfile; FILE *uncompressedfile; @@ -1734,9 +1683,7 @@ struct flock sflock; /* for unlocking, same as above */ #ifndef USE_FCNTL static char * -make_lockname(filename, lockname) -const char *filename; -char *lockname; +make_lockname(const char *filename, char *lockname) { #if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(WIN32) \ || defined(MSDOS) @@ -1770,10 +1717,7 @@ char *lockname; /* lock a file */ boolean -lock_file(filename, whichprefix, retryct) -const char *filename; -int whichprefix; -int retryct; +lock_file(const char *filename, int whichprefix, int retryct) { #if defined(PRAGMA_UNUSED) && !(defined(UNIX) || defined(VMS)) \ && !(defined(AMIGA) || defined(WIN32) || defined(MSDOS)) @@ -1936,8 +1880,7 @@ int retryct; /* unlock file, which must be currently locked by lock_file */ void -unlock_file(filename) -const char *filename; +unlock_file(const char *filename) { #ifndef USE_FCNTL char locknambuf[BUFSZ]; @@ -2015,17 +1958,14 @@ const char *backward_compat_configfile = "nethack.cnf"; /* remember the name of the file we're accessing; if may be used in option reject messages */ static void -set_configfile_name(fname) -const char *fname; +set_configfile_name(const char *fname) { (void) strncpy(configfile, fname, sizeof configfile - 1); configfile[sizeof configfile - 1] = '\0'; } static FILE * -fopen_config_file(filename, src) -const char *filename; -int src; +fopen_config_file(const char *filename, int src) { FILE *fp; #if defined(UNIX) || defined(VMS) @@ -2166,12 +2106,11 @@ int src; * location is unchanged. Callers must handle zeros if modlist is FALSE. */ static int -get_uchars(bufp, list, modlist, size, name) -char *bufp; /* current pointer */ -uchar *list; /* return list */ -boolean modlist; /* TRUE: list is being modified in place */ -int size; /* return list size */ -const char *name; /* name of option for error message */ +get_uchars(char *bufp, /* current pointer */ + uchar *list, /* return list */ + boolean modlist, /* TRUE: list is being modified in place */ + int size, /* return list size */ + const char *name) /* name of option for error message */ { unsigned int num = 0; int count = 0; @@ -2227,9 +2166,7 @@ const char *name; /* name of option for error message */ #ifdef NOCWD_ASSUMPTIONS static void -adjust_prefix(bufp, prefixid) -char *bufp; -int prefixid; +adjust_prefix(char *bufp, int prefixid) { char *ptr; @@ -2252,9 +2189,7 @@ int prefixid; /* Choose at random one of the sep separated parts from str. Mangles str. */ static char * -choose_random_part(str, sep) -char *str; -char sep; +choose_random_part(char *str, char sep) { int nsep = 1; int csep; @@ -2292,7 +2227,7 @@ char sep; } static void -free_config_sections() +free_config_sections(void) { if (g.config_section_chosen) { free(g.config_section_chosen); @@ -2308,8 +2243,8 @@ free_config_sections() with spaces optional; returns pointer to "anything-except..." (with trailing " ] #..." stripped) if ok, otherwise Null */ static char * -is_config_section(str) -char *str; /* trailing spaces will be stripped, ']' too iff result is good */ +is_config_section(char *str) /* trailing spaces will be stripped, + ']' too iff result is good */ { char *a, *c, *z; @@ -2336,8 +2271,7 @@ char *str; /* trailing spaces will be stripped, ']' too iff result is good */ } static boolean -handle_config_section(buf) -char *buf; +handle_config_section(char *buf) { char *sect = is_config_section(buf); @@ -2372,8 +2306,7 @@ char *buf; /* find the '=' or ':' */ static char * -find_optparam(buf) -const char *buf; +find_optparam(const char *buf) { char *bufp, *altp; @@ -2386,8 +2319,7 @@ const char *buf; } boolean -parse_config_line(origbuf) -char *origbuf; +parse_config_line(char *origbuf) { #if defined(MICRO) && !defined(NOCWD_ASSUMPTIONS) static boolean ramdisk_specified = FALSE; @@ -2854,8 +2786,7 @@ char *origbuf; #ifdef USER_SOUNDS boolean -can_read_file(filename) -const char *filename; +can_read_file(const char *filename) { return (boolean) (access(filename, 4) == 0); } @@ -2875,10 +2806,7 @@ struct _config_error_frame { static struct _config_error_frame *config_error_data = 0; void -config_error_init(from_file, sourcename, secure) -boolean from_file; -const char *sourcename; -boolean secure; +config_error_init(boolean from_file, const char *sourcename, boolean secure) { struct _config_error_frame *tmp = (struct _config_error_frame *) alloc(sizeof (struct _config_error_frame)); @@ -2901,8 +2829,7 @@ boolean secure; } static boolean -config_error_nextline(line) -const char *line; +config_error_nextline(const char *line) { struct _config_error_frame *ced = config_error_data; @@ -2925,8 +2852,7 @@ const char *line; /* varargs 'config_error_add()' moved to pline.c */ void -config_erradd(buf) -const char *buf; +config_erradd(const char *buf) { char lineno[QBUFSZ]; @@ -2956,7 +2882,7 @@ const char *buf; } int -config_error_done() +config_error_done(void) { int n; struct _config_error_frame *tmp = config_error_data; @@ -2978,9 +2904,7 @@ config_error_done() } boolean -read_config_file(filename, src) -const char *filename; -int src; +read_config_file(const char *filename, int src) { FILE *fp; boolean rv = TRUE; @@ -3003,7 +2927,7 @@ int src; } static FILE * -fopen_wizkit_file() +fopen_wizkit_file(void) { FILE *fp; #if defined(VMS) || defined(UNIX) @@ -3075,8 +2999,7 @@ fopen_wizkit_file() /* add to hero's inventory if there's room, otherwise put item on floor */ static void -wizkit_addinv(obj) -struct obj *obj; +wizkit_addinv(struct obj *obj) { if (!obj || obj == &cg.zeroobj) return; @@ -3102,8 +3025,7 @@ struct obj *obj; boolean -proc_wizkit_line(buf) -char *buf; +proc_wizkit_line(char *buf) { struct obj *otmp; @@ -3123,7 +3045,7 @@ char *buf; } void -read_wizkit() +read_wizkit(void) { FILE *fp; @@ -3150,9 +3072,7 @@ read_wizkit() * Continued lines are merged together with one space in between. */ static boolean -parse_conf_file(fp, proc) -FILE *fp; -boolean FDECL((*proc), (char *)); +parse_conf_file(FILE *fp, boolean (*proc)(char *)) { char inbuf[4 * BUFSZ]; boolean rv = TRUE; /* assume successful parse */ @@ -3291,7 +3211,7 @@ extern const char *known_restrictions[]; /* drawing.c */ static FILE * -fopen_sym_file() +fopen_sym_file(void) { FILE *fp; @@ -3311,8 +3231,7 @@ fopen_sym_file() * 0 if it wasn't found in the sym file or other problem. */ int -read_sym_file(which_set) -int which_set; +read_sym_file(int which_set) { FILE *fp; @@ -3358,17 +3277,14 @@ int which_set; } boolean -proc_symset_line(buf) -char *buf; +proc_symset_line(char *buf) { return !((boolean) parse_sym_line(buf, g.symset_which_set)); } /* returns 0 on error */ int -parse_sym_line(buf, which_set) -char *buf; -int which_set; +parse_sym_line(char *buf, int which_set) { int val, i; struct symparse *symp; @@ -3554,9 +3470,7 @@ int which_set; } static void -set_symhandling(handling, which_set) -char *handling; -int which_set; +set_symhandling(char *handling, int which_set) { int i = 0; @@ -3571,9 +3485,7 @@ int which_set; } void -parseformat(arr, str) -int *arr; -char *str; +parseformat(int *arr, char *str) { const char *legal[] = {"historical", "lendian", "ascii"}; int i, kwi = 0, words = 0; @@ -3618,8 +3530,7 @@ char *str; /* verify that we can write to scoreboard file; if not, try to create one */ /*ARGUSED*/ void -check_recordfile(dir) -const char *dir UNUSED_if_not_OS2_CODEVIEW; +check_recordfile(const char *dir UNUSED_if_not_OS2_CODEVIEW) { #if defined(PRAGMA_UNUSED) && !defined(OS2_CODEVIEW) #pragma unused(dir) @@ -3732,9 +3643,8 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW; /*ARGSUSED*/ void -paniclog(type, reason) -const char *type; /* panic, impossible, trickery */ -const char *reason; /* explanation */ +paniclog(const char *type, /* panic, impossible, trickery */ + const char *reason) /* explanation */ { #ifdef PANICLOG FILE *lfile; @@ -3766,10 +3676,9 @@ const char *reason; /* explanation */ } void -testinglog(filenm, type, reason) -const char *filenm; /* ad hoc file name */ -const char *type; -const char *reason; /* explanation */ +testinglog(const char *filenm, /* ad hoc file name */ + const char *type, + const char *reason) /* explanation */ { FILE *lfile; char fnbuf[BUFSZ]; @@ -3793,7 +3702,7 @@ const char *reason; /* explanation */ /* ---------- BEGIN INTERNAL RECOVER ----------- */ boolean -recover_savefile() +recover_savefile(void) { NHFILE *gnhfp, *lnhfp, *snhfp; int lev, savelev, hpid, pltmpsiz, filecmc; @@ -3988,8 +3897,7 @@ recover_savefile() } boolean -copy_bytes(ifd, ofd) -int ifd, ofd; +copy_bytes(int ifd, int ofd) { char buf[BUFSIZ]; int nfrom, nto; @@ -4011,7 +3919,7 @@ int ifd, ofd; #ifdef SYSCF #ifdef SYSCF_FILE void -assure_syscf_file() +assure_syscf_file(void) { int fd; @@ -4058,9 +3966,7 @@ assure_syscf_file() * like dungeon.c and questpgr.c, which generate a ridiculous amount of * output if DEBUG is defined and effectively block the use of a wildcard */ boolean -debugcore(filename, wildcards) -const char *filename; -boolean wildcards; +debugcore(const char *filename, boolean wildcards) { const char *debugfiles, *p; @@ -4130,7 +4036,7 @@ boolean wildcards; #endif void -reveal_paths(VOID_ARGS) +reveal_paths(void) { const char *fqn, *nodumpreason; char buf[BUFSZ]; @@ -4347,14 +4253,14 @@ reveal_paths(VOID_ARGS) #define MAXPASSAGES SIZE(g.context.novel.pasg) /* 20 */ -static int FDECL(choose_passage, (int, unsigned)); +static int choose_passage(int, unsigned); /* choose a random passage that hasn't been chosen yet; once all have been chosen, reset the tracking to make all passages available again */ static int -choose_passage(passagecnt, oid) -int passagecnt; /* total of available passages */ -unsigned oid; /* book.o_id, used to determine whether re-reading same book */ +choose_passage(int passagecnt, /* total of available passages */ + unsigned oid) /* book.o_id, used to determine whether + re-reading same book */ { int idx, res; @@ -4394,11 +4300,9 @@ unsigned oid; /* book.o_id, used to determine whether re-reading same book */ /* Returns True if you were able to read something. */ boolean -read_tribute(tribsection, tribtitle, tribpassage, nowin_buf, bufsz, oid) -const char *tribsection, *tribtitle; -int tribpassage, bufsz; -char *nowin_buf; -unsigned oid; /* book identifier */ +read_tribute(const char *tribsection, const char *tribtitle, + int tribpassage, char *nowin_buf, int bufsz, + unsigned oid) /* book identifier */ { dlb *fp; char line[BUFSZ], lastline[BUFSZ]; @@ -4570,9 +4474,7 @@ unsigned oid; /* book identifier */ } boolean -Death_quote(buf, bufsz) -char *buf; -int bufsz; +Death_quote(char *buf, int bufsz) { unsigned death_oid = 1; /* chance of oid #1 being a novel is negligible */ diff --git a/src/fountain.c b/src/fountain.c index f5be392dd..36b1d5219 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -6,17 +6,16 @@ #include "hack.h" -static void NDECL(dowatersnakes); -static void NDECL(dowaterdemon); -static void NDECL(dowaternymph); -static void FDECL(gush, (int, int, genericptr_t)); -static void NDECL(dofindgem); +static void dowatersnakes(void); +static void dowaterdemon(void); +static void dowaternymph(void); +static void gush(int, int, genericptr_t); +static void dofindgem(void); /* used when trying to dip in or drink from fountain or sink or pool while levitating above it, or when trying to move downwards in that state */ void -floating_above(what) -const char *what; +floating_above(const char *what) { const char *umsg = "are floating high above the %s."; @@ -31,7 +30,7 @@ const char *what; /* Fountain of snakes! */ static void -dowatersnakes() +dowatersnakes(void) { register int num = rn1(5, 2); struct monst *mtmp; @@ -53,7 +52,7 @@ dowatersnakes() /* Water demon */ static void -dowaterdemon() +dowaterdemon(void) { struct monst *mtmp; @@ -81,7 +80,7 @@ dowaterdemon() /* Water Nymph */ static void -dowaternymph() +dowaternymph(void) { register struct monst *mtmp; @@ -103,8 +102,7 @@ dowaternymph() /* Gushing forth along LOS from (u.ux, u.uy) */ void -dogushforth(drinking) -int drinking; +dogushforth(int drinking) { int madepool = 0; @@ -118,9 +116,7 @@ int drinking; } static void -gush(x, y, poolcnt) -int x, y; -genericptr_t poolcnt; +gush(int x, int y, genericptr_t poolcnt) { register struct monst *mtmp; register struct trap *ttmp; @@ -150,7 +146,7 @@ genericptr_t poolcnt; /* Find a gem in the sparkling waters. */ static void -dofindgem() +dofindgem(void) { if (!Blind) You("spot a gem in the sparkling waters!"); @@ -164,9 +160,7 @@ dofindgem() } void -dryup(x, y, isyou) -xchar x, y; -boolean isyou; +dryup(xchar x, xchar y, boolean isyou) { if (IS_FOUNTAIN(levl[x][y].typ) && (!rn2(3) || FOUNTAIN_IS_WARNED(x, y))) { @@ -226,7 +220,7 @@ boolean isyou; } void -drinkfountain() +drinkfountain(void) { /* What happens when you drink from a fountain? */ register boolean mgkftn = (levl[u.ux][u.uy].blessedftn == 1); @@ -372,8 +366,7 @@ drinkfountain() } void -dipfountain(obj) -register struct obj *obj; +dipfountain(register struct obj *obj) { if (Levitation) { floating_above("fountain"); @@ -518,8 +511,7 @@ register struct obj *obj; } void -breaksink(x, y) -int x, y; +breaksink(int x, int y) { if (cansee(x, y) || (x == u.ux && y == u.uy)) pline_The("pipes break! Water spurts out!"); @@ -532,7 +524,7 @@ int x, y; } void -drinksink() +drinksink(void) { struct obj *otmp; struct monst *mtmp; diff --git a/src/hack.c b/src/hack.c index e004caaed..545f1ae7d 100644 --- a/src/hack.c +++ b/src/hack.c @@ -7,17 +7,17 @@ /* #define DEBUG */ /* uncomment for debugging */ -static void NDECL(maybe_wail); -static int NDECL(moverock); -static void NDECL(dosinkfall); -static boolean FDECL(findtravelpath, (int)); -static boolean FDECL(trapmove, (int, int, struct trap *)); -static struct monst *FDECL(monstinroom, (struct permonst *, int)); -static boolean FDECL(doorless_door, (int, int)); -static void FDECL(move_update, (BOOLEAN_P)); -static int NDECL(pickup_checks); -static void FDECL(maybe_smudge_engr, (int, int, int, int)); -static void NDECL(domove_core); +static void maybe_wail(void); +static int moverock(void); +static void dosinkfall(void); +static boolean findtravelpath(int); +static boolean trapmove(int, int, struct trap *); +static struct monst *monstinroom(struct permonst *, int); +static boolean doorless_door(int, int); +static void move_update(boolean); +static int pickup_checks(void); +static void maybe_smudge_engr(int, int, int, int); +static void domove_core(void); #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE) @@ -27,8 +27,7 @@ static void NDECL(domove_core); #define TRAVP_VALID 2 anything * -uint_to_any(ui) -unsigned ui; +uint_to_any(unsigned ui) { g.tmp_anything = cg.zeroany; g.tmp_anything.a_uint = ui; @@ -36,8 +35,7 @@ unsigned ui; } anything * -long_to_any(lng) -long lng; +long_to_any(long lng) { g.tmp_anything = cg.zeroany; g.tmp_anything.a_long = lng; @@ -45,8 +43,7 @@ long lng; } anything * -monst_to_any(mtmp) -struct monst *mtmp; +monst_to_any(struct monst *mtmp) { g.tmp_anything = cg.zeroany; g.tmp_anything.a_monst = mtmp; @@ -54,8 +51,7 @@ struct monst *mtmp; } anything * -obj_to_any(obj) -struct obj *obj; +obj_to_any(struct obj *obj) { g.tmp_anything = cg.zeroany; g.tmp_anything.a_obj = obj; @@ -63,9 +59,7 @@ struct obj *obj; } boolean -revive_nasty(x, y, msg) -int x, y; -const char *msg; +revive_nasty(int x, int y, const char *msg) { register struct obj *otmp, *otmp2; struct monst *mtmp; @@ -100,7 +94,7 @@ const char *msg; } static int -moverock() +moverock(void) { register xchar rx, ry, sx, sy; register struct obj *otmp; @@ -394,8 +388,7 @@ moverock() * Returns TRUE if still eating, FALSE when done. */ int -still_chewing(x, y) -xchar x, y; +still_chewing(xchar x, xchar y) { struct rm *lev = &levl[x][y]; struct obj *boulder = sobj_at(BOULDER, x, y); @@ -566,9 +559,7 @@ xchar x, y; } void -movobj(obj, ox, oy) -register struct obj *obj; -register xchar ox, oy; +movobj(register struct obj *obj, register xchar ox, register xchar oy) { /* optimize by leaving on the fobj chain? */ remove_object(obj); @@ -581,7 +572,7 @@ register xchar ox, oy; static NEARDATA const char fell_on_sink[] = "fell onto a sink"; static void -dosinkfall() +dosinkfall(void) { register struct obj *obj; int dmg; @@ -667,8 +658,7 @@ dosinkfall() /* intended to be called only on ROCKs or TREEs */ boolean -may_dig(x, y) -register xchar x, y; +may_dig(register xchar x, register xchar y) { struct rm *lev = &levl[x][y]; @@ -677,17 +667,14 @@ register xchar x, y; } boolean -may_passwall(x, y) -register xchar x, y; +may_passwall(register xchar x, register xchar y) { return (boolean) !(IS_STWALL(levl[x][y].typ) && (levl[x][y].wall_info & W_NONPASSWALL)); } boolean -bad_rock(mdat, x, y) -struct permonst *mdat; -register xchar x, y; +bad_rock(struct permonst *mdat, register xchar x, register xchar y) { return (boolean) ((Sokoban && sobj_at(BOULDER, x, y)) || (IS_ROCK(levl[x][y].typ) @@ -701,8 +688,7 @@ register xchar x, y; the reason why: 1: can't fit, 2: possessions won't fit, 3: sokoban returns 0 if we can squeeze through */ int -cant_squeeze_thru(mon) -struct monst *mon; +cant_squeeze_thru(struct monst *mon) { int amt; struct permonst *ptr = mon->data; @@ -728,8 +714,7 @@ struct monst *mon; } boolean -invocation_pos(x, y) -xchar x, y; +invocation_pos(xchar x, xchar y) { return (boolean) (Invocation_lev(&u.uz) && x == g.inv_pos.x && y == g.inv_pos.y); @@ -739,9 +724,7 @@ xchar x, y; * mode is one of DO_MOVE, TEST_MOVE, TEST_TRAV, or TEST_TRAP */ boolean -test_move(ux, uy, dx, dy, mode) -int ux, uy, dx, dy; -int mode; +test_move(int ux, int uy, int dx, int dy, int mode) { int x = ux + dx; int y = uy + dy; @@ -971,8 +954,7 @@ int mode; * Returns TRUE if a path was found. */ static boolean -findtravelpath(mode) -int mode; +findtravelpath(int mode) { /* if travel to adjacent, reachable location, use normal movement rules */ if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && g.context.travel1 @@ -1211,8 +1193,7 @@ int mode; } boolean -is_valid_travelpt(x,y) -int x,y; +is_valid_travelpt(int x, int y) { int tx = u.tx; int ty = u.ty; @@ -1236,9 +1217,8 @@ int x,y; return true iff moving should continue to intended destination (all failures and most successful escapes leave hero at original spot) */ static boolean -trapmove(x, y, desttrap) -int x, y; /* targetted destination, */ -struct trap *desttrap; /* nonnull if another trap at */ +trapmove(int x, int y, /* targetted destination, */ + struct trap *desttrap) /* nonnull if another trap at */ { boolean anchored = FALSE; const char *predicament, *culprit; @@ -1377,7 +1357,7 @@ struct trap *desttrap; /* nonnull if another trap at */ } boolean -u_rooted() +u_rooted(void) { if (!g.youmonst.data->mmove) { You("are rooted %s.", @@ -1391,7 +1371,7 @@ u_rooted() } void -domove() +domove(void) { int ux1 = u.ux, uy1 = u.uy; @@ -1404,7 +1384,7 @@ domove() } static void -domove_core() +domove_core(void) { register struct monst *mtmp; register struct rm *tmpr; @@ -2047,8 +2027,7 @@ domove_core() } static void -maybe_smudge_engr(x1,y1,x2,y2) -int x1, y1, x2, y2; +maybe_smudge_engr(int x1, int y1, int x2, int y2) { struct engr *ep; @@ -2063,7 +2042,7 @@ int x1, y1, x2, y2; /* HP loss or passing out from overexerting yourself */ void -overexert_hp() +overexert_hp(void) { int *hp = (!Upolyd ? &u.uhp : &u.mh); @@ -2079,7 +2058,7 @@ overexert_hp() /* combat increases metabolism */ boolean -overexertion() +overexertion(void) { /* this used to be part of domove() when moving to a monster's position, but is now called by attack() so that it doesn't @@ -2092,7 +2071,7 @@ overexertion() } void -invocation_message() +invocation_message(void) { /* a special clue-msg when on the Invocation position */ if (invocation_pos(u.ux, u.uy) && !On_stairs(u.ux, u.uy)) { @@ -2119,7 +2098,7 @@ invocation_message() might be going into solid rock, inhibiting levitation or flight, or coming back out of such, reinstating levitation/flying */ void -switch_terrain() +switch_terrain(void) { struct rm *lev = &levl[u.ux][u.uy]; boolean blocklev = (IS_ROCK(lev->typ) || closed_door(u.ux, u.uy) @@ -2158,8 +2137,7 @@ switch_terrain() /* set or clear u.uinwater */ void -set_uinwater(in_out) -int in_out; +set_uinwater(int in_out) { u.uinwater = in_out ? 1 : 0; } @@ -2168,8 +2146,7 @@ int in_out; leaving a pool of water/lava, and by moveloop to check for staying on one; returns true to skip rest of spoteffects */ boolean -pooleffects(newspot) -boolean newspot; /* true if called by spoteffects */ +pooleffects(boolean newspot) /* true if called by spoteffects */ { /* check for leaving water */ if (u.uinwater) { @@ -2249,8 +2226,7 @@ boolean newspot; /* true if called by spoteffects */ } void -spoteffects(pick) -boolean pick; +spoteffects(boolean pick) { static int inspoteffects = 0; static coord spotloc; @@ -2397,9 +2373,7 @@ boolean pick; /* returns first matching monster */ static struct monst * -monstinroom(mdat, roomno) -struct permonst *mdat; -int roomno; +monstinroom(struct permonst *mdat, int roomno) { register struct monst *mtmp; @@ -2414,9 +2388,7 @@ int roomno; } char * -in_rooms(x, y, typewanted) -register xchar x, y; -register int typewanted; +in_rooms(register xchar x, register xchar y, register int typewanted) { static char buf[5]; char rno, *ptr = &buf[4]; @@ -2482,8 +2454,7 @@ register int typewanted; /* is (x,y) in a town? */ boolean -in_town(x, y) -register int x, y; +in_town(register int x, register int y) { s_level *slev = Is_special(&u.uz); register struct mkroom *sroom; @@ -2508,8 +2479,7 @@ register int x, y; } static void -move_update(newlev) -register boolean newlev; +move_update(register boolean newlev) { char *ptr1, *ptr2, *ptr3, *ptr4; @@ -2549,8 +2519,7 @@ register boolean newlev; /* possibly deliver a one-time room entry message */ void -check_special_room(newlev) -boolean newlev; +check_special_room(boolean newlev) { register struct monst *mtmp; char *ptr; @@ -2691,7 +2660,7 @@ boolean newlev; -1 = do normal pickup -2 = loot the monster */ static int -pickup_checks() +pickup_checks(void) { struct trap *traphere; @@ -2780,7 +2749,7 @@ pickup_checks() /* the ',' command */ int -dopickup(VOID_ARGS) +dopickup(void) { int count, tmpcount, ret; @@ -2803,7 +2772,7 @@ dopickup(VOID_ARGS) /* turn around a corner if that is the only way we can proceed */ /* do not turn left or right twice */ void -lookaround() +lookaround(void) { register int x, y; int i, x0 = 0, y0 = 0, m0 = 1, i0 = 9; @@ -2957,8 +2926,7 @@ lookaround() /* check for a doorway which lacks its door (NODOOR or BROKEN) */ static boolean -doorless_door(x, y) -int x, y; +doorless_door(int x, int y) { struct rm *lev_p = &levl[x][y]; @@ -2973,8 +2941,7 @@ int x, y; /* used by drown() to check whether hero can crawl from water to */ boolean -crawl_destination(x, y) -int x, y; +crawl_destination(int x, int y) { /* is location ok in general? */ if (!goodpos(x, y, &g.youmonst, 0)) @@ -3000,7 +2967,7 @@ int x, y; /* something like lookaround, but we are not running */ /* react only to monsters that might hit us */ int -monster_nearby() +monster_nearby(void) { register int x, y; register struct monst *mtmp; @@ -3024,8 +2991,7 @@ monster_nearby() } void -end_running(and_travel) -boolean and_travel; +end_running(boolean and_travel) { /* moveloop() suppresses time_botl when context.run is non-zero; when running stops, update 'time' even if other botl status is unchanged */ @@ -3039,8 +3005,7 @@ boolean and_travel; } void -nomul(nval) -int nval; +nomul(int nval) { if (g.multi < nval) return; /* This is a bug fix by ab@unido */ @@ -3055,8 +3020,7 @@ int nval; /* called when a non-movement, multi-turn action has completed */ void -unmul(msg_override) -const char *msg_override; +unmul(const char *msg_override) { g.context.botl = TRUE; g.multi = 0; /* caller will usually have done this already */ @@ -3079,11 +3043,11 @@ const char *msg_override; u.usleep = 0; g.multi_reason = NULL; if (g.afternmv) { - int NDECL((*f)) = g.afternmv; + int (*f)(void) = g.afternmv; /* clear afternmv before calling it (to override the encumbrance hack for levitation--see weight_cap()) */ - g.afternmv = (int NDECL((*))) 0; + g.afternmv = (int (*)(void)) 0; (void) (*f)(); /* for finishing Armor/Boots/&c_on() */ update_inventory(); @@ -3091,7 +3055,7 @@ const char *msg_override; } static void -maybe_wail() +maybe_wail(void) { static short powers[] = { TELEPORT, SEE_INVIS, POISON_RES, COLD_RES, SHOCK_RES, FIRE_RES, SLEEP_RES, DISINT_RES, @@ -3125,10 +3089,7 @@ maybe_wail() } void -losehp(n, knam, k_format) -register int n; -register const char *knam; -boolean k_format; +losehp(register int n, register const char *knam, boolean k_format) { #if 0 /* code below is prepared to handle negative 'loss' so don't add this * until we've verified that no callers intentionally rely on that */ @@ -3165,7 +3126,7 @@ boolean k_format; } int -weight_cap() +weight_cap(void) { long carrcap, save_ELev = ELevitation, save_BLev = BLevitation; @@ -3222,7 +3183,7 @@ weight_cap() /* returns how far beyond the normal capacity the player is currently. */ /* inv_weight() is negative if the player is below normal capacity. */ int -inv_weight() +inv_weight(void) { register struct obj *otmp = g.invent; register int wt = 0; @@ -3243,8 +3204,7 @@ inv_weight() * over the normal capacity the player is loaded. Max is 5. */ int -calc_capacity(xtra_wt) -int xtra_wt; +calc_capacity(int xtra_wt) { int cap, wt = inv_weight() + xtra_wt; @@ -3257,13 +3217,13 @@ int xtra_wt; } int -near_capacity() +near_capacity(void) { return calc_capacity(0); } int -max_capacity() +max_capacity(void) { int wt = inv_weight(); @@ -3271,8 +3231,7 @@ max_capacity() } boolean -check_capacity(str) -const char *str; +check_capacity(const char *str) { if (near_capacity() >= EXT_ENCUMBER) { if (str) @@ -3285,8 +3244,7 @@ const char *str; } int -inv_cnt(incl_gold) -boolean incl_gold; +inv_cnt(boolean incl_gold) { register struct obj *otmp = g.invent; register int ct = 0; @@ -3304,8 +3262,7 @@ boolean incl_gold; /* now that u.gold/m.gold is gone.*/ /* Counting money in a container might be possible too. */ long -money_cnt(otmp) -struct obj *otmp; +money_cnt(struct obj *otmp) { while (otmp) { if (otmp->oclass == COIN_CLASS) diff --git a/src/hacklib.c b/src/hacklib.c index 749591394..17b52469c 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -83,45 +83,40 @@ #define Static static #endif -static boolean FDECL(pmatch_internal, (const char *, const char *, - BOOLEAN_P, const char *)); +static boolean pmatch_internal(const char *, const char *, boolean, + const char *); /* is 'c' a digit? */ boolean -digit(c) -char c; +digit(char c) { return (boolean) ('0' <= c && c <= '9'); } /* is 'c' a letter? note: '@' classed as letter */ boolean -letter(c) -char c; +letter(char c) { return (boolean) ('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z'); } /* force 'c' into uppercase */ char -highc(c) -char c; +highc(char c) { return (char) (('a' <= c && c <= 'z') ? (c & ~040) : c); } /* force 'c' into lowercase */ char -lowc(c) -char c; +lowc(char c) { return (char) (('A' <= c && c <= 'Z') ? (c | 040) : c); } /* convert a string into all lowercase */ char * -lcase(s) -char *s; +lcase(char *s) { register char *p; @@ -133,8 +128,7 @@ char *s; /* convert a string into all uppercase */ char * -ucase(s) -char *s; +ucase(char *s) { register char *p; @@ -146,8 +140,7 @@ char *s; /* convert first character of a string to uppercase */ char * -upstart(s) -char *s; +upstart(char *s) { if (s) *s = highc(*s); @@ -156,8 +149,7 @@ char *s; /* remove excess whitespace from a string buffer (in place) */ char * -mungspaces(bp) -char *bp; +mungspaces(char *bp) { register char c, *p, *p2; boolean was_space = TRUE; @@ -179,8 +171,7 @@ char *bp; /* skip leading whitespace; remove trailing whitespace, in place */ char * -trimspaces(txt) -char *txt; +trimspaces(char *txt) { char *end; @@ -196,8 +187,7 @@ char *txt; /* remove \n from end of line; remove \r too if one is there */ char * -strip_newline(str) -char *str; +strip_newline(char *str) { char *p = rindex(str, '\n'); @@ -211,8 +201,7 @@ char *str; /* return the end of a string (pointing at '\0') */ char * -eos(s) -register char *s; +eos(register char *s) { while (*s) s++; /* s += strlen(s); */ @@ -221,8 +210,7 @@ register char *s; /* determine whether 'str' ends in 'chkstr' */ boolean -str_end_is(str, chkstr) -const char *str, *chkstr; +str_end_is(const char *str, const char *chkstr) { int clen = (int) strlen(chkstr); @@ -233,8 +221,7 @@ const char *str, *chkstr; /* return the max line length from buffer comprising of newline-separated strings */ int -str_lines_maxlen(str) -const char *str; +str_lines_maxlen(const char *str) { const char *s1, *s2; int len, max_len = 0; @@ -258,9 +245,7 @@ const char *str; /* append a character to a string (in place): strcat(s, {c,'\0'}); */ char * -strkitten(s, c) -char *s; -char c; +strkitten(char *s, char c) { char *p = eos(s); @@ -271,10 +256,7 @@ char c; /* truncating string copy */ void -copynchars(dst, src, n) -char *dst; -const char *src; -int n; +copynchars(char *dst, const char *src, int n) { /* copies at most n characters, stopping sooner if terminator reached; treats newline as input terminator; unlike strncpy, always supplies @@ -288,8 +270,7 @@ int n; /* convert char nc into oc's case; mostly used by strcasecpy */ char -chrcasecpy(oc, nc) -int oc, nc; +chrcasecpy(int oc, int nc) { #if 0 /* this will be necessary if we switch to */ oc = (int) (unsigned char) oc; @@ -311,9 +292,7 @@ int oc, nc; for case-insensitive editions of makeplural() and makesingular(); src might be shorter, same length, or longer than dst */ char * -strcasecpy(dst, src) -char *dst; -const char *src; +strcasecpy(char *dst, const char *src) { char *result = dst; int ic, oc, dst_exhausted = 0; @@ -335,8 +314,7 @@ const char *src; /* return a name converted to possessive */ char * -s_suffix(s) -const char *s; +s_suffix(const char *s) { Static char buf[BUFSZ]; @@ -354,8 +332,7 @@ const char *s; /* construct a gerund (a verb formed by appending "ing" to a noun) */ char * -ing_suffix(s) -const char *s; +ing_suffix(const char *s) { static const char vowel[] = "aeiouwy"; static char buf[BUFSZ]; @@ -390,9 +367,7 @@ const char *s; /* trivial text encryption routine (see makedefs) */ char * -xcrypt(str, buf) -const char *str; -char *buf; +xcrypt(const char *str, char *buf) { register const char *p; register char *q; @@ -411,8 +386,7 @@ char *buf; /* is a string entirely whitespace? */ boolean -onlyspace(s) -const char *s; +onlyspace(const char *s) { for (; *s; s++) if (*s != ' ' && *s != '\t') @@ -422,9 +396,9 @@ const char *s; /* expand tabs into proper number of spaces (in place) */ char * -tabexpand(sbuf) -char *sbuf; /* assumed to be [BUFSZ] but can be smaller provided that expanded - * string fits; expansion bigger than BUFSZ-1 will be truncated */ +tabexpand(char *sbuf) /* assumed to be [BUFSZ] but can be smaller provided that + * expanded string fits; expansion bigger than BUFSZ-1 + * will be truncated */ { char buf[BUFSZ + 10]; register char *bp, *s = sbuf; @@ -461,8 +435,7 @@ char *sbuf; /* assumed to be [BUFSZ] but can be smaller provided that expanded #define VISCTRL_NBUF 5 /* make a displayable string from a character */ char * -visctrl(c) -char c; +visctrl(char c) { Static char visctrl_bufs[VISCTRL_NBUF][5]; static int nbuf = 0; @@ -492,9 +465,7 @@ char c; /* caller is responsible for ensuring that bp is a valid pointer to a BUFSZ buffer */ char * -stripchars(bp, stuff_to_strip, orig) -char *bp; -const char *stuff_to_strip, *orig; +stripchars(char *bp, const char *stuff_to_strip, const char *orig) { int i = 0; char *s = bp; @@ -515,8 +486,7 @@ const char *stuff_to_strip, *orig; /* remove digits from string */ char * -stripdigits(s) -char *s; +stripdigits(char *s) { char *s1, *s2; @@ -531,9 +501,7 @@ char *s; /* substitute a word or phrase in a string (in place) */ /* caller is responsible for ensuring that bp points to big enough buffer */ char * -strsubst(bp, orig, replacement) -char *bp; -const char *orig, *replacement; +strsubst(char *bp, const char *orig, const char *replacement) { char *found, buf[BUFSZ]; @@ -553,11 +521,10 @@ const char *orig, *replacement; if N is 0, substitute all occurrences; returns the number of subsitutions; maximum output length is BUFSZ (BUFSZ-1 chars + terminating '\0') */ int -strNsubst(inoutbuf, orig, replacement, n) -char *inoutbuf; /* current string, and result buffer */ -const char *orig, /* old substring; if "" then insert in front of Nth char */ - *replacement; /* new substring; if "" then delete old substring */ -int n; /* which occurrence to replace; 0 => all */ +strNsubst(char *inoutbuf, /* current string, and result buffer */ + const char *orig, /* old substring; if "" then insert in front of Nth char */ + const char *replacement, /* new substring; if "" then delete old substring */ + int n) /* which occurrence to replace; 0 => all */ { char *bp, *op, workbuf[BUFSZ]; const char *rp; @@ -597,8 +564,7 @@ int n; /* which occurrence to replace; 0 => all */ /* return the ordinal suffix of a number */ const char * -ordin(n) -int n; /* note: should be non-negative */ +ordin(int n) /* note: should be non-negative */ { register int dd = n % 10; @@ -608,8 +574,7 @@ int n; /* note: should be non-negative */ /* make a signed digit string from a number */ char * -sitoa(n) -int n; +sitoa(int n) { Static char buf[13]; @@ -619,17 +584,14 @@ int n; /* return the sign of a number: -1, 0, or 1 */ int -sgn(n) -int n; +sgn(int n) { return (n < 0) ? -1 : (n != 0); } /* calculate x/y, rounding as appropriate */ int -rounddiv(x, y) -long x; -int y; +rounddiv(long x, int y) { int r, m; int divsgn = 1; @@ -654,8 +616,7 @@ int y; /* distance between two points, in moves */ int -distmin(x0, y0, x1, y1) -int x0, y0, x1, y1; +distmin(int x0, int y0, int x1, int y1) { register int dx = x0 - x1, dy = y0 - y1; @@ -671,8 +632,7 @@ int x0, y0, x1, y1; /* square of euclidean distance between pair of pts */ int -dist2(x0, y0, x1, y1) -int x0, y0, x1, y1; +dist2(int x0, int y0, int x1, int y1) { register int dx = x0 - x1, dy = y0 - y1; @@ -681,8 +641,7 @@ int x0, y0, x1, y1; /* integer square root function without using floating point */ int -isqrt(val) -int val; +isqrt(int val) { int rt = 0; int odd = 1; @@ -704,8 +663,7 @@ int val; /* are two points lined up (on a straight line)? */ boolean -online2(x0, y0, x1, y1) -int x0, y0, x1, y1; +online2(int x0, int y0, int x1, int y1) { int dx = x0 - x1, dy = y0 - y1; /* If either delta is zero then they're on an orthogonal line, @@ -717,10 +675,10 @@ int x0, y0, x1, y1; /* guts of pmatch(), pmatchi(), and pmatchz(); match a string against a pattern */ static boolean -pmatch_internal(patrn, strng, ci, sk) -const char *patrn, *strng; -boolean ci; /* True => case-insensitive, False => case-sensitive */ -const char *sk; /* set of characters to skip */ +pmatch_internal(const char *patrn, const char *strng, + boolean ci, /* True => case-insensitive, + False => case-sensitive */ + const char *sk) /* set of characters to skip */ { char s, p; /* @@ -757,24 +715,21 @@ pmatch_top: /* case-sensitive wildcard match */ boolean -pmatch(patrn, strng) -const char *patrn, *strng; +pmatch(const char *patrn, const char *strng) { return pmatch_internal(patrn, strng, FALSE, (const char *) 0); } /* case-insensitive wildcard match */ boolean -pmatchi(patrn, strng) -const char *patrn, *strng; +pmatchi(const char *patrn, const char *strng) { return pmatch_internal(patrn, strng, TRUE, (const char *) 0); } /* case-insensitive wildcard fuzzymatch */ boolean -pmatchz(patrn, strng) -const char *patrn, *strng; +pmatchz(const char *patrn, const char *strng) { /* ignore spaces, tabs (just in case), dashes, and underscores */ static const char fuzzychars[] = " \t-_"; @@ -784,10 +739,10 @@ const char *patrn, *strng; #ifndef STRNCMPI /* case insensitive counted string comparison */ +/*{ aka strncasecmp }*/ int -strncmpi(s1, s2, n) /*{ aka strncasecmp }*/ -register const char *s1, *s2; -register int n; /*(should probably be size_t, which is unsigned)*/ +strncmpi(register const char *s1, register const char *s2, + register int n) /*(should probably be size_t, which is unsigned)*/ { register char t1, t2; @@ -808,9 +763,7 @@ register int n; /*(should probably be size_t, which is unsigned)*/ #ifndef STRSTRI /* case insensitive substring search */ char * -strstri(str, sub) -const char *str; -const char *sub; +strstri(const char *str, const char *sub) { register const char *s1, *s2; register int i, k; @@ -855,10 +808,8 @@ const char *sub; /* compare two strings for equality, ignoring the presence of specified characters (typically whitespace) and possibly ignoring case */ boolean -fuzzymatch(s1, s2, ignore_chars, caseblind) -const char *s1, *s2; -const char *ignore_chars; -boolean caseblind; +fuzzymatch(const char *s1, const char *s2, const char *ignore_chars, + boolean caseblind) { register char c1, c2; @@ -907,17 +858,16 @@ boolean caseblind; #if defined(AMIGA) && !defined(AZTEC_C) && !defined(__SASC_60) \ && !defined(_DCC) && !defined(__GNUC__) -extern struct tm *FDECL(localtime, (time_t *)); +extern struct tm *localtime(time_t *); #endif -static struct tm *NDECL(getlt); +static struct tm *getlt(void); /* Sets the seed for the random number generator */ #ifdef USE_ISAAC64 static void -set_random(seed, fn) -unsigned long seed; -int FDECL((*fn), (int)); +set_random(unsigned long seed, + int (*fn)(int)) { init_isaac64(seed, fn); } @@ -926,9 +876,8 @@ int FDECL((*fn), (int)); /*ARGSUSED*/ static void -set_random(seed, fn) -unsigned long seed; -int FDECL((*fn), (int)) UNUSED; +set_random(unsigned long seed, + int (*fn)(int) UNUSED) { /* the types are different enough here that sweeping the different * routine names into one via #defines is even more confusing @@ -957,23 +906,21 @@ int FDECL((*fn), (int)) UNUSED; /* An appropriate version of this must always be provided in port-specific code somewhere. It returns a number suitable as seed for the random number generator */ -extern unsigned long NDECL(sys_random_seed); +extern unsigned long sys_random_seed(void); /* * Initializes the random number generator. * Only call once. */ void -init_random(fn) -int FDECL((*fn), (int)); +init_random(int (*fn)(int)) { set_random(sys_random_seed(), fn); } /* Reshuffles the random number generator. */ void -reseed_random(fn) -int FDECL((*fn), (int)); +reseed_random(int (*fn)(int)) { /* only reseed if we are certain that the seed generation is unguessable * by the players. */ @@ -982,7 +929,7 @@ int FDECL((*fn), (int)); } time_t -getnow() +getnow(void) { time_t datetime = 0; @@ -991,7 +938,7 @@ getnow() } static struct tm * -getlt() +getlt(void) { time_t date = getnow(); @@ -999,7 +946,7 @@ getlt() } int -getyear() +getyear(void) { return (1900 + getlt()->tm_year); } @@ -1007,8 +954,7 @@ getyear() #if 0 /* This routine is no longer used since in 20YY it yields "1YYmmdd". */ char * -yymmdd(date) -time_t date; +yymmdd(time_t date) { Static char datestr[10]; struct tm *lt; @@ -1025,8 +971,7 @@ time_t date; #endif long -yyyymmdd(date) -time_t date; +yyyymmdd(time_t date) { long datenum; struct tm *lt; @@ -1050,8 +995,7 @@ time_t date; } long -hhmmss(date) -time_t date; +hhmmss(time_t date) { long timenum; struct tm *lt; @@ -1066,8 +1010,7 @@ time_t date; } char * -yyyymmddhhmmss(date) -time_t date; +yyyymmddhhmmss(time_t date) { long datenum; static char datestr[15]; @@ -1095,8 +1038,7 @@ time_t date; } time_t -time_from_yyyymmddhhmmss(buf) -char *buf; +time_from_yyyymmddhhmmss(char *buf) { int k; time_t timeresult = (time_t) 0; @@ -1163,7 +1105,7 @@ char *buf; * + 11/22 for rounding */ int -phase_of_the_moon() /* 0-7, with 0: new, 4: full */ +phase_of_the_moon(void) /* 0-7, with 0: new, 4: full */ { register struct tm *lt = getlt(); register int epact, diy, goldn; @@ -1178,7 +1120,7 @@ phase_of_the_moon() /* 0-7, with 0: new, 4: full */ } boolean -friday_13th() +friday_13th(void) { register struct tm *lt = getlt(); @@ -1187,7 +1129,7 @@ friday_13th() } int -night() +night(void) { register int hour = getlt()->tm_hour; @@ -1195,15 +1137,14 @@ night() } int -midnight() +midnight(void) { return (getlt()->tm_hour == 0); } /* strbuf_init() initializes strbuf state for use */ void -strbuf_init(strbuf) -strbuf_t *strbuf; +strbuf_init(strbuf_t *strbuf) { strbuf->str = NULL; strbuf->len = 0; @@ -1211,9 +1152,7 @@ strbuf_t *strbuf; /* strbuf_append() appends given str to strbuf->str */ void -strbuf_append(strbuf, str) -strbuf_t *strbuf; -const char *str; +strbuf_append(strbuf_t *strbuf, const char *str) { int len = (int) strlen(str) + 1; @@ -1224,9 +1163,7 @@ const char *str; /* strbuf_reserve() ensure strbuf->str has storage for len characters */ void -strbuf_reserve(strbuf, len) -strbuf_t *strbuf; -int len; +strbuf_reserve(strbuf_t *strbuf, int len) { if (strbuf->str == NULL) { strbuf->str = strbuf->buf; @@ -1247,8 +1184,7 @@ int len; /* strbuf_empty() frees allocated memory and set strbuf to initial state */ void -strbuf_empty(strbuf) -strbuf_t *strbuf; +strbuf_empty(strbuf_t *strbuf) { if (strbuf->str != NULL && strbuf->str != strbuf->buf) free((genericptr_t) strbuf->str); @@ -1257,8 +1193,7 @@ strbuf_t *strbuf; /* strbuf_nl_to_crlf() converts all occurences of \n to \r\n */ void -strbuf_nl_to_crlf(strbuf) -strbuf_t *strbuf; +strbuf_nl_to_crlf(strbuf_t *strbuf) { if (strbuf->str) { int len = (int) strlen(strbuf->str); @@ -1280,9 +1215,7 @@ strbuf_t *strbuf; } char * -nonconst(str, buf) -const char *str; -char *buf; +nonconst(const char *str, char *buf) { char *retval = emptystr; @@ -1296,8 +1229,7 @@ char *buf; /* swapbits(val, bita, bitb) swaps bit a with bit b in val */ int -swapbits(val, bita, bitb) -int val, bita, bitb; +swapbits(int val, int bita, int bitb) { int tmp = ((val >> bita) & 1) ^ ((val >> bitb) & 1); @@ -1306,9 +1238,7 @@ int val, bita, bitb; /* randomize the given list of numbers 0 <= i < count */ void -shuffle_int_array(indices, count) -int *indices; -int count; +shuffle_int_array(int *indices, int count) { int i, iswap, temp; diff --git a/src/insight.c b/src/insight.c index 15368fb74..4cea28c84 100644 --- a/src/insight.c +++ b/src/insight.c @@ -14,26 +14,25 @@ #include "hack.h" -static void FDECL(enlght_out, (const char *)); -static void FDECL(enlght_line, (const char *, const char *, const char *, - const char *)); -static char *FDECL(enlght_combatinc, (const char *, int, int, char *)); -static void FDECL(enlght_halfdmg, (int, int)); -static boolean NDECL(walking_on_water); -static boolean FDECL(cause_known, (int)); -static char *FDECL(attrval, (int, int, char *)); -static void FDECL(background_enlightenment, (int, int)); -static void FDECL(basics_enlightenment, (int, int)); -static void FDECL(characteristics_enlightenment, (int, int)); -static void FDECL(one_characteristic, (int, int, int)); -static void FDECL(status_enlightenment, (int, int)); -static void FDECL(weapon_insight, (int)); -static void FDECL(attributes_enlightenment, (int, int)); -static void FDECL(show_achievements, (int)); -static int FDECL(CFDECLSPEC vanqsort_cmp, (const genericptr, - const genericptr)); -static int NDECL(set_vanq_order); -static int NDECL(num_extinct); +static void enlght_out(const char *); +static void enlght_line(const char *, const char *, const char *, + const char *); +static char *enlght_combatinc(const char *, int, int, char *); +static void enlght_halfdmg(int, int); +static boolean walking_on_water(void); +static boolean cause_known(int); +static char *attrval(int, int, char *); +static void background_enlightenment(int, int); +static void basics_enlightenment(int, int); +static void characteristics_enlightenment(int, int); +static void one_characteristic(int, int, int); +static void status_enlightenment(int, int); +static void weapon_insight(int); +static void attributes_enlightenment(int, int); +static void show_achievements(int); +static int CFDECLSPEC vanqsort_cmp(const genericptr, const genericptr); +static int set_vanq_order(void); +static int num_extinct(void); extern const char *hu_stat[]; /* hunger status from eat.c */ extern const char *enc_stat[]; /* encumbrance status from botl.c */ @@ -56,8 +55,7 @@ static const char have_been[] = "have been ", have_never[] = "have never ", enl_msg(You_, have, (const char *) "", something, "") static void -enlght_out(buf) -const char *buf; +enlght_out(const char *buf) { if (g.en_via_menu) { anything any; @@ -70,8 +68,8 @@ const char *buf; } static void -enlght_line(start, middle, end, ps) -const char *start, *middle, *end, *ps; +enlght_line(const char *start, const char *middle, const char *end, + const char *ps) { char buf[BUFSZ]; @@ -81,10 +79,7 @@ const char *start, *middle, *end, *ps; /* format increased chance to hit or damage or defense (Protection) */ static char * -enlght_combatinc(inctyp, incamt, final, outbuf) -const char *inctyp; -int incamt, final; -char *outbuf; +enlght_combatinc(const char *inctyp, int incamt, int final, char *outbuf) { const char *modif, *bonus; boolean invrt; @@ -121,9 +116,7 @@ char *outbuf; /* report half physical or half spell damage */ static void -enlght_halfdmg(category, final) -int category; -int final; +enlght_halfdmg(int category, int final) { const char *category_name; char buf[BUFSZ]; @@ -146,7 +139,7 @@ int final; /* is hero actively using water walking capability on water (or lava)? */ static boolean -walking_on_water() +walking_on_water(void) { if (u.uinwater || Levitation || Flying) return FALSE; @@ -156,10 +149,7 @@ walking_on_water() /* describe u.utraptype; used by status_enlightenment() and self_lookat() */ char * -trap_predicament(outbuf, final, wizxtra) -char *outbuf; -int final; -boolean wizxtra; +trap_predicament(char *outbuf, int final, boolean wizxtra) { struct trap *t; @@ -193,8 +183,7 @@ boolean wizxtra; confers the target property; item must have been seen and its type discovered but it doesn't necessarily have to be fully identified */ static boolean -cause_known(propindx) -int propindx; /* index of a property which can be conveyed by worn item */ +cause_known(int propindx) /* index of a property which can be conveyed by worn item */ { register struct obj *o; long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL; @@ -213,9 +202,8 @@ int propindx; /* index of a property which can be conveyed by worn item */ /* format a characteristic value, accommodating Strength's strangeness */ static char * -attrval(attrindx, attrvalue, resultbuf) -int attrindx, attrvalue; -char resultbuf[]; /* should be at least [7] to hold "18/100\0" */ +attrval(int attrindx, int attrvalue, + char resultbuf[]) /* should be at least [7] to hold "18/100\0" */ { if (attrindx != A_STR || attrvalue <= 18) Sprintf(resultbuf, "%d", attrvalue); @@ -227,9 +215,9 @@ char resultbuf[]; /* should be at least [7] to hold "18/100\0" */ } void -enlightenment(mode, final) -int mode; /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */ -int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */ +enlightenment(int mode, /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */ + int final) /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, + ENL_GAMEOVERDEAD */ { char buf[BUFSZ], tmpbuf[BUFSZ]; @@ -305,9 +293,7 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */ /*ARGSUSED*/ /* display role, race, alignment and such to en_win */ static void -background_enlightenment(unused_mode, final) -int unused_mode UNUSED; -int final; +background_enlightenment(int unused_mode UNUSED, int final) { const char *role_titl, *rank_titl; int innategend, difgend, difalgn; @@ -559,9 +545,7 @@ int final; doesn't fit very well in other categories */ /*ARGSUSED*/ static void -basics_enlightenment(mode, final) -int mode UNUSED; -int final; +basics_enlightenment(int mode UNUSED, int final) { static char Power[] = "energy points (spell power)"; char buf[BUFSZ]; @@ -644,9 +628,7 @@ int final; /* characteristics: expanded version of bottom line strength, dexterity, &c */ static void -characteristics_enlightenment(mode, final) -int mode; -int final; +characteristics_enlightenment(int mode, int final) { char buf[BUFSZ]; @@ -665,8 +647,7 @@ int final; /* display one attribute value for characteristics_enlightenment() */ static void -one_characteristic(mode, final, attrindx) -int mode, final, attrindx; +one_characteristic(int mode, int final, int attrindx) { extern const char *const attrname[]; /* attrib.c */ boolean hide_innate_value = FALSE, interesting_alimit; @@ -760,9 +741,7 @@ int mode, final, attrindx; /* status: selected obvious capabilities, assorted troubles */ static void -status_enlightenment(mode, final) -int mode; -int final; +status_enlightenment(int mode, int final) { boolean magic = (mode & MAGICENLIGHTENMENT) ? TRUE : FALSE; int cap; @@ -1073,8 +1052,7 @@ int final; /* extracted from status_enlightenment() to reduce clutter there */ static void -weapon_insight(final) -int final; +weapon_insight(int final) { char buf[BUFSZ]; int wtype; @@ -1279,9 +1257,7 @@ int final; /* attributes: intrinsics and the like, other non-obvious capabilities */ static void -attributes_enlightenment(unused_mode, final) -int unused_mode UNUSED; -int final; +attributes_enlightenment(int unused_mode UNUSED, int final) { static NEARDATA const char if_surroundings_permitted[] = " if surroundings permitted"; @@ -1742,7 +1718,7 @@ int final; /* ^X command */ int -doattributes(VOID_ARGS) +doattributes(void) { int mode = BASICENLIGHTENMENT; @@ -1755,9 +1731,8 @@ doattributes(VOID_ARGS) } void -youhiding(via_enlghtmt, msgflag) -boolean via_enlghtmt; /* englightment line vs topl message */ -int msgflag; /* for variant message phrasing */ +youhiding(boolean via_enlghtmt, /* englightment line vs topl message */ + int msgflag) /* for variant message phrasing */ { char *bp, buf[BUFSZ]; @@ -1815,7 +1790,7 @@ int msgflag; /* for variant message phrasing */ /* #conduct command [KMH]; shares enlightenment's tense handling */ int -doconduct(VOID_ARGS) +doconduct(void) { show_conduct(0); return 0; @@ -1823,8 +1798,7 @@ doconduct(VOID_ARGS) /* display conducts; for doconduct(), also disclose() and dump_everything() */ void -show_conduct(final) -int final; +show_conduct(int final) { char buf[BUFSZ]; int ngenocided; @@ -1964,8 +1938,7 @@ int final; */ static void -show_achievements(final) -int final; /* used "behind the curtain" by enl_foo() macros */ +show_achievements(int final) /* used "behind the curtain" by enl_foo() macros */ { int i, achidx, absidx, acnt; char title[QBUFSZ], buf[QBUFSZ]; @@ -2124,8 +2097,7 @@ int final; /* used "behind the curtain" by enl_foo() macros */ /* record an achievement (add at end of list unless already present) */ void -record_achievement(achidx) -schar achidx; +record_achievement(schar achidx) { int i, absidx; @@ -2152,8 +2124,7 @@ schar achidx; /* discard a recorded achievement; return True if removed, False otherwise */ boolean -remove_achievement(achidx) -schar achidx; +remove_achievement(schar achidx) { int i; @@ -2171,7 +2142,7 @@ schar achidx; /* used to decide whether there are any achievements to display */ int -count_achievements() +count_achievements(void) { int i, acnt = 0; @@ -2183,8 +2154,7 @@ count_achievements() /* convert a rank index to an achievement number; encode it when female in order to subsequently report gender-specific ranks accurately */ schar -achieve_rank(rank) -int rank; /* 1..8 */ +achieve_rank(int rank) /* 1..8 */ { schar achidx = (schar) ((rank - 1) + ACH_RNK1); @@ -2195,7 +2165,7 @@ int rank; /* 1..8 */ /* return True if sokoban branch has been entered, False otherwise */ boolean -sokoban_in_play() +sokoban_in_play(void) { int achidx; @@ -2224,9 +2194,7 @@ static const char *vanqorders[NUM_VANQ_ORDER_MODES] = { }; static int CFDECLSPEC -vanqsort_cmp(vptr1, vptr2) -const genericptr vptr1; -const genericptr vptr2; +vanqsort_cmp(const genericptr vptr1, const genericptr vptr2) { int indx1 = *(short *) vptr1, indx2 = *(short *) vptr2, mlev1, mlev2, mstr1, mstr2, uniq1, uniq2, died1, died2, res; @@ -2306,7 +2274,7 @@ const genericptr vptr2; /* returns -1 if cancelled via ESC */ static int -set_vanq_order() +set_vanq_order(void) { winid tmpwin; menu_item *selected; @@ -2342,7 +2310,7 @@ set_vanq_order() /* #vanquished command */ int -dovanquished() +dovanquished(void) { list_vanquished('a', FALSE); return 0; @@ -2350,7 +2318,7 @@ dovanquished() /* #wizborn extended command */ int -doborn() +doborn(void) { static const char fmt[] = "%4i %4i %c %-30s"; int i; @@ -2388,9 +2356,7 @@ doborn() #define done_stopprint g.program_state.stopprint void -list_vanquished(defquery, ask) -char defquery; -boolean ask; +list_vanquished(char defquery, boolean ask) { register int i; int pfx, nkilled; @@ -2520,7 +2486,7 @@ boolean ask; /* number of monster species which have been genocided */ int -num_genocides() +num_genocides(void) { int i, n = 0; @@ -2536,7 +2502,7 @@ num_genocides() } static int -num_extinct() +num_extinct(void) { int i, n = 0; @@ -2550,9 +2516,7 @@ num_extinct() } void -list_genocided(defquery, ask) -char defquery; -boolean ask; +list_genocided(char defquery, boolean ask) { register int i; int ngenocided, nextinct; @@ -2632,8 +2596,7 @@ boolean ask; */ const char * -align_str(alignment) -aligntyp alignment; +align_str(aligntyp alignment) { switch ((int) alignment) { case A_CHAOTIC: @@ -2650,9 +2613,7 @@ aligntyp alignment; /* used for self-probing */ char * -piousness(showneg, suffix) -boolean showneg; -const char *suffix; +piousness(boolean showneg, const char *suffix) { static char buf[32]; /* bigger than "insufficiently neutral" */ const char *pio; @@ -2692,8 +2653,7 @@ const char *suffix; /* stethoscope or probing applied to monster -- one-line feedback */ void -mstatusline(mtmp) -struct monst *mtmp; +mstatusline(struct monst *mtmp) { aligntyp alignment = mon_aligntyp(mtmp); char info[BUFSZ], monnambuf[BUFSZ]; @@ -2790,7 +2750,7 @@ struct monst *mtmp; /* stethoscope or probing applied to hero -- one-line feedback */ void -ustatusline() +ustatusline(void) { char info[BUFSZ]; diff --git a/src/invent.c b/src/invent.c index afd92389d..06114d455 100644 --- a/src/invent.c +++ b/src/invent.c @@ -13,34 +13,32 @@ #define CONTAINED_SYM '>' /* designator for inside a container */ #define HANDS_SYM '-' -static char *FDECL(loot_xname, (struct obj *)); -static int FDECL(invletter_value, (CHAR_P)); -static int FDECL(CFDECLSPEC sortloot_cmp, (const genericptr, - const genericptr)); -static void NDECL(reorder_invent); -static struct obj *FDECL(addinv_core0, (struct obj *, struct obj *, - BOOLEAN_P)); -static void FDECL(noarmor, (BOOLEAN_P)); -static void FDECL(invdisp_nothing, (const char *, const char *)); -static boolean FDECL(worn_wield_only, (struct obj *)); -static boolean FDECL(only_here, (struct obj *)); -static void FDECL(compactify, (char *)); -static boolean FDECL(taking_off, (const char *)); -static int FDECL(ckvalidcat, (struct obj *)); -static int FDECL(ckunpaid, (struct obj *)); -static char *FDECL(safeq_xprname, (struct obj *)); -static char *FDECL(safeq_shortxprname, (struct obj *)); -static char FDECL(display_pickinv, (const char *, const char *, - const char *, BOOLEAN_P, long *)); -static char FDECL(display_used_invlets, (CHAR_P)); -static boolean FDECL(this_type_only, (struct obj *)); -static void NDECL(dounpaid); -static struct obj *FDECL(find_unpaid, (struct obj *, struct obj **)); -static void FDECL(menu_identify, (int)); -static boolean FDECL(tool_in_use, (struct obj *)); -static int FDECL(adjust_ok, (struct obj *)); -static char FDECL(obj_to_let, (struct obj *)); -static void FDECL(mime_action, (const char *)); +static char *loot_xname(struct obj *); +static int invletter_value(char); +static int CFDECLSPEC sortloot_cmp(const genericptr, const genericptr); +static void reorder_invent(void); +static struct obj *addinv_core0(struct obj *, struct obj *, boolean); +static void noarmor(boolean); +static void invdisp_nothing(const char *, const char *); +static boolean worn_wield_only(struct obj *); +static boolean only_here(struct obj *); +static void compactify(char *); +static boolean taking_off(const char *); +static int ckvalidcat(struct obj *); +static int ckunpaid(struct obj *); +static char *safeq_xprname(struct obj *); +static char *safeq_shortxprname(struct obj *); +static char display_pickinv(const char *, const char *, const char *, + boolean, long *); +static char display_used_invlets(char); +static boolean this_type_only(struct obj *); +static void dounpaid(void); +static struct obj *find_unpaid(struct obj *, struct obj **); +static void menu_identify(int); +static boolean tool_in_use(struct obj *); +static int adjust_ok(struct obj *); +static char obj_to_let(struct obj *); +static void mime_action(const char *); /* wizards can wish for venom, which will become an invisible inventory * item without this. putting it in inv_order would mean venom would @@ -55,9 +53,7 @@ static const char venom_inv[] = { VENOM_CLASS, 0 }; /* (constant) */ /* sortloot() classification; called at most once [per sort] for each object */ void -loot_classify(sort_item, obj) -Loot *sort_item; -struct obj *obj; +loot_classify(Loot *sort_item, struct obj *obj) { /* we may eventually make this a settable option to always use with sortloot instead of only when the 'sortpack' option isn't @@ -215,8 +211,7 @@ struct obj *obj; /* sortloot() formatting routine; for alphabetizing, not shown to user */ static char * -loot_xname(obj) -struct obj *obj; +loot_xname(struct obj *obj) { struct obj saveo; boolean save_debug; @@ -298,8 +293,7 @@ struct obj *obj; } static int -invletter_value(c) -char c; +invletter_value(char c) { return ('a' <= c && c <= 'z') ? (c - 'a' + 2) : ('A' <= c && c <= 'Z') ? (c - 'A' + 2 + 26) @@ -310,9 +304,7 @@ char c; /* qsort comparison routine for sortloot() */ static int CFDECLSPEC -sortloot_cmp(vptr1, vptr2) -const genericptr vptr1; -const genericptr vptr2; +sortloot_cmp(const genericptr vptr1, const genericptr vptr2) { struct sortloot_item *sli1 = (struct sortloot_item *) vptr1, *sli2 = (struct sortloot_item *) vptr2; @@ -478,11 +470,10 @@ const genericptr vptr2; * instead of simple 'struct obj *' entries. */ Loot * -sortloot(olist, mode, by_nexthere, filterfunc) -struct obj **olist; /* previous version might have changed *olist, we don't */ -unsigned mode; /* flags for sortloot_cmp() */ -boolean by_nexthere; /* T: traverse via obj->nexthere, F: via obj->nobj */ -boolean FDECL((*filterfunc), (OBJ_P)); +sortloot(struct obj **olist, /* previous version might have changed *olist, we don't */ + unsigned mode, /* flags for sortloot_cmp() */ + boolean by_nexthere, /* T: traverse via obj->nexthere, F: via obj->nobj */ + boolean (*filterfunc)(OBJ_P)) { Loot *sliarray; struct obj *o; @@ -533,8 +524,7 @@ boolean FDECL((*filterfunc), (OBJ_P)); /* sortloot() callers should use this to free up memory it allocates */ void -unsortloot(loot_array_p) -Loot **loot_array_p; +unsortloot(Loot **loot_array_p) { if (*loot_array_p) free((genericptr_t) *loot_array_p), *loot_array_p = (Loot *) 0; @@ -542,10 +532,9 @@ Loot **loot_array_p; #if 0 /* 3.6.0 'revamp' */ void -sortloot(olist, mode, by_nexthere) -struct obj **olist; -unsigned mode; /* flags for sortloot_cmp() */ -boolean by_nexthere; /* T: traverse via obj->nexthere, F: via obj->nobj */ +sortloot(struct obj **olist, unsigned mode, /* flags for sortloot_cmp() */ + boolean by_nexthere) /* T: traverse via obj->nexthere, + F: via obj->nobj */ { struct sortloot_item *sliarray, osli, nsli; struct obj *o, **nxt_p; @@ -581,8 +570,7 @@ boolean by_nexthere; /* T: traverse via obj->nexthere, F: via obj->nobj */ #endif /*0*/ void -assigninvlet(otmp) -register struct obj *otmp; +assigninvlet(register struct obj *otmp) { boolean inuse[52]; register int i; @@ -627,7 +615,7 @@ register struct obj *otmp; /* sort the inventory; used by addinv() and doorganize() */ static void -reorder_invent() +reorder_invent(void) { struct obj *otmp, *prev, *next; boolean need_more_sorting; @@ -663,8 +651,7 @@ reorder_invent() one of them; used in pickup.c when all 52 inventory slots are in use, to figure out whether another object could still be picked up */ struct obj * -merge_choice(objlist, obj) -struct obj *objlist, *obj; +merge_choice(struct obj *objlist, struct obj *obj) { struct monst *shkp; int save_nocharge; @@ -700,8 +687,7 @@ struct obj *objlist, *obj; /* merge obj with otmp and delete obj if types agree */ int -merged(potmp, pobj) -struct obj **potmp, **pobj; +merged(struct obj **potmp, struct obj **pobj) { register struct obj *otmp = *potmp, *obj = *pobj; @@ -803,8 +789,7 @@ struct obj **potmp, **pobj; * It may be valid to merge this code with with addinv_core2(). */ void -addinv_core1(obj) -struct obj *obj; +addinv_core1(struct obj *obj) { if (obj->oclass == COIN_CLASS) { g.context.botl = 1; @@ -861,8 +846,7 @@ struct obj *obj; * in-place. */ void -addinv_core2(obj) -struct obj *obj; +addinv_core2(struct obj *obj) { if (confers_luck(obj)) { /* new luckstone must be in inventory by this point @@ -876,9 +860,8 @@ struct obj *obj; * Adjust hero attributes as necessary. */ static struct obj * -addinv_core0(obj, other_obj, update_perm_invent) -struct obj *obj, *other_obj; -boolean update_perm_invent; +addinv_core0(struct obj *obj, struct obj *other_obj, + boolean update_perm_invent) { struct obj *otmp, *prev; int saved_otyp = (int) obj->otyp; /* for panic */ @@ -959,16 +942,14 @@ boolean update_perm_invent; /* add obj to the hero's inventory in the default fashion */ struct obj * -addinv(obj) -struct obj *obj; +addinv(struct obj *obj) { return addinv_core0(obj, (struct obj *) 0, TRUE); } /* add obj to the hero's inventory by inserting in front of a specific item */ struct obj * -addinv_before(obj, other_obj) -struct obj *obj, *other_obj; +addinv_before(struct obj *obj, struct obj *other_obj) { return addinv_core0(obj, other_obj, TRUE); } @@ -980,8 +961,7 @@ struct obj *obj, *other_obj; * and after hero's intrinsics have been updated. */ void -carry_obj_effects(obj) -struct obj *obj; +carry_obj_effects(struct obj *obj) { /* Cursed figurines can spontaneously transform when carried. */ if (obj->otyp == FIGURINE) { @@ -1000,9 +980,8 @@ struct obj *obj; * touch_artifact will print its own messages if they are warranted. */ struct obj * -hold_another_object(obj, drop_fmt, drop_arg, hold_msg) -struct obj *obj; -const char *drop_fmt, *drop_arg, *hold_msg; +hold_another_object(struct obj *obj, const char *drop_fmt, + const char *drop_arg, const char *hold_msg) { char buf[BUFSZ]; @@ -1092,8 +1071,7 @@ const char *drop_fmt, *drop_arg, *hold_msg; /* useup() all of an item regardless of its quantity */ void -useupall(obj) -struct obj *obj; +useupall(struct obj *obj) { setnotworn(obj); freeinv(obj); @@ -1101,8 +1079,7 @@ struct obj *obj; } void -useup(obj) -register struct obj *obj; +useup(register struct obj *obj) { /* Note: This works correctly for containers because they (containers) don't merge. */ @@ -1118,9 +1095,8 @@ register struct obj *obj; /* use one charge from an item and possibly incur shop debt for it */ void -consume_obj_charge(obj, maybe_unpaid) -struct obj *obj; -boolean maybe_unpaid; /* false if caller handles shop billing */ +consume_obj_charge(struct obj *obj, + boolean maybe_unpaid) /* false if caller handles shop billing */ { if (maybe_unpaid) check_unpaid(obj); @@ -1137,8 +1113,7 @@ boolean maybe_unpaid; /* false if caller handles shop billing */ * Should think of a better name... */ void -freeinv_core(obj) -struct obj *obj; +freeinv_core(struct obj *obj) { if (obj->oclass == COIN_CLASS) { g.context.botl = 1; @@ -1180,8 +1155,7 @@ struct obj *obj; /* remove an object from the hero's inventory */ void -freeinv(obj) -register struct obj *obj; +freeinv(register struct obj *obj) { extract_nobj(obj, &g.invent); freeinv_core(obj); @@ -1189,8 +1163,7 @@ register struct obj *obj; } void -delallobj(x, y) -int x, y; +delallobj(int x, int y) { struct obj *otmp, *otmp2; @@ -1207,8 +1180,7 @@ int x, y; /* destroy object in fobj chain (if unpaid, it remains on the bill) */ void -delobj(obj) -register struct obj *obj; +delobj(register struct obj *obj) { boolean update_map; @@ -1234,9 +1206,7 @@ register struct obj *obj; /* try to find a particular type of object at designated map location */ struct obj * -sobj_at(otyp, x, y) -int otyp; -int x, y; +sobj_at(int otyp, int x, int y) { register struct obj *otmp; @@ -1249,10 +1219,7 @@ int x, y; /* sobj_at(&c) traversal -- find next object of specified type */ struct obj * -nxtobj(obj, type, by_nexthere) -struct obj *obj; -int type; -boolean by_nexthere; +nxtobj(struct obj *obj, int type, boolean by_nexthere) { register struct obj *otmp; @@ -1267,8 +1234,7 @@ boolean by_nexthere; } struct obj * -carrying(type) -register int type; +carrying(register int type) { register struct obj *otmp; @@ -1306,8 +1272,7 @@ static const char *const currencies[] = { }; const char * -currency(amount) -long amount; +currency(long amount) { const char *res; @@ -1318,7 +1283,7 @@ long amount; } boolean -have_lizard() +have_lizard(void) { register struct obj *otmp; @@ -1329,7 +1294,7 @@ have_lizard() } struct obj * -u_carried_gloves() { +u_carried_gloves(void) { struct obj *otmp, *gloves = (struct obj *) 0; if (uarmg) { @@ -1347,7 +1312,7 @@ u_carried_gloves() { /* 3.6 tribute */ struct obj * -u_have_novel() +u_have_novel(void) { register struct obj *otmp; @@ -1358,9 +1323,7 @@ u_have_novel() } struct obj * -o_on(id, objchn) -unsigned int id; -register struct obj *objchn; +o_on(unsigned int id, register struct obj *objchn) { struct obj *temp; @@ -1375,9 +1338,7 @@ register struct obj *objchn; } boolean -obj_here(obj, x, y) -register struct obj *obj; -int x, y; +obj_here(register struct obj *obj, int x, int y) { register struct obj *otmp; @@ -1388,8 +1349,7 @@ int x, y; } struct obj * -g_at(x, y) -register int x, y; +g_at(register int x, register int y) { register struct obj *obj = g.level.objects[x][y]; @@ -1403,8 +1363,7 @@ register int x, y; /* compact a string of inventory letters by dashing runs of letters */ static void -compactify(buf) -register char *buf; +compactify(register char *buf) { register int i1 = 1, i2 = 1; register char ilet, ilet1, ilet2; @@ -1441,8 +1400,7 @@ register char *buf; /* some objects shouldn't be split when count given to getobj or askchain */ boolean -splittable(obj) -struct obj *obj; +splittable(struct obj *obj) { return !((obj->otyp == LOADSTONE && obj->cursed) || (obj == uwep && welded(uwep))); @@ -1450,15 +1408,13 @@ struct obj *obj; /* match the prompt for either 'T' or 'R' command */ static boolean -taking_off(action) -const char *action; +taking_off(const char *action) { return !strcmp(action, "take off") || !strcmp(action, "remove"); } static void -mime_action(word) -const char *word; +mime_action(const char *word) { char buf[BUFSZ]; char *bp = buf; @@ -1481,8 +1437,7 @@ const char *word; /* getobj callback that allows any object - but not hands. */ int -any_obj_ok(obj) -struct obj *obj; +any_obj_ok(struct obj *obj) { if (obj) return GETOBJ_SUGGEST; @@ -1502,10 +1457,9 @@ struct obj *obj; * it with &cg.zeroobj, so its behavior can be undefined in that case. */ struct obj * -getobj(word, obj_ok, ctrlflags) -register const char *word; -int FDECL((*obj_ok), (OBJ_P)); /* callback */ -unsigned int ctrlflags; +getobj(register const char *word, + int (*obj_ok)(OBJ_P), /* callback */ + unsigned int ctrlflags) { register struct obj *otmp; register char ilet = 0; @@ -1537,7 +1491,7 @@ unsigned int ctrlflags; /* force invent to be in invlet order before collecting candidate inventory letters */ sortedinvent = sortloot(&g.invent, SORTLOOT_INVLET, FALSE, - (boolean FDECL((*), (OBJ_P))) 0); + (boolean (*)(OBJ_P)) 0); for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) { if (&bp[suggested] == &buf[sizeof buf - 1] @@ -1755,12 +1709,11 @@ unsigned int ctrlflags; } void -silly_thing(word, otmp) -const char *word; +silly_thing(const char *word, #ifdef OBSOLETE_HANDLING -struct obj *otmp; + struct obj *otmp) #else -struct obj *otmp UNUSED; + struct obj *otmp UNUSED) #endif { #ifdef OBSOLETE_HANDLING @@ -1793,30 +1746,27 @@ struct obj *otmp UNUSED; } static int -ckvalidcat(otmp) -struct obj *otmp; +ckvalidcat(struct obj *otmp) { /* use allow_category() from pickup.c */ return (int) allow_category(otmp); } static int -ckunpaid(otmp) -struct obj *otmp; +ckunpaid(struct obj *otmp) { return (otmp->unpaid || (Has_contents(otmp) && count_unpaid(otmp->cobj))); } boolean -wearing_armor() +wearing_armor(void) { return (boolean) (uarm || uarmc || uarmf || uarmg || uarmh || uarms || uarmu); } boolean -is_worn(otmp) -struct obj *otmp; +is_worn(struct obj *otmp) { return (otmp->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE | W_WEAPONS)) ? TRUE @@ -1831,8 +1781,7 @@ static struct xprnctx { /* safe_qbuf() -> short_oname() callback */ static char * -safeq_xprname(obj) -struct obj *obj; +safeq_xprname(struct obj *obj) { return xprname(obj, (char *) 0, safeq_xprn_ctx.let, safeq_xprn_ctx.dot, 0L, 0L); @@ -1840,8 +1789,7 @@ struct obj *obj; /* alternate safe_qbuf() -> short_oname() callback */ static char * -safeq_shortxprname(obj) -struct obj *obj; +safeq_shortxprname(struct obj *obj) { return xprname(obj, ansimpleoname(obj), safeq_xprn_ctx.let, safeq_xprn_ctx.dot, 0L, 0L); @@ -1855,14 +1803,12 @@ static NEARDATA const char removeables[] = { ARMOR_CLASS, WEAPON_CLASS, Return the number of times fn was called successfully. If combo is TRUE, we just use this to get a category list. */ int -ggetobj(word, fn, mx, combo, resultflags) -const char *word; -int FDECL((*fn), (OBJ_P)), mx; -boolean combo; /* combination menu flag */ -unsigned *resultflags; +ggetobj(const char *word, int (*fn)(OBJ_P), int mx, + boolean combo, /* combination menu flag */ + unsigned *resultflags) { - int FDECL((*ckfn), (OBJ_P)) = (int FDECL((*), (OBJ_P))) 0; - boolean FDECL((*ofilter), (OBJ_P)) = (boolean FDECL((*), (OBJ_P))) 0; + int (*ckfn)(OBJ_P) = (int (*)(OBJ_P)) 0; + boolean (*ofilter)(OBJ_P) = (boolean (*)(OBJ_P)) 0; boolean takeoff, ident, allflag, m_seen; int itemcount; int oletct, iletct, unpaid, oc_of_sym; @@ -2029,11 +1975,11 @@ unsigned *resultflags; * of objects to be treated. Return the number of objects treated. */ int -askchain(objchn, olets, allflag, fn, ckfn, mx, word) -struct obj **objchn; /* *objchn might change */ -int allflag, mx; -const char *olets, *word; /* olets is an Obj Class char array */ -int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P)); +askchain(struct obj **objchn, /* *objchn might change */ + const char *olets, /* olets is an Obj Class char array */ + int allflag, + int (*fn)(OBJ_P), int (*ckfn)(OBJ_P), + int mx, const char *word) { struct obj *otmp, *otmpo; register char sym, ilet; @@ -2056,7 +2002,7 @@ int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P)); /* someday maybe we'll sort by 'olets' too (temporarily replace flags.packorder and pass SORTLOOT_PACK), but not yet... */ sortedchn = sortloot(objchn, SORTLOOT_INVLET, FALSE, - (boolean FDECL((*), (OBJ_P))) 0); + (boolean (*)(OBJ_P)) 0); first = TRUE; /* @@ -2186,8 +2132,7 @@ int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P)); /* set the cknown and lknown flags on an object if they're applicable */ void -set_cknown_lknown(obj) -struct obj *obj; +set_cknown_lknown(struct obj *obj) { if (Is_container(obj) || obj->otyp == STATUE) obj->cknown = obj->lknown = 1; @@ -2200,8 +2145,7 @@ struct obj *obj; /* make an object actually be identified; no display updating */ void -fully_identify_obj(otmp) -struct obj *otmp; +fully_identify_obj(struct obj *otmp) { makeknown(otmp->otyp); if (otmp->oartifact) @@ -2214,8 +2158,7 @@ struct obj *otmp; /* ggetobj callback routine; identify an object and give immediate feedback */ int -identify(otmp) -struct obj *otmp; +identify(struct obj *otmp) { fully_identify_obj(otmp); prinv((char *) 0, otmp, 0L); @@ -2224,8 +2167,7 @@ struct obj *otmp; /* menu of unidentified objects; select and identify up to id_limit of them */ static void -menu_identify(id_limit) -int id_limit; +menu_identify(int id_limit) { menu_item *pick_list; int n, i, first = 1, tryct = 5; @@ -2262,8 +2204,7 @@ int id_limit; } /* count the unidentified items */ int -count_unidentified(objchn) -struct obj *objchn; +count_unidentified(struct obj *objchn) { int unid_cnt = 0; struct obj *obj; @@ -2276,9 +2217,9 @@ struct obj *objchn; /* dialog with user to identify a given number of items; 0 means all */ void -identify_pack(id_limit, learning_id) -int id_limit; -boolean learning_id; /* true if we just read unknown identify scroll */ +identify_pack(int id_limit, + boolean learning_id) /* true if we just read unknown + identify scroll */ { struct obj *obj; int n, unid_cnt = count_unidentified(g.invent); @@ -2315,7 +2256,7 @@ boolean learning_id; /* true if we just read unknown identify scroll */ /* called when regaining sight; mark inventory objects which were picked up while blind as now having been seen */ void -learn_unseen_invent() +learn_unseen_invent(void) { struct obj *otmp; @@ -2340,7 +2281,7 @@ learn_unseen_invent() (*windowprocs.win_update_inventory) but the restore hackery was getting out of hand; this is now a central call point */ void -update_inventory() +update_inventory(void) { if (g.program_state.saving || g.program_state.restoring) return; @@ -2357,8 +2298,7 @@ update_inventory() /* should of course only be called for things in invent */ static char -obj_to_let(obj) -struct obj *obj; +obj_to_let(struct obj *obj) { if (!flags.invlet_constant) { obj->invlet = NOINVSYM; @@ -2372,10 +2312,7 @@ struct obj *obj; * the current quantity. */ void -prinv(prefix, obj, quan) -const char *prefix; -struct obj *obj; -long quan; +prinv(const char *prefix, struct obj *obj, long quan) { if (!prefix) prefix = ""; @@ -2384,13 +2321,12 @@ long quan; } char * -xprname(obj, txt, let, dot, cost, quan) -struct obj *obj; -const char *txt; /* text to print instead of obj */ -char let; /* inventory letter */ -boolean dot; /* append period; (dot && cost => Iu) */ -long cost; /* cost (for inventory of unpaid or expended items) */ -long quan; /* if non-0, print this quantity, not obj->quan */ +xprname(struct obj *obj, + const char *txt, /* text to print instead of obj */ + char let, /* inventory letter */ + boolean dot, /* append period; (dot && cost => Iu) */ + long cost, /* cost (for inventory of unpaid or expended items) */ + long quan) /* if non-0, print this quantity, not obj->quan */ { #ifdef LINT /* handle static char li[BUFSZ]; */ char li[BUFSZ]; @@ -2431,7 +2367,7 @@ long quan; /* if non-0, print this quantity, not obj->quan */ /* the 'i' command */ int -ddoinv() +ddoinv(void) { (void) display_inventory((char *) 0, FALSE); return 0; @@ -2447,8 +2383,7 @@ ddoinv() * containers. */ static struct obj * -find_unpaid(list, last_found) -struct obj *list, **last_found; +find_unpaid(struct obj *list, struct obj **last_found) { struct obj *obj; @@ -2471,7 +2406,7 @@ struct obj *list, **last_found; } void -free_pickinv_cache() +free_pickinv_cache(void) { if (g.cached_pickinv_win != WIN_ERR) { destroy_nhwindow(g.cached_pickinv_win); @@ -2485,12 +2420,10 @@ free_pickinv_cache() * any count returned from the menu selection is placed here. */ static char -display_pickinv(lets, xtra_choice, query, want_reply, out_cnt) -register const char *lets; -const char *xtra_choice; /* "fingers", pick hands rather than an object */ -const char *query; -boolean want_reply; -long *out_cnt; +display_pickinv(register const char *lets, + const char *xtra_choice, /* "fingers", pick hands rather than + an object */ + const char *query, boolean want_reply, long *out_cnt) { static const char not_carrying_anything[] = "Not carrying anything"; struct obj *otmp, wizid_fakeobj; @@ -2580,7 +2513,7 @@ long *out_cnt; if (flags.sortpack) sortflags |= SORTLOOT_PACK; sortedinvent = sortloot(&g.invent, sortflags, FALSE, - (boolean FDECL((*), (OBJ_P))) 0); + (boolean (*)(OBJ_P)) 0); start_menu(win, MENU_BEHAVE_STANDARD); any = cg.zeroany; @@ -2732,9 +2665,7 @@ long *out_cnt; * was selected. */ char -display_inventory(lets, want_reply) -const char *lets; -boolean want_reply; +display_inventory(const char *lets, boolean want_reply) { return display_pickinv(lets, (char *) 0, (char *) 0, want_reply, (long *) 0); @@ -2745,8 +2676,7 @@ boolean want_reply; * */ static char -display_used_invlets(avoidlet) -char avoidlet; +display_used_invlets(char avoidlet) { struct obj *otmp; char ilet, ret = 0; @@ -2805,8 +2735,7 @@ char avoidlet; * contained objects. */ int -count_unpaid(list) -struct obj *list; +count_unpaid(struct obj *list) { int count = 0; @@ -2828,10 +2757,7 @@ struct obj *list; * at some point: bknown is forced for priest[ess], like in xname(). */ int -count_buc(list, type, filterfunc) -struct obj *list; -int type; -boolean FDECL((*filterfunc), (OBJ_P)); +count_buc(struct obj *list, int type, boolean (*filterfunc)(OBJ_P)) { int count = 0; @@ -2863,10 +2789,8 @@ boolean FDECL((*filterfunc), (OBJ_P)); /* similar to count_buc(), but tallies all states at once rather than looking for a specific type */ void -tally_BUCX(list, by_nexthere, bcp, ucp, ccp, xcp, ocp) -struct obj *list; -boolean by_nexthere; -int *bcp, *ucp, *ccp, *xcp, *ocp; +tally_BUCX(struct obj *list, boolean by_nexthere, + int *bcp, int *ucp, int *ccp, int *xcp, int *ocp) { /* Future extensions: * Skip current_container when list is invent, uchain when @@ -2901,14 +2825,14 @@ int *bcp, *ucp, *ccp, *xcp, *ocp; /* count everything inside a container, or just shop-owned items inside */ long -count_contents(container, nested, quantity, everything, newdrop) -struct obj *container; -boolean nested, /* include contents of any nested containers */ - quantity, /* count all vs count separate stacks */ - everything, /* all objects vs only unpaid objects */ - newdrop; /* on floor, but hero-owned items haven't been marked - * no_charge yet and shop-owned items are still marked - * unpaid -- used when asking the player whether to sell */ +count_contents(struct obj *container, + boolean nested, /* include contents of any nested containers */ + boolean quantity, /* count all vs count separate stacks */ + boolean everything, /* all objects vs only unpaid objects */ + boolean newdrop) /* on floor, but hero-owned items haven't + * been marked no_charge yet and shop-owned + * items are still marked unpaid -- used + * when asking the player whether to sell */ { struct obj *otmp, *topc; boolean shoppy = FALSE; @@ -2934,7 +2858,7 @@ boolean nested, /* include contents of any nested containers */ } static void -dounpaid() +dounpaid(void) { winid win; struct obj *otmp, *marker, *contnr; @@ -3036,8 +2960,7 @@ dounpaid() static boolean -this_type_only(obj) -struct obj *obj; +this_type_only(struct obj *obj) { boolean res = (obj->oclass == g.this_type); @@ -3069,7 +2992,7 @@ struct obj *obj; /* the 'I' command */ int -dotypeinv() +dotypeinv(void) { char c = '\0'; int n, i = 0; @@ -3115,7 +3038,7 @@ dotypeinv() /* collect list of classes of objects carried, for use as a prompt */ types[0] = 0; class_count = collect_obj_classes(types, g.invent, FALSE, - (boolean FDECL((*), (OBJ_P))) 0, + (boolean (*)(OBJ_P)) 0, &itemcount); if (unpaid_count || billx || (bcnt + ccnt + ucnt + xcnt) != 0) types[class_count++] = ' '; @@ -3237,9 +3160,7 @@ dotypeinv() /* return a string describing the dungeon feature at if there is one worth mentioning at that location; otherwise null */ const char * -dfeature_at(x, y, buf) -int x, y; -char *buf; +dfeature_at(int x, int y, char *buf) { struct rm *lev = &levl[x][y]; int ltyp = lev->typ, cmap = -1; @@ -3315,9 +3236,8 @@ char *buf; /* look at what is here; if there are many objects (pile_limit or more), don't show them unless obj_cnt is 0 */ int -look_here(obj_cnt, lookhere_flags) -int obj_cnt; /* obj_cnt > 0 implies that autopickup is in progress */ -unsigned lookhere_flags; +look_here(int obj_cnt, /* obj_cnt > 0 implies that autopickup is in progress */ + unsigned lookhere_flags) { struct obj *otmp; struct trap *trap; @@ -3491,7 +3411,7 @@ unsigned lookhere_flags; /* the ':' command - explicitly look at what is here, including all objects */ int -dolook() +dolook(void) { int res; @@ -3506,9 +3426,7 @@ dolook() } boolean -will_feel_cockatrice(otmp, force_touch) -struct obj *otmp; -boolean force_touch; +will_feel_cockatrice(struct obj *otmp, boolean force_touch) { if ((Blind || force_touch) && !uarmg && !Stone_resistance && (otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]))) @@ -3517,9 +3435,7 @@ boolean force_touch; } void -feel_cockatrice(otmp, force_touch) -struct obj *otmp; -boolean force_touch; +feel_cockatrice(struct obj *otmp, boolean force_touch) { char kbuf[BUFSZ]; @@ -3540,8 +3456,7 @@ boolean force_touch; } void -stackobj(obj) -struct obj *obj; +stackobj(struct obj *obj) { struct obj *otmp; @@ -3553,8 +3468,7 @@ struct obj *obj; /* returns TRUE if obj & otmp can be merged; used in invent.c and mkobj.c */ boolean -mergable(otmp, obj) -register struct obj *otmp, *obj; +mergable(register struct obj *otmp, register struct obj *obj) { int objnamelth = 0, otmpnamelth = 0; @@ -3662,7 +3576,7 @@ register struct obj *otmp, *obj; /* the '$' command */ int -doprgold() +doprgold(void) { /* the messages used to refer to "carrying gold", but that didn't take containers into account */ @@ -3678,7 +3592,7 @@ doprgold() /* the ')' command */ int -doprwep() +doprwep(void) { if (!uwep) { You("are empty %s.", body_part(HANDED)); @@ -3692,8 +3606,7 @@ doprwep() /* caller is responsible for checking !wearing_armor() */ static void -noarmor(report_uskin) -boolean report_uskin; +noarmor(boolean report_uskin) { if (!uskin || !report_uskin) { You("are not wearing any armor."); @@ -3716,7 +3629,7 @@ boolean report_uskin; /* the '[' command */ int -doprarm() +doprarm(void) { char lets[8]; register int ct = 0; @@ -3751,7 +3664,7 @@ doprarm() /* the '=' command */ int -doprring() +doprring(void) { if (!uleft && !uright) You("are not wearing any rings."); @@ -3771,7 +3684,7 @@ doprring() /* the '"' command */ int -dopramulet() +dopramulet(void) { if (!uamul) You("are not wearing an amulet."); @@ -3781,8 +3694,7 @@ dopramulet() } static boolean -tool_in_use(obj) -struct obj *obj; +tool_in_use(struct obj *obj) { if ((obj->owornmask & (W_TOOL | W_SADDLE)) != 0L) return TRUE; @@ -3794,7 +3706,7 @@ struct obj *obj; /* the '(' command */ int -doprtool() +doprtool(void) { struct obj *otmp; int ct = 0; @@ -3814,7 +3726,7 @@ doprtool() /* '*' command; combines the ')' + '[' + '=' + '"' + '(' commands; show inventory of all currently wielded, worn, or used objects */ int -doprinuse() +doprinuse(void) { struct obj *otmp; int ct = 0; @@ -3835,9 +3747,7 @@ doprinuse() * uses up an object that's on the floor, charging for it as necessary */ void -useupf(obj, numused) -register struct obj *obj; -long numused; +useupf(register struct obj *obj, long numused) { register struct obj *otmp; boolean at_u = (obj->ox == u.ux && obj->oy == u.uy); @@ -3872,9 +3782,7 @@ static NEARDATA const char oth_symbols[] = { CONTAINED_SYM, '\0' }; static NEARDATA const char *oth_names[] = { "Bagged/Boxed items" }; char * -let_to_name(let, unpaid, showsym) -char let; -boolean unpaid, showsym; +let_to_name(char let, boolean unpaid, boolean showsym) { const char *ocsymfmt = " ('%c')"; const int invbuf_sympadding = 8; /* arbitrary */ @@ -3917,7 +3825,7 @@ boolean unpaid, showsym; /* release the static buffer used by let_to_name() */ void -free_invbuf() +free_invbuf(void) { if (g.invbuf) free((genericptr_t) g.invbuf), g.invbuf = (char *) 0; @@ -3927,7 +3835,7 @@ free_invbuf() /* give consecutive letters to every item in inventory (for !fixinv mode); gold is always forced to '$' slot at head of list */ void -reassign() +reassign(void) { int i; struct obj *obj, *prevobj, *goldobj; @@ -3960,8 +3868,7 @@ reassign() /* getobj callback for item to #adjust */ int -adjust_ok(obj) -struct obj *obj; +adjust_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -4036,7 +3943,7 @@ struct obj *obj; * is unnamed and source is named. */ int -doorganize() /* inventory organizer by Del Lamb */ +doorganize(void) /* inventory organizer by Del Lamb */ { struct obj *obj, *otmp, *splitting, *bumped; int ix, cur, trycnt; @@ -4249,8 +4156,7 @@ doorganize() /* inventory organizer by Del Lamb */ /* common to display_minventory and display_cinventory */ static void -invdisp_nothing(hdr, txt) -const char *hdr, *txt; +invdisp_nothing(const char *hdr, const char *txt) { winid win; anything any; @@ -4274,8 +4180,7 @@ const char *hdr, *txt; /* query_objlist callback: return things that are worn or wielded */ static boolean -worn_wield_only(obj) -struct obj *obj; +worn_wield_only(struct obj *obj) { #if 1 /* check for things that *are* worn or wielded (only used for monsters, @@ -4307,10 +4212,7 @@ struct obj *obj; * MINV_ALL - display all inventory */ struct obj * -display_minventory(mon, dflags, title) -register struct monst *mon; -int dflags; -char *title; +display_minventory(register struct monst *mon, int dflags, char *title) { struct obj *ret; char tmp[QBUFSZ]; @@ -4358,8 +4260,7 @@ char *title; * Currently, this is only used for statues, via wand of probing. */ struct obj * -display_cinventory(obj) -register struct obj *obj; +display_cinventory(register struct obj *obj) { struct obj *ret; char qbuf[QBUFSZ]; @@ -4387,8 +4288,7 @@ register struct obj *obj; static boolean -only_here(obj) -struct obj *obj; +only_here(struct obj *obj) { return (obj->ox == g.only.x && obj->oy == g.only.y); } @@ -4400,9 +4300,7 @@ struct obj *obj; * Currently, this is only used with a wand of probing zapped downwards. */ int -display_binventory(x, y, as_if_seen) -int x, y; -boolean as_if_seen; +display_binventory(int x, int y, boolean as_if_seen) { struct obj *obj; menu_item *selected = 0; diff --git a/src/light.c b/src/light.c index 26f832777..60dd07e3e 100644 --- a/src/light.c +++ b/src/light.c @@ -41,11 +41,10 @@ #define LSF_SHOW 0x1 /* display the light source */ #define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */ -static light_source *FDECL(new_light_core, (XCHAR_P, XCHAR_P, int, int, - anything *)); -static void NDECL(discard_flashes); -static void FDECL(write_ls, (NHFILE *, light_source *)); -static int FDECL(maybe_write_ls, (NHFILE *, int, BOOLEAN_P)); +static light_source *new_light_core(xchar, xchar, int, int, anything *); +static void discard_flashes(void); +static void write_ls(NHFILE *, light_source *); +static int maybe_write_ls(NHFILE *, int, boolean); /* imported from vision.c, for small circles */ extern xchar circle_data[]; @@ -55,20 +54,14 @@ extern xchar circle_start[]; /* Create a new light source. Caller (and extern.h) doesn't need to know anything about type 'light_source'. */ void -new_light_source(x, y, range, type, id) - xchar x, y; - int range, type; - anything *id; +new_light_source(xchar x, xchar y, int range, int type, anything *id) { (void) new_light_core(x, y, range, type, id); } /* Create a new light source and return it. Only used within this file. */ static light_source * -new_light_core(x, y, range, type, id) - xchar x, y; - int range, type; - anything *id; +new_light_core(xchar x, xchar y, int range, int type, anything *id) { light_source *ls; @@ -99,9 +92,7 @@ new_light_core(x, y, range, type, id) * to an object at a time. */ void -del_light_source(type, id) -int type; -anything *id; +del_light_source(int type, anything *id) { light_source *curr, *prev; anything tmp_id; @@ -143,8 +134,7 @@ anything *id; /* Mark locations that are temporarily lit via mobile light sources. */ void -do_light_sources(cs_rows) -xchar **cs_rows; +do_light_sources(xchar **cs_rows) { int x, y, min_x, max_x, max_y, offset; xchar *limits; @@ -231,9 +221,7 @@ xchar **cs_rows; remember terrain, objects, and monsters being revealed; if 'obj' is Null, is being hit by a camera's light flash */ void -show_transient_light(obj, x, y) -struct obj *obj; -int x, y; +show_transient_light(struct obj *obj, int x, int y) { light_source *ls = 0; anything cameraflash; @@ -301,7 +289,7 @@ int x, y; monster" glyph at locations where a monster was flagged for being visible during transient light movement but can't be seen now */ void -transient_light_cleanup() +transient_light_cleanup(void) { struct monst *mon; int mtempcount; @@ -332,7 +320,7 @@ transient_light_cleanup() /* camera flashes have Null object; caller wants to get rid of them now */ static void -discard_flashes() +discard_flashes(void) { light_source *ls, *nxt_ls; @@ -349,9 +337,7 @@ discard_flashes() #define mon_is_local(mon) ((mon)->mx > 0) struct monst * -find_mid(nid, fmflags) -unsigned nid; -unsigned fmflags; +find_mid(unsigned nid, unsigned fmflags) { struct monst *mtmp; @@ -374,9 +360,7 @@ unsigned fmflags; /* Save all light sources of the given range. */ void -save_light_sources(nhfp, range) -NHFILE *nhfp; -int range; +save_light_sources(NHFILE *nhfp, int range) { int count, actual, is_global; light_source **prev, *curr; @@ -434,8 +418,7 @@ int range; * pointers. */ void -restore_light_sources(nhfp) -NHFILE *nhfp; +restore_light_sources(NHFILE *nhfp) { int count = 0; light_source *ls; @@ -455,10 +438,7 @@ NHFILE *nhfp; /* to support '#stats' wizard-mode command */ void -light_stats(hdrfmt, hdrbuf, count, size) -const char *hdrfmt; -char *hdrbuf; -long *count, *size; +light_stats(const char *hdrfmt, char *hdrbuf, long *count, long *size) { light_source *ls; @@ -472,8 +452,7 @@ long *count, *size; /* Relink all lights that are so marked. */ void -relink_light_sources(ghostly) -boolean ghostly; +relink_light_sources(boolean ghostly) { char which; unsigned nid; @@ -511,10 +490,7 @@ boolean ghostly; * the light source out. */ static int -maybe_write_ls(nhfp, range, write_it) -NHFILE *nhfp; -int range; -boolean write_it; +maybe_write_ls(NHFILE *nhfp, int range, boolean write_it) { int count = 0, is_global; light_source *ls; @@ -549,7 +525,7 @@ boolean write_it; } void -light_sources_sanity_check() +light_sources_sanity_check(void) { light_source *ls; struct monst *mtmp; @@ -577,9 +553,7 @@ light_sources_sanity_check() /* Write a light source structure to disk. */ static void -write_ls(nhfp, ls) -NHFILE *nhfp; -light_source *ls; +write_ls(NHFILE *nhfp, light_source *ls) { anything arg_save; struct obj *otmp; @@ -620,8 +594,7 @@ light_source *ls; /* Change light source's ID from src to dest. */ void -obj_move_light_source(src, dest) -struct obj *src, *dest; +obj_move_light_source(struct obj *src, struct obj *dest) { light_source *ls; @@ -634,7 +607,7 @@ struct obj *src, *dest; /* return true if there exist any light sources */ boolean -any_light_source() +any_light_source(void) { return (boolean) (g.light_base != (light_source *) 0); } @@ -644,8 +617,7 @@ any_light_source() * only for burning light sources. */ void -snuff_light_source(x, y) -int x, y; +snuff_light_source(int x, int y) { light_source *ls; struct obj *obj; @@ -679,8 +651,7 @@ int x, y; /* Return TRUE if object sheds any light at all. */ boolean -obj_sheds_light(obj) -struct obj *obj; +obj_sheds_light(struct obj *obj) { /* so far, only burning objects shed light */ return obj_is_burning(obj); @@ -688,8 +659,7 @@ struct obj *obj; /* Return TRUE if sheds light AND will be snuffed by end_burn(). */ boolean -obj_is_burning(obj) -struct obj *obj; +obj_is_burning(struct obj *obj) { return (boolean) (obj->lamplit && (ignitable(obj) || artifact_light(obj))); @@ -697,8 +667,7 @@ struct obj *obj; /* copy the light source(s) attached to src, and attach it/them to dest */ void -obj_split_light_source(src, dest) -struct obj *src, *dest; +obj_split_light_source(struct obj *src, struct obj *dest) { light_source *ls, *new_ls; @@ -727,8 +696,7 @@ struct obj *src, *dest; /* light source `src' has been folded into light source `dest'; used for merging lit candles and adding candle(s) to lit candelabrum */ void -obj_merge_light_sources(src, dest) -struct obj *src, *dest; +obj_merge_light_sources(struct obj *src, struct obj *dest) { light_source *ls; @@ -746,9 +714,7 @@ struct obj *src, *dest; /* light source `obj' is being made brighter or dimmer */ void -obj_adjust_light_radius(obj, new_radius) -struct obj *obj; -int new_radius; +obj_adjust_light_radius(struct obj *obj, int new_radius) { light_source *ls; @@ -765,8 +731,7 @@ int new_radius; /* Candlelight is proportional to the number of candles; minimum range is 2 rather than 1 for playability. */ int -candle_light_range(obj) -struct obj *obj; +candle_light_range(struct obj *obj) { int radius; @@ -804,8 +769,7 @@ struct obj *obj; /* light emitting artifact's range depends upon its curse/bless state */ int -arti_light_radius(obj) -struct obj *obj; +arti_light_radius(struct obj *obj) { /* * Used by begin_burn() when setting up a new light source @@ -826,8 +790,7 @@ struct obj *obj; /* adverb describing lit artifact's light; depends on curse/bless state */ const char * -arti_light_description(obj) -struct obj *obj; +arti_light_description(struct obj *obj) { switch (arti_light_radius(obj)) { case 3: @@ -843,7 +806,7 @@ struct obj *obj; } int -wiz_light_sources() +wiz_light_sources(void) { winid win; char buf[BUFSZ]; diff --git a/src/lock.c b/src/lock.c index b14256856..b02a852ed 100644 --- a/src/lock.c +++ b/src/lock.c @@ -6,16 +6,15 @@ #include "hack.h" /* occupation callbacks */ -static int NDECL(picklock); -static int NDECL(forcelock); +static int picklock(void); +static int forcelock(void); -static const char *NDECL(lock_action); -static boolean FDECL(obstructed, (int, int, BOOLEAN_P)); -static void FDECL(chest_shatter_msg, (struct obj *)); +static const char *lock_action(void); +static boolean obstructed(int, int, boolean); +static void chest_shatter_msg(struct obj *); boolean -picking_lock(x, y) -int *x, *y; +picking_lock(int *x, int *y) { if (g.occupation == picklock) { *x = u.ux + u.dx; @@ -28,15 +27,14 @@ int *x, *y; } boolean -picking_at(x, y) -int x, y; +picking_at(int x, int y) { return (boolean) (g.occupation == picklock && g.xlock.door == &levl[x][y]); } /* produce an occupation string appropriate for the current activity */ static const char * -lock_action() +lock_action(void) { /* "unlocking"+2 == "locking" */ static const char *actions[] = { @@ -66,7 +64,7 @@ lock_action() /* try to open/close a lock */ static int -picklock(VOID_ARGS) +picklock(void) { if (g.xlock.box) { if (g.xlock.box->where != OBJ_FLOOR @@ -157,9 +155,7 @@ picklock(VOID_ARGS) } void -breakchestlock(box, destroyit) -struct obj *box; -boolean destroyit; +breakchestlock(struct obj *box, boolean destroyit) { if (!destroyit) { /* bill for the box but not for its contents */ struct obj *hide_contents = box->cobj; @@ -212,7 +208,7 @@ boolean destroyit; /* try to force a locked chest */ static int -forcelock(VOID_ARGS) +forcelock(void) { if ((g.xlock.box->ox != u.ux) || (g.xlock.box->oy != u.uy)) return ((g.xlock.usedtime = 0)); /* you or it moved */ @@ -255,7 +251,7 @@ forcelock(VOID_ARGS) } void -reset_pick() +reset_pick(void) { g.xlock.usedtime = g.xlock.chance = g.xlock.picktyp = 0; g.xlock.magic_key = FALSE; @@ -265,8 +261,7 @@ reset_pick() /* level change or object deletion; context may no longer be valid */ void -maybe_reset_pick(container) -struct obj *container; /* passed from obfree() */ +maybe_reset_pick(struct obj *container) /* passed from obfree() */ { /* * If a specific container, only clear context if it is for that @@ -286,8 +281,7 @@ struct obj *container; /* passed from obfree() */ /* pick a tool for autounlock */ struct obj * -autokey(opening) -boolean opening; /* True: key, pick, or card; False: key or pick */ +autokey(boolean opening) /* True: key, pick, or card; False: key or pick */ { struct obj *o, *key, *pick, *card, *akey, *apick, *acard; @@ -354,11 +348,11 @@ boolean opening; /* True: key, pick, or card; False: key or pick */ /* player is applying a key, lock pick, or credit card */ int -pick_lock(pick, rx, ry, container) -struct obj *pick; -xchar rx, ry; /* coordinates of doors/container, for autounlock: does not - prompt for direction if these are set */ -struct obj *container; /* container, for autounlock */ +pick_lock(struct obj *pick, + xchar rx, xchar ry, /* coordinates of doors/container, + for autounlock: does not prompt + for direction if these are set */ + struct obj *container) /* container, for autounlock */ { int picktyp, c, ch; coord cc; @@ -608,7 +602,7 @@ struct obj *container; /* container, for autounlock */ /* try to force a chest with your weapon */ int -doforce() +doforce(void) { register struct obj *otmp; register int c, picktyp; @@ -688,8 +682,7 @@ doforce() } boolean -stumble_on_door_mimic(x, y) -int x, y; +stumble_on_door_mimic(int x, int y) { struct monst *mtmp; @@ -703,15 +696,14 @@ int x, y; /* the 'O' command - try to open a door */ int -doopen() +doopen(void) { return doopen_indir(0, 0); } /* try to open a door in direction u.dx/u.dy */ int -doopen_indir(x, y) -int x, y; +doopen_indir(int x, int y) { coord cc; register struct rm *door; @@ -825,9 +817,7 @@ int x, y; } static boolean -obstructed(x, y, quietly) -register int x, y; -boolean quietly; +obstructed(register int x, register int y, boolean quietly) { register struct monst *mtmp = m_at(x, y); @@ -860,7 +850,7 @@ boolean quietly; /* the 'C' command - try to close a door */ int -doclose() +doclose(void) { register int x, y; register struct rm *door; @@ -958,8 +948,7 @@ doclose() /* box obj was hit with spell or wand effect otmp; returns true if something happened */ boolean -boxlock(obj, otmp) -struct obj *obj, *otmp; /* obj *is* a box */ +boxlock(struct obj *obj, struct obj *otmp) /* obj *is* a box */ { boolean res = 0; @@ -1004,9 +993,7 @@ struct obj *obj, *otmp; /* obj *is* a box */ /* Door/secret door was hit with spell or wand effect otmp; returns true if something happened */ boolean -doorlock(otmp, x, y) -struct obj *otmp; -int x, y; +doorlock(struct obj *otmp, int x, int y) { register struct rm *door = &levl[x][y]; boolean res = TRUE; @@ -1158,8 +1145,7 @@ int x, y; } static void -chest_shatter_msg(otmp) -struct obj *otmp; +chest_shatter_msg(struct obj *otmp) { const char *disposition; const char *thing; diff --git a/src/mail.c b/src/mail.c index 1eeae3118..cbcaa9f3c 100644 --- a/src/mail.c +++ b/src/mail.c @@ -40,10 +40,10 @@ * random intervals. */ -static boolean FDECL(md_start, (coord *)); -static boolean FDECL(md_stop, (coord *, coord *)); -static boolean FDECL(md_rush, (struct monst *, int, int)); -static void FDECL(newmail, (struct mail_info *)); +static boolean md_start(coord *); +static boolean md_stop(coord *, coord *); +static boolean md_rush(struct monst *, int, int); +static void newmail(struct mail_info *); #if !defined(UNIX) && !defined(VMS) int mustgetmail = -1; @@ -57,9 +57,9 @@ int mustgetmail = -1; #if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__)) /* DO trust all SVR4 to typedef uid_t in (probably to a long) */ #if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX) -extern struct passwd *FDECL(getpwuid, (uid_t)); +extern struct passwd *getpwuid(uid_t); #else -extern struct passwd *FDECL(getpwuid, (int)); +extern struct passwd *getpwuid(int); #endif #endif #endif @@ -84,14 +84,14 @@ static long laststattime; #endif void -free_maildata() +free_maildata(void) { if (mailbox) free((genericptr_t) mailbox), mailbox = (char *) 0; } void -getmailstatus() +getmailstatus(void) { if (mailbox) { ; /* no need to repeat the setup */ @@ -143,8 +143,7 @@ getmailstatus() * from newmail() and newphone(). */ static boolean -md_start(startp) -coord *startp; +md_start(coord *startp) { coord testcc; /* scratch coordinates */ int row; /* current row we are checking */ @@ -242,9 +241,8 @@ coord *startp; * its point randomly, which is not what we want. */ static boolean -md_stop(stopp, startp) -coord *stopp; /* stopping position (we fill it in) */ -coord *startp; /* starting position (read only) */ +md_stop(coord *stopp, /* stopping position (we fill it in) */ + coord *startp) /* starting position (read only) */ { int x, y, distance, min_distance = -1; @@ -283,9 +281,8 @@ static NEARDATA const char *mail_text[] = { "Gangway!", "Look out!", * TRUE otherwise. */ static boolean -md_rush(md, tx, ty) -struct monst *md; -register int tx, ty; /* destination of mail daemon */ +md_rush(struct monst *md, + register int tx, register int ty) /* destination of mail daemon */ { struct monst *mon; /* displaced monster */ register int dx, dy; /* direction counters */ @@ -386,8 +383,7 @@ register int tx, ty; /* destination of mail daemon */ /* Deliver a scroll of mail. */ /*ARGSUSED*/ static void -newmail(info) -struct mail_info *info; +newmail(struct mail_info *info) { struct monst *md; coord start, stop; @@ -437,7 +433,7 @@ struct mail_info *info; #if !defined(UNIX) && !defined(VMS) void -ckmailstatus() +ckmailstatus(void) { if (u.uswallow || !flags.biff) return; @@ -458,8 +454,7 @@ ckmailstatus() /*ARGSUSED*/ void -readmail(otmp) -struct obj *otmp UNUSED; +readmail(struct obj *otmp UNUSED) { static const char *junk[] = { "Report bugs to <%s>.", /*** must be first entry ***/ @@ -532,7 +527,7 @@ struct obj *otmp UNUSED; #ifdef UNIX void -ckmailstatus() +ckmailstatus(void) { ck_server_admin_msg(); @@ -570,9 +565,7 @@ ckmailstatus() #if defined(SIMPLE_MAIL) || defined(SERVER_ADMIN_MSG) void -read_simplemail(mbox, adminmsg) -char *mbox; -boolean adminmsg; +read_simplemail(char *mbox, boolean adminmsg) { FILE* mb = fopen(mbox, "r"); char curline[128], *msg; @@ -657,7 +650,7 @@ boolean adminmsg; #endif /* SIMPLE_MAIL */ void -ck_server_admin_msg() +ck_server_admin_msg(void) { #ifdef SERVER_ADMIN_MSG static struct stat ost,nst; @@ -676,8 +669,7 @@ ck_server_admin_msg() /*ARGSUSED*/ void -readmail(otmp) -struct obj *otmp UNUSED; +readmail(struct obj *otmp UNUSED) { #ifdef DEF_MAILREADER /* This implies that UNIX is defined */ register const char *mr = 0; @@ -712,12 +704,12 @@ struct obj *otmp UNUSED; #ifdef VMS -extern NDECL(struct mail_info *parse_next_broadcast); +extern struct mail_info *parse_next_broadcast(void); volatile int broadcasts = 0; void -ckmailstatus() +ckmailstatus(void) { struct mail_info *brdcst; @@ -736,8 +728,7 @@ ckmailstatus() } void -readmail(otmp) -struct obj *otmp; +readmail(struct obj *otmp) { #ifdef SHELL /* can't access mail reader without spawning subprocess */ const char *txt, *cmd; diff --git a/src/makemon.c b/src/makemon.c index 0199cedb4..87bd30d0a 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -14,22 +14,21 @@ (mptr->mlet == S_HUMAN && Role_if(role_pm) \ && (mptr->msound == MS_LEADER || mptr->msound == MS_NEMESIS)) -static boolean FDECL(uncommon, (int)); -static int FDECL(align_shift, (struct permonst *)); -static boolean FDECL(mk_gen_ok, (int, unsigned, unsigned)); -static boolean FDECL(wrong_elem_type, (struct permonst *)); -static void FDECL(m_initgrp, (struct monst *, int, int, int, int)); -static void FDECL(m_initthrow, (struct monst *, int, int)); -static void FDECL(m_initweap, (struct monst *)); -static void FDECL(m_initinv, (struct monst *)); -static boolean FDECL(makemon_rnd_goodpos, (struct monst *, long, coord *)); +static boolean uncommon(int); +static int align_shift(struct permonst *); +static boolean mk_gen_ok(int, unsigned, unsigned); +static boolean wrong_elem_type(struct permonst *); +static void m_initgrp(struct monst *, int, int, int, int); +static void m_initthrow(struct monst *, int, int); +static void m_initweap(struct monst *); +static void m_initinv(struct monst *); +static boolean makemon_rnd_goodpos(struct monst *, long, coord *); #define m_initsgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 3, mmf) #define m_initlgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 10, mmf) boolean -is_home_elemental(ptr) -struct permonst *ptr; +is_home_elemental(struct permonst *ptr) { if (ptr->mlet == S_ELEMENTAL) switch (monsndx(ptr)) { @@ -49,8 +48,7 @@ struct permonst *ptr; * Return true if the given monster cannot exist on this elemental level. */ static boolean -wrong_elem_type(ptr) -struct permonst *ptr; +wrong_elem_type(struct permonst *ptr) { if (ptr->mlet == S_ELEMENTAL) { return (boolean) !is_home_elemental(ptr); @@ -73,9 +71,7 @@ struct permonst *ptr; /* make a group just like mtmp */ static void -m_initgrp(mtmp, x, y, n, mmflags) -struct monst *mtmp; -int x, y, n, mmflags; +m_initgrp(struct monst *mtmp, int x, int y, int n, int mmflags) { coord mm; register int cnt = rnd(n); @@ -142,9 +138,7 @@ int x, y, n, mmflags; static void -m_initthrow(mtmp, otyp, oquan) -struct monst *mtmp; -int otyp, oquan; +m_initthrow(struct monst *mtmp, int otyp, int oquan) { register struct obj *otmp; @@ -157,8 +151,7 @@ int otyp, oquan; } static void -m_initweap(mtmp) -register struct monst *mtmp; +m_initweap(register struct monst *mtmp) { register struct permonst *ptr = mtmp->data; register int mm = monsndx(ptr); @@ -558,9 +551,7 @@ register struct monst *mtmp; * Makes up money for monster's inventory. */ void -mkmonmoney(mtmp, amount) -struct monst *mtmp; -long amount; +mkmonmoney(struct monst *mtmp, long amount) { struct obj *gold = mksobj(GOLD_PIECE, FALSE, FALSE); @@ -569,8 +560,7 @@ long amount; } static void -m_initinv(mtmp) -register struct monst *mtmp; +m_initinv(register struct monst *mtmp) { register int cnt; register struct obj *otmp; @@ -815,9 +805,8 @@ register struct monst *mtmp; /* Note: for long worms, always call cutworm (cutworm calls clone_mon) */ struct monst * -clone_mon(mon, x, y) -struct monst *mon; -xchar x, y; /* clone's preferred location or 0 (near mon) */ +clone_mon(struct monst *mon, + xchar x, xchar y) /* clone's preferred location or 0 (near mon) */ { coord mm; struct monst *m2; @@ -934,10 +923,7 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */ * TRUE propagation successful */ boolean -propagate(mndx, tally, ghostly) -int mndx; -boolean tally; -boolean ghostly; +propagate(int mndx, boolean tally, boolean ghostly) { boolean gone, result; int lim = mbirth_limit(mndx); @@ -965,8 +951,7 @@ boolean ghostly; /* amount of HP to lose from level drain (or gain from Stormbringer) */ int -monhp_per_lvl(mon) -struct monst *mon; +monhp_per_lvl(struct monst *mon) { struct permonst *ptr = mon->data; int hp = rnd(8); /* default is d8 */ @@ -992,9 +977,7 @@ struct monst *mon; /* set up a new monster's initial level and hit points; used by newcham() as well as by makemon() */ void -newmonhp(mon, mndx) -struct monst *mon; -int mndx; +newmonhp(struct monst *mon, int mndx) { struct permonst *ptr = &mons[mndx]; int basehp = 0; @@ -1041,15 +1024,14 @@ int mndx; static const struct mextra zeromextra = DUMMY; static void -init_mextra(mex) -struct mextra *mex; +init_mextra(struct mextra *mex) { *mex = zeromextra; mex->mcorpsenm = NON_PM; } struct mextra * -newmextra() +newmextra(void) { struct mextra *mextra; @@ -1059,10 +1041,7 @@ newmextra() } static boolean -makemon_rnd_goodpos(mon, gpflags, cc) -struct monst *mon; -long gpflags; -coord *cc; +makemon_rnd_goodpos(struct monst *mon, long gpflags, coord *cc) { int tryct = 0; int nx, ny; @@ -1127,10 +1106,8 @@ coord *cc; * In case we make a monster group, only return the one at [x,y]. */ struct monst * -makemon(ptr, x, y, mmflags) -register struct permonst *ptr; -register int x, y; -long mmflags; +makemon(register struct permonst *ptr, + register int x, register int y, long mmflags) { register struct monst *mtmp; struct monst fakemon; @@ -1435,9 +1412,7 @@ long mmflags; /* caller rejects makemon()'s result; always returns Null */ struct monst * -unmakemon(mon, mmflags) -struct monst *mon; -long mmflags; +unmakemon(struct monst *mon, long mmflags) { boolean countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0); int mndx = monsndx(mon->data); @@ -1462,8 +1437,7 @@ long mmflags; } int -mbirth_limit(mndx) -int mndx; +mbirth_limit(int mndx) { /* There is an implicit limit of 4 for "high priest of ", * but aligned priests can grow into high priests, thus they aren't @@ -1477,10 +1451,9 @@ int mndx; /* used for wand/scroll/spell of create monster */ /* returns TRUE iff you know monsters have been created */ boolean -create_critters(cnt, mptr, neverask) -int cnt; -struct permonst *mptr; /* usually null; used for confused reading */ -boolean neverask; +create_critters(int cnt, + struct permonst *mptr, /* usually null; used for confused reading */ + boolean neverask) { coord c; int x, y; @@ -1514,8 +1487,7 @@ boolean neverask; } static boolean -uncommon(mndx) -int mndx; +uncommon(int mndx) { if (mons[mndx].geno & (G_NOGEN | G_UNIQ)) return TRUE; @@ -1533,8 +1505,7 @@ int mndx; * return an integer in the range of 0-5. */ static int -align_shift(ptr) -register struct permonst *ptr; +align_shift(register struct permonst *ptr) { static NEARDATA long oldmoves = 0L; /* != 1, starting value of moves */ static NEARDATA s_level *lev; @@ -1564,7 +1535,7 @@ register struct permonst *ptr; /* select a random monster type */ struct permonst * -rndmonst() +rndmonst(void) { register struct permonst *ptr; register int mndx; @@ -1640,9 +1611,7 @@ rndmonst() /* decide whether it's ok to generate a candidate monster by mkclass() */ static boolean -mk_gen_ok(mndx, mvflagsmask, genomask) -int mndx; -unsigned mvflagsmask, genomask; +mk_gen_ok(int mndx, unsigned mvflagsmask, unsigned genomask) { struct permonst *ptr = &mons[mndx]; @@ -1665,19 +1634,15 @@ unsigned mvflagsmask, genomask; to allow the normal genesis masks to be deactivated. Returns Null if no monsters in that class can be made. */ struct permonst * -mkclass(class, spc) -char class; -int spc; +mkclass(char class, int spc) { return mkclass_aligned(class, spc, A_NONE); } /* mkclass() with alignment restrictions; used by ndemon() */ struct permonst * -mkclass_aligned(class, spc, atyp) -char class; -int spc; /* special mons[].geno handling */ -aligntyp atyp; +mkclass_aligned(char class, int spc, /* special mons[].geno handling */ + aligntyp atyp) { register int first, last, num = 0; int k, nums[SPECIAL_PM + 1]; /* +1: insurance for final return value */ @@ -1769,8 +1734,7 @@ aligntyp atyp; genocided types are avoided but extinct ones are acceptable; we don't check polyok() here--caller accepts some choices !polyok() would reject */ int -mkclass_poly(class) -int class; +mkclass_poly(int class) { register int first, last, num = 0; unsigned gmask; @@ -1803,8 +1767,7 @@ int class; /* adjust strength of monsters based on u.uz and u.ulevel */ int -adj_lev(ptr) -register struct permonst *ptr; +adj_lev(register struct permonst *ptr) { int tmp, tmp2; @@ -1839,8 +1802,7 @@ register struct permonst *ptr; /* monster earned experience and will gain some hit points; it might also grow into a bigger monster (baby to adult, soldier to officer, etc) */ struct permonst * -grow_up(mtmp, victim) -struct monst *mtmp, *victim; +grow_up(struct monst *mtmp, struct monst *victim) { int oldtype, newtype, max_increase, cur_increase, lev_limit, hp_threshold; unsigned fem; @@ -1965,9 +1927,7 @@ struct monst *mtmp, *victim; } struct obj * -mongets(mtmp, otyp) -register struct monst *mtmp; -int otyp; +mongets(register struct monst *mtmp, int otyp) { register struct obj *otmp; @@ -2018,8 +1978,7 @@ int otyp; } int -golemhp(type) -int type; +golemhp(int type) { switch (type) { case PM_STRAW_GOLEM: @@ -2054,8 +2013,7 @@ int type; * (Some "animal" types are co-aligned, but also hungry.) */ boolean -peace_minded(ptr) -register struct permonst *ptr; +peace_minded(register struct permonst *ptr) { aligntyp mal = ptr->maligntyp, ual = u.ualign.type; @@ -2106,8 +2064,7 @@ register struct permonst *ptr; * it's never bad to kill a hostile monster, although it may not be good. */ void -set_malign(mtmp) -struct monst *mtmp; +set_malign(struct monst *mtmp) { schar mal = mtmp->data->maligntyp; boolean coaligned; @@ -2156,8 +2113,7 @@ struct monst *mtmp; /* allocate a new mcorpsenm field for a monster; only need mextra itself */ void -newmcorpsenm(mtmp) -struct monst *mtmp; +newmcorpsenm(struct monst *mtmp) { if (!mtmp->mextra) mtmp->mextra = newmextra(); @@ -2166,8 +2122,7 @@ struct monst *mtmp; /* release monster's mcorpsenm field; basically a no-op */ void -freemcorpsenm(mtmp) -struct monst *mtmp; +freemcorpsenm(struct monst *mtmp) { if (has_mcorpsenm(mtmp)) MCORPSENM(mtmp) = NON_PM; @@ -2181,8 +2136,7 @@ static const NEARDATA char syms[] = { }; void -set_mimic_sym(mtmp) -register struct monst *mtmp; +set_mimic_sym(register struct monst *mtmp) { int typ, roomno, rt; unsigned appear, ap_type; @@ -2339,10 +2293,9 @@ register struct monst *mtmp; /* release monster from bag of tricks; return number of monsters created */ int -bagotricks(bag, tipping, seencount) -struct obj *bag; -boolean tipping; /* caller emptying entire contents; affects shop handling */ -int *seencount; /* secondary output */ +bagotricks(struct obj *bag, + boolean tipping, /* caller emptying entire contents; affects shop handling */ + int *seencount) /* secondary output */ { int moncount = 0; diff --git a/src/mcastu.c b/src/mcastu.c index f6b23986e..f51da0e82 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -35,24 +35,21 @@ enum mcast_cleric_spells { CLC_GEYSER }; -static void FDECL(cursetxt, (struct monst *, BOOLEAN_P)); -static int FDECL(choose_magic_spell, (int)); -static int FDECL(choose_clerical_spell, (int)); -static int FDECL(m_cure_self, (struct monst *, int)); -static void FDECL(cast_wizard_spell, (struct monst *, int, int)); -static void FDECL(cast_cleric_spell, (struct monst *, int, int)); -static boolean FDECL(is_undirected_spell, (unsigned int, int)); +static void cursetxt(struct monst *, boolean); +static int choose_magic_spell(int); +static int choose_clerical_spell(int); +static int m_cure_self(struct monst *, int); +static void cast_wizard_spell(struct monst *, int, int); +static void cast_cleric_spell(struct monst *, int, int); +static boolean is_undirected_spell(unsigned int, int); static boolean -FDECL(spell_would_be_useless, (struct monst *, unsigned int, int)); +spell_would_be_useless(struct monst *, unsigned int, int); extern const char *const flash_types[]; /* from zap.c */ /* feedback when frustrated monster couldn't cast a spell */ -static -void -cursetxt(mtmp, undirected) -struct monst *mtmp; -boolean undirected; +static void +cursetxt(struct monst *mtmp, boolean undirected) { if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)) { const char *point_msg; /* spellcasting monsters are impolite */ @@ -79,8 +76,7 @@ boolean undirected; /* convert a level based random selection into a specific mage spell; inappropriate choices will be screened out by spell_would_be_useless() */ static int -choose_magic_spell(spellval) -int spellval; +choose_magic_spell(int spellval) { /* for 3.4.3 and earlier, val greater than 22 selected default spell */ while (spellval > 24 && rn2(25)) @@ -133,8 +129,7 @@ int spellval; /* convert a level based random selection into a specific cleric spell */ static int -choose_clerical_spell(spellnum) -int spellnum; +choose_clerical_spell(int spellnum) { /* for 3.4.3 and earlier, num greater than 13 selected the default spell */ @@ -180,11 +175,10 @@ int spellnum; * 0: unsuccessful spell */ int -castmu(mtmp, mattk, thinks_it_foundyou, foundyou) -register struct monst *mtmp; -register struct attack *mattk; -boolean thinks_it_foundyou; -boolean foundyou; +castmu(register struct monst *mtmp, + register struct attack *mattk, + boolean thinks_it_foundyou, + boolean foundyou) { int dmg, ml = mtmp->m_lev; int ret; @@ -336,9 +330,7 @@ boolean foundyou; } static int -m_cure_self(mtmp, dmg) -struct monst *mtmp; -int dmg; +m_cure_self(struct monst *mtmp, int dmg) { if (mtmp->mhp < mtmp->mhpmax) { if (canseemon(mtmp)) @@ -362,10 +354,7 @@ int dmg; */ static void -cast_wizard_spell(mtmp, dmg, spellnum) -struct monst *mtmp; -int dmg; -int spellnum; +cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum) { if (dmg == 0 && !is_undirected_spell(AD_SPEL, spellnum)) { impossible("cast directed wizard spell (%d) with dmg=0?", spellnum); @@ -517,12 +506,8 @@ int spellnum; mdamageu(mtmp, dmg); } -static -void -cast_cleric_spell(mtmp, dmg, spellnum) -struct monst *mtmp; -int dmg; -int spellnum; +static void +cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum) { if (dmg == 0 && !is_undirected_spell(AD_CLRC, spellnum)) { impossible("cast directed cleric spell (%d) with dmg=0?", spellnum); @@ -736,11 +721,8 @@ int spellnum; mdamageu(mtmp, dmg); } -static -boolean -is_undirected_spell(adtyp, spellnum) -unsigned int adtyp; -int spellnum; +static boolean +is_undirected_spell(unsigned int adtyp, int spellnum) { if (adtyp == AD_SPEL) { switch (spellnum) { @@ -767,12 +749,8 @@ int spellnum; } /* Some spells are useless under some circumstances. */ -static -boolean -spell_would_be_useless(mtmp, adtyp, spellnum) -struct monst *mtmp; -unsigned int adtyp; -int spellnum; +static boolean +spell_would_be_useless(struct monst *mtmp, unsigned int adtyp, int spellnum) { /* Some spells don't require the player to really be there and can be cast * by the monster when you're invisible, yet still shouldn't be cast when @@ -843,9 +821,7 @@ int spellnum; /* monster uses spell (ranged) */ int -buzzmu(mtmp, mattk) -register struct monst *mtmp; -register struct attack *mattk; +buzzmu(register struct monst *mtmp, register struct attack *mattk) { /* don't print constant stream of curse messages for 'normal' spellcasting monsters at range */ diff --git a/src/mdlib.c b/src/mdlib.c index c1595450f..8bdfc79c4 100644 --- a/src/mdlib.c +++ b/src/mdlib.c @@ -56,26 +56,26 @@ /* REPRODUCIBLE_BUILD will change this to TRUE */ static boolean date_via_env = FALSE; -static char *FDECL(version_string, (char *, const char *)); -static char *FDECL(version_id_string, (char *, const char *)); -static char *FDECL(bannerc_string, (char *, const char *)); +static char *version_string(char *, const char *); +static char *version_id_string(char *, const char *); +static char *bannerc_string(char *, const char *); -static void NDECL(make_version); -static char *FDECL(eos, (char *)); +static void make_version(void); +static char *eos(char *); #if 0 -static char *FDECL(mdlib_strsubst, (char *, const char *, const char *)); +static char *mdlib_strsubst(char *, const char *, const char *); #endif #ifndef HAS_NO_MKSTEMP #ifdef _MSC_VER -static int FDECL(mkstemp, (char *)); +static int mkstemp(char *); #endif #endif #endif /* MAKEDEFS_C || FOR_RUNTIME */ #if defined(MAKEDEFS_C) || defined(FOR_RUNTIME) || defined(WIN32) \ || (defined(CROSSCOMPILE_TARGET) && defined(__DATE__) && defined(__TIME__)) -static int FDECL(case_insensitive_comp, (const char *, const char *)); +static int case_insensitive_comp(const char *, const char *); #endif #if !defined(MAKEDEFS_C) && defined(WIN32) @@ -83,13 +83,13 @@ extern int GUILaunched; #endif /* these two are in extern.h but we don't include hack.h */ -void NDECL(runtime_info_init); -const char *FDECL(do_runtime_info, (int *)); +void runtime_info_init(void); +const char *do_runtime_info(int *); -void NDECL(build_options); -static int NDECL(count_and_validate_winopts); -static void FDECL(opt_out_words, (char *, int *)); -static void NDECL(build_savebones_compat_string); +void build_options(void); +static int count_and_validate_winopts(void); +static void opt_out_words(char *, int *); +static void build_savebones_compat_string(void); static int idxopttext, done_runtime_opt_init_once = 0; #define MAXOPT 40 #if !defined(MAKEDEFS_C) && defined(CROSSCOMPILE_TARGET) \ @@ -184,7 +184,7 @@ static struct win_info window_opts[] = { #endif /* MD_IGNORED_FEATUES */ static void -make_version() +make_version(void) { register int i; @@ -258,9 +258,7 @@ make_version() #if defined(MAKEDEFS_C) || defined(FOR_RUNTIME) static char * -version_string(outbuf, delim) -char *outbuf; -const char *delim; +version_string(char *outbuf, const char *delim) { Sprintf(outbuf, "%d%s%d%s%d", VERSION_MAJOR, delim, VERSION_MINOR, delim, PATCHLEVEL); @@ -271,9 +269,7 @@ const char *delim; } static char * -version_id_string(outbuf, build_date) -char *outbuf; -const char *build_date; +version_id_string(char *outbuf, const char *build_date) { char subbuf[64], versbuf[64]; char statusbuf[64]; @@ -306,9 +302,7 @@ const char *build_date; /* still within #if MAKDEFS_C || FOR_RUNTIME */ static char * -bannerc_string(outbuf, build_date) -char *outbuf; -const char *build_date; +bannerc_string(char *outbuf, const char *build_date) { char subbuf[64], versbuf[64]; @@ -339,8 +333,7 @@ const char *build_date; #ifndef HAS_NO_MKSTEMP #ifdef _MSC_VER int -mkstemp(template) -char *template; +mkstemp(char *template) { int err; @@ -358,9 +351,7 @@ char *template; #if defined(MAKEDEFS_C) || defined(FOR_RUNTIME) || defined(WIN32) \ || (defined(CROSSCOMPILE_TARGET) && defined(__DATE__) && defined(__TIME__)) static int -case_insensitive_comp(s1, s2) -const char *s1; -const char *s2; +case_insensitive_comp(const char *s1, const char *s2) { uchar u1, u2; @@ -379,8 +370,7 @@ const char *s2; #endif static char * -eos(str) -char *str; +eos(char *str) { while (*str) str++; @@ -389,9 +379,7 @@ char *str; #if 0 static char * -mdlib_strsubst(bp, orig, replacement) -char *bp; -const char *orig, *replacement; +mdlib_strsubst(char *bp, const char *orig, const char *replacement) { char *found, buf[BUFSZ]; @@ -411,7 +399,7 @@ const char *orig, *replacement; static char save_bones_compat_buf[BUFSZ]; static void -build_savebones_compat_string() +build_savebones_compat_string(void) { #ifdef VERSION_COMPATIBILITY unsigned long uver = VERSION_COMPATIBILITY, @@ -619,7 +607,7 @@ static const char *build_opts[] = { }; int -count_and_validate_winopts(VOID_ARGS) +count_and_validate_winopts(void) { int i, cnt = 0; @@ -642,9 +630,8 @@ count_and_validate_winopts(VOID_ARGS) } static void -opt_out_words(str, length_p) -char *str; /* input, but modified during processing */ -int *length_p; /* in/out */ +opt_out_words(char *str, /* input, but modified during processing */ + int *length_p) /* in/out */ { char *word; @@ -672,7 +659,7 @@ int *length_p; /* in/out */ } void -build_options() +build_options(void) { char buf[BUFSZ]; int i, length, winsyscnt, cnt = 0; @@ -814,7 +801,7 @@ build_options() #endif void -runtime_info_init() +runtime_info_init(void) { #if !defined(MAKEDEFS_C) && defined(CROSSCOMPILE_TARGET) \ && defined(__DATE__) && defined(__TIME__) @@ -907,8 +894,7 @@ runtime_info_init() } const char * -do_runtime_info(rtcontext) -int *rtcontext; +do_runtime_info(int *rtcontext) { const char *retval = (const char *) 0; diff --git a/src/mhitm.c b/src/mhitm.c index 27b8f4b2a..a164f4d75 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -9,24 +9,22 @@ static const char brief_feeling[] = "have a %s feeling for a moment, then it passes."; -static int FDECL(hitmm, (struct monst *, struct monst *, - struct attack *, struct obj *, int)); -static int FDECL(gazemm, (struct monst *, struct monst *, struct attack *)); -static int FDECL(gulpmm, (struct monst *, struct monst *, struct attack *)); -static int FDECL(explmm, (struct monst *, struct monst *, struct attack *)); -static int FDECL(mdamagem, (struct monst *, struct monst *, - struct attack *, struct obj *, int)); -static void FDECL(mswingsm, (struct monst *, struct monst *, struct obj *)); -static void FDECL(noises, (struct monst *, struct attack *)); -static void FDECL(pre_mm_attack, (struct monst *, struct monst *)); -static void FDECL(missmm, (struct monst *, struct monst *, struct attack *)); -static int FDECL(passivemm, (struct monst *, struct monst *, - BOOLEAN_P, int, struct obj *)); +static int hitmm(struct monst *, struct monst *, struct attack *, struct obj *, + int); +static int gazemm(struct monst *, struct monst *, struct attack *); +static int gulpmm(struct monst *, struct monst *, struct attack *); +static int explmm(struct monst *, struct monst *, struct attack *); +static int mdamagem(struct monst *, struct monst *, struct attack *, + struct obj *, int); +static void mswingsm(struct monst *, struct monst *, struct obj *); +static void noises(struct monst *, struct attack *); +static void pre_mm_attack(struct monst *, struct monst *); +static void missmm(struct monst *, struct monst *, struct attack *); +static int passivemm(struct monst *, struct monst *, boolean, int, + struct obj *); static void -noises(magr, mattk) -register struct monst *magr; -register struct attack *mattk; +noises(register struct monst *magr, register struct attack *mattk) { boolean farq = (distu(magr->mx, magr->my) > 15); @@ -40,8 +38,7 @@ register struct attack *mattk; } static void -pre_mm_attack(magr, mdef) -struct monst *magr, *mdef; +pre_mm_attack(struct monst *magr, struct monst *mdef) { boolean showit = FALSE; @@ -76,9 +73,8 @@ struct monst *magr, *mdef; static void -missmm(magr, mdef, mattk) -register struct monst *magr, *mdef; -struct attack *mattk; +missmm(register struct monst *magr, register struct monst *mdef, + struct attack *mattk) { const char *fmt; char buf[BUFSZ]; @@ -108,8 +104,7 @@ struct attack *mattk; */ /* have monsters fight each other */ int -fightm(mtmp) -register struct monst *mtmp; +fightm(register struct monst *mtmp) { register struct monst *mon, *nmon; int result, has_u_swallowed; @@ -183,9 +178,8 @@ register struct monst *mtmp; * returns same results as mattackm(). */ int -mdisplacem(magr, mdef, quietly) -register struct monst *magr, *mdef; -boolean quietly; +mdisplacem(register struct monst *magr, register struct monst *mdef, + boolean quietly) { struct permonst *pa, *pd; int tx, ty, fx, fy; @@ -279,8 +273,7 @@ boolean quietly; * In the case of exploding monsters, the monster dies as well. */ int -mattackm(magr, mdef) -register struct monst *magr, *mdef; +mattackm(register struct monst *magr, register struct monst *mdef) { int i, /* loop counter */ tmp, /* amour class difference */ @@ -545,11 +538,8 @@ register struct monst *magr, *mdef; /* Returns the result of mdamagem(). */ static int -hitmm(magr, mdef, mattk, mwep, dieroll) -register struct monst *magr, *mdef; -struct attack *mattk; -struct obj *mwep; -int dieroll; +hitmm(register struct monst *magr, register struct monst *mdef, + struct attack *mattk, struct obj *mwep, int dieroll) { boolean weaponhit = (mattk->aatyp == AT_WEAP || (mattk->aatyp == AT_CLAW && mwep)), @@ -634,9 +624,8 @@ int dieroll; /* Returns the same values as mdamagem(). */ static int -gazemm(magr, mdef, mattk) -register struct monst *magr, *mdef; -struct attack *mattk; +gazemm(register struct monst *magr, register struct monst *mdef, + struct attack *mattk) { char buf[BUFSZ]; @@ -688,8 +677,7 @@ struct attack *mattk; /* return True if magr is allowed to swallow mdef, False otherwise */ boolean -engulf_target(magr, mdef) -struct monst *magr, *mdef; +engulf_target(struct monst *magr, struct monst *mdef) { struct rm *lev; int dx, dy; @@ -720,9 +708,8 @@ struct monst *magr, *mdef; /* Returns the same values as mattackm(). */ static int -gulpmm(magr, mdef, mattk) -register struct monst *magr, *mdef; -register struct attack *mattk; +gulpmm(register struct monst *magr, register struct monst *mdef, + register struct attack *mattk) { xchar ax, ay, dx, dy; int status; @@ -810,9 +797,7 @@ register struct attack *mattk; } static int -explmm(magr, mdef, mattk) -struct monst *magr, *mdef; -struct attack *mattk; +explmm(struct monst *magr, struct monst *mdef, struct attack *mattk) { int result; @@ -850,11 +835,8 @@ struct attack *mattk; * See comment at top of mattackm(), for return values. */ static int -mdamagem(magr, mdef, mattk, mwep, dieroll) -struct monst *magr, *mdef; -struct attack *mattk; -struct obj *mwep; -int dieroll; +mdamagem(struct monst *magr, struct monst *mdef, + struct attack *mattk, struct obj *mwep, int dieroll) { struct permonst *pa = magr->data, *pd = mdef->data; int armpro; @@ -948,9 +930,7 @@ int dieroll; } int -mon_poly(magr, mdef, dmg) -struct monst *magr, *mdef; -int dmg; +mon_poly(struct monst *magr, struct monst *mdef, int dmg) { if (mdef == &g.youmonst) { if (Antimagic) { @@ -1017,9 +997,7 @@ int dmg; } void -paralyze_monst(mon, amt) -struct monst *mon; -int amt; +paralyze_monst(struct monst *mon, int amt) { if (amt > 127) amt = 127; @@ -1032,9 +1010,7 @@ int amt; /* `mon' is hit by a sleep attack; return 1 if it's affected, 0 otherwise */ int -sleep_monst(mon, amt, how) -struct monst *mon; -int amt, how; +sleep_monst(struct monst *mon, int amt, int how) { if (resists_sleep(mon) || (how >= 0 && resist(mon, (char) how, 0, NOTELL))) { @@ -1055,8 +1031,7 @@ int amt, how; /* sleeping grabber releases, engulfer doesn't; don't use for paralysis! */ void -slept_monst(mon) -struct monst *mon; +slept_monst(struct monst *mon) { if ((mon->msleeping || !mon->mcanmove) && mon == u.ustuck && !sticks(g.youmonst.data) && !u.uswallow) { @@ -1066,9 +1041,7 @@ struct monst *mon; } void -rustm(mdef, obj) -struct monst *mdef; -struct obj *obj; +rustm(struct monst *mdef, struct obj *obj) { int dmgtyp = -1, chance = 1; @@ -1091,9 +1064,7 @@ struct obj *obj; } static void -mswingsm(magr, mdef, otemp) -struct monst *magr, *mdef; -struct obj *otemp; +mswingsm(struct monst *magr, struct monst *mdef, struct obj *otemp) { if (flags.verbose && !Blind && mon_visible(magr)) { pline("%s %s %s%s %s at %s.", Monnam(magr), @@ -1108,11 +1079,8 @@ struct obj *otemp; * handled above. Returns same values as mattackm. */ static int -passivemm(magr, mdef, mhitb, mdead, mwep) -register struct monst *magr, *mdef; -boolean mhitb; -int mdead; -struct obj *mwep; +passivemm(register struct monst *magr, register struct monst *mdef, + boolean mhitb, int mdead, struct obj *mwep) { register struct permonst *mddat = mdef->data; register struct permonst *madat = magr->data; @@ -1265,9 +1233,7 @@ struct obj *mwep; /* hero or monster has successfully hit target mon with drain energy attack */ void -xdrainenergym(mon, givemsg) -struct monst *mon; -boolean givemsg; +xdrainenergym(struct monst *mon, boolean givemsg) { if (mon->mspec_used < 20 /* limit draining */ && (attacktype(mon->data, AT_MAGC) @@ -1281,8 +1247,7 @@ boolean givemsg; /* "aggressive defense"; what type of armor prevents specified attack from touching its target? */ long -attk_protection(aatyp) -int aatyp; +attk_protection(int aatyp) { long w_mask = 0L; diff --git a/src/mhitu.c b/src/mhitu.c index e2fdd17f9..a17f2462c 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -8,24 +8,21 @@ static NEARDATA struct obj *mon_currwep = (struct obj *) 0; -static void FDECL(missmu, (struct monst *, BOOLEAN_P, struct attack *)); -static void FDECL(mswings, (struct monst *, struct obj *)); -static void FDECL(wildmiss, (struct monst *, struct attack *)); -static void FDECL(summonmu, (struct monst *, BOOLEAN_P)); -static int FDECL(hitmu, (struct monst *, struct attack *)); -static int FDECL(gulpmu, (struct monst *, struct attack *)); -static int FDECL(explmu, (struct monst *, struct attack *, BOOLEAN_P)); -static void FDECL(mayberem, (struct monst *, const char *, - struct obj *, const char *)); -static int FDECL(passiveum, (struct permonst *, struct monst *, - struct attack *)); +static void missmu(struct monst *, boolean, struct attack *); +static void mswings(struct monst *, struct obj *); +static void wildmiss(struct monst *, struct attack *); +static void summonmu(struct monst *, boolean); +static int hitmu(struct monst *, struct attack *); +static int gulpmu(struct monst *, struct attack *); +static int explmu(struct monst *, struct attack *, boolean); +static void mayberem(struct monst *, const char *, struct obj *, + const char *); +static int passiveum(struct permonst *, struct monst *, struct attack *); #define ld() ((yyyymmdd((time_t) 0) - (getyear() * 10000L)) == 0xe5) void -hitmsg(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +hitmsg(struct monst *mtmp, struct attack *mattk) { int compat; const char *pfmt = 0; @@ -74,10 +71,7 @@ struct attack *mattk; /* monster missed you */ static void -missmu(mtmp, nearmiss, mattk) -struct monst *mtmp; -boolean nearmiss; -struct attack *mattk; +missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk) { if (!canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); @@ -93,9 +87,7 @@ struct attack *mattk; /* monster swings obj */ static void -mswings(mtmp, otemp) -struct monst *mtmp; -struct obj *otemp; +mswings(struct monst *mtmp, struct obj *otemp) { if (flags.verbose && !Blind && mon_visible(mtmp)) { pline("%s %s %s%s %s.", Monnam(mtmp), @@ -106,9 +98,7 @@ struct obj *otemp; /* return how a poison attack was delivered */ const char * -mpoisons_subj(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +mpoisons_subj(struct monst *mtmp, struct attack *mattk) { if (mattk->aatyp == AT_WEAP) { struct obj *mwep = (mtmp == &g.youmonst) ? uwep : MON_WEP(mtmp); @@ -124,7 +114,7 @@ struct attack *mattk; /* called when your intrinsic speed is taken away */ void -u_slow_down() +u_slow_down(void) { HFast = 0L; if (!Fast) @@ -136,9 +126,7 @@ u_slow_down() /* monster attacked your displaced image */ static void -wildmiss(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +wildmiss(struct monst *mtmp, struct attack *mattk) { int compat; const char *Monst_name; /* Monnam(mtmp) */ @@ -212,10 +200,9 @@ struct attack *mattk; } void -expels(mtmp, mdat, message) -struct monst *mtmp; -struct permonst *mdat; /* if mtmp is polymorphed, mdat != mtmp->data */ -boolean message; +expels(struct monst *mtmp, + struct permonst *mdat, /* if mtmp is polymorphed, mdat != mtmp->data */ + boolean message) { g.context.botl = 1; if (message) { @@ -256,10 +243,8 @@ boolean message; /* select a monster's next attack, possibly substituting for its usual one */ struct attack * -getmattk(magr, mdef, indx, prev_result, alt_attk_buf) -struct monst *magr, *mdef; -int indx, prev_result[]; -struct attack *alt_attk_buf; +getmattk(struct monst *magr, struct monst *mdef, + int indx, int prev_result[], struct attack *alt_attk_buf) { struct permonst *mptr = magr->data; struct attack *attk = &mptr->mattk[indx]; @@ -358,8 +343,7 @@ struct attack *alt_attk_buf; * take care of it... */ int -mattacku(mtmp) -register struct monst *mtmp; +mattacku(register struct monst *mtmp) { struct attack *mattk, alt_attk; int i, j = 0, tmp, sum[NATTK]; @@ -781,9 +765,7 @@ register struct monst *mtmp; /* monster summons help for its fight against hero */ static void -summonmu(mtmp, youseeit) -struct monst *mtmp; -boolean youseeit; +summonmu(struct monst *mtmp, boolean youseeit) { struct permonst *mdat = mtmp->data; @@ -853,8 +835,7 @@ boolean youseeit; } boolean -diseasemu(mdat) -struct permonst *mdat; +diseasemu(struct permonst *mdat) { if (Sick_resistance) { You_feel("a slight illness."); @@ -868,9 +849,7 @@ struct permonst *mdat; /* check whether slippery clothing protects from hug or wrap attack */ boolean -u_slip_free(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +u_slip_free(struct monst *mtmp, struct attack *mattk) { struct obj *obj = (uarmc ? uarmc : uarm); @@ -905,8 +884,7 @@ struct attack *mattk; /* armor that sufficiently covers the body might be able to block magic */ int -magic_negation(mon) -struct monst *mon; +magic_negation(struct monst *mon) { struct obj *o; long wearmask; @@ -959,9 +937,7 @@ struct monst *mon; * returns MM_ flags */ static int -hitmu(mtmp, mattk) -register struct monst *mtmp; -register struct attack *mattk; +hitmu(register struct monst *mtmp, register struct attack *mattk) { struct permonst *mdat = mtmp->data; /* int uncancelled; */ @@ -1091,7 +1067,7 @@ register struct attack *mattk; * to see if an engulfing attack should immediately take affect, like * a passive attack. TRUE if engulfing blindness occurred */ boolean -gulp_blnd_check() +gulp_blnd_check(void) { struct attack *mattk; @@ -1107,9 +1083,7 @@ gulp_blnd_check() /* monster swallows you, or damage if u.uswallow */ static int -gulpmu(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +gulpmu(struct monst *mtmp, struct attack *mattk) { struct trap *t = t_at(u.ux, u.uy); int tmp = d((int) mattk->damn, (int) mattk->damd); @@ -1366,10 +1340,7 @@ struct attack *mattk; /* monster explodes in your face */ static int -explmu(mtmp, mattk, ufound) -struct monst *mtmp; -struct attack *mattk; -boolean ufound; +explmu(struct monst *mtmp, struct attack *mattk, boolean ufound) { boolean physical_damage = TRUE, kill_agr = TRUE; @@ -1471,9 +1442,7 @@ boolean ufound; /* monster gazes at you */ int -gazemu(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +gazemu(struct monst *mtmp, struct attack *mattk) { static const char *const reactions[] = { "confused", /* [0] */ @@ -1689,9 +1658,7 @@ struct attack *mattk; /* mtmp hits you for n points damage */ void -mdamageu(mtmp, n) -struct monst *mtmp; -int n; +mdamageu(struct monst *mtmp, int n) { g.context.botl = 1; if (Upolyd) { @@ -1710,9 +1677,8 @@ int n; * 2 if wrong gender for nymph */ int -could_seduce(magr, mdef, mattk) -struct monst *magr, *mdef; -struct attack *mattk; /* non-Null: current attack; Null: general capability */ +could_seduce(struct monst *magr, struct monst *mdef, + struct attack *mattk) /* non-Null: current attack; Null: general capability */ { struct permonst *pagr; boolean agrinvis, defperc; @@ -1761,8 +1727,7 @@ struct attack *mattk; /* non-Null: current attack; Null: general capability */ /* returns 1 if monster teleported (or hero leaves monster's vicinity) */ int -doseduce(mon) -struct monst *mon; +doseduce(struct monst *mon) { struct obj *ring, *nring; boolean fem = (mon->data == &mons[PM_AMOROUS_DEMON] @@ -2072,11 +2037,9 @@ struct monst *mon; /* 'mon' tries to remove a piece of hero's armor */ static void -mayberem(mon, seducer, obj, str) -struct monst *mon; -const char *seducer; /* only used for alternate message */ -struct obj *obj; -const char *str; +mayberem(struct monst *mon, + const char *seducer, /* only used for alternate message */ + struct obj *obj, const char *str) { char qbuf[QBUFSZ]; @@ -2125,10 +2088,7 @@ const char *str; * damage applies. */ static int -passiveum(olduasmon, mtmp, mattk) -struct permonst *olduasmon; -struct monst *mtmp; -struct attack *mattk; +passiveum(struct permonst *olduasmon, struct monst *mtmp, struct attack *mattk) { int i, tmp; struct attack *oldu_mattk = 0; @@ -2312,7 +2272,7 @@ struct attack *mattk; } struct monst * -cloneu() +cloneu(void) { struct monst *mon; int mndx = monsndx(g.youmonst.data); diff --git a/src/minion.c b/src/minion.c index c6a7dec58..54869a8bd 100644 --- a/src/minion.c +++ b/src/minion.c @@ -6,8 +6,7 @@ #include "hack.h" void -newemin(mtmp) -struct monst *mtmp; +newemin(struct monst *mtmp) { if (!mtmp->mextra) mtmp->mextra = newmextra(); @@ -18,8 +17,7 @@ struct monst *mtmp; } void -free_emin(mtmp) -struct monst *mtmp; +free_emin(struct monst *mtmp) { if (mtmp->mextra && EMIN(mtmp)) { free((genericptr_t) EMIN(mtmp)); @@ -30,8 +28,7 @@ struct monst *mtmp; /* count the number of monsters on the level */ int -monster_census(spotted) -boolean spotted; /* seen|sensed vs all */ +monster_census(boolean spotted) /* seen|sensed vs all */ { struct monst *mtmp; int count = 0; @@ -50,8 +47,7 @@ boolean spotted; /* seen|sensed vs all */ /* mon summons a monster */ int -msummon(mon) -struct monst *mon; +msummon(struct monst *mon) { struct permonst *ptr; int dtype = NON_PM, cnt = 0, result = 0, census; @@ -163,9 +159,7 @@ struct monst *mon; } void -summon_minion(alignment, talk) -aligntyp alignment; -boolean talk; +summon_minion(aligntyp alignment, boolean talk) { register struct monst *mon; int mnum; @@ -225,8 +219,7 @@ boolean talk; /* returns 1 if it won't attack. */ int -demon_talk(mtmp) -register struct monst *mtmp; +demon_talk(register struct monst *mtmp) { long cash, demand, offer; @@ -305,8 +298,7 @@ register struct monst *mtmp; } long -bribe(mtmp) -struct monst *mtmp; +bribe(struct monst *mtmp) { char buf[BUFSZ] = DUMMY; long offer; @@ -336,8 +328,7 @@ struct monst *mtmp; } int -dprince(atyp) -aligntyp atyp; +dprince(aligntyp atyp) { int tryct, pm; @@ -351,8 +342,7 @@ aligntyp atyp; } int -dlord(atyp) -aligntyp atyp; +dlord(aligntyp atyp) { int tryct, pm; @@ -367,7 +357,7 @@ aligntyp atyp; /* create lawful (good) lord */ int -llord() +llord(void) { if (!(g.mvitals[PM_ARCHON].mvflags & G_GONE)) return PM_ARCHON; @@ -376,7 +366,7 @@ llord() } int -lminion() +lminion(void) { int tryct; struct permonst *ptr; @@ -391,8 +381,7 @@ lminion() } int -ndemon(atyp) -aligntyp atyp; /* A_NONE is used for 'any alignment' */ +ndemon(aligntyp atyp) /* A_NONE is used for 'any alignment' */ { struct permonst *ptr; @@ -416,8 +405,7 @@ aligntyp atyp; /* A_NONE is used for 'any alignment' */ /* guardian angel has been affected by conflict so is abandoning hero */ void -lose_guardian_angel(mon) -struct monst *mon; /* if null, angel hasn't been created yet */ +lose_guardian_angel(struct monst *mon) /* if null, angel hasn't been created yet */ { coord mm; int i; @@ -445,7 +433,7 @@ struct monst *mon; /* if null, angel hasn't been created yet */ /* just entered the Astral Plane; receive tame guardian angel if worthy */ void -gain_guardian_angel() +gain_guardian_angel(void) { struct monst *mtmp; struct obj *otmp; diff --git a/src/mklev.c b/src/mklev.c index 45663bb99..0b606b4bf 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -9,37 +9,34 @@ /* croom->lx etc are schar (width <= int), so % arith ensures that */ /* conversion of result to int is reasonable */ -static boolean FDECL(generate_stairs_room_good, (struct mkroom *, int)); -static struct mkroom *NDECL(generate_stairs_find_room); -static void NDECL(generate_stairs); -static void FDECL(mkfount, (int, struct mkroom *)); -static boolean FDECL(find_okay_roompos, (struct mkroom *, coord *)); -static void FDECL(mksink, (struct mkroom *)); -static void FDECL(mkaltar, (struct mkroom *)); -static void FDECL(mkgrave, (struct mkroom *)); -static void NDECL(makevtele); -void NDECL(clear_level_structures); -static void FDECL(fill_ordinary_room, (struct mkroom *)); -static void NDECL(makelevel); -static boolean FDECL(bydoor, (XCHAR_P, XCHAR_P)); -static struct mkroom *FDECL(find_branch_room, (coord *)); -static struct mkroom *FDECL(pos_to_room, (XCHAR_P, XCHAR_P)); -static boolean FDECL(place_niche, (struct mkroom *, int *, int *, int *)); -static void FDECL(makeniche, (int)); -static void NDECL(make_niches); -static int FDECL(CFDECLSPEC do_comp, (const genericptr, - const genericptr)); -static void FDECL(dosdoor, (XCHAR_P, XCHAR_P, struct mkroom *, int)); -static void FDECL(join, (int, int, BOOLEAN_P)); -static void FDECL(do_room_or_subroom, (struct mkroom *, int, int, - int, int, BOOLEAN_P, - SCHAR_P, BOOLEAN_P, BOOLEAN_P)); -static void NDECL(makerooms); -static boolean FDECL(door_into_nonjoined, (XCHAR_P, XCHAR_P)); -static void FDECL(finddpos, (coord *, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P)); -static void FDECL(mkinvpos, (XCHAR_P, XCHAR_P, int)); -static void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P)); +static boolean generate_stairs_room_good(struct mkroom *, int); +static struct mkroom *generate_stairs_find_room(void); +static void generate_stairs(void); +static void mkfount(int, struct mkroom *); +static boolean find_okay_roompos(struct mkroom *, coord *); +static void mksink(struct mkroom *); +static void mkaltar(struct mkroom *); +static void mkgrave(struct mkroom *); +static void makevtele(void); +void clear_level_structures(void); +static void fill_ordinary_room(struct mkroom *); +static void makelevel(void); +static boolean bydoor(xchar, xchar); +static struct mkroom *find_branch_room(coord *); +static struct mkroom *pos_to_room(xchar, xchar); +static boolean place_niche(struct mkroom *, int *, int *, int *); +static void makeniche(int); +static void make_niches(void); +static int CFDECLSPEC do_comp(const genericptr, const genericptr); +static void dosdoor(xchar, xchar, struct mkroom *, int); +static void join(int, int, boolean); +static void do_room_or_subroom(struct mkroom *, int, int, int, int, boolean, + schar, boolean, boolean); +static void makerooms(void); +static boolean door_into_nonjoined(xchar, xchar); +static void finddpos(coord *, xchar, xchar, xchar, xchar); +static void mkinvpos(xchar, xchar, int); +static void mk_knox_portal(xchar, xchar); #define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE) #define init_vault() g.vault_x = -1 @@ -48,9 +45,7 @@ static void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P)); /* Args must be (const genericptr) so that qsort will always be happy. */ static int CFDECLSPEC -do_comp(vx, vy) -const genericptr vx; -const genericptr vy; +do_comp(const genericptr vx, const genericptr vy) { #ifdef LINT /* lint complains about possible pointer alignment problems, but we know @@ -76,8 +71,7 @@ const genericptr vy; * connect them up to other areas. */ static boolean -door_into_nonjoined(x, y) -xchar x, y; +door_into_nonjoined(xchar x, xchar y) { xchar tx, ty, diridx; @@ -97,9 +91,7 @@ xchar x, y; } static void -finddpos(cc, xl, yl, xh, yh) -coord *cc; -xchar xl, yl, xh, yh; +finddpos(coord *cc, xchar xl, xchar yl, xchar xh, xchar yh) { register xchar x, y; @@ -131,7 +123,7 @@ xchar xl, yl, xh, yh; /* Sort rooms on the level so they're ordered from left to right on the map. makecorridors() by default links rooms N and N+1 */ void -sort_rooms() +sort_rooms(void) { int i, x, y; int ri[MAXNROFROOMS+1]; @@ -157,14 +149,9 @@ sort_rooms() } static void -do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special, is_room) -register struct mkroom *croom; -int lowx, lowy; -register int hix, hiy; -boolean lit; -schar rtype; -boolean special; -boolean is_room; +do_room_or_subroom(register struct mkroom *croom, + int lowx, int lowy, register int hix, register int hiy, + boolean lit, schar rtype, boolean special, boolean is_room) { register int x, y; struct rm *lev; @@ -235,11 +222,8 @@ boolean is_room; } void -add_room(lowx, lowy, hix, hiy, lit, rtype, special) -int lowx, lowy, hix, hiy; -boolean lit; -schar rtype; -boolean special; +add_room(int lowx, int lowy, int hix, int hiy, + boolean lit, schar rtype, boolean special) { register struct mkroom *croom; @@ -252,12 +236,8 @@ boolean special; } void -add_subroom(proom, lowx, lowy, hix, hiy, lit, rtype, special) -struct mkroom *proom; -int lowx, lowy, hix, hiy; -boolean lit; -schar rtype; -boolean special; +add_subroom(struct mkroom *proom, int lowx, int lowy, int hix, int hiy, + boolean lit, schar rtype, boolean special) { register struct mkroom *croom; @@ -271,8 +251,7 @@ boolean special; } void -free_luathemes(keependgame) -boolean keependgame; /* False: exiting, True: discarding main dungeon */ +free_luathemes(boolean keependgame) /* False: exiting, True: discarding main dungeon */ { int i; @@ -287,7 +266,7 @@ boolean keependgame; /* False: exiting, True: discarding main dungeon */ } static void -makerooms() +makerooms(void) { boolean tried_vault = FALSE; int themeroom_tries = 0; @@ -348,9 +327,7 @@ makerooms() } static void -join(a, b, nxcor) -register int a, b; -boolean nxcor; +join(register int a, register int b, boolean nxcor) { coord cc, tt, org, dest; register xchar tx, ty, xx, yy; @@ -426,7 +403,7 @@ boolean nxcor; } void -makecorridors() +makecorridors(void) { int a, b, i; boolean any = TRUE; @@ -458,9 +435,7 @@ makecorridors() } void -add_door(x, y, aroom) -register int x, y; -register struct mkroom *aroom; +add_door(register int x, register int y, register struct mkroom *aroom) { register struct mkroom *broom; register int tmp; @@ -499,10 +474,7 @@ register struct mkroom *aroom; } static void -dosdoor(x, y, aroom, type) -register xchar x, y; -struct mkroom *aroom; -int type; +dosdoor(register xchar x, register xchar y, struct mkroom *aroom, int type) { boolean shdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE; @@ -566,9 +538,7 @@ int type; } static boolean -place_niche(aroom, dy, xx, yy) -register struct mkroom *aroom; -int *dy, *xx, *yy; +place_niche(register struct mkroom *aroom, int *dy, int *xx, int *yy) { coord dd; @@ -599,8 +569,7 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = { }; static void -makeniche(trap_type) -int trap_type; +makeniche(int trap_type) { register struct mkroom *aroom; struct rm *rm; @@ -664,7 +633,7 @@ int trap_type; } static void -make_niches() +make_niches(void) { int ct = rnd((g.nroom >> 1) + 1), dep = depth(&u.uz); boolean ltptr = (!g.level.flags.noteleport && dep > 15), @@ -683,7 +652,7 @@ make_niches() } static void -makevtele() +makevtele(void) { makeniche(TELEP_TRAP); } @@ -694,7 +663,7 @@ makevtele() * each type initializes what it needs to separately. */ void -clear_level_structures() +clear_level_structures(void) { static struct rm zerorm = { GLYPH_UNEXPLORED, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -766,8 +735,7 @@ clear_level_structures() * Doom) with random monsters, objects, and dungeon features. */ static void -fill_ordinary_room(croom) -struct mkroom *croom; +fill_ordinary_room(struct mkroom *croom) { int trycnt = 0; coord pos; @@ -867,7 +835,7 @@ struct mkroom *croom; } static void -makelevel() +makelevel(void) { register struct mkroom *croom; branch *branchp; @@ -1007,9 +975,8 @@ makelevel() * mineralize(-1, -1, -1, -1, FALSE); => "default" behaviour */ void -mineralize(kelp_pool, kelp_moat, goldprob, gemprob, skip_lvl_checks) -int kelp_pool, kelp_moat, goldprob, gemprob; -boolean skip_lvl_checks; +mineralize(int kelp_pool, int kelp_moat, int goldprob, int gemprob, + boolean skip_lvl_checks) { s_level *sp; struct obj *otmp; @@ -1103,7 +1070,7 @@ boolean skip_lvl_checks; } void -mklev() +mklev(void) { struct mkroom *croom; int ridx; @@ -1145,12 +1112,9 @@ mklev() void #ifdef SPECIALIZATION -topologize(croom, do_ordinary) -struct mkroom *croom; -boolean do_ordinary; +topologize(struct mkroom *croom, boolean do_ordinary) #else -topologize(croom) -struct mkroom *croom; +topologize(struct mkroom *croom) #endif { register int x, y, roomno = (int) ((croom - g.rooms) + ROOMOFFSET); @@ -1210,8 +1174,7 @@ struct mkroom *croom; /* Find an unused room for a branch location. */ static struct mkroom * -find_branch_room(mp) -coord *mp; +find_branch_room(coord *mp) { struct mkroom *croom = 0; @@ -1228,8 +1191,7 @@ coord *mp; /* Find the room for (x,y). Return null if not in a room. */ static struct mkroom * -pos_to_room(x, y) -xchar x, y; +pos_to_room(xchar x, xchar y) { int i; struct mkroom *curr; @@ -1243,9 +1205,8 @@ xchar x, y; /* If given a branch, randomly place a special stair or portal. */ void -place_branch(br, x, y) -branch *br; /* branch to place */ -xchar x, y; /* location */ +place_branch(branch *br, /* branch to place */ + xchar x, xchar y) /* location */ { coord m = {0}; d_level *dest; @@ -1301,8 +1262,7 @@ xchar x, y; /* location */ } static boolean -bydoor(x, y) -register xchar x, y; +bydoor(register xchar x, register xchar y) { register int typ; @@ -1331,8 +1291,7 @@ register xchar x, y; /* see whether it is allowable to create a door at [x,y] */ int -okdoor(x, y) -xchar x, y; +okdoor(xchar x, xchar y) { boolean near_door = bydoor(x, y); @@ -1345,9 +1304,7 @@ xchar x, y; } void -dodoor(x, y, aroom) -int x, y; -struct mkroom *aroom; +dodoor(int x, int y, struct mkroom *aroom) { if (g.doorindex >= DOORMAX) { impossible("DOORMAX exceeded?"); @@ -1358,8 +1315,7 @@ struct mkroom *aroom; } boolean -occupied(x, y) -register xchar x, y; +occupied(register xchar x, register xchar y) { return (boolean) (t_at(x, y) || IS_FURNITURE(levl[x][y].typ) || is_lava(x, y) || is_pool(x, y) @@ -1369,10 +1325,7 @@ register xchar x, y; /* make a trap somewhere (in croom if mazeflag = 0 && !tm) */ /* if tm != null, make trap at that location */ void -mktrap(num, mazeflag, croom, tm) -int num, mazeflag; -struct mkroom *croom; -coord *tm; +mktrap(int num, int mazeflag, struct mkroom *croom, coord *tm) { register int kind; struct trap *t; @@ -1632,10 +1585,9 @@ coord *tm; } void -mkstairs(x, y, up, croom) -xchar x, y; -char up; /* [why 'char' when usage is boolean?] */ -struct mkroom *croom UNUSED; +mkstairs(xchar x, xchar y, + char up, /* [why 'char' when usage is boolean?] */ + struct mkroom *croom UNUSED) { d_level dest; @@ -1669,9 +1621,7 @@ struct mkroom *croom UNUSED; -1 == allow an unjoined room */ static boolean -generate_stairs_room_good(croom, phase) -struct mkroom *croom; -int phase; +generate_stairs_room_good(struct mkroom *croom, int phase) { return (croom && (croom->needjoining || (phase < 0)) && ((!has_dnstairs(croom) && !has_upstairs(croom)) @@ -1682,7 +1632,7 @@ int phase; /* find a good room to generate an up or down stairs in */ static struct mkroom * -generate_stairs_find_room() +generate_stairs_find_room(void) { struct mkroom *croom; int i, phase, tryct = 0; @@ -1713,7 +1663,7 @@ generate_stairs_find_room() /* construct stairs up and down within the same branch, up and down in different rooms if possible */ static void -generate_stairs() +generate_stairs(void) { struct mkroom *croom = generate_stairs_find_room(); coord pos; @@ -1739,9 +1689,7 @@ generate_stairs() } static void -mkfount(mazeflag, croom) -int mazeflag; -struct mkroom *croom; +mkfount(int mazeflag, struct mkroom *croom) { coord m; register int tryct = 0; @@ -1765,9 +1713,7 @@ struct mkroom *croom; } static boolean -find_okay_roompos(croom, crd) -struct mkroom *croom; -coord *crd; +find_okay_roompos(struct mkroom *croom, coord *crd) { int tryct = 0; @@ -1781,8 +1727,7 @@ coord *crd; } static void -mksink(croom) -struct mkroom *croom; +mksink(struct mkroom *croom) { coord m; @@ -1796,8 +1741,7 @@ struct mkroom *croom; } static void -mkaltar(croom) -struct mkroom *croom; +mkaltar(struct mkroom *croom) { coord m; aligntyp al; @@ -1817,8 +1761,7 @@ struct mkroom *croom; } static void -mkgrave(croom) -struct mkroom *croom; +mkgrave(struct mkroom *croom) { coord m; register int tryct = 0; @@ -1879,7 +1822,7 @@ struct mkroom *croom; * attempted while blind (in order to make blind-from-birth conduct viable).] */ void -mkinvokearea() +mkinvokearea(void) { int dist; xchar xmin = g.inv_pos.x, xmax = g.inv_pos.x, @@ -1938,9 +1881,7 @@ mkinvokearea() * Temporarily overrides vision in the name of a nice effect. */ static void -mkinvpos(x, y, dist) -xchar x, y; -int dist; +mkinvpos(xchar x, xchar y, int dist) { struct trap *ttmp; struct obj *otmp; @@ -2035,8 +1976,7 @@ int dist; * Ludios will remain isolated until the branch is corrected by this function. */ static void -mk_knox_portal(x, y) -xchar x, y; +mk_knox_portal(xchar x, xchar y) { d_level *source; branch *br; diff --git a/src/mkmap.c b/src/mkmap.c index 8100394ca..d114a4561 100644 --- a/src/mkmap.c +++ b/src/mkmap.c @@ -8,21 +8,19 @@ #define HEIGHT (ROWNO - 1) #define WIDTH (COLNO - 2) -static void FDECL(init_map, (SCHAR_P)); -static void FDECL(init_fill, (SCHAR_P, SCHAR_P)); -static schar FDECL(get_map, (int, int, SCHAR_P)); -static void FDECL(pass_one, (SCHAR_P, SCHAR_P)); -static void FDECL(pass_two, (SCHAR_P, SCHAR_P)); -static void FDECL(pass_three, (SCHAR_P, SCHAR_P)); -static void FDECL(join_map, (SCHAR_P, SCHAR_P)); -static void FDECL(finish_map, - (SCHAR_P, SCHAR_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -static void FDECL(remove_room, (unsigned)); -void FDECL(mkmap, (lev_init *)); +static void init_map(schar); +static void init_fill(schar, schar); +static schar get_map(int, int, schar); +static void pass_one(schar, schar); +static void pass_two(schar, schar); +static void pass_three(schar, schar); +static void join_map(schar, schar); +static void finish_map(schar, schar, boolean, boolean, boolean); +static void remove_room(unsigned); +void mkmap(lev_init *); static void -init_map(bg_typ) -schar bg_typ; +init_map(schar bg_typ) { register int i, j; @@ -34,8 +32,7 @@ schar bg_typ; } static void -init_fill(bg_typ, fg_typ) -schar bg_typ, fg_typ; +init_fill(schar bg_typ, schar fg_typ) { register int i, j; long limit, count; @@ -53,9 +50,7 @@ schar bg_typ, fg_typ; } static schar -get_map(col, row, bg_typ) -int col, row; -schar bg_typ; +get_map(int col, int row, schar bg_typ) { if (col <= 0 || row < 0 || col > WIDTH || row >= HEIGHT) return bg_typ; @@ -66,8 +61,7 @@ static const int dirs[16] = { -1, -1 /**/, -1, 0 /**/, -1, 1 /**/, 0, -1 /**/, 0, 1 /**/, 1, -1 /**/, 1, 0 /**/, 1, 1 }; static void -pass_one(bg_typ, fg_typ) -schar bg_typ, fg_typ; +pass_one(schar bg_typ, schar fg_typ) { register int i, j; short count, dr; @@ -100,8 +94,7 @@ schar bg_typ, fg_typ; #define new_loc(i, j) *(g.new_locations + ((j) * (WIDTH + 1)) + (i)) static void -pass_two(bg_typ, fg_typ) -schar bg_typ, fg_typ; +pass_two(schar bg_typ, schar fg_typ) { register int i, j; short count, dr; @@ -124,8 +117,7 @@ schar bg_typ, fg_typ; } static void -pass_three(bg_typ, fg_typ) -schar bg_typ, fg_typ; +pass_three(schar bg_typ, schar fg_typ) { register int i, j; short count, dr; @@ -154,12 +146,12 @@ schar bg_typ, fg_typ; * exactly matching levl[sx][sy].typ and walls are included as well. */ void -flood_fill_rm(sx, sy, rmno, lit, anyroom) -int sx; -register int sy; -register int rmno; -boolean lit; -boolean anyroom; +flood_fill_rm( + int sx, + register int sy, + register int rmno, + boolean lit, + boolean anyroom) { register int i; int nx; @@ -247,8 +239,7 @@ boolean anyroom; } static void -join_map(bg_typ, fg_typ) -schar bg_typ, fg_typ; +join_map(schar bg_typ, schar fg_typ) { register struct mkroom *croom, *croom2; @@ -320,9 +311,12 @@ joinm: } static void -finish_map(fg_typ, bg_typ, lit, walled, icedpools) -schar fg_typ, bg_typ; -boolean lit, walled, icedpools; +finish_map( + schar fg_typ, + schar bg_typ, + boolean lit, + boolean walled, + boolean icedpools) { int i, j; @@ -361,8 +355,7 @@ boolean lit, walled, icedpools; * region are all set. */ void -remove_rooms(lx, ly, hx, hy) -int lx, ly, hx, hy; +remove_rooms(int lx, int ly, int hx, int hy) { int i; struct mkroom *croom; @@ -393,8 +386,7 @@ int lx, ly, hx, hy; * Currently handles only the removal of rooms that have no subrooms. */ static void -remove_room(roomno) -unsigned roomno; +remove_room(unsigned int roomno) { struct mkroom *croom = &g.rooms[roomno]; struct mkroom *maxroom = &g.rooms[--g.nroom]; @@ -426,8 +418,7 @@ unsigned roomno; #define N_P3_ITER 2 /* tune map smoothing via this value */ boolean -litstate_rnd(litstate) -int litstate; +litstate_rnd(int litstate) { if (litstate < 0) return (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE; @@ -435,8 +426,7 @@ int litstate; } void -mkmap(init_lev) -lev_init *init_lev; +mkmap(lev_init* init_lev) { schar bg_typ = init_lev->bg, fg_typ = init_lev->fg; boolean smooth = init_lev->smoothed, join = init_lev->joined; diff --git a/src/mkmaze.c b/src/mkmaze.c index c79068bf1..e5db13835 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -6,26 +6,25 @@ #include "hack.h" #include "sp_lev.h" -static int FDECL(iswall, (int, int)); -static int FDECL(iswall_or_stone, (int, int)); -static boolean FDECL(is_solid, (int, int)); -static int FDECL(extend_spine, (int[3][3], int, int, int)); -static void FDECL(wall_cleanup, (int, int, int, int)); -static boolean FDECL(okay, (int, int, int)); -static void FDECL(maze0xy, (coord *)); -static boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, BOOLEAN_P, d_level *)); -static void NDECL(baalz_fixup); -static void NDECL(setup_waterlevel); -static void NDECL(unsetup_waterlevel); -static void FDECL(check_ransacked, (char *)); -static void FDECL(migr_booty_item, (int, const char *)); -static void FDECL(migrate_orc, (struct monst *, unsigned long)); -static void FDECL(shiny_orc_stuff, (struct monst *)); -static void NDECL(stolen_booty); -static boolean FDECL(maze_inbounds, (int, int)); -static void FDECL(maze_remove_deadends, (XCHAR_P)); +static int iswall(int, int); +static int iswall_or_stone(int, int); +static boolean is_solid(int, int); +static int extend_spine(int[3][3], int, int, int); +static void wall_cleanup(int, int, int, int); +static boolean okay(int, int, int); +static void maze0xy(coord *); +static boolean put_lregion_here(xchar, xchar, xchar, xchar, xchar, + xchar, xchar, boolean, d_level *); +static void baalz_fixup(void); +static void setup_waterlevel(void); +static void unsetup_waterlevel(void); +static void check_ransacked(char *); +static void migr_booty_item(int, const char *); +static void migrate_orc(struct monst *, unsigned long); +static void shiny_orc_stuff(struct monst *); +static void stolen_booty(void); +static boolean maze_inbounds(int, int); +static void maze_remove_deadends(xchar); /* adjust a coordinate one step in the specified direction */ #define mz_move(X, Y, dir) \ @@ -40,8 +39,7 @@ static void FDECL(maze_remove_deadends, (XCHAR_P)); } while (0) static int -iswall(x, y) -int x, y; +iswall(int x, int y) { int type; @@ -53,8 +51,7 @@ int x, y; } static int -iswall_or_stone(x, y) -int x, y; +iswall_or_stone(int x, int y) { /* out of bounds = stone */ if (!isok(x, y)) @@ -65,8 +62,7 @@ int x, y; /* return TRUE if out of bounds, wall or rock */ static boolean -is_solid(x, y) -int x, y; +is_solid(int x, int y) { return (boolean) (!isok(x, y) || IS_STWALL(levl[x][y].typ)); } @@ -90,9 +86,7 @@ int x, y; * . W W */ static int -extend_spine(locale, wall_there, dx, dy) -int locale[3][3]; -int wall_there, dx, dy; +extend_spine(int locale[3][3], int wall_there, int dx, int dy) { int spine, nx, ny; @@ -124,8 +118,7 @@ int wall_there, dx, dy; /* Remove walls totally surrounded by stone */ static void -wall_cleanup(x1, y1, x2, y2) -int x1, y1, x2, y2; +wall_cleanup(int x1, int y1, int x2, int y2) { uchar type; int x, y; @@ -156,13 +149,12 @@ int x1, y1, x2, y2; /* Correct wall types so they extend and connect to each other */ void -fix_wall_spines(x1, y1, x2, y2) -int x1, y1, x2, y2; +fix_wall_spines(int x1, int y1, int x2, int y2) { uchar type; int x, y; struct rm *lev; - int FDECL((*loc_f), (int, int)); + int (*loc_f)(int, int); int bits; int locale[3][3]; /* rock or wall status surrounding positions */ @@ -218,17 +210,14 @@ int x1, y1, x2, y2; } void -wallification(x1, y1, x2, y2) -int x1, y1, x2, y2; +wallification(int x1, int y1, int x2, int y2) { wall_cleanup(x1, y1, x2, y2); fix_wall_spines(x1, y1, x2, y2); } static boolean -okay(x, y, dir) -int x, y; -int dir; +okay(int x, int y, int dir) { mz_move(x, y, dir); mz_move(x, y, dir); @@ -240,8 +229,7 @@ int dir; /* find random starting point for maze generation */ static void -maze0xy(cc) -coord *cc; +maze0xy(coord * cc) { cc->x = 3 + 2 * rn2((g.x_maze_max >> 1) - 1); cc->y = 3 + 2 * rn2((g.y_maze_max >> 1) - 1); @@ -255,9 +243,7 @@ coord *cc; * NOT (pos is corridor and a maze level OR pos is a room OR pos is air) */ boolean -bad_location(x, y, lx, ly, hx, hy) -xchar x, y; -xchar lx, ly, hx, hy; +bad_location(xchar x, xchar y, xchar lx, xchar ly, xchar hx, xchar hy) { return (boolean) (occupied(x, y) || within_bounded_area(x, y, lx, ly, hx, hy) @@ -269,11 +255,11 @@ xchar lx, ly, hx, hy; /* pick a location in area (lx, ly, hx, hy) but not in (nlx, nly, nhx, nhy) and place something (based on rtype) in that region */ void -place_lregion(lx, ly, hx, hy, nlx, nly, nhx, nhy, rtype, lev) -xchar lx, ly, hx, hy; -xchar nlx, nly, nhx, nhy; -xchar rtype; -d_level *lev; +place_lregion( + xchar lx, xchar ly, xchar hx, xchar hy, + xchar nlx, xchar nly, xchar nhx,xchar nhy, + xchar rtype, + d_level *lev) { int trycnt; boolean oneshot; @@ -316,12 +302,12 @@ d_level *lev; } static boolean -put_lregion_here(x, y, nlx, nly, nhx, nhy, rtype, oneshot, lev) -xchar x, y; -xchar nlx, nly, nhx, nhy; -xchar rtype; -boolean oneshot; -d_level *lev; +put_lregion_here( + xchar x, xchar y, + xchar nlx, xchar nly, xchar nhx, xchar nhy, + xchar rtype, + boolean oneshot, + d_level *lev) { struct monst *mtmp; @@ -373,7 +359,7 @@ d_level *lev; its legs are walls within solid rock--regular wallification classifies them as superfluous and gets rid of them */ static void -baalz_fixup() +baalz_fixup(void) { struct monst *mtmp; int x, y, lastx, lasty; @@ -459,7 +445,7 @@ baalz_fixup() /* this is special stuff that the level compiler cannot (yet) handle */ void -fixup_special() +fixup_special(void) { lev_region *r = g.lregions; struct d_level lev; @@ -587,8 +573,7 @@ fixup_special() } static void -check_ransacked(s) -char *s; +check_ransacked(char * s) { /* this kludge only works as long as orctown is minetn-1 */ g.ransacked = (u.uz.dnum == mines_dnum && !strcmp(s, "minetn-1")); @@ -598,9 +583,7 @@ char *s; static const char *orcfruit[] = { "paddle cactus", "dwarven root" }; static void -migrate_orc(mtmp, mflags) -struct monst *mtmp; -unsigned long mflags; +migrate_orc(struct monst* mtmp, unsigned long mflags) { int nlev, max_depth, cur_depth; d_level dest; @@ -631,8 +614,7 @@ unsigned long mflags; } static void -shiny_orc_stuff(mtmp) -struct monst *mtmp; +shiny_orc_stuff(struct monst* mtmp) { int gemprob, goldprob, otyp; struct obj *otmp; @@ -663,9 +645,7 @@ struct monst *mtmp; } } static void -migr_booty_item(otyp, gang) -int otyp; -const char *gang; +migr_booty_item(int otyp, const char* gang) { struct obj *otmp; @@ -778,16 +758,14 @@ stolen_booty(VOID_ARGS) #undef ORC_LEADER static boolean -maze_inbounds(x, y) -int x, y; +maze_inbounds(int x, int y) { return (x >= 2 && y >= 2 && x < g.x_maze_max && y < g.y_maze_max && isok(x, y)); } static void -maze_remove_deadends(typ) -xchar typ; +maze_remove_deadends(xchar typ) { char dirok[4]; int x, y, dir, idx, idx2, dx, dy, dx2, dy2; @@ -833,9 +811,7 @@ xchar typ; * TODO: rewrite walkfrom so it works on temp space, not levl */ void -create_maze(corrwid, wallthick, rmdeadends) -int corrwid, wallthick; -boolean rmdeadends; +create_maze(int corrwid, int wallthick, boolean rmdeadends) { int x,y; coord mm; @@ -931,8 +907,7 @@ boolean rmdeadends; void -makemaz(s) -const char *s; +makemaz(const char *s) { int x, y; char protofile[20]; @@ -1097,9 +1072,7 @@ const char *s; * that is totally safe. */ void -walkfrom(x, y, typ) -int x, y; -schar typ; +walkfrom(int x, int y, schar typ) { #define CELLS (ROWNO * COLNO) / 4 /* a maze cell is 4 squares */ char mazex[CELLS + 1], mazey[CELLS + 1]; /* char's are OK */ @@ -1146,9 +1119,7 @@ schar typ; #else /* !MICRO */ void -walkfrom(x, y, typ) -int x, y; -schar typ; +walkfrom(int x, int y, schar typ) { int q, a, dir; int dirs[4]; @@ -1185,8 +1156,7 @@ schar typ; /* find random point in generated corridors, so we don't create items in moats, bunkers, or walls */ void -mazexy(cc) -coord *cc; +mazexy(coord *cc) { int cpt = 0; @@ -1215,8 +1185,7 @@ coord *cc; } void -get_level_extends(left, top, right, bottom) -int *left, *top, *right, *bottom; +get_level_extends(int * left, int * top, int * right, int * bottom) { int x, y; unsigned typ; @@ -1301,7 +1270,7 @@ int *left, *top, *right, *bottom; * that provides a window of abuse for wallified special levels */ void -bound_digging() +bound_digging(void) { int x, y; int xmin, xmax, ymin, ymax; @@ -1318,8 +1287,7 @@ bound_digging() } void -mkportal(x, y, todnum, todlevel) -xchar x, y, todnum, todlevel; +mkportal(xchar x, xchar y, xchar todnum, xchar todlevel) { /* a portal "trap" must be matched by a portal in the destination dungeon/dlevel */ @@ -1337,7 +1305,7 @@ xchar x, y, todnum, todlevel; } void -fumaroles() +fumaroles(void) { xchar n; boolean snd = FALSE, loud = FALSE; @@ -1372,12 +1340,12 @@ fumaroles() #define gbxmax (g.xmax - 1) #define gbymax (g.ymax - 1) -static void NDECL(set_wportal); -static void FDECL(mk_bubble, (int, int, int)); -static void FDECL(mv_bubble, (struct bubble *, int, int, BOOLEAN_P)); +static void set_wportal(void); +static void mk_bubble(int, int, int); +static void mv_bubble(struct bubble *, int, int, boolean); void -movebubbles() +movebubbles(void) { static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1521,7 +1489,7 @@ movebubbles() /* when moving in water, possibly (1 in 3) alter the intended destination */ void -water_friction() +water_friction(void) { int x, y, dx, dy; boolean eff = FALSE; @@ -1555,8 +1523,7 @@ water_friction() } void -save_waterlevel(nhfp) -NHFILE *nhfp; +save_waterlevel(NHFILE* nhfp) { struct bubble *b; @@ -1584,8 +1551,7 @@ NHFILE *nhfp; } void -restore_waterlevel(nhfp) -NHFILE *nhfp; +restore_waterlevel(NHFILE* nhfp) { struct bubble *b = (struct bubble *) 0, *btmp; int i, n = 0; @@ -1628,8 +1594,7 @@ NHFILE *nhfp; } const char * -waterbody_name(x, y) -xchar x, y; +waterbody_name(xchar x, xchar y) { struct rm *lev; schar ltyp; @@ -1658,7 +1623,7 @@ xchar x, y; } static void -set_wportal() +set_wportal(void) { /* there better be only one magic portal on water level... */ for (g.wportal = g.ftrap; g.wportal; g.wportal = g.wportal->ntrap) @@ -1668,7 +1633,7 @@ set_wportal() } static void -setup_waterlevel() +setup_waterlevel(void) { int x, y, xskip, yskip, typ, glyph; @@ -1715,7 +1680,7 @@ setup_waterlevel() } static void -unsetup_waterlevel() +unsetup_waterlevel(void) { struct bubble *b, *bb; @@ -1728,8 +1693,7 @@ unsetup_waterlevel() } static void -mk_bubble(x, y, n) -int x, y, n; +mk_bubble(int x, int y, int n) { /* * These bit masks make visually pleasing bubbles on a normal aspect @@ -1792,10 +1756,7 @@ int x, y, n; * This property also makes leaving a bubble slightly difficult. */ static void -mv_bubble(b, dx, dy, ini) -struct bubble *b; -int dx, dy; -boolean ini; +mv_bubble(struct bubble* b, int dx, int dy, boolean ini) { int x, y, i, j, colli = 0; struct container *cons, *ctemp; diff --git a/src/mkobj.c b/src/mkobj.c index 85052e3fd..e57d7b40e 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -5,21 +5,20 @@ #include "hack.h" -static void FDECL(mkbox_cnts, (struct obj *)); -static unsigned FDECL(nextoid, (struct obj *, struct obj *)); -static void FDECL(maybe_adjust_light, (struct obj *, int)); -static void FDECL(obj_timer_checks, (struct obj *, - XCHAR_P, XCHAR_P, int)); -static void FDECL(container_weight, (struct obj *)); -static struct obj *FDECL(save_mtraits, (struct obj *, struct monst *)); -static void FDECL(objlist_sanity, (struct obj *, int, const char *)); -static void FDECL(mon_obj_sanity, (struct monst *, const char *)); -static const char *FDECL(where_name, (struct obj *)); -static void FDECL(insane_object, (struct obj *, const char *, - const char *, struct monst *)); -static void FDECL(check_contained, (struct obj *, const char *)); -static void FDECL(check_glob, (struct obj *, const char *)); -static void FDECL(sanity_check_worn, (struct obj *)); +static void mkbox_cnts(struct obj *); +static unsigned nextoid(struct obj *, struct obj *); +static void maybe_adjust_light(struct obj *, int); +static void obj_timer_checks(struct obj *, xchar, xchar, int); +static void container_weight(struct obj *); +static struct obj *save_mtraits(struct obj *, struct monst *); +static void objlist_sanity(struct obj *, int, const char *); +static void mon_obj_sanity(struct monst *, const char *); +static const char *where_name(struct obj *); +static void insane_object(struct obj *, const char *, const char *, + struct monst *); +static void check_contained(struct obj *, const char *); +static void check_glob(struct obj *, const char *); +static void sanity_check_worn(struct obj *); struct icp { int iprob; /* probability of an item type */ @@ -70,14 +69,13 @@ static const struct icp hellprobs[] = { { 20, WEAPON_CLASS }, static const struct oextra zerooextra = DUMMY; static void -init_oextra(oex) -struct oextra *oex; +init_oextra(struct oextra* oex) { *oex = zerooextra; } struct oextra * -newoextra() +newoextra(void) { struct oextra *oextra; @@ -87,8 +85,7 @@ newoextra() } void -dealloc_oextra(o) -struct obj *o; +dealloc_oextra(struct obj* o) { struct oextra *x = o->oextra; @@ -106,8 +103,7 @@ struct obj *o; } void -newomonst(otmp) -struct obj *otmp; +newomonst(struct obj* otmp) { if (!otmp->oextra) otmp->oextra = newoextra(); @@ -121,8 +117,7 @@ struct obj *otmp; } void -free_omonst(otmp) -struct obj *otmp; +free_omonst(struct obj* otmp) { if (otmp->oextra) { struct monst *m = OMONST(otmp); @@ -137,8 +132,7 @@ struct obj *otmp; } void -newomid(otmp) -struct obj *otmp; +newomid(struct obj* otmp) { if (!otmp->oextra) otmp->oextra = newoextra(); @@ -146,16 +140,13 @@ struct obj *otmp; } void -free_omid(otmp) -struct obj *otmp; +free_omid(struct obj* otmp) { OMID(otmp) = 0; } void -new_omailcmd(otmp, response_cmd) -struct obj *otmp; -const char *response_cmd; +new_omailcmd(struct obj* otmp, const char * response_cmd) { if (!otmp->oextra) otmp->oextra = newoextra(); @@ -165,8 +156,7 @@ const char *response_cmd; } void -free_omailcmd(otmp) -struct obj *otmp; +free_omailcmd(struct obj* otmp) { if (otmp->oextra && OMAILCMD(otmp)) { free((genericptr_t) OMAILCMD(otmp)); @@ -175,10 +165,7 @@ struct obj *otmp; } struct obj * -mkobj_at(let, x, y, artif) -char let; -int x, y; -boolean artif; +mkobj_at(char let, int x, int y, boolean artif) { struct obj *otmp; @@ -188,9 +175,7 @@ boolean artif; } struct obj * -mksobj_at(otyp, x, y, init, artif) -int otyp, x, y; -boolean init, artif; +mksobj_at(int otyp, int x, int y, boolean init, boolean artif) { struct obj *otmp; @@ -200,10 +185,11 @@ boolean init, artif; } struct obj * -mksobj_migr_to_species(otyp, mflags2, init, artif) -int otyp; -unsigned mflags2; -boolean init, artif; +mksobj_migr_to_species( + int otyp, + unsigned int mflags2, + boolean init, + boolean artif) { struct obj *otmp; @@ -217,9 +203,7 @@ boolean init, artif; /* mkobj(): select a type of item from a class, use mksobj() to create it; result is always non-Null */ struct obj * -mkobj(oclass, artif) -int oclass; -boolean artif; +mkobj(int oclass, boolean artif) { int tprob, i, prob = rnd(1000); @@ -250,8 +234,7 @@ boolean artif; } static void -mkbox_cnts(box) -struct obj *box; +mkbox_cnts(struct obj* box) { register int n; register struct obj *otmp; @@ -332,7 +315,7 @@ struct obj *box; /* select a random, common monster type */ int -rndmonnum() +rndmonnum(void) { register struct permonst *ptr; register int i; @@ -354,8 +337,7 @@ rndmonnum() } void -copy_oextra(obj2, obj1) -struct obj *obj2, *obj1; +copy_oextra(struct obj* obj2, struct obj* obj1) { if (!obj2 || !obj1 || !obj1->oextra) return; @@ -396,9 +378,7 @@ struct obj *obj2, *obj1; * in the nobj chain (and nexthere chain when on the floor). */ struct obj * -splitobj(obj, num) -struct obj *obj; -long num; +splitobj(struct obj* obj, long num) { struct obj *otmp; @@ -439,8 +419,7 @@ long num; /* when splitting a stack that has o_id-based shop prices, pick an o_id value for the new stack that will maintain the same price */ static unsigned -nextoid(oldobj, newobj) -struct obj *oldobj, *newobj; +nextoid(struct obj* oldobj, struct obj* newobj) { int olddif, newdif, trylimit = 256; /* limit of 4 suffices at present */ unsigned oid = g.context.ident - 1; /* loop increment will reverse -1 */ @@ -459,8 +438,7 @@ struct obj *oldobj, *newobj; /* try to find the stack obj was split from, then merge them back together; returns the combined object if unsplit is successful, null otherwise */ struct obj * -unsplitobj(obj) -struct obj *obj; +unsplitobj(struct obj* obj) { unsigned target_oid = 0; struct obj *oparent = 0, *ochild = 0, *list = 0; @@ -530,7 +508,7 @@ struct obj *obj; /* reset splitobj()/unsplitobj() context */ void -clear_splitobjs() +clear_splitobjs(void) { g.context.objsplit.parent_oid = g.context.objsplit.child_oid = 0; } @@ -545,9 +523,7 @@ clear_splitobjs() * not actually moving something. */ void -replace_object(obj, otmp) -struct obj *obj; -struct obj *otmp; +replace_object(struct obj* obj, struct obj* otmp) { otmp->where = obj->where; switch (obj->where) { @@ -590,8 +566,7 @@ struct obj *otmp; /* is 'obj' inside a container whose contents aren't known? if so, return the outermost container meeting that criterium */ struct obj * -unknwn_contnr_contents(obj) -struct obj *obj; +unknwn_contnr_contents(struct obj* obj) { struct obj *result = 0, *parent; @@ -619,8 +594,7 @@ struct obj *obj; * usage of an object. */ void -bill_dummy_object(otmp) -register struct obj *otmp; +bill_dummy_object(struct obj* otmp) { register struct obj *dummy; long cost = 0L; @@ -660,9 +634,7 @@ static const char *const alteration_verbs[] = { /* possibly bill for an object which the player has just modified */ void -costly_alteration(obj, alter_type) -struct obj *obj; -int alter_type; +costly_alteration(struct obj* obj, int alter_type) { xchar ox, oy; char objroom; @@ -738,10 +710,7 @@ static const char dknowns[] = { WAND_CLASS, RING_CLASS, POTION_CLASS, /* mksobj(): create a specific type of object; result it always non-Null */ struct obj * -mksobj(otyp, init, artif) -int otyp; -boolean init; -boolean artif; +mksobj(int otyp, boolean init, boolean artif) { int mndx, tryct; struct obj *otmp; @@ -1110,9 +1079,7 @@ boolean artif; * */ void -set_corpsenm(obj, id) -struct obj *obj; -int id; +set_corpsenm(struct obj* obj, int id) { long when = 0L; @@ -1148,9 +1115,7 @@ int id; /* Return the number of turns after which a Rider corpse revives */ long -rider_revival_time(body, retry) -struct obj *body; -boolean retry; +rider_revival_time(struct obj* body, boolean retry) { long when; long minturn = retry ? 3L : (body->corpsenm == PM_DEATH) ? 6L : 12L; @@ -1168,8 +1133,7 @@ boolean retry; * This takes the age of the corpse into consideration as of 3.4.0. */ void -start_corpse_timeout(body) -struct obj *body; +start_corpse_timeout(struct obj* body) { long when; /* rot away when this old */ long corpse_age; /* age of corpse */ @@ -1216,9 +1180,7 @@ struct obj *body; } static void -maybe_adjust_light(obj, old_range) -struct obj *obj; -int old_range; +maybe_adjust_light(struct obj* obj, int old_range) { char buf[BUFSZ]; xchar ox, oy; @@ -1259,8 +1221,7 @@ int old_range; */ void -bless(otmp) -register struct obj *otmp; +bless(struct obj* otmp) { int old_light = 0; @@ -1282,8 +1243,7 @@ register struct obj *otmp; } void -unbless(otmp) -register struct obj *otmp; +unbless(struct obj* otmp) { int old_light = 0; @@ -1299,8 +1259,7 @@ register struct obj *otmp; } void -curse(otmp) -register struct obj *otmp; +curse(struct obj* otmp) { unsigned already_cursed; int old_light = 0; @@ -1339,8 +1298,7 @@ register struct obj *otmp; } void -uncurse(otmp) -register struct obj *otmp; +uncurse(struct obj* otmp) { int old_light = 0; @@ -1359,9 +1317,7 @@ register struct obj *otmp; } void -blessorcurse(otmp, chance) -register struct obj *otmp; -register int chance; +blessorcurse(struct obj* otmp, int chance) { if (otmp->blessed || otmp->cursed) return; @@ -1377,17 +1333,14 @@ register int chance; } int -bcsign(otmp) -register struct obj *otmp; +bcsign(struct obj* otmp) { return (!!otmp->blessed - !!otmp->cursed); } /* set the object's bless/curse-state known flag */ void -set_bknown(obj, onoff) -struct obj *obj; -unsigned onoff; /* 1 or 0 */ +set_bknown(struct obj* obj, unsigned int onoff /* 1 or 0 */) { if (obj->bknown != onoff) { obj->bknown = onoff; @@ -1405,8 +1358,7 @@ unsigned onoff; /* 1 or 0 */ * container's weight. */ int -weight(obj) -register struct obj *obj; +weight(struct obj* obj) { int wt = (int) objects[obj->otyp].oc_weight; @@ -1467,17 +1419,14 @@ static const int treefruits[] = { APPLE, ORANGE, PEAR, BANANA, EUCALYPTUS_LEAF } /* called when a tree is kicked; never returns Null */ struct obj * -rnd_treefruit_at(x, y) -int x, y; +rnd_treefruit_at(int x, int y) { return mksobj_at(treefruits[rn2(SIZE(treefruits))], x, y, TRUE, FALSE); } /* create a stack of N gold pieces; never returns Null */ struct obj * -mkgold(amount, x, y) -long amount; -int x, y; +mkgold(long amount, int x, int y) { struct obj *gold = g_at(x, y); @@ -1513,12 +1462,12 @@ int x, y; * resurrection. */ struct obj * -mkcorpstat(objtype, mtmp, ptr, x, y, corpstatflags) -int objtype; /* CORPSE or STATUE */ -struct monst *mtmp; -struct permonst *ptr; -int x, y; -unsigned corpstatflags; +mkcorpstat( + int objtype, /* CORPSE or STATUE */ + struct monst *mtmp, + struct permonst *ptr, + int x, int y, + unsigned corpstatflags) { struct obj *otmp; boolean init = ((corpstatflags & CORPSTAT_INIT) != 0); @@ -1571,8 +1520,7 @@ unsigned corpstatflags; * The return value is an index into mons[]. */ int -corpse_revive_type(obj) -struct obj *obj; +corpse_revive_type(struct obj* obj) { int revivetype = obj->corpsenm; struct monst *mtmp; @@ -1590,9 +1538,7 @@ struct obj *obj; * a lasting association between the two. */ struct obj * -obj_attach_mid(obj, mid) -struct obj *obj; -unsigned mid; +obj_attach_mid(struct obj* obj, unsigned int mid) { if (!mid || !obj) return (struct obj *) 0; @@ -1602,9 +1548,7 @@ unsigned mid; } static struct obj * -save_mtraits(obj, mtmp) -struct obj *obj; -struct monst *mtmp; +save_mtraits(struct obj* obj, struct monst* mtmp) { if (mtmp->ispriest) forget_temple_entry(mtmp); /* EPRI() */ @@ -1647,9 +1591,7 @@ struct monst *mtmp; * the one contained within the obj. */ struct monst * -get_mtraits(obj, copyof) -struct obj *obj; -boolean copyof; +get_mtraits(struct obj* obj, boolean copyof) { struct monst *mtmp = (struct monst *) 0; struct monst *mnew = (struct monst *) 0; @@ -1675,9 +1617,9 @@ boolean copyof; /* make an object named after someone listed in the scoreboard file; never returns Null */ struct obj * -mk_tt_object(objtype, x, y) -int objtype; /* CORPSE or STATUE */ -int x, y; +mk_tt_object( + int objtype, /* CORPSE or STATUE */ + int x, int y) { struct obj *otmp; boolean initialize_it; @@ -1696,11 +1638,11 @@ int x, y; /* make a new corpse or statue, uninitialized if a statue (i.e. no books); never returns Null */ struct obj * -mk_named_object(objtype, ptr, x, y, nm) -int objtype; /* CORPSE or STATUE */ -struct permonst *ptr; -int x, y; -const char *nm; +mk_named_object( +int objtype, /* CORPSE or STATUE */ +struct permonst *ptr, +int x, int y, +const char *nm) { struct obj *otmp; unsigned corpstatflags = (objtype != STATUE) ? CORPSTAT_INIT @@ -1713,8 +1655,7 @@ const char *nm; } boolean -is_flammable(otmp) -register struct obj *otmp; +is_flammable(struct obj* otmp) { int otyp = otmp->otyp; int omat = objects[otyp].oc_material; @@ -1733,8 +1674,7 @@ register struct obj *otmp; } boolean -is_rottable(otmp) -register struct obj *otmp; +is_rottable(struct obj* otmp) { int otyp = otmp->otyp; @@ -1749,14 +1689,12 @@ register struct obj *otmp; /* put the object at the given location */ void -place_object(otmp, x, y) -register struct obj *otmp; -int x, y; +place_object(struct obj* otmp, int x, int y) { register struct obj *otmp2 = g.level.objects[x][y]; if (!isok(x, y)) { /* validate location */ - void VDECL((*func), (const char *, ...)) PRINTF_F(1, 2); + void (*func)(const char *, ...); func = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic : impossible; @@ -1809,9 +1747,7 @@ int x, y; * Also used for starting ice effects too. [zap.c] */ void -obj_ice_effects(x, y, do_buried) -int x, y; -boolean do_buried; +obj_ice_effects(int x, int y, boolean do_buried) { struct obj *otmp; @@ -1837,8 +1773,7 @@ boolean do_buried; * restarted etc. */ long -peek_at_iced_corpse_age(otmp) -struct obj *otmp; +peek_at_iced_corpse_age(struct obj* otmp) { long age, retval = otmp->age; @@ -1855,10 +1790,10 @@ struct obj *otmp; } static void -obj_timer_checks(otmp, x, y, force) -struct obj *otmp; -xchar x, y; -int force; /* 0 = no force so do checks, <0 = force off, >0 force on */ +obj_timer_checks( + struct obj* otmp, + xchar x, xchar y, + int force) /* 0 = no force so do checks, <0 = force off, >0 force on */ { long tleft = 0L; short action = ROT_CORPSE; @@ -1923,8 +1858,7 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */ #undef ROT_ICE_ADJUSTMENT void -remove_object(otmp) -register struct obj *otmp; +remove_object(struct obj* otmp) { xchar x = otmp->ox; xchar y = otmp->oy; @@ -1942,9 +1876,7 @@ register struct obj *otmp; /* throw away all of a monster's inventory */ void -discard_minvent(mtmp, uncreate_artifacts) -struct monst *mtmp; -boolean uncreate_artifacts; +discard_minvent(struct monst* mtmp, boolean uncreate_artifacts) { struct obj *otmp, *mwep = MON_WEP(mtmp); boolean keeping_mon = !DEADMONSTER(mtmp); @@ -1984,8 +1916,7 @@ boolean uncreate_artifacts; * OBJ_LUAFREE obj is dealloc'd from core, but still used by lua */ void -obj_extract_self(obj) -struct obj *obj; +obj_extract_self(struct obj* obj) { switch (obj->where) { case OBJ_FREE: @@ -2023,8 +1954,7 @@ struct obj *obj; /* Extract the given object from the chain, following nobj chain. */ void -extract_nobj(obj, head_ptr) -struct obj *obj, **head_ptr; +extract_nobj(struct obj* obj, struct obj** head_ptr) { struct obj *curr, *prev; @@ -2051,8 +1981,7 @@ struct obj *obj, **head_ptr; * in tandem with extract_nobj, which does set it. */ void -extract_nexthere(obj, head_ptr) -struct obj *obj, **head_ptr; +extract_nexthere(struct obj* obj, struct obj** head_ptr) { struct obj *curr, *prev; @@ -2077,9 +2006,7 @@ struct obj *obj, **head_ptr; * Otherwise 0 is returned. */ int -add_to_minv(mon, obj) -struct monst *mon; -struct obj *obj; +add_to_minv(struct monst *mon, struct obj* obj) { struct obj *otmp; @@ -2103,8 +2030,7 @@ struct obj *obj; * The input obj may be deleted in the process. */ struct obj * -add_to_container(container, obj) -struct obj *container, *obj; +add_to_container(struct obj* container, struct obj* obj) { struct obj *otmp; @@ -2126,8 +2052,7 @@ struct obj *container, *obj; } void -add_to_migration(obj) -struct obj *obj; +add_to_migration(struct obj* obj) { if (obj->where != OBJ_FREE) panic("add_to_migration: obj not free"); @@ -2144,8 +2069,7 @@ struct obj *obj; } void -add_to_buried(obj) -struct obj *obj; +add_to_buried(struct obj* obj) { if (obj->where != OBJ_FREE) panic("add_to_buried: obj not free"); @@ -2157,8 +2081,7 @@ struct obj *obj; /* Recalculate the weight of this container and all of _its_ containers. */ static void -container_weight(container) -struct obj *container; +container_weight(struct obj* container) { container->owt = weight(container); if (container->where == OBJ_CONTAINED) @@ -2174,8 +2097,7 @@ struct obj *container; * them to be deallocated. */ void -dealloc_obj(obj) -struct obj *obj; +dealloc_obj(struct obj* obj) { if (obj->where != OBJ_FREE && obj->where != OBJ_LUAFREE) panic("dealloc_obj: obj not free"); @@ -2218,9 +2140,9 @@ struct obj *obj; /* create an object from a horn of plenty; mirrors bagotricks(makemon.c) */ int -hornoplenty(horn, tipping) -struct obj *horn; -boolean tipping; /* caller emptying entire contents; affects shop handling */ +hornoplenty( + struct obj* horn, + boolean tipping) /* caller emptying entire contents; affects shop handling */ { int objcount = 0; @@ -2301,7 +2223,7 @@ static const char NEARDATA /* pline formats for insane_object() */ /* Check all object lists for consistency. */ void -obj_sanity_check() +obj_sanity_check(void) { int x, y; struct obj *obj; @@ -2364,10 +2286,7 @@ obj_sanity_check() /* sanity check for objects on specified list (fobj, &c) */ static void -objlist_sanity(objlist, wheretype, mesg) -struct obj *objlist; -int wheretype; -const char *mesg; +objlist_sanity(struct obj* objlist, int wheretype, const char * mesg) { struct obj *obj; @@ -2416,9 +2335,7 @@ const char *mesg; /* sanity check for objects carried by all monsters in specified list */ static void -mon_obj_sanity(monlist, mesg) -struct monst *monlist; -const char *mesg; +mon_obj_sanity(struct monst* monlist, const char* mesg) { struct monst *mon; struct obj *obj, *mwep; @@ -2453,8 +2370,7 @@ static const char *obj_state_names[NOBJ_STATES] = { "free", "floor", "luafree" }; static const char * -where_name(obj) -struct obj *obj; +where_name(struct obj* obj) { static char unknown[32]; /* big enough to handle rogue 64-bit int */ int where; @@ -2470,10 +2386,11 @@ struct obj *obj; } static void -insane_object(obj, fmt, mesg, mon) -struct obj *obj; -const char *fmt, *mesg; -struct monst *mon; +insane_object( + struct obj* obj, + const char* fmt, + const char* mesg, + struct monst* mon) { const char *objnm, *monnm; char altfmt[BUFSZ]; @@ -2502,10 +2419,7 @@ struct monst *mon; * take an obj pointer to work. */ struct obj * -init_dummyobj(obj, otyp, oquan) -struct obj *obj; -short otyp; -long oquan; +init_dummyobj(struct obj* obj, short otyp, long oquan) { if (obj) { *obj = cg.zeroobj; @@ -2528,9 +2442,7 @@ long oquan; /* obj sanity check: check objects inside container */ static void -check_contained(container, mesg) -struct obj *container; -const char *mesg; +check_contained(struct obj* container, const char *mesg) { struct obj *obj; /* big enough to work with, not too big to blow out stack in recursion */ @@ -2576,9 +2488,7 @@ const char *mesg; /* called when 'obj->globby' is set so we don't recheck it here */ static void -check_glob(obj, mesg) -struct obj *obj; -const char *mesg; +check_glob(struct obj* obj, const char *mesg) { #define LOWEST_GLOB GLOB_OF_GRAY_OOZE #define HIGHEST_GLOB GLOB_OF_BLACK_PUDDING @@ -2599,8 +2509,7 @@ const char *mesg; /* check an object in hero's or monster's inventory which has worn mask set */ static void -sanity_check_worn(obj) -struct obj *obj; +sanity_check_worn(struct obj* obj) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) static unsigned long wearbits[] = { @@ -2796,8 +2705,7 @@ struct obj *obj; * wrapper to make "near this object" convenient */ struct obj * -obj_nexto(otmp) -struct obj *otmp; +obj_nexto(struct obj* otmp) { if (!otmp) { impossible("obj_nexto: wasn't given an object to check"); @@ -2815,10 +2723,7 @@ struct obj *otmp; * reliably predict which one we want to 'find' first */ struct obj * -obj_nexto_xy(obj, x, y, recurs) -struct obj *obj; -int x, y; -boolean recurs; +obj_nexto_xy(struct obj* obj, int x, int y, boolean recurs) { struct obj *otmp; int fx, fy, ex, ey, otyp = obj->otyp; @@ -2860,8 +2765,7 @@ boolean recurs; * is returned. */ struct obj * -obj_absorb(obj1, obj2) -struct obj **obj1, **obj2; +obj_absorb(struct obj** obj1, struct obj** obj2) { struct obj *otmp1, *otmp2; int o1wt, o2wt; @@ -2913,8 +2817,7 @@ struct obj **obj1, **obj2; * cleanly (since we don't know which we want to stay around) */ struct obj * -obj_meld(obj1, obj2) -struct obj **obj1, **obj2; +obj_meld(struct obj** obj1, struct obj** obj2) { struct obj *otmp1, *otmp2, *result = 0; int ox, oy; @@ -2958,9 +2861,7 @@ struct obj **obj1, **obj2; /* give a message if hero notices two globs merging [used to be in pline.c] */ void -pudding_merge_message(otmp, otmp2) -struct obj *otmp; -struct obj *otmp2; +pudding_merge_message(struct obj* otmp, struct obj* otmp2) { boolean visible = (cansee(otmp->ox, otmp->oy) || cansee(otmp2->ox, otmp2->oy)), diff --git a/src/mkroom.c b/src/mkroom.c index 496b4c426..f2e613e9e 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -17,24 +17,23 @@ #include "hack.h" -static boolean FDECL(isbig, (struct mkroom *)); -static struct mkroom *FDECL(pick_room, (BOOLEAN_P)); -static void NDECL(mkshop), FDECL(mkzoo, (int)), NDECL(mkswamp); -static void FDECL(mk_zoo_thronemon, (int, int)); -static void NDECL(mktemple); -static coord *FDECL(shrine_pos, (int)); -static struct permonst *NDECL(morguemon); -static struct permonst *NDECL(squadmon); -static void FDECL(save_room, (NHFILE *, struct mkroom *)); -static void FDECL(rest_room, (NHFILE *, struct mkroom *)); +static boolean isbig(struct mkroom *); +static struct mkroom *pick_room(boolean); +static void mkshop(void), mkzoo(int), mkswamp(void); +static void mk_zoo_thronemon(int, int); +static void mktemple(void); +static coord *shrine_pos(int); +static struct permonst *morguemon(void); +static struct permonst *squadmon(void); +static void save_room(NHFILE *, struct mkroom *); +static void rest_room(NHFILE *, struct mkroom *); #define sq(x) ((x) * (x)) extern const struct shclass shtypes[]; /* defined in shknam.c */ static boolean -isbig(sroom) -register struct mkroom *sroom; +isbig(struct mkroom* sroom) { register int area = (sroom->hx - sroom->lx + 1) * (sroom->hy - sroom->ly + 1); @@ -44,8 +43,7 @@ register struct mkroom *sroom; /* make and stock a room of a given type */ void -mkroom(roomtype) -int roomtype; +mkroom(int roomtype) { if (roomtype >= SHOPBASE) mkshop(); /* someday, we should be able to specify shop type */ @@ -87,7 +85,7 @@ int roomtype; } static void -mkshop() +mkshop(void) { register struct mkroom *sroom; int i = -1; @@ -207,8 +205,7 @@ gottype: /* pick an unused room, preferably with only one door */ static struct mkroom * -pick_room(strict) -register boolean strict; +pick_room(boolean strict) { register struct mkroom *sroom; register int i = g.nroom; @@ -232,8 +229,7 @@ register boolean strict; } static void -mkzoo(type) -int type; +mkzoo(int type) { register struct mkroom *sroom; @@ -246,8 +242,7 @@ int type; } static void -mk_zoo_thronemon(x,y) -int x,y; +mk_zoo_thronemon(int x,int y) { int i = rnd(level_difficulty()); int pm = (i > 9) ? PM_OGRE_TYRANT @@ -266,8 +261,7 @@ int x,y; } void -fill_zoo(sroom) -struct mkroom *sroom; +fill_zoo(struct mkroom* sroom) { struct monst *mon; register int sx, sy, i; @@ -442,10 +436,10 @@ struct mkroom *sroom; /* make a swarm of undead around mm */ void -mkundead(mm, revive_corpses, mm_flags) -coord *mm; -boolean revive_corpses; -int mm_flags; +mkundead( + coord *mm, + boolean revive_corpses, + int mm_flags) { int cnt = (level_difficulty() + 1) / 10 + rnd(5); struct permonst *mdat; @@ -464,7 +458,7 @@ int mm_flags; } static struct permonst * -morguemon() +morguemon(void) { register int i = rn2(100), hd = rn2(level_difficulty()); @@ -488,7 +482,7 @@ morguemon() } struct permonst * -antholemon() +antholemon(void) { int mtyp, indx, trycnt = 0; @@ -516,7 +510,7 @@ antholemon() } static void -mkswamp() /* Michiel Huisjes & Fred de Wilde */ +mkswamp(void) /* Michiel Huisjes & Fred de Wilde */ { register struct mkroom *sroom; register int sx, sy, i, eelct = 0; @@ -554,8 +548,7 @@ mkswamp() /* Michiel Huisjes & Fred de Wilde */ } static coord * -shrine_pos(roomno) -int roomno; +shrine_pos(int roomno) { static coord buf; int delta; @@ -576,7 +569,7 @@ int roomno; } static void -mktemple() +mktemple(void) { register struct mkroom *sroom; coord *shrine_spot; @@ -601,8 +594,7 @@ mktemple() } boolean -nexttodoor(sx, sy) -register int sx, sy; +nexttodoor(int sx, int sy) { register int dx, dy; register struct rm *lev; @@ -619,8 +611,7 @@ register int sx, sy; } boolean -has_dnstairs(sroom) -register struct mkroom *sroom; +has_dnstairs(struct mkroom* sroom) { stairway *stway = g.stairs; @@ -633,8 +624,7 @@ register struct mkroom *sroom; } boolean -has_upstairs(sroom) -register struct mkroom *sroom; +has_upstairs(struct mkroom* sroom) { stairway *stway = g.stairs; @@ -647,23 +637,19 @@ register struct mkroom *sroom; } int -somex(croom) -register struct mkroom *croom; +somex(struct mkroom* croom) { return rn1(croom->hx - croom->lx + 1, croom->lx); } int -somey(croom) -register struct mkroom *croom; +somey(struct mkroom* croom) { return rn1(croom->hy - croom->ly + 1, croom->ly); } boolean -inside_room(croom, x, y) -struct mkroom *croom; -xchar x, y; +inside_room(struct mkroom* croom, xchar x, xchar y) { if (croom->irregular) { int i = (int) ((croom - g.rooms) + ROOMOFFSET); @@ -675,9 +661,7 @@ xchar x, y; } boolean -somexy(croom, c) -struct mkroom *croom; -coord *c; +somexy(struct mkroom* croom,coord * c) { int try_cnt = 0; int i; @@ -726,9 +710,7 @@ coord *c; } boolean -somexyspace(croom, c) -struct mkroom *croom; -coord *c; +somexyspace(struct mkroom* croom, coord *c) { int trycnt = 0; boolean okay; @@ -749,8 +731,7 @@ coord *c; * - ANY_TYPE */ struct mkroom * -search_special(type) -schar type; +search_special(schar type) { register struct mkroom *croom; @@ -768,7 +749,7 @@ schar type; } struct permonst * -courtmon() +courtmon(void) { int i = rn2(60) + rn2(3 * level_difficulty()); @@ -802,7 +783,7 @@ static const struct { /* return soldier types. */ static struct permonst * -squadmon() +squadmon(void) { int sel_prob, i, cpro, mndx; @@ -829,9 +810,7 @@ gotone: * (if any). */ static void -save_room(nhfp, r) -NHFILE *nhfp; -struct mkroom *r; +save_room(NHFILE* nhfp, struct mkroom* r) { short i; @@ -851,8 +830,7 @@ struct mkroom *r; * save_rooms : Save all the rooms on disk! */ void -save_rooms(nhfp) -NHFILE *nhfp; +save_rooms(NHFILE* nhfp) { short i; @@ -864,9 +842,7 @@ NHFILE *nhfp; } static void -rest_room(nhfp, r) -NHFILE *nhfp; -struct mkroom *r; +rest_room(NHFILE* nhfp, struct mkroom* r) { short i; @@ -885,8 +861,7 @@ struct mkroom *r; * the disk. */ void -rest_rooms(nhfp) -NHFILE *nhfp; +rest_rooms(NHFILE* nhfp) { short i; @@ -905,8 +880,7 @@ NHFILE *nhfp; /* convert a display symbol for terrain into topology type; used for remembered terrain when mimics pose as furniture */ int -cmap_to_type(sym) -int sym; +cmap_to_type(int sym) { int typ = STONE; /* catchall */ diff --git a/src/mon.c b/src/mon.c index c5ecf42f4..9932594bd 100644 --- a/src/mon.c +++ b/src/mon.c @@ -7,26 +7,26 @@ #include "mfndpos.h" #include -static void FDECL(sanity_check_single_mon, (struct monst *, BOOLEAN_P, - const char *)); -static boolean FDECL(restrap, (struct monst *)); -static long FDECL(mm_2way_aggression, (struct monst *, struct monst *)); -static long FDECL(mm_aggression, (struct monst *, struct monst *)); -static long FDECL(mm_displacement, (struct monst *, struct monst *)); -static int NDECL(pick_animal); -static void FDECL(kill_eggs, (struct obj *)); -static int FDECL(pickvampshape, (struct monst *)); -static boolean FDECL(isspecmon, (struct monst *)); -static boolean FDECL(validspecmon, (struct monst *, int)); -static struct permonst *FDECL(accept_newcham_form, (struct monst *, int)); -static struct obj *FDECL(make_corpse, (struct monst *, unsigned)); -static int FDECL(minliquid_core, (struct monst *)); -static void FDECL(m_detach, (struct monst *, struct permonst *)); -static void FDECL(set_mon_min_mhpmax, (struct monst *, int)); -static void FDECL(lifesaved_monster, (struct monst *)); -static void FDECL(migrate_mon, (struct monst *, XCHAR_P, XCHAR_P)); -static boolean FDECL(ok_to_obliterate, (struct monst *)); -static void FDECL(deal_with_overcrowding, (struct monst *)); +static void sanity_check_single_mon(struct monst *, boolean, + const char *); +static boolean restrap(struct monst *); +static long mm_2way_aggression(struct monst *, struct monst *); +static long mm_aggression(struct monst *, struct monst *); +static long mm_displacement(struct monst *, struct monst *); +static int pick_animal(void); +static void kill_eggs(struct obj *); +static int pickvampshape(struct monst *); +static boolean isspecmon(struct monst *); +static boolean validspecmon(struct monst *, int); +static struct permonst *accept_newcham_form(struct monst *, int); +static struct obj *make_corpse(struct monst *, unsigned); +static int minliquid_core(struct monst *); +static void m_detach(struct monst *, struct permonst *); +static void set_mon_min_mhpmax(struct monst *, int); +static void lifesaved_monster(struct monst *); +static void migrate_mon(struct monst *, xchar, xchar); +static boolean ok_to_obliterate(struct monst *); +static void deal_with_overcrowding(struct monst *); #define LEVEL_SPECIFIC_NOCORPSE(mdat) \ (Is_rogue_level(&u.uz) \ @@ -41,10 +41,10 @@ const char *warnings[] = { static void -sanity_check_single_mon(mtmp, chk_geno, msg) -struct monst *mtmp; -boolean chk_geno; -const char *msg; +sanity_check_single_mon( + struct monst *mtmp, + boolean chk_geno, + const char *msg) { struct permonst *mptr = mtmp->data; int mx = mtmp->mx, my = mtmp->my; @@ -175,7 +175,7 @@ const char *msg; } void -mon_sanity_check() +mon_sanity_check(void) { int x, y; struct monst *mtmp, *m; @@ -234,8 +234,7 @@ mon_sanity_check() /* Does not check for actual poison gas at the location. */ /* Returns one of M_POISONGAS_foo */ int -m_poisongas_ok(mtmp) -struct monst *mtmp; +m_poisongas_ok(struct monst* mtmp) { int px, py; boolean is_you = (mtmp == &g.youmonst); @@ -268,8 +267,7 @@ struct monst *mtmp; /* Return TRUE if this monster is capable of converting other monsters into * zombies. */ boolean -zombie_maker(pm) -struct permonst *pm; +zombie_maker(struct permonst* pm) { switch(pm->mlet) { case S_ZOMBIE: @@ -290,8 +288,7 @@ struct permonst *pm; * If a zombie gets passed to this function, it should return NON_PM, not the * same monster again. */ int -zombie_form(pm) -struct permonst *pm; +zombie_form(struct permonst* pm) { switch(pm->mlet) { case S_KOBOLD: @@ -320,8 +317,7 @@ struct permonst *pm; /* convert the monster index of an undead to its living counterpart */ int -undead_to_corpse(mndx) -int mndx; +undead_to_corpse(int mndx) { switch (mndx) { case PM_KOBOLD_ZOMBIE: @@ -374,8 +370,7 @@ int mndx; * if mode is 1. */ int -genus(mndx, mode) -int mndx, mode; +genus(int mndx, int mode) { switch (mndx) { /* Quest guardians */ @@ -440,8 +435,7 @@ int mndx, mode; /* return monster index if chameleon, or NON_PM if not */ int -pm_to_cham(mndx) -int mndx; +pm_to_cham(int mndx) { int mcham = NON_PM; @@ -470,9 +464,7 @@ int mndx; * etc.... */ static struct obj * -make_corpse(mtmp, corpseflags) -register struct monst *mtmp; -unsigned corpseflags; +make_corpse(register struct monst* mtmp, unsigned int corpseflags) { register struct permonst *mdat = mtmp->data; int num; @@ -664,8 +656,7 @@ unsigned corpseflags; /* check mtmp and water/lava for compatibility, 0 (survived), 1 (died) */ int -minliquid(mtmp) -struct monst *mtmp; +minliquid(struct monst* mtmp) { int res; @@ -679,8 +670,7 @@ struct monst *mtmp; /* guts of minliquid() */ static int -minliquid_core(mtmp) -struct monst *mtmp; +minliquid_core(struct monst* mtmp) { boolean inpool, inlava, infountain; @@ -828,9 +818,9 @@ struct monst *mtmp; /* calculate 'mon's movement for current turn; called from moveloop() */ int -mcalcmove(mon, m_moving) -struct monst *mon; -boolean m_moving; /* True: adjust for moving; False: just adjust for speed */ +mcalcmove( + struct monst *mon, + boolean m_moving) /* True: adjust for moving; False: just adjust for speed */ { int mmove = mon->data->mmove; int mmove_adj; @@ -870,7 +860,7 @@ boolean m_moving; /* True: adjust for moving; False: just adjust for speed */ individual monster's metabolism; some of these might need to be reclassified to occur more in proportion with movement rate */ void -mcalcdistress() +mcalcdistress(void) { struct monst *mtmp; @@ -911,7 +901,7 @@ mcalcdistress() } int -movemon() +movemon(void) { register struct monst *mtmp, *nmtmp; register boolean somebody_can_move = FALSE; @@ -1063,8 +1053,7 @@ movemon() * has young and old forms). */ int -meatmetal(mtmp) -register struct monst *mtmp; +meatmetal(register struct monst* mtmp) { register struct obj *otmp; struct permonst *ptr; @@ -1162,8 +1151,7 @@ register struct monst *mtmp; /* monster eats a pile of objects */ int -meatobj(mtmp) /* for gelatinous cubes */ -struct monst *mtmp; +meatobj(struct monst* mtmp) /* for gelatinous cubes */ { struct obj *otmp, *otmp2; struct permonst *ptr, *original_ptr = mtmp->data; @@ -1309,8 +1297,7 @@ struct monst *mtmp; /* Monster eats a corpse off the ground. * Return value is 0 = nothing eaten, 1 = ate a corpse, 2 = died */ int -meatcorpse(mtmp) /* for purple worms and other voracious monsters */ -struct monst* mtmp; +meatcorpse(struct monst* mtmp) /* for purple worms and other voracious monsters */ { struct obj *otmp; struct permonst *ptr, *original_ptr = mtmp->data, *corpsepm; @@ -1389,8 +1376,7 @@ struct monst* mtmp; } void -mpickgold(mtmp) -register struct monst *mtmp; +mpickgold(register struct monst* mtmp) { register struct obj *gold; int mat_idx; @@ -1409,9 +1395,7 @@ register struct monst *mtmp; } boolean -mpickstuff(mtmp, str) -register struct monst *mtmp; -register const char *str; +mpickstuff(register struct monst* mtmp, register const char* str) { register struct obj *otmp, *otmp2, *otmp3; int carryamt = 0; @@ -1459,8 +1443,7 @@ register const char *str; } int -curr_mon_load(mtmp) -struct monst *mtmp; +curr_mon_load(struct monst* mtmp) { int curload = 0; struct obj *obj; @@ -1474,8 +1457,7 @@ struct monst *mtmp; } int -max_mon_load(mtmp) -struct monst *mtmp; +max_mon_load(struct monst* mtmp) { long maxload; @@ -1518,9 +1500,7 @@ struct monst *mtmp; * likesgold handling m_move results in picking up the whole stack. */ int -can_carry(mtmp, otmp) -struct monst *mtmp; -struct obj *otmp; +can_carry(struct monst* mtmp, struct obj* otmp) { int iquan, otyp = otmp->otyp, newload = otmp->owt; struct permonst *mdat = mtmp->data; @@ -1593,8 +1573,7 @@ struct obj *otmp; /* return flags based on monster data, for mfndpos() */ long -mon_allowflags(mtmp) -struct monst *mtmp; +mon_allowflags(struct monst* mtmp) { long allowflags = 0L; boolean can_open = !(nohands(mtmp->data) || verysmall(mtmp->data)); @@ -1656,11 +1635,11 @@ struct monst *mtmp; /* return number of acceptable neighbour positions */ int -mfndpos(mon, poss, info, flag) -struct monst *mon; -coord *poss; /* coord poss[9] */ -long *info; /* long info[9] */ -long flag; +mfndpos( + struct monst *mon, + coord *poss, /* coord poss[9] */ + long *info, /* long info[9] */ + long flag) { struct permonst *mdat = mon->data; register struct trap *ttmp; @@ -1905,8 +1884,7 @@ long flag; * code each case twice, this function contains those cases that ought to * happen twice, and mm_aggression will call it twice. */ static long -mm_2way_aggression(magr, mdef) -struct monst *magr, *mdef; +mm_2way_aggression(struct monst* magr, struct monst* mdef) { struct permonst *ma = magr->data; struct permonst *md = mdef->data; @@ -1924,9 +1902,9 @@ struct monst *magr, *mdef; other monsters; just hand to hand fighting when they happen to be next to each other. */ static long -mm_aggression(magr, mdef) -struct monst *magr, /* monster that is currently deciding where to move */ - *mdef; /* another monster which is next to it */ +mm_aggression( + struct monst *magr, /* monster that is currently deciding where to move */ + struct monst *mdef) /* another monster which is next to it */ { int mndx = monsndx(magr->data); @@ -1947,9 +1925,9 @@ struct monst *magr, /* monster that is currently deciding where to move */ /* Monster displacing another monster out of the way */ static long -mm_displacement(magr, mdef) -struct monst *magr, /* monster that is currently deciding where to move */ - *mdef; /* another monster which is next to it */ +mm_displacement( + struct monst *magr, /* monster that is currently deciding where to move */ + struct monst *mdef) /* another monster which is next to it */ { struct permonst *pa = magr->data, *pd = mdef->data; @@ -1972,9 +1950,7 @@ struct monst *magr, /* monster that is currently deciding where to move */ /* Is the square close enough for the monster to move or attack into? */ boolean -monnear(mon, x, y) -struct monst *mon; -int x, y; +monnear(struct monst* mon, int x, int y) { int distance = dist2(mon->mx, mon->my, x, y); @@ -1985,7 +1961,7 @@ int x, y; /* really free dead monsters */ void -dmonsfree() +dmonsfree(void) { struct monst **mtmp, *freetmp; int count = 0; @@ -2013,8 +1989,7 @@ dmonsfree() /* called when monster is moved to larger structure */ void -replmon(mtmp, mtmp2) -struct monst *mtmp, *mtmp2; +replmon(struct monst* mtmp, struct monst* mtmp2) { struct obj *otmp; @@ -2060,9 +2035,9 @@ struct monst *mtmp, *mtmp2; /* release mon from the display and the map's monster list, maybe transfer it to one of the other monster lists */ void -relmon(mon, monst_list) -struct monst *mon; -struct monst **monst_list; /* &g.migrating_mons or &g.mydogs or null */ +relmon( + struct monst *mon, + struct monst **monst_list) /* &g.migrating_mons or &g.mydogs or null */ { struct monst *mtmp; int mx = mon->mx, my = mon->my; @@ -2118,8 +2093,7 @@ struct monst **monst_list; /* &g.migrating_mons or &g.mydogs or null */ } void -copy_mextra(mtmp2, mtmp1) -struct monst *mtmp2, *mtmp1; +copy_mextra(struct monst* mtmp2, struct monst* mtmp1) { if (!mtmp2 || !mtmp1 || !mtmp1->mextra) return; @@ -2160,8 +2134,7 @@ struct monst *mtmp2, *mtmp1; } void -dealloc_mextra(m) -struct monst *m; +dealloc_mextra(struct monst* m) { struct mextra *x = m->mextra; @@ -2186,8 +2159,7 @@ struct monst *m; } void -dealloc_monst(mon) -struct monst *mon; +dealloc_monst(struct monst* mon) { char buf[QBUFSZ]; @@ -2203,9 +2175,9 @@ struct monst *mon; /* remove effects of mtmp from other data structures */ static void -m_detach(mtmp, mptr) -struct monst *mtmp; -struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */ +m_detach( + struct monst *mtmp, + struct permonst *mptr) /* reflects mtmp->data _prior_ to mtmp's death */ { boolean onmap = (mtmp->mx > 0); @@ -2254,9 +2226,9 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */ /* give a life-saved monster a reasonable mhpmax value in case it has been the victim of excessive life draining */ static void -set_mon_min_mhpmax(mon, minimum_mhpmax) -struct monst *mon; -int minimum_mhpmax; /* monster life-saving has traditionally used 10 */ +set_mon_min_mhpmax( + struct monst *mon, + int minimum_mhpmax) /* monster life-saving has traditionally used 10 */ { /* can't be less than m_lev+1 (if we just used m_lev itself, level 0 monsters would end up allowing a minimum of 0); since life draining @@ -2273,8 +2245,7 @@ int minimum_mhpmax; /* monster life-saving has traditionally used 10 */ /* find the worn amulet of life saving which will save a monster */ struct obj * -mlifesaver(mon) -struct monst *mon; +mlifesaver(struct monst* mon) { if (!nonliving(mon->data) || is_vampshifter(mon)) { struct obj *otmp = which_armor(mon, W_AMUL); @@ -2286,8 +2257,7 @@ struct monst *mon; } static void -lifesaved_monster(mtmp) -struct monst *mtmp; +lifesaved_monster(struct monst* mtmp) { boolean surviver; struct obj *lifesave = mlifesaver(mtmp); @@ -2335,8 +2305,7 @@ struct monst *mtmp; } void -mondead(mtmp) -register struct monst *mtmp; +mondead(register struct monst* mtmp) { struct permonst *mptr; boolean be_sad; @@ -2496,10 +2465,10 @@ register struct monst *mtmp; /* TRUE if corpse might be dropped, magr may die if mon was swallowed */ boolean -corpse_chance(mon, magr, was_swallowed) -struct monst *mon; -struct monst *magr; /* killer, if swallowed */ -boolean was_swallowed; /* digestion */ +corpse_chance( + struct monst *mon, + struct monst *magr, /* killer, if swallowed */ + boolean was_swallowed) /* digestion */ { struct permonst *mdat = mon->data; int i, tmp; @@ -2565,8 +2534,7 @@ boolean was_swallowed; /* digestion */ /* drop (perhaps) a cadaver and remove monster */ void -mondied(mdef) -register struct monst *mdef; +mondied(register struct monst* mdef) { mondead(mdef); if (!DEADMONSTER(mdef)) @@ -2579,8 +2547,7 @@ register struct monst *mdef; /* monster disappears, not dies */ void -mongone(mdef) -struct monst *mdef; +mongone(struct monst* mdef) { mdef->mhp = 0; /* can skip some inventory bookkeeping */ @@ -2603,8 +2570,7 @@ struct monst *mdef; /* drop a statue or rock and remove monster */ void -monstone(mdef) -struct monst *mdef; +monstone(struct monst* mdef) { struct obj *otmp, *obj, *oldminvent; xchar x = mdef->mx, y = mdef->my; @@ -2693,10 +2659,10 @@ struct monst *mdef; /* another monster has killed the monster mdef */ void -monkilled(mdef, fltxt, how) -struct monst *mdef; -const char *fltxt; -int how; +monkilled( + struct monst *mdef, + const char *fltxt, + int how) { struct permonst *mptr = mdef->data; @@ -2736,8 +2702,7 @@ int how; } void -set_ustuck(mtmp) -struct monst *mtmp; +set_ustuck(struct monst* mtmp) { if (iflags.sanity_check || iflags.debug_fuzzer) { if (mtmp && distu(mtmp->mx, mtmp->my) > 2) @@ -2750,8 +2715,7 @@ struct monst *mtmp; } void -unstuck(mtmp) -struct monst *mtmp; +unstuck(struct monst* mtmp) { if (u.ustuck == mtmp) { /* do this first so that docrt()'s botl update is accurate; @@ -2776,17 +2740,16 @@ struct monst *mtmp; } void -killed(mtmp) -struct monst *mtmp; +killed(struct monst* mtmp) { xkilled(mtmp, XKILL_GIVEMSG); } /* the player has killed the monster mtmp */ void -xkilled(mtmp, xkill_flags) -struct monst *mtmp; -int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */ +xkilled( + struct monst *mtmp, + int xkill_flags) /* 1: suppress message, 2: suppress corpse, 4: pacifist */ { int tmp, mndx, x = mtmp->mx, y = mtmp->my; struct permonst *mdat; @@ -2988,8 +2951,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */ /* changes the monster into a stone monster of the same type this should only be called when poly_when_stoned() is true */ void -mon_to_stone(mtmp) -struct monst *mtmp; +mon_to_stone(struct monst* mtmp) { if (mtmp->data->mlet == S_GOLEM) { /* it's a golem, and not a stone golem */ @@ -3007,8 +2969,7 @@ struct monst *mtmp; } boolean -vamp_stone(mtmp) -struct monst *mtmp; +vamp_stone(struct monst* mtmp) { if (is_vampshifter(mtmp)) { int mndx = mtmp->cham; @@ -3077,8 +3038,7 @@ struct monst *mtmp; /* drop monster into "limbo" - that is, migrate to the current level */ void -m_into_limbo(mtmp) -struct monst *mtmp; +m_into_limbo(struct monst* mtmp) { xchar target_lev = ledger_no(&u.uz), xyloc = MIGR_APPROX_XY; @@ -3087,9 +3047,7 @@ struct monst *mtmp; } static void -migrate_mon(mtmp, target_lev, xyloc) -struct monst *mtmp; -xchar target_lev, xyloc; +migrate_mon(struct monst* mtmp, xchar target_lev, xchar xyloc) { unstuck(mtmp); mdrop_special_objs(mtmp); @@ -3098,8 +3056,7 @@ xchar target_lev, xyloc; } static boolean -ok_to_obliterate(mtmp) -struct monst *mtmp; +ok_to_obliterate(struct monst* mtmp) { /* * Add checks for monsters that should not be obliterated @@ -3113,8 +3070,7 @@ struct monst *mtmp; } void -elemental_clog(mon) -struct monst *mon; +elemental_clog(struct monst* mon) { int m_lev = 0; static long msgmv = 0L; @@ -3191,8 +3147,7 @@ struct monst *mon; /* make monster mtmp next to you (if possible); might place monst on far side of a wall or boulder */ void -mnexto(mtmp) -struct monst *mtmp; +mnexto(struct monst* mtmp) { coord mm; boolean couldspot = canspotmon(mtmp); @@ -3219,8 +3174,7 @@ struct monst *mtmp; } static void -deal_with_overcrowding(mtmp) -struct monst *mtmp; +deal_with_overcrowding(struct monst* mtmp) { if (In_endgame(&u.uz)) { debugpline1("overcrowding: elemental_clog on %s", m_monnam(mtmp)); @@ -3233,8 +3187,7 @@ struct monst *mtmp; /* like mnexto() but requires destination to be directly accessible */ void -maybe_mnexto(mtmp) -struct monst *mtmp; +maybe_mnexto(struct monst* mtmp) { coord mm; struct permonst *ptr = mtmp->data; @@ -3265,10 +3218,11 @@ struct monst *mtmp; * will be False on the nested call so there won't be any further recursion. */ int -mnearto(mtmp, x, y, move_other) -register struct monst *mtmp; -xchar x, y; -boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */ +mnearto( + register struct monst *mtmp, + xchar x, + xchar y, + boolean move_other) /* make sure mtmp gets to x, y! so move m_at(x, y) */ { struct monst *othermon = (struct monst *) 0; xchar newx, newy; @@ -3322,8 +3276,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */ /* monster responds to player action; not the same as a passive attack; assumes reason for response has been tested, and response _must_ be made */ void -m_respond(mtmp) -struct monst *mtmp; +m_respond(struct monst* mtmp) { if (mtmp->data->msound == MS_SHRIEK) { if (!Deaf) { @@ -3359,9 +3312,7 @@ struct monst *mtmp; where mtmp was already hostile; it checks for situations where the player shouldn't be attacking and any ramifications /that/ might have. */ void -setmangry(mtmp, via_attack) -struct monst *mtmp; -boolean via_attack; +setmangry(struct monst* mtmp, boolean via_attack) { if (via_attack && sengr_at("Elbereth", u.ux, u.uy, TRUE) /* only hypocritical if monster is vulnerable to Elbereth (or @@ -3525,9 +3476,7 @@ boolean via_attack; /* wake up a monster, possibly making it angry in the process */ void -wakeup(mtmp, via_attack) -register struct monst *mtmp; -boolean via_attack; +wakeup(struct monst* mtmp, boolean via_attack) { mtmp->msleeping = 0; if (M_AP_TYPE(mtmp) != M_AP_NOTHING) { @@ -3547,15 +3496,14 @@ boolean via_attack; /* Wake up nearby monsters without angering them. */ void -wake_nearby() +wake_nearby(void) { wake_nearto(u.ux, u.uy, u.ulevel * 20); } /* Wake up monsters near some particular location. */ void -wake_nearto(x, y, distance) -int x, y, distance; +wake_nearto(int x, int y, int distance) { struct monst *mtmp; @@ -3583,8 +3531,7 @@ int x, y, distance; /* NOTE: we must check for mimicry before calling this routine */ void -seemimic(mtmp) -register struct monst *mtmp; +seemimic(register struct monst* mtmp) { boolean is_blocker_appear = (is_lightblocker_mappear(mtmp)); @@ -3606,7 +3553,7 @@ register struct monst *mtmp; /* force all chameleons to become normal */ void -rescham() +rescham(void) { register struct monst *mtmp; int mcham; @@ -3640,7 +3587,7 @@ rescham() /* Let the chameleons change again -dgk */ void -restartcham() +restartcham(void) { register struct monst *mtmp; @@ -3661,8 +3608,7 @@ restartcham() against shape-changing might be different now than it was at the time the level was saved. */ void -restore_cham(mon) -struct monst *mon; +restore_cham(struct monst* mon) { int mcham; @@ -3681,8 +3627,7 @@ struct monst *mon; /* unwatched hiders may hide again; if so, returns True */ static boolean -restrap(mtmp) -register struct monst *mtmp; +restrap(struct monst* mtmp) { struct trap *t; @@ -3708,8 +3653,7 @@ register struct monst *mtmp; /* reveal a monster at x,y hiding under an object, if there are no objects there */ void -maybe_unhide_at(x, y) -xchar x, y; +maybe_unhide_at(xchar x, xchar y) { struct monst *mtmp; @@ -3720,8 +3664,7 @@ xchar x, y; /* monster/hero tries to hide under something at the current location */ boolean -hideunder(mtmp) -struct monst *mtmp; +hideunder(struct monst* mtmp) { struct trap *t; boolean undetected = FALSE, is_u = (mtmp == &g.youmonst); @@ -3754,8 +3697,7 @@ struct monst *mtmp; /* called when returning to a previously visited level */ void -hide_monst(mon) -struct monst *mon; +hide_monst(struct monst* mon) { boolean hider_under = hides_under(mon->data) || mon->data->mlet == S_EEL; @@ -3778,8 +3720,7 @@ struct monst *mon; } void -mon_animal_list(construct) -boolean construct; +mon_animal_list(boolean construct) { if (construct) { short animal_temp[SPECIAL_PM]; @@ -3804,7 +3745,7 @@ boolean construct; } static int -pick_animal() +pick_animal(void) { int res; @@ -3821,9 +3762,7 @@ pick_animal() } void -decide_to_shapeshift(mon, shiftflags) -struct monst *mon; -int shiftflags; +decide_to_shapeshift(struct monst* mon, int shiftflags) { struct permonst *ptr = 0; int mndx; @@ -3883,8 +3822,7 @@ int shiftflags; } static int -pickvampshape(mon) -struct monst *mon; +pickvampshape(struct monst* mon) { int mndx = mon->cham, wolfchance = 10; /* avoid picking monsters with lowercase display symbols ('d' for wolf @@ -3913,8 +3851,7 @@ struct monst *mon; /* nonshapechangers who warrant special polymorph handling */ static boolean -isspecmon(mon) -struct monst *mon; +isspecmon(struct monst* mon) { return (mon->isshk || mon->ispriest || mon->isgd || mon->m_id == g.quest_status.leader_m_id); @@ -3924,9 +3861,7 @@ struct monst *mon; vault guards) to forms that allow them to behave sensibly (catching gold, speaking?) so that they don't need too much extra code */ static boolean -validspecmon(mon, mndx) -struct monst *mon; -int mndx; +validspecmon(struct monst* mon, int mndx) { if (mndx == NON_PM) return TRUE; /* caller wants random */ @@ -3948,8 +3883,7 @@ int mndx; /* used for hero polyself handling */ boolean -valid_vampshiftform(base, form) -int base, form; +valid_vampshiftform(int base, int form) { if (base >= LOW_PM && is_vampire(&mons[base])) { if (form == PM_VAMPIRE_BAT || form == PM_FOG_CLOUD @@ -3962,9 +3896,7 @@ int base, form; /* prevent wizard mode user from specifying invalid vampshifter shape when using monpolycontrol to assign a new form to a vampshifter */ boolean -validvamp(mon, mndx_p, monclass) -struct monst *mon; -int *mndx_p, monclass; +validvamp(struct monst* mon, int* mndx_p, int monclass) { /* simplify caller's usage */ if (!is_vampshifter(mon)) @@ -4013,8 +3945,7 @@ int *mndx_p, monclass; } int -select_newcham_form(mon) -struct monst *mon; +select_newcham_form(struct monst* mon) { int mndx = NON_PM, tryct; @@ -4147,9 +4078,7 @@ struct monst *mon; /* this used to be inline within newcham() but monpolycontrol needs it too */ static struct permonst * -accept_newcham_form(mon, mndx) -struct monst *mon; -int mndx; +accept_newcham_form(struct monst* mon, int mndx) { struct permonst *mdat; @@ -4175,9 +4104,7 @@ int mndx; } void -mgender_from_permonst(mtmp, mdat) -struct monst *mtmp; -struct permonst *mdat; +mgender_from_permonst(struct monst* mtmp, struct permonst* mdat) { if (is_male(mdat)) { if (mtmp->female) @@ -4195,11 +4122,11 @@ struct permonst *mdat; (possibly self-inflicted) become a different monster; returns 1 if it actually changes form */ int -newcham(mtmp, mdat, polyspot, msg) -struct monst *mtmp; -struct permonst *mdat; -boolean polyspot; /* change is the result of wand or spell of polymorph */ -boolean msg; /* "The oldmon turns into a newmon!" */ +newcham( + struct monst *mtmp, + struct permonst *mdat, + boolean polyspot, /* change is the result of wand or spell of polymorph */ + boolean msg) /* "The oldmon turns into a newmon!" */ { int hpn, hpd; int mndx, tryct; @@ -4421,8 +4348,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */ * NON_PM if the given monster can't be hatched. */ int -can_be_hatched(mnum) -int mnum; +can_be_hatched(int mnum) { /* ranger quest nemesis has the oviparous bit set, making it be possible to wish for eggs of that unique monster; turn @@ -4445,9 +4371,9 @@ int mnum; /* type of egg laid by #sit; usually matches parent */ int -egg_type_from_parent(mnum, force_ordinary) -int mnum; /* parent monster; caller must handle lays_eggs() check */ -boolean force_ordinary; +egg_type_from_parent( + int mnum, /* parent monster; caller must handle lays_eggs() check */ + boolean force_ordinary) { if (force_ordinary || !BREEDER_EGG) { if (mnum == PM_QUEEN_BEE) @@ -4461,9 +4387,7 @@ boolean force_ordinary; /* decide whether an egg of the indicated monster type is viable; also used to determine whether an egg or tin can be created... */ boolean -dead_species(m_idx, egg) -int m_idx; -boolean egg; +dead_species(int m_idx, boolean egg) { int alt_idx; @@ -4484,8 +4408,7 @@ boolean egg; /* kill off any eggs of genocided monsters */ static void -kill_eggs(obj_list) -struct obj *obj_list; +kill_eggs(struct obj* obj_list) { struct obj *otmp; @@ -4515,7 +4438,7 @@ struct obj *obj_list; /* kill all members of genocided species */ void -kill_genocided_monsters() +kill_genocided_monsters(void) { struct monst *mtmp, *mtmp2; boolean kill_cham; @@ -4556,9 +4479,7 @@ kill_genocided_monsters() } void -golemeffects(mon, damtype, dam) -register struct monst *mon; -int damtype, dam; +golemeffects(register struct monst* mon, int damtype, int dam) { int heal = 0, slow = 0; @@ -4591,8 +4512,7 @@ int damtype, dam; } boolean -angry_guards(silent) -boolean silent; +angry_guards(boolean silent) { struct monst *mtmp; int ct = 0, nct = 0, sct = 0, slct = 0; @@ -4636,7 +4556,7 @@ boolean silent; } void -pacify_guards() +pacify_guards(void) { struct monst *mtmp; @@ -4649,9 +4569,7 @@ pacify_guards() } void -mimic_hit_msg(mtmp, otyp) -struct monst *mtmp; -short otyp; +mimic_hit_msg(struct monst* mtmp, short otyp) { short ap = mtmp->mappearance; @@ -4671,8 +4589,7 @@ short otyp; } boolean -usmellmon(mdat) -struct permonst *mdat; +usmellmon(struct permonst* mdat) { int mndx; boolean nonspecific = FALSE; diff --git a/src/mondata.c b/src/mondata.c index f3f9a5649..28e4e65b5 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -10,9 +10,7 @@ /* set up an individual monster's base type (initial creation, shapechange) */ void -set_mon_data(mon, ptr) -struct monst *mon; -struct permonst *ptr; +set_mon_data(struct monst* mon, struct permonst* ptr) { int new_speed, old_speed = mon->data ? mon->data->mmove : 0; @@ -40,9 +38,7 @@ struct permonst *ptr; /* does monster-type have any attack for a specific type of damage? */ struct attack * -attacktype_fordmg(ptr, atyp, dtyp) -struct permonst *ptr; -int atyp, dtyp; +attacktype_fordmg(struct permonst* ptr, int atyp, int dtyp) { struct attack *a; @@ -54,17 +50,14 @@ int atyp, dtyp; /* does monster-type have a particular type of attack */ boolean -attacktype(ptr, atyp) -struct permonst *ptr; -int atyp; +attacktype(struct permonst* ptr, int atyp) { return attacktype_fordmg(ptr, atyp, AD_ANY) ? TRUE : FALSE; } /* returns True if monster doesn't attack, False if it does */ boolean -noattacks(ptr) -struct permonst *ptr; +noattacks(struct permonst* ptr) { int i; struct attack *mattk = ptr->mattk; @@ -83,8 +76,7 @@ struct permonst *ptr; /* does monster-type transform into something else when petrified? */ boolean -poly_when_stoned(ptr) -struct permonst *ptr; +poly_when_stoned(struct permonst* ptr) { /* non-stone golems turn into stone golems unless latter is genocided */ return (boolean) (is_golem(ptr) && ptr != &mons[PM_STONE_GOLEM] @@ -94,8 +86,7 @@ struct permonst *ptr; /* returns True if monster is drain-life resistant */ boolean -resists_drli(mon) -struct monst *mon; +resists_drli(struct monst* mon) { struct permonst *ptr = mon->data; struct obj *wep; @@ -111,8 +102,7 @@ struct monst *mon; /* True if monster is magic-missile (actually, general magic) resistant */ boolean -resists_magm(mon) -struct monst *mon; +resists_magm(struct monst* mon) { struct permonst *ptr = mon->data; boolean is_you = (mon == &g.youmonst); @@ -145,8 +135,7 @@ struct monst *mon; /* True iff monster is resistant to light-induced blindness */ boolean -resists_blnd(mon) -struct monst *mon; +resists_blnd(struct monst* mon) { struct permonst *ptr = mon->data; boolean is_you = (mon == &g.youmonst); @@ -186,11 +175,11 @@ struct monst *mon; magr can be NULL. */ boolean -can_blnd(magr, mdef, aatyp, obj) -struct monst *magr; /* NULL == no specific aggressor */ -struct monst *mdef; -uchar aatyp; -struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ +can_blnd( + struct monst *magr, /* NULL == no specific aggressor */ + struct monst *mdef, + uchar aatyp, + struct obj *obj) /* aatyp == AT_WEAP, AT_SPIT */ { boolean is_you = (mdef == &g.youmonst); boolean check_visor = FALSE; @@ -279,8 +268,7 @@ struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ /* returns True if monster can attack at range */ boolean -ranged_attk(ptr) -struct permonst *ptr; +ranged_attk(struct permonst* ptr) { register int i, atyp; long atk_mask = (1L << AT_BREA) | (1L << AT_SPIT) | (1L << AT_GAZE); @@ -303,16 +291,14 @@ struct permonst *ptr; /* True if specific monster is especially affected by silver weapons */ boolean -mon_hates_silver(mon) -struct monst *mon; +mon_hates_silver(struct monst* mon) { return (boolean) (is_vampshifter(mon) || hates_silver(mon->data)); } /* True if monster-type is especially affected by silver weapons */ boolean -hates_silver(ptr) -register struct permonst *ptr; +hates_silver(register struct permonst* ptr) { return (boolean) (is_were(ptr) || ptr->mlet == S_VAMPIRE || is_demon(ptr) || ptr == &mons[PM_SHADE] @@ -321,16 +307,14 @@ register struct permonst *ptr; /* True if specific monster is especially affected by light-emitting weapons */ boolean -mon_hates_light(mon) -struct monst *mon; +mon_hates_light(struct monst* mon) { return (boolean) (hates_light(mon->data)); } /* True iff the type of monster pass through iron bars */ boolean -passes_bars(mptr) -struct permonst *mptr; +passes_bars(struct permonst* mptr) { return (boolean) (passes_walls(mptr) || amorphous(mptr) || unsolid(mptr) || is_whirly(mptr) || verysmall(mptr) @@ -343,8 +327,7 @@ struct permonst *mptr; /* returns True if monster can blow (whistle, etc) */ boolean -can_blow(mtmp) -struct monst *mtmp; +can_blow(struct monst* mtmp) { if ((is_silent(mtmp->data) || mtmp->data->msound == MS_BUZZ) && (breathless(mtmp->data) || verysmall(mtmp->data) @@ -357,8 +340,7 @@ struct monst *mtmp; /* for casting spells and reading scrolls while blind */ boolean -can_chant(mtmp) -struct monst *mtmp; +can_chant(struct monst* mtmp) { if ((mtmp == &g.youmonst && Strangled) || is_silent(mtmp->data) || !has_head(mtmp->data) @@ -369,8 +351,7 @@ struct monst *mtmp; /* True if mon is vulnerable to strangulation */ boolean -can_be_strangled(mon) -struct monst *mon; +can_be_strangled(struct monst* mon) { struct obj *mamul; boolean nonbreathing, nobrainer; @@ -402,8 +383,7 @@ struct monst *mon; /* returns True if monster can track well */ boolean -can_track(ptr) -register struct permonst *ptr; +can_track(register struct permonst* ptr) { if (uwep && uwep->oartifact == ART_EXCALIBUR) return TRUE; @@ -413,8 +393,7 @@ register struct permonst *ptr; /* creature will slide out of armor */ boolean -sliparm(ptr) -register struct permonst *ptr; +sliparm(register struct permonst* ptr) { return (boolean) (is_whirly(ptr) || ptr->msize <= MZ_SMALL || noncorporeal(ptr)); @@ -422,8 +401,7 @@ register struct permonst *ptr; /* creature will break out of armor */ boolean -breakarm(ptr) -register struct permonst *ptr; +breakarm(register struct permonst* ptr) { if (sliparm(ptr)) return FALSE; @@ -437,8 +415,7 @@ register struct permonst *ptr; /* creature sticks other creatures it hits */ boolean -sticks(ptr) -register struct permonst *ptr; +sticks(register struct permonst* ptr) { return (boolean) (dmgtype(ptr, AD_STCK) || dmgtype(ptr, AD_WRAP) || attacktype(ptr, AT_HUGS)); @@ -446,8 +423,7 @@ register struct permonst *ptr; /* some monster-types can't vomit */ boolean -cantvomit(ptr) -struct permonst *ptr; +cantvomit(struct permonst* ptr) { /* rats and mice are incapable of vomiting; which other creatures have the same limitation? */ @@ -459,8 +435,7 @@ struct permonst *ptr; /* number of horns this type of monster has on its head */ int -num_horns(ptr) -struct permonst *ptr; +num_horns(struct permonst* ptr) { switch (monsndx(ptr)) { case PM_HORNED_DEVIL: /* ? "more than one" */ @@ -482,9 +457,7 @@ struct permonst *ptr; /* does monster-type deal out a particular type of damage from a particular type of attack? */ struct attack * -dmgtype_fromattack(ptr, dtyp, atyp) -struct permonst *ptr; -int dtyp, atyp; +dmgtype_fromattack(struct permonst* ptr, int dtyp, int atyp) { struct attack *a; @@ -496,9 +469,7 @@ int dtyp, atyp; /* does monster-type deal out a particular type of damage from any attack */ boolean -dmgtype(ptr, dtyp) -struct permonst *ptr; -int dtyp; +dmgtype(struct permonst* ptr, int dtyp) { return dmgtype_fromattack(ptr, dtyp, AT_ANY) ? TRUE : FALSE; } @@ -506,8 +477,7 @@ int dtyp; /* returns the maximum damage a defender can do to the attacker via a passive defense */ int -max_passive_dmg(mdef, magr) -register struct monst *mdef, *magr; +max_passive_dmg(register struct monst* mdef, register struct monst* magr) { int i, dmg, multi2 = 0; uchar adtyp; @@ -558,8 +528,7 @@ register struct monst *mdef, *magr; /* determine whether two monster types are from the same species */ boolean -same_race(pm1, pm2) -struct permonst *pm1, *pm2; +same_race(struct permonst* pm1, struct permonst* pm2) { char let1 = pm1->mlet, let2 = pm2->mlet; @@ -663,8 +632,7 @@ struct permonst *pm1, *pm2; /* return an index into the mons array */ int -monsndx(ptr) -struct permonst *ptr; +monsndx(struct permonst* ptr) { register int i; @@ -687,9 +655,7 @@ struct alt_spl { /* figure out what type of monster a user-supplied string is specifying; ingore anything past the monster name */ int -name_to_mon(in_str, gender_name_var) -const char *in_str; -int *gender_name_var; +name_to_mon(const char *in_str, int * gender_name_var) { return name_to_monplus(in_str, (const char **) 0, gender_name_var); } @@ -699,10 +665,10 @@ int *gender_name_var; caller wants to strip off the name and it matches one of the alternate names rather the canonical mons[].mname */ int -name_to_monplus(in_str, remainder_p, gender_name_var) -const char *in_str; -const char **remainder_p; -int *gender_name_var; +name_to_monplus( + const char *in_str, + const char **remainder_p, + int *gender_name_var) { /* Be careful. We must check the entire string in case it was * something such as "ettin zombie corpse". The calling routine @@ -882,9 +848,7 @@ int *gender_name_var; /* monster class from user input; used for genocide and controlled polymorph; returns 0 rather than MAXMCLASSES if no match is found */ int -name_to_monclass(in_str, mndx_p) -const char *in_str; -int *mndx_p; +name_to_monclass(const char *in_str, int * mndx_p) { /* Single letters are matched against def_monsyms[].sym; words or phrases are first matched against def_monsyms[].explain @@ -974,8 +938,7 @@ int *mndx_p; /* returns 3 values (0=male, 1=female, 2=none) */ int -gender(mtmp) -register struct monst *mtmp; +gender(register struct monst* mtmp) { if (is_neuter(mtmp->data)) return 2; @@ -986,10 +949,10 @@ register struct monst *mtmp; and lower animals and such are "it" even when seen; hallucination might yield "they". This is the one we want to use when printing messages. */ int -pronoun_gender(mtmp, pg_flags) -register struct monst *mtmp; -unsigned pg_flags; /* flags&1: 'no it' unless neuter, - * flags&2: random if hallucinating */ +pronoun_gender( + register struct monst *mtmp, + unsigned pg_flags) /* flags&1: 'no it' unless neuter, + * flags&2: random if hallucinating */ { boolean override_vis = (pg_flags & PRONOUN_NO_IT) ? TRUE : FALSE, hallu_rand = (pg_flags & PRONOUN_HALLU) ? TRUE : FALSE; @@ -1006,8 +969,7 @@ unsigned pg_flags; /* flags&1: 'no it' unless neuter, /* used for nearby monsters when you go to another level */ boolean -levl_follower(mtmp) -struct monst *mtmp; +levl_follower(struct monst* mtmp) { if (mtmp == u.usteed) return TRUE; @@ -1098,8 +1060,7 @@ static const short grownups[][2] = { }; int -little_to_big(montype) -int montype; +little_to_big(int montype) { register int i; @@ -1112,8 +1073,7 @@ int montype; } int -big_to_little(montype) -int montype; +big_to_little(int montype) { register int i; @@ -1128,8 +1088,7 @@ int montype; /* determine whether two permonst indices are part of the same progression; existence of progressions with more than one step makes it a bit tricky */ boolean -big_little_match(montyp1, montyp2) -int montyp1, montyp2; +big_little_match(int montyp1, int montyp2) { int l, b; @@ -1157,8 +1116,7 @@ int montyp1, montyp2; * player. It does not return a pointer to player role character. */ const struct permonst * -raceptr(mtmp) -struct monst *mtmp; +raceptr(struct monst* mtmp) { if (mtmp == &g.youmonst && !Upolyd) return &mons[g.urace.malenum]; @@ -1175,9 +1133,7 @@ static const char *immobile[4] = { "wiggle", "Wiggle", "pulsate", "Pulsate" }; static const char *crawl[4] = { "crawl", "Crawl", "falter", "Falter" }; const char * -locomotion(ptr, def) -const struct permonst *ptr; -const char *def; +locomotion(const struct permonst* ptr, const char* def) { int capitalize = (*def == highc(*def)); @@ -1192,9 +1148,7 @@ const char *def; } const char * -stagger(ptr, def) -const struct permonst *ptr; -const char *def; +stagger(const struct permonst* ptr, const char* def) { int capitalize = 2 + (*def == highc(*def)); @@ -1210,9 +1164,7 @@ const char *def; /* return phrase describing the effect of fire attack on a type of monster */ const char * -on_fire(mptr, mattk) -struct permonst *mptr; -struct attack *mattk; +on_fire(struct permonst* mptr, struct attack* mattk) { const char *what; @@ -1258,8 +1210,7 @@ struct attack *mattk; * We're assuming all insects can smell at a distance too. */ boolean -olfaction(mdat) -struct permonst *mdat; +olfaction(struct permonst* mdat) { if (is_golem(mdat) || mdat->mlet == S_EYE /* spheres */ diff --git a/src/monmove.c b/src/monmove.c index 48ba3ccc7..2442a5cd6 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -7,20 +7,18 @@ #include "mfndpos.h" #include "artifact.h" -static void FDECL(watch_on_duty, (struct monst *)); -static int FDECL(disturb, (struct monst *)); -static void FDECL(release_hero, (struct monst *)); -static void FDECL(distfleeck, (struct monst *, int *, int *, int *)); -static int FDECL(m_arrival, (struct monst *)); -static boolean FDECL(m_balks_at_approaching, (struct monst *)); -static boolean FDECL(stuff_prevents_passage, (struct monst *)); -static int FDECL(vamp_shift, (struct monst *, struct permonst *, - BOOLEAN_P)); +static void watch_on_duty(struct monst *); +static int disturb(struct monst *); +static void release_hero(struct monst *); +static void distfleeck(struct monst *, int *, int *, int *); +static int m_arrival(struct monst *); +static boolean m_balks_at_approaching(struct monst *); +static boolean stuff_prevents_passage(struct monst *); +static int vamp_shift(struct monst *, struct permonst *, boolean); /* True if mtmp died */ boolean -mb_trapped(mtmp) -struct monst *mtmp; +mb_trapped(struct monst* mtmp) { if (flags.verbose) { if (cansee(mtmp->mx, mtmp->my) && !Unaware) @@ -43,9 +41,9 @@ struct monst *mtmp; /* check whether a monster is carrying a locking/unlocking tool */ boolean -monhaskey(mon, for_unlocking) -struct monst *mon; -boolean for_unlocking; /* true => credit card ok, false => not ok */ +monhaskey( + struct monst *mon, + boolean for_unlocking) /* true => credit card ok, false => not ok */ { if (for_unlocking && m_carrying(mon, CREDIT_CARD)) return TRUE; @@ -53,9 +51,7 @@ boolean for_unlocking; /* true => credit card ok, false => not ok */ } void -mon_yells(mon, shout) -struct monst *mon; -const char *shout; +mon_yells(struct monst* mon, const char* shout) { if (Deaf) { if (canspotmon(mon)) @@ -78,8 +74,7 @@ const char *shout; } static void -watch_on_duty(mtmp) -register struct monst *mtmp; +watch_on_duty(register struct monst* mtmp) { int x, y; @@ -106,8 +101,7 @@ register struct monst *mtmp; } int -dochugw(mtmp) -register struct monst *mtmp; +dochugw(register struct monst* mtmp) { int x = mtmp->mx, y = mtmp->my; boolean already_saw_mon = !g.occupation ? 0 : canspotmon(mtmp); @@ -133,9 +127,7 @@ register struct monst *mtmp; } boolean -onscary(x, y, mtmp) -int x, y; -struct monst *mtmp; +onscary(int x, int y, struct monst* mtmp) { /* creatures who are directly resistant to magical scaring: * humans aren't monsters @@ -188,9 +180,7 @@ struct monst *mtmp; /* regenerate lost hit points */ void -mon_regen(mon, digest_meal) -struct monst *mon; -boolean digest_meal; +mon_regen(struct monst* mon, boolean digest_meal) { if (mon->mhp < mon->mhpmax && (g.moves % 20 == 0 || regenerates(mon->data))) mon->mhp++; @@ -210,8 +200,7 @@ boolean digest_meal; * jolted awake. */ static int -disturb(mtmp) -register struct monst *mtmp; +disturb(register struct monst* mtmp) { /* * + Ettins are hard to surprise. @@ -245,8 +234,7 @@ register struct monst *mtmp; /* ungrab/expel held/swallowed hero */ static void -release_hero(mon) -struct monst *mon; +release_hero(struct monst* mon) { if (mon == u.ustuck) { if (u.uswallow) { @@ -259,8 +247,7 @@ struct monst *mon; } struct monst * -find_pmmonst(pm) -int pm; +find_pmmonst(int pm) { struct monst *mtmp = 0; @@ -279,9 +266,7 @@ int pm; will eat it if there is no queen bee on the level; return 1: mon died, 0: mon ate jelly and lived; -1: mon didn't eat jelly to use its move */ int -bee_eat_jelly(mon, obj) -struct monst *mon; -struct obj *obj; +bee_eat_jelly(struct monst* mon, struct obj* obj) { int m_delay; struct monst *mtmp = find_pmmonst(PM_QUEEN_BEE); @@ -319,11 +304,11 @@ struct obj *obj; * if first, only adds fleetime if monster isn't already fleeing * if fleemsg, prints a message about new flight, otherwise, caller should */ void -monflee(mtmp, fleetime, first, fleemsg) -struct monst *mtmp; -int fleetime; -boolean first; -boolean fleemsg; +monflee( + struct monst *mtmp, + int fleetime, + boolean first, + boolean fleemsg) { /* shouldn't happen; maybe warrants impossible()? */ if (DEADMONSTER(mtmp)) @@ -367,9 +352,7 @@ boolean fleemsg; } static void -distfleeck(mtmp, inrange, nearby, scared) -register struct monst *mtmp; -int *inrange, *nearby, *scared; +distfleeck(register struct monst* mtmp, int* inrange, int* nearby, int* scared) { int seescaryx, seescaryy; boolean sawscary = FALSE, bravegremlin = (rn2(5) == 0); @@ -408,8 +391,7 @@ int *inrange, *nearby, *scared; /* perform a special one-time action for a monster; returns -1 if nothing special happened, 0 if monster uses up its turn, 1 if monster is killed */ static int -m_arrival(mon) -struct monst *mon; +m_arrival(struct monst* mon) { mon->mstrategy &= ~STRAT_ARRIVE; /* always reset */ @@ -421,8 +403,7 @@ struct monst *mon; * code. --KAA */ int -dochug(mtmp) -register struct monst *mtmp; +dochug(register struct monst* mtmp) { register struct permonst *mdat; register int tmp = 0; @@ -762,8 +743,7 @@ static NEARDATA const char boulder_class[] = { ROCK_CLASS, 0 }; static NEARDATA const char gem_class[] = { GEM_CLASS, 0 }; boolean -itsstuck(mtmp) -register struct monst *mtmp; +itsstuck(register struct monst* mtmp) { if (sticks(g.youmonst.data) && mtmp == u.ustuck && !u.uswallow) { pline("%s cannot escape from you!", Monnam(mtmp)); @@ -780,12 +760,13 @@ register struct monst *mtmp; * those should be used instead. This function does that evaluation. */ boolean -should_displace(mtmp, poss, info, cnt, gx, gy) -struct monst *mtmp; -coord *poss; /* coord poss[9] */ -long *info; /* long info[9] */ -int cnt; -xchar gx, gy; +should_displace( + struct monst *mtmp, + coord *poss, /* coord poss[9] */ + long *info, /* long info[9] */ + int cnt, + xchar gx, + xchar gy) { int shortest_with_displacing = -1; int shortest_without_displacing = -1; @@ -817,9 +798,7 @@ xchar gx, gy; } boolean -m_digweapon_check(mtmp, nix, niy) -struct monst *mtmp; -xchar nix,niy; +m_digweapon_check(struct monst* mtmp, xchar nix, xchar niy) { boolean can_tunnel = 0; struct obj *mw_tmp = MON_WEP(mtmp); @@ -850,8 +829,7 @@ xchar nix,niy; /* does monster want to avoid you? */ static boolean -m_balks_at_approaching(mtmp) -struct monst *mtmp; +m_balks_at_approaching(struct monst* mtmp) { /* peaceful, far away, or can't see you */ if (mtmp->mpeaceful @@ -885,9 +863,7 @@ struct monst *mtmp; * 3: did not move, and can't do anything else either. */ int -m_move(mtmp, after) -register struct monst *mtmp; -register int after; +m_move(register struct monst* mtmp, register int after) { int appr, etmp; xchar gx, gy, nix, niy, chcnt; @@ -1601,9 +1577,7 @@ register int after; * (mtmp died) or 3 (mtmp made its move). */ int -m_move_aggress(mtmp, x, y) -struct monst * mtmp; -xchar x, y; +m_move_aggress(struct monst* mtmp, xchar x, xchar y) { struct monst *mtmp2; int mstatus; @@ -1629,8 +1603,7 @@ xchar x, y; } void -dissolve_bars(x, y) -register int x, y; +dissolve_bars(register int x, register int y) { levl[x][y].typ = (Is_special(&u.uz) || *in_rooms(x, y, 0)) ? ROOM : CORR; levl[x][y].flags = 0; @@ -1640,16 +1613,14 @@ register int x, y; } boolean -closed_door(x, y) -register int x, y; +closed_door(register int x, register int y) { return (boolean) (IS_DOOR(levl[x][y].typ) && (levl[x][y].doormask & (D_LOCKED | D_CLOSED))); } boolean -accessible(x, y) -register int x, y; +accessible(register int x, register int y) { int levtyp = levl[x][y].typ; @@ -1662,8 +1633,7 @@ register int x, y; /* decide where the monster thinks you are standing */ void -set_apparxy(mtmp) -register struct monst *mtmp; +set_apparxy(register struct monst* mtmp) { boolean notseen, notthere, gotu; int disp, mx = mtmp->mux, my = mtmp->muy; @@ -1737,9 +1707,10 @@ register struct monst *mtmp; * location however. */ boolean -undesirable_disp(mtmp, x, y) -struct monst *mtmp; /* barging creature */ -xchar x, y; /* spot 'mtmp' is considering moving to */ +undesirable_disp( + struct monst *mtmp, /* barging creature */ + xchar x, + xchar y) /* spot 'mtmp' is considering moving to */ { boolean is_pet = (mtmp && mtmp->mtame && !mtmp->isminion); struct trap *trap = t_at(x, y); @@ -1778,8 +1749,7 @@ xchar x, y; /* spot 'mtmp' is considering moving to */ * Used by can_ooze() and can_fog(). */ static boolean -stuff_prevents_passage(mtmp) -struct monst *mtmp; +stuff_prevents_passage(struct monst* mtmp) { struct obj *chain, *obj; @@ -1816,8 +1786,7 @@ struct monst *mtmp; } boolean -can_ooze(mtmp) -struct monst *mtmp; +can_ooze(struct monst* mtmp) { if (!amorphous(mtmp->data) || stuff_prevents_passage(mtmp)) return FALSE; @@ -1826,8 +1795,7 @@ struct monst *mtmp; /* monster can change form into a fog if necessary */ boolean -can_fog(mtmp) -struct monst *mtmp; +can_fog(struct monst* mtmp) { if (!(g.mvitals[PM_FOG_CLOUD].mvflags & G_GENOD) && is_vampshifter(mtmp) && !Protection_from_shape_changers && !stuff_prevents_passage(mtmp)) @@ -1836,10 +1804,10 @@ struct monst *mtmp; } static int -vamp_shift(mon, ptr, domsg) -struct monst *mon; -struct permonst *ptr; -boolean domsg; +vamp_shift( + struct monst *mon, + struct permonst *ptr, + boolean domsg) { int reslt = 0; char oldmtype[BUFSZ]; diff --git a/src/monst.c b/src/monst.c index 6d3dc51af..1db5cf978 100644 --- a/src/monst.c +++ b/src/monst.c @@ -3253,12 +3253,12 @@ struct permonst _mons2[] = { #ifndef SPLITMON_1 -void NDECL(monst_globals_init); /* in hack.h but we're using config.h */ +void monst_globals_init(void); /* in hack.h but we're using config.h */ struct permonst mons[SIZE(mons_init)]; void -monst_globals_init() +monst_globals_init(void) { memcpy(mons, mons_init, sizeof(mons)); return; diff --git a/src/mplayer.c b/src/mplayer.c index 78f8f84f3..d50f8daa2 100644 --- a/src/mplayer.c +++ b/src/mplayer.c @@ -4,9 +4,9 @@ #include "hack.h" -static const char *NDECL(dev_name); -static void FDECL(get_mplname, (struct monst *, char *)); -static void FDECL(mk_mplayer_armor, (struct monst *, SHORT_P)); +static const char *dev_name(void); +static void get_mplname(struct monst *, char *); +static void mk_mplayer_armor(struct monst *, short); /* These are the names of those who * contributed to the development of NetHack 3.2/3.3/3.4/3.6. @@ -41,7 +41,7 @@ static const char *developers[] = { /* return a randomly chosen developer name */ static const char * -dev_name() +dev_name(void) { register int i, m = 0, n = SIZE(developers); register struct monst *mtmp; @@ -69,9 +69,7 @@ dev_name() } static void -get_mplname(mtmp, nam) -register struct monst *mtmp; -char *nam; +get_mplname(register struct monst* mtmp, char *nam) { boolean fmlkind = is_female(mtmp->data); const char *devnam; @@ -94,9 +92,7 @@ char *nam; } static void -mk_mplayer_armor(mon, typ) -struct monst *mon; -short typ; +mk_mplayer_armor(struct monst* mon, short typ) { struct obj *obj; @@ -118,10 +114,7 @@ short typ; } struct monst * -mk_mplayer(ptr, x, y, special) -register struct permonst *ptr; -xchar x, y; -register boolean special; +mk_mplayer(register struct permonst* ptr, xchar x, xchar y, register boolean special) { register struct monst *mtmp; char nam[PL_NSIZ]; @@ -327,9 +320,7 @@ register boolean special; * fill up the overflow. */ void -create_mplayers(num, special) -register int num; -boolean special; +create_mplayers(register int num, boolean special) { int pm, x, y; struct monst fakemon; @@ -358,8 +349,7 @@ boolean special; } void -mplayer_talk(mtmp) -register struct monst *mtmp; +mplayer_talk(register struct monst* mtmp) { static const char *same_class_msg[3] = { diff --git a/src/mthrowu.c b/src/mthrowu.c index c545eca7f..8dd7be626 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -5,10 +5,10 @@ #include "hack.h" -static int FDECL(monmulti, (struct monst *, struct obj *, struct obj *)); -static void FDECL(monshoot, (struct monst *, struct obj *, struct obj *)); -static int FDECL(drop_throw, (struct obj *, BOOLEAN_P, int, int)); -static int FDECL(m_lined_up, (struct monst *, struct monst *)); +static int monmulti(struct monst *, struct obj *, struct obj *); +static void monshoot(struct monst *, struct obj *, struct obj *); +static int drop_throw(struct obj *, boolean, int, int); +static int m_lined_up(struct monst *, struct monst *); #define URETREATING(x, y) \ (distmin(u.ux, u.uy, x, y) > distmin(u.ux0, u.uy0, x, y)) @@ -23,8 +23,7 @@ static NEARDATA const char *breathwep[] = { }; boolean -m_has_launcher_and_ammo(mtmp) -struct monst *mtmp; +m_has_launcher_and_ammo(struct monst* mtmp) { struct obj *mwep = MON_WEP(mtmp); @@ -40,10 +39,11 @@ struct monst *mtmp; /* hero is hit by something other than a monster */ int -thitu(tlev, dam, objp, name) -int tlev, dam; -struct obj **objp; -const char *name; /* if null, then format `*objp' */ +thitu( + int tlev, + int dam, + struct obj **objp, + const char *name) /* if null, then format `*objp' */ { struct obj *obj = objp ? *objp : 0; const char *onm, *knm; @@ -115,10 +115,11 @@ const char *name; /* if null, then format `*objp' */ * Returns 0 if object still exists (not destroyed). */ static int -drop_throw(obj, ohit, x, y) -register struct obj *obj; -boolean ohit; -int x, y; +drop_throw( + register struct obj *obj, + boolean ohit, + int x, + int y) { int retvalu = 1; int create; @@ -159,9 +160,7 @@ int x, y; /* calculate multishot volley count for mtmp throwing otmp (if not ammo) or shooting otmp with mwep (if otmp is ammo and mwep appropriate launcher) */ static int -monmulti(mtmp, otmp, mwep) -struct monst *mtmp; -struct obj *otmp, *mwep; +monmulti(struct monst* mtmp, struct obj* otmp, struct obj* mwep) { int multishot = 1; @@ -220,9 +219,7 @@ struct obj *otmp, *mwep; /* mtmp throws otmp, or shoots otmp with mwep, at hero or at monster mtarg */ static void -monshoot(mtmp, otmp, mwep) -struct monst *mtmp; -struct obj *otmp, *mwep; +monshoot(struct monst* mtmp, struct obj* otmp, struct obj* mwep) { struct monst *mtarg = g.mtarget; int dm = distmin(mtmp->mx, mtmp->my, @@ -279,13 +276,13 @@ struct obj *otmp, *mwep; /* an object launched by someone/thing other than player attacks a monster; return 1 if the object has stopped moving (hit or its range used up) */ int -ohitmon(mtmp, otmp, range, verbose) -struct monst *mtmp; /* accidental target, located at */ -struct obj *otmp; /* missile; might be destroyed by drop_throw */ -int range; /* how much farther will object travel if it misses; - use -1 to signify to keep going even after hit, - unless it's gone (used for rolling_boulder_traps) */ -boolean verbose; /* give message(s) even when you can't see what happened */ +ohitmon( + struct monst *mtmp, /* accidental target, located at */ + struct obj *otmp, /* missile; might be destroyed by drop_throw */ + int range, /* how much farther will object travel if it misses; + use -1 to signify to keep going even after hit, + unless it's gone (used for rolling_boulder_traps) */ + boolean verbose)/* give message(s) even when you can't see what happened */ { int damage, tmp; boolean vis, ismimic; @@ -466,10 +463,14 @@ boolean verbose; /* give message(s) even when you can't see what happened */ || (!(pre) && IS_SINK(levl[g.bhitpos.x][g.bhitpos.y].typ))) void -m_throw(mon, x, y, dx, dy, range, obj) -struct monst *mon; /* launching monster */ -int x, y, dx, dy, range; /* launch point, direction, and range */ -struct obj *obj; /* missile (or stack providing it) */ +m_throw( + struct monst *mon, /* launching monster */ + int x, + int y, + int dx, + int dy, + int range, /* launch point, direction, and range */ + struct obj *obj) /* missile (or stack providing it) */ { struct monst *mtmp; struct obj *singleobj; @@ -689,8 +690,7 @@ struct obj *obj; /* missile (or stack providing it) */ /* Monster throws item at another monster */ int -thrwmm(mtmp, mtarg) -struct monst *mtmp, *mtarg; +thrwmm(struct monst* mtmp, struct monst* mtarg) { struct obj *otmp, *mwep; register xchar x, y; @@ -737,9 +737,7 @@ struct monst *mtmp, *mtarg; /* monster spits substance at monster */ int -spitmm(mtmp, mattk, mtarg) -struct monst *mtmp, *mtarg; -struct attack *mattk; +spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) { struct obj *otmp; @@ -797,9 +795,7 @@ struct attack *mattk; /* monster breathes at monster (ranged) */ int -breamm(mtmp, mattk, mtarg) -struct monst *mtmp, *mtarg; -struct attack *mattk; +breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) { /* if new breath types are added, change AD_ACID to max type */ int typ = (mattk->adtyp == AD_RBRE) ? rnd(AD_ACID) : mattk->adtyp ; @@ -850,9 +846,7 @@ struct attack *mattk; /* remove an entire item from a monster's inventory; destroy that item */ void -m_useupall(mon, obj) -struct monst *mon; -struct obj *obj; +m_useupall(struct monst* mon, struct obj* obj) { obj_extract_self(obj); if (obj->owornmask) { @@ -867,9 +861,7 @@ struct obj *obj; /* remove one instance of an item from a monster's inventory */ void -m_useup(mon, obj) -struct monst *mon; -struct obj *obj; +m_useup(struct monst* mon, struct obj* obj) { if (obj->quan > 1L) { obj->quan--; @@ -881,8 +873,7 @@ struct obj *obj; /* monster attempts ranged weapon attack against player */ void -thrwmu(mtmp) -struct monst *mtmp; +thrwmu(struct monst* mtmp) { struct obj *otmp, *mwep; xchar x, y; @@ -950,18 +941,14 @@ struct monst *mtmp; /* monster spits substance at you */ int -spitmu(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +spitmu(struct monst* mtmp, struct attack* mattk) { return spitmm(mtmp, mattk, &g.youmonst); } /* monster breathes at you (ranged) */ int -breamu(mtmp, mattk) -struct monst *mtmp; -struct attack *mattk; +breamu(struct monst* mtmp, struct attack* mattk) { return breamm(mtmp, mattk, &g.youmonst); } @@ -971,9 +958,12 @@ struct attack *mattk; Stops if fnc return TRUE, or if step was blocked by wall or closed door. Returns TRUE if fnc returned TRUE. */ boolean -linedup_callback(ax, ay, bx, by, fnc) -xchar ax, ay, bx, by; -boolean FDECL((*fnc), (int, int)); +linedup_callback( + xchar ax, + xchar ay, + xchar bx, + xchar by, + boolean (*fnc)(int, int)) { int dx, dy; @@ -1004,9 +994,12 @@ boolean FDECL((*fnc), (int, int)); } boolean -linedup(ax, ay, bx, by, boulderhandling) -register xchar ax, ay, bx, by; -int boulderhandling; /* 0=block, 1=ignore, 2=conditionally block */ +linedup( + register xchar ax, + register xchar ay, + register xchar bx, + register xchar by, + int boulderhandling) /* 0=block, 1=ignore, 2=conditionally block */ { int dx, dy, boulderspots; @@ -1046,8 +1039,7 @@ int boulderhandling; /* 0=block, 1=ignore, 2=conditionally block */ } static int -m_lined_up(mtarg, mtmp) -struct monst *mtarg, *mtmp; +m_lined_up(struct monst* mtarg, struct monst* mtmp) { boolean utarget = (mtarg == &g.youmonst); xchar tx = utarget ? mtmp->mux : mtarg->mx; @@ -1069,17 +1061,14 @@ struct monst *mtarg, *mtmp; /* is mtmp in position to use ranged attack on hero? */ boolean -lined_up(mtmp) -register struct monst *mtmp; +lined_up(register struct monst* mtmp) { return m_lined_up(&g.youmonst, mtmp) ? TRUE : FALSE; } /* check if a monster is carrying a particular item */ struct obj * -m_carrying(mtmp, type) -struct monst *mtmp; -int type; +m_carrying(struct monst* mtmp, int type) { register struct obj *otmp; @@ -1090,10 +1079,10 @@ int type; } void -hit_bars(objp, objx, objy, barsx, barsy, your_fault, from_invent) -struct obj **objp; /* *objp will be set to NULL if object breaks */ -int objx, objy, barsx, barsy; -boolean your_fault, from_invent; +hit_bars( + struct obj **objp, /* *objp will be set to NULL if object breaks */ + int objx, int objy, int barsx, int barsy, + boolean your_fault, boolean from_invent) { struct obj *otmp = *objp; int obj_type = otmp->otyp; @@ -1125,11 +1114,11 @@ boolean your_fault, from_invent; /* TRUE iff thrown/kicked/rolled object doesn't pass through iron bars */ boolean -hits_bars(obj_p, x, y, barsx, barsy, always_hit, whodidit) -struct obj **obj_p; /* *obj_p will be set to NULL if object breaks */ -int x, y, barsx, barsy; -int always_hit; /* caller can force a hit for items which would fit through */ -int whodidit; /* 1==hero, 0=other, -1==just check whether it'll pass thru */ +hits_bars( + struct obj **obj_p, /* *obj_p will be set to NULL if object breaks */ + int x, int y, int barsx, int barsy, + int always_hit, /* caller can force a hit for items which would fit through */ + int whodidit) /* 1==hero, 0=other, -1==just check whether it'll pass thru */ { struct obj *otmp = *obj_p; int obj_type = otmp->otyp; diff --git a/src/muse.c b/src/muse.c index b1e35cc1e..a968b5905 100644 --- a/src/muse.c +++ b/src/muse.c @@ -14,43 +14,38 @@ * are confused don't know not to read scrolls, etc.... */ -static int FDECL(precheck, (struct monst *, struct obj *)); -static void FDECL(mzapwand, (struct monst *, struct obj *, BOOLEAN_P)); -static void FDECL(mplayhorn, (struct monst *, struct obj *, BOOLEAN_P)); -static void FDECL(mreadmsg, (struct monst *, struct obj *)); -static void FDECL(mquaffmsg, (struct monst *, struct obj *)); -static boolean FDECL(m_use_healing, (struct monst *)); -static boolean FDECL(linedup_chk_corpse, (int, int)); -static void FDECL(m_use_undead_turning, (struct monst *, struct obj *)); -static int FDECL(mbhitm, (struct monst *, struct obj *)); -static void FDECL(mbhit, (struct monst *, int, - int FDECL((*), (MONST_P, OBJ_P)), - int FDECL((*), (OBJ_P, OBJ_P)), struct obj *)); -static struct permonst *FDECL(muse_newcham_mon, (struct monst *)); -static int FDECL(mloot_container, (struct monst *mon, struct obj *, - BOOLEAN_P)); -static void FDECL(you_aggravate, (struct monst *)); +static int precheck(struct monst *, struct obj *); +static void mzapwand(struct monst *, struct obj *, boolean); +static void mplayhorn(struct monst *, struct obj *, boolean); +static void mreadmsg(struct monst *, struct obj *); +static void mquaffmsg(struct monst *, struct obj *); +static boolean m_use_healing(struct monst *); +static boolean linedup_chk_corpse(int, int); +static void m_use_undead_turning(struct monst *, struct obj *); +static int mbhitm(struct monst *, struct obj *); +static void mbhit(struct monst *, int, int (*)(MONST_P, OBJ_P), + int (*)(OBJ_P, OBJ_P), struct obj *); +static struct permonst *muse_newcham_mon(struct monst *); +static int mloot_container(struct monst *mon, struct obj *, boolean); +static void you_aggravate(struct monst *); #if 0 -static boolean FDECL(necrophiliac, (struct obj *, BOOLEAN_P)); +static boolean necrophiliac(struct obj *, boolean); #endif -static void FDECL(mon_consume_unstone, (struct monst *, struct obj *, - BOOLEAN_P, BOOLEAN_P)); -static boolean FDECL(cures_stoning, (struct monst *, struct obj *, - BOOLEAN_P)); -static boolean FDECL(mcould_eat_tin, (struct monst *)); -static boolean FDECL(muse_unslime, (struct monst *, struct obj *, - struct trap *, BOOLEAN_P)); -static int FDECL(cures_sliming, (struct monst *, struct obj *)); -static boolean FDECL(green_mon, (struct monst *)); +static void mon_consume_unstone(struct monst *, struct obj *, boolean, + boolean); +static boolean cures_stoning(struct monst *, struct obj *, boolean); +static boolean mcould_eat_tin(struct monst *); +static boolean muse_unslime(struct monst *, struct obj *, struct trap *, + boolean); +static int cures_sliming(struct monst *, struct obj *); +static boolean green_mon(struct monst *); /* Any preliminary checks which may result in the monster being unable to use * the item. Returns 0 if nothing happened, 2 if the monster can't do * anything (i.e. it teleported) and 1 if it's dead. */ static int -precheck(mon, obj) -struct monst *mon; -struct obj *obj; +precheck(struct monst* mon, struct obj* obj) { boolean vis; @@ -153,10 +148,10 @@ struct obj *obj; /* when a monster zaps a wand give a message, deduct a charge, and if it isn't directly seen, remove hero's memory of the number of charges */ static void -mzapwand(mtmp, otmp, self) -struct monst *mtmp; -struct obj *otmp; -boolean self; +mzapwand( + struct monst *mtmp, + struct obj *otmp, + boolean self) { if (otmp->spe < 1) { impossible("Mon zapping wand with %d charges?", otmp->spe); @@ -182,10 +177,10 @@ boolean self; /* similar to mzapwand() but for magical horns (only instrument mons play) */ static void -mplayhorn(mtmp, otmp, self) -struct monst *mtmp; -struct obj *otmp; -boolean self; +mplayhorn( + struct monst *mtmp, + struct obj *otmp, + boolean self) { char *objnamp, objbuf[BUFSZ]; @@ -222,9 +217,7 @@ boolean self; } static void -mreadmsg(mtmp, otmp) -struct monst *mtmp; -struct obj *otmp; +mreadmsg(struct monst* mtmp, struct obj* otmp) { boolean vismon = canseemon(mtmp); char onambuf[BUFSZ]; @@ -263,9 +256,7 @@ struct obj *otmp; } static void -mquaffmsg(mtmp, otmp) -struct monst *mtmp; -struct obj *otmp; +mquaffmsg(struct monst* mtmp, struct obj* otmp) { if (canseemon(mtmp)) { otmp->dknown = 1; @@ -307,8 +298,7 @@ struct obj *otmp; */ static boolean -m_use_healing(mtmp) -struct monst *mtmp; +m_use_healing(struct monst* mtmp) { struct obj *obj = 0; if ((obj = m_carrying(mtmp, POT_FULL_HEALING)) != 0) { @@ -332,8 +322,7 @@ struct monst *mtmp; /* Select a defensive item/action for a monster. Returns TRUE iff one is found. */ boolean -find_defensive(mtmp) -struct monst *mtmp; +find_defensive(struct monst* mtmp) { struct obj *obj; struct trap *t; @@ -662,8 +651,7 @@ struct monst *mtmp; * 2: did something and can't attack again (i.e. teleported). */ int -use_defensive(mtmp) -struct monst *mtmp; +use_defensive(struct monst* mtmp) { int i, fleetim, how = 0; struct obj *otmp = g.m.defensive; @@ -1072,8 +1060,7 @@ struct monst *mtmp; } int -rnd_defensive_item(mtmp) -struct monst *mtmp; +rnd_defensive_item(struct monst* mtmp) { struct permonst *pm = mtmp->data; int difficulty = mons[(monsndx(pm))].difficulty; @@ -1139,16 +1126,13 @@ struct monst *mtmp; * redefine; nonconsecutive value is ok */ static boolean -linedup_chk_corpse(x, y) -int x, y; +linedup_chk_corpse(int x, int y) { return (sobj_at(CORPSE, x, y) != 0); } static void -m_use_undead_turning(mtmp, obj) -struct monst *mtmp; -struct obj *obj; +m_use_undead_turning(struct monst* mtmp, struct obj* obj) { int ax = u.ux + sgn(mtmp->mux - mtmp->mx) * 3, ay = u.uy + sgn(mtmp->muy - mtmp->my) * 3; @@ -1196,8 +1180,7 @@ struct obj *obj; * found. */ boolean -find_offensive(mtmp) -struct monst *mtmp; +find_offensive(struct monst* mtmp) { register struct obj *obj; boolean reflection_skip = (Reflecting && rn2(2)); @@ -1344,9 +1327,7 @@ struct monst *mtmp; static int -mbhitm(mtmp, otmp) -register struct monst *mtmp; -register struct obj *otmp; +mbhitm(register struct monst* mtmp, register struct obj* otmp) { int tmp; boolean reveal_invis = FALSE, hits_you = (mtmp == &g.youmonst); @@ -1453,12 +1434,12 @@ register struct obj *otmp; * to merge the two functions...) */ static void -mbhit(mon, range, fhitm, fhito, obj) -struct monst *mon; /* monster shooting the wand */ -register int range; /* direction and range */ -int FDECL((*fhitm), (MONST_P, OBJ_P)); -int FDECL((*fhito), (OBJ_P, OBJ_P)); /* fns called when mon/obj hit */ -struct obj *obj; /* 2nd arg to fhitm/fhito */ +mbhit( + struct monst *mon, /* monster shooting the wand */ + register int range, /* direction and range */ + int (*fhitm)(MONST_P, OBJ_P), + int (*fhito)(OBJ_P, OBJ_P), /* fns called when mon/obj hit */ + struct obj *obj) /* 2nd arg to fhitm/fhito */ { register struct monst *mtmp; register struct obj *otmp; @@ -1545,8 +1526,7 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */ * after find_offensive(). Return values are same as use_defensive(). */ int -use_offensive(mtmp) -struct monst *mtmp; +use_offensive(struct monst* mtmp) { int i; struct obj *otmp = g.m.offensive; @@ -1714,8 +1694,7 @@ struct monst *mtmp; } int -rnd_offensive_item(mtmp) -struct monst *mtmp; +rnd_offensive_item(struct monst* mtmp) { struct permonst *pm = mtmp->data; int difficulty = mons[(monsndx(pm))].difficulty; @@ -1773,8 +1752,7 @@ struct monst *mtmp; #define MUSE_BAG 10 boolean -find_misc(mtmp) -struct monst *mtmp; +find_misc(struct monst* mtmp) { register struct obj *obj; struct permonst *mdat = mtmp->data; @@ -1924,8 +1902,7 @@ struct monst *mtmp; /* type of monster to polymorph into; defaults to one suitable for the current level rather than the totally arbitrary choice of newcham() */ static struct permonst * -muse_newcham_mon(mon) -struct monst *mon; +muse_newcham_mon(struct monst* mon) { struct obj *m_armr; @@ -1939,10 +1916,10 @@ struct monst *mon; } static int -mloot_container(mon, container, vismon) -struct monst *mon; -struct obj *container; -boolean vismon; +mloot_container( + struct monst *mon, + struct obj *container, + boolean vismon) { char contnr_nam[BUFSZ], mpronounbuf[20]; boolean nearby; @@ -2051,8 +2028,7 @@ boolean vismon; } int -use_misc(mtmp) -struct monst *mtmp; +use_misc(struct monst* mtmp) { int i; struct obj *otmp = g.m.misc; @@ -2265,8 +2241,7 @@ struct monst *mtmp; } static void -you_aggravate(mtmp) -struct monst *mtmp; +you_aggravate(struct monst* mtmp) { pline("For some reason, %s presence is known to you.", s_suffix(noit_mon_nam(mtmp))); @@ -2289,8 +2264,7 @@ struct monst *mtmp; } int -rnd_misc_item(mtmp) -struct monst *mtmp; +rnd_misc_item(struct monst* mtmp) { struct permonst *pm = mtmp->data; int difficulty = mons[(monsndx(pm))].difficulty; @@ -2327,9 +2301,7 @@ struct monst *mtmp; #if 0 /* check whether hero is carrying a corpse or contained petrifier corpse */ static boolean -necrophiliac(objlist, any_corpse) -struct obj *objlist; -boolean any_corpse; +necrophiliac(struct obj* objlist, boolean any_corpse) { while (objlist) { if (objlist->otyp == CORPSE @@ -2344,9 +2316,7 @@ boolean any_corpse; #endif boolean -searches_for_item(mon, obj) -struct monst *mon; -struct obj *obj; +searches_for_item(struct monst* mon, struct obj* obj) { int typ = obj->otyp; @@ -2433,9 +2403,7 @@ struct obj *obj; } boolean -mon_reflects(mon, str) -struct monst *mon; -const char *str; +mon_reflects(struct monst* mon, const char* str) { struct obj *orefl = which_armor(mon, W_ARMS); @@ -2474,8 +2442,7 @@ const char *str; } boolean -ureflects(fmt, str) -const char *fmt, *str; +ureflects(const char* fmt, const char* str) { /* Check from outermost to innermost objects */ if (EReflecting & W_ARMS) { @@ -2509,9 +2476,7 @@ const char *fmt, *str; /* cure mon's blindness (use_defensive, dog_eat, meatobj) */ void -mcureblindness(mon, verbos) -struct monst *mon; -boolean verbos; +mcureblindness(struct monst* mon, boolean verbos) { if (!mon->mcansee) { mon->mcansee = 1; @@ -2523,9 +2488,7 @@ boolean verbos; /* TRUE if the monster ate something */ boolean -munstone(mon, by_you) -struct monst *mon; -boolean by_you; +munstone(struct monst* mon, boolean by_you) { struct obj *obj; boolean tinok; @@ -2547,11 +2510,11 @@ boolean by_you; } static void -mon_consume_unstone(mon, obj, by_you, stoning) -struct monst *mon; -struct obj *obj; -boolean by_you; -boolean stoning; /* True: stop petrification, False: cure stun && confusion */ +mon_consume_unstone( + struct monst *mon, + struct obj *obj, + boolean by_you, + boolean stoning) /* True: stop petrification, False: cure stun && confusion */ { boolean vis = canseemon(mon), tinned = obj->otyp == TIN, food = obj->otyp == CORPSE || tinned, @@ -2627,10 +2590,7 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */ /* decide whether obj can cure petrification; also used when picking up */ static boolean -cures_stoning(mon, obj, tinok) -struct monst *mon; -struct obj *obj; -boolean tinok; +cures_stoning(struct monst* mon, struct obj* obj, boolean tinok) { if (obj->otyp == POT_ACID) return TRUE; @@ -2646,8 +2606,7 @@ boolean tinok; } static boolean -mcould_eat_tin(mon) -struct monst *mon; +mcould_eat_tin(struct monst* mon) { struct obj *obj, *mwep; boolean welded_wep; @@ -2677,9 +2636,7 @@ struct monst *mon; /* TRUE if monster does something to avoid turning into green slime */ boolean -munslime(mon, by_you) -struct monst *mon; -boolean by_you; +munslime(struct monst* mon, boolean by_you) { struct obj *obj, odummy; struct permonst *mptr = mon->data; @@ -2752,12 +2709,12 @@ boolean by_you; /* mon uses an item--selected by caller--to burn away incipient slime */ static boolean -muse_unslime(mon, obj, trap, by_you) -struct monst *mon; -struct obj *obj; -struct trap *trap; -boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ -{ /* [by_you not honored if 'mon' triggers fire trap]. */ +muse_unslime( + struct monst *mon, + struct obj *obj, + struct trap *trap, + boolean by_you) /* true: if mon kills itself, hero gets credit/blame */ +{ /* [by_you not honored if 'mon' triggers fire trap]. */ struct obj *odummyp; int otyp = obj->otyp, dmg = 0; boolean vis = canseemon(mon), res = TRUE; @@ -2861,9 +2818,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ /* decide whether obj can be used to cure green slime */ static int -cures_sliming(mon, obj) -struct monst *mon; -struct obj *obj; +cures_sliming(struct monst* mon, struct obj* obj) { /* scroll of fire, non-empty wand or horn of fire */ if (obj->otyp == SCR_FIRE) @@ -2878,8 +2833,7 @@ struct obj *obj; the display color, otherwise we just pick things that seem plausibly green (which doesn't necessarily match the TEXTCOLOR categorization) */ static boolean -green_mon(mon) -struct monst *mon; +green_mon(struct monst* mon) { struct permonst *ptr = mon->data; diff --git a/src/music.c b/src/music.c index 3dc60efc3..1441d28fc 100644 --- a/src/music.c +++ b/src/music.c @@ -28,22 +28,21 @@ #include "hack.h" -static void FDECL(awaken_monsters, (int)); -static void FDECL(put_monsters_to_sleep, (int)); -static void FDECL(charm_snakes, (int)); -static void FDECL(calm_nymphs, (int)); -static void FDECL(charm_monsters, (int)); -static void FDECL(do_earthquake, (int)); -static const char *NDECL(generic_lvl_desc); -static int FDECL(do_improvisation, (struct obj *)); +static void awaken_monsters(int); +static void put_monsters_to_sleep(int); +static void charm_snakes(int); +static void calm_nymphs(int); +static void charm_monsters(int); +static void do_earthquake(int); +static const char *generic_lvl_desc(void); +static int do_improvisation(struct obj *); /* * Wake every monster in range... */ static void -awaken_monsters(distance) -int distance; +awaken_monsters(int distance) { register struct monst *mtmp; register int distm; @@ -73,8 +72,7 @@ int distance; */ static void -put_monsters_to_sleep(distance) -int distance; +put_monsters_to_sleep(int distance) { register struct monst *mtmp; @@ -94,8 +92,7 @@ int distance; */ static void -charm_snakes(distance) -int distance; +charm_snakes(int distance) { register struct monst *mtmp; int could_see_mon, was_peaceful; @@ -129,8 +126,7 @@ int distance; */ static void -calm_nymphs(distance) -int distance; +calm_nymphs(int distance) { register struct monst *mtmp; @@ -153,8 +149,7 @@ int distance; /* Awake soldiers anywhere the level (and any nearby monster). */ void -awaken_soldiers(bugler) -struct monst *bugler; /* monster that played instrument */ +awaken_soldiers(struct monst* bugler /* monster that played instrument */) { register struct monst *mtmp; int distance, distm; @@ -196,8 +191,7 @@ struct monst *bugler; /* monster that played instrument */ * If swallowed, range is reduced to 0. */ static void -charm_monsters(distance) -int distance; +charm_monsters(int distance) { struct monst *mtmp, *mtmp2; @@ -222,8 +216,7 @@ int distance; * That is: create random chasms (pits). */ static void -do_earthquake(force) -int force; +do_earthquake(int force) { static const char into_a_chasm[] = " into a chasm"; register int x, y; @@ -465,7 +458,7 @@ int force; } static const char * -generic_lvl_desc() +generic_lvl_desc(void) { if (Is_astralevel(&u.uz)) return "astral plane"; @@ -490,8 +483,7 @@ const char *beats[] = { * The player is trying to extract something from his/her instrument. */ static int -do_improvisation(instr) -struct obj *instr; +do_improvisation(struct obj* instr) { int damage, mode, do_spec = !(Stunned || Confusion); struct obj itmp; @@ -690,8 +682,7 @@ struct obj *instr; * So you want music... */ int -do_play_instrument(instr) -struct obj *instr; +do_play_instrument(struct obj* instr) { char buf[BUFSZ] = DUMMY, c = 'y'; char *s; diff --git a/src/nhlobj.c b/src/nhlobj.c index 03e07401d..23c053cc8 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -10,25 +10,23 @@ struct _lua_obj { struct obj *obj; }; -static struct _lua_obj *FDECL(l_obj_check, (lua_State *, int)); -static int FDECL(l_obj_add_to_container, (lua_State *)); -static int FDECL(l_obj_gc, (lua_State *)); -static int FDECL(l_obj_getcontents, (lua_State *)); -static int FDECL(l_obj_isnull, (lua_State *)); -static int FDECL(l_obj_new_readobjnam, (lua_State *)); -static int FDECL(l_obj_nextobj, (lua_State *)); -static int FDECL(l_obj_objects_to_table, (lua_State *)); -static int FDECL(l_obj_placeobj, (lua_State *)); -static int FDECL(l_obj_to_table, (lua_State *)); -static int FDECL(l_obj_at, (lua_State *)); -static int FDECL(l_obj_container, (lua_State *)); +static struct _lua_obj *l_obj_check(lua_State *, int); +static int l_obj_add_to_container(lua_State *); +static int l_obj_gc(lua_State *); +static int l_obj_getcontents(lua_State *); +static int l_obj_isnull(lua_State *); +static int l_obj_new_readobjnam(lua_State *); +static int l_obj_nextobj(lua_State *); +static int l_obj_objects_to_table(lua_State *); +static int l_obj_placeobj(lua_State *); +static int l_obj_to_table(lua_State *); +static int l_obj_at(lua_State *); +static int l_obj_container(lua_State *); #define lobj_is_ok(lo) ((lo) && (lo)->obj && (lo)->obj->where != OBJ_LUAFREE) static struct _lua_obj * -l_obj_check(L, index) -lua_State *L; -int index; +l_obj_check(lua_State *L, int index) { struct _lua_obj *lo; @@ -40,8 +38,7 @@ int index; } static int -l_obj_gc(L) -lua_State *L; +l_obj_gc(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -67,9 +64,7 @@ lua_State *L; } static struct _lua_obj * -l_obj_push(L, otmp) -lua_State *L; -struct obj *otmp; +l_obj_push(lua_State *L, struct obj *otmp) { struct _lua_obj *lo = (struct _lua_obj *)lua_newuserdata(L, sizeof(struct _lua_obj)); luaL_getmetatable(L, "obj"); @@ -84,9 +79,7 @@ struct obj *otmp; } void -nhl_push_obj(L, otmp) -lua_State *L; -struct obj *otmp; +nhl_push_obj(lua_State *L, struct obj *otmp) { (void) l_obj_push(L, otmp); } @@ -94,8 +87,7 @@ struct obj *otmp; /* local o = obj.new("large chest"); local cobj = o:contents(); */ static int -l_obj_getcontents(L) -lua_State *L; +l_obj_getcontents(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); struct obj *obj = lo->obj; @@ -112,8 +104,7 @@ lua_State *L; box.addcontent(obj.new("rock")); */ static int -l_obj_add_to_container(L) -lua_State *L; +l_obj_add_to_container(lua_State *L) { struct _lua_obj *lobox = l_obj_check(L, 1); struct _lua_obj *lo = l_obj_check(L, 2); @@ -140,8 +131,7 @@ lua_State *L; /* Put object into player's inventory */ /* u.giveobj(obj.new("rock")); */ int -nhl_obj_u_giveobj(L) -lua_State *L; +nhl_obj_u_giveobj(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); struct obj *otmp; @@ -168,8 +158,7 @@ lua_State *L; /* local odata = obj.class(obj.new("rock")); */ /* local odata = o:class(); */ static int -l_obj_objects_to_table(L) -lua_State *L; +l_obj_objects_to_table(lua_State *L) { int argc = lua_gettop(L); int otyp = -1; @@ -241,8 +230,7 @@ lua_State *L; local o = obj.new("rock"); local otbl = o:totable(); */ static int -l_obj_to_table(L) -lua_State *L; +l_obj_to_table(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); struct obj *obj = lo->obj; @@ -337,8 +325,7 @@ lua_State *L; /* create a new object via wishing routine */ /* local o = obj.new("rock"); */ static int -l_obj_new_readobjnam(L) -lua_State *L; +l_obj_new_readobjnam(lua_State *L) { int argc = lua_gettop(L); @@ -358,8 +345,7 @@ lua_State *L; /* Get the topmost object on the map at x,y */ /* local o = obj.at(x, y); */ static int -l_obj_at(L) -lua_State *L; +l_obj_at(lua_State *L) { int argc = lua_gettop(L); @@ -380,8 +366,7 @@ lua_State *L; local o = obj.new("rock"); o:placeobj(u.ux, u.uy); */ static int -l_obj_placeobj(L) -lua_State *L; +l_obj_placeobj(lua_State *L) { int argc = lua_gettop(L); struct _lua_obj *lo = l_obj_check(L, 1); @@ -408,8 +393,7 @@ lua_State *L; local o2 = o:next(); */ static int -l_obj_nextobj(L) -lua_State *L; +l_obj_nextobj(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -421,8 +405,7 @@ lua_State *L; /* Get the container object is in */ /* local box = o:container(); */ static int -l_obj_container(L) -lua_State *L; +l_obj_container(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -436,8 +419,7 @@ lua_State *L; /* Is the object a null? */ /* local badobj = o:isnull(); */ static int -l_obj_isnull(L) -lua_State *L; +l_obj_isnull(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -466,8 +448,7 @@ static const luaL_Reg l_obj_meta[] = { }; int -l_obj_register(L) -lua_State *L; +l_obj_register(lua_State *L) { int lib_id, meta_id; diff --git a/src/nhlsel.c b/src/nhlsel.c index bfe09db3e..2b142a706 100644 --- a/src/nhlsel.c +++ b/src/nhlsel.c @@ -6,33 +6,33 @@ #include "sp_lev.h" /* lua_CFunction prototypes */ -static int FDECL(l_selection_new, (lua_State *)); -static int FDECL(l_selection_clone, (lua_State *)); -static int FDECL(l_selection_getpoint, (lua_State *)); -static int FDECL(l_selection_setpoint, (lua_State *)); -static int FDECL(l_selection_not, (lua_State *)); -static int FDECL(l_selection_filter_percent, (lua_State *)); -static int FDECL(l_selection_rndcoord, (lua_State *)); -static boolean FDECL(params_sel_2coords, (lua_State *, struct selectionvar **, - xchar *, xchar *, xchar *, xchar *)); -static int FDECL(l_selection_line, (lua_State *)); -static int FDECL(l_selection_randline, (lua_State *)); -static int FDECL(l_selection_rect, (lua_State *)); -static int FDECL(l_selection_fillrect, (lua_State *)); -static int FDECL(l_selection_grow, (lua_State *)); -static int FDECL(l_selection_filter_mapchar, (lua_State *)); -static int FDECL(l_selection_match, (lua_State *)); -static int FDECL(l_selection_flood, (lua_State *)); -static int FDECL(l_selection_circle, (lua_State *)); -static int FDECL(l_selection_ellipse, (lua_State *)); -static int FDECL(l_selection_gradient, (lua_State *)); -static int FDECL(l_selection_iterate, (lua_State *)); -static int FDECL(l_selection_gc, (lua_State *)); -static int FDECL(l_selection_not, (lua_State *)); -static int FDECL(l_selection_and, (lua_State *)); -static int FDECL(l_selection_or, (lua_State *)); -static int FDECL(l_selection_xor, (lua_State *)); -static int FDECL(l_selection_not, (lua_State *)); +static int l_selection_new(lua_State *); +static int l_selection_clone(lua_State *); +static int l_selection_getpoint(lua_State *); +static int l_selection_setpoint(lua_State *); +static int l_selection_not(lua_State *); +static int l_selection_filter_percent(lua_State *); +static int l_selection_rndcoord(lua_State *); +static boolean params_sel_2coords(lua_State *, struct selectionvar **, + xchar *, xchar *, xchar *, xchar *); +static int l_selection_line(lua_State *); +static int l_selection_randline(lua_State *); +static int l_selection_rect(lua_State *); +static int l_selection_fillrect(lua_State *); +static int l_selection_grow(lua_State *); +static int l_selection_filter_mapchar(lua_State *); +static int l_selection_match(lua_State *); +static int l_selection_flood(lua_State *); +static int l_selection_circle(lua_State *); +static int l_selection_ellipse(lua_State *); +static int l_selection_gradient(lua_State *); +static int l_selection_iterate(lua_State *); +static int l_selection_gc(lua_State *); +static int l_selection_not(lua_State *); +static int l_selection_and(lua_State *); +static int l_selection_or(lua_State *); +static int l_selection_xor(lua_State *); +static int l_selection_not(lua_State *); #if 0 /* the following do not appear to currently be used and because they are static, the OSX @@ -40,16 +40,14 @@ static int FDECL(l_selection_not, (lua_State *)); if ifdef'd out the prototype here and the function body below. */ -static int FDECL(l_selection_add, (lua_State *)); -static int FDECL(l_selection_sub, (lua_State *)); -static int FDECL(l_selection_ipairs, (lua_State *)); -static struct selectionvar *FDECL(l_selection_to, (lua_State *, int)); +static int l_selection_add(lua_State *); +static int l_selection_sub(lua_State *); +static int l_selection_ipairs(lua_State *); +static struct selectionvar *l_selection_to(lua_State *, int); #endif struct selectionvar * -l_selection_check(L, index) -lua_State *L; -int index; +l_selection_check(lua_State *L, int index) { struct selectionvar *sel; @@ -61,8 +59,7 @@ int index; } static int -l_selection_gc(L) -lua_State *L; +l_selection_gc(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -73,9 +70,7 @@ lua_State *L; #if 0 static struct selectionvar * -l_selection_to(L, index) -lua_State *L; -int index; +l_selection_to(lua_State *L, int index) { struct selectionvar *sel = (struct selectionvar *)lua_touserdata(L, index); @@ -86,8 +81,7 @@ int index; #endif static struct selectionvar * -l_selection_push(L) -lua_State *L; +l_selection_push(lua_State *L) { struct selectionvar *tmp = selection_new(); struct selectionvar @@ -106,8 +100,7 @@ lua_State *L; /* local sel = selection.new(); */ static int -l_selection_new(L) -lua_State *L; +l_selection_new(lua_State *L) { (void) l_selection_push(L); return 1; @@ -116,8 +109,7 @@ lua_State *L; /* Replace the topmost selection in the stack with a clone of it. */ /* local sel = selection.clone(sel); */ static int -l_selection_clone(L) -lua_State *L; +l_selection_clone(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); struct selectionvar *tmp; @@ -139,8 +131,7 @@ lua_State *L; /* local sel = selection.set(sel); */ /* TODO: allow setting multiple coordinates at once: set({x,y}, {x,y}, ...); */ static int -l_selection_setpoint(L) -lua_State *L; +l_selection_setpoint(lua_State *L) { struct selectionvar *sel = (struct selectionvar *) 0; xchar x = -1, y = -1; @@ -184,8 +175,7 @@ lua_State *L; /* local value = selection.get(sel, x, y); */ static int -l_selection_getpoint(L) -lua_State *L; +l_selection_getpoint(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); xchar x = (xchar) luaL_checkinteger(L, 2); @@ -209,8 +199,7 @@ lua_State *L; /* local s = selection.negate(); */ /* local s = sel:negate(); */ static int -l_selection_not(L) -lua_State *L; +l_selection_not(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel, *sel2; @@ -230,8 +219,7 @@ lua_State *L; /* local sel = selection.area(4,5, 40,10) & selection.rect(7,8, 60,14); */ static int -l_selection_and(L) -lua_State *L; +l_selection_and(lua_State *L) { int x,y; struct selectionvar *sela = l_selection_check(L, 1); @@ -251,8 +239,7 @@ lua_State *L; /* local sel = selection.area(4,5, 40,10) | selection.rect(7,8, 60,14); */ static int -l_selection_or(L) -lua_State *L; +l_selection_or(lua_State *L) { int x,y; struct selectionvar *sela = l_selection_check(L, 1); @@ -272,8 +259,7 @@ lua_State *L; /* local sel = selection.area(4,5, 40,10) ~ selection.rect(7,8, 60,14); */ static int -l_selection_xor(L) -lua_State *L; +l_selection_xor(lua_State *L) { int x,y; struct selectionvar *sela = l_selection_check(L, 1); @@ -294,8 +280,7 @@ lua_State *L; /* local s = selection.percentage(sel, 50); */ static int -l_selection_filter_percent(L) -lua_State *L; +l_selection_filter_percent(lua_State *L) { struct selectionvar *ret; int p; @@ -313,8 +298,7 @@ lua_State *L; /* local x,y = selection.rndcoord(sel); */ /* local x,y = selection.rndcoord(sel, 1); */ static int -l_selection_rndcoord(L) -lua_State *L; +l_selection_rndcoord(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); int removeit = (int) luaL_optinteger(L, 2, 0); @@ -341,10 +325,8 @@ lua_State *L; /* function(selection, x1,y1, x2,y2) */ /* selection:function(x1,y1, x2,y2) */ static boolean -params_sel_2coords(L, sel, x1,y1, x2,y2) -lua_State *L; -struct selectionvar **sel; -xchar *x1, *y1, *x2, *y2; +params_sel_2coords(lua_State *L, struct selectionvar **sel, + xchar *x1, xchar *y1, xchar *x2, xchar *y2) { int argc = lua_gettop(L); @@ -376,8 +358,7 @@ xchar *x1, *y1, *x2, *y2; /* local s = selection.line(x1,y1, x2,y2); */ /* s:line(x1,y1, x2,y2); */ static int -l_selection_line(L) -lua_State *L; +l_selection_line(lua_State *L) { struct selectionvar *sel = NULL; xchar x1, y1, x2, y2; @@ -397,8 +378,7 @@ lua_State *L; /* local s = selection.rect(sel, x1,y1, x2,y2); */ static int -l_selection_rect(L) -lua_State *L; +l_selection_rect(lua_State *L) { struct selectionvar *sel = NULL; xchar x1, y1, x2, y2; @@ -426,8 +406,7 @@ lua_State *L; /* s:fillrect(x1,y1, x2,y2); */ /* selection.area(x1,y1, x2,y2); */ static int -l_selection_fillrect(L) -lua_State *L; +l_selection_fillrect(lua_State *L) { struct selectionvar *sel = NULL; int y; @@ -459,8 +438,7 @@ lua_State *L; /* TODO: selection.randline(x1,y1, x2,y2, roughness); */ /* TODO: selection.randline({x1,y1}, {x2,y2}, roughness); */ static int -l_selection_randline(L) -lua_State *L; +l_selection_randline(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -500,8 +478,7 @@ lua_State *L; /* local s = selection.grow(sel); */ /* local s = selection.grow(sel, "north"); */ static int -l_selection_grow(L) -lua_State *L; +l_selection_grow(lua_State *L) { int argc = lua_gettop(L); const char *const growdirs[] = { "all", "random", "north", "west", "east", "south", NULL }; @@ -522,8 +499,7 @@ lua_State *L; /* local s = selection.filter_mapchar(sel, mapchar, lit); */ static int -l_selection_filter_mapchar(L) -lua_State *L; +l_selection_filter_mapchar(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = l_selection_check(L, 1); @@ -556,8 +532,7 @@ lua_State *L; /* local s = selection.match([[...]]); */ static int -l_selection_match(L) -lua_State *L; +l_selection_match(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -596,8 +571,7 @@ lua_State *L; /* local s = selection.floodfill(x,y); */ static int -l_selection_flood(L) -lua_State *L; +l_selection_flood(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -630,8 +604,7 @@ lua_State *L; /* local s = selection.circle(sel, x, y, radius); */ /* local s = selection.circle(sel, x, y, radius, filled); */ static int -l_selection_circle(L) -lua_State *L; +l_selection_circle(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -679,8 +652,7 @@ lua_State *L; /* local s = selection.ellipse(sel, x, y, radius1, radius2); */ /* local s = selection.ellipse(sel, x, y, radius1, radius2, filled); */ static int -l_selection_ellipse(L) -lua_State *L; +l_selection_ellipse(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -732,8 +704,7 @@ lua_State *L; /* selection.gradient({ type = "radial", x = 3, y = 5, x2 = 10, y2 = 12, * mindist = 4, maxdist = 10, limited = false }); */ static int -l_selection_gradient(L) -lua_State *L; +l_selection_gradient(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -747,7 +718,7 @@ lua_State *L; /* if limited is true, no points farther than maxdist will be added; if * false, all points farther than maxdist will be added */ boolean limited = FALSE; - long type; + long type = 0; static const char *const gradtypes[] = { "radial", "square", NULL }; @@ -792,8 +763,7 @@ lua_State *L; /* sel:iterate(function(x,y) ... end); */ static int -l_selection_iterate(L) -lua_State *L; +l_selection_iterate(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; @@ -857,8 +827,7 @@ static const luaL_Reg l_selection_meta[] = { }; int -l_selection_register(L) -lua_State *L; +l_selection_register(lua_State *L) { int lib_id, meta_id; diff --git a/src/nhlua.c b/src/nhlua.c index f3cea5139..43f9f4033 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -14,41 +14,39 @@ /* */ /* lua_CFunction prototypes */ -static int FDECL(nhl_test, (lua_State *)); -static int FDECL(nhl_getmap, (lua_State *)); -static void FDECL(nhl_add_table_entry_bool, (lua_State *, const char *, BOOLEAN_P)); -static char FDECL(splev_typ2chr, (SCHAR_P)); -static int FDECL(nhl_gettrap, (lua_State *)); -static int FDECL(nhl_deltrap, (lua_State *)); +static int nhl_test(lua_State *); +static int nhl_getmap(lua_State *); +static void nhl_add_table_entry_bool(lua_State *, const char *, boolean); +static char splev_typ2chr(schar); +static int nhl_gettrap(lua_State *); +static int nhl_deltrap(lua_State *); #if 0 -static int FDECL(nhl_setmap, (lua_State *)); +static int nhl_setmap(lua_State *); #endif -static int FDECL(nhl_pline, (lua_State *)); -static int FDECL(nhl_verbalize, (lua_State *)); -static int FDECL(nhl_menu, (lua_State *)); -static int FDECL(nhl_getlin, (lua_State *)); -static int FDECL(nhl_makeplural, (lua_State *)); -static int FDECL(nhl_makesingular, (lua_State *)); -static int FDECL(nhl_s_suffix, (lua_State *)); -static int FDECL(nhl_ing_suffix, (lua_State *)); -static int FDECL(nhl_an, (lua_State *)); -static int FDECL(nhl_rn2, (lua_State *)); -static int FDECL(nhl_random, (lua_State *)); -static int FDECL(nhl_level_difficulty, (lua_State *)); -static void FDECL(init_nhc_data, (lua_State *)); -static int FDECL(nhl_push_anything, (lua_State *, int, void *)); -static int FDECL(nhl_meta_u_index, (lua_State *)); -static int FDECL(nhl_meta_u_newindex, (lua_State *)); -static int FDECL(nhl_u_clear_inventory, (lua_State *)); -static int FDECL(nhl_u_giveobj, (lua_State *)); -static void FDECL(init_u_data, (lua_State *)); -static int FDECL(nhl_set_package_path, (lua_State *, const char *)); -static int FDECL(traceback_handler, (lua_State *)); +static int nhl_pline(lua_State *); +static int nhl_verbalize(lua_State *); +static int nhl_menu(lua_State *); +static int nhl_getlin(lua_State *); +static int nhl_makeplural(lua_State *); +static int nhl_makesingular(lua_State *); +static int nhl_s_suffix(lua_State *); +static int nhl_ing_suffix(lua_State *); +static int nhl_an(lua_State *); +static int nhl_rn2(lua_State *); +static int nhl_random(lua_State *); +static int nhl_level_difficulty(lua_State *); +static void init_nhc_data(lua_State *); +static int nhl_push_anything(lua_State *, int, void *); +static int nhl_meta_u_index(lua_State *); +static int nhl_meta_u_newindex(lua_State *); +static int nhl_u_clear_inventory(lua_State *); +static int nhl_u_giveobj(lua_State *); +static void init_u_data(lua_State *); +static int nhl_set_package_path(lua_State *, const char *); +static int traceback_handler(lua_State *); void -nhl_error(L, msg) -lua_State *L; -const char *msg; +nhl_error(lua_State *L, const char *msg) { lua_Debug ar; char buf[BUFSZ]; @@ -72,8 +70,7 @@ const char *msg; /* Check that parameters are nothing but single table, or if no parameters given, put empty table there */ void -lcheck_param_table(L) -lua_State *L; +lcheck_param_table(lua_State *L) { int argc = lua_gettop(L); @@ -87,9 +84,7 @@ lua_State *L; } schar -get_table_mapchr(L, name) -lua_State *L; -const char *name; +get_table_mapchr(lua_State *L, const char *name) { char *ter; xchar typ; @@ -104,10 +99,7 @@ const char *name; } schar -get_table_mapchr_opt(L, name, defval) -lua_State *L; -const char *name; -schar defval; +get_table_mapchr_opt(lua_State *L, const char *name, schar defval) { char *ter; xchar typ; @@ -125,10 +117,7 @@ schar defval; } void -nhl_add_table_entry_int(L, name, value) -lua_State *L; -const char *name; -int value; +nhl_add_table_entry_int(lua_State *L, const char *name, int value) { lua_pushstring(L, name); lua_pushinteger(L, value); @@ -136,10 +125,7 @@ int value; } void -nhl_add_table_entry_char(L, name, value) -lua_State *L; -const char *name; -char value; +nhl_add_table_entry_char(lua_State *L, const char *name, char value) { char buf[2]; Sprintf(buf, "%c", value); @@ -149,20 +135,14 @@ char value; } void -nhl_add_table_entry_str(L, name, value) -lua_State *L; -const char *name; -const char *value; +nhl_add_table_entry_str(lua_State *L, const char *name, const char *value) { lua_pushstring(L, name); lua_pushstring(L, value); lua_rawset(L, -3); } void -nhl_add_table_entry_bool(L, name, value) -lua_State *L; -const char *name; -boolean value; +nhl_add_table_entry_bool(lua_State *L, const char *name, boolean value) { lua_pushstring(L, name); lua_pushboolean(L, value); @@ -212,8 +192,7 @@ const struct { }; schar -splev_chr2typ(c) -char c; +splev_chr2typ(char c) { int i; @@ -224,8 +203,7 @@ char c; } schar -check_mapchr(s) -const char *s; +check_mapchr(const char *s) { if (s && strlen(s) == 1) return splev_chr2typ(s[0]); @@ -233,8 +211,7 @@ const char *s; } static char -splev_typ2chr(typ) -schar typ; +splev_typ2chr(schar typ) { int i; @@ -246,8 +223,7 @@ schar typ; /* local t = gettrap(x,y); */ static int -nhl_gettrap(L) -lua_State *L; +nhl_gettrap(lua_State *L) { int argc = lua_gettop(L); @@ -295,8 +271,7 @@ lua_State *L; /* deltrap(x,y); */ static int -nhl_deltrap(L) -lua_State *L; +nhl_deltrap(lua_State *L) { int argc = lua_gettop(L); @@ -316,8 +291,7 @@ lua_State *L; /* local loc = getmap(x,y) */ static int -nhl_getmap(L) -lua_State *L; +nhl_getmap(lua_State *L) { int argc = lua_gettop(L); @@ -408,8 +382,7 @@ lua_State *L; /* pline("It hits!") */ static int -nhl_pline(L) -lua_State *L; +nhl_pline(lua_State *L) { int argc = lua_gettop(L); @@ -423,8 +396,7 @@ lua_State *L; /* verbalize("Fool!") */ static int -nhl_verbalize(L) -lua_State *L; +nhl_verbalize(lua_State *L) { int argc = lua_gettop(L); @@ -440,8 +412,7 @@ lua_State *L; str = getlin("What do you want to call this dungeon level?"); */ static int -nhl_getlin(L) -lua_State *L; +nhl_getlin(lua_State *L) { int argc = lua_gettop(L); @@ -465,8 +436,7 @@ lua_State *L; selected = menu("prompt", default, pickX, { {key:"a", text:"option a"}, {key:"b", text:"option b"}, ... } ) */ static int -nhl_menu(L) -lua_State *L; +nhl_menu(lua_State *L) { static const char *const pickX[] = {"none", "one", "any"}; /* PICK_x */ int argc = lua_gettop(L); @@ -552,8 +522,7 @@ lua_State *L; /* makeplural("zorkmid") */ static int -nhl_makeplural(L) -lua_State *L; +nhl_makeplural(lua_State *L) { int argc = lua_gettop(L); @@ -567,8 +536,7 @@ lua_State *L; /* makesingular("zorkmids") */ static int -nhl_makesingular(L) -lua_State *L; +nhl_makesingular(lua_State *L) { int argc = lua_gettop(L); @@ -582,8 +550,7 @@ lua_State *L; /* s_suffix("foo") */ static int -nhl_s_suffix(L) -lua_State *L; +nhl_s_suffix(lua_State *L) { int argc = lua_gettop(L); @@ -597,8 +564,7 @@ lua_State *L; /* ing_suffix("foo") */ static int -nhl_ing_suffix(L) -lua_State *L; +nhl_ing_suffix(lua_State *L) { int argc = lua_gettop(L); @@ -612,8 +578,7 @@ lua_State *L; /* an("foo") */ static int -nhl_an(L) -lua_State *L; +nhl_an(lua_State *L) { int argc = lua_gettop(L); @@ -627,8 +592,7 @@ lua_State *L; /* rn2(10) */ static int -nhl_rn2(L) -lua_State *L; +nhl_rn2(lua_State *L) { int argc = lua_gettop(L); @@ -643,8 +607,7 @@ lua_State *L; /* random(10); -- is the same as rn2(10); */ /* random(5,8); -- same as 5 + rn2(8); */ static int -nhl_random(L) -lua_State *L; +nhl_random(lua_State *L) { int argc = lua_gettop(L); @@ -660,8 +623,7 @@ lua_State *L; /* level_difficulty() */ static int -nhl_level_difficulty(L) -lua_State *L; +nhl_level_difficulty(lua_State *L) { int argc = lua_gettop(L); if (argc == 0) { @@ -675,9 +637,7 @@ lua_State *L; /* get mandatory integer value from table */ int -get_table_int(L, name) -lua_State *L; -const char *name; +get_table_int(lua_State *L, const char *name) { int ret; @@ -689,10 +649,7 @@ const char *name; /* get optional integer value from table */ int -get_table_int_opt(L, name, defval) -lua_State *L; -const char *name; -int defval; +get_table_int_opt(lua_State *L, const char *name, int defval) { int ret = defval; @@ -705,9 +662,7 @@ int defval; } char * -get_table_str(L, name) -lua_State *L; -const char *name; +get_table_str(lua_State *L, const char *name) { char *ret; @@ -720,10 +675,7 @@ const char *name; /* get optional string value from table. return value must be freed by caller. */ char * -get_table_str_opt(L, name, defval) -lua_State *L; -const char *name; -char *defval; +get_table_str_opt(lua_State *L, const char *name, char *defval) { const char *ret; @@ -738,9 +690,7 @@ char *defval; } int -get_table_boolean(L, name) -lua_State *L; -const char *name; +get_table_boolean(lua_State *L, const char *name) { static const char *const boolstr[] = { "true", "false", "yes", "no", NULL @@ -768,10 +718,7 @@ const char *name; } int -get_table_boolean_opt(L, name, defval) -lua_State *L; -const char *name; -int defval; +get_table_boolean_opt(lua_State *L, const char *name, int defval) { int ret = defval; @@ -784,12 +731,12 @@ int defval; return ret; } +/* opts[] is a null-terminated list */ int -get_table_option(L, name, defval, opts) -lua_State *L; -const char *name; -const char *defval; -const char *const opts[]; /* NULL-terminated list */ +get_table_option(lua_State *L, + const char *name, + const char *defval, + const char *const opts[]) { int ret; @@ -803,8 +750,7 @@ const char *const opts[]; /* NULL-terminated list */ test( { x = 123, y = 456 } ); */ static int -nhl_test(L) -lua_State *L; +nhl_test(lua_State *L) { int x, y; char *name, Player[] = "Player"; @@ -862,8 +808,7 @@ static const struct { /* register and init the constants table */ static void -init_nhc_data(L) -lua_State *L; +init_nhc_data(lua_State *L) { int i; @@ -879,10 +824,7 @@ lua_State *L; } static int -nhl_push_anything(L, anytype, src) -lua_State *L; -int anytype; -void *src; +nhl_push_anything(lua_State *L, int anytype, void *src) { anything any = cg.zeroany; @@ -901,8 +843,7 @@ void *src; } static int -nhl_meta_u_index(L) -lua_State *L; +nhl_meta_u_index(lua_State *L) { static const struct { const char *name; @@ -956,16 +897,14 @@ lua_State *L; } static int -nhl_meta_u_newindex(L) -lua_State *L; +nhl_meta_u_newindex(lua_State *L) { nhl_error(L, "Cannot set u table values"); return 0; } static int -nhl_u_clear_inventory(L) -lua_State *L UNUSED; +nhl_u_clear_inventory(lua_State *L UNUSED) { while (g.invent) useupall(g.invent); @@ -975,8 +914,7 @@ lua_State *L UNUSED; /* Put object into player's inventory */ /* u.giveobj(obj.new("rock")); */ static int -nhl_u_giveobj(L) -lua_State *L; +nhl_u_giveobj(lua_State *L) { return nhl_obj_u_giveobj(L); } @@ -988,8 +926,7 @@ static const struct luaL_Reg nhl_u_functions[] = { }; static void -init_u_data(L) -lua_State *L; +init_u_data(lua_State *L) { lua_newtable(L); luaL_setfuncs(L, nhl_u_functions, 0); @@ -1003,9 +940,7 @@ lua_State *L; } static int -nhl_set_package_path(L, path) -lua_State *L; -const char *path; +nhl_set_package_path(lua_State *L, const char *path) { lua_getglobal(L, "package"); lua_pushstring(L, path); @@ -1015,8 +950,7 @@ const char *path; } static int -traceback_handler(L) -lua_State *L; +traceback_handler(lua_State *L) { luaL_traceback(L, L, lua_tostring(L, 1), 0); /* TODO: call impossible() if fuzzing? */ @@ -1026,9 +960,7 @@ lua_State *L; /* read lua code/data from a dlb module or an external file into a string buffer and feed that to lua */ boolean -nhl_loadlua(L, fname) -lua_State *L; -const char *fname; +nhl_loadlua(lua_State *L, const char *fname) { #define LOADCHUNKSIZE (1L << 13) /* 8K */ boolean ret = TRUE; @@ -1138,7 +1070,7 @@ const char *fname; } lua_State * -nhl_init() +nhl_init(void) { lua_State *L = luaL_newstate(); @@ -1170,8 +1102,7 @@ nhl_init() } boolean -load_lua(name) -const char *name; +load_lua(const char *name) { boolean ret = TRUE; lua_State *L = nhl_init(); @@ -1193,7 +1124,7 @@ const char *name; } const char * -get_lua_version() +get_lua_version(void) { size_t len = (size_t) 0; const char *vs = (const char *) 0; diff --git a/src/o_init.c b/src/o_init.c index b86c749a4..a920e05f5 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -5,16 +5,15 @@ #include "hack.h" -static void FDECL(setgemprobs, (d_level *)); -static void FDECL(shuffle, (int, int, BOOLEAN_P)); -static void NDECL(shuffle_all); -static boolean FDECL(interesting_to_discover, (int)); -static int FDECL(CFDECLSPEC discovered_cmp, (const genericptr, - const genericptr)); -static char *FDECL(oclass_to_name, (CHAR_P, char *)); +static void setgemprobs(d_level *); +static void shuffle(int, int, boolean); +static void shuffle_all(void); +static boolean interesting_to_discover(int); +static int CFDECLSPEC discovered_cmp(const genericptr, const genericptr); +static char *oclass_to_name(char, char *); #ifdef USE_TILES -static void NDECL(shuffle_tiles); +static void shuffle_tiles(void); extern short glyph2tile[]; /* from tile.c */ /* Shuffle tile assignments to match descriptions, so a red potion isn't @@ -27,7 +26,7 @@ extern short glyph2tile[]; /* from tile.c */ * another routine. */ static void -shuffle_tiles() +shuffle_tiles(void) { int i; short tmp_tilemap[NUM_OBJECTS]; @@ -41,8 +40,7 @@ shuffle_tiles() #endif /* USE_TILES */ static void -setgemprobs(dlev) -d_level *dlev; +setgemprobs(d_level* dlev) { int j, first, lev; @@ -68,9 +66,7 @@ d_level *dlev; /* shuffle descriptions on objects o_low to o_high */ static void -shuffle(o_low, o_high, domaterial) -int o_low, o_high; -boolean domaterial; +shuffle(int o_low, int o_high, boolean domaterial) { int i, j, num_to_shuffle; short sw; @@ -108,7 +104,7 @@ boolean domaterial; } void -init_objects() +init_objects(void) { int i, first, last, sum, prevoclass; char oclass; @@ -205,9 +201,9 @@ init_objects() /* retrieve the range of objects that otyp shares descriptions with */ void -obj_shuffle_range(otyp, lo_p, hi_p) -int otyp; /* input: representative item */ -int *lo_p, *hi_p; /* output: range that item belongs among */ +obj_shuffle_range( + int otyp, /* input: representative item */ + int *lo_p, int *hi_p) /* output: range that item belongs among */ { int i, ocls = objects[otyp].oc_class; @@ -258,7 +254,7 @@ int *lo_p, *hi_p; /* output: range that item belongs among */ /* randomize object descriptions */ static void -shuffle_all() +shuffle_all(void) { /* entire classes; obj_shuffle_range() handles their exceptions */ static char shuffle_classes[] = { @@ -287,9 +283,7 @@ shuffle_all() /* Return TRUE if the provided string matches the unidentified description of * the provided object. */ boolean -objdescr_is(obj, descr) -struct obj *obj; -const char *descr; +objdescr_is(struct obj* obj, const char * descr) { const char *objdescr; @@ -306,7 +300,7 @@ const char *descr; /* find the object index for snow boots; used [once] by slippery ice code */ int -find_skates() +find_skates(void) { register int i; register const char *s; @@ -321,14 +315,13 @@ find_skates() /* level dependent initialization */ void -oinit() +oinit(void) { setgemprobs(&u.uz); } void -savenames(nhfp) -NHFILE *nhfp; +savenames(NHFILE* nhfp) { int i; unsigned int len; @@ -361,8 +354,7 @@ NHFILE *nhfp; } void -restnames(nhfp) -NHFILE *nhfp; +restnames(NHFILE* nhfp) { int i; unsigned int len = 0; @@ -390,10 +382,7 @@ NHFILE *nhfp; } void -discover_object(oindx, mark_as_known, credit_hero) -register int oindx; -boolean mark_as_known; -boolean credit_hero; +discover_object(int oindx, boolean mark_as_known, boolean credit_hero) { if (!objects[oindx].oc_name_known) { register int dindx, acls = objects[oindx].oc_class; @@ -423,8 +412,7 @@ boolean credit_hero; /* if a class name has been cleared, we may need to purge it from disco[] */ void -undiscover_object(oindx) -register int oindx; +undiscover_object(int oindx) { if (!objects[oindx].oc_name_known) { register int dindx, acls = objects[oindx].oc_class; @@ -452,8 +440,7 @@ register int oindx; } static boolean -interesting_to_discover(i) -register int i; +interesting_to_discover(int i) { /* Pre-discovered objects are now printed with a '*' */ return (boolean) (objects[i].oc_uname != (char *) 0 @@ -469,9 +456,7 @@ static const short uniq_objs[] = { /* discoveries qsort comparison function */ static int CFDECLSPEC -discovered_cmp(v1, v2) -const genericptr v1; -const genericptr v2; +discovered_cmp(const genericptr v1, const genericptr v2) { const char *s1 = *(const char **) v1; const char *s2 = *(const char **) v2; @@ -485,9 +470,7 @@ const genericptr v2; } static char * -sortloot_descr(otyp, outbuf) -int otyp; -char *outbuf; +sortloot_descr(int otyp,char * outbuf) { Loot sl_cookie; struct obj o; @@ -528,8 +511,8 @@ const char *const disco_orders_descr[] = { }; int -choose_disco_sort(mode) -int mode; /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */ +choose_disco_sort( + int mode) /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */ { winid tmpwin; menu_item *selected; @@ -582,7 +565,7 @@ int mode; /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */ /* the '\' command - show discovered object types */ int -dodiscovered() /* free after Robert Viduya */ +dodiscovered(void) /* free after Robert Viduya */ { winid tmpwin; char *s, *p, oclass, prev_class, @@ -701,9 +684,7 @@ dodiscovered() /* free after Robert Viduya */ /* lower case let_to_name() output, which differs from def_oc_syms[].name */ static char * -oclass_to_name(oclass, buf) -char oclass; -char *buf; +oclass_to_name(char oclass, char *buf) { char *s; @@ -715,7 +696,7 @@ char *buf; /* the '`' command - show discovered object types for one class */ int -doclassdisco() +doclassdisco(void) { static NEARDATA const char prompt[] = "View discoveries for which sort of objects?", @@ -916,7 +897,7 @@ doclassdisco() /* put up nameable subset of discoveries list as a menu */ void -rename_disco() +rename_disco(void) { register int i, dis; int ct = 0, mn = 0, sl; diff --git a/src/objects.c b/src/objects.c index 782e8019f..69db12689 100644 --- a/src/objects.c +++ b/src/objects.c @@ -1175,13 +1175,13 @@ OBJECT(OBJ(None, None), /* clang-format on */ /* *INDENT-ON* */ -void NDECL(objects_globals_init); /* in hack.h but we're using config.h */ +void objects_globals_init(void); /* in hack.h but we're using config.h */ struct objdescr obj_descr[SIZE(obj_descr_init)]; struct objclass objects[SIZE(obj_init)]; void -objects_globals_init() +objects_globals_init(void) { memcpy(obj_descr, obj_descr_init, sizeof(obj_descr)); memcpy(objects, obj_init, sizeof(objects)); diff --git a/src/objnam.c b/src/objnam.c index 2330fa4dc..4ac4149c1 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -30,27 +30,27 @@ struct _readobjnam_data { struct obj *otmp; }; -static char *FDECL(strprepend, (char *, const char *)); -static char *NDECL(nextobuf); -static void FDECL(releaseobuf, (char *)); -static char *FDECL(xname_flags, (struct obj *, unsigned)); -static char *FDECL(minimal_xname, (struct obj *)); -static void FDECL(add_erosion_words, (struct obj *, char *)); -static char *FDECL(doname_base, (struct obj *obj, unsigned)); -static boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P, - const char *const *)); -static char *FDECL(singplur_compound, (char *)); -static boolean FDECL(badman, (const char *, BOOLEAN_P)); -static boolean FDECL(wishymatch, (const char *, const char *, BOOLEAN_P)); -static short FDECL(rnd_otyp_by_wpnskill, (SCHAR_P)); -static short FDECL(rnd_otyp_by_namedesc, (const char *, CHAR_P, int)); -static struct obj *FDECL(wizterrainwish, (char *, char *, int, int)); -static void FDECL(readobjnam_init, (char *, struct _readobjnam_data *)); -static int FDECL(readobjnam_preparse, (struct _readobjnam_data *)); -static void FDECL(readobjnam_parse_charges, (struct _readobjnam_data *)); -static int FDECL(readobjnam_postparse1, (struct _readobjnam_data *)); -static int FDECL(readobjnam_postparse2, (struct _readobjnam_data *)); -static int FDECL(readobjnam_postparse3, (struct _readobjnam_data *)); +static char *strprepend(char *, const char *); +static char *nextobuf(void); +static void releaseobuf(char *); +static char *xname_flags(struct obj *, unsigned); +static char *minimal_xname(struct obj *); +static void add_erosion_words(struct obj *, char *); +static char *doname_base(struct obj *obj, unsigned); +static boolean singplur_lookup(char *, char *, boolean, + const char *const *); +static char *singplur_compound(char *); +static boolean badman(const char *, boolean); +static boolean wishymatch(const char *, const char *, boolean); +static short rnd_otyp_by_wpnskill(schar); +static short rnd_otyp_by_namedesc(const char *, char, int); +static struct obj *wizterrainwish(char *, char *, int, int); +static void readobjnam_init(char *, struct _readobjnam_data *); +static int readobjnam_preparse(struct _readobjnam_data *); +static void readobjnam_parse_charges(struct _readobjnam_data *); +static int readobjnam_postparse1(struct _readobjnam_data *); +static int readobjnam_postparse2(struct _readobjnam_data *); +static int readobjnam_postparse3(struct _readobjnam_data *); struct Jitem { int item; @@ -84,12 +84,10 @@ static struct Jitem Japanese_items[] = { { SHORT_SWORD, "wakizashi" }, { POT_BOOZE, "sake" }, { 0, "" } }; -static const char *FDECL(Japanese_item_name, (int i)); +static const char *Japanese_item_name(int i); static char * -strprepend(s, pref) -register char *s; -register const char *pref; +strprepend(char *s,const char * pref) { register int i = (int) strlen(pref); @@ -107,7 +105,7 @@ static char NEARDATA obufs[NUMOBUF][BUFSZ]; static int obufidx = 0; static char * -nextobuf() +nextobuf(void) { obufidx = (obufidx + 1) % NUMOBUF; return obufs[obufidx]; @@ -115,8 +113,7 @@ nextobuf() /* put the most recently allocated buffer back if possible */ static void -releaseobuf(bufp) -char *bufp; +releaseobuf(char *bufp) { /* caller may not know whether bufp is the most recently allocated buffer; if it isn't, do nothing; note that because of the somewhat @@ -129,8 +126,7 @@ char *bufp; } char * -obj_typename(otyp) -register int otyp; +obj_typename(int otyp) { char *buf = nextobuf(); struct objclass *ocl = &objects[otyp]; @@ -211,8 +207,7 @@ register int otyp; /* less verbose result than obj_typename(); either the actual name or the description (but not both); user-assigned name is ignored */ char * -simple_typename(otyp) -int otyp; +simple_typename(int otyp) { char *bufp, *pp, *save_uname = objects[otyp].oc_uname; @@ -226,8 +221,7 @@ int otyp; /* typename for debugging feedback where data involved might be suspect */ char * -safe_typename(otyp) -int otyp; +safe_typename(int otyp) { unsigned save_nameknown; char *res = 0; @@ -247,8 +241,7 @@ int otyp; } boolean -obj_is_pname(obj) -struct obj *obj; +obj_is_pname(struct obj* obj) { if (!obj->oartifact || !has_oname(obj)) return FALSE; @@ -263,9 +256,7 @@ struct obj *obj; * we don't want to set dknown if it's not set already. */ char * -distant_name(obj, func) -struct obj *obj; -char *FDECL((*func), (OBJ_P)); +distant_name(struct obj* obj, char* (*func)(OBJ_P)) { char *str; @@ -286,8 +277,8 @@ char *FDECL((*func), (OBJ_P)); /* convert player specified fruit name into corresponding fruit juice name ("slice of pizza" -> "pizza juice" rather than "slice of pizza juice") */ char * -fruitname(juice) -boolean juice; /* whether or not to append " juice" to the name */ +fruitname( + boolean juice) /* whether or not to append " juice" to the name */ { char *buf = nextobuf(); const char *fruit_nam = strstri(g.pl_fruit, " of "); @@ -303,8 +294,7 @@ boolean juice; /* whether or not to append " juice" to the name */ /* look up a named fruit by index (1..127) */ struct fruit * -fruit_from_indx(indx) -int indx; +fruit_from_indx(int indx) { struct fruit *f; @@ -316,10 +306,10 @@ int indx; /* look up a named fruit by name */ struct fruit * -fruit_from_name(fname, exact, highest_fid) -const char *fname; -boolean exact; /* False => prefix or exact match, True = exact match only */ -int *highest_fid; /* optional output; only valid if 'fname' isn't found */ +fruit_from_name( + const char *fname, + boolean exact, /* False => prefix or exact match, True = exact match only */ + int *highest_fid) /* optional output; only valid if 'fname' isn't found */ { struct fruit *f, *tentativef; char *altfname; @@ -396,8 +386,7 @@ int *highest_fid; /* optional output; only valid if 'fname' isn't found */ /* sort the named-fruit linked list by fruit index number */ void -reorder_fruit(forward) -boolean forward; +reorder_fruit(boolean forward) { struct fruit *f, *allfr[1 + 127]; int i, j, k = SIZE(allfr); @@ -431,16 +420,15 @@ boolean forward; } char * -xname(obj) -struct obj *obj; +xname(struct obj* obj) { return xname_flags(obj, CXN_NORMAL); } static char * -xname_flags(obj, cxn_flags) -register struct obj *obj; -unsigned cxn_flags; /* bitmask of CXN_xxx values */ +xname_flags( + register struct obj *obj, + unsigned cxn_flags) /* bitmask of CXN_xxx values */ { register char *buf; register int typ = obj->otyp; @@ -787,8 +775,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ potion of object detection -- if discovered */ static char * -minimal_xname(obj) -struct obj *obj; +minimal_xname(struct obj* obj) { char *bufp; struct obj bareobj; @@ -832,8 +819,7 @@ struct obj *obj; /* xname() output augmented for multishot missile feedback */ char * -mshot_xname(obj) -struct obj *obj; +mshot_xname(struct obj* obj) { char tmpbuf[BUFSZ]; char *onm = xname(obj); @@ -849,8 +835,7 @@ struct obj *obj; /* used for naming "the unique_item" instead of "a unique_item" */ boolean -the_unique_obj(obj) -struct obj *obj; +the_unique_obj(struct obj* obj) { boolean known = (obj->known || iflags.override_ID); @@ -865,8 +850,7 @@ struct obj *obj; /* should monster type be prefixed with "the"? (mostly used for corpses) */ boolean -the_unique_pm(ptr) -struct permonst *ptr; +the_unique_pm(struct permonst* ptr) { boolean uniq; @@ -888,9 +872,7 @@ struct permonst *ptr; } static void -add_erosion_words(obj, prefix) -struct obj *obj; -char *prefix; +add_erosion_words(struct obj* obj, char* prefix) { boolean iscrys = (obj->otyp == CRYSKNIFE); boolean rknown; @@ -939,8 +921,7 @@ char *prefix; /* used to prevent rust on items where rust makes no difference */ boolean -erosion_matters(obj) -struct obj *obj; +erosion_matters(struct obj* obj) { switch (obj->oclass) { case TOOL_CLASS: @@ -966,9 +947,7 @@ struct obj *obj; #define DONAME_VAGUE_QUAN 2 static char * -doname_base(obj, doname_flags) -struct obj *obj; -unsigned doname_flags; +doname_base(struct obj* obj, unsigned int doname_flags) { boolean ispoisoned = FALSE, with_price = (doname_flags & DONAME_WITH_PRICE) != 0, @@ -1340,24 +1319,21 @@ unsigned doname_flags; } char * -doname(obj) -struct obj *obj; +doname(struct obj* obj) { return doname_base(obj, (unsigned) 0); } /* Name of object including price. */ char * -doname_with_price(obj) -struct obj *obj; +doname_with_price(struct obj* obj) { return doname_base(obj, DONAME_WITH_PRICE); } /* "some" instead of precise quantity if obj->dknown not set */ char * -doname_vague_quan(obj) -struct obj *obj; +doname_vague_quan(struct obj* obj) { /* Used by farlook. * If it hasn't been seen up close and quantity is more than one, @@ -1376,8 +1352,7 @@ struct obj *obj; /* used from invent.c */ boolean -not_fully_identified(otmp) -struct obj *otmp; +not_fully_identified(struct obj* otmp) { /* gold doesn't have any interesting attributes [yet?] */ if (otmp->oclass == COIN_CLASS) @@ -1415,10 +1390,10 @@ struct obj *otmp; /* format a corpse name (xname() omits monster type; doname() calls us); eatcorpse() also uses us for death reason when eating tainted glob */ char * -corpse_xname(otmp, adjective, cxn_flags) -struct obj *otmp; -const char *adjective; -unsigned cxn_flags; /* bitmask of CXN_xxx values */ +corpse_xname( + struct obj *otmp, + const char *adjective, + unsigned cxn_flags) /* bitmask of CXN_xxx values */ { /* some callers [aobjnam()] rely on prefix area that xname() sets aside */ char *nambuf = nextobuf() + PREFIX; @@ -1510,8 +1485,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ /* xname doesn't include monster type for "corpse"; cxname does */ char * -cxname(obj) -struct obj *obj; +cxname(struct obj* obj) { if (obj->otyp == CORPSE) return corpse_xname(obj, (const char *) 0, CXN_NORMAL); @@ -1520,8 +1494,7 @@ struct obj *obj; /* like cxname, but ignores quantity */ char * -cxname_singular(obj) -struct obj *obj; +cxname_singular(struct obj* obj) { if (obj->otyp == CORPSE) return corpse_xname(obj, (const char *) 0, CXN_SINGULAR); @@ -1530,8 +1503,7 @@ struct obj *obj; /* treat an object as fully ID'd when it might be used as reason for death */ char * -killer_xname(obj) -struct obj *obj; +killer_xname(struct obj* obj) { struct obj save_obj; unsigned save_ocknown; @@ -1597,11 +1569,11 @@ struct obj *obj; /* xname,doname,&c with long results reformatted to omit some stuff */ char * -short_oname(obj, func, altfunc, lenlimit) -struct obj *obj; -char *FDECL((*func), (OBJ_P)), /* main formatting routine */ - *FDECL((*altfunc), (OBJ_P)); /* alternate for shortest result */ -unsigned lenlimit; +short_oname( + struct obj *obj, + char *(*func)(OBJ_P), /* main formatting routine */ + char *(*altfunc)(OBJ_P), /* alternate for shortest result */ + unsigned lenlimit) { struct obj save_obj; char unamebuf[12], onamebuf[12], *save_oname, *save_uname, *outbuf; @@ -1679,9 +1651,7 @@ unsigned lenlimit; * Used if only one of a collection of objects is named (e.g. in eat.c). */ const char * -singular(otmp, func) -register struct obj *otmp; -char *FDECL((*func), (OBJ_P)); +singular(struct obj* otmp, char* (*func)(OBJ_P)) { long savequan; char *nam; @@ -1699,9 +1669,7 @@ char *FDECL((*func), (OBJ_P)); /* pick "", "a ", or "an " as article for 'str'; used by an() and doname() */ char * -just_an(outbuf, str) -char *outbuf; -const char *str; +just_an(char *outbuf, const char *str) { char c0; @@ -1726,8 +1694,7 @@ const char *str; } char * -an(str) -const char *str; +an(const char* str) { char *buf = nextobuf(); @@ -1740,8 +1707,7 @@ const char *str; } char * -An(str) -const char *str; +An(const char* str) { char *tmp = an(str); @@ -1754,8 +1720,7 @@ const char *str; * Use type_is_pname() for monster names, not the(). the() is idempotent. */ char * -the(str) -const char *str; +the(const char* str) { char *buf = nextobuf(); boolean insert_the = FALSE; @@ -1810,8 +1775,7 @@ const char *str; } char * -The(str) -const char *str; +The(const char* str) { char *tmp = the(str); @@ -1821,9 +1785,7 @@ const char *str; /* returns "count cxname(otmp)" or just cxname(otmp) if count == 1 */ char * -aobjnam(otmp, verb) -struct obj *otmp; -const char *verb; +aobjnam(struct obj* otmp, const char* verb) { char prefix[PREFIX]; char *bp = cxname(otmp); @@ -1841,9 +1803,7 @@ const char *verb; /* combine yname and aobjnam eg "your count cxname(otmp)" */ char * -yobjnam(obj, verb) -struct obj *obj; -const char *verb; +yobjnam(struct obj* obj, const char *verb) { char *s = aobjnam(obj, verb); @@ -1861,9 +1821,7 @@ const char *verb; /* combine Yname2 and aobjnam eg "Your count cxname(otmp)" */ char * -Yobjnam2(obj, verb) -struct obj *obj; -const char *verb; +Yobjnam2(struct obj* obj, const char *verb) { register char *s = yobjnam(obj, verb); @@ -1873,9 +1831,7 @@ const char *verb; /* like aobjnam, but prepend "The", not count, and use xname */ char * -Tobjnam(otmp, verb) -struct obj *otmp; -const char *verb; +Tobjnam(struct obj* otmp, const char *verb) { char *bp = The(xname(otmp)); @@ -1888,8 +1844,7 @@ const char *verb; /* capitalized variant of doname() */ char * -Doname2(obj) -struct obj *obj; +Doname2(struct obj* obj) { char *s = doname(obj); @@ -1900,8 +1855,7 @@ struct obj *obj; #if 0 /* stalled-out work in progress */ /* Doname2() for itemized buying of 'obj' from a shop */ char * -payDoname(obj) -struct obj *obj; +payDoname(struct obj* obj) { static const char and_contents[] = " and its contents"; char *p = doname(obj); @@ -1923,8 +1877,7 @@ struct obj *obj; /* returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */ char * -yname(obj) -struct obj *obj; +yname(struct obj* obj) { char *s = cxname(obj); @@ -1943,8 +1896,7 @@ struct obj *obj; /* capitalized variant of yname() */ char * -Yname2(obj) -struct obj *obj; +Yname2(struct obj* obj) { char *s = yname(obj); @@ -1957,8 +1909,7 @@ struct obj *obj; * or "the minimal_xname(obj)" */ char * -ysimple_name(obj) -struct obj *obj; +ysimple_name(struct obj* obj) { char *outbuf = nextobuf(); char *s = shk_your(outbuf, obj); /* assert( s == outbuf ); */ @@ -1969,8 +1920,7 @@ struct obj *obj; /* capitalized variant of ysimple_name() */ char * -Ysimple_name2(obj) -struct obj *obj; +Ysimple_name2(struct obj* obj) { char *s = ysimple_name(obj); @@ -1980,8 +1930,7 @@ struct obj *obj; /* "scroll" or "scrolls" */ char * -simpleonames(obj) -struct obj *obj; +simpleonames(struct obj* obj) { char *simpleoname = minimal_xname(obj); @@ -1992,8 +1941,7 @@ struct obj *obj; /* "a scroll" or "scrolls"; "a silver bell" or "the Bell of Opening" */ char * -ansimpleoname(obj) -struct obj *obj; +ansimpleoname(struct obj* obj) { char *simpleoname = simpleonames(obj); int otyp = obj->otyp; @@ -2015,8 +1963,7 @@ struct obj *obj; /* "the scroll" or "the scrolls" */ char * -thesimpleoname(obj) -struct obj *obj; +thesimpleoname(struct obj* obj) { char *simpleoname = simpleonames(obj); @@ -2025,8 +1972,7 @@ struct obj *obj; /* artifact's name without any object type or known/dknown/&c feedback */ char * -bare_artifactname(obj) -struct obj *obj; +bare_artifactname(struct obj* obj) { char *outbuf; @@ -2055,9 +2001,7 @@ static const char wrpsym[] = { WAND_CLASS, RING_CLASS, POTION_CLASS, /* return form of the verb (input plural) if xname(otmp) were the subject */ char * -otense(otmp, verb) -struct obj *otmp; -const char *verb; +otense(struct obj* otmp,const char * verb) { char *buf; @@ -2089,9 +2033,7 @@ static const char *const special_subjs[] = { /* return form of the verb (input plural) for present tense 3rd person subj */ char * -vtense(subj, verb) -register const char *subj; -register const char *verb; +vtense(const char* subj, const char* verb) { char *buf = nextobuf(), *bspot; int len, ltmp; @@ -2234,10 +2176,10 @@ static const char *const as_is[] = { /* singularize/pluralize decisions common to both makesingular & makeplural */ static boolean -singplur_lookup(basestr, endstring, to_plural, alt_as_is) -char *basestr, *endstring; /* base string, pointer to eos(string) */ -boolean to_plural; /* true => makeplural, false => makesingular */ -const char *const *alt_as_is; /* another set like as_is[] */ +singplur_lookup( +char *basestr, char *endstring, /* base string, pointer to eos(string) */ +boolean to_plural, /* true => makeplural, false => makesingular */ +const char *const *alt_as_is) /* another set like as_is[] */ { const struct sing_plur *sp; const char *same, *other, *const *as; @@ -2309,8 +2251,7 @@ const char *const *alt_as_is; /* another set like as_is[] */ /* searches for common compounds, ex. lump of royal jelly */ static char * -singplur_compound(str) -char *str; +singplur_compound(char *str) { /* if new entries are added, be sure to keep compound_start[] in sync */ static const char *const compounds[] = @@ -2362,8 +2303,7 @@ char *str; * 3.6.0: made case-insensitive. */ char * -makeplural(oldstr) -const char *oldstr; +makeplural(const char* oldstr) { register char *spot; char lo_c, *str = nextobuf(); @@ -2561,8 +2501,7 @@ const char *oldstr; * 3.6.0: made case-insensitive. */ char * -makesingular(oldstr) -const char *oldstr; +makesingular(const char* oldstr) { register char *p, *bp; const char *excess = 0; @@ -2691,9 +2630,9 @@ const char *oldstr; } static boolean -badman(basestr, to_plural) -const char *basestr; -boolean to_plural; /* true => makeplural, false => makesingular */ +badman( + const char *basestr, + boolean to_plural) /* true => makeplural, false => makesingular */ { /* these are all the prefixes for *man that don't have a *men plural */ static const char *no_men[] = { @@ -2740,10 +2679,10 @@ boolean to_plural; /* true => makeplural, false => makesingular */ /* compare user string against object name string using fuzzy matching */ static boolean -wishymatch(u_str, o_str, retry_inverted) -const char *u_str; /* from user, so might be variant spelling */ -const char *o_str; /* from objects[], so is in canonical form */ -boolean retry_inverted; /* optional extra "of" handling */ +wishymatch( + const char *u_str, /* from user, so might be variant spelling */ + const char *o_str, /* from objects[], so is in canonical form */ + boolean retry_inverted) /* optional extra "of" handling */ { static NEARDATA const char detect_SP[] = "detect ", SP_detection[] = " detection"; @@ -2922,8 +2861,7 @@ static const struct alt_spellings { }; static short -rnd_otyp_by_wpnskill(skill) -schar skill; +rnd_otyp_by_wpnskill(schar skill) { int i, n = 0; short otyp = STRANGE_OBJECT; @@ -2946,10 +2884,10 @@ schar skill; } static short -rnd_otyp_by_namedesc(name, oclass, xtra_prob) -const char *name; -char oclass; -int xtra_prob; /* to force 0% random generation items to also be considered */ +rnd_otyp_by_namedesc( + const char *name, + char oclass, + int xtra_prob) /* to force 0% random generation items to also be considered */ { int i, n = 0; short validobjs[NUM_OBJECTS]; @@ -3022,17 +2960,14 @@ int xtra_prob; /* to force 0% random generation items to also be considered */ } int -shiny_obj(oclass) -char oclass; +shiny_obj(char oclass) { return (int) rnd_otyp_by_namedesc("shiny", oclass, 0); } /* in wizard mode, readobjnam() can accept wishes for traps and terrain */ static struct obj * -wizterrainwish(bp, p, locked, trapped) -char *bp, *p; -int locked, trapped; +wizterrainwish(char* bp, char* p, int locked, int trapped) { struct rm *lev; boolean madeterrain = FALSE, badterrain = FALSE, didblock; @@ -3260,9 +3195,7 @@ int locked, trapped; #define SPINACH 2 static void -readobjnam_init(bp, d) -char *bp; -struct _readobjnam_data *d; +readobjnam_init(char* bp, struct _readobjnam_data* d) { d->cnt = d->spe = d->spesgn = d->typ = 0; d->very = d->rechrg = d->blessed = d->uncursed = d->iscursed @@ -3286,8 +3219,7 @@ struct _readobjnam_data *d; } static int -readobjnam_preparse(d) -struct _readobjnam_data *d; +readobjnam_preparse(struct _readobjnam_data* d) { for (;;) { register int l; @@ -3428,8 +3360,7 @@ struct _readobjnam_data *d; } static void -readobjnam_parse_charges(d) -struct _readobjnam_data *d; +readobjnam_parse_charges(struct _readobjnam_data* d) { if (strlen(d->bp) > 1 && (d->p = rindex(d->bp, '(')) != 0) { boolean keeptrailingchars = TRUE; @@ -3491,8 +3422,7 @@ struct _readobjnam_data *d; } static int -readobjnam_postparse1(d) -struct _readobjnam_data *d; +readobjnam_postparse1(struct _readobjnam_data* d) { int i; @@ -3861,8 +3791,7 @@ struct _readobjnam_data *d; } static int -readobjnam_postparse2(d) -struct _readobjnam_data *d; +readobjnam_postparse2(struct _readobjnam_data* d) { int i; @@ -3921,8 +3850,7 @@ struct _readobjnam_data *d; } static int -readobjnam_postparse3(d) -struct _readobjnam_data *d; +readobjnam_postparse3(struct _readobjnam_data* d) { int i; @@ -4087,9 +4015,7 @@ struct _readobjnam_data *d; * return null. */ struct obj * -readobjnam(bp, no_wish) -register char *bp; -struct obj *no_wish; +readobjnam(char* bp, struct obj* no_wish) { struct _readobjnam_data d; @@ -4518,8 +4444,7 @@ struct obj *no_wish; } int -rnd_class(first, last) -int first, last; +rnd_class(int first, int last) { int i, x, sum = 0; @@ -4538,8 +4463,7 @@ int first, last; } static const char * -Japanese_item_name(i) -int i; +Japanese_item_name(int i) { struct Jitem *j = Japanese_items; @@ -4552,8 +4476,7 @@ int i; } const char * -suit_simple_name(suit) -struct obj *suit; +suit_simple_name(struct obj* suit) { const char *suitnm, *esuitp; @@ -4574,8 +4497,7 @@ struct obj *suit; } const char * -cloak_simple_name(cloak) -struct obj *cloak; +cloak_simple_name(struct obj* cloak) { if (cloak) { switch (cloak->otyp) { @@ -4596,8 +4518,7 @@ struct obj *cloak; /* helm vs hat for messages */ const char * -helm_simple_name(helmet) -struct obj *helmet; +helm_simple_name(struct obj* helmet) { /* * There is some wiggle room here; the result has been chosen @@ -4616,8 +4537,7 @@ struct obj *helmet; /* gloves vs gauntlets; depends upon discovery state */ const char * -gloves_simple_name(gloves) -struct obj *gloves; +gloves_simple_name(struct obj* gloves) { static const char gauntlets[] = "gauntlets"; @@ -4636,8 +4556,7 @@ struct obj *gloves; /* boots vs shoes; depends upon discovery state */ const char * -boots_simple_name(boots) -struct obj *boots; +boots_simple_name(struct obj* boots) { static const char shoes[] = "shoes"; @@ -4656,8 +4575,7 @@ struct obj *boots; /* simplified shield for messages */ const char * -shield_simple_name(shield) -struct obj *shield; +shield_simple_name(struct obj* shield) { if (shield) { /* xname() describes unknown (unseen) reflection as smooth */ @@ -4687,15 +4605,13 @@ struct obj *shield; /* for completness */ const char * -shirt_simple_name(shirt) -struct obj *shirt UNUSED; +shirt_simple_name(struct obj* shirt UNUSED) { return "shirt"; } const char * -mimic_obj_name(mtmp) -struct monst *mtmp; +mimic_obj_name(struct monst* mtmp) { if (M_AP_TYPE(mtmp) == M_AP_OBJECT) { if (mtmp->mappearance == GOLD_PIECE) @@ -4713,12 +4629,14 @@ struct monst *mtmp; * last resort literal which should be very short), and an optional suffix. */ char * -safe_qbuf(qbuf, qprefix, qsuffix, obj, func, altfunc, lastR) -char *qbuf; /* output buffer */ -const char *qprefix, *qsuffix; -struct obj *obj; -char *FDECL((*func), (OBJ_P)), *FDECL((*altfunc), (OBJ_P)); -const char *lastR; +safe_qbuf( + char *qbuf, /* output buffer */ + const char *qprefix, + const char *qsuffix, + struct obj *obj, + char *(*func)(OBJ_P), + char *(*altfunc)(OBJ_P), + const char *lastR) { char *bufp, *endp; /* convert size_t (or int for ancient systems) to ordinary unsigned */ diff --git a/src/options.c b/src/options.c index 5596d8418..483ae77e8 100644 --- a/src/options.c +++ b/src/options.c @@ -59,7 +59,7 @@ static struct allopt_t allopt_init[] = { #include "optlist.h" {(const char *) 0, 0, 0, 0, set_in_sysconf, BoolOpt, No, No, No, No, 0, (boolean *) 0, - (int FDECL((*), (int, int, BOOLEAN_P, char *, char *))) 0, + (int (*)(int, int, boolean, char *, char *)) 0, (char *) 0, (const char *) 0, (const char *) 0, 0, 0, 0} }; #undef NHOPT_PARSE @@ -219,70 +219,69 @@ static const menu_cmd_t default_menu_cmd_info[] = { { "menu_search", MENU_SEARCH, "Search and invert matching items" }, }; -static void FDECL(nmcpy, (char *, const char *, int)); -static void FDECL(escapes, (const char *, char *)); -static void FDECL(rejectoption, (const char *)); -static char *FDECL(string_for_opt, (char *, BOOLEAN_P)); -static char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P)); -static void FDECL(bad_negation, (const char *, BOOLEAN_P)); -static int FDECL(change_inv_order, (char *)); -static boolean FDECL(warning_opts, (char *, const char *)); -static int FDECL(feature_alert_opts, (char *, const char *)); -static boolean FDECL(duplicate_opt_detection, (int)); -static void FDECL(complain_about_duplicate, (int)); -static int FDECL(length_without_val, (const char *, int len)); -static void NDECL(determine_ambiguities); -static int FDECL(check_misc_menu_command, (char *, char *)); -int FDECL(spcfn_misc_menu_cmd, (int, int, BOOLEAN_P, char *, char *)); - -static const char *FDECL(attr2attrname, (int)); -static void FDECL(basic_menu_colors, (BOOLEAN_P)); -static const char * FDECL(msgtype2name, (int)); -static int NDECL(query_msgtype); -static boolean FDECL(msgtype_add, (int, char *)); -static void FDECL(free_one_msgtype, (int)); -static int NDECL(msgtype_count); -static boolean FDECL(test_regex_pattern, (const char *, const char *)); -static boolean FDECL(add_menu_coloring_parsed, (const char *, int, int)); -static void FDECL(free_one_menu_coloring, (int)); -static int NDECL(count_menucolors); -static boolean FDECL(parse_role_opts, (int, BOOLEAN_P, const char *, - char *, char **)); -static void FDECL(doset_add_menu, (winid, const char *, int, int)); -static void FDECL(opts_add_others, (winid, const char *, int, char *, int)); -static int FDECL(handle_add_list_remove, (const char *, int)); -static void FDECL(remove_autopickup_exception, - (struct autopickup_exception *)); -static int NDECL(count_apes); -static int NDECL(count_cond); - -static int FDECL(handler_align_misc, (int)); -static int NDECL(handler_disclose); -static int NDECL(handler_menu_headings); -static int NDECL(handler_menustyle); -static int NDECL(handler_msg_window); -static int NDECL(handler_number_pad); -static int NDECL(handler_paranoid_confirmation); -static int NDECL(handler_pickup_burden); -static int NDECL(handler_pickup_types); -static int NDECL(handler_runmode); -static int NDECL(handler_sortloot); -static int FDECL(handler_symset, (int)); -static int NDECL(handler_whatis_coord); -static int NDECL(handler_whatis_filter); +static void nmcpy(char *, const char *, int); +static void escapes(const char *, char *); +static void rejectoption(const char *); +static char *string_for_opt(char *, boolean); +static char *string_for_env_opt(const char *, char *, boolean); +static void bad_negation(const char *, boolean); +static int change_inv_order(char *); +static boolean warning_opts(char *, const char *); +static int feature_alert_opts(char *, const char *); +static boolean duplicate_opt_detection(int); +static void complain_about_duplicate(int); +static int length_without_val(const char *, int len); +static void determine_ambiguities(void); +static int check_misc_menu_command(char *, char *); +int spcfn_misc_menu_cmd(int, int, boolean, char *, char *); + +static const char *attr2attrname(int); +static void basic_menu_colors(boolean); +static const char * msgtype2name(int); +static int query_msgtype(void); +static boolean msgtype_add(int, char *); +static void free_one_msgtype(int); +static int msgtype_count(void); +static boolean test_regex_pattern(const char *, const char *); +static boolean add_menu_coloring_parsed(const char *, int, int); +static void free_one_menu_coloring(int); +static int count_menucolors(void); +static boolean parse_role_opts(int, boolean, const char *, + char *, char **); +static void doset_add_menu(winid, const char *, int, int); +static void opts_add_others(winid, const char *, int, char *, int); +static int handle_add_list_remove(const char *, int); +static void remove_autopickup_exception(struct autopickup_exception *); +static int count_apes(void); +static int count_cond(void); + +static int handler_align_misc(int); +static int handler_disclose(void); +static int handler_menu_headings(void); +static int handler_menustyle(void); +static int handler_msg_window(void); +static int handler_number_pad(void); +static int handler_paranoid_confirmation(void); +static int handler_pickup_burden(void); +static int handler_pickup_types(void); +static int handler_runmode(void); +static int handler_sortloot(void); +static int handler_symset(int); +static int handler_whatis_coord(void); +static int handler_whatis_filter(void); /* next few are not allopts[] entries, so will only be called directly from doset, not from individual optfn's */ -static int NDECL(handler_autopickup_exception); -static int NDECL(handler_menu_colors); -static int NDECL(handler_msgtype); - -static boolean FDECL(is_wc_option, (const char *)); -static boolean FDECL(wc_supported, (const char *)); -static boolean FDECL(is_wc2_option, (const char *)); -static boolean FDECL(wc2_supported, (const char *)); -static void FDECL(wc_set_font_name, (int, char *)); -static int FDECL(wc_set_window_colors, (char *)); -static boolean FDECL(illegal_menu_cmd_key, (UCHAR_P)); +static int handler_autopickup_exception(void); +static int handler_menu_colors(void); +static int handler_msgtype(void); + +static boolean is_wc_option(const char *); +static boolean wc_supported(const char *); +static boolean is_wc2_option(const char *); +static boolean wc2_supported(const char *); +static void wc_set_font_name(int, char *); +static int wc_set_window_colors(char *); +static boolean illegal_menu_cmd_key(uchar); #ifdef CURSES_GRAPHICS extern int curses_read_attrs(const char *attrs); extern char *curses_fmt_attrs(char *); @@ -296,9 +295,7 @@ extern char *curses_fmt_attrs(char *); ********************************** */ boolean -parseoptions(opts, tinitial, tfrom_file) -register char *opts; -boolean tinitial, tfrom_file; +parseoptions(register char *opts,boolean tinitial, boolean tfrom_file) { char *op; boolean negated, got_match = FALSE; @@ -477,9 +474,7 @@ boolean tinitial, tfrom_file; } int -check_misc_menu_command(opts, op) -char *opts; -char *op UNUSED; +check_misc_menu_command(char *opts, char *op UNUSED) { int i; const char *name_to_check; @@ -503,11 +498,7 @@ char *op UNUSED; */ static int -optfn_align(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_align(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -533,11 +524,7 @@ char *op; static int -optfn_align_message(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_align_message(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -587,11 +574,7 @@ char *op; } static int -optfn_align_status(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_align_status(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -640,12 +623,8 @@ char *op; } static int -optfn_altkeyhandler(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_altkeyhandler(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -676,12 +655,8 @@ char *op UNUSED; } static int -optfn_boulder(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_boulder(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { #ifdef BACKWARD_COMPAT int clash = 0; @@ -758,11 +733,7 @@ char *op UNUSED; } static int -optfn_catname(optidx, req, negated, opts, op) -int optidx, req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_catname(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -788,11 +759,8 @@ char *op; #ifdef CURSES_GRAPHICS static int -optfn_cursesgraphics(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op UNUSED; +optfn_cursesgraphics(int optidx, int req, boolean negated, + char *opts, char *op UNUSED) { #ifdef BACKWARD_COMPAT boolean badflag = FALSE; @@ -841,11 +809,8 @@ char *op UNUSED; #endif static int -optfn_DECgraphics(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op UNUSED; +optfn_DECgraphics(int optidx, int req, boolean negated, + char *opts, char *op UNUSED) { #ifdef BACKWARD_COMPAT boolean badflag = FALSE; @@ -893,11 +858,7 @@ char *op UNUSED; } static int -optfn_disclose(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_disclose(int optidx, int req, boolean negated, char *opts, char *op) { int i, idx, prefix_val; unsigned num; @@ -1018,12 +979,8 @@ char *op; } static int -optfn_dogname(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_dogname(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -1047,12 +1004,8 @@ char *op; } static int -optfn_dungeon(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_dungeon(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1070,12 +1023,8 @@ char *op UNUSED; } static int -optfn_effects(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_effects(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1093,122 +1042,78 @@ char *op UNUSED; } static int -optfn_font_map(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_map(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_menu(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_menu(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_message(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_message(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_size_map(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_size_map(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_size_menu(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_size_menu(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_size_message(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_size_message(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_size_status(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_size_status(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_size_text(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_size_text(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_status(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_status(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_font_text(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_font_text(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } static int -optfn_fruit(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated; -char *opts; -char *op; +optfn_fruit(int optidx UNUSED, int req, boolean negated, + char *opts, char *op) { struct fruit *forig = 0; @@ -1278,11 +1183,7 @@ char *op; } static int -optfn_gender(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_gender(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -1309,12 +1210,8 @@ char *op; } static int -optfn_hilite_status(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated; -char *opts; -char *op; +optfn_hilite_status(int optidx UNUSED, int req, boolean negated, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -1348,11 +1245,7 @@ char *op; } static int -optfn_horsename(optidx, req, negated, opts, op) -int optidx, req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_horsename(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -1377,11 +1270,8 @@ char *op; } static int -optfn_IBMgraphics(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op UNUSED; +optfn_IBMgraphics(int optidx, int req, boolean negated, + char *opts, char *op UNUSED) { #ifdef BACKWARD_COMPAT const char *sym_name = allopt[optidx].name; @@ -1439,12 +1329,7 @@ char *op UNUSED; #if defined(BACKWARD_COMPAT) && defined(MAC_GRAPHICS_ENV) static int -optfn_MACgraphics(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_MACgraphics(int optidx, int req, boolean negated, char *opts, char *op) { boolean badflag = FALSE; @@ -1486,11 +1371,7 @@ char *op; #endif /* BACKWARD_COMPAT && MAC_GRAPHICS_ENV */ static int -optfn_map_mode(optidx, req, negated, opts, op) -int optidx, req; -boolean negated; -char *opts; -char *op; +optfn_map_mode(int optidx, int req, boolean negated, char *opts, char *op) { int i; @@ -1570,12 +1451,8 @@ char *op; } static int -optfn_menu_deselect_all(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_deselect_all(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1597,12 +1474,8 @@ char *op UNUSED; } static int -optfn_menu_deselect_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_deselect_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1624,12 +1497,8 @@ char *op UNUSED; } static int -optfn_menu_first_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_first_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1651,12 +1520,8 @@ char *op UNUSED; } static int -optfn_menu_headings(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_headings(int optidx, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { int tmpattr; @@ -1688,12 +1553,8 @@ char *op UNUSED; } static int -optfn_menu_invert_all(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_invert_all(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1715,12 +1576,8 @@ char *op UNUSED; } static int -optfn_menu_invert_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_invert_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1742,12 +1599,8 @@ char *op UNUSED; } static int -optfn_menu_last_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_last_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1769,12 +1622,8 @@ char *op UNUSED; } static int -optfn_menu_next_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_next_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1796,12 +1645,8 @@ char *op UNUSED; } static int -optfn_menu_previous_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_previous_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1823,12 +1668,8 @@ char *op UNUSED; } static int -optfn_menu_search(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_search(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1850,12 +1691,8 @@ char *op UNUSED; } static int -optfn_menu_select_all(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_select_all(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1877,12 +1714,8 @@ char *op UNUSED; } static int -optfn_menu_select_page(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_menu_select_page(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -1904,12 +1737,8 @@ char *op UNUSED; } static int -optfn_menuinvertmode(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_menuinvertmode(int optidx, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -1938,12 +1767,7 @@ char *op; } static int -optfn_menustyle(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_menustyle(int optidx, int req, boolean negated, char *opts, char *op) { int tmp; boolean val_required; /* no initializer based on opts because this can be @@ -2001,12 +1825,8 @@ char *op; } static int -optfn_monsters(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_monsters(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -2024,12 +1844,7 @@ char *op UNUSED; } static int -optfn_mouse_support(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_mouse_support(int optidx, int req, boolean negated, char *opts, char *op) { boolean compat; @@ -2093,12 +1908,7 @@ char *op; #endif static int -optfn_msg_window(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_msg_window(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; #if PREV_MSGS @@ -2165,12 +1975,7 @@ char *op; } static int -optfn_msghistory(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_msghistory(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2196,12 +2001,7 @@ char *op; } static int -optfn_name(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_name(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2226,12 +2026,7 @@ char *op; } static int -optfn_number_pad(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_number_pad(int optidx, int req, boolean negated, char *opts, char *op) { boolean compat; @@ -2301,12 +2096,8 @@ char *op; } static int -optfn_objects(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_objects(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -2324,12 +2115,8 @@ char *op UNUSED; } static int -optfn_packorder(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_packorder(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2355,12 +2142,7 @@ char *op; #ifdef CHANGE_COLOR static int -optfn_palette(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_palette(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { #ifndef WIN32 int cnt, tmp, reverse; @@ -2461,12 +2243,7 @@ char *op; #endif /* CHANGE_COLOR */ static int -optfn_paranoid_confirmation(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_paranoid_confirmation(int optidx, int req, boolean negated, char *opts, char *op) { int i; @@ -2560,12 +2337,7 @@ char *op; } static int -optfn_petattr(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_petattr(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; @@ -2625,12 +2397,7 @@ char *op; } static int -optfn_pettype(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_pettype(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2681,12 +2448,7 @@ char *op; } static int -optfn_pickup_burden(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_pickup_burden(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2738,12 +2500,7 @@ char *op; } static int -optfn_pickup_types(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_pickup_types(int optidx, int req, boolean negated, char *opts, char *op) { char ocl[MAXOCLASSES + 1], tbuf[MAXOCLASSES + 1], qbuf[QBUFSZ], abuf[BUFSZ]; @@ -2839,12 +2596,7 @@ char *op; } static int -optfn_pile_limit(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_pile_limit(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2878,12 +2630,7 @@ char *op; } static int -optfn_player_selection(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_player_selection(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2915,12 +2662,7 @@ char *op; } static int -optfn_playmode(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_playmode(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2956,12 +2698,7 @@ char *op; } static int -optfn_race(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_race(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -2988,12 +2725,8 @@ char *op; } static int -optfn_roguesymset(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_roguesymset(int optidx, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3032,12 +2765,7 @@ char *op; } static int -optfn_role(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_role(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3063,12 +2791,7 @@ char *op; } static int -optfn_runmode(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_runmode(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3107,12 +2830,7 @@ char *op; } static int -optfn_scores(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_scores(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3179,12 +2897,7 @@ char *op; } static int -optfn_scroll_amount(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_scroll_amount(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3215,12 +2928,7 @@ char *op; } static int -optfn_scroll_margin(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_scroll_margin(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3250,12 +2958,7 @@ char *op; } static int -optfn_sortdiscoveries(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_sortdiscoveries(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { flags.discosort = 'o'; @@ -3310,12 +3013,8 @@ char *op; } static int -optfn_sortloot(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_sortloot(int optidx, int req, boolean negated UNUSED, + char *opts, char *op) { int i; @@ -3359,12 +3058,8 @@ char *op; } static int -optfn_statushilites(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated; -char *opts; -char *op; +optfn_statushilites(int optidx UNUSED, int req, boolean negated, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3409,12 +3104,7 @@ char *op; } static int -optfn_statuslines(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_statuslines(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok, itmp = 0; @@ -3458,12 +3148,8 @@ char *op; #ifdef WIN32 static int -optfn_subkeyvalue(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_subkeyvalue(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -3487,12 +3173,8 @@ char *op UNUSED; #endif /* WIN32 */ static int -optfn_suppress_alert(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_suppress_alert(int optidx, int req, boolean negated, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3519,12 +3201,8 @@ char *op; } static int -optfn_symset(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_symset(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3562,12 +3240,7 @@ char *op; } static int -optfn_term_cols(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_term_cols(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; long ltmp; @@ -3606,12 +3279,7 @@ char *op; } static int -optfn_term_rows(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_term_rows(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; long ltmp; @@ -3650,12 +3318,8 @@ char *op; } static int -optfn_tile_file(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_tile_file(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3681,12 +3345,7 @@ char *op; } static int -optfn_tile_height(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_tile_height(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3716,12 +3375,7 @@ char *op; } static int -optfn_tile_width(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_tile_width(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3751,12 +3405,8 @@ char *op; } static int -optfn_traps(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_traps(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -3774,12 +3424,7 @@ char *op UNUSED; } static int -optfn_vary_msgcount(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_vary_msgcount(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3810,12 +3455,8 @@ char *op; #ifdef VIDEOSHADES static int -optfn_videocolors(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_videocolors(int optidx, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -3850,12 +3491,8 @@ char *op; } static int -optfn_videoshades(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_videoshades(int optidx, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -3886,12 +3523,8 @@ char *op; #ifdef MSDOS static int -optfn_video_width(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_video_width(int optidx UNUSED, int req, boolean negated, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3912,12 +3545,8 @@ char *op; } static int -optfn_video_height(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_video_height(int optidx UNUSED, int req, boolean negated, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -3939,12 +3568,8 @@ char *op; #ifdef NO_TERMS static int -optfn_video(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_video(int optidx, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -3975,12 +3600,8 @@ char *op; #endif /* MSDOS */ static int -optfn_warnings(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op UNUSED; +optfn_warnings(int optidx, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { int reslt; @@ -4001,12 +3622,7 @@ char *op UNUSED; } static int -optfn_whatis_coord(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_whatis_coord(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4051,12 +3667,7 @@ char *op; } static int -optfn_whatis_filter(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_whatis_filter(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4105,12 +3716,7 @@ char *op; } static int -optfn_windowborders(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_windowborders(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; @@ -4157,12 +3763,7 @@ char *op; #ifdef WINCHAIN static int -optfn_windowchain(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_windowchain(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4189,12 +3790,8 @@ char *op; #endif static int -optfn_windowcolors(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_windowcolors(int optidx, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4235,12 +3832,8 @@ char *op; } static int -optfn_windowtype(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated UNUSED; -char *opts; -char *op; +optfn_windowtype(int optidx, int req, boolean negated UNUSED, + char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4287,12 +3880,8 @@ char *op; */ int -pfxfn_cond_(optidx, req, negated, opts, op) -int optidx UNUSED; -int req; -boolean negated; -char *opts; -char *op UNUSED; +pfxfn_cond_(int optidx UNUSED, int req, boolean negated, + char *opts, char *op UNUSED) { int reslt; @@ -4332,12 +3921,7 @@ char *op UNUSED; } int -pfxfn_font(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +pfxfn_font(int optidx, int req, boolean negated, char *opts, char *op) { int opttype = -1; @@ -4469,12 +4053,8 @@ char *op; #if defined(MICRO) && !defined(AMIGA) int -pfxfn_IBM_(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +pfxfn_IBM_(int optidx UNUSED, int req, boolean negated UNUSED, + char *opts, char *op UNUSED) { if (req == do_init) { return optn_ok; @@ -4498,12 +4078,7 @@ char *op; */ static int -optfn_boolean(optidx, req, negated, opts, op) -int optidx; -int req; -boolean negated; -char *opts; -char *op; +optfn_boolean(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4698,12 +4273,7 @@ char *op; } int -spcfn_misc_menu_cmd(midx, req, negated, opts, op) -int midx; -int req; -boolean negated; -char *opts; -char *op; +spcfn_misc_menu_cmd(int midx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { return optn_ok; @@ -4743,7 +4313,7 @@ char *op; */ static int -handler_menustyle() +handler_menustyle(void) { winid tmpwin; anything any; @@ -4772,8 +4342,7 @@ handler_menustyle() } static int -handler_align_misc(optidx) -int optidx; +handler_align_misc(int optidx) { winid tmpwin; anything any; @@ -4810,7 +4379,7 @@ int optidx; } static int -handler_disclose(VOID_ARGS) +handler_disclose(void) { winid tmpwin; anything any; @@ -4914,7 +4483,7 @@ handler_disclose(VOID_ARGS) } static int -handler_menu_headings(VOID_ARGS) +handler_menu_headings(void) { int mhattr = query_attr("How to highlight menu headings:"); @@ -4924,7 +4493,7 @@ handler_menu_headings(VOID_ARGS) } static int -handler_msg_window(VOID_ARGS) +handler_msg_window(void) { #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS) winid tmpwin; @@ -4965,7 +4534,7 @@ handler_msg_window(VOID_ARGS) } static int -handler_number_pad(VOID_ARGS) +handler_number_pad(void) { winid tmpwin; anything any; @@ -5024,7 +4593,7 @@ handler_number_pad(VOID_ARGS) } static int -handler_paranoid_confirmation(VOID_ARGS) +handler_paranoid_confirmation(void) { winid tmpwin; anything any; @@ -5063,7 +4632,7 @@ handler_paranoid_confirmation(VOID_ARGS) } static int -handler_pickup_burden(VOID_ARGS) +handler_pickup_burden(void) { winid tmpwin; anything any; @@ -5090,7 +4659,7 @@ handler_pickup_burden(VOID_ARGS) } static int -handler_pickup_types(VOID_ARGS) +handler_pickup_types(void) { char buf[BUFSZ]; @@ -5101,7 +4670,7 @@ handler_pickup_types(VOID_ARGS) } static int -handler_runmode(VOID_ARGS) +handler_runmode(void) { winid tmpwin; anything any; @@ -5128,7 +4697,7 @@ handler_runmode(VOID_ARGS) } static int -handler_sortloot(VOID_ARGS) +handler_sortloot(void) { winid tmpwin; anything any; @@ -5163,7 +4732,7 @@ handler_sortloot(VOID_ARGS) } static int -handler_whatis_coord(VOID_ARGS) +handler_whatis_coord(void) { winid tmpwin; anything any; @@ -5241,7 +4810,7 @@ handler_whatis_coord(VOID_ARGS) } static int -handler_whatis_filter(VOID_ARGS) +handler_whatis_filter(void) { winid tmpwin; anything any; @@ -5282,8 +4851,7 @@ handler_whatis_filter(VOID_ARGS) } static int -handler_symset(optidx) -int optidx; +handler_symset(int optidx) { winid tmpwin; anything any; @@ -5460,7 +5028,7 @@ int optidx; } static int -handler_autopickup_exception(VOID_ARGS) +handler_autopickup_exception(void) { winid tmpwin; anything any; @@ -5537,7 +5105,7 @@ handler_autopickup_exception(VOID_ARGS) } static int -handler_menu_colors(VOID_ARGS) +handler_menu_colors(void) { winid tmpwin; anything any; @@ -5634,7 +5202,7 @@ handler_menu_colors(VOID_ARGS) } static int -handler_msgtype(VOID_ARGS) +handler_msgtype(void) { winid tmpwin; anything any; @@ -5713,9 +5281,7 @@ handler_msgtype(VOID_ARGS) */ static char * -string_for_opt(opts, val_optional) -char *opts; -boolean val_optional; +string_for_opt(char *opts, boolean val_optional) { char *colon, *equals; @@ -5733,10 +5299,7 @@ boolean val_optional; } static char * -string_for_env_opt(optname, opts, val_optional) -const char *optname; -char *opts; -boolean val_optional; +string_for_env_opt(const char *optname, char *opts, boolean val_optional) { if (!g.opt_initial) { rejectoption(optname); @@ -5746,9 +5309,7 @@ boolean val_optional; } static void -bad_negation(optname, with_parameter) -const char *optname; -boolean with_parameter; +bad_negation(const char *optname, boolean with_parameter) { pline_The("%s option may not %sbe negated.", optname, with_parameter ? "both have a value and " : ""); @@ -5758,7 +5319,7 @@ boolean with_parameter; based on what is needed for uniqueness of each individual option. Set a minimum of 3 characters. */ void -determine_ambiguities() +determine_ambiguities(void) { int i, j, len, tmpneeded, needed[SIZE(allopt)]; const char *p1, *p2; @@ -5794,9 +5355,7 @@ determine_ambiguities() } int -length_without_val(user_string, len) -const char *user_string; -int len; +length_without_val(const char *user_string, int len) { const char *p = index(user_string, ':'), *q = index(user_string, '='); @@ -5817,10 +5376,8 @@ int len; substring of a particular option name; option string might have a colon or equals sign and arbitrary value appended to it */ boolean -match_optname(user_string, optn_name, min_length, val_allowed) -const char *user_string, *optn_name; -int min_length; -boolean val_allowed; +match_optname(const char *user_string, const char *optn_name, + int min_length, boolean val_allowed) { int len = (int) strlen(user_string); @@ -5832,7 +5389,7 @@ boolean val_allowed; } void -reset_duplicate_opt_detection(VOID_ARGS) +reset_duplicate_opt_detection(void) { int k; @@ -5841,8 +5398,7 @@ reset_duplicate_opt_detection(VOID_ARGS) } static boolean -duplicate_opt_detection(optidx) -int optidx; +duplicate_opt_detection(int optidx) { if (g.opt_initial && g.opt_from_file) return allopt[optidx].dupdetected++; @@ -5850,8 +5406,7 @@ int optidx; } static void -complain_about_duplicate(optidx) -int optidx; +complain_about_duplicate(int optidx) { char buf[BUFSZ]; @@ -5873,8 +5428,7 @@ int optidx; } static void -rejectoption(optname) -const char *optname; +rejectoption(const char *optname) { #ifdef MICRO pline("\"%s\" settable only from %s.", optname, configfile); @@ -5910,8 +5464,7 @@ OPTIONS=gender * bounds-check itself. */ char * -nh_getenv(ev) -const char *ev; +nh_getenv(const char *ev) { char *getev = getenv(ev); @@ -5924,10 +5477,7 @@ const char *ev; /* copy up to maxlen-1 characters; 'dest' must be able to hold maxlen; treat comma as alternate end of 'src' */ static void -nmcpy(dest, src, maxlen) -char *dest; -const char *src; -int maxlen; +nmcpy(char *dest, const char *src, int maxlen) { int count; @@ -5962,9 +5512,8 @@ int maxlen; * or 'O', plus stop if the non-digit is end-of-string. */ static void -escapes(cp, tp) -const char *cp; /* might be 'tp', updating in place */ -char *tp; /* result is never longer than 'cp' */ +escapes(const char *cp, /* might be 'tp', updating in place */ + char *tp) /* result is never longer than 'cp' */ { static NEARDATA const char oct[] = "01234567", dec[] = "0123456789", hex[] = "00112233445566778899aAbBcCdDeEfF"; @@ -6044,7 +5593,7 @@ char *tp; /* result is never longer than 'cp' */ /* process options, possibly including SYSCF */ void -initoptions() +initoptions(void) { int i; @@ -6084,7 +5633,7 @@ initoptions() } void -initoptions_init() +initoptions_init(void) { #if (defined(UNIX) || defined(VMS)) && defined(TTY_GRAPHICS) char *opts; @@ -6208,7 +5757,7 @@ initoptions_init() } void -initoptions_finish() +initoptions_finish(void) { nhsym sym = 0; #ifndef MAC @@ -6301,8 +5850,7 @@ initoptions_finish() * */ static int -change_inv_order(op) -char *op; +change_inv_order(char *op) { int oc_sym, num; char *sp, buf[QBUFSZ]; @@ -6357,9 +5905,7 @@ char *op; */ static boolean -warning_opts(opts, optype) -register char *opts; -const char *optype; +warning_opts(char *opts, const char *optype) { uchar translate[WARNCOUNT]; int length, i; @@ -6379,8 +5925,7 @@ const char *optype; } void -assign_warnings(graph_chars) -register uchar *graph_chars; +assign_warnings(uchar *graph_chars) { int i; @@ -6397,9 +5942,7 @@ register uchar *graph_chars; */ static int -feature_alert_opts(op, optn) -char *op; -const char *optn; +feature_alert_opts(char *op, const char *optn) { char buf[BUFSZ]; unsigned long fnv = get_feature_notice_ver(op); /* version.c */ @@ -6435,8 +5978,7 @@ const char *optn; /* parse key:command */ boolean -parsebindings(bindings) -char *bindings; +parsebindings(char *bindings) { char *bind; uchar key; @@ -6544,8 +6086,7 @@ static const struct attr_names { }; const char * -clr2colorname(clr) -int clr; +clr2colorname(int clr) { int i; @@ -6556,8 +6097,7 @@ int clr; } int -match_str2clr(str) -char *str; +match_str2clr(char *str) { int i, c = CLR_MAX; @@ -6581,8 +6121,7 @@ char *str; } static const char * -attr2attrname(attr) -int attr; +attr2attrname(int attr) { int i; @@ -6593,9 +6132,7 @@ int attr; } int -match_str2attr(str, complain) -const char *str; -boolean complain; +match_str2attr(const char *str, boolean complain) { int i, a = -1; @@ -6620,8 +6157,7 @@ extern const char regex_id[]; /* from sys/share/regex.{c,cpp} */ suppresses black and white because one of those will likely be invisible due to matching the background; False: restore user-specified colorings */ static void -basic_menu_colors(load_colors) -boolean load_colors; +basic_menu_colors(boolean load_colors) { if (load_colors) { /* replace normal menu colors with a set specifically for colors */ @@ -6669,8 +6205,7 @@ boolean load_colors; } int -query_color(prompt) -const char *prompt; +query_color(const char *prompt) { winid tmpwin; anything any; @@ -6720,8 +6255,7 @@ const char *prompt; for status highlighting, multiple attributes are allowed [overkill; life would be much simpler if that were restricted to one also...] */ int -query_attr(prompt) -const char *prompt; +query_attr(const char *prompt) { winid tmpwin; anything any; @@ -6812,8 +6346,7 @@ static const struct { }; static const char * -msgtype2name(typ) -int typ; +msgtype2name(int typ) { int i; @@ -6824,7 +6357,7 @@ int typ; } static int -query_msgtype() +query_msgtype(void) { winid tmpwin; anything any; @@ -6852,9 +6385,7 @@ query_msgtype() } static boolean -msgtype_add(typ, pattern) -int typ; -char *pattern; +msgtype_add(int typ, char *pattern) { static const char *re_error = "MSGTYPE regex error"; struct plinemsg_type *tmp = (struct plinemsg_type *) alloc(sizeof *tmp); @@ -6879,7 +6410,7 @@ char *pattern; } void -msgtype_free() +msgtype_free(void) { struct plinemsg_type *tmp, *tmp2 = 0; @@ -6893,8 +6424,7 @@ msgtype_free() } static void -free_one_msgtype(idx) -int idx; /* 0 .. */ +free_one_msgtype(int idx) /* 0 .. */ { struct plinemsg_type *tmp = g.plinemsg_types; struct plinemsg_type *prev = NULL; @@ -6919,9 +6449,8 @@ int idx; /* 0 .. */ } int -msgtype_type(msg, norepeat) -const char *msg; -boolean norepeat; /* called from Norep(via pline) */ +msgtype_type(const char *msg, + boolean norepeat) /* called from Norep(via pline) */ { struct plinemsg_type *tmp = g.plinemsg_types; @@ -6938,9 +6467,7 @@ boolean norepeat; /* called from Norep(via pline) */ /* negate one or more types of messages so that their type handling will be disabled or re-enabled; MSGTYPE_NORMAL (value 0) is not affected */ void -hide_unhide_msgtypes(hide, hide_mask) -boolean hide; -int hide_mask; +hide_unhide_msgtypes(boolean hide, int hide_mask) { struct plinemsg_type *tmp; int mt; @@ -6956,7 +6483,7 @@ int hide_mask; } static int -msgtype_count(VOID_ARGS) +msgtype_count(void) { int c = 0; struct plinemsg_type *tmp = g.plinemsg_types; @@ -6969,8 +6496,7 @@ msgtype_count(VOID_ARGS) } boolean -msgtype_parse_add(str) -char *str; +msgtype_parse_add(char *str) { char pattern[256]; char msgtype[11]; @@ -6997,9 +6523,7 @@ char *str; /* parse 'str' as a regular expression to check whether it's valid; compiled regexp gets thrown away regardless of the outcome */ static boolean -test_regex_pattern(str, errmsg) -const char *str; -const char *errmsg; +test_regex_pattern(const char *str, const char *errmsg) { static const char def_errmsg[] = "NHregex error"; struct nhregex *match; @@ -7032,9 +6556,7 @@ const char *errmsg; } static boolean -add_menu_coloring_parsed(str, c, a) -const char *str; -int c, a; +add_menu_coloring_parsed(const char *str, int c, int a) { static const char re_error[] = "Menucolor regex error"; struct menucoloring *tmp; @@ -7064,8 +6586,7 @@ int c, a; /* parse '"regex_string"=color&attr' and add it to menucoloring */ boolean -add_menu_coloring(tmpstr) -char *tmpstr; /* never Null but could be empty */ +add_menu_coloring(char *tmpstr) /* never Null but could be empty */ { int c = NO_COLOR, a = ATR_NONE; char *tmps, *cs, *amp; @@ -7111,9 +6632,7 @@ char *tmpstr; /* never Null but could be empty */ } boolean -get_menu_coloring(str, color, attr) -const char *str; -int *color, *attr; +get_menu_coloring(const char *str, int *color, int *attr) { struct menucoloring *tmpmc; @@ -7129,7 +6648,7 @@ int *color, *attr; /* release all menu color patterns */ void -free_menu_coloring() +free_menu_coloring(void) { /* either menu_colorings or color_colorings or both might need to be freed or already be Null; do-loop will iterate at most twice */ @@ -7149,8 +6668,7 @@ free_menu_coloring() /* release a specific menu color pattern; not used for color_colorings */ static void -free_one_menu_coloring(idx) -int idx; /* 0 .. */ +free_one_menu_coloring(int idx) /* 0 .. */ { struct menucoloring *tmp = g.menu_colorings; struct menucoloring *prev = NULL; @@ -7175,7 +6693,7 @@ int idx; /* 0 .. */ } static int -count_menucolors(VOID_ARGS) +count_menucolors(void) { struct menucoloring *tmp; int count = 0; @@ -7186,12 +6704,8 @@ count_menucolors(VOID_ARGS) } static boolean -parse_role_opts(optidx, negated, fullname, opts, opp) -int optidx; -boolean negated; -const char *fullname; -char *opts; -char **opp; +parse_role_opts(int optidx, boolean negated, const char *fullname, + char *opts, char **opp) { char *op = *opp; @@ -7225,8 +6739,7 @@ char **opp; /* Check if character c is illegal as a menu command key */ boolean -illegal_menu_cmd_key(c) -uchar c; +illegal_menu_cmd_key(uchar c) { if (c == 0 || c == '\r' || c == '\n' || c == '\033' || c == ' ' || digit((char) c) || (letter((char) c) && c != '@')) { @@ -7251,8 +6764,7 @@ uchar c; * symbols. */ void -oc_to_str(src, dest) -char *src, *dest; +oc_to_str(char *src, char *dest) { int i; @@ -7270,8 +6782,7 @@ char *src, *dest; * maps valid C strings. */ void -add_menu_cmd_alias(from_ch, to_ch) -char from_ch, to_ch; +add_menu_cmd_alias(char from_ch, char to_ch) { if (g.n_menu_mapped >= MAX_MENU_MAPPED_CMDS) { pline("out of menu map space."); @@ -7285,8 +6796,7 @@ char from_ch, to_ch; } char -get_menu_cmd_key(ch) -char ch; +get_menu_cmd_key(char ch) { char *found = index(g.mapped_menu_op, ch); @@ -7303,8 +6813,7 @@ char ch; * doesn't match anything, just return the original. */ char -map_menu_cmd(ch) -char ch; +map_menu_cmd(char ch) { char *found = index(g.mapped_menu_cmds, ch); @@ -7323,9 +6832,7 @@ char ch; * adding a new entry--for user specified fruits only. */ int -fruitadd(str, replace_fruit) -char *str; -struct fruit *replace_fruit; +fruitadd(char *str, struct fruit *replace_fruit) { register int i; register struct fruit *f; @@ -7477,7 +6984,7 @@ static struct other_opts { const char *name; enum optset_restrictions setwhere; enum opt_other_enums code; - int NDECL((*othr_count_func)); + int (*othr_count_func)(void); } othropt[] = { { "autopickup exceptions", set_in_game, OPT_OTHER_APEXC, count_apes }, { "menu colors", set_in_game, OPT_OTHER_MENUCOLOR, count_menucolors }, @@ -7492,7 +6999,7 @@ static struct other_opts { /* the 'O' command */ int -doset() /* changing options via menu by Per Liboriussen */ +doset(void) /* changing options via menu by Per Liboriussen */ { static boolean made_fmtstr = FALSE; char buf[BUFSZ]; @@ -7713,12 +7220,11 @@ doset() /* changing options via menu by Per Liboriussen */ /* doset('O' command) menu entries for compound options */ static void -doset_add_menu(win, option, idx, indexoffset) -winid win; /* window to add to */ -const char *option; /* option name */ -int idx; /* index in allopt[] */ -int indexoffset; /* value to add to index in allopt[], or zero - if option cannot be changed */ +doset_add_menu(winid win, /* window to add to */ + const char *option, /* option name */ + int idx, /* index in allopt[] */ + int indexoffset) /* value to add to index in allopt[], + or zero if option cannot be changed */ { const char *value = "unknown"; /* current value */ char buf[BUFSZ], buf2[BUFSZ]; @@ -7763,12 +7269,7 @@ int indexoffset; /* value to add to index in allopt[], or zero } static void -opts_add_others(win, name, id, bufx, nset) -winid win; -const char *name; -int id; -char *bufx; -int nset; +opts_add_others(winid win, const char *name, int id, char *bufx, int nset) { char buf[BUFSZ], buf2[BUFSZ]; anything any = cg.zeroany; @@ -7789,9 +7290,7 @@ int nset; /* display keys for menu actions; used by cmd.c '?i' and pager.c '?k' */ void -show_menu_controls(win, dolist) -winid win; -boolean dolist; +show_menu_controls(winid win, boolean dolist) { struct xtra_cntrls { const char *key, *desc; @@ -7881,7 +7380,7 @@ boolean dolist; } } static int -count_cond(VOID_ARGS) +count_cond(void) { int i, cnt = 0; @@ -7893,7 +7392,7 @@ count_cond(VOID_ARGS) } int -count_apes(VOID_ARGS) +count_apes(void) { int numapes = 0; struct autopickup_exception *ape = g.apelist; @@ -7908,9 +7407,7 @@ count_apes(VOID_ARGS) /* common to msg-types, menu-colors, autopickup-exceptions */ static int -handle_add_list_remove(optname, numtotal) -const char *optname; -int numtotal; +handle_add_list_remove(const char *optname, int numtotal) { winid tmpwin; anything any; @@ -7956,7 +7453,7 @@ int numtotal; } int -dotogglepickup() +dotogglepickup(void) { char buf[BUFSZ], ocl[MAXOCLASSES + 1]; @@ -7977,8 +7474,7 @@ dotogglepickup() } int -add_autopickup_exception(mapping) -const char *mapping; +add_autopickup_exception(const char *mapping) { static const char APE_regex_error[] = "regex error in AUTOPICKUP_EXCEPTION", @@ -8026,8 +7522,7 @@ const char *mapping; } static void -remove_autopickup_exception(whichape) -struct autopickup_exception *whichape; +remove_autopickup_exception(struct autopickup_exception *whichape) { struct autopickup_exception *ape, *freeape, *prev = 0; @@ -8050,7 +7545,7 @@ struct autopickup_exception *whichape; } void -free_autopickup_exceptions() +free_autopickup_exceptions(void) { struct autopickup_exception *ape; @@ -8064,9 +7559,7 @@ free_autopickup_exceptions() /* bundle some common usage into one easy-to-use routine */ int -load_symset(s, which_set) -const char *s; -int which_set; +load_symset(const char *s, int which_set) { clear_symsetentry(which_set, TRUE); @@ -8084,7 +7577,7 @@ int which_set; } void -free_symsets() +free_symsets(void) { clear_symsetentry(PRIMARY, TRUE); clear_symsetentry(ROGUESET, TRUE); @@ -8096,9 +7589,7 @@ free_symsets() /* Parse the value of a SYMBOLS line from a config file */ boolean -parsesymbols(opts, which_set) -register char *opts; -int which_set; +parsesymbols(register char *opts, int which_set) { int val; char *op, *symname, *strval; @@ -8138,8 +7629,7 @@ int which_set; } struct symparse * -match_sym(buf) -char *buf; +match_sym(char *buf) { size_t len = strlen(buf); const char *p = index(buf, ':'), *q = index(buf, '='); @@ -8163,8 +7653,8 @@ char *buf; } int -sym_val(strval) -const char *strval; /* up to 4*BUFSZ-1 long; only first few chars matter */ +sym_val(const char *strval) /* up to 4*BUFSZ-1 long; only first few + chars matter */ { char buf[QBUFSZ], tmp[QBUFSZ]; /* to hold trucated copy of 'strval' */ @@ -8239,7 +7729,7 @@ static const char *opt_epilog[] = { }; void -option_help() +option_help(void) { char buf[BUFSZ], buf2[BUFSZ]; const char *optname; @@ -8321,9 +7811,7 @@ option_help() * line if not. End with next_opt(""). */ void -next_opt(datawin, str) -winid datawin; -const char *str; +next_opt(winid datawin, const char *str) { static char *buf = 0; int i; @@ -8379,12 +7867,11 @@ const char *str; * Returns number selected. */ int -choose_classes_menu(prompt, category, way, class_list, class_select) -const char *prompt; -int category; -boolean way; -char *class_list; -char *class_select; +choose_classes_menu(const char *prompt, + int category, + boolean way, + char *class_list, + char *class_select) { menu_item *pick_list = (menu_item *) 0; winid win; @@ -8543,9 +8030,7 @@ static struct wc_Opt wc2_options[] = { * with the appropriate second argument. */ void -set_option_mod_status(optnam, status) -const char *optnam; -int status; +set_option_mod_status(const char *optnam, int status) { int k; @@ -8577,9 +8062,7 @@ int status; * set_in_game); */ void -set_wc_option_mod_status(optmask, status) -unsigned long optmask; -int status; +set_wc_option_mod_status(unsigned long optmask, int status) { int k = 0; @@ -8597,8 +8080,7 @@ int status; } static boolean -is_wc_option(optnam) -const char *optnam; +is_wc_option(const char *optnam) { int k = 0; @@ -8611,8 +8093,7 @@ const char *optnam; } static boolean -wc_supported(optnam) -const char *optnam; +wc_supported(const char *optnam) { int k; @@ -8635,9 +8116,7 @@ const char *optnam; */ void -set_wc2_option_mod_status(optmask, status) -unsigned long optmask; -int status; +set_wc2_option_mod_status(unsigned long optmask, int status) { int k = 0; @@ -8655,8 +8134,7 @@ int status; } static boolean -is_wc2_option(optnam) -const char *optnam; +is_wc2_option(const char *optnam) { int k = 0; @@ -8669,8 +8147,7 @@ const char *optnam; } static boolean -wc2_supported(optnam) -const char *optnam; +wc2_supported(const char *optnam) { int k; @@ -8683,9 +8160,7 @@ const char *optnam; } static void -wc_set_font_name(opttype, fontname) -int opttype; -char *fontname; +wc_set_font_name(int opttype, char *fontname) { char **fn = (char **) 0; @@ -8719,8 +8194,7 @@ char *fontname; } static int -wc_set_window_colors(op) -char *op; +wc_set_window_colors(char *op) { /* syntax: * menu white/black message green/yellow status white/blue text @@ -8819,7 +8293,7 @@ char *op; OPTIONS=playmode:debug, or from dorecover()'s restgamestate() if restoring a game which was saved in wizard mode */ void -set_playmode() +set_playmode(void) { if (wizard) { if (authorize_wizard_mode()) diff --git a/src/pager.c b/src/pager.c index 47d18be2a..1897de794 100644 --- a/src/pager.c +++ b/src/pager.c @@ -9,31 +9,30 @@ #include "hack.h" #include "dlb.h" -static boolean FDECL(is_swallow_sym, (int)); -static int FDECL(append_str, (char *, const char *)); -static void FDECL(look_at_object, (char *, int, int, int)); -static void FDECL(look_at_monster, (char *, char *, struct monst *, int, int)); -static struct permonst *FDECL(lookat, (int, int, char *, char *)); -static void FDECL(checkfile, (char *, struct permonst *, - BOOLEAN_P, BOOLEAN_P, char *)); -static void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P)); -static void FDECL(do_supplemental_info, (char *, struct permonst *, - BOOLEAN_P)); -static void NDECL(whatdoes_help); -static void NDECL(docontact); -static void NDECL(dispfile_help); -static void NDECL(dispfile_shelp); -static void NDECL(dispfile_optionfile); -static void NDECL(dispfile_license); -static void NDECL(dispfile_debughelp); -static void NDECL(hmenu_doextversion); -static void NDECL(hmenu_dohistory); -static void NDECL(hmenu_dowhatis); -static void NDECL(hmenu_dowhatdoes); -static void NDECL(hmenu_doextlist); -static void NDECL(domenucontrols); +static boolean is_swallow_sym(int); +static int append_str(char *, const char *); +static void look_at_object(char *, int, int, int); +static void look_at_monster(char *, char *, struct monst *, int, int); +static struct permonst *lookat(int, int, char *, char *); +static void checkfile(char *, struct permonst *, boolean, boolean, + char *); +static void look_all(boolean,boolean); +static void do_supplemental_info(char *, struct permonst *, boolean); +static void whatdoes_help(void); +static void docontact(void); +static void dispfile_help(void); +static void dispfile_shelp(void); +static void dispfile_optionfile(void); +static void dispfile_license(void); +static void dispfile_debughelp(void); +static void hmenu_doextversion(void); +static void hmenu_dohistory(void); +static void hmenu_dowhatis(void); +static void hmenu_dowhatdoes(void); +static void hmenu_doextlist(void); +static void domenucontrols(void); #ifdef PORT_HELP -extern void NDECL(port_help); +extern void port_help(void); #endif static const char invisexplain[] = "remembered, unseen, creature", @@ -41,8 +40,7 @@ static const char invisexplain[] = "remembered, unseen, creature", /* Returns "true" for characters that could represent a monster's stomach. */ static boolean -is_swallow_sym(c) -int c; +is_swallow_sym(int c) { int i; @@ -58,9 +56,7 @@ int c; * It is expected that buf is of size BUFSZ. */ static int -append_str(buf, new_str) -char *buf; -const char *new_str; +append_str(char *buf, const char *new_str) { int space_left; /* space remaining in buf */ @@ -77,8 +73,7 @@ const char *new_str; /* shared by monster probing (via query_objlist!) as well as lookat() */ char * -self_lookat(outbuf) -char *outbuf; +self_lookat(char *outbuf) { char race[QBUFSZ], trapbuf[QBUFSZ]; @@ -104,10 +99,7 @@ char *outbuf; /* format description of 'mon's health for look_at_monster(), done_in_by() */ char * -monhealthdescr(mon, addspace, outbuf) -struct monst *mon; -boolean addspace; -char *outbuf; +monhealthdescr(struct monst *mon, boolean addspace, char *outbuf) { int mhp_max = max(mon->mhpmax, 1), /* bullet proofing */ pct = (mon->mhp * 100) / mhp_max; @@ -131,10 +123,10 @@ char *outbuf; /* describe a hidden monster; used for look_at during extended monster detection and for probing; also when looking at self */ void -mhidden_description(mon, altmon, outbuf) -struct monst *mon; -boolean altmon; /* for probing: if mimicking a monster, say so */ -char *outbuf; +mhidden_description(struct monst *mon, + boolean altmon, /* for probing: if mimicking a monster, + say so */ + char *outbuf) { struct obj *otmp; boolean fakeobj, isyou = (mon == &g.youmonst); @@ -189,9 +181,7 @@ char *outbuf; /* extracted from lookat(); also used by namefloorobj() */ boolean -object_from_map(glyph, x, y, obj_p) -int glyph, x, y; -struct obj **obj_p; +object_from_map(int glyph, int x, int y, struct obj **obj_p) { boolean fakeobj = FALSE, mimic_obj = FALSE; struct monst *mtmp; @@ -265,9 +255,8 @@ struct obj **obj_p; } static void -look_at_object(buf, x, y, glyph) -char *buf; /* output buffer */ -int x, y, glyph; +look_at_object(char *buf, /* output buffer */ + int x, int y, int glyph) { struct obj *otmp = 0; boolean fakeobj = object_from_map(glyph, x, y, &otmp); @@ -300,10 +289,10 @@ int x, y, glyph; } static void -look_at_monster(buf, monbuf, mtmp, x, y) -char *buf, *monbuf; /* buf: output, monbuf: optional output */ -struct monst *mtmp; -int x, y; +look_at_monster(char *buf, + char *monbuf, /* buf: output, monbuf: optional output */ + struct monst *mtmp, + int x, int y) { char *name, monnambuf[BUFSZ], healthbuf[BUFSZ]; boolean accurate = !Hallucination; @@ -425,9 +414,7 @@ int x, y; * If not hallucinating and the glyph is a monster, also monster data. */ static struct permonst * -lookat(x, y, buf, monbuf) -int x, y; -char *buf, *monbuf; +lookat(int x, int y, char *buf, char *monbuf) { struct monst *mtmp = (struct monst *) 0; struct permonst *pm = (struct permonst *) 0; @@ -587,11 +574,8 @@ char *buf, *monbuf; * Therefore, we create a copy of inp _just_ for data.base lookup. */ static void -checkfile(inp, pm, user_typed_name, without_asking, supplemental_name) -char *inp; -struct permonst *pm; -boolean user_typed_name, without_asking; -char *supplemental_name; +checkfile(char *inp, struct permonst *pm, boolean user_typed_name, + boolean without_asking, char *supplemental_name) { dlb *fp; char buf[BUFSZ], newstr[BUFSZ], givenname[BUFSZ]; @@ -874,13 +858,9 @@ char *supplemental_name; } int -do_screen_description(cc, looked, sym, out_str, firstmatch, for_supplement) -coord cc; -boolean looked; -int sym; -char *out_str; -const char **firstmatch; -struct permonst **for_supplement; +do_screen_description(coord cc, boolean looked, int sym, char *out_str, + const char **firstmatch, + struct permonst **for_supplement) { static const char mon_interior[] = "the interior of a monster", unreconnoitered[] = "unreconnoitered"; @@ -1229,9 +1209,7 @@ struct permonst **for_supplement; const char what_is_an_unknown_object[] = "an unknown object"; int -do_look(mode, click_cc) -int mode; -coord *click_cc; +do_look(int mode, coord *click_cc) { boolean quick = (mode == 1); /* use cursor; don't search for "more info" */ boolean clicklook = (mode == 2); /* right mouse-click method */ @@ -1448,9 +1426,8 @@ coord *click_cc; } static void -look_all(nearby, do_mons) -boolean nearby; /* True => within BOLTLIM, False => entire map */ -boolean do_mons; /* True => monsters, False => objects */ +look_all(boolean nearby, /* True => within BOLTLIM, False => entire map */ + boolean do_mons) /* True => monsters, False => objects */ { winid win; int x, y, lo_x, lo_y, hi_x, hi_y, glyph, count = 0; @@ -1561,10 +1538,7 @@ static const char *suptext2[] = { }; static void -do_supplemental_info(name, pm, without_asking) -char *name; -struct permonst *pm; -boolean without_asking; +do_supplemental_info(char *name, struct permonst *pm, boolean without_asking) { const char **textp; winid datawin = WIN_ERR; @@ -1628,21 +1602,21 @@ boolean without_asking; /* the '/' command */ int -dowhatis() +dowhatis(void) { return do_look(0, (coord *) 0); } /* the ';' command */ int -doquickwhatis() +doquickwhatis(void) { return do_look(1, (coord *) 0); } /* the '^' command */ int -doidtrap() +doidtrap(void) { register struct trap *trap; int x, y, tt, glyph; @@ -1721,7 +1695,7 @@ doidtrap() */ static void -whatdoes_help() +whatdoes_help(void) { dlb *fp; char *p, buf[BUFSZ]; @@ -1755,14 +1729,10 @@ struct wd_stack_frame { Bitfield(else_seen, 1); }; -static boolean FDECL(whatdoes_cond, (char *, struct wd_stack_frame *, - int *, int)); +static boolean whatdoes_cond(char *, struct wd_stack_frame *, int *, int); static boolean -whatdoes_cond(buf, stack, depth, lnum) -char *buf; -struct wd_stack_frame *stack; -int *depth, lnum; +whatdoes_cond(char *buf, struct wd_stack_frame *stack, int *depth, int lnum) { const char badstackfmt[] = "cmdhlp: too many &%c directives at line %d."; boolean newcond, neg, gotopt; @@ -1881,9 +1851,7 @@ int *depth, lnum; #endif /* 0 */ char * -dowhatdoes_core(q, cbuf) -char q; -char *cbuf; +dowhatdoes_core(char q, char *cbuf) { char buf[BUFSZ]; #if 0 @@ -1962,7 +1930,7 @@ char *cbuf; } int -dowhatdoes() +dowhatdoes(void) { static boolean once = FALSE; char bufr[BUFSZ]; @@ -2007,7 +1975,7 @@ dowhatdoes() } static void -docontact(VOID_ARGS) +docontact(void) { winid cwin = create_nhwindow(NHW_TEXT); char buf[BUFSZ]; @@ -2037,67 +2005,67 @@ docontact(VOID_ARGS) } static void -dispfile_help(VOID_ARGS) +dispfile_help(void) { display_file(HELP, TRUE); } static void -dispfile_shelp(VOID_ARGS) +dispfile_shelp(void) { display_file(SHELP, TRUE); } static void -dispfile_optionfile(VOID_ARGS) +dispfile_optionfile(void) { display_file(OPTIONFILE, TRUE); } static void -dispfile_license(VOID_ARGS) +dispfile_license(void) { display_file(LICENSE, TRUE); } static void -dispfile_debughelp(VOID_ARGS) +dispfile_debughelp(void) { display_file(DEBUGHELP, TRUE); } static void -hmenu_doextversion(VOID_ARGS) +hmenu_doextversion(void) { (void) doextversion(); } static void -hmenu_dohistory(VOID_ARGS) +hmenu_dohistory(void) { (void) dohistory(); } static void -hmenu_dowhatis(VOID_ARGS) +hmenu_dowhatis(void) { (void) dowhatis(); } static void -hmenu_dowhatdoes(VOID_ARGS) +hmenu_dowhatdoes(void) { (void) dowhatdoes(); } static void -hmenu_doextlist(VOID_ARGS) +hmenu_doextlist(void) { (void) doextlist(); } static void -domenucontrols(VOID_ARGS) +domenucontrols(void) { winid cwin = create_nhwindow(NHW_TEXT); show_menu_controls(cwin, FALSE); @@ -2107,7 +2075,7 @@ domenucontrols(VOID_ARGS) /* data for dohelp() */ static const struct { - void NDECL((*f)); + void (*f)(void); const char *text; } help_menu_items[] = { { hmenu_doextversion, "About NetHack (version information)." }, @@ -2127,12 +2095,12 @@ static const struct { { port_help, "%s-specific help and commands." }, #endif { dispfile_debughelp, "List of wizard-mode commands." }, - { (void NDECL((*))) 0, (char *) 0 } + { (void (*)(void)) 0, (char *) 0 } }; /* the '?' command */ int -dohelp() +dohelp(void) { winid tmpwin = create_nhwindow(NHW_MENU); char helpbuf[QBUFSZ]; @@ -2169,7 +2137,7 @@ dohelp() /* the 'V' command; also a choice for '?' */ int -dohistory() +dohistory(void) { display_file(HISTORY, TRUE); return 0; diff --git a/src/pickup.c b/src/pickup.c index bbfec3db7..6db657dd7 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -11,44 +11,42 @@ #define CONTAINED_SYM '>' /* from invent.c */ -static void FDECL(simple_look, (struct obj *, BOOLEAN_P)); -static boolean FDECL(query_classes, (char *, boolean *, boolean *, - const char *, struct obj *, - BOOLEAN_P, int *)); -static boolean FDECL(fatal_corpse_mistake, (struct obj *, BOOLEAN_P)); -static boolean NDECL(describe_decor); -static void FDECL(check_here, (BOOLEAN_P)); -static boolean FDECL(n_or_more, (struct obj *)); -static boolean FDECL(all_but_uchain, (struct obj *)); +static void simple_look(struct obj *, boolean); +static boolean query_classes(char *, boolean *, boolean *, const char *, + struct obj *, boolean, int *); +static boolean fatal_corpse_mistake(struct obj *, boolean); +static boolean describe_decor(void); +static void check_here(boolean); +static boolean n_or_more(struct obj *); +static boolean all_but_uchain(struct obj *); #if 0 /* not used */ -static boolean FDECL(allow_cat_no_uchain, (struct obj *)); +static boolean allow_cat_no_uchain(struct obj *); #endif -static int FDECL(autopick, (struct obj *, int, menu_item **)); -static int FDECL(count_categories, (struct obj *, int)); -static int FDECL(delta_cwt, (struct obj *, struct obj *)); -static long FDECL(carry_count, (struct obj *, struct obj *, long, - BOOLEAN_P, int *, int *)); -static int FDECL(lift_object, (struct obj *, struct obj *, long *, - BOOLEAN_P)); -static boolean FDECL(mbag_explodes, (struct obj *, int)); -static boolean NDECL(is_boh_item_gone); -static void FDECL(do_boh_explosion, (struct obj *, BOOLEAN_P)); -static long FDECL(boh_loss, (struct obj *, int)); -static int FDECL(in_container, (struct obj *)); -static int FDECL(out_container, (struct obj *)); -static long FDECL(mbag_item_gone, (int, struct obj *, BOOLEAN_P)); -static int FDECL(stash_ok, (struct obj *)); -static void FDECL(explain_container_prompt, (BOOLEAN_P)); -static int FDECL(traditional_loot, (BOOLEAN_P)); -static int FDECL(menu_loot, (int, BOOLEAN_P)); -static int FDECL(tip_ok, (struct obj *)); -static char FDECL(in_or_out_menu, (const char *, struct obj *, BOOLEAN_P, - BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -static boolean FDECL(able_to_loot, (int, int, BOOLEAN_P)); -static boolean NDECL(reverse_loot); -static boolean FDECL(mon_beside, (int, int)); -static int FDECL(do_loot_cont, (struct obj **, int, int)); -static void FDECL(tipcontainer, (struct obj *)); +static int autopick(struct obj *, int, menu_item **); +static int count_categories(struct obj *, int); +static int delta_cwt(struct obj *, struct obj *); +static long carry_count(struct obj *, struct obj *, long, boolean, int *, + int *); +static int lift_object(struct obj *, struct obj *, long *, boolean); +static boolean mbag_explodes(struct obj *, int); +static boolean is_boh_item_gone(void); +static void do_boh_explosion(struct obj *, boolean); +static long boh_loss(struct obj *, int); +static int in_container(struct obj *); +static int out_container(struct obj *); +static long mbag_item_gone(int, struct obj *, boolean); +static int stash_ok(struct obj *); +static void explain_container_prompt(boolean); +static int traditional_loot(boolean); +static int menu_loot(int, boolean); +static int tip_ok(struct obj *); +static char in_or_out_menu(const char *, struct obj *, boolean, boolean, + boolean, boolean); +static boolean able_to_loot(int, int, boolean); +static boolean reverse_loot(void); +static boolean mon_beside(int, int); +static int do_loot_cont(struct obj **, int, int); +static void tipcontainer(struct obj *); /* define for query_objlist() and autopickup() */ #define FOLLOW(curr, flags) \ @@ -69,9 +67,8 @@ static const char touching them */ /* much simpler version of the look-here code; used by query_classes() */ static void -simple_look(otmp, here) -struct obj *otmp; /* list of objects */ -boolean here; /* flag for type of obj list linkage */ +simple_look(struct obj *otmp, /* list of objects */ + boolean here) /* flag for type of obj list linkage */ { /* Neither of the first two cases is expected to happen, since * we're only called after multiple classes of objects have been @@ -95,12 +92,8 @@ boolean here; /* flag for type of obj list linkage */ } int -collect_obj_classes(ilets, otmp, here, filter, itemcount) -char ilets[]; -register struct obj *otmp; -boolean here; -boolean FDECL((*filter), (OBJ_P)); -int *itemcount; +collect_obj_classes(char ilets[], struct obj *otmp, boolean here, + boolean (*filter)(OBJ_P), int *itemcount) { register int iletct = 0; register char c; @@ -131,14 +124,9 @@ int *itemcount; * (ie, treated as if it had just been "?a"). */ static boolean -query_classes(oclasses, one_at_a_time, everything, action, objs, here, - menu_on_demand) -char oclasses[]; -boolean *one_at_a_time, *everything; -const char *action; -struct obj *objs; -boolean here; -int *menu_on_demand; +query_classes(char oclasses[], boolean *one_at_a_time, boolean *everything, + const char *action, struct obj *objs, boolean here, + int *menu_on_demand) { char ilets[36], inbuf[BUFSZ] = DUMMY; /* FIXME: hardcoded ilets[] length */ int iletct, oclassct; @@ -152,7 +140,7 @@ int *menu_on_demand; if (menu_on_demand) *menu_on_demand = 0; iletct = collect_obj_classes(ilets, objs, here, - (boolean FDECL((*), (OBJ_P))) 0, &itemcount); + (boolean (*)(OBJ_P)) 0, &itemcount); if (iletct == 0) return FALSE; @@ -254,9 +242,7 @@ int *menu_on_demand; /* check whether hero is bare-handedly touching a cockatrice corpse */ static boolean -fatal_corpse_mistake(obj, remotely) -struct obj *obj; -boolean remotely; +fatal_corpse_mistake(struct obj *obj, boolean remotely) { if (uarmg || remotely || obj->otyp != CORPSE || !touch_petrifies(&mons[obj->corpsenm]) || Stone_resistance) @@ -275,9 +261,7 @@ boolean remotely; /* attempting to manipulate a Rider's corpse triggers its revival */ boolean -rider_corpse_revival(obj, remotely) -struct obj *obj; -boolean remotely; +rider_corpse_revival(struct obj *obj, boolean remotely) { if (!obj || obj->otyp != CORPSE || !is_rider(&mons[obj->corpsenm])) return FALSE; @@ -290,8 +274,7 @@ boolean remotely; } void -deferred_decor(setup) -boolean setup; /* True: deferring, False: catching up */ +deferred_decor(boolean setup) /* True: deferring, False: catching up */ { if (setup) { iflags.defer_decor = TRUE; @@ -304,7 +287,7 @@ boolean setup; /* True: deferring, False: catching up */ /* handle 'mention_decor' (when walking onto a dungeon feature such as stairs or altar, describe it even if it isn't covered up by an object) */ static boolean -describe_decor() +describe_decor(void) { char outbuf[BUFSZ], fbuf[QBUFSZ]; boolean doorhere, waterhere, res = TRUE; @@ -372,8 +355,7 @@ describe_decor() /* look at the objects at our location, unless there are too many of them */ static void -check_here(picked_some) -boolean picked_some; +check_here(boolean picked_some) { register struct obj *obj; register int ct = 0; @@ -403,8 +385,7 @@ boolean picked_some; /* query_objlist callback: return TRUE if obj's count is >= reference value */ static boolean -n_or_more(obj) -struct obj *obj; +n_or_more(struct obj *obj) { if (obj == uchain) return FALSE; @@ -413,15 +394,13 @@ struct obj *obj; /* check valid_menu_classes[] for an entry; also used by askchain() */ boolean -menu_class_present(c) -int c; +menu_class_present(int c) { return (c && index(g.valid_menu_classes, c)) ? TRUE : FALSE; } void -add_valid_menu_class(c) -int c; +add_valid_menu_class(int c) { static int vmc_count = 0; @@ -451,8 +430,7 @@ int c; /* query_objlist callback: return TRUE if not uchain */ static boolean -all_but_uchain(obj) -struct obj *obj; +all_but_uchain(struct obj *obj) { return (boolean) (obj != uchain); } @@ -460,15 +438,13 @@ struct obj *obj; /* query_objlist callback: return TRUE */ /*ARGUSED*/ boolean -allow_all(obj) -struct obj *obj UNUSED; +allow_all(struct obj *obj UNUSED) { return TRUE; } boolean -allow_category(obj) -struct obj *obj; +allow_category(struct obj *obj) { /* For coins, if any class filter is specified, accept if coins * are included regardless of whether either unpaid or BUC-status @@ -531,8 +507,7 @@ struct obj *obj; #if 0 /* not used */ /* query_objlist callback: return TRUE if valid category (class), no uchain */ static boolean -allow_cat_no_uchain(obj) -struct obj *obj; +allow_cat_no_uchain(struct obj *obj) { if (obj != uchain && ((index(g.valid_menu_classes, 'u') && obj->unpaid) @@ -544,8 +519,7 @@ struct obj *obj; /* query_objlist callback: return TRUE if valid class and worn */ boolean -is_worn_by_type(otmp) -register struct obj *otmp; +is_worn_by_type(struct obj *otmp) { return (is_worn(otmp) && allow_category(otmp)) ? TRUE : FALSE; } @@ -563,8 +537,7 @@ register struct obj *otmp; * or not it succeeded. */ int -pickup(what) -int what; /* should be a long */ +pickup(int what) /* should be a long */ { int i, n, res, count, n_tried = 0, n_picked = 0; menu_item *pick_list = (menu_item *) 0; @@ -793,8 +766,7 @@ int what; /* should be a long */ } struct autopickup_exception * -check_autopickup_exceptions(obj) -struct obj *obj; +check_autopickup_exceptions(struct obj *obj) { /* * Does the text description of this match an exception? @@ -811,9 +783,7 @@ struct obj *obj; } boolean -autopick_testobj(otmp, calc_costly) -struct obj *otmp; -boolean calc_costly; +autopick_testobj(struct obj *otmp, boolean calc_costly) { struct autopickup_exception *ape; static boolean costly = FALSE; @@ -851,10 +821,9 @@ boolean calc_costly; * function must free the pickup list. */ static int -autopick(olist, follow, pick_list) -struct obj *olist; /* the object list */ -int follow; /* how to follow the object list */ -menu_item **pick_list; /* list of objects and counts to pick up */ +autopick(struct obj *olist, /* the object list */ + int follow, /* how to follow the object list */ + menu_item **pick_list) /* list of objects and counts to pick up */ { menu_item *pi; /* pick item */ struct obj *curr; @@ -901,13 +870,12 @@ menu_item **pick_list; /* list of objects and counts to pick up */ * FEEL_COCKATRICE - touch corpse. */ int -query_objlist(qstr, olist_p, qflags, pick_list, how, allow) -const char *qstr; /* query string */ -struct obj **olist_p; /* the list to pick from */ -int qflags; /* options to control the query */ -menu_item **pick_list; /* return list of items picked */ -int how; /* type of query */ -boolean FDECL((*allow), (OBJ_P)); /* allow function */ +query_objlist(const char *qstr, /* query string */ + struct obj **olist_p, /* the list to pick from */ + int qflags, /* options to control the query */ + menu_item **pick_list, /* return list of items picked */ + int how, /* type of query */ + boolean (*allow)(OBJ_P)) /* allow function */ { int i, n, tmpglyph; winid win; @@ -1095,12 +1063,11 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ * */ int -query_category(qstr, olist, qflags, pick_list, how) -const char *qstr; /* query string */ -struct obj *olist; /* the list to pick from */ -int qflags; /* behaviour modification flags */ -menu_item **pick_list; /* return list of items picked */ -int how; /* type of query */ +query_category(const char *qstr, /* query string */ + struct obj *olist, /* the list to pick from */ + int qflags, /* behaviour modification flags */ + menu_item **pick_list, /* return list of items picked */ + int how) /* type of query */ { int n; winid win; @@ -1110,7 +1077,7 @@ int how; /* type of query */ boolean collected_type_name; char invlet; int ccount; - boolean FDECL((*ofilter), (OBJ_P)) = (boolean FDECL((*), (OBJ_P))) 0; + boolean (*ofilter)(OBJ_P) = (boolean (*)(OBJ_P)) 0; boolean do_unpaid = FALSE; boolean do_blessed = FALSE, do_cursed = FALSE, do_uncursed = FALSE, do_buc_unknown = FALSE; @@ -1289,9 +1256,7 @@ int how; /* type of query */ } static int -count_categories(olist, qflags) -struct obj *olist; -int qflags; +count_categories(struct obj *olist, int qflags) { char *pack; boolean counted_category; @@ -1324,8 +1289,7 @@ int qflags; * than trying to match the calculation used by weight() in mkobj.c. */ static int -delta_cwt(container, obj) -struct obj *container, *obj; +delta_cwt(struct obj *container, struct obj *obj) { struct obj **prev; int owt, nwt; @@ -1351,11 +1315,11 @@ struct obj *container, *obj; /* could we carry `obj'? if not, could we carry some of it/them? */ static long -carry_count(obj, container, count, telekinesis, wt_before, wt_after) -struct obj *obj, *container; /* object to pick up, bag it's coming out of */ -long count; -boolean telekinesis; -int *wt_before, *wt_after; +carry_count(struct obj *obj, /* object to pick up... */ + struct obj *container, /* ...bag it is coming out of */ + long count, + boolean telekinesis, + int *wt_before, int *wt_after) { boolean adjust_wt = container && carried(container), is_gold = obj->oclass == COIN_CLASS; @@ -1487,10 +1451,10 @@ int *wt_before, *wt_after; /* determine whether character is able and player is willing to carry `obj' */ static int -lift_object(obj, container, cnt_p, telekinesis) -struct obj *obj, *container; /* object to pick up, bag it's coming out of */ -long *cnt_p; -boolean telekinesis; +lift_object(struct obj *obj, /* object to pick up... */ + struct obj *container, /* ...bag it's coming out of */ + long *cnt_p, + boolean telekinesis) { int result, old_wt, new_wt, prev_encumbr, next_encumbr; @@ -1582,10 +1546,8 @@ boolean telekinesis; * up, 1 if otherwise. */ int -pickup_object(obj, count, telekinesis) -struct obj *obj; -long count; -boolean telekinesis; /* not picking it up directly by hand */ +pickup_object(struct obj *obj, long count, + boolean telekinesis) /* not picking it up directly by hand */ { int res, nearload; @@ -1672,8 +1634,7 @@ boolean telekinesis; /* not picking it up directly by hand */ * from otmp because of merging. */ struct obj * -pick_obj(otmp) -struct obj *otmp; +pick_obj(struct obj *otmp) { struct obj *result; int ox = otmp->ox, oy = otmp->oy; @@ -1719,7 +1680,7 @@ struct obj *otmp; * returns the new encumbrance value (from near_capacity()). */ int -encumber_msg() +encumber_msg(void) { int newcap = near_capacity(); @@ -1766,9 +1727,7 @@ encumber_msg() /* Is there a container at x,y. Optional: return count of containers at x,y */ int -container_at(x, y, countem) -int x, y; -boolean countem; +container_at(int x, int y, boolean countem) { struct obj *cobj, *nobj; int container_count = 0; @@ -1785,9 +1744,8 @@ boolean countem; } static boolean -able_to_loot(x, y, looting) -int x, y; -boolean looting; /* loot vs tip */ +able_to_loot(int x, int y, + boolean looting) /* loot vs tip */ { const char *verb = looting ? "loot" : "tip"; struct trap *t = t_at(x, y); @@ -1816,8 +1774,7 @@ boolean looting; /* loot vs tip */ } static boolean -mon_beside(x, y) -int x, y; +mon_beside(int x, int y) { int i, j, nx, ny; @@ -1832,9 +1789,9 @@ int x, y; } static int -do_loot_cont(cobjp, cindex, ccount) -struct obj **cobjp; -int cindex, ccount; /* index of this container (1..N), number of them (N) */ +do_loot_cont(struct obj **cobjp, + int cindex, /* index of this container (1..N)... */ + int ccount) /* ...number of them (N) */ { struct obj *cobj = *cobjp; @@ -1879,7 +1836,7 @@ int cindex, ccount; /* index of this container (1..N), number of them (N) */ /* loot a container on the floor or loot saddle from mon. */ int -doloot() +doloot(void) { struct obj *cobj, *nobj; register int c = -1; @@ -2058,7 +2015,7 @@ doloot() /* called when attempting to #loot while confused */ static boolean -reverse_loot() +reverse_loot(void) { struct obj *goldob = 0, *coffers, *otmp, boxdummy; struct monst *mon; @@ -2135,10 +2092,7 @@ reverse_loot() /* loot_mon() returns amount of time passed. */ int -loot_mon(mtmp, passed_info, prev_loot) -struct monst *mtmp; -int *passed_info; -boolean *prev_loot; +loot_mon(struct monst *mtmp, int *passed_info, boolean *prev_loot) { int c = -1; int timepassed = 0; @@ -2199,9 +2153,7 @@ boolean *prev_loot; * it to explode. If the object is a bag itself, check recursively. */ static boolean -mbag_explodes(obj, depthin) -struct obj *obj; -int depthin; +mbag_explodes(struct obj *obj, int depthin) { /* these won't cause an explosion when they're empty */ if ((obj->otyp == WAN_CANCELLATION || obj->otyp == BAG_OF_TRICKS) @@ -2223,7 +2175,7 @@ int depthin; } static boolean -is_boh_item_gone() +is_boh_item_gone(void) { return (boolean) (!rn2(13)); } @@ -2232,9 +2184,7 @@ is_boh_item_gone() Some items will be destroyed with the same chance as looting a cursed bag. */ static void -do_boh_explosion(boh, on_floor) -struct obj *boh; -boolean on_floor; +do_boh_explosion(struct obj *boh, boolean on_floor) { struct obj *otmp, *nobj; @@ -2251,9 +2201,7 @@ boolean on_floor; } static long -boh_loss(container, held) -struct obj *container; -int held; +boh_loss(struct obj *container, int held) { /* sometimes toss objects if a cursed magic bag */ if (Is_mbag(container) && container->cursed && Has_contents(container)) { @@ -2274,8 +2222,7 @@ int held; /* Returns: -1 to stop, 1 item was inserted, 0 item was not inserted. */ static int -in_container(obj) -register struct obj *obj; +in_container(struct obj *obj) { boolean floor_container = !carried(g.current_container); boolean was_unpaid = FALSE; @@ -2436,16 +2383,14 @@ register struct obj *obj; * also used by getobj() when picking a single item to stash */ int -ck_bag(obj) -struct obj *obj; +ck_bag(struct obj *obj) { return (g.current_container && obj != g.current_container); } /* Returns: -1 to stop, 1 item was removed, 0 item was not removed. */ static int -out_container(obj) -register struct obj *obj; +out_container(struct obj *obj) { register struct obj *otmp; boolean is_gold = (obj->oclass == COIN_CLASS); @@ -2504,8 +2449,7 @@ register struct obj *obj; /* taking a corpse out of an ice box needs a couple of adjustments */ void -removed_from_icebox(obj) -struct obj *obj; +removed_from_icebox(struct obj *obj) { if (!age_is_relative(obj)) { obj->age = g.monstermoves - obj->age; /* actual age */ @@ -2524,10 +2468,7 @@ struct obj *obj; /* an object inside a cursed bag of holding is being destroyed */ static long -mbag_item_gone(held, item, silent) -int held; -struct obj *item; -boolean silent; +mbag_item_gone(int held, struct obj *item, boolean silent) { struct monst *shkp; long loss = 0L; @@ -2550,9 +2491,7 @@ boolean silent; /* used for #loot/apply, #tip, and final disclosure */ void -observe_quantum_cat(box, makecat, givemsg) -struct obj *box; -boolean makecat, givemsg; +observe_quantum_cat(struct obj *box, boolean makecat, boolean givemsg) { static NEARDATA const char sc[] = "Schroedinger's Cat"; struct obj *deadcat; @@ -2615,8 +2554,7 @@ boolean makecat, givemsg; /* used by askchain() to check for magic bag explosion */ boolean -container_gone(fn) -int FDECL((*fn), (OBJ_P)); +container_gone(int (*fn)(OBJ_P)) { /* result is only meaningful while use_container() is executing */ return ((fn == in_container || fn == out_container) @@ -2624,8 +2562,7 @@ int FDECL((*fn), (OBJ_P)); } static void -explain_container_prompt(more_containers) -boolean more_containers; +explain_container_prompt(boolean more_containers) { static const char *const explaintext[] = { "Container actions:", @@ -2657,7 +2594,7 @@ boolean more_containers; } boolean -u_handsy() +u_handsy(void) { if (nohands(g.youmonst.data)) { You("have no hands!"); /* not `body_part(HAND)' */ @@ -2671,8 +2608,7 @@ u_handsy() /* getobj callback for object to be stashed into a container */ int -stash_ok(obj) -struct obj *obj; +stash_ok(struct obj *obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -2687,10 +2623,10 @@ struct obj *obj; } int -use_container(objp, held, more_containers) -struct obj **objp; -int held; -boolean more_containers; /* True iff #loot multiple and this isn't last one */ +use_container(struct obj **objp, + int held, + boolean more_containers) /* True iff #loot multiple and this + isn't last one */ { struct obj *otmp, *obj = *objp; boolean quantum_cat, cursed_mbag, loot_out, loot_in, loot_in_first, @@ -2933,10 +2869,9 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */ /* loot current_container (take things out or put things in), by prompting */ static int -traditional_loot(put_in) -boolean put_in; +traditional_loot(boolean put_in) { - int FDECL((*actionfunc), (OBJ_P)), FDECL((*checkfunc), (OBJ_P)); + int (*actionfunc)(OBJ_P), (*checkfunc)(OBJ_P); struct obj **objlist; char selection[MAXOCLASSES + 10]; /* +10: room for B,U,C,X plus slop */ const char *action; @@ -2952,7 +2887,7 @@ boolean put_in; action = "take out"; objlist = &(g.current_container->cobj); actionfunc = out_container; - checkfunc = (int FDECL((*), (OBJ_P))) 0; + checkfunc = (int (*)(OBJ_P)) 0; } if (query_classes(selection, &one_by_one, &allflag, action, *objlist, @@ -2968,9 +2903,7 @@ boolean put_in; /* loot current_container (take things out or put things in), using a menu */ static int -menu_loot(retry, put_in) -int retry; -boolean put_in; +menu_loot(int retry, boolean put_in) { int n, i, n_looted = 0; boolean all_categories = TRUE, loot_everything = FALSE; @@ -3061,10 +2994,8 @@ boolean put_in; } static char -in_or_out_menu(prompt, obj, outokay, inokay, alreadyused, more_containers) -const char *prompt; -struct obj *obj; -boolean outokay, inokay, alreadyused, more_containers; +in_or_out_menu(const char *prompt, struct obj *obj, boolean outokay, + boolean inokay, boolean alreadyused, boolean more_containers) { /* underscore is not a choice; it's used to skip element [0] */ static const char lootchars[] = "_:oibrsnq", abc_chars[] = "_:abcdenq"; @@ -3142,8 +3073,7 @@ boolean outokay, inokay, alreadyused, more_containers; /* getobj callback for object to tip */ static int -tip_ok(obj) -struct obj *obj; +tip_ok(struct obj *obj) { if (!obj || obj->oclass == COIN_CLASS) return GETOBJ_EXCLUDE; @@ -3163,7 +3093,7 @@ struct obj *obj; /* #tip command -- empty container contents onto floor */ int -dotip() +dotip(void) { struct obj *cobj, *nobj; coord cc; @@ -3315,8 +3245,7 @@ dotip() } static void -tipcontainer(box) -struct obj *box; /* or bag */ +tipcontainer(struct obj *box) /* or bag */ { xchar ox = u.ux, oy = u.uy; /* #tip only works at hero's location */ boolean empty_it = FALSE, maybeshopgoods; diff --git a/src/pline.c b/src/pline.c index 957e59f0a..2ce20d624 100644 --- a/src/pline.c +++ b/src/pline.c @@ -3,27 +3,25 @@ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ -#define NEED_VARARGS /* Uses ... */ /* comment line for pre-compiled headers */ #include "hack.h" #define BIGBUFSZ (5 * BUFSZ) /* big enough to format a 4*BUFSZ string (from * config file parsing) with modest decoration; * result will then be truncated to BUFSZ-1 */ -static void FDECL(putmesg, (const char *)); -static char *FDECL(You_buf, (int)); +static void putmesg(const char *); +static char *You_buf(int); #if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__)) -static void FDECL(execplinehandler, (const char *)); +static void execplinehandler(const char *); #endif #ifdef USER_SOUNDS -extern void FDECL(maybe_play_sound, (const char *)); +extern void maybe_play_sound(const char *); #endif #ifdef DUMPLOG /* keep the most recent DUMPLOG_MSG_COUNT messages */ void -dumplogmsg(line) -const char *line; +dumplogmsg(const char *line) { /* * TODO: @@ -53,7 +51,7 @@ const char *line; this data isn't saved and restored); end-of-game releases saved_plines[] while writing its contents to the final dump log */ void -dumplogfreemessages() +dumplogfreemessages(void) { unsigned i; @@ -66,8 +64,7 @@ dumplogfreemessages() /* keeps windowprocs usage out of pline() */ static void -putmesg(line) -const char *line; +putmesg(const char *line) { int attr = ATR_NONE; @@ -81,44 +78,21 @@ const char *line; putstr(WIN_MESSAGE, attr, line); } -/* Note that these declarations rely on knowledge of the internals - * of the variable argument handling stuff in "tradstdc.h" - */ - -#if defined(USE_STDARG) || defined(USE_VARARGS) -static void FDECL(vpline, (const char *, va_list)); +static void vpline(const char *, va_list); -/*VARARGS1*/ void -pline -VA_DECL(const char *, line) +pline(const char *line, ...) { - VA_START(line); - VA_INIT(line, char *); - vpline(line, VA_ARGS); - VA_END(); + va_list the_args; + + va_start(the_args, line); + vpline(line, the_args); + va_end(the_args); } -# ifdef USE_STDARG static void vpline(const char *line, va_list the_args) -# else -static void -vpline(line, the_args) -const char *line; -va_list the_args; -# endif - -#else /* USE_STDARG | USE_VARARG */ - -# define vpline pline - -/*VARARGS1*/ -void -pline -VA_DECL(const char *, line) -#endif /* USE_STDARG | USE_VARARG */ -{ /* start of vpline() or of nested block in USE_OLDARG's pline() */ +{ static int in_pline = 0; char pbuf[BIGBUFSZ]; /* will get chopped down to BUFSZ-1 if longer */ int ln; @@ -127,7 +101,6 @@ VA_DECL(const char *, line) int vlen = 0; #endif boolean no_repeat; - /* Do NOT use VA_START and VA_END in here... see above */ if (!line || !*line) return; @@ -140,14 +113,14 @@ VA_DECL(const char *, line) if (index(line, '%')) { #if !defined(NO_VSNPRINTF) - vlen = vsnprintf(pbuf, sizeof pbuf, line, VA_ARGS); + vlen = vsnprintf(pbuf, sizeof(pbuf), line, the_args); #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) && defined(DEBUG) if (vlen >= (int) sizeof pbuf) panic("%s: truncation of buffer at %zu of %d bytes", "pline", sizeof pbuf, vlen); #endif #else - Vsprintf(pbuf, line, VA_ARGS); + Vsprintf(pbuf, line, the_args); #endif line = pbuf; } @@ -222,49 +195,39 @@ VA_DECL(const char *, line) if (msgtyp == MSGTYP_STOP) display_nhwindow(WIN_MESSAGE, TRUE); /* --more-- */ - pline_done: +pline_done: --in_pline; - return; - -#if !(defined(USE_STDARG) || defined(USE_VARARGS)) - /* provide closing brace for the nested block - which immediately follows USE_OLDARGS's VA_DECL() */ - VA_END(); -#endif } /* pline() variant which can override MSGTYPE handling or suppress message history (tty interface uses pline() to issue prompts and they shouldn't be blockable via MSGTYPE=hide) */ -/*VARARGS2*/ -void custompline -VA_DECL2(unsigned, pflags, const char *, line) +void +custompline(unsigned pflags, const char * line, ...) { - VA_START(line); - VA_INIT(line, const char *); + va_list the_args; + + va_start(the_args, line); g.pline_flags = pflags; - vpline(line, VA_ARGS); + vpline(line, the_args); g.pline_flags = 0; - VA_END(); - return; + va_end(the_args); } -/*VARARGS1*/ -void Norep -VA_DECL(const char *, line) +void +Norep(const char *line, ...) { - VA_START(line); - VA_INIT(line, const char *); + va_list the_args; + + va_start(the_args, line); g.pline_flags = PLINE_NOREPEAT; - vpline(line, VA_ARGS); + vpline(line, the_args); g.pline_flags = 0; - VA_END(); - return; + va_end(the_args); } static char * -You_buf(siz) -int siz; +You_buf(int siz) { if (siz > g.you_buf_siz) { if (g.you_buf) @@ -276,7 +239,7 @@ int siz; } void -free_youbuf() +free_youbuf(void) { if (g.you_buf) free((genericptr_t) g.you_buf), g.you_buf = (char *) 0; @@ -290,181 +253,153 @@ free_youbuf() #define YouMessage(pointer, prefix, text) \ strcat((YouPrefix(pointer, prefix, text), pointer), text) -/*VARARGS1*/ -void You -VA_DECL(const char *, line) +void +You(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); - vpline(YouMessage(tmp, "You ", line), VA_ARGS); - VA_END(); + va_start(the_args, line); + vpline(YouMessage(tmp, "You ", line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void Your -VA_DECL(const char *, line) +void +Your(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); - vpline(YouMessage(tmp, "Your ", line), VA_ARGS); - VA_END(); + va_start(the_args, line); + vpline(YouMessage(tmp, "Your ", line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void You_feel -VA_DECL(const char *, line) +void +You_feel(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); + va_start(the_args, line); if (Unaware) YouPrefix(tmp, "You dream that you feel ", line); else YouPrefix(tmp, "You feel ", line); - vpline(strcat(tmp, line), VA_ARGS); - VA_END(); + vpline(strcat(tmp, line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void You_cant -VA_DECL(const char *, line) +void +You_cant(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); - vpline(YouMessage(tmp, "You can't ", line), VA_ARGS); - VA_END(); + va_start(the_args, line); + vpline(YouMessage(tmp, "You can't ", line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void pline_The -VA_DECL(const char *, line) +void +pline_The(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); - vpline(YouMessage(tmp, "The ", line), VA_ARGS); - VA_END(); + va_start(the_args, line); + vpline(YouMessage(tmp, "The ", line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void There -VA_DECL(const char *, line) +void +There(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); - vpline(YouMessage(tmp, "There ", line), VA_ARGS); - VA_END(); + va_start(the_args, line); + vpline(YouMessage(tmp, "There ", line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void You_hear -VA_DECL(const char *, line) +void +You_hear(const char *line, ...) { + va_list the_args; char *tmp; if (Deaf || !flags.acoustics) return; - VA_START(line); - VA_INIT(line, const char *); + va_start(the_args, line); if (Underwater) YouPrefix(tmp, "You barely hear ", line); else if (Unaware) YouPrefix(tmp, "You dream that you hear ", line); else YouPrefix(tmp, "You hear ", line); /* Deaf-aware */ - vpline(strcat(tmp, line), VA_ARGS); - VA_END(); + vpline(strcat(tmp, line), the_args); + va_end(the_args); } -/*VARARGS1*/ -void You_see -VA_DECL(const char *, line) +void +You_see(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); + va_start(the_args, line); if (Unaware) YouPrefix(tmp, "You dream that you see ", line); else if (Blind) /* caller should have caught this... */ YouPrefix(tmp, "You sense ", line); else YouPrefix(tmp, "You see ", line); - vpline(strcat(tmp, line), VA_ARGS); - VA_END(); + vpline(strcat(tmp, line), the_args); + va_end(the_args); } /* Print a message inside double-quotes. * The caller is responsible for checking deafness. * Gods can speak directly to you in spite of deafness. */ -/*VARARGS1*/ -void verbalize -VA_DECL(const char *, line) +void +verbalize(const char *line, ...) { + va_list the_args; char *tmp; - VA_START(line); - VA_INIT(line, const char *); + va_start(the_args, line); tmp = You_buf((int) strlen(line) + sizeof "\"\""); Strcpy(tmp, "\""); Strcat(tmp, line); Strcat(tmp, "\""); - vpline(tmp, VA_ARGS); - VA_END(); + vpline(tmp, the_args); + va_end(the_args); } -/*VARARGS1*/ -/* Note that these declarations rely on knowledge of the internals - * of the variable argument handling stuff in "tradstdc.h" - */ - -#if defined(USE_STDARG) || defined(USE_VARARGS) -static void FDECL(vraw_printf, (const char *, va_list)); +static void vraw_printf(const char *, va_list); -void raw_printf -VA_DECL(const char *, line) +void +raw_printf(const char *line, ...) { - VA_START(line); - VA_INIT(line, char *); - vraw_printf(line, VA_ARGS); - VA_END(); + va_list the_args; + + va_start(the_args, line); + vraw_printf(line, the_args); + va_end(the_args); } -# ifdef USE_STDARG static void vraw_printf(const char *line, va_list the_args) -# else -static void -vraw_printf(line, the_args) -const char *line; -va_list the_args; -# endif - -#else /* USE_STDARG | USE_VARARG */ - -void raw_printf -VA_DECL(const char *, line) -#endif { char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */ - /* Do NOT use VA_START and VA_END in here... see above */ if (index(line, '%')) { #if !defined(NO_VSNPRINTF) - (void) vsnprintf(pbuf, sizeof pbuf, line, VA_ARGS); + (void) vsnprintf(pbuf, sizeof(pbuf), line, the_args); #else - Vsprintf(pbuf, line, VA_ARGS); + Vsprintf(pbuf, line, the_args); #endif line = pbuf; } @@ -478,53 +413,48 @@ VA_DECL(const char *, line) #if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__)) execplinehandler(line); #endif -#if !(defined(USE_STDARG) || defined(USE_VARARGS)) - VA_END(); /* (see vpline) */ -#endif } -/*VARARGS1*/ -void impossible -VA_DECL(const char *, s) +void +impossible(const char *s, ...) { + va_list the_args; char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */ - VA_START(s); - VA_INIT(s, const char *); + va_start(the_args, s); if (g.program_state.in_impossible) panic("impossible called impossible"); g.program_state.in_impossible = 1; #if !defined(NO_VSNPRINTF) - (void) vsnprintf(pbuf, sizeof pbuf, s, VA_ARGS); + (void) vsnprintf(pbuf, sizeof(pbuf), s, the_args); #else - Vsprintf(pbuf, s, VA_ARGS); + Vsprintf(pbuf, s, the_args); #endif + va_end(the_args); pbuf[BUFSZ - 1] = '\0'; /* sanity */ paniclog("impossible", pbuf); if (iflags.debug_fuzzer) panic("%s", pbuf); - pline("%s", VA_PASS1(pbuf)); + pline("%s", pbuf); /* reuse pbuf[] */ Strcpy(pbuf, "Program in disorder!"); if (g.program_state.something_worth_saving) Strcat(pbuf, " (Saving and reloading may fix this problem.)"); - pline("%s", VA_PASS1(pbuf)); + pline("%s", pbuf); pline("Please report these messages to %s.", DEVTEAM_EMAIL); if (sysopt.support) { pline("Alternatively, contact local support: %s", sysopt.support); } g.program_state.in_impossible = 0; - VA_END(); } #if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__)) static boolean use_pline_handler = TRUE; static void -execplinehandler(line) -const char *line; +execplinehandler(const char *line) { int f; const char *args[3]; @@ -556,7 +486,7 @@ const char *line; } else if (f == -1) { perror((char *) 0); use_pline_handler = FALSE; - pline("%s", VA_PASS1("Fork to message handler failed.")); + pline("%s", "Fork to message handler failed."); } } #endif /* MSGHANDLER && (POSIX_TYPES || __GNUC__) */ @@ -564,37 +494,20 @@ const char *line; /* * varargs handling for files.c */ -#if defined(USE_STDARG) || defined(USE_VARARGS) -static void FDECL(vconfig_error_add, (const char *, va_list)); +static void vconfig_error_add(const char *, va_list); -/*VARARGS1*/ void -config_error_add -VA_DECL(const char *, str) +config_error_add(const char *str, ...) { - VA_START(str); - VA_INIT(str, char *); - vconfig_error_add(str, VA_ARGS); - VA_END(); + va_list the_args; + + va_start(the_args, str); + vconfig_error_add(str, the_args); + va_end(the_args); } -# ifdef USE_STDARG static void vconfig_error_add(const char *str, va_list the_args) -# else -static void -vconfig_error_add(str, the_args) -const char *str; -va_list the_args; -# endif - -#else /* !(USE_STDARG || USE_VARARG) => USE_OLDARGS */ - -/*VARARGS1*/ -void -config_error_add -VA_DECL(const char *, str) -#endif /* ?(USE_STDARG || USE_VARARG) */ { /* start of vconf...() or of nested block in USE_OLDARG's conf...() */ #if !defined(NO_VSNPRINTF) int vlen = 0; @@ -602,29 +515,22 @@ VA_DECL(const char *, str) char buf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */ #if !defined(NO_VSNPRINTF) - vlen = vsnprintf(buf, sizeof buf, str, VA_ARGS); + vlen = vsnprintf(buf, sizeof(buf), str, the_args); #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) && defined(DEBUG) if (vlen >= (int) sizeof buf) panic("%s: truncation of buffer at %zu of %d bytes", "config_error_add", sizeof buf, vlen); #endif #else - Vsprintf(buf, str, VA_ARGS); + Vsprintf(buf, str, the_args); #endif buf[BUFSZ - 1] = '\0'; config_erradd(buf); - -#if !(defined(USE_STDARG) || defined(USE_VARARGS)) - VA_END(); /* (see pline/vpline -- ends nested block for USE_OLDARGS) */ -#endif } /* nhassert_failed is called when an nhassert's condition is false */ void -nhassert_failed(expression, filepath, line) - const char* expression; - const char * filepath; - int line; +nhassert_failed(const char *expression, const char *filepath, int line) { const char * filename; diff --git a/src/polyself.c b/src/polyself.c index 3d898ec66..fd3567da8 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -21,21 +21,21 @@ #include "hack.h" -static void FDECL(check_strangling, (BOOLEAN_P)); -static void FDECL(polyman, (const char *, const char *)); -static void FDECL(dropp, (struct obj *)); -static void NDECL(break_armor); -static void FDECL(drop_weapon, (int)); -static int FDECL(armor_to_dragon, (int)); -static void NDECL(newman); -static void NDECL(polysense); +static void check_strangling(boolean); +static void polyman(const char *, const char *); +static void dropp(struct obj *); +static void break_armor(void); +static void drop_weapon(int); +static int armor_to_dragon(int); +static void newman(void); +static void polysense(void); static const char no_longer_petrify_resistant[] = "No longer petrify-resistant, you"; /* update the g.youmonst.data structure pointer and intrinsics */ void -set_uasmon() +set_uasmon(void) { struct permonst *mdat = &mons[u.umonnum]; boolean was_vampshifter = valid_vampshiftform(g.youmonst.cham, u.umonnum); @@ -115,7 +115,7 @@ set_uasmon() /* Levitation overrides Flying; set or clear BFlying|I_SPECIAL */ void -float_vs_flight() +float_vs_flight(void) { boolean stuck_in_floor = (u.utrap && u.utraptype != TT_PIT); @@ -137,8 +137,7 @@ float_vs_flight() /* for changing into form that's immune to strangulation */ static void -check_strangling(on) -boolean on; +check_strangling(boolean on) { /* on -- maybe resume strangling */ if (on) { @@ -166,8 +165,7 @@ boolean on; /* make a (new) human out of the player */ static void -polyman(fmt, arg) -const char *fmt, *arg; +polyman(const char *fmt, const char *arg) { boolean sticky = (sticks(g.youmonst.data) && u.ustuck && !u.uswallow), was_mimicking = (U_AP_TYPE != M_AP_NOTHING); @@ -234,7 +232,7 @@ const char *fmt, *arg; } void -change_sex() +change_sex(void) { /* setting u.umonster for caveman/cavewoman or priest/priestess swap unintentionally makes `Upolyd' appear to be true */ @@ -275,7 +273,7 @@ change_sex() } static void -newman() +newman(void) { int i, oldlvl, newlvl, hpmax, enmax; @@ -393,8 +391,7 @@ newman() } void -polyself(psflags) -int psflags; +polyself(int psflags) { char buf[BUFSZ] = DUMMY; int old_light, new_light, mntmp, class, tryct, gvariant = NEUTRAL; @@ -617,8 +614,7 @@ int psflags; /* (try to) make a mntmp monster out of the player; returns 1 if polymorph successful */ int -polymon(mntmp) -int mntmp; +polymon(int mntmp) { char buf[BUFSZ]; boolean sticky = sticks(g.youmonst.data) && u.ustuck && !u.uswallow, @@ -889,8 +885,7 @@ int mntmp; /* dropx() jacket for break_armor() */ static void -dropp(obj) -struct obj *obj; +dropp(struct obj *obj) { struct obj *otmp; @@ -915,7 +910,7 @@ struct obj *obj; } static void -break_armor() +break_armor(void) { register struct obj *otmp; @@ -1044,8 +1039,7 @@ break_armor() } static void -drop_weapon(alone) -int alone; +drop_weapon(int alone) { struct obj *otmp; const char *what, *which, *whichtoo; @@ -1107,7 +1101,7 @@ int alone; /* return to original form, usually either due to polymorph timing out or dying from loss of hit points while being polymorphed */ void -rehumanize() +rehumanize(void) { boolean was_flying = (Flying != 0); @@ -1155,7 +1149,7 @@ rehumanize() } int -dobreathe() +dobreathe(void) { struct attack *mattk; @@ -1185,7 +1179,7 @@ dobreathe() } int -dospit() +dospit(void) { struct obj *otmp; struct attack *mattk; @@ -1215,7 +1209,7 @@ dospit() } int -doremove() +doremove(void) { if (!Punished) { if (u.utrap && u.utraptype == TT_BURIEDBALL) { @@ -1231,7 +1225,7 @@ doremove() } int -dospinweb() +dospinweb(void) { register struct trap *ttmp = t_at(u.ux, u.uy); @@ -1349,7 +1343,7 @@ dospinweb() } int -dosummon() +dosummon(void) { int placeholder; if (u.uen < 10) { @@ -1367,7 +1361,7 @@ dosummon() } int -dogaze() +dogaze(void) { register struct monst *mtmp; int looked = 0; @@ -1504,7 +1498,7 @@ dogaze() } int -dohide() +dohide(void) { boolean ismimic = g.youmonst.data->mlet == S_MIMIC, on_ceiling = is_clinger(g.youmonst.data) || Flying; @@ -1575,7 +1569,7 @@ dohide() } int -dopoly() +dopoly(void) { struct permonst *savedat = g.youmonst.data; @@ -1592,7 +1586,7 @@ dopoly() /* #monster for hero-as-mind_flayer giving psychic blast */ int -domindblast() +domindblast(void) { struct monst *mtmp, *nmon; int dmg; @@ -1639,7 +1633,7 @@ domindblast() } void -uunstick() +uunstick(void) { struct monst *mtmp = u.ustuck; @@ -1652,8 +1646,7 @@ uunstick() } void -skinback(silently) -boolean silently; +skinback(boolean silently) { if (uskin) { if (!silently) @@ -1666,9 +1659,7 @@ boolean silently; } const char * -mbodypart(mon, part) -struct monst *mon; -int part; +mbodypart(struct monst *mon, int part) { static NEARDATA const char *humanoid_parts[] = { "arm", "eye", "face", "finger", @@ -1825,14 +1816,13 @@ int part; } const char * -body_part(part) -int part; +body_part(int part) { return mbodypart(&g.youmonst, part); } int -poly_gender() +poly_gender(void) { /* Returns gender of polymorphed player; * 0/1=same meaning as flags.female, 2=none. @@ -1843,8 +1833,7 @@ poly_gender() } void -ugolemeffects(damtype, dam) -int damtype, dam; +ugolemeffects(int damtype, int dam) { int heal = 0; @@ -1875,8 +1864,7 @@ int damtype, dam; } static int -armor_to_dragon(atyp) -int atyp; +armor_to_dragon(int atyp) { switch (atyp) { case GRAY_DRAGON_SCALE_MAIL: @@ -1918,7 +1906,7 @@ int atyp; /* some species have awareness of other species */ static void -polysense() +polysense(void) { short warnidx = NON_PM; @@ -1947,7 +1935,7 @@ polysense() /* True iff hero's role or race has been genocided */ boolean -ugenocided() +ugenocided(void) { return (boolean) ((g.mvitals[g.urole.malenum].mvflags & G_GENOD) || (g.urole.femalenum != NON_PM @@ -1959,7 +1947,7 @@ ugenocided() /* how hero feels "inside" after self-genocide of role or race */ const char * -udeadinside() +udeadinside(void) { /* self-genocide used to always say "you feel dead inside" but that seems silly when you're polymorphed into something undead; diff --git a/src/potion.c b/src/potion.c index 7e339728c..167ccb2d5 100644 --- a/src/potion.c +++ b/src/potion.c @@ -5,21 +5,20 @@ #include "hack.h" -static long FDECL(itimeout, (long)); -static long FDECL(itimeout_incr, (long, int)); -static void NDECL(ghost_from_bottle); -static int FDECL(drink_ok, (struct obj *)); -static boolean FDECL(H2Opotion_dip, (struct obj *, struct obj *, - BOOLEAN_P, const char *)); -static short FDECL(mixtype, (struct obj *, struct obj *)); -static int FDECL(dip_ok, (struct obj *)); -static void FDECL(hold_potion, (struct obj *, const char *, - const char *, const char *)); +static long itimeout(long); +static long itimeout_incr(long, int); +static void ghost_from_bottle(void); +static int drink_ok(struct obj *); +static boolean H2Opotion_dip(struct obj *, struct obj *, boolean, + const char *); +static short mixtype(struct obj *, struct obj *); +static int dip_ok(struct obj *); +static void hold_potion(struct obj *, const char *, const char *, + const char *); /* force `val' to be within valid range for intrinsic timeout value */ static long -itimeout(val) -long val; +itimeout(long val) { if (val >= TIMEOUT) val = TIMEOUT; @@ -31,17 +30,14 @@ long val; /* increment `old' by `incr' and force result to be valid intrinsic timeout */ static long -itimeout_incr(old, incr) -long old; -int incr; +itimeout_incr(long old, int incr) { return itimeout((old & TIMEOUT) + (long) incr); } /* set the timeout field of intrinsic `which' */ void -set_itimeout(which, val) -long *which, val; +set_itimeout(long *which, long val) { *which &= ~TIMEOUT; *which |= itimeout(val); @@ -49,17 +45,13 @@ long *which, val; /* increment the timeout field of intrinsic `which' */ void -incr_itimeout(which, incr) -long *which; -int incr; +incr_itimeout(long *which, int incr) { set_itimeout(which, itimeout_incr(*which, incr)); } void -make_confused(xtime, talk) -long xtime; -boolean talk; +make_confused(long xtime, boolean talk) { long old = HConfusion; @@ -77,9 +69,7 @@ boolean talk; } void -make_stunned(xtime, talk) -long xtime; -boolean talk; +make_stunned(long xtime, boolean talk) { long old = HStun; @@ -109,11 +99,10 @@ boolean talk; u.usick_type bit mask), but delayed killer can only support one or the other at a time. They should become separate intrinsics.... */ void -make_sick(xtime, cause, talk, type) -long xtime; -const char *cause; /* sickness cause */ -boolean talk; -int type; +make_sick(long xtime, + const char *cause, /* sickness cause */ + boolean talk, + int type) { struct kinfo *kptr; long old = Sick; @@ -168,9 +157,7 @@ int type; } void -make_slimed(xtime, msg) -long xtime; -const char *msg; +make_slimed(long xtime, const char *msg) { long old = Slimed; @@ -197,11 +184,7 @@ const char *msg; /* start or stop petrification */ void -make_stoned(xtime, msg, killedby, killername) -long xtime; -const char *msg; -int killedby; -const char *killername; +make_stoned(long xtime, const char *msg, int killedby, const char *killername) { long old = Stoned; @@ -222,9 +205,7 @@ const char *killername; } void -make_vomiting(xtime, talk) -long xtime; -boolean talk; +make_vomiting(long xtime, boolean talk) { long old = Vomiting; @@ -242,9 +223,7 @@ static const char vismsg[] = "vision seems to %s for a moment but is %s now."; static const char eyemsg[] = "%s momentarily %s."; void -make_blinded(xtime, talk) -long xtime; -boolean talk; +make_blinded(long xtime, boolean talk) { long old = Blinded; boolean u_could_see, can_see_now; @@ -319,7 +298,7 @@ boolean talk; /* blindness has just started or just ended--caller enforces that; called by Blindf_on(), Blindf_off(), and make_blinded() */ void -toggle_blindness() +toggle_blindness(void) { boolean Stinging = (uwep && (EWarn_of_mon & W_WEP) != 0L); @@ -350,10 +329,11 @@ toggle_blindness() } boolean -make_hallucinated(xtime, talk, mask) -long xtime; /* nonzero if this is an attempt to turn on hallucination */ -boolean talk; -long mask; /* nonzero if resistance status should change by mask */ +make_hallucinated(long xtime, /* nonzero if this is an attempt to turn on + hallucination */ + boolean talk, + long mask) /* nonzero if resistance status should change + by mask */ { long old = HHallucination; boolean changed = 0; @@ -422,9 +402,7 @@ long mask; /* nonzero if resistance status should change by mask */ } void -make_deaf(xtime, talk) -long xtime; -boolean talk; +make_deaf(long xtime, boolean talk) { long old = HDeaf; @@ -441,8 +419,7 @@ boolean talk; /* set or clear "slippery fingers" */ void -make_glib(xtime) -int xtime; +make_glib(int xtime) { g.context.botl |= (!Glib ^ !!xtime); set_itimeout(&Glib, xtime); @@ -452,7 +429,7 @@ int xtime; } void -self_invis_message() +self_invis_message(void) { pline("%s %s.", Hallucination ? "Far out, man! You" @@ -462,7 +439,7 @@ self_invis_message() } static void -ghost_from_bottle() +ghost_from_bottle(void) { struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS); @@ -486,8 +463,7 @@ ghost_from_bottle() /* getobj callback for object to drink from, which also does double duty as the * callback for dipping into (both just allow potions). */ static int -drink_ok(obj) -struct obj *obj; +drink_ok(struct obj *obj) { if (obj && obj->oclass == POTION_CLASS) return GETOBJ_SUGGEST; @@ -497,7 +473,7 @@ struct obj *obj; /* "Quaffing is like drinking, except you spill more." - Terry Pratchett */ int -dodrink() +dodrink(void) { register struct obj *otmp; @@ -568,8 +544,7 @@ dodrink() } int -dopotion(otmp) -register struct obj *otmp; +dopotion(struct obj *otmp) { int retval; @@ -595,8 +570,7 @@ register struct obj *otmp; } int -peffects(otmp) -register struct obj *otmp; +peffects(struct obj *otmp) { register int i, ii, lim; @@ -1172,9 +1146,7 @@ register struct obj *otmp; } void -healup(nhp, nxtra, curesick, cureblind) -int nhp, nxtra; -register boolean curesick, cureblind; +healup(int nhp, int nxtra, boolean curesick, boolean cureblind) { if (nhp) { if (Upolyd) { @@ -1204,9 +1176,7 @@ register boolean curesick, cureblind; } void -strange_feeling(obj, txt) -struct obj *obj; -const char *txt; +strange_feeling(struct obj *obj, const char *txt) { if (flags.beginner || !txt) You("have a %s feeling for a moment, then it passes.", @@ -1234,7 +1204,7 @@ const char *hbottlenames[] = { }; const char * -bottlename() +bottlename(void) { if (Hallucination) return hbottlenames[rn2(SIZE(hbottlenames))]; @@ -1244,12 +1214,12 @@ bottlename() /* handle item dipped into water potion or steed saddle splashed by same */ static boolean -H2Opotion_dip(potion, targobj, useeit, objphrase) -struct obj *potion, *targobj; -boolean useeit; -const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ +H2Opotion_dip(struct obj *potion, struct obj *targobj, + boolean useeit, + const char *objphrase) /* "Your widget glows" or "Steed's saddle + glows" */ { - void FDECL((*func), (OBJ_P)) = 0; + void (*func)(OBJ_P) = 0; const char *glowcolor = 0; #define COST_alter (-2) #define COST_none (-1) @@ -1332,10 +1302,7 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ /* potion obj hits monster mon, which might be g.youmonst; obj always used up */ void -potionhit(mon, obj, how) -struct monst *mon; -struct obj *obj; -int how; +potionhit(struct monst *mon, struct obj *obj, int how) { const char *botlnam = bottlename(); boolean isyou = (mon == &g.youmonst); @@ -1633,8 +1600,7 @@ int how; /* vapors are inhaled or get in your eyes */ void -potionbreathe(obj) -register struct obj *obj; +potionbreathe(struct obj *obj) { int i, ii, isdone, kn = 0; boolean cureblind = FALSE; @@ -1815,8 +1781,7 @@ register struct obj *obj; /* returns the potion type when o1 is dipped in o2 */ static short -mixtype(o1, o2) -register struct obj *o1, *o2; +mixtype(struct obj *o1, struct obj *o2) { int o1typ = o1->otyp, o2typ = o2->otyp; @@ -1906,8 +1871,7 @@ register struct obj *o1, *o2; /* getobj callback for object to be dipped (not the thing being dipped into, * that uses drink_ok) */ static int -dip_ok(obj) -struct obj *obj; +dip_ok(struct obj *obj) { /* dipping hands and gold isn't currently implemented */ if (!obj || obj->oclass == COIN_CLASS) @@ -1923,9 +1887,8 @@ struct obj *obj; won't have changed but it might require an extra slot that isn't available or it might merge into some other carried stack */ static void -hold_potion(potobj, drop_fmt, drop_arg, hold_msg) -struct obj *potobj; -const char *drop_fmt, *drop_arg, *hold_msg; +hold_potion(struct obj *potobj, const char *drop_fmt, const char *drop_arg, + const char *hold_msg) { int cap = near_capacity(), save_pickup_burden = flags.pickup_burden; @@ -1943,7 +1906,7 @@ const char *drop_fmt, *drop_arg, *hold_msg; /* #dip command */ int -dodip() +dodip(void) { static const char Dip_[] = "Dip "; register struct obj *potion, *obj; @@ -2356,8 +2319,7 @@ dodip() /* *monp grants a wish and then leaves the game */ void -mongrantswish(monp) -struct monst **monp; +mongrantswish(struct monst **monp) { struct monst *mon = *monp; int mx = mon->mx, my = mon->my, glyph = glyph_at(mx, my); @@ -2376,8 +2338,7 @@ struct monst **monp; } void -djinni_from_bottle(obj) -struct obj *obj; +djinni_from_bottle(struct obj *obj) { struct monst *mtmp; int chance; @@ -2434,9 +2395,8 @@ struct obj *obj; /* clone a gremlin or mold (2nd arg non-null implies heat as the trigger); hit points are cut in half (odd HP stays with original) */ struct monst * -split_mon(mon, mtmp) -struct monst *mon, /* monster being split */ - *mtmp; /* optional attacker whose heat triggered it */ +split_mon(struct monst *mon, /* monster being split */ + struct monst *mtmp) /* optional attacker whose heat triggered it */ { struct monst *mtmp2; char reason[BUFSZ]; diff --git a/src/pray.c b/src/pray.c index fa95503ae..f21e101ca 100644 --- a/src/pray.c +++ b/src/pray.c @@ -4,22 +4,22 @@ #include "hack.h" -static int NDECL(prayer_done); -static struct obj *NDECL(worst_cursed_item); -static int NDECL(in_trouble); -static void FDECL(fix_worst_trouble, (int)); -static void FDECL(angrygods, (ALIGNTYP_P)); -static void FDECL(at_your_feet, (const char *)); -static void NDECL(gcrownu); -static void FDECL(pleased, (ALIGNTYP_P)); -static void FDECL(godvoice, (ALIGNTYP_P, const char *)); -static void FDECL(god_zaps_you, (ALIGNTYP_P)); -static void FDECL(fry_by_god, (ALIGNTYP_P, BOOLEAN_P)); -static void FDECL(gods_angry, (ALIGNTYP_P)); -static void FDECL(gods_upset, (ALIGNTYP_P)); -static void FDECL(consume_offering, (struct obj *)); -static boolean FDECL(water_prayer, (BOOLEAN_P)); -static boolean FDECL(blocked_boulder, (int, int)); +static int prayer_done(void); +static struct obj *worst_cursed_item(void); +static int in_trouble(void); +static void fix_worst_trouble(int); +static void angrygods(aligntyp); +static void at_your_feet(const char *); +static void gcrownu(void); +static void pleased(aligntyp); +static void godvoice(aligntyp, const char *); +static void god_zaps_you(aligntyp); +static void fry_by_god(aligntyp, boolean); +static void gods_angry(aligntyp); +static void gods_upset(aligntyp); +static void consume_offering(struct obj *); +static boolean water_prayer(boolean); +static boolean blocked_boulder(int, int); /* simplify a few tests */ #define Cursed_obj(obj, typ) ((obj) && (obj)->otyp == (typ) && (obj)->cursed) @@ -94,8 +94,8 @@ static const char *godvoices[] = { /* critically low hit points if hp <= 5 or hp <= maxhp/N for some N */ boolean -critically_low_hp(only_if_injured) -boolean only_if_injured; /* determines whether maxhp <= 5 matters */ +critically_low_hp(boolean only_if_injured) /* determines whether maxhp <= 5 + matters */ { int divisor, hplim, curhp = Upolyd ? u.mh : u.uhp, maxhp = Upolyd ? u.mhmax : u.uhpmax; @@ -138,7 +138,7 @@ boolean only_if_injured; /* determines whether maxhp <= 5 matters */ /* return True if surrounded by impassible rock, regardless of the state of your own location (for example, inside a doorless closet) */ boolean -stuck_in_wall() +stuck_in_wall(void) { int i, j, x, y, count = 0; @@ -175,7 +175,7 @@ stuck_in_wall() * hands; that's a case where the ramifications override this doubt. */ static int -in_trouble() +in_trouble(void) { struct obj *otmp; int i; @@ -265,7 +265,7 @@ in_trouble() /* select an item for TROUBLE_CURSED_ITEMS */ static struct obj * -worst_cursed_item() +worst_cursed_item(void) { register struct obj *otmp; @@ -326,8 +326,7 @@ worst_cursed_item() } static void -fix_worst_trouble(trouble) -int trouble; +fix_worst_trouble(int trouble) { int i; struct obj *otmp = 0; @@ -574,8 +573,7 @@ int trouble; * Divine wrath, dungeon walls, and armor follow the same principle. */ static void -god_zaps_you(resp_god) -aligntyp resp_god; +god_zaps_you(aligntyp resp_god) { if (u.uswallow) { pline( @@ -650,9 +648,7 @@ aligntyp resp_god; } static void -fry_by_god(resp_god, via_disintegration) -aligntyp resp_god; -boolean via_disintegration; +fry_by_god(aligntyp resp_god, boolean via_disintegration) { You("%s!", !via_disintegration ? "fry to a crisp" : "disintegrate into a pile of dust"); @@ -662,8 +658,7 @@ boolean via_disintegration; } static void -angrygods(resp_god) -aligntyp resp_god; +angrygods(aligntyp resp_god) { int maxanger; @@ -738,8 +733,7 @@ aligntyp resp_god; /* helper to print "str appears at your feet", or appropriate */ static void -at_your_feet(str) -const char *str; +at_your_feet(const char *str) { if (Blind) str = Something; @@ -755,7 +749,7 @@ const char *str; } static void -gcrownu() +gcrownu(void) { struct obj *obj; boolean already_exists, in_hand; @@ -914,8 +908,7 @@ gcrownu() } static void -pleased(g_align) -aligntyp g_align; +pleased(aligntyp g_align) { /* don't use p_trouble, worst trouble may get fixed while praying */ int trouble = in_trouble(); /* what's your worst difficulty? */ @@ -1232,8 +1225,7 @@ aligntyp g_align; * returns true if it found any water here. */ static boolean -water_prayer(bless_water) -boolean bless_water; +water_prayer(boolean bless_water) { register struct obj *otmp; register long changed = 0; @@ -1261,9 +1253,7 @@ boolean bless_water; } static void -godvoice(g_align, words) -aligntyp g_align; -const char *words; +godvoice(aligntyp g_align, const char *words) { const char *quot = ""; @@ -1277,16 +1267,14 @@ const char *words; } static void -gods_angry(g_align) -aligntyp g_align; +gods_angry(aligntyp g_align) { godvoice(g_align, "Thou hast angered me."); } /* The g_align god is upset with you. */ static void -gods_upset(g_align) -aligntyp g_align; +gods_upset(aligntyp g_align) { if (g_align == u.ualign.type) u.ugangr++; @@ -1296,8 +1284,7 @@ aligntyp g_align; } static void -consume_offering(otmp) -register struct obj *otmp; +consume_offering(struct obj *otmp) { if (Hallucination) switch (rn2(3)) { @@ -1329,7 +1316,7 @@ register struct obj *otmp; } int -dosacrifice() +dosacrifice(void) { static NEARDATA const char cloud_of_smoke[] = "A cloud of %s smoke surrounds you..."; @@ -1809,8 +1796,7 @@ dosacrifice() /* determine prayer results in advance; also used for enlightenment */ boolean -can_pray(praying) -boolean praying; /* false means no messages should be given */ +can_pray(boolean praying) /* false means no messages should be given */ { int alignment; @@ -1863,7 +1849,7 @@ boolean praying; /* false means no messages should be given */ /* #pray commmand */ int -dopray() +dopray(void) { /* Confirm accidental slips of Alt-P */ if (ParanoidPray && yn("Are you sure you want to pray?") != 'y') @@ -1903,7 +1889,7 @@ dopray() } static int -prayer_done() /* M. Stephenson (1.0.3b) */ +prayer_done(void) /* M. Stephenson (1.0.3b) */ { aligntyp alignment = g.p_aligntyp; @@ -1972,7 +1958,7 @@ prayer_done() /* M. Stephenson (1.0.3b) */ /* #turn command */ int -doturn() +doturn(void) { /* Knights & Priest(esse)s only please */ struct monst *mtmp, *mtmp2; @@ -2117,8 +2103,7 @@ doturn() } int -altarmask_at(x, y) -int x, y; +altarmask_at(int x, int y) { int res = 0; @@ -2135,15 +2120,14 @@ int x, y; } const char * -a_gname() +a_gname(void) { return a_gname_at(u.ux, u.uy); } /* returns the name of an altar's deity */ const char * -a_gname_at(x, y) -xchar x, y; +a_gname_at(xchar x, xchar y) { if (!IS_ALTAR(levl[x][y].typ)) return (char *) 0; @@ -2153,14 +2137,13 @@ xchar x, y; /* returns the name of the hero's deity */ const char * -u_gname() +u_gname(void) { return align_gname(u.ualign.type); } const char * -align_gname(alignment) -aligntyp alignment; +align_gname(aligntyp alignment) { const char *gnam; @@ -2207,8 +2190,7 @@ static const char *hallu_gods[] = { /* hallucination handling for priest/minion names: select a random god iff character is hallucinating */ const char * -halu_gname(alignment) -aligntyp alignment; +halu_gname(aligntyp alignment) { const char *gnam = NULL; int which; @@ -2259,8 +2241,7 @@ aligntyp alignment; /* deity's title */ const char * -align_gtitle(alignment) -aligntyp alignment; +align_gtitle(aligntyp alignment) { const char *gnam, *result = "god"; @@ -2284,8 +2265,7 @@ aligntyp alignment; } void -altar_wrath(x, y) -register int x, y; +altar_wrath(int x, int y) { aligntyp altaralign = a_align(x, y); @@ -2309,8 +2289,7 @@ register int x, y; /* assumes isok() at one space away, but not necessarily at two */ static boolean -blocked_boulder(dx, dy) -int dx, dy; +blocked_boulder(int dx, int dy) { register struct obj *otmp; int nx, ny; diff --git a/src/priest.c b/src/priest.c index 354cbc5a4..a62ed76ad 100644 --- a/src/priest.c +++ b/src/priest.c @@ -9,12 +9,11 @@ #define ALGN_SINNED (-4) /* worse than strayed (-1..-3) */ #define ALGN_PIOUS 14 /* better than fervent (9..13) */ -static boolean FDECL(histemple_at, (struct monst *, XCHAR_P, XCHAR_P)); -static boolean FDECL(has_shrine, (struct monst *)); +static boolean histemple_at(struct monst *, xchar, xchar); +static boolean has_shrine(struct monst *); void -newepri(mtmp) -struct monst *mtmp; +newepri(struct monst *mtmp) { if (!mtmp->mextra) mtmp->mextra = newmextra(); @@ -25,8 +24,7 @@ struct monst *mtmp; } void -free_epri(mtmp) -struct monst *mtmp; +free_epri(struct monst *mtmp) { if (mtmp->mextra && EPRI(mtmp)) { free((genericptr_t) EPRI(mtmp)); @@ -40,12 +38,9 @@ struct monst *mtmp; * Valid returns are 1: moved 0: didn't -1: let m_move do it -2: died. */ int -move_special(mtmp, in_his_shop, appr, uondoor, avoid, omx, omy, gx, gy) -register struct monst *mtmp; -boolean in_his_shop; -schar appr; -boolean uondoor, avoid; -register xchar omx, omy, gx, gy; +move_special(struct monst *mtmp, boolean in_his_shop, schar appr, + boolean uondoor, boolean avoid, + xchar omx, xchar omy, xchar gx, xchar gy) { register xchar nx, ny, nix, niy; register schar i; @@ -140,8 +135,7 @@ pick_move: } char -temple_occupied(array) -register char *array; +temple_occupied(char *array) { register char *ptr; @@ -152,9 +146,7 @@ register char *array; } static boolean -histemple_at(priest, x, y) -register struct monst *priest; -register xchar x, y; +histemple_at(struct monst *priest, xchar x, xchar y) { return (boolean) (priest && priest->ispriest && (EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE)) @@ -162,8 +154,7 @@ register xchar x, y; } boolean -inhistemple(priest) -struct monst *priest; +inhistemple(struct monst *priest) { /* make sure we have a priest */ if (!priest || !priest->ispriest) @@ -179,8 +170,7 @@ struct monst *priest; * pri_move: return 1: moved 0: didn't -1: let m_move do it -2: died */ int -pri_move(priest) -register struct monst *priest; +pri_move(struct monst *priest) { register xchar gx, gy, omx, omy; schar temple; @@ -223,11 +213,8 @@ register struct monst *priest; /* exclusively for mktemple() */ void -priestini(lvl, sroom, sx, sy, sanctum) -d_level *lvl; -struct mkroom *sroom; -int sx, sy; -boolean sanctum; /* is it the seat of the high priest? */ +priestini(d_level *lvl, struct mkroom *sroom, int sx, int sy, + boolean sanctum) /* is it the seat of the high priest? */ { struct monst *priest; struct obj *otmp; @@ -282,8 +269,7 @@ boolean sanctum; /* is it the seat of the high priest? */ /* get a monster's alignment type without caller needing EPRI & EMIN */ aligntyp -mon_aligntyp(mon) -struct monst *mon; +mon_aligntyp(struct monst *mon) { aligntyp algn = mon->ispriest ? EPRI(mon)->shralign : mon->isminion ? EMIN(mon)->min_align @@ -305,9 +291,8 @@ struct monst *mon; * the true name even when under that influence */ char * -priestname(mon, pname) -register struct monst *mon; -char *pname; /* caller-supplied output buffer */ +priestname(struct monst *mon, + char *pname) /* caller-supplied output buffer */ { boolean do_hallu = Hallucination, aligned_priest = mon->data == &mons[PM_ALIGNED_CLERIC], @@ -356,15 +341,13 @@ char *pname; /* caller-supplied output buffer */ } boolean -p_coaligned(priest) -struct monst *priest; +p_coaligned(struct monst *priest) { return (boolean) (u.ualign.type == mon_aligntyp(priest)); } static boolean -has_shrine(pri) -struct monst *pri; +has_shrine(struct monst *pri) { struct rm *lev; struct epri *epri_p; @@ -380,8 +363,7 @@ struct monst *pri; } struct monst * -findpriest(roomno) -char roomno; +findpriest(char roomno) { register struct monst *mtmp; @@ -397,8 +379,7 @@ char roomno; /* called from check_special_room() when the player enters the temple room */ void -intemple(roomno) -int roomno; +intemple(int roomno) { struct monst *priest, *mtmp; struct epri *epri_p; @@ -530,8 +511,7 @@ int roomno; /* reset the move counters used to limit temple entry feedback; leaving the level and then returning yields a fresh start */ void -forget_temple_entry(priest) -struct monst *priest; +forget_temple_entry(struct monst *priest) { struct epri *epri_p = priest->ispriest ? EPRI(priest) : 0; @@ -544,8 +524,7 @@ struct monst *priest; } void -priest_talk(priest) -register struct monst *priest; +priest_talk(struct monst *priest) { boolean coaligned = p_coaligned(priest); boolean strayed = (u.ualign.record < 0); @@ -659,11 +638,8 @@ register struct monst *priest; } struct monst * -mk_roamer(ptr, alignment, x, y, peaceful) -register struct permonst *ptr; -aligntyp alignment; -xchar x, y; -boolean peaceful; +mk_roamer(struct permonst *ptr, aligntyp alignment, xchar x, xchar y, + boolean peaceful) { register struct monst *roamer; register boolean coaligned = (u.ualign.type == alignment); @@ -693,8 +669,7 @@ boolean peaceful; } void -reset_hostility(roamer) -register struct monst *roamer; +reset_hostility(struct monst *roamer) { if (!roamer->isminion) return; @@ -710,9 +685,8 @@ register struct monst *roamer; } boolean -in_your_sanctuary(mon, x, y) -struct monst *mon; /* if non-null, overrides */ -xchar x, y; +in_your_sanctuary(struct monst *mon, /* if non-null, overrides */ + xchar x, xchar y) { register char roomno; register struct monst *priest; @@ -735,8 +709,7 @@ xchar x, y; /* when attacking "priest" in his temple */ void -ghod_hitsu(priest) -struct monst *priest; +ghod_hitsu(struct monst *priest) { int x, y, ax, ay, roomno = (int) temple_occupied(u.urooms); struct mkroom *troom; @@ -808,7 +781,7 @@ struct monst *priest; } void -angry_priest() +angry_priest(void) { register struct monst *priest; struct rm *lev; @@ -849,7 +822,7 @@ angry_priest() * [Perhaps we should convert them into roamers instead?] */ void -clearpriests() +clearpriests(void) { struct monst *mtmp; @@ -863,9 +836,7 @@ clearpriests() /* munge priest-specific structure when restoring -dlc */ void -restpriest(mtmp, ghostly) -register struct monst *mtmp; -boolean ghostly; +restpriest(struct monst *mtmp, boolean ghostly) { if (u.uz.dlevel) { if (ghostly) diff --git a/src/quest.c b/src/quest.c index e1d4dfdbd..575f4fef8 100644 --- a/src/quest.c +++ b/src/quest.c @@ -11,19 +11,19 @@ #define Not_firsttime (on_level(&u.uz0, &u.uz)) #define Qstat(x) (g.quest_status.x) -static void NDECL(on_start); -static void NDECL(on_locate); -static void NDECL(on_goal); -static boolean NDECL(not_capable); -static int FDECL(is_pure, (BOOLEAN_P)); -static void FDECL(expulsion, (BOOLEAN_P)); -static void NDECL(chat_with_leader); -static void NDECL(chat_with_nemesis); -static void NDECL(chat_with_guardian); -static void FDECL(prisoner_speaks, (struct monst *)); +static void on_start(void); +static void on_locate(void); +static void on_goal(void); +static boolean not_capable(void); +static int is_pure(boolean); +static void expulsion(boolean); +static void chat_with_leader(void); +static void chat_with_nemesis(void); +static void chat_with_guardian(void); +static void prisoner_speaks(struct monst *); static void -on_start() +on_start(void) { if (!Qstat(first_start)) { qt_pager("firsttime"); @@ -37,7 +37,7 @@ on_start() } static void -on_locate() +on_locate(void) { /* the locate messages are phrased in a manner such that they only make sense when arriving on the level from above */ @@ -59,7 +59,7 @@ on_locate() } static void -on_goal() +on_goal(void) { if (Qstat(killed_nemesis)) { return; @@ -87,7 +87,7 @@ on_goal() } void -onquest() +onquest(void) { if (u.uevent.qcompleted || Not_firsttime) return; @@ -104,7 +104,7 @@ onquest() } void -nemdead() +nemdead(void) { if (!Qstat(killed_nemesis)) { Qstat(killed_nemesis) = TRUE; @@ -113,8 +113,7 @@ nemdead() } void -artitouch(obj) -struct obj *obj; +artitouch(struct obj *obj) { if (!Qstat(touched_artifact)) { /* in case we haven't seen the item yet (ie, currently blinded), @@ -129,21 +128,20 @@ struct obj *obj; /* external hook for do.c (level change check) */ boolean -ok_to_quest() +ok_to_quest(void) { return (boolean) ((Qstat(got_quest) || Qstat(got_thanks)) && is_pure(FALSE) > 0); } static boolean -not_capable() +not_capable(void) { return (boolean) (u.ulevel < MIN_QUEST_LEVEL); } static int -is_pure(talk) -boolean talk; +is_pure(boolean talk) { int purity; aligntyp original_alignment = u.ualignbase[A_ORIGINAL]; @@ -176,8 +174,7 @@ boolean talk; * there is a single branch to and from it. */ static void -expulsion(seal) -boolean seal; +expulsion(boolean seal) { branch *br; d_level *dest; @@ -214,8 +211,8 @@ boolean seal; give another message about the character keeping the artifact and using the magic portal to return to the dungeon. */ void -finish_quest(obj) -struct obj *obj; /* quest artifact; possibly null if carrying Amulet */ +finish_quest(struct obj *obj) /* quest artifact; possibly null if carrying + Amulet */ { struct obj *otmp; @@ -243,7 +240,7 @@ struct obj *obj; /* quest artifact; possibly null if carrying Amulet */ } static void -chat_with_leader() +chat_with_leader(void) { /* Rule 0: Cheater checks. */ if (u.uhave.questart && !Qstat(met_nemesis)) @@ -317,8 +314,7 @@ chat_with_leader() } void -leader_speaks(mtmp) -struct monst *mtmp; +leader_speaks(struct monst *mtmp) { /* maybe you attacked leader? */ if (!mtmp->mpeaceful) { @@ -338,7 +334,7 @@ struct monst *mtmp; } static void -chat_with_nemesis() +chat_with_nemesis(void) { /* The nemesis will do most of the talking, but... */ qt_pager("discourage"); @@ -347,7 +343,7 @@ chat_with_nemesis() } void -nemesis_speaks() +nemesis_speaks(void) { if (!Qstat(in_battle)) { if (u.uhave.questart) @@ -369,7 +365,7 @@ nemesis_speaks() } static void -chat_with_guardian() +chat_with_guardian(void) { /* These guys/gals really don't have much to say... */ if (u.uhave.questart && Qstat(killed_nemesis)) @@ -379,8 +375,7 @@ chat_with_guardian() } static void -prisoner_speaks(mtmp) -struct monst *mtmp; +prisoner_speaks(struct monst *mtmp) { if (mtmp->data == &mons[PM_PRISONER] && (mtmp->mstrategy & STRAT_WAITMASK)) { @@ -401,8 +396,7 @@ struct monst *mtmp; } void -quest_chat(mtmp) -register struct monst *mtmp; +quest_chat(struct monst *mtmp) { if (mtmp->m_id == Qstat(leader_m_id)) { chat_with_leader(); @@ -421,8 +415,7 @@ register struct monst *mtmp; } void -quest_talk(mtmp) -struct monst *mtmp; +quest_talk(struct monst *mtmp) { if (mtmp->m_id == Qstat(leader_m_id)) { leader_speaks(mtmp); @@ -441,8 +434,7 @@ struct monst *mtmp; } void -quest_stat_check(mtmp) -struct monst *mtmp; +quest_stat_check(struct monst *mtmp) { if (mtmp->data->msound == MS_NEMESIS) Qstat(in_battle) = (mtmp->mcanmove && !mtmp->msleeping diff --git a/src/questpgr.c b/src/questpgr.c index 2a52de0f1..895b42c5c 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -13,22 +13,21 @@ #include "wintty.h" #endif -static const char *NDECL(intermed); -static struct obj *FDECL(find_qarti, (struct obj *)); -static const char *NDECL(neminame); -static const char *NDECL(guardname); -static const char *NDECL(homebase); -static void FDECL(qtext_pronoun, (CHAR_P, CHAR_P)); -static void FDECL(convert_arg, (CHAR_P)); -static void FDECL(convert_line, (char *,char *)); -static void FDECL(deliver_by_pline, (const char *)); -static void FDECL(deliver_by_window, (const char *, int)); -static boolean FDECL(skip_pager, (BOOLEAN_P)); -static boolean FDECL(com_pager_core, (const char *, const char *, BOOLEAN_P)); +static const char *intermed(void); +static struct obj *find_qarti(struct obj *); +static const char *neminame(void); +static const char *guardname(void); +static const char *homebase(void); +static void qtext_pronoun(char, char); +static void convert_arg(char); +static void convert_line(char *,char *); +static void deliver_by_pline(const char *); +static void deliver_by_window(const char *, int); +static boolean skip_pager(boolean); +static boolean com_pager_core(const char *, const char *, boolean); short -quest_info(typ) -int typ; +quest_info(int typ) { switch (typ) { case 0: @@ -47,7 +46,7 @@ int typ; /* return your role leader's name */ const char * -ldrname() +ldrname(void) { int i = g.urole.ldrnum; @@ -58,21 +57,19 @@ ldrname() /* return your intermediate target string */ static const char * -intermed() +intermed(void) { return g.urole.intermed; } boolean -is_quest_artifact(otmp) -struct obj *otmp; +is_quest_artifact(struct obj *otmp) { return (boolean) (otmp->oartifact == g.urole.questarti); } static struct obj * -find_qarti(ochain) -struct obj *ochain; +find_qarti(struct obj *ochain) { struct obj *otmp, *qarti; @@ -88,8 +85,7 @@ struct obj *ochain; /* check several object chains for the quest artifact to determine whether it is present on the current level */ struct obj * -find_quest_artifact(whichchains) -unsigned whichchains; +find_quest_artifact(unsigned whichchains) { struct monst *mtmp; struct obj *qarti = 0; @@ -124,7 +120,7 @@ unsigned whichchains; /* return your role nemesis' name */ static const char * -neminame() +neminame(void) { int i = g.urole.neminum; @@ -134,7 +130,7 @@ neminame() } static const char * -guardname() /* return your role leader's guard monster name */ +guardname(void) /* return your role leader's guard monster name */ { int i = g.urole.guardnum; @@ -142,7 +138,7 @@ guardname() /* return your role leader's guard monster name */ } static const char * -homebase() /* return your role leader's location */ +homebase(void) /* return your role leader's location */ { return g.urole.homebase; } @@ -150,9 +146,9 @@ homebase() /* return your role leader's location */ /* replace deity, leader, nemesis, or artifact name with pronoun; overwrites cvt_buf[] */ static void -qtext_pronoun(who, which) -char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ - which; /* 'h'|'H'|'i'|'I'|'j'|'J' */ +qtext_pronoun(char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, + 'o' => artifact */ + char which) /* 'h'|'H'|'i'|'I'|'j'|'J' */ { const char *pnoun; int godgend; @@ -187,8 +183,7 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ } static void -convert_arg(c) -char c; +convert_arg(char c) { register const char *str; @@ -279,8 +274,7 @@ char c; } static void -convert_line(in_line, out_line) -char *in_line, *out_line; +convert_line(char *in_line, char *out_line) { char *c, *cc; @@ -372,8 +366,7 @@ char *in_line, *out_line; } static void -deliver_by_pline(str) -const char *str; +deliver_by_pline(const char *str) { const char *msgp = str; const char *msgend = eos((char *)str); @@ -395,9 +388,7 @@ const char *str; } static void -deliver_by_window(msg, how) -const char *msg; -int how; +deliver_by_window(const char *msg, int how) { const char *msgp = msg; const char *msgend = eos((char *)msg); @@ -423,8 +414,7 @@ int how; } static boolean -skip_pager(common) -boolean common UNUSED; +skip_pager(boolean common UNUSED) { /* WIZKIT: suppress plot feedback if starting with quest artifact */ if (g.program_state.wizkit_wishing) @@ -433,10 +423,7 @@ boolean common UNUSED; } static boolean -com_pager_core(section, msgid, showerror) -const char *section; -const char *msgid; -boolean showerror; +com_pager_core(const char *section, const char *msgid, boolean showerror) { static const char *const howtoput[] = { "pline", "window", "text", "menu", "default", NULL @@ -560,22 +547,20 @@ boolean showerror; } void -com_pager(msgid) -const char *msgid; +com_pager(const char *msgid) { com_pager_core("common", msgid, TRUE); } void -qt_pager(msgid) -const char *msgid; +qt_pager(const char *msgid) { if (!com_pager_core(g.urole.filecode, msgid, FALSE)) com_pager_core("common", msgid, TRUE); } struct permonst * -qt_montype() +qt_montype(void) { int qpm; @@ -593,7 +578,7 @@ qt_montype() /* special levels can include a custom arrival message; display it */ void -deliver_splev_message() +deliver_splev_message(void) { char *str, *nl, in_line[BUFSZ], out_line[BUFSZ]; diff --git a/src/read.c b/src/read.c index 94eb0faba..51a4aae10 100644 --- a/src/read.c +++ b/src/read.c @@ -12,26 +12,26 @@ ((mndx) == g.urace.malenum \ || (g.urace.femalenum != NON_PM && (mndx) == g.urace.femalenum)) -static boolean FDECL(learnscrolltyp, (SHORT_P)); -static void FDECL(cap_spe, (struct obj *)); -static char *FDECL(erode_obj_text, (struct obj *, char *)); -static int FDECL(read_ok, (struct obj *)); -static void FDECL(stripspe, (struct obj *)); -static void FDECL(p_glow1, (struct obj *)); -static void FDECL(p_glow2, (struct obj *, const char *)); -static void FDECL(forget, (int)); -static int FDECL(maybe_tame, (struct monst *, struct obj *)); -static boolean FDECL(get_valid_stinking_cloud_pos, (int, int)); -static boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P)); -static void FDECL(display_stinking_cloud_positions, (int)); -static void FDECL(set_lit, (int, int, genericptr)); -static void NDECL(do_class_genocide); -static boolean FDECL(create_particular_parse, (char *, struct _create_particular_data *)); -static boolean FDECL(create_particular_creation, (struct _create_particular_data *)); +static boolean learnscrolltyp(short); +static void cap_spe(struct obj *); +static char *erode_obj_text(struct obj *, char *); +static int read_ok(struct obj *); +static void stripspe(struct obj *); +static void p_glow1(struct obj *); +static void p_glow2(struct obj *, const char *); +static void forget(int); +static int maybe_tame(struct monst *, struct obj *); +static boolean get_valid_stinking_cloud_pos(int, int); +static boolean is_valid_stinking_cloud_pos(int, int, boolean); +static void display_stinking_cloud_positions(int); +static void set_lit(int, int, genericptr); +static void do_class_genocide(void); +static boolean create_particular_parse(char *, + struct _create_particular_data *); +static boolean create_particular_creation(struct _create_particular_data *); static boolean -learnscrolltyp(scrolltyp) -short scrolltyp; +learnscrolltyp(short scrolltyp) { if (!objects[scrolltyp].oc_name_known) { makeknown(scrolltyp); @@ -43,8 +43,7 @@ short scrolltyp; /* also called from teleport.c for scroll of teleportation */ void -learnscroll(sobj) -struct obj *sobj; +learnscroll(struct obj* sobj) { /* it's implied that sobj->dknown is set; we couldn't be reading this scroll otherwise */ @@ -54,8 +53,7 @@ struct obj *sobj; /* max spe is +99, min is -99 */ static void -cap_spe(obj) -struct obj *obj; +cap_spe(struct obj* obj) { if (obj) { if (abs(obj->spe) > SPE_LIM) @@ -64,9 +62,7 @@ struct obj *obj; } static char * -erode_obj_text(otmp, buf) -struct obj *otmp; -char *buf; +erode_obj_text(struct obj* otmp, char* buf) { int erosion = greatest_erosion(otmp); @@ -77,9 +73,7 @@ char *buf; } char * -tshirt_text(tshirt, buf) -struct obj *tshirt; -char *buf; +tshirt_text(struct obj* tshirt, char* buf) { static const char *shirt_msgs[] = { /* Scott Bigham */ @@ -166,9 +160,7 @@ char *buf; } char * -apron_text(apron, buf) -struct obj *apron; -char *buf; +apron_text(struct obj* apron, char* buf) { static const char *apron_msgs[] = { "Kiss the cook", @@ -206,8 +198,7 @@ static const char *candy_wrappers[] = { /* return the text of a candy bar's wrapper */ const char * -candy_wrapper_text(obj) -struct obj *obj; +candy_wrapper_text(struct obj* obj) { /* modulo operation is just bullet proofing; 'spe' is already in range */ return candy_wrappers[obj->spe % SIZE(candy_wrappers)]; @@ -215,8 +206,7 @@ struct obj *obj; /* assign a wrapper to a candy bar stack */ void -assign_candy_wrapper(obj) -struct obj *obj; +assign_candy_wrapper(struct obj* obj) { if (obj->otyp == CANDY_BAR) { /* skips candy_wrappers[0] */ @@ -227,8 +217,7 @@ struct obj *obj; /* getobj callback for object to read */ static int -read_ok(obj) -struct obj *obj; +read_ok(struct obj* obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -241,7 +230,7 @@ struct obj *obj; /* the 'r' command; read a scroll or spell book or various other things */ int -doread() +doread(void) { static const char find_any_braille[] = "feel any Braille writing."; register struct obj *scroll; @@ -514,8 +503,7 @@ doread() } static void -stripspe(obj) -register struct obj *obj; +stripspe(register struct obj* obj) { if (obj->blessed || obj->spe <= 0) { pline1(nothing_happens); @@ -530,16 +518,13 @@ register struct obj *obj; } static void -p_glow1(otmp) -register struct obj *otmp; +p_glow1(register struct obj* otmp) { pline("%s briefly.", Yobjnam2(otmp, Blind ? "vibrate" : "glow")); } static void -p_glow2(otmp, color) -register struct obj *otmp; -register const char *color; +p_glow2(register struct obj* otmp, register const char* color) { pline("%s%s%s for a moment.", Yobjnam2(otmp, Blind ? "vibrate" : "glow"), Blind ? "" : " ", Blind ? "" : hcolor(color)); @@ -547,8 +532,7 @@ register const char *color; /* getobj callback for object to charge */ int -charge_ok(obj) -struct obj *obj; +charge_ok(struct obj* obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -582,9 +566,7 @@ struct obj *obj; /* recharge an object; curse_bless is -1 if the recharging implement was cursed, +1 if blessed, 0 otherwise. */ void -recharge(obj, curse_bless) -struct obj *obj; -int curse_bless; +recharge(struct obj* obj, int curse_bless) { register int n; boolean is_cursed, is_blessed; @@ -870,8 +852,7 @@ int curse_bless; * howmuch & ALL_SPELLS = forget all spells */ static void -forget(howmuch) -int howmuch; +forget(int howmuch) { if (Punished) u.bc_felt = 0; /* forget felt ball&chain */ @@ -885,9 +866,7 @@ int howmuch; /* monster is hit by scroll of taming's effect */ static int -maybe_tame(mtmp, sobj) -struct monst *mtmp; -struct obj *sobj; +maybe_tame(struct monst* mtmp, struct obj* sobj) { int was_tame = mtmp->mtame; unsigned was_peaceful = mtmp->mpeaceful; @@ -908,8 +887,7 @@ struct obj *sobj; } static boolean -get_valid_stinking_cloud_pos(x,y) -int x,y; +get_valid_stinking_cloud_pos(int x,int y) { return (!(!isok(x,y) || !cansee(x, y) || !ACCESSIBLE(levl[x][y].typ) @@ -917,9 +895,7 @@ int x,y; } static boolean -is_valid_stinking_cloud_pos(x, y, showmsg) -int x, y; -boolean showmsg; +is_valid_stinking_cloud_pos(int x, int y, boolean showmsg) { if (!get_valid_stinking_cloud_pos(x,y)) { if (showmsg) @@ -930,8 +906,7 @@ boolean showmsg; } static void -display_stinking_cloud_positions(state) -int state; +display_stinking_cloud_positions(int state) { if (state == 0) { tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); @@ -954,8 +929,7 @@ int state; /* scroll effects; return 1 if we use up the scroll and possibly make it become discovered, 0 if caller should take care of those side-effects */ int -seffects(sobj) -struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ +seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll-like spell */ { int cval, otyp = sobj->otyp; boolean confused = (Confusion != 0), sblessed = sobj->blessed, @@ -1749,8 +1723,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ } void -drop_boulder_on_player(confused, helmet_protects, byu, skip_uswallow) -boolean confused, helmet_protects, byu, skip_uswallow; +drop_boulder_on_player(boolean confused, boolean helmet_protects, boolean byu, boolean skip_uswallow) { int dmg; struct obj *otmp2; @@ -1793,9 +1766,7 @@ boolean confused, helmet_protects, byu, skip_uswallow; } boolean -drop_boulder_on_monster(x, y, confused, byu) -int x, y; -boolean confused, byu; +drop_boulder_on_monster(int x, int y, boolean confused, boolean byu) { register struct obj *otmp2; register struct monst *mtmp; @@ -1868,9 +1839,7 @@ boolean confused, byu; /* overcharging any wand or zapping/engraving cursed wand */ void -wand_explode(obj, chg) -struct obj *obj; -int chg; /* recharging */ +wand_explode(struct obj* obj, int chg /* recharging */) { const char *expl = !chg ? "suddenly" : "vibrates violently and"; int dmg, n, k; @@ -1927,9 +1896,7 @@ static struct litmon *gremlins = 0; * Low-level lit-field update routine. */ static void -set_lit(x, y, val) -int x, y; -genericptr_t val; +set_lit(int x, int y, genericptr_t val) { struct monst *mtmp; struct litmon *gremlin; @@ -1949,9 +1916,7 @@ genericptr_t val; } void -litroom(on, obj) -register boolean on; -struct obj *obj; +litroom(register boolean on, struct obj* obj) { char is_lit; /* value is irrelevant; we use its address as a `not null' flag for set_lit() */ @@ -2054,7 +2019,7 @@ struct obj *obj; } static void -do_class_genocide() +do_class_genocide(void) { int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0; char buf[BUFSZ] = DUMMY; @@ -2205,8 +2170,8 @@ do_class_genocide() #define PLAYER 2 #define ONTHRONE 4 void -do_genocide(how) -int how; +do_genocide(int how) +/* how: */ /* 0 = no genocide; create monsters (cursed scroll) */ /* 1 = normal genocide */ /* 3 = forced genocide of player */ @@ -2370,8 +2335,7 @@ int how; } void -punish(sobj) -struct obj *sobj; +punish(struct obj* sobj) { struct obj *reuse_ball = (sobj && sobj->otyp == HEAVY_IRON_BALL) ? sobj : (struct obj *) 0; @@ -2414,7 +2378,7 @@ struct obj *sobj; /* remove the ball and chain */ void -unpunish() +unpunish(void) { struct obj *savechain = uchain; @@ -2432,10 +2396,7 @@ unpunish() * revive one, the disoriented creature becomes a zombie */ boolean -cant_revive(mtype, revival, from_obj) -int *mtype; -boolean revival; -struct obj *from_obj; +cant_revive(int* mtype, boolean revival, struct obj* from_obj) { /* SHOPKEEPERS can be revived now */ if (*mtype == PM_GUARD || (*mtype == PM_SHOPKEEPER && !revival) @@ -2457,9 +2418,7 @@ struct obj *from_obj; } static boolean -create_particular_parse(str, d) -char *str; -struct _create_particular_data *d; +create_particular_parse(char* str, struct _create_particular_data* d) { int gender_name_var = NEUTRAL; char *bufp = str; @@ -2572,8 +2531,7 @@ struct _create_particular_data *d; } static boolean -create_particular_creation(d) -struct _create_particular_data *d; +create_particular_creation(struct _create_particular_data* d) { struct permonst *whichpm = NULL; int i, mx, my, firstchoice = NON_PM; @@ -2702,7 +2660,7 @@ struct _create_particular_data *d; * this code was also used for the scroll/spell in explore mode. */ boolean -create_particular() +create_particular(void) { #define CP_TRYLIM 5 struct _create_particular_data d; diff --git a/src/rect.c b/src/rect.c index 1ae311898..26d7a1167 100644 --- a/src/rect.c +++ b/src/rect.c @@ -4,9 +4,9 @@ #include "hack.h" -int FDECL(get_rect_ind, (NhRect *)); +int get_rect_ind(NhRect *); -static boolean FDECL(intersect, (NhRect *, NhRect *, NhRect *)); +static boolean intersect(NhRect *, NhRect *, NhRect *); /* * In this file, we will handle the various rectangle functions we @@ -26,7 +26,7 @@ static int rect_cnt; */ void -init_rect() +init_rect(void) { rect_cnt = 1; rect[0].lx = rect[0].ly = 0; @@ -40,8 +40,7 @@ init_rect() */ int -get_rect_ind(r) -NhRect *r; +get_rect_ind(NhRect* r) { register NhRect *rectp; register int lx, ly, hx, hy; @@ -63,8 +62,7 @@ NhRect *r; */ NhRect * -get_rect(r) -NhRect *r; +get_rect(NhRect* r) { register NhRect *rectp; register int lx, ly, hx, hy; @@ -86,7 +84,7 @@ NhRect *r; */ NhRect * -rnd_rect() +rnd_rect(void) { return rect_cnt > 0 ? &rect[rn2(rect_cnt)] : 0; } @@ -98,8 +96,7 @@ rnd_rect() */ static boolean -intersect(r1, r2, r3) -NhRect *r1, *r2, *r3; +intersect(NhRect* r1, NhRect* r2, NhRect* r3) { if (r2->lx > r1->hx || r2->ly > r1->hy || r2->hx < r1->lx || r2->hy < r1->ly) @@ -120,8 +117,7 @@ NhRect *r1, *r2, *r3; */ void -remove_rect(r) -NhRect *r; +remove_rect(NhRect* r) { int ind; @@ -135,8 +131,7 @@ NhRect *r; */ void -add_rect(r) -NhRect *r; +add_rect(NhRect* r) { if (rect_cnt >= MAXRECT) { if (wizard) @@ -158,8 +153,7 @@ NhRect *r; */ void -split_rects(r1, r2) -NhRect *r1, *r2; +split_rects(NhRect* r1, NhRect* r2) { NhRect r, old_r; int i; diff --git a/src/region.c b/src/region.c index 771217bd9..8bd10e5e3 100644 --- a/src/region.c +++ b/src/region.c @@ -12,33 +12,33 @@ #define NO_CALLBACK (-1) -boolean FDECL(inside_gas_cloud, (genericptr, genericptr)); -boolean FDECL(expire_gas_cloud, (genericptr, genericptr)); -boolean FDECL(inside_rect, (NhRect *, int, int)); -boolean FDECL(inside_region, (NhRegion *, int, int)); -NhRegion *FDECL(create_region, (NhRect *, int)); -void FDECL(add_rect_to_reg, (NhRegion *, NhRect *)); -void FDECL(add_mon_to_reg, (NhRegion *, struct monst *)); -void FDECL(remove_mon_from_reg, (NhRegion *, struct monst *)); -boolean FDECL(mon_in_region, (NhRegion *, struct monst *)); +boolean inside_gas_cloud(genericptr, genericptr); +boolean expire_gas_cloud(genericptr, genericptr); +boolean inside_rect(NhRect *, int, int); +boolean inside_region(NhRegion *, int, int); +NhRegion *create_region(NhRect *, int); +void add_rect_to_reg(NhRegion *, NhRect *); +void add_mon_to_reg(NhRegion *, struct monst *); +void remove_mon_from_reg(NhRegion *, struct monst *); +boolean mon_in_region(NhRegion *, struct monst *); #if 0 -NhRegion *FDECL(clone_region, (NhRegion *)); +NhRegion *clone_region(NhRegion *); #endif -void FDECL(free_region, (NhRegion *)); -void FDECL(add_region, (NhRegion *)); -void FDECL(remove_region, (NhRegion *)); +void free_region(NhRegion *); +void add_region(NhRegion *); +void remove_region(NhRegion *); #if 0 -void FDECL(replace_mon_regions, (struct monst *,struct monst *)); -void FDECL(remove_mon_from_regions, (struct monst *)); -NhRegion *FDECL(create_msg_region, (XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P, - const char *,const char *)); -boolean FDECL(enter_force_field, (genericptr,genericptr)); -NhRegion *FDECL(create_force_field, (XCHAR_P,XCHAR_P,int,long)); +void replace_mon_regions(struct monst *,struct monst *); +void remove_mon_from_regions(struct monst *); +NhRegion *create_msg_region(xchar,xchar,xchar,xchar, const char *, + const char *); +boolean enter_force_field(genericptr,genericptr); +NhRegion *create_force_field(xchar,xchar,int,long); #endif -static void FDECL(reset_region_mids, (NhRegion *)); +static void reset_region_mids(NhRegion *); static const callback_proc callbacks[] = { #define INSIDE_GAS_CLOUD 0 @@ -49,9 +49,7 @@ static const callback_proc callbacks[] = { /* Should be inlined. */ boolean -inside_rect(r, x, y) -NhRect *r; -int x, y; +inside_rect(NhRect* r, int x, int y) { return (boolean) (x >= r->lx && x <= r->hx && y >= r->ly && y <= r->hy); } @@ -60,9 +58,7 @@ int x, y; * Check if a point is inside a region. */ boolean -inside_region(reg, x, y) -NhRegion *reg; -int x, y; +inside_region(NhRegion* reg, int x, int y) { int i; @@ -78,9 +74,7 @@ int x, y; * Create a region. It does not activate it. */ NhRegion * -create_region(rects, nrect) -NhRect *rects; -int nrect; +create_region(NhRect* rects, int nrect) { int i; NhRegion *reg; @@ -134,9 +128,7 @@ int nrect; * Add rectangle to region. */ void -add_rect_to_reg(reg, rect) -NhRegion *reg; -NhRect *rect; +add_rect_to_reg(NhRegion* reg, NhRect* rect) { NhRect *tmp_rect; @@ -164,9 +156,7 @@ NhRect *rect; * Add a monster to the region */ void -add_mon_to_reg(reg, mon) -NhRegion *reg; -struct monst *mon; +add_mon_to_reg(NhRegion* reg, struct monst* mon) { int i; unsigned *tmp_m; @@ -189,9 +179,7 @@ struct monst *mon; * Remove a monster from the region list (it left or died...) */ void -remove_mon_from_reg(reg, mon) -NhRegion *reg; -struct monst *mon; +remove_mon_from_reg(NhRegion* reg, struct monst* mon) { register int i; @@ -209,9 +197,7 @@ struct monst *mon; * than to check for coordinates. */ boolean -mon_in_region(reg, mon) -NhRegion *reg; -struct monst *mon; +mon_in_region(NhRegion* reg, struct monst* mon) { int i; @@ -262,8 +248,7 @@ NhRegion *reg; * Free mem from region. */ void -free_region(reg) -NhRegion *reg; +free_region(NhRegion* reg) { if (reg) { if (reg->rects) @@ -283,8 +268,7 @@ NhRegion *reg; * This actually activates the region. */ void -add_region(reg) -NhRegion *reg; +add_region(NhRegion* reg) { NhRegion **tmp_reg; int i, j; @@ -327,8 +311,7 @@ NhRegion *reg; * Remove a region from the list & free it. */ void -remove_region(reg) -NhRegion *reg; +remove_region(NhRegion* reg) { register int i, x, y; @@ -363,7 +346,7 @@ NhRegion *reg; * when changing level, for instance). */ void -clear_regions() +clear_regions(void) { register int i; @@ -382,7 +365,7 @@ clear_regions() * callbacks when needed. */ void -run_regions() +run_regions(void) { register int i, j, k; int f_indx; @@ -429,8 +412,7 @@ run_regions() * check whether player enters/leaves one or more regions. */ boolean -in_out_region(x, y) -xchar x, y; +in_out_region(xchar x, xchar y) { int i, f_indx = 0; @@ -483,9 +465,7 @@ xchar x, y; * check whether a monster enters/leaves one or more regions. */ boolean -m_in_out_region(mon, x, y) -struct monst *mon; -xchar x, y; +m_in_out_region(struct monst* mon, xchar x, xchar y) { int i, f_indx = 0; @@ -534,7 +514,7 @@ xchar x, y; * Checks player's regions after a teleport for instance. */ void -update_player_regions() +update_player_regions(void) { register int i; @@ -550,8 +530,7 @@ update_player_regions() * Ditto for a specified monster. */ void -update_monster_region(mon) -struct monst *mon; +update_monster_region(struct monst* mon) { register int i; @@ -591,8 +570,7 @@ struct monst *monold, *monnew; * Remove monster from all regions it was in (ie monster just died) */ void -remove_mon_from_regions(mon) -struct monst *mon; +remove_mon_from_regions(struct monst* mon) { register int i; @@ -608,8 +586,7 @@ struct monst *mon; * Returns NULL if not, otherwise returns region. */ NhRegion * -visible_region_at(x, y) -xchar x, y; +visible_region_at(xchar x, xchar y) { register int i; @@ -623,9 +600,7 @@ xchar x, y; } void -show_region(reg, x, y) -NhRegion *reg; -xchar x, y; +show_region(NhRegion* reg, xchar x, xchar y) { show_glyph(x, y, reg->glyph); } @@ -634,8 +609,7 @@ xchar x, y; * save_regions : */ void -save_regions(nhfp) -NHFILE *nhfp; +save_regions(NHFILE* nhfp) { int i, j; unsigned n; @@ -710,8 +684,7 @@ NHFILE *nhfp; } void -rest_regions(nhfp) -NHFILE *nhfp; +rest_regions(NHFILE* nhfp) { int i, j; unsigned n = 0; @@ -831,10 +804,7 @@ NHFILE *nhfp; /* to support '#stats' wizard-mode command */ void -region_stats(hdrfmt, hdrbuf, count, size) -const char *hdrfmt; -char *hdrbuf; -long *count, *size; +region_stats(const char* hdrfmt, char* hdrbuf, long* count, long* size) { NhRegion *rg; int i; @@ -857,8 +827,7 @@ long *count, *size; /* update monster IDs for region being loaded from bones; `ghostly' implied */ static void -reset_region_mids(reg) -NhRegion *reg; +reset_region_mids(NhRegion* reg) { int i = 0, n = reg->n_monst; unsigned *mid_list = reg->monsters; @@ -885,11 +854,9 @@ NhRegion *reg; *--------------------------------------------------------------*/ NhRegion * -create_msg_region(x, y, w, h, msg_enter, msg_leave) -xchar x, y; -xchar w, h; -const char *msg_enter; -const char *msg_leave; +create_msg_region( + xchar x, xchar y, xchar w, xchar h, + const char* msg_enter, const char* msg_leave) { NhRect tmprect; NhRegion *reg = create_region((NhRect *) 0, 0); @@ -915,9 +882,7 @@ const char *msg_leave; *--------------------------------------------------------------*/ boolean -enter_force_field(p1, p2) -genericptr_t p1; -genericptr_t p2; +enter_force_field(genericptr_t p1, genericptr_t p2) { struct monst *mtmp; @@ -937,10 +902,7 @@ genericptr_t p2; } NhRegion * -create_force_field(x, y, radius, ttl) -xchar x, y; -int radius; -long ttl; +create_force_field(xchar x, xchar y, int radius, long ttl) { int i; NhRegion *ff; @@ -983,9 +945,7 @@ long ttl; */ /*ARGSUSED*/ boolean -expire_gas_cloud(p1, p2) -genericptr_t p1; -genericptr_t p2 UNUSED; +expire_gas_cloud(genericptr_t p1, genericptr_t p2 UNUSED) { NhRegion *reg; int damage; @@ -1006,9 +966,7 @@ genericptr_t p2 UNUSED; /* returns True if p2 is killed by region p1, False otherwise */ boolean -inside_gas_cloud(p1, p2) -genericptr_t p1; -genericptr_t p2; +inside_gas_cloud(genericptr_t p1, genericptr_t p2) { NhRegion *reg = (NhRegion *) p1; struct monst *mtmp = (struct monst *) p2; @@ -1072,10 +1030,7 @@ genericptr_t p2; } NhRegion * -create_gas_cloud(x, y, radius, damage) -xchar x, y; -int radius; -int damage; +create_gas_cloud(xchar x, xchar y, int radius, int damage) { NhRegion *cloud; int i, nrect; @@ -1109,7 +1064,7 @@ int damage; /* for checking troubles during prayer; is hero at risk? */ boolean -region_danger() +region_danger(void) { int i, f_indx, n = 0; @@ -1136,7 +1091,7 @@ region_danger() /* for fixing trouble at end of prayer; danger detected at start of prayer might have expired by now */ void -region_safety() +region_safety(void) { NhRegion *r = 0; int i, f_indx, n = 0; diff --git a/src/restore.c b/src/restore.c index ec4eaa7f5..896384f12 100644 --- a/src/restore.c +++ b/src/restore.c @@ -12,32 +12,32 @@ extern int dotrow; /* shared with save */ #endif #ifdef USE_TILES -extern void FDECL(substitute_tiles, (d_level *)); /* from tile.c */ +extern void substitute_tiles(d_level *); /* from tile.c */ #endif #ifdef ZEROCOMP -static void NDECL(zerocomp_minit); -static void FDECL(zerocomp_mread, (int, genericptr_t, unsigned int)); -static int NDECL(zerocomp_mgetc); +static void zerocomp_minit(void); +static void zerocomp_mread(int, genericptr_t, unsigned int); +static int zerocomp_mgetc(void); #endif -static void NDECL(find_lev_obj); -static void FDECL(restlevchn, (NHFILE *)); -static void FDECL(restdamage, (NHFILE *)); -static void FDECL(restobj, (NHFILE *, struct obj *)); -static struct obj *FDECL(restobjchn, (NHFILE *, BOOLEAN_P)); -static void FDECL(restmon, (NHFILE *, struct monst *)); -static struct monst *FDECL(restmonchn, (NHFILE *)); -static struct fruit *FDECL(loadfruitchn, (NHFILE *)); -static void FDECL(freefruitchn, (struct fruit *)); -static void FDECL(ghostfruit, (struct obj *)); -static boolean FDECL(restgamestate, (NHFILE *, unsigned int *, unsigned int *)); -static void FDECL(restlevelstate, (unsigned int, unsigned int)); -static int FDECL(restlevelfile, (XCHAR_P)); -static void FDECL(restore_msghistory, (NHFILE *)); -static void FDECL(reset_oattached_mids, (BOOLEAN_P)); -static void FDECL(rest_levl, (NHFILE *, BOOLEAN_P)); -static void FDECL(rest_stairs, (NHFILE *)); +static void find_lev_obj(void); +static void restlevchn(NHFILE *); +static void restdamage(NHFILE *); +static void restobj(NHFILE *, struct obj *); +static struct obj *restobjchn(NHFILE *, boolean); +static void restmon(NHFILE *, struct monst *); +static struct monst *restmonchn(NHFILE *); +static struct fruit *loadfruitchn(NHFILE *); +static void freefruitchn(struct fruit *); +static void ghostfruit(struct obj *); +static boolean restgamestate(NHFILE *, unsigned int *, unsigned int *); +static void restlevelstate(unsigned int, unsigned int); +static int restlevelfile(xchar); +static void restore_msghistory(NHFILE *); +static void reset_oattached_mids(boolean); +static void rest_levl(NHFILE *, boolean); +static void rest_stairs(NHFILE *); /* * Save a mapping of IDs from ghost levels to the current level. This @@ -52,11 +52,11 @@ struct bucket { } map[N_PER_BUCKET]; }; -static void NDECL(clear_id_mapping); -static void FDECL(add_id_mapping, (unsigned, unsigned)); +static void clear_id_mapping(void); +static void add_id_mapping(unsigned, unsigned); #ifdef AMII_GRAPHICS -void FDECL(amii_setpens, (int)); /* use colors from save file */ +void amii_setpens(int); /* use colors from save file */ extern int amii_numcolors; #endif @@ -66,7 +66,7 @@ extern int amii_numcolors; /* Recalculate g.level.objects[x][y], since this info was not saved. */ static void -find_lev_obj() +find_lev_obj(void) { register struct obj *fobjtmp = (struct obj *) 0; register struct obj *otmp; @@ -100,8 +100,7 @@ find_lev_obj() * infamous "HUP" cheat) get used up here. */ void -inven_inuse(quietly) -boolean quietly; +inven_inuse(boolean quietly) { register struct obj *otmp, *otmp2; @@ -116,8 +115,7 @@ boolean quietly; } static void -restlevchn(nhfp) -NHFILE *nhfp; +restlevchn(NHFILE* nhfp) { int cnt = 0; s_level *tmplev, *x; @@ -143,8 +141,7 @@ NHFILE *nhfp; } static void -restdamage(nhfp) -NHFILE *nhfp; +restdamage(NHFILE* nhfp) { unsigned int dmgcount = 0; int counter; @@ -193,9 +190,7 @@ NHFILE *nhfp; /* restore one object */ static void -restobj(nhfp, otmp) -NHFILE *nhfp; -struct obj *otmp; +restobj(NHFILE* nhfp, struct obj *otmp) { int buflen = 0; @@ -250,9 +245,7 @@ struct obj *otmp; } static struct obj * -restobjchn(nhfp, frozen) -NHFILE *nhfp; -boolean frozen; +restobjchn(NHFILE* nhfp, boolean frozen) { register struct obj *otmp, *otmp2 = 0; register struct obj *first = (struct obj *) 0; @@ -319,9 +312,7 @@ boolean frozen; /* restore one monster */ static void -restmon(nhfp, mtmp) -NHFILE *nhfp; -struct monst *mtmp; +restmon(NHFILE* nhfp, struct monst* mtmp) { int buflen = 0; @@ -391,8 +382,7 @@ struct monst *mtmp; } static struct monst * -restmonchn(nhfp) -NHFILE *nhfp; +restmonchn(NHFILE* nhfp) { register struct monst *mtmp, *mtmp2 = 0; register struct monst *first = (struct monst *) 0; @@ -466,8 +456,7 @@ NHFILE *nhfp; } static struct fruit * -loadfruitchn(nhfp) -NHFILE *nhfp; +loadfruitchn(NHFILE* nhfp) { register struct fruit *flist, *fnext; @@ -487,8 +476,7 @@ NHFILE *nhfp; } static void -freefruitchn(flist) -register struct fruit *flist; +freefruitchn(register struct fruit* flist) { register struct fruit *fnext; @@ -500,8 +488,7 @@ register struct fruit *flist; } static void -ghostfruit(otmp) -register struct obj *otmp; +ghostfruit(register struct obj* otmp) { register struct fruit *oldf; @@ -523,9 +510,7 @@ register struct obj *otmp; static boolean -restgamestate(nhfp, stuckid, steedid) -NHFILE *nhfp; -unsigned int *stuckid, *steedid; +restgamestate(NHFILE* nhfp, unsigned int* stuckid, unsigned int* steedid) { struct flag newgameflags; struct context_info newgamecontext; /* all 0, but has some pointers */ @@ -718,8 +703,7 @@ unsigned int *stuckid, *steedid; * don't dereference a wild u.ustuck when saving the game state, for instance) */ static void -restlevelstate(stuckid, steedid) -unsigned int stuckid, steedid; +restlevelstate(unsigned int stuckid, unsigned int steedid) { register struct monst *mtmp; @@ -744,8 +728,7 @@ unsigned int stuckid, steedid; /*ARGSUSED*/ static int -restlevelfile(ltmp) -xchar ltmp; +restlevelfile(xchar ltmp) { char whynot[BUFSZ]; NHFILE *nhfp = (NHFILE *) 0; @@ -764,8 +747,7 @@ xchar ltmp; } int -dorecover(nhfp) -NHFILE *nhfp; +dorecover(NHFILE* nhfp) { unsigned int stuckid = 0, steedid = 0; /* not a register */ xchar ltmp = 0; @@ -907,8 +889,7 @@ NHFILE *nhfp; } static void -rest_stairs(nhfp) -NHFILE *nhfp; +rest_stairs(NHFILE* nhfp) { int buflen = 0; stairway stway = UNDEFINED_VALUES; @@ -938,9 +919,7 @@ NHFILE *nhfp; } void -restcemetery(nhfp, cemeteryaddr) -NHFILE *nhfp; -struct cemetery **cemeteryaddr; +restcemetery(NHFILE* nhfp, struct cemetery** cemeteryaddr) { struct cemetery *bonesinfo, **bonesaddr; int cflag = 0; @@ -963,13 +942,14 @@ struct cemetery **cemeteryaddr; /*ARGSUSED*/ static void -rest_levl(nhfp, rlecomp) -NHFILE *nhfp; +rest_levl( + NHFILE *nhfp, #ifdef RLECOMP -boolean rlecomp; + boolean rlecomp #else -boolean rlecomp UNUSED; + boolean rlecomp UNUSED #endif +) { #ifdef RLECOMP short i, j; @@ -1006,8 +986,7 @@ boolean rlecomp UNUSED; } void -trickery(reason) -char *reason; +trickery(char *reason) { pline("Strange, this map is not as I remember it."); pline("Somebody is trying some trickery here..."); @@ -1017,10 +996,7 @@ char *reason; } void -getlev(nhfp, pid, lev) -NHFILE *nhfp; -int pid; -xchar lev; +getlev(NHFILE* nhfp, int pid, xchar lev) { register struct trap *trap; register struct monst *mtmp; @@ -1239,9 +1215,7 @@ xchar lev; } void -get_plname_from_file(nhfp, plbuf) -NHFILE *nhfp; -char *plbuf; +get_plname_from_file(NHFILE* nhfp, char *plbuf) { int pltmpsiz = 0; @@ -1253,8 +1227,7 @@ char *plbuf; } static void -restore_msghistory(nhfp) -NHFILE *nhfp; +restore_msghistory(NHFILE* nhfp) { int msgsize = 0, msgcount = 0; char msg[BUFSZ]; @@ -1279,7 +1252,7 @@ NHFILE *nhfp; /* Clear all structures for object and monster ID mapping. */ static void -clear_id_mapping() +clear_id_mapping(void) { struct bucket *curr; @@ -1292,8 +1265,7 @@ clear_id_mapping() /* Add a mapping to the ID map. */ static void -add_id_mapping(gid, nid) -unsigned gid, nid; +add_id_mapping(unsigned int gid, unsigned int nid) { int idx; @@ -1317,8 +1289,7 @@ unsigned gid, nid; * ID. */ boolean -lookup_id_mapping(gid, nidp) -unsigned gid, *nidp; +lookup_id_mapping(unsigned int gid, unsigned int *nidp) { int i; struct bucket *curr; @@ -1344,8 +1315,7 @@ unsigned gid, *nidp; } static void -reset_oattached_mids(ghostly) -boolean ghostly; +reset_oattached_mids(boolean ghostly) { struct obj *otmp; unsigned oldid, nid; @@ -1371,8 +1341,8 @@ boolean ghostly; /* put up a menu listing each character from this player's saved games; returns 1: use g.plname[], 0: new game, -1: quit */ int -restore_menu(bannerwin) -winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */ +restore_menu( + winid bannerwin) /* if not WIN_ERR, clear window and show copyright in menu */ { winid tmpwin; anything any; @@ -1439,9 +1409,7 @@ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */ #endif /* SELECTSAVED */ int -validate(nhfp, name) -NHFILE *nhfp; -const char *name; +validate(NHFILE* nhfp, const char *name) { int rlen = 0; struct savefile_info sfi; diff --git a/src/rip.c b/src/rip.c index 634d816d2..259a0d09d 100644 --- a/src/rip.c +++ b/src/rip.c @@ -17,7 +17,7 @@ #endif #ifdef TEXT_TOMBSTONE -static void FDECL(center, (int, char *)); +static void center(int, char *); #ifndef NH320_DEDICATION /* A normal tombstone for end of game display. */ @@ -69,9 +69,7 @@ static const char *rip_txt[] = { #define YEAR_LINE 12 /* *char[] line # for year */ static void -center(line, text) -int line; -char *text; +center(int line, char *text) { register char *ip, *op; ip = text; @@ -81,10 +79,7 @@ char *text; } void -genl_outrip(tmpwin, how, when) -winid tmpwin; -int how; -time_t when; +genl_outrip(winid tmpwin, int how, time_t when) { register char **dp; register char *dpx; diff --git a/src/rnd.c b/src/rnd.c index 6b5d46006..e02754b8f 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -7,14 +7,14 @@ #ifdef USE_ISAAC64 #include "isaac64.h" -static int FDECL(whichrng, (int FDECL((*fn), (int)))); +static int whichrng(int (*fn)(int)); #if 0 static isaac64_ctx rng_state; #endif struct rnglist_t { - int FDECL((*fn), (int)); + int (*fn)(int); boolean init; isaac64_ctx rng_state; }; @@ -27,8 +27,7 @@ static struct rnglist_t rnglist[] = { }; int -whichrng(fn) -int FDECL((*fn), (int)); +whichrng(int (*fn)(int)) { int i; @@ -39,9 +38,7 @@ int FDECL((*fn), (int)); } void -init_isaac64(seed, fn) -unsigned long seed; -int FDECL((*fn), (int)); +init_isaac64(unsigned long seed, int (*fn)(int)) { unsigned char new_rng_state[sizeof seed]; unsigned i; @@ -68,8 +65,7 @@ RND(int x) used in cases where the answer doesn't affect gameplay and we don't want to give users easy control over the main RNG sequence. */ int -rn2_on_display_rng(x) -register int x; +rn2_on_display_rng(register int x) { return (isaac64_next_uint64(&rnglist[DISP].rng_state) % x); } @@ -78,7 +74,7 @@ register int x; /* "Rand()"s definition is determined by [OS]conf.h */ #if defined(LINT) && defined(UNIX) /* rand() is long... */ -extern int NDECL(rand); +extern int rand(void); #define RND(x) (rand() % x) #else /* LINT */ #if defined(UNIX) || defined(RANDOM) @@ -89,8 +85,7 @@ extern int NDECL(rand); #endif #endif /* LINT */ int -rn2_on_display_rng(x) -register int x; +rn2_on_display_rng(register int x) { static unsigned seed = 1; seed *= 2739110765; @@ -100,8 +95,7 @@ register int x; /* 0 <= rn2(x) < x */ int -rn2(x) -register int x; +rn2(register int x) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (x <= 0) { @@ -118,8 +112,7 @@ register int x; /* 0 <= rnl(x) < x; sometimes subtracting Luck; good luck approaches 0, bad luck approaches (x-1) */ int -rnl(x) -register int x; +rnl(register int x) { register int i, adjustment; @@ -162,8 +155,7 @@ register int x; /* 1 <= rnd(x) <= x */ int -rnd(x) -register int x; +rnd(register int x) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (x <= 0) { @@ -177,8 +169,7 @@ register int x; /* d(N,X) == NdX == dX+dX+...+dX N times; n <= d(n,x) <= (n*x) */ int -d(n, x) -register int n, x; +d(register int n, register int x) { register int tmp = n; @@ -195,8 +186,7 @@ register int n, x; /* 1 <= rne(x) <= max(u.ulevel/3,5) */ int -rne(x) -register int x; +rne(register int x) { register int tmp, utmp; @@ -218,8 +208,7 @@ register int x; /* rnz: everyone's favorite! */ int -rnz(i) -int i; +rnz(int i) { #ifdef LINT int x = i; diff --git a/src/role.c b/src/role.c index 5072ce7f1..0a75c959c 100644 --- a/src/role.c +++ b/src/role.c @@ -714,24 +714,22 @@ const struct Align aligns[] = { { "evil", "unaligned", "Una", 0, A_NONE } }; -static int NDECL(randrole_filtered); -static char *FDECL(promptsep, (char *, int)); -static int FDECL(role_gendercount, (int)); -static int FDECL(race_alignmentcount, (int)); +static int randrole_filtered(void); +static char *promptsep(char *, int); +static int role_gendercount(int); +static int race_alignmentcount(int); /* used by str2XXX() */ static char NEARDATA randomstr[] = "random"; boolean -validrole(rolenum) -int rolenum; +validrole(int rolenum) { return (boolean) (rolenum >= 0 && rolenum < SIZE(roles) - 1); } int -randrole(for_display) -boolean for_display; +randrole(boolean for_display) { int res = SIZE(roles) - 1; @@ -743,7 +741,7 @@ boolean for_display; } static int -randrole_filtered() +randrole_filtered(void) { int i, n = 0, set[SIZE(roles)]; @@ -759,8 +757,7 @@ randrole_filtered() } int -str2role(str) -const char *str; +str2role(const char *str) { int i, len; @@ -791,8 +788,7 @@ const char *str; } boolean -validrace(rolenum, racenum) -int rolenum, racenum; +validrace(int rolenum, int racenum) { /* Assumes validrole */ return (boolean) (racenum >= 0 && racenum < SIZE(races) - 1 @@ -801,8 +797,7 @@ int rolenum, racenum; } int -randrace(rolenum) -int rolenum; +randrace(int rolenum) { int i, n = 0; @@ -828,8 +823,7 @@ int rolenum; } int -str2race(str) -const char *str; +str2race(const char *str) { int i, len; @@ -857,8 +851,7 @@ const char *str; } boolean -validgend(rolenum, racenum, gendnum) -int rolenum, racenum, gendnum; +validgend(int rolenum, int racenum, int gendnum) { /* Assumes validrole and validrace */ return (boolean) (gendnum >= 0 && gendnum < ROLE_GENDERS @@ -867,8 +860,7 @@ int rolenum, racenum, gendnum; } int -randgend(rolenum, racenum) -int rolenum, racenum; +randgend(int rolenum, int racenum) { int i, n = 0; @@ -895,8 +887,7 @@ int rolenum, racenum; } int -str2gend(str) -const char *str; +str2gend(const char *str) { int i, len; @@ -923,8 +914,7 @@ const char *str; } boolean -validalign(rolenum, racenum, alignnum) -int rolenum, racenum, alignnum; +validalign(int rolenum, int racenum, int alignnum) { /* Assumes validrole and validrace */ return (boolean) (alignnum >= 0 && alignnum < ROLE_ALIGNS @@ -933,8 +923,7 @@ int rolenum, racenum, alignnum; } int -randalign(rolenum, racenum) -int rolenum, racenum; +randalign(int rolenum, int racenum) { int i, n = 0; @@ -961,8 +950,7 @@ int rolenum, racenum; } int -str2align(str) -const char *str; +str2align(const char *str) { int i, len; @@ -990,8 +978,7 @@ const char *str; /* is rolenum compatible with any racenum/gendnum/alignnum constraints? */ boolean -ok_role(rolenum, racenum, gendnum, alignnum) -int rolenum, racenum, gendnum, alignnum; +ok_role(int rolenum, int racenum, int gendnum, int alignnum) { int i; short allow; @@ -1035,8 +1022,7 @@ int rolenum, racenum, gendnum, alignnum; /* If pickhow == PICK_RIGID a role is returned only if there is */ /* a single possibility */ int -pick_role(racenum, gendnum, alignnum, pickhow) -int racenum, gendnum, alignnum, pickhow; +pick_role(int racenum, int gendnum, int alignnum, int pickhow) { int i; int roles_ok = 0, set[SIZE(roles)]; @@ -1058,8 +1044,7 @@ int racenum, gendnum, alignnum, pickhow; /* is racenum compatible with any rolenum/gendnum/alignnum constraints? */ boolean -ok_race(rolenum, racenum, gendnum, alignnum) -int rolenum, racenum, gendnum, alignnum; +ok_race(int rolenum, int racenum, int gendnum, int alignnum) { int i; short allow; @@ -1103,8 +1088,7 @@ int rolenum, racenum, gendnum, alignnum; If pickhow == PICK_RIGID a race is returned only if there is a single possibility. */ int -pick_race(rolenum, gendnum, alignnum, pickhow) -int rolenum, gendnum, alignnum, pickhow; +pick_race(int rolenum, int gendnum, int alignnum, int pickhow) { int i; int races_ok = 0; @@ -1130,9 +1114,7 @@ int rolenum, gendnum, alignnum, pickhow; /* is gendnum compatible with any rolenum/racenum/alignnum constraints? */ /* gender and alignment are not comparable (and also not constrainable) */ boolean -ok_gend(rolenum, racenum, gendnum, alignnum) -int rolenum, racenum, gendnum; -int alignnum UNUSED; +ok_gend(int rolenum, int racenum, int gendnum, int alignnum UNUSED) { int i; short allow; @@ -1171,8 +1153,7 @@ int alignnum UNUSED; /* If pickhow == PICK_RIGID a gender is returned only if there is */ /* a single possibility */ int -pick_gend(rolenum, racenum, alignnum, pickhow) -int rolenum, racenum, alignnum, pickhow; +pick_gend(int rolenum, int racenum, int alignnum, int pickhow) { int i; int gends_ok = 0; @@ -1198,10 +1179,7 @@ int rolenum, racenum, alignnum, pickhow; /* is alignnum compatible with any rolenum/racenum/gendnum constraints? */ /* alignment and gender are not comparable (and also not constrainable) */ boolean -ok_align(rolenum, racenum, gendnum, alignnum) -int rolenum, racenum; -int gendnum UNUSED; -int alignnum; +ok_align(int rolenum, int racenum, int gendnum UNUSED, int alignnum) { int i; short allow; @@ -1240,8 +1218,7 @@ int alignnum; If pickhow == PICK_RIGID an alignment is returned only if there is a single possibility. */ int -pick_align(rolenum, racenum, gendnum, pickhow) -int rolenum, racenum, gendnum, pickhow; +pick_align(int rolenum, int racenum, int gendnum, int pickhow) { int i; int aligns_ok = 0; @@ -1265,7 +1242,7 @@ int rolenum, racenum, gendnum, pickhow; } void -rigid_role_checks() +rigid_role_checks(void) { int tmp; @@ -1314,8 +1291,7 @@ rigid_role_checks() } boolean -setrolefilter(bufp) -const char *bufp; +setrolefilter(const char *bufp) { int i; boolean reslt = TRUE; @@ -1334,7 +1310,7 @@ const char *bufp; } boolean -gotrolefilter() +gotrolefilter(void) { int i; @@ -1347,7 +1323,7 @@ gotrolefilter() } void -clearrolefilter() +clearrolefilter(void) { int i; @@ -1357,9 +1333,7 @@ clearrolefilter() } static char * -promptsep(buf, num_post_attribs) -char *buf; -int num_post_attribs; +promptsep(char *buf, int num_post_attribs) { const char *conjuct = "and "; @@ -1374,8 +1348,7 @@ int num_post_attribs; } static int -role_gendercount(rolenum) -int rolenum; +role_gendercount(int rolenum) { int gendcount = 0; @@ -1391,8 +1364,7 @@ int rolenum; } static int -race_alignmentcount(racenum) -int racenum; +race_alignmentcount(int racenum) { int aligncount = 0; @@ -1408,10 +1380,9 @@ int racenum; } char * -root_plselection_prompt(suppliedbuf, buflen, rolenum, racenum, gendnum, - alignnum) -char *suppliedbuf; -int buflen, rolenum, racenum, gendnum, alignnum; +root_plselection_prompt( + char *suppliedbuf, int buflen, + int rolenum, int racenum, int gendnum, int alignnum) { int k, gendercount = 0, aligncount = 0; char buf[BUFSZ]; @@ -1559,9 +1530,9 @@ int buflen, rolenum, racenum, gendnum, alignnum; } char * -build_plselection_prompt(buf, buflen, rolenum, racenum, gendnum, alignnum) -char *buf; -int buflen, rolenum, racenum, gendnum, alignnum; +build_plselection_prompt( + char *buf, int buflen, + int rolenum, int racenum, int gendnum, int alignnum) { const char *defprompt = "Shall I pick a character for you? [ynaq] "; int num_post_attribs = 0; @@ -1641,7 +1612,7 @@ int buflen, rolenum, racenum, gendnum, alignnum; #undef NUM_BP void -plnamesuffix() +plnamesuffix(void) { char *sptr, *eptr; int i; @@ -1696,9 +1667,7 @@ plnamesuffix() /* show current settings for name, role, race, gender, and alignment in the specified window */ void -role_selection_prolog(which, where) -int which; -winid where; +role_selection_prolog(int which, winid where) { static const char NEARDATA choosing[] = " choosing now", not_yet[] = " not yet specified", @@ -1785,10 +1754,7 @@ winid where; /* add a "pick alignment first"-type entry to the specified menu */ void -role_menu_extra(which, where, preselect) -int which; -winid where; -boolean preselect; +role_menu_extra(int which, winid where, boolean preselect) { static NEARDATA const char RS_menu_let[] = { '=', /* name */ @@ -1952,7 +1918,7 @@ boolean preselect; * This code also replaces quest_init(). */ void -role_init() +role_init(void) { int alignmnt; struct permonst *pm; @@ -2091,8 +2057,7 @@ role_init() } const char * -Hello(mtmp) -struct monst *mtmp; +Hello(struct monst* mtmp) { switch (Role_switch) { case PM_KNIGHT: @@ -2115,7 +2080,7 @@ struct monst *mtmp; } const char * -Goodbye() +Goodbye(void) { switch (Role_switch) { case PM_KNIGHT: diff --git a/src/rumors.c b/src/rumors.c index 1f720bb4a..a41447981 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -40,14 +40,13 @@ * and placed there by 'makedefs'. */ -static void FDECL(init_rumors, (dlb *)); -static void FDECL(init_oracles, (dlb *)); -static void FDECL(others_check, (const char *ftype, const char *, winid *)); -static void FDECL(couldnt_open_file, (const char *)); +static void init_rumors(dlb *); +static void init_oracles(dlb *); +static void others_check(const char *ftype, const char *, winid *); +static void couldnt_open_file(const char *); static void -init_rumors(fp) -dlb *fp; +init_rumors(dlb* fp) { static const char rumors_header[] = "%d,%ld,%lx;%d,%ld,%lx;0,0,%lx\n"; int true_count, false_count; /* in file but not used here */ @@ -77,10 +76,10 @@ dlb *fp; * of them contain such references anyway. */ char * -getrumor(truth, rumor_buf, exclude_cookie) -int truth; /* 1=true, -1=false, 0=either */ -char *rumor_buf; -boolean exclude_cookie; +getrumor( + int truth, /* 1=true, -1=false, 0=either */ + char *rumor_buf, + boolean exclude_cookie) { dlb *rumors; long tidbit, beginning; @@ -170,7 +169,7 @@ boolean exclude_cookie; /* test that the true/false rumor boundaries are valid and show the first two and very last epitaphs, engravings, and bogus monsters */ void -rumor_check() +rumor_check(void) { dlb *rumors = 0; winid tmpwin = WIN_ERR; @@ -275,9 +274,7 @@ rumor_check() /* 3.7: augments rumors_check(); test 'engrave' or 'epitaph' or 'bogusmon' */ static void -others_check(ftype, fname, winptr) -const char *ftype, *fname; -winid *winptr; +others_check(const char* ftype, const char* fname, winid* winptr) { static const char errfmt[] = "others_check(\"%s\"): %s"; dlb *fh; @@ -379,10 +376,7 @@ winid *winptr; /* Gets a random line of text from file 'fname', and returns it. rng is the random number generator to use, and should act like rn2 does. */ char * -get_rnd_text(fname, buf, rng) -const char *fname; -char *buf; -int FDECL((*rng), (int)); +get_rnd_text(const char* fname, char* buf, int (*rng)(int)) { dlb *fh; @@ -426,9 +420,9 @@ int FDECL((*rng), (int)); } void -outrumor(truth, mechanism) -int truth; /* 1=true, -1=false, 0=either */ -int mechanism; +outrumor( + int truth, /* 1=true, -1=false, 0=either */ + int mechanism) { static const char fortune_msg[] = "This cookie has a scrap of paper inside."; @@ -471,8 +465,7 @@ int mechanism; } static void -init_oracles(fp) -dlb *fp; +init_oracles(dlb* fp) { register int i; char line[BUFSZ]; @@ -493,8 +486,7 @@ dlb *fp; } void -save_oracles(nhfp) -NHFILE *nhfp; +save_oracles(NHFILE* nhfp) { if (perform_bwrite(nhfp)) { if (nhfp->structlevel) @@ -516,8 +508,7 @@ NHFILE *nhfp; } void -restore_oracles(nhfp) -NHFILE *nhfp; +restore_oracles(NHFILE* nhfp) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt); @@ -533,9 +524,7 @@ NHFILE *nhfp; } void -outoracle(special, delphi) -boolean special; -boolean delphi; +outoracle(boolean special, boolean delphi) { winid tmpwin; dlb *oracles; @@ -591,8 +580,7 @@ boolean delphi; } int -doconsult(oracl) -struct monst *oracl; +doconsult(struct monst* oracl) { long umoney; int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel; @@ -666,8 +654,7 @@ struct monst *oracl; } static void -couldnt_open_file(filename) -const char *filename; +couldnt_open_file(const char *filename) { int save_something = g.program_state.something_worth_saving; diff --git a/src/save.c b/src/save.c index fe6001bbf..0153d4018 100644 --- a/src/save.c +++ b/src/save.c @@ -20,24 +20,24 @@ int dotcnt, dotrow; /* also used in restore */ #endif -static void FDECL(savelevchn, (NHFILE *)); -static void FDECL(savelevl, (NHFILE *,BOOLEAN_P)); -static void FDECL(savedamage, (NHFILE *)); -static void FDECL(save_stairs, (NHFILE *)); -static void FDECL(saveobj, (NHFILE *,struct obj *)); -static void FDECL(saveobjchn, (NHFILE *,struct obj **)); -static void FDECL(savemon, (NHFILE *,struct monst *)); -static void FDECL(savemonchn, (NHFILE *,struct monst *)); -static void FDECL(savetrapchn, (NHFILE *,struct trap *)); -static void FDECL(savegamestate, (NHFILE *)); -static void FDECL(save_msghistory, (NHFILE *)); +static void savelevchn(NHFILE *); +static void savelevl(NHFILE *,boolean); +static void savedamage(NHFILE *); +static void save_stairs(NHFILE *); +static void saveobj(NHFILE *,struct obj *); +static void saveobjchn(NHFILE *,struct obj **); +static void savemon(NHFILE *,struct monst *); +static void savemonchn(NHFILE *,struct monst *); +static void savetrapchn(NHFILE *,struct trap *); +static void savegamestate(NHFILE *); +static void save_msghistory(NHFILE *); #ifdef ZEROCOMP -static void FDECL(zerocomp_bufon, (int)); -static void FDECL(zerocomp_bufoff, (int)); -static void FDECL(zerocomp_bflush, (int)); -static void FDECL(zerocomp_bwrite, (int, genericptr_t, unsigned int)); -static void FDECL(zerocomp_bputc, (int)); +static void zerocomp_bufon(int); +static void zerocomp_bufoff(int); +static void zerocomp_bflush(int); +static void zerocomp_bwrite(int, genericptr_t, unsigned int); +static void zerocomp_bputc(int); #endif #if defined(UNIX) || defined(VMS) || defined(__EMX__) || defined(WIN32) @@ -47,7 +47,7 @@ static void FDECL(zerocomp_bputc, (int)); #endif int -dosave() +dosave(void) { if (iflags.debug_fuzzer) return 0; @@ -76,7 +76,7 @@ dosave() /* returns 1 if save successful */ int -dosave0() +dosave0(void) { const char *fq_save; xchar ltmp; @@ -103,7 +103,7 @@ dosave0() fq_save = fqname(g.SAVEF, SAVEPREFIX, 1); /* level files take 0 */ #ifndef NO_SIGNAL #if defined(UNIX) || defined(VMS) - sethanguphandler((void FDECL((*), (int) )) SIG_IGN); + sethanguphandler((void (*)(int) ) SIG_IGN); #endif (void) signal(SIGINT, SIG_IGN); #endif @@ -233,8 +233,7 @@ dosave0() } static void -savegamestate(nhfp) -NHFILE *nhfp; +savegamestate(NHFILE* nhfp) { unsigned long uid; struct obj *bc_objs = (struct obj *)0; @@ -327,9 +326,7 @@ NHFILE *nhfp; /* potentially called from goto_level(do.c) as well as savestateinlock() */ boolean -tricked_fileremoved(nhfp, whynot) -NHFILE *nhfp; -char *whynot; +tricked_fileremoved(NHFILE* nhfp, char* whynot) { if (!nhfp) { pline1(whynot); @@ -343,7 +340,7 @@ char *whynot; #ifdef INSURANCE void -savestateinlock() +savestateinlock(void) { int hpid = 0; char whynot[BUFSZ]; @@ -425,9 +422,7 @@ savestateinlock() #endif void -savelev(nhfp, lev) -NHFILE *nhfp; -xchar lev; +savelev(NHFILE* nhfp, xchar lev) { #ifdef TOS short tlev; @@ -542,9 +537,7 @@ xchar lev; } static void -savelevl(nhfp, rlecomp) -NHFILE *nhfp; -boolean rlecomp; +savelevl(NHFILE* nhfp, boolean rlecomp) { #ifdef RLECOMP struct rm *prm, *rgrm; @@ -605,9 +598,7 @@ boolean rlecomp; /* used when saving a level and also when saving dungeon overview data */ void -savecemetery(nhfp, cemeteryaddr) -NHFILE *nhfp; -struct cemetery **cemeteryaddr; +savecemetery(NHFILE* nhfp, struct cemetery** cemeteryaddr) { struct cemetery *thisbones, *nextbones; int flag; @@ -632,8 +623,7 @@ struct cemetery **cemeteryaddr; } static void -savedamage(nhfp) -NHFILE *nhfp; +savedamage(NHFILE* nhfp) { register struct damage *damageptr, *tmp_dam; unsigned int xl = 0; @@ -660,8 +650,7 @@ NHFILE *nhfp; } static void -save_stairs(nhfp) -NHFILE *nhfp; +save_stairs(NHFILE* nhfp) { stairway *stway = g.stairs; int buflen = (int) sizeof *stway; @@ -694,9 +683,7 @@ NHFILE *nhfp; /* save one object; caveat: this is only for perform_bwrite(); caller handles release_data() */ static void -saveobj(nhfp, otmp) -NHFILE *nhfp; -struct obj *otmp; +saveobj(NHFILE* nhfp, struct obj* otmp) { int buflen, zerobuf = 0; @@ -740,9 +727,7 @@ struct obj *otmp; /* save an object chain; sets head of list to Null when done; handles release_data() for each object in the list */ static void -saveobjchn(nhfp, obj_p) -NHFILE *nhfp; -struct obj **obj_p; +saveobjchn(NHFILE* nhfp, struct obj** obj_p) { register struct obj *otmp = *obj_p; struct obj *otmp2; @@ -800,9 +785,7 @@ struct obj **obj_p; } static void -savemon(nhfp, mtmp) -NHFILE *nhfp; -struct monst *mtmp; +savemon(NHFILE* nhfp, struct monst* mtmp) { int buflen; @@ -865,9 +848,7 @@ struct monst *mtmp; } static void -savemonchn(nhfp, mtmp) -NHFILE *nhfp; -register struct monst *mtmp; +savemonchn(NHFILE* nhfp, register struct monst* mtmp) { register struct monst *mtmp2; int minusone = -1; @@ -900,9 +881,7 @@ register struct monst *mtmp; /* save traps; g.ftrap is the only trap chain so the 2nd arg is superfluous */ static void -savetrapchn(nhfp, trap) -NHFILE *nhfp; -register struct trap *trap; +savetrapchn(NHFILE* nhfp, register struct trap* trap) { static struct trap zerotrap; register struct trap *trap2; @@ -929,8 +908,7 @@ register struct trap *trap; * level routine marks nonexistent fruits by making the fid negative. */ void -savefruitchn(nhfp) -NHFILE *nhfp; +savefruitchn(NHFILE* nhfp) { static struct fruit zerofruit; register struct fruit *f2, *f1; @@ -957,8 +935,7 @@ NHFILE *nhfp; static void -savelevchn(nhfp) -NHFILE *nhfp; +savelevchn(NHFILE* nhfp) { s_level *tmplev, *tmplev2; int cnt = 0; @@ -983,8 +960,7 @@ NHFILE *nhfp; } void -store_plname_in_file(nhfp) -NHFILE *nhfp; +store_plname_in_file(NHFILE* nhfp) { int plsiztmp = PL_NSIZ; @@ -999,8 +975,7 @@ NHFILE *nhfp; } static void -save_msghistory(nhfp) -NHFILE *nhfp; +save_msghistory(NHFILE* nhfp) { char *msg; int msgcount = 0, msglen; @@ -1032,8 +1007,7 @@ NHFILE *nhfp; } void -store_savefileinfo(nhfp) -NHFILE *nhfp; +store_savefileinfo(NHFILE* nhfp) { /* sfcap (decl.c) describes the savefile feature capabilities * that are supported by this port/platform build. @@ -1058,7 +1032,7 @@ NHFILE *nhfp; /* also called by prscore(); this probably belongs in dungeon.c... */ void -free_dungeons() +free_dungeons(void) { #ifdef FREE_ALL_MEMORY NHFILE tnhfp; @@ -1073,7 +1047,7 @@ free_dungeons() } void -freedynamicdata() +freedynamicdata(void) { NHFILE tnhfp; diff --git a/src/sfstruct.c b/src/sfstruct.c index d33841cea..8c882c861 100644 --- a/src/sfstruct.c +++ b/src/sfstruct.c @@ -32,16 +32,16 @@ #ifdef minit #undef minit #endif -void FDECL(newread, (NHFILE *, int, int, genericptr_t, unsigned int)); -void FDECL(bufon, (int)); -void FDECL(bufoff, (int)); -void FDECL(bflush, (int)); -void FDECL(bwrite, (int, genericptr_t, unsigned int)); -void FDECL(mread, (int, genericptr_t, unsigned int)); -void NDECL(minit); -void FDECL(bclose, (int)); +void newread(NHFILE *, int, int, genericptr_t, unsigned int); +void bufon(int); +void bufoff(int); +void bflush(int); +void bwrite(int, genericptr_t, unsigned int); +void mread(int, genericptr_t, unsigned int); +void minit(void); +void bclose(int); #endif /* TRACE_BUFFERING */ -static int FDECL(getidx, (int, int)); +static int getidx(int, int); #if defined(UNIX) || defined(WIN32) #define USE_BUFFERING @@ -98,8 +98,7 @@ static FILE *bw_FILE[MAXFD] = {0,0,0,0,0}; */ static int -getidx(fd, flg) -int fd, flg; +getidx(int fd, int flg) { int i, retval = -1; @@ -119,8 +118,7 @@ int fd, flg; /* Let caller know that bclose() should handle it (TRUE) */ boolean -close_check(fd) -int fd; +close_check(int fd) { int idx = getidx(fd, NOSLOT); boolean retval = FALSE; @@ -131,8 +129,7 @@ int fd; } void -bufon(fd) -int fd; +bufon(int fd) { int idx = getidx(fd, NOFLG); @@ -153,8 +150,7 @@ int fd; } void -bufoff(fd) -int fd; +bufoff(int fd) { int idx = getidx(fd, NOFLG); @@ -165,8 +161,7 @@ int fd; } void -bclose(fd) -int fd; +bclose(int fd) { int idx = getidx(fd, NOSLOT); @@ -186,8 +181,7 @@ int fd; } void -bflush(fd) -int fd; +bflush(int fd) { int idx = getidx(fd, NOFLG); @@ -203,10 +197,7 @@ int fd; } void -bwrite(fd, loc, num) -register int fd; -register genericptr_t loc; -register unsigned num; +bwrite(register int fd, register genericptr_t loc, register unsigned num) { boolean failed; int idx = getidx(fd, NOFLG); @@ -240,16 +231,13 @@ register unsigned num; /* ===================================================== */ void -minit() +minit(void) { return; } void -mread(fd, buf, len) -register int fd; -register genericptr_t buf; -register unsigned int len; +mread(register int fd, register genericptr_t buf, register unsigned int len) { register int rlen; #if defined(BSD) || defined(ULTRIX) @@ -286,73 +274,59 @@ static FILE *tracefile; fclose(tracefile); void -Bufon(fd, fncname, linenum) -int fd; -const char *fncname; -int linenum; +Bufon(int fd, const char *fncname, int linenum) { TRACE(fd); bufon(fd); } void -Bufoff(fd, fncname, linenum) -int fd; -const char *fncname; -int linenum; +Bufoff(int fd, const char *fncname, int linenum) { TRACE(fd); bufoff(fd); } void -Bflush(fd, fncname, linenum) -int fd; -const char *fncname; -int linenum; +Bflush(int fd, const char* fncname, int linenum) { TRACE(fd); bflush(fd); } void -Bwrite(fd, loc, num, fncname, linenum) -register int fd; -register genericptr_t loc; -register unsigned num; -const char *fncname; -int linenum; +Bwrite( + register int fd, + register genericptr_t loc, + register unsigned num, + const char *fncname, + int linenum) { TRACE(fd); bwrite(fd, loc, num); } void -Bclose(fd, fncname, linenum) -int fd; -const char *fncname; -int linenum; +Bclose(int fd, const char *fncname, int linenum) { TRACE(fd); bclose(fd); } void -Minit(fncname, linenum) -const char *fncname; -int linenum; +Minit(const char*fncname, int linenum) { TRACE(-1); minit(); } void -Mread(fd, buf, len, fncname, linenum) -register int fd; -register genericptr_t buf; -register unsigned int len; -const char *fncname; -int linenum; +Mread( + register int fd, + register genericptr_t buf, + register unsigned int len, + const char *fncname, + int linenum) { TRACE(fd); mread(fd, buf, len); diff --git a/src/shk.c b/src/shk.c index fd47041e6..0e7efbd58 100644 --- a/src/shk.c +++ b/src/shk.c @@ -11,9 +11,9 @@ #define PAY_SKIP (-1) #define PAY_BROKE (-2) -static void FDECL(makekops, (coord *)); -static void FDECL(call_kops, (struct monst *, BOOLEAN_P)); -static void FDECL(kops_gone, (BOOLEAN_P)); +static void makekops(coord *); +static void call_kops(struct monst *, boolean); +static void kops_gone(boolean); #define NOTANGRY(mon) ((mon)->mpeaceful) #define ANGRY(mon) (!NOTANGRY(mon)) @@ -28,53 +28,47 @@ extern const struct shclass shtypes[]; /* defined in shknam.c */ static const char and_its_contents[] = " and its contents"; static const char the_contents_of[] = "the contents of "; -static void FDECL(append_honorific, (char *)); -static long FDECL(addupbill, (struct monst *)); -static void FDECL(pacify_shk, (struct monst *)); -static struct bill_x *FDECL(onbill, (struct obj *, struct monst *, - BOOLEAN_P)); -static struct monst *FDECL(next_shkp, (struct monst *, BOOLEAN_P)); -static long FDECL(shop_debt, (struct eshk *)); -static char *FDECL(shk_owns, (char *, struct obj *)); -static char *FDECL(mon_owns, (char *, struct obj *)); -static void FDECL(clear_unpaid_obj, (struct monst *, struct obj *)); -static void FDECL(clear_unpaid, (struct monst *, struct obj *)); -static long FDECL(check_credit, (long, struct monst *)); -static void FDECL(pay, (long, struct monst *)); -static long FDECL(get_cost, (struct obj *, struct monst *)); -static long FDECL(set_cost, (struct obj *, struct monst *)); -static const char *FDECL(shk_embellish, (struct obj *, long)); -static long FDECL(cost_per_charge, (struct monst *, struct obj *, - BOOLEAN_P)); -static long FDECL(cheapest_item, (struct monst *)); -static int FDECL(dopayobj, (struct monst *, struct bill_x *, - struct obj **, int, BOOLEAN_P)); -static long FDECL(stolen_container, (struct obj *, struct monst *, - long, BOOLEAN_P)); -static long FDECL(getprice, (struct obj *, BOOLEAN_P)); -static void FDECL(shk_names_obj, (struct monst *, struct obj *, - const char *, long, const char *)); -static boolean FDECL(inherits, (struct monst *, int, int, BOOLEAN_P)); -static void FDECL(set_repo_loc, (struct monst *)); -static struct obj *FDECL(bp_to_obj, (struct bill_x *)); -static long FDECL(get_pricing_units, (struct obj *)); -static boolean NDECL(angry_shk_exists); -static void FDECL(rile_shk, (struct monst *)); -static void FDECL(rouse_shk, (struct monst *, BOOLEAN_P)); -static void FDECL(remove_damage, (struct monst *, BOOLEAN_P)); -static void FDECL(sub_one_frombill, (struct obj *, struct monst *)); -static void FDECL(add_one_tobill, (struct obj *, BOOLEAN_P, - struct monst *)); -static void FDECL(dropped_container, (struct obj *, struct monst *, - BOOLEAN_P)); -static void FDECL(add_to_billobjs, (struct obj *)); -static void FDECL(bill_box_content, (struct obj *, BOOLEAN_P, BOOLEAN_P, - struct monst *)); -static boolean FDECL(rob_shop, (struct monst *)); -static void FDECL(deserted_shop, (char *)); -static boolean FDECL(special_stock, (struct obj *, struct monst *, - BOOLEAN_P)); -static const char *FDECL(cad, (BOOLEAN_P)); +static void append_honorific(char *); +static long addupbill(struct monst *); +static void pacify_shk(struct monst *); +static struct bill_x *onbill(struct obj *, struct monst *, boolean); +static struct monst *next_shkp(struct monst *, boolean); +static long shop_debt(struct eshk *); +static char *shk_owns(char *, struct obj *); +static char *mon_owns(char *, struct obj *); +static void clear_unpaid_obj(struct monst *, struct obj *); +static void clear_unpaid(struct monst *, struct obj *); +static long check_credit(long, struct monst *); +static void pay(long, struct monst *); +static long get_cost(struct obj *, struct monst *); +static long set_cost(struct obj *, struct monst *); +static const char *shk_embellish(struct obj *, long); +static long cost_per_charge(struct monst *, struct obj *, boolean); +static long cheapest_item(struct monst *); +static int dopayobj(struct monst *, struct bill_x *, struct obj **, int, + boolean); +static long stolen_container(struct obj *, struct monst *, long, boolean); +static long getprice(struct obj *, boolean); +static void shk_names_obj(struct monst *, struct obj *, const char *, long, + const char *); +static boolean inherits(struct monst *, int, int, boolean); +static void set_repo_loc(struct monst *); +static struct obj *bp_to_obj(struct bill_x *); +static long get_pricing_units(struct obj *); +static boolean angry_shk_exists(void); +static void rile_shk(struct monst *); +static void rouse_shk(struct monst *, boolean); +static void remove_damage(struct monst *, boolean); +static void sub_one_frombill(struct obj *, struct monst *); +static void add_one_tobill(struct obj *, boolean, struct monst *); +static void dropped_container(struct obj *, struct monst *, boolean); +static void add_to_billobjs(struct obj *); +static void bill_box_content(struct obj *, boolean, boolean, + struct monst *); +static boolean rob_shop(struct monst *); +static void deserted_shop(char *); +static boolean special_stock(struct obj *, struct monst *, boolean); +static const char *cad(boolean); /* invariants: obj->unpaid iff onbill(obj) [unless bp->useup] @@ -97,9 +91,7 @@ static const char *angrytexts[] = { "quite upset", "ticked off", "furious" }; * if the monster kept the change. */ long -money2mon(mon, amount) -struct monst *mon; -long amount; +money2mon(struct monst* mon, long amount) { struct obj *ygold = findgold(g.invent); @@ -128,9 +120,7 @@ long amount; * the priest gives you money for an ale. */ void -money2u(mon, amount) -struct monst *mon; -long amount; +money2u(struct monst* mon, long amount) { struct obj *mongold = findgold(mon->minvent); @@ -158,9 +148,7 @@ long amount; } static struct monst * -next_shkp(shkp, withbill) -register struct monst *shkp; -register boolean withbill; +next_shkp(register struct monst* shkp, register boolean withbill) { for (; shkp; shkp = shkp->nmon) { if (DEADMONSTER(shkp)) @@ -183,8 +171,7 @@ register boolean withbill; /* called in mon.c */ void -shkgone(mtmp) -struct monst *mtmp; +shkgone(struct monst* mtmp) { struct eshk *eshk = ESHK(mtmp); struct mkroom *sroom = &g.rooms[eshk->shoproom - ROOMOFFSET]; @@ -221,9 +208,7 @@ struct monst *mtmp; } void -set_residency(shkp, zero_out) -register struct monst *shkp; -register boolean zero_out; +set_residency(register struct monst* shkp, register boolean zero_out) { if (on_level(&(ESHK(shkp)->shoplevel), &u.uz)) g.rooms[ESHK(shkp)->shoproom - ROOMOFFSET].resident = @@ -231,8 +216,7 @@ register boolean zero_out; } void -replshk(mtmp, mtmp2) -register struct monst *mtmp, *mtmp2; +replshk(register struct monst* mtmp, register struct monst* mtmp2) { g.rooms[ESHK(mtmp2)->shoproom - ROOMOFFSET].resident = mtmp2; if (inhishop(mtmp) && *u.ushops == ESHK(mtmp)->shoproom) { @@ -242,9 +226,7 @@ register struct monst *mtmp, *mtmp2; /* do shopkeeper specific structure munging -dlc */ void -restshk(shkp, ghostly) -struct monst *shkp; -boolean ghostly; +restshk(struct monst* shkp, boolean ghostly) { if (u.uz.dlevel) { struct eshk *eshkp = ESHK(shkp); @@ -263,9 +245,7 @@ boolean ghostly; /* Clear the unpaid bit on a single object and its contents. */ static void -clear_unpaid_obj(shkp, otmp) -struct monst *shkp; -struct obj *otmp; +clear_unpaid_obj(struct monst* shkp, struct obj* otmp) { if (Has_contents(otmp)) clear_unpaid(shkp, otmp->cobj); @@ -275,9 +255,7 @@ struct obj *otmp; /* Clear the unpaid bit on all of the objects in the list. */ static void -clear_unpaid(shkp, list) -struct monst *shkp; -struct obj *list; +clear_unpaid(struct monst* shkp, struct obj* list) { while (list) { clear_unpaid_obj(shkp, list); @@ -287,8 +265,7 @@ struct obj *list; /* either you paid or left the shop or the shopkeeper died */ void -setpaid(shkp) -register struct monst *shkp; +setpaid(register struct monst* shkp) { register struct obj *obj; register struct monst *mtmp; @@ -318,8 +295,7 @@ register struct monst *shkp; } static long -addupbill(shkp) -register struct monst *shkp; +addupbill(register struct monst* shkp) { register int ct = ESHK(shkp)->billct; register struct bill_x *bp = ESHK(shkp)->bill_p; @@ -333,9 +309,7 @@ register struct monst *shkp; } static void -call_kops(shkp, nearshop) -register struct monst *shkp; -register boolean nearshop; +call_kops(register struct monst* shkp, register boolean nearshop) { /* Keystone Kops srt@ucla */ register boolean nokops; @@ -394,8 +368,7 @@ register boolean nearshop; /* x,y is strictly inside shop */ char -inside_shop(x, y) -register xchar x, y; +inside_shop(register xchar x, register xchar y) { register char rno; @@ -406,9 +379,7 @@ register xchar x, y; } void -u_left_shop(leavestring, newlev) -char *leavestring; -boolean newlev; +u_left_shop(char* leavestring, boolean newlev) { struct monst *shkp; struct eshk *eshkp; @@ -455,8 +426,7 @@ boolean newlev; /* robbery from outside the shop via telekinesis or grappling hook */ void -remote_burglary(x, y) -xchar x, y; +remote_burglary(xchar x, xchar y) { struct monst *shkp; struct eshk *eshkp; @@ -478,8 +448,7 @@ xchar x, y; /* shop merchandise has been taken; pay for it with any credit available; return false if the debt is fully covered by credit, true otherwise */ static boolean -rob_shop(shkp) -struct monst *shkp; +rob_shop(struct monst* shkp) { struct eshk *eshkp; long total; @@ -511,8 +480,7 @@ struct monst *shkp; /* give a message when entering an untended shop (caller has verified that) */ static void -deserted_shop(enterstring) -/*const*/ char *enterstring; +deserted_shop(/*const*/ char* enterstring) { struct monst *mtmp; struct mkroom *r = &g.rooms[(int) *enterstring - ROOMOFFSET]; @@ -539,8 +507,7 @@ deserted_shop(enterstring) } void -u_entered_shop(enterstring) -char *enterstring; +u_entered_shop(char* enterstring) { register int rt; register struct monst *shkp; @@ -688,8 +655,7 @@ char *enterstring; /* called when removing a pick-axe or mattock from a container */ void -pick_pick(obj) -struct obj *obj; +pick_pick(struct obj* obj) { struct monst *shkp; @@ -721,8 +687,7 @@ struct obj *obj; quoted by the shopkeeper and also that they both belong to the same shk. */ boolean -same_price(obj1, obj2) -struct obj *obj1, *obj2; +same_price(struct obj* obj1, struct obj* obj2) { register struct monst *shkp1, *shkp2; struct bill_x *bp1 = 0, *bp2 = 0; @@ -757,8 +722,7 @@ struct obj *obj1, *obj2; * level is bones data which has a shk on the warpath. */ static long -shop_debt(eshkp) -struct eshk *eshkp; +shop_debt(struct eshk* eshkp) { struct bill_x *bp; int ct; @@ -771,7 +735,7 @@ struct eshk *eshkp; /* called in response to the `$' command */ void -shopper_financial_report() +shopper_financial_report(void) { struct monst *shkp, *this_shkp = shop_keeper(inside_shop(u.ux, u.uy)); struct eshk *eshkp; @@ -806,8 +770,7 @@ shopper_financial_report() } int -inhishop(mtmp) -register struct monst *mtmp; +inhishop(register struct monst* mtmp) { struct eshk *eshkp = ESHK(mtmp); @@ -816,8 +779,7 @@ register struct monst *mtmp; } struct monst * -shop_keeper(rmno) -char rmno; +shop_keeper(char rmno) { struct monst *shkp; @@ -850,8 +812,7 @@ char rmno; } boolean -tended_shop(sroom) -struct mkroom *sroom; +tended_shop(struct mkroom* sroom) { struct monst *mtmp = sroom->resident; @@ -859,10 +820,7 @@ struct mkroom *sroom; } static struct bill_x * -onbill(obj, shkp, silent) -struct obj *obj; -struct monst *shkp; -boolean silent; +onbill(struct obj* obj, struct monst* shkp, boolean silent) { if (shkp) { register struct bill_x *bp = ESHK(shkp)->bill_p; @@ -883,8 +841,7 @@ boolean silent; /* check whether an object or any of its contents belongs to a shop */ boolean -is_unpaid(obj) -struct obj *obj; +is_unpaid(struct obj* obj) { return (boolean) (obj->unpaid || (Has_contents(obj) && count_unpaid(obj->cobj))); @@ -892,8 +849,7 @@ struct obj *obj; /* Delete the contents of the given object. */ void -delete_contents(obj) -register struct obj *obj; +delete_contents(register struct obj* obj) { register struct obj *curr; @@ -905,8 +861,7 @@ register struct obj *obj; /* called with two args on merge */ void -obfree(obj, merge) -register struct obj *obj, *merge; +obfree(register struct obj* obj, register struct obj* merge) { register struct bill_x *bp; register struct bill_x *bpm; @@ -997,9 +952,7 @@ register struct obj *obj, *merge; } static long -check_credit(tmp, shkp) -long tmp; -register struct monst *shkp; +check_credit(long tmp, register struct monst* shkp) { long credit = ESHK(shkp)->credit; @@ -1018,9 +971,7 @@ register struct monst *shkp; } static void -pay(tmp, shkp) -long tmp; -register struct monst *shkp; +pay(long tmp, register struct monst* shkp) { long robbed = ESHK(shkp)->robbed; long balance = ((tmp <= 0L) ? tmp : check_credit(tmp, shkp)); @@ -1040,9 +991,7 @@ register struct monst *shkp; /* return shkp to home position */ void -home_shk(shkp, killkops) -register struct monst *shkp; -register boolean killkops; +home_shk(register struct monst* shkp, register boolean killkops) { register xchar x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y; @@ -1056,7 +1005,7 @@ register boolean killkops; } static boolean -angry_shk_exists() +angry_shk_exists(void) { register struct monst *shkp; @@ -1069,8 +1018,7 @@ angry_shk_exists() /* remove previously applied surcharge from all billed items */ static void -pacify_shk(shkp) -register struct monst *shkp; +pacify_shk(register struct monst* shkp) { NOTANGRY(shkp) = TRUE; /* make peaceful */ if (ESHK(shkp)->surcharge) { @@ -1088,8 +1036,7 @@ register struct monst *shkp; /* add aggravation surcharge to all billed items */ static void -rile_shk(shkp) -register struct monst *shkp; +rile_shk(register struct monst* shkp) { NOTANGRY(shkp) = FALSE; /* make angry */ if (!ESHK(shkp)->surcharge) { @@ -1107,9 +1054,7 @@ register struct monst *shkp; /* wakeup and/or unparalyze shopkeeper */ static void -rouse_shk(shkp, verbosely) -struct monst *shkp; -boolean verbosely; +rouse_shk(struct monst* shkp, boolean verbosely) { if (!shkp->mcanmove || shkp->msleeping) { /* greed induced recovery... */ @@ -1123,9 +1068,7 @@ boolean verbosely; } void -make_happy_shk(shkp, silentkops) -register struct monst *shkp; -register boolean silentkops; +make_happy_shk(register struct monst* shkp, register boolean silentkops) { boolean wasmad = ANGRY(shkp); struct eshk *eshkp = ESHK(shkp); @@ -1168,8 +1111,7 @@ register boolean silentkops; /* called by make_happy_shk() and also by losedogs() for migrating shk */ void -make_happy_shoppers(silentkops) -boolean silentkops; +make_happy_shoppers(boolean silentkops) { if (!angry_shk_exists()) { kops_gone(silentkops); @@ -1178,8 +1120,7 @@ boolean silentkops; } void -hot_pursuit(shkp) -register struct monst *shkp; +hot_pursuit(register struct monst* shkp) { if (!shkp->isshk) return; @@ -1194,10 +1135,8 @@ register struct monst *shkp; the shop. These conditions must be checked by the calling function. */ /*ARGSUSED*/ void -make_angry_shk(shkp, ox, oy) -struct monst *shkp; -xchar ox UNUSED; /* predate 'noit_Monnam()', let alone Shknam() */ -xchar oy UNUSED; +make_angry_shk(struct monst* shkp, xchar ox UNUSED, xchar oy UNUSED) +/* predate 'noit_Monnam()', let alone Shknam() */ { struct eshk *eshkp = ESHK(shkp); @@ -1221,8 +1160,7 @@ static const char /* delivers the cheapest item on the list */ static long -cheapest_item(shkp) -register struct monst *shkp; +cheapest_item(register struct monst* shkp) { register int ct = ESHK(shkp)->billct; register struct bill_x *bp = ESHK(shkp)->bill_p; @@ -1237,7 +1175,7 @@ register struct monst *shkp; } int -dopay() +dopay(void) { register struct eshk *eshkp; register struct monst *shkp; @@ -1584,12 +1522,13 @@ dopay() * -2 if no money/credit left */ static int -dopayobj(shkp, bp, obj_p, which, itemize) -register struct monst *shkp; -register struct bill_x *bp; -struct obj **obj_p; -int which; /* 0 => used-up item, 1 => other (unpaid or lost) */ -boolean itemize; +dopayobj( + register struct monst* shkp, + register struct bill_x* bp, + struct obj** obj_p, + int which /* 0 => used-up item, 1 => other (unpaid or lost) */, + boolean itemize) + { register struct obj *obj = *obj_p; long ltmp, quan, save_quan; @@ -1695,9 +1634,9 @@ boolean itemize; /* routine called after dying (or quitting) */ boolean -paybill(croaked, silently) -int croaked; /* -1: escaped dungeon; 0: quit; 1: died */ -boolean silently; /* maybe avoid messages */ +paybill( + int croaked, /* -1: escaped dungeon; 0: quit; 1: died */ + boolean silently) /* maybe avoid messages */ { struct monst *mtmp, *mtmp2, *firstshk, *resident, *creditor, *hostile, *localshk; @@ -1783,11 +1722,7 @@ boolean silently; /* maybe avoid messages */ } static boolean -inherits(shkp, numsk, croaked, silently) -struct monst *shkp; -int numsk; -int croaked; -boolean silently; +inherits(struct monst* shkp, int numsk, int croaked, boolean silently) { long loss = 0L; long umoney; @@ -1889,8 +1824,7 @@ boolean silently; } static void -set_repo_loc(shkp) -struct monst *shkp; +set_repo_loc(struct monst* shkp) { register xchar ox, oy; struct eshk *eshkp = ESHK(shkp); @@ -1919,7 +1853,7 @@ struct monst *shkp; /* called at game exit, after inventory disclosure but before making bones; shouldn't issue any messages */ void -finish_paybill() +finish_paybill(void) { struct monst *shkp = g.repo.shopkeeper; int ox = g.repo.location.x, oy = g.repo.location.y; @@ -1943,8 +1877,7 @@ finish_paybill() /* find obj on one of the lists */ static struct obj * -bp_to_obj(bp) -register struct bill_x *bp; +bp_to_obj(register struct bill_x* bp) { register struct obj *obj; register unsigned int id = bp->bo_id; @@ -1962,8 +1895,7 @@ register struct bill_x *bp; * be any timeouts on the g.billobjs chain. */ struct obj * -find_oid(id) -unsigned id; +find_oid(unsigned int id) { struct obj *obj; struct monst *mon, *mmtmp[3]; @@ -1995,9 +1927,8 @@ unsigned id; /* Returns the price of an arbitrary item in the shop, 0 if the item doesn't belong to a shopkeeper or hero is not in the shop. */ long -get_cost_of_shop_item(obj, nochrg) -register struct obj *obj; -int *nochrg; /* alternate return value: 1: no charge, 0: shop owned, */ +get_cost_of_shop_item(register struct obj* obj, int* nochrg) + /* alternate return value: 1: no charge, 0: shop owned, */ { /* -1: not in a shop (so should't be formatted as "no charge") */ struct monst *shkp; struct obj *top; @@ -2031,8 +1962,7 @@ int *nochrg; /* alternate return value: 1: no charge, 0: shop owned, */ } static long -get_pricing_units(obj) -struct obj *obj; +get_pricing_units(struct obj* obj) { long units = obj->quan; @@ -2050,9 +1980,7 @@ struct obj *obj; /* decide whether to apply a surcharge (or hypothetically, a discount) to obj if it had ID number 'oid'; returns 1: increase, 0: normal, -1: decrease */ int -oid_price_adjustment(obj, oid) -struct obj *obj; -unsigned oid; +oid_price_adjustment(struct obj* obj, unsigned int oid) { int res = 0, otyp = obj->otyp; @@ -2065,9 +1993,9 @@ unsigned oid; /* calculate the value that the shk will charge for [one of] an object */ static long -get_cost(obj, shkp) -register struct obj *obj; -register struct monst *shkp; /* if angry, impose a surcharge */ +get_cost( + register struct obj* obj, + register struct monst* shkp) /* if angry, impose a surcharge */ { long tmp = getprice(obj, FALSE), /* used to perform a single calculation even when multiple @@ -2176,12 +2104,12 @@ register struct monst *shkp; /* if angry, impose a surcharge */ * a different price quoted for selling as vs. buying. */ long -contained_cost(obj, shkp, price, usell, unpaid_only) -struct obj *obj; -struct monst *shkp; -long price; -boolean usell; -boolean unpaid_only; +contained_cost( + struct obj *obj, + struct monst *shkp, + long price, + boolean usell, + boolean unpaid_only) { register struct obj *otmp, *top; xchar x, y; @@ -2227,9 +2155,9 @@ boolean unpaid_only; /* count amount of gold inside container 'obj' and any nested containers */ long -contained_gold(obj, even_if_unknown) -struct obj *obj; -boolean even_if_unknown; /* True: all gold; False: limit to known contents */ +contained_gold( + struct obj *obj, + boolean even_if_unknown) /* True: all gold; False: limit to known contents */ { register struct obj *otmp; register long value = 0L; @@ -2245,10 +2173,10 @@ boolean even_if_unknown; /* True: all gold; False: limit to known contents */ } static void -dropped_container(obj, shkp, sale) -register struct obj *obj; -register struct monst *shkp; -register boolean sale; +dropped_container( + register struct obj *obj, + register struct monst *shkp, + register boolean sale) { register struct obj *otmp; @@ -2266,8 +2194,7 @@ register boolean sale; } void -picked_container(obj) -register struct obj *obj; +picked_container(register struct obj* obj) { register struct obj *otmp; @@ -2285,10 +2212,10 @@ register struct obj *obj; } static boolean -special_stock(obj, shkp, quietly) -struct obj *obj; -struct monst *shkp; -boolean quietly; +special_stock( + struct obj *obj, + struct monst *shkp, + boolean quietly) { /* for unique situations */ if (ESHK(shkp)->shoptype == CANDLESHOP @@ -2325,9 +2252,7 @@ boolean quietly; /* calculate how much the shk will pay when buying [all of] an object */ static long -set_cost(obj, shkp) -register struct obj *obj; -register struct monst *shkp; +set_cost(register struct obj* obj, register struct monst* shkp) { long tmp, unit_price = getprice(obj, TRUE), multiplier = 1L, divisor = 1L; @@ -2376,8 +2301,7 @@ register struct monst *shkp; /* unlike alter_cost() which operates on a specific item, identifying or forgetting a gem causes all unpaid gems of its type to change value */ void -gem_learned(oindx) -int oindx; +gem_learned(int oindx) { struct obj *obj; struct monst *shkp; @@ -2416,10 +2340,10 @@ int oindx; on any shop bill, update that bill to reflect the new higher price [if the new price drops for some reason, keep the old one in place] */ void -alter_cost(obj, amt) -struct obj *obj; -long amt; /* if 0, use regular shop pricing, otherwise force amount; - if negative, use abs(amt) even if it's less than old cost */ +alter_cost( + struct obj* obj, + long amt) /* if 0, use regular shop pricing, otherwise force amount; + if negative, use abs(amt) even if it's less than old cost */ { struct bill_x *bp = 0; struct monst *shkp; @@ -2439,9 +2363,9 @@ long amt; /* if 0, use regular shop pricing, otherwise force amount; /* called from doinv(invent.c) for inventory of unpaid objects */ long -unpaid_cost(unp_obj, include_contents) -struct obj *unp_obj; /* known to be unpaid or contain unpaid */ -boolean include_contents; +unpaid_cost( + struct obj *unp_obj, /* known to be unpaid or contain unpaid */ + boolean include_contents) { struct bill_x *bp = (struct bill_x *) 0; struct monst *shkp; @@ -2473,10 +2397,7 @@ boolean include_contents; } static void -add_one_tobill(obj, dummy, shkp) -struct obj *obj; -boolean dummy; -struct monst *shkp; +add_one_tobill(struct obj* obj, boolean dummy, struct monst* shkp) { struct eshk *eshkp; struct bill_x *bp; @@ -2515,8 +2436,7 @@ struct monst *shkp; } static void -add_to_billobjs(obj) -struct obj *obj; +add_to_billobjs(struct obj* obj) { if (obj->where != OBJ_FREE) panic("add_to_billobjs: obj not free"); @@ -2530,10 +2450,11 @@ struct obj *obj; /* recursive billing of objects within containers. */ static void -bill_box_content(obj, ininv, dummy, shkp) -register struct obj *obj; -register boolean ininv, dummy; -register struct monst *shkp; +bill_box_content( + register struct obj *obj, + register boolean ininv, + register boolean dummy, + register struct monst *shkp) { register struct obj *otmp; @@ -2553,12 +2474,12 @@ register struct monst *shkp; /* shopkeeper tells you what you bought or sold, sometimes partly IDing it */ static void -shk_names_obj(shkp, obj, fmt, amt, arg) -struct monst *shkp; -struct obj *obj; -const char *fmt; /* "%s %ld %s %s", doname(obj), amt, plur(amt), arg */ -long amt; -const char *arg; +shk_names_obj( + struct monst *shkp, + struct obj *obj, + const char *fmt, /* "%s %ld %s %s", doname(obj), amt, plur(amt), arg */ + long amt, + const char *arg) { char *obj_name, fmtbuf[BUFSZ]; boolean was_unknown = !obj->dknown; @@ -2589,11 +2510,11 @@ const char *arg; /* decide whether a shopkeeper thinks an item belongs to her */ boolean -billable(shkpp, obj, roomno, reset_nocharge) -struct monst **shkpp; /* in: non-null if shk has been validated; out: shk */ -struct obj *obj; -char roomno; -boolean reset_nocharge; +billable( + struct monst **shkpp, /* in: non-null if shk has been validated; out: shk */ + struct obj *obj, + char roomno, + boolean reset_nocharge) { struct monst *shkp = *shkpp; @@ -2627,9 +2548,11 @@ boolean reset_nocharge; } void -addtobill(obj, ininv, dummy, silent) -struct obj *obj; -boolean ininv, dummy, silent; +addtobill( + struct obj *obj, + boolean ininv, + boolean dummy, + boolean silent) { struct monst *shkp = 0; long ltmp, cltmp, gltmp; @@ -2730,8 +2653,7 @@ boolean ininv, dummy, silent; } static void -append_honorific(buf) -char *buf; +append_honorific(char *buf) { /* (chooses among [0]..[3] normally; [1]..[4] after the Wizard has been killed or invocation ritual performed) */ @@ -2751,8 +2673,7 @@ char *buf; } void -splitbill(obj, otmp) -register struct obj *obj, *otmp; +splitbill(register struct obj* obj, register struct obj* otmp) { /* otmp has been split off from obj */ register struct bill_x *bp; @@ -2790,9 +2711,7 @@ register struct obj *obj, *otmp; } static void -sub_one_frombill(obj, shkp) -register struct obj *obj; -register struct monst *shkp; +sub_one_frombill(register struct obj* obj, register struct monst* shkp) { register struct bill_x *bp; @@ -2832,9 +2751,7 @@ register struct monst *shkp; /* recursive check of unpaid objects within nested containers. */ void -subfrombill(obj, shkp) -register struct obj *obj; -register struct monst *shkp; +subfrombill(register struct obj* obj, register struct monst* shkp) { register struct obj *otmp; @@ -2853,11 +2770,11 @@ register struct monst *shkp; } static long -stolen_container(obj, shkp, price, ininv) -struct obj *obj; -struct monst *shkp; -long price; -boolean ininv; +stolen_container( + struct obj *obj, + struct monst *shkp, + long price, + boolean ininv) { struct obj *otmp; struct bill_x *bp; @@ -2893,10 +2810,12 @@ boolean ininv; } long -stolen_value(obj, x, y, peaceful, silent) -struct obj *obj; -xchar x, y; -boolean peaceful, silent; +stolen_value( + struct obj *obj, + xchar x, + xchar y, + boolean peaceful, + boolean silent) { long value = 0L, gvalue = 0L, billamt = 0L; char roomno = *in_rooms(x, y, SHOPBASE); @@ -3006,10 +2925,10 @@ boolean peaceful, silent; /* opposite of costly_gold(); hero has dropped gold in a shop; called from sellobj(); ought to be called from subfrombill() too */ void -donate_gold(gltmp, shkp, selling) -long gltmp; -struct monst *shkp; -boolean selling; /* True: dropped in shop; False: kicked and landed in shop */ +donate_gold( + long gltmp, + struct monst *shkp, + boolean selling) /* True: dropped in shop; False: kicked and landed in shop */ { struct eshk *eshkp = ESHK(shkp); @@ -3042,8 +2961,7 @@ boolean selling; /* True: dropped in shop; False: kicked and landed in shop */ } void -sellobj_state(deliberate) -int deliberate; +sellobj_state(int deliberate) { /* If we're deliberately dropping something, there's no automatic response to the shopkeeper's "want to sell" query; however, if we @@ -3057,9 +2975,7 @@ int deliberate; } void -sellobj(obj, x, y) -register struct obj *obj; -xchar x, y; +sellobj(register struct obj* obj, xchar x, xchar y) { register struct monst *shkp; register struct eshk *eshkp; @@ -3318,8 +3234,8 @@ xchar x, y; } int -doinvbill(mode) -int mode; /* 0: deliver count 1: paged */ +doinvbill( + int mode) /* 0: deliver count 1: paged */ { #ifdef __SASC void sasc_bug(struct obj *, unsigned); @@ -3398,9 +3314,7 @@ int mode; /* 0: deliver count 1: paged */ } static long -getprice(obj, shk_buying) -register struct obj *obj; -boolean shk_buying; +getprice(register struct obj* obj, boolean shk_buying) { register long tmp = (long) objects[obj->otyp].oc_cost; @@ -3441,9 +3355,7 @@ boolean shk_buying; /* shk catches thrown pick-axe */ struct monst * -shkcatch(obj, x, y) -register struct obj *obj; -register xchar x, y; +shkcatch(register struct obj* obj, register xchar x, register xchar y) { register struct monst *shkp; @@ -3474,9 +3386,10 @@ register xchar x, y; } void -add_damage(x, y, cost) -register xchar x, y; -long cost; +add_damage( + register xchar x, + register xchar y, + long cost) { struct damage *tmp_dam; char *shops; @@ -3522,9 +3435,7 @@ long cost; */ static void -remove_damage(shkp, croaked) -struct monst *shkp; -boolean croaked; +remove_damage(struct monst* shkp, boolean croaked) { struct damage *tmp_dam, *tmp2_dam; struct obj *shk_inv = shkp->minvent; @@ -3660,11 +3571,11 @@ boolean croaked; * 3: untrap */ int -repair_damage(shkp, tmp_dam, once, catchup) -struct monst *shkp; -struct damage *tmp_dam; -int *once; -boolean catchup; /* restoring a level */ +repair_damage( + struct monst *shkp, + struct damage *tmp_dam, + int *once, + boolean catchup) /* restoring a level */ { xchar x, y; xchar litter[9]; @@ -3829,8 +3740,7 @@ boolean catchup; /* restoring a level */ * shk_move: return 1: moved 0: didn't -1: let m_move do it -2: died */ int -shk_move(shkp) -struct monst *shkp; +shk_move(struct monst* shkp) { xchar gx, gy, omx, omy; int udist; @@ -3943,8 +3853,7 @@ struct monst *shkp; /* called after shopkeeper moves, in case themove causes re-entry into shop */ void -after_shk_move(shkp) -struct monst *shkp; +after_shk_move(struct monst* shkp) { struct eshk *eshkp = ESHK(shkp); @@ -3957,16 +3866,14 @@ struct monst *shkp; /* for use in levl_follower (mondata.c) */ boolean -is_fshk(mtmp) -register struct monst *mtmp; +is_fshk(register struct monst* mtmp) { return (boolean) (mtmp->isshk && ESHK(mtmp)->following); } /* You are digging in the shop. */ void -shopdig(fall) -register int fall; +shopdig(register int fall) { register struct monst *shkp = shop_keeper(*u.ushops); int lang; @@ -4060,8 +3967,7 @@ register int fall; } static void -makekops(mm) -coord *mm; +makekops(coord* mm) { static const short k_mndx[4] = { PM_KEYSTONE_KOP, PM_KOP_SERGEANT, PM_KOP_LIEUTENANT, PM_KOP_KAPTAIN }; @@ -4086,9 +3992,7 @@ coord *mm; } void -pay_for_damage(dmgstr, cant_mollify) -const char *dmgstr; -boolean cant_mollify; +pay_for_damage(const char* dmgstr, boolean cant_mollify) { register struct monst *shkp = (struct monst *) 0; char shops_affected[5]; @@ -4268,8 +4172,7 @@ boolean cant_mollify; /* called in dokick.c when we kick an object that might be in a store */ boolean -costly_spot(x, y) -register xchar x, y; +costly_spot(register xchar x, register xchar y) { struct monst *shkp; struct eshk *eshkp; @@ -4287,8 +4190,7 @@ register xchar x, y; /* called by dotalk(sounds.c) when #chatting; returns obj if location contains shop goods and shopkeeper is willing & able to speak */ struct obj * -shop_object(x, y) -register xchar x, y; +shop_object(register xchar x, register xchar y) { register struct obj *otmp; register struct monst *shkp; @@ -4308,8 +4210,7 @@ register xchar x, y; /* give price quotes for all objects linked to this one (ie, on this spot) */ void -price_quote(first_obj) -register struct obj *first_obj; +price_quote(register struct obj* first_obj) { register struct obj *otmp; char buf[BUFSZ], price[40]; @@ -4363,9 +4264,7 @@ register struct obj *first_obj; } static const char * -shk_embellish(itm, cost) -register struct obj *itm; -long cost; +shk_embellish(register struct obj* itm, long cost) { if (!rn2(3)) { register int o, choice = rn2(5); @@ -4416,8 +4315,7 @@ const char *Izchak_speaks[] = { }; void -shk_chat(shkp) -struct monst *shkp; +shk_chat(struct monst* shkp) { struct eshk *eshk; long shkmoney; @@ -4492,8 +4390,7 @@ struct monst *shkp; } static void -kops_gone(silent) -boolean silent; +kops_gone(boolean silent) { int cnt = 0; struct monst *mtmp, *mtmp2; @@ -4514,10 +4411,10 @@ boolean silent; } static long -cost_per_charge(shkp, otmp, altusage) -struct monst *shkp; -struct obj *otmp; -boolean altusage; /* some items have an "alternate" use with different cost */ +cost_per_charge( + struct monst *shkp, + struct obj *otmp, + boolean altusage) /* some items have an "alternate" use with different cost */ { long tmp = 0L; @@ -4573,9 +4470,7 @@ boolean altusage; /* some items have an "alternate" use with different cost */ * when an object is completely used. */ void -check_unpaid_usage(otmp, altusage) -struct obj *otmp; -boolean altusage; +check_unpaid_usage(struct obj* otmp, boolean altusage) { struct monst *shkp; const char *fmt, *arg1, *arg2; @@ -4622,16 +4517,13 @@ boolean altusage; /* for using charges of unpaid objects "used in the normal manner" */ void -check_unpaid(otmp) -struct obj *otmp; +check_unpaid(struct obj* otmp) { check_unpaid_usage(otmp, FALSE); /* normal item use */ } void -costly_gold(x, y, amount) -register xchar x, y; -register long amount; +costly_gold(register xchar x, register xchar y, register long amount) { register long delta; register struct monst *shkp; @@ -4666,8 +4558,7 @@ register long amount; /* used in domove to block diagonal shop-exit */ /* x,y should always be a door */ boolean -block_door(x, y) -register xchar x, y; +block_door(register xchar x, register xchar y) { register int roomno = *in_rooms(x, y, SHOPBASE); register struct monst *shkp; @@ -4701,8 +4592,7 @@ register xchar x, y; /* used in domove to block diagonal shop-entry; u.ux, u.uy should always be a door */ boolean -block_entry(x, y) -register xchar x, y; +block_entry(register xchar x, register xchar y) { register xchar sx, sy; register int roomno; @@ -4737,9 +4627,7 @@ register xchar x, y; /* "your " or "Foobar's " (note the trailing space) */ char * -shk_your(buf, obj) -char *buf; -struct obj *obj; +shk_your(char *buf, struct obj* obj) { if (!shk_owns(buf, obj) && !mon_owns(buf, obj)) Strcpy(buf, the_your[carried(obj) ? 1 : 0]); @@ -4747,9 +4635,7 @@ struct obj *obj; } char * -Shk_Your(buf, obj) -char *buf; -struct obj *obj; +Shk_Your(char* buf, struct obj* obj) { (void) shk_your(buf, obj); *buf = highc(*buf); @@ -4757,9 +4643,7 @@ struct obj *obj; } static char * -shk_owns(buf, obj) -char *buf; -struct obj *obj; +shk_owns(char* buf, struct obj* obj) { struct monst *shkp; xchar x, y; @@ -4774,9 +4658,7 @@ struct obj *obj; } static char * -mon_owns(buf, obj) -char *buf; -struct obj *obj; +mon_owns(char* buf, struct obj* obj) { if (obj->where == OBJ_MINVENT) return strcpy(buf, s_suffix(y_monnam(obj->ocarry))); @@ -4784,8 +4666,8 @@ struct obj *obj; } static const char * -cad(altusage) -boolean altusage; /* used as a verbalized exclamation: \"Cad! ...\" */ +cad( + boolean altusage) /* used as a verbalized exclamation: \"Cad! ...\" */ { const char *res = 0; @@ -4852,8 +4734,7 @@ sasc_bug(struct obj *op, unsigned x) * 4. player_owned glob merging into player_owned glob */ void -globby_bill_fixup(obj_absorber, obj_absorbed) -struct obj *obj_absorber, *obj_absorbed; +globby_bill_fixup(struct obj* obj_absorber, struct obj* obj_absorbed) { int x = 0, y = 0; struct bill_x *bp, *bp_absorber = (struct bill_x *) 0; diff --git a/src/shknam.c b/src/shknam.c index b8a4386c4..ecba17993 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -7,14 +7,13 @@ #include "hack.h" -static boolean FDECL(stock_room_goodpos, (struct mkroom *, int, int, int, int)); -static boolean FDECL(veggy_item, (struct obj * obj, int)); -static int NDECL(shkveg); -static void FDECL(mkveggy_at, (int, int)); -static void FDECL(mkshobj_at, (const struct shclass *, int, int, - BOOLEAN_P)); -static void FDECL(nameshk, (struct monst *, const char *const *)); -static int FDECL(shkinit, (const struct shclass *, struct mkroom *)); +static boolean stock_room_goodpos(struct mkroom *, int, int, int, int); +static boolean veggy_item(struct obj * obj, int); +static int shkveg(void); +static void mkveggy_at(int, int); +static void mkshobj_at(const struct shclass *, int, int, boolean); +static void nameshk(struct monst *, const char *const *); +static int shkinit(const struct shclass *, struct mkroom *); #define VEGETARIAN_CLASS (MAXOCLASSES + 1) @@ -370,9 +369,7 @@ init_shop_selection() /* decide whether an object or object type is considered vegetarian; for types, items which might go either way are assumed to be veggy */ static boolean -veggy_item(obj, otyp) -struct obj *obj; -int otyp; /* used iff obj is null */ +veggy_item(struct obj* obj, int otyp /* used iff obj is null */) { int corpsenm; char oclass; @@ -401,7 +398,7 @@ int otyp; /* used iff obj is null */ } static int -shkveg() +shkveg(void) { int i, j, maxprob, prob; char oclass = FOOD_CLASS; @@ -436,8 +433,7 @@ shkveg() /* make a random item for health food store */ static void -mkveggy_at(sx, sy) -int sx, sy; +mkveggy_at(int sx, int sy) { struct obj *obj = mksobj_at(shkveg(), sx, sy, TRUE, TRUE); @@ -448,10 +444,7 @@ int sx, sy; /* make an object of the appropriate type for a shop square */ static void -mkshobj_at(shp, sx, sy, mkspecl) -const struct shclass *shp; -int sx, sy; -boolean mkspecl; +mkshobj_at(const struct shclass* shp, int sx, int sy, boolean mkspecl) { struct monst *mtmp; struct permonst *ptr; @@ -488,9 +481,7 @@ boolean mkspecl; /* extract a shopkeeper name for the given shop type */ static void -nameshk(shk, nlp) -struct monst *shk; -const char *const *nlp; +nameshk(struct monst* shk, const char* const* nlp) { int i, trycnt, names_avail; const char *shname = 0; @@ -559,8 +550,7 @@ const char *const *nlp; } void -neweshk(mtmp) -struct monst *mtmp; +neweshk(struct monst* mtmp) { if (!mtmp->mextra) mtmp->mextra = newmextra(); @@ -571,8 +561,7 @@ struct monst *mtmp; } void -free_eshk(mtmp) -struct monst *mtmp; +free_eshk(struct monst* mtmp) { if (mtmp->mextra && ESHK(mtmp)) { free((genericptr_t) ESHK(mtmp)); @@ -583,9 +572,7 @@ struct monst *mtmp; /* create a new shopkeeper in the given room */ static int -shkinit(shp, sroom) -const struct shclass *shp; -struct mkroom *sroom; +shkinit(const struct shclass* shp, struct mkroom* sroom) { register int sh, sx, sy; struct monst *shk; @@ -677,9 +664,7 @@ struct mkroom *sroom; } static boolean -stock_room_goodpos(sroom, rmno, sh, sx, sy) -struct mkroom *sroom; -int rmno, sh, sx,sy; +stock_room_goodpos(struct mkroom* sroom, int rmno, int sh, int sx, int sy) { if (sroom->irregular) { if (levl[sx][sy].edge @@ -702,9 +687,7 @@ int rmno, sh, sx,sy; /* stock a newly-created room with objects */ void -stock_room(shp_indx, sroom) -int shp_indx; -register struct mkroom *sroom; +stock_room(int shp_indx, register struct mkroom* sroom) { /* * Someday soon we'll dispatch on the shdist field of shclass to do @@ -788,9 +771,7 @@ register struct mkroom *sroom; /* does shkp's shop stock this item type? */ boolean -saleable(shkp, obj) -struct monst *shkp; -struct obj *obj; +saleable(struct monst* shkp, struct obj* obj) { int i, shp_indx = ESHK(shkp)->shoptype - SHOPBASE; const struct shclass *shp = &shtypes[shp_indx]; @@ -814,8 +795,7 @@ struct obj *obj; /* positive value: class; negative value: specific object type. can also return non-existing object class (eg. VEGETARIAN_CLASS) */ int -get_shop_item(type) -int type; +get_shop_item(int type) { const struct shclass *shp = shtypes + type; register int i, j; @@ -829,8 +809,7 @@ int type; /* version of shkname() for beginning of sentence */ char * -Shknam(mtmp) -struct monst *mtmp; +Shknam(struct monst* mtmp) { char *nam = shkname(mtmp); @@ -843,8 +822,7 @@ struct monst *mtmp; will yield some other shopkeeper's name (not necessarily one residing in the current game's dungeon, or who keeps same type of shop) */ char * -shkname(mtmp) -struct monst *mtmp; +shkname(struct monst* mtmp) { char *nam; unsigned save_isshk = mtmp->isshk; @@ -888,8 +866,7 @@ struct monst *mtmp; } boolean -shkname_is_pname(mtmp) -struct monst *mtmp; +shkname_is_pname(struct monst* mtmp) { const char *shknm = ESHK(mtmp)->shknam; @@ -897,9 +874,7 @@ struct monst *mtmp; } boolean -is_izchak(shkp, override_hallucination) -struct monst *shkp; -boolean override_hallucination; +is_izchak(struct monst* shkp, boolean override_hallucination) { const char *shknm; diff --git a/src/sit.c b/src/sit.c index ee6e9679b..abaf704b2 100644 --- a/src/sit.c +++ b/src/sit.c @@ -9,7 +9,7 @@ /* take away the hero's money */ void -take_gold() +take_gold(void) { struct obj *otmp, *nobj; int lost_money = 0; @@ -32,7 +32,7 @@ take_gold() /* #sit command */ int -dosit() +dosit(void) { static const char sit_message[] = "sit on the %s."; register struct trap *trap = t_at(u.ux, u.uy); @@ -331,7 +331,7 @@ dosit() /* curse a few inventory items at random! */ void -rndcurse() +rndcurse(void) { int nobj = 0; int cnt, onum; @@ -401,7 +401,7 @@ rndcurse() /* remove a random INTRINSIC ability */ void -attrcurse() +attrcurse(void) { switch (rnd(11)) { case 1: diff --git a/src/sounds.c b/src/sounds.c index 8685609b0..d6df797bb 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -4,17 +4,15 @@ #include "hack.h" -static boolean FDECL(mon_is_gecko, (struct monst *)); -static int FDECL(domonnoise, (struct monst *)); -static int NDECL(dochat); -static struct monst *FDECL(responsive_mon_at, (int, int)); -static int FDECL(mon_in_room, (struct monst *, int)); +static boolean mon_is_gecko(struct monst *); +static int domonnoise(struct monst *); +static int dochat(void); +static struct monst *responsive_mon_at(int, int); +static int mon_in_room(struct monst *, int); /* this easily could be a macro, but it might overtax dumb compilers */ static int -mon_in_room(mon, rmtyp) -struct monst *mon; -int rmtyp; +mon_in_room(struct monst* mon, int rmtyp) { int rno = levl[mon->mx][mon->my].roomno; if (rno >= ROOMOFFSET) @@ -23,7 +21,7 @@ int rmtyp; } void -dosounds() +dosounds(void) { register struct mkroom *sroom; register int hallu, vx, vy; @@ -297,8 +295,7 @@ static const char *const h_sounds[] = { }; const char * -growl_sound(mtmp) -register struct monst *mtmp; +growl_sound(register struct monst* mtmp) { const char *ret; @@ -343,8 +340,7 @@ register struct monst *mtmp; /* the sounds of a seriously abused pet, including player attacking it */ void -growl(mtmp) -register struct monst *mtmp; +growl(register struct monst* mtmp) { register const char *growl_verb = 0; @@ -367,8 +363,7 @@ register struct monst *mtmp; /* the sounds of mistreated pets */ void -yelp(mtmp) -register struct monst *mtmp; +yelp(register struct monst* mtmp) { register const char *yelp_verb = 0; @@ -410,8 +405,7 @@ register struct monst *mtmp; /* the sounds of distressed pets */ void -whimper(mtmp) -register struct monst *mtmp; +whimper(register struct monst* mtmp) { register const char *whimper_verb = 0; @@ -444,8 +438,7 @@ register struct monst *mtmp; /* pet makes "I'm hungry" noises */ void -beg(mtmp) -register struct monst *mtmp; +beg(register struct monst* mtmp) { if (mtmp->msleeping || !mtmp->mcanmove || !(carnivorous(mtmp->data) || herbivorous(mtmp->data))) @@ -471,8 +464,7 @@ register struct monst *mtmp; /* hero has attacked a peaceful monster within 'mon's view */ const char * -maybe_gasp(mon) -struct monst *mon; +maybe_gasp(struct monst* mon) { static const char *const Exclam[] = { "Gasp!", "Uh-oh.", "Oh my!", "What?", "Why?", @@ -539,8 +531,7 @@ struct monst *mon; /* return True if mon is a gecko or seems to look like one (hallucination) */ static boolean -mon_is_gecko(mon) -struct monst *mon; +mon_is_gecko(struct monst* mon) { int glyph; @@ -558,8 +549,7 @@ struct monst *mon; } static int -domonnoise(mtmp) -register struct monst *mtmp; +domonnoise(register struct monst* mtmp) { char verbuf[BUFSZ]; register const char *pline_msg = 0, /* Monnam(mtmp) will be prepended */ @@ -1060,7 +1050,7 @@ register struct monst *mtmp; /* #chat command */ int -dotalk() +dotalk(void) { int result; @@ -1069,7 +1059,7 @@ dotalk() } static int -dochat() +dochat(void) { struct monst *mtmp; int tx, ty; @@ -1219,8 +1209,7 @@ dochat() /* is there a monster at that can see the hero and react? */ static struct monst * -responsive_mon_at(x, y) -int x, y; +responsive_mon_at(int x, int y) { struct monst *mtmp = isok(x, y) ? m_at(x, y) : 0; @@ -1234,7 +1223,7 @@ int x, y; /* player chose 'uarmh' for #tip (pickup.c); visual #chat, sort of... */ int -tiphat() +tiphat(void) { struct monst *mtmp; struct obj *otmp; @@ -1349,10 +1338,10 @@ tiphat() #ifdef USER_SOUNDS #if defined(WIN32) || defined(QT_GRAPHICS) -extern void FDECL(play_usersound, (const char *, int)); +extern void play_usersound(const char *, int); #endif #if defined(TTY_SOUND_ESCCODES) -extern void FDECL(play_usersound_via_idx, (int, int)); +extern void play_usersound_via_idx(int, int); #endif typedef struct audio_mapping_rec { @@ -1364,14 +1353,13 @@ typedef struct audio_mapping_rec { } audio_mapping; static audio_mapping *soundmap = 0; -static audio_mapping *FDECL(sound_matches_message, (const char *)); +static audio_mapping *sound_matches_message(const char *); char *sounddir = 0; /* set in files.c */ /* adds a sound file mapping, returns 0 on failure, 1 on success */ int -add_sound_mapping(mapping) -const char *mapping; +add_sound_mapping(const char* mapping) { char text[256]; char filename[256]; @@ -1425,8 +1413,7 @@ const char *mapping; } static audio_mapping * -sound_matches_message(msg) -const char *msg; +sound_matches_message(const char* msg) { audio_mapping *snd = soundmap; @@ -1439,8 +1426,7 @@ const char *msg; } void -play_sound_for_message(msg) -const char *msg; +play_sound_for_message(const char* msg) { audio_mapping *snd = sound_matches_message(msg); @@ -1449,8 +1435,7 @@ const char *msg; } void -maybe_play_sound(msg) -const char *msg; +maybe_play_sound(const char* msg) { #if defined(WIN32) || defined(QT_GRAPHICS) || defined(TTY_SOUND_ESCCODES) audio_mapping *snd = sound_matches_message(msg); @@ -1477,7 +1462,7 @@ const char *msg; } void -release_sound_mappings() +release_sound_mappings(void) { audio_mapping *nextsound = 0; diff --git a/src/sp_lev.c b/src/sp_lev.c index bb405cabe..9500847d5 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -19,144 +19,142 @@ #pragma warning(disable : 4244) #endif -typedef void FDECL((*select_iter_func), (int, int, genericptr)); - -extern void FDECL(mkmap, (lev_init *)); - -static boolean FDECL(match_maptyps, (XCHAR_P, XCHAR_P)); -static void NDECL(solidify_map); -static void FDECL(lvlfill_maze_grid, (int, int, int, int, SCHAR_P)); -static void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P)); -static void FDECL(lvlfill_swamp, (SCHAR_P, SCHAR_P, SCHAR_P)); -static void FDECL(flip_drawbridge_horizontal, (struct rm *)); -static void FDECL(flip_drawbridge_vertical, (struct rm *)); -static void FDECL(flip_visuals, (int, int, int, int, int)); -static int FDECL(flip_encoded_direction_bits, (int, int)); -static void FDECL(sel_set_wall_property, (int, int, genericptr_t)); -static void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - int)); -static void NDECL(count_features); -static void NDECL(remove_boundary_syms); -static void FDECL(set_door_orientation, (int, int)); -static void FDECL(maybe_add_door, (int, int, struct mkroom *)); -static void NDECL(link_doors_rooms); -static int NDECL(rnddoor); -static int NDECL(rndtrap); -static void FDECL(get_location, (xchar *, xchar *, int, struct mkroom *)); -static boolean FDECL(is_ok_location, (XCHAR_P, XCHAR_P, int)); -static unpacked_coord FDECL(get_unpacked_coord, (long, int)); -static void FDECL(get_room_loc, (xchar *, xchar *, struct mkroom *)); -static void FDECL(get_free_room_loc, (xchar *, xchar *, - struct mkroom *, packed_coord)); -static boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -static void FDECL(create_door, (room_door *, struct mkroom *)); -static void FDECL(create_trap, (spltrap *, struct mkroom *)); -static int FDECL(noncoalignment, (ALIGNTYP_P)); -static boolean FDECL(m_bad_boulder_spot, (int, int)); -static int FDECL(pm_to_humidity, (struct permonst *)); -static void FDECL(create_monster, (monster *, struct mkroom *)); -static void FDECL(create_object, (object *, struct mkroom *)); -static void FDECL(create_altar, (altar *, struct mkroom *)); -static boolean FDECL(search_door, (struct mkroom *, - xchar *, xchar *, XCHAR_P, int)); -static void FDECL(create_corridor, (corridor *)); -static struct mkroom *FDECL(build_room, (room *, struct mkroom *)); -static void FDECL(light_region, (region *)); -static void FDECL(maze1xy, (coord *, int)); -static void NDECL(fill_empty_maze); -static void FDECL(splev_initlev, (lev_init *)); +typedef void (*select_iter_func)(int, int, genericptr); + +extern void mkmap(lev_init *); + +static boolean match_maptyps(xchar, xchar); +static void solidify_map(void); +static void lvlfill_maze_grid(int, int, int, int, schar); +static void lvlfill_solid(schar, schar); +static void lvlfill_swamp(schar, schar, schar); +static void flip_drawbridge_horizontal(struct rm *); +static void flip_drawbridge_vertical(struct rm *); +static void flip_visuals(int, int, int, int, int); +static int flip_encoded_direction_bits(int, int); +static void sel_set_wall_property(int, int, genericptr_t); +static void set_wall_property(xchar, xchar, xchar, xchar, int); +static void count_features(void); +static void remove_boundary_syms(void); +static void set_door_orientation(int, int); +static void maybe_add_door(int, int, struct mkroom *); +static void link_doors_rooms(void); +static int rnddoor(void); +static int rndtrap(void); +static void get_location(xchar *, xchar *, int, struct mkroom *); +static boolean is_ok_location(xchar, xchar, int); +static unpacked_coord get_unpacked_coord(long, int); +static void get_room_loc(xchar *, xchar *, struct mkroom *); +static void get_free_room_loc(xchar *, xchar *, struct mkroom *, + packed_coord); +static boolean create_subroom(struct mkroom *, xchar, xchar, xchar, + xchar, xchar, xchar); +static void create_door(room_door *, struct mkroom *); +static void create_trap(spltrap *, struct mkroom *); +static int noncoalignment(aligntyp); +static boolean m_bad_boulder_spot(int, int); +static int pm_to_humidity(struct permonst *); +static void create_monster(monster *, struct mkroom *); +static void create_object(object *, struct mkroom *); +static void create_altar(altar *, struct mkroom *); +static boolean search_door(struct mkroom *, xchar *, xchar *, xchar, int); +static void create_corridor(corridor *); +static struct mkroom *build_room(room *, struct mkroom *); +static void light_region(region *); +static void maze1xy(coord *, int); +static void fill_empty_maze(void); +static void splev_initlev(lev_init *); #if 0 /* macosx complains that these are unused */ -static long FDECL(sp_code_jmpaddr, (long, long)); -static void FDECL(spo_room, (struct sp_coder *)); -static void FDECL(spo_trap, (struct sp_coder *)); -static void FDECL(spo_gold, (struct sp_coder *)); -static void FDECL(spo_corridor, (struct sp_coder *)); -static void FDECL(spo_feature, (struct sp_coder *)); -static void FDECL(spo_terrain, (struct sp_coder *)); -static void FDECL(spo_replace_terrain, (struct sp_coder *)); -static void FDECL(spo_levregion, (struct sp_coder *)); -static void FDECL(spo_region, (struct sp_coder *)); -static void FDECL(spo_drawbridge, (struct sp_coder *)); -static void FDECL(spo_mazewalk, (struct sp_coder *)); -static void FDECL(spo_wall_property, (struct sp_coder *)); -static void FDECL(spo_room_door, (struct sp_coder *)); -static void FDECL(spo_wallify, (struct sp_coder *)); -static void FDECL(sel_set_wallify, (int, int, genericptr_t)); +static long sp_code_jmpaddr(long, long); +static void spo_room(struct sp_coder *); +static void spo_trap(struct sp_coder *); +static void spo_gold(struct sp_coder *); +static void spo_corridor(struct sp_coder *); +static void spo_feature(struct sp_coder *); +static void spo_terrain(struct sp_coder *); +static void spo_replace_terrain(struct sp_coder *); +static void spo_levregion(struct sp_coder *); +static void spo_region(struct sp_coder *); +static void spo_drawbridge(struct sp_coder *); +static void spo_mazewalk(struct sp_coder *); +static void spo_wall_property(struct sp_coder *); +static void spo_room_door(struct sp_coder *); +static void spo_wallify(struct sp_coder *); +static void sel_set_wallify(int, int, genericptr_t); #endif -static void NDECL(spo_end_moninvent); -static void NDECL(spo_pop_container); -static int FDECL(l_create_stairway, (lua_State *, BOOLEAN_P)); -static void FDECL(spo_endroom, (struct sp_coder *)); -static void FDECL(l_table_getset_feature_flag, (lua_State *, int, int, - const char *, int)); -static void FDECL(sel_set_lit, (int, int, genericptr_t)); -static void FDECL(selection_iterate, (struct selectionvar *, select_iter_func, - genericptr_t)); -static void FDECL(sel_set_ter, (int, int, genericptr_t)); -static void FDECL(sel_set_door, (int, int, genericptr_t)); -static void FDECL(sel_set_feature, (int, int, genericptr_t)); -static int FDECL(get_coord, (lua_State *, int, int *, int *)); -static void FDECL(levregion_add, (lev_region *)); -static void FDECL(get_table_xy_or_coord, (lua_State *, int *, int *)); -static int FDECL(get_table_region, (lua_State *, const char *, - int *, int *, int *, int *, BOOLEAN_P)); -static void FDECL(set_wallprop_in_selection, (lua_State *, int)); -static int FDECL(floodfillchk_match_under, (int, int)); -static int FDECL(floodfillchk_match_accessible, (int, int)); -static boolean FDECL(sel_flood_havepoint, (int, int, xchar *, xchar *, int)); -static long FDECL(line_dist_coord, (long, long, long, long, long, long)); -static void FDECL(l_push_wid_hei_table, (lua_State *, int, int)); -static int FDECL(get_table_align, (lua_State *)); -static int FDECL(get_table_monclass, (lua_State *)); -static int FDECL(find_montype, (lua_State *, const char *, int *)); -static int FDECL(get_table_montype, (lua_State *, int *)); -static int FDECL(get_table_int_or_random, (lua_State *, const char *, int)); -static int FDECL(get_table_buc, (lua_State *)); -static int FDECL(get_table_objclass, (lua_State *)); -static int FDECL(find_objtype, (lua_State *, const char *)); -static int FDECL(get_table_objtype, (lua_State *)); -static int FDECL(get_table_roomtype_opt, (lua_State *, const char *, int)); -static int FDECL(get_table_traptype_opt, (lua_State *, const char *, int)); -static int FDECL(get_traptype_byname, (const char *)); -static int FDECL(get_table_intarray_entry, (lua_State *, int, int)); -static struct sp_coder *NDECL(sp_level_coder_init); +static void spo_end_moninvent(void); +static void spo_pop_container(void); +static int l_create_stairway(lua_State *, boolean); +static void spo_endroom(struct sp_coder *); +static void l_table_getset_feature_flag(lua_State *, int, int, const char *, + int); +static void sel_set_lit(int, int, genericptr_t); +static void selection_iterate(struct selectionvar *, select_iter_func, + genericptr_t); +static void sel_set_ter(int, int, genericptr_t); +static void sel_set_door(int, int, genericptr_t); +static void sel_set_feature(int, int, genericptr_t); +static int get_coord(lua_State *, int, int *, int *); +static void levregion_add(lev_region *); +static void get_table_xy_or_coord(lua_State *, int *, int *); +static int get_table_region(lua_State *, const char *, int *, int *, int *, + int *, boolean); +static void set_wallprop_in_selection(lua_State *, int); +static int floodfillchk_match_under(int, int); +static int floodfillchk_match_accessible(int, int); +static boolean sel_flood_havepoint(int, int, xchar *, xchar *, int); +static long line_dist_coord(long, long, long, long, long, long); +static void l_push_wid_hei_table(lua_State *, int, int); +static int get_table_align(lua_State *); +static int get_table_monclass(lua_State *); +static int find_montype(lua_State *, const char *, int *); +static int get_table_montype(lua_State *, int *); +static int get_table_int_or_random(lua_State *, const char *, int); +static int get_table_buc(lua_State *); +static int get_table_objclass(lua_State *); +static int find_objtype(lua_State *, const char *); +static int get_table_objtype(lua_State *); +static int get_table_roomtype_opt(lua_State *, const char *, int); +static int get_table_traptype_opt(lua_State *, const char *, int); +static int get_traptype_byname(const char *); +static int get_table_intarray_entry(lua_State *, int, int); +static struct sp_coder *sp_level_coder_init(void); /* lua_CFunction prototypes */ -int FDECL(lspo_altar, (lua_State *)); -int FDECL(lspo_branch, (lua_State *)); -int FDECL(lspo_corridor, (lua_State *)); -int FDECL(lspo_door, (lua_State *)); -int FDECL(lspo_drawbridge, (lua_State *)); -int FDECL(lspo_engraving, (lua_State *)); -int FDECL(lspo_feature, (lua_State *)); -int FDECL(lspo_gold, (lua_State *)); -int FDECL(lspo_grave, (lua_State *)); -int FDECL(lspo_ladder, (lua_State *)); -int FDECL(lspo_level_flags, (lua_State *)); -int FDECL(lspo_level_init, (lua_State *)); -int FDECL(lspo_levregion, (lua_State *)); -int FDECL(lspo_map, (lua_State *)); -int FDECL(lspo_mazewalk, (lua_State *)); -int FDECL(lspo_message, (lua_State *)); -int FDECL(lspo_mineralize, (lua_State *)); -int FDECL(lspo_monster, (lua_State *)); -int FDECL(lspo_non_diggable, (lua_State *)); -int FDECL(lspo_non_passwall, (lua_State *)); -int FDECL(lspo_object, (lua_State *)); -int FDECL(lspo_portal, (lua_State *)); -int FDECL(lspo_random_corridors, (lua_State *)); -int FDECL(lspo_region, (lua_State *)); -int FDECL(lspo_replace_terrain, (lua_State *)); -int FDECL(lspo_reset_level, (lua_State *)); -int FDECL(lspo_room, (lua_State *)); -int FDECL(lspo_stair, (lua_State *)); -int FDECL(lspo_teleport_region, (lua_State *)); -int FDECL(lspo_terrain, (lua_State *)); -int FDECL(lspo_trap, (lua_State *)); -int FDECL(lspo_wall_property, (lua_State *)); -int FDECL(lspo_wallify, (lua_State *)); +int lspo_altar(lua_State *); +int lspo_branch(lua_State *); +int lspo_corridor(lua_State *); +int lspo_door(lua_State *); +int lspo_drawbridge(lua_State *); +int lspo_engraving(lua_State *); +int lspo_feature(lua_State *); +int lspo_gold(lua_State *); +int lspo_grave(lua_State *); +int lspo_ladder(lua_State *); +int lspo_level_flags(lua_State *); +int lspo_level_init(lua_State *); +int lspo_levregion(lua_State *); +int lspo_map(lua_State *); +int lspo_mazewalk(lua_State *); +int lspo_message(lua_State *); +int lspo_mineralize(lua_State *); +int lspo_monster(lua_State *); +int lspo_non_diggable(lua_State *); +int lspo_non_passwall(lua_State *); +int lspo_object(lua_State *); +int lspo_portal(lua_State *); +int lspo_random_corridors(lua_State *); +int lspo_region(lua_State *); +int lspo_replace_terrain(lua_State *); +int lspo_reset_level(lua_State *); +int lspo_room(lua_State *); +int lspo_stair(lua_State *); +int lspo_teleport_region(lua_State *); +int lspo_terrain(lua_State *); +int lspo_trap(lua_State *); +int lspo_wall_property(lua_State *); +int lspo_wallify(lua_State *); #define LEFT 1 #define H_LEFT 2 @@ -201,8 +199,7 @@ static struct monst *invent_carrying_monster = (struct monst *) 0; /* Does typ match with levl[][].typ, considering special types MATCH_WALL and MAX_TYPE (aka transparency)? */ static boolean -match_maptyps(typ, levltyp) -xchar typ, levltyp; +match_maptyps(xchar typ, xchar levltyp) { if ((typ == MATCH_WALL) && !IS_STWALL(levltyp)) return FALSE; @@ -212,8 +209,7 @@ xchar typ, levltyp; } struct mapfragment * -mapfrag_fromstr(str) -char *str; +mapfrag_fromstr(char* str) { struct mapfragment *mf = (struct mapfragment *) alloc(sizeof(struct mapfragment)); @@ -242,8 +238,7 @@ char *str; } void -mapfrag_free(mf) -struct mapfragment **mf; +mapfrag_free(struct mapfragment** mf) { if (mf && *mf) { free((*mf)->data); @@ -253,9 +248,7 @@ struct mapfragment **mf; } schar -mapfrag_get(mf, x,y) -struct mapfragment *mf; -int x,y; +mapfrag_get(struct mapfragment* mf, int x, int y) { if (y < 0 || x < 0 || y > mf->hei-1 || x > mf->wid-1) panic("outside mapfrag (%i,%i), wanted (%i,%i)", mf->wid, mf->hei, x,y); @@ -263,15 +256,13 @@ int x,y; } boolean -mapfrag_canmatch(mf) -struct mapfragment *mf; +mapfrag_canmatch(struct mapfragment* mf) { return ((mf->wid % 2) && (mf->hei % 2)); } const char * -mapfrag_error(mf) -struct mapfragment *mf; +mapfrag_error(struct mapfragment* mf) { if (!mf) return "mapfragment error"; @@ -286,9 +277,7 @@ struct mapfragment *mf; } boolean -mapfrag_match(mf, x,y) -struct mapfragment *mf; -int x,y; +mapfrag_match(struct mapfragment* mf, int x, int y) { int rx, ry; @@ -303,7 +292,7 @@ int x,y; } static void -solidify_map() +solidify_map(void) { xchar x, y; @@ -314,9 +303,7 @@ solidify_map() } static void -lvlfill_maze_grid(x1, y1, x2, y2, filling) -int x1, y1, x2, y2; -schar filling; +lvlfill_maze_grid(int x1, int y1, int x2, int y2, schar filling) { int x, y; @@ -331,9 +318,7 @@ schar filling; } static void -lvlfill_solid(filling, lit) -schar filling; -schar lit; +lvlfill_solid(schar filling, schar lit) { int x, y; @@ -349,8 +334,7 @@ schar lit; } static void -lvlfill_swamp(fg, bg, lit) -schar fg, bg, lit; +lvlfill_swamp(schar fg, schar bg, schar lit) { int x,y; @@ -376,8 +360,7 @@ schar fg, bg, lit; } static void -flip_drawbridge_horizontal(lev) -struct rm *lev; +flip_drawbridge_horizontal(struct rm* lev) { if (IS_DRAWBRIDGE(lev->typ)) { if ((lev->drawbridgemask & DB_DIR) == DB_WEST) { @@ -391,8 +374,7 @@ struct rm *lev; } static void -flip_drawbridge_vertical(lev) -struct rm *lev; +flip_drawbridge_vertical(struct rm* lev) { if (IS_DRAWBRIDGE(lev->typ)) { if ((lev->drawbridgemask & DB_DIR) == DB_NORTH) { @@ -408,9 +390,7 @@ struct rm *lev; /* for #wizfliplevel; not needed when flipping during level creation; update seen vector for whole flip area and glyph for known walls */ static void -flip_visuals(flp, minx, miny, maxx, maxy) -int flp; -int minx, miny, maxx, maxy; +flip_visuals(int flp, int minx, int miny, int maxx, int maxy) { struct rm *lev; int x, y, seenv; @@ -484,9 +464,7 @@ flip_encoded_direction_bits(int flp, int val) /* transpose top with bottom or left with right or both; sometimes called for new special levels, or for any level via the #wizfliplevel command */ void -flip_level(flp, extras) -int flp; -boolean extras; +flip_level(int flp, boolean extras) { int x, y, i, itmp; int minx, miny, maxx, maxy; @@ -840,9 +818,7 @@ boolean extras; /* randomly transpose top with bottom or left with right or both; caller controls which transpositions are allowed */ void -flip_level_rnd(flp, extras) -int flp; -boolean extras; +flip_level_rnd(int flp, boolean extras) { int c = 0; @@ -861,9 +837,7 @@ boolean extras; static void -sel_set_wall_property(x, y, arg) -int x, y; -genericptr_t arg; +sel_set_wall_property(int x, int y, genericptr_t arg) { int prop = *(int *)arg; @@ -878,9 +852,7 @@ genericptr_t arg; * Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able */ static void -set_wall_property(x1, y1, x2, y2, prop) -xchar x1, y1, x2, y2; -int prop; +set_wall_property(xchar x1, xchar y1, xchar x2, xchar y2, int prop) { register xchar x, y; @@ -898,7 +870,7 @@ int prop; * Count the different features (sinks, fountains) in the level. */ static void -count_features() +count_features(void) { xchar x, y; @@ -914,7 +886,7 @@ count_features() } static void -remove_boundary_syms() +remove_boundary_syms(void) { /* * If any CROSSWALLs are found, must change to ROOM after REGION's @@ -940,8 +912,7 @@ remove_boundary_syms() /* used by sel_set_door() and link_doors_rooms() */ static void -set_door_orientation(x, y) -int x, y; +set_door_orientation(int x, int y) { boolean wleft, wright, wup, wdown; @@ -987,16 +958,14 @@ int x, y; } static void -maybe_add_door(x, y, droom) -int x, y; -struct mkroom *droom; +maybe_add_door(int x, int y, struct mkroom* droom) { if (droom->hx >= 0 && g.doorindex < DOORMAX && inside_room(droom, x, y)) add_door(x, y, droom); } static void -link_doors_rooms() +link_doors_rooms(void) { int x, y; int tmpi, m; @@ -1022,7 +991,7 @@ link_doors_rooms() * Choose randomly the state (nodoor, open, closed or locked) for a door */ static int -rnddoor() +rnddoor(void) { static int state[] = { D_NODOOR, D_BROKEN, D_ISOPEN, D_CLOSED, D_LOCKED }; @@ -1033,7 +1002,7 @@ rnddoor() * Select a random trap */ static int -rndtrap() +rndtrap(void) { int rtrap; @@ -1072,10 +1041,7 @@ rndtrap() * created underwater, or eels on dry land. */ static void -get_location(x, y, humidity, croom) -xchar *x, *y; -int humidity; -struct mkroom *croom; +get_location(xchar *x, xchar *y, int humidity, struct mkroom* croom) { int cpt = 0; int mx, my, sx, sy; @@ -1142,9 +1108,7 @@ struct mkroom *croom; } static boolean -is_ok_location(x, y, humidity) -register xchar x, y; -register int humidity; +is_ok_location(xchar x, xchar y, int humidity) { register int typ; @@ -1174,17 +1138,13 @@ register int humidity; } boolean -pm_good_location(x, y, pm) -int x, y; -struct permonst *pm; +pm_good_location(int x, int y, struct permonst* pm) { return is_ok_location(x, y, pm_to_humidity(pm)); } static unpacked_coord -get_unpacked_coord(loc, defhumidity) -long loc; -int defhumidity; +get_unpacked_coord(long loc, int defhumidity) { static unpacked_coord c; @@ -1204,11 +1164,11 @@ int defhumidity; } void -get_location_coord(x, y, humidity, croom, crd) -xchar *x, *y; -int humidity; -struct mkroom *croom; -long crd; +get_location_coord( + xchar *x, xchar *y, + int humidity, + struct mkroom* croom, + long crd) { unpacked_coord c; @@ -1227,9 +1187,7 @@ long crd; */ static void -get_room_loc(x, y, croom) -xchar *x, *y; -struct mkroom *croom; +get_room_loc(xchar* x, xchar* y, struct mkroom* croom) { coord c; @@ -1254,10 +1212,7 @@ struct mkroom *croom; * negative values for x or y means RANDOM! */ static void -get_free_room_loc(x, y, croom, pos) -xchar *x, *y; -struct mkroom *croom; -packed_coord pos; +get_free_room_loc(xchar* x, xchar* y, struct mkroom* croom, packed_coord pos) { xchar try_x, try_y; register int trycnt = 0; @@ -1276,9 +1231,7 @@ packed_coord pos; } boolean -check_room(lowx, ddx, lowy, ddy, vault) -xchar *lowx, *ddx, *lowy, *ddy; -boolean vault; +check_room(xchar* lowx, xchar* ddx, xchar* lowy, xchar* ddy, boolean vault) { register int x, y, hix = *lowx + *ddx, hiy = *lowy + *ddy; register struct rm *lev; @@ -1354,11 +1307,11 @@ boolean vault; * This is still very incomplete... */ boolean -create_room(x, y, w, h, xal, yal, rtype, rlit) -xchar x, y; -xchar w, h; -xchar xal, yal; -xchar rtype, rlit; +create_room( + xchar x, xchar y, + xchar w, xchar h, + xchar xal, xchar yal, + xchar rtype, xchar rlit) { xchar xabs = 0, yabs = 0; int wtmp, htmp, xaltmp, yaltmp, xtmp, ytmp; @@ -1535,11 +1488,11 @@ xchar rtype, rlit; * x & y are relative to the parent room. */ static boolean -create_subroom(proom, x, y, w, h, rtype, rlit) -struct mkroom *proom; -xchar x, y; -xchar w, h; -xchar rtype, rlit; +create_subroom( + struct mkroom *proom, + xchar x, xchar y, + xchar w, xchar h, + xchar rtype, xchar rlit) { xchar width, height; @@ -1581,9 +1534,7 @@ xchar rtype, rlit; * It's placed on a wall (north, south, east or west). */ static void -create_door(dd, broom) -room_door *dd; -struct mkroom *broom; +create_door(room_door* dd, struct mkroom* broom) { int x = 0, y = 0; int trycnt = 0, wtry = 0; @@ -1687,9 +1638,9 @@ struct mkroom *broom; * Create a secret door in croom on any one of the specified walls. */ void -create_secret_door(croom, walls) -struct mkroom *croom; -xchar walls; /* any of W_NORTH | W_SOUTH | W_EAST | W_WEST (or W_ANY) */ +create_secret_door( + struct mkroom *croom, + xchar walls) /* any of W_NORTH | W_SOUTH | W_EAST | W_WEST (or W_ANY) */ { xchar sx, sy; /* location of the secret door */ int count; @@ -1735,9 +1686,7 @@ xchar walls; /* any of W_NORTH | W_SOUTH | W_EAST | W_WEST (or W_ANY) */ * Create a trap in a room. */ static void -create_trap(t, croom) -spltrap *t; -struct mkroom *croom; +create_trap(spltrap* t, struct mkroom* croom) { xchar x = -1, y = -1; coord tm; @@ -1765,8 +1714,7 @@ struct mkroom *croom; * Create a monster in a room. */ static int -noncoalignment(alignment) -aligntyp alignment; +noncoalignment(aligntyp alignment) { int k; @@ -1778,8 +1726,7 @@ aligntyp alignment; /* attempt to screen out locations where a mimic-as-boulder shouldn't occur */ static boolean -m_bad_boulder_spot(x, y) -int x, y; +m_bad_boulder_spot(int x, int y) { struct rm *lev; @@ -1799,8 +1746,7 @@ int x, y; } static int -pm_to_humidity(pm) -struct permonst *pm; +pm_to_humidity(struct permonst* pm) { int loc = DRY; @@ -1818,9 +1764,7 @@ struct permonst *pm; } static void -create_monster(m, croom) -monster *m; -struct mkroom *croom; +create_monster(monster* m, struct mkroom* croom) { struct monst *mtmp; xchar x, y; @@ -2083,9 +2027,7 @@ struct mkroom *croom; * Create an object in a room. */ static void -create_object(o, croom) -object *o; -struct mkroom *croom; +create_object(object* o, struct mkroom* croom) { struct obj *otmp; xchar x, y; @@ -2320,9 +2262,7 @@ struct mkroom *croom; * Create an altar in a room. */ static void -create_altar(a, croom) -altar *a; -struct mkroom *croom; +create_altar(altar* a, struct mkroom* croom) { schar sproom; xchar x = -1, y = -1; @@ -2382,11 +2322,10 @@ struct mkroom *croom; * Search for a door in a room on a specified wall. */ static boolean -search_door(croom, x, y, wall, cnt) -struct mkroom *croom; -xchar *x, *y; -xchar wall; -int cnt; +search_door( + struct mkroom* croom, + xchar *x, xchar * y, + xchar wall, int cnt) { int dx, dy; int xx, yy; @@ -2438,10 +2377,12 @@ int cnt; * Dig a corridor between two points. */ boolean -dig_corridor(org, dest, nxcor, ftyp, btyp) -coord *org, *dest; -boolean nxcor; -schar ftyp, btyp; +dig_corridor( + coord *org, + coord *dest, + boolean nxcor, + schar ftyp, + schar btyp) { int dx = 0, dy = 0, dix, diy, cct; struct rm *crm; @@ -2553,8 +2494,7 @@ schar ftyp, btyp; * (from a distance). */ static void -create_corridor(c) -corridor *c; +create_corridor(corridor *c) { coord org, dest; @@ -2606,8 +2546,7 @@ corridor *c; * Fill a room (shop, zoo, etc...) with appropriate stuff. */ void -fill_special_room(croom) -struct mkroom *croom; +fill_special_room(struct mkroom* croom) { int i; @@ -2680,9 +2619,7 @@ struct mkroom *croom; } static struct mkroom * -build_room(r, mkr) -room *r; -struct mkroom *mkr; +build_room(room *r, struct mkroom* mkr) { boolean okroom; struct mkroom *aroom; @@ -2714,8 +2651,7 @@ struct mkroom *mkr; * set lighting in a region that will not become a room. */ static void -light_region(tmpregion) -region *tmpregion; +light_region(region* tmpregion) { register boolean litstate = tmpregion->rlit ? 1 : 0; register int hiy = tmpregion->y2; @@ -2742,8 +2678,7 @@ region *tmpregion; } void -wallify_map(x1, y1, x2, y2) -int x1, y1, x2, y2; +wallify_map(int x1, int y1, int x2, int y2) { int x, y, xx, yy, lo_xx, lo_yy, hi_xx, hi_yy; @@ -2778,9 +2713,7 @@ int x1, y1, x2, y2; * the maze outside every part of the special level. */ static void -maze1xy(m, humidity) -coord *m; -int humidity; +maze1xy(coord *m, int humidity) { register int x, y, tryct = 2000; /* tryct: normally it won't take more than ten or so tries due @@ -2806,7 +2739,7 @@ int humidity; * to the size of the maze. */ static void -fill_empty_maze() +fill_empty_maze(void) { int mapcountmax, mapcount, mapfact; xchar x, y; @@ -2857,8 +2790,7 @@ fill_empty_maze() } static void -splev_initlev(linit) -lev_init *linit; +splev_initlev(lev_init* linit) { switch (linit->init_style) { default: @@ -2898,8 +2830,7 @@ lev_init *linit; #if 0 static long -sp_code_jmpaddr(curpos, jmpaddr) -long curpos, jmpaddr; +sp_code_jmpaddr(long curpos, long jmpaddr) { return (curpos + jmpaddr); } @@ -2908,7 +2839,7 @@ long curpos, jmpaddr; /*ARGUSED*/ static void -spo_end_moninvent() +spo_end_moninvent(void) { if (invent_carrying_monster) m_dowear(invent_carrying_monster, TRUE); @@ -2917,7 +2848,7 @@ spo_end_moninvent() /*ARGUSED*/ static void -spo_pop_container() +spo_pop_container(void) { if (container_idx > 0) { container_idx--; @@ -2927,9 +2858,7 @@ spo_pop_container() /* push a table on lua stack: {width=wid, height=hei} */ static void -l_push_wid_hei_table(L, wid, hei) -lua_State *L; -int wid, hei; +l_push_wid_hei_table(lua_State* L, int wid, int hei) { lua_newtable(L); @@ -2944,8 +2873,7 @@ int wid, hei; /* message("What a strange feeling!"); */ int -lspo_message(L) -lua_State *L; +lspo_message(lua_State* L) { char *levmsg; int old_n, n; @@ -2980,8 +2908,7 @@ lua_State *L; } static int -get_table_align(L) -lua_State *L; +get_table_align(lua_State* L) { static const char *const gtaligns[] = { "noalign", "law", "neutral", "chaos", @@ -2998,8 +2925,7 @@ lua_State *L; } static int -get_table_monclass(L) -lua_State *L; +get_table_monclass(lua_State* L) { char *s = get_table_str_opt(L, "class", NULL); int ret = -1; @@ -3011,10 +2937,10 @@ lua_State *L; } static int -find_montype(L, s, mgender) -lua_State *L UNUSED; -const char *s; -int *mgender; +find_montype( + lua_State *L UNUSED, + const char *s, + int *mgender) { int i, mgend = NEUTRAL; @@ -3035,9 +2961,7 @@ int *mgender; } static int -get_table_montype(L, mgender) -lua_State *L; -int *mgender; +get_table_montype(lua_State* L, int *mgender) { char *s = get_table_str_opt(L, "id", NULL); int ret = NON_PM; @@ -3052,9 +2976,7 @@ int *mgender; } static void -get_table_xy_or_coord(L, x,y) -lua_State *L; -int *x, *y; +get_table_xy_or_coord(lua_State* L, int *x, int *y) { int mx = get_table_int_opt(L, "x", -1); int my = get_table_int_opt(L, "y", -1); @@ -3077,8 +2999,7 @@ int *x, *y; /* monster({ id = "giant mimic", appear_as = "obj:boulder" }); */ /* monster({ class = "H", peaceful = 0 }); */ int -lspo_monster(L) -lua_State *L; +lspo_monster(lua_State* L) { int argc = lua_gettop(L); monster tmpmons; @@ -3227,10 +3148,7 @@ lua_State *L; or if not existent, also return rndval. */ static int -get_table_int_or_random(L, name, rndval) -lua_State *L; -const char *name; -int rndval; +get_table_int_or_random(lua_State* L, const char* name, int rndval) { int ret; char buf[BUFSZ]; @@ -3259,8 +3177,7 @@ int rndval; } static int -get_table_buc(L) -lua_State *L; +get_table_buc(lua_State* L) { static const char *const bucs[] = { "random", "blessed", "uncursed", "cursed", @@ -3273,8 +3190,7 @@ lua_State *L; } static int -get_table_objclass(L) -lua_State *L; +get_table_objclass(lua_State* L) { char *s = get_table_str_opt(L, "class", NULL); int ret = -1; @@ -3286,9 +3202,7 @@ lua_State *L; } static int -find_objtype(L, s) -lua_State *L; -const char *s; +find_objtype(lua_State* L, const char *s) { if (s) { int i; @@ -3326,8 +3240,7 @@ const char *s; } static int -get_table_objtype(L) -lua_State *L; +get_table_objtype(lua_State* L) { char *s = get_table_str_opt(L, "id", NULL); int ret = find_objtype(L, s); @@ -3344,8 +3257,7 @@ lua_State *L; /* object({ id = "boulder", x = 03, y = 12}); */ /* object({ id = "boulder", coord = {03,12} }); */ int -lspo_object(L) -lua_State *L; +lspo_object(lua_State* L) { static object zeroobject = { DUMMY }; #if 0 @@ -3512,8 +3424,7 @@ lua_State *L; /* level_flags("noteleport", "mazelevel", ... ); */ int -lspo_level_flags(L) -lua_State *L; +lspo_level_flags(lua_State* L) { int argc = lua_gettop(L); int i; @@ -3571,8 +3482,7 @@ lua_State *L; /* level_init({ style = "solidfill", fg = " " }); */ /* level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 }) */ int -lspo_level_init(L) -lua_State *L; +lspo_level_init(lua_State* L) { static const char *const initstyles[] = { "solidfill", "mazegrid", "maze", "rogue", "mines", "swamp", NULL @@ -3616,8 +3526,7 @@ lua_State *L; /* engraving({ coord={1, 1}, type="burn", text="Foo" }); */ /* engraving({x,y}, "engrave", "Foo"); */ int -lspo_engraving(L) -lua_State *L; +lspo_engraving(lua_State* L) { static const char *const engrtypes[] = { "dust", "engrave", "burn", "mark", "blood", NULL @@ -3665,8 +3574,7 @@ lua_State *L; } int -lspo_mineralize(L) -lua_State *L; +lspo_mineralize(lua_State* L) { int gem_prob, gold_prob, kelp_moat, kelp_pool; @@ -3717,10 +3625,7 @@ static const struct { }; static int -get_table_roomtype_opt(L, name, defval) -lua_State *L; -const char *name; -int defval; +get_table_roomtype_opt(lua_State* L, const char *name, int defval) { char *roomstr = get_table_str_opt(L, name, emptystr); int i, res = defval; @@ -3742,8 +3647,7 @@ int defval; /* room({ lit=1, coord={3,3}, xalign="center",yalign="center", w=11,h=9 }); */ /* room({ coord={3,3}, xalign="center",yalign="center", w=11,h=9, contents=function(room) ... end }); */ int -lspo_room(L) -lua_State *L; +lspo_room(lua_State* L) { create_des_coder(); @@ -3826,8 +3730,7 @@ lua_State *L; } static void -spo_endroom(coder) -struct sp_coder *coder UNUSED; +spo_endroom(struct sp_coder* coder UNUSED) { if (g.coder->n_subroom > 1) { g.coder->n_subroom--; @@ -3849,9 +3752,7 @@ struct sp_coder *coder UNUSED; } static int -l_create_stairway(L, using_ladder) -lua_State *L; -boolean using_ladder; +l_create_stairway(lua_State* L, boolean using_ladder) { static const char *const stairdirs[] = { "down", "up", NULL }; static const int stairdirs2i[] = { 0, 1 }; @@ -3922,8 +3823,7 @@ boolean using_ladder; /* TODO: stair(selection, "down"); */ /* TODO: stair("up", {x,y}); */ int -lspo_stair(L) -lua_State *L; +lspo_stair(lua_State* L) { return l_create_stairway(L, FALSE); } @@ -3932,8 +3832,7 @@ lua_State *L; /* ladder("up", 6,10); */ /* ladder({ x=11, y=05, dir="down" }); */ int -lspo_ladder(L) -lua_State *L; +lspo_ladder(lua_State* L) { return l_create_stairway(L, TRUE); } @@ -3944,8 +3843,7 @@ lua_State *L; /* grave({ x = 1, y = 1, text = "Foo" }); */ /* grave({ coord = {1, 1}, text = "Foo" }); */ int -lspo_grave(L) -lua_State *L; +lspo_grave(lua_State* L) { int argc = lua_gettop(L); xchar x, y; @@ -3985,8 +3883,7 @@ lua_State *L; /* altar({ x=NN, y=NN, align=ALIGNMENT, type=SHRINE }); */ /* des.altar({ coord = {5, 10}, align="noalign", type="altar" }); */ int -lspo_altar(L) -lua_State *L; +lspo_altar(lua_State* L) { static const char *const shrines[] = { "altar", "shrine", "sanctum", NULL @@ -4053,10 +3950,7 @@ static const struct { { 0, NO_TRAP } }; static int -get_table_traptype_opt(L, name, defval) -lua_State *L; -const char *name; -int defval; +get_table_traptype_opt(lua_State* L, const char *name, int defval) { char *trapstr = get_table_str_opt(L, name, emptystr); int i, res = defval; @@ -4073,8 +3967,7 @@ int defval; } const char * -get_trapname_bytype(ttyp) -int ttyp; +get_trapname_bytype(int ttyp) { int i; @@ -4086,8 +3979,7 @@ int ttyp; } static int -get_traptype_byname(trapname) -const char *trapname; +get_traptype_byname(const char *trapname) { int i; @@ -4104,8 +3996,7 @@ const char *trapname; /* trap("rust") */ /* trap(); */ int -lspo_trap(L) -lua_State *L; +lspo_trap(lua_State* L) { spltrap tmptrap; int x, y; @@ -4156,8 +4047,7 @@ lua_State *L; /* gold({ amount = 500, coord = {2, 5} });*/ /* gold(); */ int -lspo_gold(L) -lua_State *L; +lspo_gold(lua_State* L) { int argc = lua_gettop(L); xchar x, y; @@ -4202,8 +4092,7 @@ lua_State *L; /* corridor({ srcroom=1, srcdoor=2, srcwall="north", destroom=2, destdoor=1, destwall="west" });*/ int -lspo_corridor(L) -lua_State *L; +lspo_corridor(lua_State* L) { static const char *const walldirs[] = { "all", "random", "north", "west", "east", "south", NULL @@ -4231,8 +4120,7 @@ lua_State *L; /* random_corridors(); */ int -lspo_random_corridors(L) -lua_State *L UNUSED; +lspo_random_corridors(lua_State* L UNUSED) { corridor tc; @@ -4252,7 +4140,7 @@ lua_State *L UNUSED; /* selection */ struct selectionvar * -selection_new() +selection_new(void) { struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof(struct selectionvar)); @@ -4266,9 +4154,7 @@ selection_new() } void -selection_free(sel, freesel) -struct selectionvar *sel; -boolean freesel; +selection_free(struct selectionvar* sel, boolean freesel) { if (sel) { Free(sel->map); @@ -4281,8 +4167,7 @@ boolean freesel; } struct selectionvar * -selection_clone(sel) -struct selectionvar *sel; +selection_clone(struct selectionvar* sel) { struct selectionvar * tmps = (struct selectionvar *) alloc(sizeof (struct selectionvar)); @@ -4295,9 +4180,7 @@ struct selectionvar *sel; } xchar -selection_getpoint(x, y, sel) -int x, y; -struct selectionvar *sel; +selection_getpoint(int x, int y, struct selectionvar* sel) { if (!sel || !sel->map) return 0; @@ -4308,10 +4191,7 @@ struct selectionvar *sel; } void -selection_setpoint(x, y, sel, c) -int x, y; -struct selectionvar *sel; -xchar c; +selection_setpoint(int x, int y, struct selectionvar* sel, xchar c) { if (!sel || !sel->map) return; @@ -4322,8 +4202,7 @@ xchar c; } struct selectionvar * -selection_not(s) -struct selectionvar *s; +selection_not(struct selectionvar* s) { int x, y; @@ -4336,10 +4215,7 @@ struct selectionvar *s; } struct selectionvar * -selection_filter_mapchar(ov, typ, lit) -struct selectionvar *ov; -xchar typ; -int lit; +selection_filter_mapchar(struct selectionvar* ov, xchar typ, int lit) { int x, y; struct selectionvar *ret = selection_new(); @@ -4369,9 +4245,7 @@ int lit; } void -selection_filter_percent(ov, percent) -struct selectionvar *ov; -int percent; +selection_filter_percent(struct selectionvar* ov, int percent) { int x, y; @@ -4384,10 +4258,7 @@ int percent; } int -selection_rndcoord(ov, x, y, removeit) -struct selectionvar *ov; -xchar *x, *y; -boolean removeit; +selection_rndcoord(struct selectionvar* ov, xchar *x, xchar *y, boolean removeit) { int idx = 0; int c; @@ -4418,9 +4289,7 @@ boolean removeit; } void -selection_do_grow(ov, dir) -struct selectionvar *ov; -int dir; +selection_do_grow(struct selectionvar* ov, int dir) { int x, y; struct selectionvar *tmp = selection_new(); @@ -4458,34 +4327,30 @@ int dir; selection_free(tmp, TRUE); } -static int FDECL((*selection_flood_check_func), (int, int)); +static int (*selection_flood_check_func)(int, int); static schar floodfillchk_match_under_typ; void -set_selection_floodfillchk(f) -int FDECL((*f), (int, int)); +set_selection_floodfillchk(int (*f)(int, int)) { selection_flood_check_func = f; } static int -floodfillchk_match_under(x,y) -int x,y; +floodfillchk_match_under(int x, int y) { return (floodfillchk_match_under_typ == levl[x][y].typ); } void -set_floodfillchk_match_under(typ) -xchar typ; +set_floodfillchk_match_under(xchar typ) { floodfillchk_match_under_typ = typ; set_selection_floodfillchk(floodfillchk_match_under); } static int -floodfillchk_match_accessible(x, y) -int x, y; +floodfillchk_match_accessible(int x, int y) { return (ACCESSIBLE(levl[x][y].typ) || levl[x][y].typ == SDOOR @@ -4494,10 +4359,7 @@ int x, y; /* check whethere is already in xs[],ys[] */ static boolean -sel_flood_havepoint(x, y, xs, ys, n) -int x, y; -xchar xs[], ys[]; -int n; +sel_flood_havepoint(int x, int y, xchar xs[], xchar ys[], int n) { xchar xx = (xchar) x, yy = (xchar) y; @@ -4510,10 +4372,7 @@ int n; } void -selection_floodfill(ov, x, y, diagonals) -struct selectionvar *ov; -int x, y; -boolean diagonals; +selection_floodfill(struct selectionvar* ov, int x, int y, boolean diagonals) { struct selectionvar *tmp = selection_new(); #define SEL_FLOOD_STACK (COLNO * ROWNO) @@ -4539,7 +4398,7 @@ boolean diagonals; xchar dx[SEL_FLOOD_STACK]; xchar dy[SEL_FLOOD_STACK]; - if (selection_flood_check_func == (int FDECL((*), (int, int))) 0) { + if (selection_flood_check_func == (int (*)(int, int)) 0) { selection_free(tmp, TRUE); return; } @@ -4571,9 +4430,11 @@ boolean diagonals; /* McIlroy's Ellipse Algorithm */ void -selection_do_ellipse(ov, xc, yc, a, b, filled) -struct selectionvar *ov; -int xc, yc, a, b, filled; +selection_do_ellipse( + struct selectionvar *ov, + int xc, int yc, + int a, int b, + int filled) { /* e(x,y) = b^2*x^2 + a^2*y^2 - a^2*b^2 */ int x = 0, y = b; long a2 = (long) a * a, b2 = (long) b * b; @@ -4655,8 +4516,7 @@ int xc, yc, a, b, filled; /* distance from line segment (x1,y1, x2,y2) to point (x3,y3) */ static long -line_dist_coord(x1, y1, x2, y2, x3, y3) -long x1, y1, x2, y2, x3, y3; +line_dist_coord(long x1, long y1, long x2, long y2, long x3, long y3) { long px = x2 - x1; long py = y2 - y1; @@ -4683,9 +4543,12 @@ long x1, y1, x2, y2, x3, y3; } void -selection_do_gradient(ov, x, y, x2, y2, gtyp, mind, maxd, limit) -struct selectionvar *ov; -long x, y, x2, y2, gtyp, mind, maxd, limit; +selection_do_gradient( + struct selectionvar *ov, + long x, long y, + long x2,long y2, + long gtyp, + long mind, long maxd, long limit) { long dx, dy, dofs; @@ -4736,9 +4599,10 @@ long x, y, x2, y2, gtyp, mind, maxd, limit; /* bresenham line algo */ void -selection_do_line(x1, y1, x2, y2, ov) -xchar x1, y1, x2, y2; -struct selectionvar *ov; +selection_do_line( +xchar x1, xchar y1, +xchar x2, xchar y2, +struct selectionvar *ov) { int d0, dx, dy, ai, bi, xi, yi; @@ -4790,10 +4654,12 @@ struct selectionvar *ov; } void -selection_do_randline(x1, y1, x2, y2, rough, rec, ov) -xchar x1, y1, x2, y2; -schar rough, rec; -struct selectionvar *ov; +selection_do_randline( +xchar x1, xchar y1, +xchar x2, xchar y2, +schar rough, +schar rec, +struct selectionvar *ov) { int mx, my; int dx, dy; @@ -4831,10 +4697,10 @@ struct selectionvar *ov; } static void -selection_iterate(ov, func, arg) -struct selectionvar *ov; -select_iter_func func; -genericptr_t arg; +selection_iterate( +struct selectionvar *ov, +select_iter_func func, +genericptr_t arg) { int x, y; @@ -4849,9 +4715,7 @@ genericptr_t arg; } static void -sel_set_ter(x, y, arg) -int x, y; -genericptr_t arg; +sel_set_ter(int x, int y, genericptr_t arg) { terrain terr; @@ -4867,9 +4731,7 @@ genericptr_t arg; } static void -sel_set_feature(x, y, arg) -int x, y; -genericptr_t arg; +sel_set_feature(int x, int y, genericptr_t arg) { if (IS_FURNITURE(levl[x][y].typ)) return; @@ -4877,9 +4739,7 @@ genericptr_t arg; } static void -sel_set_door(dx, dy, arg) -int dx, dy; -genericptr_t arg; +sel_set_door(int dx, int dy, genericptr_t arg) { xchar typ = *(xchar *) arg; xchar x = dx, y = dy; @@ -4901,8 +4761,7 @@ genericptr_t arg; /* door({ wall = "north", pos = 3, state="secret" }); */ /* door("nodoor", 1, 2); */ int -lspo_door(L) -lua_State *L; +lspo_door(lua_State* L) { static const char *const doorstates[] = { "random", "open", "closed", "locked", "nodoor", "broken", @@ -4963,11 +4822,11 @@ lua_State *L; } static void -l_table_getset_feature_flag(L, x,y, name, flag) -lua_State *L; -int x, y; -const char *name; -int flag; +l_table_getset_feature_flag( + lua_State *L, + int x, int y, + const char *name, + int flag) { int val = get_table_boolean_opt(L, name, -2); @@ -4986,8 +4845,7 @@ int flag; /* feature({ type="fountain", coord={NN, NN} }); */ /* feature({ type="tree", coord={NN, NN}, swarm=true, looted=false }); */ int -lspo_feature(L) -lua_State *L; +lspo_feature(lua_State* L) { static const char *const features[] = { "fountain", "sink", "pool", "throne", "tree", NULL }; @@ -5065,8 +4923,7 @@ lua_State *L; * terrain(x,y, MAPCHAR); */ int -lspo_terrain(L) -lua_State *L; +lspo_terrain(lua_State* L) { terrain tmpterrain; xchar x = 0, y = 0; @@ -5134,8 +4991,7 @@ lua_State *L; * toterrain=MAPCHAR }); */ int -lspo_replace_terrain(L) -lua_State *L; +lspo_replace_terrain(lua_State* L) { xchar totyp, fromtyp; struct mapfragment *mf = NULL; @@ -5225,9 +5081,9 @@ lua_State *L; } static boolean -generate_way_out_method(nx,ny, ov) -int nx,ny; -struct selectionvar *ov; +generate_way_out_method( + int nx, int ny, + struct selectionvar *ov) { static const int escapeitems[] = { PICK_AXE, DWARVISH_MATTOCK, WAN_DIGGING, @@ -5296,7 +5152,7 @@ struct selectionvar *ov; } static void -ensure_way_out() +ensure_way_out(void) { struct selectionvar *ov = selection_new(); struct trap *ttmp = g.ftrap; @@ -5338,9 +5194,7 @@ ensure_way_out() } static int -get_table_intarray_entry(L, tableidx, entrynum) -lua_State *L; -int tableidx, entrynum; +get_table_intarray_entry(lua_State* L, int tableidx, int entrynum) { int ret = 0; if (tableidx < 0) @@ -5361,11 +5215,12 @@ int tableidx, entrynum; } static int -get_table_region(L, name, x1,y1, x2,y2, optional) -lua_State *L; -const char *name; -int *x1, *y1, *x2, *y2; -boolean optional; +get_table_region( + lua_State *L, + const char *name, + int *x1, int *y1, + int *x2, int *y2, + boolean optional) { int arrlen; @@ -5396,15 +5251,12 @@ boolean optional; } static int -get_coord(L, index, x, y) -lua_State *L; -int index; -int *x, *y; +get_coord(lua_State* L, int i, int *x, int *y) { - if (lua_type(L, index) == LUA_TTABLE) { + if (lua_type(L, i) == LUA_TTABLE) { int arrlen; - lua_len(L, index); + lua_len(L, i); arrlen = lua_tointeger(L, -1); lua_pop(L, 1); if (arrlen != 2) { @@ -5412,8 +5264,8 @@ int *x, *y; return 0; } - *x = get_table_intarray_entry(L, index, 1); - *y = get_table_intarray_entry(L, index, 2); + *x = get_table_intarray_entry(L, i, 1); + *y = get_table_intarray_entry(L, i, 2); return 1; } @@ -5421,8 +5273,7 @@ int *x, *y; } static void -levregion_add(lregion) -lev_region *lregion; +levregion_add(lev_region* lregion) { if (!lregion->in_islev) { get_location(&lregion->inarea.x1, &lregion->inarea.y1, ANY_LOC, @@ -5459,8 +5310,7 @@ lev_region *lregion; /* teleport_region({ region = { x1,y1, x2,y2}, [ region_islev = 1, ] exclude = { x1,y1, x2,y2}, [ exclude_islen = 1, ] [ dir = "up" ] }); */ /* TODO: maybe allow using selection, with a new selection method "getextents()"? */ int -lspo_teleport_region(L) -lua_State *L; +lspo_teleport_region(lua_State* L) { static const char *const teledirs[] = { "both", "down", "up", NULL }; static const int teledirs2i[] = { LR_TELE, LR_DOWNTELE, LR_UPTELE, -1 }; @@ -5507,8 +5357,7 @@ lua_State *L; /* levregion({ region = { x1,y1, x2,y2 }, exclude = { x1,y1, x2,y2 }, type = "portal", name="air" }); */ /* TODO: allow region to be optional, defaulting to whole level */ int -lspo_levregion(L) -lua_State *L; +lspo_levregion(lua_State* L) { static const char *const regiontypes[] = { "stair-down", "stair-up", "portal", "branch", @@ -5552,9 +5401,7 @@ lua_State *L; } static void -sel_set_lit(x, y, arg) -int x, y; -genericptr_t arg; +sel_set_lit(int x, int y, genericptr_t arg) { int lit = *(int *)arg; @@ -5565,8 +5412,7 @@ genericptr_t arg; /* region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL, irregular=BOOL, filled=NN [ , contents = FUNCTION ] }); */ /* region({ region={x1,y1, x2,y2}, type="ordinary" }); */ int -lspo_region(L) -lua_State *L; +lspo_region(lua_State* L) { xchar dx1, dy1, dx2, dy2; register struct mkroom *troom; @@ -5702,8 +5548,7 @@ lua_State *L; /* drawbridge({ dir="east", state="closed", x=05,y=08 }); */ /* drawbridge({ dir="east", state="closed", coord={05,08} }); */ int -lspo_drawbridge(L) -lua_State *L; +lspo_drawbridge(lua_State* L) { static const char *const mwdirs[] = { "north", "south", "west", "east", "random", NULL @@ -5746,8 +5591,7 @@ lua_State *L; /* mazewalk({ coord = {XX, YY}, typ = ".", dir = "north", stocked = 0 }); */ /* mazewalk(x,y,dir); */ int -lspo_mazewalk(L) -lua_State *L; +lspo_mazewalk(lua_State* L) { static const char *const mwdirs[] = { "north", "south", "east", "west", "random", NULL @@ -5847,8 +5691,7 @@ lua_State *L; /* wall_property({ x1=0, y1=0, x2=78, y2=20, property="nondiggable" }); */ /* wall_property({ region = {1,0, 78,20}, property="nonpasswall" }); */ int -lspo_wall_property(L) -lua_State *L; +lspo_wall_property(lua_State* L) { static const char *const wprops[] = { "nondiggable", "nonpasswall", NULL }; static const int wprop2i[] = { W_NONDIGGABLE, W_NONPASSWALL, -1 }; @@ -5891,9 +5734,7 @@ lua_State *L; } static void -set_wallprop_in_selection(L, prop) -lua_State *L; -int prop; +set_wallprop_in_selection(lua_State* L, int prop) { int argc = lua_gettop(L); boolean freesel = FALSE; @@ -5919,8 +5760,7 @@ int prop; /* non_diggable(selection); */ /* non_diggable(); */ int -lspo_non_diggable(L) -lua_State *L; +lspo_non_diggable(lua_State* L) { set_wallprop_in_selection(L, W_NONDIGGABLE); return 0; @@ -5929,8 +5769,7 @@ lua_State *L; /* non_passwall(selection); */ /* non_passwall(); */ int -lspo_non_passwall(L) -lua_State *L; +lspo_non_passwall(lua_State* L) { set_wallprop_in_selection(L, W_NONPASSWALL); return 0; @@ -5939,9 +5778,7 @@ lua_State *L; #if 0 /*ARGSUSED*/ static void -sel_set_wallify(x, y, arg) -int x, y; -genericptr_t arg UNUSED; +sel_set_wallify(int x, int y, genericptr_t arg UNUSED) { wallify_map(x, y, x, y); } @@ -5951,8 +5788,7 @@ genericptr_t arg UNUSED; /* wallify({ x1=NN,y1=NN, x2=NN,y2=NN }); */ /* wallify(); */ int -lspo_wallify(L) -lua_State *L; +lspo_wallify(lua_State* L) { int dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1; @@ -5979,8 +5815,7 @@ lua_State *L; /* reset_level is only needed for testing purposes */ int -lspo_reset_level(L) -lua_State *L UNUSED; +lspo_reset_level(lua_State* L UNUSED) { boolean wtower = In_W_tower(u.ux, u.uy, &u.uz); @@ -5996,8 +5831,7 @@ lua_State *L UNUSED; /* map({ map = [[...]], contents = function(map) ... end }); */ /* map([[...]]) */ int -lspo_map(L) -lua_State *L; +lspo_map(lua_State* L) { /* TODO: allow passing an array of strings as map data @@ -6245,7 +6079,7 @@ skipmap: } void -update_croom() +update_croom(void) { if (!g.coder) return; @@ -6257,7 +6091,7 @@ update_croom() } static struct sp_coder * -sp_level_coder_init() +sp_level_coder_init(void) { int tmpi; struct sp_coder *coder = @@ -6352,8 +6186,7 @@ static const struct luaL_Reg nhl_functions[] = { */ void -l_register_des(L) -lua_State *L; +l_register_des(lua_State* L) { /* register des -table, and functions for it */ lua_newtable(L); @@ -6362,7 +6195,7 @@ lua_State *L; } void -create_des_coder() +create_des_coder(void) { if (!g.coder) g.coder = sp_level_coder_init(); @@ -6372,8 +6205,7 @@ create_des_coder() * General loader */ boolean -load_special(name) -const char *name; +load_special(const char *name) { boolean result = FALSE; diff --git a/src/spell.c b/src/spell.c index ca5311d46..a56536e7a 100644 --- a/src/spell.c +++ b/src/spell.c @@ -25,25 +25,24 @@ #define spellet(spell) \ ((char) ((spell < 26) ? ('a' + spell) : ('A' + spell - 26))) -static int FDECL(spell_let_to_idx, (CHAR_P)); -static boolean FDECL(cursed_book, (struct obj * bp)); -static boolean FDECL(confused_book, (struct obj *)); -static void FDECL(deadbook, (struct obj *)); -static int NDECL(learn); -static boolean NDECL(rejectcasting); -static boolean FDECL(getspell, (int *)); -static int FDECL(CFDECLSPEC spell_cmp, (const genericptr, - const genericptr)); -static void NDECL(sortspells); -static boolean NDECL(spellsortmenu); -static boolean FDECL(dospellmenu, (const char *, int, int *)); -static int FDECL(percent_success, (int)); -static char *FDECL(spellretention, (int, char *)); -static int NDECL(throwspell); -static void NDECL(cast_protection); -static void FDECL(spell_backfire, (int)); -static const char *FDECL(spelltypemnemonic, (int)); -static boolean FDECL(spell_aim_step, (genericptr_t, int, int)); +static int spell_let_to_idx(char); +static boolean cursed_book(struct obj * bp); +static boolean confused_book(struct obj *); +static void deadbook(struct obj *); +static int learn(void); +static boolean rejectcasting(void); +static boolean getspell(int *); +static int CFDECLSPEC spell_cmp(const genericptr, const genericptr); +static void sortspells(void); +static boolean spellsortmenu(void); +static boolean dospellmenu(const char *, int, int *); +static int percent_success(int); +static char *spellretention(int, char *); +static int throwspell(void); +static void cast_protection(void); +static void spell_backfire(int); +static const char *spelltypemnemonic(int); +static boolean spell_aim_step(genericptr_t, int, int); /* The roles[] table lists the role-specific values for tuning * percent_success(). @@ -102,8 +101,7 @@ static const char explodes[] = "radiates explosive energy"; /* convert a letter into a number in the range 0..51, or -1 if not a letter */ static int -spell_let_to_idx(ilet) -char ilet; +spell_let_to_idx(char ilet) { int indx; @@ -118,8 +116,7 @@ char ilet; /* TRUE: book should be destroyed by caller */ static boolean -cursed_book(bp) -struct obj *bp; +cursed_book(struct obj* bp) { boolean was_in_use; int lev = objects[bp->otyp].oc_level; @@ -178,8 +175,7 @@ struct obj *bp; /* study while confused: returns TRUE if the book is destroyed */ static boolean -confused_book(spellbook) -struct obj *spellbook; +confused_book(struct obj* spellbook) { boolean gone = FALSE; @@ -204,8 +200,7 @@ struct obj *spellbook; /* special effects for The Book of the Dead; reading it while blind is allowed so that needs to be taken into account too */ static void -deadbook(book2) -struct obj *book2; +deadbook(struct obj* book2) { struct monst *mtmp, *mtmp2; coord mm; @@ -335,8 +330,7 @@ struct obj *book2; /* 'book' has just become cursed; if we're reading it and realize it is now cursed, interrupt */ void -book_cursed(book) -struct obj *book; +book_cursed(struct obj* book) { if (g.occupation == learn && g.context.spbook.book == book && book->cursed && book->bknown && g.multi >= 0) @@ -442,8 +436,7 @@ learn(VOID_ARGS) } int -study_book(spellbook) -register struct obj *spellbook; +study_book(register struct obj* spellbook) { int booktype = spellbook->otyp, i; boolean confused = (Confusion != 0); @@ -614,8 +607,7 @@ register struct obj *spellbook; /* a spellbook has been destroyed or the character has changed levels; the stored address for the current book is no longer valid */ void -book_disappears(obj) -struct obj *obj; +book_disappears(struct obj* obj) { if (obj == g.context.spbook.book) { g.context.spbook.book = (struct obj *) 0; @@ -627,8 +619,7 @@ struct obj *obj; so the sequence start reading, get interrupted, name the book, resume reading would read the "new" book from scratch */ void -book_substitution(old_obj, new_obj) -struct obj *old_obj, *new_obj; +book_substitution(struct obj* old_obj, struct obj* new_obj) { if (old_obj == g.context.spbook.book) { g.context.spbook.book = new_obj; @@ -639,7 +630,7 @@ struct obj *old_obj, *new_obj; /* called from moveloop() */ void -age_spells() +age_spells(void) { int i; /* @@ -657,7 +648,7 @@ age_spells() /* return True if spellcasting is inhibited; only covers a small subset of reasons why casting won't work */ static boolean -rejectcasting() +rejectcasting(void) { /* rejections which take place before selecting a particular spell */ if (Stunned) { @@ -685,8 +676,7 @@ rejectcasting() * parameter. Otherwise return FALSE. */ static boolean -getspell(spell_no) -int *spell_no; +getspell(int* spell_no) { int nspells, idx; char ilet, lets[BUFSZ], qbuf[QBUFSZ]; @@ -738,7 +728,7 @@ int *spell_no; /* the 'Z' command -- cast a spell */ int -docast() +docast(void) { int spell_no; @@ -748,8 +738,7 @@ docast() } static const char * -spelltypemnemonic(skill) -int skill; +spelltypemnemonic(int skill) { switch (skill) { case P_ATTACK_SPELL: @@ -773,14 +762,13 @@ int skill; } int -spell_skilltype(booktype) -int booktype; +spell_skilltype(int booktype) { return objects[booktype].oc_skill; } static void -cast_protection() +cast_protection(void) { int l = u.ulevel, loglev = 0, gain, natac = u.uac + u.uspellprot; @@ -861,8 +849,7 @@ cast_protection() /* attempting to cast a forgotten spell will cause disorientation */ static void -spell_backfire(spell) -int spell; +spell_backfire(int spell) { long duration = (long) ((spellev(spell) + 1) * 3), /* 6..24 */ old_stun = (HStun & TIMEOUT), old_conf = (HConfusion & TIMEOUT); @@ -901,9 +888,7 @@ int spell; } int -spelleffects(spell, atme) -int spell; -boolean atme; +spelleffects(int spell, boolean atme) { int energy, damage, chance, n, intell; int otyp, skill, role_skill, res = 0; @@ -1234,9 +1219,7 @@ boolean atme; /*ARGSUSED*/ static boolean -spell_aim_step(arg, x, y) -genericptr_t arg UNUSED; -int x, y; +spell_aim_step(genericptr_t arg UNUSED, int x, int y) { if (!isok(x,y)) return FALSE; @@ -1248,7 +1231,7 @@ int x, y; /* Choose location where spell takes effect. */ static int -throwspell() +throwspell(void) { coord cc, uc; struct monst *mtmp; @@ -1298,8 +1281,7 @@ throwspell() /* add/hide/remove/unhide teleport-away on behalf of dotelecmd() to give more control to behavior of ^T when used in wizard mode */ int -tport_spell(what) -int what; +tport_spell(int what) { static struct tport_hideaway { struct spell savespell; @@ -1355,7 +1337,7 @@ int what; they used to be lost entirely, as if never learned, but now we just set the memory retention to zero so that they can't be cast */ void -losespells() +losespells(void) { int n, nzap, i; @@ -1462,9 +1444,7 @@ static const char *spl_sortchoices[NUM_SPELL_SORTBY] = { /* qsort callback routine */ static int CFDECLSPEC -spell_cmp(vptr1, vptr2) -const genericptr vptr1; -const genericptr vptr2; +spell_cmp(const genericptr vptr1, const genericptr vptr2) { /* * gather up all of the possible parameters except spell name @@ -1521,7 +1501,7 @@ const genericptr vptr2; list (sortmode == SORTBY_xxx), or sort the spellbook itself to make the current display order stick (sortmode == SORTRETAINORDER) */ static void -sortspells() +sortspells(void) { int i; #if defined(SYSV) || defined(DGUX) @@ -1569,7 +1549,7 @@ sortspells() /* called if the [sort spells] entry in the view spells menu gets chosen */ static boolean -spellsortmenu() +spellsortmenu(void) { winid tmpwin; menu_item *selected; @@ -1614,7 +1594,7 @@ spellsortmenu() /* the '+' command -- view known spells */ int -dovspell() +dovspell(void) { char qbuf[QBUFSZ]; int splnum, othnum; @@ -1649,10 +1629,10 @@ dovspell() } static boolean -dospellmenu(prompt, splaction, spell_no) -const char *prompt; -int splaction; /* SPELLMENU_CAST, SPELLMENU_VIEW, or g.spl_book[] index */ -int *spell_no; +dospellmenu( + const char *prompt, + int splaction, /* SPELLMENU_CAST, SPELLMENU_VIEW, or g.spl_book[] index */ + int *spell_no) { winid tmpwin; int i, n, how, splnum; @@ -1733,8 +1713,7 @@ int *spell_no; } static int -percent_success(spell) -int spell; +percent_success(int spell) { /* Intrinsic and learned ability are combined to calculate * the probability of player's success at cast a given spell. @@ -1848,9 +1827,7 @@ int spell; } static char * -spellretention(idx, outbuf) -int idx; -char *outbuf; +spellretention(int idx, char * outbuf) { long turnsleft, percent, accuracy; int skill; @@ -1895,8 +1872,7 @@ char *outbuf; /* Learn a spell during creation of the initial inventory */ void -initialspell(obj) -struct obj *obj; +initialspell(struct obj* obj) { int i, otyp = obj->otyp; diff --git a/src/steal.c b/src/steal.c index 790a08128..a887c0cb2 100644 --- a/src/steal.c +++ b/src/steal.c @@ -5,13 +5,12 @@ #include "hack.h" -static int NDECL(stealarm); -static int NDECL(unstolenarm); -static const char *FDECL(equipname, (struct obj *)); +static int stealarm(void); +static int unstolenarm(void); +static const char *equipname(struct obj *); static const char * -equipname(otmp) -register struct obj *otmp; +equipname(register struct obj* otmp) { return ((otmp == uarmu) ? shirt_simple_name(otmp) : (otmp == uarmf) ? boots_simple_name(otmp) @@ -24,8 +23,7 @@ register struct obj *otmp; /* proportional subset of gold; return value actually fits in an int */ long -somegold(lmoney) -long lmoney; +somegold(long lmoney) { #ifdef LINT /* long conv. ok */ int igold = 0; @@ -60,8 +58,7 @@ long lmoney; * Deals in gold only, as leprechauns don't care for lesser coins. */ struct obj * -findgold(chain) -register struct obj *chain; +findgold(register struct obj* chain) { while (chain && chain->otyp != GOLD_PIECE) chain = chain->nobj; @@ -72,8 +69,7 @@ register struct obj *chain; * Steal gold coins only. Leprechauns don't care for lesser coins. */ void -stealgold(mtmp) -register struct monst *mtmp; +stealgold(register struct monst* mtmp) { register struct obj *fgold = g_at(u.ux, u.uy); register struct obj *ygold; @@ -135,7 +131,7 @@ register struct monst *mtmp; /* monster who was stealing from hero has just died */ void -thiefdead() +thiefdead(void) { /* hero is busy taking off an item of armor which takes multiple turns */ g.stealmid = 0; @@ -205,9 +201,9 @@ stealarm(VOID_ARGS) /* An object you're wearing has been taken off by a monster (theft or seduction). Also used if a worn item gets transformed (stone to flesh). */ void -remove_worn_item(obj, unchain_ball) -struct obj *obj; -boolean unchain_ball; /* whether to unpunish or just unwield */ +remove_worn_item( + struct obj *obj, + boolean unchain_ball) /* whether to unpunish or just unwield */ { if (donning(obj)) cancel_don(); @@ -266,9 +262,7 @@ boolean unchain_ball; /* whether to unpunish or just unwield */ * Nymphs and monkeys won't steal coins. */ int -steal(mtmp, objnambuf) -struct monst *mtmp; -char *objnambuf; +steal(struct monst* mtmp, char* objnambuf) { struct obj *otmp; int tmp, could_petrify, armordelay, olddelay, icnt, @@ -499,9 +493,7 @@ char *objnambuf; /* Returns 1 if otmp is free'd, 0 otherwise. */ int -mpickobj(mtmp, otmp) -register struct monst *mtmp; -register struct obj *otmp; +mpickobj(register struct monst* mtmp, register struct obj* otmp) { int freed_otmp; boolean snuff_otmp = FALSE; @@ -548,8 +540,7 @@ register struct obj *otmp; /* called for AD_SAMU (the Wizard and quest nemeses) */ void -stealamulet(mtmp) -struct monst *mtmp; +stealamulet(struct monst* mtmp) { char buf[BUFSZ]; struct obj *otmp = 0, *obj = 0; @@ -631,10 +622,10 @@ struct monst *mtmp; /* when a mimic gets poked with something, it might take that thing (at present, only implemented for when the hero does the poking) */ void -maybe_absorb_item(mon, obj, ochance, achance) -struct monst *mon; -struct obj *obj; -int ochance, achance; /* percent chance for ordinary item, artifact */ +maybe_absorb_item( + struct monst *mon, + struct obj *obj, + int ochance, int achance) /* percent chance for ordinary item, artifact */ { if (obj == uball || obj == uchain || obj->oclass == ROCK_CLASS || obj_resists(obj, 100 - ochance, 100 - achance) @@ -674,10 +665,10 @@ int ochance, achance; /* percent chance for ordinary item, artifact */ /* drop one object taken from a (possibly dead) monster's inventory */ void -mdrop_obj(mon, obj, verbosely) -struct monst *mon; -struct obj *obj; -boolean verbosely; +mdrop_obj( + struct monst *mon, + struct obj *obj, + boolean verbosely) { int omx = mon->mx, omy = mon->my; boolean update_mon = FALSE; @@ -719,8 +710,7 @@ boolean verbosely; even leaving the game entirely; when that happens, prevent them from taking the Amulet, invocation items, or quest artifact with them */ void -mdrop_special_objs(mon) -struct monst *mon; +mdrop_special_objs(struct monst* mon) { struct obj *obj, *otmp; @@ -749,10 +739,10 @@ struct monst *mon; /* release the objects the creature is carrying */ void -relobj(mtmp, show, is_pet) -struct monst *mtmp; -int show; -boolean is_pet; /* If true, pet should keep wielded/worn items */ +relobj( + struct monst *mtmp, + int show, + boolean is_pet) /* If true, pet should keep wielded/worn items */ { struct obj *otmp; int omx = mtmp->mx, omy = mtmp->my; diff --git a/src/steed.c b/src/steed.c index c7fb2f329..e374e6fab 100644 --- a/src/steed.c +++ b/src/steed.c @@ -9,12 +9,12 @@ static NEARDATA const char steeds[] = { S_QUADRUPED, S_UNICORN, S_ANGEL, S_CENTAUR, S_DRAGON, S_JABBERWOCK, '\0' }; -static boolean FDECL(landing_spot, (coord *, int, int)); -static void FDECL(maybewakesteed, (struct monst *)); +static boolean landing_spot(coord *, int, int); +static void maybewakesteed(struct monst *); /* caller has decided that hero can't reach something while mounted */ void -rider_cant_reach() +rider_cant_reach(void) { You("aren't skilled enough to reach from %s.", y_monnam(u.usteed)); } @@ -23,8 +23,7 @@ rider_cant_reach() /* Can this monster wear a saddle? */ boolean -can_saddle(mtmp) -struct monst *mtmp; +can_saddle(struct monst* mtmp) { struct permonst *ptr = mtmp->data; @@ -34,8 +33,7 @@ struct monst *mtmp; } int -use_saddle(otmp) -struct obj *otmp; +use_saddle(struct obj* otmp) { struct monst *mtmp; struct permonst *ptr; @@ -139,9 +137,7 @@ struct obj *otmp; } void -put_saddle_on_mon(saddle, mtmp) -struct obj *saddle; -struct monst *mtmp; +put_saddle_on_mon(struct obj* saddle, struct monst* mtmp) { if (!can_saddle(mtmp) || which_armor(mtmp, W_SADDLE)) return; @@ -157,8 +153,7 @@ struct monst *mtmp; /* Can we ride this monster? Caller should also check can_saddle() */ boolean -can_ride(mtmp) -struct monst *mtmp; +can_ride(struct monst* mtmp) { return (mtmp->mtame && humanoid(g.youmonst.data) && !verysmall(g.youmonst.data) && !bigmonst(g.youmonst.data) @@ -166,7 +161,7 @@ struct monst *mtmp; } int -doride() +doride(void) { boolean forcemount = FALSE; @@ -184,9 +179,9 @@ doride() /* Start riding, with the given monster */ boolean -mount_steed(mtmp, force) -struct monst *mtmp; /* The animal */ -boolean force; /* Quietly force this animal */ +mount_steed( + struct monst *mtmp, /* The animal */ + boolean force) /* Quietly force this animal */ { struct obj *otmp; char buf[BUFSZ]; @@ -363,7 +358,7 @@ boolean force; /* Quietly force this animal */ /* You and your steed have moved */ void -exercise_steed() +exercise_steed(void) { if (!u.usteed) return; @@ -378,7 +373,7 @@ exercise_steed() /* The player kicks or whips the steed */ void -kick_steed() +kick_steed(void) { char He[BUFSZ]; /* monverbself() appends to the "He"/"She"/"It" value */ if (!u.usteed) @@ -436,10 +431,10 @@ kick_steed() * Adapted from mail daemon code. */ static boolean -landing_spot(spot, reason, forceit) -coord *spot; /* landing position (we fill it in) */ -int reason; -int forceit; +landing_spot( + coord *spot, /* landing position (we fill it in) */ + int reason, + int forceit) { int i = 0, x, y, distance, min_distance = -1; boolean found = FALSE; @@ -482,8 +477,8 @@ int forceit; /* Stop riding the current steed */ void -dismount_steed(reason) -int reason; /* Player was thrown off etc. */ +dismount_steed( + int reason) /* Player was thrown off etc. */ { struct monst *mtmp; struct obj *otmp; @@ -698,8 +693,7 @@ int reason; /* Player was thrown off etc. */ /* when attempting to saddle or mount a sleeping steed, try to wake it up (for the saddling case, it won't be u.usteed yet) */ static void -maybewakesteed(steed) -struct monst *steed; +maybewakesteed(struct monst* steed) { int frozen = (int) steed->mfrozen; boolean wasimmobile = steed->msleeping || !steed->mcanmove; @@ -725,8 +719,7 @@ struct monst *steed; /* decide whether hero's steed is able to move; doesn't check for holding traps--those affect the hero directly */ boolean -stucksteed(checkfeeding) -boolean checkfeeding; +stucksteed(boolean checkfeeding) { struct monst *steed = u.usteed; @@ -746,9 +739,7 @@ boolean checkfeeding; } void -place_monster(mon, x, y) -struct monst *mon; -int x, y; +place_monster(struct monst* mon, int x, int y) { struct monst *othermon; const char *monnm, *othnm; diff --git a/src/symbols.c b/src/symbols.c index fccec4576..87d887e39 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -8,16 +8,16 @@ extern const uchar def_r_oc_syms[MAXOCLASSES]; /* drawing.c */ #if defined(TERMLIB) || defined(CURSES_GRAPHICS) -void NDECL((*decgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ +void (*decgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */ #endif /* TERMLIB || CURSES */ #ifdef PC9800 -void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ -void NDECL((*ascgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ +void (*ibmgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */ +void (*ascgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */ #endif #ifdef CURSES_GRAPHICS -void NDECL((*cursesgraphics_mode_callback)) = 0; +void (*cursesgraphics_mode_callback)(void) = 0; #endif /* * Explanations of the functions found below: @@ -72,7 +72,7 @@ void NDECL((*cursesgraphics_mode_callback)) = 0; */ void -init_symbols() +init_symbols(void) { init_ov_primary_symbols(); init_ov_rogue_symbols(); @@ -82,7 +82,7 @@ init_symbols() } void -init_showsyms() +init_showsyms(void) { register int i; @@ -100,7 +100,7 @@ init_showsyms() /* initialize defaults for the overrides to the rogue symset */ void -init_ov_rogue_symbols() +init_ov_rogue_symbols(void) { register int i; @@ -109,7 +109,7 @@ init_ov_rogue_symbols() } /* initialize defaults for the overrides to the primary symset */ void -init_ov_primary_symbols() +init_ov_primary_symbols(void) { register int i; @@ -118,8 +118,7 @@ init_ov_primary_symbols() } nhsym -get_othersym(idx, which_set) -int idx, which_set; +get_othersym(int idx, int which_set) { nhsym sym = (nhsym) 0; int oidx = idx + SYM_OFF_X; @@ -155,7 +154,7 @@ int idx, which_set; /* initialize defaults for the primary symset */ void -init_primary_symbols() +init_primary_symbols(void) { register int i; @@ -175,7 +174,7 @@ init_primary_symbols() /* initialize defaults for the rogue symset */ void -init_rogue_symbols() +init_rogue_symbols(void) { register int i; @@ -204,8 +203,7 @@ init_rogue_symbols() } void -assign_graphics(whichset) -int whichset; +assign_graphics(int whichset) { register int i; @@ -240,8 +238,7 @@ int whichset; } void -switch_symbols(nondefault) -int nondefault; +switch_symbols(int nondefault) { register int i; @@ -275,41 +272,31 @@ int nondefault; } void -update_ov_primary_symset(symp, val) -struct symparse *symp; -int val; +update_ov_primary_symset(struct symparse* symp, int val) { g.ov_primary_syms[symp->idx] = val; } void -update_ov_rogue_symset(symp, val) -struct symparse *symp; -int val; +update_ov_rogue_symset(struct symparse* symp, int val) { g.ov_rogue_syms[symp->idx] = val; } void -update_primary_symset(symp, val) -struct symparse *symp; -int val; +update_primary_symset(struct symparse* symp, int val) { g.primary_syms[symp->idx] = val; } void -update_rogue_symset(symp, val) -struct symparse *symp; -int val; +update_rogue_symset(struct symparse* symp, int val) { g.rogue_syms[symp->idx] = val; } void -clear_symsetentry(which_set, name_too) -int which_set; -boolean name_too; +clear_symsetentry(int which_set, boolean name_too) { if (g.symset[which_set].desc) free((genericptr_t) g.symset[which_set].desc); diff --git a/src/sys.c b/src/sys.c index 650c20e08..54ef241bb 100644 --- a/src/sys.c +++ b/src/sys.c @@ -18,7 +18,7 @@ struct sysopt sysopt; void -sys_early_init() +sys_early_init(void) { sysopt.support = (char *) 0; sysopt.recover = (char *) 0; @@ -43,20 +43,14 @@ sys_early_init() sysopt.bones_pools = 0; /* record file */ - sysopt.persmax = PERSMAX; - sysopt.entrymax = ENTRYMAX; - sysopt.pointsmin = POINTSMIN; + sysopt.persmax = max(PERSMAX, 1); + sysopt.entrymax = max(ENTRYMAX, 10); + sysopt.pointsmin = max(POINTSMIN, 1); sysopt.pers_is_uid = PERS_IS_UID; sysopt.tt_oname_maxrank = 10; /* sanity checks */ - if (PERSMAX < 1) - sysopt.persmax = 1; - if (ENTRYMAX < 10) - sysopt.entrymax = 10; - if (POINTSMIN < 1) - sysopt.pointsmin = 1; - if (PERS_IS_UID != 0 && PERS_IS_UID != 1) + if (sysopt.pers_is_uid != 0 && sysopt.pers_is_uid != 1) panic("config error: PERS_IS_UID must be either 0 or 1"); #ifdef PANICTRACE @@ -90,7 +84,7 @@ sys_early_init() } void -sysopt_release() +sysopt_release(void) { if (sysopt.support) free((genericptr_t) sysopt.support), sysopt.support = (char *) 0; @@ -129,9 +123,9 @@ extern const struct attack c_sa_yes[NATTK]; extern const struct attack c_sa_no[NATTK]; void -sysopt_seduce_set(val) +sysopt_seduce_set( #if 0 -int val; +int val) { /* * Attack substitution is now done on the fly in getmattk(mhitu.c). @@ -144,7 +138,7 @@ int val; mons[PM_SUCCUBUS].mattk[x] = setval[x]; } #else -int val UNUSED; +int val UNUSED) { #endif return; diff --git a/src/teleport.c b/src/teleport.c index 4f47b1d82..1e901cb96 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -5,16 +5,15 @@ #include "hack.h" -static boolean FDECL(tele_jump_ok, (int, int, int, int)); -static boolean FDECL(teleok, (int, int, BOOLEAN_P)); -static void NDECL(vault_tele); -static boolean FDECL(rloc_pos_ok, (int, int, struct monst *)); -static void FDECL(mvault_tele, (struct monst *)); +static boolean tele_jump_ok(int, int, int, int); +static boolean teleok(int, int, boolean); +static void vault_tele(void); +static boolean rloc_pos_ok(int, int, struct monst *); +static void mvault_tele(struct monst *); /* teleporting is prevented on this level for this monster? */ boolean -noteleport_level(mon) -struct monst *mon; +noteleport_level(struct monst* mon) { struct monst *mtmp; @@ -39,10 +38,7 @@ struct monst *mon; * call it to generate new monster positions with fake monster structures. */ boolean -goodpos(x, y, mtmp, gpflags) -int x, y; -struct monst *mtmp; -long gpflags; +goodpos(int x, int y, struct monst* mtmp, long gpflags) { struct permonst *mdat = (struct permonst *) 0; boolean ignorewater = ((gpflags & MM_IGNOREWATER) != 0), @@ -134,20 +130,22 @@ long gpflags; * Return TRUE and the position chosen when successful, FALSE otherwise. */ boolean -enexto(cc, xx, yy, mdat) -coord *cc; -register xchar xx, yy; -struct permonst *mdat; +enexto( + coord *cc, + register xchar xx, + register xchar yy, + struct permonst *mdat) { return enexto_core(cc, xx, yy, mdat, NO_MM_FLAGS); } boolean -enexto_core(cc, xx, yy, mdat, entflags) -coord *cc; -xchar xx, yy; -struct permonst *mdat; -long entflags; +enexto_core( + coord *cc, + xchar xx, + xchar yy, + struct permonst *mdat, + long entflags) { #define MAX_GOOD 15 coord good[MAX_GOOD], *good_ptr; @@ -245,8 +243,7 @@ long entflags; * only for explicitly chosen destinations.) */ static boolean -tele_jump_ok(x1, y1, x2, y2) -int x1, y1, x2, y2; +tele_jump_ok(int x1, int y1, int x2, int y2) { if (!isok(x2, y2)) return FALSE; @@ -280,9 +277,7 @@ int x1, y1, x2, y2; } static boolean -teleok(x, y, trapok) -register int x, y; -boolean trapok; +teleok(register int x, register int y, boolean trapok) { if (!trapok) { /* allow teleportation onto vibrating square, it's not a real trap */ @@ -301,9 +296,7 @@ boolean trapok; } void -teleds(nux, nuy, teleds_flags) -int nux, nuy; -int teleds_flags; +teleds(int nux, int nuy, int teleds_flags) { boolean ball_active, ball_still_in_range = FALSE, allow_drag = (teleds_flags & TELEDS_ALLOW_DRAG) != 0, @@ -422,8 +415,7 @@ int teleds_flags; } boolean -safe_teleds(teleds_flags) -int teleds_flags; +safe_teleds(int teleds_flags) { register int nux, nuy, tcnt = 0; @@ -440,7 +432,7 @@ int teleds_flags; } static void -vault_tele() +vault_tele(void) { register struct mkroom *croom = search_special(VAULT); coord c; @@ -453,9 +445,7 @@ vault_tele() } boolean -teleport_pet(mtmp, force_it) -register struct monst *mtmp; -boolean force_it; +teleport_pet(register struct monst* mtmp, boolean force_it) { register struct obj *otmp; @@ -483,15 +473,14 @@ boolean force_it; /* teleport the hero via some method other than scroll of teleport */ void -tele() +tele(void) { scrolltele((struct obj *) 0); } /* teleport the hero; usually discover scroll of teleporation if via scroll */ void -scrolltele(scroll) -struct obj *scroll; +scrolltele(struct obj* scroll) { coord cc; @@ -561,7 +550,7 @@ struct obj *scroll; /* ^T command; 'm ^T' == choose among several teleport modes */ int -dotelecmd() +dotelecmd(void) { long save_HTele, save_ETele; int res, added, hidden; @@ -671,8 +660,8 @@ dotelecmd() } int -dotele(break_the_rules) -boolean break_the_rules; /* True: wizard mode ^T */ +dotele( + boolean break_the_rules) /* True: wizard mode ^T */ { struct trap *trap; const char *cantdoit; @@ -795,7 +784,7 @@ boolean break_the_rules; /* True: wizard mode ^T */ } void -level_tele() +level_tele(void) { static const char get_there_from[] = "get there from %s."; register int newlev; @@ -1061,8 +1050,7 @@ level_tele() } void -domagicportal(ttmp) -register struct trap *ttmp; +domagicportal(register struct trap* ttmp) { struct d_level target_level; @@ -1097,8 +1085,7 @@ register struct trap *ttmp; } void -tele_trap(trap) -struct trap *trap; +tele_trap(struct trap* trap) { if (In_endgame(&u.uz) || Antimagic) { if (Antimagic) @@ -1115,9 +1102,7 @@ struct trap *trap; } void -level_tele_trap(trap, trflags) -struct trap *trap; -unsigned trflags; +level_tele_trap(struct trap* trap, unsigned int trflags) { char verbbuf[BUFSZ]; boolean intentional = FALSE; @@ -1149,9 +1134,10 @@ unsigned trflags; /* check whether monster can arrive at location via Tport (or fall) */ static boolean -rloc_pos_ok(x, y, mtmp) -register int x, y; /* coordinates of candidate location */ -struct monst *mtmp; +rloc_pos_ok( + register int x, + register int y, /* x,y - coordinates of candidate location */ + struct monst *mtmp) { register int xx, yy; @@ -1216,9 +1202,7 @@ struct monst *mtmp; * placed randomly around the head of the worm. */ void -rloc_to(mtmp, x, y) -struct monst *mtmp; -register int x, y; +rloc_to(struct monst* mtmp, register int x, register int y) { register int oldx = mtmp->mx, oldy = mtmp->my; boolean resident_shk = mtmp->isshk && inhishop(mtmp); @@ -1267,8 +1251,7 @@ register int x, y; } static stairway * -stairway_find_forwiz(isladder, up) -boolean isladder, up; +stairway_find_forwiz(boolean isladder, boolean up) { stairway *stway = g.stairs; @@ -1281,9 +1264,9 @@ boolean isladder, up; /* place a monster at a random location, typically due to teleport */ /* return TRUE if successful, FALSE if not */ boolean -rloc(mtmp, suppress_impossible) -struct monst *mtmp; /* mx==0 implies migrating monster arrival */ -boolean suppress_impossible; +rloc( + struct monst *mtmp, /* mx==0 implies migrating monster arrival */ + boolean suppress_impossible) { register int x, y, trycount; @@ -1339,8 +1322,7 @@ boolean suppress_impossible; } static void -mvault_tele(mtmp) -struct monst *mtmp; +mvault_tele(struct monst* mtmp) { struct mkroom *croom = search_special(VAULT); coord c; @@ -1353,8 +1335,7 @@ struct monst *mtmp; } boolean -tele_restrict(mon) -struct monst *mon; +tele_restrict(struct monst* mon) { if (noteleport_level(mon)) { if (canseemon(mon)) @@ -1366,10 +1347,7 @@ struct monst *mon; } void -mtele_trap(mtmp, trap, in_sight) -struct monst *mtmp; -struct trap *trap; -int in_sight; +mtele_trap(struct monst* mtmp, struct trap* trap, int in_sight) { char *monname; @@ -1400,11 +1378,11 @@ int in_sight; /* return 0 if still on level, 3 if not */ int -mlevel_tele_trap(mtmp, trap, force_it, in_sight) -struct monst *mtmp; -struct trap *trap; -boolean force_it; -int in_sight; +mlevel_tele_trap( + struct monst *mtmp, + struct trap *trap, + boolean force_it, + int in_sight) { int tt = (trap ? trap->ttyp : NO_TRAP); @@ -1485,8 +1463,7 @@ int in_sight; /* place object randomly, returns False if it's gone (eg broken) */ boolean -rloco(obj) -register struct obj *obj; +rloco(register struct obj* obj) { register xchar tx, ty, otx, oty; boolean restricted_fall; @@ -1550,7 +1527,7 @@ register struct obj *obj; /* Returns an absolute depth */ int -random_teleport_level() +random_teleport_level(void) { int nlev, max_depth, min_depth, cur_depth = (int) depth(&u.uz); @@ -1622,9 +1599,7 @@ random_teleport_level() /* you teleport a monster (via wand, spell, or poly'd q.mechanic attack); return false iff the attempt fails */ boolean -u_teleport_mon(mtmp, give_feedback) -struct monst *mtmp; -boolean give_feedback; +u_teleport_mon(struct monst* mtmp, boolean give_feedback) { coord cc; diff --git a/src/timeout.c b/src/timeout.c index 9f57fbf51..47ea90490 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -5,18 +5,18 @@ #include "hack.h" -static void NDECL(stoned_dialogue); -static void NDECL(vomiting_dialogue); -static void NDECL(choke_dialogue); -static void NDECL(levitation_dialogue); -static void NDECL(slime_dialogue); -static void FDECL(slimed_to_death, (struct kinfo *)); -static void NDECL(phaze_dialogue); -static void FDECL(done_timeout, (int, int)); -static void NDECL(slip_or_trip); -static void FDECL(see_lamp_flicker, (struct obj *, const char *)); -static void FDECL(lantern_message, (struct obj *)); -static void FDECL(cleanup_burn, (ANY_P *, long)); +static void stoned_dialogue(void); +static void vomiting_dialogue(void); +static void choke_dialogue(void); +static void levitation_dialogue(void); +static void slime_dialogue(void); +static void slimed_to_death(struct kinfo *); +static void phaze_dialogue(void); +static void done_timeout(int, int); +static void slip_or_trip(void); +static void see_lamp_flicker(struct obj *, const char *); +static void lantern_message(struct obj *); +static void cleanup_burn(ANY_P *, long); /* used by wizard mode #timeout and #wizintrinsic; order by 'interest' for timeout countdown, where most won't occur in normal play */ @@ -112,7 +112,7 @@ static NEARDATA const char *const stoned_texts[] = { }; static void -stoned_dialogue() +stoned_dialogue(void) { register long i = (Stoned & TIMEOUT); @@ -172,7 +172,7 @@ static NEARDATA const char *const vomiting_texts[] = { }; static void -vomiting_dialogue() +vomiting_dialogue(void) { const char *txt = 0; char buf[BUFSZ]; @@ -258,7 +258,7 @@ static NEARDATA const char *const choke_texts2[] = { }; static void -choke_dialogue() +choke_dialogue(void) { register long i = (Strangled & TIMEOUT); @@ -283,7 +283,7 @@ static NEARDATA const char *const levi_texts[] = { }; static void -levitation_dialogue() +levitation_dialogue(void) { /* -1 because the last message comes via float_down() */ long i = (((HLevitation & TIMEOUT) - 1L) / 2L); @@ -318,7 +318,7 @@ static NEARDATA const char *const slime_texts[] = { }; static void -slime_dialogue() +slime_dialogue(void) { long t = (Slimed & TIMEOUT), i = t / 2L; @@ -373,7 +373,7 @@ slime_dialogue() } void -burn_away_slime() +burn_away_slime(void) { if (Slimed) { make_slimed(0L, "The slime that covers you is burned away!"); @@ -382,8 +382,7 @@ burn_away_slime() /* countdown timer for turning into green slime has run out; kill our hero */ static void -slimed_to_death(kptr) -struct kinfo *kptr; +slimed_to_death(struct kinfo* kptr) { uchar save_mvflags; @@ -460,7 +459,7 @@ static NEARDATA const char *const phaze_texts[] = { }; static void -phaze_dialogue() +phaze_dialogue(void) { long i = ((HPasses_walls & TIMEOUT) / 2L); @@ -475,8 +474,7 @@ phaze_dialogue() during end of game rundown (and potential dumplog); timeout has already counted down to 0 by the time we get here */ static void -done_timeout(how, which) -int how, which; +done_timeout(int how, int which) { long *intrinsic_p = &u.uprops[which].intrinsic; @@ -489,7 +487,7 @@ int how, which; } void -nh_timeout() +nh_timeout(void) { register struct prop *upp; struct kinfo *kptr; @@ -775,9 +773,7 @@ nh_timeout() } void -fall_asleep(how_long, wakeup_msg) -int how_long; -boolean wakeup_msg; +fall_asleep(int how_long, boolean wakeup_msg) { stop_occupation(); nomul(how_long); @@ -800,9 +796,7 @@ boolean wakeup_msg; * existing hatch timer. Pass 0L for random hatch time. */ void -attach_egg_hatch_timeout(egg, when) -struct obj *egg; -long when; +attach_egg_hatch_timeout(struct obj* egg, long when) { int i; @@ -830,8 +824,7 @@ long when; /* prevent an egg from ever hatching */ void -kill_egg(egg) -struct obj *egg; +kill_egg(struct obj* egg) { /* stop previous timer, if any */ (void) stop_timer(HATCH_EGG, obj_to_any(egg)); @@ -839,9 +832,7 @@ struct obj *egg; /* timer callback routine: hatch the given egg */ void -hatch_egg(arg, timeout) -anything *arg; -long timeout; +hatch_egg(anything *arg, long timeout) { struct obj *egg; struct monst *mon, *mon2; @@ -1006,8 +997,7 @@ long timeout; /* Learn to recognize eggs of the given type. */ void -learn_egg_type(mnum) -int mnum; +learn_egg_type(int mnum) { /* baby monsters hatch from grown-up eggs */ mnum = little_to_big(mnum); @@ -1018,8 +1008,7 @@ int mnum; /* Attach a fig_transform timeout to the given figurine. */ void -attach_fig_transform_timeout(figurine) -struct obj *figurine; +attach_fig_transform_timeout(struct obj* figurine) { int i; @@ -1037,7 +1026,7 @@ struct obj *figurine; /* give a fumble message */ static void -slip_or_trip() +slip_or_trip(void) { struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2; const char *what; @@ -1128,9 +1117,7 @@ slip_or_trip() /* Print a lamp flicker message with tailer. */ static void -see_lamp_flicker(obj, tailer) -struct obj *obj; -const char *tailer; +see_lamp_flicker(struct obj* obj, const char* tailer) { switch (obj->where) { case OBJ_INVENT: @@ -1145,8 +1132,7 @@ const char *tailer; /* Print a dimming message for brass lanterns. */ static void -lantern_message(obj) -struct obj *obj; +lantern_message(struct obj* obj) { /* from adventure */ switch (obj->where) { @@ -1169,9 +1155,7 @@ struct obj *obj; * See begin_burn() for meanings of obj->age and obj->spe. */ void -burn_object(arg, timeout) -anything *arg; -long timeout; +burn_object(anything* arg, long timeout) { struct obj *obj = arg->a_obj; boolean canseeit, many, menorah, need_newsym, need_invupdate; @@ -1479,9 +1463,7 @@ long timeout; * This is a "silent" routine - it should not print anything out. */ void -begin_burn(obj, already_lit) -struct obj *obj; -boolean already_lit; +begin_burn(struct obj* obj, boolean already_lit) { int radius = 3; long turns = 0; @@ -1573,9 +1555,7 @@ boolean already_lit; * light source. */ void -end_burn(obj, timer_attached) -struct obj *obj; -boolean timer_attached; +end_burn(struct obj* obj, boolean timer_attached) { if (!obj->lamplit) { impossible("end_burn: obj %s not lit", xname(obj)); @@ -1599,9 +1579,7 @@ boolean timer_attached; * Cleanup a burning object if timer stopped. */ static void -cleanup_burn(arg, expire_time) -anything *arg; -long expire_time; +cleanup_burn(anything* arg, long expire_time) { struct obj *obj = arg->a_obj; if (!obj->lamplit) { @@ -1621,7 +1599,7 @@ long expire_time; } void -do_storms() +do_storms(void) { int nstrike; register int x, y; @@ -1724,15 +1702,14 @@ do_storms() * Check whether object has a timer of type timer_type. */ -static const char *FDECL(kind_name, (SHORT_P)); -static void FDECL(print_queue, (winid, timer_element *)); -static void FDECL(insert_timer, (timer_element *)); -static timer_element *FDECL(remove_timer, - (timer_element **, SHORT_P, ANY_P *)); -static void FDECL(write_timer, (NHFILE *, timer_element *)); -static boolean FDECL(mon_is_local, (struct monst *)); -static boolean FDECL(timer_is_local, (timer_element *)); -static int FDECL(maybe_write_timer, (NHFILE *, int, BOOLEAN_P)); +static const char *kind_name(short); +static void print_queue(winid, timer_element *); +static void insert_timer(timer_element *); +static timer_element *remove_timer(timer_element **, short, ANY_P *); +static void write_timer(NHFILE *, timer_element *); +static boolean mon_is_local(struct monst *); +static boolean timer_is_local(timer_element *); +static int maybe_write_timer(NHFILE *, int, boolean); /* If defined, then include names when printing out the timer queue */ #define VERBOSE_TIMER @@ -1767,8 +1744,7 @@ static const ttable timeout_funcs[NUM_TIME_FUNCS] = { #undef TTAB static const char * -kind_name(kind) -short kind; +kind_name(short kind) { switch (kind) { case TIMER_LEVEL: @@ -1784,9 +1760,7 @@ short kind; } static void -print_queue(win, base) -winid win; -timer_element *base; +print_queue(winid win, timer_element* base) { timer_element *curr; char buf[BUFSZ]; @@ -1812,7 +1786,7 @@ timer_element *base; } int -wiz_timeout_queue() +wiz_timeout_queue(void) { winid win; char buf[BUFSZ]; @@ -1878,7 +1852,7 @@ wiz_timeout_queue() } void -timer_sanity_check() +timer_sanity_check(void) { timer_element *curr; @@ -1899,7 +1873,7 @@ timer_sanity_check() * Do this until their time is less than or equal to the move count. */ void -run_timers() +run_timers(void) { timer_element *curr; @@ -1923,11 +1897,11 @@ run_timers() * Start a timer. Return TRUE if successful. */ boolean -start_timer(when, kind, func_index, arg) -long when; -short kind; -short func_index; -anything *arg; +start_timer( + long when, + short kind, + short func_index, + anything *arg) { timer_element *gnu, *dup; @@ -1975,9 +1949,7 @@ anything *arg; * remaining until it would have gone off, 0 if not found. */ long -stop_timer(func_index, arg) -short func_index; -anything *arg; +stop_timer(short func_index, anything *arg) { timer_element *doomed; long timeout; @@ -2000,9 +1972,7 @@ anything *arg; * Find the timeout of specified timer; return 0 if none. */ long -peek_timer(type, arg) -short type; -anything *arg; +peek_timer(short type, anything *arg) { timer_element *curr; @@ -2017,8 +1987,7 @@ anything *arg; * Move all object timers from src to dest, leaving src untimed. */ void -obj_move_timers(src, dest) -struct obj *src, *dest; +obj_move_timers(struct obj* src, struct obj* dest) { int count; timer_element *curr; @@ -2038,8 +2007,7 @@ struct obj *src, *dest; * Find all object timers and duplicate them for the new object "dest". */ void -obj_split_timers(src, dest) -struct obj *src, *dest; +obj_split_timers(struct obj* src, struct obj* dest) { timer_element *curr, *next_timer = 0; @@ -2057,8 +2025,7 @@ struct obj *src, *dest; * all object pointers are unique. */ void -obj_stop_timers(obj) -struct obj *obj; +obj_stop_timers(struct obj* obj) { timer_element *curr, *prev, *next_timer = 0; @@ -2084,9 +2051,7 @@ struct obj *obj; * Check whether object has a timer of type timer_type. */ boolean -obj_has_timer(object, timer_type) -struct obj *object; -short timer_type; +obj_has_timer(struct obj* object, short timer_type) { long timeout = peek_timer(timer_type, obj_to_any(object)); @@ -2098,9 +2063,7 @@ short timer_type; * */ void -spot_stop_timers(x, y, func_index) -xchar x, y; -short func_index; +spot_stop_timers(xchar x, xchar y, short func_index) { timer_element *curr, *prev, *next_timer = 0; long where = (((long) x << 16) | ((long) y)); @@ -2128,9 +2091,7 @@ short func_index; * Returns 0L if no such timer. */ long -spot_time_expires(x, y, func_index) -xchar x, y; -short func_index; +spot_time_expires(xchar x, xchar y, short func_index) { timer_element *curr; long where = (((long) x << 16) | ((long) y)); @@ -2144,9 +2105,7 @@ short func_index; } long -spot_time_left(x, y, func_index) -xchar x, y; -short func_index; +spot_time_left(xchar x, xchar y, short func_index) { long expires = spot_time_expires(x, y, func_index); return (expires > 0L) ? expires - g.monstermoves : 0L; @@ -2154,8 +2113,7 @@ short func_index; /* Insert timer into the global queue */ static void -insert_timer(gnu) -timer_element *gnu; +insert_timer(timer_element* gnu) { timer_element *curr, *prev; @@ -2171,10 +2129,10 @@ timer_element *gnu; } static timer_element * -remove_timer(base, func_index, arg) -timer_element **base; -short func_index; -anything *arg; +remove_timer( + timer_element **base, + short func_index, + anything *arg) { timer_element *prev, *curr; @@ -2193,9 +2151,7 @@ anything *arg; } static void -write_timer(nhfp, timer) -NHFILE *nhfp; -timer_element *timer; +write_timer(NHFILE* nhfp, timer_element* timer) { anything arg_save; @@ -2253,8 +2209,7 @@ timer_element *timer; * saved. */ boolean -obj_is_local(obj) -struct obj *obj; +obj_is_local(struct obj* obj) { switch (obj->where) { case OBJ_INVENT: @@ -2277,8 +2232,7 @@ struct obj *obj; * level is saved. */ static boolean -mon_is_local(mon) -struct monst *mon; +mon_is_local(struct monst* mon) { struct monst *curr; @@ -2297,8 +2251,7 @@ struct monst *mon; * level when the level is saved. */ static boolean -timer_is_local(timer) -timer_element *timer; +timer_is_local(timer_element* timer) { switch (timer->kind) { case TIMER_LEVEL: @@ -2319,10 +2272,7 @@ timer_element *timer; * be written. If write_it is true, actually write the timer. */ static int -maybe_write_timer(nhfp, range, write_it) -NHFILE *nhfp; -int range; -boolean write_it; +maybe_write_timer(NHFILE* nhfp, int range, boolean write_it) { int count = 0; timer_element *curr; @@ -2363,9 +2313,7 @@ boolean write_it; * + timeouts that stay with the level (obj & monst) */ void -save_timers(nhfp, range) -NHFILE *nhfp; -int range; +save_timers(NHFILE* nhfp, int range) { timer_element *curr, *prev, *next_timer = 0; int count; @@ -2404,10 +2352,7 @@ int range; * monster pointers. */ void -restore_timers(nhfp, range, adjust) -NHFILE *nhfp; -int range; -long adjust; /* how much to adjust timeout */ +restore_timers(NHFILE* nhfp, int range, long adjust) { int count = 0; timer_element *curr; @@ -2434,10 +2379,7 @@ long adjust; /* how much to adjust timeout */ /* to support '#stats' wizard-mode command */ void -timer_stats(hdrfmt, hdrbuf, count, size) -const char *hdrfmt; -char *hdrbuf; -long *count, *size; +timer_stats(const char* hdrfmt, char *hdrbuf, long *count, long *size) { timer_element *te; @@ -2451,8 +2393,7 @@ long *count, *size; /* reset all timers that are marked for reseting */ void -relink_timers(ghostly) -boolean ghostly; +relink_timers(boolean ghostly) { timer_element *curr; unsigned nid; diff --git a/src/topten.c b/src/topten.c index f96948cb2..672ea348a 100644 --- a/src/topten.c +++ b/src/topten.c @@ -54,38 +54,38 @@ struct toptenentry { room for separating space or trailing newline plus string terminator */ #define SCANBUFSZ (4 * (ROLESZ + 1) + (NAMSZ + 1) + (DTHSZ + 1) + 1) -static void FDECL(topten_print, (const char *)); -static void FDECL(topten_print_bold, (const char *)); -static void NDECL(outheader); -static void FDECL(outentry, (int, struct toptenentry *, BOOLEAN_P)); -static void FDECL(discardexcess, (FILE *)); -static void FDECL(readentry, (FILE *, struct toptenentry *)); -static void FDECL(writeentry, (FILE *, struct toptenentry *)); +static void topten_print(const char *); +static void topten_print_bold(const char *); +static void outheader(void); +static void outentry(int, struct toptenentry *, boolean); +static void discardexcess(FILE *); +static void readentry(FILE *, struct toptenentry *); +static void writeentry(FILE *, struct toptenentry *); #ifdef XLOGFILE -static void FDECL(writexlentry, (FILE *, struct toptenentry *, int)); -static long NDECL(encodexlogflags); -static long NDECL(encodeconduct); -static long FDECL(encodeachieve, (BOOLEAN_P)); -static void FDECL(add_achieveX, (char *, const char *, BOOLEAN_P)); -static char *NDECL(encode_extended_achievements); -static char *NDECL(encode_extended_conducts); +static void writexlentry(FILE *, struct toptenentry *, int); +static long encodexlogflags(void); +static long encodeconduct(void); +static long encodeachieve(boolean); +static void add_achieveX(char *, const char *, boolean); +static char *encode_extended_achievements(void); +static char *encode_extended_conducts(void); #endif -static void FDECL(free_ttlist, (struct toptenentry *)); -static int FDECL(classmon, (char *, BOOLEAN_P)); -static int FDECL(score_wanted, (BOOLEAN_P, int, struct toptenentry *, int, - const char **, int)); +static void free_ttlist(struct toptenentry *); +static int classmon(char *, boolean); +static int score_wanted(boolean, int, struct toptenentry *, int, + const char **, int); #ifdef NO_SCAN_BRACK -static void FDECL(nsb_mung_line, (char *)); -static void FDECL(nsb_unmung_line, (char *)); +static void nsb_mung_line(char *); +static void nsb_unmung_line(char *); #endif /* "killed by",&c ["an"] 'g.killer.name' */ void -formatkiller(buf, siz, how, incl_helpless) -char *buf; -unsigned siz; -int how; -boolean incl_helpless; +formatkiller( + char *buf, + unsigned siz, + int how, + boolean incl_helpless) { static NEARDATA const char *const killed_by_prefix[] = { /* DIED, CHOKING, POISONING, STARVING, */ @@ -153,8 +153,7 @@ boolean incl_helpless; } static void -topten_print(x) -const char *x; +topten_print(const char *x) { if (g.toptenwin == WIN_ERR) raw_print(x); @@ -163,8 +162,7 @@ const char *x; } static void -topten_print_bold(x) -const char *x; +topten_print_bold(const char* x) { if (g.toptenwin == WIN_ERR) raw_print_bold(x); @@ -173,8 +171,7 @@ const char *x; } int -observable_depth(lev) -d_level *lev; +observable_depth(d_level* lev) { #if 0 /* if we ever randomize the order of the elemental planes, we @@ -199,8 +196,7 @@ d_level *lev; /* throw away characters until current record has been entirely consumed */ static void -discardexcess(rfile) -FILE *rfile; +discardexcess(FILE* rfile) { int c; @@ -210,9 +206,7 @@ FILE *rfile; } static void -readentry(rfile, tt) -FILE *rfile; -struct toptenentry *tt; +readentry(FILE* rfile, struct toptenentry* tt) { char inbuf[SCANBUFSZ], s1[SCANBUFSZ], s2[SCANBUFSZ], s3[SCANBUFSZ], s4[SCANBUFSZ], s5[SCANBUFSZ], s6[SCANBUFSZ]; @@ -293,9 +287,7 @@ struct toptenentry *tt; } static void -writeentry(rfile, tt) -FILE *rfile; -struct toptenentry *tt; +writeentry(FILE* rfile, struct toptenentry* tt) { static const char fmt32[] = "%c%c "; /* role,gender */ static const char fmt33[] = "%s %s %s %s "; /* role,race,gndr,algn */ @@ -332,10 +324,7 @@ struct toptenentry *tt; /* as tab is never used in eg. g.plname or death, no need to mangle those. */ static void -writexlentry(rfile, tt, how) -FILE *rfile; -struct toptenentry *tt; -int how; +writexlentry(FILE* rfile, struct toptenentry* tt, int how) { #define Fprintf (void) fprintf #define XLOG_SEP '\t' /* xlogfile field separator. */ @@ -384,7 +373,7 @@ int how; } static long -encodexlogflags() +encodexlogflags(void) { long e = 0L; @@ -399,7 +388,7 @@ encodexlogflags() } static long -encodeconduct() +encodeconduct(void) { long e = 0L; @@ -441,8 +430,8 @@ encodeconduct() } static long -encodeachieve(secondlong) -boolean secondlong; /* False: handle achievements 1..31, True: 32..62 */ +encodeachieve( + boolean secondlong) /* False: handle achievements 1..31, True: 32..62 */ { int i, achidx, offset; long r = 0L; @@ -466,10 +455,7 @@ boolean secondlong; /* False: handle achievements 1..31, True: 32..62 */ /* add the achievement or conduct comma-separated to string */ static void -add_achieveX(buf, achievement, condition) -char *buf; -const char *achievement; -boolean condition; +add_achieveX(char* buf, const char* achievement, boolean condition) { if (condition) { if (buf[0] != '\0') { @@ -480,7 +466,7 @@ boolean condition; } static char * -encode_extended_achievements() +encode_extended_achievements(void) { static char buf[N_ACH * 40]; char rnkbuf[40]; @@ -571,7 +557,7 @@ encode_extended_achievements() } static char * -encode_extended_conducts() +encode_extended_conducts(void) { static char buf[BUFSZ]; @@ -600,8 +586,7 @@ encode_extended_conducts() #endif /* XLOGFILE */ static void -free_ttlist(tt) -struct toptenentry *tt; +free_ttlist(struct toptenentry* tt) { struct toptenentry *ttnext; @@ -614,9 +599,7 @@ struct toptenentry *tt; } void -topten(how, when) -int how; -time_t when; +topten(int how, time_t when) { int uid = getuid(); int rank, rank0 = -1, rank1 = 0; @@ -912,7 +895,7 @@ destroywin: } static void -outheader() +outheader(void) { char linebuf[BUFSZ]; register char *bp; @@ -927,10 +910,7 @@ outheader() /* so>0: standout line; so=0: ordinary line */ static void -outentry(rank, t1, so) -struct toptenentry *t1; -int rank; -boolean so; +outentry(int rank, struct toptenentry* t1, boolean so) { boolean second_line = TRUE; char linebuf[BUFSZ]; @@ -1090,13 +1070,13 @@ boolean so; } static int -score_wanted(current_ver, rank, t1, playerct, players, uid) -boolean current_ver; -int rank; -struct toptenentry *t1; -int playerct; -const char **players; -int uid; +score_wanted( + boolean current_ver, + int rank, + struct toptenentry *t1, + int playerct, + const char **players, + int uid) { int i; @@ -1135,9 +1115,7 @@ int uid; * caveat: some shells might allow argv elements to be arbitrarily long. */ void -prscore(argc, argv) -int argc; -char **argv; +prscore(int argc, char **argv) { const char **players; int playerct, rank; @@ -1283,9 +1261,7 @@ char **argv; } static int -classmon(plch, fem) -char *plch; -boolean fem; +classmon(char *plch, boolean fem) { int i; @@ -1311,7 +1287,7 @@ boolean fem; * Get a random player name and class from the high score list, */ struct toptenentry * -get_rnd_toptenentry() +get_rnd_toptenentry(void) { int rank, i; FILE *rfile; @@ -1352,8 +1328,7 @@ pickentry: * to an object (for statues or morgue corpses). */ struct obj * -tt_oname(otmp) -struct obj *otmp; +tt_oname(struct obj* otmp) { struct toptenentry *tt; if (!otmp) diff --git a/src/track.c b/src/track.c index ec6e8f565..6e5704588 100644 --- a/src/track.c +++ b/src/track.c @@ -12,14 +12,14 @@ static NEARDATA int utcnt, utpnt; static NEARDATA coord utrack[UTSZ]; void -initrack() +initrack(void) { utcnt = utpnt = 0; } /* add to track */ void -settrack() +settrack(void) { if (utcnt < UTSZ) utcnt++; @@ -31,8 +31,7 @@ settrack() } coord * -gettrack(x, y) -register int x, y; +gettrack(register int x, register int y) { register int cnt, ndist; register coord *tc; diff --git a/src/trap.c b/src/trap.c index 70d655ec9..15955a08e 100644 --- a/src/trap.c +++ b/src/trap.c @@ -7,62 +7,61 @@ extern const char *const destroy_strings[][3]; /* from zap.c */ -static boolean FDECL(keep_saddle_with_steedcorpse, (unsigned, struct obj *, - struct obj *)); -static boolean FDECL(mu_maybe_destroy_web, (struct monst *, BOOLEAN_P, - struct trap *)); -static struct obj *FDECL(t_missile, (int, struct trap *)); -static int FDECL(trapeffect_arrow_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_dart_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_rocktrap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_sqky_board, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_bear_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_slp_gas_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_rust_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_fire_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_pit, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_hole, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_telep_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_level_telep, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_web, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_statue_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_magic_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_anti_magic, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_poly_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_landmine, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_rolling_boulder_trap, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_magic_portal, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_vibrating_square, (struct monst *, struct trap *, unsigned)); -static int FDECL(trapeffect_selector, (struct monst *, struct trap *, unsigned)); -static char *FDECL(trapnote, (struct trap *, BOOLEAN_P)); -static int FDECL(steedintrap, (struct trap *, struct obj *)); -static void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P)); -static int FDECL(mkroll_launch, (struct trap *, XCHAR_P, XCHAR_P, - SHORT_P, long)); -static boolean FDECL(isclearpath, (coord *, int, SCHAR_P, SCHAR_P)); -static void FDECL(dofiretrap, (struct obj *)); -static void NDECL(domagictrap); -static boolean FDECL(emergency_disrobe, (boolean *)); -static int FDECL(untrap_prob, (struct trap *)); -static void FDECL(move_into_trap, (struct trap *)); -static int FDECL(try_disarm, (struct trap *, BOOLEAN_P)); -static void FDECL(reward_untrap, (struct trap *, struct monst *)); -static int FDECL(disarm_holdingtrap, (struct trap *)); -static int FDECL(disarm_landmine, (struct trap *)); -static int FDECL(unsqueak_ok, (struct obj *)); -static int FDECL(disarm_squeaky_board, (struct trap *)); -static int FDECL(disarm_shooting_trap, (struct trap *, int)); -static void FDECL(clear_conjoined_pits, (struct trap *)); -static boolean FDECL(adj_nonconjoined_pit, (struct trap *)); -static int FDECL(try_lift, (struct monst *, struct trap *, int, - BOOLEAN_P)); -static int FDECL(help_monster_out, (struct monst *, struct trap *)); +static boolean keep_saddle_with_steedcorpse(unsigned, struct obj *, + struct obj *); +static boolean mu_maybe_destroy_web(struct monst *, boolean, + struct trap *); +static struct obj *t_missile(int, struct trap *); +static int trapeffect_arrow_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_dart_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_rocktrap(struct monst *, struct trap *, unsigned); +static int trapeffect_sqky_board(struct monst *, struct trap *, unsigned); +static int trapeffect_bear_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_slp_gas_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_rust_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_fire_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_pit(struct monst *, struct trap *, unsigned); +static int trapeffect_hole(struct monst *, struct trap *, unsigned); +static int trapeffect_telep_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_level_telep(struct monst *, struct trap *, unsigned); +static int trapeffect_web(struct monst *, struct trap *, unsigned); +static int trapeffect_statue_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_magic_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_anti_magic(struct monst *, struct trap *, unsigned); +static int trapeffect_poly_trap(struct monst *, struct trap *, unsigned); +static int trapeffect_landmine(struct monst *, struct trap *, unsigned); +static int trapeffect_rolling_boulder_trap(struct monst *, struct trap *, + unsigned); +static int trapeffect_magic_portal(struct monst *, struct trap *, unsigned); +static int trapeffect_vibrating_square(struct monst *, struct trap *, + unsigned); +static int trapeffect_selector(struct monst *, struct trap *, unsigned); +static char *trapnote(struct trap *, boolean); +static int steedintrap(struct trap *, struct obj *); +static void launch_drop_spot(struct obj *, xchar, xchar); +static int mkroll_launch(struct trap *, xchar, xchar, short, long); +static boolean isclearpath(coord *, int, schar, schar); +static void dofiretrap(struct obj *); +static void domagictrap(void); +static boolean emergency_disrobe(boolean *); +static int untrap_prob(struct trap *); +static void move_into_trap(struct trap *); +static int try_disarm(struct trap *, boolean); +static void reward_untrap(struct trap *, struct monst *); +static int disarm_holdingtrap(struct trap *); +static int disarm_landmine(struct trap *); +static int unsqueak_ok(struct obj *); +static int disarm_squeaky_board(struct trap *); +static int disarm_shooting_trap(struct trap *, int); +static void clear_conjoined_pits(struct trap *); +static boolean adj_nonconjoined_pit(struct trap *); +static int try_lift(struct monst *, struct trap *, int, boolean); +static int help_monster_out(struct monst *, struct trap *); #if 0 -static void FDECL(join_adjacent_pits, (struct trap *)); +static void join_adjacent_pits(struct trap *); #endif -static boolean FDECL(thitm, (int, struct monst *, struct obj *, int, - BOOLEAN_P)); -static void NDECL(maybe_finish_sokoban); +static boolean thitm(int, struct monst *, struct obj *, int, boolean); +static void maybe_finish_sokoban(void); static const char *const a_your[2] = { "a", "your" }; static const char *const A_Your[2] = { "A", "Your" }; @@ -75,8 +74,7 @@ static const char *const blindgas[6] = { "humid", "odorless", /* called when you're hit by fire (dofiretrap,buzz,zapyourself,explode); returns TRUE if hit on torso */ boolean -burnarmor(victim) -struct monst *victim; +burnarmor(struct monst* victim) { struct obj *item; char buf[BUFSZ]; @@ -159,11 +157,11 @@ struct monst *victim; * Returns an erosion return value (ER_*) */ int -erode_obj(otmp, ostr, type, ef_flags) -register struct obj *otmp; -const char *ostr; -int type; -int ef_flags; +erode_obj( + register struct obj *otmp, + const char *ostr, + int type, + int ef_flags) { static NEARDATA const char *const action[] = { "smoulder", "rust", "rot", "corrode" }, @@ -307,10 +305,10 @@ int ef_flags; * wears off. */ boolean -grease_protect(otmp, ostr, victim) -register struct obj *otmp; -const char *ostr; -struct monst *victim; +grease_protect( + register struct obj *otmp, + const char *ostr, + struct monst *victim) { static const char txt[] = "protected by the layer of grease!"; boolean vismon = victim && (victim != &g.youmonst) && canseemon(victim); @@ -336,8 +334,7 @@ struct monst *victim; } struct trap * -maketrap(x, y, typ) -int x, y, typ; +maketrap(int x, int y, int typ) { static union vlaunchinfo zero_vl; boolean oldplace; @@ -468,9 +465,9 @@ int x, y, typ; } void -fall_through(td, ftflags) -boolean td; /* td == TRUE : trap door or hole */ -unsigned ftflags; +fall_through( + boolean td, /* td == TRUE : trap door or hole */ + unsigned ftflags) { d_level dtmp; char msgbuf[BUFSZ]; @@ -591,11 +588,12 @@ unsigned ftflags; * shop status--it's not worth the hassle.] */ struct monst * -animate_statue(statue, x, y, cause, fail_reason) -struct obj *statue; -xchar x, y; -int cause; -int *fail_reason; +animate_statue( + struct obj *statue, + xchar x, + xchar y, + int cause, + int *fail_reason) { int mnum = statue->corpsenm; struct permonst *mptr = &mons[mnum]; @@ -769,10 +767,11 @@ int *fail_reason; * or pick-axe. */ struct monst * -activate_statue_trap(trap, x, y, shatter) -struct trap *trap; -xchar x, y; -boolean shatter; +activate_statue_trap( + struct trap *trap, + xchar x, + xchar y, + boolean shatter) { struct monst *mtmp = (struct monst *) 0; struct obj *otmp = sobj_at(STATUE, x, y); @@ -799,9 +798,10 @@ boolean shatter; } static boolean -keep_saddle_with_steedcorpse(steed_mid, objchn, saddle) -unsigned steed_mid; -struct obj *objchn, *saddle; +keep_saddle_with_steedcorpse( + unsigned steed_mid, + struct obj *objchn, + struct obj *saddle) { if (!saddle) return FALSE; @@ -831,10 +831,10 @@ struct obj *objchn, *saddle; /* monster or you go through and possibly destroy a web. return TRUE if could go through. */ static boolean -mu_maybe_destroy_web(mtmp, domsg, trap) -struct monst *mtmp; -boolean domsg; -struct trap *trap; +mu_maybe_destroy_web( + struct monst *mtmp, + boolean domsg, + struct trap *trap) { boolean isyou = (mtmp == &g.youmonst); struct permonst *mptr = mtmp->data; @@ -875,9 +875,7 @@ struct trap *trap; /* make a single arrow/dart/rock for a trap to shoot or drop */ static struct obj * -t_missile(otyp, trap) -int otyp; -struct trap *trap; +t_missile(int otyp, struct trap* trap) { struct obj *otmp = mksobj(otyp, TRUE, FALSE); @@ -889,8 +887,7 @@ struct trap *trap; } void -set_utrap(tim, typ) -unsigned tim, typ; +set_utrap(unsigned int tim, unsigned int typ) { /* if we get here through reset_utrap(), the caller of that might have already set u.utrap to 0 so this check won't be sufficient @@ -910,8 +907,7 @@ unsigned tim, typ; } void -reset_utrap(msg) -boolean msg; +reset_utrap(boolean msg) { boolean was_Lev = (Levitation != 0), was_Fly = (Flying != 0); @@ -926,10 +922,10 @@ boolean msg; } static int -trapeffect_arrow_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_arrow_trap( + struct monst *mtmp, + struct trap *trap, + unsigned trflags UNUSED) { struct obj *otmp; @@ -982,10 +978,10 @@ unsigned trflags UNUSED; } static int -trapeffect_dart_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_dart_trap( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags UNUSED) { struct obj *otmp; @@ -1050,10 +1046,10 @@ unsigned trflags UNUSED; } static int -trapeffect_rocktrap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_rocktrap( + struct monst *mtmp, + struct trap *trap, + unsigned trflags UNUSED) { struct obj *otmp; @@ -1115,10 +1111,10 @@ unsigned trflags UNUSED; } static int -trapeffect_sqky_board(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_sqky_board( + struct monst *mtmp, + struct trap *trap, + unsigned trflags) { boolean forcetrap = ((trflags & FORCETRAP) != 0 || (trflags & FAILEDUNTRAP) != 0); @@ -1170,10 +1166,10 @@ unsigned trflags; } static int -trapeffect_bear_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_bear_trap( + struct monst *mtmp, + struct trap *trap, + unsigned trflags) { boolean forcetrap = ((trflags & FORCETRAP) != 0 || (trflags & FAILEDUNTRAP) != 0); @@ -1243,10 +1239,10 @@ unsigned trflags; } static int -trapeffect_slp_gas_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_slp_gas_trap( + struct monst *mtmp, + struct trap *trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { seetrap(trap); @@ -1272,10 +1268,10 @@ unsigned trflags UNUSED; } static int -trapeffect_rust_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_rust_trap( + struct monst *mtmp, + struct trap *trap, + unsigned int trflags UNUSED) { struct obj *otmp; @@ -1401,10 +1397,10 @@ unsigned trflags UNUSED; } static int -trapeffect_fire_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_fire_trap( + struct monst *mtmp, + struct trap *trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { seetrap(trap); @@ -1483,10 +1479,10 @@ unsigned trflags UNUSED; } static int -trapeffect_pit(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_pit( + struct monst *mtmp, + struct trap *trap, + unsigned int trflags) { int ttype = trap->ttyp; @@ -1658,10 +1654,10 @@ unsigned trflags; } static int -trapeffect_hole(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_hole( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { if (!Can_fall_thru(&u.uz)) { @@ -1717,10 +1713,10 @@ unsigned trflags; } static int -trapeffect_telep_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_telep_trap( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { seetrap(trap); @@ -1734,10 +1730,10 @@ unsigned trflags UNUSED; } static int -trapeffect_level_telep(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_level_telep( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { seetrap(trap); @@ -1758,10 +1754,10 @@ unsigned trflags; } static int -trapeffect_web(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_web( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { boolean webmsgok = (trflags & NOWEBMSG) == 0; @@ -1926,10 +1922,10 @@ unsigned trflags; } static int -trapeffect_statue_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_statue_trap( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { (void) activate_statue_trap(trap, u.ux, u.uy, FALSE); @@ -1940,10 +1936,10 @@ unsigned trflags UNUSED; } static int -trapeffect_magic_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_magic_trap( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { seetrap(trap); @@ -1968,10 +1964,10 @@ unsigned trflags; } static int -trapeffect_anti_magic(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_anti_magic( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { seetrap(trap); @@ -2061,10 +2057,10 @@ unsigned trflags UNUSED; } static int -trapeffect_poly_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_poly_trap( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { boolean viasitting = (trflags & VIASITTING) != 0; @@ -2114,10 +2110,10 @@ unsigned trflags; } static int -trapeffect_landmine(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_landmine( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { boolean already_seen = trap->tseen; @@ -2233,10 +2229,10 @@ unsigned trflags; } static int -trapeffect_rolling_boulder_trap(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_rolling_boulder_trap( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0); @@ -2278,10 +2274,10 @@ unsigned trflags UNUSED; } static int -trapeffect_magic_portal(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_magic_portal( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { if (mtmp == &g.youmonst) { feeltrap(trap); @@ -2293,10 +2289,10 @@ unsigned trflags; } static int -trapeffect_vibrating_square(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags UNUSED; +trapeffect_vibrating_square( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { feeltrap(trap); @@ -2336,10 +2332,10 @@ unsigned trflags UNUSED; } static int -trapeffect_selector(mtmp, trap, trflags) -struct monst *mtmp; -struct trap *trap; -unsigned trflags; +trapeffect_selector( + struct monst* mtmp, + struct trap* trap, + unsigned int trflags) { switch (trap->ttyp) { case ARROW_TRAP: @@ -2395,9 +2391,7 @@ unsigned trflags; } void -dotrap(trap, trflags) -register struct trap *trap; -unsigned trflags; +dotrap(register struct trap* trap, unsigned int trflags) { register int ttype = trap->ttyp; boolean already_seen = trap->tseen, @@ -2457,9 +2451,7 @@ unsigned trflags; } static char * -trapnote(trap, noprefix) -struct trap *trap; -boolean noprefix; +trapnote(struct trap* trap, boolean noprefix) { static char tnbuf[12]; const char *tn, @@ -2477,9 +2469,7 @@ boolean noprefix; } static int -steedintrap(trap, otmp) -struct trap *trap; -struct obj *otmp; +steedintrap(struct trap* trap, struct obj* otmp) { struct monst *steed = u.usteed; int tt; @@ -2561,8 +2551,7 @@ struct obj *otmp; /* some actions common to both player and monsters for triggered landmine */ void -blow_up_landmine(trap) -struct trap *trap; +blow_up_landmine(struct trap* trap) { int x = trap->tx, y = trap->ty, dbx, dby; struct rm *lev = &levl[x][y]; @@ -2606,9 +2595,7 @@ struct trap *trap; } static void -launch_drop_spot(obj, x, y) -struct obj *obj; -xchar x, y; +launch_drop_spot(struct obj* obj, xchar x, xchar y) { if (!obj) { g.launchplace.obj = (struct obj *) 0; @@ -2622,7 +2609,7 @@ xchar x, y; } boolean -launch_in_progress() +launch_in_progress(void) { if (g.launchplace.obj) return TRUE; @@ -2630,7 +2617,7 @@ launch_in_progress() } void -force_launch_placement() +force_launch_placement(void) { if (g.launchplace.obj) { g.launchplace.obj->otrapped = 0; @@ -2646,10 +2633,13 @@ force_launch_placement() * 2 if an object was launched, but used up. */ int -launch_obj(otyp, x1, y1, x2, y2, style) -short otyp; -register int x1, y1, x2, y2; -int style; +launch_obj( + short otyp, + register int x1, + register int y1, + register int x2, + register int y2, + int style) { register struct monst *mtmp; register struct obj *otmp, *otmp2; @@ -2909,8 +2899,7 @@ int style; } void -seetrap(trap) -struct trap *trap; +seetrap(struct trap* trap) { if (!trap->tseen) { trap->tseen = 1; @@ -2920,8 +2909,7 @@ struct trap *trap; /* like seetrap() but overrides vision */ void -feeltrap(trap) -struct trap *trap; +feeltrap(struct trap* trap) { trap->tseen = 1; map_trap(trap, 1); @@ -2930,11 +2918,12 @@ struct trap *trap; } static int -mkroll_launch(ttmp, x, y, otyp, ocount) -struct trap *ttmp; -xchar x, y; -short otyp; -long ocount; +mkroll_launch( + struct trap *ttmp, + xchar x, + xchar y, + short otyp, + long ocount) { struct obj *otmp; register int tmp; @@ -3000,10 +2989,11 @@ long ocount; } static boolean -isclearpath(cc, distance, dx, dy) -coord *cc; -int distance; -schar dx, dy; +isclearpath( + coord *cc, + int distance, + schar dx, + schar dy) { uchar typ; xchar x, y; @@ -3023,8 +3013,7 @@ schar dx, dy; } int -mintrap(mtmp) -register struct monst *mtmp; +mintrap(register struct monst *mtmp) { register struct trap *trap = t_at(mtmp->mx, mtmp->my); boolean trapkilled = FALSE; @@ -3101,8 +3090,7 @@ register struct monst *mtmp; /* Combine cockatrice checks into single functions to avoid repeating code. */ void -instapetrify(str) -const char *str; +instapetrify(const char *str) { if (Stone_resistance) return; @@ -3116,9 +3104,7 @@ const char *str; } void -minstapetrify(mon, byplayer) -struct monst *mon; -boolean byplayer; +minstapetrify(struct monst *mon, boolean byplayer) { if (resists_ston(mon)) return; @@ -3143,8 +3129,7 @@ boolean byplayer; } void -selftouch(arg) -const char *arg; +selftouch(const char *arg) { char kbuf[BUFSZ]; @@ -3175,10 +3160,10 @@ const char *arg; } void -mselftouch(mon, arg, byplayer) -struct monst *mon; -const char *arg; -boolean byplayer; +mselftouch( + struct monst *mon, + const char *arg, + boolean byplayer) { struct obj *mwep = MON_WEP(mon); @@ -3199,7 +3184,7 @@ boolean byplayer; /* start levitating */ void -float_up() +float_up(void) { g.context.botl = TRUE; if (u.utrap) { @@ -3269,8 +3254,7 @@ float_up() } void -fill_pit(x, y) -int x, y; +fill_pit(int x, int y) { struct obj *otmp; struct trap *t; @@ -3284,8 +3268,9 @@ int x, y; /* stop levitating */ int -float_down(hmask, emask) -long hmask, emask; /* might cancel timeout */ +float_down( + long hmask, + long emask) /* might cancel timeout */ { register struct trap *trap = (struct trap *) 0; d_level current_dungeon_level; @@ -3441,7 +3426,7 @@ long hmask, emask; /* might cancel timeout */ /* shared code for climbing out of a pit */ void -climb_pit() +climb_pit(void) { const char *pitname; @@ -3491,8 +3476,8 @@ climb_pit() } static void -dofiretrap(box) -struct obj *box; /* null for floor trap */ +dofiretrap( + struct obj *box) /* null for floor trap */ { boolean see_it = !Blind; int num, alt; @@ -3562,7 +3547,7 @@ struct obj *box; /* null for floor trap */ } static void -domagictrap() +domagictrap(void) { register int fate = rnd(20); @@ -3684,10 +3669,11 @@ domagictrap() * Return whether the object was destroyed. */ boolean -fire_damage(obj, force, x, y) -struct obj *obj; -boolean force; -xchar x, y; +fire_damage( + struct obj *obj, + boolean force, + xchar x, + xchar y) { int chance; struct obj *otmp, *ncobj; @@ -3774,10 +3760,12 @@ xchar x, y; * Return number of objects destroyed. --ALI */ int -fire_damage_chain(chain, force, here, x, y) -struct obj *chain; -boolean force, here; -xchar x, y; +fire_damage_chain( + struct obj *chain, + boolean force, + boolean here, + xchar x, + xchar y) { struct obj *obj, *nobj; int num = 0; @@ -3799,9 +3787,7 @@ xchar x, y; /* obj has been thrown or dropped into lava; damage is worse than mere fire */ boolean -lava_damage(obj, x, y) -struct obj *obj; -xchar x, y; +lava_damage(struct obj* obj, xchar x, xchar y) { int otyp = obj->otyp, ocls = obj->oclass; @@ -3843,8 +3829,7 @@ xchar x, y; } void -acid_damage(obj) -struct obj *obj; +acid_damage(struct obj* obj) { /* Scrolls but not spellbooks can be erased by acid. */ struct monst *victim; @@ -3886,10 +3871,10 @@ struct obj *obj; * Returns an erosion return value (ER_*) */ int -water_damage(obj, ostr, force) -struct obj *obj; -const char *ostr; -boolean force; +water_damage( + struct obj *obj, + const char *ostr, + boolean force) { if (!obj) return ER_NOTHING; @@ -4036,9 +4021,9 @@ boolean force; } void -water_damage_chain(obj, here) -struct obj *obj; -boolean here; +water_damage_chain( + struct obj *obj, + boolean here) { struct obj *otmp; xchar x, y; @@ -4073,8 +4058,7 @@ boolean here; * crawl out of the current predicament. */ static boolean -emergency_disrobe(lostsome) -boolean *lostsome; +emergency_disrobe(boolean *lostsome) { int invc = inv_cnt(TRUE); @@ -4120,7 +4104,7 @@ boolean *lostsome; /* return TRUE iff player relocated */ boolean -drown() +drown(void) { const char *pool_of_water; boolean inpool_ok = FALSE, crawl_ok; @@ -4274,8 +4258,7 @@ drown() } void -drain_en(n) -int n; +drain_en(int n) { if (!u.uenmax) { /* energy is completely gone */ @@ -4299,7 +4282,7 @@ int n; /* disarm a trap */ int -dountrap() +dountrap(void) { if (near_capacity() >= HVY_ENCUMBER) { pline("You're too strained to do that."); @@ -4322,8 +4305,7 @@ dountrap() /* Probability of disabling a trap. Helge Hafting */ static int -untrap_prob(ttmp) -struct trap *ttmp; +untrap_prob(struct trap* ttmp) { int chance = 3; @@ -4353,11 +4335,11 @@ struct trap *ttmp; /* Replace trap with object(s). Helge Hafting */ void -cnv_trap_obj(otyp, cnt, ttmp, bury_it) -int otyp; -int cnt; -struct trap *ttmp; -boolean bury_it; +cnv_trap_obj( + int otyp, + int cnt, + struct trap *ttmp, + boolean bury_it) { struct obj *otmp = mksobj(otyp, TRUE, FALSE); @@ -4384,8 +4366,7 @@ boolean bury_it; /* while attempting to disarm an adjacent trap, we've fallen into it */ static void -move_into_trap(ttmp) -struct trap *ttmp; +move_into_trap(struct trap* ttmp) { int bc = 0; xchar x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy; @@ -4427,9 +4408,7 @@ struct trap *ttmp; * 2: succeeds */ static int -try_disarm(ttmp, force_failure) -struct trap *ttmp; -boolean force_failure; +try_disarm(struct trap* ttmp, boolean force_failure) { struct monst *mtmp = m_at(ttmp->tx, ttmp->ty); int ttype = ttmp->ttyp; @@ -4510,9 +4489,7 @@ boolean force_failure; } static void -reward_untrap(ttmp, mtmp) -struct trap *ttmp; -struct monst *mtmp; +reward_untrap(struct trap* ttmp, struct monst* mtmp) { if (!ttmp->madeby_u) { if (rnl(10) < 8 && !mtmp->mpeaceful && !mtmp->msleeping @@ -4532,8 +4509,7 @@ struct monst *mtmp; } static int -disarm_holdingtrap(ttmp) /* Helge Hafting */ -struct trap *ttmp; +disarm_holdingtrap(struct trap* ttmp) /* Helge Hafting */ { struct monst *mtmp; int fails = try_disarm(ttmp, FALSE); @@ -4565,8 +4541,7 @@ struct trap *ttmp; } static int -disarm_landmine(ttmp) /* Helge Hafting */ -struct trap *ttmp; +disarm_landmine(struct trap* ttmp) /* Helge Hafting */ { int fails = try_disarm(ttmp, FALSE); @@ -4579,8 +4554,7 @@ struct trap *ttmp; /* getobj callback for object to disarm a squeaky board with */ static int -unsqueak_ok(obj) -struct obj *obj; +unsqueak_ok(struct obj* obj) { if (!obj) return GETOBJ_EXCLUDE; @@ -4603,8 +4577,7 @@ struct obj *obj; /* it may not make much sense to use grease on floor boards, but so what? */ static int -disarm_squeaky_board(ttmp) -struct trap *ttmp; +disarm_squeaky_board(struct trap* ttmp) { struct obj *obj; boolean bad_tool; @@ -4638,9 +4611,7 @@ struct trap *ttmp; /* removes traps that shoot arrows, darts, etc. */ static int -disarm_shooting_trap(ttmp, otyp) -struct trap *ttmp; -int otyp; +disarm_shooting_trap(struct trap* ttmp, int otyp) { int fails = try_disarm(ttmp, FALSE); @@ -4654,11 +4625,11 @@ int otyp; /* Is the weight too heavy? * Formula as in near_capacity() & check_capacity() */ static int -try_lift(mtmp, ttmp, wt, stuff) -struct monst *mtmp; -struct trap *ttmp; -int wt; -boolean stuff; +try_lift( + struct monst *mtmp, + struct trap *ttmp, + int wt, + boolean stuff) { int wc = weight_cap(); @@ -4679,9 +4650,9 @@ boolean stuff; /* Help trapped monster (out of a (spiked) pit) */ static int -help_monster_out(mtmp, ttmp) -struct monst *mtmp; -struct trap *ttmp; +help_monster_out( + struct monst *mtmp, + struct trap *ttmp) { int wt; struct obj *otmp; @@ -4770,8 +4741,7 @@ struct trap *ttmp; } int -untrap(force) -boolean force; +untrap(boolean force) { register struct obj *otmp; register int x, y; @@ -5016,10 +4986,10 @@ boolean force; /* for magic unlocking; returns true if targetted monster (which might be hero) gets untrapped; the trap remains intact */ boolean -openholdingtrap(mon, noticed) -struct monst *mon; -boolean *noticed; /* set to true iff hero notices the effect; */ -{ /* otherwise left with its previous value intact */ +openholdingtrap( + struct monst *mon, + boolean *noticed) /* set to true iff hero notices the effect; */ +{ /* otherwise left with its previous value intact */ struct trap *t; char buf[BUFSZ], whichbuf[20]; const char *trapdescr = 0, *which = 0; @@ -5108,10 +5078,10 @@ boolean *noticed; /* set to true iff hero notices the effect; */ /* for magic locking; returns true if targetted monster (which might be hero) gets hit by a trap (might avoid actually becoming trapped) */ boolean -closeholdingtrap(mon, noticed) -struct monst *mon; -boolean *noticed; /* set to true iff hero notices the effect; */ -{ /* otherwise left with its previous value intact */ +closeholdingtrap( + struct monst *mon, + boolean *noticed) /* set to true iff hero notices the effect; */ +{ /* otherwise left with its previous value intact */ struct trap *t; unsigned dotrapflags; boolean ishero = (mon == &g.youmonst), result; @@ -5153,11 +5123,11 @@ boolean *noticed; /* set to true iff hero notices the effect; */ /* for magic unlocking; returns true if targetted monster (which might be hero) gets hit by a trap (target might avoid its effect) */ boolean -openfallingtrap(mon, trapdoor_only, noticed) -struct monst *mon; -boolean trapdoor_only; -boolean *noticed; /* set to true iff hero notices the effect; */ -{ /* otherwise left with its previous value intact */ +openfallingtrap( + struct monst *mon, + boolean trapdoor_only, + boolean *noticed) /* set to true iff hero notices the effect; */ +{ /* otherwise left with its previous value intact */ struct trap *t; boolean ishero = (mon == &g.youmonst), result; @@ -5196,10 +5166,10 @@ boolean *noticed; /* set to true iff hero notices the effect; */ /* only called when the player is doing something to the chest directly */ boolean -chest_trap(obj, bodypart, disarm) -register struct obj *obj; -register int bodypart; -boolean disarm; +chest_trap( + register struct obj *obj, + register int bodypart, + boolean disarm) { register struct obj *otmp = obj, *otmp2; char buf[80]; @@ -5386,8 +5356,7 @@ boolean disarm; } struct trap * -t_at(x, y) -register int x, y; +t_at(register int x, register int y) { register struct trap *trap = g.ftrap; @@ -5400,8 +5369,7 @@ register int x, y; } void -deltrap(trap) -register struct trap *trap; +deltrap(register struct trap* trap) { register struct trap *ttmp; @@ -5422,9 +5390,10 @@ register struct trap *trap; } boolean -conjoined_pits(trap2, trap1, u_entering_trap2) -struct trap *trap2, *trap1; -boolean u_entering_trap2; +conjoined_pits( + struct trap *trap2, + struct trap *trap1, + boolean u_entering_trap2) { int dx, dy, diridx, adjidx; @@ -5451,8 +5420,7 @@ boolean u_entering_trap2; } static void -clear_conjoined_pits(trap) -struct trap *trap; +clear_conjoined_pits(struct trap* trap) { int diridx, adjidx, x, y; struct trap *t; @@ -5475,8 +5443,7 @@ struct trap *trap; } static boolean -adj_nonconjoined_pit(adjtrap) -struct trap *adjtrap; +adj_nonconjoined_pit(struct trap* adjtrap) { struct trap *trap_with_u = t_at(u.ux0, u.uy0); @@ -5498,8 +5465,7 @@ struct trap *adjtrap; * (currently not called from anywhere) */ static void -join_adjacent_pits(trap) -struct trap *trap; +join_adjacent_pits(struct trap* trap) { struct trap *t; int diridx, x, y; @@ -5524,8 +5490,7 @@ struct trap *trap; * Returns TRUE if you escaped a pit and are standing on the precipice. */ boolean -uteetering_at_seen_pit(trap) -struct trap *trap; +uteetering_at_seen_pit(struct trap* trap) { return (trap && is_pit(trap->ttyp) && trap->tseen && trap->tx == u.ux && trap->ty == u.uy @@ -5537,8 +5502,7 @@ struct trap *trap; * release a trap door */ boolean -uescaped_shaft(trap) -struct trap *trap; +uescaped_shaft(struct trap* trap) { return (trap && is_hole(trap->ttyp) && trap->tseen && trap->tx == u.ux && trap->ty == u.uy); @@ -5546,8 +5510,7 @@ struct trap *trap; /* Destroy a trap that emanates from the floor. */ boolean -delfloortrap(ttmp) -register struct trap *ttmp; +delfloortrap(struct trap* ttmp) { /* some of these are arbitrary -dlc */ if (ttmp && ((ttmp->ttyp == SQKY_BOARD) || (ttmp->ttyp == BEAR_TRAP) @@ -5573,9 +5536,7 @@ register struct trap *ttmp; /* used for doors (also tins). can be used for anything else that opens. */ void -b_trapped(item, bodypart) -const char *item; -int bodypart; +b_trapped(const char* item, int bodypart) { int lvl = level_difficulty(), dmg = rnd(5 + (lvl < 5 ? lvl : 2 + lvl / 2)); @@ -5592,12 +5553,12 @@ int bodypart; /* Monster is hit by trap. */ /* Note: doesn't work if both obj and d_override are null */ static boolean -thitm(tlev, mon, obj, d_override, nocorpse) -int tlev; -struct monst *mon; -struct obj *obj; -int d_override; -boolean nocorpse; +thitm( + int tlev, + struct monst *mon, + struct obj *obj, + int d_override, + boolean nocorpse) { int strike; boolean trapkilled = FALSE; @@ -5648,7 +5609,7 @@ boolean nocorpse; } boolean -unconscious() +unconscious(void) { if (g.multi >= 0) return FALSE; @@ -5663,7 +5624,7 @@ unconscious() static const char lava_killer[] = "molten lava"; boolean -lava_effects() +lava_effects(void) { register struct obj *obj, *obj2; int dmg = d(6, 6); /* only applicable for water walking */ @@ -5791,7 +5752,7 @@ lava_effects() /* called each turn when trapped in lava */ void -sink_into_lava() +sink_into_lava(void) { static const char sink_deeper[] = "You sink deeper into the lava."; @@ -5839,7 +5800,7 @@ sink_into_lava() /* called when something has been done (breaking a boulder, for instance) which entails a luck penalty if performed on a sokoban level */ void -sokoban_guilt() +sokoban_guilt(void) { if (Sokoban) { u.uconduct.sokocheat++; @@ -5859,7 +5820,7 @@ sokoban_guilt() /* called when a trap has been deleted or had its ttyp replaced */ static void -maybe_finish_sokoban() +maybe_finish_sokoban(void) { struct trap *t; @@ -5892,9 +5853,7 @@ maybe_finish_sokoban() * calls). */ const char * -trapname(ttyp, override) -int ttyp; -boolean override; +trapname(int ttyp, boolean override) { static const char *halu_trapnames[] = { /* riffs on actual nethack traps */ @@ -5950,8 +5909,7 @@ boolean override; chain, due to some external source of fire. The object chain should be somewhere exposed, like someone's open inventory or the floor. */ void -ignite_items(objchn) -struct obj *objchn; +ignite_items(struct obj* objchn) { struct obj *obj; boolean bynexthere = (objchn && objchn->where == OBJ_FLOOR); diff --git a/src/u_init.c b/src/u_init.c index 99be2a44d..4c069f3d7 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -13,10 +13,10 @@ struct trobj { Bitfield(trbless, 2); }; -static void FDECL(ini_inv, (struct trobj *)); -static void FDECL(knows_object, (int)); -static void FDECL(knows_class, (CHAR_P)); -static boolean FDECL(restricted_spell_discipline, (int)); +static void ini_inv(struct trobj *); +static void knows_object(int); +static void knows_class(char); +static boolean restricted_spell_discipline(int); #define UNDEF_TYP 0 #define UNDEF_SPE '\177' @@ -558,8 +558,7 @@ static const struct def_skill Skill_W[] = { }; static void -knows_object(obj) -register int obj; +knows_object(int obj) { discover_object(obj, TRUE, FALSE); objects[obj].oc_pre_discovered = 1; /* not a "discovery" */ @@ -569,8 +568,7 @@ register int obj; * like all gems except the loadstone and luckstone. */ static void -knows_class(sym) -register char sym; +knows_class(char sym) { register int ct; for (ct = 1; ct < NUM_OBJECTS; ct++) @@ -579,7 +577,7 @@ register char sym; } void -u_init() +u_init(void) { register int i; struct u_roleplay tmpuroleplay = u.uroleplay; /* set by rcfile options */ @@ -908,8 +906,7 @@ u_init() /* skills aren't initialized, so we use the role-specific skill lists */ static boolean -restricted_spell_discipline(otyp) -int otyp; +restricted_spell_discipline(int otyp) { const struct def_skill *skills; int this_skill = spell_skilltype(otyp); @@ -968,8 +965,7 @@ int otyp; } static void -ini_inv(trop) -register struct trobj *trop; +ini_inv(struct trobj *trop) { struct obj *obj; int otyp, i; diff --git a/src/uhitm.c b/src/uhitm.c index 09db7c852..5a8e54b02 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -8,30 +8,28 @@ static const char brief_feeling[] = "have a %s feeling for a moment, then it passes."; -static boolean FDECL(known_hitum, (struct monst *, struct obj *, int *, - int, int, struct attack *, int)); -static boolean FDECL(theft_petrifies, (struct obj *)); -static void FDECL(steal_it, (struct monst *, struct attack *)); -static boolean FDECL(hitum_cleave, (struct monst *, struct attack *)); -static boolean FDECL(hitum, (struct monst *, struct attack *)); -static boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int, int)); -static int FDECL(joust, (struct monst *, struct obj *)); -static void NDECL(demonpet); -static boolean FDECL(m_slips_free, (struct monst *, struct attack *)); -static int FDECL(explum, (struct monst *, struct attack *)); -static void FDECL(start_engulf, (struct monst *)); -static void NDECL(end_engulf); -static int FDECL(gulpum, (struct monst *, struct attack *)); -static boolean FDECL(hmonas, (struct monst *)); -static void FDECL(nohandglow, (struct monst *)); -static boolean FDECL(shade_aware, (struct obj *)); +static boolean known_hitum(struct monst *, struct obj *, int *, int, int, + struct attack *, int); +static boolean theft_petrifies(struct obj *); +static void steal_it(struct monst *, struct attack *); +static boolean hitum_cleave(struct monst *, struct attack *); +static boolean hitum(struct monst *, struct attack *); +static boolean hmon_hitmon(struct monst *, struct obj *, int, int); +static int joust(struct monst *, struct obj *); +static void demonpet(void); +static boolean m_slips_free(struct monst *, struct attack *); +static int explum(struct monst *, struct attack *); +static void start_engulf(struct monst *); +static void end_engulf(void); +static int gulpum(struct monst *, struct attack *); +static boolean hmonas(struct monst *); +static void nohandglow(struct monst *); +static boolean shade_aware(struct obj *); #define PROJECTILE(obj) ((obj) && is_ammo(obj)) void -erode_armor(mdef, hurt) -struct monst *mdef; -int hurt; +erode_armor(struct monst *mdef, int hurt) { struct obj *target; @@ -94,9 +92,8 @@ int hurt; /* FALSE means it's OK to attack */ boolean -attack_checks(mtmp, wep) -register struct monst *mtmp; -struct obj *wep; /* uwep for attack(), null for kick_monster() */ +attack_checks(struct monst *mtmp, + struct obj *wep) /* uwep for attack(), null for kick_monster() */ { int glyph; @@ -231,8 +228,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */ * It is unchivalrous for a knight to attack the defenseless or from behind. */ void -check_caitiff(mtmp) -struct monst *mtmp; +check_caitiff(struct monst *mtmp) { if (u.ualign.record <= -10) return; @@ -250,11 +246,11 @@ struct monst *mtmp; } int -find_roll_to_hit(mtmp, aatyp, weapon, attk_count, role_roll_penalty) -register struct monst *mtmp; -uchar aatyp; /* usually AT_WEAP or AT_KICK */ -struct obj *weapon; /* uwep or uswapwep or NULL */ -int *attk_count, *role_roll_penalty; +find_roll_to_hit(struct monst *mtmp, + uchar aatyp, /* usually AT_WEAP or AT_KICK */ + struct obj *weapon, /* uwep or uswapwep or NULL */ + int *attk_count, + int *role_roll_penalty) { int tmp, tmp2; @@ -323,8 +319,7 @@ int *attk_count, *role_roll_penalty; /* try to attack; return False if monster evaded; u.dx and u.dy must be set */ boolean -attack(mtmp) -register struct monst *mtmp; +attack(struct monst *mtmp) { register struct permonst *mdat = mtmp->data; @@ -459,13 +454,10 @@ register struct monst *mtmp; /* really hit target monster; returns TRUE if it still lives */ static boolean -known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk, dieroll) -register struct monst *mon; -struct obj *weapon; -int *mhit; -int rollneeded, armorpenalty; /* for monks */ -struct attack *uattk; -int dieroll; +known_hitum(struct monst *mon, struct obj *weapon, int *mhit, int rollneeded, + int armorpenalty, /* for monks */ + struct attack *uattk, + int dieroll) { boolean malive = TRUE, /* hmon() might destroy weapon; remember aspect for cutworm */ @@ -519,9 +511,10 @@ int dieroll; /* hit the monster next to you and the monsters to the left and right of it; return False if the primary target is killed, True otherwise */ static boolean -hitum_cleave(target, uattk) -struct monst *target; /* non-Null; forcefight at nothing doesn't cleave... */ -struct attack *uattk; /* ... but we don't enforce that here; Null works ok */ +hitum_cleave(struct monst *target, /* non-Null; forcefight at nothing doesn't + cleave... */ + struct attack *uattk) /* ... but we don't enforce that here; Null + works ok */ { /* swings will be delivered in alternate directions; with consecutive attacks it will simulate normal swing and backswing; when swings @@ -600,9 +593,7 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */ /* hit target monster; returns TRUE if it still lives */ static boolean -hitum(mon, uattk) -struct monst *mon; -struct attack *uattk; +hitum(struct monst *mon, struct attack *uattk) { boolean malive, wep_was_destroyed = FALSE; struct obj *wepbefore = uwep; @@ -646,11 +637,10 @@ struct attack *uattk; /* general "damage monster" routine; return True if mon still alive */ boolean -hmon(mon, obj, thrown, dieroll) -struct monst *mon; -struct obj *obj; -int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ -int dieroll; +hmon(struct monst *mon, + struct obj *obj, + int thrown, /* HMON_xxx (0 => hand-to-hand, other => ranged) */ + int dieroll) { boolean result, anger_guards; @@ -666,11 +656,10 @@ int dieroll; /* guts of hmon() */ static boolean -hmon_hitmon(mon, obj, thrown, dieroll) -struct monst *mon; -struct obj *obj; -int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ -int dieroll; +hmon_hitmon(struct monst *mon, + struct obj *obj, + int thrown, /* HMON_xxx (0 => hand-to-hand, other => ranged) */ + int dieroll) { int tmp; struct permonst *mdat = mon->data; @@ -1399,8 +1388,7 @@ int dieroll; } static boolean -shade_aware(obj) -struct obj *obj; +shade_aware(struct obj *obj) { if (!obj) return FALSE; @@ -1424,10 +1412,8 @@ struct obj *obj; /* used for hero vs monster and monster vs monster; also handles monster vs hero but that won't happen because hero can't be a shade */ boolean -shade_miss(magr, mdef, obj, thrown, verbose) -struct monst *magr, *mdef; -struct obj *obj; -boolean thrown, verbose; +shade_miss(struct monst *magr, struct monst *mdef, struct obj *obj, + boolean thrown, boolean verbose) { const char *what, *whose, *target; boolean youagr = (magr == &g.youmonst), youdef = (mdef == &g.youmonst); @@ -1462,9 +1448,7 @@ boolean thrown, verbose; /* check whether slippery clothing protects from hug or wrap attack */ /* [currently assumes that you are the attacker] */ static boolean -m_slips_free(mdef, mattk) -struct monst *mdef; -struct attack *mattk; +m_slips_free(struct monst *mdef, struct attack *mattk) { struct obj *obj; @@ -1506,9 +1490,8 @@ struct attack *mattk; /* used when hitting a monster with a lance while mounted; 1: joust hit; 0: ordinary hit; -1: joust but break lance */ static int -joust(mon, obj) -struct monst *mon; /* target */ -struct obj *obj; /* weapon */ +joust(struct monst *mon, /* target */ + struct obj *obj) /* weapon */ { int skill_rating, joust_dieroll; @@ -1544,7 +1527,7 @@ struct obj *obj; /* weapon */ * Pulling it out makes it work. */ static void -demonpet() +demonpet(void) { int i; struct permonst *pm; @@ -1559,8 +1542,7 @@ demonpet() } static boolean -theft_petrifies(otmp) -struct obj *otmp; +theft_petrifies(struct obj *otmp) { if (uarmg || otmp->otyp != CORPSE || !touch_petrifies(&mons[otmp->corpsenm]) || Stone_resistance) @@ -1586,9 +1568,7 @@ struct obj *otmp; * otherwise, take one object. [Is this really the behavior we want?] */ static void -steal_it(mdef, mattk) -struct monst *mdef; -struct attack *mattk; +steal_it(struct monst *mdef, struct attack *mattk) { struct obj *otmp, *gold = 0, *ustealo, **minvent_ptr; long unwornmask; @@ -1698,11 +1678,8 @@ struct attack *mattk; } void -mhitm_ad_rust(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_rust(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -1756,11 +1733,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_corr(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_corr(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -1783,11 +1757,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_dcay(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_dcay(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -1839,11 +1810,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_dren(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_dren(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -1877,11 +1845,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_drli(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_drli(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -1956,11 +1921,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_fire(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_fire(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -2076,11 +2038,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_cold(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_cold(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -2141,11 +2100,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_elec(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_elec(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -2212,11 +2168,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_acid(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_acid(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -2259,11 +2212,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_sgld(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_sgld(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; struct permonst *pd = mdef->data; @@ -2327,11 +2277,8 @@ struct mhitm_data *mhm; void -mhitm_ad_tlpt(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_tlpt(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -2427,11 +2374,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_blnd(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_blnd(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -2474,11 +2418,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_curs(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_curs(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; struct permonst *pd = mdef->data; @@ -2557,11 +2498,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_drst(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_drst(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; @@ -2628,11 +2566,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_drin(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_drin(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -2729,11 +2664,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_stck(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_stck(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -2765,11 +2697,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_wrap(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -2841,11 +2770,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_plys(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_plys(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -2895,11 +2821,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_slee(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm UNUSED; +mhitm_ad_slee(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm UNUSED) { if (magr == &g.youmonst) { /* uhitm */ @@ -2946,11 +2869,8 @@ struct mhitm_data *mhm UNUSED; } void -mhitm_ad_slim(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_slim(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3027,11 +2947,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_ench(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm UNUSED; +mhitm_ad_ench(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm UNUSED) { if (magr == &g.youmonst) { /* uhitm */ @@ -3078,11 +2995,8 @@ struct mhitm_data *mhm UNUSED; } void -mhitm_ad_slow(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm UNUSED; +mhitm_ad_slow(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm UNUSED) { if (magr == &g.youmonst) { /* uhitm */ @@ -3122,11 +3036,8 @@ struct mhitm_data *mhm UNUSED; } void -mhitm_ad_conf(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_conf(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -3163,11 +3074,10 @@ struct mhitm_data *mhm; } void -mhitm_ad_poly(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; /* implied */ -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_poly(struct monst *magr, + struct attack *mattk UNUSED, /* implied */ + struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -3193,11 +3103,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_famn(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_famn(struct monst *magr, struct attack *mattk UNUSED, + struct monst *mdef, struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -3216,11 +3123,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_pest(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_pest(struct monst *magr, struct attack *mattk UNUSED, + struct monst *mdef, struct mhitm_data *mhm) { struct permonst *pa = magr->data; @@ -3239,11 +3143,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_deth(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_deth(struct monst *magr, struct attack *mattk UNUSED, + struct monst *mdef, struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3292,11 +3193,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_halu(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_halu(struct monst *magr, struct attack *mattk UNUSED, + struct monst *mdef, struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3320,8 +3218,7 @@ struct mhitm_data *mhm; } boolean -do_stone_u(mtmp) -struct monst *mtmp; +do_stone_u(struct monst *mtmp) { if (!Stoned && !Stone_resistance && !(poly_when_stoned(g.youmonst.data) @@ -3342,11 +3239,8 @@ struct monst *mtmp; } void -do_stone_mon(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; -struct monst *mdef; -struct mhitm_data *mhm; +do_stone_mon(struct monst *magr, struct attack *mattk UNUSED, + struct monst *mdef, struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3379,11 +3273,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_phys(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_phys(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; struct permonst *pd = mdef->data; @@ -3563,11 +3454,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_ston(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_ston(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -3605,11 +3493,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_were(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_were(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; @@ -3640,11 +3525,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_heal(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_heal(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3728,11 +3610,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_stun(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_stun(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3767,11 +3646,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_legs(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_legs(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -3836,11 +3712,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_dgst(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk UNUSED; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_dgst(struct monst *magr, struct attack *mattk UNUSED, + struct monst *mdef, struct mhitm_data *mhm) { struct permonst *pd = mdef->data; @@ -3911,11 +3784,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_samu(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_samu(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -3935,11 +3805,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_dise(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_dise(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; @@ -3958,11 +3825,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_sedu(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_sedu(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { struct permonst *pa = magr->data; @@ -4093,11 +3957,8 @@ struct mhitm_data *mhm; } void -mhitm_ad_ssex(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_ad_ssex(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { if (magr == &g.youmonst) { /* uhitm */ @@ -4127,11 +3988,8 @@ struct mhitm_data *mhm; } void -mhitm_adtyping(magr, mattk, mdef, mhm) -struct monst *magr; -struct attack *mattk; -struct monst *mdef; -struct mhitm_data *mhm; +mhitm_adtyping(struct monst *magr, struct attack *mattk, struct monst *mdef, + struct mhitm_data *mhm) { switch (mattk->adtyp) { case AD_STUN: mhitm_ad_stun(magr, mattk, mdef, mhm); break; @@ -4182,10 +4040,8 @@ struct mhitm_data *mhm; } int -damageum(mdef, mattk, specialdmg) -register struct monst *mdef; -register struct attack *mattk; -int specialdmg; /* blessed and/or silver bonus against various things */ +damageum(struct monst *mdef, struct attack *mattk, + int specialdmg) /* blessed and/or silver bonus against various things */ { int armpro; boolean negated; @@ -4229,9 +4085,7 @@ int specialdmg; /* blessed and/or silver bonus against various things */ } static int -explum(mdef, mattk) -register struct monst *mdef; -register struct attack *mattk; +explum(struct monst *mdef, struct attack *mattk) { boolean resistance; /* only for cold/fire/elec */ register int tmp = d((int) mattk->damn, (int) mattk->damd); @@ -4282,8 +4136,7 @@ register struct attack *mattk; } static void -start_engulf(mdef) -struct monst *mdef; +start_engulf(struct monst *mdef) { if (!Invisible) { map_location(u.ux, u.uy, TRUE); @@ -4296,7 +4149,7 @@ struct monst *mdef; } static void -end_engulf() +end_engulf(void) { if (!Invisible) { tmp_at(DISP_END, 0); @@ -4305,9 +4158,7 @@ end_engulf() } static int -gulpum(mdef, mattk) -register struct monst *mdef; -register struct attack *mattk; +gulpum(struct monst *mdef, struct attack *mattk) { #ifdef LINT /* static char msgbuf[BUFSZ]; */ char msgbuf[BUFSZ]; @@ -4523,10 +4374,7 @@ register struct attack *mattk; } void -missum(mdef, mattk, wouldhavehit) -register struct monst *mdef; -register struct attack *mattk; -boolean wouldhavehit; +missum(struct monst *mdef, struct attack *mattk, boolean wouldhavehit) { if (wouldhavehit) /* monk is missing due to penalty for wearing suit */ Your("armor is rather cumbersome..."); @@ -4543,8 +4391,7 @@ boolean wouldhavehit; /* attack monster as a monster; returns True if mon survives */ static boolean -hmonas(mon) -register struct monst *mon; +hmonas(struct monst *mon) { struct attack *mattk, alt_attk; struct obj *weapon, **originalweapon; @@ -4935,13 +4782,12 @@ register struct monst *mon; /* Special (passive) attacks on you by monsters done here. */ int -passive(mon, weapon, mhitb, maliveb, aatyp, wep_was_destroyed) -struct monst *mon; -struct obj *weapon; /* uwep or uswapwep or uarmg or uarmf or Null */ -boolean mhitb; -boolean maliveb; -uchar aatyp; -boolean wep_was_destroyed; +passive(struct monst *mon, + struct obj *weapon, /* uwep or uswapwep or uarmg or uarmf or Null */ + boolean mhitb, + boolean maliveb, + uchar aatyp, + boolean wep_was_destroyed) { register struct permonst *ptr = mon->data; register int i, tmp; @@ -5174,10 +5020,9 @@ boolean wep_was_destroyed; * Assumes the attack was successful. */ void -passive_obj(mon, obj, mattk) -struct monst *mon; -struct obj *obj; /* null means pick uwep, uswapwep or uarmg */ -struct attack *mattk; /* null means we find one internally */ +passive_obj(struct monst *mon, + struct obj *obj, /* null means pick uwep, uswapwep or uarmg */ + struct attack *mattk) /* null means we find one internally */ { struct permonst *ptr = mon->data; int i; @@ -5244,8 +5089,7 @@ struct attack *mattk; /* null means we find one internally */ /* Note: caller must ascertain mtmp is mimicking... */ void -stumble_onto_mimic(mtmp) -struct monst *mtmp; +stumble_onto_mimic(struct monst *mtmp) { const char *fmt = "Wait! That's %s!", *generic = "a monster", *what = 0; @@ -5287,8 +5131,7 @@ struct monst *mtmp; } static void -nohandglow(mon) -struct monst *mon; +nohandglow(struct monst *mon) { char *hands = makeplural(body_part(HAND)); @@ -5310,9 +5153,8 @@ struct monst *mon; /* returns 1 if light flash has noticeable effect on 'mtmp', 0 otherwise */ int -flash_hits_mon(mtmp, otmp) -struct monst *mtmp; -struct obj *otmp; /* source of flash */ +flash_hits_mon(struct monst *mtmp, + struct obj *otmp) /* source of flash */ { struct rm *lev; int tmp, amt, useeit, res = 0; @@ -5366,9 +5208,7 @@ struct obj *otmp; /* source of flash */ } void -light_hits_gremlin(mon, dmg) -struct monst *mon; -int dmg; +light_hits_gremlin(struct monst *mon, int dmg) { pline("%s %s!", Monnam(mon), (dmg > mon->mhp / 2) ? "wails in agony" : "cries out in pain"); diff --git a/src/vault.c b/src/vault.c index 8fb059a9e..874b0733c 100644 --- a/src/vault.c +++ b/src/vault.c @@ -5,20 +5,19 @@ #include "hack.h" -static boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P)); -static void FDECL(blackout, (int, int)); -static void FDECL(restfakecorr, (struct monst *)); -static void FDECL(parkguard, (struct monst *)); -static boolean FDECL(in_fcorridor, (struct monst *, int, int)); -static boolean FDECL(find_guard_dest, (struct monst *, xchar *, xchar *)); -static void FDECL(move_gold, (struct obj *, int)); -static void FDECL(wallify_vault, (struct monst *)); -static void FDECL(gd_mv_monaway, (struct monst *, int, int)); -static void FDECL(gd_pick_corridor_gold, (struct monst *, int, int)); +static boolean clear_fcorr(struct monst *, boolean); +static void blackout(int, int); +static void restfakecorr(struct monst *); +static void parkguard(struct monst *); +static boolean in_fcorridor(struct monst *, int, int); +static boolean find_guard_dest(struct monst *, xchar *, xchar *); +static void move_gold(struct obj *, int); +static void wallify_vault(struct monst *); +static void gd_mv_monaway(struct monst *, int, int); +static void gd_pick_corridor_gold(struct monst *, int, int); void -newegd(mtmp) -struct monst *mtmp; +newegd(struct monst *mtmp) { if (!mtmp->mextra) mtmp->mextra = newmextra(); @@ -29,8 +28,7 @@ struct monst *mtmp; } void -free_egd(mtmp) -struct monst *mtmp; +free_egd(struct monst *mtmp) { if (mtmp->mextra && EGD(mtmp)) { free((genericptr_t) EGD(mtmp)); @@ -43,9 +41,7 @@ struct monst *mtmp; maintained by guard 'grd'; if guard is still in it, removal will fail, to be tried again later */ static boolean -clear_fcorr(grd, forceshow) -struct monst *grd; -boolean forceshow; +clear_fcorr(struct monst *grd, boolean forceshow) { register int fcx, fcy, fcbeg; struct monst *mtmp; @@ -119,8 +115,7 @@ boolean forceshow; the corridor, we don't want the light to reappear if/when a new tunnel goes through the same area */ static void -blackout(x, y) -int x, y; +blackout(int x, int y) { struct rm *lev; int i, j; @@ -141,8 +136,7 @@ int x, y; } static void -restfakecorr(grd) -struct monst *grd; +restfakecorr(struct monst *grd) { /* it seems you left the corridor - let the guard disappear */ if (clear_fcorr(grd, FALSE)) { @@ -153,8 +147,7 @@ struct monst *grd; /* move guard--dead to alive--to <0,0> until temporary corridor is removed */ static void -parkguard(grd) -struct monst *grd; +parkguard(struct monst *grd) { /* either guard is dead or will now be treated as if so; monster traversal loops should skip it */ @@ -173,8 +166,7 @@ struct monst *grd; /* called in mon.c */ boolean -grddead(grd) -struct monst *grd; +grddead(struct monst *grd) { boolean dispose = clear_fcorr(grd, TRUE); @@ -191,9 +183,7 @@ struct monst *grd; } static boolean -in_fcorridor(grd, x, y) -struct monst *grd; -int x, y; +in_fcorridor(struct monst *grd, int x, int y) { register int fci; struct egd *egrd = EGD(grd); @@ -205,7 +195,7 @@ int x, y; } struct monst * -findgd() +findgd(void) { register struct monst *mtmp; @@ -219,15 +209,14 @@ findgd() } void -vault_summon_gd() +vault_summon_gd(void) { if (vault_occupied(u.urooms) && !findgd()) u.uinvault = (VAULT_GUARD_TIME - 1); } char -vault_occupied(array) -char *array; +vault_occupied(char *array) { register char *ptr; @@ -239,8 +228,7 @@ char *array; /* hero has teleported out of vault while a guard is active */ void -uleftvault(grd) -struct monst *grd; +uleftvault(struct monst *grd) { /* only called if caller has checked vault_occupied() and findgd() */ if (!grd || !grd->isgd || DEADMONSTER(grd)) { @@ -265,9 +253,7 @@ struct monst *grd; } static boolean -find_guard_dest(guard, rx, ry) -struct monst *guard; -xchar *rx, *ry; +find_guard_dest(struct monst *guard, xchar *rx, xchar *ry) { register int x, y, dd, lx = 0, ly = 0; @@ -303,7 +289,7 @@ xchar *rx, *ry; } void -invault() +invault(void) { struct monst *guard; boolean gsensed; @@ -549,9 +535,7 @@ invault() } static void -move_gold(gold, vroom) -struct obj *gold; -int vroom; +move_gold(struct obj *gold, int vroom) { xchar nx, ny; @@ -565,8 +549,7 @@ int vroom; } static void -wallify_vault(grd) -struct monst *grd; +wallify_vault(struct monst *grd) { int x, y, typ; int vlt = EGD(grd)->vroom; @@ -633,9 +616,7 @@ struct monst *grd; } static void -gd_mv_monaway(grd, nx, ny) -register struct monst *grd; -int nx, ny; +gd_mv_monaway(struct monst *grd, int nx, int ny) { if (MON_AT(nx, ny) && !(nx == grd->mx && ny == grd->my)) { if (!Deaf) @@ -648,9 +629,7 @@ int nx, ny; /* have guard pick gold off the floor, possibly moving to the gold's position before message and back to his current spot after */ static void -gd_pick_corridor_gold(grd, goldx, goldy) -struct monst *grd; -int goldx, goldy; /* ox, gold->oy> */ +gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy) { struct obj *gold; coord newcc, bestcc; @@ -740,8 +719,7 @@ int goldx, goldy; /* ox, gold->oy> */ * return 1: guard moved, 0: guard didn't, -1: let m_move do it, -2: died */ int -gd_move(grd) -register struct monst *grd; +gd_move(struct monst *grd) { int x, y, nx, ny, m, n; int dx, dy, gx = 0, gy = 0, fci; @@ -1063,8 +1041,7 @@ register struct monst *grd; /* Routine when dying or quitting with a vault guard around */ void -paygd(silently) -boolean silently; +paygd(boolean silently) { register struct monst *grd = findgd(); long umoney = money_cnt(g.invent); @@ -1108,10 +1085,15 @@ boolean silently; return; } -/* amount of gold in carried containers */ +/* + * amount of gold in carried containers + * + * even_if_unknown: + * True: all gold + * False: limit to known contents + */ long -hidden_gold(even_if_unknown) -boolean even_if_unknown; /* True: all gold; False: limit to known contents */ +hidden_gold(boolean even_if_unknown) { long value = 0L; struct obj *obj; @@ -1126,7 +1108,7 @@ boolean even_if_unknown; /* True: all gold; False: limit to known contents */ /* prevent "You hear footsteps.." when inappropriate */ boolean -gd_sound() +gd_sound(void) { struct monst *grd = findgd(); @@ -1137,8 +1119,7 @@ gd_sound() } void -vault_gd_watching(activity) -unsigned int activity; +vault_gd_watching(unsigned int activity) { struct monst *guard = findgd(); diff --git a/src/version.c b/src/version.c index ba6523c97..0b197d4af 100644 --- a/src/version.c +++ b/src/version.c @@ -51,20 +51,18 @@ const char *NetHack_git_branch ; #endif -static void FDECL(insert_rtoption, (char *)); +static void insert_rtoption(char *); /* fill buffer with short version (so caller can avoid including date.h) */ char * -version_string(buf) -char *buf; +version_string(char *buf) { return strcpy(buf, VERSION_STRING); } /* fill and return the given buffer with the long nethack version string */ char * -getversionstring(buf) -char *buf; +getversionstring(char *buf) { Strcpy(buf, VERSION_ID); @@ -111,7 +109,7 @@ char *buf; /* the 'v' command */ int -doversion() +doversion(void) { char buf[BUFSZ]; @@ -121,7 +119,7 @@ doversion() /* the '#version' command; also a choice for '?' */ int -doextversion() +doextversion(void) { int rtcontext = 0; const char *rtbuf; @@ -248,8 +246,7 @@ doextversion() } void -early_version_info(pastebuf) -boolean pastebuf; +early_version_info(boolean pastebuf) { char buf1[BUFSZ], buf2[BUFSZ]; char *buf, *tmp; @@ -308,8 +305,7 @@ static struct rt_opt { * game image, so we insert those options here. */ static void -insert_rtoption(buf) -char *buf; +insert_rtoption(char *buf) { int i; @@ -327,8 +323,7 @@ char *buf; #ifdef MICRO boolean -comp_times(filetime) -long filetime; +comp_times(long filetime) { /* BUILD_TIME is constant but might have L suffix rather than UL; 'filetime' is historically signed but ought to have been unsigned */ @@ -337,11 +332,8 @@ long filetime; #endif boolean -check_version(version_data, filename, complain, utdflags) -struct version_info *version_data; -const char *filename; -boolean complain; -unsigned long utdflags; +check_version(struct version_info *version_data, const char *filename, + boolean complain, unsigned long utdflags) { if ( #ifdef VERSION_COMPATIBILITY @@ -377,10 +369,7 @@ unsigned long utdflags; /* this used to be based on file date and somewhat OS-dependant, but now examines the initial part of the file's contents */ boolean -uptodate(nhfp, name, utdflags) -NHFILE *nhfp; -const char *name; -unsigned long utdflags; +uptodate(NHFILE *nhfp, const char *name, unsigned long utdflags) { int rlen = 0, cmc = 0, filecmc = 0; struct version_info vers_info; @@ -415,8 +404,7 @@ unsigned long utdflags; } void -store_formatindicator(nhfp) -NHFILE *nhfp; +store_formatindicator(NHFILE *nhfp) { char indicate = 'u'; int cmc = 0; @@ -431,8 +419,7 @@ NHFILE *nhfp; } void -store_version(nhfp) -NHFILE *nhfp; +store_version(NHFILE *nhfp) { #if !defined(CROSSCOMPILE) || !defined(CROSSCOMPILE_TARGET) static const struct version_info version_data = { @@ -467,8 +454,7 @@ const char amiga_version_string[] = AMIGA_VERSION_STRING; #endif unsigned long -get_feature_notice_ver(str) -char *str; +get_feature_notice_ver(char *str) { char buf[BUFSZ]; int ver_maj, ver_min, patch; @@ -501,15 +487,14 @@ char *str; } unsigned long -get_current_feature_ver() +get_current_feature_ver(void) { return FEATURE_NOTICE_VER(VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL); } /*ARGUSED*/ const char * -copyright_banner_line(indx) -int indx; +copyright_banner_line(int indx) { #ifdef COPYRIGHT_BANNER_A if (indx == 1) diff --git a/src/vision.c b/src/vision.c index 9d291ae40..a41072e87 100644 --- a/src/vision.c +++ b/src/vision.c @@ -86,14 +86,14 @@ static xchar left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */ static xchar right_ptrs[ROWNO][COLNO]; /* Forward declarations. */ -static void FDECL(fill_point, (int, int)); -static void FDECL(dig_point, (int, int)); -static void NDECL(view_init); -static void FDECL(view_from, (int, int, xchar **, xchar *, xchar *, int, - void (*)(int, int, genericptr_t), - genericptr_t)); -static void FDECL(get_unused_cs, (xchar ***, xchar **, xchar **)); -static void FDECL(rogue_vision, (xchar **, xchar *, xchar *)); +static void fill_point(int, int); +static void dig_point(int, int); +static void view_init(void); +static void view_from(int, int, xchar **, xchar *, xchar *, int, + void (*)(int, int, genericptr_t), + genericptr_t); +static void get_unused_cs(xchar ***, xchar **, xchar **); +static void rogue_vision(xchar **, xchar *, xchar *); /* Macro definitions that I can't find anywhere. */ #define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0)) @@ -108,7 +108,7 @@ static void FDECL(rogue_vision, (xchar **, xchar *, xchar *)); * or before a game restore. Else we die a horrible death. */ void -vision_init() +vision_init(void) { int i; @@ -138,9 +138,7 @@ vision_init() * sight. */ int -does_block(x, y, lev) -int x, y; -register struct rm *lev; +does_block(int x, int y, struct rm *lev) { struct obj *obj; struct monst *mon; @@ -175,7 +173,7 @@ register struct rm *lev; * level and the level monsters and objects are in place. */ void -vision_reset() +vision_reset(void) { int y; register int x, i, dig_left, block; @@ -238,9 +236,7 @@ vision_reset() * to the unused vision work area. */ static void -get_unused_cs(rows, rmin, rmax) -xchar ***rows; -xchar **rmin, **rmax; +get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax) { register int row; register xchar *nrmin, *nrmax; @@ -279,9 +275,7 @@ xchar **rmin, **rmax; * due to the one-sided lit wall hack. */ static void -rogue_vision(next, rmin, rmax) -xchar **next; /* could_see array pointers */ -xchar *rmin, *rmax; +rogue_vision(xchar **next, xchar *rmin, xchar *rmax) { int rnum = levl[u.ux][u.uy].roomno - ROOMOFFSET; /* no SHARED... */ int start, stop, in_door, xhi, xlo, yhi, ylo; @@ -337,7 +331,7 @@ xchar *rmin, *rmax; #ifdef EXTEND_SPINE -static int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); +static int new_angle(struct rm *, unsigned char *, int, int); /* * new_angle() * @@ -381,10 +375,7 @@ static int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); * checks. - Dean 2/11/93 */ static int -new_angle(lev, sv, row, col) -struct rm *lev; -unsigned char *sv; -int row, col; +new_angle(struct rm *lev, unsigned char *sv, int row, int col) { register int res = *sv; @@ -482,8 +473,7 @@ int row, col; * + Just before bubbles are moved. [movebubbles()] */ void -vision_recalc(control) -int control; +vision_recalc(int control) { extern unsigned char seenv_matrix[3][3]; /* from display.c */ static unsigned char colbump[COLNO + 1]; /* cols to bump sv */ @@ -530,7 +520,7 @@ int control; * + Monsters can see you even when you're in a pit. */ view_from(u.uy, u.ux, next_array, next_rmin, next_rmax, 0, - (void FDECL((*), (int, int, genericptr_t))) 0, + (void (*)(int, int, genericptr_t)) 0, (genericptr_t) 0); /* @@ -596,7 +586,7 @@ int control; } } else view_from(u.uy, u.ux, next_array, next_rmin, next_rmax, 0, - (void FDECL((*), (int, int, genericptr_t))) 0, + (void (*)(int, int, genericptr_t)) 0, (genericptr_t) 0); /* @@ -826,8 +816,7 @@ skip: * Make the location opaque to light. */ void -block_point(x, y) -int x, y; +block_point(int x, int y) { fill_point(y, x); @@ -850,8 +839,7 @@ int x, y; * Make the location transparent to light. */ void -unblock_point(x, y) -int x, y; +unblock_point(int x, int y) { dig_point(y, x); @@ -909,8 +897,7 @@ int x, y; * spot on its right) will point to itself. */ static void -dig_point(row, col) -int row, col; +dig_point(int row, int col) { int i; @@ -994,8 +981,7 @@ int row, col; } static void -fill_point(row, col) -int row, col; +fill_point(int row, int col) { int i; @@ -1087,7 +1073,7 @@ static xchar **cs_rows; static xchar *cs_left; static xchar *cs_right; -static void FDECL((*vis_func), (int, int, genericptr_t)); +static void (*vis_func)(int, int, genericptr_t); static genericptr_t varg; /* @@ -1336,10 +1322,10 @@ static genericptr_t varg; #else /* !MACRO_CPATH -- quadrants are really functions */ -static int FDECL(_q1_path, (int, int, int, int)); -static int FDECL(_q2_path, (int, int, int, int)); -static int FDECL(_q3_path, (int, int, int, int)); -static int FDECL(_q4_path, (int, int, int, int)); +static int _q1_path(int, int, int, int); +static int _q2_path(int, int, int, int); +static int _q3_path(int, int, int, int); +static int _q4_path(int, int, int, int); #define q1_path(sy, sx, y, x, dummy) result = _q1_path(sy, sx, y, x) #define q2_path(sy, sx, y, x, dummy) result = _q2_path(sy, sx, y, x) @@ -1350,8 +1336,7 @@ static int FDECL(_q4_path, (int, int, int, int)); * Quadrant I (step < 0). */ static int -_q1_path(srow, scol, y2, x2) -int scol, srow, y2, x2; +_q1_path(int scol, int srow, int y2, int x2) { int dx, dy; register int k, err, x, y, dxs, dys; @@ -1398,8 +1383,7 @@ int scol, srow, y2, x2; * Quadrant IV (step > 0). */ static int -_q4_path(srow, scol, y2, x2) -int scol, srow, y2, x2; +_q4_path(int scol, int srow, int y2, int x2) { int dx, dy; register int k, err, x, y, dxs, dys; @@ -1446,8 +1430,7 @@ int scol, srow, y2, x2; * Quadrant II (step < 0). */ static int -_q2_path(srow, scol, y2, x2) -int scol, srow, y2, x2; +_q2_path(int scol, int srow, int y2, int x2) { int dx, dy; register int k, err, x, y, dxs, dys; @@ -1494,8 +1477,7 @@ int scol, srow, y2, x2; * Quadrant III (step > 0). */ static int -_q3_path(srow, scol, y2, x2) -int scol, srow, y2, x2; +_q3_path(int scol, int srow, int y2, int x2) { int dx, dy; register int k, err, x, y, dxs, dys; @@ -1548,8 +1530,7 @@ int scol, srow, y2, x2; * do_light_sources() */ boolean -clear_path(col1, row1, col2, row2) -int col1, row1, col2, row2; +clear_path(int col1, int row1, int col2, int row2) { int result; @@ -1582,25 +1563,27 @@ cleardone: /* * Defines local to Algorithm C. */ -static void FDECL(right_side, (int, int, int, const xchar *)); -static void FDECL(left_side, (int, int, int, const xchar *)); +static void right_side(int, int, int, const xchar *); +static void left_side(int, int, int, const xchar *); /* Initialize algorithm C (nothing). */ static void -view_init() +view_init(void) { } /* * Mark positions as visible on one quadrant of the right side. The * quadrant is determined by the value of the global variable step. + * + * Arguments: + * row current row + * left first (left side) visible spot on prev row + * right_mark last (right side) visible spot on prev row + * limits points at range limit for current row, or NULL */ static void -right_side(row, left, right_mark, limits) -int row; /* current row */ -int left; /* first (left side) visible spot on prev row */ -int right_mark; /* last (right side) visible spot on prev row */ -const xchar *limits; /* points at range limit for current row, or NULL */ +right_side(int row, int left, int right_mark, const xchar *limits) { int right; /* right limit of "could see" */ int right_edge; /* right edge of an opening */ @@ -1788,9 +1771,7 @@ const xchar *limits; /* points at range limit for current row, or NULL */ * extensive comments. */ static void -left_side(row, left_mark, right, limits) -int row, left_mark, right; -const xchar *limits; +left_side(int row, int left_mark, int right, const xchar *limits) { int left, left_edge, nrow, deeper, result; register int i; @@ -1922,16 +1903,20 @@ const xchar *limits; * Calculate all possible visible locations from the given location * (srow,scol). NOTE this is (y,x)! Mark the visible locations in the * array provided. + * + * Arguments + * srow, scol starting row and column + * loc_cs_rows pointers to the rows of the could_see array + * left_most min mark on each row + * right_most max mark on each row + * range 0 if unlimited + * func function to call on each spot + * arg argument for func */ static void -view_from(srow, scol, loc_cs_rows, left_most, right_most, range, func, arg) -int srow, scol; /* starting row and column */ -xchar **loc_cs_rows; /* pointers to the rows of the could_see array */ -xchar *left_most; /* min mark on each row */ -xchar *right_most; /* max mark on each row */ -int range; /* 0 if unlimited */ -void FDECL((*func), (int, int, genericptr_t)); -genericptr_t arg; +view_from(int srow, int scol, xchar **loc_cs_rows, + xchar *left_most, xchar *right_most, int range, + void (*func)(int, int, genericptr_t), genericptr_t arg) { register int i; /* loop counter */ xchar *rowp; /* optimization for setting could_see */ @@ -2030,10 +2015,8 @@ genericptr_t arg; * vision matrix and reduce extra work. */ void -do_clear_area(scol, srow, range, func, arg) -int scol, srow, range; -void FDECL((*func), (int, int, genericptr_t)); -genericptr_t arg; +do_clear_area(int scol, int srow, int range, + void (*func)(int, int, genericptr_t), genericptr_t arg) { /* If not centered on hero, do the hard work of figuring the area */ if (scol != u.ux || srow != u.uy) { @@ -2074,8 +2057,7 @@ genericptr_t arg; /* bitmask indicating ways mon is seen; extracted from lookat(pager.c) */ unsigned -howmonseen(mon) -struct monst *mon; +howmonseen(struct monst *mon) { boolean useemon = (boolean) canseemon(mon); int xraydist = (u.xray_range < 0) ? -1 : (u.xray_range * u.xray_range); diff --git a/src/weapon.c b/src/weapon.c index 0bb0b95f1..62539aafa 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -10,12 +10,12 @@ */ #include "hack.h" -static void FDECL(give_may_advance_msg, (int)); -static void FDECL(finish_towel_change, (struct obj *obj, int)); -static boolean FDECL(could_advance, (int)); -static boolean FDECL(peaked_skill, (int)); -static int FDECL(slots_required, (int)); -static void FDECL(skill_advance, (int)); +static void give_may_advance_msg(int); +static void finish_towel_change(struct obj *obj, int); +static boolean could_advance(int); +static boolean peaked_skill(int); +static int slots_required(int); +static void skill_advance(int); /* Categories whose names don't come from OBJ_NAME(objects[type]) */ @@ -67,8 +67,7 @@ static NEARDATA const char kebabable[] = { S_XORN, S_DRAGON, S_JABBERWOCK, S_NAGA, S_GIANT, '\0' }; static void -give_may_advance_msg(skill) -int skill; +give_may_advance_msg(int skill) { You_feel("more confident in your %sskills.", (skill == P_NONE) ? "" @@ -86,8 +85,7 @@ int skill; mostly used to shorten "you drop your " messages when slippery fingers or polymorph causes hero to involuntarily drop wielded weapon(s) */ const char * -weapon_descr(obj) -struct obj *obj; +weapon_descr(struct obj *obj) { int skill = weapon_type(obj); const char *descr = P_NAME(skill); @@ -146,9 +144,7 @@ struct obj *obj; * of "otmp" against the monster. */ int -hitval(otmp, mon) -struct obj *otmp; -struct monst *mon; +hitval(struct obj *otmp, struct monst *mon) { int tmp = 0; struct permonst *ptr = mon->data; @@ -216,9 +212,7 @@ struct monst *mon; * of "otmp" against the monster. */ int -dmgval(otmp, mon) -struct obj *otmp; -struct monst *mon; +dmgval(struct obj *otmp, struct monst *mon) { int tmp = 0, otyp = otmp->otyp; struct permonst *ptr = mon->data; @@ -363,11 +357,12 @@ struct monst *mon; /* check whether blessed and/or silver damage applies for *non-weapon* hit; return value is the amount of the extra damage */ int -special_dmgval(magr, mdef, armask, silverhit_p) -struct monst *magr, *mdef; -long armask; /* armor mask, multiple bits accepted for W_ARMC|W_ARM|W_ARMU - * or W_ARMG|W_RINGL|W_RINGR only */ -long *silverhit_p; /* output flag mask for silver bonus */ +special_dmgval(struct monst *magr, + struct monst *mdef, + long armask, /* armor mask, multiple bits accepted for + W_ARMC|W_ARM|W_ARMU or + W_ARMG|W_RINGL|W_RINGR only */ + long *silverhit_p) /* output flag mask for silver bonus */ { struct obj *obj; struct permonst *ptr = mdef->data; @@ -438,10 +433,8 @@ long *silverhit_p; /* output flag mask for silver bonus */ /* give a "silver sears " message; not used for weapon hit, so we only handle rings */ void -silver_sears(magr, mdef, silverhit) -struct monst *magr UNUSED; -struct monst *mdef; -long silverhit; +silver_sears(struct monst *magr UNUSED, struct monst *mdef, + long silverhit) { char rings[20]; /* plenty of room for "rings" */ int ltyp = ((uleft && (silverhit & W_RINGL) != 0L) @@ -471,15 +464,13 @@ long silverhit; } } -static struct obj *FDECL(oselect, (struct monst *, int)); +static struct obj *oselect(struct monst *, int); #define Oselect(x) \ if ((otmp = oselect(mtmp, x)) != 0) \ return otmp; static struct obj * -oselect(mtmp, x) -struct monst *mtmp; -int x; +oselect(struct monst *mtmp, int x) { struct obj *otmp; @@ -511,8 +502,7 @@ static NEARDATA const int pwep[] = { HALBERD, BARDICHE, SPETUM, /* select a ranged weapon for the monster */ struct obj * -select_rwep(mtmp) -register struct monst *mtmp; +select_rwep(struct monst *mtmp) { register struct obj *otmp; struct obj *mwep; @@ -632,8 +622,7 @@ register struct monst *mtmp; /* is 'obj' a type of weapon that any monster knows how to throw? */ boolean -monmightthrowwep(obj) -struct obj *obj; +monmightthrowwep(struct obj *obj) { short idx; @@ -658,8 +647,7 @@ static const NEARDATA short hwep[] = { /* select a hand to hand weapon for the monster */ struct obj * -select_hwep(mtmp) -register struct monst *mtmp; +select_hwep(struct monst *mtmp) { register struct obj *otmp; register int i; @@ -699,9 +687,7 @@ register struct monst *mtmp; * otherwise never unwield stuff on their own. Might print message. */ void -possibly_unwield(mon, polyspot) -struct monst *mon; -boolean polyspot; +possibly_unwield(struct monst *mon, boolean polyspot) { struct obj *obj, *mw_tmp; @@ -754,8 +740,7 @@ boolean polyspot; * Returns 1 if the monster took time to do it, 0 if it did not. */ int -mon_wield_item(mon) -register struct monst *mon; +mon_wield_item(struct monst *mon) { struct obj *obj; @@ -879,8 +864,7 @@ register struct monst *mon; /* force monster to stop wielding current weapon, if any */ void -mwepgone(mon) -struct monst *mon; +mwepgone(struct monst *mon) { struct obj *mwep = MON_WEP(mon); @@ -892,7 +876,7 @@ struct monst *mon; /* attack bonus for strength & dexterity */ int -abon() +abon(void) { int sbon; int str = ACURR(A_STR), dex = ACURR(A_DEX); @@ -930,7 +914,7 @@ abon() /* damage bonus for strength */ int -dbon() +dbon(void) { int str = ACURR(A_STR); @@ -957,9 +941,7 @@ dbon() /* called when wet_a_towel() or dry_a_towel() is changing a towel's wetness */ static void -finish_towel_change(obj, newspe) -struct obj *obj; -int newspe; +finish_towel_change(struct obj *obj, int newspe) { /* towel wetness is always between 0 (dry) and 7, inclusive */ newspe = min(newspe, 7); @@ -977,10 +959,10 @@ int newspe; /* increase a towel's wetness */ void -wet_a_towel(obj, amt, verbose) -struct obj *obj; -int amt; /* positive: new value; negative: increment by -amt; zero: no-op */ -boolean verbose; +wet_a_towel(struct obj *obj, + int amt, /* positive: new value; negative: increment by -amt; + zero: no-op */ + boolean verbose) { int newspe = (amt <= 0) ? obj->spe - amt : amt; @@ -1006,10 +988,10 @@ boolean verbose; /* decrease a towel's wetness; unlike when wetting, 0 is not a no-op */ void -dry_a_towel(obj, amt, verbose) -struct obj *obj; -int amt; /* positive or zero: new value; negative: decrement by abs(amt) */ -boolean verbose; +dry_a_towel(struct obj *obj, + int amt, /* positive or zero: new value; + negative: decrement by abs(amt) */ + boolean verbose) { int newspe = (amt < 0) ? obj->spe + amt : amt; @@ -1031,9 +1013,7 @@ boolean verbose; /* copy the skill level name into the given buffer */ char * -skill_level_name(skill, buf) -int skill; -char *buf; +skill_level_name(int skill, char *buf) { const char *ptr; @@ -1066,16 +1046,14 @@ char *buf; } const char * -skill_name(skill) -int skill; +skill_name(int skill) { return P_NAME(skill); } /* return the # of slots required to advance the skill */ static int -slots_required(skill) -int skill; +slots_required(int skill) { int tmp = P_SKILL(skill); @@ -1099,9 +1077,7 @@ int skill; /* return true if this skill can be advanced */ boolean -can_advance(skill, speedy) -int skill; -boolean speedy; +can_advance(int skill, boolean speedy) { if (P_RESTRICTED(skill) || P_SKILL(skill) >= P_MAX_SKILL(skill) @@ -1118,8 +1094,7 @@ boolean speedy; /* return true if this skill could be advanced if more slots were available */ static boolean -could_advance(skill) -int skill; +could_advance(int skill) { if (P_RESTRICTED(skill) || P_SKILL(skill) >= P_MAX_SKILL(skill) @@ -1133,8 +1108,7 @@ int skill; /* return true if this skill has reached its maximum and there's been enough practice to become eligible for the next step if that had been possible */ static boolean -peaked_skill(skill) -int skill; +peaked_skill(int skill) { if (P_RESTRICTED(skill)) return FALSE; @@ -1145,8 +1119,7 @@ int skill; } static void -skill_advance(skill) -int skill; +skill_advance(int skill) { u.weapon_slots -= slots_required(skill); P_SKILL(skill)++; @@ -1175,7 +1148,7 @@ static const struct skill_range { * others unselectable. */ int -enhance_weapon_skill() +enhance_weapon_skill(void) { int pass, i, n, len, longest, to_advance, eventually_advance, maxxed_cnt; char buf[BUFSZ], sklnambuf[BUFSZ]; @@ -1322,8 +1295,7 @@ enhance_weapon_skill() * function may be called with with P_NONE. Used in pray.c as well as below. */ void -unrestrict_weapon_skill(skill) -int skill; +unrestrict_weapon_skill(int skill) { if (skill < P_NUM_SKILLS && P_RESTRICTED(skill)) { P_SKILL(skill) = P_UNSKILLED; @@ -1333,9 +1305,7 @@ int skill; } void -use_skill(skill, degree) -int skill; -int degree; +use_skill(int skill, int degree) { boolean advance_before; @@ -1348,8 +1318,7 @@ int degree; } void -add_weapon_skill(n) -int n; /* number of slots to gain; normally one */ +add_weapon_skill(int n) /* number of slots to gain; normally one */ { int i, before, after; @@ -1365,8 +1334,7 @@ int n; /* number of slots to gain; normally one */ } void -lose_weapon_skill(n) -int n; /* number of slots to lose; normally one */ +lose_weapon_skill(int n) /* number of slots to lose; normally one */ { int skill; @@ -1389,8 +1357,7 @@ int n; /* number of slots to lose; normally one */ } void -drain_weapon_skill(n) -int n; /* number of skills to drain */ +drain_weapon_skill(int n) /* number of skills to drain */ { int skill; int i; @@ -1427,8 +1394,7 @@ int n; /* number of skills to drain */ } int -weapon_type(obj) -struct obj *obj; +weapon_type(struct obj *obj) { /* KMH -- now uses the object table */ int type; @@ -1443,7 +1409,7 @@ struct obj *obj; } int -uwep_skill_type() +uwep_skill_type(void) { if (u.twoweap) return P_TWO_WEAPON_COMBAT; @@ -1455,8 +1421,7 @@ uwep_skill_type() * Treat restricted weapons as unskilled. */ int -weapon_hit_bonus(weapon) -struct obj *weapon; +weapon_hit_bonus(struct obj *weapon) { int type, wep_type, skill, bonus = 0; static const char bad_skill[] = "weapon_hit_bonus: bad skill %d"; @@ -1550,8 +1515,7 @@ struct obj *weapon; * Treat restricted weapons as unskilled. */ int -weapon_dam_bonus(weapon) -struct obj *weapon; +weapon_dam_bonus(struct obj *weapon) { int type, wep_type, skill, bonus = 0; @@ -1644,8 +1608,7 @@ struct obj *weapon; * maximums. */ void -skill_init(class_skill) -const struct def_skill *class_skill; +skill_init(const struct def_skill *class_skill) { struct obj *obj; int skmax, skill; @@ -1718,9 +1681,7 @@ const struct def_skill *class_skill; } void -setmnotwielded(mon, obj) -register struct monst *mon; -register struct obj *obj; +setmnotwielded(struct monst *mon, struct obj *obj) { if (!obj) return; diff --git a/src/were.c b/src/were.c index e0e208151..3969deded 100644 --- a/src/were.c +++ b/src/were.c @@ -6,8 +6,7 @@ #include "hack.h" void -were_change(mon) -register struct monst *mon; +were_change(struct monst *mon) { if (!is_were(mon->data)) return; @@ -43,8 +42,7 @@ register struct monst *mon; } int -counter_were(pm) -int pm; +counter_were(int pm) { switch (pm) { case PM_WEREWOLF: @@ -66,8 +64,7 @@ int pm; /* convert monsters similar to werecritters into appropriate werebeast */ int -were_beastie(pm) -int pm; +were_beastie(int pm) { switch (pm) { case PM_WERERAT: @@ -92,8 +89,7 @@ int pm; } void -new_were(mon) -register struct monst *mon; +new_were(struct monst *mon) { register int pm; @@ -125,11 +121,10 @@ register struct monst *mon; /* were-creature (even you) summons a horde */ int -were_summon(ptr, yours, visible, genbuf) -struct permonst *ptr; -boolean yours; -int *visible; /* number of visible helpers created */ -char *genbuf; +were_summon(struct permonst *ptr, + boolean yours, + int *visible, /* number of visible helpers created */ + char *genbuf) { int i, typ, pm = monsndx(ptr); struct monst *mtmp; @@ -175,7 +170,7 @@ char *genbuf; } void -you_were() +you_were(void) { char qbuf[QBUFSZ]; boolean controllable_poly = Polymorph_control && !(Stunned || Unaware); @@ -193,8 +188,7 @@ you_were() } void -you_unwere(purify) -boolean purify; +you_unwere(boolean purify) { boolean controllable_poly = Polymorph_control && !(Stunned || Unaware); @@ -212,8 +206,7 @@ boolean purify; /* lycanthropy is being caught or cured, but no shape change is involved */ void -set_ulycn(which) -int which; +set_ulycn(int which) { u.ulycn = which; /* add or remove lycanthrope's innate intrinsics (Drain_resistance) */ diff --git a/src/wield.c b/src/wield.c index a296975ba..c907564e9 100644 --- a/src/wield.c +++ b/src/wield.c @@ -52,10 +52,10 @@ * No item may be in more than one of these slots. */ -static boolean FDECL(cant_wield_corpse, (struct obj *)); -static int FDECL(ready_weapon, (struct obj *)); -static int FDECL(ready_ok, (struct obj *)); -static int FDECL(wield_ok, (struct obj *)); +static boolean cant_wield_corpse(struct obj *); +static int ready_weapon(struct obj *); +static int ready_ok(struct obj *); +static int wield_ok(struct obj *); /* used by will_weld() */ /* probably should be renamed */ @@ -96,8 +96,7 @@ static const char * to print the appropriate messages. */ void -setuwep(obj) -register struct obj *obj; +setuwep(struct obj *obj) { struct obj *olduwep = uwep; @@ -130,8 +129,7 @@ register struct obj *obj; } static boolean -cant_wield_corpse(obj) -struct obj *obj; +cant_wield_corpse(struct obj *obj) { char kbuf[BUFSZ]; @@ -149,8 +147,7 @@ struct obj *obj; } static int -ready_weapon(wep) -struct obj *wep; +ready_weapon(struct obj *wep) { /* Separated function so swapping works easily */ int res = 0; @@ -252,8 +249,7 @@ struct obj *wep; } void -setuqwep(obj) -register struct obj *obj; +setuqwep(struct obj *obj) { setworn(obj, W_QUIVER); /* no extra handling needed; this used to include a call to @@ -262,8 +258,7 @@ register struct obj *obj; } void -setuswapwep(obj) -register struct obj *obj; +setuswapwep(struct obj *obj) { setworn(obj, W_SWAPWEP); return; @@ -271,8 +266,7 @@ register struct obj *obj; /* getobj callback for object to ready for throwing/shooting */ static int -ready_ok(obj) -struct obj *obj; +ready_ok(struct obj *obj) { if (!obj) return GETOBJ_SUGGEST; @@ -299,8 +293,7 @@ struct obj *obj; /* getobj callback for object to wield */ static int -wield_ok(obj) -struct obj *obj; +wield_ok(struct obj *obj) { if (!obj) return GETOBJ_SUGGEST; @@ -316,7 +309,7 @@ struct obj *obj; } int -dowield() +dowield(void) { char qbuf[QBUFSZ]; struct obj *wep, *oldwep; @@ -426,7 +419,7 @@ dowield() } int -doswapweapon() +doswapweapon(void) { register struct obj *oldwep, *oldswap; int result = 0; @@ -469,7 +462,7 @@ doswapweapon() } int -dowieldquiver() +dowieldquiver(void) { char qbuf[QBUFSZ]; struct obj *newquiver; @@ -628,9 +621,8 @@ dowieldquiver() /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */ boolean -wield_tool(obj, verb) -struct obj *obj; -const char *verb; /* "rub",&c */ +wield_tool(struct obj *obj, + const char *verb) /* "rub",&c */ { const char *what; boolean more_than_1; @@ -707,7 +699,7 @@ const char *verb; /* "rub",&c */ } int -can_twoweapon() +can_twoweapon(void) { struct obj *otmp; @@ -753,7 +745,7 @@ can_twoweapon() } void -drop_uswapwep() +drop_uswapwep(void) { char str[BUFSZ]; struct obj *obj = uswapwep; @@ -765,14 +757,13 @@ drop_uswapwep() } void -set_twoweap(on_off) -boolean on_off; +set_twoweap(boolean on_off) { u.twoweap = on_off; } int -dotwoweapon() +dotwoweapon(void) { /* You can always toggle it off */ if (u.twoweap) { @@ -800,7 +791,7 @@ dotwoweapon() * 2. Making an item disappear for a bones pile. */ void -uwepgone() +uwepgone(void) { if (uwep) { if (artifact_light(uwep) && uwep->lamplit) { @@ -815,7 +806,7 @@ uwepgone() } void -uswapwepgone() +uswapwepgone(void) { if (uswapwep) { setworn((struct obj *) 0, W_SWAPWEP); @@ -824,7 +815,7 @@ uswapwepgone() } void -uqwepgone() +uqwepgone(void) { if (uquiver) { setworn((struct obj *) 0, W_QUIVER); @@ -833,7 +824,7 @@ uqwepgone() } void -untwoweapon() +untwoweapon(void) { if (u.twoweap) { You("%s.", can_no_longer_twoweap); @@ -844,9 +835,7 @@ untwoweapon() } int -chwepon(otmp, amount) -register struct obj *otmp; -register int amount; +chwepon(struct obj *otmp, int amount) { const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE); const char *xtime, *wepname = ""; @@ -979,8 +968,7 @@ register int amount; } int -welded(obj) -register struct obj *obj; +welded(struct obj *obj) { if (obj && obj == uwep && will_weld(obj)) { set_bknown(obj, 1); @@ -990,8 +978,7 @@ register struct obj *obj; } void -weldmsg(obj) -register struct obj *obj; +weldmsg(struct obj *obj) { long savewornmask; @@ -1004,8 +991,7 @@ register struct obj *obj; /* test whether monster's wielded weapon is stuck to hand/paw/whatever */ boolean -mwelded(obj) -struct obj *obj; +mwelded(struct obj *obj) { /* caller is responsible for making sure this is a monster's item */ if (obj && (obj->owornmask & W_WEP) && will_weld(obj)) diff --git a/src/windows.c b/src/windows.c index 38f175a9e..8ee5e15b2 100644 --- a/src/windows.c +++ b/src/windows.c @@ -13,7 +13,7 @@ extern struct window_procs curses_procs; /* Cannot just blindly include winX.h without including all of X11 stuff and must get the order of include files right. Don't bother. */ extern struct window_procs X11_procs; -extern void FDECL(win_X11_init, (int)); +extern void win_X11_init(int); #endif #ifdef QT_GRAPHICS extern struct window_procs Qt_procs; @@ -26,13 +26,13 @@ extern struct window_procs mac_procs; #endif #ifdef BEOS_GRAPHICS extern struct window_procs beos_procs; -extern void FDECL(be_win_init, (int)); +extern void be_win_init(int); FAIL /* be_win_init doesn't exist? XXX*/ #endif #ifdef AMIGA_INTUITION extern struct window_procs amii_procs; extern struct window_procs amiv_procs; -extern void FDECL(ami_wininit_data, (int)); +extern void ami_wininit_data(int); #endif #ifdef WIN32_GRAPHICS extern struct window_procs win32_procs; @@ -49,32 +49,32 @@ extern struct window_procs shim_procs; #endif #ifdef WINCHAIN extern struct window_procs chainin_procs; -extern void FDECL(chainin_procs_init, (int)); -extern void *FDECL(chainin_procs_chain, (int, int, void *, void *, void *)); +extern void chainin_procs_init(int); +extern void *chainin_procs_chain(int, int, void *, void *, void *); extern struct chain_procs chainout_procs; -extern void FDECL(chainout_procs_init, (int)); -extern void *FDECL(chainout_procs_chain, (int, int, void *, void *, void *)); +extern void chainout_procs_init(int); +extern void *chainout_procs_chain(int, int, void *, void *, void *); extern struct chain_procs trace_procs; -extern void FDECL(trace_procs_init, (int)); -extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *)); +extern void trace_procs_init(int); +extern void *trace_procs_chain(int, int, void *, void *, void *); #endif -static void FDECL(def_raw_print, (const char *s)); -static void NDECL(def_wait_synch); +static void def_raw_print(const char *s); +static void def_wait_synch(void); #ifdef DUMPLOG -static winid FDECL(dump_create_nhwindow, (int)); -static void FDECL(dump_clear_nhwindow, (winid)); -static void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P)); -static void FDECL(dump_destroy_nhwindow, (winid)); -static void FDECL(dump_start_menu, (winid, unsigned long)); -static void FDECL(dump_add_menu, (winid, const glyph_info *, const ANY_P *, CHAR_P, - CHAR_P, int, const char *, unsigned int)); -static void FDECL(dump_end_menu, (winid, const char *)); -static int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **)); -static void FDECL(dump_putstr, (winid, int, const char *)); +static winid dump_create_nhwindow(int); +static void dump_clear_nhwindow(winid); +static void dump_display_nhwindow(winid, boolean); +static void dump_destroy_nhwindow(winid); +static void dump_start_menu(winid, unsigned long); +static void dump_add_menu(winid, const glyph_info *, const ANY_P *, char, + char, int, const char *, unsigned int); +static void dump_end_menu(winid, const char *); +static int dump_select_menu(winid, int, MENU_ITEM_P **); +static void dump_putstr(winid, int, const char *); #endif /* DUMPLOG */ #ifdef HANGUPHANDLING @@ -90,9 +90,9 @@ volatile static struct win_choices { struct window_procs *procs; - void FDECL((*ini_routine), (int)); /* optional (can be 0) */ + void (*ini_routine)(int); /* optional (can be 0) */ #ifdef WINCHAIN - void *FDECL((*chain_routine), (int, int, void *, void *, void *)); + void *(*chain_routine)(int, int, void *, void *, void *); #endif } winchoices[] = { #ifdef TTY_GRAPHICS @@ -156,7 +156,7 @@ struct winlink { static struct winlink *chain = 0; static struct winlink * -wl_new() +wl_new(void) { struct winlink *wl = (struct winlink *) alloc(sizeof *wl); @@ -192,28 +192,27 @@ wl_addtail(struct winlink *wl) #endif /* WINCHAIN */ boolean -genl_can_suspend_no(VOID_ARGS) +genl_can_suspend_no(void) { return FALSE; } boolean -genl_can_suspend_yes(VOID_ARGS) +genl_can_suspend_yes(void) { return TRUE; } static void -def_raw_print(s) -const char *s; +def_raw_print(const char *s) { puts(s); } static void -def_wait_synch(VOID_ARGS) +def_wait_synch(void) { /* Config file error handling routines * call wait_sync() without checking to @@ -229,8 +228,7 @@ def_wait_synch(VOID_ARGS) #ifdef WINCHAIN static struct win_choices * -win_choices_find(s) -const char *s; +win_choices_find(const char *s) { register int i; @@ -244,8 +242,7 @@ const char *s; #endif void -choose_windows(s) -const char *s; +choose_windows(const char *s) { int i; char *tmps = 0; @@ -321,8 +318,7 @@ const char *s; #ifdef WINCHAIN void -addto_windowchain(s) -const char *s; +addto_windowchain(const char *s) { register int i; @@ -352,7 +348,7 @@ const char *s; } void -commit_windowchain() +commit_windowchain(void) { struct winlink *p; int n; @@ -431,10 +427,9 @@ commit_windowchain() */ /*ARGSUSED*/ char -genl_message_menu(let, how, mesg) -char let UNUSED; -int how UNUSED; -const char *mesg; +genl_message_menu(char let UNUSED, + int how UNUSED, + const char *mesg) { pline("%s", mesg); return 0; @@ -442,8 +437,7 @@ const char *mesg; /*ARGSUSED*/ void -genl_preference_update(pref) -const char *pref UNUSED; +genl_preference_update(const char *pref UNUSED) { /* window ports are expected to provide their own preference update routine @@ -454,8 +448,7 @@ const char *pref UNUSED; } char * -genl_getmsghistory(init) -boolean init UNUSED; +genl_getmsghistory(boolean init UNUSED) { /* window ports can provide their own getmsghistory() routine to @@ -472,9 +465,7 @@ boolean init UNUSED; } void -genl_putmsghistory(msg, is_restoring) -const char *msg; -boolean is_restoring; +genl_putmsghistory(const char *msg, boolean is_restoring) { /* window ports can provide their own putmsghistory() routine to @@ -508,44 +499,43 @@ boolean is_restoring; * in order to avoid all terminal I/O after hangup/disconnect. */ -static int NDECL(hup_nhgetch); -static char FDECL(hup_yn_function, (const char *, const char *, CHAR_P)); -static int FDECL(hup_nh_poskey, (int *, int *, int *)); -static void FDECL(hup_getlin, (const char *, char *)); -static void FDECL(hup_init_nhwindows, (int *, char **)); -static void FDECL(hup_exit_nhwindows, (const char *)); -static winid FDECL(hup_create_nhwindow, (int)); -static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **)); -static void FDECL(hup_add_menu, (winid, const glyph_info *, const anything *, - CHAR_P, CHAR_P, int, const char *, - unsigned int)); -static void FDECL(hup_end_menu, (winid, const char *)); -static void FDECL(hup_putstr, (winid, int, const char *)); -static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, - const glyph_info *, const glyph_info *)); -static void FDECL(hup_outrip, (winid, int, time_t)); -static void FDECL(hup_curs, (winid, int, int)); -static void FDECL(hup_display_nhwindow, (winid, BOOLEAN_P)); -static void FDECL(hup_display_file, (const char *, BOOLEAN_P)); +static int hup_nhgetch(void); +static char hup_yn_function(const char *, const char *, char); +static int hup_nh_poskey(int *, int *, int *); +static void hup_getlin(const char *, char *); +static void hup_init_nhwindows(int *, char **); +static void hup_exit_nhwindows(const char *); +static winid hup_create_nhwindow(int); +static int hup_select_menu(winid, int, MENU_ITEM_P **); +static void hup_add_menu(winid, const glyph_info *, const anything *, char, + char, int, const char *, unsigned int); +static void hup_end_menu(winid, const char *); +static void hup_putstr(winid, int, const char *); +static void hup_print_glyph(winid, xchar, xchar, const glyph_info *, + const glyph_info *); +static void hup_outrip(winid, int, time_t); +static void hup_curs(winid, int, int); +static void hup_display_nhwindow(winid, boolean); +static void hup_display_file(const char *, boolean); #ifdef CLIPPING -static void FDECL(hup_cliparound, (int, int)); +static void hup_cliparound(int, int); #endif #ifdef CHANGE_COLOR -static void FDECL(hup_change_color, (int, long, int)); +static void hup_change_color(int, long, int); #ifdef MAC -static short FDECL(hup_set_font_name, (winid, char *)); +static short hup_set_font_name(winid, char *); #endif -static char *NDECL(hup_get_color_string); +static char *hup_get_color_string(void); #endif /* CHANGE_COLOR */ -static void FDECL(hup_status_update, (int, genericptr_t, int, int, int, - unsigned long *)); +static void hup_status_update(int, genericptr_t, int, int, int, + unsigned long *); -static int NDECL(hup_int_ndecl); -static void NDECL(hup_void_ndecl); -static void FDECL(hup_void_fdecl_int, (int)); -static void FDECL(hup_void_fdecl_winid, (winid)); -static void FDECL(hup_void_fdecl_winid_ulong, (winid, unsigned long)); -static void FDECL(hup_void_fdecl_constchar_p, (const char *)); +static int hup_int_ndecl(void); +static void hup_void_ndecl(void); +static void hup_void_fdecl_int(int); +static void hup_void_fdecl_winid(winid); +static void hup_void_fdecl_winid_ulong(winid, unsigned long); +static void hup_void_fdecl_constchar_p(const char *); static struct window_procs hup_procs = { "hup", 0L, 0L, @@ -568,7 +558,7 @@ static struct window_procs hup_procs = { hup_cliparound, #endif #ifdef POSITIONBAR - (void FDECL((*), (char *))) hup_void_fdecl_constchar_p, + (void (*)(char *)) hup_void_fdecl_constchar_p, /* update_positionbar */ #endif hup_print_glyph, @@ -597,13 +587,13 @@ static struct window_procs hup_procs = { genl_can_suspend_no, }; -static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0; +static void (*previnterface_exit_nhwindows)(const char *) = 0; /* hangup has occurred; switch to no-op user interface */ void -nhwindows_hangup() +nhwindows_hangup(void) { - char *FDECL((*previnterface_getmsghistory), (BOOLEAN_P)) = 0; + char *(*previnterface_getmsghistory)(boolean) = 0; #ifdef ALTMETA /* command processor shouldn't look for 2nd char after seeing ESC */ @@ -629,8 +619,7 @@ nhwindows_hangup() } static void -hup_exit_nhwindows(lastgasp) -const char *lastgasp; +hup_exit_nhwindows(const char *lastgasp) { /* core has called exit_nhwindows(); call the previous interface's shutdown routine now; xxx_exit_nhwindows() needs to call other @@ -644,16 +633,16 @@ const char *lastgasp; } static int -hup_nhgetch(VOID_ARGS) +hup_nhgetch(void) { return '\033'; /* ESC */ } /*ARGSUSED*/ static char -hup_yn_function(prompt, resp, deflt) -const char *prompt UNUSED, *resp UNUSED; -char deflt; +hup_yn_function(const char *prompt UNUSED, + const char *resp UNUSED, + char deflt) { if (!deflt) deflt = '\033'; @@ -662,125 +651,102 @@ char deflt; /*ARGSUSED*/ static int -hup_nh_poskey(x, y, mod) -int *x UNUSED, *y UNUSED, *mod UNUSED; +hup_nh_poskey(int *x UNUSED, int *y UNUSED, int *mod UNUSED) { return '\033'; } /*ARGSUSED*/ static void -hup_getlin(prompt, outbuf) -const char *prompt UNUSED; -char *outbuf; +hup_getlin(const char *prompt UNUSED, char *outbuf) { Strcpy(outbuf, "\033"); } /*ARGSUSED*/ static void -hup_init_nhwindows(argc_p, argv) -int *argc_p UNUSED; -char **argv UNUSED; +hup_init_nhwindows(int *argc_p UNUSED, char **argv UNUSED) { iflags.window_inited = 1; } /*ARGUSED*/ static winid -hup_create_nhwindow(type) -int type UNUSED; +hup_create_nhwindow(int type UNUSED) { return WIN_ERR; } /*ARGSUSED*/ static int -hup_select_menu(window, how, menu_list) -winid window UNUSED; -int how UNUSED; -struct mi **menu_list UNUSED; +hup_select_menu(winid window UNUSED, int how UNUSED, + struct mi **menu_list UNUSED) { return -1; } /*ARGSUSED*/ static void -hup_add_menu(window, glyphinfo, identifier, sel, grpsel, attr, txt, itemflags) -winid window UNUSED; -const glyph_info *glyphinfo UNUSED; -int attr UNUSED; -const anything *identifier UNUSED; -char sel UNUSED, grpsel UNUSED; -const char *txt UNUSED; -unsigned int itemflags UNUSED; +hup_add_menu(winid window UNUSED, + const glyph_info *glyphinfo UNUSED, + const anything *identifier UNUSED, + char sel UNUSED, + char grpsel UNUSED, + int attr UNUSED, + const char *txt UNUSED, + unsigned int itemflags UNUSED) { return; } /*ARGSUSED*/ static void -hup_end_menu(window, prompt) -winid window UNUSED; -const char *prompt UNUSED; +hup_end_menu(winid window UNUSED, const char *prompt UNUSED) { return; } /*ARGSUSED*/ static void -hup_putstr(window, attr, text) -winid window UNUSED; -int attr UNUSED; -const char *text UNUSED; +hup_putstr(winid window UNUSED, int attr UNUSED, const char *text UNUSED) { return; } /*ARGSUSED*/ static void -hup_print_glyph(window, x, y, glyphinfo, bkglyphinfo) -winid window UNUSED; -xchar x UNUSED, y UNUSED; -const glyph_info *glyphinfo UNUSED; -const glyph_info *bkglyphinfo UNUSED; +hup_print_glyph(winid window UNUSED, + xchar x UNUSED, xchar y UNUSED, + const glyph_info *glyphinfo UNUSED, + const glyph_info *bkglyphinfo UNUSED) { return; } /*ARGSUSED*/ static void -hup_outrip(tmpwin, how, when) -winid tmpwin UNUSED; -int how UNUSED; -time_t when UNUSED; +hup_outrip(winid tmpwin UNUSED, int how UNUSED, time_t when UNUSED) { return; } /*ARGSUSED*/ static void -hup_curs(window, x, y) -winid window UNUSED; -int x UNUSED, y UNUSED; +hup_curs(winid window UNUSED, int x UNUSED, int y UNUSED) { return; } /*ARGSUSED*/ static void -hup_display_nhwindow(window, blocking) -winid window UNUSED; -boolean blocking UNUSED; +hup_display_nhwindow(winid window UNUSED, boolean blocking UNUSED) { return; } /*ARGSUSED*/ static void -hup_display_file(fname, complain) -const char *fname UNUSED; -boolean complain UNUSED; +hup_display_file(const char *fname UNUSED, boolean complain UNUSED) { return; } @@ -788,8 +754,7 @@ boolean complain UNUSED; #ifdef CLIPPING /*ARGSUSED*/ static void -hup_cliparound(x, y) -int x UNUSED, y UNUSED; +hup_cliparound(int x UNUSED, int y UNUSED) { return; } @@ -798,9 +763,7 @@ int x UNUSED, y UNUSED; #ifdef CHANGE_COLOR /*ARGSUSED*/ static void -hup_change_color(color, rgb, reverse) -int color, reverse; -long rgb; +hup_change_color(int color, int reverse, long rgb) { return; } @@ -808,16 +771,14 @@ long rgb; #ifdef MAC /*ARGSUSED*/ static short -hup_set_font_name(window, fontname) -winid window; -char *fontname; +hup_set_font_name(winid window, char *fontname) { return 0; } #endif /* MAC */ static char * -hup_get_color_string(VOID_ARGS) +hup_get_color_string(void) { return (char *) 0; } @@ -825,12 +786,9 @@ hup_get_color_string(VOID_ARGS) /*ARGSUSED*/ static void -hup_status_update(idx, ptr, chg, pc, color, colormasks) -int idx UNUSED; -genericptr_t ptr UNUSED; -int chg UNUSED, pc UNUSED, color UNUSED; -unsigned long *colormasks UNUSED; - +hup_status_update(int idx UNUSED, genericptr_t ptr UNUSED, int chg UNUSED, + int pc UNUSED, int color UNUSED, + unsigned long *colormasks UNUSED) { return; } @@ -840,46 +798,42 @@ unsigned long *colormasks UNUSED; */ static int -hup_int_ndecl(VOID_ARGS) +hup_int_ndecl(void) { return -1; } static void -hup_void_ndecl(VOID_ARGS) +hup_void_ndecl(void) { return; } /*ARGUSED*/ static void -hup_void_fdecl_int(arg) -int arg UNUSED; +hup_void_fdecl_int(int arg UNUSED) { return; } /*ARGUSED*/ static void -hup_void_fdecl_winid(window) -winid window UNUSED; +hup_void_fdecl_winid(winid window UNUSED) { return; } /*ARGUSED*/ static void -hup_void_fdecl_winid_ulong(window, mbehavior) -winid window UNUSED; -unsigned long mbehavior UNUSED; +hup_void_fdecl_winid_ulong(winid window UNUSED, + unsigned long mbehavior UNUSED) { return; } /*ARGUSED*/ static void -hup_void_fdecl_constchar_p(string) -const char *string UNUSED; +hup_void_fdecl_constchar_p(const char *string UNUSED) { return; } @@ -897,7 +851,7 @@ char *status_vals[MAXBLSTATS]; boolean status_activefields[MAXBLSTATS]; void -genl_status_init() +genl_status_init(void) { int i; @@ -913,7 +867,7 @@ genl_status_init() } void -genl_status_finish() +genl_status_finish(void) { /* tear down routine */ int i; @@ -926,11 +880,8 @@ genl_status_finish() } void -genl_status_enablefield(fieldidx, nm, fmt, enable) -int fieldidx; -const char *nm; -const char *fmt; -boolean enable; +genl_status_enablefield(int fieldidx, const char *nm, const char *fmt, + boolean enable) { status_fieldfmt[fieldidx] = fmt; status_fieldnm[fieldidx] = nm; @@ -939,11 +890,9 @@ boolean enable; /* call once for each field, then call with BL_FLUSH to output the result */ void -genl_status_update(idx, ptr, chg, percent, color, colormasks) -int idx; -genericptr_t ptr; -int chg UNUSED, percent UNUSED, color UNUSED; -unsigned long *colormasks UNUSED; +genl_status_update(int idx, genericptr_t ptr, int chg UNUSED, + int percent UNUSED, int color UNUSED, + unsigned long *colormasks UNUSED) { char newbot1[MAXCO], newbot2[MAXCO]; long cond, *condptr = (long *) ptr; @@ -1126,12 +1075,11 @@ static FILE *dumplog_file; static time_t dumplog_now; char * -dump_fmtstr(fmt, buf, fullsubs) -const char *fmt; -char *buf; -boolean fullsubs; /* True -> full substitution for file name, False -> - * partial substitution for '--showpaths' feedback - * where there's no game in progress when executed */ +dump_fmtstr(const char *fmt, char *buf, + boolean fullsubs) /* True -> full substitution for file name, + False -> partial substitution for + '--showpaths' feedback where there's + no game in progress when executed */ { const char *fp = fmt; char *bp = buf; @@ -1243,8 +1191,7 @@ boolean fullsubs; /* True -> full substitution for file name, False -> #endif /* DUMPLOG */ void -dump_open_log(now) -time_t now; +dump_open_log(time_t now) { #ifdef DUMPLOG char buf[BUFSZ]; @@ -1267,7 +1214,7 @@ time_t now; } void -dump_close_log() +dump_close_log(void) { if (dumplog_file) { (void) fclose(dumplog_file); @@ -1276,11 +1223,7 @@ dump_close_log() } void -dump_forward_putstr(win, attr, str, no_forward) -winid win; -int attr; -const char *str; -int no_forward; +dump_forward_putstr(winid win, int attr, const char *str, int no_forward) { if (dumplog_file) fprintf(dumplog_file, "%s\n", str); @@ -1290,67 +1233,56 @@ int no_forward; /*ARGSUSED*/ static void -dump_putstr(win, attr, str) -winid win UNUSED; -int attr UNUSED; -const char *str; +dump_putstr(winid win UNUSED, int attr UNUSED, const char *str) { if (dumplog_file) fprintf(dumplog_file, "%s\n", str); } static winid -dump_create_nhwindow(dummy) -int dummy; +dump_create_nhwindow(int dummy) { return dummy; } /*ARGUSED*/ static void -dump_clear_nhwindow(win) -winid win UNUSED; +dump_clear_nhwindow(winid win UNUSED) { return; } /*ARGSUSED*/ static void -dump_display_nhwindow(win, p) -winid win UNUSED; -boolean p UNUSED; +dump_display_nhwindow(winid win UNUSED, boolean p UNUSED) { return; } /*ARGUSED*/ static void -dump_destroy_nhwindow(win) -winid win UNUSED; +dump_destroy_nhwindow(winid win UNUSED) { return; } /*ARGUSED*/ static void -dump_start_menu(win, mbehavior) -winid win UNUSED; -unsigned long mbehavior UNUSED; +dump_start_menu(winid win UNUSED, unsigned long mbehavior UNUSED) { return; } /*ARGSUSED*/ static void -dump_add_menu(win, glyphinfo, identifier, ch, gch, attr, str, itemflags) -winid win UNUSED; -const glyph_info *glyphinfo; -const anything *identifier UNUSED; -char ch; -char gch UNUSED; -int attr UNUSED; -const char *str; -unsigned int itemflags UNUSED; +dump_add_menu(winid win UNUSED, + const glyph_info *glyphinfo, + const anything *identifier UNUSED, + char ch, + char gch UNUSED, + int attr UNUSED, + const char *str, + unsigned int itemflags UNUSED) { if (dumplog_file) { if (glyphinfo->glyph == NO_GLYPH) @@ -1362,9 +1294,7 @@ unsigned int itemflags UNUSED; /*ARGSUSED*/ static void -dump_end_menu(win, str) -winid win UNUSED; -const char *str; +dump_end_menu(winid win UNUSED, const char *str) { if (dumplog_file) { if (str) @@ -1375,18 +1305,14 @@ const char *str; } static int -dump_select_menu(win, how, item) -winid win UNUSED; -int how UNUSED; -menu_item **item; +dump_select_menu(winid win UNUSED, int how UNUSED, menu_item **item) { *item = (menu_item *) 0; return 0; } void -dump_redirect(onoff_flag) -boolean onoff_flag; +dump_redirect(boolean onoff_flag) { if (dumplog_file) { if (onoff_flag) { @@ -1419,8 +1345,7 @@ extern NEARDATA char *hilites[CLR_MAX]; #endif int -has_color(color) -int color; +has_color(int color) { return (iflags.use_color && windowprocs.name && (windowprocs.wincap & WC_COLOR) && windowprocs.has_color[color] @@ -1433,8 +1358,7 @@ int color; } int -glyph2ttychar(glyph) -int glyph; +glyph2ttychar(int glyph) { glyph_info glyphinfo; @@ -1443,8 +1367,7 @@ int glyph; } int -glyph2symidx(glyph) -int glyph; +glyph2symidx(int glyph) { glyph_info glyphinfo; @@ -1453,8 +1376,7 @@ int glyph; } char * -encglyph(glyph) -int glyph; +encglyph(int glyph) { static char encbuf[20]; /* 10+1 would suffice */ @@ -1463,9 +1385,7 @@ int glyph; } char * -decode_mixed(buf, str) -char *buf; -const char *str; +decode_mixed(char *buf, const char *str) { static const char hex[] = "00112233445566778899aAbBcCdDeEfF"; char *put = buf; @@ -1557,10 +1477,7 @@ const char *str; */ void -genl_putmixed(window, attr, str) -winid window; -int attr; -const char *str; +genl_putmixed(winid window, int attr, const char *str) { char buf[BUFSZ]; @@ -1573,10 +1490,10 @@ const char *str; * logic into one place instead of 7 different window-port routines. */ boolean -menuitem_invert_test(mode, itemflags, is_selected) -int mode; -unsigned itemflags; /* The itemflags for the item */ -boolean is_selected; /* The current selection status of the item */ +menuitem_invert_test(int mode, + unsigned itemflags, /* The itemflags for the item */ + boolean is_selected) /* The current selection status + of the item */ { boolean skipinvert = (itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0; diff --git a/src/wizard.c b/src/wizard.c index 4f1891566..8e16337a4 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -10,14 +10,14 @@ #include "hack.h" -static short FDECL(which_arti, (int)); -static boolean FDECL(mon_has_arti, (struct monst *, SHORT_P)); -static struct monst *FDECL(other_mon_has_arti, (struct monst *, SHORT_P)); -static struct obj *FDECL(on_ground, (SHORT_P)); -static boolean FDECL(you_have, (int)); -static unsigned long FDECL(target_on, (int, struct monst *)); -static unsigned long FDECL(strategy, (struct monst *)); -static void FDECL(choose_stairs, (xchar *, xchar *)); +static short which_arti(int); +static boolean mon_has_arti(struct monst *, short); +static struct monst *other_mon_has_arti(struct monst *, short); +static struct obj *on_ground(short); +static boolean you_have(int); +static unsigned long target_on(int, struct monst *); +static unsigned long strategy(struct monst *); +static void choose_stairs(xchar *, xchar *); /* adding more neutral creatures will tend to reduce the number of monsters summoned by nasty(); adding more lawful creatures will reduce the number @@ -56,7 +56,7 @@ static NEARDATA const unsigned wizapp[] = { /* If you've found the Amulet, make the Wizard appear after some time */ /* Also, give hints about portal locations, if amulet is worn/wielded -dlc */ void -amulet() +amulet(void) { struct monst *mtmp; struct trap *ttmp; @@ -101,8 +101,7 @@ amulet() } int -mon_has_amulet(mtmp) -register struct monst *mtmp; +mon_has_amulet(struct monst *mtmp) { register struct obj *otmp; @@ -113,8 +112,7 @@ register struct monst *mtmp; } int -mon_has_special(mtmp) -register struct monst *mtmp; +mon_has_special(struct monst *mtmp) { register struct obj *otmp; @@ -142,8 +140,7 @@ register struct monst *mtmp; #define M_Wants(mask) (mtmp->data->mflags3 & (mask)) static short -which_arti(mask) -register int mask; +which_arti(int mask) { switch (mask) { case M3_WANTSAMUL: @@ -166,9 +163,7 @@ register int mask; * artifacts right now. [MRS] */ static boolean -mon_has_arti(mtmp, otyp) -register struct monst *mtmp; -register short otyp; +mon_has_arti(struct monst *mtmp, short otyp) { register struct obj *otmp; @@ -183,9 +178,7 @@ register short otyp; } static struct monst * -other_mon_has_arti(mtmp, otyp) -register struct monst *mtmp; -register short otyp; +other_mon_has_arti(struct monst *mtmp, short otyp) { register struct monst *mtmp2; @@ -199,8 +192,7 @@ register short otyp; } static struct obj * -on_ground(otyp) -register short otyp; +on_ground(short otyp) { register struct obj *otmp; @@ -214,8 +206,7 @@ register short otyp; } static boolean -you_have(mask) -register int mask; +you_have(int mask) { switch (mask) { case M3_WANTSAMUL: @@ -235,9 +226,7 @@ register int mask; } static unsigned long -target_on(mask, mtmp) -register int mask; -register struct monst *mtmp; +target_on(int mask, struct monst *mtmp) { register short otyp; register struct obj *otmp; @@ -263,8 +252,7 @@ register struct monst *mtmp; } static unsigned long -strategy(mtmp) -register struct monst *mtmp; +strategy(struct monst *mtmp) { unsigned long strat, dstrat; @@ -324,9 +312,7 @@ register struct monst *mtmp; } static void -choose_stairs(sx, sy) -xchar *sx; -xchar *sy; +choose_stairs(xchar *sx, xchar *sy) { xchar x = 0, y = 0; stairway *stway = g.stairs; @@ -356,8 +342,7 @@ xchar *sy; } int -tactics(mtmp) -register struct monst *mtmp; +tactics(struct monst *mtmp) { unsigned long strat = strategy(mtmp); xchar sx = 0, sy = 0, mx, my; @@ -449,8 +434,7 @@ register struct monst *mtmp; /* are there any monsters mon could aggravate? */ boolean -has_aggravatables(mon) -struct monst *mon; +has_aggravatables(struct monst *mon) { struct monst *mtmp; boolean in_w_tower = In_W_tower(mon->mx, mon->my, &u.uz); @@ -471,7 +455,7 @@ struct monst *mon; } void -aggravate() +aggravate(void) { register struct monst *mtmp; boolean in_w_tower = In_W_tower(u.ux, u.uy, &u.uz); @@ -494,7 +478,7 @@ aggravate() only casting this when there is currently one wizard in existence; the clone can't use it unless/until its creator has been killed off */ void -clonewiz() +clonewiz(void) { register struct monst *mtmp2; @@ -513,8 +497,8 @@ clonewiz() /* also used by newcham() */ int -pick_nasty(difcap) -int difcap; /* if non-zero, try to make difficulty be lower than this */ +pick_nasty(int difcap) /* if non-zero, try to make difficulty be lower + than this */ { int alt, res = nasties[rn2(SIZE(nasties))]; @@ -566,8 +550,7 @@ int difcap; /* if non-zero, try to make difficulty be lower than this */ creatures on average (in 3.6.0 and earlier, Null was treated as chaotic); returns the number of monsters created */ int -nasty(summoner) -struct monst *summoner; +nasty(struct monst *summoner) { struct monst *mtmp; coord bypos; @@ -685,7 +668,7 @@ struct monst *summoner; /* Let's resurrect the wizard, for some unexpected fun. */ void -resurrect() +resurrect(void) { struct monst *mtmp, **mmtmp; long elapsed; @@ -740,7 +723,7 @@ resurrect() /* Here, we make trouble for the poor shmuck who actually managed to do in the Wizard. */ void -intervene() +intervene(void) { int which = Is_astralevel(&u.uz) ? rnd(4) : rn2(6); /* cases 0 and 5 don't apply on the Astral level */ @@ -767,7 +750,7 @@ intervene() } void -wizdead() +wizdead(void) { g.context.no_of_wizards--; if (!u.uevent.udemigod) { @@ -798,8 +781,7 @@ const char *const random_malediction[] = { /* Insult or intimidate the player */ void -cuss(mtmp) -register struct monst *mtmp; +cuss(struct monst *mtmp) { if (Deaf) return; diff --git a/src/worm.c b/src/worm.c index 9081a9919..73f1c7824 100644 --- a/src/worm.c +++ b/src/worm.c @@ -14,12 +14,12 @@ struct wseg { xchar wx, wy; /* the segment's position */ }; -static void FDECL(toss_wsegs, (struct wseg *, BOOLEAN_P)); -static void FDECL(shrink_worm, (int)); +static void toss_wsegs(struct wseg *, boolean); +static void shrink_worm(int); #if 0 -static void FDECL(random_dir, (int, int, int *, int *)); +static void random_dir(int, int, int *, int *); #endif -static struct wseg *FDECL(create_worm_tail, (int)); +static struct wseg *create_worm_tail(int); /* Description of long worm implementation. * @@ -89,7 +89,7 @@ static long wgrowtime[MAX_NUM_WORMS] = DUMMY; * Implementation is left to the interested hacker. */ int -get_wormno() +get_wormno(void) { int new_wormno = 1; @@ -113,9 +113,7 @@ get_wormno() * not be called. */ void -initworm(worm, wseg_count) -struct monst *worm; -int wseg_count; +initworm(struct monst *worm, int wseg_count) { struct wseg *seg, *new_tail = create_worm_tail(wseg_count); int wnum = worm->wormno; @@ -142,9 +140,7 @@ int wseg_count; */ static void -toss_wsegs(curr, display_update) -struct wseg *curr; -boolean display_update; +toss_wsegs(struct wseg *curr, boolean display_update) { struct wseg *nxtseg; @@ -174,8 +170,7 @@ boolean display_update; */ static void -shrink_worm(wnum) -int wnum; /* worm number */ +shrink_worm(int wnum) /* worm number */ { struct wseg *seg; @@ -196,8 +191,7 @@ int wnum; /* worm number */ * Move the worm. Maybe grow. */ void -worm_move(worm) -struct monst *worm; +worm_move(struct monst *worm) { struct wseg *seg, *new_seg; /* new segment */ int wnum = worm->wormno; /* worm number */ @@ -288,8 +282,7 @@ struct monst *worm; * The worm don't move so it should shrink. */ void -worm_nomove(worm) -struct monst *worm; +worm_nomove(struct monst *worm) { shrink_worm((int) worm->wormno); /* shrink */ @@ -308,8 +301,7 @@ struct monst *worm; * Kill a worm tail. */ void -wormgone(worm) -struct monst *worm; +wormgone(struct monst *worm) { int wnum = worm->wormno; @@ -333,8 +325,7 @@ struct monst *worm; * or 0 if it doesn't. */ int -wormhitu(worm) -struct monst *worm; +wormhitu(struct monst *worm) { int wnum = worm->wormno; struct wseg *seg; @@ -363,10 +354,8 @@ struct monst *worm; * that both halves will survive. */ void -cutworm(worm, x, y, cuttier) -struct monst *worm; -xchar x, y; -boolean cuttier; /* hit is by wielded blade or axe or by thrown axe */ +cutworm(struct monst *worm, xchar x, xchar y, + boolean cuttier) /* hit is by wielded blade or axe or by thrown axe */ { struct wseg *curr, *new_tail; struct monst *new_worm; @@ -479,8 +468,7 @@ boolean cuttier; /* hit is by wielded blade or axe or by thrown axe */ * is located here for modularity. */ void -see_wsegs(worm) -struct monst *worm; +see_wsegs(struct monst *worm) { struct wseg *curr = wtails[worm->wormno]; @@ -496,9 +484,7 @@ struct monst *worm; * Display all of the segments of the given worm for detection. */ void -detect_wsegs(worm, use_detection_glyph) -struct monst *worm; -boolean use_detection_glyph; +detect_wsegs(struct monst *worm, boolean use_detection_glyph) { int num; struct wseg *curr = wtails[worm->wormno]; @@ -520,8 +506,7 @@ boolean use_detection_glyph; * of segments, including the dummy. Called from save.c. */ void -save_worm(nhfp) -NHFILE *nhfp; +save_worm(NHFILE *nhfp) { int i; int count; @@ -575,8 +560,7 @@ NHFILE *nhfp; * Restore the worm information from the save file. Called from restore.c */ void -rest_worm(nhfp) -NHFILE *nhfp; +rest_worm(NHFILE *nhfp) { int i, j, count = 0; struct wseg *curr, *temp; @@ -615,8 +599,7 @@ NHFILE *nhfp; * in the same location as worm segments */ void -place_wsegs(worm, oldworm) -struct monst *worm, *oldworm; +place_wsegs(struct monst *worm, struct monst *oldworm) { struct wseg *curr = wtails[worm->wormno]; @@ -640,8 +623,7 @@ struct monst *worm, *oldworm; /* called from mon_sanity_check(mon.c) */ void -sanity_check_worm(worm) -struct monst *worm; +sanity_check_worm(struct monst *worm) { struct wseg *curr; int wnum, x, y; @@ -684,7 +666,7 @@ struct monst *worm; /* called from mon_sanity_check(mon.c) */ void -wormno_sanity_check() +wormno_sanity_check(void) { #ifdef EXTRA_SANITY_CHECKS struct wseg *seg; @@ -716,8 +698,7 @@ wormno_sanity_check() * not remove the mon from the fmon chain. */ void -remove_worm(worm) -struct monst *worm; +remove_worm(struct monst *worm) { struct wseg *curr = wtails[worm->wormno]; @@ -741,9 +722,7 @@ struct monst *worm; * be, if somehow the head is disjoint from the tail. */ void -place_worm_tail_randomly(worm, x, y) -struct monst *worm; -xchar x, y; +place_worm_tail_randomly(struct monst *worm, xchar x, xchar y) { int wnum = worm->wormno; struct wseg *curr = wtails[wnum]; @@ -837,11 +816,8 @@ xchar x, y; * This function, and the loop it serves, could be eliminated by coding * enexto() with a search radius. */ -static -void -random_dir(x, y, nx, ny) -int x, y; -int *nx, *ny; +static void +random_dir(int x, int y, int *nx, int *ny) { *nx = x + (x > 1 /* extreme left ? */ ? (x < COLNO - 1 /* extreme right ? */ @@ -865,8 +841,7 @@ int *nx, *ny; /* for size_monst(cmd.c) to support #stats */ int -size_wseg(worm) -struct monst *worm; +size_wseg(struct monst *worm) { return (int) (count_wsegs(worm) * sizeof (struct wseg)); } @@ -875,8 +850,7 @@ struct monst *worm; * returns the number of segments that a worm has. */ int -count_wsegs(mtmp) -struct monst *mtmp; +count_wsegs(struct monst *mtmp) { int i = 0; struct wseg *curr; @@ -893,8 +867,7 @@ struct monst *mtmp; */ static struct wseg * -create_worm_tail(num_segs) -int num_segs; +create_worm_tail(int num_segs) { int i = 0; struct wseg *new_tail, *curr; @@ -925,8 +898,7 @@ int num_segs; * Mostly used in the canseemon() macro. */ boolean -worm_known(worm) -struct monst *worm; +worm_known(struct monst *worm) { struct wseg *curr = wtails[worm->wormno]; @@ -941,8 +913,7 @@ struct monst *worm; /* would moving from to involve passing between two consecutive segments of the same worm? */ boolean -worm_cross(x1, y1, x2, y2) -int x1, y1, x2, y2; +worm_cross(int x1, int y1, int x2, int y2) { struct monst *worm; struct wseg *curr, *wnxt; @@ -990,9 +961,7 @@ int x1, y1, x2, y2; /* construct an index number for a worm tail segment */ int -wseg_at(worm, x, y) -struct monst *worm; -int x, y; +wseg_at(struct monst *worm, int x, int y) { int res = 0; @@ -1014,9 +983,7 @@ int x, y; } void -flip_worm_segs_vertical(worm, miny, maxy) -struct monst *worm; -int miny, maxy; +flip_worm_segs_vertical(struct monst *worm, int miny, int maxy) { struct wseg *curr = wtails[worm->wormno]; @@ -1027,9 +994,7 @@ int miny, maxy; } void -flip_worm_segs_horizontal(worm, minx, maxx) -struct monst *worm; -int minx, maxx; +flip_worm_segs_horizontal(struct monst *worm, int minx, int maxx) { struct wseg *curr = wtails[worm->wormno]; diff --git a/src/worn.c b/src/worn.c index 7da309a02..0b35ad492 100644 --- a/src/worn.c +++ b/src/worn.c @@ -5,10 +5,9 @@ #include "hack.h" -static void FDECL(m_lose_armor, (struct monst *, struct obj *)); -static void FDECL(m_dowear_type, - (struct monst *, long, BOOLEAN_P, BOOLEAN_P)); -static int FDECL(extra_pref, (struct monst *, struct obj *)); +static void m_lose_armor(struct monst *, struct obj *); +static void m_dowear_type(struct monst *, long, boolean, boolean); +static int extra_pref(struct monst *, struct obj *); const struct worn { long w_mask; @@ -44,9 +43,7 @@ const struct worn { /* Updated to use the extrinsic and blocked fields. */ void -setworn(obj, mask) -register struct obj *obj; -long mask; +setworn(struct obj *obj, long mask) { register const struct worn *wp; register struct obj *oobj; @@ -115,8 +112,7 @@ long mask; /* called e.g. when obj is destroyed */ /* Updated to use the extrinsic and blocked fields. */ void -setnotworn(obj) -register struct obj *obj; +setnotworn(struct obj *obj) { register const struct worn *wp; register int p; @@ -147,7 +143,7 @@ register struct obj *obj; /* called when saving with FREEING flag set has just discarded inventory */ void -allunworn() +allunworn(void) { const struct worn *wp; @@ -165,8 +161,7 @@ allunworn() /* return item worn in slot indiciated by wornmask; needed by poly_obj() */ struct obj * -wearmask_to_obj(wornmask) -long wornmask; +wearmask_to_obj(long wornmask) { const struct worn *wp; @@ -178,8 +173,7 @@ long wornmask; /* return a bitmask of the equipment slot(s) a given item might be worn in */ long -wearslot(obj) -struct obj *obj; +wearslot(struct obj *obj) { int otyp = obj->otyp; /* practically any item can be wielded or quivered; it's up to @@ -251,8 +245,7 @@ struct obj *obj; } void -mon_set_minvis(mon) -struct monst *mon; +mon_set_minvis(struct monst *mon) { mon->perminvis = 1; if (!mon->invis_blkd) { @@ -264,10 +257,10 @@ struct monst *mon; } void -mon_adjust_speed(mon, adjust, obj) -struct monst *mon; -int adjust; /* positive => increase speed, negative => decrease */ -struct obj *obj; /* item to make known if effect can be seen */ +mon_adjust_speed(struct monst *mon, + int adjust, /* positive => increase speed, negative => + decrease */ + struct obj *obj) /* item to make known if effect can be seen */ { struct obj *otmp; boolean give_msg = !g.in_mklev, petrify = FALSE; @@ -343,10 +336,8 @@ struct obj *obj; /* item to make known if effect can be seen */ /* armor put on or taken off; might be magical variety [TODO: rename to 'update_mon_extrinsics()' and change all callers...] */ void -update_mon_intrinsics(mon, obj, on, silently) -struct monst *mon; -struct obj *obj; -boolean on, silently; +update_mon_intrinsics(struct monst *mon, struct obj *obj, boolean on, + boolean silently) { int unseen; uchar mask; @@ -456,8 +447,7 @@ boolean on, silently; } int -find_mac(mon) -register struct monst *mon; +find_mac(struct monst *mon) { register struct obj *obj; int base = mon->data->ac; @@ -497,9 +487,7 @@ register struct monst *mon; * already worn body armor is too obviously buggy... */ void -m_dowear(mon, creation) -register struct monst *mon; -boolean creation; +m_dowear(struct monst *mon, boolean creation) { #define RACE_EXCEPTION TRUE /* Note the restrictions here are the same as in dowear in do_wear.c @@ -536,11 +524,8 @@ boolean creation; } static void -m_dowear_type(mon, flag, creation, racialexception) -struct monst *mon; -long flag; -boolean creation; -boolean racialexception; +m_dowear_type(struct monst *mon, long flag, boolean creation, + boolean racialexception) { struct obj *old, *best, *obj; int m_delay = 0; @@ -688,9 +673,7 @@ boolean racialexception; #undef RACE_EXCEPTION struct obj * -which_armor(mon, flag) -struct monst *mon; -long flag; +which_armor(struct monst *mon, long flag) { if (mon == &g.youmonst) { switch (flag) { @@ -724,9 +707,7 @@ long flag; /* remove an item of armor and then drop it */ static void -m_lose_armor(mon, obj) -struct monst *mon; -struct obj *obj; +m_lose_armor(struct monst *mon, struct obj *obj) { mon->misc_worn_check &= ~obj->owornmask; if (obj->owornmask) @@ -741,7 +722,7 @@ struct obj *obj; /* all objects with their bypass bit set should now be reset to normal */ void -clear_bypasses() +clear_bypasses(void) { struct obj *otmp, *nobj; struct monst *mtmp; @@ -803,8 +784,7 @@ clear_bypasses() } void -bypass_obj(obj) -struct obj *obj; +bypass_obj(struct obj *obj) { obj->bypass = 1; g.context.bypasses = TRUE; @@ -812,9 +792,8 @@ struct obj *obj; /* set or clear the bypass bit in a list of objects */ void -bypass_objlist(objchain, on) -struct obj *objchain; -boolean on; /* TRUE => set, FALSE => clear */ +bypass_objlist(struct obj *objchain, + boolean on) /* TRUE => set, FALSE => clear */ { if (on && objchain) g.context.bypasses = TRUE; @@ -827,8 +806,7 @@ boolean on; /* TRUE => set, FALSE => clear */ /* return the first object without its bypass bit set; set that bit before returning so that successive calls will find further objects */ struct obj * -nxt_unbypassed_obj(objchain) -struct obj *objchain; +nxt_unbypassed_obj(struct obj *objchain) { while (objchain) { if (!objchain->bypass) { @@ -845,9 +823,7 @@ struct obj *objchain; there's an added complication that the array may have stale pointers for deleted objects (see Multiple-Drop case in askchain(invent.c)) */ struct obj * -nxt_unbypassed_loot(lootarray, listhead) -Loot *lootarray; -struct obj *listhead; +nxt_unbypassed_loot(Loot *lootarray, struct obj *listhead) { struct obj *o, *obj; @@ -865,9 +841,7 @@ struct obj *listhead; } void -mon_break_armor(mon, polyspot) -struct monst *mon; -boolean polyspot; +mon_break_armor(struct monst *mon, boolean polyspot) { register struct obj *otmp; struct permonst *mdat = mon->data; @@ -1030,9 +1004,7 @@ boolean polyspot; /* bias a monster's preferences towards armor that has special benefits. */ static int -extra_pref(mon, obj) -struct monst *mon; -struct obj *obj; +extra_pref(struct monst *mon, struct obj *obj) { /* currently only does speed boots, but might be expanded if monsters * get to use more armor abilities @@ -1053,9 +1025,7 @@ struct obj *obj; * -1 If the race/object combination is unacceptable. */ int -racial_exception(mon, obj) -struct monst *mon; -struct obj *obj; +racial_exception(struct monst *mon, struct obj *obj) { const struct permonst *ptr = raceptr(mon); diff --git a/src/write.c b/src/write.c index 8029ab33b..1614735ea 100644 --- a/src/write.c +++ b/src/write.c @@ -3,17 +3,16 @@ #include "hack.h" -static int FDECL(cost, (struct obj *)); -static boolean FDECL(label_known, (int, struct obj *)); -static int FDECL(write_ok, (struct obj *)); -static char *FDECL(new_book_description, (int, char *)); +static int cost(struct obj *); +static boolean label_known(int, struct obj *); +static int write_ok(struct obj *); +static char *new_book_description(int, char *); /* * returns basecost of a scroll or a spellbook */ static int -cost(otmp) -register struct obj *otmp; +cost(struct obj *otmp) { if (otmp->oclass == SPBOOK_CLASS) return (10 * objects[otmp->otyp].oc_level); @@ -63,9 +62,7 @@ register struct obj *otmp; the discoveries list and aren't present in current inventory, so some scrolls with ought to yield True will end up False */ static boolean -label_known(scrolltype, objlist) -int scrolltype; -struct obj *objlist; +label_known(int scrolltype, struct obj *objlist) { struct obj *otmp; @@ -90,8 +87,7 @@ struct obj *objlist; /* getobj callback for object to write on */ static int -write_ok(obj) -struct obj *obj; +write_ok(struct obj *obj) { if (!obj || (obj->oclass != SCROLL_CLASS && obj->oclass != SPBOOK_CLASS)) return GETOBJ_EXCLUDE; @@ -104,8 +100,7 @@ struct obj *obj; /* write -- applying a magic marker */ int -dowrite(pen) -register struct obj *pen; +dowrite(struct obj *pen) { register struct obj *paper; char namebuf[BUFSZ] = DUMMY, *nm, *bp; @@ -373,9 +368,7 @@ found: even that's rather iffy, indicating that such descriptions probably ought to be eliminated (especially "cloth"!) */ static char * -new_book_description(booktype, outbuf) -int booktype; -char *outbuf; +new_book_description(int booktype, char *outbuf) { /* subset of description strings from objects.c; if it grows much, we may need to add a new flag field to objects[] instead */ diff --git a/src/zap.c b/src/zap.c index de51db503..67de59d3b 100644 --- a/src/zap.c +++ b/src/zap.c @@ -12,22 +12,22 @@ */ #define MAGIC_COOKIE 1000 -static void FDECL(polyuse, (struct obj *, int, int)); -static void FDECL(create_polymon, (struct obj *, int)); -static int FDECL(stone_to_flesh_obj, (struct obj *)); -static boolean FDECL(zap_updown, (struct obj *)); -static void FDECL(zhitu, (int, int, const char *, XCHAR_P, XCHAR_P)); -static void FDECL(revive_egg, (struct obj *)); -static boolean FDECL(zap_steed, (struct obj *)); -static void FDECL(skiprange, (int, int *, int *)); -static int FDECL(zap_hit, (int, int)); -static void FDECL(disintegrate_mon, (struct monst *, int, const char *)); -static void FDECL(backfire, (struct obj *)); -static int FDECL(zap_ok, (struct obj *)); -static void FDECL(boxlock_invent, (struct obj *)); -static int FDECL(spell_hit_bonus, (int)); -static void FDECL(destroy_one_item, (struct obj *, int, int)); -static void FDECL(wishcmdassist, (int)); +static void polyuse(struct obj *, int, int); +static void create_polymon(struct obj *, int); +static int stone_to_flesh_obj(struct obj *); +static boolean zap_updown(struct obj *); +static void zhitu(int, int, const char *, xchar, xchar); +static void revive_egg(struct obj *); +static boolean zap_steed(struct obj *); +static void skiprange(int, int *, int *); +static int zap_hit(int, int); +static void disintegrate_mon(struct monst *, int, const char *); +static void backfire(struct obj *); +static int zap_ok(struct obj *); +static void boxlock_invent(struct obj *); +static int spell_hit_bonus(int); +static void destroy_one_item(struct obj *, int, int); +static void wishcmdassist(int); #define ZT_MAGIC_MISSILE (AD_MAGM - 1) #define ZT_FIRE (AD_FIRE - 1) @@ -93,8 +93,7 @@ const char *const flash_types[] = /* also used in buzzmu(mcastu.c) */ /* wand discovery gets special handling when hero is blinded */ void -learnwand(obj) -struct obj *obj; +learnwand(struct obj *obj) { /* For a wand (or wand-like tool) zapped by the player, if the effect was observable (determined by caller; usually seen, but @@ -127,9 +126,7 @@ struct obj *obj; /* Routines for IMMEDIATE wands and spells. */ /* bhitm: monster mtmp was hit by the effect of wand or spell otmp */ int -bhitm(mtmp, otmp) -struct monst *mtmp; -struct obj *otmp; +bhitm(struct monst *mtmp, struct obj *otmp) { boolean wake = TRUE; /* Most 'zaps' should wake monster */ boolean reveal_invis = FALSE, learn_it = FALSE; @@ -476,8 +473,7 @@ struct obj *otmp; } void -probe_monster(mtmp) -struct monst *mtmp; +probe_monster(struct monst *mtmp) { struct obj *otmp; @@ -514,10 +510,7 @@ struct monst *mtmp; * is not available or subject to the constraints above. */ boolean -get_obj_location(obj, xp, yp, locflags) -struct obj *obj; -xchar *xp, *yp; -int locflags; +get_obj_location(struct obj *obj, xchar *xp, xchar *yp, int locflags) { switch (obj->where) { case OBJ_INVENT: @@ -552,10 +545,9 @@ int locflags; } boolean -get_mon_location(mon, xp, yp, locflags) -struct monst *mon; -xchar *xp, *yp; -int locflags; /* non-zero means get location even if monster is buried */ +get_mon_location(struct monst *mon, xchar *xp, xchar *yp, + int locflags) /* non-zero means get location even if monster + is buried */ { if (mon == &g.youmonst) { *xp = u.ux; @@ -573,10 +565,9 @@ int locflags; /* non-zero means get location even if monster is buried */ /* used by revive() and animate_statue() */ struct monst * -montraits(obj, cc, adjacentok) -struct obj *obj; -coord *cc; -boolean adjacentok; /* False: at obj's spot only, True: nearby is allowed */ +montraits(struct obj *obj, coord *cc, + boolean adjacentok) /* False: at obj's spot only, True: nearby is + allowed */ { struct monst *mtmp, *mtmp2 = has_omonst(obj) ? get_mtraits(obj, TRUE) : 0; @@ -698,10 +689,7 @@ boolean adjacentok; /* False: at obj's spot only, True: nearby is allowed */ * if applicable. */ struct monst * -get_container_location(obj, loc, container_nesting) -struct obj *obj; -int *loc; -int *container_nesting; +get_container_location(struct obj *obj, int *loc, int *container_nesting) { if (!obj || !loc) return 0; @@ -728,9 +716,7 @@ int *container_nesting; * and only one monster will be resurrected. */ struct monst * -revive(corpse, by_hero) -struct obj *corpse; -boolean by_hero; +revive(struct obj *corpse, boolean by_hero) { struct monst *mtmp = 0; struct permonst *mptr; @@ -959,8 +945,7 @@ boolean by_hero; } static void -revive_egg(obj) -struct obj *obj; +revive_egg(struct obj *obj) { /* * Note: generic eggs with corpsenm set to NON_PM will never hatch. @@ -973,8 +958,7 @@ struct obj *obj; /* try to revive all corpses and eggs carried by `mon' */ int -unturn_dead(mon) -struct monst *mon; +unturn_dead(struct monst *mon) { struct obj *otmp, *otmp2; struct monst *mtmp2; @@ -1035,7 +1019,7 @@ struct monst *mon; } void -unturn_you() +unturn_you(void) { (void) unturn_dead(&g.youmonst); /* hit carried corpses and eggs */ @@ -1049,8 +1033,7 @@ unturn_you() /* cancel obj, possibly carried by you or a monster */ void -cancel_item(obj) -register struct obj *obj; +cancel_item(struct obj *obj) { int otyp = obj->otyp; @@ -1175,9 +1158,7 @@ register struct obj *obj; * possibly carried by you or a monster */ boolean -drain_item(obj, by_you) -struct obj *obj; -boolean by_you; +drain_item(struct obj *obj, boolean by_you) { boolean u_ring; @@ -1253,9 +1234,9 @@ boolean by_you; } boolean -obj_resists(obj, ochance, achance) -struct obj *obj; -int ochance, achance; /* percent chance for ordinary objects, artifacts */ +obj_resists(struct obj *obj, + int ochance, /* percent chance for ordinary objects */ + int achance) /* percent chance for artifacts */ { if (obj->otyp == AMULET_OF_YENDOR || obj->otyp == SPE_BOOK_OF_THE_DEAD @@ -1271,8 +1252,7 @@ int ochance, achance; /* percent chance for ordinary objects, artifacts */ } boolean -obj_shudders(obj) -struct obj *obj; +obj_shudders(struct obj *obj) { int zap_odds; @@ -1301,9 +1281,7 @@ struct obj *obj; * at the top of the pile. */ static void -polyuse(objhdr, mat, minwt) -struct obj *objhdr; -int mat, minwt; +polyuse(struct obj *objhdr, int mat, int minwt) { register struct obj *otmp, *otmp2; @@ -1344,9 +1322,7 @@ int mat, minwt; * a golem of the kind okind. */ static void -create_polymon(obj, okind) -struct obj *obj; -int okind; +create_polymon(struct obj *obj, int okind) { struct permonst *mdat = (struct permonst *) 0; struct monst *mtmp; @@ -1437,8 +1413,7 @@ int okind; /* Assumes obj is on the floor. */ void -do_osshock(obj) -struct obj *obj; +do_osshock(struct obj *obj) { long i; @@ -1479,8 +1454,7 @@ struct obj *obj; /* Returns TRUE if obj resists polymorphing */ boolean -obj_unpolyable(obj) -struct obj *obj; +obj_unpolyable(struct obj *obj) { return (unpolyable(obj) || obj == uball || obj == uskin @@ -1504,9 +1478,7 @@ static const char charged_objs[] = { WAND_CLASS, WEAPON_CLASS, ARMOR_CLASS, * This should be safe to call for an object anywhere. */ struct obj * -poly_obj(obj, id) -struct obj *obj; -int id; +poly_obj(struct obj *obj, int id) { struct obj *otmp; xchar ox = 0, oy = 0; @@ -1775,8 +1747,7 @@ int id; /* stone-to-flesh spell hits and maybe transforms or animates obj */ static int -stone_to_flesh_obj(obj) -struct obj *obj; +stone_to_flesh_obj(struct obj *obj) { int res = 1; /* affected object by default */ struct permonst *ptr; @@ -1899,8 +1870,7 @@ struct obj *obj; * non-zero if the wand/spell had any effect. */ int -bhito(obj, otmp) -struct obj *obj, *otmp; +bhito(struct obj *obj, struct obj *otmp) { int res = 1; /* affected object by default */ boolean learn_it = FALSE, maybelearnit; @@ -2173,11 +2143,7 @@ struct obj *obj, *otmp; /* returns nonzero if something was hit */ int -bhitpile(obj, fhito, tx, ty, zz) -struct obj *obj; -int FDECL((*fhito), (OBJ_P, OBJ_P)); -int tx, ty; -schar zz; +bhitpile(struct obj *obj, int (*fhito)(OBJ_P, OBJ_P), int tx, int ty, schar zz) { int hitanything = 0; register struct obj *otmp, *next_obj; @@ -2217,8 +2183,7 @@ schar zz; * added by GAN 11/03/86 */ int -zappable(wand) -register struct obj *wand; +zappable(struct obj *wand) { if (wand->spe < 0 || (wand->spe == 0 && rn2(121))) return 0; @@ -2229,7 +2194,7 @@ register struct obj *wand; } void -do_enlightenment_effect() +do_enlightenment_effect(void) { You_feel("self-knowledgeable..."); display_nhwindow(WIN_MESSAGE, FALSE); @@ -2243,8 +2208,7 @@ do_enlightenment_effect() * added by GAN 11/03/86 */ void -zapnodir(obj) -register struct obj *obj; +zapnodir(struct obj *obj) { boolean known = FALSE; @@ -2291,8 +2255,7 @@ register struct obj *obj; } static void -backfire(otmp) -struct obj *otmp; +backfire(struct obj *otmp) { int dmg; @@ -2305,8 +2268,7 @@ struct obj *otmp; /* getobj callback for object to zap */ static int -zap_ok(obj) -struct obj *obj; +zap_ok(struct obj *obj) { if (obj && obj->oclass == WAND_CLASS) return GETOBJ_SUGGEST; @@ -2315,7 +2277,7 @@ struct obj *obj; /* 'z' command (or 'y' if numbed_pad==-1) */ int -dozap() +dozap(void) { struct obj *obj; int damage, need_dir; @@ -2374,8 +2336,7 @@ dozap() /* Lock or unlock all boxes in inventory */ static void -boxlock_invent(obj) -struct obj *obj; +boxlock_invent(struct obj *obj) { struct obj *otmp; boolean boxing = FALSE; @@ -2391,9 +2352,7 @@ struct obj *obj; } int -zapyourself(obj, ordinary) -struct obj *obj; -boolean ordinary; +zapyourself(struct obj *obj, boolean ordinary) { boolean learn_it = FALSE; int damage = 0; @@ -2697,8 +2656,7 @@ boolean ordinary; /* called when poly'd hero uses breath attack against self */ void -ubreatheu(mattk) -struct attack *mattk; +ubreatheu(struct attack *mattk) { int dtyp = 20 + mattk->adtyp - 1; /* breath by hero */ const char *fltxt = flash_types[dtyp]; /* blast of */ @@ -2708,10 +2666,10 @@ struct attack *mattk; /* light damages hero in gremlin form */ int -lightdamage(obj, ordinary, amt) -struct obj *obj; /* item making light (fake book if spell) */ -boolean ordinary; /* wand/camera zap vs wand destruction */ -int amt; /* pseudo-damage used to determine blindness duration */ +lightdamage(struct obj *obj, /* item making light (fake book if spell) */ + boolean ordinary, /* wand/camera zap vs wand destruction */ + int amt) /* pseudo-damage used to determine blindness + duration */ { char buf[BUFSZ]; const char *how; @@ -2742,8 +2700,7 @@ int amt; /* pseudo-damage used to determine blindness duration */ /* light[ning] causes blindness */ boolean -flashburn(duration) -long duration; +flashburn(long duration) { if (!resists_blnd(&g.youmonst)) { You(are_blinded_by_the_flash); @@ -2760,8 +2717,7 @@ long duration; * Return FALSE if the steed was not hit by the wand. */ static boolean -zap_steed(obj) -struct obj *obj; /* wand or spell */ +zap_steed(struct obj *obj) /* wand or spell */ { int steedhit = FALSE; @@ -2824,10 +2780,8 @@ struct obj *obj; /* wand or spell */ * themselves with cancellation. */ boolean -cancel_monst(mdef, obj, youattack, allow_cancel_kill, self_cancel) -register struct monst *mdef; -register struct obj *obj; -boolean youattack, allow_cancel_kill, self_cancel; +cancel_monst(struct monst *mdef, struct obj *obj, boolean youattack, + boolean allow_cancel_kill, boolean self_cancel) { static const char writing_vanishes[] = "Some writing vanishes from %s head!", @@ -2906,8 +2860,7 @@ boolean youattack, allow_cancel_kill, self_cancel; /* you've zapped an immediate type wand up or down */ static boolean -zap_updown(obj) -struct obj *obj; /* wand or spell */ +zap_updown(struct obj *obj) /* wand or spell */ { boolean striking = FALSE, disclose = FALSE; int x, y, xx, yy, ptmp; @@ -3115,13 +3068,13 @@ struct obj *obj; /* wand or spell */ /* used by do_break_wand() was well as by weffects() */ void -zapsetup() +zapsetup(void) { g.obj_zapped = FALSE; } void -zapwrapup() +zapwrapup(void) { /* if do_osshock() set obj_zapped while polying, give a message now */ if (g.obj_zapped) @@ -3131,8 +3084,7 @@ zapwrapup() /* called for various wand and spell effects - M. Stephenson */ void -weffects(obj) -struct obj *obj; +weffects(struct obj *obj) { int otyp = obj->otyp; boolean disclose = FALSE, was_unkn = !objects[otyp].oc_name_known; @@ -3182,8 +3134,7 @@ struct obj *obj; /* augment damage for a spell dased on the hero's intelligence (and level) */ int -spell_damage_bonus(dmg) -int dmg; /* base amount to be adjusted by bonus or penalty */ +spell_damage_bonus(int dmg) /* base amount to be adjusted by bonus or penalty */ { int intell = ACURR(A_INT); @@ -3211,8 +3162,7 @@ int dmg; /* base amount to be adjusted by bonus or penalty */ * spell class and dexterity. */ static int -spell_hit_bonus(skill) -int skill; +spell_hit_bonus(int skill) { int hit_bon = 0; int dex = ACURR(A_DEX); @@ -3250,8 +3200,7 @@ int skill; } const char * -exclam(force) -int force; +exclam(int force) { /* force == 0 occurs e.g. with sleep ray */ /* note that large force is usual with wands so that !! would @@ -3260,10 +3209,8 @@ int force; } void -hit(str, mtmp, force) -const char *str; -struct monst *mtmp; -const char *force; /* usually either "." or "!" */ +hit(const char *str, struct monst *mtmp, + const char *force) /* usually either "." or "!" */ { if ((!cansee(g.bhitpos.x, g.bhitpos.y) && !canspotmon(mtmp) && !(u.uswallow && mtmp == u.ustuck)) || !flags.verbose) @@ -3274,9 +3221,7 @@ const char *force; /* usually either "." or "!" */ } void -miss(str, mtmp) -register const char *str; -register struct monst *mtmp; +miss(const char *str, struct monst *mtmp) { pline( "%s %s %s.", The(str), vtense(str, "miss"), @@ -3286,8 +3231,7 @@ register struct monst *mtmp; } static void -skiprange(range, skipstart, skipend) -int range, *skipstart, *skipend; +skiprange(int range, int *skipstart, int *skipend) { int tr = (range / 4); int tmp = range - ((tr > 0) ? rnd(tr) : 0); @@ -3320,13 +3264,12 @@ int range, *skipstart, *skipend; * one is revealed for a weapon, but if not a weapon is left up to fhitm(). */ struct monst * -bhit(ddx, ddy, range, weapon, fhitm, fhito, pobj) -register int ddx, ddy, range; /* direction and range */ -enum bhit_call_types weapon; /* defined in hack.h */ -int FDECL((*fhitm), (MONST_P, OBJ_P)), /* fns called when mon/obj hit */ - FDECL((*fhito), (OBJ_P, OBJ_P)); -struct obj **pobj; /* object tossed/used, set to NULL - * if object is destroyed */ +bhit(int ddx, int ddy, int range, /* direction and range */ + enum bhit_call_types weapon, /* defined in hack.h */ + int (*fhitm)(MONST_P, OBJ_P), /* fns called when mon/obj hit */ + int (*fhito)(OBJ_P, OBJ_P), + struct obj **pobj) /* object tossed/used, set to NULL + if object is destroyed */ { struct monst *mtmp, *result = (struct monst *) 0; struct obj *obj = *pobj; @@ -3630,9 +3573,7 @@ struct obj **pobj; /* object tossed/used, set to NULL * is too obviously silly. */ struct monst * -boomhit(obj, dx, dy) -struct obj *obj; -int dx, dy; +boomhit(struct obj *obj, int dx, int dy) { register int i, ct; int boom; /* showsym[] index */ @@ -3710,10 +3651,8 @@ int dx, dy; /* used by buzz(); also used by munslime(muse.c); returns damage applied to mon; note: caller is responsible for killing mon if damage is fatal */ int -zhitm(mon, type, nd, ootmp) -register struct monst *mon; -register int type, nd; -struct obj **ootmp; /* to return worn armor for caller to disintegrate */ +zhitm(struct monst *mon, int type, int nd, + struct obj **ootmp) /* to return worn armor for caller to disintegrate */ { register int tmp = 0; register int abstype = abs(type) % 10; @@ -3874,10 +3813,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */ } static void -zhitu(type, nd, fltxt, sx, sy) -int type, nd; -const char *fltxt; -xchar sx, sy; +zhitu(int type, int nd, const char *fltxt, xchar sx, xchar sy) { int dam = 0, abstyp = abs(type); @@ -4017,10 +3953,10 @@ xchar sx, sy; * at position x,y; return the number of objects burned */ int -burn_floor_objects(x, y, give_feedback, u_caused) -int x, y; -boolean give_feedback; /* caller needs to decide about visibility checks */ -boolean u_caused; +burn_floor_objects(int x, int y, + boolean give_feedback, /* caller needs to decide about + visibility checks */ + boolean u_caused) { struct obj *obj, *obj2; long i, scrquan, delquan; @@ -4078,9 +4014,8 @@ boolean u_caused; /* will zap/spell/breath attack score a hit against armor class `ac'? */ static int -zap_hit(ac, type) -int ac; -int type; /* either hero cast spell type or 0 */ +zap_hit(int ac, + int type) /* either hero cast spell type or 0 */ { int chance = rn2(20); int spell_bonus = type ? spell_hit_bonus(type) : 0; @@ -4096,10 +4031,9 @@ int type; /* either hero cast spell type or 0 */ } static void -disintegrate_mon(mon, type, fltxt) -struct monst *mon; -int type; /* hero vs other */ -const char *fltxt; +disintegrate_mon(struct monst *mon, + int type, /* hero vs other */ + const char *fltxt) { struct obj *otmp, *otmp2, *m_amulet = mlifesaver(mon); @@ -4141,10 +4075,7 @@ const char *fltxt; } void -buzz(type, nd, sx, sy, dx, dy) -int type, nd; -xchar sx, sy; -int dx, dy; +buzz(int type, int nd, xchar sx, xchar sy, int dx, int dy) { dobuzz(type, nd, sx, sy, dx, dy, TRUE); } @@ -4159,11 +4090,8 @@ int dx, dy; * called with dx = dy = 0 with vertical bolts */ void -dobuzz(type, nd, sx, sy, dx, dy, say) -register int type, nd; -register xchar sx, sy; -register int dx, dy; -boolean say; /* Announce out of sight hit/miss events if true */ +dobuzz(int type, int nd, xchar sx, xchar sy, int dx, int dy, + boolean say) /* Announce out of sight hit/miss events if true */ { int range, abstype = abs(type) % 10; register xchar lsx, lsy; @@ -4430,9 +4358,7 @@ boolean say; /* Announce out of sight hit/miss events if true */ } void -melt_ice(x, y, msg) -xchar x, y; -const char *msg; +melt_ice(xchar x, xchar y, const char *msg) { struct rm *lev = &levl[x][y]; struct obj *otmp; @@ -4485,9 +4411,9 @@ const char *msg; * permanent instead. */ void -start_melt_ice_timeout(x, y, min_time) -xchar x, y; -long min_time; /* 's old melt timeout (deleted by time we get here) */ +start_melt_ice_timeout(xchar x, xchar y, + long min_time) /* 's old melt timeout (deleted by + time we get here) */ { int when; long where; @@ -4516,9 +4442,7 @@ long min_time; /* 's old melt timeout (deleted by time we get here) */ * Called when ice has melted completely away. */ void -melt_ice_away(arg, timeout) -anything *arg; -long timeout UNUSED; +melt_ice_away(anything *arg, long timeout UNUSED) { xchar x, y; long where = arg->a_long; @@ -4539,11 +4463,8 @@ long timeout UNUSED; * amount by which range is reduced (the latter is just ignored by fireballs) */ int -zap_over_floor(x, y, type, shopdamage, exploding_wand_typ) -xchar x, y; -int type; -boolean *shopdamage; -short exploding_wand_typ; +zap_over_floor(xchar x, xchar y, int type, boolean *shopdamage, + short exploding_wand_typ) { const char *zapverb; struct monst *mon; @@ -4844,8 +4765,7 @@ short exploding_wand_typ; /* fractured by pick-axe or wand of striking */ void -fracture_rock(obj) -register struct obj *obj; /* no texts here! */ +fracture_rock(struct obj *obj) /* no texts here! */ { xchar x, y; boolean by_you = !g.context.mon_moving; @@ -4888,8 +4808,7 @@ register struct obj *obj; /* no texts here! */ /* handle statue hit by striking/force bolt/pick-axe */ boolean -break_statue(obj) -register struct obj *obj; +break_statue(struct obj *obj) { /* [obj is assumed to be on floor, so no get_obj_location() needed] */ struct trap *trap = t_at(obj->ox, obj->oy); @@ -4939,9 +4858,7 @@ const char *const destroy_strings[][3] = { /* guts of destroy_item(), which ought to be called maybe_destroy_items(); caller must decide whether obj is eligible */ static void -destroy_one_item(obj, osym, dmgtyp) -struct obj *obj; -int osym, dmgtyp; +destroy_one_item(struct obj *obj, int osym, int dmgtyp) { long i, cnt, quan; int dmg, xresist, skip, dindx; @@ -5086,8 +5003,7 @@ int osym, dmgtyp; /* target items of specified class for possible destruction */ void -destroy_item(osym, dmgtyp) -int osym, dmgtyp; +destroy_item(int osym, int dmgtyp) { register struct obj *obj; int i, deferral_indx = 0; @@ -5168,9 +5084,7 @@ int osym, dmgtyp; } int -destroy_mitem(mtmp, osym, dmgtyp) -struct monst *mtmp; -int osym, dmgtyp; +destroy_mitem(struct monst *mtmp, int osym, int dmgtyp) { struct obj *obj; int skip, tmp = 0; @@ -5288,10 +5202,7 @@ int osym, dmgtyp; } int -resist(mtmp, oclass, damage, tell) -struct monst *mtmp; -char oclass; -int damage, tell; +resist(struct monst *mtmp, char oclass, int damage, int tell) { int resisted; int alev, dlev; @@ -5356,8 +5267,7 @@ int damage, tell; #define MAXWISHTRY 5 static void -wishcmdassist(triesleft) -int triesleft; +wishcmdassist(int triesleft) { static NEARDATA const char * wishinfo[] = { @@ -5414,7 +5324,7 @@ int triesleft; } void -makewish() +makewish(void) { char buf[BUFSZ] = DUMMY; char promptbuf[BUFSZ]; diff --git a/sys/libnh/libnhmain.c b/sys/libnh/libnhmain.c index 0fec1cd6e..a8df203f7 100644 --- a/sys/libnh/libnhmain.c +++ b/sys/libnh/libnhmain.c @@ -27,46 +27,42 @@ void js_globals_init(); #if !defined(_BULL_SOURCE) && !defined(__sgi) && !defined(_M_UNIX) #if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__)) #if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX) -extern struct passwd *FDECL(getpwuid, (uid_t)); +extern struct passwd *getpwuid(uid_t); #else -extern struct passwd *FDECL(getpwuid, (int)); +extern struct passwd *getpwuid, (int); #endif #endif #endif -extern struct passwd *FDECL(getpwnam, (const char *)); +extern struct passwd *getpwnam(const char *); #ifdef CHDIR -static void FDECL(chdirx, (const char *, BOOLEAN_P)); +static void chdirx(const char *, boolean); #endif /* CHDIR */ -static boolean NDECL(whoami); -static void FDECL(process_options, (int, char **)); +static boolean whoami(void); +static void process_options(int, char **); #ifdef _M_UNIX -extern void NDECL(check_sco_console); -extern void NDECL(init_sco_cons); +extern void check_sco_console(void); +extern void init_sco_cons(void); #endif #ifdef __linux__ -extern void NDECL(check_linux_console); -extern void NDECL(init_linux_cons); +extern void check_linux_console(void); +extern void init_linux_cons(void); #endif -static void NDECL(wd_message); +static void wd_message(void); static boolean wiz_error_flag = FALSE; -static struct passwd *NDECL(get_unix_pw); +static struct passwd *get_unix_pw(void); #ifdef __EMSCRIPTEN__ /* if WebAssembly, export this API and don't optimize it out */ EMSCRIPTEN_KEEPALIVE int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) #else /* !__EMSCRIPTEN__ */ int -nhmain(argc, argv) -int argc; -char *argv[]; +nhmain(int argc, char *argv[]) #endif /* __EMSCRIPTEN__ */ { @@ -342,9 +338,7 @@ char *argv[]; /* caveat: argv elements might be arbitrary long */ static void -process_options(argc, argv) -int argc; -char *argv[]; +process_options(int argc, char *argv[]) { int i, l; @@ -464,9 +458,7 @@ char *argv[]; #ifdef CHDIR static void -chdirx(dir, wr) -const char *dir; -boolean wr; +chdirx(const char *dir, boolean wr) { if (dir /* User specified directory? */ #ifdef HACKDIR @@ -524,7 +516,7 @@ boolean wr; /* returns True iff we set plname[] to username which contains a hyphen */ static boolean -whoami() +whoami(void) { /* * Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS @@ -557,8 +549,7 @@ whoami() #ifndef NO_SIGNAL void -sethanguphandler(handler) -void FDECL((*handler), (int)); +sethanguphandler(void (*handler)(int)) { #ifdef SA_RESTART /* don't want reads to restart. If SA_RESTART is defined, we know @@ -586,7 +577,7 @@ void FDECL((*handler), (int)); #ifdef PORT_HELP void -port_help() +port_help(void) { /* * Display unix-specific help. Just show contents of the helpfile @@ -598,7 +589,7 @@ port_help() /* validate wizard mode if player has requested access to it */ boolean -authorize_wizard_mode() +authorize_wizard_mode(void) { struct passwd *pw = get_unix_pw(); @@ -611,7 +602,7 @@ authorize_wizard_mode() } static void -wd_message() +wd_message(void) { if (wiz_error_flag) { if (sysopt.wizards && sysopt.wizards[0]) { @@ -631,8 +622,7 @@ wd_message() * be room for the / */ void -append_slash(name) -char *name; +append_slash(char *name) { char *ptr; @@ -647,8 +637,7 @@ char *name; } boolean -check_user_string(optstr) -const char *optstr; +check_user_string(const char *optstr) { struct passwd *pw; int pwlen; @@ -684,7 +673,7 @@ const char *optstr; } static struct passwd * -get_unix_pw() +get_unix_pw(void) { char *user; unsigned uid; @@ -715,7 +704,7 @@ get_unix_pw() } char * -get_login_name() +get_login_name(void) { static char buf[BUFSZ]; struct passwd *pw = get_unix_pw(); @@ -728,7 +717,7 @@ get_login_name() } unsigned long -sys_random_seed() +sys_random_seed(void) { unsigned long seed = 0L; unsigned long pid = (unsigned long) getpid(); diff --git a/sys/msdos/msdos.c b/sys/msdos/msdos.c index 0892566b9..564e79da2 100644 --- a/sys/msdos/msdos.c +++ b/sys/msdos/msdos.c @@ -45,22 +45,25 @@ #define GETKEYFLAGS 0x02 /* Get Keyboard Flags */ /*#define KEY_DEBUG */ /* print values of unexpected key codes - devel*/ -void FDECL(get_cursor, (int *, int *)); +void get_cursor(int *, int *); /* direct bios calls are used only when iflags.BIOS is set */ -static char NDECL(DOSgetch); -static char NDECL(BIOSgetch); +static char DOSgetch(void); +static char BIOSgetch(void); +/* static long freediskspace(char *path); */ +unsigned long sys_random_seed(void); + #ifndef __GO32__ -static char *NDECL(getdta); +static char *getdta(void); #endif -static unsigned int FDECL(dos_ioctl, (int, int, unsigned)); +static unsigned int dos_ioctl(int, int, unsigned); #ifdef USE_TILES -extern boolean FDECL(pckeys, (unsigned char, unsigned char)); /* pckeys.c */ +extern boolean pckeys(unsigned char, unsigned char); /* pckeys.c */ #endif int -tgetch() +tgetch(void) { char ch; @@ -249,7 +252,7 @@ static const char numeric_scanmap[] = { /* ... */ #endif /* PC9800 */ static char -BIOSgetch() +BIOSgetch(void) { unsigned char scan, shift, ch = 0; const struct pad *kpad; @@ -309,7 +312,7 @@ BIOSgetch() } static char -DOSgetch() +DOSgetch(void) { union REGS regs; char ch; @@ -348,7 +351,7 @@ DOSgetch() } char -switchar() +switchar(void) { union REGS regs; @@ -357,9 +360,9 @@ switchar() return regs.h.dl; } -long -freediskspace(path) -char *path; +#if 0 +static long +freediskspace(char *path) { union REGS regs; @@ -374,14 +377,14 @@ char *path; else return ((long) regs.x.bx * regs.x.cx * regs.x.ax); } +#endif /* 0 */ #ifndef __GO32__ /* * Functions to get filenames using wildcards */ int -findfirst_file(path) -char *path; +findfirst_file(char *path) { union REGS regs; struct SREGS sregs; @@ -395,7 +398,7 @@ char *path; } int -findnext_file() +findnext_file(void) { union REGS regs; @@ -405,14 +408,14 @@ findnext_file() } char * -foundfile_buffer() +foundfile_buffer(void) { return (getdta() + 30); } /* Get disk transfer area */ static char * -getdta() +getdta(void) { union REGS regs; struct SREGS sregs; @@ -430,8 +433,7 @@ getdta() } long -filesize_nh(file) -char *file; +filesize_nh(char *file) { char *dta; @@ -448,8 +450,7 @@ char *file; * Chdrive() changes the default drive. */ void -chdrive(str) -char *str; +chdrive(char *str) { #define SELECTDISK 0x0E char *ptr; @@ -482,7 +483,7 @@ char *str; static unsigned int old_stdin, old_stdout; void -disable_ctrlP() +disable_ctrlP(void) { if (!iflags.rawio) return; @@ -497,7 +498,7 @@ disable_ctrlP() } void -enable_ctrlP() +enable_ctrlP(void) { if (!iflags.rawio) return; @@ -509,9 +510,7 @@ enable_ctrlP() } static unsigned int -dos_ioctl(handle, mode, setvalue) -int handle, mode; -unsigned setvalue; +dos_ioctl(int handle, int mode, unsigned setvalue) { union REGS regs; @@ -525,7 +524,7 @@ unsigned setvalue; } unsigned long -sys_random_seed(VOID_ARGS) +sys_random_seed(void) { unsigned long ourseed = 0UL; time_t datetime = 0; diff --git a/sys/msdos/pckeys.c b/sys/msdos/pckeys.c index 224c031d6..b7f44c7cb 100644 --- a/sys/msdos/pckeys.c +++ b/sys/msdos/pckeys.c @@ -13,11 +13,11 @@ #include "wintty.h" #include "pcvideo.h" -boolean FDECL(pckeys, (unsigned char, unsigned char)); -static void FDECL(userpan, (BOOLEAN_P)); -static void FDECL(overview, (BOOLEAN_P)); -static void FDECL(traditional, (BOOLEAN_P)); -static void NDECL(refresh); +boolean pckeys(unsigned char, unsigned char); +static void userpan(boolean); +static void overview(boolean); +static void traditional(boolean); +static void refresh(void); extern struct WinDesc *wins[MAXWIN]; /* from wintty.c */ extern boolean inmap; /* from video.c */ @@ -32,9 +32,7 @@ extern boolean inmap; /* from video.c */ * */ boolean -pckeys(scancode, shift) -unsigned char scancode; -unsigned char shift; +pckeys(unsigned char scancode, unsigned char shift) { boolean opening_dialog; @@ -78,8 +76,7 @@ unsigned char shift; } static void -userpan(on) -boolean on; +userpan(boolean on) { #ifdef SCREEN_VGA if (iflags.usevga) @@ -92,8 +89,7 @@ boolean on; } static void -overview(on) -boolean on; +overview(boolean on) { #ifdef SCREEN_VGA if (iflags.usevga) @@ -106,8 +102,7 @@ boolean on; } static void -traditional(on) -boolean on; +traditional(boolean on) { #ifdef SCREEN_VGA if (iflags.usevga) @@ -120,7 +115,7 @@ boolean on; } static void -refresh() +refresh(void) { #ifdef SCREEN_VGA if (iflags.usevga) diff --git a/sys/msdos/pctiles.c b/sys/msdos/pctiles.c index b7c7d7e4f..5609db1be 100644 --- a/sys/msdos/pctiles.c +++ b/sys/msdos/pctiles.c @@ -54,9 +54,7 @@ extern int total_tiles_used; /* tile.c */ * */ int -ReadTileFileHeader(tibhdr, filestyle) -struct tibhdr_struct *tibhdr; -boolean filestyle; +ReadTileFileHeader(struct tibhdr_struct *tibhdr, boolean filestyle) { FILE *x; x = filestyle ? tilefile_O : tilefile; @@ -85,9 +83,7 @@ boolean filestyle; * */ int -OpenTileFile(tilefilename, filestyle) -char *tilefilename; -boolean filestyle; +OpenTileFile(char *tilefilename, boolean filestyle) { #ifdef TILES_IN_RAM int k; @@ -150,8 +146,7 @@ boolean filestyle; } void -CloseTileFile(filestyle) -boolean filestyle; +CloseTileFile(boolean filestyle) { fclose(filestyle ? tilefile_O : tilefile); #ifdef TILES_IN_RAM @@ -191,9 +186,7 @@ struct overview_planar_cell_struct oplancell; */ #ifdef PLANAR_FILE int -ReadPlanarTileFile(tilenum, gp) -int tilenum; -struct planar_cell_struct **gp; +ReadPlanarTileFile(int tilenum, struct planar_cell_struct **gp) { long fpos; @@ -214,9 +207,7 @@ struct planar_cell_struct **gp; return 0; } int -ReadPlanarTileFile_O(tilenum, gp) -int tilenum; -struct overview_planar_cell_struct **gp; +ReadPlanarTileFile_O(int tilenum, struct overview_planar_cell_struct **gp) { long fpos; @@ -242,9 +233,7 @@ struct overview_planar_cell_struct **gp; #ifdef PACKED_FILE int -ReadPackedTileFile(tilenum, pta) -int tilenum; -char (*pta)[TILE_X]; +ReadPackedTileFile(int tilenum, char (*pta)[TILE_X]) { long fpos; diff --git a/sys/msdos/pctiles.h b/sys/msdos/pctiles.h index 7fb7f7e3b..eb6dab602 100644 --- a/sys/msdos/pctiles.h +++ b/sys/msdos/pctiles.h @@ -45,20 +45,19 @@ struct tibhdr_struct { * char packtile[TILE_Y][TILE_X]; */ -extern void FDECL(CloseTileFile, (BOOLEAN_P)); -extern int FDECL(OpenTileFile, (char *, BOOLEAN_P)); -extern int FDECL(ReadTileFileHeader, (struct tibhdr_struct *, BOOLEAN_P)); +extern void CloseTileFile(boolean); +extern int OpenTileFile(char *, boolean); +extern int ReadTileFileHeader(struct tibhdr_struct *, boolean); #ifdef PLANAR_FILE #ifdef SCREEN_VGA -extern int FDECL(ReadPlanarTileFile, (int, struct planar_cell_struct **)); -extern int FDECL(ReadPlanarTileFile_O, - (int, struct overview_planar_cell_struct **)); +extern int ReadPlanarTileFile(int, struct planar_cell_struct **); +extern int ReadPlanarTileFile_O(int, struct overview_planar_cell_struct **); #endif #endif #ifdef PACKED_FILE -extern int FDECL(ReadPackedTileFile, (int, char (*)[TILE_X])); +extern int ReadPackedTileFile(int, char (*)[TILE_X]); #endif extern short glyph2tile[MAX_GLYPH]; /* in tile.c (made from tilemap.c) */ diff --git a/sys/msdos/pcvideo.h b/sys/msdos/pcvideo.h index 1b21c652f..5653296be 100644 --- a/sys/msdos/pcvideo.h +++ b/sys/msdos/pcvideo.h @@ -22,7 +22,7 @@ #endif #ifdef SCREEN_DJGPPFAST -/*# define MONO_CHECK /* djgpp should be able to do check */ +/*# define MONO_CHECK */ /* djgpp should be able to do check */ #endif /* @@ -66,14 +66,14 @@ * VGA Specific Stuff */ #ifdef SCREEN_VGA -/* #define HW_PANNING /* Hardware panning enabled */ +/* #define HW_PANNING */ /* Hardware panning enabled */ #define USHORT unsigned short #define MODE640x480 0x0012 /* Switch to VGA 640 x 480 Graphics mode */ #define MODETEXT 0x0003 /* Switch to Text mode 3 */ #ifdef HW_PANNING #define PIXELINC 16 /* How much to increment by when panning */ -/*#define PIXELINC 1 /* How much to increment by when panning */ +/*#define PIXELINC 1 */ /* How much to increment by when panning */ #define SCREENBYTES 128 #define CharRows 30 #define VERT_RETRACE \ @@ -227,96 +227,92 @@ extern int cursor_color; * */ -#define E extern - /* ### video.c ### */ #ifdef SIMULATE_CURSOR -E void NDECL(DrawCursor); -E void NDECL(HideCursor); +extern void DrawCursor(void); +extern void HideCursor(void); #endif /* ### vidtxt.c ### */ #ifdef NO_TERMS -E void NDECL(txt_backsp); -E void NDECL(txt_clear_screen); -E void FDECL(txt_cl_end, (int, int)); -E void NDECL(txt_cl_eos); -E void NDECL(txt_get_scr_size); -E void FDECL(txt_gotoxy, (int, int)); -E int NDECL(txt_monoadapt_check); -E void NDECL(txt_nhbell); -E void FDECL(txt_startup, (int *, int *)); -E void FDECL(txt_xputs, (const char *, int, int)); -E void FDECL(txt_xputc, (CHAR_P, int)); +extern void txt_backsp(void); +extern void txt_clear_screen(void); +extern void txt_cl_end(int, int); +extern void txt_cl_eos(void); +extern void txt_get_scr_size(void); +extern void txt_gotoxy(int, int); +extern int txt_monoadapt_check(void); +extern void txt_nhbell(void); +extern void txt_startup(int *, int *); +extern void txt_xputs(const char *, int, int); +extern void txt_xputc(char, int); /* ### vidvga.c ### */ enum vga_pan_direction { pan_left, pan_up, pan_right, pan_down }; #ifdef SCREEN_VGA -E void NDECL(vga_backsp); -E void FDECL(vga_clear_screen, (int)); -E void FDECL(vga_cl_end, (int, int)); -E void FDECL(vga_cl_eos, (int)); -E int NDECL(vga_detect); +extern void vga_backsp(void); +extern void vga_clear_screen(int); +extern void vga_cl_end(int, int); +extern void vga_cl_eos(int); +extern int vga_detect(void); #ifdef SIMULATE_CURSOR -E void NDECL(vga_DrawCursor); +extern void vga_DrawCursor(void); #endif -E void NDECL(vga_Finish); -E char __far *NDECL(vga_FontPtrs); -E void NDECL(vga_get_scr_size); -E void FDECL(vga_gotoloc, (int, int)); +extern void vga_Finish(void); +extern char __far *vga_FontPtrs(void); +extern void vga_get_scr_size(void); +extern void vga_gotoloc(int, int); #ifdef POSITIONBAR -E void FDECL(vga_update_positionbar, (char *)); +extern void vga_update_positionbar(char *); #endif #ifdef SIMULATE_CURSOR -E void NDECL(vga_HideCursor); +extern void vga_HideCursor(void); #endif -E void NDECL(vga_Init); -E void NDECL(vga_tty_end_screen); -E void FDECL(vga_tty_startup, (int *, int *)); -E void FDECL(vga_xputs, (const char *, int, int)); -E void FDECL(vga_xputc, (CHAR_P, int)); -E void FDECL(vga_xputg, (int, int, unsigned)); -E void FDECL(vga_userpan, (enum vga_pan_direction)); -E void FDECL(vga_overview, (BOOLEAN_P)); -E void FDECL(vga_traditional, (BOOLEAN_P)); -E void NDECL(vga_refresh); +extern void vga_Init(void); +extern void vga_tty_end_screen(void); +extern void vga_tty_startup(int *, int *); +extern void vga_xputs(const char *, int, int); +extern void vga_xputc(char, int); +extern void vga_xputg(int, int, unsigned); +extern void vga_userpan(enum vga_pan_direction); +extern void vga_overview(boolean); +extern void vga_traditional(boolean); +extern void vga_refresh(void); #endif /* SCREEN_VGA */ #ifdef SCREEN_VESA -E void NDECL(vesa_backsp); -E void FDECL(vesa_clear_screen, (int)); -E void FDECL(vesa_cl_end, (int, int)); -E void FDECL(vesa_cl_eos, (int)); -E int NDECL(vesa_detect); +extern void vesa_backsp(void); +extern void vesa_clear_screen(int); +extern void vesa_cl_end(int, int); +extern void vesa_cl_eos(int); +extern int vesa_detect(void); #ifdef SIMULATE_CURSOR -E void NDECL(vesa_DrawCursor); +extern void vesa_DrawCursor(void); #endif -E void NDECL(vesa_Finish); -E void NDECL(vesa_get_scr_size); -E void FDECL(vesa_gotoloc, (int, int)); +extern void vesa_Finish(void); +extern void vesa_get_scr_size(void); +extern void vesa_gotoloc(int, int); #ifdef POSITIONBAR -E void FDECL(vesa_update_positionbar, (char *)); +extern void vesa_update_positionbar(char *); #endif #ifdef SIMULATE_CURSOR -E void NDECL(vesa_HideCursor); +extern void vesa_HideCursor(void); #endif -E void NDECL(vesa_Init); -E void NDECL(vesa_tty_end_screen); -E void FDECL(vesa_tty_startup, (int *, int *)); -E void FDECL(vesa_xputs, (const char *, int, int)); -E void FDECL(vesa_xputc, (CHAR_P, int)); -E void FDECL(vesa_xputg, (int, int, unsigned)); -E void FDECL(vesa_userpan, (enum vga_pan_direction)); -E void FDECL(vesa_overview, (BOOLEAN_P)); -E void FDECL(vesa_traditional, (BOOLEAN_P)); -E void NDECL(vesa_refresh); -E void NDECL(vesa_flush_text); +extern void vesa_Init(void); +extern void vesa_tty_end_screen(void); +extern void vesa_tty_startup(int *, int *); +extern void vesa_xputs(const char *, int, int); +extern void vesa_xputc(char, int); +extern void vesa_xputg(int, int, unsigned); +extern void vesa_userpan(enum vga_pan_direction); +extern void vesa_overview(boolean); +extern void vesa_traditional(boolean); +extern void vesa_refresh(void); +extern void vesa_flush_text(void); #endif /* SCREEN_VESA */ #endif /* NO_TERMS */ -#undef E - #endif /* PCVIDEO_H */ /* pcvideo.h */ diff --git a/sys/msdos/tile2bin.c b/sys/msdos/tile2bin.c index a0b415291..fea00b15e 100644 --- a/sys/msdos/tile2bin.c +++ b/sys/msdos/tile2bin.c @@ -44,7 +44,7 @@ extern unsigned _stklen = STKSIZ; #undef PACKED_FILE #endif -extern char *FDECL(tilename, (int, int)); +extern char *tilename(int, int); #ifdef PLANAR_FILE char masktable[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; @@ -66,10 +66,10 @@ int num_colors; pixel pixels[TILE_Y][TILE_X]; struct tibhdr_struct tibheader; -static void FDECL(write_tibtile, (int)); -static void FDECL(write_tibheader, (FILE *, struct tibhdr_struct *)); -static void FDECL(build_tibtile, (pixel(*) [TILE_X], BOOLEAN_P)); -static void NDECL(remap_colors); +static void write_tibtile(int); +static void write_tibheader(FILE *, struct tibhdr_struct *); +static void build_tibtile(pixel(*) [TILE_X], boolean); +static void remap_colors(void); #ifndef OVERVIEW_FILE char *tilefiles[] = { "../win/share/monsters.txt", "../win/share/objects.txt", @@ -84,9 +84,7 @@ int filenum; int paletteflag; int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { int i; struct tm *newtime; @@ -223,9 +221,7 @@ char *argv[]; } static void -write_tibheader(fileptr, tibhdr) -FILE *fileptr; -struct tibhdr_struct *tibhdr; +write_tibheader(FILE *fileptr, struct tibhdr_struct *tibhdr) { if (fseek(fileptr, 0L, SEEK_SET)) { Fprintf(stderr, "Error writing header to tile file\n"); @@ -234,9 +230,7 @@ struct tibhdr_struct *tibhdr; } static void -build_tibtile(pixels, statues) -pixel (*pixels)[TILE_X]; -boolean statues; +build_tibtile(pixel (*pixels)[TILE_X], boolean statues) { static int graymappings[] = { /* . A B C D E F G H I J K L M N O P */ @@ -314,8 +308,7 @@ boolean statues; } static void -write_tibtile(recnum) -int recnum; +write_tibtile(int recnum) { long fpos; @@ -352,7 +345,7 @@ int recnum; } static void -remap_colors() +remap_colors(void) { char swap; diff --git a/sys/msdos/video.c b/sys/msdos/video.c index 0ab576f14..007e238dd 100644 --- a/sys/msdos/video.c +++ b/sys/msdos/video.c @@ -73,7 +73,7 @@ */ void -get_scr_size() +get_scr_size(void) { #ifdef SCREEN_VGA if (iflags.usevga) { @@ -116,13 +116,13 @@ typedef long clock_t; #endif #ifdef SCREEN_BIOS -void FDECL(get_cursor, (int *, int *)); +void get_cursor(int *, int *); #endif -void FDECL(adjust_cursor_flags, (struct WinDesc *)); -void FDECL(cmov, (int, int)); -void FDECL(nocmov, (int, int)); -static void NDECL(init_ttycolor); +void adjust_cursor_flags(struct WinDesc *); +void cmov(int, int); +void nocmov(int, int); +static void init_ttycolor(void); int savevmode; /* store the original video mode in here */ int curcol, currow; /* graphics mode current cursor locations */ @@ -139,7 +139,7 @@ char ttycolors[CLR_MAX]; /* also used/set in options.c */ #endif /* TEXTCOLOR */ void -backsp() +backsp(void) { if (!iflags.grmode) { txt_backsp(); @@ -155,7 +155,7 @@ backsp() } void -clear_screen() +clear_screen(void) { if (!iflags.grmode) { txt_clear_screen(); @@ -170,7 +170,7 @@ clear_screen() } } -void cl_end() /* clear to end of line */ +void cl_end(void) /* clear to end of line */ { int col, row; @@ -190,7 +190,7 @@ void cl_end() /* clear to end of line */ tty_curs(BASE_WINDOW, (int) ttyDisplay->curx + 1, (int) ttyDisplay->cury); } -void cl_eos() /* clear to end of screen */ +void cl_eos(void) /* clear to end of screen */ { int cy = (int) ttyDisplay->cury + 1; @@ -209,8 +209,7 @@ void cl_eos() /* clear to end of screen */ } void -cmov(col, row) -register int col, row; +cmov(int col, int row) { ttyDisplay->cury = (uchar) row; ttyDisplay->curx = (uchar) col; @@ -241,7 +240,7 @@ has_color(int color) #endif void -home() +home(void) { tty_curs(BASE_WINDOW, 1, 0); ttyDisplay->curx = ttyDisplay->cury = (uchar) 0; @@ -259,8 +258,7 @@ home() } void -nocmov(col, row) -int col, row; +nocmov(int col, int row) { if (!iflags.grmode) { txt_gotoxy(col, row); @@ -276,13 +274,13 @@ int col, row; } void -standoutbeg() +standoutbeg(void) { g_attribute = iflags.grmode ? attrib_gr_intense : attrib_text_intense; } void -standoutend() +standoutend(void) { g_attribute = iflags.grmode ? attrib_gr_normal : attrib_text_normal; } @@ -379,7 +377,7 @@ term_start_raw_bold(void) } void -tty_delay_output() +tty_delay_output(void) { #ifdef TIMED_DELAY if (flags.nap) { @@ -391,7 +389,7 @@ tty_delay_output() } void -tty_end_screen() +tty_end_screen(void) { if (!iflags.grmode) { txt_clear_screen(); @@ -410,21 +408,19 @@ tty_end_screen() } void -tty_nhbell() +tty_nhbell(void) { txt_nhbell(); } void -tty_number_pad(state) -int state; +tty_number_pad(int state) { ++state; /* prevents compiler warning (unref. param) */ } void -tty_startup(wid, hgt) -int *wid, *hgt; +tty_startup(int *wid, int *hgt) { /* code to sense display adapter is required here - MJA */ @@ -468,7 +464,7 @@ int *wid, *hgt; } void -tty_start_screen() +tty_start_screen(void) { #ifdef PC9800 fputs("\033[>1h", stdout); @@ -478,7 +474,7 @@ tty_start_screen() } void -gr_init() +gr_init(void) { #ifdef SCREEN_VGA if (iflags.usevga) { @@ -499,7 +495,7 @@ gr_init() } void -gr_finish() +gr_finish(void) { if (iflags.grmode) { #ifdef SCREEN_VGA @@ -552,8 +548,7 @@ gr_finish() */ void -xputs(s) -const char *s; +xputs(const char *s) { int col, row; @@ -575,8 +570,7 @@ const char *s; /* same signature as 'putchar()' with potential failure result ignored */ int -xputc(ch) /* write out character (and attribute) */ -int ch; +xputc(int ch) /* write out character (and attribute) */ { int i; char attribute; @@ -599,10 +593,7 @@ int ch; } /* write out a glyph picture at current location */ -void xputg(glyphnum, ch, special) -int glyphnum; -int ch; -unsigned special; +void xputg(int glyphnum, int ch, unsigned special) { if (!iflags.grmode || !iflags.tile_view) { (void) xputc((char) ch); @@ -619,8 +610,7 @@ unsigned special; #ifdef POSITIONBAR void -video_update_positionbar(posbar) -char *posbar; +video_update_positionbar(char *posbar) { if (!iflags.grmode) return; @@ -636,8 +626,7 @@ char *posbar; #endif void -adjust_cursor_flags(cw) -struct WinDesc *cw; +adjust_cursor_flags(struct WinDesc *cw) { #ifdef SIMULATE_CURSOR #if 0 @@ -664,7 +653,7 @@ int cursor_flag; /* The check for iflags.grmode is made BEFORE calling these. */ void -DrawCursor() +DrawCursor(void) { #ifdef SCREEN_VGA if (iflags.usevga) @@ -677,7 +666,7 @@ DrawCursor() } void -HideCursor() +HideCursor(void) { #ifdef SCREEN_VGA if (iflags.usevga) @@ -720,12 +709,12 @@ HideCursor() int shadeflag; /* shades are initialized */ int colorflag; /* colors are initialized */ -char *schoice[3] = { "dark", "normal", "light" }; -char *shade[3]; +const char *schoice[3] = { "dark", "normal", "light" }; +const char *shade[3]; #endif /* VIDEOSHADES */ static void -init_ttycolor() +init_ttycolor(void) { #ifdef VIDEOSHADES if (!shadeflag) { @@ -763,7 +752,7 @@ init_ttycolor() #endif } -static int FDECL(convert_uchars, (char *, uchar *, int)); +static int convert_uchars(char *, uchar *, int); #ifdef VIDEOSHADES int assign_videoshades(char *choiceptr) @@ -872,10 +861,9 @@ assign_videocolors(char *colorvals) } static int -convert_uchars(bufp, list, size) -char *bufp; /* current pointer */ -uchar *list; /* return list */ -int size; +convert_uchars(char *bufp, /* current pointer */ + uchar *list, /* return list */ + int size) { unsigned int num = 0; int count = 0; @@ -928,8 +916,7 @@ int size; * vga (use vga adapter code) */ int -assign_video(sopt) -char *sopt; +assign_video(char *sopt) { /* * debug @@ -994,8 +981,7 @@ char *sopt; } void -tileview(enable) -boolean enable; +tileview(boolean enable) { #ifdef SCREEN_VGA if (iflags.grmode && iflags.usevga) @@ -1011,8 +997,7 @@ boolean enable; #else /* STUBVIDEO */ void -tileview(enable) -boolean enable; +tileview(boolean enable) { } #endif /* STUBVIDEO */ diff --git a/sys/msdos/vidtxt.c b/sys/msdos/vidtxt.c index 90c4cc44e..36435ae9a 100644 --- a/sys/msdos/vidtxt.c +++ b/sys/msdos/vidtxt.c @@ -24,14 +24,14 @@ #if _MSC_VER >= 700 #pragma warning(disable : 4018) /* signed/unsigned mismatch */ #pragma warning(disable : 4127) /* conditional expression is constant */ -#pragma warning(disable : 4131) /* old style declarator */ +/* #pragma warning(disable : 4131) */ /* old style declarator */ #pragma warning(disable : 4305) /* prevents complaints with MK_FP */ #pragma warning(disable : 4309) /* initializing */ #pragma warning(disable : 4759) /* prevents complaints with MK_FP */ #endif #endif -/* void FDECL(txt_xputc,(char, int)); */ /* write out character (and +/* void txt_xputc(char, int);*/ /* write out character (and attribute) */ extern int attrib_text_normal; /* text mode normal attribute */ @@ -40,7 +40,7 @@ extern int attrib_text_intense; /* text mode intense attribute */ extern int attrib_gr_intense; /* graphics mode intense attribute */ void -txt_get_scr_size() +txt_get_scr_size(void) { union REGS regs; @@ -98,10 +98,10 @@ txt_get_scr_size() #include #endif -void FDECL(txt_gotoxy, (int, int)); +void txt_gotoxy(int, int); #if defined(SCREEN_BIOS) && !defined(PC9800) -void FDECL(txt_get_cursor, (int *, int *)); +void txt_get_cursor(int *, int *); #endif #ifdef SCREEN_DJGPPFAST @@ -112,7 +112,7 @@ extern int g_attribute; /* Current attribute to use */ extern int monoflag; /* 0 = not monochrome, else monochrome */ void -txt_backsp() +txt_backsp(void) { #ifdef PC9800 union REGS regs; @@ -134,7 +134,7 @@ txt_backsp() } void -txt_nhbell() +txt_nhbell(void) { union REGS regs; @@ -146,7 +146,7 @@ txt_nhbell() } void -txt_clear_screen() +txt_clear_screen(void) /* djgpp provides ScreenClear(), but in version 1.09 it is broken * so for now we just use the BIOS Routines */ @@ -178,8 +178,8 @@ txt_clear_screen() #endif } -void txt_cl_end(col, row) /* clear to end of line */ -int col, row; +/* clear to end of line */ +void txt_cl_end(int col, int row) { union REGS regs; #ifndef PC9800 @@ -213,7 +213,7 @@ int col, row; #endif } -void txt_cl_eos() /* clear to end of screen */ +void txt_cl_eos(void) /* clear to end of screen */ { union REGS regs; #ifndef PC9800 @@ -252,8 +252,7 @@ void txt_cl_eos() /* clear to end of screen */ } void -txt_startup(wid, hgt) -int *wid, *hgt; +txt_startup(int *wid, int *hgt) { txt_get_scr_size(); *wid = CO; @@ -289,9 +288,7 @@ int *wid, *hgt; */ void -txt_xputs(s, col, row) -const char *s; -int col, row; +txt_xputs(const char *s, int col, int row) { char c; @@ -307,9 +304,8 @@ int col, row; } } -void txt_xputc(ch, attr) /* write out character (and attribute) */ -char ch; -int attr; +/* write out character (and attribute) */ +void txt_xputc(char ch, int attr) { #ifdef PC9800 union REGS regs; @@ -390,10 +386,11 @@ int attr; #if defined(SCREEN_BIOS) && !defined(PC9800) /* + * get cursor position + * * This is implemented as a macro under DJGPPFAST. */ -void txt_get_cursor(x, y) /* get cursor position */ -int *x, *y; +void txt_get_cursor(int *x, int *y) { union REGS regs; @@ -408,8 +405,7 @@ int *x, *y; #endif /* SCREEN_BIOS && !PC9800 */ void -txt_gotoxy(x, y) -int x, y; +txt_gotoxy(int x, int y) { #ifdef SCREEN_BIOS union REGS regs; @@ -445,7 +441,7 @@ int x, y; #ifdef MONO_CHECK int -txt_monoadapt_check() +txt_monoadapt_check(void) { union REGS regs; diff --git a/sys/msdos/vidvesa.c b/sys/msdos/vidvesa.c index 125cf712d..db31487e3 100644 --- a/sys/msdos/vidvesa.c +++ b/sys/msdos/vidvesa.c @@ -26,46 +26,43 @@ struct VesaCharacter { int chr; }; -static unsigned long FDECL(vesa_SetWindow, (int window, unsigned long offset)); -static unsigned long FDECL(vesa_ReadPixel32, (unsigned x, unsigned y)); -static void FDECL(vesa_WritePixel32, (unsigned x, unsigned y, - unsigned long color)); -static void FDECL(vesa_WritePixel, (unsigned x, unsigned y, unsigned color)); -static void FDECL(vesa_WritePixelRow, (unsigned long offset, - unsigned char const *p_row, unsigned p_row_size)); -static unsigned long FDECL(vesa_MakeColor, (struct Pixel)); -static void FDECL(vesa_FillRect, ( - unsigned left, unsigned top, - unsigned width, unsigned height, - unsigned color)); - -static void NDECL(vesa_redrawmap); -static void FDECL(vesa_cliparound, (int, int)); +static unsigned long vesa_SetWindow(int window, unsigned long offset); +static unsigned long vesa_ReadPixel32(unsigned x, unsigned y); +static void vesa_WritePixel32(unsigned x, unsigned y, unsigned long color); +static void vesa_WritePixel(unsigned x, unsigned y, unsigned color); +static void vesa_WritePixelRow(unsigned long offset, + unsigned char const *p_row, unsigned p_row_size); +static unsigned long vesa_MakeColor(struct Pixel); +static void vesa_FillRect(unsigned left, unsigned top, unsigned width, + unsigned height, unsigned color); + +static void vesa_redrawmap(void); +static void vesa_cliparound(int, int); #if 0 -static void FDECL(decal_packed, (const struct TileImage *tile, unsigned special)); +static void decal_packed(const struct TileImage *tile, unsigned special); #endif -static void FDECL(vesa_SwitchMode, (unsigned mode)); -static void NDECL(vesa_SetViewPort); -static boolean FDECL(vesa_SetPalette, (const struct Pixel *)); -static boolean FDECL(vesa_SetHardPalette, (const struct Pixel *)); -static boolean FDECL(vesa_SetSoftPalette, (const struct Pixel *)); -static void FDECL(vesa_DisplayCell, (int, int, int)); -static unsigned FDECL(vesa_FindMode, (unsigned long mode_addr, unsigned bits)); -static void FDECL(vesa_WriteChar, (int, int, int, int)); -static void FDECL(vesa_WriteCharXY, (int, int, int, int)); -static void FDECL(vesa_WriteCharTransparent, (int, int, int, int)); -static void FDECL(vesa_WriteTextRow, (int pixx, int pixy, - struct VesaCharacter const *t_row, unsigned t_row_width)); -static boolean FDECL(vesa_GetCharPixel, (int, unsigned, unsigned)); -static unsigned char FDECL(vesa_GetCharPixelRow, (int, unsigned, unsigned)); -static unsigned long FDECL(vesa_DoublePixels, (unsigned long)); -static unsigned long FDECL(vesa_TriplePixels, (unsigned long)); -static void FDECL(vesa_WriteStr, (const char *, int, int, int, int)); -static unsigned char __far *NDECL(vesa_FontPtrs); -static void FDECL(vesa_process_tile, (struct TileImage *tile)); +static void vesa_SwitchMode(unsigned mode); +static void vesa_SetViewPort(void); +static boolean vesa_SetPalette(const struct Pixel *); +static boolean vesa_SetHardPalette(const struct Pixel *); +static boolean vesa_SetSoftPalette(const struct Pixel *); +static void vesa_DisplayCell(int, int, int); +static unsigned vesa_FindMode(unsigned long mode_addr, unsigned bits); +static void vesa_WriteChar(int, int, int, int); +static void vesa_WriteCharXY(int, int, int, int); +static void vesa_WriteCharTransparent(int, int, int, int); +static void vesa_WriteTextRow(int pixx, int pixy, + struct VesaCharacter const *t_row, unsigned t_row_width); +static boolean vesa_GetCharPixel(int, unsigned, unsigned); +static unsigned char vesa_GetCharPixelRow(int, unsigned, unsigned); +static unsigned long vesa_DoublePixels(unsigned long); +static unsigned long vesa_TriplePixels(unsigned long); +static void vesa_WriteStr(const char *, int, int, int, int); +static unsigned char __far *vesa_FontPtrs(void); +/* static void vesa_process_tile(struct TileImage *tile); */ #ifdef POSITIONBAR -static void NDECL(positionbar); +static void positionbar(void); #endif extern int clipx, clipxmax; /* current clipping column from wintty.c */ @@ -193,9 +190,7 @@ static const struct OldModeInfo old_mode_table[] = { /* Retrieve the mode info block */ static boolean -vesa_GetModeInfo(mode, info) -unsigned mode; -struct ModeInfoBlock *info; +vesa_GetModeInfo(unsigned mode, struct ModeInfoBlock *info) { int mode_info_sel = -1; /* custodial */ int mode_info_seg; @@ -266,9 +261,7 @@ vesa_map_frame_buffer(unsigned phys_addr, unsigned size) /* Set the memory window and return the offset */ static unsigned long -vesa_SetWindow(window, offset) -int window; -unsigned long offset; +vesa_SetWindow(int window, unsigned long offset) { /* If the desired offset is already within the window, leave the window as it is and return the address based on the current window position. @@ -311,8 +304,7 @@ unsigned long offset; } static unsigned long -vesa_ReadPixel32(x, y) -unsigned x, y; +vesa_ReadPixel32(unsigned x, unsigned y) { unsigned long offset = y * vesa_scan_line + x * vesa_pixel_bytes; unsigned long addr, color; @@ -383,9 +375,7 @@ unsigned x, y; } static void -vesa_WritePixel32(x, y, color) -unsigned x, y; -unsigned long color; +vesa_WritePixel32(unsigned x, unsigned y, unsigned long color) { unsigned long offset = y * vesa_scan_line + x * vesa_pixel_bytes; unsigned long addr; @@ -451,9 +441,7 @@ unsigned long color; } static void -vesa_WritePixel(x, y, color) -unsigned x, y; -unsigned color; +vesa_WritePixel(unsigned x, unsigned y, unsigned color) { if (vesa_pixel_size == 8) { vesa_WritePixel32(x, y, color); @@ -463,10 +451,8 @@ unsigned color; } static void -vesa_WritePixelRow(offset, p_row, p_row_size) -unsigned long offset; -unsigned char const *p_row; -unsigned p_row_size; +vesa_WritePixelRow(unsigned long offset, + unsigned char const *p_row, unsigned p_row_size) { if (vesa_segment != 0) { /* Linear frame buffer in use */ @@ -489,20 +475,19 @@ unsigned p_row_size; } static unsigned long -vesa_MakeColor(p) -struct Pixel p; +vesa_MakeColor(struct Pixel p) { unsigned long r = p.r >> vesa_red_shift; - unsigned long g = p.g >> vesa_green_shift; + unsigned long gr = p.g >> vesa_green_shift; unsigned long b = p.b >> vesa_blue_shift; return (r << vesa_red_pos) - | (g << vesa_green_pos) + | (gr << vesa_green_pos) | (b << vesa_blue_pos); } static void -vesa_FillRect(left, top, width, height, color) -unsigned left, top, width, height, color; +vesa_FillRect(unsigned left, unsigned top, unsigned width, + unsigned height, unsigned color) { unsigned p_row_size = width * vesa_pixel_bytes; unsigned char *p_row = (unsigned char *) alloc(p_row_size); @@ -545,14 +530,14 @@ unsigned left, top, width, height, color; } void -vesa_get_scr_size() +vesa_get_scr_size(void) { CO = vesa_x_res / vesa_char_width; LI = vesa_y_res / vesa_char_height - 1; } void -vesa_backsp() +vesa_backsp(void) { int col, row; @@ -565,8 +550,7 @@ vesa_backsp() } void -vesa_clear_screen(colour) -int colour; +vesa_clear_screen(int colour) { vesa_FillRect(0, 0, vesa_x_res, vesa_y_res, colour); if (iflags.tile_view) @@ -576,8 +560,7 @@ int colour; /* clear to end of line */ void -vesa_cl_end(col, row) -int col, row; +vesa_cl_end(int col, int row) { unsigned left = vesa_x_center + col * vesa_char_width; unsigned top = vesa_y_center + row * vesa_char_height; @@ -590,8 +573,7 @@ int col, row; /* clear to end of screen */ void -vesa_cl_eos(cy) -int cy; +vesa_cl_eos(int cy) { cl_end(); if (cy < LI - 1) { @@ -605,15 +587,14 @@ int cy; } void -vesa_tty_end_screen() +vesa_tty_end_screen(void) { vesa_clear_screen(BACKGROUND_VESA_COLOR); vesa_SwitchMode(MODETEXT); } void -vesa_tty_startup(wid, hgt) -int *wid, *hgt; +vesa_tty_startup(int *wid, int *hgt) { /* code to sense display adapter is required here - MJA */ @@ -650,9 +631,7 @@ int *wid, *hgt; */ void -vesa_xputs(s, col, row) -const char *s; -int col, row; +vesa_xputs(const char *s, int col, int row) { if (s != NULL) { vesa_WriteStr(s, strlen(s), col, row, g_attribute); @@ -661,9 +640,7 @@ int col, row; /* write out character (and attribute) */ void -vesa_xputc(ch, attr) -char ch; -int attr; +vesa_xputc(char ch, int attr) { int col, row; @@ -690,12 +667,9 @@ int attr; #if defined(USE_TILES) /* Place tile represent. a glyph at current location */ void -vesa_xputg(glyphnum, ch, - special) -int glyphnum; -int ch; -unsigned special; /* special feature: corpse, invis, detected, pet, ridden - - hack.h */ +vesa_xputg(int glyphnum, int ch, + unsigned special) /* special feature: corpse, invis, detected, pet, ridden - + hack.h */ { int col, row; int attr; @@ -747,8 +721,7 @@ unsigned special; /* special feature: corpse, invis, detected, pet, ridden - */ void -vesa_gotoloc(col, row) -int col, row; +vesa_gotoloc(int col, int row) { curcol = min(col, CO - 1); /* protection from callers */ currow = min(row, LI - 1); @@ -756,8 +729,7 @@ int col, row; #if defined(USE_TILES) && defined(CLIPPING) static void -vesa_cliparound(x, y) -int x, y; +vesa_cliparound(int x, int y) { int oldx = clipx, oldy = clipy; @@ -796,12 +768,12 @@ int x, y; } static void -vesa_redrawmap() +vesa_redrawmap(void) { unsigned y_top = TOP_MAP_ROW * vesa_char_height; unsigned y_bottom = vesa_y_res - 5 * vesa_char_height; - unsigned x, y, cx, cy, px, py; - unsigned long color; + unsigned x, y, cx, cy, py /*, px */ ; + /* unsigned long color; */ unsigned long offset = y_top * (unsigned long) vesa_scan_line; unsigned char *p_row = NULL; unsigned p_row_width; @@ -813,9 +785,9 @@ vesa_redrawmap() if (iflags.traditional_view) { /* Text mode */ y = y_top; - for (cy = clipy; cy <= clipymax && cy < ROWNO; ++cy) { + for (cy = clipy; cy <= (unsigned) clipymax && cy < ROWNO; ++cy) { struct VesaCharacter t_row[COLNO]; - for (cx = clipx; cx <= clipxmax && cx < COLNO; ++cx) { + for (cx = clipx; cx <= (unsigned) clipxmax && cx < COLNO; ++cx) { t_row[cx].chr = map[cy][cx].ch; t_row[cx].colour = map[cy][cx].attr; } @@ -852,9 +824,9 @@ vesa_redrawmap() p_row_width = iflags.wc_tile_width * vesa_pixel_bytes; y = y_top; - for (cy = clipy; cy <= clipymax && cy < ROWNO; ++cy) { - for (py = 0; py < iflags.wc_tile_height; ++py) { - for (cx = clipx; cx <= clipxmax && cx < COLNO; ++cx) { + for (cy = clipy; cy <= (unsigned) clipymax && cy < ROWNO; ++cy) { + for (py = 0; py < (unsigned) iflags.wc_tile_height; ++py) { + for (cx = clipx; cx <= (unsigned) clipxmax && cx < COLNO; ++cx) { tile = vesa_tiles[glyph2tile[map[cy][cx].glyph]]; vesa_WritePixelRow(offset + p_row_width * (cx - clipx), tile + p_row_width * py, p_row_width); } @@ -877,8 +849,7 @@ vesa_redrawmap() #endif /* USE_TILES && CLIPPING */ void -vesa_userpan(pan) -enum vga_pan_direction pan; +vesa_userpan(enum vga_pan_direction pan) { /* pline("Into userpan"); */ if (iflags.over_view || iflags.traditional_view) @@ -934,8 +905,7 @@ enum vga_pan_direction pan; } void -vesa_overview(on) -boolean on; +vesa_overview(boolean on) { /* vesa_HideCursor(); */ if (on) { @@ -968,8 +938,7 @@ boolean on; } void -vesa_traditional(on) -boolean on; +vesa_traditional(boolean on) { /* vesa_HideCursor(); */ if (on) { @@ -1005,7 +974,7 @@ boolean on; } void -vesa_refresh() +vesa_refresh(void) { positionbar(); vesa_redrawmap(); @@ -1014,9 +983,7 @@ vesa_refresh() #if 0 static void -decal_packed(gp, special) -const struct TileImage *gp; -unsigned special; +decal_packed(const struct TileImage *gp, unsigned special) { /* FIXME: the tile array is fixed in memory and should not be changed; if we ever implement this, we'll have to copy the pixels */ @@ -1114,13 +1081,13 @@ vesa_Init(void) /* Set the size of the tiles for the overview mode */ vesa_oview_width = vesa_x_res / COLNO; - if (vesa_oview_width > iflags.wc_tile_width) { - vesa_oview_width = iflags.wc_tile_width; + if (vesa_oview_width > (unsigned) iflags.wc_tile_width) { + vesa_oview_width = (unsigned) iflags.wc_tile_width; } vesa_oview_height = (vesa_y_res - (TOP_MAP_ROW + 4) * vesa_char_height) / ROWNO; - if (vesa_oview_height > iflags.wc_tile_height) { - vesa_oview_height = iflags.wc_tile_height; + if (vesa_oview_height > (unsigned) iflags.wc_tile_height) { + vesa_oview_height = (unsigned) iflags.wc_tile_height; } /* Use the map font size to set the font size */ @@ -1146,7 +1113,7 @@ vesa_Init(void) num_pixels = iflags.wc_tile_width * iflags.wc_tile_height; num_oview_pixels = vesa_oview_width * vesa_oview_height; set_tile_type(vesa_pixel_size > 8); - for (i = 0; i < total_tiles_used; ++i) { + for (i = 0; i < (unsigned) total_tiles_used; ++i) { const struct TileImage *tile = get_tile(i); struct TileImage *ov_tile = stretch_tile(tile, vesa_oview_width, vesa_oview_height); unsigned j; @@ -1200,7 +1167,7 @@ vesa_Init(void) /* Set the size of the map viewport */ static void -vesa_SetViewPort() +vesa_SetViewPort(void) { unsigned y_reserved = (TOP_MAP_ROW + 5) * vesa_char_height; unsigned y_map = vesa_y_res - y_reserved; @@ -1220,8 +1187,7 @@ vesa_SetViewPort() * */ static void -vesa_SwitchMode(mode) -unsigned mode; +vesa_SwitchMode(unsigned mode) { __dpmi_regs regs; @@ -1307,7 +1273,7 @@ vesa_FontPtrs(void) * returns a VbeInfoBlock describing the features of the VESA BIOS. */ int -vesa_detect() +vesa_detect(void) { int vbe_info_sel = -1; /* custodial */ int vbe_info_seg; @@ -1489,9 +1455,7 @@ error: } static unsigned -vesa_FindMode(mode_addr, bits) -unsigned long mode_addr; -unsigned bits; +vesa_FindMode(unsigned long mode_addr, unsigned bits) { unsigned selected_mode; struct ModeInfoBlock mode_info0, mode_info; @@ -1542,8 +1506,7 @@ unsigned bits; * */ static void -vesa_WriteChar(chr, col, row, colour) -int chr, col, row, colour; +vesa_WriteChar(int chr, int col, int row, int colour) { int pixx, pixy; @@ -1562,17 +1525,16 @@ int chr, col, row, colour; * transparency */ static void -vesa_WriteCharXY(chr, pixx, pixy, colour) -int chr, pixx, pixy, colour; +vesa_WriteCharXY(int chr, int pixx, int pixy, int colour) { /* Flush if cache is full or if not contiguous to the last character */ if (chr_cache_size >= SIZE(chr_cache)) { vesa_flush_text(); } - if (chr_cache_size != 0 && chr_cache_lastx + vesa_char_width != pixx) { + if (chr_cache_size != 0 && chr_cache_lastx + vesa_char_width != (unsigned) pixx) { vesa_flush_text(); } - if (chr_cache_size != 0 && chr_cache_pixy != pixy) { + if (chr_cache_size != 0 && chr_cache_pixy != (unsigned) pixy) { vesa_flush_text(); } /* Add to cache and write later */ @@ -1591,13 +1553,12 @@ int chr, pixx, pixy, colour; * Don't bother cacheing; only the position bar and the cursor use this */ static void -vesa_WriteCharTransparent(chr, pixx, pixy, colour) -int chr, pixx, pixy, colour; +vesa_WriteCharTransparent(int chr, int pixx, int pixy, int colour) { int px, py; - for (py = 0; py < vesa_char_height; ++py) { - for (px = 0; px < vesa_char_width; ++px) { + for (py = 0; py < (int) vesa_char_height; ++py) { + for (px = 0; px < (int) vesa_char_width; ++px) { if (vesa_GetCharPixel(chr, px, py)) { vesa_WritePixel(pixx + px, pixy + py, colour + FIRST_TEXT_COLOR); } @@ -1606,7 +1567,7 @@ int chr, pixx, pixy, colour; } void -vesa_flush_text() +vesa_flush_text(void) { if (chr_cache_size == 0) return; @@ -1615,10 +1576,8 @@ vesa_flush_text() } static void -vesa_WriteTextRow(pixx, pixy, t_row, t_row_width) -int pixx, pixy; -struct VesaCharacter const *t_row; -unsigned t_row_width; +vesa_WriteTextRow(int pixx, int pixy, struct VesaCharacter const *t_row, + unsigned t_row_width) { int x, px, py; unsigned i; @@ -1639,7 +1598,7 @@ unsigned t_row_width; } /* First loop: draw one raster line of all row entries */ - for (py = 0; py < vesa_char_height; ++py) { + for (py = 0; py < (int) vesa_char_height; ++py) { /* Second loop: draw one raster line of one character */ x = 0; for (i = 0; i < t_row_width; ++i) { @@ -1656,7 +1615,7 @@ unsigned t_row_width; fg[3] = (pix >> 24) & 0xFF; } /* Third loop: draw eight pixels */ - for (px = 0; px < vesa_char_width; px += 8) { + for (px = 0; px < (int) vesa_char_width; px += 8) { /* Fourth loop: draw one pixel */ int px2; unsigned char fnt = vesa_GetCharPixelRow(chr, px, py); @@ -1682,9 +1641,7 @@ unsigned t_row_width; } static boolean -vesa_GetCharPixel(ch, x, y) -int ch; -unsigned x, y; +vesa_GetCharPixel(int ch, unsigned x, unsigned y) { unsigned x2; unsigned char fnt; @@ -1696,9 +1653,7 @@ unsigned x, y; } static unsigned char -vesa_GetCharPixelRow(ch, x, y) -int ch; -unsigned x, y; +vesa_GetCharPixelRow(int ch, unsigned x, unsigned y) { unsigned x1; unsigned char fnt; @@ -1736,8 +1691,7 @@ unsigned x, y; /* Scale font pixels horizontally */ static unsigned long -vesa_DoublePixels(fnt) -unsigned long fnt; +vesa_DoublePixels(unsigned long fnt) { static const unsigned char double_bits[] = { 0x00, 0x03, 0x0C, 0x0F, @@ -1757,8 +1711,7 @@ unsigned long fnt; } static unsigned long -vesa_TriplePixels(fnt) -unsigned long fnt; +vesa_TriplePixels(unsigned long fnt) { static const unsigned short triple_bits[] = { 00000, 00007, 00070, 00077, @@ -1787,14 +1740,12 @@ unsigned long fnt; * */ static void -vesa_DisplayCell(tilenum, col, row) -int tilenum; -int col, row; +vesa_DisplayCell(int tilenum, int col, int row) { unsigned char const *tile; unsigned t_width, t_height; unsigned char const *tptr; - int px, py, pixx, pixy; + int /* px, */ py, pixx, pixy; unsigned long offset; unsigned p_row_width; @@ -1817,7 +1768,7 @@ int col, row; offset = pixy * (unsigned long)vesa_scan_line + pixx * vesa_pixel_bytes; tptr = tile; - for (py = 0; py < t_height; ++py) { + for (py = 0; py < (int) t_height; ++py) { vesa_WritePixelRow(offset, tptr, p_row_width); offset += vesa_scan_line; tptr += p_row_width; @@ -1830,9 +1781,7 @@ int col, row; * */ static void -vesa_WriteStr(s, len, col, row, colour) -const char *s; -int len, col, row, colour; +vesa_WriteStr(const char *s, int len, int col, int row, int colour) { const unsigned char *us; int i = 0; @@ -1859,8 +1808,7 @@ int len, col, row, colour; * */ static boolean -vesa_SetPalette(palette) -const struct Pixel *palette; +vesa_SetPalette(const struct Pixel *palette) { if (vesa_pixel_size == 8) { return vesa_SetHardPalette(palette); @@ -1870,8 +1818,7 @@ const struct Pixel *palette; } static boolean -vesa_SetHardPalette(palette) -const struct Pixel *palette; +vesa_SetHardPalette(const struct Pixel *palette) { int palette_sel = -1; /* custodial */ int palette_seg; @@ -1958,8 +1905,7 @@ error: } static boolean -vesa_SetSoftPalette(palette) -const struct Pixel *palette; +vesa_SetSoftPalette(const struct Pixel *palette) { const struct Pixel *p; unsigned i; @@ -1993,8 +1939,7 @@ const struct Pixel *palette; static unsigned char pbar[COLNO]; void -vesa_update_positionbar(posbar) -char *posbar; +vesa_update_positionbar(char *posbar) { unsigned char *p = pbar; if (posbar) @@ -2004,7 +1949,7 @@ char *posbar; } static void -positionbar() +positionbar(void) { unsigned char *posbar = pbar; int feature, ucol; @@ -2084,7 +2029,7 @@ positionbar() #ifdef SIMULATE_CURSOR void -vesa_DrawCursor() +vesa_DrawCursor(void) { static boolean last_inmap = FALSE; unsigned x, y, left, top, right, bottom, width, height; @@ -2111,7 +2056,8 @@ vesa_DrawCursor() x = min(curcol, (CO - 1)); /* protection from callers */ y = min(currow, (LI - 1)); /* protection from callers */ if (!halfwidth - && ((x < clipx) || (x > clipxmax) || (y < clipy) || (y > clipymax))) + && ((x < (unsigned) clipx) || (x > (unsigned) clipxmax) + || (y < (unsigned) clipy) || (y > (unsigned) clipymax))) return; if (inmap) { x -= clipx; @@ -2198,7 +2144,7 @@ vesa_DrawCursor() } void -vesa_HideCursor() +vesa_HideCursor(void) { unsigned x, y, left, top, width, height; boolean isrogue = Is_rogue_level(&u.uz); @@ -2213,7 +2159,9 @@ vesa_HideCursor() x = min(curcol, (CO - 1)); /* protection from callers */ y = min(currow, (LI - 1)); /* protection from callers */ if (!halfwidth - && ((x < clipx) || (x > clipxmax) || (y < clipy) || (y > clipymax))) + && ((x < (unsigned) clipx) || (x > (unsigned) clipxmax) + || (y < (unsigned) clipy) + || (y > (unsigned) clipymax))) return; if (inmap) { x -= clipx; diff --git a/sys/msdos/vidvga.c b/sys/msdos/vidvga.c index 621cf1d9a..e2c8107a3 100644 --- a/sys/msdos/vidvga.c +++ b/sys/msdos/vidvga.c @@ -92,7 +92,7 @@ #if _MSC_VER >= 700 #pragma warning(disable : 4018) /* signed/unsigned mismatch */ #pragma warning(disable : 4127) /* conditional expression is constant */ -#pragma warning(disable : 4131) /* old style declarator */ +/* #pragma warning(disable : 4131) */ /* old style declarator */ #pragma warning(disable : 4305) /* prevents complaints with MK_FP */ #pragma warning(disable : 4309) /* initializing */ #if _MSC_VER > 700 @@ -104,33 +104,34 @@ extern short glyph2tile[]; -/* static void FDECL(vga_NoBorder, (int)); */ -void FDECL(vga_gotoloc, (int, int)); /* This should be made a macro */ -void NDECL(vga_backsp); +/* static void vga_NoBorder(int); */ +void vga_gotoloc(int, int); /* This should be made a macro */ +void vga_backsp(void); + #ifdef SCROLLMAP -static void FDECL(vga_scrollmap, (BOOLEAN_P)); +static void vga_scrollmap(boolean); #endif -static void FDECL(vga_redrawmap, (BOOLEAN_P)); -static void FDECL(vga_cliparound, (int, int)); -static void FDECL(decal_planar, (struct planar_cell_struct *, unsigned)); +static void vga_redrawmap(boolean); +static void vga_cliparound(int, int); +static void decal_planar(struct planar_cell_struct *, unsigned); #ifdef POSITIONBAR -static void NDECL(positionbar); -static void FDECL(vga_special, (int, int, int)); +static void positionbar(void); +static void vga_special(int, int, int); #endif -static void FDECL(vga_DisplayCell, (struct planar_cell_struct *, int, int)); -static void FDECL(vga_DisplayCell_O, - (struct overview_planar_cell_struct *, int, int)); -static void FDECL(vga_SwitchMode, (unsigned int)); -static void FDECL(vga_SetPalette, (const struct Pixel *)); -static void FDECL(vga_WriteChar, (int, int, int, int)); -static void FDECL(vga_WriteStr, (char *, int, int, int, int)); +static void vga_DisplayCell(struct planar_cell_struct *, int, int); +static void vga_DisplayCell_O(struct overview_planar_cell_struct *, int, + int); +static void vga_SwitchMode(unsigned int); +static void vga_SetPalette(const struct Pixel *); +static void vga_WriteChar(int, int, int, int); +static void vga_WriteStr(char *, int, int, int, int); -static void FDECL(read_planar_tile, (unsigned, struct planar_cell_struct *)); -static void FDECL(read_planar_tile_O, - (unsigned, struct overview_planar_cell_struct *)); -static void FDECL(read_tile_indexes, (unsigned, unsigned char (*)[TILE_X])); +static void read_planar_tile(unsigned, struct planar_cell_struct *); +static void read_planar_tile_O(unsigned, + struct overview_planar_cell_struct *); +static void read_tile_indexes(unsigned, unsigned char (*)[TILE_X]); extern int clipx, clipxmax; /* current clipping column from wintty.c */ extern boolean clipping; /* clipping on? from wintty.c */ @@ -208,14 +209,14 @@ static struct overview_planar_cell_struct planecell_O; /* static int g_attribute; */ /* Current attribute to use */ void -vga_get_scr_size() +vga_get_scr_size(void) { CO = 80; LI = 29; } void -vga_backsp() +vga_backsp(void) { int col, row; @@ -228,8 +229,7 @@ vga_backsp() } void -vga_clear_screen(colour) -int colour; +vga_clear_screen(int colour) { unsigned long __far *pch; unsigned j; @@ -250,8 +250,8 @@ int colour; vga_gotoloc(0, 0); /* is this needed? */ } -void vga_cl_end(col, row) /* clear to end of line */ -int col, row; +/* clear to end of line */ +void vga_cl_end(int col, int row) { int count; @@ -265,8 +265,8 @@ int col, row; } } -void vga_cl_eos(cy) /* clear to end of screen */ -int cy; +/* clear to end of screen */ +void vga_cl_eos(int cy) { int count; @@ -280,15 +280,14 @@ int cy; } void -vga_tty_end_screen() +vga_tty_end_screen(void) { vga_clear_screen(BACKGROUND_VGA_COLOR); vga_SwitchMode(MODETEXT); } void -vga_tty_startup(wid, hgt) -int *wid, *hgt; +vga_tty_startup(int *wid, int *hgt) { /* code to sense display adapter is required here - MJA */ @@ -325,18 +324,15 @@ int *wid, *hgt; */ void -vga_xputs(s, col, row) -const char *s; -int col, row; +vga_xputs(const char *s, int col, int row) { if (s != (char *) 0) { vga_WriteStr((char *) s, strlen(s), col, row, g_attribute); } } -void vga_xputc(ch, attr) /* write out character (and attribute) */ -char ch; -int attr; +/* write out character (and attribute) */ +void vga_xputc(char ch, int attr) { int col, row; @@ -358,13 +354,11 @@ int attr; } #if defined(USE_TILES) +/* Place tile represent. a glyph at current location */ void -vga_xputg(glyphnum, ch, - special) /* Place tile represent. a glyph at current location */ -int glyphnum; -int ch; -unsigned special; /* special feature: corpse, invis, detected, pet, ridden - - hack.h */ +vga_xputg(int glyphnum, int ch, + unsigned special) /* special feature: corpse, invis, detected, pet, ridden - + hack.h */ { int col, row; int attr; @@ -418,8 +412,7 @@ unsigned special; /* special feature: corpse, invis, detected, pet, ridden - */ void -vga_gotoloc(col, row) -int col, row; +vga_gotoloc(int col, int row) { curcol = min(col, CO - 1); /* protection from callers */ currow = min(row, LI - 1); @@ -427,8 +420,7 @@ int col, row; #if defined(USE_TILES) && defined(CLIPPING) static void -vga_cliparound(x, y) -int x, y; +vga_cliparound(int x, int y UNUSED) { int oldx = clipx; @@ -450,8 +442,7 @@ int x, y; } static void -vga_redrawmap(clearfirst) -boolean clearfirst; +vga_redrawmap(boolean clearfirst) { int x, y, t; unsigned long __far *pch; @@ -501,8 +492,7 @@ boolean clearfirst; #endif /* USE_TILES && CLIPPING */ void -vga_userpan(pan) -enum vga_pan_direction pan; +vga_userpan(enum vga_pan_direction pan) { int x; @@ -521,8 +511,7 @@ enum vga_pan_direction pan; } void -vga_overview(on) -boolean on; +vga_overview(boolean on) { /* vga_HideCursor(); */ if (on) { @@ -539,8 +528,7 @@ boolean on; } void -vga_traditional(on) -boolean on; +vga_traditional(boolean on) { /* vga_HideCursor(); */ if (on) { @@ -560,7 +548,7 @@ boolean on; } void -vga_refresh() +vga_refresh(void) { positionbar(); vga_redrawmap(1); @@ -632,9 +620,7 @@ boolean left; #endif /* SCROLLMAP */ static void -read_planar_tile(glyph, cell) -unsigned glyph; -struct planar_cell_struct *cell; +read_planar_tile(unsigned glyph, struct planar_cell_struct *cell) { unsigned char indexes[TILE_Y][TILE_X]; unsigned plane, y, byte, bit; @@ -658,9 +644,7 @@ struct planar_cell_struct *cell; } static void -read_planar_tile_O(glyph, cell) -unsigned glyph; -struct overview_planar_cell_struct *cell; +read_planar_tile_O(unsigned glyph, struct overview_planar_cell_struct *cell) { unsigned char indexes[TILE_Y][TILE_X]; unsigned plane, y, bit; @@ -682,9 +666,7 @@ struct overview_planar_cell_struct *cell; } static void -read_tile_indexes(glyph, indexes) -unsigned glyph; -unsigned char (*indexes)[TILE_X]; +read_tile_indexes(unsigned glyph, unsigned char (*indexes)[TILE_X]) { const struct TileImage *tile; unsigned x, y; @@ -708,7 +690,6 @@ unsigned char (*indexes)[TILE_X]; tile = get_tile(tilenum); /* Map to a 16 bit palette; assume colors laid out as in default tileset */ - memset(indexes, 0, sizeof(indexes)); for (y = 0; y < TILE_Y && y < tile->height; ++y) { for (x = 0; x < TILE_X && x < tile->width; ++x) { unsigned i = tile->indexes[y * tile->width + x]; @@ -725,9 +706,7 @@ unsigned char (*indexes)[TILE_X]; } static void -decal_planar(gp, special) -struct planar_cell_struct *gp; -unsigned special; +decal_planar(struct planar_cell_struct *gp UNUSED, unsigned special) { if (special & MG_CORPSE) { } else if (special & MG_INVIS) { @@ -798,7 +777,7 @@ vga_Init(void) #endif vga_SetPalette(paletteptr); g_attribute = attrib_gr_normal; - font = vga_FontPtrs(); + font = (unsigned char __far *) vga_FontPtrs(); clear_screen(); clipx = 0; clipxmax = clipx + (viewport_size - 1); @@ -907,7 +886,7 @@ vga_FontPtrs(void) * 0xB=MCGA(mono-monitor), 0xC=MCGA(color-monitor), 0xFF=unknown) */ int -vga_detect() +vga_detect(void) { union REGS regs; @@ -935,8 +914,7 @@ vga_detect() * */ static void -vga_WriteChar(chr, col, row, colour) -int chr, col, row, colour; +vga_WriteChar(int chr, int col, int row, int colour) { int i; int x, pixy; @@ -999,9 +977,7 @@ int chr, col, row, colour; * */ static void -vga_DisplayCell(gp, col, row) -struct planar_cell_struct *gp; -int col, row; +vga_DisplayCell(struct planar_cell_struct *gp, int col, int row) { int i, pixx, pixy; char __far *tmp_s; /* source pointer */ @@ -1030,9 +1006,7 @@ int col, row; } static void -vga_DisplayCell_O(gp, col, row) -struct overview_planar_cell_struct *gp; -int col, row; +vga_DisplayCell_O(struct overview_planar_cell_struct *gp, int col, int row) { int i, pixx, pixy; char __far *tmp_s; /* source pointer */ @@ -1063,9 +1037,7 @@ int col, row; * */ static void -vga_WriteStr(s, len, col, row, colour) -char *s; -int len, col, row, colour; +vga_WriteStr(char *s, int len, int col, int row, int colour) { unsigned char *us; int i = 0; @@ -1091,8 +1063,7 @@ int len, col, row, colour; * */ static void -vga_SetPalette(p) -const struct Pixel *p; +vga_SetPalette(const struct Pixel *p) { union REGS regs; int i; @@ -1127,20 +1098,24 @@ static unsigned char colorbits[] = { 0x08, 0x04, 0x02, 0x01 }; static unsigned char pbar[COLNO]; void -vga_update_positionbar(posbar) -char *posbar; +vga_update_positionbar(char *posbar) { - char *p = pbar; + char *p = (char *) pbar; if (posbar) while (*posbar) *p++ = *posbar++; *p = 0; } +#ifdef __DJGPP__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif /* __DJGPP__ */ + static void -positionbar() +positionbar(void) { - char *posbar = pbar; + char *posbar = (char *) pbar; int feature, ucol; int k, y, colour, row; char __far *pch; @@ -1238,9 +1213,12 @@ positionbar() #endif } +#ifdef __DJGPP__ +#pragma GCC diagnostic pop +#endif /* __DJGPP__ */ + void -vga_special(chr, col, color) -int chr, col, color; +vga_special(int chr, int col, int color) { int i, y, pixy; char __far *tmp_d; /* destination pointer */ @@ -1272,7 +1250,6 @@ int chr, col, color; } egawriteplane(15); } - #endif /*POSITIONBAR*/ #ifdef SIMULATE_CURSOR @@ -1281,7 +1258,7 @@ static struct planar_cell_struct undercursor; static struct planar_cell_struct cursor; void -vga_DrawCursor() +vga_DrawCursor(void) { int i, pixx, pixy, x, y, p; char __far *tmp1; @@ -1496,7 +1473,7 @@ vga_DrawCursor() } void -vga_HideCursor() +vga_HideCursor(void) { int i, pixx, pixy, x, y; char __far *tmp1; diff --git a/sys/share/ioctl.c b/sys/share/ioctl.c index b391c1f07..d6a2468c5 100644 --- a/sys/share/ioctl.c +++ b/sys/share/ioctl.c @@ -75,17 +75,17 @@ struct termio termio; #endif #ifdef _M_UNIX -extern void NDECL(sco_mapon); -extern void NDECL(sco_mapoff); +extern void sco_mapon(void); +extern void sco_mapoff(void); #endif #ifdef __linux__ -extern void NDECL(linux_mapon); -extern void NDECL(linux_mapoff); +extern void linux_mapon(void); +extern void linux_mapoff(void); #endif #ifdef AUX void -catch_stp() +catch_stp(void) { signal(SIGTSTP, SIG_DFL); dosuspend(); @@ -93,7 +93,7 @@ catch_stp() #endif /* AUX */ void -getwindowsz() +getwindowsz(void) { #ifdef USE_WIN_IOCTL /* @@ -116,7 +116,7 @@ getwindowsz() } void -getioctls() +getioctls(void) { #ifdef BSD_JOB_CONTROL (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); @@ -139,7 +139,7 @@ getioctls() } void -setioctls() +setioctls(void) { #ifdef BSD_JOB_CONTROL (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); @@ -158,7 +158,7 @@ setioctls() #ifdef SUSPEND /* No longer implies BSD */ int -dosuspend() +dosuspend(void) { #ifdef SYSCF /* NB: check_user_string() is port-specific. */ diff --git a/sys/share/nhlan.c b/sys/share/nhlan.c index f3e75e360..4ba0682d2 100644 --- a/sys/share/nhlan.c +++ b/sys/share/nhlan.c @@ -18,7 +18,7 @@ #ifdef LAN_FEATURES void -init_lan_features() +init_lan_features(void) { lan_username(); } @@ -29,7 +29,7 @@ init_lan_features() */ char * -lan_username() +lan_username(void) { char *lu; lu = get_username(&g.lusername_size); diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 2367c84ea..1c3a7ae57 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -24,6 +24,13 @@ #include /* for getcwd() prototype */ #endif +#if defined(MICRO) || defined(OS2) +void nethack_exit(int) NORETURN; +#else +#define nethack_exit exit +#endif + +char *exepath(char *); char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */ #ifdef TOS @@ -35,28 +42,24 @@ long _stksize = 16 * 1024; #ifdef AMIGA extern int bigscreen; -void NDECL(preserve_icon); +void preserve_icon(void); #endif -static void FDECL(process_options, (int argc, char **argv)); -static void NDECL(nhusage); - -#if defined(MICRO) || defined(OS2) -extern void FDECL(nethack_exit, (int)) NORETURN; -#else -#define nethack_exit exit -#endif +static void process_options(int argc, char **argv); +static void nhusage(void); -#ifdef EXEPATH -static char *FDECL(exepath, (char *)); -#endif +#ifdef PORT_HELP +#if defined(MSDOS) +void port_help(void); +#endif /* MSDOS */ +#endif /* PORT_HELP */ -int FDECL(main, (int, char **)); +int main(int, char **); -extern boolean FDECL(pcmain, (int, char **)); +extern boolean pcmain(int, char **); #if defined(__BORLANDC__) -void NDECL(startup); +void startup(void); unsigned _stklen = STKSIZ; #endif @@ -66,12 +69,10 @@ unsigned _stklen = STKSIZ; */ int #ifndef __MINGW32__ -main(argc, argv) +main(int argc, char *argv[]) #else -mingw_main(argc, argv) +mingw_main(int argc, char *argv[]) #endif -int argc; -char *argv[]; { boolean resuming; @@ -84,9 +85,7 @@ char *argv[]; } boolean -pcmain(argc, argv) -int argc; -char *argv[]; +pcmain(int argc, char *argv[]) { NHFILE *nhfp; register char *dir; @@ -455,7 +454,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ * We'll return here if new game player_selection() renames the hero. */ attempt_restore: - if ((nhfp = restore_saved_game()) > 0) { + if ((nhfp = restore_saved_game()) != 0) { #ifndef NO_SIGNAL (void) signal(SIGINT, (SIG_RET_TYPE) done1); #endif @@ -515,9 +514,7 @@ attempt_restore: } static void -process_options(argc, argv) -int argc; -char *argv[]; +process_options(int argc, char *argv[]) { int i; @@ -637,7 +634,7 @@ char *argv[]; } static void -nhusage() +nhusage(void) { char buf1[BUFSZ], buf2[BUFSZ], *bufptr; @@ -678,9 +675,7 @@ nhusage() #ifdef CHDIR void -chdirx(dir, wr) -char *dir; -boolean wr; +chdirx(char *dir, boolean wr) { #ifdef AMIGA static char thisdir[] = ""; @@ -708,7 +703,7 @@ boolean wr; #ifdef PORT_HELP #if defined(MSDOS) void -port_help() +port_help(void) { /* display port specific help file */ display_file(PORT_HELP, 1); @@ -718,7 +713,7 @@ port_help() /* validate wizard mode if player has requested access to it */ boolean -authorize_wizard_mode() +authorize_wizard_mode(void) { if (!strcmp(g.plname, WIZARD_NAME)) return TRUE; @@ -736,15 +731,12 @@ authorize_wizard_mode() char exepathbuf[EXEPATHBUFSZ]; char * -exepath(str) -char *str; +exepath(char *str) { char *tmp, *tmp2; - int bsize; if (!str) return (char *) 0; - bsize = EXEPATHBUFSZ; tmp = exepathbuf; Strcpy(tmp, str); tmp2 = strrchr(tmp, PATH_SEPARATOR); @@ -767,7 +759,7 @@ VA_DECL(const char *, fmt) } unsigned long -sys_random_seed() +sys_random_seed(void) { unsigned long seed = 0L; unsigned long pid = (unsigned long) getpid(); diff --git a/sys/share/pcsys.c b/sys/share/pcsys.c index af30e4423..c09887305 100644 --- a/sys/share/pcsys.c +++ b/sys/share/pcsys.c @@ -29,11 +29,11 @@ #endif #if defined(MICRO) || defined(OS2) -void FDECL(nethack_exit, (int)) NORETURN; +void nethack_exit(int) NORETURN; #else #define nethack_exit exit #endif -static void NDECL(msexit); +static void msexit(void); #ifdef MOVERLAY extern void __far __cdecl _movepause(void); @@ -43,11 +43,12 @@ extern unsigned short __far __cdecl _movefpaused; #define __MOVE_PAUSE_DISK 2 /* Represents the executable file */ #define __MOVE_PAUSE_CACHE 4 /* Represents the cache memory */ #endif /* MOVERLAY */ +FILE * fopenp(const char *name, const char *mode); #if defined(MICRO) void -flushout() +flushout(void) { (void) fflush(stdout); return; @@ -64,9 +65,11 @@ static const char *COMSPEC = #ifdef SHELL int -dosh() +dosh(void) { +#ifndef NOCWD_ASSUMPTIONS extern char orgdir[]; +#endif char *comspec; #ifndef __GO32__ int spawnstat; @@ -132,8 +135,7 @@ dosh() * be room for the \ */ void -append_slash(name) -char *name; +append_slash(char *name) { char *ptr; @@ -148,8 +150,7 @@ char *name; } void -getreturn(str) -const char *str; +getreturn(const char *str) { #ifdef TOS msmsg("Hit %s.", str); @@ -194,8 +195,7 @@ VA_DECL(const char *, fmt) #endif FILE * -fopenp(name, mode) -const char *name, *mode; +fopenp(const char *name, const char *mode) { char buf[BUFSIZ], *bp, *pp, lastch = 0; FILE *fp; @@ -243,8 +243,7 @@ const char *name, *mode; #if defined(MICRO) || defined(OS2) void -nethack_exit(code) -int code; +nethack_exit(int code) { msexit(); exit(code); @@ -257,9 +256,9 @@ extern boolean run_from_desktop; /* set in pcmain.c */ #endif static void -msexit() +msexit(void) { -#ifdef CHDIR +#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) extern char orgdir[]; #endif diff --git a/sys/share/pctty.c b/sys/share/pctty.c index 75e38e9ab..6b718d66a 100644 --- a/sys/share/pctty.c +++ b/sys/share/pctty.c @@ -18,7 +18,7 @@ char erase_char, kill_char; * Called by startup() in termcap.c and after returning from ! or ^Z */ void -gettty() +gettty(void) { erase_char = '\b'; kill_char = 21; /* cntl-U */ @@ -33,8 +33,7 @@ gettty() /* reset terminal to original state */ void -settty(s) -const char *s; +settty(const char *s) { #if defined(MSDOS) && defined(NO_TERMS) gr_finish(); @@ -49,15 +48,14 @@ const char *s; /* called by init_nhwindows() and resume_nhwindows() */ void -setftty() +setftty(void) { start_screen(); } #if defined(TIMED_DELAY) && defined(_MSC_VER) void -msleep(mseconds) -unsigned mseconds; +msleep(unsigned mseconds) { /* now uses clock() which is ANSI C */ clock_t goal; diff --git a/sys/share/pcunix.c b/sys/share/pcunix.c index 2ea4e38dd..8b023fc65 100644 --- a/sys/share/pcunix.c +++ b/sys/share/pcunix.c @@ -18,8 +18,8 @@ extern char orgdir[]; #endif #if defined(TTY_GRAPHICS) -extern void NDECL(backsp); -extern void NDECL(clear_screen); +extern void backsp(void); +extern void clear_screen(void); #endif #if 0 @@ -30,14 +30,13 @@ static struct stat buf; static struct stat hbuf; #endif -#ifdef PC_LOCKING -static int NDECL(eraseoldlocks); +#if defined(PC_LOCKING) && !defined(SELF_RECOVER) +static int eraseoldlocks(void); #endif #if 0 int -uptodate(fd) -int fd; +uptodate(int fd) { #ifdef WANT_GETHDATE if(fstat(fd, &buf)) { @@ -73,9 +72,10 @@ int fd; } #endif -#ifdef PC_LOCKING +#if defined(PC_LOCKING) +#if !defined(SELF_RECOVER) static int -eraseoldlocks() +eraseoldlocks(void) { register int i; @@ -96,11 +96,12 @@ eraseoldlocks() return 0; /* cannot remove it */ return (1); /* success! */ } +#endif /* SELF_RECOVER */ void -getlock() +getlock(void) { - register int fd, c, ci, ct, ern; + register int fd, c, ci, ct; int fcmask = FCMASK; char tbuf[BUFSZ]; const char *fq_lock; @@ -209,8 +210,6 @@ getlock() gotlock: fd = creat(fq_lock, fcmask); - if (fd == -1) - ern = errno; unlock_file(HLOCK); if (fd == -1) { #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) @@ -240,12 +239,11 @@ gotlock: #endif /* PC_LOCKING */ void -regularize(s) +regularize(register char *s) /* * normalize file name - we don't like .'s, /'s, spaces, and * lots of other things */ -register char *s; { register char *lp; diff --git a/sys/share/pmatchregex.c b/sys/share/pmatchregex.c index 0d688d330..d04fdacc1 100644 --- a/sys/share/pmatchregex.c +++ b/sys/share/pmatchregex.c @@ -20,7 +20,7 @@ struct nhregex { }; struct nhregex * -regex_init() +regex_init(void) { struct nhregex *re; @@ -30,9 +30,7 @@ regex_init() } boolean -regex_compile(s, re) -const char *s; -struct nhregex *re; +regex_compile(const char *s, struct nhregex *re) { if (!re) return FALSE; @@ -44,16 +42,13 @@ struct nhregex *re; } const char * -regex_error_desc(re) -struct nhregex *re UNUSED; +regex_error_desc(struct nhregex *re UNUSED) { return "pattern match compilation error"; } boolean -regex_match(s, re) -const char *s; -struct nhregex *re; +regex_match(const char *s, struct nhregex *re) { if (!re || !re->pat || !s) return FALSE; @@ -62,8 +57,7 @@ struct nhregex *re; } void -regex_free(re) -struct nhregex *re; +regex_free(struct nhregex *re) { if (re) { if (re->pat) diff --git a/sys/share/posixregex.c b/sys/share/posixregex.c index d681a5b9a..37f16ada9 100644 --- a/sys/share/posixregex.c +++ b/sys/share/posixregex.c @@ -52,7 +52,7 @@ struct nhregex { }; struct nhregex * -regex_init() +regex_init(void) { return (struct nhregex *) alloc(sizeof(struct nhregex)); } diff --git a/sys/share/tclib.c b/sys/share/tclib.c index 75ce78151..be0b3bc48 100644 --- a/sys/share/tclib.c +++ b/sys/share/tclib.c @@ -21,13 +21,13 @@ char *BC, *UP; short ospeed; /* exported routines */ -int FDECL(tgetent, (char *, const char *)); -int FDECL(tgetflag, (const char *)); -int FDECL(tgetnum, (const char *)); -char *FDECL(tgetstr, (const char *, char **)); -char *FDECL(tgoto, (const char *, int, int)); -char *FDECL(tparam, (const char *, char *, int, int, int, int, int)); -void FDECL(tputs, (const char *, int, int (*)(int))); +int tgetent(char *, const char *); +int tgetflag(const char *); +int tgetnum(const char *); +char *tgetstr(const char *, char **); +char *tgoto(const char *, int, int); +char *tparam(const char *, char *, int, int, int, int, int); +void tputs(const char *, int, int (*)(int)); /* local support data */ static char *tc_entry; @@ -49,10 +49,10 @@ static short baud_rates[] = { #endif /* !NO_DELAY_PADDING */ /* local support code */ -static int FDECL(tc_store, (const char *, const char *)); -static char *FDECL(tc_find, (FILE *, const char *, char *, int)); -static char *FDECL(tc_name, (const char *, char *)); -static const char *FDECL(tc_field, (const char *, const char **)); +static int tc_store(const char *, const char *); +static char *tc_find(FILE *, const char *, char *, int); +static char *tc_name(const char *, char *); +static const char *tc_field(const char *, const char **); #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) @@ -60,9 +60,8 @@ static const char *FDECL(tc_field, (const char *, const char **)); /* retrieve the specified terminal entry and return it in `entbuf' */ int -tgetent(entbuf, term) -char *entbuf; /* size must be at least [TCBUFSIZ] */ -const char *term; +tgetent(char *entbuf, /* size must be at least [TCBUFSIZ] */ + const char *term) { int result; FILE *fp; @@ -96,8 +95,7 @@ const char *term; /* copy the entry into the output buffer */ static int -tc_store(trm, ent) -const char *trm, *ent; +tc_store(const char *trm, const char *ent) { const char *bar, *col; char *s; @@ -137,11 +135,7 @@ const char *trm, *ent; /* search for an entry in the termcap file */ static char * -tc_find(fp, term, buffer, bufsiz) -FILE *fp; -const char *term; -char *buffer; -int bufsiz; +tc_find(FILE *fp, const char *term, char *buffer, int bufsiz) { int in, len, first, skip; char *ip, *op, *tc_fetch, tcbuf[TCBUFSIZ]; @@ -198,9 +192,7 @@ int bufsiz; /* check whether `ent' contains `nam'; return start of field entries */ static char * -tc_name(nam, ent) -const char *nam; -char *ent; +tc_name(const char *nam, char *ent) { char *nxt, *lst, *p = ent; size_t n = strlen(nam); @@ -220,8 +212,7 @@ char *ent; /* look up a numeric entry */ int -tgetnum(which) -const char *which; +tgetnum(const char *which) { const char *q, *p = tc_field(which, &q); char numbuf[32]; @@ -239,8 +230,7 @@ const char *which; /* look up a boolean entry */ int -tgetflag(which) -const char *which; +tgetflag(const char *which) { const char *p = tc_field(which, (const char **) 0); @@ -249,9 +239,7 @@ const char *which; /* look up a string entry; update `*outptr' */ char * -tgetstr(which, outptr) -const char *which; -char **outptr; +tgetstr(const char *which, char **outptr) { int n; char c, *r, *result; @@ -326,9 +314,7 @@ char **outptr; /* look for a particular field name */ static const char * -tc_field(field, tc_end) -const char *field; -const char **tc_end; +tc_field(const char *field, const char **tc_end) { const char *end, *q, *p = tc_entry; @@ -356,20 +342,17 @@ static char cmbuf[64]; /* produce a string which will position the cursor at if output */ char * -tgoto(cm, col, row) -const char *cm; -int col, row; +tgoto(const char *cm, int col, int row) { return tparam(cm, cmbuf, (int) (sizeof cmbuf), row, col, 0, 0); } /* format a parameterized string, ala sprintf */ char * -tparam(ctl, buf, buflen, row, col, row2, col2) -const char *ctl; /* parameter control string */ -char *buf; /* output buffer */ -int buflen; /* ought to have been `size_t'... */ -int row, col, row2, col2; +tparam(const char *ctl, /* parameter control string */ + char *buf, /* output buffer */ + int buflen, /* ought to have been `size_t'... */ + int row, int col, int row2, int col2) { int atmp, ac, av[5]; char c, *r, *z, *bufend, numbuf[32]; @@ -501,10 +484,9 @@ int row, col, row2, col2; /* send a string to the terminal, possibly padded with trailing NULs */ void -tputs(string, range, output_func) -const char *string; /* characters to output */ -int range; /* number of lines affected, used for `*' delays */ -int FDECL((*output_func),(int)); /* actual output routine; +tputs(const char *string, /* characters to output */ + int range, /* number of lines affected, used for `*' delays */ + int (*output_func)(int)) /* actual output routine; * return value ignored */ { register int c, num = 0; diff --git a/sys/share/unixtty.c b/sys/share/unixtty.c index cc6a088ca..dd5f5682a 100644 --- a/sys/share/unixtty.c +++ b/sys/share/unixtty.c @@ -131,7 +131,7 @@ struct tchars inittyb2, curttyb2; * used unconditionally because it conflicts with the 'bool' one. */ #ifdef NEED_HAS_COLORS_DECL -int has_colors(); +int has_colors(void); #endif #if defined(TTY_GRAPHICS) && ((!defined(SYSV) && !defined(HPUX)) \ @@ -154,8 +154,7 @@ struct termstruct inittyb, curttyb; #ifdef POSIX_TYPES static int -speednum(speed) -speed_t speed; +speednum(speed_t speed) { switch (speed) { case B0: @@ -197,7 +196,7 @@ speed_t speed; #endif static void -setctty() +setctty(void) { if (STTY(&curttyb) < 0 || STTY2(&curttyb2) < 0) perror("NetHack (setctty)"); @@ -209,7 +208,7 @@ setctty() * Called by startup() in termcap.c and after returning from ! or ^Z */ void -gettty() +gettty(void) { if (GTTY(&inittyb) < 0 || GTTY2(&inittyb2) < 0) perror("NetHack (gettty)"); @@ -231,8 +230,7 @@ gettty() /* reset terminal to original state */ void -settty(s) -const char *s; +settty(const char *s) { end_screen(); if (s) @@ -247,7 +245,7 @@ const char *s; } void -setftty() +setftty(void) { unsigned ef, cf; int change = 0; @@ -314,7 +312,7 @@ setftty() start_screen(); } -void intron() /* enable kbd interupts if enabled when game started */ +void intron(void) /* enable kbd interupts if enabled when game started */ { #ifdef TTY_GRAPHICS /* Ugly hack to keep from changing tty modes for non-tty games -dlc */ @@ -326,7 +324,7 @@ void intron() /* enable kbd interupts if enabled when game started */ #endif } -void introff() /* disable kbd interrupts if required*/ +void introff(void) /* disable kbd interrupts if required*/ { #ifdef TTY_GRAPHICS /* Ugly hack to keep from changing tty modes for non-tty games -dlc */ @@ -349,13 +347,13 @@ int sco_flag_console = 0; int sco_map_valid = -1; unsigned char sco_chanmap_buf[BSIZE]; -void NDECL(sco_mapon); -void NDECL(sco_mapoff); -void NDECL(check_sco_console); -void NDECL(init_sco_cons); +void sco_mapon(void); +void sco_mapoff(void); +void check_sco_console(void); +void init_sco_cons(void); void -sco_mapon() +sco_mapon(void) { #ifdef TTY_GRAPHICS if (WINDOWPORT("tty") && sco_flag_console) { @@ -368,7 +366,7 @@ sco_mapon() } void -sco_mapoff() +sco_mapoff(void) { #ifdef TTY_GRAPHICS if (WINDOWPORT("tty") && sco_flag_console) { @@ -381,7 +379,7 @@ sco_mapoff() } void -check_sco_console() +check_sco_console(void) { if (isatty(0) && ioctl(0, CONS_GET, 0) != -1) { sco_flag_console = 1; @@ -389,7 +387,7 @@ check_sco_console() } void -init_sco_cons() +init_sco_cons(void) { #ifdef TTY_GRAPHICS if (WINDOWPORT("tty") && sco_flag_console) { @@ -413,13 +411,13 @@ init_sco_cons() int linux_flag_console = 0; -void NDECL(linux_mapon); -void NDECL(linux_mapoff); -void NDECL(check_linux_console); -void NDECL(init_linux_cons); +void linux_mapon(void); +void linux_mapoff(void); +void check_linux_console(void); +void init_linux_cons(void); void -linux_mapon() +linux_mapon(void) { #ifdef TTY_GRAPHICS if (WINDOWPORT("tty") && linux_flag_console) { @@ -429,7 +427,7 @@ linux_mapon() } void -linux_mapoff() +linux_mapoff(void) { #ifdef TTY_GRAPHICS if (WINDOWPORT("tty") && linux_flag_console) { @@ -439,7 +437,7 @@ linux_mapoff() } void -check_linux_console() +check_linux_console(void) { struct vt_mode vtm; @@ -449,7 +447,7 @@ check_linux_console() } void -init_linux_cons() +init_linux_cons(void) { #ifdef TTY_GRAPHICS if (WINDOWPORT("tty") && linux_flag_console) { @@ -466,20 +464,19 @@ init_linux_cons() #ifndef __begui__ /* the Be GUI will define its own error proc */ /* fatal error */ -/*VARARGS1*/ -void error -VA_DECL(const char *, s) +void +error(const char *s, ...) { - VA_START(s); - VA_INIT(s, const char *); + va_list the_args; + va_start(the_args, s); if (iflags.window_inited) exit_nhwindows((char *) 0); /* for tty, will call settty() */ if (settty_needed) settty((char *) 0); - Vprintf(s, VA_ARGS); + Vprintf(s, the_args); (void) putchar('\n'); - VA_END(); + va_end(the_args); exit(EXIT_FAILURE); } #endif /* !__begui__ */ diff --git a/sys/share/uudecode.c b/sys/share/uudecode.c index b998e4698..12b3d9339 100644 --- a/sys/share/uudecode.c +++ b/sys/share/uudecode.c @@ -88,9 +88,7 @@ static void outdec(char *, FILE *, int); #define DEC(c) (((c) - ' ') & 077) int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { FILE *in, *out; int mode; @@ -179,9 +177,7 @@ char **argv; * copy from in to out, decoding as you go along. */ void -decode(in, out) -FILE *in; -FILE *out; +decode(FILE *in, FILE *out) { char buf[80]; char *bp; @@ -218,10 +214,7 @@ FILE *out; * output all of them at the end of the file. */ void -outdec(p, f, n) -char *p; -FILE *f; -int n; +outdec(char *p, FILE *f, int n) { int c1, c2, c3; diff --git a/sys/unix/hints/include/compiler.2020 b/sys/unix/hints/include/compiler.2020 index 52b028ca2..e8ab62fcc 100755 --- a/sys/unix/hints/include/compiler.2020 +++ b/sys/unix/hints/include/compiler.2020 @@ -68,9 +68,8 @@ endif # clang # leave it out by default. #CFLAGS+=-Wunreachable-code # -# Can't use these; NetHack uses old-style-definitions -#CFLAGS+=-Wold-style-definition -#CFLAGS+=-Wstrict-prototypes +CFLAGS+=-Wold-style-definition +CFLAGS+=-Wstrict-prototypes #end of compiler.2020 #------------------------------------------------------------------------------ diff --git a/sys/unix/hints/include/cross-pre.2020 b/sys/unix/hints/include/cross-pre.2020 index 39860d1f1..502f9fd93 100644 --- a/sys/unix/hints/include/cross-pre.2020 +++ b/sys/unix/hints/include/cross-pre.2020 @@ -165,7 +165,11 @@ override TARGET_AR = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc-ar override TARGET_STUBEDIT = ../lib/djgpp/i586-pc-msdosdjgpp/bin/stubedit override TARGET_CFLAGS = -c -O -I../include -I../sys/msdos -I../win/share \ $(LUAINCL) -DDLB $(PDCURSESDEF) \ - -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS + -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \ + -Wall -Wextra -Wno-missing-field-initializers -Wimplicit \ + -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings \ + -Wimplicit-function-declaration -Wimplicit-int \ + -Wmissing-declarations -Wmissing-prototypes -Wmissing-parameter-type override TARGET_CXXFLAGS = $(TARGET_CFLAGS) override TARGET_LINK = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc override TARGET_LFLAGS= diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index c6fea0d3b..98b572f44 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -19,36 +19,34 @@ #if !defined(_BULL_SOURCE) && !defined(__sgi) && !defined(_M_UNIX) #if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__)) #if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX) -extern struct passwd *FDECL(getpwuid, (uid_t)); +extern struct passwd *getpwuid(uid_t); #else -extern struct passwd *FDECL(getpwuid, (int)); +extern struct passwd *getpwuid(int); #endif #endif #endif -extern struct passwd *FDECL(getpwnam, (const char *)); +extern struct passwd *getpwnam(const char *); #ifdef CHDIR -static void FDECL(chdirx, (const char *, BOOLEAN_P)); +static void chdirx(const char *, boolean); #endif /* CHDIR */ -static boolean NDECL(whoami); -static void FDECL(process_options, (int, char **)); +static boolean whoami(void); +static void process_options(int, char **); #ifdef _M_UNIX -extern void NDECL(check_sco_console); -extern void NDECL(init_sco_cons); +extern void check_sco_console(void); +extern void init_sco_cons(void); #endif #ifdef __linux__ -extern void NDECL(check_linux_console); -extern void NDECL(init_linux_cons); +extern void check_linux_console(void); +extern void init_linux_cons(void); #endif -static void NDECL(wd_message); +static void wd_message(void); static boolean wiz_error_flag = FALSE; -static struct passwd *NDECL(get_unix_pw); +static struct passwd *get_unix_pw(void); int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { #ifdef CHDIR register char *dir; @@ -343,9 +341,7 @@ char *argv[]; /* caveat: argv elements might be arbitrary long */ static void -process_options(argc, argv) -int argc; -char *argv[]; +process_options(int argc, char *argv[]) { int i, l; @@ -465,9 +461,7 @@ char *argv[]; #ifdef CHDIR static void -chdirx(dir, wr) -const char *dir; -boolean wr; +chdirx(const char *dir, boolean wr) { if (dir /* User specified directory? */ #ifdef HACKDIR @@ -525,7 +519,7 @@ boolean wr; /* returns True iff we set plname[] to username which contains a hyphen */ static boolean -whoami() +whoami(void) { /* * Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS @@ -557,8 +551,7 @@ whoami() } void -sethanguphandler(handler) -void FDECL((*handler), (int)); +sethanguphandler(void (*handler)(int)) { #ifdef SA_RESTART /* don't want reads to restart. If SA_RESTART is defined, we know @@ -585,7 +578,7 @@ void FDECL((*handler), (int)); #ifdef PORT_HELP void -port_help() +port_help(void) { /* * Display unix-specific help. Just show contents of the helpfile @@ -597,7 +590,7 @@ port_help() /* validate wizard mode if player has requested access to it */ boolean -authorize_wizard_mode() +authorize_wizard_mode(void) { struct passwd *pw = get_unix_pw(); @@ -610,7 +603,7 @@ authorize_wizard_mode() } static void -wd_message() +wd_message(void) { if (wiz_error_flag) { if (sysopt.wizards && sysopt.wizards[0]) { @@ -630,8 +623,7 @@ wd_message() * be room for the / */ void -append_slash(name) -char *name; +append_slash(char *name) { char *ptr; @@ -646,8 +638,7 @@ char *name; } boolean -check_user_string(optstr) -const char *optstr; +check_user_string(const char *optstr) { struct passwd *pw; int pwlen; @@ -683,7 +674,7 @@ const char *optstr; } static struct passwd * -get_unix_pw() +get_unix_pw(void) { char *user; unsigned uid; @@ -714,7 +705,7 @@ get_unix_pw() } char * -get_login_name() +get_login_name(void) { static char buf[BUFSZ]; struct passwd *pw = get_unix_pw(); @@ -730,8 +721,7 @@ get_login_name() extern int errno; void -port_insert_pastebuf(buf) -char *buf; +port_insert_pastebuf(char *buf) { /* This should be replaced when there is a Cocoa port. */ const char *errfmt; @@ -765,7 +755,7 @@ char *buf; #endif /* __APPLE__ */ unsigned long -sys_random_seed() +sys_random_seed(void) { unsigned long seed = 0L; unsigned long pid = (unsigned long) getpid(); diff --git a/sys/unix/unixres.c b/sys/unix/unixres.c index f44cd2cc5..f2a2fe8a6 100644 --- a/sys/unix/unixres.c +++ b/sys/unix/unixres.c @@ -24,8 +24,7 @@ #include static int -real_getresuid(ruid, euid, suid) -uid_t *ruid, *euid, *suid; +real_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) { int (*f)(uid_t *, uid_t *, uid_t *); /* getresuid signature */ @@ -37,8 +36,7 @@ uid_t *ruid, *euid, *suid; } static int -real_getresgid(rgid, egid, sgid) -gid_t *rgid, *egid, *sgid; +real_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) { int (*f)(gid_t *, gid_t *, gid_t *); /* getresgid signature */ @@ -55,8 +53,7 @@ gid_t *rgid, *egid, *sgid; #ifdef SYS_getresuid static int -real_getresuid(ruid, euid, suid) -uid_t *ruid, *euid, *suid; +real_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) { return syscall(SYS_getresuid, ruid, euid, suid); } @@ -68,8 +65,7 @@ uid_t *ruid, *euid, *suid; #endif /* SVR4 */ static int -real_getresuid(ruid, euid, suid) -uid_t *ruid, *euid, *suid; +real_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) { int retval; int pfd[2]; @@ -93,8 +89,7 @@ uid_t *ruid, *euid, *suid; #ifdef SYS_getresgid static int -real_getresgid(rgid, egid, sgid) -gid_t *rgid, *egid, *sgid; +real_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) { return syscall(SYS_getresgid, rgid, egid, sgid); } @@ -102,8 +97,7 @@ gid_t *rgid, *egid, *sgid; #else /* SYS_getresgid */ static int -real_getresgid(rgid, egid, sgid) -gid_t *rgid, *egid, *sgid; +real_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) { int retval; int pfd[2]; @@ -133,8 +127,7 @@ static unsigned int hiding_privileges = 0; */ int -hide_privileges(flag) -boolean flag; +hide_privileges(boolean flag) { if (flag) hiding_privileges++; @@ -144,8 +137,7 @@ boolean flag; } int -nh_getresuid(ruid, euid, suid) -uid_t *ruid, *euid, *suid; +nh_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) { int retval = real_getresuid(ruid, euid, suid); @@ -155,7 +147,7 @@ uid_t *ruid, *euid, *suid; } uid_t -nh_getuid() +nh_getuid(void) { uid_t ruid, euid, suid; @@ -164,7 +156,7 @@ nh_getuid() } uid_t -nh_geteuid() +nh_geteuid(void) { uid_t ruid, euid, suid; @@ -175,8 +167,7 @@ nh_geteuid() } int -nh_getresgid(rgid, egid, sgid) -gid_t *rgid, *egid, *sgid; +nh_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) { int retval = real_getresgid(rgid, egid, sgid); @@ -186,7 +177,7 @@ gid_t *rgid, *egid, *sgid; } gid_t -nh_getgid() +nh_getgid(void) { gid_t rgid, egid, sgid; @@ -195,7 +186,7 @@ nh_getgid() } gid_t -nh_getegid() +nh_getegid(void) { gid_t rgid, egid, sgid; @@ -209,8 +200,7 @@ nh_getegid() #ifdef GNOME_GRAPHICS int -hide_privileges(flag) -boolean flag; +hide_privileges(boolean flag) { return 0; } diff --git a/sys/unix/unixunix.c b/sys/unix/unixunix.c index 77d3527db..cd8a7daa8 100644 --- a/sys/unix/unixunix.c +++ b/sys/unix/unixunix.c @@ -15,12 +15,12 @@ #include #ifdef _M_UNIX -extern void NDECL(sco_mapon); -extern void NDECL(sco_mapoff); +extern void sco_mapon(void); +extern void sco_mapoff(void); #endif #ifdef __linux__ -extern void NDECL(linux_mapon); -extern void NDECL(linux_mapoff); +extern void linux_mapon(void); +extern void linux_mapoff(void); #endif #ifndef NHSTDC @@ -32,8 +32,7 @@ static struct stat buf; /* see whether we should throw away this xlock file; if yes, close it, otherwise leave it open */ static int -veryold(fd) -int fd; +veryold(int fd) { time_t date; @@ -71,7 +70,7 @@ int fd; } static int -eraseoldlocks() +eraseoldlocks(void) { register int i; @@ -92,7 +91,7 @@ eraseoldlocks() } void -getlock() +getlock(void) { register int i = 0, fd, c; const char *fq_lock; @@ -215,8 +214,7 @@ gotlock: /* normalize file name - we don't like .'s, /'s, spaces */ void -regularize(s) -register char *s; +regularize(char *s) { register char *lp; @@ -250,8 +248,7 @@ register char *s; #include void -msleep(msec) -unsigned msec; /* milliseconds */ +msleep(unsigned msec) /* milliseconds */ { struct pollfd unused; int msecs = msec; /* poll API is signed */ @@ -264,7 +261,7 @@ unsigned msec; /* milliseconds */ #ifdef SHELL int -dosh() +dosh(void) { char *str; @@ -290,8 +287,7 @@ dosh() #if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER) int -child(wt) -int wt; +child(int wt) { register int f; @@ -342,44 +338,42 @@ int wt; #ifdef GETRES_SUPPORT -extern int FDECL(nh_getresuid, (uid_t *, uid_t *, uid_t *)); -extern uid_t NDECL(nh_getuid); -extern uid_t NDECL(nh_geteuid); -extern int FDECL(nh_getresgid, (gid_t *, gid_t *, gid_t *)); -extern gid_t NDECL(nh_getgid); -extern gid_t NDECL(nh_getegid); +extern int nh_getresuid(uid_t *, uid_t *, uid_t *); +extern uid_t nh_getuid(void); +extern uid_t nh_geteuid(void); +extern int nh_getresgid(gid_t *, gid_t *, gid_t *); +extern gid_t nh_getgid(void); +extern gid_t nh_getegid(void); /* the following several functions assume __STDC__ where parentheses around the name of a function-like macro prevent macro expansion */ -int (getresuid)(ruid, euid, suid) -uid_t *ruid, *euid, *suid; +int (getresuid)(uid_t *ruid, *euid, *suid) { return nh_getresuid(ruid, euid, suid); } -uid_t (getuid)() +uid_t (getuid)(void) { return nh_getuid(); } -uid_t (geteuid)() +uid_t (geteuid)(void) { return nh_geteuid(); } -int (getresgid)(rgid, egid, sgid) -gid_t *rgid, *egid, *sgid; +int (getresgid)(gid_t *rgid, *egid, *sgid) { return nh_getresgid(rgid, egid, sgid); } -gid_t (getgid)() +gid_t (getgid)(void) { return nh_getgid(); } -gid_t (getegid)() +gid_t (getegid)(void) { return nh_getegid(); } @@ -389,8 +383,7 @@ gid_t (getegid)() /* XXX should be ifdef PANICTRACE_GDB, but there's no such symbol yet */ #ifdef PANICTRACE boolean -file_exists(path) -const char *path; +file_exists(const char *path) { struct stat sb; diff --git a/sys/winnt/nh340key.c b/sys/winnt/nh340key.c index 348bd89e8..ec2e82711 100644 --- a/sys/winnt/nh340key.c +++ b/sys/winnt/nh340key.c @@ -22,9 +22,8 @@ extern INPUT_RECORD ir; char dllname[512]; char *shortdllname; -int FDECL(__declspec(dllexport) __stdcall ProcessKeystroke, - (HANDLE hConIn, INPUT_RECORD *ir, boolean *valid, - BOOLEAN_P numberpad, int portdebug)); +int __declspec(dllexport) __stdcall ProcessKeystroke(HANDLE hConIn, + INPUT_RECORD *ir, boolean *valid, boolean numberpad, int portdebug); int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) @@ -101,17 +100,16 @@ static const struct pad { #define inmap(x, vk) (((x) > 'A' && (x) < 'Z') || (vk) == 0xBF || (x) == '2') -int __declspec(dllexport) __stdcall ProcessKeystroke(hConIn, ir, valid, - numberpad, portdebug) -HANDLE hConIn; -INPUT_RECORD *ir; -boolean *valid; -boolean numberpad; -int portdebug; +int __declspec(dllexport) __stdcall +ProcessKeystroke( + HANDLE hConIn, + INPUT_RECORD *ir, + boolean *valid, + boolean numberpad, + int portdebug) { - int metaflags = 0, k = 0; int keycode, vk; - unsigned char ch, pre_ch, mk = 0; + unsigned char ch, pre_ch; unsigned short int scan; unsigned long shiftstate; int altseq = 0; @@ -193,9 +191,10 @@ int portdebug; return ch; } -int __declspec(dllexport) __stdcall NHkbhit(hConIn, ir) -HANDLE hConIn; -INPUT_RECORD *ir; +int __declspec(dllexport) __stdcall +NHkbhit( + HANDLE hConIn, + INPUT_RECORD *ir) { int done = 0; /* true = "stop searching" */ int retval; /* true = "we had a match" */ @@ -247,20 +246,19 @@ INPUT_RECORD *ir; return retval; } -int __declspec(dllexport) __stdcall CheckInput(hConIn, ir, count, numpad, - mode, mod, cc) -HANDLE hConIn; -INPUT_RECORD *ir; -DWORD *count; -boolean numpad; -int mode; -int *mod; -coord *cc; +int __declspec(dllexport) __stdcall CheckInput( + HANDLE hConIn, + INPUT_RECORD *ir, + DWORD *count, + boolean numpad, + int mode, + int *mod, + coord *cc) { #if defined(SAFERHANGUP) DWORD dwWait; #endif - int ch; + int ch = 0; boolean valid = 0, done = 0; #ifdef QWERTZ_SUPPORT @@ -324,8 +322,8 @@ coord *cc; return mode ? 0 : ch; } -int __declspec(dllexport) __stdcall SourceWhere(buf) -char **buf; +int __declspec(dllexport) __stdcall +SourceWhere(char** buf) { if (!buf) return 0; @@ -333,8 +331,8 @@ char **buf; return 1; } -int __declspec(dllexport) __stdcall SourceAuthor(buf) -char **buf; +int __declspec(dllexport) __stdcall +SourceAuthor(char** buf) { if (!buf) return 0; @@ -342,9 +340,8 @@ char **buf; return 1; } -int __declspec(dllexport) __stdcall KeyHandlerName(buf, full) -char **buf; -int full; +int __declspec(dllexport) __stdcall +KeyHandlerName(char** buf, int full) { if (!buf) return 0; diff --git a/sys/winnt/nhdefkey.c b/sys/winnt/nhdefkey.c index 32b7c95dd..1f2f9d51e 100644 --- a/sys/winnt/nhdefkey.c +++ b/sys/winnt/nhdefkey.c @@ -29,9 +29,8 @@ extern INPUT_RECORD ir; char dllname[512]; char *shortdllname; -int FDECL(__declspec(dllexport) __stdcall ProcessKeystroke, - (HANDLE hConIn, INPUT_RECORD *ir, boolean *valid, - BOOLEAN_P numberpad, int portdebug)); +int __declspec(dllexport) __stdcall ProcessKeystroke(HANDLE hConIn, + INPUT_RECORD *ir, boolean *valid, boolean numberpad, int portdebug); int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) @@ -110,17 +109,17 @@ static const struct pad { static BYTE KeyState[256]; -int __declspec(dllexport) __stdcall ProcessKeystroke(hConIn, ir, valid, - numberpad, portdebug) -HANDLE hConIn; -INPUT_RECORD *ir; -boolean *valid; -boolean numberpad; -int portdebug; +int __declspec(dllexport) __stdcall +ProcessKeystroke( + HANDLE hConIn, + INPUT_RECORD* ir, + boolean* valid, + boolean numberpad, + int portdebug) { - int metaflags = 0, k = 0; + int k = 0; int keycode, vk; - unsigned char ch, pre_ch, mk = 0; + unsigned char ch, pre_ch; unsigned short int scan; unsigned long shiftstate; int altseq = 0; @@ -224,9 +223,8 @@ int portdebug; return ch; } -int __declspec(dllexport) __stdcall NHkbhit(hConIn, ir) -HANDLE hConIn; -INPUT_RECORD *ir; +int __declspec(dllexport) __stdcall +NHkbhit(HANDLE hConIn, INPUT_RECORD *ir) { int done = 0; /* true = "stop searching" */ int retval; /* true = "we had a match" */ @@ -278,20 +276,20 @@ INPUT_RECORD *ir; return retval; } -int __declspec(dllexport) __stdcall CheckInput(hConIn, ir, count, numpad, - mode, mod, cc) -HANDLE hConIn; -INPUT_RECORD *ir; -DWORD *count; -boolean numpad; -int mode; -int *mod; -coord *cc; +int __declspec(dllexport) __stdcall +CheckInput( + HANDLE hConIn, + INPUT_RECORD *ir, + DWORD* count, + boolean numpad, + int mode, + int *mod, + coord *cc) { #if defined(SAFERHANGUP) DWORD dwWait; #endif - int ch; + int ch = 0; boolean valid = 0, done = 0; #ifdef QWERTZ_SUPPORT @@ -355,8 +353,8 @@ coord *cc; return mode ? 0 : ch; } -int __declspec(dllexport) __stdcall SourceWhere(buf) -char **buf; +int __declspec(dllexport) __stdcall +SourceWhere(char** buf) { if (!buf) return 0; @@ -364,8 +362,8 @@ char **buf; return 1; } -int __declspec(dllexport) __stdcall SourceAuthor(buf) -char **buf; +int __declspec(dllexport) __stdcall +SourceAuthor(char **buf) { if (!buf) return 0; @@ -373,9 +371,8 @@ char **buf; return 1; } -int __declspec(dllexport) __stdcall KeyHandlerName(buf, full) -char **buf; -int full; +int __declspec(dllexport) __stdcall +KeyHandlerName(char **buf, int full) { if (!buf) return 0; diff --git a/sys/winnt/nhraykey.c b/sys/winnt/nhraykey.c index 5bd9e3ead..51d513587 100644 --- a/sys/winnt/nhraykey.c +++ b/sys/winnt/nhraykey.c @@ -169,9 +169,8 @@ extern INPUT_RECORD ir; char dllname[512]; char *shortdllname; -int FDECL(__declspec(dllexport) __stdcall ProcessKeystroke, - (HANDLE hConIn, INPUT_RECORD *ir, boolean *valid, - BOOLEAN_P numberpad, int portdebug)); +int __declspec(dllexport) __stdcall ProcessKeystroke(HANDLE hConIn, + INPUT_RECORD *ir, boolean *valid, boolean numberpad, int portdebug); static INPUT_RECORD bogus_key; @@ -262,14 +261,13 @@ static const struct pad { #define inmap(x, vk) (((x) > 'A' && (x) < 'Z') || (vk) == 0xBF || (x) == '2') /* Use process_keystroke for key commands, process_keystroke2 for prompts */ -/* int FDECL(process_keystroke, (INPUT_RECORD *ir, boolean *valid, int - * portdebug)); */ -int FDECL(process_keystroke2, (HANDLE, INPUT_RECORD *ir, boolean *valid)); -static int FDECL(is_altseq, (unsigned long shiftstate)); +/* int process_keystroke(INPUT_RECORD *ir, boolean *valid, int + * portdebug); */ +int process_keystroke2(HANDLE, INPUT_RECORD *ir, boolean *valid); +static int is_altseq(unsigned long shiftstate); static int -is_altseq(shiftstate) -unsigned long shiftstate; +is_altseq(unsigned long shiftstate) { /* We need to distinguish the Alt keys from the AltGr key. * On NT-based Windows, AltGr signals as right Alt and left Ctrl together; @@ -291,17 +289,16 @@ unsigned long shiftstate; } } -int __declspec(dllexport) __stdcall ProcessKeystroke(hConIn, ir, valid, - numberpad, portdebug) -HANDLE hConIn; -INPUT_RECORD *ir; -boolean *valid; -boolean numberpad; -int portdebug; +int __declspec(dllexport) __stdcall +ProcessKeystroke( + HANDLE hConIn, + INPUT_RECORD *ir, + boolean *valid, + boolean numberpad, + int portdebug) { - int metaflags = 0, k = 0; int keycode, vk; - unsigned char ch, pre_ch, mk = 0; + unsigned char ch, pre_ch; unsigned short int scan; unsigned long shiftstate; int altseq = 0; @@ -413,10 +410,10 @@ int portdebug; } int -process_keystroke2(hConIn, ir, valid) -HANDLE hConIn; -INPUT_RECORD *ir; -boolean *valid; +process_keystroke2( + HANDLE hConIn, + INPUT_RECORD *ir, + boolean *valid) { /* Use these values for the numeric keypad */ static const char keypad_nums[] = "789-456+1230."; @@ -479,20 +476,20 @@ boolean *valid; return ch; } -int __declspec(dllexport) __stdcall CheckInput(hConIn, ir, count, numpad, - mode, mod, cc) -HANDLE hConIn; -INPUT_RECORD *ir; -DWORD *count; -int mode; -int *mod; -boolean numpad; -coord *cc; +int __declspec(dllexport) __stdcall +CheckInput( + HANDLE hConIn, + INPUT_RECORD *ir, + DWORD *count, + boolean numpad, + int mode, + int *mod, + coord *cc) { #if defined(SAFERHANGUP) DWORD dwWait; #endif - int ch; + int ch = 0; boolean valid = 0, done = 0; #ifdef QWERTZ_SUPPORT @@ -577,9 +574,9 @@ coord *cc; return ch; } -int __declspec(dllexport) __stdcall NHkbhit(hConIn, ir) -HANDLE hConIn; -INPUT_RECORD *ir; +int __declspec(dllexport) __stdcall NHkbhit( + HANDLE hConIn, + INPUT_RECORD *ir) { int done = 0; /* true = "stop searching" */ int retval; /* true = "we had a match" */ @@ -637,8 +634,8 @@ INPUT_RECORD *ir; return retval; } -int __declspec(dllexport) __stdcall SourceWhere(buf) -char **buf; +int __declspec(dllexport) __stdcall +SourceWhere(char** buf) { if (!buf) return 0; @@ -646,8 +643,8 @@ char **buf; return 1; } -int __declspec(dllexport) __stdcall SourceAuthor(buf) -char **buf; +int __declspec(dllexport) __stdcall +SourceAuthor(char** buf) { if (!buf) return 0; @@ -655,9 +652,9 @@ char **buf; return 1; } -int __declspec(dllexport) __stdcall KeyHandlerName(buf, full) -char **buf; -int full; +int __declspec(dllexport) __stdcall KeyHandlerName( + char **buf, + int full) { if (!buf) return 0; diff --git a/sys/winnt/ntsound.c b/sys/winnt/ntsound.c index 69450b748..e54f2d68d 100644 --- a/sys/winnt/ntsound.c +++ b/sys/winnt/ntsound.c @@ -17,9 +17,7 @@ #ifdef USER_SOUNDS void -play_usersound(filename, volume) -const char *filename; -int volume; +play_usersound(const char* filename, int volume) { /* pline("play_usersound: %s (%d).", filename, volume); */ (void) sndPlaySound(filename, SND_ASYNC | SND_NODEFAULT); diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index c1f1a0f70..2245dd048 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -70,19 +70,19 @@ cell_t undefined_cell = { CONSOLE_UNDEFINED_CHARACTER, * GetConsoleOutputCP */ -static BOOL FDECL(CtrlHandler, (DWORD)); -static void FDECL(xputc_core, (char)); -void FDECL(cmov, (int, int)); -void FDECL(nocmov, (int, int)); -int FDECL(process_keystroke, - (INPUT_RECORD *, boolean *, BOOLEAN_P numberpad, int portdebug)); -static void NDECL(init_ttycolor); -static void NDECL(really_move_cursor); -static void NDECL(check_and_set_font); -static boolean NDECL(check_font_widths); -static void NDECL(set_known_good_console_font); -static void NDECL(restore_original_console_font); -extern void NDECL(safe_routines); +static BOOL CtrlHandler(DWORD); +static void xputc_core(char); +void cmov(int, int); +void nocmov(int, int); +int process_keystroke(INPUT_RECORD *, boolean *, boolean numberpad, + int portdebug); +static void init_ttycolor(void); +static void really_move_cursor(void); +static void check_and_set_font(void); +static boolean check_font_widths(void); +static void set_known_good_console_font(void); +static void restore_original_console_font(void); +extern void safe_routines(void); /* Win32 Screen buffer,coordinate,console I/O information */ COORD ntcoord; @@ -105,8 +105,8 @@ static boolean init_ttycolor_completed; static boolean display_cursor_info = FALSE; #endif #ifdef CHANGE_COLOR -static void NDECL(adjust_palette); -static int FDECL(match_color_name, (const char *)); +static void adjust_palette(void); +static int match_color_name(const char *); typedef HWND(WINAPI *GETCONSOLEWINDOW)(); static HWND GetConsoleHandle(void); static HWND GetConsoleHwnd(void); @@ -181,11 +181,11 @@ char erase_char, kill_char; /* dynamic keystroke handling .DLL support */ typedef int(__stdcall *PROCESS_KEYSTROKE)(HANDLE, INPUT_RECORD *, boolean *, - BOOLEAN_P, int); + boolean, int); typedef int(__stdcall *NHKBHIT)(HANDLE, INPUT_RECORD *); -typedef int(__stdcall *CHECKINPUT)(HANDLE, INPUT_RECORD *, DWORD *, BOOLEAN_P, +typedef int(__stdcall *CHECKINPUT)(HANDLE, INPUT_RECORD *, DWORD *, boolean, int, int *, coord *); typedef int(__stdcall *SOURCEWHERE)(char **); @@ -305,8 +305,7 @@ gettty() /* reset terminal to original state */ void -settty(s) -const char *s; +settty(const char* s) { cmov(ttyDisplay->curx, ttyDisplay->cury); end_screen(); @@ -334,8 +333,7 @@ setftty() } void -tty_startup(wid, hgt) -int *wid, *hgt; +tty_startup(int *wid, int *hgt) { *wid = console.width; *hgt = console.height; @@ -343,8 +341,7 @@ int *wid, *hgt; } void -tty_number_pad(state) -int state; +tty_number_pad(int state) { // do nothing } @@ -367,8 +364,7 @@ tty_end_screen() } static BOOL -CtrlHandler(ctrltype) -DWORD ctrltype; +CtrlHandler(DWORD ctrltype) { switch (ctrltype) { /* case CTRL_C_EVENT: */ @@ -392,8 +388,7 @@ DWORD ctrltype; /* called by pcmain() and process_options() */ void -nttty_open(mode) -int mode; // unused +nttty_open(int mode) { DWORD cmode; @@ -421,11 +416,11 @@ nttty_exit() } int -process_keystroke(ir, valid, numberpad, portdebug) -INPUT_RECORD *ir; -boolean *valid; -boolean numberpad; -int portdebug; +process_keystroke( + INPUT_RECORD *ir, + boolean *valid, + boolean numberpad, + int portdebug) { int ch; @@ -473,11 +468,10 @@ tgetch() } int -ntposkey(x, y, mod) -int *x, *y, *mod; +ntposkey(int *x, int *y, int *mod) { int ch; - coord cc; + coord cc = { 0, 0 }; DWORD count; boolean numpad = iflags.num_pad; @@ -542,8 +536,7 @@ really_move_cursor() } void -cmov(x, y) -register int x, y; +cmov(int x, int y) { ttyDisplay->cury = y; ttyDisplay->curx = x; @@ -552,8 +545,7 @@ register int x, y; } void -nocmov(x, y) -int x, y; +nocmov(int x, int y) { ttyDisplay->curx = x; ttyDisplay->cury = y; @@ -563,8 +555,7 @@ int x, y; /* same signature as 'putchar()' with potential failure result ignored */ int -xputc(ch) -int ch; +xputc(int ch) { set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); xputc_core((char) ch); @@ -572,8 +563,7 @@ int ch; } void -xputs(s) -const char *s; +xputs(const char* s) { int k; int slen = (int) strlen(s); @@ -592,8 +582,7 @@ const char *s; * on the display. */ void -xputc_core(ch) -char ch; +xputc_core(char ch) { nhassert(console.cursor.X >= 0 && console.cursor.X < console.width); nhassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); @@ -652,8 +641,7 @@ char ch; */ void -g_putch(in_ch) -int in_ch; +g_putch(int in_ch) { boolean inverse = FALSE; unsigned char ch = (unsigned char) in_ch; @@ -676,7 +664,7 @@ int in_ch; } void -cl_end() +cl_end(void) { set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); buffer_clear_to_end_of_line(console.back_buffer, console.cursor.X, @@ -685,7 +673,7 @@ cl_end() } void -raw_clear_screen() +raw_clear_screen(void) { if (WINDOWPORT("tty")) { cell_t * back = console.back_buffer; @@ -715,28 +703,28 @@ raw_clear_screen() } void -clear_screen() +clear_screen(void) { buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0); home(); } void -home() +home(void) { ttyDisplay->curx = ttyDisplay->cury = 0; set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); } void -backsp() +backsp(void) { set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); xputc_core('\b'); } void -cl_eos() +cl_eos(void) { buffer_fill_to_end(console.back_buffer, &clear_cell, ttyDisplay->curx, ttyDisplay->cury); @@ -744,7 +732,7 @@ cl_eos() } void -tty_nhbell() +tty_nhbell(void) { if (flags.silent || iflags.debug_fuzzer) return; @@ -754,7 +742,7 @@ tty_nhbell() volatile int junk; /* prevent optimizer from eliminating loop below */ void -tty_delay_output() +tty_delay_output(void) { /* delay 50 ms - uses ANSI C clock() function now */ clock_t goal; @@ -792,7 +780,7 @@ tty_delay_output() */ static void -init_ttycolor() +init_ttycolor(void) { #ifdef TEXTCOLOR ttycolors[CLR_BLACK] = FOREGROUND_INTENSITY; /* fix by Quietust */ @@ -927,20 +915,20 @@ term_end_color(void) } void -standoutbeg() +standoutbeg(void) { term_start_attr(ATR_BOLD); } void -standoutend() +standoutend(void) { term_end_attr(ATR_BOLD); } #ifndef NO_MOUSE_ALLOWED void -toggle_mouse_support() +toggle_mouse_support(void) { static int qeinit = 0; DWORD cmode; @@ -972,8 +960,7 @@ toggle_mouse_support() /* handle tty options updates here */ void -nttty_preference_update(pref) -const char *pref; +nttty_preference_update(const char* pref) { if (stricmp(pref, "mouse_support") == 0) { #ifndef NO_MOUSE_ALLOWED @@ -987,11 +974,11 @@ const char *pref; #ifdef PORT_DEBUG void -win32con_debug_keystrokes() +win32con_debug_keystrokes(void) { DWORD count; boolean valid = 0; - int ch; + int ch = 0; xputs("\n"); while (!valid || ch != 27) { nocmov(ttyDisplay->curx, ttyDisplay->cury); @@ -1002,7 +989,7 @@ win32con_debug_keystrokes() (void) doredraw(); } void -win32con_handler_info() +win32con_handler_info(void) { char *buf; int ci; @@ -1034,15 +1021,14 @@ win32con_handler_info() } void -win32con_toggle_cursor_info() +win32con_toggle_cursor_info(void) { display_cursor_info = !display_cursor_info; } #endif void -map_subkeyvalue(op) -register char *op; +map_subkeyvalue(char* op) { char digits[] = "0123456789"; int length, i, idx, val; @@ -1074,7 +1060,7 @@ register char *op; key_overrides[idx] = val; } -void unload_keyboard_handler() +void unload_keyboard_handler(void) { nhassert(keyboard_handler.hLibrary != NULL); @@ -1170,7 +1156,7 @@ VA_DECL(const char *, s) } void -synch_cursor() +synch_cursor(void) { really_move_cursor(); } @@ -1396,7 +1382,7 @@ static void GetConsoleSizeInfo(CONSOLE_INFO *pci); VOID WINAPI SetConsolePalette(COLORREF crPalette[16]); void -adjust_palette(VOID_ARGS) +adjust_palette(void) { SetConsolePalette(UserDefinedColors); altered_palette = 0; @@ -1639,6 +1625,9 @@ check_font_widths() /* select font */ HGDIOBJ saved_font = SelectObject(hDC, console_font); + /* measure the set of used glyphs to ensure they fit */ + boolean all_glyphs_fit = FALSE; + /* determine whether it is a true type font */ TEXTMETRICA tm; success = GetTextMetricsA(hDC, &tm); @@ -1664,8 +1653,7 @@ check_font_widths() if (used[i]) wcUsed[wcUsedCount++] = cp437[i]; - /* measure the set of used glyphs to ensure they fit */ - boolean all_glyphs_fit = TRUE; + all_glyphs_fit = TRUE; for (int i = 0; i < wcUsedCount; i++) { int width; @@ -1911,12 +1899,12 @@ void nethack_enter_nttty() /* grow the size of the console buffer if it is not wide enough */ if (console.origcsbi.dwSize.X < console.width) { - COORD size = { - size.Y = console.origcsbi.dwSize.Y, - size.X = console.width + COORD screen_size = { + screen_size.Y = console.origcsbi.dwSize.Y, + screen_size.X = console.width }; - SetConsoleScreenBufferSize(console.hConOut, size); + SetConsoleScreenBufferSize(console.hConOut, screen_size); } /* setup front and back buffers */ diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index 7e7fe01f6..ea9413a81 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -18,12 +18,12 @@ struct window_procs Qt_procs = { "-guistubs" }; int qt_tilewidth, qt_tileheight, qt_fontsize, qt_compact_mode; #endif void -mswin_destroy_reg() +mswin_destroy_reg(void) { return; } void -mswin_raw_print_flush() +mswin_raw_print_flush(void) { } @@ -41,9 +41,7 @@ extern char default_window_sys[]; extern int mingw_main(int argc, char **argv); int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { boolean resuming; @@ -69,54 +67,50 @@ char erase_char, kill_char; #endif void -win_tty_init(dir) -int dir; +win_tty_init(int dir) { return; } void -nttty_open(mode) -int mode; +nttty_open(int mode) { return; } int -xputc(ch) -int ch; +xputc(int ch) { return 0; } void -xputs(s) -const char *s; +xputs(const char *s) { return; } void -raw_clear_screen() +raw_clear_screen(void) { return; } void -clear_screen() +clear_screen(void) { return; } void -backsp() +backsp(void) { return; } #ifndef NO_MOUSE_ALLOWED void -toggle_mouse_support() +toggle_mouse_support(void) { return; } @@ -124,20 +118,19 @@ toggle_mouse_support() #ifdef PORT_DEBUG void -win32con_debug_keystrokes() +win32con_debug_keystrokes(void) { return; } void -win32con_handler_info() +win32con_handler_info(void) { return; } #endif void -map_subkeyvalue(op) -register char *op; +map_subkeyvalue(char *op) { return; } @@ -166,20 +159,20 @@ VA_DECL(const char *, s) #ifdef TTY_GRAPHICS void -synch_cursor() +synch_cursor(void) { return; } #endif void -more() +more(void) { return; } void -nethack_enter_nttty() +nethack_enter_nttty(void) { return; } @@ -192,8 +185,7 @@ set_altkeyhandler(const char *inName) #if defined(USER_SOUNDS) && defined(TTY_SOUND_ESCCODES) void -play_usersound_via_idx(idx, volume) -int idx, volume; +play_usersound_via_idx(int idx, int volume) { } #endif /* USER_SOUNDS && TTY_SOUND_ESCCODES */ diff --git a/sys/winnt/win10.c b/sys/winnt/win10.c index 80542574e..98bd5ae3c 100644 --- a/sys/winnt/win10.c +++ b/sys/winnt/win10.c @@ -25,7 +25,7 @@ typedef struct { Win10 gWin10 = { 0 }; -void win10_init() +void win10_init(void) { if (IsWindows10OrGreater()) { @@ -107,7 +107,7 @@ void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo) } BOOL -win10_is_desktop_bridge_application() +win10_is_desktop_bridge_application(void) { if (gWin10.Valid) { UINT32 length = 0; diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index a18999a78..7b2ba200b 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -17,23 +17,21 @@ #error You must #define SAFEPROCS to build windmain.c #endif -#define E extern -static void FDECL(process_options, (int argc, char **argv)); -static void NDECL(nhusage); -static char *NDECL(get_executable_path); -char *FDECL(translate_path_variables, (const char *, char *)); -char *NDECL(exename); -boolean NDECL(fakeconsole); -void NDECL(freefakeconsole); -E void FDECL(nethack_exit, (int)) NORETURN; +static void process_options(int argc, char **argv); +static void nhusage(void); +static char *get_executable_path(void); +char *translate_path_variables(const char *, char *); +char *exename(void); +boolean fakeconsole(void); +void freefakeconsole(void); +extern void nethack_exit(int) NORETURN; #if defined(MSWIN_GRAPHICS) -E void NDECL(mswin_destroy_reg); +extern void mswin_destroy_reg(void); #endif #ifdef TTY_GRAPHICS -extern void NDECL(backsp); +extern void backsp(void); #endif -extern void NDECL(clear_screen); -#undef E +extern void clear_screen(void); #ifdef _MSC_VER #ifdef kbhit @@ -43,18 +41,18 @@ extern void NDECL(clear_screen); #endif #ifdef PC_LOCKING -static int NDECL(eraseoldlocks); +static int eraseoldlocks(void); #endif -int NDECL(windows_nhgetch); -void NDECL(windows_nhbell); -int FDECL(windows_nh_poskey, (int *, int *, int *)); -void FDECL(windows_raw_print, (const char *)); -char FDECL(windows_yn_function, (const char *, const char *, CHAR_P)); -static void FDECL(windows_getlin, (const char *, char *)); -extern int NDECL(windows_console_custom_nhgetch); -void NDECL(safe_routines); -int NDECL(tty_self_recover_prompt); -int NDECL(other_self_recover_prompt); +int windows_nhgetch(void); +void windows_nhbell(void); +int windows_nh_poskey(int *, int *, int *); +void windows_raw_print(const char *); +char windows_yn_function(const char *, const char *, char); +static void windows_getlin(const char *, char *); +extern int windows_console_custom_nhgetch(void); +void safe_routines(void); +int tty_self_recover_prompt(void); +int other_self_recover_prompt(void); char orgdir[PATHLEN]; boolean getreturn_enabled; @@ -233,9 +231,6 @@ const char *get_portable_device() void set_default_prefix_locations(const char *programPath) { - char *envp = NULL; - char *sptr = NULL; - static char executable_path[MAX_PATH]; static char profile_path[MAX_PATH]; static char versioned_profile_path[MAX_PATH]; @@ -404,18 +399,14 @@ copy_hack_content() */ int #ifndef __MINGW32__ -main(argc, argv) +main(int argc, char *argv[]) #else -mingw_main(argc, argv) +mingw_main(int argc, char *argv[]) #endif -int argc; -char *argv[]; { boolean resuming = FALSE; /* assume new game */ NHFILE *nhfp; char *windowtype = NULL; - char *envp = NULL; - char *sptr = NULL; char fnamebuf[BUFSZ], encodedfnamebuf[BUFSZ]; char failbuf[BUFSZ]; @@ -639,9 +630,7 @@ attempt_restore: } static void -process_options(argc, argv) -int argc; -char *argv[]; +process_options(int argc, char * argv[]) { int i; @@ -805,7 +794,7 @@ char *argv[]; } static void -nhusage() +nhusage(void) { char buf1[BUFSZ], buf2[BUFSZ], *bufptr; @@ -842,7 +831,7 @@ nhusage() } void -safe_routines(VOID_ARGS) +safe_routines(void) { /* * Get a set of valid safe windowport function @@ -856,7 +845,7 @@ safe_routines(VOID_ARGS) #ifdef PORT_HELP void -port_help() +port_help(void) { /* display port specific help file */ display_file(PORT_HELP, 1); @@ -865,7 +854,7 @@ port_help() /* validate wizard mode if player has requested access to it */ boolean -authorize_wizard_mode() +authorize_wizard_mode(void) { if (!strcmp(g.plname, WIZARD_NAME)) return TRUE; @@ -881,7 +870,7 @@ extern HANDLE hConOut; boolean has_fakeconsole; char * -exename() +exename(void) { int bsize = PATHLEN; char *tmp = exenamebuf, *tmp2; @@ -940,7 +929,7 @@ void freefakeconsole() #endif char * -get_executable_path() +get_executable_path(void) { static char path_buffer[MAX_PATH]; @@ -964,9 +953,7 @@ get_executable_path() } char * -translate_path_variables(str, buf) -const char *str; -char *buf; +translate_path_variables(const char* str, char* buf) { const char *src; char evar[BUFSZ], *dest, *envp, *eptr = (char *) 0; @@ -1020,8 +1007,7 @@ char *buf; /*ARGSUSED*/ void -windows_raw_print(str) -const char *str; +windows_raw_print(const char* str) { if (str) fprintf(stdout, "%s\n", str); @@ -1031,56 +1017,49 @@ const char *str; /*ARGSUSED*/ void -windows_raw_print_bold(str) -const char *str; +windows_raw_print_bold(const char* str) { windows_raw_print(str); return; } int -windows_nhgetch() +windows_nhgetch(void) { return getchar(); } void -windows_nhbell() +windows_nhbell(void) { return; } /*ARGSUSED*/ int -windows_nh_poskey(x, y, mod) -int *x, *y, *mod; +windows_nh_poskey(int *x, int *y, int *mod) { return '\033'; } /*ARGSUSED*/ char -windows_yn_function(query, resp, def) -const char *query; -const char *resp; -char def; +windows_yn_function(const char* query, const char* resp, char def) { return '\033'; } /*ARGSUSED*/ static void -windows_getlin(prompt, outbuf) -const char *prompt UNUSED; -char *outbuf; +windows_getlin(const char* prompt UNUSED, char* outbuf) { Strcpy(outbuf, "\033"); } #ifdef PC_LOCKING static int -eraseoldlocks() +eraseoldlocks(void) { register int i; @@ -1103,9 +1082,9 @@ eraseoldlocks() } int -getlock() +getlock(void) { - register int fd, ern, prompt_result = 0; + int fd, ern = 0, prompt_result = 0; int fcmask = FCMASK; #ifndef SELF_RECOVER char tbuf[BUFSZ]; @@ -1230,8 +1209,7 @@ gotlock: #endif /* PC_LOCKING */ boolean -file_exists(path) -const char *path; +file_exists(const char* path) { struct stat sb; @@ -1248,9 +1226,7 @@ const char *path; does not exist, it returns TRUE. */ boolean -file_newer(a_path, b_path) -const char * a_path; -const char * b_path; +file_newer(const char* a_path, const char* b_path) { struct stat a_sb; struct stat b_sb; @@ -1272,7 +1248,7 @@ const char * b_path; * -1 if old game should be destroyed, allowing new game to proceed. */ int -tty_self_recover_prompt() +tty_self_recover_prompt(void) { register int c, ci, ct, pl, retval = 0; /* for saving/replacing functions, if needed */ @@ -1339,7 +1315,7 @@ tty_self_recover_prompt() } int -other_self_recover_prompt() +other_self_recover_prompt(void) { register int c, ci, ct, pl, retval = 0; boolean ismswin = WINDOWPORT("mswin"), diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index f34a68397..dc98e95f5 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -52,10 +52,10 @@ typedef HWND(WINAPI *GETCONSOLEWINDOW)(); static HWND GetConsoleHandle(void); static HWND GetConsoleHwnd(void); #if !defined(TTY_GRAPHICS) -extern void NDECL(backsp); +extern void backsp(void); #endif -int NDECL(windows_console_custom_nhgetch); -extern void NDECL(safe_routines); +int windows_console_custom_nhgetch(void); +extern void safe_routines(void); /* The function pointer nt_kbhit contains a kbhit() equivalent * which varies depending on which window port is active. @@ -68,15 +68,14 @@ int def_kbhit(void); int (*nt_kbhit)() = def_kbhit; char -switchar() +switchar(void) { /* Could not locate a WIN32 API call for this- MJA */ return '-'; } long -freediskspace(path) -char *path; +freediskspace(char* path) { char tmppath[4]; DWORD SectorsPerCluster = 0; @@ -97,8 +96,7 @@ char *path; * Functions to get filenames using wildcards */ int -findfirst(path) -char *path; +findfirst(char* path) { if (ffhandle) { FindClose(ffhandle); @@ -109,20 +107,19 @@ char *path; } int -findnext() +findnext(void) { return FindNextFile(ffhandle, &ffd) ? 1 : 0; } char * -foundfile_buffer() +foundfile_buffer(void) { return &ffd.cFileName[0]; } long -filesize(file) -char *file; +filesize(char* file) { if (findfirst(file)) { return ((long) ffd.nFileSizeLow); @@ -134,8 +131,7 @@ char *file; * Chdrive() changes the default drive. */ void -chdrive(str) -char *str; +chdrive(char* str) { char *ptr; char drive; @@ -146,7 +142,7 @@ char *str; } static int -max_filename() +max_filename(void) { DWORD maxflen; int status = 0; @@ -160,7 +156,7 @@ max_filename() } int -def_kbhit() +def_kbhit(void) { return 0; } @@ -169,12 +165,11 @@ def_kbhit() * Strip out troublesome file system characters. */ -void nt_regularize(s) /* normalize file name */ -register char *s; +void nt_regularize(char* s) /* normalize file name */ { - register unsigned char *lp; + unsigned char *lp; - for (lp = s; *lp; lp++) + for (lp = (unsigned char *) s; *lp; lp++) if (*lp == '?' || *lp == '"' || *lp == '\\' || *lp == '/' || *lp == '>' || *lp == '<' || *lp == '*' || *lp == '|' || *lp == ':' || (*lp > 127)) @@ -185,8 +180,7 @@ register char *s; * This is used in nhlan.c to implement some of the LAN_FEATURES. */ char * -get_username(lan_username_size) -int *lan_username_size; +get_username(int *lan_username_size) { static TCHAR username_buffer[BUFSZ]; DWORD i = BUFSZ - 1; @@ -215,7 +209,7 @@ int *lan_username_size; } #if 0 -char *getxxx() +char *getxxx(void) { char szFullPath[MAX_PATH] = ""; HMODULE hInst = NULL; /* NULL gets the filename of this module */ @@ -225,8 +219,8 @@ return &szFullPath[0]; } #endif -extern void NDECL(mswin_raw_print_flush); -extern void FDECL(mswin_raw_print, (const char *)); +extern void mswin_raw_print_flush(void); +extern void mswin_raw_print(const char *); /* fatal error */ /*VARARGS1*/ @@ -262,7 +256,7 @@ Delay(int ms) } void -win32_abort() +win32_abort(void) { int c; @@ -285,11 +279,7 @@ static char interjection_buf[INTERJECTION_TYPES][1024]; static int interjection[INTERJECTION_TYPES]; void -interject_assistance(num, interjection_type, ptr1, ptr2) -int num; -int interjection_type; -genericptr_t ptr1; -genericptr_t ptr2; +interject_assistance(int num, int interjection_type, genericptr_t ptr1, genericptr_t ptr2) { switch (num) { case 1: { @@ -334,8 +324,7 @@ genericptr_t ptr2; } void -interject(interjection_type) -int interjection_type; +interject(int interjection_type) { if (interjection_type >= 0 && interjection_type < INTERJECTION_TYPES) msmsg(interjection_buf[interjection_type]); @@ -343,14 +332,12 @@ int interjection_type; #ifdef RUNTIME_PASTEBUF_SUPPORT -void port_insert_pastebuf(buf) -char *buf; +void port_insert_pastebuf(char *buf) { /* This implementation will utilize the windows clipboard * to accomplish this. */ - char *tmp = buf; HGLOBAL hglbCopy; WCHAR *w, w2[2]; int cc, rc, abytes; @@ -475,8 +462,7 @@ GetConsoleHwnd(void) #endif char * -get_port_id(buf) -char *buf; +get_port_id(char *buf) { Strcpy(buf, TARGET_PORT); return buf; @@ -484,8 +470,7 @@ char *buf; #endif /* RUNTIME_PORT_ID */ void -nethack_exit(code) -int code; +nethack_exit(int code) { /* Only if we started from the GUI, not the command prompt, * we need to get one last return, so the score board does @@ -511,15 +496,14 @@ int code; #include int -windows_console_custom_nhgetch(VOID_ARGS) +windows_console_custom_nhgetch(void) { return _getch(); } void -getreturn(str) -const char *str; +getreturn(const char *str) { static boolean in_getreturn = FALSE; char buf[BUFSZ]; @@ -536,7 +520,7 @@ const char *str; /* nethack_enter_winnt() is called from main immediately after initializing the window port */ -void nethack_enter_winnt() +void nethack_enter_winnt(void) { if (WINDOWPORT("tty")) nethack_enter_nttty(); @@ -631,8 +615,7 @@ BOOL winos_font_support_cp437(HFONT hFont) } int -windows_early_options(window_opt) -const char *window_opt; +windows_early_options(const char *window_opt) { /* * If you return 2, the game will exit before it begins. @@ -655,8 +638,7 @@ const char *window_opt; * be room for the \ */ void -append_slash(name) -char *name; +append_slash(char *name) { char *ptr; @@ -683,7 +665,7 @@ char *name; #endif unsigned long -sys_random_seed(VOID_ARGS) +sys_random_seed(void) { unsigned long ourseed = 0UL; BCRYPT_ALG_HANDLE hRa = (BCRYPT_ALG_HANDLE) 0; @@ -719,10 +701,7 @@ sys_random_seed(VOID_ARGS) /* nt_assert_failed is called when an nhassert's condition is false */ void -nt_assert_failed(expression, filepath, line) - const char * expression; - const char * filepath; - int line; +nt_assert_failed(const char *expression, const char *filepath, int line) { const char * filename; diff --git a/util/dlb_main.c b/util/dlb_main.c index 2a32124dc..e1a5d237d 100644 --- a/util/dlb_main.c +++ b/util/dlb_main.c @@ -14,8 +14,8 @@ #include #endif -static void FDECL(grow_ld, (libdir **, int *, int)); -static void FDECL(xexit, (int)) NORETURN; +static void grow_ld(libdir **, int *, int); +static void xexit(int) NORETURN; #ifdef DLB #ifdef DLBLIB @@ -24,16 +24,16 @@ static void FDECL(xexit, (int)) NORETURN; #define LIBLISTFILE "dlb.lst" /* default list file */ /* library functions (from dlb.c) */ -extern boolean FDECL(open_library, (const char *, library *)); -extern void FDECL(close_library, (library *)); +extern boolean open_library(const char *, library *); +extern void close_library(library *); -char *FDECL(eos, (char *)); /* also used by dlb.c */ -FILE *FDECL(fopen_datafile, (const char *, const char *)); +char *eos(char *); /* also used by dlb.c */ +FILE *fopen_datafile(const char *, const char *); -static void FDECL(Write, (int, char *, long)); -static void NDECL(usage) NORETURN; -static void NDECL(verbose_help) NORETURN; -static void FDECL(write_dlb_directory, (int, int, libdir *, long, long, long)); +static void Write(int, char *, long); +static void usage(void) NORETURN; +static void verbose_help(void) NORETURN; +static void write_dlb_directory(int, int, libdir *, long, long, long); static char default_progname[] = "dlb"; static char *progname = default_progname; @@ -77,7 +77,7 @@ static char origdir[255] = ""; */ static void -usage() +usage(void) { (void) printf("Usage: %s [ctxCIfv] arguments... [files...]\n", progname); (void) printf(" default library is %s\n", library_file); @@ -87,7 +87,7 @@ usage() } static void -verbose_help() +verbose_help(void) { static const char *const long_help[] = { "", "dlb COMMANDoptions args... files...", " commands:", @@ -109,10 +109,7 @@ verbose_help() } static void -Write(out, buf, len) -int out; -char *buf; -long len; +Write(int out, char *buf, long len) { #if defined(MSDOS) && !defined(__DJGPP__) unsigned short slen; @@ -133,8 +130,7 @@ long len; } char * -eos(s) -char *s; +eos(char *s) { while (*s) s++; @@ -143,8 +139,7 @@ char *s; /* open_library(dlb.c) needs this (which normally comes from src/files.c) */ FILE * -fopen_datafile(filename, mode) -const char *filename, *mode; +fopen_datafile(const char *filename, const char *mode) { return fopen(filename, mode); } @@ -153,9 +148,7 @@ const char *filename, *mode; #endif /* DLB */ int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { #ifdef DLB #ifdef DLBLIB @@ -486,10 +479,7 @@ char **argv; #ifdef DLBLIB static void -grow_ld(ld_p, ldlimit_p, alloc_incr) -libdir **ld_p; -int *ldlimit_p; -int alloc_incr; +grow_ld(libdir **ld_p, int *ldlimit_p, int alloc_incr) { static libdir zerolibdir; int i = 0, newlimit = *ldlimit_p + alloc_incr; @@ -506,10 +496,8 @@ int alloc_incr; } static void -write_dlb_directory(out, nfiles, ld, slen, dir_size, flen) -int out, nfiles; -libdir *ld; -long slen, dir_size, flen; +write_dlb_directory(int out, int nfiles, libdir *ld, + long slen, long dir_size, long flen) { char buf[BUFSIZ]; int i; @@ -539,8 +527,7 @@ long slen, dir_size, flen; #endif /* DLB */ static void -xexit(retcd) -int retcd; +xexit(int retcd) { #ifdef DLB #ifdef AMIGA diff --git a/util/makedefs.c b/util/makedefs.c index e960e7651..bc63790d6 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -125,51 +125,46 @@ char *file_prefix = ""; #endif #ifdef MACsansMPWTOOL -int FDECL(main, (void)); +int main(void); #else -int FDECL(main, (int, char **)); +int main(int, char **); #endif -void FDECL(do_makedefs, (char *)); -void NDECL(do_objs); -void NDECL(do_data); -void NDECL(do_dungeon); -void NDECL(do_options); -void NDECL(do_monstr); -void NDECL(do_permonst); -void NDECL(do_questtxt); -void NDECL(do_rumors); -void NDECL(do_oracles); -void NDECL(do_date); - -extern void NDECL(monst_globals_init); /* monst.c */ -extern void NDECL(objects_globals_init); /* objects.c */ - -static char *FDECL(name_file, (const char *, const char *)); -static FILE *FDECL(getfp, (const char *, const char *, const char *, int)); -static void FDECL(do_ext_makedefs, (int, char **)); -static char *FDECL(xcrypt, (const char *)); -static unsigned long FDECL(read_rumors_file, - (const char *, int *, long *, unsigned long)); -static void FDECL(do_rnd_access_file, (const char *, const char *)); -static boolean FDECL(d_filter, (char *)); -static boolean FDECL(h_filter, (char *)); -static void FDECL(opt_out_words, (char *, int *)); - -static char *FDECL(fgetline, (FILE*)); -static char *FDECL(tmpdup, (const char *)); -static char *FDECL(limit, (char *, int)); -static void NDECL(windowing_sanity); -static boolean FDECL(get_gitinfo, (char *, char *)); +void do_makedefs(char *); +void do_objs(void); +void do_data(void); +void do_dungeon(void); +void do_options(void); +void do_monstr(void); +void do_permonst(void); +void do_questtxt(void); +void do_rumors(void); +void do_oracles(void); +void do_date(void); + +extern void monst_globals_init(void); /* monst.c */ +extern void objects_globals_init(void); /* objects.c */ + +static char *name_file(const char *, const char *); +static FILE *getfp(const char *, const char *, const char *, int); +static void do_ext_makedefs(int, char **); +static char *xcrypt(const char *); +static unsigned long read_rumors_file(const char *, int *, + long *, unsigned long); +static void do_rnd_access_file(const char *, const char *); +static boolean d_filter(char *); +static boolean h_filter(char *); +static void opt_out_words(char *, int *); + +static char *fgetline(FILE*); +static char *tmpdup(const char *); +static char *limit(char *, int); +static void windowing_sanity(void); +static boolean get_gitinfo(char *, char *); /* input, output, tmp */ static FILE *ifp, *ofp, *tfp; -static boolean use_enum = -#ifdef ENUM_PM - TRUE; -#else - FALSE; -#endif +static boolean use_enum = TRUE; #if defined(__BORLANDC__) && !defined(_WIN32) extern unsigned _stklen = STKSIZ; @@ -219,9 +214,7 @@ main(void) #else /* ! MAC */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { if ((argc == 1) || ((argc != 2) @@ -254,8 +247,7 @@ char *argv[]; #endif void -do_makedefs(options) -char *options; +do_makedefs(char *options) { boolean more_than_one; @@ -342,21 +334,17 @@ char *options; static char namebuf[1000]; static char * -name_file(template, tag) -const char *template; -const char *tag; +name_file(const char* template, const char* tag) { Sprintf(namebuf, template, tag); return namebuf; } #ifdef HAS_NO_MKSTEMP -static void FDECL(delete_file, (const char *template, const char *)); +static void delete_file(const char *template, const char *); static void -delete_file(template, tag) -const char *template; -const char *tag; +delete_file(const char *template, const char *tag) { char *name = name_file(template, tag); @@ -365,15 +353,7 @@ const char *tag; #endif static FILE * -getfp(template, tag, mode, flg) -const char *template; -const char *tag; -const char *mode; -#ifndef HAS_NO_MKSTEMP -int flg; -#else -int flg UNUSED; -#endif +getfp(const char* template, const char* tag, const char* mode, int flg) { char *name = name_file(template, tag); FILE *rv = (FILE *) 0; @@ -389,7 +369,10 @@ int flg UNUSED; rv = fdopen(tmpfd, WRTMODE); /* temp file is always read+write */ Unlink(tmpfbuf); } - } else + } + else +#else + flg; // unused #endif rv = fopen(name, mode); if (!rv) { @@ -415,13 +398,13 @@ struct grep_var { /* struct grep_var grep_vars[] and TODO_* constants in include file: */ #include "mdgrep.h" -static void NDECL(do_grep_showvars); -static struct grep_var *FDECL(grepsearch, (const char *)); -static int FDECL(grep_check_id, (const char *)); -static void FDECL(grep_show_wstack, (const char *)); -static char *FDECL(do_grep_control, (char *)); -static void NDECL(do_grep); -static void FDECL(grep0, (FILE *, FILE *, int)); +static void do_grep_showvars(void); +static struct grep_var *grepsearch(const char *); +static int grep_check_id(const char *); +static void grep_show_wstack(const char *); +static char *do_grep_control(char *); +static void do_grep(void); +static void grep0(FILE *, FILE *, int); static int grep_trace = 0; @@ -615,7 +598,7 @@ static int grep_stack[GREP_STACK_SIZE] = { ST_LD(1, 0) }; static int grep_lineno = 0; static void -do_grep_showvars() +do_grep_showvars(void) { int x; @@ -625,8 +608,7 @@ do_grep_showvars() } static struct grep_var * -grepsearch(name) -const char *name; +grepsearch(const char* name) { /* XXX make into binary search */ int x = 0; @@ -640,8 +622,7 @@ const char *name; } static int -grep_check_id(id) -const char *id; +grep_check_id(const char* id) { struct grep_var *rv; @@ -670,8 +651,7 @@ const char *id; } static void -grep_show_wstack(tag) -const char *tag; +grep_show_wstack(const char* tag) { int x; @@ -686,8 +666,7 @@ const char *tag; } static char * -do_grep_control(buf) -char *buf; +do_grep_control(char *buf) { int isif = 1; char *buf0 = buf; @@ -773,7 +752,7 @@ char *buf; static void grep0(FILE *, FILE *, int); static void -do_grep() +do_grep(void) { if (!inputfp) { Fprintf(stderr, "--grep requires --input\n"); @@ -789,14 +768,7 @@ do_grep() } static void -grep0(inputfp0, outputfp0, flg) -FILE *inputfp0; -FILE *outputfp0; -#ifndef HAS_NO_MKSTEMP -int flg; -#else -int flg UNUSED; -#endif +grep0(FILE *inputfp0, FILE* outputfp0, int flg) { #ifndef HAS_NO_MKSTEMP /* if grep0 is passed FLG_TEMPFILE flag, it will @@ -804,6 +776,8 @@ int flg UNUSED; The caller will have to take care of calling fclose() when it is done with the file */ boolean istemp = (flg & FLG_TEMPFILE) != 0; +#else + flg; // unused #endif char buf[16384]; /* looong, just in case */ @@ -864,8 +838,7 @@ int flg UNUSED; /* trivial text encryption routine which can't be broken with `tr' */ static char * -xcrypt(str) -const char *str; +xcrypt(const char* str) { /* duplicated in src/hacklib.c */ static char buf[BUFSZ]; register const char *p; @@ -886,11 +859,8 @@ const char *str; #define PAD_RUMORS_TO 60 /* common code for do_rumors(). Return 0 on error. */ static unsigned long -read_rumors_file(file_ext, rumor_count, rumor_size, old_rumor_offset) -const char *file_ext; -int *rumor_count; -long *rumor_size; -unsigned long old_rumor_offset; +read_rumors_file(const char* file_ext, int* rumor_count, + long* rumor_size, unsigned long old_rumor_offset) { char infile[MAXFNAMELEN]; char *line; @@ -947,9 +917,7 @@ unsigned long old_rumor_offset; } static void -do_rnd_access_file(fname, deflt_content) -const char *fname; -const char *deflt_content; +do_rnd_access_file(const char* fname, const char* deflt_content) { char *line, buf[BUFSZ]; @@ -1001,7 +969,7 @@ const char *deflt_content; } void -do_rumors() +do_rumors(void) { char *line; static const char rumors_header[] = @@ -1093,7 +1061,7 @@ rumors_failure: } void -do_date() +do_date(void) { #ifdef KR1ED long clocktim = 0; @@ -1281,8 +1249,7 @@ do_date() } static boolean -get_gitinfo(githash, gitbranch) -char *githash, *gitbranch; +get_gitinfo(char *githash, char *gitbranch) { FILE *gifp; size_t len; @@ -1342,7 +1309,7 @@ char *githash, *gitbranch; } void -do_options() +do_options(void) { const char *optline; int infocontext = 0; @@ -1364,7 +1331,7 @@ do_options() } static void -windowing_sanity() +windowing_sanity(void) { #ifndef DEFAULT_WINDOW_SYS /* pre-standard compilers didn't support #error; wait til run-time */ @@ -1404,8 +1371,7 @@ windowing_sanity() /* routine to decide whether to discard something from data.base */ static boolean -d_filter(line) -char *line; +d_filter(char *line) { if (*line == '#') return TRUE; /* ignore comment lines */ @@ -1435,7 +1401,7 @@ text-b/text-c at fseek(0x01234567L + 456L) */ void -do_data() +do_data(void) { char infile[60], tempfile[60]; boolean ok; @@ -1550,8 +1516,7 @@ do_data() /* routine to decide whether to discard something from oracles.txt */ static boolean -h_filter(line) -char *line; +h_filter(char *line) { static boolean skip = FALSE; char *tag; @@ -1590,7 +1555,7 @@ static const char *special_oracle[] = { */ void -do_oracles() +do_oracles(void) { char infile[60], tempfile[60]; boolean in_oracle, ok; @@ -1752,7 +1717,7 @@ do_oracles() } void -do_dungeon() +do_dungeon(void) { char *line; @@ -1810,8 +1775,8 @@ do_dungeon() * transfer relevant generated monstr values to src/monst.c; * delete src/monstr.c. */ -static int FDECL(mstrength, (struct permonst *)); -static boolean FDECL(ranged_attk, (struct permonst *)); +static int mstrength(struct permonst *); +static boolean ranged_attk(struct permonst *); /* * This routine is designed to return an integer value which represents @@ -1819,8 +1784,7 @@ static boolean FDECL(ranged_attk, (struct permonst *)); * determination as "experience()" to arrive at the strength. */ static int -mstrength(ptr) -struct permonst *ptr; +mstrength(struct permonst* ptr) { int i, tmp2, n, tmp = ptr->mlevel; @@ -1879,8 +1843,7 @@ struct permonst *ptr; /* returns True if monster can attack at range */ static boolean -ranged_attk(ptr) -register struct permonst *ptr; +ranged_attk(register struct permonst* ptr) { register int i, j; register int atk_mask = (1 << AT_BREA) | (1 << AT_SPIT) | (1 << AT_GAZE); @@ -1894,7 +1857,7 @@ register struct permonst *ptr; } void -do_monstr() +do_monstr(void) { struct permonst *ptr; int i; @@ -1945,9 +1908,9 @@ do_monstr() } Fprintf(ofp, " *\n */\n\n"); - Fprintf(ofp, "\nvoid NDECL(monstr_init);\n"); + Fprintf(ofp, "\nvoid monstr_init(void);\n"); Fprintf(ofp, "\nvoid\n"); - Fprintf(ofp, "monstr_init()\n"); + Fprintf(ofp, "monstr_init(void)\n"); Fprintf(ofp, "{\n"); Fprintf(ofp, " return;\n"); Fprintf(ofp, "}\n"); @@ -1958,7 +1921,7 @@ do_monstr() } void -do_permonst() +do_permonst(void) { int i; char *c, *nam; @@ -2015,7 +1978,7 @@ do_permonst() /* Start of Quest text file processing. */ void -do_questtxt() +do_questtxt(void) { printf("DEPRECATION WARNINGS:\n"); printf("'makedefs -q' is no longer required. Remove all references\n"); @@ -2027,9 +1990,7 @@ do_questtxt() static char temp[32]; -static char *limit(name, pref) /* limit a name to 30 characters length */ -char *name; -int pref; +static char *limit(char* name, int pref) /* limit a name to 30 characters length */ { (void) strncpy(temp, name, pref ? 26 : 30); temp[pref ? 26 : 30] = 0; @@ -2037,7 +1998,7 @@ int pref; } void -do_objs() +do_objs(void) { int i, sum = 0; char *c, *objnam; @@ -2184,8 +2145,7 @@ do_objs() * null pointer if no characters were read. */ static char * -fgetline(fd) -FILE *fd; +fgetline(FILE *fd) { static const int inc = 256; int len = inc; @@ -2208,8 +2168,7 @@ FILE *fd; } static char * -tmpdup(str) -const char *str; +tmpdup(const char* str) { static char buf[128]; diff --git a/util/panic.c b/util/panic.c index 4842a16c4..6d5d93f41 100644 --- a/util/panic.c +++ b/util/panic.c @@ -15,12 +15,12 @@ #define abort() exit() #endif #ifdef VMS -extern void NDECL(vms_abort); +extern void vms_abort(void); #endif /*VARARGS1*/ boolean panicking; -void VDECL(panic, (const char *, ...)); +void panic(const char *, ...); void panic VA_DECL(const char *, str) @@ -53,8 +53,7 @@ VA_DECL(const char *, str) * systems, but they should either use yacc or get a real alloca routine. */ long * -alloca(cnt) -unsigned cnt; +alloca(unsigned int cnt) { return cnt ? alloc(cnt) : (long *) 0; } diff --git a/util/recover.c b/util/recover.c index 5b09611e1..1dabf30df 100644 --- a/util/recover.c +++ b/util/recover.c @@ -18,16 +18,16 @@ #endif #ifdef VMS -extern int FDECL(vms_creat, (const char *, unsigned)); -extern int FDECL(vms_open, (const char *, int, unsigned)); +extern int vms_creat(const char *, unsigned); +extern int vms_open(const char *, int, unsigned); #endif /* VMS */ -int FDECL(restore_savefile, (char *)); -void FDECL(set_levelfile_name, (int)); -int FDECL(open_levelfile, (int)); -int NDECL(create_savefile); -void FDECL(copy_bytes, (int, int)); -static void FDECL(store_formatindicator, (int)); +int restore_savefile(char *); +void set_levelfile_name(int); +int open_levelfile(int); +int create_savefile(void); +void copy_bytes(int, int); +static void store_formatindicator(int); #ifndef WIN_CE #define Fprintf (void) fprintf @@ -39,7 +39,7 @@ static void nhce_message(FILE *, const char *, ...); #define Close (void) close #if defined(EXEPATH) -char *FDECL(exepath, (char *)); +char *exepath(char *); #endif #if defined(__BORLANDC__) && !defined(_WIN32) @@ -50,9 +50,7 @@ extern unsigned _stklen = STKSIZ; char savename[SAVESIZE]; /* holds relative path of save file from playground */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { int argno; const char *dir = (char *) 0; @@ -141,8 +139,7 @@ char *argv[]; static char lock[256]; void -set_levelfile_name(lev) -int lev; +set_levelfile_name(int lev) { char *tf; @@ -156,8 +153,7 @@ int lev; } int -open_levelfile(lev) -int lev; +open_levelfile(int lev) { int fd; @@ -171,7 +167,7 @@ int lev; } int -create_savefile() +create_savefile(void) { int fd; @@ -184,8 +180,7 @@ create_savefile() } void -copy_bytes(ifd, ofd) -int ifd, ofd; +copy_bytes(int ifd, int ofd) { char buf[BUFSIZ]; int nfrom, nto; @@ -201,8 +196,7 @@ int ifd, ofd; } int -restore_savefile(basename) -char *basename; +restore_savefile(char *basename) { int gfd, lfd, sfd; int res = 0, lev, savelev, hpid, pltmpsiz, filecmc; @@ -390,8 +384,7 @@ char *basename; } static void -store_formatindicator(fd) -int fd; +store_formatindicator(int fd) { char indicate = 'h'; /* historical */ int cmc = 0; @@ -413,8 +406,7 @@ int fd; char exepathbuf[EXEPATHBUFSZ]; char * -exepath(str) -char *str; +exepath(char *str) { char *tmp, *tmp2; int bsize; diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index dc2521b46..9d9d9ca3b 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -346,7 +346,7 @@ void NetHackQtBind::qt_clear_nhwindow(winid wid) window->Clear(); } -void NetHackQtBind::qt_display_nhwindow(winid wid, BOOLEAN_P block) +void NetHackQtBind::qt_display_nhwindow(winid wid, boolean block) { NetHackQtWindow* window=id_to_window[(int)wid]; if (window) @@ -388,7 +388,7 @@ void NetHackQtBind::qt_putstr(winid wid, int attr, const QString& text) window->PutStr(attr,text); } -void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist) +void NetHackQtBind::qt_display_file(const char *filename, boolean must_exist) { NetHackQtTextWindow* window=new NetHackQtTextWindow(mainWidget()); bool complain = false; @@ -429,7 +429,7 @@ void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED) } void NetHackQtBind::qt_add_menu(winid wid, const glyph_info *glyphinfo, - const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, + const ANY_P * identifier, char ch, char gch, int attr, const char *str, unsigned itemflags) { NetHackQtWindow* window=id_to_window[(int)wid]; @@ -479,7 +479,7 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) NetHackQtWindow* window=id_to_window[(int)wid]; window->ClipAround(x,y); } -void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y, +void NetHackQtBind::qt_print_glyph(winid wid,xchar x,xchar y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED) { @@ -647,7 +647,7 @@ char NetHackQtBind::qt_more() } char NetHackQtBind::qt_yn_function(const char *question_, - const char *choices, CHAR_P def) + const char *choices, char def) { QString question(QString::fromLatin1(question_)); QString message; @@ -852,7 +852,7 @@ void NetHackQtBind::qt_preference_update(const char *optname) #endif } -char *NetHackQtBind::qt_getmsghistory(BOOLEAN_P init) +char *NetHackQtBind::qt_getmsghistory(boolean init) { NetHackQtMessageWindow *window = main->GetMessageWindow(); if (window) @@ -860,7 +860,7 @@ char *NetHackQtBind::qt_getmsghistory(BOOLEAN_P init) return NULL; } -void NetHackQtBind::qt_putmsghistory(const char *msg, BOOLEAN_P is_restoring) +void NetHackQtBind::qt_putmsghistory(const char *msg, boolean is_restoring) { NetHackQtMessageWindow *window = main->GetMessageWindow(); if (!window) diff --git a/win/Qt/qt_bind.h b/win/Qt/qt_bind.h index 80652a7ea..d170e2b1b 100644 --- a/win/Qt/qt_bind.h +++ b/win/Qt/qt_bind.h @@ -44,16 +44,16 @@ public: static void qt_resume_nhwindows(); static winid qt_create_nhwindow(int type); static void qt_clear_nhwindow(winid wid); - static void qt_display_nhwindow(winid wid, BOOLEAN_P block); + static void qt_display_nhwindow(winid wid, boolean block); static void qt_destroy_nhwindow(winid wid); static void qt_curs(winid wid, int x, int y); static void qt_putstr(winid wid, int attr, const char *text); static void qt_putstr(winid wid, int attr, const std::string& text); static void qt_putstr(winid wid, int attr, const QString& text); - static void qt_display_file(const char *filename, BOOLEAN_P must_exist); + static void qt_display_file(const char *filename, boolean must_exist); static void qt_start_menu(winid wid, unsigned long mbehavior); static void qt_add_menu(winid wid, const glyph_info *glyphinfo, - const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, + const ANY_P * identifier, char ch, char gch, int attr, const char *str, unsigned int itemflags); static void qt_end_menu(winid wid, const char *prompt); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); @@ -63,7 +63,7 @@ public: static void qt_cliparound(int x, int y); static void qt_cliparound_window(winid wid, int x, int y); - static void qt_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, + static void qt_print_glyph(winid wid, xchar x, xchar y, const glyph_info *glyphingo, const glyph_info *bkglyphinfo); static void qt_raw_print(const char *str); @@ -74,7 +74,7 @@ public: static int qt_doprev_message(); static char qt_more(); static char qt_yn_function(const char *question, - const char *choices, CHAR_P def); + const char *choices, char def); static void qt_getlin(const char *prompt, char *line); static int qt_get_ext_cmd(); static void qt_number_pad(int); @@ -83,8 +83,8 @@ public: static void qt_end_screen(); static void qt_preference_update(const char *optname); - static char *qt_getmsghistory(BOOLEAN_P init); - static void qt_putmsghistory(const char *msg, BOOLEAN_P is_restoring); + static char *qt_getmsghistory(boolean init); + static void qt_putmsghistory(const char *msg, boolean is_restoring); static void qt_outrip(winid wid, int how, time_t when); static int qt_kbhit(); diff --git a/win/Qt/qt_main.cpp b/win/Qt/qt_main.cpp index f3bca10a1..6d692ea83 100644 --- a/win/Qt/qt_main.cpp +++ b/win/Qt/qt_main.cpp @@ -577,7 +577,7 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : QMenu* menu; const char* name; int flags; - int NDECL((*funct)); + int (*funct)(void); } item[] = { { game, 0, 3}, { game, "Version", 3, doversion}, @@ -914,7 +914,7 @@ void NetHackQtMainWindow::CtrlV() // add a toolbar button to invoke command 'name' via function '(*func)()' void NetHackQtMainWindow::AddToolButton(QToolBar *toolbar, QSignalMapper *sm, - const char *name, int NDECL((*func)), + const char *name, int (*func)(void), QPixmap xpm) { char actchar[2]; @@ -1084,7 +1084,7 @@ void NetHackQtMainWindow::doKeys(const QString& k) } // queue up the command name for a function, as if user had typed it -void NetHackQtMainWindow::FuncAsCommand(int NDECL((*func))) +void NetHackQtMainWindow::FuncAsCommand(int (*func)(void)) { char cmdbuf[32]; Strcpy(cmdbuf, "#"); diff --git a/win/Qt/qt_main.h b/win/Qt/qt_main.h index 3f8c9f400..54b56c453 100644 --- a/win/Qt/qt_main.h +++ b/win/Qt/qt_main.h @@ -59,7 +59,7 @@ public: void fadeHighlighting(bool before_key); - void FuncAsCommand(int NDECL((*func))); + void FuncAsCommand(int (*func)(void)); // this is unconditional in case qt_main.h comes before qt_set.h void resizePaperDoll(bool); // ENHANCED_PAPERDOLL #ifdef DYNAMIC_STATUSLINES @@ -95,7 +95,7 @@ private slots: private: void ShowIfReady(); void AddToolButton(QToolBar *toolbar, QSignalMapper *sm, - const char *name, int NDECL((*func)), QPixmap xpm); + const char *name, int (*func)(void), QPixmap xpm); #ifdef KDE KMenuBar* menubar; diff --git a/win/X11/Window.c b/win/X11/Window.c index 75598dba1..9bc448627 100644 --- a/win/X11/Window.c +++ b/win/X11/Window.c @@ -91,11 +91,10 @@ static XtResource resources[] = { /* ARGSUSED */ static void -no_op(w, event, params, num_params) -Widget w; /* unused */ -XEvent *event; /* unused */ -String *params; /* unused */ -Cardinal *num_params; /* unused */ +no_op(Widget w, /* unused */ + XEvent *event, /* unused */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ { nhUse(w); nhUse(event); @@ -114,10 +113,7 @@ static char translations[] = ": input() \ /* ARGSUSED */ static void -Redisplay(w, event, region) -Widget w; -XEvent *event; -Region region; /* unused */ +Redisplay(Widget w, XEvent *event, Region region /* unused */) { nhUse(region); @@ -127,8 +123,7 @@ Region region; /* unused */ /* ARGSUSED */ static void -Resize(w) -Widget w; +Resize(Widget w) { XtCallCallbacks(w, XtNresizeCallback, (XtPointer) 0); } @@ -174,15 +169,13 @@ WindowClassRec windowClassRec = { WidgetClass windowWidgetClass = (WidgetClass) &windowClassRec; Font -WindowFont(w) -Widget w; +WindowFont(Widget w) { return ((WindowWidget) w)->window.font->fid; } XFontStruct * -WindowFontStruct(w) -Widget w; +WindowFontStruct(Widget w) { return ((WindowWidget) w)->window.font; } diff --git a/win/X11/dialogs.c b/win/X11/dialogs.c index 607b8f5c2..8ce7a7daa 100644 --- a/win/X11/dialogs.c +++ b/win/X11/dialogs.c @@ -97,11 +97,8 @@ static const char cancel_accelerators[] = "#override\n\ * an optional cancel button */ Widget -CreateDialog(parent, name, okay_callback, cancel_callback) -Widget parent; -String name; -XtCallbackProc okay_callback; -XtCallbackProc cancel_callback; +CreateDialog(Widget parent, String name, XtCallbackProc okay_callback, + XtCallbackProc cancel_callback) { Widget form, prompt, response, okay, cancel; Arg args[20]; @@ -218,8 +215,7 @@ XtCallbackProc cancel_callback; /* get the prompt from the dialog box. Used a startup time to * save away the initial prompt */ String -GetDialogPrompt(w) - Widget w; +GetDialogPrompt(Widget w) { Arg args[1]; Widget label; @@ -234,9 +230,7 @@ GetDialogPrompt(w) /* set the prompt. This is used to put error information in the prompt */ void -SetDialogPrompt(w, newprompt) -Widget w; -String newprompt; +SetDialogPrompt(Widget w, String newprompt) { Arg args[1]; Widget label; @@ -248,8 +242,7 @@ String newprompt; /* get what the user typed; caller must free the response */ String -GetDialogResponse(w) -Widget w; +GetDialogResponse(Widget w) { Arg args[1]; Widget response; @@ -263,10 +256,7 @@ Widget w; /* set the default reponse */ void -SetDialogResponse(w, s, ln) -Widget w; -String s; -unsigned ln; +SetDialogResponse(Widget w, String s, unsigned ln) { Arg args[4]; Widget response; @@ -296,8 +286,7 @@ unsigned ln; #if 0 /* clear the response */ void -ClearDialogResponse(w) - Widget w; +ClearDialogResponse(Widget w) { Arg args[2]; Widget response; @@ -313,9 +302,7 @@ ClearDialogResponse(w) /* position popup window under the cursor */ void -positionpopup(w, bottom) -Widget w; -boolean bottom; /* position y on bottom? */ +positionpopup(Widget w, boolean bottom) /* position y on bottom? */ { Arg args[3]; Cardinal num_args; diff --git a/win/X11/tile2x11.c b/win/X11/tile2x11.c index 762f95ba2..2f774065a 100644 --- a/win/X11/tile2x11.c +++ b/win/X11/tile2x11.c @@ -22,13 +22,12 @@ unsigned char tile_bytes[TILE_X * TILE_Y * (MAX_GLYPH + TILES_PER_ROW)]; unsigned char *curr_tb = tile_bytes; unsigned char x11_colormap[MAXCOLORMAPSIZE][3]; -extern void NDECL(monst_globals_init); -extern void NDECL(objects_globals_init); +extern void monst_globals_init(void); +extern void objects_globals_init(void); /* Look up the given pixel and return its colormap index. */ static unsigned char -pix_to_colormap(pix) -pixel pix; +pix_to_colormap(pixel pix) { unsigned long i; @@ -49,9 +48,8 @@ pixel pix; /* Convert the tiles in the file to our format of bytes. */ static unsigned long -convert_tiles(tb_ptr, total) -unsigned char **tb_ptr; /* pointer to a tile byte pointer */ -unsigned long total; /* total tiles so far */ +convert_tiles(unsigned char **tb_ptr, /* pointer to a tile byte pointer */ + unsigned long total) /* total tiles so far */ { unsigned char *tb = *tb_ptr; unsigned long count = 0; @@ -79,7 +77,7 @@ unsigned long total; /* total tiles so far */ /* Merge the current text colormap (ColorMap) with ours (x11_colormap). */ static void -merge_text_colormap() +merge_text_colormap(void) { unsigned i, j; @@ -112,8 +110,7 @@ merge_text_colormap() /* Open the given file, read & merge the colormap, convert the tiles. */ static void -process_file(fname) -char *fname; +process_file(char *fname) { unsigned long count; @@ -130,8 +127,7 @@ char *fname; #ifdef USE_XPM static int -xpm_write(fp) -FILE *fp; +xpm_write(FILE *fp) { unsigned long i, j; unsigned n; @@ -169,9 +165,7 @@ FILE *fp; #endif /* USE_XPM */ int -main(argc, argv) -int argc; -char **argv; +main(int argc, char *argv[]) { FILE *fp; int i; diff --git a/win/X11/winX.c b/win/X11/winX.c index 4e5da1160..0ded103ae 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -81,7 +81,7 @@ static struct icon_info { */ struct xwindow window_list[MAX_WINDOWS]; AppResources appResources; -void FDECL((*input_func), (Widget, XEvent *, String *, Cardinal *)); +void (*input_func)(Widget, XEvent *, String *, Cardinal *); int click_x, click_y, click_button; /* Click position on a map window */ /* (filled by set_button_values()). */ int updated_inventory; @@ -143,34 +143,34 @@ struct window_procs X11_procs = { /* * Local functions. */ -static winid NDECL(find_free_window); +static winid find_free_window(void); #ifdef TEXTCOLOR -static void FDECL(nhFreePixel, (XtAppContext, XrmValuePtr, XtPointer, - XrmValuePtr, Cardinal *)); +static void nhFreePixel(XtAppContext, XrmValuePtr, XtPointer, XrmValuePtr, + Cardinal *); #endif -static boolean FDECL(new_resource_macro, (String, unsigned)); -static void NDECL(load_default_resources); -static void NDECL(release_default_resources); -static int FDECL(panic_on_error, (Display *, XErrorEvent *)); +static boolean new_resource_macro(String, unsigned); +static void load_default_resources(void); +static void release_default_resources(void); +static int panic_on_error(Display *, XErrorEvent *); #ifdef X11_HANGUP_SIGNAL -static void FDECL(X11_sig, (int)); -static void FDECL(X11_sig_cb, (XtPointer, XtSignalId *)); +static void X11_sig(int); +static void X11_sig_cb(XtPointer, XtSignalId *); #endif -static void FDECL(d_timeout, (XtPointer, XtIntervalId *)); -static void FDECL(X11_hangup, (Widget, XEvent *, String *, Cardinal *)); -static void FDECL(X11_bail, (const char *)); -static void FDECL(askname_delete, (Widget, XEvent *, String *, Cardinal *)); -static void FDECL(askname_done, (Widget, XtPointer, XtPointer)); -static void FDECL(done_button, (Widget, XtPointer, XtPointer)); -static void FDECL(getline_delete, (Widget, XEvent *, String *, Cardinal *)); -static void FDECL(abort_button, (Widget, XtPointer, XtPointer)); -static void NDECL(release_getline_widgets); -static void FDECL(yn_delete, (Widget, XEvent *, String *, Cardinal *)); -static void FDECL(yn_key, (Widget, XEvent *, String *, Cardinal *)); -static void NDECL(release_yn_widgets); -static int FDECL(input_event, (int)); -static void FDECL(win_visible, (Widget, XtPointer, XEvent *, Boolean *)); -static void NDECL(init_standard_windows); +static void d_timeout(XtPointer, XtIntervalId *); +static void X11_hangup(Widget, XEvent *, String *, Cardinal *); +static void X11_bail(const char *); +static void askname_delete(Widget, XEvent *, String *, Cardinal *); +static void askname_done(Widget, XtPointer, XtPointer); +static void done_button(Widget, XtPointer, XtPointer); +static void getline_delete(Widget, XEvent *, String *, Cardinal *); +static void abort_button(Widget, XtPointer, XtPointer); +static void release_getline_widgets(void); +static void yn_delete(Widget, XEvent *, String *, Cardinal *); +static void yn_key(Widget, XEvent *, String *, Cardinal *); +static void release_yn_widgets(void); +static int input_event(int); +static void win_visible(Widget, XtPointer, XEvent *, Boolean *); +static void init_standard_windows(void); /* * Local variables. @@ -182,9 +182,7 @@ static winid message_win = WIN_ERR, /* These are the winids of the message, */ static Pixmap icon_pixmap = None; /* Pixmap for icon. */ void -X11_putmsghistory(msg, is_restoring) -const char *msg; -boolean is_restoring; +X11_putmsghistory(const char *msg, boolean is_restoring) { if (WIN_MESSAGE != WIN_ERR) { struct xwindow *wp = &window_list[WIN_MESSAGE]; @@ -195,8 +193,7 @@ boolean is_restoring; } char * -X11_getmsghistory(init) -boolean init; +X11_getmsghistory(boolean init) { if (WIN_MESSAGE != WIN_ERR) { static struct line_element *curr = (struct line_element *) 0; @@ -226,8 +223,7 @@ boolean init; * that this is not the popup widget, nor the viewport, but the child. */ struct xwindow * -find_widget(w) -Widget w; +find_widget(Widget w) { int windex; struct xwindow *wp; @@ -251,7 +247,7 @@ Widget w; * Find a free window slot for use. */ static winid -find_free_window() +find_free_window(void) { int windex; struct xwindow *wp; @@ -268,9 +264,7 @@ find_free_window() XColor -get_nhcolor(wp, clr) -struct xwindow *wp; -int clr; +get_nhcolor(struct xwindow *wp, int clr) { init_menu_nhcolors(wp); /* FIXME: init_menu_nhcolors may fail */ @@ -282,8 +276,7 @@ int clr; } void -init_menu_nhcolors(wp) -struct xwindow *wp; +init_menu_nhcolors(struct xwindow *wp) { static const char *mapCLR_to_res[CLR_MAX] = { XtNblack, @@ -400,11 +393,10 @@ XtConvertArgRec const nhcolorConvertArgs[] = { * Return True if something close was found. */ Boolean -nhApproxColor(screen, colormap, str, color) -Screen *screen; /* screen to use */ -Colormap colormap; /* the colormap to use */ -char *str; /* color name */ -XColor *color; /* the X color structure; changed only if successful */ +nhApproxColor(Screen *screen, /* screen to use */ + Colormap colormap, /* the colormap to use */ + char *str, /* color name */ + XColor *color) /* the X color structure; changed only if successful */ { int ncells; long cdiff = 16777216; /* 2^24; hopefully our map is smaller */ @@ -476,13 +468,9 @@ try_again: } Boolean -nhCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) -Display *dpy; -XrmValuePtr args; -Cardinal *num_args; -XrmValuePtr fromVal; -XrmValuePtr toVal; -XtPointer *closure_ret; +nhCvtStringToPixel(Display *dpy, XrmValuePtr args, Cardinal *num_args, + XrmValuePtr fromVal, XrmValuePtr toVal, + XtPointer *closure_ret) { String str = (String) fromVal->addr; XColor screenColor; @@ -571,9 +559,7 @@ XtPointer *closure_ret; /* Ask the WM for window frame size */ void -get_window_frame_extents(w, top, bottom, left, right) -Widget w; -long *top, *bottom, *left, *right; +get_window_frame_extents(Widget w, long *top, long *bottom, long *left, long *right) { XEvent event; Display *dpy = XtDisplay(w); @@ -605,9 +591,7 @@ long *top, *bottom, *left, *right; } void -get_widget_window_geometry(w, x,y, width, height) -Widget w; -int *x, *y, *width, *height; +get_widget_window_geometry(Widget w, int *x, int *y, int *width, int *height) { long top, bottom, left, right; Arg args[5]; @@ -623,8 +607,7 @@ int *x, *y, *width, *height; /* Change the full font name string so the weight is "bold" */ char * -fontname_boldify(fontname) -const char *fontname; +fontname_boldify(const char *fontname) { static char buf[BUFSZ]; char *bufp = buf; @@ -650,9 +633,7 @@ const char *fontname; } void -load_boldfont(wp, w) -struct xwindow *wp; -Widget w; +load_boldfont(struct xwindow *wp, Widget w) { Arg args[1]; XFontStruct *fs; @@ -677,12 +658,11 @@ Widget w; #ifdef TEXTCOLOR /* ARGSUSED */ static void -nhFreePixel(app, toVal, closure, args, num_args) -XtAppContext app; -XrmValuePtr toVal; -XtPointer closure; -XrmValuePtr args; -Cardinal *num_args; +nhFreePixel(XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, + XrmValuePtr args, + Cardinal *num_args) { Screen *screen; Colormap colormap; @@ -708,8 +688,7 @@ Cardinal *num_args; * assumption of ascent + descent is not always valid. */ Dimension -nhFontHeight(w) -Widget w; +nhFontHeight(Widget w) { #ifdef _XawTextSink_h Widget sink; @@ -740,9 +719,8 @@ static String *default_resource_data = 0, /* NULL-terminated arrays */ /* caller found "#define"; parse into macro name and its expansion value */ static boolean -new_resource_macro(inbuf, numdefs) -String inbuf; /* points past '#define' rather than to start of buffer */ -unsigned numdefs; /* array slot to fill */ +new_resource_macro(String inbuf, /* points past '#define' rather than to start of buffer */ + unsigned numdefs) /* array slot to fill */ { String p, q; @@ -775,7 +753,7 @@ unsigned numdefs; /* array slot to fill */ /* read the template NetHack.ad into default_resource_data[] to supply fallback resources to XtAppInitialize() */ static void -load_default_resources() +load_default_resources(void) { FILE *fp; String inbuf; @@ -884,7 +862,7 @@ load_default_resources() } static void -release_default_resources() +release_default_resources(void) { if (default_resource_data) { unsigned idx; @@ -898,23 +876,19 @@ release_default_resources() /* Global Functions ======================================================= */ void -X11_raw_print(str) -const char *str; +X11_raw_print(const char *str) { (void) puts(str); } void -X11_raw_print_bold(str) -const char *str; +X11_raw_print_bold(const char *str) { (void) puts(str); } void -X11_curs(window, x, y) -winid window; -int x, y; +X11_curs(winid window, int x, int y) { check_winid(window); @@ -932,10 +906,7 @@ int x, y; } void -X11_putstr(window, attr, str) -winid window; -int attr; -const char *str; +X11_putstr(winid window, int attr, const char *str) { winid new_win; struct xwindow *wp; @@ -982,20 +953,19 @@ const char *str; /* We do event processing as a callback, so this is a null routine. */ void -X11_get_nh_event() +X11_get_nh_event(void) { return; } int -X11_nhgetch() +X11_nhgetch(void) { return input_event(EXIT_ON_KEY_PRESS); } int -X11_nh_poskey(x, y, mod) -int *x, *y, *mod; +X11_nh_poskey(int *x, int *y, int *mod) { int val = input_event(EXIT_ON_KEY_OR_BUTTON_PRESS); @@ -1008,8 +978,7 @@ int *x, *y, *mod; } winid -X11_create_nhwindow(type) -int type; +X11_create_nhwindow(int type) { winid window; struct xwindow *wp; @@ -1103,8 +1072,7 @@ int type; } void -X11_clear_nhwindow(window) -winid window; +X11_clear_nhwindow(winid window) { struct xwindow *wp; @@ -1130,9 +1098,7 @@ winid window; } void -X11_display_nhwindow(window, blocking) -winid window; -boolean blocking; +X11_display_nhwindow(winid window, boolean blocking) { struct xwindow *wp; @@ -1194,8 +1160,7 @@ boolean blocking; } void -X11_destroy_nhwindow(window) -winid window; +X11_destroy_nhwindow(winid window) { struct xwindow *wp; @@ -1256,7 +1221,7 @@ winid window; } void -X11_update_inventory() +X11_update_inventory(void) { if (x_inited && window_list[WIN_INVEN].menu_information->is_up) { updated_inventory = 1; /* hack to avoid mapping&raising window */ @@ -1267,13 +1232,13 @@ X11_update_inventory() /* The current implementation has all of the saved lines on the screen. */ int -X11_doprev_message() +X11_doprev_message(void) { return 0; } void -X11_nhbell() +X11_nhbell(void) { /* We can't use XBell until toplevel has been initialized. */ if (x_inited) @@ -1282,7 +1247,7 @@ X11_nhbell() } void -X11_mark_synch() +X11_mark_synch(void) { if (x_inited) { /* @@ -1299,7 +1264,7 @@ X11_mark_synch() } void -X11_wait_synch() +X11_wait_synch(void) { if (x_inited) XFlush(XtDisplay(toplevel)); @@ -1307,14 +1272,13 @@ X11_wait_synch() /* Both resume_ and suspend_ are called from ioctl.c and unixunix.c. */ void -X11_resume_nhwindows() +X11_resume_nhwindows(void) { return; } /* ARGSUSED */ void -X11_suspend_nhwindows(str) -const char *str; +X11_suspend_nhwindows(const char *str) { nhUse(str); @@ -1324,8 +1288,7 @@ const char *str; /* Under X, we don't need to initialize the number pad. */ /* ARGSUSED */ void -X11_number_pad(state) /* called from options.c */ -int state; +X11_number_pad(int state) /* called from options.c */ { nhUse(state); @@ -1334,24 +1297,21 @@ int state; /* called from setftty() in unixtty.c */ void -X11_start_screen() +X11_start_screen(void) { return; } /* called from settty() in unixtty.c */ void -X11_end_screen() +X11_end_screen(void) { return; } #ifdef GRAPHIC_TOMBSTONE void -X11_outrip(window, how, when) -winid window; -int how; -time_t when; +X11_outrip(winid window, int how, time_t when) { struct xwindow *wp; FILE *rip_fp = 0; @@ -1465,9 +1425,7 @@ static XtResource resources[] = { }; static int -panic_on_error(display, error) -Display *display; -XErrorEvent *error; +panic_on_error(Display *display, XErrorEvent *error) { char buf[BUFSZ]; XGetErrorText(display, error->error_code, buf, BUFSZ); @@ -1480,9 +1438,7 @@ XErrorEvent *error; } void -X11_init_nhwindows(argcp, argv) -int *argcp; -char **argv; +X11_init_nhwindows(int *argcp, char **argv) { int i; Cardinal num_args; @@ -1585,8 +1541,7 @@ char **argv; */ /* ARGSUSED */ void -X11_exit_nhwindows(dummy) -const char *dummy; +X11_exit_nhwindows(const char *dummy) { extern Pixmap tile_pixmap; /* from winmap.c */ @@ -1616,17 +1571,14 @@ const char *dummy; #ifdef X11_HANGUP_SIGNAL static void -X11_sig(sig) /* Unix signal handler */ -int sig; +X11_sig(int sig) /* Unix signal handler */ { XtNoticeSignal(X11_sig_id); hangup(sig); } static void -X11_sig_cb(not_used, id) -XtPointer not_used; -XtSignalId *id; +X11_sig_cb(XtPointer not_used, XtSignalId *id) { XEvent event; XClientMessageEvent *mesg; @@ -1654,9 +1606,7 @@ XtSignalId *id; */ /* ARGSUSED */ static void -d_timeout(client_data, id) -XtPointer client_data; -XtIntervalId *id; +d_timeout(XtPointer client_data, XtIntervalId *id) { XEvent event; XClientMessageEvent *mesg; @@ -1681,7 +1631,7 @@ XtIntervalId *id; * for a sent event. */ void -X11_delay_output() +X11_delay_output(void) { if (!x_inited) return; @@ -1695,11 +1645,7 @@ X11_delay_output() /* X11_hangup ------------------------------------------------------------- */ /* ARGSUSED */ static void -X11_hangup(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +X11_hangup(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(w); nhUse(event); @@ -1713,8 +1659,7 @@ Cardinal *num_params; /* X11_bail --------------------------------------------------------------- */ /* clean up and quit */ static void -X11_bail(mesg) -const char *mesg; +X11_bail(const char *mesg) { g.program_state.something_worth_saving = 0; clearlocks(); @@ -1726,11 +1671,7 @@ const char *mesg; /* askname ---------------------------------------------------------------- */ /* ARGSUSED */ static void -askname_delete(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +askname_delete(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(event); nhUse(params); @@ -1744,10 +1685,7 @@ Cardinal *num_params; /* Callback for askname dialog widget. */ /* ARGSUSED */ static void -askname_done(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; +askname_done(Widget w, XtPointer client_data, XtPointer call_data) { unsigned len; char *s; @@ -1779,7 +1717,7 @@ XtPointer call_data; /* ask player for character's name to replace generic name "player" (or other values; see config.h) after 'nethack -u player' or OPTIONS=name:player */ void -X11_askname() +X11_askname(void) { Widget popup, dialog; Arg args[1]; @@ -1847,10 +1785,7 @@ static char *getline_input; /* Callback for getline dialog widget. */ /* ARGSUSED */ static void -done_button(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; +done_button(Widget w, XtPointer client_data, XtPointer call_data) { int len; char *s; @@ -1876,11 +1811,7 @@ XtPointer call_data; /* ARGSUSED */ static void -getline_delete(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +getline_delete(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(event); nhUse(params); @@ -1894,10 +1825,7 @@ Cardinal *num_params; /* Callback for getline dialog widget. */ /* ARGSUSED */ static void -abort_button(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; +abort_button(Widget w, XtPointer client_data, XtPointer call_data) { Widget dialog = (Widget) client_data; @@ -1910,7 +1838,7 @@ XtPointer call_data; } static void -release_getline_widgets() +release_getline_widgets(void) { if (getline_dialog) XtDestroyWidget(getline_dialog), getline_dialog = (Widget) 0; @@ -1919,9 +1847,7 @@ release_getline_widgets() } void -X11_getlin(question, input) -const char *question; -char *input; +X11_getlin(const char *question, char *input) { getline_input = input; @@ -1970,9 +1896,7 @@ char *input; /* uses a menu (with no selectors specified) rather than a text window to allow previous_page and first_menu actions to move backwards */ void -X11_display_file(str, complain) -const char *str; -boolean complain; +X11_display_file(const char *str, boolean complain) { dlb *fp; winid newwin; @@ -2035,8 +1959,7 @@ static const char yn_translations[] = "#override\n\ * no conversion (i.e. just the CTRL key hit) a NUL is returned. */ char -key_event_to_char(key) -XKeyEvent *key; +key_event_to_char(XKeyEvent *key) { char keystring[MAX_KEY_STRING]; int nbytes; @@ -2057,11 +1980,7 @@ XKeyEvent *key; */ /* ARGSUSED */ static void -yn_delete(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +yn_delete(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(w); nhUse(event); @@ -2079,11 +1998,7 @@ Cardinal *num_params; */ /* ARGSUSED */ static void -yn_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +yn_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch; @@ -2151,7 +2066,7 @@ Cardinal *num_params; /* called at exit time */ static void -release_yn_widgets() +release_yn_widgets(void) { if (yn_label) XtDestroyWidget(yn_label), yn_label = (Widget) 0; @@ -2162,10 +2077,9 @@ release_yn_widgets() /* X11-specific edition of yn_function(), the routine called by the core to show a prompt and get a single keystroke answer, often 'y' vs 'n' */ char -X11_yn_function(ques, choices, def) -const char *ques; -const char *choices; /* string of possible response chars; any char if Null */ -char def; /* default response if user hits or */ +X11_yn_function(const char *ques, + const char *choices, /* string of possible response chars; any char if Null */ + char def) /* default response if user hits or */ { char buf[BUFSZ]; Arg args[4]; @@ -2305,8 +2219,7 @@ char def; /* default response if user hits or */ /* used when processing window-capability-specific run-time options; we support toggling tiles on and off via iflags.wc_tiled_map */ void -X11_preference_update(pref) -const char *pref; +X11_preference_update(const char *pref) { if (!strcmp(pref, "tiled_map")) { if (WIN_MAP != WIN_ERR) @@ -2321,8 +2234,7 @@ const char *pref; * do some pre-processing. */ static int -input_event(exit_condition) -int exit_condition; +input_event(int exit_condition) { if (appResources.fancy_status && WIN_STATUS != WIN_ERR) check_turn_events(); /* hilighting on the fancy status window */ @@ -2336,10 +2248,7 @@ int exit_condition; /*ARGSUSED*/ void -msgkey(w, data, event) -Widget w; -XtPointer data; -XEvent *event; +msgkey(Widget w, XtPointer data, XEvent *event) { Cardinal num = 0; @@ -2352,11 +2261,9 @@ XEvent *event; /* only called for autofocus */ /*ARGSUSED*/ static void -win_visible(w, data, event, flag) -Widget w; -XtPointer data; /* client_data not used */ -XEvent *event; -Boolean *flag; /* continue_to_dispatch flag not used */ +win_visible(Widget w, XtPointer data, /* client_data not used */ + XEvent *event, + Boolean *flag) /* continue_to_dispatch flag not used */ { XVisibilityEvent *vis_event = (XVisibilityEvent *) event; @@ -2376,8 +2283,7 @@ Boolean *flag; /* continue_to_dispatch flag not used */ part of the map when idle or to invert background and foreground when a prompt is active */ void -highlight_yn(init) -boolean init; +highlight_yn(boolean init) { struct xwindow *xmap; @@ -2416,7 +2322,7 @@ boolean init; * than using a popup. */ static void -init_standard_windows() +init_standard_windows(void) { Widget form, message_viewport, map_viewport, status; Arg args[8]; @@ -2616,10 +2522,9 @@ init_standard_windows() } void -nh_XtPopup(w, grb, childwid) -Widget w; /* widget */ -int grb; /* type of grab */ -Widget childwid; /* child to receive focus (can be None) */ +nh_XtPopup(Widget w, /* widget */ + int grb, /* type of grab */ + Widget childwid) /* child to receive focus (can be None) */ { XtPopup(w, (XtGrabKind) grb); XSetWMProtocols(XtDisplay(w), XtWindow(w), &wm_delete_window, 1); @@ -2628,8 +2533,7 @@ Widget childwid; /* child to receive focus (can be None) */ } void -nh_XtPopdown(w) -Widget w; +nh_XtPopdown(Widget w) { XtPopdown(w); if (appResources.autofocus) @@ -2637,8 +2541,7 @@ Widget w; } void -win_X11_init(dir) -int dir; +win_X11_init(int dir) { if (dir != WININIT) return; @@ -2647,9 +2550,7 @@ int dir; } void -find_scrollbars(w, horiz, vert) -Widget w; -Widget *horiz, *vert; +find_scrollbars(Widget w, Widget *horiz, Widget *vert) { if (w) { do { @@ -2665,11 +2566,8 @@ Widget *horiz, *vert; */ /*ARGSUSED*/ void -nh_keyscroll(viewport, event, params, num_params) -Widget viewport; -XEvent *event; -String *params; -Cardinal *num_params; +nh_keyscroll(Widget viewport, XEvent *event, String *params, + Cardinal *num_params) { Arg arg[2]; Widget horiz_sb = (Widget) 0, vert_sb = (Widget) 0; diff --git a/win/X11/winmap.c b/win/X11/winmap.c index 7bd4e86fc..748b2b161 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -57,27 +57,23 @@ extern int total_tiles_used; #define COL0_OFFSET 1 /* change to 0 to revert to displaying unused column 0 */ -static boolean FDECL(init_tiles, (struct xwindow *)); -static void FDECL(set_button_values, (Widget, int, int, unsigned)); -static void FDECL(map_check_size_change, (struct xwindow *)); -static void FDECL(map_update, (struct xwindow *, int, int, int, int, - BOOLEAN_P)); -static void FDECL(init_text, (struct xwindow *)); -static void FDECL(map_exposed, (Widget, XtPointer, XtPointer)); -static void FDECL(set_gc, (Widget, Font, const char *, Pixel, GC *, GC *)); -static void FDECL(get_text_gc, (struct xwindow *, Font)); -static void FDECL(map_all_unexplored, (struct map_info_t *)); -static void FDECL(get_char_info, (struct xwindow *)); -static void FDECL(display_cursor, (struct xwindow *)); +static boolean init_tiles(struct xwindow *); +static void set_button_values(Widget, int, int, unsigned); +static void map_check_size_change(struct xwindow *); +static void map_update(struct xwindow *, int, int, int, int, boolean); +static void init_text(struct xwindow *); +static void map_exposed(Widget, XtPointer, XtPointer); +static void set_gc(Widget, Font, const char *, Pixel, GC *, GC *); +static void get_text_gc(struct xwindow *, Font); +static void map_all_unexplored(struct map_info_t *); +static void get_char_info(struct xwindow *); +static void display_cursor(struct xwindow *); /* Global functions ======================================================= */ void -X11_print_glyph(window, x, y, glyphinfo, bkglyphinfo) -winid window; -xchar x, y; -const glyph_info *glyphinfo; -const glyph_info *bkglyphinfo UNUSED; +X11_print_glyph(winid window, xchar x, xchar y, const glyph_info *glyphinfo, + const glyph_info *bkglyphinfo UNUSED) { struct map_info_t *map_info; boolean update_bbox = FALSE; @@ -156,9 +152,7 @@ const glyph_info *bkglyphinfo UNUSED; */ /*ARGSUSED*/ void -X11_cliparound(x, y) -int x UNUSED; -int y UNUSED; +X11_cliparound(int x UNUSED, int y UNUSED) { return; } @@ -194,10 +188,7 @@ static struct tile_annotation pet_annotation; static struct tile_annotation pile_annotation; static void -init_annotation(annotation, filename, colorpixel) -struct tile_annotation *annotation; -char *filename; -Pixel colorpixel; +init_annotation(struct tile_annotation *annotation, char *filename, Pixel colorpixel) { Display *dpy = XtDisplay(toplevel); @@ -224,7 +215,7 @@ Pixel colorpixel; * map viewport. */ void -post_process_tiles() +post_process_tiles(void) { Display *dpy = XtDisplay(toplevel); unsigned int width, height; @@ -261,8 +252,7 @@ post_process_tiles() * Return FALSE otherwise. */ static boolean -init_tiles(wp) -struct xwindow *wp; +init_tiles(struct xwindow *wp) { #ifdef USE_XPM XpmAttributes attributes; @@ -578,8 +568,7 @@ ntiles %ld\n", * Make sure the map's cursor is always visible. */ void -check_cursor_visibility(wp) -struct xwindow *wp; +check_cursor_visibility(struct xwindow *wp) { Arg arg[2]; Widget viewport, horiz_sb, vert_sb; @@ -730,8 +719,7 @@ struct xwindow *wp; * on the screen when the user resizes the nethack window. */ static void -map_check_size_change(wp) -struct xwindow *wp; +map_check_size_change(struct xwindow *wp) { struct map_info_t *map_info = wp->map_information; Arg arg[2]; @@ -785,12 +773,8 @@ struct xwindow *wp; * by querying the widget with the resource name. */ static void -set_gc(w, font, resource_name, bgpixel, regular, inverse) -Widget w; -Font font; -const char *resource_name; -Pixel bgpixel; -GC *regular, *inverse; +set_gc(Widget w, Font font, const char *resource_name, Pixel bgpixel, + GC *regular, GC *inverse) { XGCValues values; XtGCMask mask = GCFunction | GCForeground | GCBackground | GCFont; @@ -820,9 +804,7 @@ GC *regular, *inverse; * background colors on the current GC as needed. */ static void -get_text_gc(wp, font) -struct xwindow *wp; -Font font; +get_text_gc(struct xwindow *wp, Font font) { struct map_info_t *map_info = wp->map_information; Pixel bgpixel; @@ -865,8 +847,7 @@ Font font; * Display the cursor on the map window. */ static void -display_cursor(wp) -struct xwindow *wp; +display_cursor(struct xwindow *wp) { /* Redisplay the cursor location inverted. */ map_update(wp, wp->cursy, wp->cursy, wp->cursx, wp->cursx, TRUE); @@ -877,8 +858,7 @@ struct xwindow *wp; * the screen. */ void -display_map_window(wp) -struct xwindow *wp; +display_map_window(struct xwindow *wp) { register int row; struct map_info_t *map_info = wp->map_information; @@ -927,8 +907,7 @@ struct xwindow *wp; * (Actually, column 0 is set to S_nothing and 1..COLNO-1 to S_unexplored.) */ static void -map_all_unexplored(map_info) /* [was map_all_stone()] */ -struct map_info_t *map_info; +map_all_unexplored(struct map_info_t *map_info) /* [was map_all_stone()] */ { int x, y; /* unsigned short g_stone = cmap_to_glyph(S_stone); */ @@ -963,8 +942,7 @@ struct map_info_t *map_info; * display_map_window(). */ void -clear_map_window(wp) -struct xwindow *wp; +clear_map_window(struct xwindow *wp) { struct map_info_t *map_info = wp->map_information; @@ -985,8 +963,7 @@ struct xwindow *wp; * that are used when updating it. */ static void -get_char_info(wp) -struct xwindow *wp; +get_char_info(struct xwindow *wp) { XFontStruct *fs; struct map_info_t *map_info = wp->map_information; @@ -1033,11 +1010,7 @@ static int inptr = 0; /* points to valid data */ * Keyboard and button event handler for map window. */ void -map_input(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +map_input(Widget w, XEvent *event, String *params, Cardinal *num_params) { XKeyEvent *key; XButtonEvent *button; @@ -1133,11 +1106,7 @@ Cardinal *num_params; } static void -set_button_values(w, x, y, button) -Widget w; -int x; -int y; -unsigned int button; +set_button_values(Widget w, int x, int y, unsigned int button) { struct xwindow *wp; struct map_info_t *map_info; @@ -1170,10 +1139,8 @@ unsigned int button; */ /*ARGSUSED*/ static void -map_exposed(w, client_data, widget_data) -Widget w; -XtPointer client_data; /* unused */ -XtPointer widget_data; /* expose event from Window widget */ +map_exposed(Widget w, XtPointer client_data, /* unused */ + XtPointer widget_data) /* expose event from Window widget */ { int x, y; struct xwindow *wp; @@ -1256,10 +1223,7 @@ XtPointer widget_data; /* expose event from Window widget */ * The start and stop columns are *inclusive*. */ static void -map_update(wp, start_row, stop_row, start_col, stop_col, inverted) -struct xwindow *wp; -int start_row, stop_row, start_col, stop_col; -boolean inverted; +map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int stop_col, boolean inverted) { int win_start_row, win_start_col; struct map_info_t *map_info = wp->map_information; @@ -1433,9 +1397,7 @@ boolean inverted; /* Adjust the number of rows and columns on the given map window */ void -set_map_size(wp, cols, rows) -struct xwindow *wp; -Dimension cols, rows; +set_map_size(struct xwindow *wp, Dimension cols, Dimension rows) { Arg args[4]; Cardinal num_args; @@ -1456,8 +1418,7 @@ Dimension cols, rows; } static void -init_text(wp) -struct xwindow *wp; +init_text(struct xwindow *wp) { struct map_info_t *map_info = wp->map_information; @@ -1480,10 +1441,9 @@ static char map_translations[] = "#override\n\ * The map window creation routine. */ void -create_map_window(wp, create_popup, parent) -struct xwindow *wp; -boolean create_popup; /* parent is a popup shell that we create */ -Widget parent; +create_map_window(struct xwindow *wp, + boolean create_popup, /* parent is a popup shell that we create */ + Widget parent) { struct map_info_t *map_info; /* map info pointer */ Widget map, viewport; @@ -1610,8 +1570,7 @@ Widget parent; * Destroy this map window. */ void -destroy_map_window(wp) -struct xwindow *wp; +destroy_map_window(struct xwindow *wp) { struct map_info_t *map_info = wp->map_information; @@ -1659,8 +1618,7 @@ boolean exit_x_event; /* exit condition for the event loop */ #if 0 /*******/ void -pkey(k) -int k; +pkey(int k) { printf("key = '%s%c'\n", (k < 32) ? "^" : "", (k < 32) ? '@' + k : k); } @@ -1671,8 +1629,7 @@ int k; * under certain circumstances. */ int -x_event(exit_condition) -int exit_condition; +x_event(int exit_condition) { XEvent event; int retval = 0; diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index c4c9f2142..690e0fef7 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -35,34 +35,34 @@ #include "hack.h" #include "winX.h" -static void FDECL(menu_size_change_handler, (Widget, XtPointer, - XEvent *, Boolean *)); -static void FDECL(menu_select, (Widget, XtPointer, XtPointer)); -static void FDECL(invert_line, (struct xwindow *, x11_menu_item *, int, long)); -static void FDECL(menu_ok, (Widget, XtPointer, XtPointer)); -static void FDECL(menu_cancel, (Widget, XtPointer, XtPointer)); -static void FDECL(menu_all, (Widget, XtPointer, XtPointer)); -static void FDECL(menu_none, (Widget, XtPointer, XtPointer)); -static void FDECL(menu_invert, (Widget, XtPointer, XtPointer)); -static void FDECL(menu_search, (Widget, XtPointer, XtPointer)); -static void FDECL(search_menu, (struct xwindow *)); -static void FDECL(select_all, (struct xwindow *)); -static void FDECL(select_none, (struct xwindow *)); -static void FDECL(select_match, (struct xwindow *, char *)); -static void FDECL(invert_all, (struct xwindow *)); -static void FDECL(invert_match, (struct xwindow *, char *)); -static void FDECL(menu_popdown, (struct xwindow *)); -static Widget FDECL(menu_create_buttons, (struct xwindow *, Widget, Widget)); -static void FDECL(menu_create_entries, (struct xwindow *, struct menu *)); -static void FDECL(destroy_menu_entry_widgets, (struct xwindow *)); -static void NDECL(create_menu_translation_tables); - -static void FDECL(move_menu, (struct menu *, struct menu *)); -static void FDECL(free_menu_line_entries, (struct menu *)); -static void FDECL(free_menu, (struct menu *)); -static void FDECL(reset_menu_to_default, (struct menu *)); -static void FDECL(clear_old_menu, (struct xwindow *)); -static char *FDECL(copy_of, (const char *)); +static void menu_size_change_handler(Widget, XtPointer, XEvent *, + Boolean *); +static void menu_select(Widget, XtPointer, XtPointer); +static void invert_line(struct xwindow *, x11_menu_item *, int, long); +static void menu_ok(Widget, XtPointer, XtPointer); +static void menu_cancel(Widget, XtPointer, XtPointer); +static void menu_all(Widget, XtPointer, XtPointer); +static void menu_none(Widget, XtPointer, XtPointer); +static void menu_invert(Widget, XtPointer, XtPointer); +static void menu_search(Widget, XtPointer, XtPointer); +static void search_menu(struct xwindow *); +static void select_all(struct xwindow *); +static void select_none(struct xwindow *); +static void select_match(struct xwindow *, char *); +static void invert_all(struct xwindow *); +static void invert_match(struct xwindow *, char *); +static void menu_popdown(struct xwindow *); +static Widget menu_create_buttons(struct xwindow *, Widget, Widget); +static void menu_create_entries(struct xwindow *, struct menu *); +static void destroy_menu_entry_widgets(struct xwindow *); +static void create_menu_translation_tables(void); + +static void move_menu(struct menu *, struct menu *); +static void free_menu_line_entries(struct menu *); +static void free_menu(struct menu *); +static void reset_menu_to_default(struct menu *); +static void clear_old_menu(struct xwindow *); +static char *copy_of(const char *); #define reset_menu_count(mi) ((mi)->counting = FALSE, (mi)->menu_count = 0L) @@ -84,7 +84,7 @@ XtTranslations menu_translation_table = (XtTranslations) 0; XtTranslations menu_del_translation_table = (XtTranslations) 0; static void -create_menu_translation_tables() +create_menu_translation_tables(void) { if (!menu_translation_table) { menu_translation_table = XtParseTranslationTable(menu_translations); @@ -97,11 +97,7 @@ create_menu_translation_tables() /*ARGSUSED*/ static void -menu_size_change_handler(w, ptr, event, flag) -Widget w; -XtPointer ptr; -XEvent *event; -Boolean *flag; +menu_size_change_handler(Widget w, XtPointer ptr, XEvent *event, Boolean *flag) { struct xwindow *wp = (struct xwindow *) ptr; @@ -127,9 +123,7 @@ Boolean *flag; */ /* ARGSUSED */ static void -menu_select(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +menu_select(Widget w, XtPointer client_data, XtPointer call_data) { struct menu_info_t *menu_info; long how_many; @@ -178,11 +172,7 @@ XtPointer client_data, call_data; */ /* ARGSUSED */ void -menu_delete(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +menu_delete(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(event); nhUse(params); @@ -196,11 +186,7 @@ Cardinal *num_params; */ /*ARGSUSED*/ static void -invert_line(wp, curr, which, how_many) -struct xwindow *wp; -x11_menu_item *curr; -int which; -long how_many; +invert_line(struct xwindow *wp, x11_menu_item *curr, int which, long how_many) { Arg args[2]; @@ -229,11 +215,7 @@ long how_many; */ /* ARGSUSED */ void -menu_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +menu_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { struct menu_info_t *menu_info; x11_menu_item *curr; @@ -382,9 +364,7 @@ menu_done: /* ARGSUSED */ static void -menu_ok(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +menu_ok(Widget w, XtPointer client_data, XtPointer call_data) { struct xwindow *wp = (struct xwindow *) client_data; @@ -396,9 +376,8 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -menu_cancel(w, client_data, call_data) -Widget w; /* don't use - may be None */ -XtPointer client_data, call_data; +menu_cancel(Widget w, /* don't use - may be None */ + XtPointer client_data, XtPointer call_data) { struct xwindow *wp = (struct xwindow *) client_data; @@ -414,9 +393,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -menu_all(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +menu_all(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(call_data); @@ -426,9 +403,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -menu_none(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +menu_none(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(call_data); @@ -438,9 +413,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -menu_invert(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +menu_invert(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(call_data); @@ -450,9 +423,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -menu_search(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +menu_search(Widget w, XtPointer client_data, XtPointer call_data) { struct xwindow *wp = (struct xwindow *) client_data; struct menu_info_t *menu_info = wp->menu_information; @@ -467,8 +438,7 @@ XtPointer client_data, call_data; /* common to menu_search and menu_key */ static void -search_menu(wp) -struct xwindow *wp; +search_menu(struct xwindow *wp) { char *pat, buf[BUFSZ + 2]; /* room for '*' + BUFSZ-1 + '*' + '\0' */ struct menu_info_t *menu_info = wp->menu_information; @@ -500,8 +470,7 @@ struct xwindow *wp; } static void -select_all(wp) -struct xwindow *wp; +select_all(struct xwindow *wp) { x11_menu_item *curr; int count; @@ -517,8 +486,7 @@ struct xwindow *wp; } static void -select_none(wp) -struct xwindow *wp; +select_none(struct xwindow *wp) { x11_menu_item *curr; int count; @@ -534,8 +502,7 @@ struct xwindow *wp; } static void -invert_all(wp) -struct xwindow *wp; +invert_all(struct xwindow *wp) { x11_menu_item *curr; int count; @@ -551,9 +518,8 @@ struct xwindow *wp; } static void -invert_match(wp, match) -struct xwindow *wp; -char *match; /* wildcard pattern for pmatch() */ +invert_match(struct xwindow *wp, + char *match) /* wildcard pattern for pmatch() */ { x11_menu_item *curr; int count; @@ -571,9 +537,8 @@ char *match; /* wildcard pattern for pmatch() */ } static void -select_match(wp, match) -struct xwindow *wp; -char *match; /* wildcard pattern for pmatch() */ +select_match(struct xwindow *wp, + char *match) /* wildcard pattern for pmatch() */ { x11_menu_item *curr, *found = 0; int count; @@ -598,8 +563,7 @@ char *match; /* wildcard pattern for pmatch() */ } static void -menu_popdown(wp) -struct xwindow *wp; +menu_popdown(struct xwindow *wp) { nh_XtPopdown(wp->popup); /* remove the event grab */ XtDestroyWidget(wp->popup); @@ -612,9 +576,7 @@ struct xwindow *wp; /* Global functions ======================================================= */ void -X11_start_menu(window, mbehavior) -winid window; -unsigned long mbehavior UNUSED; +X11_start_menu(winid window, unsigned long mbehavior UNUSED) { struct xwindow *wp; check_winid(window); @@ -631,15 +593,13 @@ unsigned long mbehavior UNUSED; /*ARGSUSED*/ void -X11_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags) -winid window; -const glyph_info *glyphinfo UNUSED; -const anything *identifier; -char ch; -char gch; /* group accelerator (0 = no group) */ -int attr; -const char *str; -unsigned itemflags; +X11_add_menu(winid window, + const glyph_info *glyphinfo UNUSED, + const anything *identifier, + char ch, + char gch, /* group accelerator (0 = no group) */ + int attr, + const char *str, unsigned itemflags) { x11_menu_item *item; struct menu_info_t *menu_info; @@ -708,9 +668,7 @@ unsigned itemflags; } void -X11_end_menu(window, query) -winid window; -const char *query; +X11_end_menu(winid window, const char *query) { struct menu_info_t *menu_info; @@ -725,10 +683,7 @@ const char *query; } int -X11_select_menu(window, how, menu_list) -winid window; -int how; -menu_item **menu_list; +X11_select_menu(winid window, int how, menu_item **menu_list) { x11_menu_item *curr; struct xwindow *wp; @@ -1001,8 +956,7 @@ menu_item **menu_list; * zero length. */ static char * -copy_of(s) -const char *s; +copy_of(const char *s) { if (!s) s = ""; @@ -1013,9 +967,7 @@ const char *s; * Create ok, cancel, all, none, invert, and search buttons. */ static Widget -menu_create_buttons(wp, form, under) -struct xwindow *wp; -Widget form,under; +menu_create_buttons(struct xwindow *wp, Widget form, Widget under) { Arg args[15]; Cardinal num_args; @@ -1137,9 +1089,7 @@ Widget form,under; } static void -menu_create_entries(wp, curr_menu) -struct xwindow *wp; -struct menu *curr_menu; +menu_create_entries(struct xwindow *wp, struct menu *curr_menu) { x11_menu_item *curr; int menulineidx = 0; @@ -1217,8 +1167,7 @@ struct menu *curr_menu; } static void -destroy_menu_entry_widgets(wp) -struct xwindow *wp; +destroy_menu_entry_widgets(struct xwindow *wp) { WidgetList wlist; Cardinal numchild; @@ -1242,8 +1191,7 @@ struct xwindow *wp; } static void -move_menu(src_menu, dest_menu) -struct menu *src_menu, *dest_menu; +move_menu(struct menu *src_menu, struct menu *dest_menu) { free_menu(dest_menu); /* toss old menu */ *dest_menu = *src_menu; /* make new menu current */ @@ -1252,8 +1200,7 @@ struct menu *src_menu, *dest_menu; } static void -free_menu_line_entries(mp) -struct menu *mp; +free_menu_line_entries(struct menu *mp) { /* We're not freeing menu entry widgets here, but let XtDestroyWidget() on the parent widget take care of that */ @@ -1266,8 +1213,7 @@ struct menu *mp; } static void -free_menu(mp) -struct menu *mp; +free_menu(struct menu *mp) { free_menu_line_entries(mp); if (mp->query) @@ -1278,8 +1224,7 @@ struct menu *mp; } static void -reset_menu_to_default(mp) -struct menu *mp; +reset_menu_to_default(struct menu *mp) { mp->base = mp->last = (x11_menu_item *) 0; mp->query = (const char *) 0; @@ -1289,8 +1234,7 @@ struct menu *mp; } static void -clear_old_menu(wp) -struct xwindow *wp; +clear_old_menu(struct xwindow *wp) { struct menu_info_t *menu_info = wp->menu_information; @@ -1306,8 +1250,7 @@ struct xwindow *wp; } void -create_menu_window(wp) -struct xwindow *wp; +create_menu_window(struct xwindow *wp) { wp->type = NHW_MENU; wp->menu_information = @@ -1325,8 +1268,7 @@ struct xwindow *wp; } void -destroy_menu_window(wp) -struct xwindow *wp; +destroy_menu_window(struct xwindow *wp) { clear_old_menu(wp); /* this will also destroy the widgets */ free((genericptr_t) wp->menu_information); diff --git a/win/X11/winmesg.c b/win/X11/winmesg.c index 67d5f457c..73e8a5fca 100644 --- a/win/X11/winmesg.c +++ b/win/X11/winmesg.c @@ -35,15 +35,15 @@ #include "hack.h" #include "winX.h" -static struct line_element *FDECL(get_previous, (struct line_element *)); -static void FDECL(set_circle_buf, (struct mesg_info_t *, int)); -static char *FDECL(split, (char *, XFontStruct *, DIMENSION_P)); -static void FDECL(add_line, (struct mesg_info_t *, const char *)); -static void FDECL(redraw_message_window, (struct xwindow *)); -static void FDECL(mesg_check_size_change, (struct xwindow *)); -static void FDECL(mesg_exposed, (Widget, XtPointer, XtPointer)); -static void FDECL(get_gc, (Widget, struct mesg_info_t *)); -static void FDECL(mesg_resized, (Widget, XtPointer, XtPointer)); +static struct line_element *get_previous(struct line_element *); +static void set_circle_buf(struct mesg_info_t *, int); +static char *split(char *, XFontStruct *, Dimension); +static void add_line(struct mesg_info_t *, const char *); +static void redraw_message_window(struct xwindow *); +static void mesg_check_size_change(struct xwindow *); +static void mesg_exposed(Widget, XtPointer, XtPointer); +static void get_gc(Widget, struct mesg_info_t *); +static void mesg_resized(Widget, XtPointer, XtPointer); static char mesg_translations[] = "#override\n\ Left: scroll(4)\n\ @@ -56,8 +56,7 @@ static char mesg_translations[] = "#override\n\ /* Move the message window's vertical scrollbar's slider to the bottom. */ void -set_message_slider(wp) -struct xwindow *wp; +set_message_slider(struct xwindow *wp) { Widget scrollbar; float top; @@ -71,10 +70,8 @@ struct xwindow *wp; } void -create_message_window(wp, create_popup, parent) -struct xwindow *wp; /* window pointer */ -boolean create_popup; -Widget parent; +create_message_window(struct xwindow *wp, /* window pointer */ + boolean create_popup, Widget parent) { Arg args[8]; Cardinal num_args; @@ -209,8 +206,7 @@ Widget parent; } void -destroy_message_window(wp) -struct xwindow *wp; +destroy_message_window(struct xwindow *wp) { if (wp->popup) { nh_XtPopdown(wp->popup); @@ -230,8 +226,7 @@ struct xwindow *wp; /* Redraw message window if new lines have been added. */ void -display_message_window(wp) -struct xwindow *wp; +display_message_window(struct xwindow *wp) { set_message_slider(wp); if (wp->mesg_information->dirty) @@ -243,9 +238,7 @@ struct xwindow *wp; * rendering of the text is too long for the window. */ void -append_message(wp, str) -struct xwindow *wp; -const char *str; +append_message(struct xwindow *wp, const char *str) { char *mark, *remainder, buf[BUFSZ]; @@ -270,8 +263,7 @@ const char *str; * element. */ static struct line_element * -get_previous(mark) -struct line_element *mark; +get_previous(struct line_element *mark) { struct line_element *curr; @@ -290,9 +282,7 @@ struct line_element *mark; * are no longer used. */ static void -set_circle_buf(mesg_info, count) -struct mesg_info_t *mesg_info; -int count; +set_circle_buf(struct mesg_info_t *mesg_info, int count) { int i; struct line_element *tail, *curr, *head; @@ -367,10 +357,9 @@ int count; * not, back up from the end by words until we find a place to split. */ static char * -split(s, fs, pixel_width) -char *s; -XFontStruct *fs; /* Font for the window. */ -Dimension pixel_width; +split(char *s, + XFontStruct *fs, /* Font for the window. */ + Dimension pixel_width) { char save, *end, *remainder; @@ -400,9 +389,7 @@ Dimension pixel_width; * one. */ static void -add_line(mesg_info, s) -struct mesg_info_t *mesg_info; -const char *s; +add_line(struct mesg_info_t *mesg_info, const char *s) { register struct line_element *curr = mesg_info->head; register int new_line_length = strlen(s); @@ -431,8 +418,7 @@ const char *s; * line above this saved pointer. */ void -set_last_pause(wp) -struct xwindow *wp; +set_last_pause(struct xwindow *wp) { register struct mesg_info_t *mesg_info = wp->mesg_information; @@ -459,8 +445,7 @@ struct xwindow *wp; } static void -redraw_message_window(wp) -struct xwindow *wp; +redraw_message_window(struct xwindow *wp) { struct mesg_info_t *mesg_info = wp->mesg_information; register struct line_element *curr; @@ -504,8 +489,7 @@ struct xwindow *wp; * move the vertical slider to the bottom. */ static void -mesg_check_size_change(wp) -struct xwindow *wp; +mesg_check_size_change(struct xwindow *wp) { struct mesg_info_t *mesg_info = wp->mesg_information; Arg arg[2]; @@ -531,10 +515,9 @@ struct xwindow *wp; /* Event handler for message window expose events. */ /*ARGSUSED*/ static void -mesg_exposed(w, client_data, widget_data) -Widget w; -XtPointer client_data; /* unused */ -XtPointer widget_data; /* expose event from Window widget */ +mesg_exposed(Widget w, + XtPointer client_data, /* unused */ + XtPointer widget_data) /* expose event from Window widget */ { XExposeEvent *event = (XExposeEvent *) widget_data; @@ -564,9 +547,7 @@ XtPointer widget_data; /* expose event from Window widget */ } static void -get_gc(w, mesg_info) -Widget w; -struct mesg_info_t *mesg_info; +get_gc(Widget w, struct mesg_info_t *mesg_info) { XGCValues values; XtGCMask mask = GCFunction | GCForeground | GCBackground | GCFont; @@ -596,9 +577,7 @@ struct mesg_info_t *mesg_info; */ /* ARGSUSED */ static void -mesg_resized(w, client_data, call_data) -Widget w; -XtPointer call_data, client_data; +mesg_resized(Widget w, XtPointer call_data, XtPointer client_data) { Arg args[4]; Cardinal num_args; diff --git a/win/X11/winmisc.c b/win/X11/winmisc.c index 726ec3003..16c5a4e59 100644 --- a/win/X11/winmisc.c +++ b/win/X11/winmisc.c @@ -91,47 +91,44 @@ static const char popup_entry_translations[] = "#override\n\ : scroll(8)\n\ : scroll(2)"; -static void NDECL(plsel_dialog_acceptvalues); -static void FDECL(plsel_set_play_button, (BOOLEAN_P)); -static void FDECL(plsel_set_sensitivities, (BOOLEAN_P)); -static void NDECL(X11_player_selection_randomize); -static void NDECL(X11_player_selection_setupOthers); -static void FDECL(racetoggleCallback, (Widget, XtPointer, XtPointer)); -static void FDECL(roletoggleCallback, (Widget, XtPointer, XtPointer)); -static void FDECL(gendertoggleCallback, (Widget, XtPointer, XtPointer)); -static void FDECL(aligntoggleCallback, (Widget, XtPointer, XtPointer)); -static void FDECL(plsel_random_btn_callback, (Widget, XtPointer, XtPointer)); -static void FDECL(plsel_play_btn_callback, (Widget, XtPointer, XtPointer)); -static void FDECL(plsel_quit_btn_callback, (Widget, XtPointer, XtPointer)); -static Widget FDECL(X11_create_player_selection_name, (Widget)); -static void NDECL(X11_player_selection_dialog); -static void NDECL(X11_player_selection_prompts); -static void FDECL(ps_quit, (Widget, XtPointer, XtPointer)); -static void FDECL(ps_random, (Widget, XtPointer, XtPointer)); -static void FDECL(ps_select, (Widget, XtPointer, XtPointer)); -static void FDECL(extend_select, (Widget, XtPointer, XtPointer)); -static void FDECL(extend_dismiss, (Widget, XtPointer, XtPointer)); -static void FDECL(extend_help, (Widget, XtPointer, XtPointer)); -static void FDECL(popup_delete, (Widget, XEvent *, String *, Cardinal *)); -static void NDECL(ec_dismiss); -static void FDECL(ec_scroll_to_view, (int)); -static void NDECL(init_extended_commands_popup); -static Widget FDECL(make_menu, (const char *, const char *, const char *, - const char *, XtCallbackProc, const char *, - XtCallbackProc, int, const char **, - Widget **, XtCallbackProc, Widget *)); +static void plsel_dialog_acceptvalues(void); +static void plsel_set_play_button(boolean); +static void plsel_set_sensitivities(boolean); +static void X11_player_selection_randomize(void); +static void X11_player_selection_setupOthers(void); +static void racetoggleCallback(Widget, XtPointer, XtPointer); +static void roletoggleCallback(Widget, XtPointer, XtPointer); +static void gendertoggleCallback(Widget, XtPointer, XtPointer); +static void aligntoggleCallback(Widget, XtPointer, XtPointer); +static void plsel_random_btn_callback(Widget, XtPointer, XtPointer); +static void plsel_play_btn_callback(Widget, XtPointer, XtPointer); +static void plsel_quit_btn_callback(Widget, XtPointer, XtPointer); +static Widget X11_create_player_selection_name(Widget); +static void X11_player_selection_dialog(void); +static void X11_player_selection_prompts(void); +static void ps_quit(Widget, XtPointer, XtPointer); +static void ps_random(Widget, XtPointer, XtPointer); +static void ps_select(Widget, XtPointer, XtPointer); +static void extend_select(Widget, XtPointer, XtPointer); +static void extend_dismiss(Widget, XtPointer, XtPointer); +static void extend_help(Widget, XtPointer, XtPointer); +static void popup_delete(Widget, XEvent *, String *, Cardinal *); +static void ec_dismiss(void); +static void ec_scroll_to_view(int); +static void init_extended_commands_popup(void); +static Widget make_menu(const char *, const char *, const char *, const char *, + XtCallbackProc, const char *, XtCallbackProc, int, + const char **, Widget **, XtCallbackProc, Widget *); /* Bad Hack alert. Using integers instead of XtPointers */ XtPointer -i2xtp(i) -int i; +i2xtp(int i) { return (XtPointer) (ptrdiff_t) i; } int -xtp2i(x) -XtPointer x; +xtp2i(XtPointer x) { return (int) (ptrdiff_t) x; } @@ -139,9 +136,7 @@ XtPointer x; /* Player Selection ------------------------------------------------------- */ /* ARGSUSED */ static void -ps_quit(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +ps_quit(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(client_data); @@ -153,9 +148,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -ps_random(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +ps_random(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(client_data); @@ -167,9 +160,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -ps_select(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +ps_select(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(call_data); @@ -180,11 +171,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ void -ps_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +ps_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch, *mark; char rolechars[QBUFSZ]; @@ -230,11 +217,7 @@ Cardinal *num_params; /* ARGSUSED */ void -race_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +race_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch, *mark; char racechars[QBUFSZ]; @@ -278,11 +261,7 @@ Cardinal *num_params; /* ARGSUSED */ void -gend_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +gend_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch, *mark; static char gendchars[] = "mf"; @@ -315,11 +294,7 @@ Cardinal *num_params; /* ARGSUSED */ void -algn_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +algn_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch, *mark; static char algnchars[] = "LNC"; @@ -361,7 +336,7 @@ Widget plsel_name_input; Widget plsel_btn_play; static void -plsel_dialog_acceptvalues() +plsel_dialog_acceptvalues(void) { Arg args[2]; String s; @@ -384,11 +359,7 @@ plsel_dialog_acceptvalues() /* ARGSUSED */ void -plsel_quit(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +plsel_quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(w); nhUse(event); @@ -401,11 +372,7 @@ Cardinal *num_params; /* ARGSUSED */ void -plsel_play(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +plsel_play(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg args[2]; Boolean state; @@ -428,11 +395,7 @@ Cardinal *num_params; /* ARGSUSED */ void -plsel_randomize(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +plsel_randomize(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(w); nhUse(event); @@ -444,8 +407,7 @@ Cardinal *num_params; /* enable or disable the Play button */ static void -plsel_set_play_button(state) -boolean state; +plsel_set_play_button(boolean state) { Arg args[2]; @@ -454,8 +416,7 @@ boolean state; } static void -plsel_set_sensitivities(setcurr) -boolean setcurr; +plsel_set_sensitivities(boolean setcurr) { Arg args[2]; int j, valid; @@ -508,7 +469,7 @@ boolean setcurr; } static void -X11_player_selection_randomize() +X11_player_selection_randomize(void) { int nrole = plsel_n_roles; int nrace = plsel_n_races; @@ -595,7 +556,7 @@ X11_player_selection_randomize() } static void -X11_player_selection_setupOthers() +X11_player_selection_setupOthers(void) { Arg args[2]; int ra = xtp2i(XawToggleGetCurrent(plsel_race_radios[0])) - 1; @@ -641,9 +602,7 @@ X11_player_selection_setupOthers() } static void -racetoggleCallback(w, client, call) -Widget w; -XtPointer client, call; +racetoggleCallback(Widget w, XtPointer client, XtPointer call) { Arg args[2]; int j, valid; @@ -682,9 +641,7 @@ XtPointer client, call; } static void -roletoggleCallback(w, client, call) -Widget w; -XtPointer client, call; +roletoggleCallback(Widget w, XtPointer client, XtPointer call) { Arg args[2]; int j, valid; @@ -723,9 +680,7 @@ XtPointer client, call; } static void -gendertoggleCallback(w, client, call) -Widget w; -XtPointer client, call; +gendertoggleCallback(Widget w, XtPointer client, XtPointer call) { int i, r = xtp2i(XawToggleGetCurrent(plsel_gend_radios[0])) - 1; @@ -747,9 +702,7 @@ XtPointer client, call; } static void -aligntoggleCallback(w, client, call) -Widget w; -XtPointer client, call; +aligntoggleCallback(Widget w, XtPointer client, XtPointer call) { int r = xtp2i(XawToggleGetCurrent(plsel_align_radios[0])) - 1; @@ -761,10 +714,7 @@ XtPointer client, call; } static void -plsel_random_btn_callback(w, client, call) -Widget w; -XtPointer client; -XtPointer call; +plsel_random_btn_callback(Widget w, XtPointer client, XtPointer call) { nhUse(w); nhUse(client); @@ -774,10 +724,7 @@ XtPointer call; } static void -plsel_play_btn_callback(w, client, call) -Widget w; -XtPointer client; -XtPointer call; +plsel_play_btn_callback(Widget w, XtPointer client, XtPointer call) { nhUse(w); nhUse(client); @@ -788,10 +735,7 @@ XtPointer call; } static void -plsel_quit_btn_callback(w, client, call) -Widget w; -XtPointer client; -XtPointer call; +plsel_quit_btn_callback(Widget w, XtPointer client, XtPointer call) { nhUse(w); nhUse(client); @@ -802,8 +746,7 @@ XtPointer call; } static Widget -X11_create_player_selection_name(form) -Widget form; +X11_create_player_selection_name(Widget form) { Widget namelabel, name_vp, name_form; Arg args[10]; @@ -865,7 +808,7 @@ Widget form; } static void -X11_player_selection_dialog() +X11_player_selection_dialog(void) { Widget popup, popup_vp; Widget form; @@ -1290,7 +1233,7 @@ X11_player_selection_dialog() } static void -X11_player_selection_prompts() +X11_player_selection_prompts(void) { int num_roles, num_races, num_gends, num_algns, i, availcount, availindex; Widget popup, player_form; @@ -1578,7 +1521,7 @@ X11_player_selection_prompts() /* Global functions ======================================================== */ void -X11_player_selection() +X11_player_selection(void) { if (iflags.wc_player_selection == VIA_DIALOG) { if (!*g.plname) { @@ -1600,7 +1543,7 @@ X11_player_selection() /* called by core to have the player pick an extended command */ int -X11_get_ext_cmd() +X11_get_ext_cmd(void) { if (iflags.extmenu != ec_full_list) { /* player has toggled the 'extmenu' option, toss the old widgets */ @@ -1627,7 +1570,7 @@ X11_get_ext_cmd() } void -release_extended_cmds() +release_extended_cmds(void) { if (extended_commands) { XtDestroyWidget(extended_command_popup), extended_command_popup = 0; @@ -1642,9 +1585,7 @@ release_extended_cmds() /* Extended Command ------------------------------------------------------- */ /* ARGSUSED */ static void -extend_select(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +extend_select(Widget w, XtPointer client_data, XtPointer call_data) { int selected = (int) (ptrdiff_t) client_data; @@ -1670,9 +1611,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -extend_dismiss(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +extend_dismiss(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(client_data); @@ -1683,9 +1622,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ static void -extend_help(w, client_data, call_data) -Widget w; -XtPointer client_data, call_data; +extend_help(Widget w, XtPointer client_data, XtPointer call_data) { nhUse(w); nhUse(client_data); @@ -1697,11 +1634,7 @@ XtPointer client_data, call_data; /* ARGSUSED */ void -ec_delete(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +ec_delete(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (w == extended_command_popup) { ec_dismiss(); @@ -1712,11 +1645,7 @@ Cardinal *num_params; /* ARGSUSED */ static void -popup_delete(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +popup_delete(Widget w, XEvent *event, String *params, Cardinal *num_params) { nhUse(event); nhUse(params); @@ -1728,7 +1657,7 @@ Cardinal *num_params; } static void -ec_dismiss() +ec_dismiss(void) { /* unselect while still visible */ if (extended_cmd_selected >= 0) @@ -1742,8 +1671,7 @@ ec_dismiss() /* scroll the extended command menu if necessary so that choices extended_cmd_selected through ec_indx will be visible */ static void -ec_scroll_to_view(ec_indx) -int ec_indx; /* might be greater than extended_cmd_selected */ +ec_scroll_to_view(int ec_indx) /* might be greater than extended_cmd_selected */ { Widget viewport, scrollbar, tmpw; Arg args[5]; @@ -1846,8 +1774,7 @@ int ec_indx; /* might be greater than extended_cmd_selected */ /* decide whether extcmdlist[idx] should be part of extended commands menu */ static boolean -ignore_extcmd(idx) -int idx; +ignore_extcmd(int idx) { /* #shell or #suspect might not be available; 'extmenu' option controls whether we show full list @@ -1862,11 +1789,7 @@ int idx; /* ARGSUSED */ void -ec_key(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +ec_key(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch; int i, pass; @@ -1984,7 +1907,7 @@ Cardinal *num_params; * be used from a menubox. */ static void -init_extended_commands_popup() +init_extended_commands_popup(void) { int i, j, num_commands, ignore_cmds = 0; @@ -2036,21 +1959,13 @@ init_extended_commands_popup() * ------------------------ */ static Widget -make_menu(popup_name, popup_label, popup_translations, left_name, - left_callback, right_name, right_callback, num_names, widget_names, - command_widgets, name_callback, formp) -const char *popup_name; -const char *popup_label; -const char *popup_translations; -const char *left_name; -XtCallbackProc left_callback; -const char *right_name; -XtCallbackProc right_callback; -int num_names; -const char **widget_names; /* return array of command widgets */ -Widget **command_widgets; -XtCallbackProc name_callback; -Widget *formp; /* return */ +make_menu(const char *popup_name, const char *popup_label, + const char *popup_translations, const char *left_name, + XtCallbackProc left_callback, const char *right_name, + XtCallbackProc right_callback, int num_names, + const char **widget_names, /* return array of command widgets */ + Widget **command_widgets, + XtCallbackProc name_callback, Widget *formp) /* return */ { Widget popup, popform, form, label, above, left, right, view; Widget *commands, *curr; diff --git a/win/X11/winstat.c b/win/X11/winstat.c index c652804fc..e761d9fb2 100644 --- a/win/X11/winstat.c +++ b/win/X11/winstat.c @@ -95,30 +95,28 @@ #define NUM_STATS 41 -static int FDECL(condcolor, (long, unsigned long *)); -static int FDECL(condattr, (long, unsigned long *)); -static void FDECL(HiliteField, (Widget, int, int, int, XFontStruct **)); -static void FDECL(PrepStatusField, (int, Widget, const char *)); -static void FDECL(DisplayCond, (int, unsigned long *)); -static int FDECL(render_conditions, (int, int)); +static int condcolor(long, unsigned long *); +static int condattr(long, unsigned long *); +static void HiliteField(Widget, int, int, int, XFontStruct **); +static void PrepStatusField(int, Widget, const char *); +static void DisplayCond(int, unsigned long *); +static int render_conditions(int, int); #ifdef STATUS_HILITES -static void FDECL(tt_reset_color, (int, int, unsigned long *)); +static void tt_reset_color(int, int, unsigned long *); #endif -static void NDECL(tt_status_fixup); -static Widget FDECL(create_tty_status_field, (int, int, Widget, Widget)); -static Widget FDECL(create_tty_status, (Widget, Widget)); -static void FDECL(update_fancy_status_field, (int, int, int)); -static void FDECL(update_fancy_status, (BOOLEAN_P)); -static Widget FDECL(create_fancy_status, (Widget, Widget)); -static void FDECL(destroy_fancy_status, (struct xwindow *)); -static void FDECL(create_status_window_fancy, (struct xwindow *, - BOOLEAN_P, Widget)); -static void FDECL(create_status_window_tty, (struct xwindow *, - BOOLEAN_P, Widget)); -static void FDECL(destroy_status_window_fancy, (struct xwindow *)); -static void FDECL(destroy_status_window_tty, (struct xwindow *)); -static void FDECL(adjust_status_fancy, (struct xwindow *, const char *)); -static void FDECL(adjust_status_tty, (struct xwindow *, const char *)); +static void tt_status_fixup(void); +static Widget create_tty_status_field(int, int, Widget, Widget); +static Widget create_tty_status(Widget, Widget); +static void update_fancy_status_field(int, int, int); +static void update_fancy_status(boolean); +static Widget create_fancy_status(Widget, Widget); +static void destroy_fancy_status(struct xwindow *); +static void create_status_window_fancy(struct xwindow *, boolean, Widget); +static void create_status_window_tty(struct xwindow *, boolean, Widget); +static void destroy_status_window_fancy(struct xwindow *); +static void destroy_status_window_tty(struct xwindow *); +static void adjust_status_fancy(struct xwindow *, const char *); +static void adjust_status_tty(struct xwindow *, const char *); extern const char *status_fieldfmt[MAXBLSTATS]; extern char *status_vals[MAXBLSTATS]; @@ -200,9 +198,7 @@ static Pixel X11_status_fg, X11_status_bg; struct xwindow *xw_status_win; static int -condcolor(bm, bmarray) -long bm; -unsigned long *bmarray; +condcolor(long bm, unsigned long *bmarray) { int i; @@ -215,9 +211,7 @@ unsigned long *bmarray; } static int -condattr(bm, bmarray) -long bm; -unsigned long *bmarray; +condattr(long bm, unsigned long *bmarray) { int attr = 0; int i; @@ -249,7 +243,7 @@ unsigned long *bmarray; } void -X11_status_init() +X11_status_init(void) { int i; @@ -265,26 +259,22 @@ X11_status_init() } void -X11_status_finish() +X11_status_finish(void) { /* nothing */ return; } void -X11_status_enablefield(fieldidx, nm, fmt, enable) -int fieldidx; -const char *nm; -const char *fmt; -boolean enable; +X11_status_enablefield(int fieldidx, const char *nm, + const char *fmt, boolean enable) { genl_status_enablefield(fieldidx, nm, fmt, enable); } #if 0 int -cond_bm2idx(bm) -unsigned long bm; +cond_bm2idx(unsigned long bm) { int i; @@ -297,10 +287,9 @@ unsigned long bm; /* highlight a tty-style status field (or condition) */ static void -HiliteField(label, fld, cond, colrattr, font_p) -Widget label; -int fld, cond, colrattr; -XFontStruct **font_p; +HiliteField(Widget label, + int fld, int cond, int colrattr, + XFontStruct **font_p) { #ifdef STATUS_HILITES static Pixel grayPxl, blackPxl, whitePxl; @@ -378,10 +367,7 @@ XFontStruct **font_p; /* set up a specific field other than 'condition'; its general location was specified during widget creation but it might need adjusting */ static void -PrepStatusField(fld, label, text) -int fld; -Widget label; -const char *text; +PrepStatusField(int fld, Widget label, const char *text) { Arg args[6]; Cardinal num_args; @@ -411,9 +397,8 @@ const char *text; /* set up one status condition for tty-style status display */ static void -DisplayCond(c_idx, colormasks) -int c_idx; /* index into tt_condorder[] */ -unsigned long *colormasks; +DisplayCond(int c_idx, /* index into tt_condorder[] */ + unsigned long *colormasks) { Widget label; Arg args[6]; @@ -459,8 +444,7 @@ unsigned long *colormasks; /* display the tty-style status conditions; the number shown varies and we might be showing more, same, or fewer than during previous status */ static int -render_conditions(row, dx) -int row, dx; +render_conditions(int row, int dx) { Widget label; Arg args[6]; @@ -524,9 +508,7 @@ int row, dx; /* reset status_hilite for BL_RESET; if highlighting has been disabled or this field is disabled, clear highlighting for this field or condition */ static void -tt_reset_color(fld, cond, colormasks) -int fld, cond; -unsigned long *colormasks; +tt_reset_color(int fld, int cond, unsigned long *colormasks) { Widget label; int colrattr = NO_COLOR; @@ -557,7 +539,7 @@ unsigned long *colormasks; then explicitly set them for all the status widgets; also cache some geometry settings in (*xw_status_win).Status_info */ static void -tt_status_fixup() +tt_status_fixup(void) { Arg args[6]; Cardinal num_args; @@ -663,10 +645,10 @@ tt_status_fixup() /* core requests updating one status field (or is indicating that it's time to flush all updated fields); tty-style handling */ static void -X11_status_update_tty(fld, ptr, chg, percent, color, colormasks) -int fld, chg UNUSED, percent, color; -genericptr_t ptr; -unsigned long *colormasks; /* bitmask of highlights for conditions */ +X11_status_update_tty(int fld, genericptr_t ptr, int chg UNUSED, int percent, + int color, + unsigned long *colormasks) /* bitmask of highlights + for conditions */ { static int xtra_space[MAXBLSTATS]; static unsigned long *cond_colormasks = (unsigned long *) 0; @@ -830,10 +812,9 @@ unsigned long *colormasks; /* bitmask of highlights for conditions */ /*ARGSUSED*/ static void -X11_status_update_fancy(fld, ptr, chg, percent, colrattr, colormasks) -int fld, chg UNUSED, percent UNUSED, colrattr; -genericptr_t ptr; -unsigned long *colormasks; +X11_status_update_fancy(int fld, genericptr_t ptr, int chg UNUSED, + int percent UNUSED, int colrattr, + unsigned long *colormasks UNUSED) { static const struct bl_to_ff { int bl, ff; @@ -927,10 +908,9 @@ unsigned long *colormasks; } void -X11_status_update(fld, ptr, chg, percent, color, colormasks) -int fld, chg UNUSED, percent UNUSED, color; -genericptr_t ptr; -unsigned long *colormasks; +X11_status_update(int fld, genericptr_t ptr, int chg, + int percent, int color, + unsigned long *colormasks) { if (fld < BL_RESET || fld >= MAXBLSTATS) panic("X11_status_update(%d) -- invalid field", fld); @@ -943,9 +923,7 @@ unsigned long *colormasks; /* create a widget for a particular status field or potential condition */ static Widget -create_tty_status_field(fld, condindx, above, left) -int fld, condindx; -Widget above, left; +create_tty_status_field(int fld, int condindx, Widget above, Widget left) { Arg args[16]; Cardinal num_args; @@ -985,8 +963,7 @@ Widget above, left; /* create an overall status widget (X11_status_widget) and also separate widgets for all status fields and potential conditions */ static Widget -create_tty_status(parent, top) -Widget parent, top; +create_tty_status(Widget parent, Widget top) { Widget form; /* viewport that holds the form that surrounds everything */ Widget w, over_w, prev_w; @@ -1040,18 +1017,15 @@ Widget parent, top; /*ARGSUSED*/ void -create_status_window_tty(wp, create_popup, parent) -struct xwindow *wp; /* window pointer */ -boolean create_popup UNUSED; -Widget parent; +create_status_window_tty(struct xwindow *wp, /* window pointer */ + boolean create_popup UNUSED, Widget parent) { wp->type = NHW_STATUS; wp->w = create_tty_status(parent, (Widget) 0); } void -destroy_status_window_tty(wp) -struct xwindow *wp; +destroy_status_window_tty(struct xwindow *wp) { /* If status_information is defined, then it a "text" status window. */ if (wp->status_information) { @@ -1071,19 +1045,15 @@ struct xwindow *wp; /*ARGSUSED*/ void -adjust_status_tty(wp, str) -struct xwindow *wp UNUSED; -const char *str UNUSED; +adjust_status_tty(struct xwindow *wp UNUSED, const char *str UNUSED) { /* nothing */ return; } void -create_status_window(wp, create_popup, parent) -struct xwindow *wp; /* window pointer */ -boolean create_popup; -Widget parent; +create_status_window(struct xwindow *wp, /* window pointer */ + boolean create_popup, Widget parent) { struct status_info_t *si = (struct status_info_t *) alloc(sizeof *si); @@ -1100,8 +1070,7 @@ Widget parent; } void -destroy_status_window(wp) -struct xwindow *wp; +destroy_status_window(struct xwindow *wp) { if (appResources.fancy_status) destroy_status_window_fancy(wp); @@ -1110,9 +1079,7 @@ struct xwindow *wp; } void -adjust_status(wp, str) -struct xwindow *wp; -const char *str; +adjust_status(struct xwindow *wp, const char *str) { if (appResources.fancy_status) adjust_status_fancy(wp, str); @@ -1121,10 +1088,8 @@ const char *str; } void -create_status_window_fancy(wp, create_popup, parent) -struct xwindow *wp; /* window pointer */ -boolean create_popup; -Widget parent; +create_status_window_fancy(struct xwindow *wp, /* window pointer */ + boolean create_popup, Widget parent) { XFontStruct *fs; Arg args[8]; @@ -1203,8 +1168,7 @@ Widget parent; } void -destroy_status_window_fancy(wp) -struct xwindow *wp; +destroy_status_window_fancy(struct xwindow *wp) { /* If status_information is defined, then it a "text" status window. */ if (wp->status_information) { @@ -1229,9 +1193,7 @@ struct xwindow *wp; * + We didn't set stringInPlace on the widget. */ void -adjust_status_fancy(wp, str) -struct xwindow *wp; -const char *str; +adjust_status_fancy(struct xwindow *wp, const char *str) { Arg args[2]; Cardinal num_args; @@ -1289,22 +1251,21 @@ struct f_overload { struct ovld_item conds[NUM_OVLD]; }; -static const struct f_overload *FDECL(ff_ovld_from_mask, (unsigned long)); -static const struct f_overload *FDECL(ff_ovld_from_indx, (int)); -static void FDECL(hilight_label, (Widget)); -static void FDECL(update_val, (struct X_status_value *, long)); -static void FDECL(skip_cond_val, (struct X_status_value *)); -static void FDECL(update_color, (struct X_status_value *, int)); -static boolean FDECL(name_widget_has_label, (struct X_status_value *)); -static void FDECL(apply_hilite_attributes, (struct X_status_value *, int)); -static const char *FDECL(width_string, (int)); -static void FDECL(create_widget, (Widget, struct X_status_value *, int)); -static void FDECL(get_widths, (struct X_status_value *, int *, int *)); -static void FDECL(set_widths, (struct X_status_value *, int, int)); -static Widget FDECL(init_column, (const char *, Widget, Widget, Widget, - int *, int)); -static void NDECL(fixup_cond_widths); -static Widget FDECL(init_info_form, (Widget, Widget, Widget)); +static const struct f_overload *ff_ovld_from_mask(unsigned long); +static const struct f_overload *ff_ovld_from_indx(int); +static void hilight_label(Widget); +static void update_val(struct X_status_value *, long); +static void skip_cond_val(struct X_status_value *); +static void update_color(struct X_status_value *, int); +static boolean name_widget_has_label(struct X_status_value *); +static void apply_hilite_attributes(struct X_status_value *, int); +static const char *width_string(int); +static void create_widget(Widget, struct X_status_value *, int); +static void get_widths(struct X_status_value *, int *, int *); +static void set_widths(struct X_status_value *, int, int); +static Widget init_column(const char *, Widget, Widget, Widget, int *, int); +static void fixup_cond_widths(void); +static Widget init_info_form(Widget, Widget, Widget); /* * Notes: @@ -1413,8 +1374,7 @@ static const struct f_overload cond_ovl[] = { }; static const struct f_overload * -ff_ovld_from_mask(mask) -unsigned long mask; +ff_ovld_from_mask(unsigned long mask) { const struct f_overload *fo; @@ -1426,8 +1386,7 @@ unsigned long mask; } static const struct f_overload * -ff_ovld_from_indx(indx) -int indx; /* F_foo number, index into shown_stats[] */ +ff_ovld_from_indx(int indx) /* F_foo number, index into shown_stats[] */ { const struct f_overload *fo; int i, ff; @@ -1448,7 +1407,7 @@ int indx; /* F_foo number, index into shown_stats[] */ * kinds of funny values being displayed. */ void -null_out_status() +null_out_status(void) { int i; struct X_status_value *sv; @@ -1475,8 +1434,7 @@ null_out_status() /* this is almost an exact duplicate of hilight_value() */ static void -hilight_label(w) -Widget w; /* label widget */ +hilight_label(Widget w) /* label widget */ { /* * This predates STATUS_HILITES. @@ -1487,9 +1445,7 @@ Widget w; /* label widget */ } static void -update_val(attr_rec, new_value) -struct X_status_value *attr_rec; -long new_value; +update_val(struct X_status_value *attr_rec, long new_value) { static boolean Exp_shown = TRUE, time_shown = TRUE, score_shown = TRUE, Xp_was_HD = FALSE; @@ -1699,8 +1655,7 @@ long new_value; /* overloaded condition is being cleared without going through update_val() so that an alternate can be shown; put this one back to default settings */ static void -skip_cond_val(sv) -struct X_status_value *sv; +skip_cond_val(struct X_status_value *sv) { sv->last_value = 0L; /* Off */ if (sv->set) { @@ -1714,9 +1669,7 @@ struct X_status_value *sv; } static void -update_color(sv, color) -struct X_status_value *sv; -int color; +update_color(struct X_status_value *sv, int color) { Pixel pixel = 0; Arg args[1]; @@ -1747,8 +1700,7 @@ int color; } static boolean -name_widget_has_label(sv) -struct X_status_value *sv; +name_widget_has_label(struct X_status_value *sv) { Arg args[1]; const char *label; @@ -1759,9 +1711,7 @@ struct X_status_value *sv; } static void -apply_hilite_attributes(sv, attributes) -struct X_status_value *sv; -int attributes; +apply_hilite_attributes(struct X_status_value *sv, int attributes) { boolean attr_inversion = ((HL_INVERSE & attributes) && (sv->type != SV_NAME @@ -1801,8 +1751,7 @@ int attributes; * [**] HD is shown instead of level and exp if Upolyd. */ static void -update_fancy_status_field(i, color, attributes) -int i, color, attributes; +update_fancy_status_field(int i, int color, int attributes) { struct X_status_value *sv = &shown_stats[i]; unsigned long condmask = 0L; @@ -1990,8 +1939,7 @@ int i, color, attributes; /* fully update status after bl_flush or window resize */ static void -update_fancy_status(force_update) -boolean force_update; +update_fancy_status(boolean force_update) { static boolean old_showtime, old_showexp, old_showscore; static int old_upolyd = -1; /* -1: force first time update */ @@ -2023,7 +1971,7 @@ boolean force_update; * Turn off hilighted status values after a certain amount of turns. */ void -check_turn_events() +check_turn_events(void) { int i; struct X_status_value *sv; @@ -2050,8 +1998,7 @@ check_turn_events() /* Return a string for the initial width, so use longest possible value. */ static const char * -width_string(sv_index) -int sv_index; +width_string(int sv_index) { switch (sv_index) { case F_DUMMY: @@ -2121,10 +2068,7 @@ int sv_index; } static void -create_widget(parent, sv, sv_index) -Widget parent; -struct X_status_value *sv; -int sv_index; +create_widget(Widget parent, struct X_status_value *sv, int sv_index) { Arg args[4]; Cardinal num_args; @@ -2195,9 +2139,7 @@ int sv_index; * Get current width of value. width2p is only valid for SV_VALUE types. */ static void -get_widths(sv, width1p, width2p) -struct X_status_value *sv; -int *width1p, *width2p; +get_widths(struct X_status_value *sv, int *width1p, int *width2p) { Arg args[1]; Dimension width; @@ -2220,9 +2162,7 @@ int *width1p, *width2p; } static void -set_widths(sv, width1, width2) -struct X_status_value *sv; -int width1, width2; +set_widths(struct X_status_value *sv, int width1, int width2) { Arg args[1]; @@ -2242,10 +2182,8 @@ int width1, width2; } static Widget -init_column(name, parent, top, left, col_indices, xtrawidth) -const char *name; -Widget parent, top, left; -int *col_indices, xtrawidth; +init_column(const char *name, Widget parent, Widget top, Widget left, + int *col_indices, int xtrawidth) { Widget form; Arg args[4]; @@ -2365,8 +2303,7 @@ static int characteristics_indices[11 - 2] = { * TODO: widen title field and implement hitpoint bar on it. */ static Widget -init_info_form(parent, top, left) -Widget parent, top, left; +init_info_form(Widget parent, Widget top, Widget left) { Widget form, col1, col2; struct X_status_value *sv_name, *sv_dlevel; @@ -2425,7 +2362,7 @@ Widget parent, top, left; /* give the three status condition columns the same width */ static void -fixup_cond_widths() +fixup_cond_widths(void) { int pass, i, *ip, w1, w2; @@ -2462,8 +2399,7 @@ fixup_cond_widths() * contains everything. */ static Widget -create_fancy_status(parent, top) -Widget parent, top; +create_fancy_status(Widget parent, Widget top) { Widget form; /* The form that surrounds everything. */ Widget w; @@ -2510,8 +2446,7 @@ Widget parent, top; } static void -destroy_fancy_status(wp) -struct xwindow *wp; +destroy_fancy_status(struct xwindow *wp) { int i; struct X_status_value *sv; diff --git a/win/X11/wintext.c b/win/X11/wintext.c index a6c2737b8..c3ce45f29 100644 --- a/win/X11/wintext.c +++ b/win/X11/wintext.c @@ -48,16 +48,12 @@ static const char rip_translations[] = "#override\n\ : rip_dismiss_text()\n\ : rip_dismiss_text()"; -static Widget FDECL(create_ripout_widget, (Widget)); +static Widget create_ripout_widget(Widget); #endif /*ARGSUSED*/ void -delete_text(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +delete_text(Widget w, XEvent *event, String *params, Cardinal *num_params) { struct xwindow *wp; struct text_info_t *text_info; @@ -85,11 +81,7 @@ Cardinal *num_params; */ /*ARGSUSED*/ void -dismiss_text(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +dismiss_text(Widget w, XEvent *event, String *params, Cardinal *num_params) { struct xwindow *wp; struct text_info_t *text_info; @@ -112,11 +104,7 @@ Cardinal *num_params; /* Dismiss when a non-modifier key pressed. */ void -key_dismiss_text(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +key_dismiss_text(Widget w, XEvent *event, String *params, Cardinal *num_params) { char ch = key_event_to_char((XKeyEvent *) event); if (ch) @@ -126,11 +114,7 @@ Cardinal *num_params; #ifdef GRAPHIC_TOMBSTONE /* Dismiss from clicking on rip image. */ void -rip_dismiss_text(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; +rip_dismiss_text(Widget w, XEvent *event, String *params, Cardinal *num_params) { dismiss_text(XtParent(w), event, params, num_params); } @@ -138,10 +122,8 @@ Cardinal *num_params; /* ARGSUSED */ void -add_to_text_window(wp, attr, str) -struct xwindow *wp; -int attr; /* currently unused */ -const char *str; +add_to_text_window(struct xwindow *wp, int attr, /* currently unused */ + const char *str) { struct text_info_t *text_info = wp->text_information; int width; @@ -157,9 +139,7 @@ const char *str; } void -display_text_window(wp, blocking) -struct xwindow *wp; -boolean blocking; +display_text_window(struct xwindow *wp, boolean blocking) { struct text_info_t *text_info; Arg args[8]; @@ -258,8 +238,7 @@ boolean blocking; } void -create_text_window(wp) -struct xwindow *wp; +create_text_window(struct xwindow *wp) { struct text_info_t *text_info; Arg args[8]; @@ -341,8 +320,7 @@ struct xwindow *wp; } void -destroy_text_window(wp) -struct xwindow *wp; +destroy_text_window(struct xwindow *wp) { /* Don't need to pop down, this only called from dismiss_text(). */ @@ -365,8 +343,7 @@ struct xwindow *wp; } void -clear_text_window(wp) -struct xwindow *wp; +clear_text_window(struct xwindow *wp) { clear_text_buffer(&wp->text_information->text); } @@ -376,10 +353,7 @@ struct xwindow *wp; /* Append a line to the text buffer. */ void -append_text_buffer(tb, str, concat) -struct text_buffer *tb; -const char *str; -boolean concat; +append_text_buffer(struct text_buffer *tb, const char *str, boolean concat) { char *copy; int length; @@ -436,8 +410,7 @@ boolean concat; /* Initialize text buffer. */ void -init_text_buffer(tb) -struct text_buffer *tb; +init_text_buffer(struct text_buffer *tb) { tb->text = (char *) alloc(START_SIZE); tb->text[0] = '\0'; @@ -448,8 +421,7 @@ struct text_buffer *tb; /* Empty the text buffer */ void -clear_text_buffer(tb) -struct text_buffer *tb; +clear_text_buffer(struct text_buffer *tb) { tb->text_last = 0; tb->text[0] = '\0'; @@ -458,8 +430,7 @@ struct text_buffer *tb; /* Free up allocated memory. */ void -free_text_buffer(tb) -struct text_buffer *tb; +free_text_buffer(struct text_buffer *tb) { free(tb->text); tb->text = (char *) 0; @@ -470,7 +441,7 @@ struct text_buffer *tb; #ifdef GRAPHIC_TOMBSTONE -static void FDECL(rip_exposed, (Widget, XtPointer, XtPointer)); +static void rip_exposed(Widget, XtPointer, XtPointer); static XImage *rip_image = 0; @@ -538,10 +509,8 @@ calculate_rip_text(int how, time_t when) */ /*ARGSUSED*/ static void -rip_exposed(w, client_data, widget_data) -Widget w; -XtPointer client_data UNUSED; -XtPointer widget_data; /* expose event from Window widget */ +rip_exposed(Widget w, XtPointer client_data UNUSED, + XtPointer widget_data) /* expose event from Window widget */ { XExposeEvent *event = (XExposeEvent *) widget_data; Display *dpy = XtDisplay(w); diff --git a/win/X11/winval.c b/win/X11/winval.c index 6bb620539..19a0ecbc7 100644 --- a/win/X11/winval.c +++ b/win/X11/winval.c @@ -32,9 +32,7 @@ #define WVALUE "value" Widget -create_value(parent, name_value) -Widget parent; -const char *name_value; +create_value(Widget parent, const char *name_value) { Widget form, name; Arg args[8]; @@ -75,9 +73,7 @@ const char *name_value; } void -set_name(w, new_label) -Widget w; -const char *new_label; +set_name(Widget w, const char *new_label) { Arg args[1]; Widget name; @@ -88,9 +84,7 @@ const char *new_label; } void -set_name_width(w, new_width) -Widget w; -int new_width; +set_name_width(Widget w, int new_width) { Arg args[1]; Widget name; @@ -101,8 +95,7 @@ int new_width; } int -get_name_width(w) -Widget w; +get_name_width(Widget w) { Arg args[1]; Dimension width; @@ -115,16 +108,13 @@ Widget w; } Widget -get_value_widget(w) -Widget w; +get_value_widget(Widget w) { return XtNameToWidget(w, WVALUE); } void -set_value(w, new_value) -Widget w; -const char *new_value; +set_value(Widget w, const char *new_value) { Arg args[1]; Widget val; @@ -135,9 +125,7 @@ const char *new_value; } void -set_value_width(w, new_width) -Widget w; -int new_width; +set_value_width(Widget w, int new_width) { Arg args[1]; Widget val; @@ -148,8 +136,7 @@ int new_width; } int -get_value_width(w) -Widget w; +get_value_width(Widget w) { Arg args[1]; Widget val; @@ -164,16 +151,14 @@ Widget w; /* Swap foreground and background colors (this is the best I can do with */ /* a label widget, unless I can get some init hook in there). */ void -hilight_value(w) -Widget w; +hilight_value(Widget w) { swap_fg_bg(get_value_widget(w)); } /* Swap the foreground and background colors of the given widget */ void -swap_fg_bg(w) -Widget w; +swap_fg_bg(Widget w) { Arg args[2]; Pixel fg, bg; diff --git a/win/chain/wc_chainin.c b/win/chain/wc_chainin.c index e1e7f9de1..020cbe2b5 100644 --- a/win/chain/wc_chainin.c +++ b/win/chain/wc_chainin.c @@ -127,7 +127,7 @@ winid window; void chainin_display_nhwindow(window, blocking) winid window; -BOOLEAN_P blocking; +boolean blocking; { (*cibase->nprocs->win_display_nhwindow)(cibase->ndata, window, blocking); } diff --git a/win/chain/wc_chainout.c b/win/chain/wc_chainout.c index 5630a9056..056476ff2 100644 --- a/win/chain/wc_chainout.c +++ b/win/chain/wc_chainout.c @@ -148,7 +148,7 @@ void chainout_display_nhwindow(vp, window, blocking) void *vp; winid window; -BOOLEAN_P blocking; +boolean blocking; { struct chainout_data *tdp = vp; diff --git a/win/chain/wc_trace.c b/win/chain/wc_trace.c index f8604f2e0..e0895a865 100644 --- a/win/chain/wc_trace.c +++ b/win/chain/wc_trace.c @@ -249,7 +249,7 @@ void trace_display_nhwindow(vp, window, blocking) void *vp; winid window; -BOOLEAN_P blocking; +boolean blocking; { struct trace_data *tdp = vp; diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 2353fcc31..6c30e3e53 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -23,7 +23,7 @@ extern char erase_char, kill_char; /* * Note: - * + * FIXME * Prototypes need to use the widened/unwidened type macros (CHAR_P, &c) * in order to match fields of the window_procs struct (see winprocs.h). * But for a standard-conforming compiler, we'll end up with the widened @@ -60,11 +60,11 @@ typedef struct nhmi { winid wid; /* NetHack window id */ glyph_info glyphinfo; /* holds menu glyph and additional glyph info */ anything identifier; /* Value returned if item selected */ - CHAR_P accelerator; /* Character used to select item from menu */ - CHAR_P group_accel; /* Group accelerator for menu item, if any */ + char accelerator; /* Character used to select item from menu */ + char group_accel; /* Group accelerator for menu item, if any */ int attr; /* Text attributes for item */ const char *str; /* Text of menu item */ - BOOLEAN_P presel; /* Whether menu item should be preselected */ + boolean presel; /* Whether menu item should be preselected */ boolean selected; /* Whether item is currently selected */ unsigned itemflags; int page_num; /* Display page number for entry */ @@ -225,7 +225,7 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer) int curses_character_input_dialog(const char *prompt, const char *choices, - CHAR_P def) + char def) { WINDOW *askwin = NULL; #ifdef PDCURSES @@ -390,7 +390,7 @@ curses_character_input_dialog(const char *prompt, const char *choices, /* Return an extended command from the user */ int -curses_ext_cmd() +curses_ext_cmd(void) { int count, letter, prompt_width, startx, starty, winx, winy; int messageh, messagew, maxlen = BUFSZ - 1; @@ -624,8 +624,8 @@ curs_new_menu_item(winid wid, const char *str) void curses_add_nhmenu_item(winid wid, const glyph_info *glyphinfo, - const ANY_P *identifier, CHAR_P accelerator, - CHAR_P group_accel, int attr, + const ANY_P *identifier, char accelerator, + char group_accel, int attr, const char *str, unsigned itemflags) { nhmenu_item *new_item, *current_items, *menu_item_ptr; diff --git a/win/curses/cursdial.h b/win/curses/cursdial.h index e964fd07f..9d504bc6e 100644 --- a/win/curses/cursdial.h +++ b/win/curses/cursdial.h @@ -10,12 +10,12 @@ void curses_line_input_dialog(const char *prompt, char *answer, int buffer); int curses_character_input_dialog(const char *prompt, const char *choices, - CHAR_P def); + char def); int curses_ext_cmd(void); void curses_create_nhmenu(winid wid, unsigned long); void curses_add_nhmenu_item(winid wid, const glyph_info *glyphinfo, - const ANY_P *identifier, CHAR_P accelerator, - CHAR_P group_accel, int attr, + const ANY_P *identifier, char accelerator, + char group_accel, int attr, const char *str, unsigned itemflags); void curs_menu_set_bottom_heavy(winid); void curses_finalize_nhmenu(winid wid, const char *prompt); diff --git a/win/curses/cursinit.c b/win/curses/cursinit.c index 5ab6af594..621efd7db 100644 --- a/win/curses/cursinit.c +++ b/win/curses/cursinit.c @@ -108,7 +108,7 @@ set_window_position(int *winx, int *winy, int *winw, int *winh, /* Create the "main" nonvolatile windows used by nethack */ void -curses_create_main_windows() +curses_create_main_windows(void) { int min_message_height = 1; int message_orientation = 0; @@ -298,7 +298,7 @@ curses_create_main_windows() /* Initialize curses colors to colors used by NetHack */ void -curses_init_nhcolors() +curses_init_nhcolors(void) { #ifdef TEXTCOLOR if (has_colors()) { @@ -411,7 +411,7 @@ curses_init_nhcolors() /* Allow player to pick character's role, race, gender, and alignment. Borrowed from the Gnome window port. */ void -curses_choose_character() +curses_choose_character(void) { int n, i, sel, count_off, pick4u; int count = 0; @@ -775,7 +775,7 @@ curses_character_dialog(const char **choices, const char *prompt) /* Initialize and display options appropriately */ void -curses_init_options() +curses_init_options(void) { /* change these from set_gameview to set_in_game */ set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS, set_in_game); @@ -846,7 +846,7 @@ curses_init_options() /* Display an ASCII splash screen if the splash_screen option is set */ void -curses_display_splash_window() +curses_display_splash_window(void) { int i, x_start, y_start; @@ -880,7 +880,7 @@ curses_display_splash_window() /* Restore colors and cursor state before exiting */ void -curses_cleanup() +curses_cleanup(void) { #ifdef TEXTCOLOR if (has_colors() && can_change_color()) { diff --git a/win/curses/cursinvt.c b/win/curses/cursinvt.c index bfbf04a62..c60167e1d 100644 --- a/win/curses/cursinvt.c +++ b/win/curses/cursinvt.c @@ -55,7 +55,7 @@ curses_update_inv(void) /* Adds an inventory item. 'y' is 1 rather than 0 for the first item. */ void -curses_add_inv(int y, const glyph_info *glyphinfo UNUSED, CHAR_P accelerator, +curses_add_inv(int y, const glyph_info *glyphinfo UNUSED, char accelerator, attr_t attr, const char *str) { WINDOW *win = curses_get_nhwin(INV_WIN); diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 02d38fce2..785054e1f 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -230,7 +230,7 @@ curses_init_nhwindows(int *argcp UNUSED, the process. You need to fill in pl_character[0]. */ void -curses_player_selection() +curses_player_selection(void) { curses_choose_character(); } @@ -238,7 +238,7 @@ curses_player_selection() /* Ask the user for a player name. */ void -curses_askname() +curses_askname(void) { #ifdef SELECTSAVED if (iflags.wc2_selectsaved && !iflags.renameinprogress) @@ -271,7 +271,7 @@ curses_askname() A noop for the tty and X window-ports. */ void -curses_get_nh_event() +curses_get_nh_event(void) { boolean do_reset = FALSE; @@ -330,7 +330,7 @@ curses_suspend_nhwindows(const char *str UNUSED) /* Restore the windows after being suspended. */ void -curses_resume_nhwindows() +curses_resume_nhwindows(void) { curses_refresh_nethack_windows(); } @@ -380,7 +380,7 @@ curses_clear_nhwindow(winid wid) --more--, if necessary, in the tty window-port. */ void -curses_display_nhwindow(winid wid, BOOLEAN_P block) +curses_display_nhwindow(winid wid, boolean block) { menu_item *selected = NULL; @@ -489,7 +489,7 @@ curses_putstr(winid wid, int attr, const char *text) iff complain is TRUE. */ void -curses_display_file(const char *filename, BOOLEAN_P must_exist) +curses_display_file(const char *filename, boolean must_exist) { curses_view_file(filename, must_exist); } @@ -544,7 +544,7 @@ add_menu(winid wid, const glyph_info *glyphinfo, void curses_add_menu(winid wid, const glyph_info *glyphinfo, const ANY_P * identifier, - CHAR_P accelerator, CHAR_P group_accel, int attr, + char accelerator, char group_accel, int attr, const char *str, unsigned itemflags) { int curses_attr; @@ -641,7 +641,7 @@ mark_synch() -- Don't go beyond this point in I/O on any channel until for the moment */ void -curses_mark_synch() +curses_mark_synch(void) { } @@ -652,7 +652,7 @@ wait_synch() -- Wait until all pending output is complete (*flush*() for display is OK when return from wait_synch(). */ void -curses_wait_synch() +curses_wait_synch(void) { /* [do we need 'if (counting) curses_count_window((char *)0);' here?] */ } @@ -700,7 +700,7 @@ print_glyph(window, x, y, glyphinfo, bkglyphinfo) */ void -curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, +curses_print_glyph(winid wid, xchar x, xchar y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED) { int glyph; @@ -782,7 +782,7 @@ int nhgetch() -- Returns a single character input from the user. Returned character _must_ be non-zero. */ int -curses_nhgetch() +curses_nhgetch(void) { int ch; @@ -828,7 +828,7 @@ nhbell() -- Beep at user. [This will exist at least until sounds are redone, since sounds aren't attributable to windows anyway.] */ void -curses_nhbell() +curses_nhbell(void) { beep(); } @@ -839,7 +839,7 @@ doprev_message() -- On the tty-port this scrolls WIN_MESSAGE back one line. */ int -curses_doprev_message() +curses_doprev_message(void) { curses_prev_mesg(); return 0; @@ -865,7 +865,7 @@ char yn_function(const char *ques, const char *choices, char default) ports might use a popup. */ char -curses_yn_function(const char *question, const char *choices, CHAR_P def) +curses_yn_function(const char *question, const char *choices, char def) { return (char) curses_character_input_dialog(question, choices, def); } @@ -893,7 +893,7 @@ int get_ext_cmd(void) selection, -1 otherwise. */ int -curses_get_ext_cmd() +curses_get_ext_cmd(void) { return curses_ext_cmd(); } @@ -915,7 +915,7 @@ delay_output() -- Causes a visible delay of 50ms in the output. by a nap(50ms), but allows asynchronous operation. */ void -curses_delay_output() +curses_delay_output(void) { /* refreshing the whole display is a waste of time, * but that's why we're here */ @@ -931,7 +931,7 @@ start_screen() -- Only used on Unix tty ports, but must be declared for just declare an empty function. */ void -curses_start_screen() +curses_start_screen(void) { } @@ -940,7 +940,7 @@ end_screen() -- Only used on Unix tty ports, but must be declared for completeness. The complement of start_screen(). */ void -curses_end_screen() +curses_end_screen(void) { } @@ -1024,7 +1024,7 @@ dummy_change_color(int a1 UNUSED, long a2 UNUSED, int a3 UNUSED) } static char * -dummy_get_color_string(VOID_ARGS) +dummy_get_color_string(void) { return (char *) 0; } diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 256998cf3..0dbc74bc2 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -242,7 +242,7 @@ curses_block(boolean noscroll) /* noscroll - blocking because of msgtype } int -curses_more() +curses_more(void) { return curses_block(FALSE); } @@ -251,7 +251,7 @@ curses_more() /* Clear the message window if one line; otherwise unhighlight old messages */ void -curses_clear_unhighlight_message_window() +curses_clear_unhighlight_message_window(void) { int mh, mw, count, brdroffset = curses_window_has_border(MESSAGE_WIN) ? 1 : 0; @@ -279,7 +279,7 @@ curses_clear_unhighlight_message_window() recent messages. */ void -curses_last_messages() +curses_last_messages(void) { nhprev_mesg *mesg; int i, height, width; @@ -324,7 +324,7 @@ curses_last_messages() /* Initialize list for message history */ void -curses_init_mesg_history() +curses_init_mesg_history(void) { max_messages = iflags.msg_history; @@ -356,7 +356,7 @@ curses_teardown_messages(void) /* Display previous messages in a popup (via menu so can scroll backwards) */ void -curses_prev_mesg() +curses_prev_mesg(void) { int count; winid wid; @@ -838,8 +838,7 @@ get_msg_line(boolean reverse, int mindex) puts it into save file; if any new messages are added to the list while that is taking place, the results are likely to be scrambled */ char * -curses_getmsghistory(init) -boolean init; +curses_getmsghistory(boolean init) { static int nxtidx; nhprev_mesg *mesg; @@ -882,9 +881,7 @@ boolean init; * into message history for ^P recall without having displayed it. */ void -curses_putmsghistory(msg, restoring_msghist) -const char *msg; -boolean restoring_msghist; +curses_putmsghistory(const char *msg, boolean restoring_msghist) { static boolean initd = FALSE; static int stash_count; diff --git a/win/curses/cursmesg.h b/win/curses/cursmesg.h index f5cee192e..88c62d97b 100644 --- a/win/curses/cursmesg.h +++ b/win/curses/cursmesg.h @@ -19,7 +19,7 @@ void curses_last_messages(void); void curses_init_mesg_history(void); void curses_prev_mesg(void); void curses_count_window(const char *count_text); -char *curses_getmsghistory(BOOLEAN_P); -void curses_putmsghistory(const char *, BOOLEAN_P); +char *curses_getmsghistory(boolean); +void curses_putmsghistory(const char *, boolean); #endif /* CURSMESG_H */ diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index a8724b291..8f4b4cd59 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -38,7 +38,7 @@ static int parse_escape_sequence(void); /* Read a character of input from the user */ int -curses_read_char() +curses_read_char(void) { int ch; #if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z) @@ -624,7 +624,7 @@ curses_move_cursor(winid wid, int x, int y) /* Perform actions that should be done every turn before nhgetch() */ void -curses_prehousekeeping() +curses_prehousekeeping(void) { #ifndef PDCURSES WINDOW *win = curses_get_nhwin(MAP_WIN); @@ -647,7 +647,7 @@ curses_prehousekeeping() /* Perform actions that should be done every turn after nhgetch() */ void -curses_posthousekeeping() +curses_posthousekeeping(void) { curs_set(0); /* curses_decrement_highlights(FALSE); */ @@ -817,8 +817,7 @@ curses_read_attrs(const char *attrs) /* format iflags.wc2_petattr into "+a+b..." for set bits a, b, ... (used by core's 'O' command; return value points past leading '+') */ char * -curses_fmt_attrs(outbuf) -char *outbuf; +curses_fmt_attrs(char *outbuf) { int attr = iflags.wc2_petattr; @@ -1030,8 +1029,7 @@ curses_get_mouse(int *mousex, int *mousey, int *mod) } void -curses_mouse_support(mode) -int mode; /* 0: off, 1: on, 2: alternate on */ +curses_mouse_support(int mode) /* 0: off, 1: on, 2: alternate on */ { #ifdef NCURSES_MOUSE_VERSION mmask_t result, oldmask, newmask; diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 63c188886..02aff4f58 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -30,18 +30,18 @@ static int curses_status_colors[MAXBLSTATS]; static int hpbar_percent, hpbar_color; static int vert_status_dirty; -static void NDECL(draw_status); -static void FDECL(draw_vertical, (BOOLEAN_P)); -static void FDECL(draw_horizontal, (BOOLEAN_P)); +static void draw_status(void); +static void draw_vertical(boolean); +static void draw_horizontal(boolean); static void curs_HPbar(char *, int); static void curs_stat_conds(int, int, int *, int *, char *, boolean *); static void curs_vert_status_vals(int); #ifdef STATUS_HILITES #ifdef TEXTCOLOR -static int FDECL(condcolor, (long, unsigned long *)); +static int condcolor(long, unsigned long *); #endif -static int FDECL(condattr, (long, unsigned long *)); -static int FDECL(nhattr2curses, (int)); +static int condattr(long, unsigned long *); +static int nhattr2curses(int); #endif /* STATUS_HILITES */ /* width of a single line in vertical status orientation (one field per line; @@ -49,7 +49,7 @@ static int FDECL(nhattr2curses, (int)); #define STATVAL_WIDTH 60 /* overkill; was MAXCO (200), massive overkill */ void -curses_status_init() +curses_status_init(void) { int i; @@ -68,7 +68,7 @@ curses_status_init() } void -curses_status_finish() +curses_status_finish(void) { int i; @@ -137,11 +137,8 @@ curses_status_finish() static int changed_fields = 0; void -curses_status_update(fldidx, ptr, chg, percent, color_and_attr, colormasks) -int fldidx, chg UNUSED, - percent, color_and_attr; -genericptr_t ptr; -unsigned long *colormasks; +curses_status_update(int fldidx, genericptr_t ptr, int chg UNUSED, int percent, + int color_and_attr, unsigned long *colormasks) { long *condptr = (long *) ptr; char *text = (char *) ptr; @@ -206,7 +203,7 @@ unsigned long *colormasks; } static void -draw_status() +draw_status(void) { WINDOW *win = curses_get_nhwin(STATUS_WIN); orient statorient = (orient) curses_get_window_orientation(STATUS_WIN); @@ -244,8 +241,7 @@ draw_status() /* horizontal layout on 2 or 3 lines */ static void -draw_horizontal(border) -boolean border; +draw_horizontal(boolean border) { #define blPAD BL_FLUSH /* almost all fields already come with a leading space; @@ -650,8 +646,7 @@ boolean border; /* vertical layout, to left or right of map */ static void -draw_vertical(border) -boolean border; +draw_vertical(boolean border) { /* for blank lines, the digit prefix is the order in which they get removed if we need to shrink to fit within height limit (very rare) */ @@ -1258,9 +1253,7 @@ curs_vert_status_vals(int win_width) * be displayed in based on user settings. */ static int -condcolor(bm, bmarray) -long bm; -unsigned long *bmarray; +condcolor(long bm, unsigned long *bmarray) { int i; @@ -1274,9 +1267,7 @@ unsigned long *bmarray; #endif /* TEXTCOLOR */ static int -condattr(bm, bmarray) -long bm; -unsigned long *bmarray; +condattr(long bm, unsigned long *bmarray) { int i, attr = 0; @@ -1310,8 +1301,7 @@ unsigned long *bmarray; /* convert tty attributes to curses attributes; despite similar names, the mask fields have different values */ static int -nhattr2curses(attrmask) -int attrmask; +nhattr2curses(int attrmask) { int result = 0; diff --git a/win/curses/cursstat.h b/win/curses/cursstat.h index 3d5d856dc..1f2179e7e 100644 --- a/win/curses/cursstat.h +++ b/win/curses/cursstat.h @@ -17,7 +17,7 @@ /* Global declarations */ -void curses_update_stats(); +void curses_update_stats(void); void curses_decrement_highlights(boolean); attr_t curses_color_attr(int nh_color, int bg_color); diff --git a/win/curses/curswins.c b/win/curses/curswins.c index e1c6f5f8e..dfcb43fa2 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -159,7 +159,7 @@ curses_destroy_win(WINDOW *win) /* Refresh nethack windows if they exist, or base window if not */ void -curses_refresh_nethack_windows() +curses_refresh_nethack_windows(void) { WINDOW *status_window, *message_window, *map_window, *inv_window; @@ -350,7 +350,7 @@ curses_del_wid(winid wid) /* called by destroy_nhwindows() prior to exit */ void -curs_destroy_all_wins() +curs_destroy_all_wins(void) { curses_count_window((char *) 0); /* clean up orphan */ @@ -683,7 +683,7 @@ curses_draw_map(int sx, int sy, int ex, int ey) /* Init map array to blanks */ static void -clear_map() +clear_map(void) { int x, y; diff --git a/win/share/bmptiles.c b/win/share/bmptiles.c index f3475b1bf..61184f05c 100644 --- a/win/share/bmptiles.c +++ b/win/share/bmptiles.c @@ -61,23 +61,21 @@ struct BitmapInfoHeader { #define BI_JPEG 4 #define BI_PNG 5 -static uint16 FDECL(read_u16, (const unsigned char buf[2])); -static uint32 FDECL(read_u32, (const unsigned char buf[4])); -static int32 FDECL(read_s32, (const unsigned char buf[4])); -static struct Pixel FDECL(build_pixel, (const struct BitmapInfoHeader *, uint32)); -static unsigned char FDECL(pixel_element, (uint32, uint32)); -static boolean FDECL(read_header, (FILE *, struct BitmapHeader *)); -static boolean FDECL(read_info_header, (FILE *, struct BitmapInfoHeader *)); -static boolean FDECL(check_info_header, (const struct BitmapInfoHeader *)); -static unsigned FDECL(get_palette_size, (const struct BitmapInfoHeader *)); -static boolean FDECL(read_palette, (FILE *, struct Pixel *, unsigned)); +static uint16 read_u16(const unsigned char buf[2]); +static uint32 read_u32(const unsigned char buf[4]); +static int32 read_s32(const unsigned char buf[4]); +static struct Pixel build_pixel(const struct BitmapInfoHeader *, uint32); +static unsigned char pixel_element(uint32, uint32); +static boolean read_header(FILE *, struct BitmapHeader *); +static boolean read_info_header(FILE *, struct BitmapInfoHeader *); +static boolean check_info_header(const struct BitmapInfoHeader *); +static unsigned get_palette_size(const struct BitmapInfoHeader *); +static boolean read_palette(FILE *, struct Pixel *, unsigned); /* Read a .BMP file into the image structure */ /* Return TRUE if successful, FALSE on any error */ boolean -read_bmp_tiles(filename, image) -const char *filename; -struct TileSetImage *image; +read_bmp_tiles(const char *filename, struct TileSetImage *image) { struct BitmapHeader header1; struct BitmapInfoHeader header2; @@ -325,9 +323,7 @@ error: /* Read and decode the first header */ static boolean -read_header(fp, header) -FILE *fp; -struct BitmapHeader *header; +read_header(FILE *fp, struct BitmapHeader *header) { unsigned char buf[14]; size_t size; @@ -344,9 +340,7 @@ struct BitmapHeader *header; /* Read and decode the second header */ static boolean -read_info_header(fp, header) -FILE *fp; -struct BitmapInfoHeader *header; +read_info_header(FILE *fp, struct BitmapInfoHeader *header) { unsigned char buf[124]; /* maximum size */ size_t size; @@ -441,8 +435,7 @@ struct BitmapInfoHeader *header; /* Check the second header for consistency and unsupported features */ static boolean -check_info_header(header) -const struct BitmapInfoHeader *header; +check_info_header(const struct BitmapInfoHeader *header) { if (header->NumPlanes != 1) return FALSE; switch (header->BitsPerPixel) { @@ -492,8 +485,7 @@ const struct BitmapInfoHeader *header; /* Return the number of palette entries to read from the file */ static unsigned -get_palette_size(header) -const struct BitmapInfoHeader *header; +get_palette_size(const struct BitmapInfoHeader *header) { switch (header->BitsPerPixel) { case 1: @@ -517,10 +509,7 @@ const struct BitmapInfoHeader *header; * Return TRUE if successful, FALSE on any error */ static boolean -read_palette(fp, palette, palette_size) -FILE *fp; -struct Pixel *palette; -unsigned palette_size; +read_palette(FILE *fp, struct Pixel *palette, unsigned palette_size) { unsigned i; unsigned char buf[4]; @@ -547,8 +536,7 @@ unsigned palette_size; /* Decode an unsigned 16 bit quantity */ static uint16 -read_u16(buf) -const unsigned char buf[2]; +read_u16(const unsigned char buf[2]) { return ((uint16)buf[0] << 0) | ((uint16)buf[1] << 8); @@ -556,8 +544,7 @@ const unsigned char buf[2]; /* Decode an unsigned 32 bit quantity */ static uint32 -read_u32(buf) -const unsigned char buf[4]; +read_u32(const unsigned char buf[4]) { return ((uint32)buf[0] << 0) | ((uint32)buf[1] << 8) @@ -567,8 +554,7 @@ const unsigned char buf[4]; /* Decode a signed 32 bit quantity */ static int32 -read_s32(buf) -const unsigned char buf[4]; +read_s32(const unsigned char buf[4]) { return (int32)((read_u32(buf) ^ 0x80000000) - 0x80000000); } @@ -591,9 +577,7 @@ uint32 color; /* Extract one element (red, green, blue or alpha) from a pixel */ static unsigned char -pixel_element(mask, color) -uint32 mask; -uint32 color; +pixel_element(uint32 mask, uint32 color) { uint32 bits, shift; diff --git a/win/share/gifread.c b/win/share/gifread.c index 28c5215e1..c7f742545 100644 --- a/win/share/gifread.c +++ b/win/share/gifread.c @@ -20,7 +20,7 @@ #include "tile.h" #ifndef MONITOR_HEAP -extern long *FDECL(alloc, (unsigned int)); +extern long *alloc(unsigned int); #endif #define PPM_ASSIGN(p, red, grn, blu) \ @@ -65,24 +65,22 @@ static int tiles_across, tiles_down, curr_tiles_across, curr_tiles_down; static pixel **image; static unsigned char input_code_size; -static int FDECL(GetDataBlock, (FILE * fd, unsigned char *buf)); -static void FDECL(DoExtension, (FILE * fd, int label)); -static boolean FDECL(ReadColorMap, (FILE * fd, int number)); -static void FDECL(read_header, (FILE * fd)); -static int FDECL(GetCode, (FILE * fd, int code_size, int flag)); -static int FDECL(LWZReadByte, (FILE * fd, int flag, int input_code_size)); -static void FDECL(ReadInterleavedImage, (FILE * fd, int len, int height)); -static void FDECL(ReadTileStrip, (FILE * fd, int len)); +static int GetDataBlock(FILE * fd, unsigned char *buf); +static void DoExtension(FILE * fd, int label); +static boolean ReadColorMap(FILE * fd, int number); +static void read_header(FILE * fd); +static int GetCode(FILE * fd, int code_size, int flag); +static int LWZReadByte(FILE * fd, int flag, int input_code_size); +static void ReadInterleavedImage(FILE * fd, int len, int height); +static void ReadTileStrip(FILE * fd, int len); /* These should be in gif.h, but there isn't one. */ -boolean FDECL(fopen_gif_file, (const char *, const char *)); -boolean FDECL(read_gif_tile, (pixel(*) [TILE_X])); -int NDECL(fclose_gif_file); +boolean fopen_gif_file(const char *, const char *); +boolean read_gif_tile(pixel(*) [TILE_X]); +int fclose_gif_file(void); static int -GetDataBlock(fd, buf) -FILE *fd; -unsigned char *buf; +GetDataBlock(FILE *fd, unsigned char *buf) { unsigned char count; @@ -102,9 +100,7 @@ unsigned char *buf; } static void -DoExtension(fd, label) -FILE *fd; -int label; +DoExtension(FILE *fd, int label) { static char buf[256]; char *str; @@ -169,9 +165,7 @@ int label; } static boolean -ReadColorMap(fd, number) -FILE *fd; -int number; +ReadColorMap(FILE *fd, int number) { int i; unsigned char rgb[3]; @@ -194,8 +188,7 @@ int number; * file, so if that image has a local colormap, overwrite the global one. */ static void -read_header(fd) -FILE *fd; +read_header(FILE *fd) { unsigned char buf[16]; unsigned char c; @@ -294,10 +287,7 @@ FILE *fd; } static int -GetCode(fd, code_size, flag) -FILE *fd; -int code_size; -int flag; +GetCode(FILE *fd, int code_size, int flag) { static unsigned char buf[280]; static int curbit, lastbit, done, last_byte; @@ -338,10 +328,7 @@ int flag; } static int -LWZReadByte(fd, flag, input_code_size) -FILE *fd; -int flag; -int input_code_size; +LWZReadByte(FILE *fd, int flag, int input_code_size) { static int fresh = FALSE; int code, incode; @@ -454,9 +441,7 @@ int input_code_size; } static void -ReadInterleavedImage(fd, len, height) -FILE *fd; -int len, height; +ReadInterleavedImage(FILE *fd, int len, int height) { int v; int xpos = 0, ypos = 0, pass = 0; @@ -508,9 +493,7 @@ fini: } static void -ReadTileStrip(fd, len) -FILE *fd; -int len; +ReadTileStrip(FILE *fd, int len) { int v; int xpos = 0, ypos = 0; @@ -530,9 +513,7 @@ int len; } boolean -fopen_gif_file(filename, type) -const char *filename; -const char *type; +fopen_gif_file(const char *filename, const char *type) { int i; @@ -599,8 +580,7 @@ const char *type; /* Read a tile. Returns FALSE when there are no more tiles */ boolean -read_gif_tile(pixels) -pixel (*pixels)[TILE_X]; +read_gif_tile(pixel (*pixels)[TILE_X]) { int i, j; @@ -646,7 +626,7 @@ pixel (*pixels)[TILE_X]; } int -fclose_gif_file() +fclose_gif_file(void) { int i; @@ -670,9 +650,7 @@ static char *std_args[] = { "tilemap", /* dummy argv[0] */ "objects.txt", "other.gif", "other.txt" }; int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { pixel pixels[TILE_Y][TILE_X]; diff --git a/win/share/giftiles.c b/win/share/giftiles.c index bb5c81c07..bb2db7972 100644 --- a/win/share/giftiles.c +++ b/win/share/giftiles.c @@ -45,14 +45,15 @@ struct DataBlock { unsigned char *data; }; -static boolean FDECL(read_data_block, (struct Bitstream *gif, struct DataBlock *block)); -static void FDECL(free_data_block, (struct DataBlock *block)); -static unsigned short FDECL(read_u16, (const unsigned char buf[2])); -static void FDECL(init_decoder, (struct Bitstream *gif, unsigned bit_width)); -static void FDECL(reset_decoder, (struct Bitstream *gif)); -static int FDECL(decode, (struct Bitstream *gif, struct DataBlock *block)); -static int FDECL(get_code, (struct Bitstream *gif, struct DataBlock *block)); -static unsigned FDECL(interlace_incr, (unsigned y, unsigned height)); +static boolean read_data_block(struct Bitstream *gif, + struct DataBlock *block); +static void free_data_block(struct DataBlock *block); +static unsigned short read_u16(const unsigned char buf[2]); +static void init_decoder(struct Bitstream *gif, unsigned bit_width); +static void reset_decoder(struct Bitstream *gif); +static int decode(struct Bitstream *gif, struct DataBlock *block); +static int get_code(struct Bitstream *gif, struct DataBlock *block); +static unsigned interlace_incr(unsigned y, unsigned height); /* * GIF specifies a canvas, which may have a palette (the "global color table") @@ -64,9 +65,7 @@ static unsigned FDECL(interlace_incr, (unsigned y, unsigned height)); */ boolean -read_gif_tiles(filename, image) -const char *filename; -struct TileSetImage *image; +read_gif_tiles(const char *filename, struct TileSetImage *image) { struct Bitstream gif; struct DataBlock block; @@ -158,7 +157,7 @@ struct TileSetImage *image; boolean have_lct, interlace; unsigned lct_start, lct_size; struct Pixel lct[256]; - int b; + int new_b; unsigned x, y, x2, y2; size = fread(buf, 1, 9, gif.fp); @@ -203,23 +202,23 @@ struct TileSetImage *image; } } /* 22. Table based image data */ - b = fgetc(gif.fp); - if (b == EOF) goto error; - if (b < MIN_LZW_BITS - 1 || MAX_LZW_BITS - 1 < b) goto error; - init_decoder(&gif, b); + new_b = fgetc(gif.fp); + if (new_b == EOF) goto error; + if (new_b < MIN_LZW_BITS - 1 || MAX_LZW_BITS - 1 < new_b) goto error; + init_decoder(&gif, new_b); x = 0; y = 0; if (!read_data_block(&gif, &block)) goto error; while (TRUE) { - b = decode(&gif, &block); - if (b == EOF) goto error; - if (b == END_OF_DATA) break; + new_b = decode(&gif, &block); + if (new_b == EOF) goto error; + if (new_b == END_OF_DATA) break; if (y >= img_height) goto error; x2 = img_left + x; y2 = img_top + y; if (x2 < image->width && y2 < image->height) { - image->pixels[y2 * image->width + x2] = lct[b]; - image->indexes[y2 * image->width + x2] = b + lct_start; + image->pixels[y2 * image->width + x2] = lct[new_b]; + image->indexes[y2 * image->width + x2] = new_b + lct_start; } ++x; if (x >= img_width) { @@ -310,9 +309,7 @@ error: } static void -init_decoder(gif, bit_width) -struct Bitstream *gif; -unsigned bit_width; +init_decoder(struct Bitstream *gif, unsigned bit_width) { unsigned i; unsigned clear; @@ -335,8 +332,7 @@ unsigned bit_width; } static void -reset_decoder(gif) -struct Bitstream *gif; +reset_decoder(struct Bitstream *gif) { /* Set the bit width */ gif->bit_width = gif->initial_bit_width + 1; @@ -349,9 +345,7 @@ struct Bitstream *gif; } static int -decode(gif, block) -struct Bitstream *gif; -struct DataBlock *block; +decode(struct Bitstream *gif, struct DataBlock *block) { int code; unsigned clear = 1 << gif->initial_bit_width; @@ -364,12 +358,12 @@ struct DataBlock *block; /* Get the next code, until code other than clear */ while (TRUE) { code = get_code(gif, block); - if (code != clear) break; + if ((unsigned) code != clear) break; reset_decoder(gif); } if (code == EOF) return EOF; - if (code == clear + 1) return END_OF_DATA; + if ((unsigned) code == clear + 1) return END_OF_DATA; if (code > gif->dict_size) return EOF; /* Add a new string to the dictionary */ @@ -396,7 +390,7 @@ struct DataBlock *block; /* code is less than gif->dict_size and not equal to clear or clear + 1 */ /* Prepare the decoded string for return; note that it is stored in * reverse order */ - while (code >= clear) { + while ((unsigned) code >= clear) { gif->string[gif->str_size++] = gif->dictionary[code].byte; code = gif->dictionary[code].next; } @@ -405,9 +399,7 @@ struct DataBlock *block; } static int -get_code(gif, block) -struct Bitstream *gif; -struct DataBlock *block; +get_code(struct Bitstream *gif, struct DataBlock *block) { int code; @@ -426,9 +418,7 @@ struct DataBlock *block; } static unsigned -interlace_incr(y, height) -unsigned y; -unsigned height; +interlace_incr(unsigned y, unsigned height) { static const unsigned char incr[] = { 8, 2, 4, 2 }; @@ -457,17 +447,14 @@ unsigned height; /* Decode an unsigned 16 bit quantity */ static unsigned short -read_u16(buf) -const unsigned char buf[2]; +read_u16(const unsigned char buf[2]) { return ((unsigned short)buf[0] << 0) | ((unsigned short)buf[1] << 8); } static boolean -read_data_block(gif, block) -struct Bitstream *gif; -struct DataBlock *block; +read_data_block(struct Bitstream *gif, struct DataBlock *block) { long pos = ftell(gif->fp); int b; @@ -494,7 +481,8 @@ struct DataBlock *block; b = fgetc(gif->fp); if (b == EOF) return FALSE; if (b == 0) break; - if (fread(block->data + i, 1, b, gif->fp) != b) return FALSE; + if (fread(block->data + i, 1, b, gif->fp) != (unsigned) b) + return FALSE; i += b; } @@ -503,8 +491,7 @@ struct DataBlock *block; } static void -free_data_block(block) -struct DataBlock *block; +free_data_block(struct DataBlock *block) { free(block->data); block->size = 0; diff --git a/win/share/ppmwrite.c b/win/share/ppmwrite.c index b379ece22..8cd7a09cc 100644 --- a/win/share/ppmwrite.c +++ b/win/share/ppmwrite.c @@ -7,7 +7,7 @@ #include "tile.h" #ifndef MONITOR_HEAP -extern long *FDECL(alloc, (unsigned int)); +extern long *alloc(unsigned int); #endif FILE *ppm_file; @@ -20,18 +20,18 @@ struct ppmscreen { static int tiles_across, tiles_down, curr_tiles_across; static pixel **image; -static void NDECL(write_header); -static void NDECL(WriteTileStrip); +static void write_header(void); +static void WriteTileStrip(void); static void -write_header() +write_header(void) { (void) fprintf(ppm_file, "P6 %03d %03d 255\n", PpmScreen.Width, PpmScreen.Height); } static void -WriteTileStrip() +WriteTileStrip(void) { int i, j; @@ -45,9 +45,7 @@ WriteTileStrip() } boolean -fopen_ppm_file(filename, type) -const char *filename; -const char *type; +fopen_ppm_file(const char *filename, const char *type) { int i; @@ -84,8 +82,7 @@ const char *type; } boolean -write_ppm_tile(pixels) -pixel (*pixels)[TILE_X]; +write_ppm_tile(pixel (*pixels)[TILE_X]) { int i, j; @@ -104,7 +101,7 @@ pixel (*pixels)[TILE_X]; } int -fclose_ppm_file() +fclose_ppm_file(void) { int i, j; @@ -139,9 +136,7 @@ fclose_ppm_file() } int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { pixel pixels[TILE_Y][TILE_X]; diff --git a/win/share/safeproc.c b/win/share/safeproc.c index dab573848..dacf59d8a 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -101,8 +101,7 @@ struct window_procs safe_procs = { }; struct window_procs * -get_safe_procs(optn) -int optn; +get_safe_procs(int optn) { if (optn) { /* include the slightly more functional stdc versions */ @@ -118,126 +117,104 @@ int optn; /*ARGSUSED*/ void -safe_init_nhwindows(argcp, argv) -int *argcp UNUSED; -char **argv UNUSED; +safe_init_nhwindows(int *argcp UNUSED, char **argv UNUSED) { return; } void -safe_player_selection() +safe_player_selection(void) { return; } void -safe_askname() +safe_askname(void) { return; } void -safe_get_nh_event() +safe_get_nh_event(void) { return; } void -safe_suspend_nhwindows(str) -const char *str; +safe_suspend_nhwindows(const char *str) { return; } void -safe_resume_nhwindows() +safe_resume_nhwindows(void) { return; } void -safe_exit_nhwindows(str) -const char *str; +safe_exit_nhwindows(const char *str) { return; } winid -safe_create_nhwindow(type) -int type; +safe_create_nhwindow(int type) { return WIN_ERR; } void -safe_clear_nhwindow(window) -winid window; +safe_clear_nhwindow(winid window) { return; } /*ARGSUSED*/ void -safe_display_nhwindow(window, blocking) -winid window; -boolean blocking; +safe_display_nhwindow(winid window,boolean blocking) { return; } void -safe_dismiss_nhwindow(window) -winid window; +safe_dismiss_nhwindow(winid window) { return; } void -safe_destroy_nhwindow(window) -winid window; +safe_destroy_nhwindow(winid window) { return; } void -safe_curs(window, x, y) -winid window; -int x, y; +safe_curs(winid window, int x, int y) { return; } void -safe_putstr(window, attr, str) -winid window; -int attr; -const char *str; +safe_putstr(winid window, int attr, const char *str) { return; } void -safe_putmixed(window, attr, str) -winid window; -int attr; -const char *str; +safe_putmixed(winid window, int attr, const char *str) { return; } void -safe_display_file(fname, complain) -const char *fname; -boolean complain; +safe_display_file(const char * fname, boolean complain) { return; } void -safe_start_menu(window, mbehavior) -winid window; -unsigned long mbehavior; +safe_start_menu(winid window, unsigned long mbehavior) { return; } @@ -248,15 +225,15 @@ unsigned long mbehavior; * later. */ void -safe_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags) -winid window; /* window to use, must be of type NHW_MENU */ -const glyph_info *glyphinfo UNUSED; /* glyph plus glyph info */ -const anything *identifier; /* what to return if selected */ -char ch; /* keyboard accelerator (0 = pick our own) */ -char gch; /* group accelerator (0 = no group) */ -int attr; /* attribute for string (like safe_putstr()) */ -const char *str; /* menu string */ -unsigned int itemflags; /* itemflags such as marked as selected */ +safe_add_menu( + winid window, /* window to use, must be of type NHW_MENU */ + const glyph_info *glyphinfo UNUSED, /* glyph plus glyph info */ + const anything *identifier, /* what to return if selected */ + char ch, /* keyboard accelerator (0 = pick our own) */ + char gch, /* group accelerator (0 = no group) */ + int attr, /* attribute for string (like safe_putstr()) */ + const char *str, /* menu string */ + unsigned int itemflags) /* itemflags such as marked as selected */ { return; } @@ -265,52 +242,51 @@ unsigned int itemflags; /* itemflags such as marked as selected */ * End a menu in this window, window must a type NHW_MENU. */ void -safe_end_menu(window, prompt) -winid window; /* menu to use */ -const char *prompt; /* prompt to for menu */ +safe_end_menu( + winid window, /* menu to use */ + const char *prompt) /* prompt to for menu */ { return; } int -safe_select_menu(window, how, menu_list) -winid window; -int how; -menu_item **menu_list; +safe_select_menu( + winid window, + int how, + menu_item **menu_list) { return 0; } /* special hack for treating top line --More-- as a one item menu */ char -safe_message_menu(let, how, mesg) -char let; -int how; -const char *mesg; +safe_message_menu( + char let, + int how, + const char *mesg) { return '\033'; } void -safe_update_inventory() +safe_update_inventory(void) { return; } void -safe_mark_synch() +safe_mark_synch(void) { } void -safe_wait_synch() +safe_wait_synch(void) { } #ifdef CLIPPING void -safe_cliparound(x, y) -int x, y; +safe_cliparound(int x, int y) { } #endif /* CLIPPING */ @@ -321,31 +297,30 @@ int x, y; * Print the glyph to the output device. Don't flush the output device. */ void -safe_print_glyph(window, x, y, glyphinfo, bkglyphinfo) -winid window UNUSED; -xchar x UNUSED, y UNUSED; -const glyph_info *glyphinfo UNUSED; -const glyph_info *bkglyphinfo UNUSED; +safe_print_glyph( + winid window UNUSED, + xchar x UNUSED, + xchar y UNUSED, + const glyph_info *glyphinfo UNUSED, + const glyph_info *bkglyphinfo UNUSED) { return; } void -safe_raw_print(str) -const char *str; +safe_raw_print(const char *str) { return; } void -safe_raw_print_bold(str) -const char *str; +safe_raw_print_bold(const char *str) { return; } int -safe_nhgetch() +safe_nhgetch(void) { return '\033'; } @@ -357,23 +332,20 @@ safe_nhgetch() */ /*ARGSUSED*/ int -safe_nh_poskey(x, y, mod) -int *x, *y, *mod; +safe_nh_poskey(int *x, int *y, int *mod) { return '\033'; } void -win_safe_init(dir) -int dir; +win_safe_init(int dir) { return; } #ifdef POSITIONBAR void -safe_update_positionbar(posbar) -char *posbar; +safe_update_positionbar(char *posbar) { return; } @@ -384,130 +356,121 @@ char *posbar; * -- initialize the port-specific data structures. */ void -safe_status_init() +safe_status_init(void) { return; } boolean -safe_can_suspend() +safe_can_suspend(void) { return FALSE; } void -safe_nhbell() +safe_nhbell(void) { return; } int -safe_doprev_message() +safe_doprev_message(void) { return 0; } char -safe_yn_function(query, resp, def) -const char *query; -const char *resp; -char def; +safe_yn_function(const char * query, const char* resp, char def) { return '\033'; } /*ARGSUSED*/ void -safe_getlin(prompt, outbuf) -const char *prompt UNUSED; -char *outbuf; +safe_getlin(const char* prompt UNUSED, char *outbuf) { Strcpy(outbuf, "\033"); } int -safe_get_ext_cmd() +safe_get_ext_cmd(void) { return '\033'; } void -safe_number_pad(mode) -int mode; +safe_number_pad(int mode) { return; } void -safe_delay_output() +safe_delay_output(void) { return; } void -safe_start_screen() +safe_start_screen(void) { return; } void -safe_end_screen() +safe_end_screen(void) { return; } void -safe_outrip(tmpwin, how, when) -winid tmpwin; -int how; -time_t when; +safe_outrip(winid tmpwin, int how, time_t when) { return; } /*ARGSUSED*/ void -safe_preference_update(pref) -const char *pref UNUSED; +safe_preference_update(const char* pref UNUSED) { return; } char * -safe_getmsghistory(init) -boolean init UNUSED; +safe_getmsghistory(boolean init UNUSED) { return (char *) 0; } void -safe_putmsghistory(msg, is_restoring) -const char *msg; -boolean is_restoring; +safe_putmsghistory( + const char *msg, + boolean is_restoring) { } void -safe_status_finish() +safe_status_finish(void) { } void -safe_status_enablefield(fieldidx, nm, fmt, enable) -int fieldidx; -const char *nm; -const char *fmt; -boolean enable; +safe_status_enablefield( + int fieldidx, + const char *nm, + const char *fmt, + boolean enable) { } /* call once for each field, then call with BL_FLUSH to output the result */ void -safe_status_update(idx, ptr, chg, percent, color, colormasks) -int idx; -genericptr_t ptr; -int chg UNUSED, percent UNUSED, color UNUSED; -unsigned long *colormasks UNUSED; +safe_status_update( + int idx, + genericptr_t ptr, + int chg UNUSED, + int percent UNUSED, + int color UNUSED, + unsigned long *colormasks UNUSED) { } @@ -528,7 +491,7 @@ unsigned long *colormasks UNUSED; /* Add to your code: windowprocs.win_raw_print = stdio_wait_synch; */ void -stdio_wait_synch() +stdio_wait_synch(void) { char valid[] = {' ', '\n', '\r', '\033', '\0'}; @@ -540,8 +503,7 @@ stdio_wait_synch() /* Add to your code: windowprocs.win_raw_print = stdio_raw_print; */ void -stdio_raw_print(str) -const char *str; +stdio_raw_print(const char* str) { if (str) fprintf(stdout, "%s\n", str); @@ -551,8 +513,7 @@ const char *str; /* no newline variation, add to your code: windowprocs.win_raw_print = stdio_nonl_raw_print; */ void -stdio_nonl_raw_print(str) -const char *str; +stdio_nonl_raw_print(const char* str) { if (str) fprintf(stdout, "%s", str); @@ -561,8 +522,7 @@ const char *str; /* Add to your code: windowprocs.win_raw_print_bold = stdio_raw_print_bold; */ void -stdio_raw_print_bold(str) -const char *str; +stdio_raw_print_bold(const char* str) { stdio_raw_print(str); return; @@ -570,7 +530,7 @@ const char *str; /* Add to your code: windowprocs.win_nhgetch = stdio_nhgetch; */ int -stdio_nhgetch() +stdio_nhgetch(void) { return getchar(); } diff --git a/win/share/tile.h b/win/share/tile.h index 79e7e8a2e..54d1e2a6d 100644 --- a/win/share/tile.h +++ b/win/share/tile.h @@ -33,18 +33,18 @@ extern int colorsinmainmap; #define Fprintf (void) fprintf -extern boolean FDECL(fopen_text_file, (const char *, const char *)); -extern boolean FDECL(read_text_tile, (pixel(*) [TILE_X])); -extern boolean FDECL(write_text_tile, (pixel(*) [TILE_X])); -extern int NDECL(fclose_text_file); +extern boolean fopen_text_file(const char *, const char *); +extern boolean read_text_tile(pixel(*) [TILE_X]); +extern boolean write_text_tile(pixel(*) [TILE_X]); +extern int fclose_text_file(void); -extern void FDECL(set_grayscale, (int)); -extern void NDECL(init_colormap); -extern void NDECL(merge_colormap); +extern void set_grayscale(int); +extern void init_colormap(void); +extern void merge_colormap(void); #if defined(MICRO) || defined(WIN32) #undef exit #if !defined(MSDOS) && !defined(WIN32) -extern void FDECL(exit, (int)); +extern void exit(int); #endif #endif diff --git a/win/share/tile2bmp.c b/win/share/tile2bmp.c index 3e66b6e5a..e29d8f7a7 100644 --- a/win/share/tile2bmp.c +++ b/win/share/tile2bmp.c @@ -18,8 +18,8 @@ #include "config.h" #include "tile.h" -extern void NDECL(monst_globals_init); -extern void NDECL(objects_globals_init); +extern void monst_globals_init(void); +extern void objects_globals_init(void); #include #if defined(UINT32_MAX) && defined(INT32_MAX) && defined(UINT16_MAX) @@ -45,7 +45,7 @@ extern void NDECL(objects_globals_init); #define BITCOUNT 8 -extern char *FDECL(tilename, (int, int)); +extern char *tilename(int, int); #define MAGICTILENO (340 + 440 + 231 + 340) @@ -158,9 +158,9 @@ FILE *tibfile2; pixel tilepixels[TILE_Y][TILE_X]; -static void FDECL(build_bmfh, (BITMAPFILEHEADER *)); -static void FDECL(build_bmih, (BITMAPINFOHEADER *)); -static void FDECL(build_bmptile, (pixel(*) [TILE_X])); +static void build_bmfh(BITMAPFILEHEADER *); +static void build_bmih(BITMAPINFOHEADER *); +static void build_bmptile(pixel(*) [TILE_X]); const char *tilefiles[] = { #if (TILE_X == 32) @@ -184,9 +184,7 @@ char bmpname[128]; FILE *fp; int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { int i, j; @@ -271,8 +269,7 @@ char *argv[]; } static void -build_bmfh(pbmfh) -BITMAPFILEHEADER *pbmfh; +build_bmfh(BITMAPFILEHEADER* pbmfh) { pbmfh->bfType = leshort(0x4D42); pbmfh->bfSize = lelong(BMPFILESIZE); @@ -283,8 +280,7 @@ BITMAPFILEHEADER *pbmfh; } static void -build_bmih(pbmih) -BITMAPINFOHEADER *pbmih; +build_bmih(BITMAPINFOHEADER* pbmih) { WORD cClrBits; int w, h; @@ -335,8 +331,7 @@ BITMAPINFOHEADER *pbmih; } static void -build_bmptile(pixels) -pixel (*pixels)[TILE_X]; +build_bmptile(pixel(*pixels)[TILE_X]) { int cur_x, cur_y, cur_color, apply_color; int x, y; diff --git a/win/share/tilemap.c b/win/share/tilemap.c index 550a90288..604f92448 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -30,15 +30,15 @@ FILE *tilemap_file; #endif -const char *FDECL(tilename, (int, int, int)); -void NDECL(init_tilemap); -void FDECL(process_substitutions, (FILE *)); -boolean FDECL(acceptable_tilename, (int, int, const char *, const char *)); +const char *tilename(int, int, int); +void init_tilemap(void); +void process_substitutions(FILE *); +boolean acceptable_tilename(int, int, const char *, const char *); #if defined(MICRO) || defined(WIN32) #undef exit #if !defined(MSDOS) && !defined(WIN32) -extern void FDECL(exit, (int)); +extern void exit(int); #endif #endif @@ -113,8 +113,7 @@ struct substitute { * file_entry is the position of the tile within the monsters/objects/other set */ const char * -tilename(set, file_entry, gend) -int set, file_entry, gend; +tilename(int set, int file_entry, int gend) { int i, j, condnum, tilenum, gendnum; static char buf[BUFSZ]; @@ -296,7 +295,7 @@ int lastmontile, lastobjtile, lastothtile; * introduced in 3.3.1. */ void -init_tilemap() +init_tilemap(void) { int i, j, condnum, tilenum; int corpsetile, swallowbase; @@ -564,15 +563,14 @@ init_tilemap() #endif } -const char *prolog[] = { "", "void", "substitute_tiles(plev)", - "d_level *plev;", "{", " int i;", "" }; +const char *prolog[] = { "", "void", "substitute_tiles(d_level *plev)", + "{", " int i;", "" }; const char *epilog[] = { " return;", "}" }; /* write out the substitutions in an easily-used form. */ void -process_substitutions(ofp) -FILE *ofp; +process_substitutions(FILE *ofp) { static const char Dent[] = " "; /* 4 space indentation */ int i, j, k, span, start; @@ -642,12 +640,12 @@ FILE *ofp; } #ifdef OBTAIN_TILEMAP -extern void NDECL(monst_globals_init); -extern void NDECL(objects_globals_init); +extern void monst_globals_init(void); +extern void objects_globals_init(void); #endif int -main() +main(int argc UNUSED, char *argv[] UNUSED) { register int i; char filename[30]; @@ -802,9 +800,8 @@ struct { }; boolean -acceptable_tilename(glyph_set, idx, encountered, expected) -int glyph_set, idx; -const char *encountered, *expected; +acceptable_tilename(int glyph_set, int idx, const char *encountered, + const char *expected) { if (glyph_set == OTH_GLYPH) { if (idx >= 0 && idx < SIZE(altlabels)) { diff --git a/win/share/tileset.c b/win/share/tileset.c index 6006d1f44..ce32d6ffa 100644 --- a/win/share/tileset.c +++ b/win/share/tileset.c @@ -7,10 +7,10 @@ #include "flag.h" #include "tileset.h" -static void FDECL(get_tile_map, (const char *)); -static unsigned FDECL(gcd, (unsigned, unsigned)); -static void FDECL(split_tiles, (const struct TileSetImage *)); -static void FDECL(free_image, (struct TileSetImage *)); +static void get_tile_map(const char *); +static unsigned gcd(unsigned, unsigned); +static void split_tiles(const struct TileSetImage *); +static void free_image(struct TileSetImage *); static struct TileImage *tiles; static unsigned num_tiles; @@ -20,9 +20,7 @@ static boolean have_palette; static struct Pixel palette[256]; boolean -read_tiles(filename, true_color) -const char *filename; -boolean true_color; +read_tiles(const char *filename, boolean true_color) { static const unsigned char png_sig[] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A @@ -105,8 +103,7 @@ error: /* Free tile memory not required by the chosen display mode */ void -set_tile_type(true_color) -boolean true_color; +set_tile_type(boolean true_color) { unsigned i; @@ -127,21 +124,20 @@ boolean true_color; } const struct Pixel * -get_palette() +get_palette(void) { return have_palette ? palette : NULL; } /* TODO: derive tile_map from image_desc */ static void -get_tile_map(image_desc) -const char *image_desc; +get_tile_map(const char *image_desc UNUSED) { return; } void -free_tiles() +free_tiles(void) { unsigned i; @@ -161,8 +157,7 @@ free_tiles() } static void -free_image(image) -struct TileSetImage *image; +free_image(struct TileSetImage *image) { if (image->pixels) free((genericptr_t) image->pixels), image->pixels = NULL; @@ -173,8 +168,7 @@ struct TileSetImage *image; } const struct TileImage * -get_tile(tile_index) -unsigned tile_index; +get_tile(unsigned tile_index) { if (tile_index >= num_tiles) return &blank_tile; @@ -183,9 +177,8 @@ unsigned tile_index; /* Note that any tile returned by this function must be freed */ struct TileImage * -stretch_tile(inp_tile, out_width, out_height) -const struct TileImage *inp_tile; -unsigned out_width, out_height; +stretch_tile(const struct TileImage *inp_tile, + unsigned out_width, unsigned out_height) { unsigned x_scale_inp, x_scale_out, y_scale_inp, y_scale_out; unsigned divisor; @@ -264,8 +257,7 @@ unsigned out_width, out_height; /* Free a tile returned by stretch_tile */ /* Do NOT use this with tiles returned by get_tile */ void -free_tile(tile) -struct TileImage *tile; +free_tile(struct TileImage *tile) { if (tile != NULL) { free(tile->indexes); @@ -276,8 +268,7 @@ struct TileImage *tile; /* Return the greatest common divisor */ static unsigned -gcd(a, b) -unsigned a, b; +gcd(unsigned a, unsigned b) { while (TRUE) { if (b == 0) return a; @@ -288,8 +279,7 @@ unsigned a, b; } static void -split_tiles(image) -const struct TileSetImage *image; +split_tiles(const struct TileSetImage *image) { unsigned tile_rows, tile_cols; size_t tile_size, i, j; @@ -317,8 +307,8 @@ const struct TileSetImage *image; if (image->indexes != NULL) { tile->indexes = (unsigned char *) alloc(tile_size); } - for (y2 = 0; y2 < iflags.wc_tile_height; ++y2) { - for (x2 = 0; x2 < iflags.wc_tile_width; ++x2) { + for (y2 = 0; y2 < (unsigned) iflags.wc_tile_height; ++y2) { + for (x2 = 0; x2 < (unsigned) iflags.wc_tile_width; ++x2) { unsigned x = x1 * iflags.wc_tile_width + x2; unsigned y = y1 * iflags.wc_tile_height + y2; @@ -351,9 +341,7 @@ const struct TileSetImage *image; } boolean -read_png_tiles(filename, image) -const char *filename; -struct TileSetImage *image; +read_png_tiles(const char *filename UNUSED, struct TileSetImage *image UNUSED) { /* stub */ return FALSE; diff --git a/win/share/tiletext.c b/win/share/tiletext.c index c07c96431..7df71ce31 100644 --- a/win/share/tiletext.c +++ b/win/share/tiletext.c @@ -26,12 +26,12 @@ static const char *text_sets[] = { "monsters.txt", "objects.txt", "other.txt" }; #endif -extern const char *FDECL(tilename, (int, int, int)); -extern boolean FDECL(acceptable_tilename, (int, int, const char *, const char *)); -static void FDECL(read_text_colormap, (FILE *)); -static boolean FDECL(write_text_colormap, (FILE *)); -static boolean FDECL(read_txttile, (FILE *, pixel (*)[TILE_X])); -static void FDECL(write_txttile, (FILE *, pixel (*)[TILE_X])); +extern const char *tilename(int, int, int); +extern boolean acceptable_tilename(int, int, const char *, const char *); +static void read_text_colormap(FILE *); +static boolean write_text_colormap(FILE *); +static boolean read_txttile(FILE *, pixel (*)[TILE_X]); +static void write_txttile(FILE *, pixel (*)[TILE_X]); enum { MONSTER_SET, OBJECT_SET, OTHER_SET}; @@ -50,15 +50,13 @@ static const int graymappings[] = { }; void -set_grayscale(g) -int g; +set_grayscale(int g) { grayscale = g; } static void -read_text_colormap(txtfile) -FILE *txtfile; +read_text_colormap(FILE *txtfile) { int i, r, g, b; char c[2]; @@ -80,8 +78,7 @@ FILE *txtfile; #undef FORMAT_STRING static boolean -write_text_colormap(txtfile) -FILE *txtfile; +write_text_colormap(FILE *txtfile) { int i; char c; @@ -108,9 +105,7 @@ FILE *txtfile; } static boolean -read_txttile(txtfile, pixels) -FILE *txtfile; -pixel (*pixels)[TILE_X]; +read_txttile(FILE *txtfile, pixel (*pixels)[TILE_X]) { int ph, i, j, k, reslt; char buf[BUFSZ], ttype[BUFSZ], gend[BUFSZ]; @@ -202,9 +197,7 @@ pixel (*pixels)[TILE_X]; } static void -write_txttile(txtfile, pixels) -FILE *txtfile; -pixel (*pixels)[TILE_X]; +write_txttile(FILE *txtfile, pixel (*pixels)[TILE_X]) { const char *p; const char *type; @@ -252,7 +245,7 @@ pixel (*pixels)[TILE_X]; /* initialize main colormap from globally accessed ColorMap */ void -init_colormap() +init_colormap(void) { int i; @@ -266,7 +259,7 @@ init_colormap() /* merge new colors from ColorMap into MainColorMap */ void -merge_colormap() +merge_colormap(void) { int i, j; @@ -292,9 +285,7 @@ merge_colormap() } boolean -fopen_text_file(filename, type) -const char *filename; -const char *type; +fopen_text_file(const char *filename, const char *type) { const char *p; int i; @@ -350,22 +341,20 @@ const char *type; } boolean -read_text_tile(pixels) -pixel (*pixels)[TILE_X]; +read_text_tile(pixel (*pixels)[TILE_X]) { return (read_txttile(tile_file, pixels)); } boolean -write_text_tile(pixels) -pixel (*pixels)[TILE_X]; +write_text_tile(pixel (*pixels)[TILE_X]) { write_txttile(tile_file, pixels); return TRUE; } int -fclose_text_file() +fclose_text_file(void) { int ret; diff --git a/win/shim/winshim.c b/win/shim/winshim.c index adf91f509..b3d5b348f 100644 --- a/win/shim/winshim.c +++ b/win/shim/winshim.c @@ -111,32 +111,32 @@ VDECLCB(shim_suspend_nhwindows,(const char *str), "vs", P2V str) VDECLCB(shim_resume_nhwindows,(void), "v") DECLCB(winid, shim_create_nhwindow, (int type), "ii", A2P type) VDECLCB(shim_clear_nhwindow,(winid window), "vi", A2P window) -VDECLCB(shim_display_nhwindow,(winid window, BOOLEAN_P blocking), "vii", A2P window, A2P blocking) +VDECLCB(shim_display_nhwindow,(winid window, boolean blocking), "vii", A2P window, A2P blocking) VDECLCB(shim_destroy_nhwindow,(winid window), "vi", A2P window) VDECLCB(shim_curs,(winid a, int x, int y), "viii", A2P a, A2P x, A2P y) VDECLCB(shim_putstr,(winid w, int attr, const char *str), "viis", A2P w, A2P attr, P2V str) -VDECLCB(shim_display_file,(const char *name, BOOLEAN_P complain), "vsi", P2V name, A2P complain) +VDECLCB(shim_display_file,(const char *name, boolean complain), "vsi", P2V name, A2P complain) VDECLCB(shim_start_menu,(winid window, unsigned long mbehavior), "vii", A2P window, A2P mbehavior) VDECLCB(shim_add_menu, - (winid window, const glyph_info *glyphinfo, const ANY_P *identifier, CHAR_P ch, CHAR_P gch, int attr, const char *str, unsigned int itemflags), + (winid window, const glyph_info *glyphinfo, const ANY_P *identifier, char ch, char gch, int attr, const char *str, unsigned int itemflags), "viipiiisi", - A2P window, P2VP glyphinfo, P2V identifier, A2P ch, A2P gch, A2P attr, P2V str, A2P itemflags) + A2P window, P2V glyphinfo, P2V identifier, A2P ch, A2P gch, A2P attr, P2V str, A2P itemflags) VDECLCB(shim_end_menu,(winid window, const char *prompt), "vis", A2P window, P2V prompt) /* XXX: shim_select_menu menu_list is an output */ DECLCB(int, shim_select_menu,(winid window, int how, MENU_ITEM_P **menu_list), "iiio", A2P window, A2P how, P2V menu_list) -DECLCB(char, shim_message_menu,(CHAR_P let, int how, const char *mesg), "ciis", A2P let, A2P how, P2V mesg) +DECLCB(char, shim_message_menu,(char let, int how, const char *mesg), "ciis", A2P let, A2P how, P2V mesg) VDECLCB(shim_mark_synch,(void), "v") VDECLCB(shim_wait_synch,(void), "v") VDECLCB(shim_cliparound,(int x, int y), "vii", A2P x, A2P y) VDECLCB(shim_update_positionbar,(char *posbar), "vp", P2V posbar) -VDECLCB(shim_print_glyph,(winid w, int x, int y, const glyph_info *glyph, const glyph_info *bkglyph), "viiiii", A2P w, A2P x, A2P y, V2P glyphinfo, V2P bkglyphinfo) +VDECLCB(shim_print_glyph,(winid w, int x, int y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo), "viiiii", A2P w, A2P x, A2P y, P2V glyphinfo, P2V bkglyphinfo) VDECLCB(shim_raw_print,(const char *str), "vs", P2V str) VDECLCB(shim_raw_print_bold,(const char *str), "vs", P2V str) DECLCB(int, shim_nhgetch,(void), "i") DECLCB(int, shim_nh_poskey,(int *x, int *y, int *mod), "iooo", P2V x, P2V y, P2V mod) VDECLCB(shim_nhbell,(void), "v") DECLCB(int, shim_doprev_message,(void),"iv") -DECLCB(char, shim_yn_function,(const char *query, const char *resp, CHAR_P def), "cssi", P2V query, P2V resp, A2P def) +DECLCB(char, shim_yn_function,(const char *query, const char *resp, char def), "cssi", P2V query, P2V resp, A2P def) VDECLCB(shim_getlin,(const char *query, char *bufp), "vso", P2V query, P2V bufp) DECLCB(int,shim_get_ext_cmd,(void),"iv") VDECLCB(shim_number_pad,(int state), "vi", A2P state) @@ -150,11 +150,11 @@ DECLCB(char *,shim_get_color_string,(void),"sv") VDECLCB(shim_start_screen, (void), "v") VDECLCB(shim_end_screen, (void), "v") VDECLCB(shim_preference_update, (const char *pref), "vp", P2V pref) -DECLCB(char *,shim_getmsghistory, (BOOLEAN_P init), "si", A2P init) -VDECLCB(shim_putmsghistory, (const char *msg, BOOLEAN_P restoring_msghist), "vsi", P2V msg, A2P restoring_msghist) +DECLCB(char *,shim_getmsghistory, (boolean init), "si", A2P init) +VDECLCB(shim_putmsghistory, (const char *msg, boolean restoring_msghist), "vsi", P2V msg, A2P restoring_msghist) VDECLCB(shim_status_init, (void), "v") VDECLCB(shim_status_enablefield, - (int fieldidx, const char *nm, const char *fmt, BOOLEAN_P enable), + (int fieldidx, const char *nm, const char *fmt, boolean enable), "vippi", A2P fieldidx, P2V nm, P2V fmt, A2P enable) /* XXX: the second argument to shim_status_update is sometimes an integer and sometimes a pointer */ diff --git a/win/tty/getline.c b/win/tty/getline.c index 8925f6b4a..850372d9a 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -16,13 +16,12 @@ char morc = 0; /* tell the outside world what char you chose */ static boolean suppress_history; -static boolean FDECL(ext_cmd_getlin_hook, (char *)); +static boolean ext_cmd_getlin_hook(char *); -typedef boolean FDECL((*getlin_hook_proc), (char *)); +typedef boolean (*getlin_hook_proc)(char *); -static void FDECL(hooked_tty_getlin, - (const char *, char *, getlin_hook_proc)); -extern int NDECL(extcmd_via_menu); /* cmd.c */ +static void hooked_tty_getlin(const char *, char *, getlin_hook_proc); +extern int extcmd_via_menu(void); /* cmd.c */ extern char erase_char, kill_char; /* from appropriate tty.c file */ @@ -33,19 +32,14 @@ extern char erase_char, kill_char; /* from appropriate tty.c file */ * resulting string is "\033". */ void -tty_getlin(query, bufp) -const char *query; -register char *bufp; +tty_getlin(const char *query, register char *bufp) { suppress_history = FALSE; hooked_tty_getlin(query, bufp, (getlin_hook_proc) 0); } static void -hooked_tty_getlin(query, bufp, hook) -const char *query; -register char *bufp; -getlin_hook_proc hook; +hooked_tty_getlin(const char *query, register char *bufp, getlin_hook_proc hook) { register char *obufp = bufp; register int c; @@ -210,8 +204,7 @@ getlin_hook_proc hook; } void -xwaitforspace(s) -register const char *s; /* chars allowed besides return */ +xwaitforspace(register const char *s) /* chars allowed besides return */ { register int c, x = ttyDisplay ? (int) ttyDisplay->dismiss_more : '\n'; @@ -253,8 +246,7 @@ register const char *s; /* chars allowed besides return */ * + base has enough room to hold our string */ static boolean -ext_cmd_getlin_hook(base) -char *base; +ext_cmd_getlin_hook(char *base) { int oindex, com_index; @@ -284,7 +276,7 @@ char *base; * stop when we have found enough characters to make a unique command. */ int -tty_get_ext_cmd() +tty_get_ext_cmd(void) { int i; char buf[BUFSZ]; diff --git a/win/tty/termcap.c b/win/tty/termcap.c index d8b0e8f1d..6429a04f7 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -12,19 +12,19 @@ #define Tgetstr(key) (tgetstr(key, &tbufptr)) -static char *FDECL(s_atr2str, (int)); -static char *FDECL(e_atr2str, (int)); +static char *s_atr2str(int); +static char *e_atr2str(int); -void FDECL(cmov, (int, int)); -void FDECL(nocmov, (int, int)); +void cmov(int, int); +void nocmov(int, int); #if defined(TEXTCOLOR) && defined(TERMLIB) #if (!defined(UNIX) || !defined(TERMINFO)) && !defined(TOS) -static void FDECL(analyze_seq, (char *, int *, int *)); +static void analyze_seq(char *, int *, int *); #endif #endif #if defined(TEXTCOLOR) && (defined(TERMLIB) || defined(ANSI_DEFAULT)) -static void NDECL(init_hilite); -static void NDECL(kill_hilite); +static void init_hilite(void); +static void kill_hilite(void); #endif /* (see tcap.h) -- nh_CM, nh_ND, nh_CD, nh_HI,nh_HE, nh_US,nh_UE, ul_hack */ @@ -66,8 +66,7 @@ static char tgotobuf[20]; #endif /* TERMLIB */ void -tty_startup(wid, hgt) -int *wid, *hgt; +tty_startup(int *wid, int *hgt) { #ifdef TERMLIB register const char *term; @@ -310,7 +309,7 @@ int *wid, *hgt; */ /* deallocate resources prior to final termination */ void -tty_shutdown() +tty_shutdown(void) { /* we only attempt to clean up a few individual termcap variables */ #if defined(TEXTCOLOR) && (defined(TERMLIB) || defined(ANSI_DEFAULT)) @@ -327,8 +326,7 @@ tty_shutdown() } void -tty_number_pad(state) -int state; +tty_number_pad(int state) { switch (state) { case -1: /* activate keypad mode (escape sequences) */ @@ -346,8 +344,8 @@ int state; } #ifdef TERMLIB -extern void NDECL((*decgraphics_mode_callback)); /* defined in symbols.c */ -static void NDECL(tty_decgraphics_termcap_fixup); +extern void (*decgraphics_mode_callback)(void); /* defined in symbols.c */ +static void tty_decgraphics_termcap_fixup(void); /* We call this routine whenever DECgraphics mode is enabled, even if it @@ -357,7 +355,7 @@ static void NDECL(tty_decgraphics_termcap_fixup); so this is a convenient hook. */ static void -tty_decgraphics_termcap_fixup() +tty_decgraphics_termcap_fixup(void) { static char ctrlN[] = "\016"; static char ctrlO[] = "\017"; @@ -419,15 +417,15 @@ tty_decgraphics_termcap_fixup() #endif /* TERMLIB */ #if defined(ASCIIGRAPH) && defined(PC9800) -extern void NDECL((*ibmgraphics_mode_callback)); /* defined in drawing.c */ +extern void (*ibmgraphics_mode_callback)(void); /* defined in drawing.c */ #endif #ifdef PC9800 -extern void NDECL((*ascgraphics_mode_callback)); /* defined in drawing.c */ -static void NDECL(tty_ascgraphics_hilite_fixup); +extern void (*ascgraphics_mode_callback)(void); /* defined in drawing.c */ +static void tty_ascgraphics_hilite_fixup(void); static void -tty_ascgraphics_hilite_fixup() +tty_ascgraphics_hilite_fixup(void) { register int c; @@ -444,7 +442,7 @@ tty_ascgraphics_hilite_fixup() #endif /* PC9800 */ void -tty_start_screen() +tty_start_screen(void) { xputs(TI); xputs(VS); @@ -472,7 +470,7 @@ tty_start_screen() } void -tty_end_screen() +tty_end_screen(void) { clear_screen(); xputs(VE); @@ -488,8 +486,7 @@ tty_end_screen() then action must be taken in trampoli.[ch]. */ void -nocmov(x, y) -int x, y; +nocmov(int x, int y) { if ((int) ttyDisplay->cury > y) { if (UP) { @@ -538,8 +535,7 @@ int x, y; } void -cmov(x, y) -register int x, y; +cmov(register int x, register int y) { xputs(tgoto(nh_CM, x, y)); ttyDisplay->cury = y; @@ -548,8 +544,7 @@ register int x, y; /* See note above. xputc() is a special function for overlays. */ int -xputc(c) -int c; /* actually char, but explicitly specify its widened type */ +xputc(int c) /* actually char, but explicitly specify its widened type */ { /* * Note: xputc() as a direct all to putchar() doesn't make any @@ -570,8 +565,7 @@ int c; /* actually char, but explicitly specify its widened type */ } void -xputs(s) -const char *s; +xputs(const char *s) { #ifndef TERMLIB (void) fputs(s, stdout); @@ -581,7 +575,7 @@ const char *s; } void -cl_end() +cl_end(void) { if (CE) { xputs(CE); @@ -600,7 +594,7 @@ cl_end() } void -clear_screen() +clear_screen(void) { /* note: if CL is null, then termcap initialization failed, so don't attempt screen-oriented I/O during final cleanup. @@ -612,7 +606,7 @@ clear_screen() } void -home() +home(void) { if (HO) xputs(HO); @@ -624,14 +618,14 @@ home() } void -standoutbeg() +standoutbeg(void) { if (SO) xputs(SO); } void -standoutend() +standoutend(void) { if (SE) xputs(SE); @@ -639,28 +633,28 @@ standoutend() #if 0 /* if you need one of these, uncomment it (here and in extern.h) */ void -revbeg() +revbeg(void) { if (MR) xputs(MR); } void -boldbeg() +boldbeg(void) { if (MD) xputs(MD); } void -blinkbeg() +blinkbeg(void) { if (MB) xputs(MB); } void -dimbeg() +dimbeg(void) { /* not in most termcap entries */ if (MH) @@ -668,7 +662,7 @@ dimbeg() } void -m_end() +m_end(void) { if (ME) xputs(ME); @@ -676,13 +670,13 @@ m_end() #endif /*0*/ void -backsp() +backsp(void) { xputs(BC); } void -tty_nhbell() +tty_nhbell(void) { if (flags.silent) return; @@ -692,14 +686,14 @@ tty_nhbell() #ifdef ASCIIGRAPH void -graph_on() +graph_on(void) { if (AS) xputs(AS); } void -graph_off() +graph_off(void) { if (AE) xputs(AE); @@ -722,7 +716,7 @@ static const short tmspc10[] = { /* from termcap */ /* delay 50 ms */ void -tty_delay_output() +tty_delay_output(void) { #if defined(MICRO) register int i; @@ -770,7 +764,7 @@ tty_delay_output() /* must only be called with curx = 1 */ void -cl_eos() /* free after Robert Viduya */ +cl_eos(void) /* free after Robert Viduya */ { if (nh_CD) { xputs(nh_CD); @@ -866,7 +860,7 @@ const struct { static char nilstring[] = ""; static void -init_hilite() +init_hilite(void) { register int c; char *setf, *scratch; @@ -941,7 +935,7 @@ init_hilite() } static void -kill_hilite() +kill_hilite(void) { /* if colors weren't available, no freeing needed */ if (hilites[CLR_BLACK] == nh_HI) @@ -988,9 +982,7 @@ kill_hilite() #ifndef TOS /* find the foreground and background colors set by nh_HI or nh_HE */ static void -analyze_seq(str, fg, bg) -char *str; -int *fg, *bg; +analyze_seq(char *str, int *fg, int *bg) { register int c, code; int len; @@ -1051,7 +1043,7 @@ int *fg, *bg; */ static void -init_hilite() +init_hilite(void) { register int c; #ifdef TOS @@ -1133,7 +1125,7 @@ init_hilite() } static void -kill_hilite() +kill_hilite(void) { #ifndef TOS register int c; @@ -1156,7 +1148,7 @@ kill_hilite() static char adef_nilstring[] = ""; static void -init_hilite() +init_hilite(void) { register int c; @@ -1190,7 +1182,7 @@ init_hilite() } static void -kill_hilite() +kill_hilite(void) { register int c; @@ -1215,8 +1207,7 @@ kill_hilite() static char nulstr[] = ""; static char * -s_atr2str(n) -int n; +s_atr2str(int n) { switch (n) { case ATR_BLINK: @@ -1248,8 +1239,7 @@ int n; } static char * -e_atr2str(n) -int n; +e_atr2str(int n) { switch (n) { case ATR_ULINE: @@ -1273,8 +1263,7 @@ int n; /* suppress nonfunctional highlights so render_status() might be able to optimize more; keep this in sync with s_atr2str() */ int -term_attr_fixup(msk) -int msk; +term_attr_fixup(int msk) { /* underline is converted to bold if its start sequence isn't available */ if ((msk & HL_ULINE) && (!nh_US || !*nh_US)) { @@ -1294,8 +1283,7 @@ int msk; } void -term_start_attr(attr) -int attr; +term_start_attr(int attr) { if (attr) { const char *astr = s_atr2str(attr); @@ -1306,8 +1294,7 @@ int attr; } void -term_end_attr(attr) -int attr; +term_end_attr(int attr) { if (attr) { const char *astr = e_atr2str(attr); @@ -1318,13 +1305,13 @@ int attr; } void -term_start_raw_bold() +term_start_raw_bold(void) { xputs(nh_HI); } void -term_end_raw_bold() +term_end_raw_bold(void) { xputs(nh_HE); } @@ -1332,14 +1319,13 @@ term_end_raw_bold() #ifdef TEXTCOLOR void -term_end_color() +term_end_color(void) { xputs(nh_HE); } void -term_start_color(color) -int color; +term_start_color(int color) { if (color < CLR_MAX && hilites[color] && *hilites[color]) xputs(hilites[color]); diff --git a/win/tty/topl.c b/win/tty/topl.c index 1802d6944..46a1f482f 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -14,14 +14,14 @@ #define C(c) (0x1f & (c)) #endif -static void FDECL(redotoplin, (const char *)); -static void FDECL(topl_putsym, (CHAR_P)); -static void FDECL(removetopl, (int)); -static void FDECL(msghistory_snapshot, (BOOLEAN_P)); -static void FDECL(free_msghistory_snapshot, (BOOLEAN_P)); +static void redotoplin(const char *); +static void topl_putsym(char); +static void removetopl(int); +static void msghistory_snapshot(boolean); +static void free_msghistory_snapshot(boolean); int -tty_doprev_message() +tty_doprev_message(void) { register struct WinDesc *cw = wins[WIN_MESSAGE]; winid prevmsg_win; @@ -123,8 +123,7 @@ tty_doprev_message() } static void -redotoplin(str) -const char *str; +redotoplin(const char *str) { int otoplin = ttyDisplay->toplin; @@ -145,8 +144,7 @@ const char *str; /* for use by tty_putstr() */ void -show_topl(str) -const char *str; +show_topl(const char *str) { struct WinDesc *cw = wins[WIN_MESSAGE]; @@ -166,7 +164,7 @@ const char *str; /* used by update_topl(); also by tty_putstr() */ void -remember_topl() +remember_topl(void) { register struct WinDesc *cw = wins[WIN_MESSAGE]; int idx = cw->maxrow; @@ -188,8 +186,7 @@ remember_topl() } void -addtopl(s) -const char *s; +addtopl(const char *s) { register struct WinDesc *cw = wins[WIN_MESSAGE]; @@ -200,7 +197,7 @@ const char *s; } void -more() +more(void) { struct WinDesc *cw = wins[WIN_MESSAGE]; @@ -244,8 +241,7 @@ more() } void -update_topl(bp) -register const char *bp; +update_topl(register const char *bp) { register char *tl, *otl; register int n0; @@ -297,10 +293,8 @@ register const char *bp; redotoplin(g.toplines); } -static -void -topl_putsym(c) -char c; +static void +topl_putsym(char c) { register struct WinDesc *cw = wins[WIN_MESSAGE]; @@ -342,16 +336,14 @@ char c; } void -putsyms(str) -const char *str; +putsyms(const char *str) { while (*str) topl_putsym(*str++); } static void -removetopl(n) -register int n; +removetopl(register int n) { /* assume addtopl() has been done, so ttyDisplay->toplin is already set */ while (n-- > 0) @@ -362,9 +354,7 @@ extern char erase_char; /* from xxxtty.c; don't need kill_char */ /* returns a single keystroke; also sets 'yn_number' */ char -tty_yn_function(query, resp, def) -const char *query, *resp; -char def; +tty_yn_function(const char *query, const char *resp, char def) /* * Generic yes/no function. 'def' is the default (returned by space or * return; 'esc' returns 'q', or 'n', or the default, depending on @@ -550,8 +540,8 @@ static char **snapshot_mesgs = 0; /* collect currently available message history data into a sequential array; optionally, purge that data from the active circular buffer set as we go */ static void -msghistory_snapshot(purge) -boolean purge; /* clear message history buffer as we copy it */ +msghistory_snapshot(boolean purge) /* clear message history buffer + as we copy it */ { char *mesg; int i, inidx, outidx; @@ -596,8 +586,8 @@ boolean purge; /* clear message history buffer as we copy it */ /* release memory allocated to message history snapshot */ static void -free_msghistory_snapshot(purged) -boolean purged; /* True: took history's pointers, False: just cloned them */ +free_msghistory_snapshot(boolean purged) /* True: took history's pointers, + False: just cloned them */ { if (snapshot_mesgs) { /* snapshot pointers are no longer in use */ @@ -627,8 +617,7 @@ boolean purged; /* True: took history's pointers, False: just cloned them */ * included among the output of the subsequent calls. */ char * -tty_getmsghistory(init) -boolean init; +tty_getmsghistory(boolean init) { static int nxtidx; char *nextmesg; @@ -668,9 +657,7 @@ boolean init; * into message history for ^P recall without having displayed it. */ void -tty_putmsghistory(msg, restoring_msghist) -const char *msg; -boolean restoring_msghist; +tty_putmsghistory(const char *msg, boolean restoring_msghist) { static boolean initd = FALSE; int idx; diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 12ef0c903..8a209dad6 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -144,8 +144,8 @@ winid BASE_WINDOW; struct WinDesc *wins[MAXWIN]; struct DisplayDesc *ttyDisplay; /* the tty display descriptor */ -extern void FDECL(cmov, (int, int)); /* from termcap.c */ -extern void FDECL(nocmov, (int, int)); /* from termcap.c */ +extern void cmov(int, int); /* from termcap.c */ +extern void nocmov(int, int); /* from termcap.c */ #if defined(UNIX) || defined(VMS) static char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ #endif @@ -166,7 +166,7 @@ static int clipy = 0, clipymax = 0; #endif /* CLIPPING */ #if defined(USE_TILES) && defined(MSDOS) -extern void FDECL(adjust_cursor_flags, (struct WinDesc *)); +extern void adjust_cursor_flags(struct WinDesc *); #endif #if defined(ASCIIGRAPH) && !defined(NO_TERMS) @@ -178,47 +178,43 @@ boolean HE_resets_AS; /* see termcap.c */ static const char to_continue[] = "to continue"; #define getret() getreturn(to_continue) #else -static void NDECL(getret); +static void getret(void); #endif -static void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */ -static void NDECL(new_status_window); -static void FDECL(erase_menu_or_text, (winid, struct WinDesc *, - BOOLEAN_P)); -static void FDECL(free_window_info, (struct WinDesc *, BOOLEAN_P)); -static boolean FDECL(toggle_menu_curr, (winid, tty_menu_item *, int, - BOOLEAN_P, BOOLEAN_P, long)); -static void FDECL(dmore, (struct WinDesc *, const char *)); -static void FDECL(set_item_state, (winid, int, tty_menu_item *)); -static void FDECL(set_all_on_page, (winid, tty_menu_item *, - tty_menu_item *)); -static void FDECL(unset_all_on_page, (winid, tty_menu_item *, - tty_menu_item *)); -static void FDECL(invert_all_on_page, (winid, tty_menu_item *, - tty_menu_item *, CHAR_P)); -static void FDECL(invert_all, (winid, tty_menu_item *, - tty_menu_item *, CHAR_P)); -static void FDECL(toggle_menu_attr, (BOOLEAN_P, int, int)); -static void FDECL(process_menu_window, (winid, struct WinDesc *)); -static void FDECL(process_text_window, (winid, struct WinDesc *)); -static tty_menu_item *FDECL(reverse, (tty_menu_item *)); -static const char *FDECL(compress_str, (const char *)); -static void FDECL(tty_putsym, (winid, int, int, CHAR_P)); -static void FDECL(setup_rolemenu, (winid, BOOLEAN_P, int, int, int)); -static void FDECL(setup_racemenu, (winid, BOOLEAN_P, int, int, int)); -static void FDECL(setup_gendmenu, (winid, BOOLEAN_P, int, int, int)); -static void FDECL(setup_algnmenu, (winid, BOOLEAN_P, int, int, int)); -static boolean NDECL(reset_role_filtering); +static void bail(const char *); /* __attribute__((noreturn)) */ +static void new_status_window(void); +static void erase_menu_or_text(winid, struct WinDesc *, boolean); +static void free_window_info(struct WinDesc *, boolean); +static boolean toggle_menu_curr(winid, tty_menu_item *, int, boolean, + boolean, long); +static void dmore(struct WinDesc *, const char *); +static void set_item_state(winid, int, tty_menu_item *); +static void set_all_on_page(winid, tty_menu_item *, tty_menu_item *); +static void unset_all_on_page(winid, tty_menu_item *, tty_menu_item *); +static void invert_all_on_page(winid, tty_menu_item *, tty_menu_item *, + char); +static void invert_all(winid, tty_menu_item *, tty_menu_item *, char); +static void toggle_menu_attr(boolean, int, int); +static void process_menu_window(winid, struct WinDesc *); +static void process_text_window(winid, struct WinDesc *); +static tty_menu_item *reverse(tty_menu_item *); +static const char *compress_str(const char *); +static void tty_putsym(winid, int, int, char); +static void setup_rolemenu(winid, boolean, int, int, int); +static void setup_racemenu(winid, boolean, int, int, int); +static void setup_gendmenu(winid, boolean, int, int, int); +static void setup_algnmenu(winid, boolean, int, int, int); +static boolean reset_role_filtering(void); #ifdef STATUS_HILITES -static boolean FDECL(check_fields, (BOOLEAN_P, int *)); -static void NDECL(render_status); -static void FDECL(tty_putstatusfield, (const char *, int, int)); -static boolean NDECL(check_windowdata); -static void NDECL(set_condition_length); -static int FDECL(make_things_fit, (BOOLEAN_P)); -static void FDECL(shrink_enc, (int)); -static void FDECL(shrink_dlvl, (int)); +static boolean check_fields(boolean, int *); +static void render_status(void); +static void tty_putstatusfield(const char *, int, int); +static boolean check_windowdata(void); +static void set_condition_length(void); +static int make_things_fit(boolean); +static void shrink_enc(int); +static void shrink_dlvl(int); #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) -static void NDECL(status_sanity_check); +static void status_sanity_check(void); #endif /* NH_DEVEL_STATUS */ #endif @@ -266,8 +262,7 @@ int i, c, d; #ifdef TTY_SOUND_ESCCODES void -print_vt_soundcode_idx(idx, v) -int idx, v; +print_vt_soundcode_idx(int idx, int v) { HUPSKIP(); if (iflags.vt_sounddata) { @@ -285,8 +280,7 @@ int idx, v; /* clean up and quit */ static void -bail(mesg) -const char *mesg; +bail(const char *mesg) { clearlocks(); tty_exit_nhwindows(mesg); @@ -295,7 +289,7 @@ const char *mesg; } #if defined(SIGWINCH) && defined(CLIPPING) && !defined(NO_SIGNAL) -static void FDECL(winch_handler, (int)); +static void winch_handler(int); /* * This really ought to just set a flag like the hangup handler does, @@ -306,10 +300,10 @@ static void FDECL(winch_handler, (int)); * * 'winch_seen' has been "notyet" for a long time.... */ +/* signal handler is called with at least 1 arg */ /*ARGUSED*/ static void -winch_handler(sig_unused) /* signal handler is called with at least 1 arg */ -int sig_unused UNUSED; +winch_handler(int sig_unused UNUSED) { int oldLI = LI, oldCO = CO, i; register struct WinDesc *cw; @@ -374,7 +368,7 @@ int sig_unused UNUSED; /* destroy and recreate status window; extracted from winch_handler() and augmented for use by tty_preference_update() */ static void -new_status_window() +new_status_window(void) { if (WIN_STATUS != WIN_ERR) { /* if it's shrinking, clear it before destroying so that @@ -408,9 +402,7 @@ new_status_window() /*ARGSUSED*/ void -tty_init_nhwindows(argcp, argv) -int *argcp UNUSED; -char **argv UNUSED; +tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED) { int wid, hgt, i; @@ -476,8 +468,7 @@ char **argv UNUSED; } void -tty_preference_update(pref) -const char *pref; +tty_preference_update(const char *pref) { if (!strcmp(pref, "statuslines") && iflags.window_inited) { new_status_window(); @@ -498,7 +489,7 @@ const char *pref; #define ALGN flags.initalign void -tty_player_selection() +tty_player_selection(void) { int i, k, n, choice, nextpick; boolean getconfirmation, picksomething; @@ -1047,7 +1038,7 @@ tty_player_selection() } static boolean -reset_role_filtering() +reset_role_filtering(void) { winid win; anything any; @@ -1104,10 +1095,10 @@ reset_role_filtering() /* add entries a-Archeologist, b-Barbarian, &c to menu being built in 'win' */ static void -setup_rolemenu(win, filtering, race, gend, algn) -winid win; -boolean filtering; /* True => exclude filtered roles; False => filter reset */ -int race, gend, algn; /* all ROLE_NONE for !filtering case */ +setup_rolemenu(winid win, + boolean filtering, /* True => exclude filtered roles; + False => filter reset */ + int race, int gend, int algn) /* all ROLE_NONE for !filtering case */ { anything any; int i; @@ -1153,10 +1144,7 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */ } static void -setup_racemenu(win, filtering, role, gend, algn) -winid win; -boolean filtering; -int role, gend, algn; +setup_racemenu(winid win, boolean filtering, int role, int gend, int algn) { anything any; boolean race_ok; @@ -1190,10 +1178,7 @@ int role, gend, algn; } static void -setup_gendmenu(win, filtering, role, race, algn) -winid win; -boolean filtering; -int role, race, algn; +setup_gendmenu(winid win, boolean filtering, int role, int race, int algn) { anything any; boolean gend_ok; @@ -1225,10 +1210,7 @@ int role, race, algn; } static void -setup_algnmenu(win, filtering, role, race, gend) -winid win; -boolean filtering; -int role, race, gend; +setup_algnmenu(winid win, boolean filtering, int role, int race, int gend) { anything any; boolean algn_ok; @@ -1266,7 +1248,7 @@ int role, race, gend; * Always called after init_nhwindows() and before display_gamewindows(). */ void -tty_askname() +tty_askname(void) { static const char who_are_you[] = "Who are you? "; register int c, ct, tryct = 0; @@ -1372,14 +1354,14 @@ tty_askname() } void -tty_get_nh_event() +tty_get_nh_event(void) { return; } #if !defined(MICRO) && !defined(WIN32CON) static void -getret() +getret(void) { HUPSKIP(); xputs("\n"); @@ -1395,8 +1377,7 @@ getret() #endif void -tty_suspend_nhwindows(str) -const char *str; +tty_suspend_nhwindows(const char *str) { settty(str); /* calls end_screen, perhaps raw_print */ if (!str) @@ -1404,7 +1385,7 @@ const char *str; } void -tty_resume_nhwindows() +tty_resume_nhwindows(void) { gettty(); setftty(); /* calls start_screen */ @@ -1412,8 +1393,7 @@ tty_resume_nhwindows() } void -tty_exit_nhwindows(str) -const char *str; +tty_exit_nhwindows(const char *str) { winid i; @@ -1456,8 +1436,7 @@ const char *str; } winid -tty_create_nhwindow(type) -int type; +tty_create_nhwindow(int type) { struct WinDesc *newwin; int i, rowoffset; @@ -1571,10 +1550,7 @@ int type; } static void -erase_menu_or_text(window, cw, clear) -winid window; -struct WinDesc *cw; -boolean clear; +erase_menu_or_text(winid window, struct WinDesc *cw, boolean clear) { if (cw->offx == 0) { if (cw->offy) { @@ -1591,9 +1567,7 @@ boolean clear; } static void -free_window_info(cw, free_data) -struct WinDesc *cw; -boolean free_data; +free_window_info(struct WinDesc *cw, boolean free_data) { int i; @@ -1639,8 +1613,7 @@ boolean free_data; } void -tty_clear_nhwindow(window) -winid window; +tty_clear_nhwindow(winid window) { int i, j, m, n; register struct WinDesc *cw = 0; @@ -1695,12 +1668,8 @@ winid window; } static boolean -toggle_menu_curr(window, curr, lineno, in_view, counting, count) -winid window; -tty_menu_item *curr; -int lineno; -boolean in_view, counting; -long count; +toggle_menu_curr(winid window, tty_menu_item *curr, int lineno, + boolean in_view, boolean counting, long count) { if (curr->selected) { if (counting && count > 0) { @@ -1734,9 +1703,8 @@ long count; } static void -dmore(cw, s) -register struct WinDesc *cw; -const char *s; /* valid responses */ +dmore(register struct WinDesc *cw, + const char *s) /* valid responses */ { const char *prompt = cw->morestr ? cw->morestr : defmorestr; int offset = (cw->type == NHW_TEXT) ? 1 : 2; @@ -1755,10 +1723,7 @@ const char *s; /* valid responses */ } static void -set_item_state(window, lineno, item) -winid window; -int lineno; -tty_menu_item *item; +set_item_state(winid window, int lineno, tty_menu_item *item) { char ch = item->selected ? (item->count == -1L ? '+' : '#') : '-'; @@ -1771,9 +1736,8 @@ tty_menu_item *item; } static void -set_all_on_page(window, page_start, page_end) -winid window; -tty_menu_item *page_start, *page_end; +set_all_on_page(winid window, tty_menu_item *page_start, + tty_menu_item *page_end) { tty_menu_item *curr; int n; @@ -1786,9 +1750,8 @@ tty_menu_item *page_start, *page_end; } static void -unset_all_on_page(window, page_start, page_end) -winid window; -tty_menu_item *page_start, *page_end; +unset_all_on_page(winid window, tty_menu_item *page_start, + tty_menu_item *page_end) { tty_menu_item *curr; int n; @@ -1802,10 +1765,9 @@ tty_menu_item *page_start, *page_end; } static void -invert_all_on_page(window, page_start, page_end, acc) -winid window; -tty_menu_item *page_start, *page_end; -char acc; /* group accelerator, 0 => all */ +invert_all_on_page(winid window, tty_menu_item *page_start, + tty_menu_item *page_end, + char acc) /* group accelerator, 0 => all */ { tty_menu_item *curr; int n; @@ -1829,10 +1791,9 @@ char acc; /* group accelerator, 0 => all */ * Invert all entries that match the give group accelerator (or all if zero). */ static void -invert_all(window, page_start, page_end, acc) -winid window; -tty_menu_item *page_start, *page_end; -char acc; /* group accelerator, 0 => all */ +invert_all(winid window, tty_menu_item *page_start, + tty_menu_item *page_end, + char acc) /* group accelerator, 0 => all */ { tty_menu_item *curr; boolean on_curr_page; @@ -1862,9 +1823,7 @@ char acc; /* group accelerator, 0 => all */ /* support menucolor in addition to caller-supplied attribute */ static void -toggle_menu_attr(on, color, attr) -boolean on; -int color, attr; +toggle_menu_attr(boolean on, int color, int attr) { if (on) { term_start_attr(attr); @@ -1886,9 +1845,7 @@ int color, attr; } static void -process_menu_window(window, cw) -winid window; -struct WinDesc *cw; +process_menu_window(winid window, struct WinDesc *cw) { tty_menu_item *page_start, *page_end, *curr; long count; @@ -2262,9 +2219,7 @@ struct WinDesc *cw; } static void -process_text_window(window, cw) -winid window; -struct WinDesc *cw; +process_text_window(winid window, struct WinDesc *cw) { int i, n, attr; boolean linestart; @@ -2341,9 +2296,8 @@ struct WinDesc *cw; /*ARGSUSED*/ void -tty_display_nhwindow(window, blocking) -winid window; -boolean blocking; /* with ttys, all windows are blocking */ +tty_display_nhwindow(winid window, + boolean blocking) /* with ttys, all windows are blocking */ { register struct WinDesc *cw = 0; short s_maxcol; @@ -2437,8 +2391,7 @@ boolean blocking; /* with ttys, all windows are blocking */ } void -tty_dismiss_nhwindow(window) -winid window; +tty_dismiss_nhwindow(winid window) { register struct WinDesc *cw = 0; @@ -2484,8 +2437,7 @@ winid window; } void -tty_destroy_nhwindow(window) -winid window; +tty_destroy_nhwindow(winid window) { register struct WinDesc *cw = 0; @@ -2505,10 +2457,10 @@ winid window; } void -tty_curs(window, x, y) -winid window; -register int x, y; /* not xchar: perhaps xchar is unsigned and - curx-x would be unsigned as well */ +tty_curs(winid window, + register int x, register int y) /* not xchar: perhaps xchar is + unsigned and curx-x would be + unsigned as well */ { struct WinDesc *cw = 0; int cx = ttyDisplay->curx; @@ -2606,10 +2558,7 @@ register int x, y; /* not xchar: perhaps xchar is unsigned and } static void -tty_putsym(window, x, y, ch) -winid window; -int x, y; -char ch; +tty_putsym(winid window, int x, int y, char ch) { register struct WinDesc *cw = 0; @@ -2639,8 +2588,7 @@ char ch; } static const char * -compress_str(str) -const char *str; +compress_str(const char *str) { static char cbuf[BUFSZ]; @@ -2670,10 +2618,7 @@ const char *str; } void -tty_putstr(window, attr, str) -winid window; -int attr; -const char *str; +tty_putstr(winid window, int attr, const char *str) { register struct WinDesc *cw = 0; register char *ob; @@ -2843,9 +2788,7 @@ const char *str; } void -tty_display_file(fname, complain) -const char *fname; -boolean complain; +tty_display_file(const char *fname, boolean complain) { #ifdef DEF_PAGER /* this implies that UNIX is defined */ { @@ -2937,9 +2880,7 @@ boolean complain; } void -tty_start_menu(window, mbehavior) -winid window; -unsigned long mbehavior; +tty_start_menu(winid window, unsigned long mbehavior) { wins[window]->mbehavior = mbehavior; tty_clear_nhwindow(window); @@ -2952,15 +2893,15 @@ unsigned long mbehavior; * later. */ void -tty_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags) -winid window; /* window to use, must be of type NHW_MENU */ -const glyph_info *glyphinfo UNUSED; /* glyph info w/glyph to display w/item */ -const anything *identifier; /* what to return if selected */ -char ch; /* keyboard accelerator (0 = pick our own) */ -char gch; /* group accelerator (0 = no group) */ -int attr; /* attribute for string (like tty_putstr()) */ -const char *str; /* menu string */ -unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */ +tty_add_menu(winid window, /* window to use, must be of type NHW_MENU */ + const glyph_info *glyphinfo UNUSED, /* glyph info with glyph to + display with item */ + const anything *identifier, /* what to return if selected */ + char ch, /* keyboard accelerator (0 = pick our own) */ + char gch, /* group accelerator (0 = no group) */ + int attr, /* attribute for string (like tty_putstr()) */ + const char *str, /* menu string */ + unsigned int itemflags) /* itemflags such as MENU_ITEMFLAGS_SELECTED */ { boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); register struct WinDesc *cw = 0; @@ -3009,8 +2950,7 @@ unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */ /* Invert the given list, can handle NULL as an input. */ static tty_menu_item * -reverse(curr) -tty_menu_item *curr; +reverse(tty_menu_item *curr) { tty_menu_item *next, *head = 0; @@ -3030,9 +2970,8 @@ tty_menu_item *curr; * height of the window. */ void -tty_end_menu(window, prompt) -winid window; /* menu to use */ -const char *prompt; /* prompt to for menu */ +tty_end_menu(winid window, /* menu to use */ + const char *prompt) /* prompt to for menu */ { struct WinDesc *cw = 0; tty_menu_item *curr; @@ -3141,10 +3080,7 @@ const char *prompt; /* prompt to for menu */ } int -tty_select_menu(window, how, menu_list) -winid window; -int how; -menu_item **menu_list; +tty_select_menu(winid window, int how, menu_item **menu_list) { register struct WinDesc *cw = 0; tty_menu_item *curr; @@ -3185,10 +3121,7 @@ menu_item **menu_list; /* special hack for treating top line --More-- as a one item menu */ char -tty_message_menu(let, how, mesg) -char let; -int how; -const char *mesg; +tty_message_menu(char let, int how, const char *mesg) { HUPSKIP(); /* "menu" without selection; use ordinary pline, no more() */ @@ -3219,20 +3152,20 @@ const char *mesg; } void -tty_update_inventory() +tty_update_inventory(void) { return; } void -tty_mark_synch() +tty_mark_synch(void) { HUPSKIP(); (void) fflush(stdout); } void -tty_wait_synch() +tty_wait_synch(void) { HUPSKIP(); /* we just need to make sure all windows are synch'd */ @@ -3258,8 +3191,7 @@ tty_wait_synch() } void -docorner(xmin, ymax) -register int xmin, ymax; +docorner(register int xmin, register int ymax) { register int y; register struct WinDesc *cw = wins[WIN_MAP]; @@ -3311,7 +3243,7 @@ register int xmin, ymax; } void -end_glyphout() +end_glyphout(void) { HUPSKIP(); #if defined(ASCIIGRAPH) && !defined(NO_TERMS) @@ -3330,8 +3262,7 @@ end_glyphout() #ifndef WIN32 void -g_putch(in_ch) -int in_ch; +g_putch(int in_ch) { register char ch = (char) in_ch; @@ -3370,7 +3301,7 @@ int in_ch; #ifdef CLIPPING void -setclipped() +setclipped(void) { clipping = TRUE; clipx = clipy = 0; @@ -3379,8 +3310,7 @@ setclipped() } void -tty_cliparound(x, y) -int x, y; +tty_cliparound(int x, int y) { int oldx = clipx, oldy = clipy; @@ -3417,15 +3347,13 @@ int x, y; */ void -tty_print_glyph(window, x, y, glyphinfo, bkglyphinfo) -winid window; -xchar x, y; +tty_print_glyph(winid window, xchar x, xchar y, #if defined(TTY_TILES_ESCCODES) || defined(MSDOS) -const glyph_info *glyphinfo; + const glyph_info *glyphinfo, #else -const glyph_info *glyphinfo UNUSED; + const glyph_info *glyphinfo UNUSED, #endif -const glyph_info *bkglyphinfo UNUSED; + const glyph_info *bkglyphinfo UNUSED) { boolean inverse_on = FALSE; int ch, color; @@ -3519,8 +3447,7 @@ const glyph_info *bkglyphinfo UNUSED; } void -tty_raw_print(str) -const char *str; +tty_raw_print(const char *str) { HUPSKIP(); if (ttyDisplay) @@ -3535,8 +3462,7 @@ const char *str; } void -tty_raw_print_bold(str) -const char *str; +tty_raw_print_bold(const char *str) { HUPSKIP(); if (ttyDisplay) @@ -3558,7 +3484,7 @@ const char *str; } int -tty_nhgetch() +tty_nhgetch(void) { int i; #ifdef UNIX @@ -3620,11 +3546,10 @@ tty_nhgetch() */ /*ARGSUSED*/ int -tty_nh_poskey(x, y, mod) #if defined(WIN32CON) -int *x, *y, *mod; +tty_nh_poskey(int *x, int *y, int *mod) #else -int *x UNUSED, *y UNUSED, *mod UNUSED; +tty_nh_poskey(int *x UNUSED, int *y UNUSED, int *mod UNUSED) #endif { int i; @@ -3652,8 +3577,7 @@ int *x UNUSED, *y UNUSED, *mod UNUSED; } void -win_tty_init(dir) -int dir; +win_tty_init(int dir) { if (dir != WININIT) return; @@ -3662,8 +3586,7 @@ int dir; #ifdef POSITIONBAR void -tty_update_positionbar(posbar) -char *posbar; +tty_update_positionbar(char *posbar) { #ifdef MSDOS video_update_positionbar(posbar); @@ -3737,9 +3660,9 @@ extern winid WIN_STATUS; #ifdef STATUS_HILITES #ifdef TEXTCOLOR -static int FDECL(condcolor, (long, unsigned long *)); +static int condcolor(long, unsigned long *); #endif -static int FDECL(condattr, (long, unsigned long *)); +static int condattr(long, unsigned long *); static unsigned long *tty_colormasks; static long tty_condition_bits; static struct tty_status_fields tty_status[2][MAXBLSTATS]; /* 2: NOW,BEFORE */ @@ -3809,7 +3732,7 @@ static int do_field_opt = * -- call genl_status_init() to initialize the general data. */ void -tty_status_init() +tty_status_init(void) { #ifdef STATUS_HILITES int i, num_rows; @@ -3837,11 +3760,8 @@ tty_status_init() } void -tty_status_enablefield(fieldidx, nm, fmt, enable) -int fieldidx; -const char *nm; -const char *fmt; -boolean enable; +tty_status_enablefield(int fieldidx, const char *nm, const char *fmt, + boolean enable) { genl_status_enablefield(fieldidx, nm, fmt, enable); } @@ -3924,10 +3844,8 @@ boolean enable; */ void -tty_status_update(fldidx, ptr, chg, percent, color, colormasks) -int fldidx, chg UNUSED, percent, color; -genericptr_t ptr; -unsigned long *colormasks; +tty_status_update(int fldidx, genericptr_t ptr, int chg UNUSED, int percent, + int color, unsigned long *colormasks) { int attrmask; long *condptr = (long *) ptr; @@ -4047,8 +3965,7 @@ unsigned long *colormasks; } static int -make_things_fit(force_update) -boolean force_update; +make_things_fit(boolean force_update) { int trycnt, fitting = 0, requirement; int rowsz[3], num_rows, condrow, otheroptions = 0; @@ -4111,9 +4028,7 @@ boolean force_update; * This is now done at an individual field case-by-case level. */ static boolean -check_fields(forcefields, sz) -boolean forcefields; -int sz[3]; +check_fields(boolean forcefields, int sz[3]) { int c, i, row, col, num_rows, idx; boolean valid = TRUE, matchprev, update_right; @@ -4214,7 +4129,7 @@ int sz[3]; #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) static void -status_sanity_check(VOID_ARGS) +status_sanity_check(void) { int i; static boolean in_sanity_check = FALSE; @@ -4262,9 +4177,7 @@ status_sanity_check(VOID_ARGS) * This is what places a field on the tty display. */ static void -tty_putstatusfield(text, x, y) -const char *text; -int x, y; +tty_putstatusfield(const char *text, int x, int y) { int i, n, ncols, nrows, lth = 0; struct WinDesc *cw = 0; @@ -4305,7 +4218,7 @@ int x, y; /* caller must set cond_shrinklvl (0..2) before calling us */ static void -set_condition_length() +set_condition_length(void) { long mask; int c, lth = 0; @@ -4321,8 +4234,7 @@ set_condition_length() } static void -shrink_enc(lvl) -int lvl; +shrink_enc(int lvl) { /* shrink or restore the encumbrance word */ if (lvl <= 2) { @@ -4333,8 +4245,7 @@ int lvl; } static void -shrink_dlvl(lvl) -int lvl; +shrink_dlvl(int lvl) { /* try changing Dlvl: to Dl: */ char buf[BUFSZ]; @@ -4354,7 +4265,7 @@ int lvl; * blank and null-terminated. */ static boolean -check_windowdata(VOID_ARGS) +check_windowdata(void) { if (WIN_STATUS == WIN_ERR || wins[WIN_STATUS] == (struct WinDesc *) 0) { paniclog("check_windowdata", " null status window."); @@ -4372,9 +4283,7 @@ check_windowdata(VOID_ARGS) * be displayed in based on user settings. */ static int -condcolor(bm, bmarray) -long bm; -unsigned long *bmarray; +condcolor(long bm, unsigned long *bmarray) { int i; @@ -4394,9 +4303,7 @@ unsigned long *bmarray; #endif /* TEXTCOLOR */ static int -condattr(bm, bmarray) -long bm; -unsigned long *bmarray; +condattr(long bm, unsigned long *bmarray) { int attr = 0; int i; @@ -4460,7 +4367,7 @@ unsigned long *bmarray; } while (0) static void -render_status(VOID_ARGS) +render_status(void) { long mask, bits; int i, x, y, idx, c, ci, row, tlth, num_rows, coloridx = 0, attrmask = 0; @@ -4685,8 +4592,7 @@ render_status(VOID_ARGS) #if defined(USER_SOUNDS) && defined(TTY_SOUND_ESCCODES) void -play_usersound_via_idx(idx, volume) -int idx, volume; +play_usersound_via_idx(int idx, int volume) { print_vt_soundcode_idx(idx, volume); } diff --git a/win/win32/NetHackW.c b/win/win32/NetHackW.c index b86109500..38533b485 100644 --- a/win/win32/NetHackW.c +++ b/win/win32/NetHackW.c @@ -53,7 +53,7 @@ Version _WIN_32IE Platform/IE /*#define COMCTL_URL * "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp"*/ -extern void FDECL(nethack_exit, (int)) NORETURN; +extern void nethack_exit(int) NORETURN; static TCHAR *_get_cmd_arg(TCHAR *pCmdLine); static HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); BOOL WINAPI @@ -72,7 +72,7 @@ extern int GUILaunched; /* We tell shared startup code in windmain.c #endif // Foward declarations of functions included in this code module: -extern boolean FDECL(main, (int, char **)); +extern boolean main(int, char **); static void __cdecl mswin_moveloop(void *); #define MAX_CMDLINE_PARAM 255 @@ -242,7 +242,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, } PNHWinApp -GetNHApp() +GetNHApp(void) { return &_nethack_app; } diff --git a/win/win32/mhdlg.c b/win/win32/mhdlg.c index c6c747ff9..9e064229b 100644 --- a/win/win32/mhdlg.c +++ b/win/win32/mhdlg.c @@ -345,7 +345,7 @@ static boolean plselRandomize(plsel_data_t * data); static BOOL plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam); boolean -mswin_player_selection_window() +mswin_player_selection_window(void) { INT_PTR ret; plsel_data_t data; diff --git a/win/win32/mhfont.c b/win/win32/mhfont.c index 8fb512496..9b6035e34 100644 --- a/win/win32/mhfont.c +++ b/win/win32/mhfont.c @@ -217,7 +217,7 @@ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace) } UINT -mswin_charset() +mswin_charset(void) { CHARSETINFO cis; if (SYMHANDLING(H_IBM)) diff --git a/win/win32/mhinput.c b/win/win32/mhinput.c index de67b08e5..fb57ea917 100644 --- a/win/win32/mhinput.c +++ b/win/win32/mhinput.c @@ -34,7 +34,7 @@ mswin_nh_input_init(void) /* check for input */ int -mswin_have_input() +mswin_have_input(void) { return #ifdef SAFERHANGUP @@ -63,7 +63,7 @@ mswin_input_push(PMSNHEvent event) /* get event from the queue and delete it */ PMSNHEvent -mswin_input_pop() +mswin_input_pop(void) { PMSNHEvent retval; @@ -92,7 +92,7 @@ mswin_input_pop() /* get event from the queue but leave it there */ PMSNHEvent -mswin_input_peek() +mswin_input_peek(void) { PMSNHEvent retval; diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c index 1d9b84c10..ca1835a52 100644 --- a/win/win32/mhmain.c +++ b/win/win32/mhmain.c @@ -44,7 +44,7 @@ static void mswin_apply_window_style_all(); // returns strdup() created pointer - callee assumes the ownership HWND -mswin_init_main_window() +mswin_init_main_window(void) { static int run_once = 0; HWND ret; @@ -98,7 +98,7 @@ mswin_init_main_window() } void -register_main_window_class() +register_main_window_class(void) { WNDCLASS wcex; @@ -1102,7 +1102,7 @@ About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } void -mswin_menu_check_intf_mode() +mswin_menu_check_intf_mode(void) { HMENU hMenu = GetMenu(GetNHApp()->hMainWnd); @@ -1235,7 +1235,8 @@ mswin_apply_window_style(HWND hwnd) { } void -mswin_apply_window_style_all() { +mswin_apply_window_style_all(void) +{ int i; for (i = 0; i < MAXWINDOWS; i++) { if (IsWindow(GetNHApp()->windowlist[i].win) @@ -1249,7 +1250,7 @@ mswin_apply_window_style_all() { // returns strdup() created pointer - callee assumes the ownership #define TEXT_BUFFER_SIZE 4096 char * -nh_compose_ascii_screenshot() +nh_compose_ascii_screenshot(void) { char *retval; PMSNHMsgGetText text; diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index aa79ef5a6..d4576710a 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -96,7 +96,7 @@ static void nhglyph2charcolor(short glyph, uchar *ch, int *color); extern boolean win32_cursorblink; /* from sys\winnt\winnt.c */ HWND -mswin_init_map_window() +mswin_init_map_window(void) { static int run_once = 0; HWND hWnd; @@ -517,7 +517,7 @@ void mswin_map_update(HWND hWnd) /* register window class for map window */ void -register_map_window_class() +register_map_window_class(void) { WNDCLASS wcex; ZeroMemory(&wcex, sizeof(wcex)); diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index e034909e1..91480dd34 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -29,11 +29,11 @@ typedef struct mswin_menu_item { glyph_info glyphinfo; ANY_P identifier; - CHAR_P accelerator; - CHAR_P group_accel; + char accelerator; + char group_accel; int attr; char str[NHMENU_STR_SIZE]; - BOOLEAN_P presel; + boolean presel; unsigned int itemflags; int count; BOOL has_focus; diff --git a/win/win32/mhmsg.h b/win/win32/mhmsg.h index 7c9f98a9e..2289b5889 100644 --- a/win/win32/mhmsg.h +++ b/win/win32/mhmsg.h @@ -34,8 +34,8 @@ typedef struct mswin_nhmsg_putstr { } MSNHMsgPutstr, *PMSNHMsgPutstr; typedef struct mswin_nhmsg_print_glyph { - XCHAR_P x; - XCHAR_P y; + xchar x; + xchar y; glyph_info glyphinfo; glyph_info bkglyphinfo; } MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph; @@ -48,11 +48,11 @@ typedef struct mswin_nhmsg_cliparound { typedef struct mswin_nhmsg_add_menu { glyph_info glyphinfo; const ANY_P *identifier; - CHAR_P accelerator; - CHAR_P group_accel; + char accelerator; + char group_accel; int attr; const char *str; - BOOLEAN_P presel; + boolean presel; unsigned int itemflags; } MSNHMsgAddMenu, *PMSNHMsgAddMenu; diff --git a/win/win32/mhmsgwnd.c b/win/win32/mhmsgwnd.c index c821583cc..1e73527dd 100644 --- a/win/win32/mhmsgwnd.c +++ b/win/win32/mhmsgwnd.c @@ -66,7 +66,7 @@ extern void play_sound_for_message(const char *str); #endif HWND -mswin_init_message_window() +mswin_init_message_window(void) { static int run_once = 0; HWND ret; @@ -116,7 +116,7 @@ mswin_init_message_window() } void -register_message_window_class() +register_message_window_class(void) { WNDCLASS wcex; ZeroMemory(&wcex, sizeof(wcex)); diff --git a/win/win32/mhrip.c b/win/win32/mhrip.c index 84f7f7788..3cc5b1b52 100644 --- a/win/win32/mhrip.c +++ b/win/win32/mhrip.c @@ -40,7 +40,7 @@ INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM); static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); HWND -mswin_init_RIP_window() +mswin_init_RIP_window(void) { HWND ret; PNHRIPWindow data; diff --git a/win/win32/mhstatus.c b/win/win32/mhstatus.c index 53d1b1a78..07855155b 100644 --- a/win/win32/mhstatus.c +++ b/win/win32/mhstatus.c @@ -86,7 +86,7 @@ static LRESULT onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam); #define DEFAULT_COLOR_FG_STATUS COLOR_WINDOWTEXT HWND -mswin_init_status_window() +mswin_init_status_window(void) { static int run_once = 0; HWND ret; @@ -151,7 +151,7 @@ mswin_init_status_window() } void -register_status_window_class() +register_status_window_class(void) { WNDCLASS wcex; ZeroMemory(&wcex, sizeof(wcex)); diff --git a/win/win32/mhtext.c b/win/win32/mhtext.c index 56c2a8179..d9f542da1 100644 --- a/win/win32/mhtext.c +++ b/win/win32/mhtext.c @@ -24,7 +24,7 @@ static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); static void LayoutText(HWND hwnd); HWND -mswin_init_text_window() +mswin_init_text_window(void) { HWND ret; RECT rt; diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 141a4e96f..5961b31a3 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -744,7 +744,7 @@ mswin_suspend_nhwindows(const char *str) /* Restore the windows after being suspended. */ void -mswin_resume_nhwindows() +mswin_resume_nhwindows(void) { logDebug("mswin_resume_nhwindows()\n"); @@ -854,7 +854,7 @@ mswin_clear_nhwindow(winid wid) --more--, if necessary, in the tty window-port. */ void -mswin_display_nhwindow(winid wid, BOOLEAN_P block) +mswin_display_nhwindow(winid wid, boolean block) { logDebug("mswin_display_nhwindow(%d, %d)\n", wid, block); if (GetNHApp()->windowlist[wid].win != NULL) { @@ -1035,7 +1035,7 @@ mswin_putstr_ex(winid wid, int attr, const char *text, int app) iff complain is TRUE. */ void -mswin_display_file(const char *filename, BOOLEAN_P must_exist) +mswin_display_file(const char *filename, boolean must_exist) { dlb *f; TCHAR wbuf[BUFSZ]; @@ -1130,7 +1130,7 @@ add_menu(windid window, const glyph_info *glyphinfo, void mswin_add_menu(winid wid, const glyph_info *glyphinfo, const ANY_P *identifier, - CHAR_P accelerator, CHAR_P group_accel, int attr, + char accelerator, char group_accel, int attr, const char *str, unsigned int itemflags) { boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); @@ -1232,7 +1232,7 @@ mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected) window up, otherwise empty. */ void -mswin_update_inventory() +mswin_update_inventory(void) { logDebug("mswin_update_inventory()\n"); if (iflags.perm_invent && g.program_state.something_worth_saving @@ -1246,7 +1246,7 @@ mark_synch() -- Don't go beyond this point in I/O on any channel until for the moment */ void -mswin_mark_synch() +mswin_mark_synch(void) { logDebug("mswin_mark_synch()\n"); } @@ -1258,7 +1258,7 @@ wait_synch() -- Wait until all pending output is complete (*flush*() for display is OK when return from wait_synch(). */ void -mswin_wait_synch() +mswin_wait_synch(void) { logDebug("mswin_wait_synch()\n"); mswin_raw_print_flush(); @@ -1299,7 +1299,7 @@ print_glyph(window, x, y, glyphinfo, bkglyphinfo) */ void -mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, +mswin_print_glyph(winid wid, xchar x, xchar y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo) { logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", wid, x, y, glyphinfo->glyph, bkglyphinfo->glyph); @@ -1338,7 +1338,7 @@ mswin_raw_print_accumulate(const char * str, boolean bold) * dialog box and clear raw_print_strbuf. */ void -mswin_raw_print_flush() +mswin_raw_print_flush(void) { if (raw_print_strbuf.str != NULL) { int wlen = strlen(raw_print_strbuf.str) + 1; @@ -1408,7 +1408,7 @@ int nhgetch() -- Returns a single character input from the user. Returned character _must_ be non-zero. */ int -mswin_nhgetch() +mswin_nhgetch(void) { PMSNHEvent event; int key = 0; @@ -1467,7 +1467,7 @@ nhbell() -- Beep at user. [This will exist at least until sounds are anyway.] */ void -mswin_nhbell() +mswin_nhbell(void) { logDebug("mswin_nhbell()\n"); } @@ -1478,7 +1478,7 @@ doprev_message() -- On the tty-port this scrolls WIN_MESSAGE back one line. */ int -mswin_doprev_message() +mswin_doprev_message(void) { logDebug("mswin_doprev_message()\n"); SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_VSCROLL, @@ -1506,14 +1506,14 @@ char yn_function(const char *ques, const char *choices, char default) ports might use a popup. */ char -mswin_yn_function(const char *question, const char *choices, CHAR_P def) +mswin_yn_function(const char *question, const char *choices, char def) { char ch; char yn_esc_map = '\033'; char message[BUFSZ]; char res_ch[2]; int createcaret; - boolean digit_ok, allow_num; + boolean digit_ok, allow_num = FALSE; logDebug("mswin_yn_function(%s, %s, %d)\n", question, choices, def); @@ -1746,7 +1746,7 @@ int get_ext_cmd(void) selection, -1 otherwise. */ int -mswin_get_ext_cmd() +mswin_get_ext_cmd(void) { int ret; logDebug("mswin_get_ext_cmd()\n"); @@ -1849,7 +1849,7 @@ delay_output() -- Causes a visible delay of 50ms in the output. by a nap(50ms), but allows asynchronous operation. */ void -mswin_delay_output() +mswin_delay_output(void) { logDebug("mswin_delay_output()\n"); mswin_map_update(mswin_hwnd_from_winid(WIN_MAP)); @@ -1857,13 +1857,13 @@ mswin_delay_output() } void -mswin_change_color() +mswin_change_color(void) { logDebug("mswin_change_color()\n"); } char * -mswin_get_color_string() +mswin_get_color_string(void) { logDebug("mswin_get_color_string()\n"); return (""); @@ -1877,7 +1877,7 @@ start_screen() -- Only used on Unix tty ports, but must be declared for just declare an empty function. */ void -mswin_start_screen() +mswin_start_screen(void) { /* Do Nothing */ logDebug("mswin_start_screen()\n"); @@ -1888,7 +1888,7 @@ end_screen() -- Only used on Unix tty ports, but must be declared for completeness. The complement of start_screen(). */ void -mswin_end_screen() +mswin_end_screen(void) { /* Do Nothing */ logDebug("mswin_end_screen()\n"); @@ -2064,7 +2064,7 @@ mswin_preference_update(const char *pref) #define TEXT_BUFFER_SIZE 4096 char * -mswin_getmsghistory(BOOLEAN_P init) +mswin_getmsghistory(boolean init) { static PMSNHMsgGetText text = 0; static char *next_message = 0; @@ -2101,7 +2101,7 @@ mswin_getmsghistory(BOOLEAN_P init) } void -mswin_putmsghistory(const char *msg, BOOLEAN_P restoring) +mswin_putmsghistory(const char *msg, boolean restoring) { BOOL save_sound_opt; @@ -2119,7 +2119,7 @@ mswin_putmsghistory(const char *msg, BOOLEAN_P restoring) } void -mswin_main_loop() +mswin_main_loop(void) { while (!mswin_have_input()) { MSG msg; @@ -2377,7 +2377,7 @@ logDebug(const char *fmt, ...) #define INTFKEY "Interface" void -mswin_read_reg() +mswin_read_reg(void) { HKEY key; DWORD size; @@ -2489,7 +2489,7 @@ mswin_read_reg() } void -mswin_write_reg() +mswin_write_reg(void) { HKEY key; DWORD disposition; @@ -2567,7 +2567,7 @@ mswin_write_reg() } void -mswin_destroy_reg() +mswin_destroy_reg(void) { char keystring[MAX_PATH]; HKEY key; diff --git a/win/win32/vs/common.props b/win/win32/vs/common.props index ee802873c..ea55f68ca 100644 --- a/win/win32/vs/common.props +++ b/win/win32/vs/common.props @@ -8,7 +8,8 @@ - Level3 + Level4 + 4820;4706;4244;4245;4100;4310 WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;WINVER=0x0601;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) diff --git a/win/win32/winMS.h b/win/win32/winMS.h index 4242ce3d1..03d92973a 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -146,16 +146,16 @@ void mswin_suspend_nhwindows(const char *); void mswin_resume_nhwindows(void); winid mswin_create_nhwindow(int type); void mswin_clear_nhwindow(winid wid); -void mswin_display_nhwindow(winid wid, BOOLEAN_P block); +void mswin_display_nhwindow(winid wid, boolean block); void mswin_destroy_nhwindow(winid wid); void mswin_curs(winid wid, int x, int y); void mswin_putstr(winid wid, int attr, const char *text); void mswin_putstr_ex(winid wid, int attr, const char *text, int); -void mswin_display_file(const char *filename, BOOLEAN_P must_exist); +void mswin_display_file(const char *filename, boolean must_exist); void mswin_start_menu(winid wid, unsigned long mbehavior); void mswin_add_menu(winid wid, const glyph_info *glyphinfo, const ANY_P *identifier, - CHAR_P accelerator, CHAR_P group_accel, int attr, + char accelerator, char group_accel, int attr, const char *str, unsigned int itemflags); void mswin_end_menu(winid wid, const char *prompt); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); @@ -163,7 +163,7 @@ void mswin_update_inventory(void); void mswin_mark_synch(void); void mswin_wait_synch(void); void mswin_cliparound(int x, int y); -void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, +void mswin_print_glyph(winid wid, xchar x, xchar y, const glyph_info *glyph, const glyph_info *bkglyph); void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str); @@ -172,7 +172,7 @@ int mswin_nhgetch(void); int mswin_nh_poskey(int *x, int *y, int *mod); void mswin_nhbell(void); int mswin_doprev_message(void); -char mswin_yn_function(const char *question, const char *choices, CHAR_P def); +char mswin_yn_function(const char *question, const char *choices, char def); void mswin_getlin(const char *question, char *input); int mswin_get_ext_cmd(void); void mswin_number_pad(int state); @@ -183,8 +183,8 @@ void mswin_start_screen(void); void mswin_end_screen(void); void mswin_outrip(winid wid, int how, time_t when); void mswin_preference_update(const char *pref); -char *mswin_getmsghistory(BOOLEAN_P init); -void mswin_putmsghistory(const char *msg, BOOLEAN_P); +char *mswin_getmsghistory(boolean init); +void mswin_putmsghistory(const char *msg, boolean); void mswin_status_init(void); void mswin_status_finish(void);