]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
inv/background merge
authorClyne Sullivan <tullivan99@gmail.com>
Fri, 20 Nov 2015 13:58:44 +0000 (08:58 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Fri, 20 Nov 2015 13:58:44 +0000 (08:58 -0500)
1  2 
include/world.h
main.cpp
src/gameplay.cpp
src/ui.cpp
src/world.cpp

diff --cc include/world.h
index 1a96252f7764c2d951d8ae73836d3a044e263446,a32c7f29cfd392a6c08b388bf698df6dfa96bffc..4c82b2cc66a969dea44f17d61a9f3267826c5386
@@@ -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 a26222afe15783c96dd9f2d87d50d3f0801f1871,f6a40ec3b9c8445140586e930e8ac9f2fc432fa6..1e311ad3d3b5b57943f83ac9faaec11fdfbfbd56
+++ 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      ****
index 1d9fac6e1db143e06672f4600f7e8f20d3587614,92d12840adfe08b3aab7944aeab42c8f7e9e0a80..52aceb89ba7c998d9cb6870da0f1cc40bbb2fd61
@@@ -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/ui.cpp
Simple merge
diff --cc src/world.cpp
index 44d1900ee55f777dd002d6cc146c1d24a3ae9e09,c50ad0bba433e48252fc4b4869faad956754d5b3..6f31d6d1bd11f815657105fd9702b7b95c1fd849
@@@ -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());