Super-Rogue: convert to ANSI-style function declarations.
This fixes most of the build warnings.
This commit is contained in:
parent
0f87d5b4d8
commit
59f448e92e
33 changed files with 783 additions and 518 deletions
|
|
@ -21,7 +21,8 @@
|
|||
* wear:
|
||||
* The player wants to wear something, so let the hero try
|
||||
*/
|
||||
wear()
|
||||
void
|
||||
wear(void)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct object *obj;
|
||||
|
|
@ -50,7 +51,8 @@ wear()
|
|||
* take_off:
|
||||
* Get the armor off of the players back
|
||||
*/
|
||||
take_off()
|
||||
void
|
||||
take_off(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
|
||||
|
|
@ -69,9 +71,8 @@ take_off()
|
|||
* initarmor:
|
||||
* Initialize some armor.
|
||||
*/
|
||||
initarmor(obj, what)
|
||||
struct object *obj;
|
||||
int what;
|
||||
void
|
||||
initarmor(struct object *obj, int what)
|
||||
{
|
||||
struct init_armor *iwa;
|
||||
struct magic_item *mi;
|
||||
|
|
@ -90,8 +91,8 @@ int what;
|
|||
* hurt_armor:
|
||||
* Returns TRUE if armor is damaged
|
||||
*/
|
||||
hurt_armor(obj)
|
||||
struct object *obj;
|
||||
bool
|
||||
hurt_armor(struct object *obj)
|
||||
{
|
||||
reg int type, ac;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,19 +14,24 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
#define FARAWAY 32767
|
||||
#define RDIST(a, b) (DISTANCE((a)->y, (a)->x, (b).y, (b).x))
|
||||
|
||||
int do_chase(struct linked_list *mon);
|
||||
int chase(struct thing *tp, struct coord *ee, bool runaway, bool dofight);
|
||||
|
||||
struct coord ch_ret; /* Where chasing takes you */
|
||||
|
||||
/*
|
||||
* runners:
|
||||
* Make all the running monsters move.
|
||||
*/
|
||||
runners()
|
||||
void
|
||||
runners(void)
|
||||
{
|
||||
reg struct thing *tp;
|
||||
reg struct linked_list *mon,*nextmon;
|
||||
|
|
@ -54,8 +59,8 @@ runners()
|
|||
* do_chase:
|
||||
* Make one thing chase another.
|
||||
*/
|
||||
do_chase(mon)
|
||||
struct linked_list *mon;
|
||||
int
|
||||
do_chase(struct linked_list *mon)
|
||||
{
|
||||
reg struct thing *th;
|
||||
reg struct room *rer, *ree, *rxx;
|
||||
|
|
@ -241,10 +246,8 @@ struct linked_list *mon;
|
|||
* chasee. Returns TRUE if we want to keep on chasing
|
||||
* later FALSE if we reach the goal.
|
||||
*/
|
||||
chase(tp, ee, runaway, dofight)
|
||||
struct thing *tp;
|
||||
struct coord *ee;
|
||||
bool runaway, dofight;
|
||||
int
|
||||
chase(struct thing *tp, struct coord *ee, bool runaway, bool dofight)
|
||||
{
|
||||
reg int x, y, ch;
|
||||
reg int dist, thisdist, closest;
|
||||
|
|
@ -385,9 +388,8 @@ bool runaway, dofight;
|
|||
* runto:
|
||||
* Set a monster running after something
|
||||
*/
|
||||
runto(runner, spot)
|
||||
struct coord *runner;
|
||||
struct coord *spot;
|
||||
void
|
||||
runto(struct coord *runner, struct coord *spot)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct thing *tp;
|
||||
|
|
@ -409,8 +411,7 @@ struct coord *spot;
|
|||
* NULL means they aren't in any room.
|
||||
*/
|
||||
struct room *
|
||||
roomin(cp)
|
||||
struct coord *cp;
|
||||
roomin(struct coord *cp)
|
||||
{
|
||||
reg struct room *rp;
|
||||
|
||||
|
|
@ -428,8 +429,7 @@ struct coord *cp;
|
|||
* Find the monster from his coordinates
|
||||
*/
|
||||
struct linked_list *
|
||||
find_mons(y, x)
|
||||
int y, x;
|
||||
find_mons(int y, int x)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct thing *th;
|
||||
|
|
@ -447,8 +447,8 @@ int y, x;
|
|||
* diag_ok:
|
||||
* Check to see if the move is legal if it is diagonal
|
||||
*/
|
||||
diag_ok(sp, ep)
|
||||
struct coord *sp, *ep;
|
||||
bool
|
||||
diag_ok(struct coord *sp, struct coord *ep)
|
||||
{
|
||||
if (ep->x == sp->x || ep->y == sp->y)
|
||||
return TRUE;
|
||||
|
|
@ -462,8 +462,8 @@ struct coord *sp, *ep;
|
|||
* cansee:
|
||||
* returns true if the hero can see a certain coordinate.
|
||||
*/
|
||||
cansee(y, x)
|
||||
int y, x;
|
||||
bool
|
||||
cansee(int y, int x)
|
||||
{
|
||||
reg struct room *rer;
|
||||
struct coord tp;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,19 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
void search(void);
|
||||
void help(void);
|
||||
void d_level(void);
|
||||
void u_level(void);
|
||||
void shell(void);
|
||||
void call(void);
|
||||
|
||||
/*
|
||||
* command:
|
||||
* Process the user commands
|
||||
*/
|
||||
command()
|
||||
void
|
||||
command(void)
|
||||
{
|
||||
reg char ch;
|
||||
reg int ntimes = 1; /* Number of player moves */
|
||||
|
|
@ -416,7 +424,8 @@ quit(int a)
|
|||
* Player gropes about him to find hidden things.
|
||||
*/
|
||||
|
||||
search()
|
||||
void
|
||||
search(void)
|
||||
{
|
||||
reg int x, y;
|
||||
reg char ch;
|
||||
|
|
@ -461,7 +470,8 @@ search()
|
|||
* help:
|
||||
* Give single character help, or the whole mess if he wants it
|
||||
*/
|
||||
help()
|
||||
void
|
||||
help(void)
|
||||
{
|
||||
extern struct h_list helpstr[];
|
||||
reg struct h_list *strp;
|
||||
|
|
@ -519,8 +529,7 @@ help()
|
|||
* Tell the player what a certain thing is.
|
||||
*/
|
||||
char *
|
||||
identify(what)
|
||||
int what;
|
||||
identify(int what)
|
||||
{
|
||||
reg char ch, *str;
|
||||
|
||||
|
|
@ -581,7 +590,8 @@ int what;
|
|||
* d_level:
|
||||
* He wants to go down a level
|
||||
*/
|
||||
d_level()
|
||||
void
|
||||
d_level(void)
|
||||
{
|
||||
if (winat(hero.y, hero.x) != STAIRS)
|
||||
msg("I see no way down.");
|
||||
|
|
@ -599,7 +609,8 @@ d_level()
|
|||
* u_level:
|
||||
* He wants to go up a level
|
||||
*/
|
||||
u_level()
|
||||
void
|
||||
u_level(void)
|
||||
{
|
||||
if (winat(hero.y, hero.x) == STAIRS) {
|
||||
if (pl_on(ISHELD)) {
|
||||
|
|
@ -624,7 +635,8 @@ u_level()
|
|||
/*
|
||||
* Let him escape for a while
|
||||
*/
|
||||
shell()
|
||||
void
|
||||
shell(void)
|
||||
{
|
||||
reg int pid;
|
||||
reg char *sh;
|
||||
|
|
@ -659,7 +671,8 @@ shell()
|
|||
* call:
|
||||
* Allow a user to call a potion, scroll, or ring something
|
||||
*/
|
||||
call()
|
||||
void
|
||||
call(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *item;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ struct delayed_action d_list[MAXDAEMONS] = {
|
|||
* Insert a function in the daemon list.
|
||||
*/
|
||||
struct delayed_action *
|
||||
d_insert(func, arg, type, time)
|
||||
int arg, type, time, (*func)();
|
||||
d_insert(int (*func)(), int arg, int type, int time)
|
||||
{
|
||||
reg struct delayed_action *dev;
|
||||
|
||||
|
|
@ -51,8 +50,8 @@ int arg, type, time, (*func)();
|
|||
return NULL;
|
||||
}
|
||||
|
||||
d_delete(wire)
|
||||
struct delayed_action *wire;
|
||||
void
|
||||
d_delete(struct delayed_action *wire)
|
||||
{
|
||||
reg struct delayed_action *d1, *d2;
|
||||
|
||||
|
|
@ -73,8 +72,7 @@ struct delayed_action *wire;
|
|||
* Find a particular slot in the table
|
||||
*/
|
||||
struct delayed_action *
|
||||
find_slot(func)
|
||||
int (*func)();
|
||||
find_slot(int (*func)())
|
||||
{
|
||||
reg struct delayed_action *dev;
|
||||
|
||||
|
|
@ -88,8 +86,8 @@ int (*func)();
|
|||
* start_daemon:
|
||||
* Start a daemon, takes a function.
|
||||
*/
|
||||
start_daemon(func, arg, type)
|
||||
int arg, type, (*func)();
|
||||
void
|
||||
start_daemon(int (*func)(), int arg, int type)
|
||||
{
|
||||
d_insert(func, arg, type, DAEMON);
|
||||
}
|
||||
|
|
@ -99,8 +97,8 @@ int arg, type, (*func)();
|
|||
* Run all the daemons that are active with the current
|
||||
* flag, passing the argument to the function.
|
||||
*/
|
||||
do_daemons(flag)
|
||||
int flag;
|
||||
void
|
||||
do_daemons(int flag)
|
||||
{
|
||||
reg struct delayed_action *dev;
|
||||
|
||||
|
|
@ -113,8 +111,8 @@ int flag;
|
|||
* fuse:
|
||||
* Start a fuse to go off in a certain number of turns
|
||||
*/
|
||||
fuse(func, arg, time)
|
||||
int (*func)(), arg, time;
|
||||
void
|
||||
fuse(int (*func)(), int arg, int time)
|
||||
{
|
||||
d_insert(func, arg, AFTER, time);
|
||||
}
|
||||
|
|
@ -123,8 +121,8 @@ int (*func)(), arg, time;
|
|||
* lengthen:
|
||||
* Increase the time until a fuse goes off
|
||||
*/
|
||||
lengthen(func, xtime)
|
||||
int (*func)(), xtime;
|
||||
void
|
||||
lengthen(int (*func)(), int xtime)
|
||||
{
|
||||
reg struct delayed_action *wire;
|
||||
|
||||
|
|
@ -137,8 +135,8 @@ int (*func)(), xtime;
|
|||
* extinguish:
|
||||
* Put out a fuse. Find all such fuses and kill them.
|
||||
*/
|
||||
extinguish(func)
|
||||
int (*func)();
|
||||
void
|
||||
extinguish(int (*func)())
|
||||
{
|
||||
reg struct delayed_action *dev;
|
||||
|
||||
|
|
@ -151,7 +149,8 @@ int (*func)();
|
|||
* do_fuses:
|
||||
* Decrement counters and start needed fuses
|
||||
*/
|
||||
do_fuses()
|
||||
void
|
||||
do_fuses(void)
|
||||
{
|
||||
reg struct delayed_action *dev;
|
||||
|
||||
|
|
@ -170,7 +169,8 @@ do_fuses()
|
|||
* activity:
|
||||
* Show wizard number of demaons and memory blocks used
|
||||
*/
|
||||
activity()
|
||||
void
|
||||
activity(void)
|
||||
{
|
||||
msg("Daemons = %d : Memory Items = %d : Memory Used = %d",
|
||||
demoncnt,total,md_memused());
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ int between = 0;
|
|||
* doctor:
|
||||
* A healing daemon that restores hit points after rest
|
||||
*/
|
||||
doctor(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
doctor(int fromfuse)
|
||||
{
|
||||
reg int *thp, lv, ohp, ccon;
|
||||
|
||||
|
|
@ -63,8 +63,8 @@ int fromfuse;
|
|||
* Swander:
|
||||
* Called when it is time to start rolling for wandering monsters
|
||||
*/
|
||||
swander(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
swander(int fromfuse)
|
||||
{
|
||||
start_daemon(rollwand, TRUE, AFTER);
|
||||
}
|
||||
|
|
@ -74,8 +74,8 @@ int fromfuse;
|
|||
* rollwand:
|
||||
* Called to roll to see if a wandering monster starts up
|
||||
*/
|
||||
rollwand(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
rollwand(int fromfuse)
|
||||
{
|
||||
|
||||
if (++between >= 4) {
|
||||
|
|
@ -94,8 +94,8 @@ int fromfuse;
|
|||
* unconfuse:
|
||||
* Release the poor player from his confusion
|
||||
*/
|
||||
unconfuse(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
unconfuse(int fromfuse)
|
||||
{
|
||||
if (pl_on(ISHUH))
|
||||
msg("You feel less confused now.");
|
||||
|
|
@ -106,8 +106,8 @@ int fromfuse;
|
|||
* unsee:
|
||||
* He lost his see invisible power
|
||||
*/
|
||||
unsee(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
unsee(int fromfuse)
|
||||
{
|
||||
player.t_flags &= ~CANSEE;
|
||||
}
|
||||
|
|
@ -116,8 +116,8 @@ int fromfuse;
|
|||
* sight:
|
||||
* He gets his sight back
|
||||
*/
|
||||
sight(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
sight(int fromfuse)
|
||||
{
|
||||
if (pl_on(ISBLIND))
|
||||
msg("The veil of darkness lifts.");
|
||||
|
|
@ -129,8 +129,8 @@ int fromfuse;
|
|||
* nohaste:
|
||||
* End the hasting
|
||||
*/
|
||||
nohaste(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
nohaste(int fromfuse)
|
||||
{
|
||||
if (pl_on(ISHASTE))
|
||||
msg("You feel yourself slowing down.");
|
||||
|
|
@ -142,8 +142,8 @@ int fromfuse;
|
|||
* stomach:
|
||||
* Digest the hero's food
|
||||
*/
|
||||
stomach(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
stomach(int fromfuse)
|
||||
{
|
||||
reg int oldfood, old_hunger;
|
||||
|
||||
|
|
@ -188,8 +188,8 @@ int fromfuse;
|
|||
* noteth:
|
||||
* Hero is no longer etherereal
|
||||
*/
|
||||
noteth(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
noteth(int fromfuse)
|
||||
{
|
||||
int ch;
|
||||
|
||||
|
|
@ -209,8 +209,8 @@ int fromfuse;
|
|||
* sapem:
|
||||
* Sap the hero's life away
|
||||
*/
|
||||
sapem(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
sapem(int fromfuse)
|
||||
{
|
||||
chg_abil(rnd(4) + 1, -1, TRUE);
|
||||
fuse(sapem, TRUE, 150);
|
||||
|
|
@ -221,8 +221,8 @@ int fromfuse;
|
|||
* notslow:
|
||||
* Restore the hero's normal speed
|
||||
*/
|
||||
notslow(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
notslow(int fromfuse)
|
||||
{
|
||||
if (pl_on(ISSLOW))
|
||||
msg("You no longer feel hindered.");
|
||||
|
|
@ -233,8 +233,8 @@ int fromfuse;
|
|||
* notregen:
|
||||
* Hero is no longer regenerative
|
||||
*/
|
||||
notregen(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
notregen(int fromfuse)
|
||||
{
|
||||
if (pl_on(ISREGEN))
|
||||
msg("You no longer feel bolstered.");
|
||||
|
|
@ -245,8 +245,8 @@ int fromfuse;
|
|||
* notinvinc:
|
||||
* Hero not invincible any more
|
||||
*/
|
||||
notinvinc(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
notinvinc(int fromfuse)
|
||||
{
|
||||
if (pl_on(ISINVINC))
|
||||
msg("You no longer feel invincible.");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
* displevl:
|
||||
* Display detailed level for wizard and scroll
|
||||
*/
|
||||
displevl()
|
||||
void
|
||||
displevl(void)
|
||||
{
|
||||
reg char ch, mch;
|
||||
reg int i,j;
|
||||
|
|
@ -73,7 +74,8 @@ displevl()
|
|||
* dispmons:
|
||||
* Show monsters for wizard and potion
|
||||
*/
|
||||
dispmons()
|
||||
void
|
||||
dispmons(void)
|
||||
{
|
||||
reg int ch, y, x;
|
||||
reg struct thing *it;
|
||||
|
|
@ -95,8 +97,8 @@ dispmons()
|
|||
* winat:
|
||||
* Get whatever character is at a location on the screen
|
||||
*/
|
||||
winat(y, x)
|
||||
int x, y;
|
||||
char
|
||||
winat(int y, int x)
|
||||
{
|
||||
reg char ch;
|
||||
|
||||
|
|
@ -111,8 +113,8 @@ int x, y;
|
|||
* cordok:
|
||||
* Returns TRUE if coordinate is on usable screen
|
||||
*/
|
||||
cordok(y, x)
|
||||
int y, x;
|
||||
bool
|
||||
cordok(int y, int x)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= COLS || y >= LINES - 1)
|
||||
return FALSE;
|
||||
|
|
@ -123,8 +125,8 @@ int y, x;
|
|||
* pl_on:
|
||||
* Returns TRUE if the player's flag is set
|
||||
*/
|
||||
pl_on(what)
|
||||
long what;
|
||||
bool
|
||||
pl_on(long what)
|
||||
{
|
||||
return (player.t_flags & what);
|
||||
}
|
||||
|
|
@ -134,8 +136,8 @@ long what;
|
|||
* pl_off:
|
||||
* Returns TRUE when player's flag is reset
|
||||
*/
|
||||
pl_off(what)
|
||||
long what;
|
||||
bool
|
||||
pl_off(long what)
|
||||
{
|
||||
return (!(player.t_flags & what));
|
||||
}
|
||||
|
|
@ -145,9 +147,8 @@ long what;
|
|||
* o_on:
|
||||
* Returns TRUE in the objects flag is set
|
||||
*/
|
||||
o_on(what,bit)
|
||||
struct object *what;
|
||||
long bit;
|
||||
bool
|
||||
o_on(struct object *what, long bit)
|
||||
{
|
||||
reg int flag;
|
||||
|
||||
|
|
@ -162,9 +163,8 @@ long bit;
|
|||
* o_off:
|
||||
* Returns TRUE is the objects flag is reset
|
||||
*/
|
||||
o_off(what,bit)
|
||||
struct object *what;
|
||||
long bit;
|
||||
bool
|
||||
o_off(struct object *what, long bit)
|
||||
{
|
||||
reg int flag;
|
||||
|
||||
|
|
@ -179,9 +179,8 @@ long bit;
|
|||
* setoflg:
|
||||
* Set the specified flag for the object
|
||||
*/
|
||||
setoflg(what,bit)
|
||||
struct object *what;
|
||||
long bit;
|
||||
void
|
||||
setoflg(struct object *what, long bit)
|
||||
{
|
||||
what->o_flags |= bit;
|
||||
}
|
||||
|
|
@ -191,9 +190,8 @@ long bit;
|
|||
* resoflg:
|
||||
* Reset the specified flag for the object
|
||||
*/
|
||||
resoflg(what,bit)
|
||||
struct object *what;
|
||||
long bit;
|
||||
void
|
||||
resoflg(struct object *what, long bit)
|
||||
{
|
||||
what->o_flags &= ~bit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,19 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
int packweight(void);
|
||||
int pack_vol(void);
|
||||
|
||||
/*
|
||||
* updpack:
|
||||
* Update his pack weight and adjust fooduse accordingly
|
||||
*/
|
||||
updpack()
|
||||
void
|
||||
updpack(void)
|
||||
{
|
||||
reg int topcarry, curcarry;
|
||||
|
||||
|
|
@ -44,7 +49,8 @@ updpack()
|
|||
* packweight:
|
||||
* Get the total weight of the hero's pack
|
||||
*/
|
||||
packweight()
|
||||
int
|
||||
packweight(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *pc;
|
||||
|
|
@ -72,8 +78,8 @@ packweight()
|
|||
* itemweight:
|
||||
* Get the weight of an object
|
||||
*/
|
||||
itemweight(wh)
|
||||
struct object *wh;
|
||||
int
|
||||
itemweight(struct object *wh)
|
||||
{
|
||||
reg int weight;
|
||||
|
||||
|
|
@ -97,7 +103,8 @@ struct object *wh;
|
|||
* pack_vol:
|
||||
* Get the total volume of the hero's pack
|
||||
*/
|
||||
pack_vol()
|
||||
int
|
||||
pack_vol(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *pc;
|
||||
|
|
@ -115,8 +122,8 @@ pack_vol()
|
|||
* itemvol:
|
||||
* Get the volume of an object
|
||||
*/
|
||||
itemvol(wh)
|
||||
struct object *wh;
|
||||
int
|
||||
itemvol(struct object *wh)
|
||||
{
|
||||
reg int volume, what, extra;
|
||||
|
||||
|
|
@ -139,9 +146,10 @@ struct object *wh;
|
|||
* playenc:
|
||||
* Get hero's carrying ability above norm
|
||||
*/
|
||||
playenc()
|
||||
int
|
||||
playenc(void)
|
||||
{
|
||||
reg estr = him->s_ef.a_str;
|
||||
reg int estr = him->s_ef.a_str;
|
||||
if (estr >= 24)
|
||||
return 3000;
|
||||
switch(him->s_ef.a_str) {
|
||||
|
|
@ -174,7 +182,8 @@ playenc()
|
|||
* totalenc:
|
||||
* Get total weight that the hero can carry
|
||||
*/
|
||||
totalenc()
|
||||
int
|
||||
totalenc(void)
|
||||
{
|
||||
reg int wtotal;
|
||||
|
||||
|
|
@ -192,8 +201,8 @@ totalenc()
|
|||
* whgtchk:
|
||||
* See if the hero can carry his pack
|
||||
*/
|
||||
wghtchk(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
wghtchk(int fromfuse)
|
||||
{
|
||||
reg int dropchk, err = TRUE;
|
||||
reg char ch;
|
||||
|
|
@ -231,7 +240,8 @@ int fromfuse;
|
|||
* 0 hit for medium pack weight
|
||||
* -1 hit for heavy pack weight
|
||||
*/
|
||||
hitweight()
|
||||
int
|
||||
hitweight(void)
|
||||
{
|
||||
return(2 - foodlev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,19 +14,26 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
bool roll_em(struct stats *att, struct stats *def, struct object *weap, bool hurl);
|
||||
char *mindex(char *cp, char c);
|
||||
char *prname(char *who, bool upper);
|
||||
void hit(char *er);
|
||||
void miss(char *er);
|
||||
void thunk(struct object *weap, char *mname);
|
||||
void bounce(struct object *weap, char *mname);
|
||||
|
||||
/*
|
||||
* fight:
|
||||
* The player attacks the monster.
|
||||
*/
|
||||
fight(mp, weap, thrown)
|
||||
struct coord *mp;
|
||||
struct object *weap;
|
||||
bool thrown;
|
||||
bool
|
||||
fight(struct coord *mp, struct object *weap, bool thrown)
|
||||
{
|
||||
|
||||
reg struct thing *tp;
|
||||
|
|
@ -123,8 +130,8 @@ bool thrown;
|
|||
* attack:
|
||||
* The monster attacks the player
|
||||
*/
|
||||
attack(mp)
|
||||
struct thing *mp;
|
||||
int
|
||||
attack(struct thing *mp)
|
||||
{
|
||||
reg char *mname;
|
||||
|
||||
|
|
@ -349,8 +356,8 @@ struct thing *mp;
|
|||
* swing:
|
||||
* Returns true if the swing hits
|
||||
*/
|
||||
swing(at_lvl, op_arm, wplus)
|
||||
int at_lvl, op_arm, wplus;
|
||||
bool
|
||||
swing(int at_lvl, int op_arm, int wplus)
|
||||
{
|
||||
reg int res = rnd(20)+1;
|
||||
reg int need = (21 - at_lvl) - op_arm;
|
||||
|
|
@ -363,7 +370,8 @@ int at_lvl, op_arm, wplus;
|
|||
* check_level:
|
||||
* Check to see if the guy has gone up a level.
|
||||
*/
|
||||
check_level()
|
||||
void
|
||||
check_level(void)
|
||||
{
|
||||
reg int lev, add, dif;
|
||||
|
||||
|
|
@ -387,15 +395,12 @@ check_level()
|
|||
* roll_em:
|
||||
* Roll several attacks
|
||||
*/
|
||||
roll_em(att, def, weap, hurl)
|
||||
struct stats *att, *def;
|
||||
struct object *weap;
|
||||
bool hurl;
|
||||
bool
|
||||
roll_em(struct stats *att, struct stats *def, struct object *weap, bool hurl)
|
||||
{
|
||||
reg char *cp;
|
||||
reg int ndice, nsides, def_arm, prop_hplus, prop_dplus;
|
||||
reg bool did_hit = FALSE;
|
||||
char *mindex();
|
||||
|
||||
prop_hplus = prop_dplus = 0;
|
||||
if (weap == NULL) {
|
||||
|
|
@ -479,8 +484,7 @@ bool hurl;
|
|||
* Look for char 'c' in string pointed to by 'cp'
|
||||
*/
|
||||
char *
|
||||
mindex(cp, c)
|
||||
char *cp, c;
|
||||
mindex(char *cp, char c)
|
||||
{
|
||||
reg int i;
|
||||
|
||||
|
|
@ -498,9 +502,7 @@ char *cp, c;
|
|||
* The print name of a combatant
|
||||
*/
|
||||
char *
|
||||
prname(who, upper)
|
||||
char *who;
|
||||
bool upper;
|
||||
prname(char *who, bool upper)
|
||||
{
|
||||
static char tbuf[LINLEN];
|
||||
|
||||
|
|
@ -522,8 +524,8 @@ static char tbuf[LINLEN];
|
|||
* hit:
|
||||
* Print a message to indicate a succesful hit
|
||||
*/
|
||||
hit(er)
|
||||
char *er;
|
||||
void
|
||||
hit(char *er)
|
||||
{
|
||||
msg("%s hit.",prname(er, TRUE));
|
||||
}
|
||||
|
|
@ -533,8 +535,8 @@ char *er;
|
|||
* miss:
|
||||
* Print a message to indicate a poor swing
|
||||
*/
|
||||
miss(er)
|
||||
char *er;
|
||||
void
|
||||
miss(char *er)
|
||||
{
|
||||
msg("%s miss%s.",prname(er, TRUE),(er == 0 ? "":"es"));
|
||||
}
|
||||
|
|
@ -544,9 +546,8 @@ char *er;
|
|||
* save_throw:
|
||||
* See if a creature saves against something
|
||||
*/
|
||||
save_throw(which, tp)
|
||||
int which;
|
||||
struct thing *tp;
|
||||
bool
|
||||
save_throw(int which, struct thing *tp)
|
||||
{
|
||||
reg int need;
|
||||
reg struct stats *st;
|
||||
|
|
@ -561,8 +562,8 @@ struct thing *tp;
|
|||
* save:
|
||||
* See if he saves against various nasty things
|
||||
*/
|
||||
save(which)
|
||||
int which;
|
||||
bool
|
||||
save(int which)
|
||||
{
|
||||
return save_throw(which, &player);
|
||||
}
|
||||
|
|
@ -571,7 +572,8 @@ int which;
|
|||
* raise_level:
|
||||
* The guy just magically went up a level.
|
||||
*/
|
||||
raise_level()
|
||||
void
|
||||
raise_level(void)
|
||||
{
|
||||
him->s_exp = e_levels[him->s_lvl-1] + 1L;
|
||||
check_level();
|
||||
|
|
@ -582,9 +584,8 @@ raise_level()
|
|||
* thunk:
|
||||
* A missile hits a monster
|
||||
*/
|
||||
thunk(weap, mname)
|
||||
struct object *weap;
|
||||
char *mname;
|
||||
void
|
||||
thunk(struct object *weap, char *mname)
|
||||
{
|
||||
if (weap->o_type == WEAPON)
|
||||
msg("The %s hits the %s.",w_magic[weap->o_which].mi_name,mname);
|
||||
|
|
@ -597,9 +598,8 @@ char *mname;
|
|||
* bounce:
|
||||
* A missile misses a monster
|
||||
*/
|
||||
bounce(weap, mname)
|
||||
struct object *weap;
|
||||
char *mname;
|
||||
void
|
||||
bounce(struct object *weap, char *mname)
|
||||
{
|
||||
if (weap->o_type == WEAPON)
|
||||
msg("The %s misses the %s.", w_magic[weap->o_which].mi_name,mname);
|
||||
|
|
@ -612,9 +612,8 @@ char *mname;
|
|||
* remove:
|
||||
* Remove a monster from the screen
|
||||
*/
|
||||
remove_monster(mp, item)
|
||||
struct coord *mp;
|
||||
struct linked_list *item;
|
||||
void
|
||||
remove_monster(struct coord *mp, struct linked_list *item)
|
||||
{
|
||||
reg char what;
|
||||
|
||||
|
|
@ -633,8 +632,8 @@ struct linked_list *item;
|
|||
* is_magic:
|
||||
* Returns true if an object radiates magic
|
||||
*/
|
||||
is_magic(obj)
|
||||
struct object *obj;
|
||||
bool
|
||||
is_magic(struct object *obj)
|
||||
{
|
||||
switch (obj->o_type) {
|
||||
case ARMOR:
|
||||
|
|
@ -656,9 +655,8 @@ struct object *obj;
|
|||
* killed:
|
||||
* Called to put a monster to death
|
||||
*/
|
||||
killed(item, pr)
|
||||
struct linked_list *item;
|
||||
bool pr;
|
||||
void
|
||||
killed(struct linked_list *item, bool pr)
|
||||
{
|
||||
reg struct thing *tp;
|
||||
reg struct object *obj;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
int pinit(void);
|
||||
void badcheck(char *name, struct magic_item *magic);
|
||||
|
||||
char *rainbow[NCOLORS] = {
|
||||
"Red", "Blue", "Green", "Yellow",
|
||||
"Black", "Brown", "Orange", "Pink",
|
||||
|
|
@ -81,25 +84,12 @@ char *metal[NMETAL] = {
|
|||
"Tin", "Titanium", "Zinc",
|
||||
};
|
||||
|
||||
/*
|
||||
* init_everything:
|
||||
* Set up all important stuff.
|
||||
*/
|
||||
init_everything()
|
||||
{
|
||||
init_player(); /* Roll up the rogue */
|
||||
init_things(); /* Set up probabilities */
|
||||
init_names(); /* Set up names of scrolls */
|
||||
init_colors(); /* Set up colors of potions */
|
||||
init_stones(); /* Set up stones in rings */
|
||||
init_materials(); /* Set up materials of wands */
|
||||
}
|
||||
|
||||
/*
|
||||
* init_things:
|
||||
* Initialize the probabilities for types of things
|
||||
*/
|
||||
init_things()
|
||||
void
|
||||
init_things(void)
|
||||
{
|
||||
struct magic_item *mi;
|
||||
|
||||
|
|
@ -128,7 +118,8 @@ init_things()
|
|||
* init_colors:
|
||||
* Initialize the potion color scheme for this time
|
||||
*/
|
||||
init_colors()
|
||||
void
|
||||
init_colors(void)
|
||||
{
|
||||
reg int i, j;
|
||||
reg char *str;
|
||||
|
|
@ -155,7 +146,8 @@ init_colors()
|
|||
* init_names:
|
||||
* Generate the names of the various scrolls
|
||||
*/
|
||||
init_names()
|
||||
void
|
||||
init_names(void)
|
||||
{
|
||||
reg int nsyl;
|
||||
reg char *cp, *sp;
|
||||
|
|
@ -189,7 +181,8 @@ init_names()
|
|||
* Initialize the ring stone setting scheme for this time
|
||||
*/
|
||||
|
||||
init_stones()
|
||||
void
|
||||
init_stones(void)
|
||||
{
|
||||
reg int i, j;
|
||||
reg char *str;
|
||||
|
|
@ -217,7 +210,8 @@ init_stones()
|
|||
* Initialize the construction materials for wands and staffs
|
||||
*/
|
||||
|
||||
init_materials()
|
||||
void
|
||||
init_materials(void)
|
||||
{
|
||||
int i, j;
|
||||
char *str;
|
||||
|
|
@ -264,9 +258,8 @@ init_materials()
|
|||
badcheck("sticks", ws_magic);
|
||||
}
|
||||
|
||||
badcheck(name, magic)
|
||||
char *name;
|
||||
struct magic_item *magic;
|
||||
void
|
||||
badcheck(char *name, struct magic_item *magic)
|
||||
{
|
||||
struct magic_item *mg;
|
||||
|
||||
|
|
@ -289,7 +282,8 @@ struct magic_item *magic;
|
|||
* roll up the rogue
|
||||
*/
|
||||
|
||||
init_player()
|
||||
void
|
||||
init_player(void)
|
||||
{
|
||||
player.t_nomove = 0;
|
||||
player.t_nocmd = 0;
|
||||
|
|
@ -315,7 +309,8 @@ init_player()
|
|||
* pinit:
|
||||
* Returns the best 3 of 4 on a 6-sided die
|
||||
*/
|
||||
pinit()
|
||||
int
|
||||
pinit(void)
|
||||
{
|
||||
int best[4];
|
||||
reg int i, min, minind, dicetot;
|
||||
|
|
@ -337,3 +332,18 @@ pinit()
|
|||
}
|
||||
return(dicetot);
|
||||
}
|
||||
|
||||
/*
|
||||
* init_everything:
|
||||
* Set up all important stuff.
|
||||
*/
|
||||
void
|
||||
init_everything(void)
|
||||
{
|
||||
init_player(); /* Roll up the rogue */
|
||||
init_things(); /* Set up probabilities */
|
||||
init_names(); /* Set up names of scrolls */
|
||||
init_colors(); /* Set up colors of potions */
|
||||
init_stones(); /* Set up stones in rings */
|
||||
init_materials(); /* Set up materials of wands */
|
||||
}
|
||||
|
|
|
|||
48
srogue/io.c
48
srogue/io.c
|
|
@ -20,7 +20,7 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
int md_readchar(WINDOW *win);
|
||||
void doadd(char *fmt, va_list ap);
|
||||
|
||||
/*
|
||||
* msg:
|
||||
|
|
@ -29,6 +29,7 @@ int md_readchar(WINDOW *win);
|
|||
static char msgbuf[BUFSIZ];
|
||||
static int newpos = 0;
|
||||
|
||||
void
|
||||
msg(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
@ -54,6 +55,7 @@ msg(char *fmt, ...)
|
|||
* addmsg:
|
||||
* Add things to the current message
|
||||
*/
|
||||
void
|
||||
addmsg(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
@ -68,7 +70,8 @@ addmsg(char *fmt, ...)
|
|||
* Display a new msg, giving him a chance to see the
|
||||
* previous one if it is up there with the --More--
|
||||
*/
|
||||
endmsg()
|
||||
void
|
||||
endmsg(void)
|
||||
{
|
||||
strcpy(huh, msgbuf);
|
||||
if (mpos > 0) {
|
||||
|
|
@ -88,6 +91,7 @@ endmsg()
|
|||
* doadd:
|
||||
* Perform a printf into a buffer
|
||||
*/
|
||||
void
|
||||
doadd(char *fmt, va_list ap)
|
||||
{
|
||||
vsprintf(&msgbuf[newpos], fmt, ap);
|
||||
|
|
@ -98,8 +102,8 @@ doadd(char *fmt, va_list ap)
|
|||
* step_ok:
|
||||
* Returns TRUE if it is ok to step on ch
|
||||
*/
|
||||
step_ok(ch)
|
||||
unsigned char ch;
|
||||
bool
|
||||
step_ok(unsigned char ch)
|
||||
{
|
||||
if (dead_end(ch))
|
||||
return FALSE;
|
||||
|
|
@ -113,8 +117,8 @@ unsigned char ch;
|
|||
* dead_end:
|
||||
* Returns TRUE if you cant walk through that character
|
||||
*/
|
||||
dead_end(ch)
|
||||
char ch;
|
||||
bool
|
||||
dead_end(char ch)
|
||||
{
|
||||
if (ch == '-' || ch == '|' || ch == ' ' || ch == SECRETDOOR)
|
||||
return TRUE;
|
||||
|
|
@ -129,7 +133,8 @@ char ch;
|
|||
* getchar.
|
||||
*/
|
||||
|
||||
readchar()
|
||||
int
|
||||
readchar(void)
|
||||
{
|
||||
char c;
|
||||
|
||||
|
|
@ -148,8 +153,8 @@ char *hungstr[] = {
|
|||
* status:
|
||||
* Display the important stats line. Keep the cursor where it was.
|
||||
*/
|
||||
status(fromfuse)
|
||||
int fromfuse;
|
||||
void
|
||||
status(int fromfuse)
|
||||
{
|
||||
reg int totwght, carwght;
|
||||
reg struct real *stef, *stre, *stmx;
|
||||
|
|
@ -220,7 +225,8 @@ int fromfuse;
|
|||
* dispmax:
|
||||
* Display the hero's maximum status
|
||||
*/
|
||||
dispmax()
|
||||
void
|
||||
dispmax(void)
|
||||
{
|
||||
reg struct real *hmax;
|
||||
|
||||
|
|
@ -233,8 +239,8 @@ dispmax()
|
|||
* illeg_ch:
|
||||
* Returns TRUE if a char shouldn't show on the screen
|
||||
*/
|
||||
illeg_ch(ch)
|
||||
unsigned char ch;
|
||||
bool
|
||||
illeg_ch(unsigned char ch)
|
||||
{
|
||||
if (ch < 32 || ch > 127)
|
||||
return TRUE;
|
||||
|
|
@ -247,9 +253,8 @@ unsigned char ch;
|
|||
* wait_for:
|
||||
* Sit around until the guy types the right key
|
||||
*/
|
||||
wait_for(win,ch)
|
||||
WINDOW *win;
|
||||
char ch;
|
||||
void
|
||||
wait_for(WINDOW *win, char ch)
|
||||
{
|
||||
register char c;
|
||||
|
||||
|
|
@ -293,9 +298,8 @@ gettime()
|
|||
* dbotline:
|
||||
* Displays message on bottom line and waits for a space to return
|
||||
*/
|
||||
dbotline(scr,message)
|
||||
WINDOW *scr;
|
||||
char *message;
|
||||
void
|
||||
dbotline(WINDOW *scr, char *message)
|
||||
{
|
||||
mvwaddstr(scr,LINES-1,0,message);
|
||||
draw(scr);
|
||||
|
|
@ -307,8 +311,8 @@ char *message;
|
|||
* restscr:
|
||||
* Restores the screen to the terminal
|
||||
*/
|
||||
restscr(scr)
|
||||
WINDOW *scr;
|
||||
void
|
||||
restscr(WINDOW *scr)
|
||||
{
|
||||
clearok(scr,TRUE);
|
||||
touchwin(scr);
|
||||
|
|
@ -318,8 +322,8 @@ WINDOW *scr;
|
|||
* npch:
|
||||
* Get the next char in line for inventories
|
||||
*/
|
||||
npch(ch)
|
||||
char ch;
|
||||
char
|
||||
npch(char ch)
|
||||
{
|
||||
reg char nch;
|
||||
if (ch >= 'z')
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
* Takes an item out of whatever linked list it might be in
|
||||
*/
|
||||
|
||||
_detach(list, item)
|
||||
struct linked_list **list, *item;
|
||||
void
|
||||
_detach(struct linked_list **list, struct linked_list *item)
|
||||
{
|
||||
if (*list == item)
|
||||
*list = next(item);
|
||||
|
|
@ -39,8 +39,8 @@ struct linked_list **list, *item;
|
|||
/*
|
||||
* _attach: add an item to the head of a list
|
||||
*/
|
||||
_attach(list, item)
|
||||
struct linked_list **list, *item;
|
||||
void
|
||||
_attach(struct linked_list **list, struct linked_list *item)
|
||||
{
|
||||
if (*list != NULL) {
|
||||
item->l_next = *list;
|
||||
|
|
@ -57,8 +57,8 @@ struct linked_list **list, *item;
|
|||
/*
|
||||
* _free_list: Throw the whole blamed thing away
|
||||
*/
|
||||
_free_list(ptr)
|
||||
struct linked_list **ptr;
|
||||
void
|
||||
_free_list(struct linked_list **ptr)
|
||||
{
|
||||
register struct linked_list *item;
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ struct linked_list **ptr;
|
|||
/*
|
||||
* discard: free up an item
|
||||
*/
|
||||
discard(item)
|
||||
struct linked_list *item;
|
||||
void
|
||||
discard(struct linked_list *item)
|
||||
{
|
||||
total -= 2;
|
||||
FREE(item->l_data);
|
||||
|
|
@ -84,8 +84,7 @@ struct linked_list *item;
|
|||
* new_item: get a new item with a specified size
|
||||
*/
|
||||
struct linked_list *
|
||||
new_item(size)
|
||||
int size;
|
||||
new_item(int size)
|
||||
{
|
||||
register struct linked_list *item;
|
||||
|
||||
|
|
@ -96,8 +95,7 @@ int size;
|
|||
}
|
||||
|
||||
char *
|
||||
new(size)
|
||||
int size;
|
||||
new(int size)
|
||||
{
|
||||
register char *space = ALLOC(size);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@
|
|||
|
||||
#include "rogue.ext"
|
||||
|
||||
char *roguehome(void);
|
||||
void open_records(void);
|
||||
|
||||
extern int scorefd;
|
||||
extern FILE *logfile;
|
||||
|
||||
main(argc, argv, envp)
|
||||
char **argv;
|
||||
char **envp;
|
||||
int
|
||||
main(int argc, char *argv[], char *envp[])
|
||||
{
|
||||
register char *env;
|
||||
register struct linked_list *item;
|
||||
|
|
@ -50,7 +50,6 @@ char **envp;
|
|||
char *getpass(), *xcrypt(), *strrchr();
|
||||
int lowtime;
|
||||
time_t now;
|
||||
char *roguehome();
|
||||
char *homedir = roguehome();
|
||||
|
||||
#ifdef __DJGPP__
|
||||
|
|
@ -322,8 +321,8 @@ endit(int a)
|
|||
* Exit the program, printing a message.
|
||||
*/
|
||||
|
||||
fatal(s)
|
||||
char *s;
|
||||
void
|
||||
fatal(char *s)
|
||||
{
|
||||
clear();
|
||||
refresh();
|
||||
|
|
@ -340,8 +339,7 @@ char *s;
|
|||
*/
|
||||
|
||||
void
|
||||
byebye(how)
|
||||
int how;
|
||||
byebye(int how)
|
||||
{
|
||||
if (!isendwin())
|
||||
endwin();
|
||||
|
|
@ -354,8 +352,8 @@ int how;
|
|||
* rnd:
|
||||
* Pick a very random number.
|
||||
*/
|
||||
rnd(range)
|
||||
int range;
|
||||
int
|
||||
rnd(int range)
|
||||
{
|
||||
reg int wh;
|
||||
|
||||
|
|
@ -372,8 +370,8 @@ int range;
|
|||
* roll:
|
||||
* roll a number of dice
|
||||
*/
|
||||
roll(number, sides)
|
||||
int number, sides;
|
||||
int
|
||||
roll(int number, int sides)
|
||||
{
|
||||
reg int dtotal = 0;
|
||||
|
||||
|
|
@ -386,7 +384,8 @@ int number, sides;
|
|||
/*
|
||||
** setup: Setup signal catching functions
|
||||
*/
|
||||
setup()
|
||||
void
|
||||
setup(void)
|
||||
{
|
||||
md_onsignal_autosave();
|
||||
|
||||
|
|
@ -400,7 +399,8 @@ setup()
|
|||
** refreshing things and looking at the proper times.
|
||||
*/
|
||||
|
||||
playit()
|
||||
void
|
||||
playit(void)
|
||||
{
|
||||
reg char *opts;
|
||||
|
||||
|
|
@ -421,7 +421,8 @@ playit()
|
|||
/*
|
||||
** author: See if a user is an author of the program
|
||||
*/
|
||||
author()
|
||||
bool
|
||||
author(void)
|
||||
{
|
||||
switch (playuid) {
|
||||
case 100:
|
||||
|
|
@ -444,7 +445,7 @@ directory_exists(char *dirname)
|
|||
}
|
||||
|
||||
char *
|
||||
roguehome()
|
||||
roguehome(void)
|
||||
{
|
||||
static char path[LINLEN+16];
|
||||
char *end,*home;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
* waste_time:
|
||||
* Do nothing but let other things happen
|
||||
*/
|
||||
waste_time()
|
||||
void
|
||||
waste_time(void)
|
||||
{
|
||||
if (inwhgt) /* if from wghtchk, then done */
|
||||
return;
|
||||
|
|
@ -35,8 +36,8 @@ waste_time()
|
|||
* getindex:
|
||||
* Convert a type into an index for the things structures
|
||||
*/
|
||||
getindex(what)
|
||||
char what;
|
||||
int
|
||||
getindex(char what)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
|
|
@ -58,8 +59,7 @@ char what;
|
|||
* print the name of a trap
|
||||
*/
|
||||
char *
|
||||
tr_name(ch)
|
||||
char ch;
|
||||
tr_name(char ch)
|
||||
{
|
||||
reg char *s;
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ char ch;
|
|||
* Look:
|
||||
* A quick glance all around the player
|
||||
*/
|
||||
look(wakeup)
|
||||
bool wakeup;
|
||||
void
|
||||
look(bool wakeup)
|
||||
{
|
||||
reg char ch;
|
||||
reg int oldx, oldy, y, x;
|
||||
|
|
@ -230,8 +230,7 @@ bool wakeup;
|
|||
* find the unclaimed object at y, x
|
||||
*/
|
||||
struct linked_list *
|
||||
find_obj(y, x)
|
||||
int y, x;
|
||||
find_obj(int y, int x)
|
||||
{
|
||||
reg struct linked_list *obj;
|
||||
reg struct object *op;
|
||||
|
|
@ -248,7 +247,8 @@ int y, x;
|
|||
* eat:
|
||||
* Let the hero eat some food.
|
||||
*/
|
||||
eat()
|
||||
void
|
||||
eat(void)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct object *obj;
|
||||
|
|
@ -297,7 +297,8 @@ eat()
|
|||
* aggravate:
|
||||
* aggravate all the monsters on this level
|
||||
*/
|
||||
aggravate()
|
||||
void
|
||||
aggravate(void)
|
||||
{
|
||||
reg struct linked_list *mi;
|
||||
|
||||
|
|
@ -310,8 +311,7 @@ aggravate()
|
|||
* If string starts with a vowel, return "n" for an "an"
|
||||
*/
|
||||
char *
|
||||
vowelstr(str)
|
||||
char *str;
|
||||
vowelstr(char *str)
|
||||
{
|
||||
switch (tolower(*str)) {
|
||||
case 'a':
|
||||
|
|
@ -329,8 +329,8 @@ char *str;
|
|||
* is_current:
|
||||
* See if the object is one of the currently used items
|
||||
*/
|
||||
is_current(obj)
|
||||
struct object *obj;
|
||||
bool
|
||||
is_current(struct object *obj)
|
||||
{
|
||||
if (obj == NULL)
|
||||
return FALSE;
|
||||
|
|
@ -346,7 +346,8 @@ struct object *obj;
|
|||
* get_dir:
|
||||
* Set up the direction coordinates
|
||||
*/
|
||||
get_dir()
|
||||
bool
|
||||
get_dir(void)
|
||||
{
|
||||
reg char *prompt;
|
||||
reg bool gotit;
|
||||
|
|
@ -384,8 +385,8 @@ get_dir()
|
|||
* initfood:
|
||||
* Set up stuff for a food-type object
|
||||
*/
|
||||
initfood(what)
|
||||
struct object *what;
|
||||
void
|
||||
initfood(struct object *what)
|
||||
{
|
||||
what->o_type = FOOD;
|
||||
what->o_group = NORMFOOD;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "rogue.h"
|
||||
#include <ctype.h>
|
||||
#include "rogue.ext"
|
||||
|
|
@ -23,10 +24,10 @@
|
|||
* Pick a monster to show up. The lower the level,
|
||||
* the meaner the monster.
|
||||
*/
|
||||
rnd_mon(wander,baddie)
|
||||
bool wander;
|
||||
bool baddie; /* TRUE when from a polymorph stick */
|
||||
char
|
||||
rnd_mon(bool wander, bool baddie)
|
||||
{
|
||||
/* baddie; TRUE when from a polymorph stick */
|
||||
reg int i, ok, cnt;
|
||||
|
||||
cnt = 0;
|
||||
|
|
@ -60,7 +61,8 @@ bool baddie; /* TRUE when from a polymorph stick */
|
|||
* lev_mon:
|
||||
* This gets all monsters possible on this level
|
||||
*/
|
||||
lev_mon()
|
||||
void
|
||||
lev_mon(void)
|
||||
{
|
||||
reg int i;
|
||||
reg struct monster *mm;
|
||||
|
|
@ -83,10 +85,7 @@ lev_mon()
|
|||
* Pick a new monster and add it to the list
|
||||
*/
|
||||
struct linked_list *
|
||||
new_monster(type, cp, treas)
|
||||
struct coord *cp;
|
||||
bool treas;
|
||||
char type;
|
||||
new_monster(char type, struct coord *cp, bool treas)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct thing *tp;
|
||||
|
|
@ -191,7 +190,8 @@ char type;
|
|||
* wanderer:
|
||||
* A wandering monster has awakened and is headed for the player
|
||||
*/
|
||||
wanderer()
|
||||
void
|
||||
wanderer(void)
|
||||
{
|
||||
reg int ch = '-';
|
||||
reg struct room *rp, *hr = player.t_room;
|
||||
|
|
@ -217,8 +217,7 @@ wanderer()
|
|||
* What to do when the hero steps next to a monster
|
||||
*/
|
||||
struct linked_list *
|
||||
wake_monster(y, x)
|
||||
int y, x;
|
||||
wake_monster(int y, int x)
|
||||
{
|
||||
reg struct thing *tp;
|
||||
reg struct linked_list *it;
|
||||
|
|
@ -279,7 +278,8 @@ int y, x;
|
|||
* genocide:
|
||||
* Eradicate a monster forevermore
|
||||
*/
|
||||
genocide()
|
||||
void
|
||||
genocide(void)
|
||||
{
|
||||
reg struct linked_list *ip, *nip;
|
||||
reg struct thing *mp;
|
||||
|
|
@ -331,8 +331,8 @@ tryagain:
|
|||
* unhold:
|
||||
* Release the player from being held
|
||||
*/
|
||||
unhold(whichmon)
|
||||
char whichmon;
|
||||
void
|
||||
unhold(char whichmon)
|
||||
{
|
||||
switch (whichmon) {
|
||||
case 'F':
|
||||
|
|
@ -347,8 +347,8 @@ char whichmon;
|
|||
* midx:
|
||||
* This returns an index to 'whichmon'
|
||||
*/
|
||||
midx(whichmon)
|
||||
char whichmon;
|
||||
int
|
||||
midx(char whichmon)
|
||||
{
|
||||
if (isupper(whichmon))
|
||||
return(whichmon - 'A'); /* 0 to 25 for uppercase */
|
||||
|
|
@ -363,8 +363,8 @@ char whichmon;
|
|||
* See when monster should run or fight. Return
|
||||
* TRUE if hit points less than acceptable.
|
||||
*/
|
||||
monhurt(th)
|
||||
struct thing *th;
|
||||
bool
|
||||
monhurt(struct thing *th)
|
||||
{
|
||||
reg int ewis, crithp, f1, f2;
|
||||
reg struct stats *st;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
|
@ -29,8 +30,8 @@ struct coord nh;
|
|||
* Start the hero running
|
||||
*/
|
||||
|
||||
do_run(ch)
|
||||
char ch;
|
||||
void
|
||||
do_run(char ch)
|
||||
{
|
||||
running = TRUE;
|
||||
after = FALSE;
|
||||
|
|
@ -43,8 +44,8 @@ char ch;
|
|||
* consequences (fighting, picking up, etc.)
|
||||
*/
|
||||
|
||||
do_move(dy, dx)
|
||||
int dy, dx;
|
||||
void
|
||||
do_move(int dy, int dx)
|
||||
{
|
||||
reg int ch;
|
||||
reg struct room *rp;
|
||||
|
|
@ -209,8 +210,8 @@ int dy, dx;
|
|||
* Called to illuminate a room.
|
||||
* If it is dark, remove anything that might move.
|
||||
*/
|
||||
light(cp)
|
||||
struct coord *cp;
|
||||
void
|
||||
light(struct coord *cp)
|
||||
{
|
||||
reg struct room *rp;
|
||||
reg int j, k, x, y;
|
||||
|
|
@ -291,8 +292,8 @@ struct coord *cp;
|
|||
* show:
|
||||
* returns what a certain thing will display as to the un-initiated
|
||||
*/
|
||||
show(y, x)
|
||||
int y, x;
|
||||
char
|
||||
show(int y, int x)
|
||||
{
|
||||
reg char ch = winat(y, x);
|
||||
reg struct linked_list *it;
|
||||
|
|
@ -330,9 +331,8 @@ int y, x;
|
|||
* be_trapped:
|
||||
* Hero or monster stepped on a trap.
|
||||
*/
|
||||
be_trapped(tc, th)
|
||||
struct thing *th;
|
||||
struct coord *tc;
|
||||
int
|
||||
be_trapped(struct coord *tc, struct thing *th)
|
||||
{
|
||||
reg struct trap *trp;
|
||||
reg int ch, ishero;
|
||||
|
|
@ -340,7 +340,7 @@ struct coord *tc;
|
|||
char stuckee[35], seeit, sayso;
|
||||
|
||||
if ((trp = trap_at(tc->y, tc->x)) == NULL)
|
||||
return;
|
||||
return 0;
|
||||
ishero = (th == &player);
|
||||
if (ishero) {
|
||||
strcpy(stuckee, "You");
|
||||
|
|
@ -491,7 +491,7 @@ goner:
|
|||
if ((trp->tr_flags & ISGONE) && rnd(100) < 10) {
|
||||
nlmove = TRUE;
|
||||
if (rnd(100) < 15)
|
||||
teleport(rndspot); /* teleport away */
|
||||
teleport(rndspot, th); /* teleport away */
|
||||
else if(rnd(100) < 15 && level > 2) {
|
||||
level -= rnd(2) + 1;
|
||||
new_level(NORMLEV);
|
||||
|
|
@ -519,7 +519,8 @@ goner:
|
|||
* dip_it:
|
||||
* Dip an object into a magic pool
|
||||
*/
|
||||
dip_it()
|
||||
void
|
||||
dip_it(void)
|
||||
{
|
||||
reg struct linked_list *what;
|
||||
reg struct object *ob;
|
||||
|
|
@ -654,8 +655,7 @@ dip_it()
|
|||
* Find the trap at (y,x) on screen.
|
||||
*/
|
||||
struct trap *
|
||||
trap_at(y, x)
|
||||
int y, x;
|
||||
trap_at(int y, int x)
|
||||
{
|
||||
reg struct trap *tp, *ep;
|
||||
|
||||
|
|
@ -673,8 +673,7 @@ int y, x;
|
|||
* move in a random direction if the monster/person is confused
|
||||
*/
|
||||
struct coord *
|
||||
rndmove(who)
|
||||
struct thing *who;
|
||||
rndmove(struct thing *who)
|
||||
{
|
||||
reg int x, y, ex, ey, ch;
|
||||
int nopen = 0;
|
||||
|
|
@ -720,8 +719,8 @@ struct thing *who;
|
|||
* isatrap:
|
||||
* Returns TRUE if this character is some kind of trap
|
||||
*/
|
||||
isatrap(ch)
|
||||
char ch;
|
||||
bool
|
||||
isatrap(char ch)
|
||||
{
|
||||
switch(ch) {
|
||||
case POST:
|
||||
|
|
|
|||
|
|
@ -17,14 +17,16 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
void put_things(void);
|
||||
|
||||
/*
|
||||
* new_level:
|
||||
* Dig and draw a new level
|
||||
*/
|
||||
new_level(ltype)
|
||||
int ltype;
|
||||
void
|
||||
new_level(int ltype)
|
||||
{
|
||||
register i;
|
||||
register int i;
|
||||
register char ch;
|
||||
struct coord traploc;
|
||||
struct room *rp;
|
||||
|
|
@ -145,9 +147,10 @@ again:
|
|||
* rnd_room:
|
||||
* Pick a room that is really there
|
||||
*/
|
||||
rnd_room()
|
||||
int
|
||||
rnd_room(void)
|
||||
{
|
||||
register rm;
|
||||
register int rm;
|
||||
|
||||
if (levtype != NORMLEV)
|
||||
rm = 0;
|
||||
|
|
@ -166,9 +169,10 @@ rnd_room()
|
|||
* put potions and scrolls on this level
|
||||
*/
|
||||
|
||||
put_things()
|
||||
void
|
||||
put_things(void)
|
||||
{
|
||||
register i, cnt, rm;
|
||||
register int i, cnt, rm;
|
||||
struct linked_list *item;
|
||||
struct object *cur;
|
||||
struct coord tp;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct optstruct {
|
|||
|
||||
typedef struct optstruct OPTION;
|
||||
|
||||
int put_str(), get_str();
|
||||
int allowchange(OPTION *opt);
|
||||
|
||||
OPTION optlist[] = {
|
||||
{ "name", "Name: ", whoami },
|
||||
|
|
@ -46,7 +46,8 @@ OPTION safeoptlist[] = {
|
|||
/*
|
||||
* print and then set options from the terminal
|
||||
*/
|
||||
option()
|
||||
void
|
||||
option(void)
|
||||
{
|
||||
reg OPTION *op;
|
||||
reg int wh;
|
||||
|
|
@ -106,9 +107,8 @@ option()
|
|||
* Set a string option
|
||||
*/
|
||||
#define CTRLB 2
|
||||
get_str(opt, awin)
|
||||
char *opt;
|
||||
WINDOW *awin;
|
||||
int
|
||||
get_str(char *opt, WINDOW *awin)
|
||||
{
|
||||
reg char *sp;
|
||||
reg int c, oy, ox;
|
||||
|
|
@ -119,7 +119,7 @@ WINDOW *awin;
|
|||
/*
|
||||
* loop reading in the string, and put it in a temporary buffer
|
||||
*/
|
||||
for (sp = buf; (c=readchar(awin)) != '\n' && c != '\r' && c != ESCAPE;
|
||||
for (sp = buf; (c=readchar()) != '\n' && c != '\r' && c != ESCAPE;
|
||||
wclrtoeol(awin), draw(awin)) {
|
||||
if (sp - buf >= 50) {
|
||||
*sp = '\0'; /* line was too long */
|
||||
|
|
@ -186,8 +186,8 @@ WINDOW *awin;
|
|||
* or the end of the entire option string.
|
||||
*/
|
||||
|
||||
parse_opts(str)
|
||||
char *str;
|
||||
void
|
||||
parse_opts(char *str)
|
||||
{
|
||||
reg char *sp;
|
||||
reg OPTION *op;
|
||||
|
|
@ -231,9 +231,8 @@ char *str;
|
|||
/*
|
||||
* copy string using unctrl for things
|
||||
*/
|
||||
strucpy(s1, s2, len)
|
||||
char *s1, *s2;
|
||||
int len;
|
||||
void
|
||||
strucpy(char *s1, char *s2, int len)
|
||||
{
|
||||
reg char *sp;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,8 @@
|
|||
* is non-null use it as the linked_list pointer instead of
|
||||
* getting it off the ground.
|
||||
*/
|
||||
add_pack(item, silent)
|
||||
struct linked_list *item;
|
||||
bool silent;
|
||||
bool
|
||||
add_pack(struct linked_list *item, bool silent)
|
||||
{
|
||||
reg struct linked_list *ip, *lp;
|
||||
reg struct object *obj, *op = NULL;
|
||||
|
|
@ -191,9 +190,8 @@ picked_up:
|
|||
* inventory:
|
||||
* Show what items are in a specific list
|
||||
*/
|
||||
inventory(list, type)
|
||||
struct linked_list *list;
|
||||
int type;
|
||||
bool
|
||||
inventory(struct linked_list *list, int type)
|
||||
{
|
||||
reg struct linked_list *pc;
|
||||
reg struct object *obj;
|
||||
|
|
@ -229,8 +227,8 @@ int type;
|
|||
* pick_up:
|
||||
* Add something to characters pack.
|
||||
*/
|
||||
pick_up(ch)
|
||||
char ch;
|
||||
void
|
||||
pick_up(char ch)
|
||||
{
|
||||
nochange = FALSE;
|
||||
switch(ch) {
|
||||
|
|
@ -254,7 +252,8 @@ char ch;
|
|||
* picky_inven:
|
||||
* Allow player to inventory a single item
|
||||
*/
|
||||
picky_inven()
|
||||
void
|
||||
picky_inven(void)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg char ch, mch;
|
||||
|
|
@ -288,9 +287,7 @@ picky_inven()
|
|||
* pick something out of a pack for a purpose
|
||||
*/
|
||||
struct linked_list *
|
||||
get_item(purpose, type)
|
||||
char *purpose;
|
||||
int type;
|
||||
get_item(char *purpose, int type)
|
||||
{
|
||||
reg struct linked_list *obj, *pit, *savepit = NULL;
|
||||
struct object *pob;
|
||||
|
|
@ -408,8 +405,7 @@ int type;
|
|||
* Get the character of a particular item in the pack
|
||||
*/
|
||||
char
|
||||
pack_char(obj)
|
||||
struct object *obj;
|
||||
pack_char(struct object *obj)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg char c;
|
||||
|
|
@ -427,7 +423,8 @@ struct object *obj;
|
|||
* idenpack:
|
||||
* Identify all the items in the pack
|
||||
*/
|
||||
idenpack()
|
||||
void
|
||||
idenpack(void)
|
||||
{
|
||||
reg struct linked_list *pc;
|
||||
|
||||
|
|
@ -440,8 +437,8 @@ idenpack()
|
|||
* del_pack:
|
||||
* Take something out of the hero's pack
|
||||
*/
|
||||
del_pack(what)
|
||||
struct linked_list *what;
|
||||
void
|
||||
del_pack(struct linked_list *what)
|
||||
{
|
||||
reg struct object *op;
|
||||
|
||||
|
|
@ -461,8 +458,8 @@ struct linked_list *what;
|
|||
* cur_null:
|
||||
* This updates cur_weapon etc for dropping things
|
||||
*/
|
||||
cur_null(op)
|
||||
struct object *op;
|
||||
void
|
||||
cur_null(struct object *op)
|
||||
{
|
||||
if (op == cur_weapon)
|
||||
cur_weapon = NULL;
|
||||
|
|
|
|||
|
|
@ -14,15 +14,20 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
void conn(int r1, int r2);
|
||||
void door(struct room *rm, struct coord *cp);
|
||||
|
||||
/*
|
||||
* do_passages:
|
||||
* Draw all the passages on a level.
|
||||
*/
|
||||
|
||||
do_passages()
|
||||
void
|
||||
do_passages(void)
|
||||
{
|
||||
reg struct rdes *r1, *r2 = NULL;
|
||||
reg int i, j;
|
||||
|
|
@ -123,8 +128,8 @@ do_passages()
|
|||
* Cconnect two rooms.
|
||||
*/
|
||||
|
||||
conn(r1, r2)
|
||||
int r1, r2;
|
||||
void
|
||||
conn(int r1, int r2)
|
||||
{
|
||||
reg struct room *rpf, *rpt = NULL;
|
||||
reg char rmt, direc;
|
||||
|
|
@ -255,9 +260,8 @@ int r1, r2;
|
|||
* also enters the door in the exits array of the room.
|
||||
*/
|
||||
|
||||
door(rm, cp)
|
||||
struct room *rm;
|
||||
struct coord *cp;
|
||||
void
|
||||
door(struct room *rm, struct coord *cp)
|
||||
{
|
||||
cmov(*cp);
|
||||
addch(rnd(10) < level - 1 && rnd(100) < 20 ? SECRETDOOR : DOOR);
|
||||
|
|
@ -269,7 +273,8 @@ struct coord *cp;
|
|||
* add_pass:
|
||||
* add the passages to the current window (wizard command)
|
||||
*/
|
||||
add_pass()
|
||||
void
|
||||
add_pass(void)
|
||||
{
|
||||
reg int y, x, ch;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
* quaff:
|
||||
* Let the hero drink a potion
|
||||
*/
|
||||
quaff()
|
||||
void
|
||||
quaff(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *item, *titem;
|
||||
|
|
@ -189,7 +190,7 @@ quaff()
|
|||
p_know[P_XHEAL] = TRUE;
|
||||
if (!iswearing(R_SLOW))
|
||||
notslow(FALSE);
|
||||
unconfuse();
|
||||
unconfuse(FALSE);
|
||||
extinguish(unconfuse);
|
||||
sight(FALSE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
void updabil(int what, int amt, struct real *pst, int how);
|
||||
int hungdam(void);
|
||||
|
||||
/*
|
||||
* chg_hpt:
|
||||
* Changes players hit points
|
||||
*/
|
||||
chg_hpt(howmany, alsomax, what)
|
||||
int howmany;
|
||||
bool alsomax;
|
||||
char what;
|
||||
void
|
||||
chg_hpt(int howmany, bool alsomax, char what)
|
||||
{
|
||||
nochange = FALSE;
|
||||
if(alsomax)
|
||||
|
|
@ -38,8 +38,8 @@ char what;
|
|||
* rchg_str:
|
||||
* Update the players real strength
|
||||
*/
|
||||
rchg_str(amt)
|
||||
int amt;
|
||||
void
|
||||
rchg_str(int amt)
|
||||
{
|
||||
chg_abil(STR,amt,TRUE);
|
||||
}
|
||||
|
|
@ -48,8 +48,8 @@ int amt;
|
|||
* chg_abil:
|
||||
* Used to modify the hero's abilities
|
||||
*/
|
||||
chg_abil(what,amt,how)
|
||||
int amt, what, how;
|
||||
void
|
||||
chg_abil(int what, int amt, int how)
|
||||
{
|
||||
if (amt == 0)
|
||||
return;
|
||||
|
|
@ -66,9 +66,8 @@ int amt, what, how;
|
|||
* updabil:
|
||||
* Do the actual abilities updating
|
||||
*/
|
||||
updabil(what, amt, pst, how)
|
||||
struct real *pst;
|
||||
int what, amt, how;
|
||||
void
|
||||
updabil(int what, int amt, struct real *pst, int how)
|
||||
{
|
||||
register int *wh, *mx, *mr;
|
||||
struct real *mst, *msr;
|
||||
|
|
@ -138,8 +137,8 @@ int what, amt, how;
|
|||
* add_haste:
|
||||
* add a haste to the player
|
||||
*/
|
||||
add_haste(potion)
|
||||
bool potion;
|
||||
void
|
||||
add_haste(bool potion)
|
||||
{
|
||||
if (pl_on(ISHASTE)) {
|
||||
msg("You faint from exhaustion.");
|
||||
|
|
@ -160,9 +159,8 @@ bool potion;
|
|||
* getpdex:
|
||||
* Gets players added dexterity for fighting
|
||||
*/
|
||||
getpdex(who, heave)
|
||||
struct stats *who;
|
||||
bool heave;
|
||||
int
|
||||
getpdex(struct stats *who, bool heave)
|
||||
{
|
||||
reg int edex;
|
||||
|
||||
|
|
@ -217,8 +215,8 @@ bool heave;
|
|||
* getpwis:
|
||||
* Get a players wisdom for fighting
|
||||
*/
|
||||
getpwis(who)
|
||||
struct stats *who;
|
||||
int
|
||||
getpwis(struct stats *who)
|
||||
{
|
||||
reg int ewis;
|
||||
|
||||
|
|
@ -249,8 +247,8 @@ struct stats *who;
|
|||
* getpcon:
|
||||
* Get added hit points from players constitution
|
||||
*/
|
||||
getpcon(who)
|
||||
struct stats *who;
|
||||
int
|
||||
getpcon(struct stats *who)
|
||||
{
|
||||
reg int econ;
|
||||
|
||||
|
|
@ -282,8 +280,8 @@ struct stats *who;
|
|||
* str_plus:
|
||||
* compute bonus/penalties for strength on the "to hit" roll
|
||||
*/
|
||||
str_plus(who)
|
||||
struct stats *who;
|
||||
int
|
||||
str_plus(struct stats *who)
|
||||
{
|
||||
reg int hitplus, str;
|
||||
|
||||
|
|
@ -315,8 +313,8 @@ struct stats *who;
|
|||
* add_dam:
|
||||
* Compute additional damage done depending on strength
|
||||
*/
|
||||
add_dam(who)
|
||||
struct stats *who;
|
||||
int
|
||||
add_dam(struct stats *who)
|
||||
{
|
||||
reg int exdam, str;
|
||||
|
||||
|
|
@ -350,7 +348,8 @@ struct stats *who;
|
|||
* hungdam:
|
||||
* Calculate damage depending on players hungry state
|
||||
*/
|
||||
hungdam()
|
||||
int
|
||||
hungdam(void)
|
||||
{
|
||||
switch (hungry_state) {
|
||||
case F_OKAY:
|
||||
|
|
@ -364,9 +363,8 @@ hungdam()
|
|||
* heal_self:
|
||||
* Heal the hero.
|
||||
*/
|
||||
heal_self(factor, updmaxhp)
|
||||
int factor;
|
||||
bool updmaxhp;
|
||||
void
|
||||
heal_self(int factor, bool updmaxhp)
|
||||
{
|
||||
him->s_hpt += roll(him->s_lvl + getpcon(him), factor);
|
||||
if (updmaxhp)
|
||||
|
|
|
|||
|
|
@ -19,11 +19,15 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
int gethand(bool isrmv);
|
||||
int ring_eat(void);
|
||||
|
||||
/*
|
||||
* ring_on:
|
||||
* Put on a ring
|
||||
*/
|
||||
ring_on()
|
||||
void
|
||||
ring_on(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *item;
|
||||
|
|
@ -144,7 +148,8 @@ ring_on()
|
|||
* ring_off:
|
||||
* Take off some ring
|
||||
*/
|
||||
ring_off()
|
||||
void
|
||||
ring_off(void)
|
||||
{
|
||||
reg int ring;
|
||||
reg struct object *obj;
|
||||
|
|
@ -178,8 +183,8 @@ ring_off()
|
|||
* toss_ring:
|
||||
* Remove a ring and stop its effects
|
||||
*/
|
||||
toss_ring(what)
|
||||
struct object *what;
|
||||
void
|
||||
toss_ring(struct object *what)
|
||||
{
|
||||
bool okring;
|
||||
|
||||
|
|
@ -228,8 +233,8 @@ struct object *what;
|
|||
* gethand:
|
||||
* Get a hand to wear a ring
|
||||
*/
|
||||
gethand(isrmv)
|
||||
bool isrmv;
|
||||
int
|
||||
gethand(bool isrmv)
|
||||
{
|
||||
reg int c;
|
||||
char *ptr;
|
||||
|
|
@ -280,7 +285,8 @@ bool isrmv;
|
|||
* ring_eat:
|
||||
* How much food do the hero's rings use up?
|
||||
*/
|
||||
ring_eat()
|
||||
int
|
||||
ring_eat(void)
|
||||
{
|
||||
reg struct object *lb;
|
||||
reg int hand, i, howmuch;
|
||||
|
|
@ -335,8 +341,7 @@ ring_eat()
|
|||
* Print ring bonuses
|
||||
*/
|
||||
char *
|
||||
ring_num(what)
|
||||
struct object *what;
|
||||
ring_num(struct object *what)
|
||||
{
|
||||
static char number[5];
|
||||
|
||||
|
|
@ -355,8 +360,8 @@ struct object *what;
|
|||
* magring:
|
||||
* Returns TRUE if a ring has a number, i.e. +2
|
||||
*/
|
||||
magring(what)
|
||||
struct object *what;
|
||||
bool
|
||||
magring(struct object *what)
|
||||
{
|
||||
switch(what->o_which) {
|
||||
case R_SPEED:
|
||||
|
|
@ -379,7 +384,8 @@ struct object *what;
|
|||
* ringabil:
|
||||
* Compute effective abilities due to rings
|
||||
*/
|
||||
ringabil()
|
||||
void
|
||||
ringabil(void)
|
||||
{
|
||||
reg struct object *rptr;
|
||||
reg int i;
|
||||
|
|
@ -406,10 +412,10 @@ ringabil()
|
|||
* init_ring:
|
||||
* Initialize a ring
|
||||
*/
|
||||
init_ring(what,fromwiz)
|
||||
struct object *what;
|
||||
bool fromwiz; /* TRUE when from wizards */
|
||||
void
|
||||
init_ring(struct object *what, bool fromwiz)
|
||||
{
|
||||
/* fromwiz: TRUE when from wizards */
|
||||
reg int much;
|
||||
|
||||
switch (what->o_which) {
|
||||
|
|
@ -459,8 +465,8 @@ bool fromwiz; /* TRUE when from wizards */
|
|||
* ringex:
|
||||
* Get extra gains from rings
|
||||
*/
|
||||
ringex(rtype)
|
||||
int rtype;
|
||||
int
|
||||
ringex(int rtype)
|
||||
{
|
||||
reg int howmuch = 0;
|
||||
|
||||
|
|
@ -475,8 +481,8 @@ int rtype;
|
|||
* iswearing:
|
||||
* Returns TRUE when the hero is wearing a certain type of ring
|
||||
*/
|
||||
iswearing(ring)
|
||||
int ring;
|
||||
bool
|
||||
iswearing(int ring)
|
||||
{
|
||||
return (isring(LEFT,ring) || isring(RIGHT,ring));
|
||||
}
|
||||
|
|
@ -485,8 +491,8 @@ int ring;
|
|||
* isring:
|
||||
* Returns TRUE if a ring is on a hand
|
||||
*/
|
||||
isring(hand,ring)
|
||||
int hand, ring;
|
||||
bool
|
||||
isring(int hand, int ring)
|
||||
{
|
||||
if (cur_ring[hand] != NULL && cur_ring[hand]->o_which == ring)
|
||||
return TRUE;
|
||||
|
|
|
|||
28
srogue/rip.c
28
srogue/rip.c
|
|
@ -50,8 +50,8 @@ static char *rip[] = {
|
|||
extern int scorefd;
|
||||
extern FILE *logfile;
|
||||
|
||||
char *killname();
|
||||
void writelog(int amount, int aflag, char monst);
|
||||
char *killname(unsigned char monst);
|
||||
void showpack(bool winner, char *howso);
|
||||
|
||||
/*
|
||||
* death:
|
||||
|
|
@ -59,8 +59,8 @@ void writelog(int amount, int aflag, char monst);
|
|||
*/
|
||||
|
||||
#include <time.h>
|
||||
death(monst)
|
||||
char monst;
|
||||
void
|
||||
death(char monst)
|
||||
{
|
||||
reg char dp, *killer;
|
||||
struct tm *lt;
|
||||
|
|
@ -119,9 +119,8 @@ int oldpurse;
|
|||
* score:
|
||||
* Figure score and post it.
|
||||
*/
|
||||
score(amount, aflag, monst)
|
||||
char monst;
|
||||
int amount, aflag;
|
||||
void
|
||||
score(int amount, int aflag, char monst)
|
||||
{
|
||||
reg struct sc_ent *scp, *sc2;
|
||||
reg int i, fd, prflags = 0;
|
||||
|
|
@ -261,8 +260,8 @@ void writelog(int amount, int aflag, char monst)
|
|||
* showtop:
|
||||
* Display the top ten on the screen
|
||||
*/
|
||||
showtop(showname)
|
||||
int showname;
|
||||
bool
|
||||
showtop(int showname)
|
||||
{
|
||||
reg int fd, i;
|
||||
char *killer;
|
||||
|
|
@ -310,7 +309,8 @@ int showname;
|
|||
* total_winner:
|
||||
* The hero made it back out alive
|
||||
*/
|
||||
total_winner()
|
||||
void
|
||||
total_winner(void)
|
||||
{
|
||||
clear();
|
||||
addstr(" \n");
|
||||
|
|
@ -345,9 +345,8 @@ addstr("a great profit and are admitted to the fighters guild.\n");
|
|||
* showpack:
|
||||
* Display the contents of the hero's pack
|
||||
*/
|
||||
showpack(winner, howso)
|
||||
bool winner;
|
||||
char *howso;
|
||||
void
|
||||
showpack(bool winner, char *howso)
|
||||
{
|
||||
reg char *iname;
|
||||
reg int cnt, worth, ch;
|
||||
|
|
@ -392,8 +391,7 @@ char *howso;
|
|||
* Returns what the hero was killed by.
|
||||
*/
|
||||
char *
|
||||
killname(monst)
|
||||
unsigned char monst;
|
||||
killname(unsigned char monst)
|
||||
{
|
||||
if (monst < MAXMONS + 1)
|
||||
return monsters[monst].m_name;
|
||||
|
|
|
|||
225
srogue/rogue.ext
225
srogue/rogue.ext
|
|
@ -2,11 +2,10 @@ EXTTHG player;
|
|||
EXTWEP weaps[];
|
||||
EXTARM armors[];
|
||||
EXTMON monsters[], *mtlev[];
|
||||
EXTTRAP *trap_at(), traps[];
|
||||
EXTROOM *roomin(), *oldrp, rooms[];
|
||||
EXTCORD *rndmove(), *rnd_pos(), delta, stairs, oldpos, rndspot;
|
||||
EXTLKL *mlist, *lvl_obj, *new_item(), *new_thing(), *new_monster();
|
||||
EXTLKL *find_mons(), *wake_monster(), *find_obj(), *get_item();
|
||||
EXTTRAP traps[];
|
||||
EXTROOM *oldrp, rooms[];
|
||||
EXTCORD delta, stairs, oldpos, rndspot;
|
||||
EXTLKL *mlist, *lvl_obj;
|
||||
EXTOBJ *cur_armor, *cur_weapon, *cur_ring[];
|
||||
EXTMAG r_magic[], s_magic[], ws_magic[], p_magic[];
|
||||
EXTMAG things[], a_magic[], w_magic[];
|
||||
|
|
@ -14,20 +13,16 @@ EXTINT max_hp, quiet, food_left, hungry_state, level, max_level;
|
|||
EXTINT foodlev, total, count, demoncnt, fung_hit, ntraps;
|
||||
EXTINT lastscore, purse, mpos, seed, dnum, no_food, packvol, playuid;
|
||||
EXTINT curprice, trader, group, levcount, levtype, ringfood, playgid;
|
||||
EXTINT chkstairs(), rollwand(), swander(), notslow(), notfight(), rnd();
|
||||
EXTINT rchg_str(), wghtchk(), stomach(), doctor(), runners(), status(), sight();
|
||||
extern void quit(), auto_save(), endit(), byebye(), game_err();
|
||||
EXTINT prntfile(), unconfuse(), sapem();
|
||||
EXTINT noteth(), notregen(), notinvinc(), unsee(), nohaste(), npch();
|
||||
EXTINT chkstairs(), notfight();
|
||||
EXTINT prntfile();
|
||||
EXTBOOL running, nochange, after, inwhgt, isfight, firstmove, nlmove;
|
||||
EXTBOOL wizard, waswizard, in_shell, amulet, door_stop, playing, use_savedir;
|
||||
EXTBOOL notify, ws_know[], p_know[], s_know[], r_know[], inpool;
|
||||
EXTCHAR home[], file_name[], whoami[], fruit[], curpurch[], scorefile[];
|
||||
EXTCHAR *r_stones[], *p_colors[], *s_names[], *ws_type[], *ws_made[];
|
||||
EXTCHAR *ws_guess[], *s_guess[], *r_guess[], *p_guess[];/*, *unctrl();*/
|
||||
EXTCHAR morestr[], prbuf[], huh[], *identify(), *vowelstr();
|
||||
EXTCHAR *new(), *strcpy(), *strcat(), *inv_name(), pack_char(), *prname();
|
||||
EXTCHAR *num(), *getenv(), *tr_name(), *release, take, runch;
|
||||
EXTCHAR morestr[], prbuf[], huh[];
|
||||
EXTCHAR *release, take, runch;
|
||||
EXTCHAR retstr[], wizstr[], spacemsg[], illegal[], callit[], starlist[];
|
||||
EXTSTAT max_stats, *him;
|
||||
extern struct magic_info thnginfo[];
|
||||
|
|
@ -46,3 +41,207 @@ extern char *stones[NSTONES];
|
|||
extern char *wood[NWOOD];
|
||||
extern char *metal[NMETAL];
|
||||
|
||||
void _attach(struct linked_list **list, struct linked_list *item);
|
||||
void _detach(struct linked_list **list, struct linked_list *item);
|
||||
void _free_list(struct linked_list **ptr);
|
||||
void activity(void);
|
||||
int add_dam(struct stats *who);
|
||||
void add_haste(bool potion);
|
||||
void add_mon(struct room *rm, bool treas);
|
||||
bool add_pack(struct linked_list *item, bool silent);
|
||||
void add_pass(void);
|
||||
void addmsg(char *fmt, ...);
|
||||
void aggravate(void);
|
||||
int attack(struct thing *mp);
|
||||
bool author(void);
|
||||
void auto_save(int a);
|
||||
int be_trapped(struct coord *tc, struct thing *th);
|
||||
void buy_it(void);
|
||||
void byebye(int how);
|
||||
bool cansee(int y, int x);
|
||||
char *charge_str(struct object *obj);
|
||||
void check_level(void);
|
||||
void chg_abil(int what, int amt, int how);
|
||||
void chg_hpt(int howmany, bool alsomax, char what);
|
||||
void command(void);
|
||||
bool cordok(int y, int x);
|
||||
void create_obj(bool fscr);
|
||||
void cur_null(struct object *op);
|
||||
void dbotline(WINDOW *scr, char *message);
|
||||
bool dead_end(char ch);
|
||||
void death(char monst);
|
||||
void del_pack(struct linked_list *what);
|
||||
bool diag_ok(struct coord *sp, struct coord *ep);
|
||||
void dip_it(void);
|
||||
void discard(struct linked_list *item);
|
||||
void displevl(void);
|
||||
void dispmax(void);
|
||||
void dispmons(void);
|
||||
void do_daemons(int flag);
|
||||
void do_fuses(void);
|
||||
void do_maze(void);
|
||||
void do_motion(struct object *obj, int ydelta, int xdelta);
|
||||
void do_move(int dy, int dx);
|
||||
void do_passages(void);
|
||||
void do_post(void);
|
||||
void do_rooms(void);
|
||||
void do_run(char ch);
|
||||
void do_zap(bool gotdir);
|
||||
void doctor(int fromfuse);
|
||||
void draw_room(struct room *rp);
|
||||
int drop(struct linked_list *item);
|
||||
bool dropcheck(struct object *op);
|
||||
void eat(void);
|
||||
int encread(void *starta, unsigned int size, int inf);
|
||||
void encwrite(void *starta, unsigned int size, FILE *outf);
|
||||
void endit(int a);
|
||||
void endmsg(void);
|
||||
void extinguish(int (*func)());
|
||||
int extras(void);
|
||||
void fall(struct linked_list *item, bool pr);
|
||||
bool fallpos(struct coord *pos, struct coord *newpos, bool passages);
|
||||
void fatal(char *s);
|
||||
bool fight(struct coord *mp, struct object *weap, bool thrown);
|
||||
struct linked_list *find_mons(int y, int x);
|
||||
struct linked_list *find_obj(int y, int x);
|
||||
void fix_stick(struct object *cur);
|
||||
void fuse(int (*func)(), int arg, int time);
|
||||
void game_err(int a);
|
||||
void genocide(void);
|
||||
bool get_dir(void);
|
||||
struct linked_list *get_item(char *purpose, int type);
|
||||
int get_str(char *opt, WINDOW *awin);
|
||||
int get_worth(struct object *obj);
|
||||
int getbless(void);
|
||||
int getindex(char what);
|
||||
int getpcon(struct stats *who);
|
||||
int getpdex(struct stats *who, bool heave);
|
||||
int getpwis(struct stats *who);
|
||||
void heal_self(int factor, bool updmaxhp);
|
||||
bool hit_monster(struct coord *mp, struct object *obj);
|
||||
int hitweight(void);
|
||||
bool hurt_armor(struct object *obj);
|
||||
void idenpack(void);
|
||||
char *identify(int what);
|
||||
void ignore(void);
|
||||
bool illeg_ch(unsigned char ch);
|
||||
void init_everything(void);
|
||||
void init_ring(struct object *what, bool fromwiz);
|
||||
void init_weapon(struct object *weap, int type);
|
||||
void initarmor(struct object *obj, int what);
|
||||
void initfood(struct object *what);
|
||||
char *inv_name(struct object *obj, bool drop);
|
||||
bool inventory(struct linked_list *list, int type);
|
||||
int itemvol(struct object *wh);
|
||||
int itemweight(struct object *wh);
|
||||
bool is_current(struct object *obj);
|
||||
bool is_magic(struct object *obj);
|
||||
bool isatrap(char ch);
|
||||
bool isring(int hand, int ring);
|
||||
bool iswearing(int ring);
|
||||
void killed(struct linked_list *item, bool pr);
|
||||
void lengthen(int (*func)(), int xtime);
|
||||
void lev_mon(void);
|
||||
void light(struct coord *cp);
|
||||
void look(bool wakeup);
|
||||
bool magring(struct object *what);
|
||||
bool makemons(int what);
|
||||
int midx(char whichmon);
|
||||
void missile(int ydelta, int xdelta);
|
||||
void money(void);
|
||||
bool monhurt(struct thing *th);
|
||||
void msg(char *fmt, ...);
|
||||
char *new(int size);
|
||||
struct linked_list *new_item(int size);
|
||||
void new_level(int ltype);
|
||||
struct linked_list *new_monster(char type, struct coord *cp, bool treas);
|
||||
struct linked_list *new_thing(bool treas, int type, int which);
|
||||
void nohaste(int fromfuse);
|
||||
void noteth(int fromfuse);
|
||||
void notinvinc(int fromfuse);
|
||||
void notregen(int fromfuse);
|
||||
void notslow(int fromfuse);
|
||||
char npch(char ch);
|
||||
char *num(int n1, int n2);
|
||||
bool o_off(struct object *what, long bit);
|
||||
bool o_on(struct object *what, long bit);
|
||||
void option(void);
|
||||
char pack_char(struct object *obj);
|
||||
void parse_opts(char *str);
|
||||
bool passwd(void);
|
||||
int pick_one(struct magic_item *mag);
|
||||
void pick_up(char ch);
|
||||
void picky_inven(void);
|
||||
bool pl_off(long what);
|
||||
bool pl_on(long what);
|
||||
void playit(void);
|
||||
bool price_it(void);
|
||||
void quaff(void);
|
||||
void quit(int a);
|
||||
void raise_level(void);
|
||||
void rchg_str(int amt);
|
||||
void read_scroll(void);
|
||||
int readchar(void);
|
||||
void remove_monster(struct coord *mp, struct linked_list *item);
|
||||
void resoflg(struct object *what, long bit);
|
||||
bool restore(char *file, char **envp);
|
||||
void restscr(WINDOW *scr);
|
||||
bool rf_on(struct room *rm, long bit);
|
||||
char *ring_num(struct object *what);
|
||||
void ring_off(void);
|
||||
void ring_on(void);
|
||||
void ringabil(void);
|
||||
int ringex(int rtype);
|
||||
int rnd(int range);
|
||||
char rnd_mon(bool wander, bool baddie);
|
||||
struct coord *rnd_pos(struct room *rp);
|
||||
int rnd_room(void);
|
||||
struct coord *rndmove(struct thing *who);
|
||||
int roll(int number, int sides);
|
||||
void rollwand(int fromfuse);
|
||||
struct room *roomin(struct coord *cp);
|
||||
int rs_restore_file(int inf);
|
||||
int rs_save_file(FILE *savef);
|
||||
void runners(void);
|
||||
void runto(struct coord *runner, struct coord *spot);
|
||||
void sapem(int fromfuse);
|
||||
bool save(int which);
|
||||
bool save_game(void);
|
||||
bool save_throw(int which, struct thing *tp);
|
||||
void score(int amount, int aflag, char monst);
|
||||
void sell_it(void);
|
||||
void setoflg(struct object *what, long bit);
|
||||
void setup(void);
|
||||
char show(int y, int x);
|
||||
bool showtop(int showname);
|
||||
void sight(int fromfuse);
|
||||
void start_daemon(int (*func)(), int arg, int type);
|
||||
void status(int fromfuse);
|
||||
bool step_ok(unsigned char ch);
|
||||
void stomach(int fromfuse);
|
||||
int str_plus(struct stats *who);
|
||||
void strucpy(char *s1, char *s2, int len);
|
||||
void swander(int fromfuse);
|
||||
bool swing(int at_lvl, int op_arm, int wplus);
|
||||
void take_off(void);
|
||||
int teleport(struct coord spot, struct thing *th);
|
||||
void toss_ring(struct object *what);
|
||||
void total_winner(void);
|
||||
int totalenc(void);
|
||||
char *tr_name(char ch);
|
||||
struct trap *trap_at(int y, int x);
|
||||
void unconfuse(int fromfuse);
|
||||
void unhold(char whichmon);
|
||||
void unsee(int fromfuse);
|
||||
void updpack(void);
|
||||
char *vowelstr(char *str);
|
||||
void wait_for(WINDOW *win, char ch);
|
||||
struct linked_list *wake_monster(int y, int x);
|
||||
void wanderer(void);
|
||||
void waste_time(void);
|
||||
void wear(void);
|
||||
void wghtchk(int fromfuse);
|
||||
void whatis(struct linked_list *what);
|
||||
void wield(void);
|
||||
char winat(int y, int x);
|
||||
void writelog(int amount, int aflag, char monst);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,15 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
void horiz(int cnt);
|
||||
void vert(int cnt);
|
||||
|
||||
/*
|
||||
* do_rooms:
|
||||
* Place the rooms in the dungeon
|
||||
*/
|
||||
do_rooms()
|
||||
void
|
||||
do_rooms(void)
|
||||
{
|
||||
int mloops, mchance, nummons, left_out, roomtries;
|
||||
bool treas = FALSE;
|
||||
|
|
@ -131,9 +135,8 @@ do_rooms()
|
|||
* add_mon:
|
||||
* Add a monster to a room
|
||||
*/
|
||||
add_mon(rm, treas)
|
||||
struct room *rm;
|
||||
bool treas;
|
||||
void
|
||||
add_mon(struct room *rm, bool treas)
|
||||
{
|
||||
reg struct thing *tp;
|
||||
reg struct linked_list *item;
|
||||
|
|
@ -165,8 +168,8 @@ bool treas;
|
|||
* draw_room:
|
||||
* Draw a box around a room
|
||||
*/
|
||||
draw_room(rp)
|
||||
struct room *rp;
|
||||
void
|
||||
draw_room(struct room *rp)
|
||||
{
|
||||
reg int j, k;
|
||||
|
||||
|
|
@ -197,8 +200,8 @@ struct room *rp;
|
|||
* horiz:
|
||||
* draw a horizontal line
|
||||
*/
|
||||
horiz(cnt)
|
||||
int cnt;
|
||||
void
|
||||
horiz(int cnt)
|
||||
{
|
||||
while (cnt-- > 0)
|
||||
addch('-');
|
||||
|
|
@ -209,8 +212,8 @@ int cnt;
|
|||
* vert:
|
||||
* draw a vertical line
|
||||
*/
|
||||
vert(cnt)
|
||||
int cnt;
|
||||
void
|
||||
vert(int cnt)
|
||||
{
|
||||
reg int x, y;
|
||||
|
||||
|
|
@ -228,8 +231,7 @@ int cnt;
|
|||
* pick a random spot in a room
|
||||
*/
|
||||
struct coord *
|
||||
rnd_pos(rp)
|
||||
struct room *rp;
|
||||
rnd_pos(struct room *rp)
|
||||
{
|
||||
reg int y, x, i;
|
||||
static struct coord spot;
|
||||
|
|
@ -249,9 +251,8 @@ struct room *rp;
|
|||
* rf_on:
|
||||
* Returns TRUE if flag is set for room stuff
|
||||
*/
|
||||
rf_on(rm, bit)
|
||||
struct room *rm;
|
||||
long bit;
|
||||
bool
|
||||
rf_on(struct room *rm, long bit)
|
||||
{
|
||||
return (rm->r_flags & bit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
EXTCHAR version[];
|
||||
EXTCHAR *ctime();
|
||||
|
||||
bool dosave(void);
|
||||
void save_file(FILE *savef);
|
||||
|
||||
typedef struct stat STAT;
|
||||
STAT sbuf;
|
||||
|
||||
|
|
@ -39,7 +42,8 @@ STAT sbuf;
|
|||
* ignore:
|
||||
* Ignore ALL signals possible
|
||||
*/
|
||||
ignore()
|
||||
void
|
||||
ignore(void)
|
||||
{
|
||||
md_ignoreallsignals();
|
||||
}
|
||||
|
|
@ -48,7 +52,8 @@ ignore()
|
|||
* save_game:
|
||||
* Save the current game
|
||||
*/
|
||||
save_game()
|
||||
bool
|
||||
save_game(void)
|
||||
{
|
||||
reg FILE *savef;
|
||||
reg int c;
|
||||
|
|
@ -136,7 +141,8 @@ game_err(int a)
|
|||
* dosave:
|
||||
* Save the game. UID/GID no longer get reset here.
|
||||
*/
|
||||
dosave()
|
||||
bool
|
||||
dosave(void)
|
||||
{
|
||||
FILE *savef;
|
||||
|
||||
|
|
@ -157,8 +163,8 @@ dosave()
|
|||
* save_file:
|
||||
* Do the actual save of this game to a file
|
||||
*/
|
||||
save_file(savef)
|
||||
FILE *savef;
|
||||
void
|
||||
save_file(FILE *savef)
|
||||
{
|
||||
int slines = LINES;
|
||||
int scols = COLS;
|
||||
|
|
@ -182,10 +188,10 @@ FILE *savef;
|
|||
* restore:
|
||||
* Restore a saved game from a file
|
||||
*/
|
||||
restore(file, envp)
|
||||
char *file, **envp;
|
||||
bool
|
||||
restore(char *file, char **envp)
|
||||
{
|
||||
register inf, pid;
|
||||
register int inf, pid;
|
||||
int ret_status;
|
||||
#ifndef _AIX
|
||||
extern char **environ;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
* read_scroll:
|
||||
* Let the hero read a scroll
|
||||
*/
|
||||
read_scroll()
|
||||
void
|
||||
read_scroll(void)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *item;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@
|
|||
#define READSTAT ((format_error == 0) && (read_error == 0))
|
||||
#define WRITESTAT (write_error == 0)
|
||||
|
||||
int rs_read_int(int inf, int *i);
|
||||
int rs_write_int(FILE *savef, int c);
|
||||
|
||||
int read_error = FALSE;
|
||||
int write_error = FALSE;
|
||||
int format_error = FALSE;
|
||||
|
|
@ -82,10 +85,8 @@ char encstr[] = "\354\251\243\332A\201|\301\321p\210\251\327\"\257\365t\341%3\27
|
|||
/*
|
||||
* perform an encrypted write
|
||||
*/
|
||||
encwrite(starta, size, outf)
|
||||
register void *starta;
|
||||
unsigned int size;
|
||||
register FILE *outf;
|
||||
void
|
||||
encwrite(void *starta, unsigned int size, FILE *outf)
|
||||
{
|
||||
register char *ep;
|
||||
register char *start = starta;
|
||||
|
|
@ -103,10 +104,8 @@ register FILE *outf;
|
|||
/*
|
||||
* perform an encrypted read
|
||||
*/
|
||||
encread(starta, size, inf)
|
||||
register void *starta;
|
||||
unsigned int size;
|
||||
register int inf;
|
||||
int
|
||||
encread(void *starta, unsigned int size, int inf)
|
||||
{
|
||||
register char *ep;
|
||||
register int read_size;
|
||||
|
|
@ -1556,6 +1555,7 @@ rs_write_traps(FILE *savef, struct trap *trap,int count)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
rs_read_traps(int inf, struct trap *trap, int count)
|
||||
{
|
||||
int id = 0, value = 0, n = 0;
|
||||
|
|
@ -1885,8 +1885,8 @@ rs_read_thing(int inf, struct thing *t)
|
|||
return(READSTAT);
|
||||
}
|
||||
|
||||
rs_fix_monster_list(list)
|
||||
struct linked_list *list;
|
||||
void
|
||||
rs_fix_monster_list(struct linked_list *list)
|
||||
{
|
||||
struct linked_list *item;
|
||||
|
||||
|
|
@ -1970,6 +1970,7 @@ rs_write_object_reference(FILE *savef, struct linked_list *list,
|
|||
return(WRITESTAT);
|
||||
}
|
||||
|
||||
int
|
||||
rs_read_object_reference(int inf, struct linked_list *list,
|
||||
struct object **item)
|
||||
{
|
||||
|
|
@ -2225,6 +2226,7 @@ rs_save_file(FILE *savef)
|
|||
return(WRITESTAT);
|
||||
}
|
||||
|
||||
int
|
||||
rs_restore_file(int inf)
|
||||
{
|
||||
bool junk;
|
||||
|
|
|
|||
|
|
@ -16,15 +16,18 @@
|
|||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
void drain(int ymin, int ymax, int xmin, int xmax);
|
||||
|
||||
/*
|
||||
* fix_stick:
|
||||
* Init a stick for the hero
|
||||
*/
|
||||
fix_stick(cur)
|
||||
struct object *cur;
|
||||
void
|
||||
fix_stick(struct object *cur)
|
||||
{
|
||||
struct rod *rd;
|
||||
|
||||
|
|
@ -62,8 +65,8 @@ struct object *cur;
|
|||
* do_zap:
|
||||
* Zap a stick at something
|
||||
*/
|
||||
do_zap(gotdir)
|
||||
bool gotdir;
|
||||
void
|
||||
do_zap(bool gotdir)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct object *obj;
|
||||
|
|
@ -537,8 +540,8 @@ bool gotdir;
|
|||
* drain:
|
||||
* Do drain hit points from player stick
|
||||
*/
|
||||
drain(ymin, ymax, xmin, xmax)
|
||||
int ymin, ymax, xmin, xmax;
|
||||
void
|
||||
drain(int ymin, int ymax, int xmin, int xmax)
|
||||
{
|
||||
reg int i, j, cnt;
|
||||
reg struct thing *ick;
|
||||
|
|
@ -580,8 +583,7 @@ int ymin, ymax, xmin, xmax;
|
|||
* Return number of charges left in a stick
|
||||
*/
|
||||
char *
|
||||
charge_str(obj)
|
||||
struct object *obj;
|
||||
charge_str(struct object *obj)
|
||||
{
|
||||
static char buf[20];
|
||||
|
||||
|
|
|
|||
|
|
@ -20,15 +20,14 @@
|
|||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
void basic_init(struct object *cur);
|
||||
|
||||
/*
|
||||
* inv_name:
|
||||
* Return the name of something as it would appear in an inventory.
|
||||
*/
|
||||
char *
|
||||
inv_name(obj, drop)
|
||||
struct object *obj;
|
||||
bool drop;
|
||||
inv_name(struct object *obj, bool drop)
|
||||
{
|
||||
reg char *pb, *tn, *pl;
|
||||
reg int wh, knowit;
|
||||
|
|
@ -183,7 +182,8 @@ bool drop;
|
|||
* money:
|
||||
* Add to characters purse
|
||||
*/
|
||||
money()
|
||||
void
|
||||
money(void)
|
||||
{
|
||||
reg struct room *rp;
|
||||
reg struct linked_list *item;
|
||||
|
|
@ -215,8 +215,8 @@ money()
|
|||
* drop:
|
||||
* put something down
|
||||
*/
|
||||
drop(item)
|
||||
struct linked_list *item;
|
||||
int
|
||||
drop(struct linked_list *item)
|
||||
{
|
||||
reg char ch;
|
||||
reg struct linked_list *ll, *nll;
|
||||
|
|
@ -281,8 +281,8 @@ struct linked_list *item;
|
|||
* dropcheck:
|
||||
* Do special checks for dropping or unweilding|unwearing|unringing
|
||||
*/
|
||||
dropcheck(op)
|
||||
struct object *op;
|
||||
bool
|
||||
dropcheck(struct object *op)
|
||||
{
|
||||
if (op == NULL)
|
||||
return TRUE;
|
||||
|
|
@ -320,9 +320,7 @@ struct object *op;
|
|||
* Return a new thing
|
||||
*/
|
||||
struct linked_list *
|
||||
new_thing(treas, type, which)
|
||||
int type, which;
|
||||
bool treas;
|
||||
new_thing(bool treas, int type, int which)
|
||||
{
|
||||
struct linked_list *item;
|
||||
struct magic_item *mi;
|
||||
|
|
@ -404,8 +402,8 @@ bool treas;
|
|||
* basic_init:
|
||||
* Set all params of an object to the basic values.
|
||||
*/
|
||||
basic_init(cur)
|
||||
struct object *cur;
|
||||
void
|
||||
basic_init(struct object *cur)
|
||||
{
|
||||
cur->o_ac = 11;
|
||||
cur->o_count = 1;
|
||||
|
|
@ -423,7 +421,8 @@ struct object *cur;
|
|||
* extras:
|
||||
* Return the number of extra items to be created
|
||||
*/
|
||||
extras()
|
||||
int
|
||||
extras(void)
|
||||
{
|
||||
reg int i;
|
||||
|
||||
|
|
@ -441,8 +440,8 @@ extras()
|
|||
* pick_one:
|
||||
* Pick an item out of a list of nitems possible magic items
|
||||
*/
|
||||
pick_one(mag)
|
||||
struct magic_item *mag;
|
||||
int
|
||||
pick_one(struct magic_item *mag)
|
||||
{
|
||||
reg struct magic_item *start;
|
||||
reg int i;
|
||||
|
|
|
|||
|
|
@ -11,16 +11,25 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
#define NOTPRICED -1
|
||||
|
||||
bool open_market(void);
|
||||
void trans_line(void);
|
||||
void draw_maze(void);
|
||||
int findcells(int y, int x);
|
||||
void rmwall(int newy, int newx, int oldy, int oldx);
|
||||
void crankout(void);
|
||||
|
||||
/*
|
||||
* do_post:
|
||||
* Put a trading post room and stuff on the screen
|
||||
*/
|
||||
do_post()
|
||||
void
|
||||
do_post(void)
|
||||
{
|
||||
struct coord tp;
|
||||
reg int i;
|
||||
|
|
@ -66,7 +75,8 @@ do_post()
|
|||
* price_it:
|
||||
* Price the object that the hero stands on
|
||||
*/
|
||||
price_it()
|
||||
bool
|
||||
price_it(void)
|
||||
{
|
||||
static char *bargain[] = {
|
||||
"great bargain",
|
||||
|
|
@ -100,7 +110,8 @@ price_it()
|
|||
* buy_it:
|
||||
* Buy the item on which the hero stands
|
||||
*/
|
||||
buy_it()
|
||||
void
|
||||
buy_it(void)
|
||||
{
|
||||
reg int wh;
|
||||
|
||||
|
|
@ -151,7 +162,8 @@ buy_it()
|
|||
* sell_it:
|
||||
* Sell an item to the trading post
|
||||
*/
|
||||
sell_it()
|
||||
void
|
||||
sell_it(void)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct object *obj;
|
||||
|
|
@ -199,7 +211,8 @@ sell_it()
|
|||
* open_market:
|
||||
* Retruns TRUE when ok do to transacting
|
||||
*/
|
||||
open_market()
|
||||
bool
|
||||
open_market(void)
|
||||
{
|
||||
if (trader >= MAXPURCH) {
|
||||
msg("The market is closed. The stairs are that-a-way.");
|
||||
|
|
@ -213,8 +226,8 @@ open_market()
|
|||
* get_worth:
|
||||
* Calculate an objects worth in gold
|
||||
*/
|
||||
get_worth(obj)
|
||||
struct object *obj;
|
||||
int
|
||||
get_worth(struct object *obj)
|
||||
{
|
||||
reg int worth, wh;
|
||||
|
||||
|
|
@ -272,7 +285,8 @@ struct object *obj;
|
|||
* trans_line:
|
||||
* Show how many transactions the hero has left
|
||||
*/
|
||||
trans_line()
|
||||
void
|
||||
trans_line(void)
|
||||
{
|
||||
sprintf(prbuf,"You have %d transactions remaining.",MAXPURCH-trader);
|
||||
mvwaddstr(cw, LINES - 4, 0, prbuf);
|
||||
|
|
@ -282,7 +296,8 @@ trans_line()
|
|||
* domaze:
|
||||
* Draw the maze on this level.
|
||||
*/
|
||||
do_maze()
|
||||
void
|
||||
do_maze(void)
|
||||
{
|
||||
struct coord tp;
|
||||
reg int i, least;
|
||||
|
|
@ -328,14 +343,16 @@ struct bordercells {
|
|||
} mborder;
|
||||
|
||||
char *frontier, *bits;
|
||||
char *moffset(), *foffset();
|
||||
char *moffset(int y, int x);
|
||||
char *foffset(int y, int x);
|
||||
int tlines, tcols;
|
||||
|
||||
/*
|
||||
* draw_maze:
|
||||
* Generate and draw the maze on the screen
|
||||
*/
|
||||
draw_maze()
|
||||
void
|
||||
draw_maze(void)
|
||||
{
|
||||
reg int i, j, more;
|
||||
reg char *ptr;
|
||||
|
|
@ -372,8 +389,7 @@ draw_maze()
|
|||
* Calculate memory address for bits
|
||||
*/
|
||||
char *
|
||||
moffset(y, x)
|
||||
int y, x;
|
||||
moffset(int y, int x)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
|
|
@ -386,8 +402,7 @@ int y, x;
|
|||
* Calculate memory address for frontier
|
||||
*/
|
||||
char *
|
||||
foffset(y, x)
|
||||
int y, x;
|
||||
foffset(int y, int x)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
|
|
@ -399,8 +414,8 @@ int y, x;
|
|||
* findcells:
|
||||
* Figure out cells to open up
|
||||
*/
|
||||
findcells(y,x)
|
||||
int x, y;
|
||||
int
|
||||
findcells(int y, int x)
|
||||
{
|
||||
reg int rtpos, i;
|
||||
|
||||
|
|
@ -450,8 +465,8 @@ int x, y;
|
|||
* rmwall:
|
||||
* Removes appropriate walls from the maze
|
||||
*/
|
||||
rmwall(newy, newx, oldy, oldx)
|
||||
int newy, newx, oldy, oldx;
|
||||
void
|
||||
rmwall(int newy, int newx, int oldy, int oldx)
|
||||
{
|
||||
reg int xdif,ydif;
|
||||
|
||||
|
|
@ -467,7 +482,8 @@ int newy, newx, oldy, oldx;
|
|||
* crankout:
|
||||
* Does actual drawing of maze to window
|
||||
*/
|
||||
crankout()
|
||||
void
|
||||
crankout(void)
|
||||
{
|
||||
reg int x, y, i;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* See the file LICENSE.TXT for full copyright and licensing information.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
|
@ -22,8 +23,8 @@
|
|||
* missile:
|
||||
* Fire a missile in a given direction
|
||||
*/
|
||||
missile(ydelta, xdelta)
|
||||
int ydelta, xdelta;
|
||||
void
|
||||
missile(int ydelta, int xdelta)
|
||||
{
|
||||
reg struct object *obj, *nowwield;
|
||||
reg struct linked_list *item, *nitem;
|
||||
|
|
@ -83,9 +84,8 @@ int ydelta, xdelta;
|
|||
* do the actual motion on the screen done by an object traveling
|
||||
* across the room
|
||||
*/
|
||||
do_motion(obj, ydelta, xdelta)
|
||||
struct object *obj;
|
||||
int ydelta, xdelta;
|
||||
void
|
||||
do_motion(struct object *obj, int ydelta, int xdelta)
|
||||
{
|
||||
reg int ch, y, x;
|
||||
|
||||
|
|
@ -120,9 +120,8 @@ int ydelta, xdelta;
|
|||
* Drop an item someplace around here.
|
||||
*/
|
||||
|
||||
fall(item, pr)
|
||||
struct linked_list *item;
|
||||
bool pr;
|
||||
void
|
||||
fall(struct linked_list *item, bool pr)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct room *rp;
|
||||
|
|
@ -155,9 +154,8 @@ bool pr;
|
|||
* Set up the initial goodies for a weapon
|
||||
*/
|
||||
|
||||
init_weapon(weap, type)
|
||||
struct object *weap;
|
||||
int type;
|
||||
void
|
||||
init_weapon(struct object *weap, int type)
|
||||
{
|
||||
reg struct init_weps *iwp;
|
||||
|
||||
|
|
@ -182,9 +180,8 @@ int type;
|
|||
* hit_monster:
|
||||
* Does the missile hit the monster
|
||||
*/
|
||||
hit_monster(mp, obj)
|
||||
struct coord *mp;
|
||||
struct object *obj;
|
||||
bool
|
||||
hit_monster(struct coord *mp, struct object *obj)
|
||||
{
|
||||
return fight(mp, obj, TRUE);
|
||||
}
|
||||
|
|
@ -194,8 +191,7 @@ struct object *obj;
|
|||
* Figure out the plus number for armor/weapons
|
||||
*/
|
||||
char *
|
||||
num(n1, n2)
|
||||
int n1, n2;
|
||||
num(int n1, int n2)
|
||||
{
|
||||
static char numbuf[LINLEN];
|
||||
|
||||
|
|
@ -212,7 +208,8 @@ int n1, n2;
|
|||
* wield:
|
||||
* Pull out a certain weapon
|
||||
*/
|
||||
wield()
|
||||
void
|
||||
wield(void)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct object *obj, *oweapon;
|
||||
|
|
@ -238,9 +235,8 @@ wield()
|
|||
* fallpos:
|
||||
* Pick a random position around the give (y, x) coordinates
|
||||
*/
|
||||
fallpos(pos, newpos, passages)
|
||||
struct coord *pos, *newpos;
|
||||
bool passages;
|
||||
bool
|
||||
fallpos(struct coord *pos, struct coord *newpos, bool passages)
|
||||
{
|
||||
reg int y, x, ch;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "rogue.h"
|
||||
#include "rogue.ext"
|
||||
|
||||
|
|
@ -23,8 +24,8 @@
|
|||
* whatis:
|
||||
* What a certain object is
|
||||
*/
|
||||
whatis(what)
|
||||
struct linked_list *what;
|
||||
void
|
||||
whatis(struct linked_list *what)
|
||||
{
|
||||
reg struct object *obj;
|
||||
reg struct linked_list *item;
|
||||
|
|
@ -74,8 +75,8 @@ struct linked_list *what;
|
|||
* create_obj:
|
||||
* Create any object for wizard or scroll (almost)
|
||||
*/
|
||||
create_obj(fscr)
|
||||
bool fscr;
|
||||
void
|
||||
create_obj(bool fscr)
|
||||
{
|
||||
reg struct linked_list *item;
|
||||
reg struct object *obj;
|
||||
|
|
@ -245,7 +246,8 @@ bool fscr;
|
|||
* getbless:
|
||||
* Get a blessing for a wizards object
|
||||
*/
|
||||
getbless()
|
||||
int
|
||||
getbless(void)
|
||||
{
|
||||
int bless;
|
||||
|
||||
|
|
@ -263,8 +265,8 @@ getbless()
|
|||
* makemons:
|
||||
* Make a monster
|
||||
*/
|
||||
makemons(what)
|
||||
int what;
|
||||
bool
|
||||
makemons(int what)
|
||||
{
|
||||
reg int x, y, oktomake = FALSE, appear = 1;
|
||||
struct coord mp;
|
||||
|
|
@ -293,9 +295,8 @@ int what;
|
|||
* telport:
|
||||
* Bamf the thing someplace else
|
||||
*/
|
||||
teleport(spot, th)
|
||||
struct coord spot;
|
||||
struct thing *th;
|
||||
int
|
||||
teleport(struct coord spot, struct thing *th)
|
||||
{
|
||||
reg int rm, y, x;
|
||||
struct coord oldspot;
|
||||
|
|
@ -345,7 +346,8 @@ struct thing *th;
|
|||
* passwd:
|
||||
* See if user knows password
|
||||
*/
|
||||
passwd()
|
||||
bool
|
||||
passwd(void)
|
||||
{
|
||||
reg char *sp, c;
|
||||
bool passok;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue