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