diff --git a/Documentation/ChangeLog.md b/Documentation/ChangeLog.md
index e35dde6..31cb341 100644
--- a/Documentation/ChangeLog.md
+++ b/Documentation/ChangeLog.md
@@ -3,17 +3,40 @@
All notable changes to this project will be documented here.
This project adheres to [Semantic Versioning](http://semver.org/)
-## [4.1.1] - 2015-09-03
+## [4.1.2] - 2015-09-04
### Fixed
-* A bug with screen height being linked to player height causing screen to be a bit strange.
+* VSnyc bug
+* Screen being jumpy as the player moves (screen is locked on the first 35 spaces until
+ player goes to the 36th spot then it will be locked on the next 35 spaces, and so on.)
+* Font loading issue on Cygwin
+
+### Added
+
+* Player can now to nothing! Wow!
+
+### Changed
+
+* Error image is now embedded so that even if it cannot load images; it will show the error pictures instead.
+* If font cannot be loaded, messages won't appear instead of program closing
## Old versions
```
+## [4.1.1] - 2015-09-03
+
+### Fixed
+
+* A bug with screen height being linked to player height causing screen to be a bit strange.
+
+### Note
+
+* In this release I accidently left DEFINED_VER_STATUS as "Alpha" which means that the config file will always be replaced.
+
+
## [4.1.0] - 2015-09-03
### Added
diff --git a/Images/Readme.md b/Images/Readme.md
index 8c22636..374ddbc 100644
--- a/Images/Readme.md
+++ b/Images/Readme.md
@@ -16,12 +16,14 @@ This picture represents the coins of the game.
The coin itself is a Mario Coin. But the image was designed by [Sandro Pereira] (http://sandrodcpereira.deviantart.com/?rnrd=50936). You can find the original [here] (http://findicons.com/icon/423492/retro_coin).
-### Error.png
+### Error.xpm
This picture is used if an unknown tile is on the map.
This picture was created by [Hopstarter](http://hopstarter.deviantart.com/) you can find the original [here] (http://www.iconarchive.com/show/button-icons-by-hopstarter/Button-Close-icon.html).
+The image was converted to an xpm using GIMP to allow the image to be embedded into the program so that it can always load.
+
### Monster.png
This picture is used to represent the monsters.
diff --git a/Project/Experimental-Platformer-AI.cbp b/Project/Experimental-Platformer-AI.cbp
index f6bac8d..e180b04 100644
--- a/Project/Experimental-Platformer-AI.cbp
+++ b/Project/Experimental-Platformer-AI.cbp
@@ -25,7 +25,7 @@
-
+
@@ -53,8 +53,8 @@
-
-
+
+
@@ -92,6 +92,7 @@
+
diff --git a/Project/NP++ Workspace.txt b/Project/NP Workspace.txt
similarity index 100%
rename from Project/NP++ Workspace.txt
rename to Project/NP Workspace.txt
diff --git a/Source/entity.cpp b/Source/entity.cpp
index f8771a2..f9a7ff9 100644
--- a/Source/entity.cpp
+++ b/Source/entity.cpp
@@ -50,7 +50,7 @@ void clsEntity::nextplayer(char death) {
if (CnfgValues.blnLogging) {
switch (plyPlayer.direction[i]) {
case dirNone :
- //Do nothing
+ fprintf(logFile," _");
break;
case dirUp :
fprintf(logFile," ↑");
@@ -137,7 +137,7 @@ void clsEntity::newplayer(void) {
uint uRandSection, uTempStep = 0;
if (uchrGenNum == 1) { //First Generation
- for (uint i = 0; i < CnfgValues.uintFirstGen; i++) {plyPlayer.direction[i] = (uint)(rand() % (dirRight) + dirUp);}
+ for (uint i = 0; i < CnfgValues.uintFirstGen; i++) {plyPlayer.direction[i] = (uint)(rand() % dirDown);}
for (uint i = CnfgValues.uintFirstGen; i < DEFINED_MAX_PLAYER_STEPS; i++ ) {plyPlayer.direction[i] = dirNone;}
} else { //Growth Phase & Steady phase
do {
@@ -145,14 +145,14 @@ void clsEntity::newplayer(void) {
uRandSection = (uint)(rand() % ((uintGenSteps - uTempStep)) + uTempStep);
if (Global::blnDebugMode) {printf("Player %d Section of %d\n",uchrRandPlayer,uRandSection);}
for (uint j = uTempStep; j <= uRandSection; j++) {
- if ((uint)(rand() % 100) < CnfgValues.uintMutationChance) {plyPlayer.direction[j] = (uint)(rand() % (dirRight) + dirUp);}
+ if ((uint)(rand() % 100) < CnfgValues.uintMutationChance) {plyPlayer.direction[j] = (uint)(rand() % dirDown);}
else {plyPlayer.direction[j] = genBestPlayers[uchrRandPlayer].direction[j];}
}//End for
uTempStep = uRandSection;
} while (uTempStep < uintGenSteps - 1);
if (uintGenSteps + CnfgValues.uintGenIncrease < DEFINED_MAX_PLAYER_STEPS) {
- for (uint k = 0; k < uintGenSteps + CnfgValues.uintGenIncrease; k++) {plyPlayer.direction[k] = (uint)(rand() % (dirRight) + dirUp);}
+ for (uint k = 0; k < uintGenSteps + CnfgValues.uintGenIncrease; k++) {plyPlayer.direction[k] = (uint)(rand() % dirDown);}
}
}
}
diff --git a/Source/image_error.xpm b/Source/image_error.xpm
new file mode 100644
index 0000000..2528fda
--- /dev/null
+++ b/Source/image_error.xpm
@@ -0,0 +1,337 @@
+/* XPM */
+//This is the image for an error. It is in this format so it can be embedded in the program.
+//Once embedded it will load in place of any missing images.
+static char * image_error_xpm[] = {
+"24 24 308 2",
+" c None",
+". c #BEBDBD",
+"+ c #4E5858",
+"@ c #000000",
+"# c #260000",
+"$ c #370000",
+"% c #360000",
+"& c #250000",
+"* c #BDBCBC",
+"= c #C3C3C3",
+"- c #420101",
+"; c #AA0000",
+"> c #E20000",
+", c #F20000",
+"' c #FF0000",
+") c #F00000",
+"! c #E10000",
+"~ c #AB0000",
+"{ c #430101",
+"] c #C1C2C2",
+"^ c #3A3F3F",
+"/ c #330101",
+"( c #AC0000",
+"_ c #CE0200",
+": c #E31C00",
+"< c #EE2A00",
+"[ c #F03000",
+"} c #ED3200",
+"| c #EA3000",
+"1 c #E62B00",
+"2 c #DF2200",
+"3 c #D61500",
+"4 c #CC0200",
+"5 c #340101",
+"6 c #393F3F",
+"7 c #0D1313",
+"8 c #5B0101",
+"9 c #BC0200",
+"0 c #E12400",
+"a c #FB3F00",
+"b c #F43900",
+"c c #F03600",
+"d c #ED3500",
+"e c #E93200",
+"f c #E53000",
+"g c #E12E00",
+"h c #DE2C00",
+"i c #DA2A00",
+"j c #D82B00",
+"k c #C91700",
+"l c #BA0200",
+"m c #5C0101",
+"n c #000606",
+"o c #353B3B",
+"p c #5C0001",
+"q c #BC0D00",
+"r c #FB3C00",
+"s c #F83B00",
+"t c #EF3800",
+"u c #ED2700",
+"v c #EE1F00",
+"w c #EC1E00",
+"x c #E52300",
+"y c #D52900",
+"z c #D32600",
+"A c #CF2400",
+"B c #CC2200",
+"C c #B10700",
+"D c #5D0101",
+"E c #363C3C",
+"F c #ABACAC",
+"G c #380101",
+"H c #BF1100",
+"I c #FF3F00",
+"J c #F33B00",
+"K c #F32A00",
+"L c #FB0D00",
+"M c #F40900",
+"N c #DA1B00",
+"O c #C92300",
+"P c #C82000",
+"Q c #C51E00",
+"R c #AF0800",
+"S c #390101",
+"T c #A30800",
+"U c #FF4000",
+"V c #F33A00",
+"W c #F81500",
+"X c #FE0000",
+"Y c #FD0000",
+"Z c #EA0C00",
+"` c #C21D00",
+" . c #C01B00",
+".. c #BE1A00",
+"+. c #9A0400",
+"@. c #430000",
+"#. c #EF3400",
+"$. c #F43A00",
+"%. c #F80D00",
+"&. c #FB0000",
+"*. c #FA0000",
+"=. c #FB0404",
+"-. c #EE0600",
+";. c #BA1A00",
+">. c #B81700",
+",. c #B31200",
+"'. c #450000",
+"). c #ACACAC",
+"!. c #A71300",
+"~. c #FC3D00",
+"{. c #F51900",
+"]. c #F80000",
+"^. c #FDAEAE",
+"/. c #FFFFFF",
+"(. c #FECCCC",
+"_. c #F90000",
+":. c #FDC6C6",
+"<. c #FEDEDE",
+"[. c #F80606",
+"}. c #DC0A00",
+"|. c #B31500",
+"1. c #B21400",
+"2. c #910600",
+"3. c #060000",
+"4. c #E93000",
+"5. c #F13100",
+"6. c #F50000",
+"7. c #F60000",
+"8. c #F73131",
+"9. c #FEE0E0",
+"0. c #F50505",
+"a. c #F50101",
+"b. c #FDD6D6",
+"c. c #F84848",
+"d. c #B81100",
+"e. c #AD1100",
+"f. c #A90D00",
+"g. c #0B0000",
+"h. c #1F0100",
+"i. c #FB3A00",
+"j. c #F01A00",
+"k. c #F30000",
+"l. c #F11610",
+"m. c #FDDADA",
+"n. c #FDCCCC",
+"o. c #F01810",
+"p. c #D10800",
+"q. c #A91000",
+"r. c #AB0E00",
+"s. c #1C0000",
+"t. c #310900",
+"u. c #F83800",
+"v. c #EC3700",
+"w. c #EE0900",
+"x. c #EF0000",
+"y. c #E64631",
+"z. c #E63825",
+"A. c #E40200",
+"B. c #A20E00",
+"C. c #A70C00",
+"D. c #240400",
+"E. c #340C00",
+"F. c #F53600",
+"G. c #E83600",
+"H. c #EC0000",
+"I. c #ED0000",
+"J. c #E04635",
+"K. c #E03929",
+"L. c #9C0C00",
+"M. c #A40A00",
+"N. c #240200",
+"O. c #2E0A00",
+"P. c #F13400",
+"Q. c #E53400",
+"R. c #E80000",
+"S. c #E70000",
+"T. c #F7DED9",
+"U. c #F9E4E0",
+"V. c #E80708",
+"W. c #E90000",
+"X. c #980B00",
+"Y. c #A00700",
+"Z. c #1E0100",
+"`. c #150400",
+" + c #EA3100",
+".+ c #E13100",
+"++ c #E30600",
+"@+ c #E30000",
+"#+ c #E30303",
+"$+ c #FCE4E4",
+"%+ c #FDECEC",
+"&+ c #E40B0B",
+"*+ c #DA0100",
+"=+ c #970800",
+"-+ c #9A0500",
+";+ c #0E0000",
+">+ c #D32B00",
+",+ c #DD1300",
+"'+ c #DF0000",
+")+ c #DF0202",
+"!+ c #FBE3E3",
+"~+ c #F8EEEC",
+"{+ c #FCEBEB",
+"]+ c #C00300",
+"^+ c #960500",
+"/+ c #8B0200",
+"(+ c #6C1500",
+"_+ c #DC2A00",
+":+ c #D72200",
+"<+ c #DA0000",
+"[+ c #E44747",
+"}+ c #C61E19",
+"|+ c #C62923",
+"1+ c #E13636",
+"2+ c #DC0000",
+"3+ c #A10400",
+"4+ c #950300",
+"5+ c #460100",
+"6+ c #D52800",
+"7+ c #D22700",
+"8+ c #D30C00",
+"9+ c #D50000",
+"0+ c #CE1312",
+"a+ c #BE1916",
+"b+ c #D70001",
+"c+ c #D70000",
+"d+ c #BD2320",
+"e+ c #F4ECEB",
+"f+ c #CE0201",
+"g+ c #BF0100",
+"h+ c #910300",
+"i+ c #8E0100",
+"j+ c #AAABAC",
+"k+ c #4F0F01",
+"l+ c #D82500",
+"m+ c #CB2300",
+"n+ c #CF0400",
+"o+ c #D20000",
+"p+ c #B11514",
+"q+ c #C26868",
+"r+ c #B50A0A",
+"s+ c #CF0000",
+"t+ c #D00000",
+"u+ c #B20909",
+"v+ c #BB4D4D",
+"w+ c #B40000",
+"x+ c #C80000",
+"y+ c #960100",
+"z+ c #350101",
+"A+ c #ACADAD",
+"B+ c #343B3C",
+"C+ c #781401",
+"D+ c #CB2000",
+"E+ c #C31D00",
+"F+ c #C80600",
+"G+ c #CC0000",
+"H+ c #CB0000",
+"I+ c #CA0000",
+"J+ c #CD0000",
+"K+ c #BE0100",
+"L+ c #930300",
+"M+ c #920100",
+"N+ c #530101",
+"O+ c #6C1101",
+"P+ c #CA1C00",
+"Q+ c #BC1A00",
+"R+ c #BC0F00",
+"S+ c #C20300",
+"T+ c #C50000",
+"U+ c #C40000",
+"V+ c #C60000",
+"W+ c #A50300",
+"X+ c #920300",
+"Y+ c #970100",
+"Z+ c #4D0101",
+"`+ c #1B2020",
+" @ c #383E3F",
+".@ c #370801",
+"+@ c #AC1500",
+"@@ c #BA1500",
+"#@ c #B01400",
+"$@ c #AF1000",
+"%@ c #B20900",
+"&@ c #B20600",
+"*@ c #B00500",
+"=@ c #AB0600",
+"-@ c #9F0600",
+";@ c #940600",
+">@ c #980300",
+",@ c #850100",
+"'@ c #290101",
+")@ c #3C4040",
+"!@ c #C0C0C0",
+"~@ c #3D0801",
+"{@ c #8D0E00",
+"]@ c #AD1000",
+"^@ c #780200",
+"/@ c #310101",
+"(@ c #C5C5C5",
+"_@ c #BBBABA",
+":@ c #4F5757",
+"<@ c #010000",
+"[@ c #1B0200",
+"}@ c #230200",
+"|@ c #220100",
+"1@ c #190100",
+"2@ c #525859",
+"3@ c #BEBEBE",
+" . + @ # $ % & @ + * ",
+" = @ - ; > , ' ' ) ! ~ { @ ] ",
+" ^ / ( _ : < [ } | 1 2 3 4 ( 5 6 ",
+" 7 8 9 0 a b c d e f g h i j k l m n ",
+" o p q r s b t d u v w x i y z A B C D E ",
+" F G H I s J K L ' ' ' ' ' ' M N O P Q R S F ",
+" @ T U s V W X Y Y Y Y Y Y Y Y ' Z ` ...+.@ ",
+"F @.#.s $.%.&.&.*.&.&.&.&.&.&.=.*.&.-.;.>.,.'.).",
+"@ !.~.$.{.].].^./.(.].]._.].:./.<.[.*.}.|.1.2.@ ",
+"3.4.b 5.6.7.8./././.9.0.a.b./././.c.6.].d.e.f.g.",
+"h.i.c j.k.k.l././././.m.n././././.o.k.k.p.q.r.s.",
+"t.u.v.w.x.x.) y././././././././.z.) ) x.A.B.C.D.",
+"E.F.G.H.H.H.H.I.J././././././.K.I.H.H.H.I.L.M.N.",
+"O.P.Q.R.S.S.R.S.R.T././././.U.V.S.S.R.S.W.X.Y.Z.",
+"`. +.+++@+@+@+#+$+/./././././.%+&+@+@+@+*+=+-+;+",
+"@ >+h ,+'+'+)+!+/././.~+/./././.{+)+'+'+]+^+/+@ ",
+"F (+_+:+<+<+[+/./././.}+|+/./././.1+<+2+3+4+5+).",
+" @ 6+7+8+9+0+/././.a+b+c+d+/./.e+f+9+g+h+i+@ ",
+" j+k+l+m+n+o+p+q+r+o+s+t+o+u+v+w+o+x+h+y+z+A+ ",
+" B+C+D+E+F+G+G+H+I+I+I+I+H+J+G+K+L+M+N+E ",
+" @ O+P+Q+R+S+T+U+U+U+U+V+K+W+X+Y+Z+`+ ",
+" @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@ ",
+" !@@ ~@{@]@r.C.M.Y.-+^@/@@ (@ ",
+" _@:@<@[@}@|@1@@ 2@3@ "};
diff --git a/Source/main.h b/Source/main.h
index 230a960..ff4d2b0 100644
--- a/Source/main.h
+++ b/Source/main.h
@@ -23,7 +23,7 @@ will likely remove these and dynamically allocate the map size for you.
//What the target FPS is for the program, only effects things when show map is true
//See tick.cpp for what it does
-#define DEFINED_GOAL_FPS 15
+#define DEFINED_GOAL_FPS 30
//The most steps a single player can take
#define DEFINED_MAX_PLAYER_STEPS 1000
diff --git a/Source/map.cpp b/Source/map.cpp
index 766072f..c292ef5 100644
--- a/Source/map.cpp
+++ b/Source/map.cpp
@@ -4,9 +4,10 @@
#include "config.h"
#include "tick.h"
#include "globals.h"
-/* TODO (GamerMan7799#9#): Do away with a set array that holds the map information; instead make things more dynamic so
- that movement will be changed to be velocity based as opposed to moving one cell at a time. This is of course because
- we are using SDL. It will be alot of work to do this; so we should hold off until v5.0.0 */
+/* TODO (GamerMan7799#9#): Have Monster and player movements based off of velocity instead of set cells. Every
+ update would calculate how far they go based on time that has passed (like I did for the Cannon Simulation).
+ Inputs will add / subtract velocities. I will first have to figure out how to detect where tile bounding boxes are.
+ It will be a lot of work will likely be part of the next major release v5.0.0*/
/**********************************************************************************************************************************************/
clsMap::clsMap() {
if (Global::blnDebugMode) {printf("Map Constructor called.\n");}
diff --git a/Source/screen.cpp b/Source/screen.cpp
index 19f2578..a3fa969 100644
--- a/Source/screen.cpp
+++ b/Source/screen.cpp
@@ -3,6 +3,7 @@
#include "map.h"
#include "config.h"
#include "globals.h"
+#include "image_error.xpm"
/**********************************************************************************************************************************************************************/
/* TODO (GamerMan7799#5#): Get better images for the game. (Currently just using placeholders)
Consider hiring someone? */
@@ -57,7 +58,7 @@ clsScreen::clsScreen() {
if (Global::blnDebugMode) {printf("Window creation successful\n");}
}
- ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
+ ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
if (ren == nullptr) {
printf("SDL Failed to create renderer.\n");
error();
@@ -67,81 +68,57 @@ clsScreen::clsScreen() {
if (Global::blnDebugMode) {printf("Renderer creation successful\n");}
}
- std::string path = DEFINED_DEFAULT_IMAGE_PATH;
- path += "sky.png";
- sky = loadIMG(path);
+
+ errortex = loadERROR();
if (bln_SDL_started == false) {return;}
else {
- blnSky = true;
- if (Global::blnDebugMode) {printf("Sky loading successful\n");}
+ blnErrortex = true;
+ if (Global::blnDebugMode) {printf("Error loading successful\n");}
}
+ std::string path = DEFINED_DEFAULT_IMAGE_PATH;
+ path += "sky.png";
+ sky = loadIMG(path);
+ blnSky = true;
+ if (Global::blnDebugMode) {printf("Sky loading successful\n");}
+
path = DEFINED_DEFAULT_IMAGE_PATH;
path += "player.png";
-
player = loadIMG(path);
- if (bln_SDL_started == false) {return;}
- else {
- blnPlayer = true;
- if (Global::blnDebugMode) {printf("Player loading successful\n");}
- }
+ blnPlayer = true;
+ if (Global::blnDebugMode) {printf("Player loading successful\n");}
+
path = DEFINED_DEFAULT_IMAGE_PATH;
path += "wall.png";
-
wall = loadIMG(path);
- if (bln_SDL_started == false) {return;}
- else {
- blnWall = true;
- if (Global::blnDebugMode) {printf("Wall loading successful\n");}
- }
+ blnWall = true;
+ if (Global::blnDebugMode) {printf("Wall loading successful\n");}
+
path = DEFINED_DEFAULT_IMAGE_PATH;
path += "coin.png";
-
coin = loadIMG(path);
- if (bln_SDL_started == false) {return;}
- else {
- blnCoin = true;
- if (Global::blnDebugMode) {printf("Coin loading successful\n");}
- }
+ blnCoin = true;
+ if (Global::blnDebugMode) {printf("Coin loading successful\n");}
path = DEFINED_DEFAULT_IMAGE_PATH;
path += "pole.png";
-
pole = loadIMG(path);
- if (bln_SDL_started == false) {return;}
- else {
- blnPole = true;
- if (Global::blnDebugMode) {printf("Pole loading successful\n");}
- }
+ blnPole = true;
+ if (Global::blnDebugMode) {printf("Pole loading successful\n");}
path = DEFINED_DEFAULT_IMAGE_PATH;
path += "monster.png";
-
monster = loadIMG(path);
- if (bln_SDL_started == false) {return;}
- else {
- blnMonster = true;
- if (Global::blnDebugMode) {printf("Monster loading successful\n");}
- }
-
- path = DEFINED_DEFAULT_IMAGE_PATH;
- path += "error.png";
-
- errortex = loadIMG(path);
- if (bln_SDL_started == false) {return;}
- else {
- blnErrortex = true;
- if (Global::blnDebugMode) {printf("Error loading successful\n");}
- }
+ blnMonster = true;
+ if (Global::blnDebugMode) {printf("Monster loading successful\n");}
MessageFont = TTF_OpenFont(DEFINED_MESSAGE_FONT,16); //Opens font and sets size
if (MessageFont == nullptr) {
- printf("Failed to open font style.\n");
- error();
- return;
+ printf("Font failed to load, messages will not appear.");
+ blnMessageFont = false;
} else {
if(Global::blnDebugMode) {printf("Message font created\n");}
blnMessageFont = true;
@@ -150,7 +127,6 @@ clsScreen::clsScreen() {
Black = {0, 0, 0, 0}; //Make the color black for fonts
White = {255, 255, 255, 0}; //Make the color white for fonts
- writemessage();
update();
} //end if blnShowMap
}
@@ -167,11 +143,14 @@ clsScreen::~clsScreen() {
/**********************************************************************************************************************************************************************/
void clsScreen::update(void) {
PLYR tempPlayer = Global::Enty.getPlayer();
-
uint Max_Height, Max_Width; //Values for how far on the map the screen should render
+ uint x_start; //place where x starts at
Max_Height = (uint) (height/pic_size);
Max_Width = (uint) (width/pic_size);
+ //This will cause the screen to move in different segments at a time.
+ x_start = (uint) (round (tempPlayer.location.x / Max_Width) ) * Max_Width;
+
//clear renderer
SDL_RenderClear(ren);
@@ -182,17 +161,18 @@ void clsScreen::update(void) {
//Start updating texture placements
for (uint y = 0; (y < (Max_Height)) && (y < DEFINED_MAP_HEIGHT); y++) {
- for (uint x = (tempPlayer.location.x - 5); (x < (tempPlayer.location.x + Max_Width - 5)) && (x < DEFINED_MAP_WIDTH); x++) {
+ for (uint x = x_start; (x < (x_start + Max_Width)) && (x < DEFINED_MAP_WIDTH); x++) {
//update where we're trying to put the texture.
- dst.x = (x - tempPlayer.location.x + 5) * pic_size;
- dst.y = /*(y - tempPlayer.location.y + 10)*/ y * pic_size;
+ dst.x = (x - x_start) * pic_size;
+ dst.y = y * pic_size;
//Query a texture to get its width and height
- //Since all textures are the same it doesn't matter which one we use
- SDL_QueryTexture(coin,NULL,NULL, &dst.w, &dst.h);
+ //Since all the textures are the same we'll use the error one since the program would
+ //not have gotten this far if that failed load.
+ SDL_QueryTexture(errortex,NULL,NULL, &dst.w, &dst.h);
switch(Global::Map.getMapCell(x,y)) {
case tileSpace:
- SDL_RenderCopy(ren,sky,NULL, &dst);
+ //SDL_RenderCopy(ren,sky,NULL, &dst);
break;
case tileCoin:
SDL_RenderCopy(ren,coin,NULL, &dst);
@@ -217,7 +197,10 @@ void clsScreen::update(void) {
} //end for x
} //end for y
- writemessage();
+ //Write messages only if Message font is loaded.
+ if (blnMessageFont) {
+ writemessage();
+ }
//show renderer
SDL_RenderPresent(ren);
Global::Tick.wait();
@@ -304,8 +287,7 @@ SDL_Texture* clsScreen::loadIMG(std::string filename) {
if (temp == nullptr) {
printf("Failed to load img.\n");
- error();
- return nullptr;
+ return errortex;
} else {
if (Global::blnDebugMode) {printf("img to surface successful\n");}
}
@@ -314,7 +296,7 @@ SDL_Texture* clsScreen::loadIMG(std::string filename) {
SDL_FreeSurface(temp);
if (tex == nullptr) {
printf("Failed to create texture.\n");
- error();
+ tex = errortex;
} else {
if (Global::blnDebugMode) {printf("Surface to texture successful\n");}
}
@@ -329,6 +311,7 @@ void clsScreen::playerDeath(void) {
//3 spaces then down about 4 spaces (depending on starting point)
//the whole thing happens in 5 frames.
+ /* TODO (GamerMan7799#1#): Add tileDeadPlayer with its own image to better till when the death animation is happening */
PLYR tempPlayer;
tempPlayer = Global::Enty.getPlayer();
//show();
@@ -362,6 +345,7 @@ void clsScreen::writemessage(void) {
char strPlayerNum[3];
char strFitness[6];
+ /* TODO (GamerMan7799#5#): Somehow detect if over wall and change color of text */
std::string message;
sprintf(strClock, "%8u", Global::Tick.getClockTime());
@@ -385,10 +369,9 @@ void clsScreen::writemessage(void) {
}
SDL_Rect dst;
- //Clock goes in top left (aka 0,0)
- dst.x = 0;
- dst.y = 0;
SDL_QueryTexture(texmessage,NULL,NULL, &dst.w, &dst.h);
+ dst.y = 0;
+ dst.x = width - dst.w;
SDL_RenderCopy(ren, texmessage, NULL, &dst);
if (Global::blnDebugMode) {printf("Clock placed.\n");}
@@ -402,10 +385,10 @@ void clsScreen::writemessage(void) {
message = "Generation: ";
valuesscanned = sprintf(strGenNum, "%2u", Global::Enty.uchrGenNum);
if (valuesscanned >= 1) {message += strGenNum;}
- message += " Player: ";
+ message += " Player: ";
valuesscanned = sprintf(strPlayerNum, "%3u", Global::Enty.uchrPlayerNum);
if (valuesscanned >= 1) {message += strPlayerNum;}
- message += " Fitness: ";
+ message += " Fitness: ";
valuesscanned = sprintf(strFitness, "%3.2f", tempPlayer.fitness);
if (valuesscanned >= 1) { message += strFitness;}
if (Global::blnDebugMode) {printf("Message written.\n");}
@@ -429,11 +412,34 @@ void clsScreen::writemessage(void) {
blnMessage = true;
}
- dst.x = (int)(width / 2);
- dst.y = height - 30;
SDL_QueryTexture(texmessage,NULL,NULL, &dst.w, &dst.h);
+ dst.x = (int)(width - dst.w);
+ dst.y = height - 30;
SDL_RenderCopy(ren, texmessage, NULL, &dst);
SDL_FreeSurface(surmessage);
}
/**********************************************************************************************************************************************************************/
+SDL_Texture* clsScreen::loadERROR(void) {
+ SDL_Surface* temp = IMG_ReadXPMFromArray(image_error_xpm);
+
+ if (temp == nullptr) {
+ printf("Failed to load embedded image.\n");
+ error();
+ return nullptr;
+ } else {
+ if (Global::blnDebugMode) {printf("Error surface created.\n");}
+ }
+
+ SDL_Texture *tex = SDL_CreateTextureFromSurface(ren,temp);
+ SDL_FreeSurface(temp);
+ if (tex == nullptr) {
+ printf("Failed to create texture.\n");
+ error();
+ } else {
+ if (Global::blnDebugMode) {printf("Surface to texture successful\n");}
+ }
+
+ return tex;
+}
+/**********************************************************************************************************************************************************************/
diff --git a/Source/screen.h b/Source/screen.h
index d9a8434..51acf56 100644
--- a/Source/screen.h
+++ b/Source/screen.h
@@ -3,7 +3,7 @@
/**********************************************************************************************************************************************************************/
#include
#include
-#include
+#include
#include
#include
/**********************************************************************************************************************************************/
@@ -12,11 +12,15 @@
#if defined(_WIN32) ||defined(_WIN64)
#define DEFINED_DEFAULT_IMAGE_PATH ".\\Images\\"
#define DEFINED_MESSAGE_FONT "C:\\Windows\\Fonts\\Arial.ttf"
-#elif defined(__unix__) || defined(__CYGWIN__) || defined(__linux__)
+#elif defined(__unix__) || defined(__linux__)
#define DEFINED_DEFAULT_IMAGE_PATH "./Images/"
- #define DEFINED_MESSAGE_FONT "/usr/share/fonts/truetype/arial.ttf"
+ #define DEFINED_MESSAGE_FONT "/usr/share/fonts/truetype/freefont/FreeMono.ttf"
+#elif defined(__CYGWIN__)
+ #define DEFINED_DEFAULT_IMAGE_PATH "./Images/"
+ #define DEFINED_MESSAGE_FONT "C:/Windows/Fonts/Arial.ttf"
#else
#define DEFINED_DEFAULT_IMAGE_PATH "OS NOT SUPPORTED!"
+ #define DEFINED_MESSAGE_FONT "OS NOT SUPPORTED!"
#endif // defined OS
/**********************************************************************************************************************************************************************/
class clsScreen {
@@ -34,6 +38,7 @@ class clsScreen {
private:
+ /* TODO (GamerMan7799#6#): Group these together somehow. Namespace or Struct */
SDL_Texture *player;
SDL_Texture *monster;
SDL_Texture *wall;
@@ -55,6 +60,7 @@ class clsScreen {
//Keeps track of which parts have been loaded
//so when ending only the ones that are open
//are closed
+ /* TODO (GamerMan7799#6#): Group these together somehow. Namespace or Struct */
bool blnWindow;
bool blnRenderer;
bool blnSky;
@@ -68,6 +74,7 @@ class clsScreen {
bool blnMessageFont;
SDL_Texture* loadIMG(std::string);
+ SDL_Texture* loadERROR(void);
void error(void);
SDL_Color Black;
diff --git a/Source/version.h b/Source/version.h
index b6116df..87e79f6 100644
--- a/Source/version.h
+++ b/Source/version.h
@@ -5,7 +5,7 @@
//it kept really messing up the system I was using so I turned it off
//Date Version Types
-#define DEFINED_VER_DATE "03"
+#define DEFINED_VER_DATE "04"
#define DEFINED_VER_MONTH "09"
#define DEFINED_VER_YEAR "2015"
//I don't know what this is for, but I'll leave it for now.
@@ -14,17 +14,17 @@
//Standard Version Type
#define DEFINED_VER_MAJOR 4
#define DEFINED_VER_MINOR 1
-#define DEFINED_VER_PATCH 1
+#define DEFINED_VER_PATCH 2
//Miscellaneous Version Types
//Don't forget to increment the build number before each build
-#define DEFINED_VER_RC_FILEVERSION 4,1,1,4
-#define DEFINED_VER_RC_FILEVERSION_STRING "4, 1, 1, 4\0"
-#define DEFINED_VER_FULLVERSION_STRING "4.1.1"
+#define DEFINED_VER_RC_FILEVERSION 4,1,2,10
+#define DEFINED_VER_RC_FILEVERSION_STRING "4, 1, 2, 10\0"
+#define DEFINED_VER_FULLVERSION_STRING "4.1.2"
//Software Status
-#define DEFINED_VER_STATUS "Alpha"
-#define DEFINED_VER_STATUS_SHORT "a"
+#define DEFINED_VER_STATUS "Release"
+#define DEFINED_VER_STATUS_SHORT "r"
/*
Software Status can be the following: