diff options
-rw-r--r-- | assets/door.png | bin | 280 -> 252 bytes | |||
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | include/entities.h | 3 | ||||
-rw-r--r-- | main.cpp | 21 | ||||
-rw-r--r-- | src/entities.cpp | 5 | ||||
-rw-r--r-- | src/gameplay.cpp | 1 | ||||
-rw-r--r-- | src/ui.cpp | 2 | ||||
-rw-r--r-- | src/world.cpp | 2 | ||||
-rw-r--r-- | test.frag | 2 | ||||
-rw-r--r-- | xcf/door.xcf | bin | 1628 -> 0 bytes |
10 files changed, 15 insertions, 23 deletions
diff --git a/assets/door.png b/assets/door.png Binary files differindex 582a52d..7db551d 100644 --- a/assets/door.png +++ b/assets/door.png diff --git a/include/common.h b/include/common.h index 08ec73f..5c90222 100644 --- a/include/common.h +++ b/include/common.h @@ -70,7 +70,7 @@ typedef struct{ * The desired width of the game window. */ -#define SCREEN_WIDTH 1024 +#define SCREEN_WIDTH 1280 /** * The desired height of the game window. diff --git a/include/entities.h b/include/entities.h index 1abe886..7a97200 100644 --- a/include/entities.h +++ b/include/entities.h @@ -138,7 +138,7 @@ public: virtual ~Entity(){} }; -class Player : public Entity { +class Player : public Entity{ public: QuestHandler qh; bool light = false; @@ -147,7 +147,6 @@ public: ~Player(); void interact(); }; - class NPC : public Entity{ public: std::vector<int (*)(NPC *)>aiFunc; @@ -344,7 +344,7 @@ int main(/*int argc, char *argv[]*/){ fragShader = glCreateShader(GL_FRAGMENT_SHADER); - std::string shaderFileContents = readFile("shader.frag"); + std::string shaderFileContents = readFile("test.frag"); const GLchar *shaderSource = shaderFileContents.c_str(); GLint bufferln = GL_FALSE; @@ -572,10 +572,7 @@ void render(){ glOrtho((offset.x-SCREEN_WIDTH/2),(offset.x+SCREEN_WIDTH/2),offset.y-SCREEN_HEIGHT/2,offset.y+SCREEN_HEIGHT/2,-1,1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glLoadIdentity(); - glEnable(GL_STENCIL_TEST); - glPushMatrix(); - + glLoadIdentity(); /* * glPushAttrib This passes attributes to the renderer so it knows what it can * render. In our case, GL_DEPTH_BUFFER_BIT allows the renderer to @@ -598,6 +595,7 @@ void render(){ * Call the world's draw function, drawing the player, the world, the background, and entities. Also * draw the player's inventory if it exists. */ + glUseProgramObjectARB(shaderProgram); player->near=true; // Draw the player's name @@ -607,17 +605,6 @@ void render(){ * Apply shaders if desired. */ - #ifdef SHADERS - glUseProgramObjectARB(shaderProgram); - glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 640,100); - glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1,1,1); - glUniform1f(glGetUniformLocation(shaderProgram, "lightStrength"), 100 + (1000-(shade*10))); - //std::cout << 100 + (1000-(shade*10)) << std::endl; - glColor4ub(0,0,0,200); - glRectf(offset.x-SCREEN_WIDTH/2,0,offset.x+SCREEN_WIDTH/2,SCREEN_HEIGHT); - glUseProgramObjectARB(0); - #endif //SHADERS - handAngle = atan((ui::mouse.y - (player->loc.y + player->height/2)) / (ui::mouse.x - player->loc.x + player->width/2))*180/PI; if(ui::mouse.x < player->loc.x){ if(handAngle <= 0) @@ -694,6 +681,8 @@ void render(){ /* * Here we draw a black overlay if it's been requested. */ + glUseProgramObjectARB(0); + if(fadeIntensity){ if(fadeWhite) diff --git a/src/entities.cpp b/src/entities.cpp index ba0f8ef..6a2f4db 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -157,7 +157,7 @@ Mob::Mob(int sub){ tex = new Texturec(0); case MS_DOOR: width = HLINE * 12; - height = HLINE * 19; + height = HLINE * 20; tex = new Texturec(1,"assets/door.png"); break; } @@ -418,7 +418,10 @@ unsigned int Structures::spawn(_TYPE t, BUILD_SUB sub, float x, float y){ * with type NPC. */ + //((World*)(inWorld))->addNPC(loc.x + i * HLINE ,100); + //inWorld->addNPC(loc.x + i * HLINE, 100); currentWorld->addNPC(loc.x + i * HLINE ,100); + } diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 35abca4..d439814 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -143,6 +143,7 @@ void initEverything(void){ currentWorld = worldSpawnHill1; worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill1,worldSpawnHill2); + worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill1,worldSpawnHill2); player = new Player(); player->spawn(200,100); @@ -556,7 +556,7 @@ namespace ui { hub.y-=fontSize*1.15; glRectf(hub.x, hub.y, - hub.x+(player->health/player->maxHealth)*130, + hub.x+(player->health/player->maxHealth?player->maxHealth:1)*130, hub.y+12); } diff --git a/src/world.cpp b/src/world.cpp index d542f2a..7f4d6f6 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -908,7 +908,7 @@ void World::addStructure(_TYPE t,BUILD_SUB sub, float x,float y,World *outside,W build.push_back(new Structures()); build.back()->spawn(t,sub,x,y); build.back()->inWorld=outside; - build.back()->inside=(void *)inside; + build.back()->inside=inside; entity.push_back(build.back()); } @@ -1,4 +1,4 @@ #version 120
void main(){
- gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+ gl_FragColor = glColor;
}
diff --git a/xcf/door.xcf b/xcf/door.xcf Binary files differdeleted file mode 100644 index ab8e078..0000000 --- a/xcf/door.xcf +++ /dev/null |