aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui.cpp2
-rw-r--r--src/world.cpp10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 7979138..cf5e31e 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -815,7 +815,7 @@ DONE:
player->inv->sel++;
break;
case SDLK_f:
-
+ player->light^=true;
break;
default:
break;
diff --git a/src/world.cpp b/src/world.cpp
index 93341f2..a52e3f3 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -674,7 +674,10 @@ LOOP2:
glUseProgram(shaderProgram);
glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
glUniform1f(glGetUniformLocation(shaderProgram, "amb"), float(shade+50.0f)/100.0f);
- if(light.size() == 0){
+ if(p->light){
+ glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), p->loc.x - offset.x+SCREEN_WIDTH/2,p->loc.y);
+ glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1.0f,1.0f,1.0f);
+ }else if(light.size() == 0){
glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 0,-1000);
glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 0.0f,0.0f,0.0f);
}else{
@@ -1268,7 +1271,10 @@ void IndoorWorld::draw(Player *p){
glUseProgram(shaderProgram);
glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
glUniform1f(glGetUniformLocation(shaderProgram, "amb"), 0.0f);
- if(light.size() == 0){
+ if(p->light){
+ glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), p->loc.x - offset.x+SCREEN_WIDTH/2,p->loc.y);
+ glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1.0f,1.0f,1.0f);
+ }else if(light.size() == 0){
glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 0,-1000);
glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 0.0f,0.0f,0.0f);
}else{