1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
|
// 041510.0046 DM
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "time.h"
#define X 215 // Wall
#define D 35 // Door (Locked)
#define K 11 // Key
#define W 37 // Water
#define Q 216 // Teleporter
#define B 240 // Bomb
#define R 120 // Bombable wall
#define T 207 // Tree
#define EDGE1 13 // Max south border
#define EDGE2 30 // Max east border
void debug(); // Debug Mode
void display(); // Prints the map
void usedir(); // Enacts the input keystroke
void printstring(); // Prints the info string, if any
void lookat(); // Look at an object
void enactmap(); // Does command of current map-tile (Pick up key, teleport, ect..)
void battle(); // Random battle
void bdisplay(); // Battle display
int x=25,y=2,clvl=0; // Character X/Y, Current Map
int keys,bombs; // Amount of key/bombs currently possessed '
int rn;
int HP=10,MP=10,STR=10,DEX=10,INT=10,STA=10,LVL=0;
int cHP=10,cMP=10,cSTR=10,cDEX=10,cINT=10,cSTA=10,cXP=0;
int lvlup[5]={25,35,45,55,65};
int mcount=1; // Number of monsters in current battle
int cmonsters[8]={999,999,999,999,999,999,999,999,}; // Types of monsters in current battle
char dir; // Input command
int count,count2; // Used in for() loops
float fcount,fcount2; // Used in float for() loops
int temp; // Temp value
float ftemp; // Temp float point value
int skipclear=0; // Skips the clrscr() command in display()
int currstring=0; // Current string at bottom of display()
int map[3][EDGE1][EDGE2] = {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0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
int mapinfo[4][34] = {
26, 4, 5, 3, 1, 0, 2, 3, 2, 0, // x/Telepad 1, y/Telepad 1, x/Destination, y/Destination, clvl/Destination,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99,99, 1,99, 1000, 500, // North Edge clvl, South Edge clvl, West edge clvl, East edge clvl, Random Battle %, Extra Enemy %,
11, 22, 33, 44, 55, 66, 77, 88, // Random Enemies 1-8
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10,11,12,13,14, 15,16,17,18,19,
99, 2,99, 0, 1000, 500, // 20,21,22,23, 24, 25,
11, 22, 33, 44, 55, 66, 77, 88, // 26, 27, 28, 29, 30, 31, 32, 33
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1,99,99,99, 1000, 500,
999,999,999,999,999,999,999,999,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99,99,99,99, 9999, 999,
999,999,999,999,999,999,999,999,
};
main()
{
// Seeding random number
srand(time(NULL));
for ( ; ; )
{
// Show display
display();
// Take keystroke
dir = getche();
// Use keystroke
usedir();
// Enact map tile
enactmap();
// Battle
if ( rand()%10000+1 <= mapinfo[clvl][24] )
battle();
}
}
void display()
{
// Clear screen
if (skipclear==1) skipclear=0;
else clrscr();
// Top border
printf ("%c",1);
for (count=0;count!=32;count++)
printf ("%c",6);
printf ("%c\n",2);
for (count=0;count!=EDGE1;count++)
{
printf ("%c ",25);
for (count2=0;count2!=EDGE2;count2++)
{
if (map[clvl][count][count2]=='0') printf (" "); // Empty Ground
else if (count==y&&count2==x) printf ("!"); // Character
else printf ("%c",map[clvl][count][count2]); // Default
}
printf (" %c\n",23);
}
// Top border
printf ("%c",3);
for (count=0;count!=32;count++)
printf ("%c",6);
printf ("%c\n",4);
if (currstring!=0) printstring(); // String
else printf("\n");
if (keys<=5) // Keys
{
for (count=0;count<=keys-1;count++) printf ("[%c] ",K);
printf ("\n");
}
else printf ("[%c] x %d\n",K,keys);
if (bombs<=5) // Bombs
{
for (count=0;count<=bombs-1;count++) printf ("[%c] ",B);
printf ("\n");
}
else printf ("[%c] x %d\n",B,bombs);
printf ("XP: [");
for (fcount=.1;fcount<=1.1;fcount+=.1) // XP Bar
{
ftemp=fcount*lvlup[LVL];
if (ftemp<=cXP) printf ("%c",127);
else printf (" ");
}
printf ("] %d/%d\n",cXP,lvlup[LVL]);
printf ("\n|| x: %d || y: %d || dir: %c || keys: %d || bombs: %d || clvl: %d\nN: %d || S: %d || W: %d || E: %d\n Fight Index: %d\ncXP: %d, lvlup[LVL]: %d",x,y,dir,keys,bombs,clvl,mapinfo[clvl][20],mapinfo[clvl][21],mapinfo[clvl][22],mapinfo[clvl][23],mapinfo[clvl][24],cXP,lvlup[LVL]); // Temporary Status Bar
}
|