]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
changelog
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 21 Jan 2016 14:25:47 +0000 (09:25 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 21 Jan 2016 14:25:47 +0000 (09:25 -0500)
Changelog
assets/names_en-us
include/entities.h
include/world.h
src/entities.cpp
src/ui.cpp
src/world.cpp
xml/playerSpawnHill1.xml

index b88ebe44528b5a9e6629335b09e17237337b68ce..0916173c53fe3ac345bcde501cbafe35391a0446 100644 (file)
--- a/Changelog
+++ b/Changelog
        - continued to document header files through doxygen
        - added border to dialogBox
        - fix entity movement handling; npcs stop when you talk to them
-<<<<<<< HEAD
-       - added sword animation?
-=======
        - added sword animation?
 
 12/9/2015,
        - imrpoved BGM handling
        - continued work on particles, made a fountain
        - added sanic
-=======
        
        ~ Broke 5000 lines of code/doc, now with some file Doxygen'd
 
        - fixed fading bugs
        - continued fixing general game bugs
        - fixed structure spawn issues
-=======
 
 12/15/2015:
 ===========
        - xml'd npc dialogs
        - drafted page xml
        
-1/11/2015:
+1/11/2016:
 ==========
 
        - improved npc dialog xmling
        - textures?
        - music?
 
-1/12/2015:
+1/12/2016:
 ==========
 
        - world linking xml'd
        - shaderssss
        - more music
        
-1/13/2015:
+1/13/2016:
 ==========
 
        - discovered how intel and nvidia gpus handle lighting
        - xml'd settings for screen dimensions
        - xml'd item giving through npc dialog
 
-1/14/2015:
+1/14/2016:
 ==========
 
        - pondered on non-random generation
        
        - began to incorporate XML into the world class for dynamic world loading...
 
-1/16/2015:
+1/16/2016:
 ==========
 
        - removed layers
        - switched world linking from pointers to file names, rewrote all world-linking code
        - worlds are now loaded dynamically
 
-1/19/2015:
+1/19/2016:
 ==========
 
        - memory management
        - began reconsidering save/load stuff
 
-1/20/2015:
+1/20/2016:
 ==========
 
        - can save npc dialog positions
        - worked on player sprite redesign
        - greatly simplified/documented gameplay.cpp
+
+1/21/2016:
+==========
+
+       - can save most mob positions
+       - fixed world widths, background drawing
+       - added aggressive flag to mobs, player enters arena on impact
+       - added world load fault handlers
+       - worked on player sprite redesign
+
+       ~ A little over 5200 lines of code
index bc2c212727bde3b99d56b5cb9a26a75ab078d745..f3f252f331f78b8fe444a39df7b9c148ad7987ce 100644 (file)
@@ -1,7 +1,7 @@
+mAndreas
 mByron
 mClark
 mJarrett
-mJohnny
 mHarrison
 mFrederick
 mPercy
@@ -46,7 +46,7 @@ mPhilip
 mBroderick
 mAshley
 mMauro
-mDaren
+mDarien
 mRigoberto
 mChuck
 mAndy
@@ -107,4 +107,4 @@ fStarla
 fMonserrate
 fAnn
 fAshley
-fAbby Ross
\ No newline at end of file
+fAbby Ross
index 1fcb89652faecdd9d1a3a18720b24629e6eb523b..9e8bece59c6689e780a422874bd7acd6d3ce0b25 100644 (file)
@@ -208,6 +208,7 @@ public:
 
 class Mob : public Entity{
 public:
+       bool aggressive;
        double init_y;
        void (*hey)(Mob *callee);
        
index 320928467906fb96e3f06fda347ae750fa3f4b8c..baa45757f59c9d0da82b08e051a04c5d988db9ac 100644 (file)
@@ -300,8 +300,9 @@ class Arena : public World {
 private:
        vec2     pxy;
        World   *exit;
+       Mob     *mmob;
 public:
-       Arena(World *leave,Player *p);
+       Arena(World *leave,Player *p,Mob *m);
        ~Arena(void);
        World *exitArena(Player *p);
 };
index 0507376c6eaac611bed296887bc2929ae1076b24..7e6b4e048261328ea58b37c7ee2e98bea63ceda7 100644 (file)
@@ -149,6 +149,7 @@ Structures::~Structures(){
 
 Mob::Mob(int sub){
        type = MOBT;
+       aggressive = false;
        
        maxHealth = health = 50;
        
@@ -533,6 +534,23 @@ unsigned int Structures::spawn(BUILD_SUB sub, float x, float y){
 void Mob::wander(int timeRun){
        static int direction;   //variable to decide what direction the entity moves
        static unsigned int heya=0,hi=0;
+       static bool YAYA = false;
+       
+       if(aggressive && !YAYA &&
+          player->loc.x + (width / 2)  > loc.x && player->loc.x + (width / 2)  < loc.x + width  &&
+          player->loc.y + (height / 3) > loc.y && player->loc.y + (height / 3) < loc.y + height ){
+               Arena *a = new Arena(currentWorld,player,this);
+               a->setBackground(BG_FOREST);
+               a->setBGM("assets/music/embark.wav");
+               ui::toggleWhiteFast();
+               YAYA = true;
+               ui::waitForCover();
+               YAYA = false;
+               currentWorld = a;
+               ui::toggleWhiteFast();
+               //player->health-=5;
+       }
+       
        switch(subtype){
        case MS_RABBIT:
                if(!ticksToUse){
index 49acd4ff2c730f098e14365878e92c2ffc2612c8..e2cc39f0c28e90529abc92ad7d477346e694ff70 100644 (file)
@@ -722,19 +722,17 @@ DONE:
                                        case SDLK_s:
                                                break;
                                        case SDLK_w:
-                                               /*if(inBattle){
+                                               if(inBattle){
                                                        tmp = currentWorld;
                                                        currentWorld = ((Arena *)currentWorld)->exitArena(player);
                                                        if(tmp != currentWorld){
                                                                //delete &tmp;
                                                                toggleBlackFast();
                                                        }
-                                               }else{*/
-                                                       if((tmp = currentWorld->goInsideStructure(player)) != currentWorld){
-                                                               delete currentWorld;
+                                               }else{
+                                                       if((tmp = currentWorld->goInsideStructure(player)) != currentWorld)
                                                                currentWorld = tmp;
-                                                       }
-                                               //}*/
+                                               }
                                                break;
                                        case SDLK_i:
                                                /*currentWorld=currentWorld->goWorldBack(player);       // Go back a layer if possible  
index af960d576338adc3528d0d74c2bc290c1468e45f..113d98aa2dfab9104557407c07e1000d7d8f24c7 100644 (file)
@@ -144,7 +144,7 @@ void World::generate(unsigned int width){   // Generates the world and sets all va
        if(width <= 0)
                abort();
                
-       lineCount = width + GEN_INC;
+       lineCount = (width + GEN_INC) / HLINE;
        
        /*
         *      Allocate enough memory for the world to be stored.
@@ -375,8 +375,13 @@ void World::draw(Player *p){
                current=current->infront;
                goto LLLOOP;
        }*/
-       cx_start = current->x_start * 1.5;
-       width = (-x_start) << 1;
+       
+       if(current->x_start < SCREEN_WIDTH * -.5 )
+               cx_start = current->x_start * 1.5;
+       else
+               cx_start = (int)(SCREEN_WIDTH * -.5);
+               
+       width = (-cx_start) << 1;
        
        glEnable(GL_TEXTURE_2D);
 
@@ -534,7 +539,10 @@ void World::draw(Player *p){
         *      corners don't stick out.
        */
 
-       for(auto &part : particles){if(part->behind)part->draw();}
+       for(auto &part : particles){
+               if(part->behind)
+               part->draw();
+       }
        for(auto &b : current->build){
                b->draw();
        }
@@ -574,6 +582,12 @@ void World::draw(Player *p){
        }
 
        glBegin(GL_QUADS);
+       
+       glTexCoord2i(0 ,0);glVertex2i(v_offset - (SCREEN_WIDTH / 1.5),0);
+       glTexCoord2i(64,0);glVertex2i(v_offset + (SCREEN_WIDTH / 1.5),0);
+       glTexCoord2i(64,1);glVertex2i(v_offset + (SCREEN_WIDTH / 1.5),base);
+       glTexCoord2i(0 ,1);glVertex2i(v_offset - (SCREEN_WIDTH / 1.5),base);
+       
        for(i=is;i<(unsigned)ie-GEN_INC;i++){
                cline[i].y+=(yoff-DRAW_Y_OFFSET);                                                                                                                       // Add the y offset
                if(!cline[i].y){
@@ -796,15 +810,15 @@ void World::singleDetect(Entity *e){
                                                }
                                        }
                                        break;
-                               case PLAYERT:
-                                       std::cout<<"RIP "<<e->name<<"."<<std::endl;
-                                       exit(0);
+                               default:
                                        break;
                                }
                                entity.erase(entity.begin()+i);
                                return;
                        }
                }
+               std::cout<<"RIP "<<e->name<<"."<<std::endl;
+               exit(0);
        }
        
        /*
@@ -1196,27 +1210,34 @@ void World::load(void){
        
        for(auto &n : npc){
                std::getline(iss,line);
+               if(line == "dOnE")return;
                if((n->dialogIndex = std::stoi(line)) != 9999)
                        n->addAIFunc(commonAIFunc,false);
                else n->clearAIFunc();
                
                std::getline(iss,line);
+               if(line == "dOnE")return;
                n->loc.x = std::stoi(line);
                std::getline(iss,line);
+               if(line == "dOnE")return;
                n->loc.y = std::stoi(line);
        }
        
        for(auto &b : build){
                std::getline(iss,line);
+               if(line == "dOnE")return;
                b->loc.x = std::stoi(line);
                std::getline(iss,line);
+               if(line == "dOnE")return;
                b->loc.y = std::stoi(line);
        }
        
        for(auto &m : mob){
                std::getline(iss,line);
+               if(line == "dOnE")return;
                m->loc.x = std::stoi(line);
                std::getline(iss,line);
+               if(line == "dOnE")return;
                m->loc.y = std::stoi(line);
        }
        
@@ -1234,11 +1255,10 @@ IndoorWorld::IndoorWorld(void){
 }
 
 IndoorWorld::~IndoorWorld(void){
-       std::cout<<"A\n";
        delete bgTex;
        delete[] star;
        delete[] line;
-
+       
        deleteEntities();
 }
 
@@ -1350,12 +1370,13 @@ void IndoorWorld::draw(Player *p){
 
 extern bool inBattle;
 
-Arena::Arena(World *leave,Player *p){
-       generate(300);
+Arena::Arena(World *leave,Player *p,Mob *m){
+       generate(800);
        addMob(MS_DOOR,100,100);
        inBattle = true;
        exit = leave;
        pxy = p->loc;
+       mmob = m;
        
        star = new vec2[100];
        memset(star,0,100 * sizeof(vec2));
@@ -1376,6 +1397,7 @@ World *Arena::exitArena(Player *p){
                ui::toggleBlackFast();
                ui::waitForCover();
                p->loc = pxy;
+               mmob->alive = false;
                return exit;
        }else{
                return this;
@@ -1454,6 +1476,10 @@ World *loadWorldFromXML(const char *path){
                                tmp->addMob(type,getRand() % tmp->getTheWidth() / 2,100);
                        else
                                tmp->addMob(type,spawnx,wxml->FloatAttribute("y"));
+                               
+                       if(wxml->QueryBoolAttribute("aggressive",&dialog) == XML_NO_ERROR)
+                               tmp->mob.back()->aggressive = dialog;
+                       
                }else if(!strcmp(name,"npc")){
                        const char *npcname;
                        
index 190f1371a7e97c93a93cf9bbd5ac3bb0a11c8ce3..7911bfd135a95c408d0b44a8769b1102276783ef 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <World>
        <style background="0" bgm="assets/music/embark.wav" />
-       <generation type="Random" width="800" />
+       <generation type="Random" width="1600" />
        
        <link right="playerSpawnHill2.xml" />
        
-       <mob type="1" />
+       <mob type="1" aggressive="true" />
        
        <npc name="Ralph" hasDialog="true" />
        <npc name="Johnny" hasDialog="true" />