home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Killer
/
Game_Killer.bin
/
014.DSAVANT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-04
|
14KB
|
648 lines
/* SHAREWARE from Darland Enterprises
if you find this program useful send $10.00
(In IOWA plus $0.60 sales tax)
TO DARLAND ENTERPISES
1965 Winding Hills RD #1304
Davenport IA 52807 */
/* Written as dos executable using Microsoft visual c++ */
#include <fstream.h>
#include <fcntl.h>
#include <io.h>
#include <stdlib.h>
#include <string.h>
#define DEBUG_N
#define PROD_N
#include "dsavant.h"
static char fname[80];
ofstream lpt("PC.TXT");
void pc_class::pc_print()
{
lpt << "Name: " << name << "\n";
switch (sex)
{
case MALE:
lpt << "Male\n";
break;
case FEMALE:
lpt << "Female\n";
break;
}
switch (race)
{
case HUMAN:
lpt << "Human\n";
break;
case ELF:
lpt << "Elf\n";
break;
case HOBBIT:
lpt << "Hobbit\n";
break;
case LIZARDMAN:
lpt << "Lizardman\n";
break;
case DRACON:
lpt << "Dracon\n";
break;
case DWARF:
lpt << "Dwarf\n";
break;
case GNOME:
lpt << "Gnome\n";
break;
case FAERIE:
lpt << "Faerie\n";
break;
case FELPURR:
lpt << "Felpurr\n";
break;
case RAWULF:
lpt << "Rawulf\n";
break;
case MOOK:
lpt << "Mook\n";
break;
default:
lpt << "Race: " << (int) race << "\n";
break;
}
switch (player_class)
{
case MAGE:
lpt << "Mage\n";
break;
case THIEF:
lpt << "Thief\n";
break;
case FIGHTER:
lpt << "Fighter\n";
break;
case PRIEST:
lpt << "Priest\n";
break;
case RANGER:
lpt << "Ranger\n";
break;
case ALCHEMIST:
lpt << "Alchemist\n";
break;
case BARD:
lpt << "Bard\n";
break;
case PSIONIC:
lpt << "Psionic\n";
break;
case VALKYRI:
lpt << "Valkyri\n";
break;
case BISHOP:
lpt << "Bishop\n";
break;
case LORD:
lpt << "Lord\n";
break;
case SAMURAI:
lpt << "Samurai\n";
break;
case MONK:
lpt << "Monk\n";
break;
case NINJA:
lpt << "Ninja\n";
break;
default:
lpt << "CLASS: " << (int) player_class << "\n";
break;
}
lpt << "Experience " << (unsigned long) experience << "\n";
lpt << "Gold " << (unsigned long) gold << "\n";
lpt << "Hits " << (int) hit_points << "/" << max_hit_points << "\n";
lpt << "Strength " << (int) strength << "\n";
lpt << "Intelligence " << (int) intelligence << "\n";
lpt << "Piety " << (int) piety << "\n";
lpt << "Vitality " << (int) vitality << "\n";
lpt << "Dexterity " << (int) dexterity << "\n";
lpt << "Speed " << (int) speed << "\n";
lpt << "Personality " << (int) personality << "\n";
lpt << "Karma " << (int) karma << "\n";
cout << "Name: " << name << "\n";
switch (sex)
{
case MALE:
cout << "Male\n";
break;
case FEMALE:
cout << "Female\n";
break;
}
switch (race)
{
case HUMAN:
cout << "Human\n";
break;
case ELF:
cout << "Elf\n";
break;
case HOBBIT:
cout << "Hobbit\n";
break;
case LIZARDMAN:
cout << "Lizardman\n";
break;
case DRACON:
cout << "Dracon\n";
break;
case DWARF:
cout << "Dwarf\n";
break;
case GNOME:
cout << "Gnome\n";
break;
case FAERIE:
cout << "Faerie\n";
break;
case FELPURR:
cout << "Felpurr\n";
break;
case RAWULF:
cout << "Rawulf\n";
break;
case MOOK:
cout << "Mook\n";
break;
default:
cout << "Race: " << (int) race << "\n";
break;
}
switch (player_class)
{
case MAGE:
cout << "Mage\n";
break;
case THIEF:
cout << "Thief\n";
break;
case FIGHTER:
cout << "Fighter\n";
break;
case PRIEST:
cout << "Priest\n";
break;
case RANGER:
cout << "Ranger\n";
break;
case ALCHEMIST:
cout << "Alchemist\n";
break;
case BARD:
cout << "Bard\n";
break;
case PSIONIC:
cout << "Psionic\n";
break;
case VALKYRI:
cout << "Valkyri\n";
break;
case BISHOP:
cout << "Bishop\n";
break;
case LORD:
cout << "Lord\n";
break;
case SAMURAI:
cout << "Samurai\n";
break;
case MONK:
cout << "Monk\n";
break;
case NINJA:
cout << "Ninja\n";
break;
default:
cout << "CLASS: " << (int) player_class << "\n";
break;
}
cout << "Experience " << (unsigned long) experience << "\n";
cout << "Gold " << (unsigned long) gold << "\n";
cout << "Hits " << (int) hit_points << "/" << max_hit_points << "\n";
cout << "Strength " << (int) strength << "\n";
cout << "Intelligence " << (int) intelligence << "\n";
cout << "Piety " << (int) piety << "\n";
cout << "Vitality " << (int) vitality << "\n";
cout << "Dexterity " << (int) dexterity << "\n";
cout << "Speed " << (int) speed << "\n";
cout << "Personality " << (int) personality << "\n";
cout << "Karma " << (int) karma << "\n";
}
void pc_class::pc_edit()
{
char choice;
unsigned long value;
while (choice != 'q')
{
cout << "Name: " << name << "\n";
switch (sex)
{
case MALE:
cout << "Male\n";
break;
case FEMALE:
cout << "Female\n";
break;
}
switch (race)
{
case HUMAN:
cout << "Human\n";
break;
case ELF:
cout << "Elf\n";
break;
case HOBBIT:
cout << "Hobbit\n";
break;
case LIZARDMAN:
cout << "Lizardman\n";
break;
case DRACON:
cout << "Dracon\n";
break;
case DWARF:
cout << "Dwarf\n";
break;
case GNOME:
cout << "Gnome\n";
break;
case FAERIE:
cout << "Faerie\n";
break;
case FELPURR:
cout << "Felpurr\n";
break;
case RAWULF:
cout << "Rawulf\n";
break;
case MOOK:
cout << "Mook\n";
break;
default:
cout << "Race: " << (int) race << "\n";
break;
}
switch (player_class)
{
case MAGE:
cout << "Mage\n";
break;
case THIEF:
cout << "Thief\n";
break;
case FIGHTER:
cout << "Fighter\n";
break;
case PRIEST:
cout << "Priest\n";
break;
case RANGER:
cout << "Ranger\n";
break;
case ALCHEMIST:
cout << "Alchemist\n";
break;
case BARD:
cout << "Bard\n";
break;
case PSIONIC:
cout << "Psionic\n";
break;
case VALKYRI:
cout << "Valkyri\n";
break;
case BISHOP:
cout << "Bishop\n";
break;
case LORD:
cout << "Lord\n";
break;
case SAMURAI:
cout << "Samurai\n";
break;
case MONK:
cout << "Monk\n";
break;
case NINJA:
cout << "Ninja\n";
break;
default:
cout << "CLASS: " << (int) player_class << "\n";
break;
}
cout << "1 Experience " << (unsigned long) experience << "\n";
cout << "2 Strength " << (int) strength << "\n";
cout << "3 Intelligence " << (int) intelligence << "\n";
cout << "4 Piety " << (int) piety << "\n";
cout << "5 Vitality " << (int) vitality << "\n";
cout << "6 Dexterity " << (int) dexterity << "\n";
cout << "7 Speed " << (int) speed << "\n";
cout << "8 Personality " << (int) personality << "\n";
cout << "9 Karma " << (int) karma << "\n";
cout << "h Hits " << (int) hit_points << "\n";
cout << "m Maximum Hits " << (int) max_hit_points << "\n";
cout << "g Gold " << (unsigned long) gold << "\n";
cout << "q Quit\n";
cout << "Choice:\n";
cin >> choice;
switch (choice)
{
case '1':
cout << "Experience desired:\n";
cin >> value;
if (value >= 0)
experience = value;
break;
case 'g':
cout << "Gold desired:\n";
cin >> value;
if (value >= 0)
gold = value;
break;
case 'h':
cout << "Hits desired\n";
cin >> value;
if (value >= 1 && value <= max_hit_points)
hit_points = value;
else
cout << "Illegal value\n";
break;
case 'm':
cout << "Maximum Hits desired\n";
cin >> value;
if (value >= hit_points && value < 32000)
max_hit_points = value;
else
cout << "Illegal value\n";
break;
break;
#ifdef DEBUG_1
case 'c':
cout << "Class desired\n";
cin >> value;
player_class = value;
break;
#endif
case '2':
cout << "Strength desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
strength = value;
else
cout << "Illegal value\n";
break;
case '3':
cout << "Intelligence desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
intelligence = value;
else
cout << "Illegal value\n";
break;
case '4':
cout << "Piety desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
piety = value;
else
cout << "Illegal value\n";
break;
case '5':
cout << "Vitality desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
vitality = value;
else
cout << "Illegal value\n";
break;
case '6':
cout << "Dexterity desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
dexterity = value;
else
cout << "Illegal value\n";
break;
case '7':
cout << "Speed desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
speed = value;
else
cout << "Illegal value\n";
break;
case '8':
cout << "Personality desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
personality = value;
else
cout << "Illegal value\n";
break;
case '9':
cout << "Karma desired:\n";
cin >> value;
if (value >= 3 && value <= 18)
karma = value;
else
cout << "Illegal value\n";
break;
case 'q':
break;
}
}
}
void pc_file_class::init()
{
int i;
cout << "Enter filename or 'y' for C:\\dsavant\\savegame.dbs\n";
cout << "You MUST enter a non empty string\n";
cin >> fname;
if (fname[0]=='y' && fname[1]==0)
strcpy(fname,"c:\\dsavant\\savegame.dbs");
ifstream pcf(fname,ios::in|ios::binary);
pcf.read((char *) &unkf1[0], 14324);
if (!pcf.good())
{
cout << "File not found\n";
exit(0);
}
for (i=0;i<360;i++ )
unkt1[i]=1;
for (i=0;i<208;i++)
unkt2[i]=1;
pcf.close();
}
void pc_file_class::fin()
{
int i;
ofstream pcf(fname,ios::out|ios::binary);
pcf.write((char *) &unkf1[0], 14324);
pcf.close();
}
void pc_file_class::pc_print()
{
int i;
for (i=0;i<6;i++)
{
// if (this->pc_status[i])
{
this->pcs[i].pc_print();
}
}
}
void pc_file_class::pc_edit()
{
int i;
char choice;
int sub;
choice = 0;
while (choice != '7')
{
for (i=0;i<6;i++)
{
cout << i+1 << " " << pcs[i].name << "\n";
}
cout << "7 Quit\n";
cout << "Choice:";
cin >> choice;
sub = choice - '1';
if (sub >= 0 && sub < 6 )
pcs[sub].pc_edit();
}
}
#ifdef DEBUG_1
void pc_file_class::pc_comp()
{
int i;
int sel1,sel2,sel3;
cout << "Char 1 sub:";
cin >> sel1;
cout << "Char 2 sub:";
cin >> sel2;
cout << "Char 3 sub:";
cin >> sel3;
for (i=0;i<360;i++)
{
this->unkt1[i] = this->unkt1[i] && this->pcs[sel1].unk1[i] == this->pcs[sel2].unk1[i]
&& this->pcs[sel1].unk1[i] != this->pcs[sel3].unk1[i];
}
for (i=0;i<208;i++)
{
this->unkt2[i] = this->unkt2[i] && this->pcs[sel1].unk2[i] == this->pcs[sel2].unk2[i]
&& this->pcs[sel1].unk2[i] != this->pcs[sel3].unk2[i];
}
}
void pc_file_class::pc_results()
{
int i;
for (i=0;i<360;i++)
{
if (this->unkt1[i])
{
cout << "t1[i] = " << i << "\n";
lpt << "t1[i] = " << i << "\n";
}
}
for (i=0;i<208;i++)
{
if (this->unkt2[i])
{
cout << "t2[i] = " << i << "\n";
lpt << "t2[i] = " << i << "\n";
}
}
}
#endif
main()
{
char choice;
pc_file_class *dspcdjd = new pc_file_class;
if (dspcdjd == NULL)
{
cout << "out of memory\n";
}
dspcdjd->init();
choice = 0;
while (choice != '3')
{
cout << "Copyright (C) Dennis J. Darland 1993\n";
cout << "Shareware If you find this program useful, send \n";
cout << " a check for $10.00 \n" ;
cout << "In Iowa, add 6% sales tax = $0.60. Total $10.60 in Iowa\n";
cout << "To: Darland Enterprises/Savant\n";
cout << "1965 Winding Hills Road #1304\n";
cout << "Davenport, IA 52807\n";
cout << "\n";
cout << "MENU\n";
cout << "\n";
cout << "1. Print characters to pc.txt\n";
#ifdef DEBUG_1
cout << "C. Compare\n";
cout << "R. Compare results\n";
#endif
cout << "2. Edit character\n";
cout << "3. Quit\n";
cout << "Choice:";
cin >> choice;
switch (choice)
{
case '1':
dspcdjd->pc_print();
break;
#ifdef DEBUG_1
case 'C':
dspcdjd->pc_comp();
break;
case 'R':
dspcdjd->pc_results();
break;
#endif
case '2':
dspcdjd->pc_edit();
case '3':
break;
}
}
dspcdjd->fin();
}