]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Started names and genders
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 30 Sep 2015 12:50:20 +0000 (08:50 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 30 Sep 2015 12:50:20 +0000 (08:50 -0400)
assets/names_en-us
include/common.h
include/entities.h
src/entities.cpp
src/main.cpp

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c34e6cfe4644b25ebaf12128426eeb004af3f972 100644 (file)
@@ -0,0 +1,106 @@
+mByron
+mClark
+mJarrett
+mJohnny
+mHarrison
+mFrederick
+mPercy
+mOdis
+mJeffery
+mRafael
+mDusty
+mAurelio
+mCornell
+mHerschel
+mRodney
+mJasper
+mElton
+mGregg
+mDemarcus
+mMajor
+mQuintin
+mFranklyn
+mChristian
+mAgustin
+mHarold
+mHenry
+mWayne
+mAhmed
+mArnold
+mChristoper
+mEzekiel
+mAlphonse
+mBoyce
+mJim
+mBrandon
+mMark
+mGeraldo
+mJackson
+mReyes
+mModesto
+mAriel
+mHassan
+mRoscoe
+mMason
+mPhilip
+mBroderick
+mAshley
+mMauro
+mDaren
+mRigoberto
+mChuck
+mAndy
+mClyne
+mPingu
+mShrek
+fShani
+fIsidra
+fAja
+fTequila
+fKrysten
+fJolanda
+fThora
+fBetty
+fGeorgann
+fTabetha
+fHellen
+fOlive
+fPhoebe
+fTereasa
+fTeresita
+fDorthey
+fRoseanne
+fBeryl
+fLesa
+fLacie
+fBethann
+fBritta
+fStarr
+fCarlyn
+fKina
+fRenae
+fTandy
+fYang
+fVivan
+fJoaquina
+fKathaleen
+fLibbie
+fAngelina
+fTori
+fKeva
+fShala
+fJalisa
+fChia
+fAutumn
+fVirgie
+fMarcene
+fAdina
+fSharyn
+fSharmaine
+fStephaine
+fUrsula
+fSylvia
+fStarla
+fMonserrate
+fAnn
+fAshley
\ No newline at end of file
index 8410f58608ff300106af517019f749247c8eeec3..5ffb2a12b3593539bc7cce0bb8b9e46af080d6eb 100644 (file)
@@ -12,7 +12,6 @@
 #include <SDL2/SDL_opengl.h>
 
 typedef struct { float x; float y; }vec2;
-typedef struct { char* first; char* last; }_name;
 
 enum _TYPE { //these are the main types of entities
        STRUCTURET = -1,
@@ -20,6 +19,12 @@ enum _TYPE { //these are the main types of entities
        NPCT       = 1
 };
 
+enum GENDER{
+       MALE,
+       FEMALE,
+       NONE
+};
+
 #include <entities.h>
 
 #define SCREEN_WIDTH  1280
@@ -37,4 +42,7 @@ int eAmt(T (&)[N]){return N;}
 extern bool gameRunning;
 extern unsigned int deltaTime;
 
+extern FILE* config;
+extern FILE* names;
+
 #endif // COMMON_H
index 53a80574787af1cd66190dee50e10c8faba19f2a..77eaaabb04bea01606cfd91e1b927d26bdb84657 100644 (file)
@@ -24,10 +24,12 @@ public:
        unsigned char ground;     //variable for testing what ground the entity is on to apply certain traits
 
        unsigned int texture[];   //TODO: ADD TEXTURES
+
        
        void spawn(float, float);
        void draw(void);
        void wander(int, vec2*);
+       char* getName();
        virtual void interact(){}
 private:
        int ticksToUse; //The variable for deciding how long an entity should do a certain task
index af4b45f8d8883d057d94aa3eceb0dccc88954712..14048a08612a04c6c9ea0689570215bce5beefb3 100644 (file)
@@ -36,6 +36,12 @@ void Entity::wander(int timeRun, vec2 *v){ //this makes the entites wander about
        ticksToUse--; //removes one off of the entities timer
 }
 
+char* Entity::getName(){
+       char* buf;
+
+       return buf;
+}
+
 Player::Player(){ //sets all of the player specific traits on object creation
        width = HLINE * 8;
        height = HLINE * 12;
index d5fe3fd1f3b892a1c6583368983ca41f458da8e7..27bb616a55bd37c3ab7bab86a259e9dac084d65e 100644 (file)
@@ -26,8 +26,6 @@ std::vector<NPC>npc;
 std::vector<Structures>build;
 
 int mx, my;
-
-FILE* config;
 FILE* names;
 
 void logic();
@@ -90,6 +88,7 @@ int main(int argc, char *argv[]){
        //      WORLD GENERATION STUFF                                                                                            //
        //************************************************************************//
 
+       names = fopen("assets/names_en-us", "r+");
        // Make a world
        World *test=new World();
        test->generate(SCREEN_WIDTH/2);
@@ -120,7 +119,6 @@ int main(int argc, char *argv[]){
        //************************************************************************//
        //      END WORLD GENERATION STUFF                                                                                        //
        //************************************************************************//
-
        currentTime=millis();
        while(gameRunning){
                prevTime = currentTime;
@@ -216,7 +214,7 @@ void logic(){
        for(int i=0;i<=entity.size();i++){
                if(entity[i]->alive&&entity[i]->type == NPCT){
                        entity[i]->wander((rand()%120 + 30), &entity[i]->vel);
-                       if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(35*HLINE,2)){
+                       if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(40*HLINE,2)){
                                if(mx >= entity[i]->loc.x && mx <= entity[i]->loc.x + entity[i]->width && my >= entity[i]->loc.y && my <= entity[i]->loc.y + entity[i]->width
                                 && (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)))
                                        entity[i]->interact();