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