From b19fdb6a77ff842b55feec8e27cc161a397016a2 Mon Sep 17 00:00:00 2001 From: CapitaineSheridan Date: Sun, 12 Mar 2023 11:15:27 +0100 Subject: [PATCH] Change Media folder to Assets folder. Naming variable convention. Command line change -crosshair-style = vector|bmp. Config ini variable change CrosshairStyle = vector|bmp. CCrosshair::DrawCrosshair optimisation. Modifying UpdateCrosshairs() to eliminate global variable. --- {Media => Assets}/DIR.txt | 0 {Media => Assets}/p1crosshair.bmp | Bin {Media => Assets}/p2crosshair.bmp | Bin Src/OSD/FileSystemPath.h | 2 +- Src/OSD/OSX/FileSystemPath.cpp | 4 +- Src/OSD/SDL/Crosshair.cpp | 213 +++++++++++++++-------------- Src/OSD/SDL/Crosshair.h | 41 +++--- Src/OSD/SDL/Main.cpp | 52 +++---- Src/OSD/Unix/FileSystemPath.cpp | 4 +- Src/OSD/Windows/FileSystemPath.cpp | 4 +- VS2008/Supermodel.vcxproj | 16 +-- 11 files changed, 160 insertions(+), 176 deletions(-) rename {Media => Assets}/DIR.txt (100%) rename {Media => Assets}/p1crosshair.bmp (100%) rename {Media => Assets}/p2crosshair.bmp (100%) diff --git a/Media/DIR.txt b/Assets/DIR.txt similarity index 100% rename from Media/DIR.txt rename to Assets/DIR.txt diff --git a/Media/p1crosshair.bmp b/Assets/p1crosshair.bmp similarity index 100% rename from Media/p1crosshair.bmp rename to Assets/p1crosshair.bmp diff --git a/Media/p2crosshair.bmp b/Assets/p2crosshair.bmp similarity index 100% rename from Media/p2crosshair.bmp rename to Assets/p2crosshair.bmp diff --git a/Src/OSD/FileSystemPath.h b/Src/OSD/FileSystemPath.h index e5ee179..2138887 100644 --- a/Src/OSD/FileSystemPath.h +++ b/Src/OSD/FileSystemPath.h @@ -32,7 +32,7 @@ namespace FileSystemPath { - enum PathType { Analysis, Config, Log, NVRAM, Saves, Screenshots, Media }; // Filesystem path types + enum PathType { Analysis, Config, Log, NVRAM, Saves, Screenshots, Assets }; // Filesystem path types bool PathExists(std::string fileSystemPath); // Checks if a directory exists (returns true if exists, false if it doesn't) std::string GetPath(PathType pathType); // Generates a path to be used by Supermodel files } diff --git a/Src/OSD/OSX/FileSystemPath.cpp b/Src/OSD/OSX/FileSystemPath.cpp index a70463e..d1619aa 100644 --- a/Src/OSD/OSX/FileSystemPath.cpp +++ b/Src/OSD/OSX/FileSystemPath.cpp @@ -41,8 +41,8 @@ namespace FileSystemPath return "Saves/"; case Screenshots: return ""; - case Media: - return "Media/"; + case Assets: + return "Assets/"; } } } diff --git a/Src/OSD/SDL/Crosshair.cpp b/Src/OSD/SDL/Crosshair.cpp index ce69c8e..02501de 100644 --- a/Src/OSD/SDL/Crosshair.cpp +++ b/Src/OSD/SDL/Crosshair.cpp @@ -27,81 +27,81 @@ #include #include -bool CCrosshair::init() +bool CCrosshair::Init() { - const std::string P1CrosshairFile = Util::Format() << FileSystemPath::GetPath(FileSystemPath::Media) << "p1crosshair.bmp"; - const std::string P2CrosshairFile = Util::Format() << FileSystemPath::GetPath(FileSystemPath::Media) << "p2crosshair.bmp"; + const std::string p1CrosshairFile = Util::Format() << FileSystemPath::GetPath(FileSystemPath::Assets) << "p1crosshair.bmp"; + const std::string p2CrosshairFile = Util::Format() << FileSystemPath::GetPath(FileSystemPath::Assets) << "p2crosshair.bmp"; - IsBitmapCrosshair = m_config["BitmapCrosshair"].ValueAs(); - xRes = m_config["XResolution"].ValueAs(); - yRes = m_config["YResolution"].ValueAs(); - a = (float)xRes / (float)yRes; + m_isBitmapCrosshair = m_config["CrosshairStyle"].ValueAs(); + m_xRes = m_config["XResolution"].ValueAs(); + m_yRes = m_config["YResolution"].ValueAs(); + m_a = (float)m_xRes / (float)m_yRes; - SDL_Surface* SurfaceCrosshairP1 = SDL_LoadBMP(P1CrosshairFile.c_str()); - SDL_Surface* SurfaceCrosshairP2 = SDL_LoadBMP(P2CrosshairFile.c_str()); - if (SurfaceCrosshairP1 == NULL || SurfaceCrosshairP2 == NULL) + SDL_Surface* surfaceCrosshairP1 = SDL_LoadBMP(p1CrosshairFile.c_str()); + SDL_Surface* surfaceCrosshairP2 = SDL_LoadBMP(p2CrosshairFile.c_str()); + if (surfaceCrosshairP1 == NULL || surfaceCrosshairP2 == NULL) return FAIL; - P1CrosshairW = SurfaceCrosshairP1->w; - P1CrosshairH = SurfaceCrosshairP1->h; - P2CrosshairW = SurfaceCrosshairP2->w; - P2CrosshairH = SurfaceCrosshairP2->h; + m_p1CrosshairW = surfaceCrosshairP1->w; + m_p1CrosshairH = surfaceCrosshairP1->h; + m_p2CrosshairW = surfaceCrosshairP2->w; + m_p2CrosshairH = surfaceCrosshairP2->h; - glGenTextures(2, CrosshairtxID); + glGenTextures(2, m_crosshairTexId); - glBindTexture(GL_TEXTURE_2D, CrosshairtxID[0]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, P1CrosshairW, P1CrosshairH, 0, GL_BGRA, GL_UNSIGNED_BYTE, SurfaceCrosshairP1->pixels); + glBindTexture(GL_TEXTURE_2D, m_crosshairTexId[0]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_p1CrosshairW, m_p1CrosshairH, 0, GL_BGRA, GL_UNSIGNED_BYTE, surfaceCrosshairP1->pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glBindTexture(GL_TEXTURE_2D, CrosshairtxID[1]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, P1CrosshairW, P1CrosshairH, 0, GL_BGRA, GL_UNSIGNED_BYTE, SurfaceCrosshairP2->pixels); + glBindTexture(GL_TEXTURE_2D, m_crosshairTexId[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_p1CrosshairW, m_p1CrosshairH, 0, GL_BGRA, GL_UNSIGNED_BYTE, surfaceCrosshairP2->pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0); - SDL_FreeSurface(SurfaceCrosshairP1); - SDL_FreeSurface(SurfaceCrosshairP2); + SDL_FreeSurface(surfaceCrosshairP1); + SDL_FreeSurface(surfaceCrosshairP2); // Get DPI - SDL_GetDisplayDPI(0, &diagdpi, &hdpi, &vdpi); - dpiMultiplicator = hdpi / standardDpi; // note : on linux VM diagdpi returns 0 + SDL_GetDisplayDPI(0, &m_diagDpi, &m_hDpi, &m_vDpi); + m_dpiMultiplicator = m_hDpi / m_standardDpi; // note : on linux VM diagdpi returns 0 // 3d obj - UVCoord.emplace_back(0.0f, 0.0f); - UVCoord.emplace_back(1.0f, 0.0f); - UVCoord.emplace_back(1.0f, 1.0f); - UVCoord.emplace_back(0.0f, 0.0f); - UVCoord.emplace_back(1.0f, 1.0f); - UVCoord.emplace_back(0.0f, 1.0f); + m_uvCoord.emplace_back(0.0f, 0.0f); + m_uvCoord.emplace_back(1.0f, 0.0f); + m_uvCoord.emplace_back(1.0f, 1.0f); + m_uvCoord.emplace_back(0.0f, 0.0f); + m_uvCoord.emplace_back(1.0f, 1.0f); + m_uvCoord.emplace_back(0.0f, 1.0f); - if (!IsBitmapCrosshair) + if (m_isBitmapCrosshair != "bmp") { - verts.emplace_back(0.0f, dist); // bottom triangle - verts.emplace_back(base / 2.0f, (dist + height) * a); - verts.emplace_back(-base / 2.0f, (dist + height) * a); - verts.emplace_back(0.0f, -dist); // top triangle - verts.emplace_back(-base / 2.0f, -(dist + height) * a); - verts.emplace_back(base / 2.0f, -(dist + height) * a); - verts.emplace_back(-dist, 0.0f); // left triangle - verts.emplace_back(-dist - height, (base / 2.0f) * a); - verts.emplace_back(-dist - height, -(base / 2.0f) * a); - verts.emplace_back(dist, 0.0f); // right triangle - verts.emplace_back(dist + height, -(base / 2.0f) * a); - verts.emplace_back(dist + height, (base / 2.0f) * a); + m_verts.emplace_back(0.0f, m_dist); // bottom triangle + m_verts.emplace_back(m_base / 2.0f, (m_dist + m_height) * m_a); + m_verts.emplace_back(-m_base / 2.0f, (m_dist + m_height) * m_a); + m_verts.emplace_back(0.0f, -m_dist); // top triangle + m_verts.emplace_back(-m_base / 2.0f, -(m_dist + m_height) * m_a); + m_verts.emplace_back(m_base / 2.0f, -(m_dist + m_height) * m_a); + m_verts.emplace_back(-m_dist, 0.0f); // left triangle + m_verts.emplace_back(-m_dist - m_height, (m_base / 2.0f) * m_a); + m_verts.emplace_back(-m_dist - m_height, -(m_base / 2.0f) * m_a); + m_verts.emplace_back(m_dist, 0.0f); // right triangle + m_verts.emplace_back(m_dist + m_height, -(m_base / 2.0f) * m_a); + m_verts.emplace_back(m_dist + m_height, (m_base / 2.0f) * m_a); } else { - verts.emplace_back(-squareSize / 2.0f, -squareSize / 2.0f * a); - verts.emplace_back(squareSize / 2.0f, -squareSize / 2.0f * a); - verts.emplace_back(squareSize / 2.0f, squareSize / 2.0f * a); - verts.emplace_back(-squareSize / 2.0f, -squareSize / 2.0f * a); - verts.emplace_back(squareSize / 2.0f, squareSize / 2.0f * a); - verts.emplace_back(-squareSize / 2.0f, squareSize / 2.0f * a); + m_verts.emplace_back(-m_squareSize / 2.0f, -m_squareSize / 2.0f * m_a); + m_verts.emplace_back(m_squareSize / 2.0f, -m_squareSize / 2.0f * m_a); + m_verts.emplace_back(m_squareSize / 2.0f, m_squareSize / 2.0f * m_a); + m_verts.emplace_back(-m_squareSize / 2.0f, -m_squareSize / 2.0f * m_a); + m_verts.emplace_back(m_squareSize / 2.0f, m_squareSize / 2.0f * m_a); + m_verts.emplace_back(-m_squareSize / 2.0f, m_squareSize / 2.0f * m_a); } - vertexShader = R"glsl( + m_vertexShader = R"glsl( #version 410 core @@ -117,7 +117,7 @@ bool CCrosshair::init() } )glsl"; - fragmentShader = R"glsl( + m_fragmentShader = R"glsl( #version 410 core @@ -136,7 +136,7 @@ bool CCrosshair::init() } )glsl"; - m_shader.LoadShaders(vertexShader, fragmentShader); + m_shader.LoadShaders(m_vertexShader, m_fragmentShader); m_shader.GetUniformLocationMap("mvp"); m_shader.GetUniformLocationMap("CrosshairTexture"); m_shader.GetUniformLocationMap("colour"); @@ -144,7 +144,7 @@ bool CCrosshair::init() m_vbo.Create(GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, sizeof(BasicVertex) * (MaxVerts)); m_vbo.Bind(true); - m_textvbo.Create(GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, sizeof(UVCoords) * (int)UVCoord.size()); + m_textvbo.Create(GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, sizeof(UVCoords) * (int)m_uvCoord.size()); m_textvbo.Bind(true); glGenVertexArrays(1, &m_vao); @@ -166,27 +166,68 @@ bool CCrosshair::init() return OKAY; } -void CCrosshair::DrawCrosshair(New3D::Mat4 matrix, float x, float y, float r, float g, float b) +void CCrosshair::DrawCrosshair(New3D::Mat4 matrix, float x, float y, int player) { - int count = (int)verts.size(); + float r=0.0f, g=0.0f, b=0.0f; + int count = (int)m_verts.size(); + if (count > MaxVerts) { count = MaxVerts; // maybe we could error out somehow } - m_shader.EnableShader(); - matrix.Translate(x, y, 0); - matrix.Scale(dpiMultiplicator, dpiMultiplicator, 0); - // update uniform memory - glUniformMatrix4fv(m_shader.uniformLocMap["mvp"], 1, GL_FALSE, matrix); - glUniform4f(m_shader.uniformLocMap["colour"], r, g, b, 1.0f); - glUniform1i(m_shader.uniformLocMap["isBitmap"], false); + if (m_isBitmapCrosshair != "bmp") + { + switch (player) + { + case 0: + r = 1.0f; + g = 0.0f; + b = 0.0f; + break; + case 1: + r = 0.0f; + g = 1.0f; + b = 0.0f; + break; + } - // update vbo mem - m_vbo.Bind(true); - m_vbo.BufferSubData(0, count * sizeof(BasicVertex), verts.data()); + matrix.Scale(m_dpiMultiplicator, m_dpiMultiplicator, 0); + + // update uniform memory + glUniformMatrix4fv(m_shader.uniformLocMap["mvp"], 1, GL_FALSE, matrix); + glUniform4f(m_shader.uniformLocMap["colour"], r, g, b, 1.0f); + glUniform1i(m_shader.uniformLocMap["isBitmap"], false); + + // update vbo mem + m_vbo.Bind(true); + m_vbo.BufferSubData(0, count * sizeof(BasicVertex), m_verts.data()); + } + else + { + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, m_crosshairTexId[player]); + + m_textureCoordsCount = (int)m_uvCoord.size(); + + matrix.Scale(m_dpiMultiplicator * m_scaleBitmap, m_dpiMultiplicator * m_scaleBitmap, 0); + + // update uniform memory + glUniformMatrix4fv(m_shader.uniformLocMap["mvp"], 1, GL_FALSE, matrix); + glUniform1i(m_shader.uniformLocMap["CrosshairTexture"], 0); // 0 or 1 or GL_TEXTURE0 GL_TEXTURE1 + glUniform4f(m_shader.uniformLocMap["colour"], 1.0f, 1.0f, 1.0f, 1.0f); + glUniform1i(m_shader.uniformLocMap["isBitmap"], true); + + // update vbo mem + m_vbo.Bind(true); + m_vbo.BufferSubData(0, count * sizeof(BasicVertex), m_verts.data()); + m_vbo.Bind(false); + m_textvbo.Bind(true); + m_textvbo.BufferSubData(0, m_textureCoordsCount * sizeof(UVCoords), m_uvCoord.data()); + m_textvbo.Bind(false); + } glBindVertexArray(m_vao); glDrawArrays(GL_TRIANGLES, 0, count); @@ -195,48 +236,10 @@ void CCrosshair::DrawCrosshair(New3D::Mat4 matrix, float x, float y, float r, fl m_shader.DisableShader(); } -void CCrosshair::DrawBitmapCrosshair(New3D::Mat4 matrix, float x, float y, int TextureNum) +CCrosshair::CCrosshair(const Util::Config::Node& config) : m_config(config),m_xRes(0),m_yRes(0) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, CrosshairtxID[TextureNum]); - - - int count = (int)verts.size(); - if (count > MaxVerts) { - count = MaxVerts; // maybe we could error out somehow - } - m_TextureCoordsCount = (int)UVCoord.size(); - - m_shader.EnableShader(); - - matrix.Translate(x, y, 0); - matrix.Scale(dpiMultiplicator * ScaleBitmap, dpiMultiplicator * ScaleBitmap, 0); - - // update uniform memory - glUniformMatrix4fv(m_shader.uniformLocMap["mvp"], 1, GL_FALSE, matrix); - glUniform1i(m_shader.uniformLocMap["CrosshairTexture"], 0); // 0 or 1 or GL_TEXTURE0 GL_TEXTURE1 - glUniform4f(m_shader.uniformLocMap["colour"], 1.0f, 1.0f, 1.0f, 1.0f); - glUniform1i(m_shader.uniformLocMap["isBitmap"], true); - - // update vbo mem - m_vbo.Bind(true); - m_vbo.BufferSubData(0, count * sizeof(BasicVertex), verts.data()); - m_vbo.Bind(false); - m_textvbo.Bind(true); - m_textvbo.BufferSubData(0, m_TextureCoordsCount * sizeof(UVCoords), UVCoord.data()); - m_textvbo.Bind(false); - - glBindVertexArray(m_vao); - glDrawArrays(GL_TRIANGLES, 0, count); - glBindVertexArray(0); - - m_shader.DisableShader(); -} - -CCrosshair::CCrosshair(const Util::Config::Node& config) : m_config(config),xRes(0),yRes(0) -{ - vertexShader = nullptr; - fragmentShader = nullptr; + m_vertexShader = nullptr; + m_fragmentShader = nullptr; } CCrosshair::~CCrosshair() diff --git a/Src/OSD/SDL/Crosshair.h b/Src/OSD/SDL/Crosshair.h index e0f105c..0ac6c07 100644 --- a/Src/OSD/SDL/Crosshair.h +++ b/Src/OSD/SDL/Crosshair.h @@ -29,19 +29,19 @@ class CCrosshair { private: const Util::Config::Node& m_config; - bool IsBitmapCrosshair=false; - GLuint CrosshairtxID[2] = { 0 }; - int P1CrosshairW = 0, P1CrosshairH = 0, P2CrosshairW = 0, P2CrosshairH = 0; - float diagdpi = 0.0f, hdpi = 0.0f, vdpi = 0.0f; - unsigned int xRes=0; - unsigned int yRes=0; - const float base = 0.01f, height = 0.02f; // geometric parameters of each triangle - const float dist = 0.004f; // distance of triangle tip from center - float a = 0.0f; // aspect ratio (to square the crosshair) - const float squareSize = 1.0f; - const float standardDpi = 96.0f; // normal dpi for usual monitor (full hd) - float dpiMultiplicator = 0.0f; - const float ScaleBitmap = 0.1f; + std::string m_isBitmapCrosshair = ""; + GLuint m_crosshairTexId[2] = { 0 }; + int m_p1CrosshairW = 0, m_p1CrosshairH = 0, m_p2CrosshairW = 0, m_p2CrosshairH = 0; + float m_diagDpi = 0.0f, m_hDpi = 0.0f, m_vDpi = 0.0f; + unsigned int m_xRes=0; + unsigned int m_yRes=0; + const float m_base = 0.01f, m_height = 0.02f; // geometric parameters of each triangle + const float m_dist = 0.004f; // distance of triangle tip from center + float m_a = 0.0f; // aspect ratio (to square the crosshair) + const float m_squareSize = 1.0f; + const float m_standardDpi = 96.0f; // normal dpi for usual monitor (full hd) + float m_dpiMultiplicator = 0.0f; + const float m_scaleBitmap = 0.1f; struct BasicVertex { @@ -56,25 +56,24 @@ private: float x, y; }; - std::vector verts; - std::vector UVCoord; + std::vector m_verts; + std::vector m_uvCoord; GLSLShader m_shader; VBO m_vbo; VBO m_textvbo; GLuint m_vao = 0; - int m_TextureCoordsCount = 0; - const char* vertexShader; - const char* fragmentShader; + int m_textureCoordsCount = 0; + const char* m_vertexShader; + const char* m_fragmentShader; const int MaxVerts = 1024; // per draw call public: CCrosshair(const Util::Config::Node& config); ~CCrosshair(); - bool init(); - void DrawCrosshair(New3D::Mat4 matrix, float x, float y, float r, float g, float b); - void DrawBitmapCrosshair(New3D::Mat4 matrix, float x, float y, int TextureNum); + bool Init(); + void DrawCrosshair(New3D::Mat4 matrix, float x, float y, int player); }; #endif diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index b601995..7d14893 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -109,8 +109,7 @@ static unsigned totalXRes, totalYRes; // total resolution (the whole GL viewpo /* * Crosshair stuff */ -static bool IsBitmapCrosshair = false; -CCrosshair* Crosshair = nullptr; +static CCrosshair* s_crosshair = nullptr; static bool SetGLGeometry(unsigned *xOffsetPtr, unsigned *yOffsetPtr, unsigned *xResPtr, unsigned *yResPtr, unsigned *totalXResPtr, unsigned *totalYResPtr, bool keepAspectRatio) { @@ -812,7 +811,7 @@ static void PrintGLError(GLenum error) } */ -static void UpdateCrosshairs(uint32_t currentInputs, CInputs *Inputs, unsigned crosshairs) +static void UpdateCrosshairs(uint32_t currentInputs, CInputs *Inputs, unsigned crosshairs, std::string crosshairStyle) { bool offscreenTrigger[2]; float x[2], y[2]; @@ -826,7 +825,7 @@ static void UpdateCrosshairs(uint32_t currentInputs, CInputs *Inputs, unsigned c glViewport(xOffset, yOffset, xRes, yRes); glDisable(GL_DEPTH_TEST); // no Z-buffering needed - if (!IsBitmapCrosshair) + if(crosshairStyle != "bmp") { glDisable(GL_BLEND); // no blending } @@ -869,27 +868,14 @@ static void UpdateCrosshairs(uint32_t currentInputs, CInputs *Inputs, unsigned c } // Draw visible crosshairs - if (!IsBitmapCrosshair) + + if ((crosshairs & 1) && !offscreenTrigger[0]) // Player 1 { - if ((crosshairs & 1) && !offscreenTrigger[0]) // Player 1 - { - Crosshair->DrawCrosshair(m, x[0], y[0], 1.0f, 0.0f, 0.0f); - } - if ((crosshairs & 2) && !offscreenTrigger[1]) // Player 2 - { - Crosshair->DrawCrosshair(m, x[1], y[1], 0.0f, 1.0f, 0.0f); - } + s_crosshair->DrawCrosshair(m, x[0], y[0], 0); } - else + if ((crosshairs & 2) && !offscreenTrigger[1]) // Player 2 { - if ((crosshairs & 1) && !offscreenTrigger[0]) // Player 1 - { - Crosshair->DrawBitmapCrosshair(m, x[0], y[0], 0); - } - if ((crosshairs & 2) && !offscreenTrigger[1]) // Player 2 - { - Crosshair->DrawBitmapCrosshair(m, x[1], y[1], 1); - } + s_crosshair->DrawCrosshair(m, x[1], y[1], 1); } //PrintGLError(glGetError()); @@ -912,7 +898,7 @@ void EndFrameVideo() { // Show crosshairs for light gun games if (videoInputs) - UpdateCrosshairs(currentInputs, videoInputs, s_runtime_config["Crosshairs"].ValueAs()); + UpdateCrosshairs(currentInputs, videoInputs, s_runtime_config["Crosshairs"].ValueAs(), s_runtime_config["CrosshairStyle"].ValueAs()); // Swap the buffers SDL_GL_SwapWindow(s_window); @@ -1566,7 +1552,7 @@ static Util::Config::Node DefaultConfig() config.Set("RefreshRate", 60.0f); config.Set("ShowFrameRate", false); config.Set("Crosshairs", int(0)); - config.Set("BitmapCrosshair", false); + config.Set("CrosshairStyle", "vector"); config.Set("FlipStereo", false); #ifdef SUPERMODEL_WIN32 config.Set("InputSystem", "dinput"); @@ -1652,8 +1638,7 @@ static void Help(void) puts(" -show-fps Display frame rate in window title bar"); puts(" -crosshairs= Crosshairs configuration for gun games:"); puts(" 0=none [Default], 1=P1 only, 2=P2 only, 3=P1 & P2"); - puts(" -vectorcrosshair Use built-in crosshair [Default]"); - puts(" -bitmapcrosshair Use image (.bmp) as crosshair (only for lost world)"); + puts(" -crosshair-style= Crosshair style: vector or bmp. [Default: vector]"); puts(" -new3d New 3D engine by Ian Curtis [Default]"); puts(" -quad-rendering Enable proper quad rendering"); puts(" -legacy3d Legacy 3D engine (faster but less accurate)"); @@ -1739,6 +1724,7 @@ static ParsedCommandLine ParseCommandLine(int argc, char **argv) { "-load-state", "InitStateFile" }, { "-ppc-frequency", "PowerPCFrequency" }, { "-crosshairs", "Crosshairs" }, + { "-crosshair-style", "CrosshairStyle" }, { "-vert-shader", "VertexShader" }, { "-frag-shader", "FragmentShader" }, { "-vert-shader-fog", "VertexShaderFog" }, @@ -1789,8 +1775,6 @@ static ParsedCommandLine ParseCommandLine(int argc, char **argv) { "-no-dsb", { "EmulateDSB", false } }, { "-legacy-scsp", { "LegacySoundDSP", true } }, { "-new-scsp", { "LegacySoundDSP", false } }, - { "-bitmapcrosshair", { "BitmapCrosshair", true } }, - { "-vectorcrosshair", { "BitmapCrosshair", false } }, #ifdef NET_BOARD { "-net", { "Network", true } }, { "-no-net", { "Network", false } }, @@ -2052,11 +2036,9 @@ int main(int argc, char **argv) goto Exit; } - IsBitmapCrosshair = s_runtime_config["BitmapCrosshair"].ValueAs(); - - // Create Bitmap Crosshair - Crosshair = new CCrosshair(s_runtime_config); - if (Crosshair->init() != OKAY) + // Create Crosshair + s_crosshair = new CCrosshair(s_runtime_config); + if (s_crosshair->Init() != OKAY) { ErrorLog("Unable to load bitmap crosshair texture\n"); exitCode = 1; @@ -2164,8 +2146,8 @@ Exit: delete InputSystem; if (Outputs != NULL) delete Outputs; - if (Crosshair != NULL) - delete Crosshair; + if (s_crosshair != NULL) + delete s_crosshair; DestroyGLScreen(); SDL_Quit(); diff --git a/Src/OSD/Unix/FileSystemPath.cpp b/Src/OSD/Unix/FileSystemPath.cpp index be0f80f..f30bb04 100644 --- a/Src/OSD/Unix/FileSystemPath.cpp +++ b/Src/OSD/Unix/FileSystemPath.cpp @@ -73,8 +73,8 @@ namespace FileSystemPath case Screenshots: strPathType = "Screenshots"; break; - case Media: - strPathType = "Media/"; + case Assets: + strPathType = "Assets/"; break; } diff --git a/Src/OSD/Windows/FileSystemPath.cpp b/Src/OSD/Windows/FileSystemPath.cpp index 84e426a..1e8e9d9 100644 --- a/Src/OSD/Windows/FileSystemPath.cpp +++ b/Src/OSD/Windows/FileSystemPath.cpp @@ -41,8 +41,8 @@ namespace FileSystemPath return "Saves/"; case Screenshots: return ""; - case Media: - return "Media/"; + case Assets: + return "Assets/"; } return ""; diff --git a/VS2008/Supermodel.vcxproj b/VS2008/Supermodel.vcxproj index b75389e..d755d81 100644 --- a/VS2008/Supermodel.vcxproj +++ b/VS2008/Supermodel.vcxproj @@ -114,10 +114,10 @@ if not exist "$(TargetDir)Config" mkdir "$(TargetDir)Config" if not exist "$(TargetDir)NVRAM" mkdir "$(TargetDir)NVRAM" if not exist "$(TargetDir)Saves" mkdir "$(TargetDir)Saves" -if not exist "$(TargetDir)Media" mkdir "$(TargetDir)Media" +if not exist "$(TargetDir)Assets" mkdir "$(TargetDir)Assets" xcopy /D /Y "$(ProjectDir)..\Docs\*" "$(TargetDir)" xcopy /D /Y "$(ProjectDir)..\Config\*" "$(TargetDir)Config" -xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" +xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets" @@ -147,10 +147,10 @@ xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" if not exist "$(TargetDir)Config" mkdir "$(TargetDir)Config" if not exist "$(TargetDir)NVRAM" mkdir "$(TargetDir)NVRAM" if not exist "$(TargetDir)Saves" mkdir "$(TargetDir)Saves" -if not exist "$(TargetDir)Media" mkdir "$(TargetDir)Media" +if not exist "$(TargetDir)Assets" mkdir "$(TargetDir)Assets" xcopy /D /Y "$(ProjectDir)..\Docs\*" "$(TargetDir)" xcopy /D /Y "$(ProjectDir)..\Config\*" "$(TargetDir)Config" -xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" +xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets" @@ -179,10 +179,10 @@ xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" if not exist "$(TargetDir)Config" mkdir "$(TargetDir)Config" if not exist "$(TargetDir)NVRAM" mkdir "$(TargetDir)NVRAM" if not exist "$(TargetDir)Saves" mkdir "$(TargetDir)Saves" -if not exist "$(TargetDir)Media" mkdir "$(TargetDir)Media" +if not exist "$(TargetDir)Assets" mkdir "$(TargetDir)Assets" xcopy /D /Y "$(ProjectDir)..\Docs\*" "$(TargetDir)" xcopy /D /Y "$(ProjectDir)..\Config\*" "$(TargetDir)Config" -xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" +xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets" @@ -215,10 +215,10 @@ xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" if not exist "$(TargetDir)Config" mkdir "$(TargetDir)Config" if not exist "$(TargetDir)NVRAM" mkdir "$(TargetDir)NVRAM" if not exist "$(TargetDir)Saves" mkdir "$(TargetDir)Saves" -if not exist "$(TargetDir)Media" mkdir "$(TargetDir)Media" +if not exist "$(TargetDir)Assets" mkdir "$(TargetDir)Assets" xcopy /D /Y "$(ProjectDir)..\Docs\*" "$(TargetDir)" xcopy /D /Y "$(ProjectDir)..\Config\*" "$(TargetDir)Config" -xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media" +xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets"