KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
wump.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <kos.h>
#include <conio/conio.h>

Macros

#define fprintf(a, fmt, args...)
 
#define printf(fmt, args...)
 
#define fgets(buf, len, a)
 
#define fflush(a)
 
#define MAX_ARROW_SHOT_DISTANCE   6 /* +1 for '0' stopper */
 
#define MAX_LINKS_IN_ROOM   25 /* a complex cave */
 
#define MAX_ROOMS_IN_CAVE   250
 
#define ROOMS_IN_CAVE   20
 
#define MIN_ROOMS_IN_CAVE   10
 
#define LINKS_IN_ROOM   3
 
#define NUMBER_OF_ARROWS   5
 
#define PIT_COUNT   3
 
#define BAT_COUNT   3
 
#define EASY   1 /* levels of play */
 
#define HARD   2
 
#define plural(n)
 

Functions

void blagh ()
 
long random ()
 
int bats_nearby (void)
 
void cave_init (void)
 
void clear_things_in_cave (void)
 
void display_room_stats __P ((void))
 
int getans __P ((const char *prompt))
 
void initialize_things_in_cave (void)
 
void instructions (void)
 
int int_compare __P ((const void *va, const void *vb))
 
void jump (int where)
 
void kill_wump (void)
 
int move_to __P ((char *room_number))
 
void move_wump (void)
 
void no_arrows (void)
 
void pit_kill (void)
 
int pit_nearby (void)
 
void pit_survive (void)
 
int shoot __P ((char *room_list))
 
void shoot_self (void)
 
int take_action (void)
 
void usage (void)
 
void wump_kill (void)
 
int wump_nearby (void)
 
int main (int argc, char **argv)
 
void display_room_stats ()
 
int move_to (char *room_number)
 
int shoot (char *room_list)
 
int getans (char *prompt) const
 
int int_compare (void *va, void *vb) const
 

Variables

static const char copyright []
 
static const char rcsid []
 
struct room_record cave [MAX_ROOMS_IN_CAVE+1]
 
int player_loc = -1
 
int wumpus_loc = -1
 
int level = EASY
 
int arrows_left
 
int pit_num = PIT_COUNT
 
int bat_num = BAT_COUNT
 
int room_num = ROOMS_IN_CAVE
 
int link_num = LINKS_IN_ROOM
 
int arrow_num = NUMBER_OF_ARROWS
 
char answer [20]
 

Macro Definition Documentation

◆ BAT_COUNT

#define BAT_COUNT   3

◆ EASY

#define EASY   1 /* levels of play */

Referenced by shoot().

◆ fflush

#define fflush ( a)
Value:
void blagh()
Definition wump.c:80

Referenced by getans(), kbd_readline(), main(), and move_to().

◆ fgets

#define fgets ( buf,
len,
a )
Value:
({ conio_input_getline(-1, buf, len); 1; })

Referenced by getans(), main(), and move_to().

◆ fprintf

#define fprintf ( a,
fmt,
args... )
Value:
conio_printf(fmt, ## args)

Referenced by main(), and usage().

◆ HARD

#define HARD   2

Referenced by initialize_things_in_cave(), and main().

◆ LINKS_IN_ROOM

#define LINKS_IN_ROOM   3

◆ MAX_ARROW_SHOT_DISTANCE

#define MAX_ARROW_SHOT_DISTANCE   6 /* +1 for '0' stopper */

◆ MAX_LINKS_IN_ROOM

#define MAX_LINKS_IN_ROOM   25 /* a complex cave */

Referenced by main().

◆ MAX_ROOMS_IN_CAVE

#define MAX_ROOMS_IN_CAVE   250

Referenced by main().

◆ MIN_ROOMS_IN_CAVE

#define MIN_ROOMS_IN_CAVE   10

Referenced by main().

◆ NUMBER_OF_ARROWS

#define NUMBER_OF_ARROWS   5

◆ PIT_COUNT

#define PIT_COUNT   3

◆ plural

#define plural ( n)
Value:
(n == 1 ? "" : "s")

Referenced by display_room_stats(), and main().

◆ printf

◆ ROOMS_IN_CAVE

#define ROOMS_IN_CAVE   20

Function Documentation

◆ __P() [1/5]

int shoot __P ( (char *room_list) )

◆ __P() [2/5]

int move_to __P ( (char *room_number) )

◆ __P() [3/5]

int getans __P ( (const char *prompt) )

◆ __P() [4/5]

int int_compare __P ( (const void *va, const void *vb) )

◆ __P() [5/5]

void display_room_stats __P ( (void) )

◆ bats_nearby()

int bats_nearby ( void )

References cave, link_num, and player_loc.

Referenced by display_room_stats().

◆ blagh()

void blagh ( )

◆ cave_init()

void cave_init ( void )

References cave, int_compare(), k, link_num, printf, random(), and room_num.

Referenced by main().

◆ clear_things_in_cave()

void clear_things_in_cave ( void )

References cave, and room_num.

Referenced by main().

◆ display_room_stats()

void display_room_stats ( )

◆ getans()

int getans ( char * prompt) const

References fflush, fgets, and printf.

Referenced by instructions(), and main().

◆ initialize_things_in_cave()

void initialize_things_in_cave ( void )

◆ instructions()

void instructions ( void )

References err, getans(), NULL, and printf.

Referenced by main().

◆ int_compare()

int int_compare ( void * va,
void * vb ) const

Referenced by cave_init().

◆ jump()

void jump ( int where)

References printf.

Referenced by move_to().

◆ kill_wump()

void kill_wump ( void )

References printf.

Referenced by shoot().

◆ main()

◆ move_to()

int move_to ( char * room_number)

◆ move_wump()

void move_wump ( void )

References cave, link_num, random(), and wumpus_loc.

Referenced by move_to(), and shoot().

◆ no_arrows()

void no_arrows ( void )

References printf.

Referenced by shoot().

◆ pit_kill()

void pit_kill ( void )

References printf.

Referenced by move_to().

◆ pit_nearby()

int pit_nearby ( void )

References cave, link_num, and player_loc.

Referenced by display_room_stats().

◆ pit_survive()

void pit_survive ( void )

References printf.

Referenced by move_to().

◆ random()

◆ shoot()

◆ shoot_self()

void shoot_self ( void )

References printf.

Referenced by shoot().

◆ take_action()

int take_action ( void )

References answer, move_to(), printf, random(), and shoot().

Referenced by main().

◆ usage()

void usage ( void )

References fprintf.

Referenced by main().

◆ wump_kill()

void wump_kill ( void )

References printf.

Referenced by move_to(), and shoot().

◆ wump_nearby()

int wump_nearby ( void )

Variable Documentation

◆ answer

char answer[20]

Referenced by main(), move_to(), and take_action().

◆ arrow_num

int arrow_num = NUMBER_OF_ARROWS

Referenced by main().

◆ arrows_left

int arrows_left

Referenced by display_room_stats(), main(), and shoot().

◆ bat_num

int bat_num = BAT_COUNT

Referenced by initialize_things_in_cave(), and main().

◆ cave

◆ copyright

const char copyright[]
static
Initial value:
=
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n"

◆ level

int level = EASY

◆ link_num

◆ pit_num

int pit_num = PIT_COUNT

Referenced by initialize_things_in_cave(), and main().

◆ player_loc

◆ rcsid

const char rcsid[]
static
Initial value:
=
"$FreeBSD: src/games/wump/wump.c,v 1.13.2.1 2000/08/17 06:24:54 jhb Exp $"

◆ room_num

◆ wumpus_loc

int wumpus_loc = -1