Annotation of 43BSDTahoe/games/sail/pl_2.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1983 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that the above copyright notice and this paragraph are
                      7:  * duplicated in all such forms and that any documentation,
                      8:  * advertising materials, and other materials related to such
                      9:  * distribution and use acknowledge that the software was developed
                     10:  * by the University of California, Berkeley.  The name of the
                     11:  * University may not be used to endorse or promote products derived
                     12:  * from this software without specific prior written permission.
                     13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     16:  */
                     17: 
                     18: #ifndef lint
                     19: static char sccsid[] = "@(#)pl_2.c     5.3 (Berkeley) 6/18/88";
                     20: #endif /* not lint */
                     21: 
                     22: #include "player.h"
                     23: 
                     24: play()
                     25: {
                     26:        register struct ship *sp;
                     27: 
                     28:        for (;;) {
                     29:                switch (sgetch("~\b", (struct ship *)0, 0)) {
                     30:                case 'm':
                     31:                        acceptmove();
                     32:                        break;
                     33:                case 's':
                     34:                        acceptsignal();
                     35:                        break;
                     36:                case 'g':
                     37:                        grapungrap();
                     38:                        break;
                     39:                case 'u':
                     40:                        unfoulplayer();
                     41:                        break;
                     42:                case 'v':
                     43:                        Signal("%s", (struct ship *)0, version);
                     44:                        break;
                     45:                case 'b':
                     46:                        acceptboard();
                     47:                        break;
                     48:                case 'f':
                     49:                        acceptcombat();
                     50:                        break;
                     51:                case 'l':
                     52:                        loadplayer();
                     53:                        break;
                     54:                case 'c':
                     55:                        changesail();
                     56:                        break;
                     57:                case 'r':
                     58:                        repair();
                     59:                        break;
                     60:                case 'B':
                     61:                        Signal("'Hands to stations!'", (struct ship *)0);
                     62:                        unboard(ms, ms, 1);     /* cancel DBP's */
                     63:                        unboard(ms, ms, 0);     /* cancel offense */
                     64:                        break;
                     65:                case '\f':
                     66:                        centerview();
                     67:                        blockalarm();
                     68:                        draw_board();
                     69:                        draw_screen();
                     70:                        unblockalarm();
                     71:                        break;
                     72:                case 'L':
                     73:                        mf->loadL = L_EMPTY;
                     74:                        mf->loadR = L_EMPTY;
                     75:                        mf->readyL = R_EMPTY;
                     76:                        mf->readyR = R_EMPTY;
                     77:                        Signal("Broadsides unloaded", (struct ship *)0);
                     78:                        break;
                     79:                case 'q':
                     80:                        Signal("Type 'Q' to quit", (struct ship *)0);
                     81:                        break;
                     82:                case 'Q':
                     83:                        leave(LEAVE_QUIT);
                     84:                        break;
                     85:                case 'I':
                     86:                        foreachship(sp)
                     87:                                if (sp != ms)
                     88:                                        eyeball(sp);
                     89:                        break;
                     90:                case 'i':
                     91:                        if ((sp = closestenemy(ms, 0, 1)) == 0)
                     92:                                Signal("No more ships left.");
                     93:                        else
                     94:                                eyeball(sp);
                     95:                        break;
                     96:                case 'C':
                     97:                        centerview();
                     98:                        blockalarm();
                     99:                        draw_view();
                    100:                        unblockalarm();
                    101:                        break;
                    102:                case 'U':
                    103:                        upview();
                    104:                        blockalarm();
                    105:                        draw_view();
                    106:                        unblockalarm();
                    107:                        break;
                    108:                case 'D':
                    109:                case 'N':
                    110:                        downview();
                    111:                        blockalarm();
                    112:                        draw_view();
                    113:                        unblockalarm();
                    114:                        break;
                    115:                case 'H':
                    116:                        leftview();
                    117:                        blockalarm();
                    118:                        draw_view();
                    119:                        unblockalarm();
                    120:                        break;
                    121:                case 'J':
                    122:                        rightview();
                    123:                        blockalarm();
                    124:                        draw_view();
                    125:                        unblockalarm();
                    126:                        break;
                    127:                case 'F':
                    128:                        lookout();
                    129:                        break;
                    130:                case 'S':
                    131:                        dont_adjust = !dont_adjust;
                    132:                        blockalarm();
                    133:                        draw_turn();
                    134:                        unblockalarm();
                    135:                        break;
                    136:                }
                    137:        }
                    138: }

unix.superglobalmegacorp.com

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