#include <allegro.h>
#include <sstream>
using namespace std;
namespace Jobs {
/* Declaring My Variables */
// INTEGERS
int pointsLeft = 10;
int numY = 0;
int numX = 0;
int num = 0;
int pointsGain [6] = {0,0,0,0,0,0};
int AtkVal;
int DefenseVal;
int Sequence = 0;
int JobNumber = 0;
int setJobNumber;
int totalPoints = 0;
int maxPoints =4;
// BOOLEAN
bool Gain = true;
// BITMAPS
BITMAP *bBackgrounds [4];
BITMAP *bSelection [4];
// FONTS
FONT *MainFont;
/* End of Declaring My Variables */
/* Declaring and defining of my Functions */
bool JobStart (int sequence) { // or if designdone = true
if (sequence == 3)
return true;
else
return false;
}
void LoadImages () {
for (int i = 0; i < 4; i++) {
stringstream str;
str << "Jobs\\Background" << i + 1 << ".bmp";
bBackgrounds [i] = load_bitmap (str.str().c_str(), NULL);
if (!bBackgrounds [i])
allegro_message ("Error could not find %s" , str.str().c_str() );
} // End of For Loop (Backgrounds)
// i can put them both in the same for loop but I'm doing this for neatness purposes
for (int i = 0; i < 4; i++) {
stringstream str;
str << "Jobs\\Selection" << i+ 1 << ".bmp";
bSelection [i] = load_bitmap (str.str().c_str(), NULL);
if (!bSelection [i])
allegro_message ("Error could not fine %s" , str.str().c_str() );
}
MainFont = load_font ("Fonts.pcx", NULL, NULL);
} // End of LoadImages
void Display (BITMAP *Buffer) {
blit (bBackgrounds [JobNumber], Buffer , 0, 0, 0, 0, 640, 480);
masked_blit (bSelection [JobNumber], Buffer, 0, 0, 0, 0, 640, 480);
textout_ex (Buffer, MainFont, "Warrior", 520, 45, makecol (255, 0, 0), -1);
textout_ex (Buffer, MainFont, "Mage", 520, 165, makecol (255, 0, 0), -1);
textout_ex (Buffer, MainFont, "Thief", 520, 285, makecol (255, 0, 0), -1);
textout_ex (Buffer, MainFont, "Knight", 520, 405, makecol (255, 0, 0), -1);
} // End of Display
void ChooseJob () { // choose class
if (Sequence == 0) {
} // End of If Sequence == 0
} // End of ChooseJob
void Controls () {
if (Sequence == 0) {
if (key [KEY_UP])
JobNumber --;
else if (key [KEY_DOWN])
JobNumber ++;
rest (40);
} // End of If Sequence == 0
else if (Sequence == 1) {
while (Sequence == 1)
if (key [KEY_DOWN]) {
numY += 100;
num ++;
} // End of If statement
else if (key [KEY_UP]) {
numY -= 100;
num --;
} // End if Else-If Statement
if (key [KEY_RIGHT]) {
pointsLeft --; // you lose points when you add them to an attribute.
if (Gain == true)
pointsGain[num] ++;
}// End if If Statement
else if (key [KEY_LEFT]){
pointsLeft ++;
pointsGain[num] --;
} // End if Else-If Statement
if (key [KEY_Z] && Gain == false) {
Sequence ++;
} // End of If Statement
} // End of Else-If Sequence == 1
} // End of Controls
void Restrictions () {
for ( int i = 0 ; i < 6 ; i ++ ) {
totalPoints += pointsGain [i];
} // End of For Loop
if (totalPoints >= maxPoints) {
Gain = false;
} else {
Gain = true;
} // End of Else Statement
if (JobNumber > 3)
JobNumber = 3;
else if (JobNumber < 0)
JobNumber = 0;
} // End of Restrictions
void Attack (BITMAP *Buffer) {
} // End of Attack
/* End of Declaring and Defining of my Functions */
}// End of namespace Jobs
|