aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-03-08 08:42:20 -0500
committerClyne Sullivan <tullivan99@gmail.com>2016-03-08 08:42:20 -0500
commit82c75b0a97eba2f78206d3b97d47eaa580a82f0c (patch)
tree90116b676fc5b8cef16fbea8b07c4951dd645ea4
parent02419534e3a0753abc74d8d15b1dc8ac0e3b31a7 (diff)
world lighting fixed
-rw-r--r--Changelog6
-rw-r--r--Makefile2
-rw-r--r--include/freetype/config/ftconfig.h (renamed from include/freetype2/config/ftconfig.h)0
-rw-r--r--include/freetype/config/ftheader.h (renamed from include/freetype2/config/ftheader.h)0
-rw-r--r--include/freetype/config/ftmodule.h (renamed from include/freetype2/config/ftmodule.h)0
-rw-r--r--include/freetype/config/ftoption.h (renamed from include/freetype2/config/ftoption.h)0
-rw-r--r--include/freetype/config/ftstdlib.h (renamed from include/freetype2/config/ftstdlib.h)0
-rw-r--r--include/freetype/freetype.h (renamed from include/freetype2/freetype.h)0
-rw-r--r--include/freetype/ft2build.h (renamed from include/freetype2/ft2build.h)4
-rw-r--r--include/freetype/ftadvanc.h (renamed from include/freetype2/ftadvanc.h)0
-rw-r--r--include/freetype/ftautoh.h (renamed from include/freetype2/ftautoh.h)0
-rw-r--r--include/freetype/ftbbox.h (renamed from include/freetype2/ftbbox.h)0
-rw-r--r--include/freetype/ftbdf.h (renamed from include/freetype2/ftbdf.h)0
-rw-r--r--include/freetype/ftbitmap.h (renamed from include/freetype2/ftbitmap.h)0
-rw-r--r--include/freetype/ftbzip2.h (renamed from include/freetype2/ftbzip2.h)0
-rw-r--r--include/freetype/ftcache.h (renamed from include/freetype2/ftcache.h)0
-rw-r--r--include/freetype/ftcffdrv.h (renamed from include/freetype2/ftcffdrv.h)0
-rw-r--r--include/freetype/ftchapters.h (renamed from include/freetype2/ftchapters.h)0
-rw-r--r--include/freetype/ftcid.h (renamed from include/freetype2/ftcid.h)0
-rw-r--r--include/freetype/fterrdef.h (renamed from include/freetype2/fterrdef.h)0
-rw-r--r--include/freetype/fterrors.h (renamed from include/freetype2/fterrors.h)0
-rw-r--r--include/freetype/ftgasp.h (renamed from include/freetype2/ftgasp.h)0
-rw-r--r--include/freetype/ftglyph.h (renamed from include/freetype2/ftglyph.h)0
-rw-r--r--include/freetype/ftgxval.h (renamed from include/freetype2/ftgxval.h)0
-rw-r--r--include/freetype/ftgzip.h (renamed from include/freetype2/ftgzip.h)0
-rw-r--r--include/freetype/ftimage.h (renamed from include/freetype2/ftimage.h)0
-rw-r--r--include/freetype/ftincrem.h (renamed from include/freetype2/ftincrem.h)0
-rw-r--r--include/freetype/ftlcdfil.h (renamed from include/freetype2/ftlcdfil.h)0
-rw-r--r--include/freetype/ftlist.h (renamed from include/freetype2/ftlist.h)0
-rw-r--r--include/freetype/ftlzw.h (renamed from include/freetype2/ftlzw.h)0
-rw-r--r--include/freetype/ftmac.h (renamed from include/freetype2/ftmac.h)0
-rw-r--r--include/freetype/ftmm.h (renamed from include/freetype2/ftmm.h)0
-rw-r--r--include/freetype/ftmodapi.h (renamed from include/freetype2/ftmodapi.h)0
-rw-r--r--include/freetype/ftmoderr.h (renamed from include/freetype2/ftmoderr.h)0
-rw-r--r--include/freetype/ftotval.h (renamed from include/freetype2/ftotval.h)0
-rw-r--r--include/freetype/ftoutln.h (renamed from include/freetype2/ftoutln.h)0
-rw-r--r--include/freetype/ftpfr.h (renamed from include/freetype2/ftpfr.h)0
-rw-r--r--include/freetype/ftrender.h (renamed from include/freetype2/ftrender.h)0
-rw-r--r--include/freetype/ftsizes.h (renamed from include/freetype2/ftsizes.h)0
-rw-r--r--include/freetype/ftsnames.h (renamed from include/freetype2/ftsnames.h)0
-rw-r--r--include/freetype/ftstroke.h (renamed from include/freetype2/ftstroke.h)0
-rw-r--r--include/freetype/ftsynth.h (renamed from include/freetype2/ftsynth.h)0
-rw-r--r--include/freetype/ftsystem.h (renamed from include/freetype2/ftsystem.h)0
-rw-r--r--include/freetype/fttrigon.h (renamed from include/freetype2/fttrigon.h)0
-rw-r--r--include/freetype/ftttdrv.h (renamed from include/freetype2/ftttdrv.h)0
-rw-r--r--include/freetype/fttypes.h (renamed from include/freetype2/fttypes.h)0
-rw-r--r--include/freetype/ftwinfnt.h (renamed from include/freetype2/ftwinfnt.h)0
-rw-r--r--include/freetype/ftxf86.h (renamed from include/freetype2/ftxf86.h)0
-rw-r--r--include/freetype/t1tables.h (renamed from include/freetype2/t1tables.h)0
-rw-r--r--include/freetype/ttnameid.h (renamed from include/freetype2/ttnameid.h)0
-rw-r--r--include/freetype/tttables.h (renamed from include/freetype2/tttables.h)0
-rw-r--r--include/freetype/tttags.h (renamed from include/freetype2/tttags.h)0
-rw-r--r--include/freetype/ttunpat.h (renamed from include/freetype2/ttunpat.h)0
-rw-r--r--main.cpp13
-rw-r--r--src/entities.cpp8
-rw-r--r--src/ui.cpp4
-rw-r--r--src/world.cpp15
57 files changed, 33 insertions, 19 deletions
diff --git a/Changelog b/Changelog
index a24650f..bac3a64 100644
--- a/Changelog
+++ b/Changelog
@@ -743,3 +743,9 @@
- andy got here
~ Total of 7,379 lines of code!
+
+3/8/2016:
+=========
+
+ - fixed world draw shadings
+ - improved merchant menu
diff --git a/Makefile b/Makefile
index db92260..e49ff04 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ ifeq ($(TARGET_OS),win32)
endif
CXXFLAGS = -m$(TARGET_BITS) -std=c++14
-CXXINC = -Iinclude -Iinclude/freetype2
+CXXINC = -Iinclude -Iinclude/freetype
CXXWARN = -Wall -Wextra -Werror -pedantic-errors
CXXSRCDIR = src
diff --git a/include/freetype2/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 11d5d95..11d5d95 100644
--- a/include/freetype2/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
diff --git a/include/freetype2/config/ftheader.h b/include/freetype/config/ftheader.h
index b623629..b623629 100644
--- a/include/freetype2/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
diff --git a/include/freetype2/config/ftmodule.h b/include/freetype/config/ftmodule.h
index d1b938b..d1b938b 100644
--- a/include/freetype2/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
diff --git a/include/freetype2/config/ftoption.h b/include/freetype/config/ftoption.h
index 84eb8d0..84eb8d0 100644
--- a/include/freetype2/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
diff --git a/include/freetype2/config/ftstdlib.h b/include/freetype/config/ftstdlib.h
index b940efc..b940efc 100644
--- a/include/freetype2/config/ftstdlib.h
+++ b/include/freetype/config/ftstdlib.h
diff --git a/include/freetype2/freetype.h b/include/freetype/freetype.h
index 39a18af..39a18af 100644
--- a/include/freetype2/freetype.h
+++ b/include/freetype/freetype.h
diff --git a/include/freetype2/ft2build.h b/include/freetype/ft2build.h
index 6f8eb7f..419b80a 100644
--- a/include/freetype2/ft2build.h
+++ b/include/freetype/ft2build.h
@@ -4,7 +4,7 @@
/* */
/* FreeType 2 build and setup macros. */
/* */
-/* Copyright 1996-2001, 2006, 2013 by */
+/* Copyright 1996-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -34,7 +34,7 @@
#ifndef __FT2BUILD_H__
#define __FT2BUILD_H__
-#include <config/ftheader.h>
+#include <freetype/config/ftheader.h>
#endif /* __FT2BUILD_H__ */
diff --git a/include/freetype2/ftadvanc.h b/include/freetype/ftadvanc.h
index 8f7e2fc..8f7e2fc 100644
--- a/include/freetype2/ftadvanc.h
+++ b/include/freetype/ftadvanc.h
diff --git a/include/freetype2/ftautoh.h b/include/freetype/ftautoh.h
index bf97b3f..bf97b3f 100644
--- a/include/freetype2/ftautoh.h
+++ b/include/freetype/ftautoh.h
diff --git a/include/freetype2/ftbbox.h b/include/freetype/ftbbox.h
index 8938841..8938841 100644
--- a/include/freetype2/ftbbox.h
+++ b/include/freetype/ftbbox.h
diff --git a/include/freetype2/ftbdf.h b/include/freetype/ftbdf.h
index 4f8baf8..4f8baf8 100644
--- a/include/freetype2/ftbdf.h
+++ b/include/freetype/ftbdf.h
diff --git a/include/freetype2/ftbitmap.h b/include/freetype/ftbitmap.h
index 7dbf5ba..7dbf5ba 100644
--- a/include/freetype2/ftbitmap.h
+++ b/include/freetype/ftbitmap.h
diff --git a/include/freetype2/ftbzip2.h b/include/freetype/ftbzip2.h
index 1bf81b1..1bf81b1 100644
--- a/include/freetype2/ftbzip2.h
+++ b/include/freetype/ftbzip2.h
diff --git a/include/freetype2/ftcache.h b/include/freetype/ftcache.h
index a5d7100..a5d7100 100644
--- a/include/freetype2/ftcache.h
+++ b/include/freetype/ftcache.h
diff --git a/include/freetype2/ftcffdrv.h b/include/freetype/ftcffdrv.h
index e4d039d..e4d039d 100644
--- a/include/freetype2/ftcffdrv.h
+++ b/include/freetype/ftcffdrv.h
diff --git a/include/freetype2/ftchapters.h b/include/freetype/ftchapters.h
index 4b1059a..4b1059a 100644
--- a/include/freetype2/ftchapters.h
+++ b/include/freetype/ftchapters.h
diff --git a/include/freetype2/ftcid.h b/include/freetype/ftcid.h
index 203a30c..203a30c 100644
--- a/include/freetype2/ftcid.h
+++ b/include/freetype/ftcid.h
diff --git a/include/freetype2/fterrdef.h b/include/freetype/fterrdef.h
index 76c7b9e..76c7b9e 100644
--- a/include/freetype2/fterrdef.h
+++ b/include/freetype/fterrdef.h
diff --git a/include/freetype2/fterrors.h b/include/freetype/fterrors.h
index 0fa3e4d..0fa3e4d 100644
--- a/include/freetype2/fterrors.h
+++ b/include/freetype/fterrors.h
diff --git a/include/freetype2/ftgasp.h b/include/freetype/ftgasp.h
index 453d4fa..453d4fa 100644
--- a/include/freetype2/ftgasp.h
+++ b/include/freetype/ftgasp.h
diff --git a/include/freetype2/ftglyph.h b/include/freetype/ftglyph.h
index 2d30ed9..2d30ed9 100644
--- a/include/freetype2/ftglyph.h
+++ b/include/freetype/ftglyph.h
diff --git a/include/freetype2/ftgxval.h b/include/freetype/ftgxval.h
index 6d38e32..6d38e32 100644
--- a/include/freetype2/ftgxval.h
+++ b/include/freetype/ftgxval.h
diff --git a/include/freetype2/ftgzip.h b/include/freetype/ftgzip.h
index 78e7269..78e7269 100644
--- a/include/freetype2/ftgzip.h
+++ b/include/freetype/ftgzip.h
diff --git a/include/freetype2/ftimage.h b/include/freetype/ftimage.h
index b66f036..b66f036 100644
--- a/include/freetype2/ftimage.h
+++ b/include/freetype/ftimage.h
diff --git a/include/freetype2/ftincrem.h b/include/freetype/ftincrem.h
index aaf689f..aaf689f 100644
--- a/include/freetype2/ftincrem.h
+++ b/include/freetype/ftincrem.h
diff --git a/include/freetype2/ftlcdfil.h b/include/freetype/ftlcdfil.h
index 39206f0..39206f0 100644
--- a/include/freetype2/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
diff --git a/include/freetype2/ftlist.h b/include/freetype/ftlist.h
index 241e21e..241e21e 100644
--- a/include/freetype2/ftlist.h
+++ b/include/freetype/ftlist.h
diff --git a/include/freetype2/ftlzw.h b/include/freetype/ftlzw.h
index 00d4016..00d4016 100644
--- a/include/freetype2/ftlzw.h
+++ b/include/freetype/ftlzw.h
diff --git a/include/freetype2/ftmac.h b/include/freetype/ftmac.h
index 42874fe..42874fe 100644
--- a/include/freetype2/ftmac.h
+++ b/include/freetype/ftmac.h
diff --git a/include/freetype2/ftmm.h b/include/freetype/ftmm.h
index 837975a..837975a 100644
--- a/include/freetype2/ftmm.h
+++ b/include/freetype/ftmm.h
diff --git a/include/freetype2/ftmodapi.h b/include/freetype/ftmodapi.h
index 22878f8..22878f8 100644
--- a/include/freetype2/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
diff --git a/include/freetype2/ftmoderr.h b/include/freetype/ftmoderr.h
index 5a27db1..5a27db1 100644
--- a/include/freetype2/ftmoderr.h
+++ b/include/freetype/ftmoderr.h
diff --git a/include/freetype2/ftotval.h b/include/freetype/ftotval.h
index bb52dc4..bb52dc4 100644
--- a/include/freetype2/ftotval.h
+++ b/include/freetype/ftotval.h
diff --git a/include/freetype2/ftoutln.h b/include/freetype/ftoutln.h
index 8c7c57d..8c7c57d 100644
--- a/include/freetype2/ftoutln.h
+++ b/include/freetype/ftoutln.h
diff --git a/include/freetype2/ftpfr.h b/include/freetype/ftpfr.h
index 0b7b7d4..0b7b7d4 100644
--- a/include/freetype2/ftpfr.h
+++ b/include/freetype/ftpfr.h
diff --git a/include/freetype2/ftrender.h b/include/freetype/ftrender.h
index dd0229b..dd0229b 100644
--- a/include/freetype2/ftrender.h
+++ b/include/freetype/ftrender.h
diff --git a/include/freetype2/ftsizes.h b/include/freetype/ftsizes.h
index 4167045..4167045 100644
--- a/include/freetype2/ftsizes.h
+++ b/include/freetype/ftsizes.h
diff --git a/include/freetype2/ftsnames.h b/include/freetype/ftsnames.h
index 88af440..88af440 100644
--- a/include/freetype2/ftsnames.h
+++ b/include/freetype/ftsnames.h
diff --git a/include/freetype2/ftstroke.h b/include/freetype/ftstroke.h
index a498e4a..a498e4a 100644
--- a/include/freetype2/ftstroke.h
+++ b/include/freetype/ftstroke.h
diff --git a/include/freetype2/ftsynth.h b/include/freetype/ftsynth.h
index 839ab5e..839ab5e 100644
--- a/include/freetype2/ftsynth.h
+++ b/include/freetype/ftsynth.h
diff --git a/include/freetype2/ftsystem.h b/include/freetype/ftsystem.h
index e07460c..e07460c 100644
--- a/include/freetype2/ftsystem.h
+++ b/include/freetype/ftsystem.h
diff --git a/include/freetype2/fttrigon.h b/include/freetype/fttrigon.h
index 65143cb..65143cb 100644
--- a/include/freetype2/fttrigon.h
+++ b/include/freetype/fttrigon.h
diff --git a/include/freetype2/ftttdrv.h b/include/freetype/ftttdrv.h
index 70ad3d5..70ad3d5 100644
--- a/include/freetype2/ftttdrv.h
+++ b/include/freetype/ftttdrv.h
diff --git a/include/freetype2/fttypes.h b/include/freetype/fttypes.h
index bd944a4..bd944a4 100644
--- a/include/freetype2/fttypes.h
+++ b/include/freetype/fttypes.h
diff --git a/include/freetype2/ftwinfnt.h b/include/freetype/ftwinfnt.h
index 0b67351..0b67351 100644
--- a/include/freetype2/ftwinfnt.h
+++ b/include/freetype/ftwinfnt.h
diff --git a/include/freetype2/ftxf86.h b/include/freetype/ftxf86.h
index 493cccd..493cccd 100644
--- a/include/freetype2/ftxf86.h
+++ b/include/freetype/ftxf86.h
diff --git a/include/freetype2/t1tables.h b/include/freetype/t1tables.h
index a14255e..a14255e 100644
--- a/include/freetype2/t1tables.h
+++ b/include/freetype/t1tables.h
diff --git a/include/freetype2/ttnameid.h b/include/freetype/ttnameid.h
index 9711d1d..9711d1d 100644
--- a/include/freetype2/ttnameid.h
+++ b/include/freetype/ttnameid.h
diff --git a/include/freetype2/tttables.h b/include/freetype/tttables.h
index bb49dc0..bb49dc0 100644
--- a/include/freetype2/tttables.h
+++ b/include/freetype/tttables.h
diff --git a/include/freetype2/tttags.h b/include/freetype/tttags.h
index d59aa19..d59aa19 100644
--- a/include/freetype2/tttags.h
+++ b/include/freetype/tttags.h
diff --git a/include/freetype2/ttunpat.h b/include/freetype/ttunpat.h
index a016275..a016275 100644
--- a/include/freetype2/ttunpat.h
+++ b/include/freetype/ttunpat.h
diff --git a/main.cpp b/main.cpp
index af962db..1ff97ca 100644
--- a/main.cpp
+++ b/main.cpp
@@ -128,16 +128,6 @@ ThreadPool pool(10);
GLuint colorIndex;
-/*
- * initEverything
- *
- * Before the main loop, things like the player, entities, and worlds should
- * be created. This game has not reached the point that these can be scripted
- * or programmed, so this function substitues for that. It is defined in
- * src/gameplay.cpp.
- *
-*/
-
/**
* TODO
*/
@@ -205,11 +195,10 @@ void render(void);
void mainLoop(void);
-
-
/*******************************************************************************
* MAIN ************************************************************************
*******************************************************************************/
+
int main(int argc, char *argv[]){
(void)argc;
(void)argv;
diff --git a/src/entities.cpp b/src/entities.cpp
index 06269d6..8a10428 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -8,6 +8,7 @@ extern std::istream *names;
extern Player *player; // main.cpp
extern World *currentWorld; // main.cpp
extern unsigned int loops; // main.cpp
+extern unsigned int tickCount; // main.cpp
GLuint waterTex;
@@ -295,6 +296,10 @@ void Object::reloadTexture(void){
void Entity::draw(void){ //draws the entities
glPushMatrix();
glColor3ub(255,255,255);
+
+ if ( !alive )
+ return;
+
if(type==NPCT){
if(NPCp(this)->aiFunc.size()){
glColor3ub(255,255,0);
@@ -626,6 +631,7 @@ void Player::save(void){
data.append(std::to_string((int)loc.y) + "\n");
data.append(std::to_string((int)health) + "\n");
data.append(std::to_string((int)maxHealth) + "\n");
+ data.append(std::to_string((int)tickCount) + "\n");
data.append(std::to_string((int)inv->items.size()) + "\n");
for(auto &i : inv->items)
@@ -666,6 +672,8 @@ void Player::sspawn(float x,float y){
health = std::stoi(ddata);
std::getline(data,ddata);
maxHealth = std::stoi(ddata);
+ std::getline(data,ddata);
+ tickCount = std::stoi(ddata);
std::getline(data,ddata);
for(i = std::stoi(ddata);i;i--){
diff --git a/src/ui.cpp b/src/ui.cpp
index 97121b4..eb25e2e 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -30,6 +30,7 @@ extern std::vector<NPC *> AIpreaddr;
*/
extern bool gameRunning;
+extern unsigned int tickCount;
/*
* Freetype variables, and a GLuint for referencing rendered letters.
@@ -1276,6 +1277,9 @@ DONE:
} else if ( !dialogBoxExists || dialogPassive ) {
tmp = currentWorld;
switch(SDL_KEY){
+ case SDLK_t:
+ tickCount += 50;
+ break;
case SDLK_a:
if(fadeEnable)break;
player->vel.x=-.15;
diff --git a/src/world.cpp b/src/world.cpp
index 4de6e39..0a84c20 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -407,6 +407,13 @@ draw( Player *p )
// world width in pixels
int width = worldData.size() * HLINE;
+ // shade value for GLSL
+ float shadeAmbient = -worldShade / 50.0f + 0.5f; // -0.5f to 1.5f
+ if ( shadeAmbient < 0 )
+ shadeAmbient = 0;
+ else if ( shadeAmbient > 0.9f )
+ shadeAmbient = 1;
+
/*
* Draw background images.
*/
@@ -459,7 +466,7 @@ draw( Player *p )
glEnable( GL_TEXTURE_2D );
bgTex->bindNext();
- safeSetColorA( 150 - shadeBackground, 150 - shadeBackground, 150 - shadeBackground, 220 );
+ safeSetColorA( 150 + shadeBackground * 2, 150 + shadeBackground * 2, 150 + shadeBackground * 2, 255 );
glBegin( GL_QUADS );
for ( i = 0; i <= (int)(worldData.size() * HLINE / 1920); i++ ) {
@@ -472,7 +479,7 @@ draw( Player *p )
for ( i = 0; i < 4; i++ ) {
bgTex->bindNext();
- safeSetColorA( bgDraw[i][0] - shadeBackground, bgDraw[i][0] - shadeBackground, bgDraw[i][0] - shadeBackground, bgDraw[i][1] );
+ safeSetColorA( bgDraw[i][0] + shadeBackground * 2, bgDraw[i][0] + shadeBackground * 2, bgDraw[i][0] + shadeBackground * 2, bgDraw[i][1] );
glBegin( GL_QUADS );
for( int j = worldStart; j <= -worldStart; j += 600 ){
@@ -534,7 +541,7 @@ draw( Player *p )
glUseProgram( shaderProgram );
glUniform1i( glGetUniformLocation( shaderProgram, "sampler"), 0 );
- glUniform1f( glGetUniformLocation( shaderProgram, "amb" ), -worldShade / 50.0f );
+ glUniform1f( glGetUniformLocation( shaderProgram, "amb" ), shadeAmbient );
if ( p->light ) {
pointArray[2 * (light.size() + 1) ] = (float)( p->loc.x + SCREEN_WIDTH / 2 );
@@ -1196,7 +1203,7 @@ void IndoorWorld::draw(Player *p){
glUseProgram( shaderProgram );
glUniform1i( glGetUniformLocation( shaderProgram, "sampler"), 0 );
- glUniform1f( glGetUniformLocation( shaderProgram, "amb" ), 0.5f - worldShade / 50.0f );
+ glUniform1f( glGetUniformLocation( shaderProgram, "amb" ), 0.3f );
if ( p->light ) {
pointArray[2 * (light.size() + 1) ] = (float)( p->loc.x + SCREEN_WIDTH / 2 );