Merge branch 'Saturn-Next' into Saturn-Testing

This commit is contained in:
Alug committed 2025-11-21 00:00:29 +01:00
commit e95382075c
10 files changed
+190 -207

No files matched your search

+6 -6
View File
@@ -166,12 +166,12 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {};
static UINT8 curcolor[MAXSPLITSCREENPLAYERS] = {};
static void D_DeviceLEDTick(void)
{
UINT8 i;
static UINT16 color[MAXSPLITSCREENPLAYERS] = {};
static UINT8 newcolor = UINT8_MAX;
if (numcontrollers == 0)
{
@@ -183,13 +183,13 @@ static void D_DeviceLEDTick(void)
if (!cv_usejoystick[i].value || !cv_gamepadled[i].value)
continue;
color[i] = G_GetSkinColor(i);
newcolor = G_GetSkinColorForGamepad(i);
if (curcolor[i] == color[i]) // dont update if same colour
if (curcolor[i] == newcolor) // dont update if same colour
continue;
G_SetPlayerGamepadIndicatorColor(i, color[i]);
curcolor[i] = color[i];
G_SetPlayerGamepadIndicatorColor(i, newcolor);
curcolor[i] = newcolor;
}
}
+18 -10
View File
@@ -875,11 +875,13 @@ static const char *gamecontrolname[num_gamecontrols] =
#include "k_kart.h"
UINT16 G_GetSkinColor(INT32 playernum)
UINT8 G_GetSkinColorForGamepad(INT32 playernum)
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (gamestate == GS_LEVEL)
{
player_t *player = &players[displayplayers[playernum]];
const player_t *player = &players[displayplayers[playernum]];
if (player)
{
@@ -897,13 +899,13 @@ UINT16 G_GetSkinColor(INT32 playernum)
switch (playernum)
{
case 0:
return cv_playercolor.value;
return (UINT8)cv_playercolor.value;
case 1:
return cv_playercolor2.value;
return (UINT8)cv_playercolor2.value;
case 2:
return cv_playercolor3.value;
return (UINT8)cv_playercolor3.value;
case 3:
return cv_playercolor4.value;
return (UINT8)cv_playercolor4.value;
default:
return 0;
}
@@ -911,19 +913,23 @@ UINT16 G_GetSkinColor(INT32 playernum)
return 0;
}
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color)
// Sets the Indicator LED on supported gamepads to a desired skincolor
// pass SKINCOLOR_NONE/0 to set the players skin color
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
{
UINT16 skincolor;
UINT8 skincolor;
byteColor_t byte_color;
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_gamepadled[playernum].value == 0)
if (cv_gamepadled[playernum].value == 0
|| color >= MAXTRANSLATIONS)
{
return;
}
skincolor = color ? color : G_GetSkinColor(playernum);
// so we can override this
skincolor = color ? color : G_GetSkinColorForGamepad(playernum);
byte_color = V_GetColor(colortranslations[skincolor][8]).s;
I_SetGamepadIndicatorColor(playernum, byte_color.red, byte_color.green, byte_color.blue);
@@ -936,7 +942,9 @@ static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
}
else
{
G_SetPlayerGamepadIndicatorColor(playernum, 0);
}
}
static void G_ResetPlayerDeviceRumble(INT32 playernum)
+5 -5
View File
@@ -131,14 +131,14 @@ extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
#define PLAYER3INPUTDOWN(gc) (gamekeydown[gamecontrol[2][gc][0]] || gamekeydown[gamecontrol[2][gc][1]])
#define PLAYER4INPUTDOWN(gc) (gamekeydown[gamecontrol[3][gc][0]] || gamekeydown[gamecontrol[3][gc][1]])
// peace to my little coder fingers!
// check a gamecontrol being active or not
UINT16 G_GetSkinColor(INT32 playernum);
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color);
UINT8 G_GetSkinColorForGamepad(INT32 playernum);
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color);
void G_ResetAllDeviceRumbles(void);
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
// peace to my little coder fingers!
// check a gamecontrol being active or not
// remaps the input event to a game control.
void G_MapEventsToControls(event_t *ev);
void G_ResetControls(void);
+21 -17
View File
@@ -168,14 +168,15 @@ static int comparePolygons(const void *p1, const void *p2)
const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
const int shader1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? -1 : poly1->shader;
const int shader2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? -1 : poly2->shader;
// special case with signedness to prevent overflowing
// FIXME: check for prediction slowdowns!
const bool sky1 = poly1->hash & 0x80000000;
const bool sky2 = poly2->hash & 0x80000000;
// skywalls and horizon lines must retain their order for horizon lines to work
if (shader1 == -1 && shader2 == -1)
return poly1 - poly2;
if (sky1 != sky2)
return sky1 < sky2 ? 1 : -1;
diff = shader1 - shader2;
diff = poly1->shader - poly2->shader;
if (diff != 0) return diff;
UINT32 downloaded1 = poly1->texture ? poly1->texture->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
@@ -210,15 +211,16 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
const GLMipmap_t *texture1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? NULL : poly1->texture;
const GLMipmap_t *texture2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? NULL : poly2->texture;
// special case with signedness to prevent overflowing
// FIXME: check for prediction slowdowns!
const bool sky1 = poly1->hash & 0x80000000;
const bool sky2 = poly2->hash & 0x80000000;
// skywalls and horizon lines must retain their order for horizon lines to work
if (!texture1 && !texture2)
return poly1 - poly2;
if (sky1 != sky2)
return sky1 < sky2 ? 1 : -1;
UINT32 downloaded1 = texture1 ? texture1->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
UINT32 downloaded2 = texture2 ? texture2->downloaded : 0;
UINT32 downloaded1 = poly1->texture ? poly1->texture->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
UINT32 downloaded2 = poly2->texture ? poly2->texture->downloaded : 0;
diff64 = downloaded1 - downloaded2;
if (diff64 != 0) return diff64;
@@ -248,6 +250,8 @@ void HWR_RenderBatches(void)
FSurfaceInfo currentSurfaceInfo;
FSurfaceInfo nextSurfaceInfo;
const boolean useshader = HWR_UseShader();
int i;
if (!currently_batching)
@@ -284,7 +288,7 @@ void HWR_RenderBatches(void)
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (HWR_UseShader() ? comparePolygons : comparePolygonsNoShaders));
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_STOP_TIMING(ps_hw_batchsorttime);
// sort order
@@ -305,7 +309,7 @@ void HWR_RenderBatches(void)
// set state for first batch
if (HWR_UseShader())
if (useshader)
{
GL_SetShader(currentShader);
}
@@ -387,7 +391,7 @@ void HWR_RenderBatches(void)
if (nextPolyFlags & PF_NoTexture)
nextTexture = 0;
if (currentShader != nextShader && HWR_UseShader())
if (useshader && currentShader != nextShader)
{
changeState = true;
changeShader = true;
@@ -405,7 +409,7 @@ void HWR_RenderBatches(void)
changePolyFlags = true;
}
if (HWR_UseShader())
if (useshader)
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
+4 -1
View File
@@ -98,7 +98,8 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
position = 0;
}
position = max(((position * scale_y) + (FRACUNIT/2)) >> FRACBITS, 0);
position = ((position * scale_y) + (FRACUNIT/2)) >> FRACBITS;
position = max(position, 0);
if (position + count >= pblockheight)
count = pblockheight - position;
@@ -461,6 +462,7 @@ static void HWR_FreeTextureData(patch_t *patch)
GL_DeleteTexture(glPatch->mipmap);
Z_Free(glPatch->mipmap->data);
glPatch->mipmap->data = NULL;
}
void HWR_FreeTexture(patch_t *patch)
@@ -478,6 +480,7 @@ void HWR_FreeTexture(patch_t *patch)
{
HWR_FreeTextureData(patch);
Z_Free(glPatch->mipmap);
glPatch->mipmap = NULL;
}
Z_Free(patch->hardware);
+3 -3
View File
@@ -5456,14 +5456,14 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
}
}
// draw normal things in current frame in current incremented stencil buffer area
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
HWR_SetTransform(fpov);
HWR_ClearSprites();
HWR_ClearClipper();
// draw normal things in current frame in current incremented stencil buffer area
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
if constexpr (Type == RenderViewpointType::kPortal)
{
if (allow_portals && rootportal)
+80 -121
View File
@@ -173,41 +173,7 @@ boolean supportstencil = false;
// can know when the textures aren't there, as textures are always considered resident in their virtual memory
static GLuint screenTextures[NUMSCREENTEXTURES] = {0};
// shortcut for ((float)1/i)
static const GLfloat byte2float[256] = {
0.000000f, 0.003922f, 0.007843f, 0.011765f, 0.015686f, 0.019608f, 0.023529f, 0.027451f,
0.031373f, 0.035294f, 0.039216f, 0.043137f, 0.047059f, 0.050980f, 0.054902f, 0.058824f,
0.062745f, 0.066667f, 0.070588f, 0.074510f, 0.078431f, 0.082353f, 0.086275f, 0.090196f,
0.094118f, 0.098039f, 0.101961f, 0.105882f, 0.109804f, 0.113725f, 0.117647f, 0.121569f,
0.125490f, 0.129412f, 0.133333f, 0.137255f, 0.141176f, 0.145098f, 0.149020f, 0.152941f,
0.156863f, 0.160784f, 0.164706f, 0.168627f, 0.172549f, 0.176471f, 0.180392f, 0.184314f,
0.188235f, 0.192157f, 0.196078f, 0.200000f, 0.203922f, 0.207843f, 0.211765f, 0.215686f,
0.219608f, 0.223529f, 0.227451f, 0.231373f, 0.235294f, 0.239216f, 0.243137f, 0.247059f,
0.250980f, 0.254902f, 0.258824f, 0.262745f, 0.266667f, 0.270588f, 0.274510f, 0.278431f,
0.282353f, 0.286275f, 0.290196f, 0.294118f, 0.298039f, 0.301961f, 0.305882f, 0.309804f,
0.313726f, 0.317647f, 0.321569f, 0.325490f, 0.329412f, 0.333333f, 0.337255f, 0.341176f,
0.345098f, 0.349020f, 0.352941f, 0.356863f, 0.360784f, 0.364706f, 0.368627f, 0.372549f,
0.376471f, 0.380392f, 0.384314f, 0.388235f, 0.392157f, 0.396078f, 0.400000f, 0.403922f,
0.407843f, 0.411765f, 0.415686f, 0.419608f, 0.423529f, 0.427451f, 0.431373f, 0.435294f,
0.439216f, 0.443137f, 0.447059f, 0.450980f, 0.454902f, 0.458824f, 0.462745f, 0.466667f,
0.470588f, 0.474510f, 0.478431f, 0.482353f, 0.486275f, 0.490196f, 0.494118f, 0.498039f,
0.501961f, 0.505882f, 0.509804f, 0.513726f, 0.517647f, 0.521569f, 0.525490f, 0.529412f,
0.533333f, 0.537255f, 0.541177f, 0.545098f, 0.549020f, 0.552941f, 0.556863f, 0.560784f,
0.564706f, 0.568627f, 0.572549f, 0.576471f, 0.580392f, 0.584314f, 0.588235f, 0.592157f,
0.596078f, 0.600000f, 0.603922f, 0.607843f, 0.611765f, 0.615686f, 0.619608f, 0.623529f,
0.627451f, 0.631373f, 0.635294f, 0.639216f, 0.643137f, 0.647059f, 0.650980f, 0.654902f,
0.658824f, 0.662745f, 0.666667f, 0.670588f, 0.674510f, 0.678431f, 0.682353f, 0.686275f,
0.690196f, 0.694118f, 0.698039f, 0.701961f, 0.705882f, 0.709804f, 0.713726f, 0.717647f,
0.721569f, 0.725490f, 0.729412f, 0.733333f, 0.737255f, 0.741177f, 0.745098f, 0.749020f,
0.752941f, 0.756863f, 0.760784f, 0.764706f, 0.768627f, 0.772549f, 0.776471f, 0.780392f,
0.784314f, 0.788235f, 0.792157f, 0.796078f, 0.800000f, 0.803922f, 0.807843f, 0.811765f,
0.815686f, 0.819608f, 0.823529f, 0.827451f, 0.831373f, 0.835294f, 0.839216f, 0.843137f,
0.847059f, 0.850980f, 0.854902f, 0.858824f, 0.862745f, 0.866667f, 0.870588f, 0.874510f,
0.878431f, 0.882353f, 0.886275f, 0.890196f, 0.894118f, 0.898039f, 0.901961f, 0.905882f,
0.909804f, 0.913726f, 0.917647f, 0.921569f, 0.925490f, 0.929412f, 0.933333f, 0.937255f,
0.941177f, 0.945098f, 0.949020f, 0.952941f, 0.956863f, 0.960784f, 0.964706f, 0.968628f,
0.972549f, 0.976471f, 0.980392f, 0.984314f, 0.988235f, 0.992157f, 0.996078f, 1.000000f
};
#define byte2float(byte) (GLfloat)(byte / 255.0f)
// -----------------+
// GL_DBG_Printf : Output debug messages to debug log if DEBUG_TO_FILE is defined,
@@ -1023,11 +989,9 @@ boolean GL_CompileShader(int slot)
{
return true;
}
else
{
gl_shaders[slot].program = 0;
return false;
}
gl_shaders[slot].program = 0;
return false;
}
//
@@ -1069,6 +1033,7 @@ void GL_SetShader(int slot)
GL_UnSetShader();
return;
}
if (gl_allowshaders)
{
gl_shader_t *next_shader = &gl_shaders[slot]; // the gl_shader_t we are going to switch to
@@ -1130,7 +1095,7 @@ static void GL_SetNoTexture(void)
// -----------------+
static void GL_Perspective(GLfloat fovy, GLfloat aspect)
{
GLfloat m[4][4] =
static GLfloat m[4][4] =
{
{ 1.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 1.0f, 0.0f, 0.0f},
@@ -1160,7 +1125,7 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
// -----------------+
void GL_SetModelView(GLint w, GLint h)
{
GLint maxtexsize = 0;
static GLint maxtexsize = 0;
//GL_DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h);
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
@@ -1193,7 +1158,9 @@ void GL_SetModelView(GLint w, GLint h)
screen_texsizeh <<= 1;
}
pglGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize); // Get the maximum supported texture size
if (!maxtexsize)
pglGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize); // Get the maximum supported texture size
if ((screen_texsizew > maxtexsize || screen_texsizeh > maxtexsize) && maxtexsize > 0)
{
// The desired screen texture resolution is too big for the player's GPU!
@@ -1339,7 +1306,8 @@ void GL_DeleteTexture(GLMipmap_t *pTexInfo)
if (!pTexInfo)
return;
else if (pTexInfo->downloaded)
if (pTexInfo->downloaded)
pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded);
while (head)
@@ -1547,6 +1515,7 @@ void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask
ClearMask |= GL_COLOR_BUFFER_BIT;
}
if (DepthMask)
{
pglClearDepth(1.0f); //Hurdler: all that are permanen states
@@ -1558,7 +1527,7 @@ void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask
GL_SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
if (StencilMask)
ClearMask |= GL_STENCIL_BUFFER_BIT;// looks like sometimes stencil buffer needs clearing? had a problem with random black screens
ClearMask |= GL_STENCIL_BUFFER_BIT; // looks like sometimes stencil buffer needs clearing? had a problem with random black screens
pglClear(ClearMask);
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
@@ -1602,18 +1571,21 @@ void GL_Draw2DLine(F2DCoord * v1, F2DCoord * v2, RGBA_t Color)
pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
pglEnable(GL_TEXTURE_2D);
}
static inline void Clamp2D(GLenum pname)
{
#ifdef GL_CLAMP_TO_EDGE
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE);
#else
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp
#endif
}
// -----------------+
// SetBlend : Set render mode
// -----------------+
// PF_Masked - we could use an ALPHA_TEST of GL_EQUAL, and alpha ref of 0,
// is it faster when pixels are discarded ?
static void Clamp2D(GLenum pname)
{
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp
#ifdef GL_CLAMP_TO_EDGE
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE);
#endif
}
static void GL_SetBlendEquation(GLenum mode)
{
@@ -2143,7 +2115,8 @@ void GL_SetTexture(GLMipmap_t *pTexInfo)
GL_SetNoTexture();
return;
}
else if (pTexInfo->downloaded)
if (pTexInfo->downloaded)
{
if (pTexInfo->downloaded != tex_downloaded)
{
@@ -2419,38 +2392,38 @@ static void GL_PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
if (pSurf)
{
// If modulated, mix the surface colour to the texture
if (CurrentPolyFlags & PF_Modulated)
pglColor4ubv((GLubyte*)&pSurf->PolyColor.s);
// If the surface is either modulated or colormapped, or both
if (CurrentPolyFlags & (PF_Modulated | PF_ColorMapped))
{
poly.red = byte2float[pSurf->PolyColor.s.red];
poly.green = byte2float[pSurf->PolyColor.s.green];
poly.blue = byte2float[pSurf->PolyColor.s.blue];
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
}
// If modulated, mix the surface colour to the texture
if (CurrentPolyFlags & PF_Modulated)
pglColor4ubv((GLubyte*)&pSurf->PolyColor.s);
// Only if the surface is colormapped
if (CurrentPolyFlags & PF_ColorMapped)
{
tint.red = byte2float[pSurf->TintColor.s.red];
tint.green = byte2float[pSurf->TintColor.s.green];
tint.blue = byte2float[pSurf->TintColor.s.blue];
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
poly.red = byte2float(pSurf->PolyColor.s.red);
poly.green = byte2float(pSurf->PolyColor.s.green);
poly.blue = byte2float(pSurf->PolyColor.s.blue);
poly.alpha = byte2float(pSurf->PolyColor.s.alpha);
fade.red = byte2float[pSurf->FadeColor.s.red];
fade.green = byte2float[pSurf->FadeColor.s.green];
fade.blue = byte2float[pSurf->FadeColor.s.blue];
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded)
// Only if the surface is colormapped
if (CurrentPolyFlags & PF_ColorMapped)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded = pSurf->LightTableId;
tint.red = byte2float(pSurf->TintColor.s.red);
tint.green = byte2float(pSurf->TintColor.s.green);
tint.blue = byte2float(pSurf->TintColor.s.blue);
tint.alpha = byte2float(pSurf->TintColor.s.alpha);
fade.red = byte2float(pSurf->FadeColor.s.red);
fade.green = byte2float(pSurf->FadeColor.s.green);
fade.blue = byte2float(pSurf->FadeColor.s.blue);
fade.alpha = byte2float(pSurf->FadeColor.s.alpha);
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded = pSurf->LightTableId;
}
}
}
}
@@ -2962,24 +2935,24 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
pol = 0.0f;
}
poly.red = byte2float[Surface->PolyColor.s.red];
poly.green = byte2float[Surface->PolyColor.s.green];
poly.blue = byte2float[Surface->PolyColor.s.blue];
poly.alpha = byte2float[Surface->PolyColor.s.alpha];
poly.red = byte2float(Surface->PolyColor.s.red);
poly.green = byte2float(Surface->PolyColor.s.green);
poly.blue = byte2float(Surface->PolyColor.s.blue);
poly.alpha = byte2float(Surface->PolyColor.s.alpha);
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
GL_SetBlend(((poly.alpha < 1) ? Surface->PolyFlags : (PF_Masked|PF_Occlude))|PF_Modulated);
tint.red = byte2float[Surface->TintColor.s.red];
tint.green = byte2float[Surface->TintColor.s.green];
tint.blue = byte2float[Surface->TintColor.s.blue];
tint.alpha = byte2float[Surface->TintColor.s.alpha];
tint.red = byte2float(Surface->TintColor.s.red);
tint.green = byte2float(Surface->TintColor.s.green);
tint.blue = byte2float(Surface->TintColor.s.blue);
tint.alpha = byte2float(Surface->TintColor.s.alpha);
fade.red = byte2float[Surface->FadeColor.s.red];
fade.green = byte2float[Surface->FadeColor.s.green];
fade.blue = byte2float[Surface->FadeColor.s.blue];
fade.alpha = byte2float[Surface->FadeColor.s.alpha];
fade.red = byte2float(Surface->FadeColor.s.red);
fade.green = byte2float(Surface->FadeColor.s.green);
fade.blue = byte2float(Surface->FadeColor.s.blue);
fade.alpha = byte2float(Surface->FadeColor.s.alpha);
if (Surface->LightTableId && Surface->LightTableId != lt_downloaded)
{
@@ -3467,7 +3440,7 @@ void GL_FlushScreenTextures(void)
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
{
float fix[8];
static float fix[8];
float xfix, yfix;
if (gl_enable_screen_textures != 2)
@@ -3476,14 +3449,8 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
xfix = 1/((float)screen_texsizew/(float)screen_width);
yfix = 1/((float)screen_texsizeh/(float)screen_height);
fix[0] = 0.0f;
fix[1] = 0.0f;
fix[2] = 0.0f;
fix[3] = yfix;
fix[4] = xfix;
fix[5] = yfix;
fix[6] = xfix;
fix[7] = 0.0f;
fix[3] = fix[5] = yfix;
fix[4] = fix[6] = xfix;
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@@ -3717,7 +3684,13 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
float origaspect, newaspect;
float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen
static float off[12];
static float off[12] =
{
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f
};
static float fix[8];
if (gl_enable_screen_textures != 2)
@@ -3741,28 +3714,14 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
}
// float off[12];
off[0] = -xoff;
off[1] = -yoff;
off[2] = 1.0f;
off[3] = -xoff;
off[4] = yoff;
off[5] = 1.0f;
off[6] = xoff;
off[7] = yoff;
off[8] = 1.0f;
off[9] = xoff;
off[10] = -yoff;
off[11] = 1.0f;
off[0] = off[3] = -xoff;
off[1] = off[10] = -yoff;
off[4] = off[7] = yoff;
off[6] = off[9] = xoff;
// float fix[8];
fix[0] = 0.0f;
fix[1] = 0.0f;
fix[2] = 0.0f;
fix[3] = yfix;
fix[4] = xfix;
fix[5] = yfix;
fix[6] = xfix;
fix[7] = 0.0f;
fix[3] = fix[5] = yfix;
fix[4] = fix[6] = xfix;
pglViewport(0, 0, width, height);
+17 -8
View File
@@ -385,7 +385,7 @@ static int lib_pSpawnMobj(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SpawnMobj(x, y, z, type);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -413,7 +413,7 @@ static int lib_pSpawnMissile(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SpawnMissile(source, dest, type);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -432,7 +432,7 @@ static int lib_pSpawnXYZMissile(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SpawnXYZMissile(source, dest, type, x, y, z);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -453,7 +453,7 @@ static int lib_pSpawnPointMissile(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SpawnPointMissile(source, xa, ya, za, type, x, y, z);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -472,7 +472,7 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -503,7 +503,7 @@ static int lib_pSPMAngle(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SPMAngle(source, type, angle, allowaim, flags2);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -519,7 +519,7 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
mobj_t *th = P_SpawnPlayerMissile(source, type, flags2);
th->islocal = !hook_important;
if (!P_MobjWasRemoved(th)) th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -3056,7 +3056,13 @@ static int lib_gSetPlayerGamepadIndicatorColor(lua_State *L)
{
INT32 player = -1;
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
UINT16 color = (UINT16)luaL_checkinteger(L, 2); // skincolor
UINT8 color = (UINT8)luaL_checkinteger(L, 2); // skincolor
if (!plr)
return LUA_ErrInvalid(L, "player_t");
if (color >= MAXTRANSLATIONS)
return luaL_error(L, "color %d out of range (0 - %d).", color, MAXTRANSLATIONS-1);
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
{
@@ -3084,6 +3090,9 @@ static int lib_gPlayerDeviceRumble(lua_State *L)
UINT16 high_strength = (UINT16)luaL_checkinteger(L, 3); // high frequency rumble motor strenght
UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms
if (!plr)
return LUA_ErrInvalid(L, "player_t");
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
{
if (plr - players == displayplayers[i])
+35 -35
View File
@@ -640,7 +640,7 @@ static boolean M_ChangeStringCvar(INT32 choice)
if (M_TextInputHandle(&menuinput, choice))
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
CV_Set(cv, menuinput.buffer);
return true;
@@ -3544,7 +3544,7 @@ static void M_HandleAddons(INT32 choice)
if (M_TextInputHandle(&menusearch, choice))
{
S_StartSound(NULL,sfx_menu1);
S_StartSound(NULL, sfx_menu1);
char *tempname = NULL;
if (dirmenu && dirmenu[dir_on[menudepthleft]])
@@ -4011,7 +4011,7 @@ static boolean M_HandleReplayHutQuery(INT32 choice)
if (M_TextInputHandle(&replayqueryinput, choice))
{
S_StartSound(NULL,sfx_menu1);
S_StartSound(NULL, sfx_menu1);
// Restart search only if we actually modified input and not just moved in it
if (memcmp(tmp, replayqueryinput_buffer, MAXREPLAYQUERY+1))
@@ -7448,7 +7448,7 @@ static void M_SetupMultiHandler(INT32 choice)
{
if (--setupm_pselect < 1)
setupm_pselect = cv_splitplayers.value;
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
break;
@@ -7457,23 +7457,23 @@ static void M_SetupMultiHandler(INT32 choice)
{
if (++setupm_pselect > cv_splitplayers.value)
setupm_pselect = 1;
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
break;
case KEY_DOWNARROW:
M_NextOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
case KEY_UPARROW:
M_PrevOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
case KEY_ENTER:
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
currentMenu->lastOn = itemOn;
switch (setupm_pselect)
{
@@ -7555,16 +7555,16 @@ static void M_HandleConnectIP(INT32 choice)
{
case KEY_DOWNARROW:
M_NextOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
case KEY_UPARROW:
M_PrevOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
case KEY_ENTER:
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
currentMenu->lastOn = itemOn;
M_ConnectIP(1);
break;
@@ -7578,7 +7578,7 @@ static void M_HandleConnectIP(INT32 choice)
case KEY_BACKSPACE:
case KEY_DEL:
if (M_TextInputHandle(&setupm_input_ip, choice))
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
default:
@@ -7588,7 +7588,7 @@ static void M_HandleConnectIP(INT32 choice)
|| (choice >= 199 && choice <= 211 && choice != 202 && choice != 206))*/ //numpad too!
{
if (M_TextInputHandle(&setupm_input_ip, choice))
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
break;
}
@@ -8314,7 +8314,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
}
else
M_NextOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
}
else if (gridselect) //grid skin select menu
@@ -8354,7 +8354,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
break;
}
M_NextOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
case KEY_UPARROW:
@@ -8370,7 +8370,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
}
else
M_PrevOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
}
else if (gridselect)
@@ -8407,18 +8407,18 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
}
else
M_PrevOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
}
M_PrevOpt();
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
break;
case KEY_LEFTARROW:
if (itemOn == 0)
{
M_TextInputHandle(&setupm_input, choice);
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
else if (cv_skinselectmenu.value == SKINMENUTYPE_2D && itemOn == 1)
{
@@ -8432,7 +8432,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
}
else //player skin
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
if (setupm_skinxpos > 0)
setupm_skinxpos--;
@@ -8465,14 +8465,14 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
}
if (itemOn == 1) //player skin
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
setupm_fakeskin--;
}
else if (itemOn == 2) // player color
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
setupm_fakecolor--;
G_SetPlayerGamepadIndicatorColor(setupm_playernum, setupm_fakecolor);
G_SetPlayerGamepadIndicatorColor(setupm_playernum, (UINT8)setupm_fakecolor);
}
break;
@@ -8480,7 +8480,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (itemOn == 0)
{
M_TextInputHandle(&setupm_input, choice);
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
else if (cv_skinselectmenu.value == SKINMENUTYPE_2D && itemOn == 1)
{
@@ -8490,11 +8490,11 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
setupm_skinselect++;
else
setupm_skinselect = 0;
S_StartSound(NULL,sfx_menu1);
S_StartSound(NULL, sfx_menu1);
}
else //player skin
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
if (setupm_skinxpos < MAXSTAT - 1)
setupm_skinxpos++;
else
@@ -8529,14 +8529,14 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
}
if (itemOn == 1) //player skin
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
setupm_fakeskin++;
}
else if (itemOn == 2) // player color
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
setupm_fakecolor++;
G_SetPlayerGamepadIndicatorColor(setupm_playernum, setupm_fakecolor);
G_SetPlayerGamepadIndicatorColor(setupm_playernum, (UINT8)setupm_fakecolor);
}
break;
@@ -8555,7 +8555,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (itemOn == 0)
{
M_TextInputHandle(&setupm_input, choice);
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
else if (gridselect && itemOn == 1)
{
@@ -8571,9 +8571,9 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
UINT8 col = skins[setupm_fakeskin].prefcolor;
if (setupm_fakecolor != col)
{
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
setupm_fakecolor = col;
G_SetPlayerGamepadIndicatorColor(setupm_playernum, setupm_fakecolor);
G_SetPlayerGamepadIndicatorColor(setupm_playernum, (UINT8)setupm_fakecolor);
}
}
break;
@@ -8584,7 +8584,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (itemOn == 0)
{
M_TextInputHandle(&setupm_input, choice);
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
break;
@@ -8607,7 +8607,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
{
setupm_skinlockedselect = true;
setupm_skinselect = 0;
S_StartSound(NULL,sfx_menu1);
S_StartSound(NULL, sfx_menu1);
}
}
else if (gridselect && itemOn == 1 && setupm_skinselect < numskins)
@@ -8621,7 +8621,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (itemOn == 0)
{
if (M_TextInputHandle(&setupm_input, choice))
S_StartSound(NULL,sfx_menu1); // Tails
S_StartSound(NULL, sfx_menu1); // Tails
}
break;
}
+1 -1
View File
@@ -986,7 +986,7 @@ static void Impl_HandleControllerAddedEvent(SDL_Event evt)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
I_InitJoystick(i);
G_SetPlayerGamepadIndicatorColor(i, G_GetSkinColor(i)); // gotta update the controller led again on reconnect
G_SetPlayerGamepadIndicatorColor(i, 0); // gotta update the controller led again on reconnect
}
////////////////////////////////////////////////////////////