⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 poa.cpp

📁 Proverbs of Apocrypha (RPG) - Version 2 - Beta 1 ] good !
💻 CPP
📖 第 1 页 / 共 5 页
字号:
         case 13:  // Enter Pressed
            test = 0;
            break;
         default:
            break;
      }
   }
   return(choice); 
}

int potionandspellmenu(int starty, int startx, int potorspl, int max, ...){
   int move;
   int arrowmove;
   int loop = 1;
   int choice = 1;
   char* strs[max];
   char header[MAXSTRING];
   int counter = 1;
   bool breakout;
   CPotion temppot;
   CSpell tempspell;
   
   va_list strings;
   va_start(strings, max);
   strcpy(header, va_arg(strings, char*));
   for(int x = 0; x < max; x++)
      strs[counter++] = va_arg(strings, char*);
   va_end(strings);
   
   clrselection(3, MAPROWSIZE - 15, COLSIZE - 29, COLSIZE - 1);
   for(int a  = 3; a < MAPROWSIZE - 15; a++){
      gotoxy(a, COLSIZE - 30);  cout<<vertwall<<flush;
   }
   gotoxy(2, COLSIZE - 30);  cout<<fliptee<<flush;
   gotoxy(MAPROWSIZE - 15, COLSIZE - 30);  cout<<tee<<flush;
   
   
   while(loop != 0){
      breakout = false;
      if(choice == max + 1)
         choice = 1;
      else if(choice == 0)
         choice = max;
      for(int index = 0; index < max; index++){
         if(index + 1 == choice){
            if(index == 0){
               if(startx >= 0)
                  arrows(header, 0, starty + index, startx);
               else
                  arrows(header, 0, starty + index, 0, -startx);
               clrselection(3, MAPROWSIZE - 15, COLSIZE - 29, COLSIZE - 1);
            }
            else{
               if(startx >= 0)
                  arrows(strs[index], 0, starty + index, startx);
               else
                  arrows(strs[index], 0, starty + index, 0, -startx);
               if(potorspl == 1){                                             // A Potion
                  for(int a = 0; a < TOTALPOTIONS && !breakout; a++){
                     if(strcmp(strs[index], allPotions[a].getname()) == 0){
                        breakout = true;
                        temppot = allPotions[a];
                     }   
                  }
                  if(!breakout)
                     Error("Error:  potionandspellmenu: Potion Not Found");
                  temppot.displaybattleinfo();
               }
               else{                                                               // A Spell
                  for(int a = 0; a < TOTALSPELLS && !breakout; a++){
                     if(strcmp(strs[index], allSpells[a].getname()) == 0){
                        breakout = true;
                        tempspell = allSpells[a];
                     }   
                  }
                  if(!breakout)
                     Error("Error:  potionandspellmenu: Spell Not Found");
                  tempspell.displaybattleinfo();
               } 
            }
         }
         else{
            if(index == 0){
               if(startx >= 0)
                  centerText(header, starty + index, startx, COLSIZE);
               else
                  centerText(header, starty + index, 0, -startx);
            }
            else{
               if(startx >= 0)
                  centerText(strs[index], starty + index, startx, COLSIZE);
               else
                  centerText(strs[index], starty + index, 0, -startx);
            }   
            cout<<" ";  // To get rid of arrow that may be appended from when
                        // the arrow was pointed here
         }      
      }
      gotoxy(0, 0); cout<<flush;
      
      move = getch();
      switch(move){
         case 224:
            arrowmove = getch();
            switch(arrowmove){
               case 72:  // Up Arrow Pressed
                  choice -= 1;
                  break;
               case 80:  // Down Arrow Pressed
                  choice += 1;
                  break;
               default:
                  break;
            }   
            break;
         case 13:  // Enter Pressed
            loop = 0;
            break;
         default:
            break;
      }   
   }
   
   clrselection(3, MAPROWSIZE - 15, COLSIZE - 30, COLSIZE - 1);
   gotoxy(2, COLSIZE - 30);  cout<<horwall<<flush;
   gotoxy(MAPROWSIZE - 15, COLSIZE - 30);  cout<<horwall<<flush;
   
   return(choice);
}  

void helpMenu(){
   int helpChoice;
   bool loop = true;
   
   //while(loop){
      clrnon_border();
      
      centerText("Help Menu", 5);
      centerText("Select An Area for Information on It", 6);
      
   while(loop){ 
      helpChoice = menu(8, 0, 5, "Map Hotkeys", "Item/Spell Information", "What Stats Really Do", "FAQ", "Leave Help");
      switch(helpChoice){
         case 1:
            clrselection(12, MAPROWSIZE - 1, 1, COLSIZE - 1);
            centerText("There are Currently 3 Map Hotkeys", 13);
            centerText("While You Roam the Map, Try These Out", 14);
            centerText("Press 'm' to View Your Positon Relative to the Entire Map", 16);
            centerText("Press 'k' to View a Key/Legend of What's on the Map", 17);
            centerText("Press 'h' to go to the Help Menu", 18);
            break;
         case 2:
            clrselection(12, MAPROWSIZE - 1, 1, COLSIZE - 1);
            centerText("Items, Spells, and their Terms Explained", 13);
            gotoxy(15, 5);  cout<<"'Base' Refers to the Damage of the Item/Spell Alone"<<flush;
            gotoxy(16, 5);  cout<<"'Actual' Refers to the Damage of the Item/Spell When Equipped"<<flush;
            gotoxy(18, 5);  cout<<"More Coming Soon"<<flush;
            break;
         case 3:
            clrselection(12, MAPROWSIZE - 1, 1, COLSIZE - 1);
            centerText("How Each Stat Actually Helps You", 13);
            gotoxy(15, 5);  cout<<"Strength:  Adds to Weapon Damage, +(str*.15) to min and max damage, plus an"<<flush;
            gotoxy(16, 10);  cout<<"extra +(str*.15) to min and max damage when using your correct wep"<<flush;
            gotoxy(18, 5);  cout<<"Dexterity:  "<<flush;
            gotoxy(21, 5);  cout<<"Vitality:  +2 Life, "<<flush;
            gotoxy(24, 5);  cout<<"Energy:  +2 Mana, "<<flush;
            break;
         case 4:
            clrselection(12, MAPROWSIZE - 1, 1, COLSIZE - 1);
            centerText("Frequently Asked Questions", 13);
            gotoxy(15, 5);  cout<<"Q:  Why does a weapon with the same base damage do less actual damage"<<flush;
            gotoxy(16, 10);  cout<<"than another weapon?"<<flush;
            gotoxy(17, 5);  cout<<"A:  This happens becuase of character class bonuses.  A barbarian"<<flush;
            gotoxy(18, 10);  cout<<"using an axe will do more damage than a barbarian using a sword"<<flush;
            gotoxy(19, 10);  cout<<"(assuming same base damage).  This is becuase axes are the barbarians"<<flush;
            gotoxy(20, 10);  cout<<"specialty item.  Knights get a bonus for swords, Sorcerers get a"<<flush;
            gotoxy(21, 10);  cout<<"bonus for spells, and Elves get a bonus for bows."<<flush;
            centerText("More Coming Soon", 22);
            break;
         case 5:
            loop = false;
            break;
         default:
            Error("Error:  helpMenu: Invalid helpChoice");
      }
      gotoxy(0, 0);  cout<<flush;
   }   
}   


