xref: /netbsd-src/games/phantasia/phantglobs.c (revision e28fc9086cd7f59ab0a7363c8a37303b5a0d04a0)
1*e28fc908Sdholland /*	$NetBSD: phantglobs.c,v 1.6 2009/08/31 08:27:16 dholland Exp $	*/
2dcfebd78Scgd 
386a62b8dSjtc /*
486a62b8dSjtc  * phantglobs.c - globals for Phantasia
586a62b8dSjtc  */
686a62b8dSjtc 
7*e28fc908Sdholland #include <setjmp.h>
8*e28fc908Sdholland #include <stdio.h>
9*e28fc908Sdholland 
10*e28fc908Sdholland #include "phantdefs.h"
11*e28fc908Sdholland #include "phantstruct.h"
12*e28fc908Sdholland #include "phantglobs.h"
13*e28fc908Sdholland 
1486a62b8dSjtc 
1586a62b8dSjtc double	Circle;		/* which circle player is in			*/
1686a62b8dSjtc double	Shield;		/* force field thrown up in monster battle	*/
1786a62b8dSjtc 
1886a62b8dSjtc bool	Beyond;		/* set if player is beyond point of no return	*/
1986a62b8dSjtc bool	Marsh;		/* set if player is in dead marshes		*/
2086a62b8dSjtc bool	Throne;		/* set if player is on throne			*/
2186a62b8dSjtc bool	Changed;	/* set if important player stats have changed	*/
2286a62b8dSjtc bool	Wizard;		/* set if player is the 'wizard' of the game	*/
2386a62b8dSjtc bool	Timeout;	/* set if short timeout waiting for input	*/
2486a62b8dSjtc bool	Windows;	/* set if we are set up for curses stuff	*/
2586a62b8dSjtc bool	Luckout;	/* set if we have tried to luck out in fight	*/
2686a62b8dSjtc bool	Foestrikes;	/* set if foe gets a chance to hit in battleplayer()	*/
2786a62b8dSjtc bool	Echo;		/* set if echo input to terminal		*/
2886a62b8dSjtc 
2986a62b8dSjtc int	Users;		/* number of users currently playing		*/
3086a62b8dSjtc int	Whichmonster;	/* which monster we are fighting		*/
3186a62b8dSjtc int	Lines;		/* line on screen counter for fight routines	*/
3286a62b8dSjtc 
3386a62b8dSjtc jmp_buf Fightenv;	/* used to jump into fight routine		*/
3486a62b8dSjtc jmp_buf Timeoenv;	/* used for timing out waiting for input	*/
3586a62b8dSjtc 
3686a62b8dSjtc long	Fileloc;	/* location in file of player statistics	*/
3786a62b8dSjtc 
38a6bb9f4eSmycroft const char *Login;	/* pointer to login of player			*/
39092d3130Sjsm const char *Enemyname;	/* pointer name of monster/player we are battling*/
4086a62b8dSjtc 
4186a62b8dSjtc struct	player	Player;	/* stats for player				*/
4286a62b8dSjtc struct	player	Other;	/* stats for another player			*/
4386a62b8dSjtc 
4486a62b8dSjtc struct	monster	Curmonster;/* stats for current monster			*/
4586a62b8dSjtc 
4686a62b8dSjtc struct	energyvoid Enrgyvoid;/* energy void buffer			*/
4786a62b8dSjtc 
48092d3130Sjsm const struct	charstats *Statptr;/* pointer into Stattable[]		*/
4986a62b8dSjtc 
5086a62b8dSjtc /* lookup table for character type dependent statistics */
51092d3130Sjsm const struct	charstats Stattable[7] = {
5286a62b8dSjtc 	/* MAGIC USER */
53a232aee2Slukem 	{
5486a62b8dSjtc 		15.0, 200.0, 18.0, 175.0, 10,
55a232aee2Slukem 			{30, 6, 0.0},	{10, 6, 2.0},	{50, 51, 75.0},
56a232aee2Slukem 			{30, 16, 20.0},	{60, 26, 6.0},	{5, 5, 2.75}
57a232aee2Slukem 	},
5886a62b8dSjtc 
5986a62b8dSjtc 	/* FIGHTER */
60a232aee2Slukem 	{
6186a62b8dSjtc 		10.0, 110.0, 15.0, 220.0, 20,
62a232aee2Slukem 			{30, 6, 0.0},	{40, 16, 3.0},	{30, 21, 40.0},
63a232aee2Slukem 			{45, 26, 30.0},	{25, 21, 3.0},	{3, 4, 1.5}
64a232aee2Slukem 	},
6586a62b8dSjtc 
6686a62b8dSjtc 	/* ELF */
67a232aee2Slukem 	{
6886a62b8dSjtc 		12.0, 150.0, 17.0, 190.0, 13,
69a232aee2Slukem 			{32, 7, 0.0},	{35, 11, 2.5},	{45, 46, 65.0},
70a232aee2Slukem 			{30, 21, 25.0},	{40, 26, 4.0},	{4, 4, 2.0}
71a232aee2Slukem 	},
7286a62b8dSjtc 
7386a62b8dSjtc 	/* DWARF */
74a232aee2Slukem 	{	 7.0, 80.0, 13.0, 255.0,  25,
75a232aee2Slukem 			{25, 6, 0.0},	{50, 21, 5.0},	{25, 21, 30.0},
76a232aee2Slukem 			{60, 41, 35.0},	{20, 21, 2.5},	{2, 4, 1.0}
77a232aee2Slukem 	},
7886a62b8dSjtc 
7986a62b8dSjtc 	/* HALFLING */
80a232aee2Slukem 	{
8186a62b8dSjtc 		11.0, 80.0, 10.0, 125.0, 40,
82a232aee2Slukem 			{34, 0, 0.0},	{20, 6, 2.0},	{25, 21, 30.0},
83a232aee2Slukem 			{55, 36, 30.0},	{40, 36, 4.5},	{1, 4, 1.0}
84a232aee2Slukem 	},
8586a62b8dSjtc 
8686a62b8dSjtc 	/* EXPERIMENTO */
87a232aee2Slukem 	{	 9.0, 90.0, 16.0, 160.0, 20,
88a232aee2Slukem 			{27, 0, 0.0},	{25, 0, 0.0},	{100, 0, 0.0},
89a232aee2Slukem 			{35, 0, 0.0},	{25, 0, 0.0},	{2, 0, 0.0}
90a232aee2Slukem 	},
9186a62b8dSjtc 
9286a62b8dSjtc 	/* SUPER */
93a232aee2Slukem 	{
9486a62b8dSjtc 		15.0, 200.0, 10.0, 225.0, 40,
95a232aee2Slukem 			{38, 0, 0.0},	{65, 0, 5.0},	{100, 0, 75.0},
96a232aee2Slukem 			{80, 0, 35.0},	{85, 0, 6.0},	{9, 0, 2.75}
97a232aee2Slukem 	}
9886a62b8dSjtc };
9986a62b8dSjtc 
10086a62b8dSjtc /* menu of items for purchase */
101092d3130Sjsm const struct menuitem	Menu[] = {
102a232aee2Slukem 	{"Mana", 1},
103a232aee2Slukem 	{"Shield", 5},
104a232aee2Slukem 	{"Book", 200},
105a232aee2Slukem 	{"Sword", 500},
106a232aee2Slukem 	{"Charm", 1000},
107a232aee2Slukem 	{"Quicksilver", 2500},
108a232aee2Slukem 	{"Blessing", 1000},
10986a62b8dSjtc };
11086a62b8dSjtc 
11186a62b8dSjtc FILE	*Playersfp;	/* pointer to open player file			*/
11286a62b8dSjtc FILE	*Monstfp;	/* pointer to open monster file			*/
11386a62b8dSjtc FILE	*Messagefp;	/* pointer to open message file			*/
11486a62b8dSjtc FILE	*Energyvoidfp;	/* pointer to open energy void file		*/
11586a62b8dSjtc 
11686a62b8dSjtc char	Databuf[SZ_DATABUF];	/* a place to read data into		*/
11786a62b8dSjtc 
11886a62b8dSjtc /* some canned strings for messages */
119092d3130Sjsm const char	Illcmd[] = "Illegal command.\n";
120092d3130Sjsm const char	Illmove[] = "Too far.\n";
121092d3130Sjsm const char	Illspell[] = "Illegal spell.\n";
122092d3130Sjsm const char	Nomana[] = "Not enought mana for that spell.\n";
123092d3130Sjsm const char	Somebetter[] = "But you already have something better.\n";
124092d3130Sjsm const char	Nobetter[] = "That's no better than what you already have.\n";
125