Annotation of 43BSDReno/games/robots/play_level.c, revision 1.1.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: (1) source distributions retain this entire copyright
                      7:  * notice and comment, and (2) distributions including binaries display
                      8:  * the following acknowledgement:  ``This product includes software
                      9:  * developed by the University of California, Berkeley and its contributors''
                     10:  * in the documentation or other materials provided with the distribution
                     11:  * and in all advertising materials mentioning features or use of this
                     12:  * software. Neither the name of the University nor the names of its
                     13:  * contributors may be used to endorse or promote products derived
                     14:  * from this software without specific prior written permission.
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     18:  */
                     19: 
                     20: #ifndef lint
                     21: static char sccsid[] = "@(#)play_level.c       5.5 (Berkeley) 6/1/90";
                     22: #endif /* not lint */
                     23: 
                     24: # include      "robots.h"
                     25: 
                     26: /*
                     27:  * play_level:
                     28:  *     Let the player play the current level
                     29:  */
                     30: play_level()
                     31: {
                     32:        register COORD  *cp;
                     33:        register int    y, x, bonus;
                     34: 
                     35:        move(My_pos.y, My_pos.x);
                     36:        addch(PLAYER);
                     37:        refresh();
                     38:        for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) {
                     39:                if (cp->y < 0)
                     40:                        continue;
                     41:                move(cp->y, cp->x);
                     42:                addch(ROBOT);
                     43:        }
                     44:        refresh();
                     45: # ifdef DEBUG
                     46:        standout();
                     47:        move(Min.y, Min.x);
                     48:        addch(inch());
                     49:        move(Max.y, Max.x);
                     50:        addch(inch());
                     51:        standend();
                     52: # endif DEBUG
                     53:        setjmp(End_move);
                     54:        flush_in();
                     55:        while (!Dead && Num_robots > 0) {
                     56:                move(My_pos.y, My_pos.x);
                     57:                if (!jumping())
                     58:                        refresh();
                     59:                get_move();
                     60:                if (Real_time)
                     61:                        alarm(0);
                     62:                if (Field[My_pos.y][My_pos.x] != 0)
                     63:                        Dead = TRUE;
                     64:                if (!Dead)
                     65:                        move_robots(FALSE);
                     66:                if (Was_bonus) {
                     67:                        move(Y_PROMPT, X_PROMPT);
                     68:                        clrtoeol();
                     69:                        move(Y_PROMPT + 1, X_PROMPT);
                     70:                        clrtoeol();
                     71:                        Was_bonus = FALSE;
                     72:                }
                     73:        }
                     74: 
                     75:        /*
                     76:         * if the player didn't die, add on the possible bonuses
                     77:         */
                     78: 
                     79:        if (!Dead) {
                     80:                Was_bonus = FALSE;
                     81: 
                     82:                if (Level == Start_level && Start_level > 1) {
                     83:                        move(Y_PROMPT, X_PROMPT);
                     84:                        printw("Advance bonus: %d", S_BONUS);
                     85:                        refresh();
                     86:                        add_score(S_BONUS);
                     87:                        Was_bonus = TRUE;
                     88:                }
                     89: 
                     90:                if (Wait_bonus != 0) {
                     91:                        if (!Was_bonus)
                     92:                                move(Y_PROMPT, X_PROMPT);
                     93:                        else
                     94:                                move(Y_PROMPT + 1, X_PROMPT);
                     95:                        printw("Wait bonus: %d", Wait_bonus);
                     96:                        refresh();
                     97:                        add_score(Wait_bonus);
                     98:                        Was_bonus = TRUE;
                     99:                }
                    100:        }
                    101: }

unix.superglobalmegacorp.com

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