Merge branch 'Saturn-Next' into Saturn-Testing
This commit is contained in:
commit
99d5590435
21 files changed
+561
-534
No files matched your search
+15
-20
@@ -1,20 +1,15 @@
|
||||
# SDL Development Libaries
|
||||
|
||||
Download both the VC and MinGW packages and extract them here.
|
||||
|
||||
https://www.libsdl.org/download-2.0.php
|
||||
|
||||
## VC Package
|
||||
|
||||
* include
|
||||
* lib
|
||||
|
||||
## MinGW Package
|
||||
|
||||
* i686-w64-mingw32
|
||||
* x86_64-w64-mingw32
|
||||
|
||||
# SRB2Kart Saturn note:
|
||||
Due to a good amount of issues with newer SDL releases, we decided to ship our own Version of the library.
|
||||
This version is just the 2.28.5 release with a fix backported for non US keyboard layouts that prevented the right ALT GR key from working properly.
|
||||
It can be found under: https://github.com/alufolie91/SDL/tree/backportaltgrfix
|
||||
# SDL Development Libaries
|
||||
|
||||
Download both the VC and MinGW packages and extract them here.
|
||||
|
||||
https://www.libsdl.org/download-2.0.php
|
||||
|
||||
## VC Package
|
||||
|
||||
* include
|
||||
* lib
|
||||
|
||||
## MinGW Package
|
||||
|
||||
* i686-w64-mingw32
|
||||
* x86_64-w64-mingw32
|
||||
Binary file not shown.
@@ -1,65 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
Binary file not shown.
@@ -1,65 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
Binary file not shown.
Binary file not shown.
+16
-11
@@ -623,7 +623,7 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
size_t i, j;
|
||||
INT32 k;
|
||||
|
||||
auto LoadFlat = [&](lumpnum_t lump, boolean noencoremap)
|
||||
auto load_flat = [&](lumpnum_t lump, boolean noencoremap)
|
||||
{
|
||||
// flat already loaded?
|
||||
if (flatpresent.count(lump) == 0)
|
||||
@@ -651,14 +651,14 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
const levelflat_t *levelflat = &levelflats[pic];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
LoadFlat(lump, R_NoEncore(sec, ceiling));
|
||||
load_flat(lump, R_NoEncore(sec, ceiling));
|
||||
|
||||
if (levelflat->speed) // is it an animated flat ?
|
||||
{
|
||||
// start from 0, occasionally basenumlump != flat->lumpnum
|
||||
for (k = 0; k < levelflat->numpics; k++)
|
||||
{
|
||||
LoadFlat(levelflat->baselumpnum + k, R_NoEncore(sec, ceiling));
|
||||
load_flat(levelflat->baselumpnum + k, R_NoEncore(sec, ceiling));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,14 +674,14 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
const levelflat_t *levelflat = &levelflats[i];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
LoadFlat(lump, false);
|
||||
load_flat(lump, false);
|
||||
|
||||
if (levelflat->speed) // is it an animated flat ?
|
||||
{
|
||||
// start from 0, occasionally basenumlump != flat->lumpnum
|
||||
for (k = 0; k < levelflat->numpics; k++)
|
||||
{
|
||||
LoadFlat(levelflat->baselumpnum + k, false);
|
||||
load_flat(levelflat->baselumpnum + k, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -882,6 +882,7 @@ void HWR_LoadMapTextures(size_t pnumtextures)
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
{
|
||||
GLMapTexture_t *gltex;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
if (tex < 0 || tex >= (signed)gl_numtextures)
|
||||
{
|
||||
@@ -900,19 +901,22 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
gltex = &gl_textures[tex];
|
||||
#endif
|
||||
|
||||
glMipmap = &gltex->mipmap;
|
||||
|
||||
// Generate texture if missing from the cache
|
||||
if (!gltex->mipmap.downloaded)
|
||||
if (!glMipmap->downloaded)
|
||||
{
|
||||
if (!gltex->mipmap.data)
|
||||
HWR_GenerateTexture(tex, gltex, noencore);
|
||||
|
||||
// If hardware does not have the texture, then call GL_SetTexture to upload it
|
||||
GL_SetTexture(&gltex->mipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
}
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
return gltex;
|
||||
}
|
||||
@@ -1052,8 +1056,8 @@ static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *glMipmap)
|
||||
// ----------------------+
|
||||
static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *glMipmap)
|
||||
{
|
||||
GLPatch_t *grPatch = static_cast<GLPatch_t *>(patch->hardware);
|
||||
HWR_MakePatch(patch, grPatch, glMipmap, true);
|
||||
GLPatch_t *glPatch = static_cast<GLPatch_t *>(patch->hardware);
|
||||
HWR_MakePatch(patch, glPatch, glMipmap, true);
|
||||
|
||||
// If hardware does not have the texture, then call GL_SetTexture to upload it
|
||||
// If it does have the texture, then call GL_UpdateTexture to update it
|
||||
@@ -1061,6 +1065,7 @@ static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *glMipmap)
|
||||
GL_SetTexture(glMipmap);
|
||||
else
|
||||
GL_UpdateTexture(glMipmap);
|
||||
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
||||
+10
-5
@@ -166,6 +166,7 @@ static void gld_clipper_RemoveRange(clipnode_t *range)
|
||||
{
|
||||
range->prev->next = range->next;
|
||||
}
|
||||
|
||||
if (range->next)
|
||||
{
|
||||
range->next->prev = range->prev;
|
||||
@@ -348,7 +349,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
// gld_FrustumSetup
|
||||
//
|
||||
|
||||
float frustum[6][4];
|
||||
static float frustum[6][4];
|
||||
|
||||
#define CALCMATRIX(a, b, c, d, e, f, g, h)\
|
||||
(modelMatrix[a] * projMatrix[b] + \
|
||||
@@ -361,16 +362,20 @@ float frustum[6][4];
|
||||
frustum[i][0] * frustum[i][0] + \
|
||||
frustum[i][1] * frustum[i][1] + \
|
||||
frustum[i][2] * frustum[i][2]); \
|
||||
frustum[i][0] /= t; \
|
||||
frustum[i][1] /= t; \
|
||||
frustum[i][2] /= t; \
|
||||
frustum[i][3] /= t
|
||||
frustum[i][0] /= t; \
|
||||
frustum[i][1] /= t; \
|
||||
frustum[i][2] /= t; \
|
||||
frustum[i][3] /= t
|
||||
|
||||
void gld_FrustumSetup(void)
|
||||
{
|
||||
float t;
|
||||
float clip[16];
|
||||
|
||||
// HWR_SetTransform will take care of this!
|
||||
//pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
||||
//pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix);
|
||||
|
||||
clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
|
||||
clip[1] = CALCMATRIX(0, 1, 1, 5, 2, 9, 3, 13);
|
||||
clip[2] = CALCMATRIX(0, 2, 1, 6, 2, 10, 3, 14);
|
||||
|
||||
+107
-118
@@ -146,7 +146,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||
static void HWR_SetTransformAiming(FTransform *trans);
|
||||
static void HWR_RollTransform(FTransform *tr, angle_t roll);
|
||||
|
||||
static void HWR_DoPostProcessor(player_t *player);
|
||||
static void HWR_DoPostProcessor(void);
|
||||
|
||||
static void HWR_SetShaderState(void);
|
||||
static void HWR_TogglePaletteRendering(void);
|
||||
@@ -4656,7 +4656,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
float y1, y2;
|
||||
float z1, z2;
|
||||
float rightsin, rightcos;
|
||||
float this_scale;
|
||||
float thing_scale;
|
||||
float spritexscale, spriteyscale;
|
||||
float gz, gzt;
|
||||
spritedef_t *sprdef;
|
||||
@@ -4725,10 +4725,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
|
||||
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
|
||||
this_scale = FixedToFloat(interp.scale);
|
||||
spritexscale = FixedToFloat(interp.spritexscale);
|
||||
spriteyscale = FixedToFloat(interp.spriteyscale);
|
||||
|
||||
// decide which patch to use for sprite relative to player
|
||||
#ifdef RANGECHECK
|
||||
if ((unsigned)thing->sprite >= numsprites)
|
||||
@@ -4829,9 +4825,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
flip ^= (1<<rot);
|
||||
}
|
||||
|
||||
if (sprskin && (sprskin->flags & SF_HIRES))
|
||||
this_scale *= FixedToFloat(sprskin->highresscale);
|
||||
|
||||
spr_width = spritecachedinfo[lumpoff].width;
|
||||
spr_height = spritecachedinfo[lumpoff].height;
|
||||
spr_offset = spritecachedinfo[lumpoff].offset;
|
||||
@@ -4876,8 +4869,13 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
spr_offset += interp.spritexoffset;
|
||||
spr_topoffset += interp.spriteyoffset;
|
||||
|
||||
spritexscale *= this_scale;
|
||||
spriteyscale *= this_scale;
|
||||
thing_scale = FixedToFloat(interp.scale);
|
||||
|
||||
if (sprskin && (sprskin->flags & SF_HIRES))
|
||||
thing_scale *= FixedToFloat(sprskin->highresscale);
|
||||
|
||||
spritexscale = FixedToFloat(interp.spritexscale) * thing_scale;
|
||||
spriteyscale = FixedToFloat(interp.spriteyscale) * thing_scale;
|
||||
|
||||
flip = !flip != !hflip;
|
||||
|
||||
@@ -4912,28 +4910,14 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
return;
|
||||
}
|
||||
|
||||
// rest in piece sweet prince
|
||||
/*if (cv_glshearing.value && !papersprite)
|
||||
{
|
||||
// killough 4/9/98: clip things which are out of view due to height
|
||||
// e6y: fix of hanging decoration disappearing in Batman Doom MAP02
|
||||
// centeryfrac -> viewheightfrac
|
||||
// [kb] add +1 so sprites are shown even with the extended freelook
|
||||
// lug: attempt to account for freelook properly
|
||||
const fixed_t fixedtz = FloatToFixed(tz);
|
||||
if (interp.z > viewz + FixedMul(centeryfrac, fixedtz) || // view center accounted for aspect (i hope)
|
||||
FloatToFixed(gzt) < viewz + FixedMul((centeryfrac - (viewheight << FRACBITS)), fixedtz)) // view center accounted for aspect but the bottom (OwO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
// if the sprite is out of our view, dont need to draw it X)
|
||||
if (!gld_SphereInFrustum(
|
||||
(FixedToFloat(interp.x)) + cos_inv_yaw * (x1 + x2) / 2.0f,
|
||||
FixedToFloat(interp.z) + (y1 + y2) / 2.0f,
|
||||
FixedToFloat(interp.y) - sin_inv_yaw * (x1 + x2) / 2.0f,
|
||||
//1.5 == sqrt(2) + small delta for MF_FOREGROUND
|
||||
std::max<float>(FixedToFloat(spr_width), FixedToFloat(spr_height)) / 2.0f * 1.5f))
|
||||
std::max<float>(FixedToFloat(spr_width) * spritexscale,
|
||||
FixedToFloat(spr_height) * spriteyscale) / 2.0f * 1.5f))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4947,17 +4931,16 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
|
||||
{
|
||||
fixed_t secheight;
|
||||
const fixed_t fgzt = FloatToFixed(gzt);
|
||||
|
||||
secheight = P_GetSectorFloorZAt(§ors[heightsec], viewx, viewy);
|
||||
if (viewz < P_GetSectorFloorZAt(§ors[phs], interp.x, interp.y) ?
|
||||
interp.z >= secheight :
|
||||
fgzt < secheight)
|
||||
FloatToFixed(gzt) < secheight)
|
||||
return;
|
||||
|
||||
secheight = P_GetSectorCeilingZAt(§ors[heightsec], viewx, viewy);
|
||||
if (viewz > P_GetSectorCeilingZAt(§ors[phs], interp.x, interp.y) ?
|
||||
fgzt < secheight && viewz >= secheight :
|
||||
FloatToFixed(gzt) < secheight && viewz >= secheight :
|
||||
interp.z >= secheight)
|
||||
return;
|
||||
}
|
||||
@@ -4992,7 +4975,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
|
||||
vis->flip = flip;
|
||||
|
||||
vis->scale = this_scale;
|
||||
vis->scale = thing_scale;
|
||||
vis->spritexscale = spritexscale;
|
||||
vis->spriteyscale = spriteyscale;
|
||||
vis->spritexoffset = FixedToFloat(spr_offset);
|
||||
@@ -5000,10 +4983,10 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (rotsprite != NULL)
|
||||
vis->gpatch = (patch_t *)rotsprite;
|
||||
vis->gpatch = static_cast<patch_t *>(rotsprite);
|
||||
else
|
||||
#endif
|
||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
vis->gpatch = static_cast<patch_t *>(W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE));
|
||||
|
||||
vis->mobj = thing;
|
||||
|
||||
@@ -5059,7 +5042,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
float z1, z2;
|
||||
float gz, gzt;
|
||||
float rightsin, rightcos;
|
||||
float this_scale;
|
||||
float thing_scale;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
size_t lumpoff;
|
||||
@@ -5095,7 +5078,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
return;
|
||||
|
||||
// decide which patch to use for sprite relative to player
|
||||
if ((unsigned)thing->sprite >= numsprites)
|
||||
if (static_cast<unsigned>(thing->sprite) >= numsprites)
|
||||
{
|
||||
#ifdef RANGECHECK
|
||||
I_Error("HWR_ProjectPrecipitationSprite: invalid sprite number %i ",
|
||||
@@ -5107,7 +5090,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
|
||||
sprdef = &sprites[thing->sprite];
|
||||
|
||||
if ((size_t)(thing->frame&FF_FRAMEMASK) >= sprdef->numframes)
|
||||
if (static_cast<size_t>((thing->frame&FF_FRAMEMASK)) >= sprdef->numframes)
|
||||
{
|
||||
#ifdef RANGECHECK
|
||||
I_Error("HWR_ProjectPrecipitationSprite: invalid sprite frame %i : %i for %s",
|
||||
@@ -5117,7 +5100,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
#endif
|
||||
}
|
||||
|
||||
this_scale = FixedToFloat(interp.scale);
|
||||
thing_scale = FixedToFloat(interp.scale);
|
||||
|
||||
sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK];
|
||||
|
||||
@@ -5137,31 +5120,31 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = FixedToFloat(spr_offset);
|
||||
x2 = FixedToFloat(spr_offset);
|
||||
x1 = x2 = FixedToFloat(spr_offset);
|
||||
}
|
||||
|
||||
y1 = (FixedToFloat(spr_topoffset));
|
||||
y2 = (FixedToFloat(spr_height - spr_topoffset));
|
||||
|
||||
x1 *= this_scale;
|
||||
x2 *= this_scale;
|
||||
y1 *= this_scale;
|
||||
y2 *= this_scale;
|
||||
x1 *= thing_scale;
|
||||
x2 *= thing_scale;
|
||||
y1 *= thing_scale;
|
||||
y2 *= thing_scale;
|
||||
|
||||
if (!gld_SphereInFrustum(
|
||||
(FixedToFloat(interp.x)) + cos_inv_yaw * (x1 + x2) / 2.0f,
|
||||
FixedToFloat(interp.z) + (y1 + y2) / 2.0f,
|
||||
FixedToFloat(interp.y) - sin_inv_yaw * (x1 + x2) / 2.0f,
|
||||
//1.5 == sqrt(2) + small delta for MF_FOREGROUND
|
||||
std::max<float>(FixedToFloat(spr_width), FixedToFloat(spr_height)) / 2.0f * 1.5f))
|
||||
std::max<float>(FixedToFloat(spr_width) * thing_scale,
|
||||
FixedToFloat(spr_height) * thing_scale) / 2.0f * 1.5f))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
gzt = FixedToFloat(interp.z) + y1;
|
||||
gz = gzt - (FixedToFloat(spr_height) * this_scale);
|
||||
gz = gzt - (FixedToFloat(spr_height) * thing_scale);
|
||||
|
||||
rightsin = FixedToFloat(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT));
|
||||
rightcos = FixedToFloat(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT));
|
||||
@@ -5181,7 +5164,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->z2 = z2;
|
||||
vis->tz = tz;
|
||||
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
|
||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
vis->gpatch = static_cast<patch_t *>(W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE));
|
||||
vis->flip = flip;
|
||||
vis->mobj = NULL;
|
||||
|
||||
@@ -5347,8 +5330,6 @@ void HWR_BuildSkyDome(void)
|
||||
}
|
||||
}
|
||||
|
||||
static boolean drewsky = false;
|
||||
|
||||
// precompute to save a bit of division
|
||||
static constexpr float FINEDEGREE = (360.0f/(float)FINEANGLES);
|
||||
|
||||
@@ -5356,7 +5337,7 @@ static void HWR_DrawSkyBackground(void)
|
||||
{
|
||||
FTransform dometransform;
|
||||
|
||||
if (drewsky || HWR_IsWireframeMode())
|
||||
if (HWR_IsWireframeMode())
|
||||
return;
|
||||
|
||||
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
@@ -5514,15 +5495,22 @@ namespace
|
||||
};
|
||||
|
||||
template <RenderViewpointType Type>
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals)
|
||||
static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, boolean allow_portals)
|
||||
{
|
||||
gl_portallist_t portallist;
|
||||
|
||||
const float fpov = FixedToFloat(R_GetPlayerFov(player));
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
player_t *viewplayer = &players[displayplayers[viewssnum]];
|
||||
const float fpov = FixedToFloat(R_GetPlayerFov(viewplayer));
|
||||
|
||||
auto reset_viewstate = [&](const float fpov)
|
||||
{
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearSprites();
|
||||
HWR_ClearClipper();
|
||||
};
|
||||
|
||||
portallist.base = portallist.cap = NULL;
|
||||
HWR_SetPortalState(GLPORTAL_OFF); // there may be portals and they need to be drawn as regural walls
|
||||
HWR_SetPortalState(GLPORTAL_OFF); // there may be portals and they need to be drawn as regular walls
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
@@ -5534,10 +5522,8 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
currentportallist = &portallist;
|
||||
HWR_SetPortalState(GLPORTAL_SEARCH);
|
||||
|
||||
HWR_SetTransform(fpov);
|
||||
reset_viewstate(fpov);
|
||||
|
||||
HWR_ClearSprites();
|
||||
HWR_ClearClipper();
|
||||
if (rootportal)
|
||||
{
|
||||
HWR_PortalClipping(rootportal);
|
||||
@@ -5552,7 +5538,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
// note: if necessary, could sort the portals here?
|
||||
for (portal = portallist.base; portal; portal = portal->next)
|
||||
{
|
||||
HWR_RenderPortal(portal, rootportal, fpov, player, stencil_level);
|
||||
HWR_RenderPortal(portal, rootportal, fpov, stencil_level);
|
||||
}
|
||||
|
||||
HWR_SetPortalState(GLPORTAL_INSIDE); // when portal walls are encountered in following bsp traversal, nothing should be drawn
|
||||
@@ -5562,9 +5548,7 @@ 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();
|
||||
reset_viewstate(fpov);
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
@@ -5578,6 +5562,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
if (HWR_IsWireframeMode())
|
||||
GL_SetSpecialState(HWD_SET_WIREFRAME, 1);
|
||||
|
||||
// FIXME: perfstats does not account for portal rendering!
|
||||
ps_numbspcalls.value.i = 0;
|
||||
ps_numpolyobjects.value.i = 0;
|
||||
PS_START_TIMING(ps_bsptime);
|
||||
@@ -5589,8 +5574,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
if (allow_portals && !rootportal && portallist.base && !skybox) // if portals have been drawn in the main view, then render skywalls differently
|
||||
gl_collect_skywalls = true;
|
||||
gl_collect_skywalls = (allow_portals && !rootportal && portallist.base && (!skyboxmo[0] || !cv_skybox.value)); // if portals have been drawn in the main view, then render skywalls differently
|
||||
|
||||
// HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree.
|
||||
// This fixes specific effects not working, such as horizon lines.
|
||||
@@ -5622,6 +5606,9 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
if (LIKELY(cv_glbatching.value))
|
||||
HWR_RenderBatches(true);
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate();
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
if (skyWallVertexArraySize) // if there are skywalls to draw using the alternate method
|
||||
@@ -5630,13 +5617,13 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
HWR_DrawSkyWallList();
|
||||
HWR_SkyWallList_Clear();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 1);
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
GL_ClearBuffer(false, false, true, NULL);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov);// restore transform
|
||||
GL_ClearBuffer(false, false, true, NULL); // clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov); // restore transform
|
||||
}
|
||||
}
|
||||
|
||||
gl_collect_skywalls = false;
|
||||
|
||||
ps_numsprites.value.i = gl_visspritecount;
|
||||
@@ -5657,6 +5644,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
ps_hw_nodesorttime.value.p = 0;
|
||||
ps_hw_nodedrawtime.value.p = 0;
|
||||
|
||||
HWR_RenderDrawNodes();
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
@@ -5667,26 +5655,22 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals) {
|
||||
HWR_RenderViewpoint<RenderViewpointType::kPortal>(rootportal, player, stencil_level, allow_portals);
|
||||
void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, int stencil_level, boolean allow_portals) {
|
||||
HWR_RenderViewpoint<RenderViewpointType::kPortal>(rootportal, stencil_level, allow_portals);
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Render the current frame.
|
||||
// ==========================================================================
|
||||
static void HWR_RenderFrame(player_t *player, boolean skybox)
|
||||
static void HWR_RenderFrame(boolean skybox, boolean drawsky)
|
||||
{
|
||||
// check for new console commands.
|
||||
NetUpdate();
|
||||
|
||||
// Clear view, set viewport (glViewport), set perspective...
|
||||
HWR_ClearView();
|
||||
|
||||
// Draw the sky background.
|
||||
HWR_DrawSkyBackground();
|
||||
if (skybox)
|
||||
drewsky = true;
|
||||
if (drawsky)
|
||||
HWR_DrawSkyBackground();
|
||||
|
||||
current_bsp_culling_distance = 0;
|
||||
|
||||
@@ -5702,26 +5686,17 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
|
||||
current_bsp_culling_distance = bsp_culling_distances[renderdist- 1];
|
||||
}
|
||||
|
||||
portalclipline = NULL;
|
||||
if (UNLIKELY(HWR_UsePortals()))
|
||||
HWR_RenderViewpoint<RenderViewpointType::kPortal>(NULL, player, 0, !skybox);
|
||||
else
|
||||
HWR_RenderViewpoint<RenderViewpointType::kNormal>(NULL, player, 0, !skybox);
|
||||
|
||||
// Unset transform and shader
|
||||
GL_SetTransform(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
// Run post processor effects
|
||||
if (!skybox)
|
||||
HWR_DoPostProcessor(player);
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate();
|
||||
|
||||
// added by Hurdler for correct splitscreen
|
||||
// moved here by hurdler so it works with the new near clipping plane
|
||||
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
portalclipline = NULL;
|
||||
if (UNLIKELY(HWR_UsePortals()))
|
||||
HWR_RenderViewpoint<RenderViewpointType::kPortal>(NULL, 0, !skybox);
|
||||
else
|
||||
HWR_RenderViewpoint<RenderViewpointType::kNormal>(NULL, 0, !skybox);
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate();
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -5771,22 +5746,31 @@ void HWR_RenderPlayerView(void)
|
||||
if (viewssnum > 3)
|
||||
return;
|
||||
|
||||
player_t * player = &players[displayplayers[viewssnum]];
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on
|
||||
|
||||
// Render the skybox if there is one.
|
||||
PS_START_TIMING(ps_skyboxtime);
|
||||
drewsky = false;
|
||||
if (skybox)
|
||||
{
|
||||
R_SkyboxFrame(viewssnum);
|
||||
HWR_RenderFrame(player, true);
|
||||
HWR_RenderFrame(true, true);
|
||||
}
|
||||
PS_STOP_TIMING(ps_skyboxtime);
|
||||
|
||||
R_SetupFrame(viewssnum, false); // This can stay false because it is only used to set viewsky in r_main.c, which isn't used here
|
||||
framecount++; // for timedemo
|
||||
HWR_RenderFrame(player, false);
|
||||
HWR_RenderFrame(false, !skybox);
|
||||
|
||||
// Unset transform and shader
|
||||
GL_SetTransform(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
// Run post processor effects
|
||||
HWR_DoPostProcessor();
|
||||
|
||||
// added by Hurdler for correct splitscreen
|
||||
// moved here by hurdler so it works with the new near clipping plane
|
||||
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
void HWR_LoadLevel(void)
|
||||
@@ -6040,35 +6024,40 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
|
||||
#endif
|
||||
}
|
||||
|
||||
static void HWR_DoPostProcessor(player_t *player)
|
||||
static void HWR_DoPostProcessor(void)
|
||||
{
|
||||
GL_UnSetShader();
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
if (!HWR_PalRenderFlashpal() && player->flashcount)
|
||||
if (!HWR_PalRenderFlashpal())
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
const player_t *player = &players[displayplayers[viewssnum]];
|
||||
|
||||
v[0].x = v[2].y = v[3].x = v[3].y = -4.0f;
|
||||
v[0].y = v[1].x = v[1].y = v[2].x = 4.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 4.0f; // 4.0 because of the same reason as with the sky, just after the screen is cleared so near clipping plane is 3.99
|
||||
|
||||
// This won't change if the flash palettes are changed unfortunately, but it works for its purpose
|
||||
if (player->flashpal == PAL_NUKE)
|
||||
if (player->flashcount)
|
||||
{
|
||||
Surf.PolyColor.s.red = 0xff;
|
||||
Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0x7F; // The nuke palette is kind of pink-ish
|
||||
static FOutVector v[4] = {
|
||||
{-4.0f, 4.0f, 4.0f, 0.0f, 0.0f},
|
||||
{ 4.0f, 4.0f, 4.0f, 0.0f, 0.0f}, // 4.0 because of the same reason as with the sky, just after the screen is cleared so near clipping plane is 3.99
|
||||
{ 4.0f, -4.0f, 4.0f, 0.0f, 0.0f},
|
||||
{-4.0f, -4.0f, 4.0f, 0.0f, 0.0f}
|
||||
};
|
||||
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
// This won't change if the flash palettes are changed unfortunately, but it works for its purpose
|
||||
if (player->flashpal == PAL_NUKE)
|
||||
{
|
||||
Surf.PolyColor.s.red = 0xff;
|
||||
Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0x7F; // The nuke palette is kind of pink-ish
|
||||
}
|
||||
else
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
V_CubeApply(&Surf.PolyColor);
|
||||
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
else
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
V_CubeApply(&Surf.PolyColor);
|
||||
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
|
||||
|
||||
@@ -102,8 +102,7 @@ void HWR_SetViewSize(void);
|
||||
void HWR_AddCommands(void);
|
||||
|
||||
void HWR_RenderPlayerView(void);
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals);
|
||||
void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_level, boolean allow_portals);
|
||||
void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, int stencil_level, boolean allow_portals);
|
||||
|
||||
void HWR_ClearSkyDome(void);
|
||||
void HWR_BuildSkyDome(void);
|
||||
|
||||
@@ -157,7 +157,7 @@ static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
}
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, int stencil_level)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov);
|
||||
@@ -170,7 +170,7 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float
|
||||
HWR_PortalFrame(portal);
|
||||
|
||||
// call HWR_RenderViewpoint
|
||||
HWR_RenderPortalViewpoint(portal, player, stencil_level + 1, true);
|
||||
HWR_RenderPortalViewpoint(portal, stencil_level + 1, true);
|
||||
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
|
||||
@@ -75,7 +75,7 @@ void HWR_PortalClipping(gl_portal_t *portal);
|
||||
|
||||
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
|
||||
void HWR_PortalFrame(gl_portal_t* portal);
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, int stencil_level);
|
||||
void HWR_FreePortalList(gl_portallist_t portallist);
|
||||
|
||||
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
|
||||
|
||||
@@ -127,7 +127,7 @@ GLuint gl_num_extensions;
|
||||
int majorGL = 0, minorGL = 0;
|
||||
|
||||
//Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
|
||||
GLfloat modelMatrix[16];
|
||||
GLfloat modelMatrix[16] = {0};
|
||||
GLfloat projMatrix[16] = {0};
|
||||
static GLint viewport[4];
|
||||
|
||||
|
||||
+44
-4
@@ -10,6 +10,7 @@
|
||||
/// \brief Chat emotes handling
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
@@ -22,8 +23,11 @@ extern "C" {
|
||||
#include "z_zone.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "v_video.h"
|
||||
#include "command.h"
|
||||
}
|
||||
|
||||
static void Command_ListEmotes_f(void);
|
||||
|
||||
consvar_t cv_emotes = {"emotes", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static std::map<std::string, emote_t> emotes;
|
||||
@@ -140,7 +144,7 @@ void M_LoadEmotes(UINT16 wadnum)
|
||||
|
||||
if (framelumpname.size() > 8)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Frame %d name is too long. (file %s, line %d)", numframes, wadfiles[wadnum]->filename, linenum);
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Frame %d name is too long. (file %s, line %d)\n", numframes, wadfiles[wadnum]->filename, linenum);
|
||||
framelumpname.resize(8);
|
||||
}
|
||||
|
||||
@@ -155,7 +159,7 @@ void M_LoadEmotes(UINT16 wadnum)
|
||||
|
||||
if (numframes == 0)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Expected list of frames. (file %s, line %d)", wadfiles[wadnum]->filename, linenum);
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Expected list of frames. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||
}
|
||||
|
||||
emote->numframes = numframes;
|
||||
@@ -167,12 +171,12 @@ void M_LoadEmotes(UINT16 wadnum)
|
||||
if (emote->timeperframe <= 0)
|
||||
{
|
||||
emote->timeperframe = 1;
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Bad value for 'timeperframe'. (file %s, line %d)", wadfiles[wadnum]->filename, linenum);
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Bad value for 'timeperframe'. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Unrecognized field '%s'. (file %s, line %d)", field.c_str(), wadfiles[wadnum]->filename, linenum);
|
||||
CONS_Alert(CONS_WARNING, "EMOTES: Unrecognized field '%s'. (file %s, line %d)\n", field.c_str(), wadfiles[wadnum]->filename, linenum);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -189,6 +193,8 @@ void M_InitEmotes(void)
|
||||
UINT16 i;
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_LoadEmotes(i);
|
||||
|
||||
COM_AddCommand("listemotes", Command_ListEmotes_f);
|
||||
}
|
||||
|
||||
emote_t *M_FindEmote(const char *name, int len, int skip)
|
||||
@@ -268,3 +274,37 @@ void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, INT3
|
||||
|
||||
V_DrawFixedPatch(x, y, scale, flags, emotepatch, NULL);
|
||||
}
|
||||
|
||||
static void Command_ListEmotes_f(void)
|
||||
{
|
||||
const int EMOTES_PER_PAGE = 24;
|
||||
const int NUMPAGES = std::max<int>(emotes.size()/EMOTES_PER_PAGE, 1);
|
||||
int page = 1;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
page = std::atoi(COM_Argv(1));
|
||||
|
||||
if (page <= 0 || page > NUMPAGES)
|
||||
{
|
||||
if (NUMPAGES > 1)
|
||||
CONS_Printf("Enter page number between 1 and %d\n", NUMPAGES);
|
||||
else
|
||||
CONS_Printf("Bad page number, try using this command without arguments\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (auto &pair: emotes)
|
||||
{
|
||||
++i;
|
||||
|
||||
if (i <= (page-1)*EMOTES_PER_PAGE)
|
||||
continue;
|
||||
if (i > page*EMOTES_PER_PAGE)
|
||||
break;
|
||||
|
||||
CONS_Printf("%s - :%s:\n", pair.first.c_str(), pair.first.c_str());
|
||||
}
|
||||
|
||||
CONS_Printf("Page %d/%d\n", page, NUMPAGES);
|
||||
}
|
||||
+223
-46
@@ -194,6 +194,11 @@ static INT32 vidm_selected = 0;
|
||||
static INT32 vidm_nummodes;
|
||||
static INT32 vidm_column_size;
|
||||
|
||||
#define SETUPM_IP_MAXSIZE ((28-1)*8)
|
||||
static char setupm_ip[64];
|
||||
static textinput_t setupm_input_ip;
|
||||
static UINT8 setupm_pselect = 1;
|
||||
|
||||
//
|
||||
// PROTOTYPES
|
||||
//
|
||||
@@ -370,7 +375,6 @@ static void M_HandleMonitorToggles(INT32 choice);
|
||||
static void M_AddonsRefresh(void);
|
||||
|
||||
// Consvar onchange functions
|
||||
static void Nextmap_OnChange(void);
|
||||
static void Newgametype_OnChange(void);
|
||||
static void Dummymenuplayer_OnChange(void);
|
||||
static void Dummystaff_OnChange(void);
|
||||
@@ -580,6 +584,196 @@ static void M_CustomCvarMenu(INT32 choice)
|
||||
M_StartMessage(M_GetText("No custom options were found\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// CVAR ONCHANGE EVENTS GO HERE
|
||||
// ==========================================================================
|
||||
// (there's only a couple anyway)
|
||||
|
||||
// Nextmap. Used for Time Attack.
|
||||
void Nextmap_OnChange(void)
|
||||
{
|
||||
char *leveltitle;
|
||||
UINT8 active;
|
||||
|
||||
// Update the string in the consvar.
|
||||
Z_Free(cv_nextmap.zstring);
|
||||
leveltitle = G_BuildMapTitle(cv_nextmap.value);
|
||||
cv_nextmap.string = cv_nextmap.zstring = leveltitle ? leveltitle : Z_StrDup(G_BuildMapName(cv_nextmap.value));
|
||||
|
||||
if (currentMenu == &SP_TimeAttackDef)
|
||||
{
|
||||
// see also p_setup.c's P_LoadRecordGhosts
|
||||
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
|
||||
char *gpath = malloc(glen);
|
||||
INT32 i;
|
||||
|
||||
if (!gpath)
|
||||
return;
|
||||
|
||||
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
|
||||
|
||||
CV_StealthSetValue(&cv_dummystaff, 0);
|
||||
|
||||
active = false;
|
||||
SP_TimeAttackMenu[taguest].status = IT_DISABLED;
|
||||
SP_TimeAttackMenu[tareplay].status = IT_DISABLED;
|
||||
|
||||
// Check if file exists, if not, disable REPLAY option
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
SP_ReplayMenu[i].status = IT_DISABLED;
|
||||
SP_GuestReplayMenu[i].status = IT_DISABLED;
|
||||
}
|
||||
SP_ReplayMenu[4].status = IT_DISABLED;
|
||||
|
||||
SP_GhostMenu[3].status = IT_DISABLED;
|
||||
SP_GhostMenu[4].status = IT_DISABLED;
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string))) {
|
||||
SP_ReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string))) {
|
||||
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string))) {
|
||||
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
|
||||
if (FIL_FileExists(va("%s-guest.lmp", gpath)))
|
||||
{
|
||||
SP_ReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GhostMenu[3].status = IT_STRING|IT_CVAR;
|
||||
active |= 3;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_dummystaff, 1);
|
||||
if (cv_dummystaff.value)
|
||||
{
|
||||
SP_ReplayMenu[4].status = IT_WHITESTRING|IT_KEYHANDLER;
|
||||
SP_GhostMenu[4].status = IT_STRING|IT_CVAR;
|
||||
CV_StealthSetValue(&cv_dummystaff, 1);
|
||||
active |= 1;
|
||||
}
|
||||
|
||||
if (active) {
|
||||
if (active & 1)
|
||||
SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU;
|
||||
if (active & 2)
|
||||
SP_TimeAttackMenu[taguest].status = IT_WHITESTRING|IT_SUBMENU;
|
||||
}
|
||||
else if (itemOn == tareplay) // Reset lastOn so replay isn't still selected when not available.
|
||||
{
|
||||
currentMenu->lastOn = itemOn;
|
||||
itemOn = tastart;
|
||||
}
|
||||
|
||||
if (mapheaderinfo[cv_nextmap.value-1] && mapheaderinfo[cv_nextmap.value-1]->forcecharacter[0] != '\0')
|
||||
CV_Set(&cv_chooseskin, mapheaderinfo[cv_nextmap.value-1]->forcecharacter);
|
||||
|
||||
free(gpath);
|
||||
}
|
||||
}
|
||||
|
||||
static void Dummymenuplayer_OnChange(void)
|
||||
{
|
||||
if (cv_dummymenuplayer.value < 1)
|
||||
CV_StealthSetValue(&cv_dummymenuplayer, splitscreen+1);
|
||||
else if (cv_dummymenuplayer.value > splitscreen+1)
|
||||
CV_StealthSetValue(&cv_dummymenuplayer, 1);
|
||||
}
|
||||
|
||||
char dummystaffname[22];
|
||||
|
||||
static void Dummystaff_OnChange(void)
|
||||
{
|
||||
lumpnum_t l;
|
||||
|
||||
dummystaffname[0] = '\0';
|
||||
|
||||
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) == LUMPERROR)
|
||||
{
|
||||
CV_StealthSetValue(&cv_dummystaff, 0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *temp = dummystaffname;
|
||||
UINT8 numstaff = 1;
|
||||
while (numstaff < 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value),numstaff+1))) != LUMPERROR)
|
||||
numstaff++;
|
||||
|
||||
if (cv_dummystaff.value < 1)
|
||||
CV_StealthSetValue(&cv_dummystaff, numstaff);
|
||||
else if (cv_dummystaff.value > numstaff)
|
||||
CV_StealthSetValue(&cv_dummystaff, 1);
|
||||
|
||||
if ((l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value), cv_dummystaff.value))) == LUMPERROR)
|
||||
return; // shouldn't happen but might as well check...
|
||||
|
||||
G_UpdateStaffGhostName(l);
|
||||
|
||||
while (*temp)
|
||||
temp++;
|
||||
|
||||
sprintf(temp, " - %d", cv_dummystaff.value);
|
||||
}
|
||||
}
|
||||
|
||||
// Newgametype. Used for gametype changes.
|
||||
static void Newgametype_OnChange(void)
|
||||
{
|
||||
if (cv_nextmap.value && menuactive)
|
||||
{
|
||||
if (!mapheaderinfo[cv_nextmap.value-1])
|
||||
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
||||
|
||||
if ((cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || // SRB2kart
|
||||
((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)))
|
||||
{
|
||||
INT32 value = 0;
|
||||
|
||||
switch (cv_newgametype.value)
|
||||
{
|
||||
case GT_COOP:
|
||||
value = TOL_RACE; // SRB2kart
|
||||
break;
|
||||
case GT_COMPETITION:
|
||||
value = TOL_COMPETITION;
|
||||
break;
|
||||
case GT_RACE:
|
||||
value = TOL_RACE;
|
||||
break;
|
||||
case GT_MATCH:
|
||||
case GT_TEAMMATCH:
|
||||
value = TOL_MATCH;
|
||||
break;
|
||||
case GT_TAG:
|
||||
case GT_HIDEANDSEEK:
|
||||
value = TOL_TAG;
|
||||
break;
|
||||
case GT_CTF:
|
||||
value = TOL_CTF;
|
||||
break;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_nextmap, M_FindFirstMap(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Splitplayers_OnChange(void)
|
||||
{
|
||||
if (cv_splitplayers.value < setupm_pselect)
|
||||
setupm_pselect = 1;
|
||||
}
|
||||
|
||||
// current menudef
|
||||
menu_t *currentMenu = &MainDef;
|
||||
|
||||
@@ -6271,8 +6465,7 @@ static void M_EraseGuest(INT32 choice)
|
||||
remove(rguest);
|
||||
|
||||
M_SetupNextMenu(&SP_TimeAttackDef);
|
||||
CV_AddValue(&cv_nextmap, -1);
|
||||
CV_AddValue(&cv_nextmap, 1);
|
||||
Nextmap_OnChange();
|
||||
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);
|
||||
}
|
||||
|
||||
@@ -6293,8 +6486,7 @@ static void M_OverwriteGuest(const char *which)
|
||||
Z_Free(rguest);
|
||||
|
||||
M_SetupNextMenu(&SP_TimeAttackDef);
|
||||
CV_AddValue(&cv_nextmap, -1);
|
||||
CV_AddValue(&cv_nextmap, 1);
|
||||
Nextmap_OnChange();
|
||||
M_StartMessage(M_GetText("Guest replay data saved.\n"),NULL,MM_NOTHING);
|
||||
}
|
||||
|
||||
@@ -6364,8 +6556,7 @@ static void M_ModeAttackEndGame(INT32 choice)
|
||||
modeattacking = ATTACKING_NONE;
|
||||
S_ChangeMusicInternal("racent", true);
|
||||
// Update replay availability.
|
||||
CV_AddValue(&cv_nextmap, 1);
|
||||
CV_AddValue(&cv_nextmap, -1);
|
||||
Nextmap_OnChange();
|
||||
}
|
||||
|
||||
// ========
|
||||
@@ -7357,10 +7548,6 @@ static void M_StartServerMenu(INT32 choice)
|
||||
// CONNECT VIA IP
|
||||
// ==============
|
||||
|
||||
#define SETUPM_IP_MAXSIZE ((28-1)*8)
|
||||
static char setupm_ip[64];
|
||||
static textinput_t setupm_input_ip;
|
||||
|
||||
void M_Multiplayer(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
@@ -7369,8 +7556,6 @@ void M_Multiplayer(INT32 choice)
|
||||
M_SetupNextMenu(&MP_MainDef);
|
||||
}
|
||||
|
||||
static UINT8 setupm_pselect = 1;
|
||||
|
||||
// Draw the funky Connect IP menu. Tails 11-19-2002
|
||||
// So much work for such a little thing!
|
||||
static void M_DrawMPMainMenu(void)
|
||||
@@ -7465,12 +7650,6 @@ Update the maxplayers label...
|
||||
}
|
||||
}
|
||||
|
||||
static void Splitplayers_OnChange(void)
|
||||
{
|
||||
if (cv_splitplayers.value < setupm_pselect)
|
||||
setupm_pselect = 1;
|
||||
}
|
||||
|
||||
static void M_SetupMultiHandler(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu and send name change
|
||||
@@ -8817,15 +8996,15 @@ static boolean M_QuitMultiPlayerMenu(void)
|
||||
if (!fastcmp(setupm_name, setupm_cvname->string))
|
||||
{
|
||||
// remove trailing whitespaces
|
||||
for (l= strlen(setupm_name)-1;
|
||||
for (l = strlen(setupm_name)-1;
|
||||
(signed)l >= 0 && setupm_name[l] ==' '; l--)
|
||||
setupm_name[l] =0;
|
||||
COM_BufAddText (va("%s \"%s\"\n",setupm_cvname->name,setupm_name));
|
||||
COM_BufAddText(va("%s \"%s\"\n",setupm_cvname->name,setupm_name));
|
||||
}
|
||||
|
||||
// you know what? always putting these in the buffer won't hurt anything.
|
||||
COM_BufAddText (va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin].name));
|
||||
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor));
|
||||
COM_BufAddText(va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin].name));
|
||||
COM_BufAddText(va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -8912,24 +9091,20 @@ static void M_DrawJoystick(void)
|
||||
//M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
|
||||
|
||||
#ifdef JOYSTICK_HOTPLUG
|
||||
if (atoi(cv_usejoystick[3].string) > I_NumJoys())
|
||||
compareval4 = atoi(cv_usejoystick[3].string);
|
||||
else
|
||||
compareval4 = atoi(cv_usejoystick[3].string);
|
||||
if (compareval4 <= numcontrollers)
|
||||
compareval4 = cv_usejoystick[3].value;
|
||||
|
||||
if (atoi(cv_usejoystick[2].string) > I_NumJoys())
|
||||
compareval3 = atoi(cv_usejoystick[2].string);
|
||||
else
|
||||
compareval3 = atoi(cv_usejoystick[2].string);
|
||||
if (compareval3 <= numcontrollers)
|
||||
compareval3 = cv_usejoystick[2].value;
|
||||
|
||||
if (atoi(cv_usejoystick[1].string) > I_NumJoys())
|
||||
compareval2 = atoi(cv_usejoystick[1].string);
|
||||
else
|
||||
compareval2 = atoi(cv_usejoystick[1].string);
|
||||
if (compareval2 <= numcontrollers)
|
||||
compareval2 = cv_usejoystick[1].value;
|
||||
|
||||
if (atoi(cv_usejoystick[0].string) > I_NumJoys())
|
||||
compareval = atoi(cv_usejoystick[0].string);
|
||||
else
|
||||
compareval = atoi(cv_usejoystick[0].string);
|
||||
if (compareval <= numcontrollers)
|
||||
compareval = cv_usejoystick[0].value;
|
||||
#else
|
||||
compareval4 = cv_usejoystick[3].value;
|
||||
@@ -8952,15 +9127,16 @@ void M_SetupJoystickMenu(INT32 choice)
|
||||
{
|
||||
INT32 i = 0;
|
||||
const char *joyNA = "Unavailable";
|
||||
INT32 n = I_NumJoys();
|
||||
(void)choice;
|
||||
|
||||
strcpy(joystickInfo[i], "None");
|
||||
|
||||
for (i = 1; i < 8; i++)
|
||||
{
|
||||
if (i <= n && (I_GetJoyName(i)) != NULL)
|
||||
strncpy(joystickInfo[i], I_GetJoyName(i), 28);
|
||||
const char *joyname = I_GetJoyName(i);
|
||||
|
||||
if (i <= numcontrollers && joyname != NULL)
|
||||
strncpy(joystickInfo[i], joyname, 28);
|
||||
else
|
||||
strcpy(joystickInfo[i], joyNA);
|
||||
|
||||
@@ -9019,28 +9195,28 @@ static void M_Setup4PJoystickMenu(INT32 choice)
|
||||
static void M_DoAssignJoystick(UINT8 pnum, INT32 choice)
|
||||
{
|
||||
INT32 oldchoice, oldstringchoice;
|
||||
const INT32 numjoys = I_NumJoys();
|
||||
const int joynum = atoi(cv_usejoystick[pnum].string);
|
||||
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[pnum].string) > numjoys ? atoi(cv_usejoystick[pnum].string) : cv_usejoystick[pnum].value;
|
||||
oldchoice = oldstringchoice = joynum > numcontrollers ? joynum : cv_usejoystick[pnum].value;
|
||||
CV_SetValue(&cv_usejoystick[pnum], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
if (choice <= numcontrollers)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick[pnum], cv_usejoystick[pnum].value);
|
||||
|
||||
if (oldchoice > numjoys) /* reset this so the comparison is valid*/
|
||||
if (oldchoice > numcontrollers) /* reset this so the comparison is valid*/
|
||||
oldchoice = cv_usejoystick[pnum].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick[pnum], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
if (choice && oldstringchoice > numcontrollers) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick[pnum], (oldstringchoice > numcontrollers ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick[pnum].string) > numjoys ? atoi(cv_usejoystick[pnum].string) : cv_usejoystick[pnum].value))
|
||||
(joynum > numcontrollers ? joynum : cv_usejoystick[pnum].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -9069,7 +9245,6 @@ static void M_AssignJoystick(INT32 choice)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
||||
switch (setupcontrolplayer)
|
||||
{
|
||||
case 4:
|
||||
@@ -10275,6 +10450,7 @@ void M_QuitResponse(INT32 ch)
|
||||
|
||||
if (ch != 'y' && ch != KEY_ENTER)
|
||||
return;
|
||||
|
||||
if (!(netgame || cv_debug))
|
||||
{
|
||||
mrand = M_RandomKey(sizeof(quitsounds)/sizeof(INT32));
|
||||
@@ -10291,6 +10467,7 @@ void M_QuitResponse(INT32 ch)
|
||||
I_UpdateTime(cv_timescale.value);
|
||||
}
|
||||
}
|
||||
|
||||
I_Quit();
|
||||
}
|
||||
|
||||
|
||||
@@ -314,6 +314,8 @@ void M_ResetDemoList(void);
|
||||
void M_ReplayHut(INT32 choice);
|
||||
void M_SetPlaybackMenuPointer(void);
|
||||
|
||||
void Nextmap_OnChange(void);
|
||||
|
||||
void M_RefreshPauseMenu(void);
|
||||
|
||||
INT32 HU_GetHighlightColor(void);
|
||||
|
||||
+2
-186
@@ -2649,191 +2649,7 @@ menu_t OP_ForkedBirdDef = {
|
||||
|
||||
menu_t OP_LocalSkinDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_ForkedBirdDef, 30, 60, NULL);
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// CVAR ONCHANGE EVENTS GO HERE
|
||||
// ==========================================================================
|
||||
// (there's only a couple anyway)
|
||||
|
||||
// Nextmap. Used for Time Attack.
|
||||
static void Nextmap_OnChange(void)
|
||||
{
|
||||
char *leveltitle;
|
||||
UINT8 active;
|
||||
|
||||
// Update the string in the consvar.
|
||||
Z_Free(cv_nextmap.zstring);
|
||||
leveltitle = G_BuildMapTitle(cv_nextmap.value);
|
||||
cv_nextmap.string = cv_nextmap.zstring = leveltitle ? leveltitle : Z_StrDup(G_BuildMapName(cv_nextmap.value));
|
||||
|
||||
if (currentMenu == &SP_TimeAttackDef)
|
||||
{
|
||||
// see also p_setup.c's P_LoadRecordGhosts
|
||||
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
|
||||
char *gpath = malloc(glen);
|
||||
INT32 i;
|
||||
|
||||
if (!gpath)
|
||||
return;
|
||||
|
||||
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
|
||||
|
||||
CV_StealthSetValue(&cv_dummystaff, 0);
|
||||
|
||||
active = false;
|
||||
SP_TimeAttackMenu[taguest].status = IT_DISABLED;
|
||||
SP_TimeAttackMenu[tareplay].status = IT_DISABLED;
|
||||
|
||||
// Check if file exists, if not, disable REPLAY option
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
SP_ReplayMenu[i].status = IT_DISABLED;
|
||||
SP_GuestReplayMenu[i].status = IT_DISABLED;
|
||||
}
|
||||
SP_ReplayMenu[4].status = IT_DISABLED;
|
||||
|
||||
SP_GhostMenu[3].status = IT_DISABLED;
|
||||
SP_GhostMenu[4].status = IT_DISABLED;
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string))) {
|
||||
SP_ReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string))) {
|
||||
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string))) {
|
||||
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
|
||||
if (FIL_FileExists(va("%s-guest.lmp", gpath)))
|
||||
{
|
||||
SP_ReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GhostMenu[3].status = IT_STRING|IT_CVAR;
|
||||
active |= 3;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_dummystaff, 1);
|
||||
if (cv_dummystaff.value)
|
||||
{
|
||||
SP_ReplayMenu[4].status = IT_WHITESTRING|IT_KEYHANDLER;
|
||||
SP_GhostMenu[4].status = IT_STRING|IT_CVAR;
|
||||
CV_StealthSetValue(&cv_dummystaff, 1);
|
||||
active |= 1;
|
||||
}
|
||||
|
||||
if (active) {
|
||||
if (active & 1)
|
||||
SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU;
|
||||
if (active & 2)
|
||||
SP_TimeAttackMenu[taguest].status = IT_WHITESTRING|IT_SUBMENU;
|
||||
}
|
||||
else if (itemOn == tareplay) // Reset lastOn so replay isn't still selected when not available.
|
||||
{
|
||||
currentMenu->lastOn = itemOn;
|
||||
itemOn = tastart;
|
||||
}
|
||||
|
||||
if (mapheaderinfo[cv_nextmap.value-1] && mapheaderinfo[cv_nextmap.value-1]->forcecharacter[0] != '\0')
|
||||
CV_Set(&cv_chooseskin, mapheaderinfo[cv_nextmap.value-1]->forcecharacter);
|
||||
|
||||
free(gpath);
|
||||
}
|
||||
}
|
||||
|
||||
static void Dummymenuplayer_OnChange(void)
|
||||
{
|
||||
if (cv_dummymenuplayer.value < 1)
|
||||
CV_StealthSetValue(&cv_dummymenuplayer, splitscreen+1);
|
||||
else if (cv_dummymenuplayer.value > splitscreen+1)
|
||||
CV_StealthSetValue(&cv_dummymenuplayer, 1);
|
||||
}
|
||||
|
||||
char dummystaffname[22];
|
||||
|
||||
static void Dummystaff_OnChange(void)
|
||||
{
|
||||
lumpnum_t l;
|
||||
|
||||
dummystaffname[0] = '\0';
|
||||
|
||||
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) == LUMPERROR)
|
||||
{
|
||||
CV_StealthSetValue(&cv_dummystaff, 0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *temp = dummystaffname;
|
||||
UINT8 numstaff = 1;
|
||||
while (numstaff < 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value),numstaff+1))) != LUMPERROR)
|
||||
numstaff++;
|
||||
|
||||
if (cv_dummystaff.value < 1)
|
||||
CV_StealthSetValue(&cv_dummystaff, numstaff);
|
||||
else if (cv_dummystaff.value > numstaff)
|
||||
CV_StealthSetValue(&cv_dummystaff, 1);
|
||||
|
||||
if ((l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value), cv_dummystaff.value))) == LUMPERROR)
|
||||
return; // shouldn't happen but might as well check...
|
||||
|
||||
G_UpdateStaffGhostName(l);
|
||||
|
||||
while (*temp)
|
||||
temp++;
|
||||
|
||||
sprintf(temp, " - %d", cv_dummystaff.value);
|
||||
}
|
||||
}
|
||||
|
||||
// Newgametype. Used for gametype changes.
|
||||
static void Newgametype_OnChange(void)
|
||||
{
|
||||
if (cv_nextmap.value && menuactive)
|
||||
{
|
||||
if (!mapheaderinfo[cv_nextmap.value-1])
|
||||
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
||||
|
||||
if ((cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || // SRB2kart
|
||||
((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)))
|
||||
{
|
||||
INT32 value = 0;
|
||||
|
||||
switch (cv_newgametype.value)
|
||||
{
|
||||
case GT_COOP:
|
||||
value = TOL_RACE; // SRB2kart
|
||||
break;
|
||||
case GT_COMPETITION:
|
||||
value = TOL_COMPETITION;
|
||||
break;
|
||||
case GT_RACE:
|
||||
value = TOL_RACE;
|
||||
break;
|
||||
case GT_MATCH:
|
||||
case GT_TEAMMATCH:
|
||||
value = TOL_MATCH;
|
||||
break;
|
||||
case GT_TAG:
|
||||
case GT_HIDEANDSEEK:
|
||||
value = TOL_TAG;
|
||||
break;
|
||||
case GT_CTF:
|
||||
value = TOL_CTF;
|
||||
break;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_nextmap, M_FindFirstMap(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Onchange functions to show/hide/move things in menus
|
||||
void Screenshot_option_Onchange(void)
|
||||
{
|
||||
OP_ScreenshotOptionsMenu[op_screenshot_folder].status =
|
||||
@@ -2910,7 +2726,7 @@ void Bird_menu_Onchange(void)
|
||||
OP_AdvancedBirdMenu[respawnfadein].status = status;
|
||||
}
|
||||
|
||||
//menu code is nice
|
||||
// menu code is nice
|
||||
void SaturnHud_menu_Onchange(void)
|
||||
{
|
||||
UINT16 status;
|
||||
|
||||
+2
-2
@@ -138,12 +138,12 @@ typedef struct levelinterpolator_s {
|
||||
fixed_t oldcx, oldcy, bakcx, bakcy;
|
||||
angle_t oldangle, bakangle;
|
||||
} polyobj;
|
||||
struct {
|
||||
/*struct {
|
||||
pslope_t *slope;
|
||||
vector3_t oldo, bako;
|
||||
vector2_t oldd, bakd;
|
||||
fixed_t oldzdelta, bakzdelta;
|
||||
} dynslope;
|
||||
} dynslope;*/
|
||||
};
|
||||
} levelinterpolator_t;
|
||||
|
||||
|
||||
+4
-4
@@ -994,12 +994,12 @@ static void Impl_HandleControllerAddedEvent(SDL_Event evt)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
|
||||
numcontrollers = I_NumJoys();
|
||||
|
||||
// update the menu
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
M_SetupJoystickMenu(0);
|
||||
|
||||
numcontrollers = I_NumJoys();
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (JoyInfo[i].dev == newcontroller)
|
||||
@@ -1056,11 +1056,11 @@ static void Impl_HandleControllerRemovedEvent(void)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
|
||||
numcontrollers = I_NumJoys();
|
||||
|
||||
// update the menu
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
M_SetupJoystickMenu(0);
|
||||
|
||||
numcontrollers = I_NumJoys();
|
||||
}
|
||||
|
||||
void I_GetEvent(void)
|
||||
|
||||
+1
-2
@@ -701,8 +701,7 @@ static void Y_UpdateRecordReplays(void)
|
||||
G_SaveGameData(false);
|
||||
|
||||
// Update timeattack menu's replay availability.
|
||||
CV_AddValue(&cv_nextmap, 1);
|
||||
CV_AddValue(&cv_nextmap, -1);
|
||||
Nextmap_OnChange();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user