diff options
-rw-r--r-- | Changelog | 9 | ||||
-rw-r--r-- | assets/bgWoodTile.png | bin | 65078 -> 75181 bytes | |||
-rw-r--r-- | assets/maybeplayer.png | bin | 2898 -> 4146 bytes | |||
-rw-r--r-- | assets/sounds/ozone.wav | bin | 12739644 -> 0 bytes | |||
-rw-r--r-- | include/entities.h | 8 | ||||
-rw-r--r-- | include/world.h | 4 | ||||
-rw-r--r-- | main.cpp | 3 | ||||
-rw-r--r-- | src/entities.cpp | 8 | ||||
-rw-r--r-- | src/gameplay.cpp | 16 | ||||
-rw-r--r-- | src/world.cpp | 38 | ||||
-rw-r--r-- | xcf/bgWoodTile.xcf | bin | 511093 -> 511349 bytes | |||
-rw-r--r-- | xcf/maybeplayer.xcf | bin | 7564 -> 3468 bytes |
12 files changed, 56 insertions, 30 deletions
@@ -435,3 +435,12 @@ - checking files for potential divide by 0 errors, due to random floating point errors still have floating point errors - restarted work on real shading (GLSL stuffs) + +12/17/2015: +=========== + + - continued work on player sprite + - continued work on GLSL shaders + - fixed NPC spawning world location stuff + - messed with threads/forks + - re-fixed/added indoor environment; fixed indoor background diff --git a/assets/bgWoodTile.png b/assets/bgWoodTile.png Binary files differindex 0c7c64b..5b631bf 100644 --- a/assets/bgWoodTile.png +++ b/assets/bgWoodTile.png diff --git a/assets/maybeplayer.png b/assets/maybeplayer.png Binary files differindex ee0e49d..c580ff7 100644 --- a/assets/maybeplayer.png +++ b/assets/maybeplayer.png diff --git a/assets/sounds/ozone.wav b/assets/sounds/ozone.wav Binary files differdeleted file mode 100644 index 60354e5..0000000 --- a/assets/sounds/ozone.wav +++ /dev/null diff --git a/include/entities.h b/include/entities.h index 1abe886..6d192fe 100644 --- a/include/entities.h +++ b/include/entities.h @@ -44,6 +44,8 @@ enum BUILD_SUB{ FOUNTAIN }; +class World; + class Particles{ public: vec2 loc; @@ -162,14 +164,14 @@ public: class Structures : public Entity{ public: - void *inWorld; - void *inside; + World *inWorld; + World *inside; BUILD_SUB bsubtype; Structures(); ~Structures(); - unsigned int spawn(_TYPE, BUILD_SUB, float, float); + unsigned int spawn(_TYPE, BUILD_SUB, float, float, World *); }; class Mob : public Entity{ diff --git a/include/world.h b/include/world.h index 0a23965..4b3a891 100644 --- a/include/world.h +++ b/include/world.h @@ -166,8 +166,8 @@ public: std::vector<Object *> object; std::vector<Particles *> particles; - void addStructure(_TYPE t,BUILD_SUB sub,float x,float y,World *outside,World *inside); - void addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float y,World *outside,World *inside); + void addStructure(_TYPE t,BUILD_SUB sub,float x,float y,World *inside); + void addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float y,World *outside); void addMob(int t,float x,float y); void addMob(int t,float x,float y,void (*hey)(Mob *)); void addNPC(float x,float y); @@ -4,6 +4,7 @@ */ #include <cstdio> // fopen +#include <thread> #include <common.h> #include <world.h> @@ -453,7 +454,7 @@ void mainLoop(void){ if(!currentTime){ // Initialize currentTime if it hasn't been currentTime=millis(); - prevPrevTime=currentTime; + //prevPrevTime=currentTime; } /* diff --git a/src/entities.cpp b/src/entities.cpp index ba0f8ef..7cd413c 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -77,7 +77,7 @@ void Entity::spawn(float x, float y){ //spawns the entity you pass to it based o Player::Player(){ //sets all of the player specific traits on object creation width = HLINE * 10; - height = HLINE * 16; + height = HLINE * 15; type = PLAYERT; //set type to player subtype = 0; @@ -393,7 +393,7 @@ void Object::interact(void){ * point to have non-normal traits so it could be invisible or invincible... */ -unsigned int Structures::spawn(_TYPE t, BUILD_SUB sub, float x, float y){ +unsigned int Structures::spawn(_TYPE t, BUILD_SUB sub, float x, float y, World *oi){ loc.x = x; loc.y = y; type = t; @@ -404,6 +404,8 @@ unsigned int Structures::spawn(_TYPE t, BUILD_SUB sub, float x, float y){ height = 40 * HLINE; bsubtype = sub; + inWorld = oi; + /* * tempN is the amount of entities that will be spawned in the village. Currently the village * will spawn bewteen 2 and 7 villagers for the starting hut. @@ -418,7 +420,7 @@ unsigned int Structures::spawn(_TYPE t, BUILD_SUB sub, float x, float y){ * with type NPC. */ - currentWorld->addNPC(loc.x + i * HLINE ,100); + inWorld->addNPC(loc.x + i * HLINE ,100); } diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 35abca4..2361029 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -93,6 +93,8 @@ static World *worldSpawnHill1; static World *worldSpawnHill2; static World *worldSpawnHill3; +static IndoorWorld *worldSpawnHill2_Building1; + /* * initEverything() start */ @@ -119,7 +121,7 @@ void initEverything(void){ worldSpawnHill3->addMob(MS_TRIGGER,-500,0,worldSpawnHill3_itemGet); worldSpawnHill3->addMob(MS_TRIGGER,0,0,worldSpawnHill3_itemSee); worldSpawnHill3->addObject(TEST_ITEM,false,"",-200,300); - worldSpawnHill3->addMob(MS_TRIGGER,400,0,worldSpawnHill3_leave); + worldSpawnHill3->addMob(MS_TRIGGER,650,0,worldSpawnHill3_leave); worldSpawnHill3->addHole(800,1000); worldSpawnHill1->toRight = worldSpawnHill2; @@ -140,14 +142,18 @@ void initEverything(void){ //playerSpawnHill->addMob(MS_TRIGGER,-1300,0,CUTSCENEEE);*/ - currentWorld = worldSpawnHill1; - worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill1,worldSpawnHill2); + worldSpawnHill2_Building1 = new IndoorWorld(); + worldSpawnHill2_Building1->generate(300); + worldSpawnHill2_Building1->setBackground(BG_WOODHOUSE); + worldSpawnHill2_Building1->setBGM("assets/music/theme_jazz.wav"); + + worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill2_Building1); player = new Player(); player->spawn(200,100); - + + currentWorld = worldSpawnHill1; currentWorld->bgmPlay(NULL); - atexit(destroyEverything); } diff --git a/src/world.cpp b/src/world.cpp index d542f2a..7f9b1c0 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -555,7 +555,6 @@ LOOP2: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); //for the s direction glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); //for the t direction glBegin(GL_QUADS); - std::cout<<shade<<std::endl; for(i=is;i<(unsigned)ie-GEN_INC;i++){ cline[i].y+=(yoff-DRAW_Y_OFFSET); // Add the y offset if(!cline[i].y){ @@ -904,16 +903,17 @@ LOOOOP: goto LOOOOP; } } -void World::addStructure(_TYPE t,BUILD_SUB sub, float x,float y,World *outside,World *inside){ +void World::addStructure(_TYPE t,BUILD_SUB sub, float x,float y,World *inside){ build.push_back(new Structures()); - build.back()->spawn(t,sub,x,y); - build.back()->inWorld=outside; - build.back()->inside=(void *)inside; + build.back()->spawn(t,sub,x,y,this); + build.back()->inWorld=this; + build.back()->inside = (World *)inside; + ((IndoorWorld *)inside)->outside = this; entity.push_back(build.back()); } -void World::addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float y,World *outside,World *inside){ +void World::addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float y,World *outside){ std::cout << npcMin << ", " << npcMax << std::endl; int xwasd; for(int i = 0; i < bCount; i++){ @@ -922,7 +922,7 @@ void World::addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float for(auto &bu : build){ if(xwasd > bu->loc.x && xwasd < bu->loc.x+bu->width)goto HERE; } - addStructure(t,HOUSE,xwasd,y,outside,inside); + addStructure(t,HOUSE,xwasd,y,outside); } } void World::addMob(int t,float x,float y){ @@ -1095,7 +1095,8 @@ void IndoorWorld::generate(unsigned int width){ // Generates a flat area of wid void IndoorWorld::draw(Player *p){ unsigned int i,ie; - int j,x,v_offset; + //int j,x,v_offset; + int x; /* * Draw the background. @@ -1104,15 +1105,17 @@ void IndoorWorld::draw(Player *p){ glEnable(GL_TEXTURE_2D); bgTex->bind(0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); //for the s direction + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); //for the t direction glColor4ub(255,255,255,255); glBegin(GL_QUADS); - for(j = x_start - SCREEN_WIDTH / 2;j < -x_start + SCREEN_WIDTH / 2; j += 512){ - glTexCoord2i(1,1);glVertex2i(j ,0); - glTexCoord2i(0,1);glVertex2i(j+512,0); - glTexCoord2i(0,0);glVertex2i(j+512,512); - glTexCoord2i(1,0);glVertex2i(j ,512); - } + //for(j = x_start - SCREEN_WIDTH / 2;j < -x_start + SCREEN_WIDTH / 2; j += 512){ + glTexCoord2i(0,1); glVertex2i( x_start - SCREEN_WIDTH / 2,0); + glTexCoord2i((-x_start*2+SCREEN_WIDTH)/512,1);glVertex2i(-x_start + SCREEN_WIDTH / 2,0); + glTexCoord2i((-x_start*2+SCREEN_WIDTH)/512,0);glVertex2i(-x_start + SCREEN_WIDTH / 2,SCREEN_HEIGHT); + glTexCoord2i(0,0); glVertex2i( x_start - SCREEN_WIDTH / 2,SCREEN_HEIGHT); + //} glEnd(); glDisable(GL_TEXTURE_2D); @@ -1121,13 +1124,16 @@ void IndoorWorld::draw(Player *p){ * Calculate the starting and ending points to draw the ground from. */ - v_offset = (p->loc.x - x_start) / HLINE; + /*v_offset = (p->loc.x - x_start) / HLINE; j = v_offset - (SCREEN_WIDTH / 2 / HLINE) - GEN_INC; if(j < 0)j = 0; i = j; ie = v_offset + (SCREEN_WIDTH / 2 / HLINE) - GEN_INC; - if(ie > lineCount)ie = lineCount; + if(ie > lineCount)ie = lineCount;*/ + + i = 0; + ie = lineCount; /* * Draw the ground. diff --git a/xcf/bgWoodTile.xcf b/xcf/bgWoodTile.xcf Binary files differindex 9aa0005..867e556 100644 --- a/xcf/bgWoodTile.xcf +++ b/xcf/bgWoodTile.xcf diff --git a/xcf/maybeplayer.xcf b/xcf/maybeplayer.xcf Binary files differindex fb885fc..c16b7c6 100644 --- a/xcf/maybeplayer.xcf +++ b/xcf/maybeplayer.xcf |