From: Clyne Sullivan Date: Fri, 20 Nov 2015 13:58:44 +0000 (-0500) Subject: inv/background merge X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=19ef54b2c5ffcaefdce352c6f195a62c05c42767;p=clyne%2Fgamedev.git inv/background merge --- 19ef54b2c5ffcaefdce352c6f195a62c05c42767 diff --cc include/world.h index 1a96252,a32c7f2..4c82b2c --- a/include/world.h +++ b/include/world.h @@@ -102,7 -85,11 +102,7 @@@ public 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 addObject(int, bool, char*, float, float); - - - //void removeObjet(Object); void update(Player *p,unsigned int delta); diff --cc main.cpp index a26222a,f6a40ec..1e311ad --- a/main.cpp +++ b/main.cpp @@@ -208,7 -213,18 +213,8 @@@ unsigned int millis(void) } #endif -typedef enum { - SUNNY = 0, - DARK, - RAIN -} WEATHER; - -#define DAY_CYCLE 3000 - -static WEATHER weather = SUNNY; -static vec2 star[100]; -static unsigned char fadeIntensity = 0; - +extern WEATHER weather; ++static unsigned int fadeIntensity = 0; /******************************************************************************* * MAIN ************************************************************************ @@@ -419,23 -435,36 +425,16 @@@ int main(int argc, char *argv[]) Mix_VolumeMusic(15); // Set the volume Mix_PlayMusic( music, -1 ); // Play music forever -- -- /* -- * Load a temporary background image. -- */ - - /*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" );*/ -- - bgDay =Texture::loadTexture("assets/bg.png" ); - bgNight =Texture::loadTexture("assets/bgn.png" ); - bgMtn =Texture::loadTexture("assets/bgFarMountain.png"); - bgTreesFront =Texture::loadTexture("assets/bgFrontTree.png" ); - bgTreesMid =Texture::loadTexture("assets/bgMidTree.png" ); - bgTreesFar =Texture::loadTexture("assets/bgFarTree.png" ); - invUI =Texture::loadTexture("assets/invUI.png" ); + /* * Load sprites used in the inventory menu. See src/inventory.cpp */ ++ ++ invUI = Texture::loadTexture("assets/invUI.png" ); - std::cout << "Before invSprites\n"; ++ //std::cout << "Before invSprites\n"; initInventorySprites(); - std::cout << "After invSprites\n"; - - /* - * 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; - } ++ //std::cout << "After invSprites\n"; /************************** **** GAMELOOP **** diff --cc src/gameplay.cpp index 1d9fac6,92d1284..52aceb8 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@@ -130,9 -157,9 +159,9 @@@ void initEverything(void) test->addMob(MS_RABBIT,200,100); test->addMob(MS_BIRD,-500,500); - - test->addObject(2, 500,200); - currentWorld->addObject(SWORD_WOOD, 500,200); ++ currentWorld->addObject(SWORD_WOOD, false, NULL, 500,200); + currentWorld->addObject(FLASHLIGHT, true, "This looks important, do you want to pick it up?",600,200); /* * Link all the entities that were just created to the initial world, and setup a test AI function. */ diff --cc src/world.cpp index 44d1900,c50ad0b..6f31d6d --- a/src/world.cpp +++ b/src/world.cpp @@@ -760,8 -625,15 +760,8 @@@ void World::addNPC(float x,float y) entity.push_back(npc.back()); } --void World::addObject(int i, float x, float y){ -- object.push_back(new Object(i)); - object.back()->spawn(x,y); - - entity.push_back(object.back()); -} - + void World::addObject(int i, bool q, char *p, float x, float y){ + object.push_back(new Object(i,q, p)); object.back()->spawn(x,y); entity.push_back(object.back());