xref: /dragonfly/games/phantasia/phantglobs.c (revision 0db87cb7)
1 /*
2  * phantglobs.c - globals for Phantasia
3  *
4  * $DragonFly: src/games/phantasia/phantglobs.c,v 1.3 2005/05/31 00:06:26 swildner Exp $
5  */
6 
7 #include "include.h"
8 
9 double	drandom(void);
10 
11 double	Circle;		/* which circle player is in			*/
12 double	Shield;		/* force field thrown up in monster battle	*/
13 
14 bool	Beyond;		/* set if player is beyond point of no return	*/
15 bool	Marsh;		/* set if player is in dead marshes		*/
16 bool	Throne;		/* set if player is on throne			*/
17 bool	Changed;	/* set if important player stats have changed	*/
18 bool	Wizard;		/* set if player is the 'wizard' of the game	*/
19 bool	Timeout;	/* set if short timeout waiting for input	*/
20 bool	Windows;	/* set if we are set up for curses stuff	*/
21 bool	Luckout;	/* set if we have tried to luck out in fight	*/
22 bool	Foestrikes;	/* set if foe gets a chance to hit in battleplayer()	*/
23 bool	Echo;		/* set if echo input to terminal		*/
24 
25 int	Users;		/* number of users currently playing		*/
26 int	Whichmonster;	/* which monster we are fighting		*/
27 int	Lines;		/* line on screen counter for fight routines	*/
28 
29 jmp_buf Fightenv;	/* used to jump into fight routine		*/
30 jmp_buf Timeoenv;	/* used for timing out waiting for input	*/
31 
32 long	Fileloc;	/* location in file of player statistics	*/
33 
34 const char *Login;	/* pointer to login of player			*/
35 const char *Enemyname;	/* pointer name of monster/player we are battling*/
36 
37 struct	player	Player;	/* stats for player				*/
38 struct	player	Other;	/* stats for another player			*/
39 
40 struct	monster	Curmonster;/* stats for current monster			*/
41 
42 struct	energyvoid Enrgyvoid;/* energy void buffer			*/
43 
44 struct	charstats *Statptr;/* pointer into Stattable[]			*/
45 
46 /* lookup table for character type dependent statistics */
47 struct	charstats Stattable[7] = {
48 	{
49 	/* MAGIC USER */
50 	/* max brains, max mana, weakness, gold tote, ring duration */
51 	15.0, 200.0, 18.0, 175.0, 10,
52 	/* quickness,	strength,	mana */
53 	{30, 6, 0.0},	{10, 6, 2.0},	{50, 51, 75.0},
54 	/* energy,	brains,		magic lvl */
55 	{30, 16, 20.0},	{60, 26, 6.0},	{5, 5, 2.75}
56 	},
57 
58 	{
59 	/* FIGHTER */
60 	/* max brains, max mana, weakness, gold tote, ring duration */
61 	10.0, 110.0, 15.0, 220.0, 20,
62 	/* quickness,	strength,	mana */
63 	{30, 6, 0.0},	{40, 16, 3.0},	{30, 21, 40.0},
64 	/* energy,	brains,		magic lvl */
65 	{45, 26, 30.0},	{25, 21, 3.0},	{3, 4, 1.5}
66 	},
67 
68 	{
69 	/* ELF */
70 	/* max brains, max mana, weakness, gold tote, ring duration */
71 	12.0, 150.0, 17.0, 190.0, 13,
72 	/* quickness,	strength,	mana */
73 	{32, 7, 0.0},	{35, 11, 2.5},	{45, 46, 65.0},
74 	/* energy,	brains,		magic lvl */
75 	{30, 21, 25.0},	{40, 26, 4.0},	{4, 4, 2.0}
76 	},
77 
78 	{
79 	/* DWARF */
80 	/* max brains, max mana, weakness, gold tote, ring duration */
81 	7.0, 80.0, 13.0, 255.0,  25,
82 	/* quickness,	strength,	mana */
83 	{25, 6, 0.0},	{50, 21, 5.0},	{25, 21, 30.0},
84 	/* energy,	brains,		magic lvl */
85 	{60, 41, 35.0},	{20, 21, 2.5},	{2, 4, 1.0}
86 	},
87 
88 	{
89 	/* HALFLING */
90 	/* max brains, max mana, weakness, gold tote, ring duration */
91 	11.0, 80.0, 10.0, 125.0, 40,
92 	/* quickness,	strength,	mana */
93 	{34, 0, 0.0},	{20, 6, 2.0},	{25, 21, 30.0},
94 	/* energy,	brains,		magic lvl */
95 	{55, 36, 30.0},	{40, 36, 4.5},	{1, 4, 1.0}
96 	},
97 
98 	{
99 	/* EXPERIMENTO */
100 	/* max brains, max mana, weakness, gold tote, ring duration */
101 	9.0, 90.0, 16.0, 160.0, 20,
102 	/* quickness,	strength,	mana */
103 	{27, 0, 0.0},	{25, 0, 0.0},	{100, 0, 0.0},
104 	/* energy,	brains,		magic lvl */
105 	{35, 0, 0.0},	{25, 0, 0.0},	{2, 0, 0.0}
106 	},
107 
108 	{
109 	/* SUPER */
110 	/* max brains, max mana, weakness, gold tote, ring duration */
111 	15.0, 200.0, 10.0, 225.0, 40,
112 	/* quickness,	strength,	mana */
113 	{38, 0, 0.0},	{65, 0, 5.0},	{100, 0, 75.0},
114 	/* energy,	brains,		magic lvl */
115 	{80, 0, 35.0},	{85, 0, 6.0},	{9, 0, 2.75}
116 	}
117 };
118 
119 /* menu of items for purchase */
120 struct menuitem	Menu[] = {
121 	{"Mana", 1},
122 	{"Shield", 5},
123 	{"Book", 200},
124 	{"Sword", 500},
125 	{"Charm", 1000},
126 	{"Quicksilver", 2500},
127 	{"Blessing", 1000}
128 };
129 
130 FILE	*Playersfp;	/* pointer to open player file			*/
131 FILE	*Monstfp;	/* pointer to open monster file			*/
132 FILE	*Messagefp;	/* pointer to open message file			*/
133 FILE	*Energyvoidfp;	/* pointer to open energy void file		*/
134 
135 char	Databuf[SZ_DATABUF];	/* a place to read data into		*/
136 
137 /* some canned strings for messages */
138 const char	Illcmd[] = "Illegal command.\n";
139 const char	Illmove[] = "Too far.\n";
140 const char	Illspell[] = "Illegal spell.\n";
141 const char	Nomana[] = "Not enought mana for that spell.\n";
142 const char	Somebetter[] = "But you already have something better.\n";
143 const char	Nobetter[] = "That's no better than what you already have.\n";
144 
145 /* return a random number */
146 double
147 drandom(void)
148 {
149     if (sizeof(int) != 2)
150 	return((double) (random() & 0x7fff) / 32768.0);
151     else
152 	return((double) random() / 32768.0);
153 }
154