Annotation of 43BSDTahoe/games/robots/play_level.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
        !             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[] = "@(#)play_level.c       5.4 (Berkeley) 6/18/88";
        !            20: #endif /* not lint */
        !            21: 
        !            22: # include      "robots.h"
        !            23: 
        !            24: /*
        !            25:  * play_level:
        !            26:  *     Let the player play the current level
        !            27:  */
        !            28: play_level()
        !            29: {
        !            30:        register COORD  *cp;
        !            31:        register int    y, x, bonus;
        !            32: 
        !            33:        move(My_pos.y, My_pos.x);
        !            34:        addch(PLAYER);
        !            35:        refresh();
        !            36:        for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) {
        !            37:                if (cp->y < 0)
        !            38:                        continue;
        !            39:                move(cp->y, cp->x);
        !            40:                addch(ROBOT);
        !            41:        }
        !            42:        refresh();
        !            43: # ifdef DEBUG
        !            44:        standout();
        !            45:        move(Min.y, Min.x);
        !            46:        addch(inch());
        !            47:        move(Max.y, Max.x);
        !            48:        addch(inch());
        !            49:        standend();
        !            50: # endif DEBUG
        !            51:        setjmp(End_move);
        !            52:        flush_in();
        !            53:        while (!Dead && Num_robots > 0) {
        !            54:                move(My_pos.y, My_pos.x);
        !            55:                if (!jumping())
        !            56:                        refresh();
        !            57:                get_move();
        !            58:                if (Real_time)
        !            59:                        alarm(0);
        !            60:                if (Field[My_pos.y][My_pos.x] != 0)
        !            61:                        Dead = TRUE;
        !            62:                if (!Dead)
        !            63:                        move_robots(FALSE);
        !            64:                if (Was_bonus) {
        !            65:                        move(Y_PROMPT, X_PROMPT);
        !            66:                        clrtoeol();
        !            67:                        move(Y_PROMPT + 1, X_PROMPT);
        !            68:                        clrtoeol();
        !            69:                        Was_bonus = FALSE;
        !            70:                }
        !            71:        }
        !            72: 
        !            73:        /*
        !            74:         * if the player didn't die, add on the possible bonuses
        !            75:         */
        !            76: 
        !            77:        if (!Dead) {
        !            78:                Was_bonus = FALSE;
        !            79: 
        !            80:                if (Level == Start_level && Start_level > 1) {
        !            81:                        move(Y_PROMPT, X_PROMPT);
        !            82:                        printw("Advance bonus: %d", S_BONUS);
        !            83:                        refresh();
        !            84:                        add_score(S_BONUS);
        !            85:                        Was_bonus = TRUE;
        !            86:                }
        !            87: 
        !            88:                if (Wait_bonus != 0) {
        !            89:                        if (!Was_bonus)
        !            90:                                move(Y_PROMPT, X_PROMPT);
        !            91:                        else
        !            92:                                move(Y_PROMPT + 1, X_PROMPT);
        !            93:                        printw("Wait bonus: %d", Wait_bonus);
        !            94:                        refresh();
        !            95:                        add_score(Wait_bonus);
        !            96:                        Was_bonus = TRUE;
        !            97:                }
        !            98:        }
        !            99: }

unix.superglobalmegacorp.com

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