Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
realm.h
00001 // realm.h 00002 // Some game constants 00003 #define MAP_WIDTH 30 00004 #define MAP_HEIGHT 20 00005 #define MAX_NAME_LEN 20 00006 #define MAX_WEAPONS 4 00007 00008 00009 typedef unsigned char byte; 00010 typedef struct { 00011 byte map[MAP_HEIGHT][MAP_WIDTH]; 00012 00013 } tRealm; 00014 typedef struct { 00015 char name[MAX_NAME_LEN+1]; 00016 byte health; 00017 byte strength; 00018 byte magic; 00019 byte wealth; 00020 byte x,y; 00021 byte Weapon1; 00022 byte Weapon2; 00023 } tPlayer; 00024 00025 // Function prototypes 00026 unsigned prbs(); 00027 unsigned random(unsigned range); 00028 void showHelp(); 00029 void showGameMessage(char *Msg); 00030 char getUserInput(); 00031 void runGame(void); 00032 void initRealm(tRealm *Realm); 00033 void showRealm(tRealm *Realm,tPlayer *thePlayer); 00034 void initPlayer(tPlayer *Player,tRealm *Realm); 00035 void showPlayer(tPlayer *thePlayer); 00036 void step(char Direction,tPlayer *Player,tRealm *Realm); 00037 void setHealth(tPlayer *Player,int health); 00038 void setStrength(tPlayer *Player, byte strength); 00039 int addWeapon(tPlayer *Player, int Weapon); 00040 int doChallenge(tPlayer *Player, int BadGuyIndex); 00041 const char *getWeaponName(int index); 00042 void zap(void);
Generated on Thu Jul 21 2022 10:42:25 by
1.7.2