|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 3364 (0xd24)
Types: TextFile
Names: »death.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/X/Xtrek/death.c«
static char sccsid[] = "@(#)death.c 1.1";
/*
#ifdef HPUX
#include <time.h>
#else HPUX
#include <sys/time.h>
#endif HPUX
Copyright (c) 1986 Chris Guthrie
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation. No representations are made about the
suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
*/
#include <X11/Xlib.h>
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>
#include <sys/types.h>
#ifdef hpux
#include <time.h>
#else hpux
#include <sys/time.h>
#endif hpux
#include "defs.h"
#include "data.h"
death(p)
register struct player *p;
{
char buf[80];
p->p_status = PDEAD;
p->p_explode = DEATHTIME;
if (!(p->p_flags & PFROBOT)) {
XClearWindow(p->display, p->w);
if (!p->mono) {
XSetWindowBorder(p->display, p->baseWin, p->gColor);
XSetWindowBorder(p->display, p->iconWin, p->gColor);
} else {
XSetWindowBorderPixmap(p->display, p->baseWin, p->gTile);
XSetWindowBorderPixmap(p->display, p->iconWin, p->gTile);
}
}
switch (p->p_whydead) {
case KQUIT:
sprintf(buf, "You have self-destructed");
warning(p, buf);
break;
case KTORP:
sprintf(buf, "You were killed by a torp from %s (%c%x) who was %d%% damaged",
players[p->p_whodead].p_name,
teamlet[players[p->p_whodead].p_team],
p->p_whodead,
players[p->p_whodead].p_damage);
warning(p, buf);
break;
case KPHASER:
sprintf(buf, "You were killed by a phaser shot from %s (%c%x) who was %d%% damaged",
players[p->p_whodead].p_name,
teamlet[players[p->p_whodead].p_team],
p->p_whodead,
players[p->p_whodead].p_damage);
warning(p, buf);
break;
case KPLANET:
sprintf(buf, "You were killed by planetary fire from %s (%c)",
planets[p->p_whodead].pl_name,
teamlet[planets[p->p_whodead].pl_owner]);
warning(p, buf);
break;
case KSHIP:
sprintf(buf, "You were killed by an exploding ship formerly owned by %s (%c%x) who was %d%% damaged",
players[p->p_whodead].p_name,
teamlet[players[p->p_whodead].p_team],
p->p_whodead,
players[p->p_whodead].p_damage);
warning(p, buf);
break;
#ifdef notdef
case KDAEMON:
sprintf(buf, "You were killed by a dying daemon");
warning(p, buf);
p->mustexit = 1;
break;
#endif
case KWINNER:
sprintf(buf, "Galaxy has been conquered by %s (%c%x)",
players[p->p_whodead].p_name,
teamlet[players[p->p_whodead].p_team],
players[p->p_whodead].p_no);
warning(p, buf);
break;
default:
sprintf(buf, "You were killed by something unknown to this game?");
warning(p, buf);
p->mustexit = 1;
break;
}
savestats(p);
if (!(p->p_flags & PFROBOT)) {
if (ismapped(p, p->playerw))
XUnmapWindow(p->display, p->playerw);
if (ismapped(p, p->planetw))
XUnmapWindow(p->display, p->planetw);
if (p->infomapped)
destroyInfo(p);
if (ismapped(p, p->war))
XUnmapWindow(p->display, p->war);
if (p->p_flags & PFSHOWSTATS)
closeStats(p, p->statwin);
p->p_flags &= ~PFSHOWSTATS;
p->p_status = POUTFIT;
} else {
p->p_status = PFREE;
}
}