Annotation of 43BSDReno/games/trek/ram.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted provided
        !             6:  * that: (1) source distributions retain this entire copyright notice and
        !             7:  * comment, and (2) distributions including binaries display the following
        !             8:  * acknowledgement:  ``This product includes software developed by the
        !             9:  * University of California, Berkeley and its contributors'' in the
        !            10:  * documentation or other materials provided with the distribution and in
        !            11:  * all advertising materials mentioning features or use of this software.
        !            12:  * Neither the name of the University nor the names of its contributors may
        !            13:  * be used to endorse or promote products derived from this software without
        !            14:  * specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            16:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            17:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #ifndef lint
        !            21: static char sccsid[] = "@(#)ram.c      5.5 (Berkeley) 6/1/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: # include      "trek.h"
        !            25: 
        !            26: /*
        !            27: **  RAM SOME OBJECT
        !            28: **
        !            29: **     You have run into some sort of object.  It may be a Klingon,
        !            30: **     a star, or a starbase.  If you run into a star, you are really
        !            31: **     stupid, because there is no hope for you.
        !            32: **
        !            33: **     If you run into something else, you destroy that object.  You
        !            34: **     also rack up incredible damages.
        !            35: */
        !            36: 
        !            37: ram(ix, iy)
        !            38: int    ix, iy;
        !            39: {
        !            40:        register int            i;
        !            41:        register char           c;
        !            42: 
        !            43:        printf("\07RED ALERT\07: collision imminent\n");
        !            44:        c = Sect[ix][iy];
        !            45:        switch (c)
        !            46:        {
        !            47: 
        !            48:          case KLINGON:
        !            49:                printf("%s rams Klingon at %d,%d\n", Ship.shipname, ix, iy);
        !            50:                killk(ix, iy);
        !            51:                break;
        !            52: 
        !            53:          case STAR:
        !            54:          case INHABIT:
        !            55:                printf("Yeoman Rand: Captain, isn't it getting hot in here?\n");
        !            56:                sleep(2);
        !            57:                printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n");
        !            58:                lose(L_STAR);
        !            59: 
        !            60:          case BASE:
        !            61:                printf("You ran into the starbase at %d,%d\n", ix, iy);
        !            62:                killb(Ship.quadx, Ship.quady);
        !            63:                /* don't penalize the captain if it wasn't his fault */
        !            64:                if (!damaged(SINS))
        !            65:                        Game.killb += 1;
        !            66:                break;
        !            67:        }
        !            68:        sleep(2);
        !            69:        printf("%s heavily damaged\n", Ship.shipname);
        !            70: 
        !            71:        /* select the number of deaths to occur */
        !            72:        i = 10 + ranf(20 * Game.skill);
        !            73:        Game.deaths += i;
        !            74:        Ship.crew -= i;
        !            75:        printf("McCoy: Take it easy Jim; we had %d casualties.\n", i);
        !            76: 
        !            77:        /* damage devices with an 80% probability */
        !            78:        for (i = 0; i < NDEV; i++)
        !            79:        {
        !            80:                if (ranf(100) < 20)
        !            81:                        continue;
        !            82:                damage(i, (2.5 * (franf() + franf()) + 1.0) * Param.damfac[i]);
        !            83:        }
        !            84: 
        !            85:        /* no chance that your shields remained up in all that */
        !            86:        Ship.shldup = 0;
        !            87: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.