aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/names_en-us106
-rw-r--r--include/common.h10
-rw-r--r--include/entities.h2
-rw-r--r--src/entities.cpp6
-rw-r--r--src/main.cpp6
5 files changed, 125 insertions, 5 deletions
diff --git a/assets/names_en-us b/assets/names_en-us
index e69de29..c34e6cf 100644
--- a/assets/names_en-us
+++ b/assets/names_en-us
@@ -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
diff --git a/include/common.h b/include/common.h
index 8410f58..5ffb2a1 100644
--- a/include/common.h
+++ b/include/common.h
@@ -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
diff --git a/include/entities.h b/include/entities.h
index 53a8057..77eaaab 100644
--- a/include/entities.h
+++ b/include/entities.h
@@ -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
diff --git a/src/entities.cpp b/src/entities.cpp
index af4b45f..14048a0 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -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;
diff --git a/src/main.cpp b/src/main.cpp
index d5fe3fd..27bb616 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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();