xref: /csrg-svn/games/trek/lose.c (revision 60857)
125993Smckusick /*
2*60857Sbostic  * Copyright (c) 1980, 1993
3*60857Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542606Sbostic  * %sccs.include.redist.c%
625993Smckusick  */
725993Smckusick 
811681Smckusick #ifndef lint
9*60857Sbostic static char sccsid[] = "@(#)lose.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111681Smckusick 
1211681Smckusick # include	"trek.h"
1344314Sbostic # include	<setjmp.h>
1411681Smckusick 
1511681Smckusick /*
1611681Smckusick **  PRINT OUT LOSER MESSAGES
1711681Smckusick **
1811681Smckusick **	The messages are printed out, the score is computed and
1911681Smckusick **	printed, and the game is restarted.  Oh yeh, any special
2011681Smckusick **	actions which need be taken are taken.
2111681Smckusick */
2211681Smckusick 
2312738Slayer char	*Losemsg[] =
2411681Smckusick {
2511681Smckusick 	"You ran out of time",
2611681Smckusick 	"You ran out of energy",
2711681Smckusick 	"You have been destroyed",
2811681Smckusick 	"You ran into the negative energy barrier",
2911681Smckusick 	"You destroyed yourself by nova'ing that star",
3011681Smckusick 	"You have been caught in a supernova",
3111681Smckusick 	"You just suffocated in outer space",
3211681Smckusick 	"You could not be rematerialized",
3334714Sbostic 	"\n\032\014 ***\07 Ship's hull has imploded\07 ***",
3411681Smckusick 	"You have burned up in a star",
3511681Smckusick 	"Well, you destroyed yourself, but it didn't do any good",
3611681Smckusick 	"You have been captured by Klingons and mercilessly tortured",
3711681Smckusick 	"Your last crew member died",
3811681Smckusick };
3911681Smckusick 
lose(why)4011681Smckusick lose(why)
4111681Smckusick int	why;
4211681Smckusick {
4344314Sbostic 	extern jmp_buf	env;
4444314Sbostic 
4511681Smckusick 	Game.killed = 1;
4611681Smckusick 	sleep(1);
4711681Smckusick 	printf("\n%s\n", Losemsg[why - 1]);
4811681Smckusick 	switch (why)
4911681Smckusick 	{
5011681Smckusick 
5111681Smckusick 	  case L_NOTIME:
5211681Smckusick 		Game.killed = 0;
5311681Smckusick 		break;
5411681Smckusick 	}
5511681Smckusick 	Move.endgame = -1;
5611681Smckusick 	score();
5711681Smckusick 	skiptonl(0);
5844314Sbostic 	longjmp(env, 1);
5911681Smckusick }
60