]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Hey, that's pretty good lighting!
authordrumsetmonkey <abelleisle@roadrunner.com>
Thu, 7 Jan 2016 13:33:54 +0000 (08:33 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Thu, 7 Jan 2016 13:33:54 +0000 (08:33 -0500)
1  2 
include/common.h
include/entities.h
include/world.h
main.cpp
src/entities.cpp
src/gameplay.cpp
src/ui.cpp
src/world.cpp

index 207b95f9ef007fc6debb782beb25b79f15de3f73,038bf42243f34785f0ce4b0ad0bf8d19dcb44d3c..0c4d70001433d177bdcec653d038ceb173eed742
@@@ -148,8 -141,23 +148,25 @@@ extern vec2 offset
   */
  extern unsigned int loops;
  
 +extern GLuint shaderProgram;
 +
+ /**
+  * This class contains a string for identification and a value. It can be used to
+  * save certain events for and decisions so that they can be recalled later.
+  */
+ class Condition {
+ private:
+       char *id;
+       void *value;
+ public:
+       Condition(const char *_id,void *val);
+       ~Condition();
+       
+       bool sameID(const char *s);
+       void *getValue(void);
+ };
  /**
   *    Prints a formatted debug message to the console, along with the callee's file and line
   *    number.
index a4bc282114b1f4c08ec4721a275a6b9e777114a1,894dc16e5cd8e47b2dea32fb9627e399983baeff..90af0f223dbc1887b50cb9e29c19f03838f060ab
@@@ -139,9 -164,12 +165,12 @@@ public
        virtual void interact(){}
        
        virtual ~Entity(){}
+       
+       char *baseSave(void);
+       void baseLoad(char *);
  };
  
 -class Player : public Entity {
 +class Player : public Entity{
  public:
        QuestHandler qh;
        bool light = false;
diff --cc include/world.h
index e10d0dc64e55f6fa8eaffd7931d83dac9e23c924,cdcea3c6f869893e0d4439fd60077966b812d256..5021fbb52b0632feab930b48d276be9d7e900278
@@@ -170,16 -169,20 +174,22 @@@ public
        std::vector<Entity              *>      entity;
        std::vector<Object              *>      object;
        std::vector<Particles   *>      particles;
 +      std::vector<Light        >  light;
        
        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 addVillage(int bCount, int npcMin, int npcMax,_TYPE t,World *inside);
        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);
        void addObject(ITEM_ID, bool, const char *, float, float);
        void addParticle(float, float, float, float, float, float, Color color, int);
 +      void addLight(vec2, Color);
+       NPC *getAvailableNPC(void);
+       
+       /*
+        *      Update coordinates of all entities.
+        */
        
        void update(Player *p,unsigned int delta);
        
diff --cc main.cpp
index c174f11d346961dcf559c081b632282b4b1c3df4,2c088cb24e0b5426f8ab36c075fcef7e089d0b16..1725ccfd91b911d949e81b959ab7593f083f1086
+++ b/main.cpp
@@@ -201,7 -202,8 +202,7 @@@ extern int  fadeIntensity
  int main(/*int argc, char *argv[]*/){
        //*argv = (char *)argc;
        gameRunning=false;
-               
 -      
++
        /*!
         *      (Attempt to) Initialize SDL libraries so that we can use SDL facilities and eventually
         *      make openGL calls. Exit if there was an error.
index d12a1ca69203d6c2a3cc51e373a7c9f6aee5c248,f34abd6c690d7a4194480845671a213eb9ef20db..7e8d55a31a223c6a73b5a46369574050bd8483b2
@@@ -158,11 -150,17 +151,17 @@@ Mob::Mob(int sub)
                width = HLINE * 20;
                height = 2000;
                tex = new Texturec(0);
+               break;
        case MS_DOOR:
                width = HLINE * 12;
 -              height = HLINE * 19;
 +              height = HLINE * 20;
                tex = new Texturec(1,"assets/door.png");
                break;
+       case MS_PAGE:
+               width = HLINE * 6;
+               height = HLINE * 4;
+               tex = new Texturec(1,"assets/items/ITEM_PAGE.png");
+               break;
        }
        
        inv = new Inventory(NPC_INV_SIZE);
@@@ -256,8 -247,8 +255,9 @@@ void Entity::draw(void){           //draws the e
                                break;
                        case MS_BIRD:
                        case MS_DOOR:
+                       case MS_PAGE:
                        default:
 +                              glActiveTexture(GL_TEXTURE0 + 0);
                                tex->bind(0);
                                break;
                }
index 1c83bd810712faaea1c5391ec4fc20a7acd76c10,94fb954fbf750505ba3b18716240ab5806bd6580..431d2cfd0f3240719d373b8eca0bdd9d1365719f
@@@ -102,11 -122,17 +122,17 @@@ static World *worldFirstVillage
  
  void destroyEverything(void);
  void initEverything(void){
+       static std::ifstream i ("world.dat",std::ifstream::in | std::ifstream::binary);
+       
        worldSpawnHill1 = new World();
-       worldSpawnHill1->generateFunc(400,gen_worldSpawnHill1);
        worldSpawnHill1->setBackground(BG_FOREST);
-       worldSpawnHill1->setBGM("assets/music/embark.wav");
 -      if(!i.fail()){
 -              worldSpawnHill1->load(&i);
 -              i.close();
 -      }else{
++      // if(!i.fail()){
++      //      worldSpawnHill1->load(&i);
++      //      i.close();
++      // }else{
+               worldSpawnHill1->generateFunc(400,gen_worldSpawnHill1);
+               worldSpawnHill1->setBGM("assets/music/embark.wav");
 -      }
++      // }
        worldSpawnHill1->addMob(MS_TRIGGER,0,0,worldSpawnHill1_hillBlock);
  
        worldSpawnHill2 = new World();
        worldSpawnHill2_Building1->setBGM("assets/music/theme_jazz.wav");
  
        worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill2_Building1);
 +      worldSpawnHill2->addLight({300,100},{1.0f,1.0f,1.0f});
+       worldSpawnHill2->getAvailableNPC()->addAIFunc(worldSpawnHill2_Quest1,false);
+       
+       worldFirstVillage->addVillage(5,0,0,STRUCTURET,worldSpawnHill2_Building1);
        
 +      //worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill1,worldSpawnHill2);
        player = new Player();
        player->spawn(200,100);
  
diff --cc src/ui.cpp
index b9a44aae98032727032b6461fba04c770e87de28,b827b431a021ea7ef784e7760d63d214ff88c587..7979138b745316672e56836e8517a2fd68f0939f
@@@ -803,6 -813,6 +813,9 @@@ DONE
                                        break;
                                case SDLK_RIGHT:
                                        player->inv->sel++;
++                                      break;
++                              case SDLK_f:
++                                      
                                        break;
                                default:
                                        break;
diff --cc src/world.cpp
Simple merge