aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-11-20 08:50:57 -0500
committerClyne Sullivan <tullivan99@gmail.com>2015-11-20 08:50:57 -0500
commit6be7b11513cdedc17358da314c6e5a5630be00c1 (patch)
tree67ecbdfb7f2f31c87707959404cced383fb3a0b6
parent5598e4d1f52224f2d075dc318868e284b2f20a78 (diff)
background draw re-do
-rw-r--r--Changelog14
-rw-r--r--assets/BennyHillTheme.wavbin48024816 -> 21318852 bytes
-rw-r--r--assets/forestTileBack.pngbin0 -> 9657 bytes
-rw-r--r--assets/forestTileFront.pngbin0 -> 26722 bytes
-rw-r--r--assets/forestTileMid.pngbin0 -> 45450 bytes
-rw-r--r--include/Texture.h13
-rw-r--r--include/world.h31
-rw-r--r--main.cpp134
-rw-r--r--src/Texture.cpp76
-rw-r--r--src/gameplay.cpp2
-rw-r--r--src/ui.cpp4
-rw-r--r--src/world.cpp149
-rw-r--r--xcf/forestTileBack.xcfbin0 -> 58423 bytes
-rw-r--r--xcf/forestTileFront.xcfbin0 -> 119452 bytes
-rw-r--r--xcf/forestTileMid.xcfbin0 -> 210345 bytes
15 files changed, 250 insertions, 173 deletions
diff --git a/Changelog b/Changelog
index 0fe9386..50e8f44 100644
--- a/Changelog
+++ b/Changelog
@@ -311,3 +311,17 @@
- converted layered background items to tiles
- fixed ortho in small spaces
- began formalizing item system
+
+11/19/2015:
+===========
+
+ - texture loaded tracks loaded textures to prevent re-loading (frees resources)
+ - continued work on things finished the following day (11/20) :)
+
+11/20/2015:
+===========
+
+ - began working on inventory UI
+ - moved background drawing to World class
+ - re-did the item system
+ - actually tiled background images to save space
diff --git a/assets/BennyHillTheme.wav b/assets/BennyHillTheme.wav
index 34c455b..a926902 100644
--- a/assets/BennyHillTheme.wav
+++ b/assets/BennyHillTheme.wav
Binary files differ
diff --git a/assets/forestTileBack.png b/assets/forestTileBack.png
new file mode 100644
index 0000000..0ea6022
--- /dev/null
+++ b/assets/forestTileBack.png
Binary files differ
diff --git a/assets/forestTileFront.png b/assets/forestTileFront.png
new file mode 100644
index 0000000..e54f631
--- /dev/null
+++ b/assets/forestTileFront.png
Binary files differ
diff --git a/assets/forestTileMid.png b/assets/forestTileMid.png
new file mode 100644
index 0000000..b23afd2
--- /dev/null
+++ b/assets/forestTileMid.png
Binary files differ
diff --git a/include/Texture.h b/include/Texture.h
index fdb294d..81a743e 100644
--- a/include/Texture.h
+++ b/include/Texture.h
@@ -3,23 +3,22 @@
#include <common.h>
+#define DEBUG
+
namespace Texture{
GLuint loadTexture(const char *fileName);
}
class Texturec{
+private:
+ GLuint *image;
+ int texState;
public:
Texturec(uint amt, ...);
void bindNext();
void bindPrev();
void bind(int);
void walk();
-
- GLuint *image;
- int texState;
-private:
-
-
};
-#endif //TEXTURE_H \ No newline at end of file
+#endif //TEXTURE_H
diff --git a/include/world.h b/include/world.h
index 8f4ea51..1a96252 100644
--- a/include/world.h
+++ b/include/world.h
@@ -9,6 +9,18 @@
// or not calculated at all, so GEN_INC is also used to decrease 'lineCount' in functions like draw()
// and detect().
+#define DAY_CYCLE 3000
+
+typedef enum {
+ BG_FOREST
+} WORLD_BG_TYPE;
+
+typedef enum {
+ SUNNY = 0,
+ DARK,
+ RAIN
+} WEATHER;
+
struct line_t {
bool gs;
float y,gh[2];
@@ -56,6 +68,14 @@ protected:
unsigned int lineCount;
+ /*
+ * Contains the background image layers (including the background image).
+ */
+
+ vec2 *star;
+
+ Texturec *bgTex;
+
public:
/*
@@ -78,16 +98,11 @@ public:
std::vector<Entity *> entity;
std::vector<Object *> object;
- //template<class T>
- //void getEntityLocation(std::vector<T*>&, unsigned int);
-
void addStructure(_TYPE t,float x,float y,World *outside,World *inside);
void addMob(int t,float x,float y);
void addMob(int t,float x,float y,void (*hey)());
void addNPC(float x,float y);
void addObject(int, float, float);
-
- //void removeObjet(Object);
void update(Player *p,unsigned int delta);
@@ -107,6 +122,12 @@ public:
void generateFunc(unsigned int width,float(*func)(float));
/*
+ * Adds images to using for the background.
+ */
+
+ void setBackground(WORLD_BG_TYPE bgt);
+
+ /*
* Looks for the furthest back layer in this world and adds a new layer of width `width` behind it.
*/
diff --git a/main.cpp b/main.cpp
index 1f8c58e..a26222a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -208,17 +208,7 @@ unsigned int millis(void){
}
#endif
-typedef enum {
- SUNNY = 0,
- DARK,
- RAIN
-} WEATHER;
-
-#define DAY_CYCLE 3000
-
-static WEATHER weather = SUNNY;
-static vec2 star[100];
-
+extern WEATHER weather;
/*******************************************************************************
* MAIN ************************************************************************
@@ -434,12 +424,12 @@ int main(int argc, char *argv[]){
* Load a temporary background image.
*/
- bgDay =Texture::loadTexture("assets/bg.png" );
+ /*bgDay =Texture::loadTexture("assets/bg.png" );
bgNight =Texture::loadTexture("assets/bgn.png" );
bgMtn =Texture::loadTexture("assets/bgFarMountain.png" );
bgTreesFront =Texture::loadTexture("assets/bgFrontTreeTile.png" );
bgTreesMid =Texture::loadTexture("assets/bgMidTreeTile.png" );
- bgTreesFar =Texture::loadTexture("assets/bgFarTreeTile.png" );
+ bgTreesFar =Texture::loadTexture("assets/bgFarTreeTile.png" );*/
/*
* Load sprites used in the inventory menu. See src/inventory.cpp
@@ -447,16 +437,6 @@ int main(int argc, char *argv[]){
initInventorySprites();
- /*
- * Generate coordinates for stars that are drawn at night.
- */
-
- unsigned int i;
- for(i=0;i<100;i++){
- star[i].x=getRand()%currentWorld->getTheWidth()-currentWorld->getTheWidth()/2;
- star[i].y=getRand()%SCREEN_HEIGHT+100;
- }
-
/**************************
**** GAMELOOP ****
**************************/
@@ -647,113 +627,9 @@ void render(){
/**************************
**** RENDER STUFF HERE ****
**************************/
-
- /*
- * Draw a temporary background image
- */
-
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D,bgDay);
- safeSetColorA(255,255,255,255-worldShade*4);
- glBegin(GL_QUADS);
- glTexCoord2i(0,1);glVertex2i(-SCREEN_WIDTH*2+offset.x,0+offset.y-SCREEN_HEIGHT/2);
- glTexCoord2i(1,1);glVertex2i( SCREEN_WIDTH*2+offset.x,0+offset.y-SCREEN_HEIGHT/2);
- glTexCoord2i(1,0);glVertex2i( SCREEN_WIDTH*2+offset.x,SCREEN_HEIGHT*2+offset.y-SCREEN_HEIGHT/2);
- glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH*2+offset.x,SCREEN_HEIGHT*2+offset.y-SCREEN_HEIGHT/2);
- glEnd();
- glBindTexture(GL_TEXTURE_2D,bgNight);
- safeSetColorA(255,255,255,worldShade*4);
- glBegin(GL_QUADS);
- glTexCoord2i(0,1);glVertex2i(-SCREEN_WIDTH*2+offset.x,0+offset.y-SCREEN_HEIGHT/2);
- glTexCoord2i(1,1);glVertex2i( SCREEN_WIDTH*2+offset.x,0+offset.y-SCREEN_HEIGHT/2);
- glTexCoord2i(1,0);glVertex2i( SCREEN_WIDTH*2+offset.x,SCREEN_HEIGHT*2+offset.y-SCREEN_HEIGHT/2);
- glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH*2+offset.x,SCREEN_HEIGHT*2+offset.y-SCREEN_HEIGHT/2);
- glEnd();
-
- glDisable(GL_TEXTURE_2D);
-
- /*
- * Draws stars if it is an appropriate time of day for them.
- */
-
- int base = 80;
- int shade = worldShade*2;
-
- if(((weather==DARK )&(tickCount%DAY_CYCLE)<DAY_CYCLE/2) ||
- ((weather==SUNNY)&(tickCount%DAY_CYCLE)>DAY_CYCLE*.75) ){
-
- if(tickCount%DAY_CYCLE){ // The above if statement doesn't check for exact midnight.
-
- safeSetColorA(255,255,255,shade);
- for(unsigned int i=0;i<100;i++){
- glRectf(star[i].x+offset.x*.9,star[i].y,star[i].x+offset.x*.9+HLINE,star[i].y+HLINE);
- }
-
- }
- }
-
- /*
- * Calculate the Y to start drawing the background at, and a value for how shaded the
- * background elements should be.
- */
-
- glEnable(GL_TEXTURE_2D);
-
- /*
- * Draw the mountains.
- */
-
- glBindTexture(GL_TEXTURE_2D, bgMtn);
- glBegin(GL_QUADS);
- safeSetColorA(150-shade,150-shade,150-shade,220);
- for(int i = 0; i <= currentWorld->getTheWidth()/1920; i++){
- glTexCoord2i(0,1);glVertex2i((currentWorld->getTheWidth()*-0.5f)+(1920 * i)+offset.x*.85,base);
- glTexCoord2i(1,1);glVertex2i((currentWorld->getTheWidth()*-0.5f)+(1920 * (i+1))+offset.x*.85,base);
- glTexCoord2i(1,0);glVertex2i((currentWorld->getTheWidth()*-0.5f)+(1920 * (i+1))+offset.x*.85,base+1080);
- glTexCoord2i(0,0);glVertex2i((currentWorld->getTheWidth()*-0.5f)+(1920 * i)+offset.x*.85,base+1080);
- }
- glEnd();
-
- /*
- * Draw three layers of trees.
- */
-
- glBindTexture(GL_TEXTURE_2D, bgTreesFar);
- glBegin(GL_QUADS);
- safeSetColorA(100-shade,100-shade,100-shade,240);
- for(int i = -currentWorld->getTheWidth() / 2; i <= currentWorld->getTheWidth() / 2; i += 300){
- glTexCoord2i(0,1);glVertex2i(i+offset.x*.6,base);
- glTexCoord2i(1,1);glVertex2i((i+300)+offset.x*.6,base);
- glTexCoord2i(1,0);glVertex2i((i+300)+offset.x*.6,base+200);
- glTexCoord2i(0,0);glVertex2i(i+offset.x*.6,base+200);
- }
- glEnd();
-
- glBindTexture(GL_TEXTURE_2D, bgTreesMid);
- glBegin(GL_QUADS);
- safeSetColorA(150-shade,150-shade,150-shade,250);
- for(int i = -currentWorld->getTheWidth() / 2; i <= currentWorld->getTheWidth() / 2; i += 400){
- glTexCoord2i(0,1);glVertex2i(i+offset.x*.4,base);
- glTexCoord2i(1,1);glVertex2i((i+300)+offset.x*.4,base);
- glTexCoord2i(1,0);glVertex2i((i+300)+offset.x*.4,base+200);
- glTexCoord2i(0,0);glVertex2i(i+offset.x*.4,base+200);
- }
- glEnd();
-
- glBindTexture(GL_TEXTURE_2D, bgTreesFront);
- glBegin(GL_QUADS);
- safeSetColorA(255-shade,255-shade,255-shade,255);
- for(int i = -currentWorld->getTheWidth() / 2; i <= currentWorld->getTheWidth() / 2; i += 280){
- glTexCoord2i(0,1);glVertex2i(i+offset.x*.25,base);
- glTexCoord2i(1,1);glVertex2i((i+300)+offset.x*.25,base);
- glTexCoord2i(1,0);glVertex2i((i+300)+offset.x*.25,base+200);
- glTexCoord2i(0,0);glVertex2i(i+offset.x*.25,base+200);
- }
- glEnd();
- glDisable(GL_TEXTURE_2D);
-
+
/*
- * Call the world's draw function, drawing the player, the world, and entities. Also
+ * Call the world's draw function, drawing the player, the world, the background, and entities. Also
* draw the player's inventory if it exists.
*/
diff --git a/src/Texture.cpp b/src/Texture.cpp
index 01a19aa..b17d204 100644
--- a/src/Texture.cpp
+++ b/src/Texture.cpp
@@ -1,34 +1,64 @@
#include <Texture.h>
+#include <string.h>
+
+struct texture_t {
+ char *name;
+ GLuint tex;
+} __attribute__ ((packed));
+
+struct texture_t *LoadedTexture[256];
+unsigned int LoadedTextureCounter = 0;
namespace Texture{
GLuint loadTexture(const char *fileName){
- SDL_Surface *image = IMG_Load(fileName);
+ SDL_Surface *image;
+ GLuint object = 0;
+ unsigned int i;
- if(!image)return 0;
- DEBUG_printf("Loaded image file: %s\n", fileName);
- unsigned object = 0; //creates a new unsigned variable for the texture
+ for(unsigned int i=0;i<LoadedTextureCounter;i++){
+ if(!strcmp(LoadedTexture[i]->name,fileName)){
+#ifdef DEBUG
+ DEBUG_printf("Reusing loaded texture for %s\n",fileName);
+#endif // DEBUG
+ return LoadedTexture[i]->tex;
+ }
+ }
- glGenTextures(1, &object); //turns "object" into a texture
- glBindTexture(GL_TEXTURE_2D, object); //binds "object" to the top of the stack
- glPixelStoref(GL_UNPACK_ALIGNMENT,1 );
+ if(!(image = IMG_Load(fileName)))
+ return 0;
+#ifdef DEBUG
+ DEBUG_printf("Loaded image file: %s\n", fileName);
+#endif // DEBUG
+
+ glGenTextures(1,&object); // Turns "object" into a texture
+ glBindTexture(GL_TEXTURE_2D,object); // Binds "object" to the top of the stack
+ glPixelStoref(GL_UNPACK_ALIGNMENT,1);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //sets the "min" filter
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //the the "max" filter of the stack
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Sets the "min" filter
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // The the "max" filter of the stack
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); //Wrap the texture to the matrix
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); //Wrap the texutre to the matrix
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Wrap the texture to the matrix
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); //
- glTexImage2D( GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- image->w,
- image->h,
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- image->pixels); //sets the texture to the image file loaded above
+ glTexImage2D(GL_TEXTURE_2D, // Sets the texture to the image file loaded above
+ 0,
+ GL_RGBA,
+ image->w,
+ image->h,
+ 0,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ image->pixels
+ );
- SDL_FreeSurface(image); //Free surface
+ SDL_FreeSurface(image); // Free the surface
+
+ LoadedTexture[LoadedTextureCounter] = (struct texture_t *)malloc(sizeof(struct texture_t));
+ LoadedTexture[LoadedTextureCounter]->name = (char *)malloc(strlen(fileName));
+ LoadedTexture[LoadedTextureCounter]->tex = object;
+ strcpy(LoadedTexture[LoadedTextureCounter]->name,fileName);
+ LoadedTextureCounter++;
+
return object;
}
}
@@ -58,5 +88,5 @@ void Texturec::bindPrev(){
}
void Texturec::walk(){
-
-} \ No newline at end of file
+ // hey
+}
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index e5d7251..1d9fac6 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -91,9 +91,11 @@ void initEverything(void){
test->addHole(100,150);
//}
+ test->setBackground(BG_FOREST);
test->addLayer(400);
playerSpawnHill->generateFunc(1280,playerSpawnHillFunc);
+ playerSpawnHill->setBackground(BG_FOREST);
//playerSpawnHill->generate(1920);
/*
diff --git a/src/ui.cpp b/src/ui.cpp
index e4cb93a..1ea844c 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -455,8 +455,8 @@ namespace ui {
}else setFontColor(255,255,255);
dialogOptLoc[i][1]=y-SCREEN_HEIGHT/4+(fontSize+HLINE)*(i+1);
dialogOptLoc[i][2]=
- putStringCentered(player->loc.x,dialogOptLoc[i][1],dialogOptText[i]);
- dialogOptLoc[i][0]=player->loc.x-dialogOptLoc[i][2]/2;
+ putStringCentered(offset.x,dialogOptLoc[i][1],dialogOptText[i]);
+ dialogOptLoc[i][0]=offset.x-dialogOptLoc[i][2]/2;
}
setFontColor(255,255,255);
}
diff --git a/src/world.cpp b/src/world.cpp
index 904bed7..44d1900 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -6,15 +6,32 @@
#define GEN_MAX 110
#define GEN_INIT 60
-#define GRASS_HEIGHT 4 // Defines how long the grass layer of a line should be in multiples of HLINE.
+#define GRASS_HEIGHT 4 // Defines how long the grass layer of a line should be in multiples of HLINE.
-#define DRAW_Y_OFFSET 50 // Defines how many pixels each layer should be offset from each other on the y axis when drawn.
-#define DRAW_SHADE 30 // Defines a shade increment for draw()
+#define DRAW_Y_OFFSET 50 // Defines how many pixels each layer should be offset from each other on the y axis when drawn.
+#define DRAW_SHADE 30 // Defines a shade increment for draw()
#define INDOOR_FLOOR_HEIGHT 100 // Defines how high the base floor of an IndoorWorld should be
-bool worldInside = false;
+bool worldInside = false; // True if player is inside a structure
+
+WEATHER weather = SUNNY;
+
+const char *bgPaths[6]={
+ "assets/bg.png", // Daytime background
+ "assets/bgn.png", // Nighttime background
+ "assets/bgFarMountain.png", // Furthest layer
+ "assets/forestTileBack.png", // Closer layer
+ "assets/forestTileMid.png", // Near layer
+ "assets/forestTileFront.png" // Closest layer
+};
+
+const float bgDraw[3][3]={
+ {100,240,.6 },
+ {150,250,.4 },
+ {255,255,.25}
+};
float worldGetYBase(World *w){
/*float base = 0;
@@ -54,6 +71,20 @@ void World::load(char *buf){
memcpy(line,buf+sizeof(struct wSavePack),lineCount * sizeof(struct line_t));
}
+void World::setBackground(WORLD_BG_TYPE bgt){
+ switch(bgt){
+ default:
+ bgTex = new Texturec(6,bgPaths[0],
+ bgPaths[1],
+ bgPaths[2],
+ bgPaths[3],
+ bgPaths[4],
+ bgPaths[5]
+ );
+ break;
+ }
+}
+
World::World(void){
/*
* Nullify pointers to other worlds.
@@ -63,6 +94,8 @@ World::World(void){
infront =
toLeft =
toRight = NULL;
+
+ star = (vec2 *)calloc(100,sizeof(vec2));
}
void World::generate(unsigned int width){ // Generates the world and sets all variables contained in the World class.
@@ -159,6 +192,11 @@ void World::generate(unsigned int width){ // Generates the world and sets all va
*/
x_start=0 - getWidth(this) / 2;
+
+ for(int i=0;i<100;i++){
+ star[i].x=getRand()%getTheWidth()-getTheWidth()/2;
+ star[i].y=getRand()%SCREEN_HEIGHT+100;
+ }
}
void World::generateFunc(unsigned int width,float(*func)(float)){
@@ -176,6 +214,11 @@ void World::generateFunc(unsigned int width,float(*func)(float)){
line[i].gs=true;
}
x_start=0 - getWidth(this) / 2;
+
+ for(int i=0;i<100;i++){
+ star[i].x=getRand()%getTheWidth()-getTheWidth()/2;
+ star[i].y=getRand()%SCREEN_HEIGHT+100;
+ }
}
World::~World(void){
@@ -197,13 +240,105 @@ void World::update(Player *p,unsigned int delta){
int worldShade = 0;
+extern vec2 offset;
+extern unsigned int tickCount;
+
void World::draw(Player *p){
static float yoff=DRAW_Y_OFFSET; // Initialize stuff
- static int shade;
+ static int shade,bgshade;
static World *current;
- int i,is,ie,v_offset,cx_start;
+ int i,is,ie,v_offset,cx_start,width;
struct line_t *cline;
- glClearColor(.1,.3,.6,0);
+
+ bgshade = worldShade << 1; // *2
+ width = (-x_start) << 1;
+
+ /*
+ * Draw the background images in the appropriate order.
+ */
+
+ glEnable(GL_TEXTURE_2D);
+
+ bgTex->bind(0);
+ safeSetColorA(255,255,255,255 - worldShade * 4);
+
+ glBegin(GL_QUADS);
+ glTexCoord2i(0,0);glVertex2i( x_start,SCREEN_HEIGHT);
+ glTexCoord2i(1,0);glVertex2i(-x_start,SCREEN_HEIGHT);
+ glTexCoord2i(1,1);glVertex2i(-x_start,0);
+ glTexCoord2i(0,1);glVertex2i( x_start,0);
+ glEnd();
+
+ bgTex->bindNext();
+ safeSetColorA(255,255,255,worldShade * 4);
+
+ glBegin(GL_QUADS);
+ glTexCoord2i(0,0);glVertex2i( x_start,SCREEN_HEIGHT);
+ glTexCoord2i(1,0);glVertex2i(-x_start,SCREEN_HEIGHT);
+ glTexCoord2i(1,1);glVertex2i(-x_start,0);
+ glTexCoord2i(0,1);glVertex2i( x_start,0);
+ glEnd();
+
+ glDisable(GL_TEXTURE_2D);
+
+ /*
+ * Draws stars if it is an appropriate time of day for them.
+ */
+
+ if(((weather==DARK )&(tickCount%DAY_CYCLE)<DAY_CYCLE/2) ||
+ ((weather==SUNNY)&(tickCount%DAY_CYCLE)>DAY_CYCLE*.75) ){
+
+ if(tickCount % DAY_CYCLE){ // The above if statement doesn't check for exact midnight.
+
+ safeSetColorA(255,255,255,bgshade + getRand() % 30 - 15);
+ for(i = 0; i < 100; i++){
+ glRectf(star[i].x+offset.x*.9,
+ star[i].y,
+ star[i].x+offset.x*.9+HLINE,
+ star[i].y+HLINE
+ );
+ }
+
+ }
+ }
+
+ glEnable(GL_TEXTURE_2D);
+
+ /*
+ * Draw the mountains.
+ */
+
+ bgTex->bindNext();
+ safeSetColorA(150-bgshade,150-bgshade,150-bgshade,220);
+
+ glBegin(GL_QUADS);
+ for(int i = 0; i <= width/1920; i++){
+ glTexCoord2i(0,1);glVertex2i(width/-2+(1920*i )+offset.x*.85,GEN_MIN);
+ glTexCoord2i(1,1);glVertex2i(width/-2+(1920*(i+1))+offset.x*.85,GEN_MIN);
+ glTexCoord2i(1,0);glVertex2i(width/-2+(1920*(i+1))+offset.x*.85,GEN_MIN+1080);
+ glTexCoord2i(0,0);glVertex2i(width/-2+(1920*i )+offset.x*.85,GEN_MIN+1080);
+ }
+ glEnd();
+
+ /*
+ * Draw three layers of trees.
+ */
+
+ for(i = 0; i < 3; i++){
+ bgTex->bindNext();
+ safeSetColorA(bgDraw[i][0]-bgshade,bgDraw[i][0]-bgshade,bgDraw[i][0]-bgshade,bgDraw[i][1]);
+
+ glBegin(GL_QUADS);
+ for(int j = x_start; j <= -x_start; j += 600){
+ glTexCoord2i(0,1);glVertex2i( j +offset.x*bgDraw[i][2],GEN_MIN);
+ glTexCoord2i(1,1);glVertex2i((j+600)+offset.x*bgDraw[i][2],GEN_MIN);
+ glTexCoord2i(1,0);glVertex2i((j+600)+offset.x*bgDraw[i][2],GEN_MIN+400);
+ glTexCoord2i(0,0);glVertex2i( j +offset.x*bgDraw[i][2],GEN_MIN+400);
+ }
+ glEnd();
+ }
+
+ glDisable(GL_TEXTURE_2D);
/*
* World drawing is done recursively, meaning that this function jumps
diff --git a/xcf/forestTileBack.xcf b/xcf/forestTileBack.xcf
new file mode 100644
index 0000000..723912f
--- /dev/null
+++ b/xcf/forestTileBack.xcf
Binary files differ
diff --git a/xcf/forestTileFront.xcf b/xcf/forestTileFront.xcf
new file mode 100644
index 0000000..f7bf8f4
--- /dev/null
+++ b/xcf/forestTileFront.xcf
Binary files differ
diff --git a/xcf/forestTileMid.xcf b/xcf/forestTileMid.xcf
new file mode 100644
index 0000000..0b719dc
--- /dev/null
+++ b/xcf/forestTileMid.xcf
Binary files differ