mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-23 06:15:37 +00:00
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.
This commit is contained in:
parent
1b066fe4b3
commit
b19fdb6a77
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 289 KiB |
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 289 KiB |
|
@ -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
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace FileSystemPath
|
|||
return "Saves/";
|
||||
case Screenshots:
|
||||
return "";
|
||||
case Media:
|
||||
return "Media/";
|
||||
case Assets:
|
||||
return "Assets/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,81 +27,81 @@
|
|||
#include <GL/glew.h>
|
||||
#include <vector>
|
||||
|
||||
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<bool>();
|
||||
xRes = m_config["XResolution"].ValueAs<unsigned>();
|
||||
yRes = m_config["YResolution"].ValueAs<unsigned>();
|
||||
a = (float)xRes / (float)yRes;
|
||||
m_isBitmapCrosshair = m_config["CrosshairStyle"].ValueAs<std::string>();
|
||||
m_xRes = m_config["XResolution"].ValueAs<unsigned>();
|
||||
m_yRes = m_config["YResolution"].ValueAs<unsigned>();
|
||||
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,18 +166,35 @@ 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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
matrix.Scale(m_dpiMultiplicator, m_dpiMultiplicator, 0);
|
||||
|
||||
// update uniform memory
|
||||
glUniformMatrix4fv(m_shader.uniformLocMap["mvp"], 1, GL_FALSE, matrix);
|
||||
|
@ -186,31 +203,16 @@ void CCrosshair::DrawCrosshair(New3D::Mat4 matrix, float x, float y, float r, fl
|
|||
|
||||
// update vbo mem
|
||||
m_vbo.Bind(true);
|
||||
m_vbo.BufferSubData(0, count * sizeof(BasicVertex), verts.data());
|
||||
|
||||
glBindVertexArray(m_vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, count);
|
||||
glBindVertexArray(0);
|
||||
|
||||
m_shader.DisableShader();
|
||||
}
|
||||
|
||||
void CCrosshair::DrawBitmapCrosshair(New3D::Mat4 matrix, float x, float y, int TextureNum)
|
||||
{
|
||||
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_vbo.BufferSubData(0, count * sizeof(BasicVertex), m_verts.data());
|
||||
}
|
||||
m_TextureCoordsCount = (int)UVCoord.size();
|
||||
else
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_crosshairTexId[player]);
|
||||
|
||||
m_shader.EnableShader();
|
||||
m_textureCoordsCount = (int)m_uvCoord.size();
|
||||
|
||||
matrix.Translate(x, y, 0);
|
||||
matrix.Scale(dpiMultiplicator * ScaleBitmap, dpiMultiplicator * ScaleBitmap, 0);
|
||||
matrix.Scale(m_dpiMultiplicator * m_scaleBitmap, m_dpiMultiplicator * m_scaleBitmap, 0);
|
||||
|
||||
// update uniform memory
|
||||
glUniformMatrix4fv(m_shader.uniformLocMap["mvp"], 1, GL_FALSE, matrix);
|
||||
|
@ -220,11 +222,12 @@ void CCrosshair::DrawBitmapCrosshair(New3D::Mat4 matrix, float x, float y, int T
|
|||
|
||||
// update vbo mem
|
||||
m_vbo.Bind(true);
|
||||
m_vbo.BufferSubData(0, count * sizeof(BasicVertex), verts.data());
|
||||
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), UVCoord.data());
|
||||
m_textvbo.BufferSubData(0, m_textureCoordsCount * sizeof(UVCoords), m_uvCoord.data());
|
||||
m_textvbo.Bind(false);
|
||||
}
|
||||
|
||||
glBindVertexArray(m_vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, count);
|
||||
|
@ -233,10 +236,10 @@ void CCrosshair::DrawBitmapCrosshair(New3D::Mat4 matrix, float x, float y, int T
|
|||
m_shader.DisableShader();
|
||||
}
|
||||
|
||||
CCrosshair::CCrosshair(const Util::Config::Node& config) : m_config(config),xRes(0),yRes(0)
|
||||
CCrosshair::CCrosshair(const Util::Config::Node& config) : m_config(config),m_xRes(0),m_yRes(0)
|
||||
{
|
||||
vertexShader = nullptr;
|
||||
fragmentShader = nullptr;
|
||||
m_vertexShader = nullptr;
|
||||
m_fragmentShader = nullptr;
|
||||
}
|
||||
|
||||
CCrosshair::~CCrosshair()
|
||||
|
|
|
@ -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<BasicVertex> verts;
|
||||
std::vector<UVCoords> UVCoord;
|
||||
std::vector<BasicVertex> m_verts;
|
||||
std::vector<UVCoords> 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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
Crosshair->DrawCrosshair(m, x[0], y[0], 1.0f, 0.0f, 0.0f);
|
||||
s_crosshair->DrawCrosshair(m, x[0], y[0], 0);
|
||||
}
|
||||
if ((crosshairs & 2) && !offscreenTrigger[1]) // Player 2
|
||||
{
|
||||
Crosshair->DrawCrosshair(m, x[1], y[1], 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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<unsigned>());
|
||||
UpdateCrosshairs(currentInputs, videoInputs, s_runtime_config["Crosshairs"].ValueAs<unsigned>(), s_runtime_config["CrosshairStyle"].ValueAs<std::string>());
|
||||
|
||||
// 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=<n> 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=<s> 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<bool>();
|
||||
|
||||
// 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();
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ namespace FileSystemPath
|
|||
case Screenshots:
|
||||
strPathType = "Screenshots";
|
||||
break;
|
||||
case Media:
|
||||
strPathType = "Media/";
|
||||
case Assets:
|
||||
strPathType = "Assets/";
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace FileSystemPath
|
|||
return "Saves/";
|
||||
case Screenshots:
|
||||
return "";
|
||||
case Media:
|
||||
return "Media/";
|
||||
case Assets:
|
||||
return "Assets/";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
|
|
@ -114,10 +114,10 @@
|
|||
<Command>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"</Command>
|
||||
xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -147,10 +147,10 @@ xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media"</Command>
|
|||
<Command>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"</Command>
|
||||
xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -179,10 +179,10 @@ xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media"</Command>
|
|||
<Command>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"</Command>
|
||||
xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -215,10 +215,10 @@ xcopy /D /Y "$(ProjectDir)..\Media\*" "$(TargetDir)Media"</Command>
|
|||
<Command>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"</Command>
|
||||
xcopy /D /Y "$(ProjectDir)..\Assets\*" "$(TargetDir)Assets"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue