home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
gkit.zip
/
GKIT.DOC
< prev
next >
Wrap
Text File
|
1988-05-05
|
13KB
|
265 lines
**********************************************
* PLEASE READ THE FILE GRULES.DOC FIRST! *
**********************************************
/*=====================================================================*/
GATEWAYS DEVELOPMENT KIT DOCUMENTATION
05/05/88.. The first official release. Look for New features highlights
in this spot of the next version.
/*=====================================================================*/
FILES you should have:
GATEWAYS.H A header file that you must include in all your modules
G0KIT.C The test functions and main() driver function
D0MAIN.C A simple example gateways game
D0MAIN.H An example header file for the example game
D0QUEST File of quiz questions used by D0MAIN
D0MAIN.PRJ Project file to use with Turbo C
D0MAIN Makefile to use with Microsoft C 5.0
MAKEFILE Makefile to use with IBM Aztec C
/*=====================================================================*/
GATEWAYS.H features:
GATEWAYS.H contains overgame define macros and compiler specific stuff.
It is not the place for you to add macros and declarations specific to
your game (Create a file like D0MAIN.H and include it in all your files).
Be sure to #include "GATEWAYS.H" at the top of all your game modules.
You will need to edit GATEWAYS.H and indicate which compiler you are using
and what features it supports. The compilers currently supported are
IBM Turbo C, IBM Microsoft (or Quick C), IBM Aztec C, CP/M Aztec C, Amiga
Manx (Aztec) C.
If your compiler is not supported, you will need to add a #define for it
and implement statements in GATEWAYS.H and G0KIT.C to support it. Feel free
to ask me for help and BE SURE TO SEND ME A COPY OF THE CHANGES RIGHT AWAY.
Be sure to place any include statements for include files that come with your
compiler in GATEWAYS.H if needed by your game, or in G0KIT.C if only needed
by the kit functions. Do not include any H files of your own creation in
GATEWAYS.H.
Later you will indicate the name of you entry function to your game
(see GAME in GATEWAYS.H)
You can turn on/off kit validation with VALIDATE.
You can customize carrier loss simulation with SIM_CARRIER and C_LOSS_P.
Before submitting your game, Please reduce C_LOSS_P and thoroughly test
the effects of carrier loss on your game.
You may be able to have the pseudo random numbers start at the same number
to reproduce results by changing RANDOM_START to 0.
Use MAX_PLAYERS as the maximum number of players in the game for setting
aside storage.
Set NUMGATES for the number of gates (exit/entry points) you want in your
game.. Do not use this macro..use the value passed to your entry function
only.
There are some global variables for your use in GATEWAYS.H:
char gss[gss_SIZE]; A character array suitable for temporary string use
void *gp0,*gp1,*gp2,*gp3,*gp4,*gp5,*gp6,*gp7,*gp8,*gp9;
Pointers to use to keep track of og_malloc()'ed memory
see og_malloc() and og_onexit()
int gfd0,gfd1,gfd2; use for file handles
int gflag0,gflag1,gflag2,gflag3; use for global bitmaps
/*=====================================================================*/
LIBRARY FUNCTIONS
Here is a list of functions that your compiler may have that I think are
currently ok to use. This list is subject to change. Please do not use any
functions not listed without asking first.
memcpy(void *dest,const void *source,int count);
memset(void *dest,int c,int count);
double atof(const char *string);
int atoi(const char *string);
long atol(const char *string);
long lseek(int handle,long offset,int origin);
int sprintf(char *buffer,const char *format[[,argument]]...);
double acos(double x),asin(double x),atan(double x),atan2(double x, double y);
double ceil(double x),cos(double x),cosh(double x),fabs(double x);
double fabs(double x),floor(double x),log(double x),log10(double x);
double sin(double x),sinh(double x),sqrt(double x),tan(double x);
double tanh(double x);
strcat(char *dest,char *source);
int strcmp(const char *string1,const char *string2);
strcpy(char *dest,char *source);
int strlen(char *string);
int strncmp(const char *string1,const char *string2,int n);
strncpy(char *dest,char *source,int n);
/*=====================================================================*/
G0KIT.C FUNCTIONS
If you have ideas for changing any of these functions or adding more, please
contact me.
Your entry function will be passed the player#, current# of players,
the gate number the player came in by, and max # of gates that your
game supports. The gate number may be used by the overgame in linking
the games together.
example: int d0main(plnum,numplayers,gatenum,numgates)
If you think of some overgame functions that you need, let me know.
Be sure to use the GATEWAYS echo to communicate your needs and ideas.
/*=====================================================================*/
main() /* driver function for your game */
/*=====================================================================*/
void error_check() /* internal use */
/*====================================================================*/
int og_open(filename,mode) /* open files for read or write */
char *filename;
int mode; /* can be 1 for read/write or 0 for read only */
/*
This function returns a file handle or -1 if the file didn't exist
or -3 if there is an error condition.
Be sure to use the global file handle variables like gfd0 so that
the function you specify to og_onexit() can close any open files
*/
/*=====================================================================*/
int og_create(filename) char *filename; /* create a file with this */
/*
This function returns -3 for an error condition.
Be sure to use the global file handle variables like gfd0 so that
the function you specify to og_onexit() can close any open files
*/
/*=====================================================================*/
int og_close(fd) int fd; /* MAKE SURE YOU CLOSE ALL FILES WITH THIS */
/*=====================================================================*/
int readline(fd,buffer,size,stopat)
/* read a line in from a ascii file until <CR> found */
int fd; file /* handle */
char *buffer; /* where to read into */
int size; /* max size of buffer (includes room for null byte) */
char stopat /* character to stop at before the <CR> if encountered */
/*
- If a line is greater in length than size-1, the remainder of the
line will be ignored and the file positioned at the start of the next line.
- The file is always positioned to the beginning of the next line.
- readline() returns the string length of the line read or it returns -1
if at the end of file or CTRL-Z encountered.
- A null byte (0) is added to the end of the buffer string.
- stopat should be 0 if not used
- an example use for stopat would be to parse phrases separated by comma.
- You can mix calls to uread and readline.
*/
/*=====================================================================*/
int writeline(fd,buffer) /* write a line to a file + <CR><LF> */
int fd; /* file handle */
char *buffer; /* a null terminated string (no <CR><LF> needed) */
/*
returns the length of the string written
*/
/*=====================================================================*/
int writestr(fd,buffer) /* write a ascii str to a file */
int fd; /* file handle */
char *buffer; /* a null terminated string */
/*
returns the length of the string written
*/
/*=====================================================================*/
int uread(fd,buffer,size) /* raw binary mode read */
/*=====================================================================*/
int uwrite(fd,buffer,size) /* raw binary mode write */
/*=====================================================================*/
void og_onexit(fn) void (*fn)();
/*
fn is function in your game to execute if carrier is lost such as to
close files or free up og_malloc()'ed memory.
See example of usage in D0MAIN.C
*/
/*=====================================================================*/
void og_carrier() /* internal usage to simulate random carrier loss */
/*=====================================================================*/
int keyin() /* returns character pressed by player */
/*=====================================================================*/
int keyout(c) char c; /* output a char c to player */
/*=====================================================================*/
int keystat()
/* returns -2 if no char waiting, 1 if char waiting from player */
/* if your compiler doesn't support checking for keyboard status */
/* this will return -2 or 1 on a random basis to simulate */
/*=====================================================================*/
void outstr(ss) char *ss; /* output a string to player */
/*=====================================================================*/
int inpstr(ss,len) /* input a string ss from player */
/* returns 0 */
char *ss; /* buffer location to put string typed in by player */
int len; /* max length of string, NOTE: DOES NOT INCLUDE ROOM FOR NULL BYTE */
/*
len should be no more than the sizeof the buffer - 1
*/
/*=====================================================================*/
int isin(s0,c) /* check to see if char c is in char array s0 */
/* returns 0 if the char c is not in string s0 */
/* else returns the position + 1 where c is found in string s0 */
char *s0; /* the string to be searched */
char c; /* the character you are searching for */
/*=====================================================================*/
void trim(ss) char *ss; /* remove beginning or trailing spaces from string */
/*=====================================================================*/
char upchar(c) char c; /* convert a character to uppercase */
/*=====================================================================*/
void upcfy(ss) char *ss; /* convert a string to upper case */
/*=====================================================================*/
int og_mode(i) int i; /* reserved usage: set modes of overgame */
/*=====================================================================*/
int og_gateways(gnum) int gnum;
/* allow player to exit your game (or not) at your gate# gnum
/* returns -3 must exit -2 continue */
/*=====================================================================*/
char *og_plname(num) int num; /* returns pointer to player #num's name */
/*
Do not assume that this name will always be in memory. In other words,
do not use a pointer to remember where the name is and then call
og_plname() again to get the name of another player and expect the
first player's name to still be there. It may be and it may not.
*/
/*=====================================================================*/
int *og_plscore(num) int num; /* return pointer player #num's score */
/*
Do not assume the score will always be in memory (see og_plname())
*/
/*=====================================================================*/
double drandom() /* return a random double d>=0.0 && d<1.0 */
/*=====================================================================*/
int irandom(max) int max; /* return a random integer i>=0 && i<=max-1 */
/*=====================================================================*/
void *og_malloc(size)
int size; /* keep this value between 30 and 32000 */
/*
- request an area of memory of size bytes and return a pointer to it
or return (void *)0 if failed.
- request no more than 32000 bytes to ensure portability
- avoid requesting small amounts of memory because of the memory overhead of
using og_malloc()
- You MUST keep track of all areas you og_malloc and call og_free() to
free the memory up for each area.
- Remember to notify David Larson of your use of this function and use
of global or static variables.
- Be sure to use the global pointer values (gp0,gp1..) provided to remember
the pointers to the blocks so you can use them to free up the areas in
the function you specify to og_onexit() in order to free them up when
carrier is loss (or some other condition occurs).
*/
/*=====================================================================*/
void og_free(ptr)
void *ptr; /* pointer to the block of memory */
/* Free a block of memory that was requested by og_malloc()
/*=====================================================================*/
/* Designed and written by David M. Larson, BBS: 916-753-8788 opus 203/955 */
/* Dynasoft, P.O. Box 915, Davis, CA 95617 */