switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions

View File

@@ -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 <x,y> 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;