aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/door.pngbin280 -> 252 bytes
-rw-r--r--include/common.h2
-rw-r--r--include/entities.h3
-rw-r--r--main.cpp21
-rw-r--r--src/entities.cpp5
-rw-r--r--src/gameplay.cpp1
-rw-r--r--src/ui.cpp2
-rw-r--r--src/world.cpp2
-rw-r--r--test.frag2
-rw-r--r--xcf/door.xcfbin1628 -> 0 bytes
10 files changed, 15 insertions, 23 deletions
diff --git a/assets/door.png b/assets/door.png
index 582a52d..7db551d 100644
--- a/assets/door.png
+++ b/assets/door.png
Binary files differ
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;
diff --git a/main.cpp b/main.cpp
index 8e154fb..80bbeb9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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);
diff --git a/src/ui.cpp b/src/ui.cpp
index 08f503f..b759012 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -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());
}
diff --git a/test.frag b/test.frag
index c30ef4d..13fe6bc 100644
--- a/test.frag
+++ b/test.frag
@@ -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
deleted file mode 100644
index ab8e078..0000000
--- a/xcf/door.xcf
+++ /dev/null
Binary files differ