X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/77e3814f0c0e3dea4d0032e25666f77e6f83bfff..7ea815843146ff6795b20eac97afcac82f672785:/rogue/trap.c diff --git a/rogue/trap.c b/rogue/trap.c index 1f523ea2..ae3c9186 100644 --- a/rogue/trap.c +++ b/rogue/trap.c @@ -1,6 +1,8 @@ +/* $NetBSD: trap.c,v 1.10 2009/08/12 08:44:45 dholland Exp $ */ + /* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Timothy C. Stoehr. @@ -13,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -34,8 +32,13 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char sccsid[] = "@(#)trap.c 5.3 (Berkeley) 6/1/90"; +#if 0 +static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: trap.c,v 1.10 2009/08/12 08:44:45 dholland Exp $"); +#endif #endif /* not lint */ /* @@ -56,7 +59,7 @@ trap traps[MAX_TRAPS]; boolean trap_door = 0; short bear_trap = 0; -char *trap_strings[TRAPS * 2] = { +static const char *const trap_strings[TRAPS * 2] = { "trap door", "you fell down a trap", "bear trap", @@ -71,15 +74,8 @@ char *trap_strings[TRAPS * 2] = { "a gush of water hits you on the head" }; -extern short cur_level, party_room; -extern char *new_level_message; -extern boolean interrupted; -extern short ring_exp; -extern boolean sustain_strength; -extern short blind; - -trap_at(row, col) -register row, col; +static short +trap_at(int row, int col) { short i; @@ -91,8 +87,8 @@ register row, col; return(NO_TRAP); } -trap_player(row, col) -short row, col; +void +trap_player(short row, short col) { short t; @@ -101,7 +97,7 @@ short row, col; } dungeon[row][col] &= (~HIDDEN); if (rand_percent(rogue.exp + ring_exp)) { - message("the trap failed", 1); + messagef(1, "the trap failed"); return; } switch(t) { @@ -110,7 +106,7 @@ short row, col; new_level_message = trap_strings[(t*2)+1]; break; case BEAR_TRAP: - message(trap_strings[(t*2)+1], 1); + messagef(1, "%s", trap_strings[(t*2)+1]); bear_trap = get_rand(4, 7); break; case TELE_TRAP: @@ -118,7 +114,7 @@ short row, col; tele(); break; case DART_TRAP: - message(trap_strings[(t*2)+1], 1); + messagef(1, "%s", trap_strings[(t*2)+1]); rogue.hp_current -= get_damage("1d6", 1); if (rogue.hp_current <= 0) { rogue.hp_current = 0; @@ -129,21 +125,22 @@ short row, col; } print_stats(STAT_HP | STAT_STRENGTH); if (rogue.hp_current <= 0) { - killed_by((object *) 0, POISON_DART); + killed_by((object *)0, POISON_DART); } break; case SLEEPING_GAS_TRAP: - message(trap_strings[(t*2)+1], 1); + messagef(1, "%s", trap_strings[(t*2)+1]); take_a_nap(); break; case RUST_TRAP: - message(trap_strings[(t*2)+1], 1); - rust((object *) 0); + messagef(1, "%s", trap_strings[(t*2)+1]); + rust(NULL); break; } } -add_traps() +void +add_traps(void) { short i, n, tries = 0; short row, col; @@ -187,11 +184,12 @@ add_traps() } } -id_trap() +void +id_trap(void) { short dir, row, col, d, t; - message("direction? ", 0); + messagef(0, "direction? "); while (!is_direction(dir = rgetchar(), &d)) { sound_bell(); @@ -208,13 +206,14 @@ id_trap() if ((dungeon[row][col] & TRAP) && (!(dungeon[row][col] & HIDDEN))) { t = trap_at(row, col); - message(trap_strings[t*2], 0); + messagef(0, "%s", trap_strings[t*2]); } else { - message("no trap there", 0); + messagef(0, "no trap there"); } } -show_traps() +void +show_traps(void) { short i, j; @@ -227,9 +226,8 @@ show_traps() } } -search(n, is_auto) -short n; -boolean is_auto; +void +search(short n, boolean is_auto) { short s, i, j, row, col, t; short shown = 0, found = 0; @@ -267,7 +265,8 @@ boolean is_auto; shown++; if (dungeon[row][col] & TRAP) { t = trap_at(row, col); - message(trap_strings[t*2], 1); + messagef(1, "%s", + trap_strings[t*2]); } } } @@ -277,7 +276,7 @@ boolean is_auto; } } if ((!is_auto) && (reg_search = !reg_search)) { - (void) reg_move(); + (void)reg_move(); } } }