diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp index 32d818d2..72966bbd 100644 --- a/Adventures in Lestoria/State_OverworldMap.cpp +++ b/Adventures in Lestoria/State_OverworldMap.cpp @@ -90,6 +90,15 @@ void State_OverworldMap::OnUserUpdate(AiL*game){ game->UpdateCamera(game->GetElapsedTime()); game->GetPlayer()->Update(game->GetElapsedTime()); + if(game->GetKey(PGUP).bHeld){ + mosaicAmt+=game->GetElapsedTime()*10; + game->SetMosaicEffect(uint8_t(mosaicAmt)); + } + if(game->GetKey(PGDN).bHeld){ + mosaicAmt-=game->GetElapsedTime()*10; + game->SetMosaicEffect(uint8_t(mosaicAmt)); + } + if(game->GetPlayer()->GetPos()!=playerTargetPos){ if(geom2d::line(game->GetPlayer()->GetPos(),playerTargetPos).length()<2){ game->GetPlayer()->SetPos(playerTargetPos); diff --git a/Adventures in Lestoria/State_OverworldMap.h b/Adventures in Lestoria/State_OverworldMap.h index 49268105..8cdc00fa 100644 --- a/Adventures in Lestoria/State_OverworldMap.h +++ b/Adventures in Lestoria/State_OverworldMap.h @@ -47,6 +47,7 @@ class State_OverworldMap:public GameState{ vf2d playerTargetPos; const float playerMoveSpd=48.0; bool analogMove=false; + float mosaicAmt=0.f; public: State_OverworldMap(); static std::vectorconnections; diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index be3795a2..2b36c4af 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -1,7 +1,14 @@ January 1st =========== +- Foreground tile depth correction for tiles w/hitboxes + +- Add Death screen (Zoom in on fatal blow, slow time down... Display some game over text... Allow retry or return to world map.) + - Track items used during a stage, on death, restore the loadout item quantities used. +- Icon displays / Proper key displays above skill keys + + Add Bonus XP when completing a stage January 31st @@ -10,17 +17,14 @@ January 31st - Loading Screen - Title Screen setpieces -- Add Death screen (Zoom in on fatal blow, slow time down... Display some game over text... Allow retry or return to world map.) - Hide mouse cursor during controller play. Reveal it again during mouse play. - Resource Packs -- Hold mouse down to increase quantity - -- Icon displays / Proper key displays above skill keys - - Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in. - Condense stage track (loading times) +- SNES mosaic effect on stage select/stage transition. + - Credits/Licensing \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 07ffd224..9e53d119 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 7474 +#define VERSION_BUILD 7485 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index b314b210..dd10664e 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -376,6 +376,8 @@ return 0; */ #pragma endregion +#define OLC_GFX_OPENGL33 + #ifndef OLC_PGE_DEF #define OLC_PGE_DEF @@ -1230,6 +1232,8 @@ namespace olc int32_t TextEntryGetCursor() const; bool IsTextEntryEnabled() const; void TextEntrySetCharLimit(const uint8_t charLimit); + const uint8_t GetMosaicEffect()const; + void SetMosaicEffect(uint8_t effectLevel); public: static std::map charToColor; @@ -1340,6 +1344,7 @@ namespace olc std::vector vDroppedFilesCache; olc::vi2d vDroppedFilesPoint; olc::vi2d vDroppedFilesPointCache; + uint8_t mosaic=1; uint8_t nTextEntryCharLimit=std::numeric_limits::max(); // Command Console Specific @@ -1505,6 +1510,7 @@ namespace olc typedef GLint CALLSTYLE locGetUniformLocation_t(GLuint program, const GLchar* name); typedef void CALLSTYLE locUniform1f_t(GLint location, GLfloat v0); typedef void CALLSTYLE locUniform1i_t(GLint location, GLint v0); + typedef void CALLSTYLE locUniform2f_t(GLint location, GLfloat v0, GLfloat v1); typedef void CALLSTYLE locUniform2fv_t(GLint location, GLsizei count, const GLfloat* value); typedef void CALLSTYLE locActiveTexture_t(GLenum texture); typedef void CALLSTYLE locGenFrameBuffers_t(GLsizei n, GLuint* ids); @@ -4383,6 +4389,12 @@ namespace olc void PixelGameEngine::TextEntrySetCharLimit(const uint8_t charLimit){ nTextEntryCharLimit=charLimit; } + const uint8_t PixelGameEngine::GetMosaicEffect()const{ + return mosaic; + } + void PixelGameEngine::SetMosaicEffect(uint8_t effectLevel){ + mosaic=std::max(uint8_t(1),effectLevel); + } void PixelGameEngine::UpdateTextEntry() { @@ -5570,6 +5582,9 @@ namespace olc locGenVertexArrays_t* locGenVertexArrays = nullptr; locSwapInterval_t* locSwapInterval = nullptr; locGetShaderInfoLog_t* locGetShaderInfoLog = nullptr; + locGetUniformLocation_t* locGetUniformLocation = nullptr; + locUniform1i_t* locUniform1i = nullptr; + locUniform2f_t* locUniform2f = nullptr; uint32_t m_nFS = 0; uint32_t m_nVS = 0; @@ -5711,6 +5726,9 @@ namespace olc locEnableVertexAttribArray = OGL_LOAD(locEnableVertexAttribArray_t, glEnableVertexAttribArray); locUseProgram = OGL_LOAD(locUseProgram_t, glUseProgram); locGetShaderInfoLog = OGL_LOAD(locGetShaderInfoLog_t, glGetShaderInfoLog); + locGetUniformLocation = OGL_LOAD(locGetUniformLocation_t, glGetUniformLocation); + locUniform1i = OGL_LOAD(locUniform1i_t, glUniform1i); + locUniform2f = OGL_LOAD(locUniform2f_t, glUniform2f); #if !defined(OLC_PLATFORM_EMSCRIPTEN) locBindVertexArray = OGL_LOAD(locBindVertexArray_t, glBindVertexArray); locGenVertexArrays = OGL_LOAD(locGenVertexArrays_t, glGenVertexArrays); @@ -5724,12 +5742,22 @@ namespace olc const GLchar* strFS = #if defined(__arm__) || defined(OLC_PLATFORM_EMSCRIPTEN) "#version 300 es\n" - "precision mediump float;" + "precision highp float;" #else "#version 330 core\n" #endif - "out vec4 pixel;\n""in vec2 oTex;\n" - "in vec4 oCol;\n""uniform sampler2D sprTex;\n""void main(){pixel = texture(sprTex, oTex) * oCol;}"; + "out vec4 pixel;\n" + "in vec2 oTex;\n" + "in vec4 oCol;\n" + "uniform int mosaic;\n" + "uniform vec2 size;\n" + "uniform sampler2D sprTex;\n" + "void main(){\n" + "if(mosaic<=1){pixel = texture(sprTex,oTex) * oCol;return;}\n" + "vec2 texelSize = 1.0 / textureSize(sprTex,0); \n" + "vec2 pos = oTex / texelSize; \n""vec2 outputPos = vec2(floor(pos.x/float(mosaic))*float(mosaic),floor(pos.y/float(mosaic))*float(mosaic));\n" + "pixel = texture(sprTex, outputPos*texelSize) * oCol;\n" + "}"; locShaderSource(m_nFS, 1, &strFS, NULL); locCompileShader(m_nFS); @@ -5741,9 +5769,18 @@ namespace olc #else "#version 330 core\n" #endif - "layout(location = 0) in vec3 aPos;\n""layout(location = 1) in vec2 aTex;\n" - "layout(location = 2) in vec4 aCol;\n""out vec2 oTex;\n""out vec4 oCol;\n" - "void main(){ float p = 1.0 / aPos.z; gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0); oTex = p * aTex; oCol = aCol;}"; + "layout(location = 0) in vec3 aPos;\n" + "layout(location = 1) in vec2 aTex;\n" + "layout(location = 2) in vec4 aCol;\n" + "out vec2 oTex;\n" + "out vec4 oCol;\n" + "\n" + "void main(){\n" + "float p = 1.0 / aPos.z;\n" + "gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0);\n" + "oTex = p * aTex;\n" + "oCol = aCol;\n" + "}"; locShaderSource(m_nVS, 1, &strVS, NULL); locCompileShader(m_nVS); @@ -5826,6 +5863,10 @@ namespace olc nDecalMode = DecalMode::NORMAL; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); locUseProgram(m_nQuadShader); + GLint mosaicUniformLoc = locGetUniformLocation(m_nQuadShader, "mosaic"); + GLint sizeUniformLoc = locGetUniformLocation(m_nQuadShader, "size"); + locUniform1i(mosaicUniformLoc,ptrPGE->GetMosaicEffect()); + locUniform2f(sizeUniformLoc,ptrPGE->ScreenWidth(),ptrPGE->ScreenHeight()); locBindVertexArray(m_vaQuad); #if defined(OLC_PLATFORM_EMSCRIPTEN) diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 2256f6cf..64edc953 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