// Save & Load Game Function Definitions
int saveGame(){
   char filename[strlen(mainchar.getname()) + 5];
   ifstream filePointer;
   ofstream fileWriter;
   char newName[MAXSTRING];
   int overwrite;
   
   restart:
   
   clrnon_border();
   
   strcpy(filename, mainchar.getname());
   strcat(filename, ".pas");
   
   filePointer.open(filename);
   
   if(filePointer.is_open()){
      filePointer.close();
      
      centerText("A Game is Already Saved with the name: ", 2, 0, COLSIZE, 7, 1, mainchar.getname());
      centerText("Do you want to Overwrite the previously saved Game?", 4);
      
      overwrite = menu(6, 0, 3, "Yes", "No ", "Change My Name and Save with the New Name");
      
      switch(overwrite){
         case 1:
            break;
         case 2:
            newtop("Game NOT Saved!");
            return(1);
            break;
         case 3:
            do{
               gotoxy(10,18);
               cout<<"Enter Your Characters New Name:  "<<flush;
               cin.getline(newName, MAXSTRING);
               cin.sync();
            } while(strcmp(newName, "\0") == 0);
            
            mainchar.assignName(newName);
            goto restart;
            break;
         default:
            Error("Error:  Savegame: Invalid overwrite choice");
      }   
   }
   
   clrnon_border();
   
   centerText("Saving...", 10);
   
   fileWriter.open(filename);
   
   fileWriter << mainchar.getname() << endl;
   fileWriter << mainchar.getclass() << endl;
   fileWriter << mainchar.getexp() << endl;
   fileWriter << mainchar.getgold() << endl;
   fileWriter << mainchar.getlvl() << endl;
   fileWriter << mainchar.gethp() << endl;
   fileWriter << mainchar.gethpMax() << endl;
   fileWriter << mainchar.getmana() << endl;
   fileWriter << mainchar.getmanaMax() << endl;
   fileWriter << mainchar.getstr() << endl;
   fileWriter << mainchar.getdex() << endl;
   fileWriter << mainchar.getvit() << endl;
   fileWriter << mainchar.getenergy() << endl;
   fileWriter << mainchar.getwep().getid() << endl;
   fileWriter << mainchar.gethelm().getid() << endl;
   fileWriter << mainchar.getarmor().getid() << endl;
   fileWriter << mainchar.getshield().getid() << endl;
   
   for(int indexSpells = 0; indexSpells < MAXSPELLS; indexSpells++){
      fileWriter << mainchar.getspells(indexSpells).getid() << endl;
   }
   for(int indexInvItems = 0; indexInvItems < MAXITEMSPERINV; indexInvItems++){
      fileWriter << mainchar.getinv(indexInvItems).getid() << endl;
   }
   for(int indexPots = 0; indexPots < MAXPOTS; indexPots++){
      fileWriter << mainchar.getpots(indexPots).getid() << endl;
   }
   
   fileWriter << mainchar.gettileY() << endl;
   fileWriter << mainchar.gettileX() << endl;
   
   fileWriter.close();
   
   Sleep(300);

   return(0);
}

int loadGame(){
   ifstream fileReader;
   char tempName[MAXSTRING];
   char tempClass[MAXSTRING];
   int texp;
   int tgold;
   int tlvl;
   int thp;
   int thpMax;
   int tmana;
   int tmanaMax;
   int tstr;
   int tdex;
   int tvit;
   int tenergy;
   int weaponid;
   int helmid;
   int armorid;
   int shieldid;
   int spellids[MAXSPELLS];
   int invids[MAXITEMSPERINV];
   int potids[MAXPOTS];
   int ttileY;
   int ttileX;
   
   clrnon_border();
   
   centerText("Character Name to Load:  ", 5);
   cin.getline(tempName, MAXSTRING);
   strcat(tempName, ".pas");
   
   fileReader.open(tempName);
   if(!fileReader.is_open()){
      newtop("Character Not Found!");
      return(1);
   }
   
   clrnon_border();
   
   centerText("Loading...", 10);
   
   fileReader.getline(tempName, MAXSTRING);
   fileReader.getline(tempClass, MAXSTRING);
   fileReader >> texp;
   fileReader >> tgold;
   fileReader >> tlvl;
   fileReader >> thp;
   fileReader >> thpMax;
   fileReader >> tmana;
   fileReader >> tmanaMax;
   fileReader >> tstr;
   fileReader >> tdex;
   fileReader >> tvit;
   fileReader >> tenergy;
   fileReader >> weaponid;
   fileReader >> helmid;
   fileReader >> armorid;
   fileReader >> shieldid; 
   
   for(int indexSpells = 0; indexSpells < MAXSPELLS; indexSpells++){
      fileReader >> spellids[indexSpells];
   }
   for(int indexInvItems = 0; indexInvItems < MAXITEMSPERINV; indexInvItems++){
      fileReader >> invids[indexInvItems];
   }
   for(int indexPots = 0; indexPots < MAXPOTS; indexPots++){
      fileReader >> potids[indexPots];
   }   
	
   fileReader >> ttileY;
   fileReader >> ttileX;

   fileReader.close();

   mainchar.assembleChar(tempName, tempClass, texp, tgold, tlvl, thp, thpMax, tmana, tmanaMax, tstr, tdex, tvit, tenergy, weaponid, helmid, armorid, shieldid, spellids, invids, potids, ttileY, ttileX);
   
   Sleep(300);
   
   clrnon_border(1, 0, 0, 0, 0);
   mainchar.displayinfo(0, 0, 0, 0);
   
   if(mainchar.gettileY() == town1.tileY && mainchar.gettileX() == town1.tileX)
      gototown(town1);
   else if(mainchar.gettileY() == town2.tileY && mainchar.gettileX() == town2.tileX)
      gototown(town2);
   else if(mainchar.gettileY() == town3.tileY && mainchar.gettileX() 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -