*/
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.
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;
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);
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.
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);
break;
case MS_BIRD:
case MS_DOOR:
+ case MS_PAGE:
default:
+ glActiveTexture(GL_TEXTURE0 + 0);
tex->bind(0);
break;
}
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);
break;
case SDLK_RIGHT:
player->inv->sel++;
++ break;
++ case SDLK_f:
++
break;
default:
break;