mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-19 16:51:53 +00:00
Merge branch 'next' into jetfume-skin-flag
This commit is contained in:
commit
860017ad32
15 changed files with 166 additions and 73 deletions
|
@ -7,6 +7,30 @@ Windows x64:
|
|||
|
||||
allow_failure: true
|
||||
|
||||
cache:
|
||||
- key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
|
||||
fallback_keys:
|
||||
- ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
|
||||
- ccache-$CI_JOB_NAME_SLUG-master
|
||||
paths:
|
||||
- build/ccache
|
||||
- build/ccache_statslog
|
||||
|
||||
- key: apt-$CI_JOB_IMAGE
|
||||
paths:
|
||||
- build/apt-cache
|
||||
unprotect: true
|
||||
|
||||
- key: vcpkg-root
|
||||
paths:
|
||||
- build/vcpkg-root
|
||||
unprotect: true
|
||||
|
||||
- key: vcpkg-binary-cache-x64-mingw-static
|
||||
paths:
|
||||
- build/vcpkg-binary-cache
|
||||
unprotect: true
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "build.cmake/bin/"
|
||||
|
@ -20,6 +44,27 @@ Windows x64:
|
|||
CXX: /usr/lib/ccache/x86_64-w64-mingw32-g++
|
||||
|
||||
script:
|
||||
- |
|
||||
# vcpkg
|
||||
echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg"
|
||||
|
||||
if [ -d "build/vcpkg-root" ]; then
|
||||
pushd build/vcpkg-root
|
||||
git fetch https://github.com/Microsoft/vcpkg master
|
||||
git reset --hard FETCH_HEAD
|
||||
popd
|
||||
else
|
||||
mkdir -p build
|
||||
git clone https://github.com/Microsoft/vcpkg build/vcpkg-root
|
||||
fi
|
||||
|
||||
export VCPKG_ROOT=$(pwd)/build/vcpkg-root
|
||||
export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
|
||||
|
||||
mkdir -p "build/vcpkg-binary-cache"
|
||||
|
||||
echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
|
@ -39,7 +84,7 @@ Windows x64:
|
|||
- - |
|
||||
# cmake
|
||||
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
|
||||
- cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake
|
||||
- cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake -G "Unix Makefiles"
|
||||
- |
|
||||
# cmake
|
||||
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
|
||||
|
@ -51,3 +96,33 @@ Windows x64:
|
|||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
after_script:
|
||||
- - |
|
||||
# apt_clean
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages"
|
||||
- apt-get autoclean
|
||||
- |
|
||||
# apt_clean
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
|
||||
|
||||
- - |
|
||||
# vcpkg_clean
|
||||
echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root"
|
||||
|
||||
if [ -d "build/vcpkg-root" ]; then
|
||||
pushd "build/vcpkg-root"
|
||||
git clean -f
|
||||
popd
|
||||
fi
|
||||
|
||||
echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K"
|
||||
|
||||
- - |
|
||||
# ccache_stats
|
||||
echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
|
||||
- ccache --show-stats
|
||||
- ccache --show-log-stats || true
|
||||
- |
|
||||
# ccahe_stats
|
||||
echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"
|
||||
|
|
|
@ -3,10 +3,6 @@ Windows x86:
|
|||
|
||||
stage: build
|
||||
|
||||
when: manual
|
||||
|
||||
allow_failure: true
|
||||
|
||||
cache:
|
||||
- key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
|
||||
fallback_keys:
|
||||
|
@ -33,8 +29,8 @@ Windows x86:
|
|||
|
||||
artifacts:
|
||||
paths:
|
||||
- "build/ninja-x86_mingw_static_vcpkg-debug/bin/"
|
||||
- "build/ninja-x86_mingw_static_vcpkg-debug/src/config.h"
|
||||
- "build.cmake/bin/"
|
||||
- "build.cmake/src/config.h"
|
||||
expose_as: "Win32"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
|
||||
|
||||
|
@ -59,7 +55,7 @@ Windows x86:
|
|||
fi
|
||||
|
||||
export VCPKG_ROOT=$(pwd)/build/vcpkg-root
|
||||
export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
|
||||
export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
|
||||
|
||||
mkdir -p "build/vcpkg-binary-cache"
|
||||
|
||||
|
@ -84,7 +80,7 @@ Windows x86:
|
|||
- - |
|
||||
# cmake
|
||||
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
|
||||
- cmake -B build.cmake --preset ninja-x86_mingw_static_vcpkg-debug -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON
|
||||
- cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake -G "Unix Makefiles"
|
||||
- |
|
||||
# cmake
|
||||
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
|
||||
|
@ -92,7 +88,7 @@ Windows x86:
|
|||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- cmake -build build.cmake --parallel 1 --verbose --preset ninja-x86_mingw_static_vcpkg-debug
|
||||
- cmake --build build.cmake --parallel 1 --verbose
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
|
|
@ -464,8 +464,13 @@ else()
|
|||
endif()
|
||||
|
||||
if(TARGET miniupnpc::miniupnpc)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
|
||||
if("${VCPKG_TARGET_TRIPLET}" MATCHES "-mingw-static$")
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC -DMINIUPNP_STATICLIB)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc -liphlpapi)
|
||||
else()
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
|
||||
endif()
|
||||
message(STATUS "miniupnpc Found")
|
||||
else()
|
||||
message(STATUS "No miniupnpc Found")
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef enum
|
|||
SF_JETFUME = 1<<14, // Follow item uses Metal Sonic's jet fume behavior
|
||||
SF_MULTIABILITY = 1<<15, // Revenge of Final Demo.
|
||||
SF_NONIGHTSROTATION = 1<<16, // Disable sprite rotation for NiGHTS
|
||||
SF_NONIGHTSSUPER = 1<<17, // Disable super colors for NiGHTS (if you have SF_SUPER)
|
||||
SF_NONIGHTSSUPER = 1<<17, // Disable super sprites and colors for NiGHTS
|
||||
SF_NOSUPERSPRITES = 1<<18, // Don't use super sprites while super
|
||||
SF_NOSUPERJUMPBOOST = 1<<19, // Disable the jump boost given while super (i.e. Knuckles)
|
||||
SF_CANBUSTWALLS = 1<<20, // Can naturally bust walls on contact? (i.e. Knuckles)
|
||||
|
|
|
@ -256,8 +256,8 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||
}
|
||||
|
||||
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
||||
cx = -1 + (cx / (vid.width/2));
|
||||
cy = 1 - (cy / (vid.height/2));
|
||||
cx = -1.0f + (cx / (vid.width / 2.0f));
|
||||
cy = 1.0f - (cy / (vid.height / 2.0f));
|
||||
|
||||
// fwidth and fheight are similar
|
||||
fwidth /= vid.width / 2;
|
||||
|
|
|
@ -3166,7 +3166,10 @@ static int lib_rCheckTextureNumForName(lua_State *L)
|
|||
{
|
||||
const char *name = luaL_checkstring(L, 1);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_CheckTextureNumForName(name));
|
||||
INT32 num = R_CheckTextureNumForName(name, TEXTURETYPE_TEXTURE);
|
||||
if (num == -1)
|
||||
num = R_CheckTextureNumForName(name, TEXTURETYPE_FLAT);
|
||||
lua_pushinteger(L, num);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -673,6 +673,7 @@ void D_QuitNetGame(void)
|
|||
HSendPacket(servernode, true, 0, 0);
|
||||
}
|
||||
|
||||
seenplayer = NULL;
|
||||
D_CloseConnection();
|
||||
ClearAdminPlayers();
|
||||
|
||||
|
|
|
@ -609,15 +609,15 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
|
|||
levelflat->type = LEVELFLAT_TEXTURE;
|
||||
|
||||
// Look for a flat
|
||||
int texturenum = R_CheckFlatNumForName(levelflat->name);
|
||||
int texturenum = R_CheckTextureNumForName(levelflat->name, TEXTURETYPE_FLAT);
|
||||
if (texturenum < 0)
|
||||
{
|
||||
// If we can't find a flat, try looking for a texture!
|
||||
texturenum = R_CheckTextureNumForName(levelflat->name);
|
||||
texturenum = R_CheckTextureNumForName(levelflat->name, TEXTURETYPE_TEXTURE);
|
||||
if (texturenum < 0)
|
||||
{
|
||||
// Use "not found" texture
|
||||
texturenum = R_CheckTextureNumForName("REDWALL");
|
||||
texturenum = R_CheckTextureNumForName("REDWALL", TEXTURETYPE_TEXTURE);
|
||||
|
||||
// Give up?
|
||||
if (texturenum < 0)
|
||||
|
|
|
@ -1046,15 +1046,37 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope)
|
|||
{
|
||||
vector3_t slopemom, axis;
|
||||
angle_t ang;
|
||||
angle_t advanceAng = ANG15;
|
||||
const boolean upwards = (slope->zangle < ANGLE_180);
|
||||
|
||||
if (slope->flags & SL_NOPHYSICS)
|
||||
return 0;
|
||||
|
||||
// If there's physics, time for launching.
|
||||
// Doesn't kill the vertical momentum as much as P_SlopeLaunch does.
|
||||
ang = slope->zangle + ANG15*((slope->zangle > 0) ? 1 : -1);
|
||||
if (ang > ANGLE_90 && ang < ANGLE_180)
|
||||
ang = ((slope->zangle > 0) ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards
|
||||
ang = slope->zangle;
|
||||
|
||||
// for the time being, let's pretend the slope inclines upwards only
|
||||
if (!upwards)
|
||||
{
|
||||
ang += ANGLE_180;
|
||||
}
|
||||
|
||||
// angles past 90 degrees need to shrink to get closer to 90 degrees
|
||||
if (ang > ANGLE_90)
|
||||
{
|
||||
advanceAng = InvAngle(advanceAng);
|
||||
}
|
||||
|
||||
// now we set the actual final angle
|
||||
if ((ang > ANGLE_90) != (ang + advanceAng > ANGLE_90)) // does advancing the angle push it past directly upwards?
|
||||
{
|
||||
ang = (upwards ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = slope->zangle + advanceAng;
|
||||
}
|
||||
|
||||
slopemom.x = mo->momx;
|
||||
slopemom.y = mo->momy;
|
||||
|
|
14
src/p_spec.c
14
src/p_spec.c
|
@ -135,22 +135,24 @@ void P_ParseAnimationDefintion(SINT8 istexture);
|
|||
|
||||
static boolean P_FindTextureForAnimation(anim_t *anim, animdef_t *animdef)
|
||||
{
|
||||
if (R_CheckTextureNumForName(animdef->startname) == -1)
|
||||
INT32 start = R_CheckTextureNumForName(animdef->startname, TEXTURETYPE_TEXTURE);
|
||||
if (start == -1)
|
||||
return false;
|
||||
|
||||
anim->picnum = R_TextureNumForName(animdef->endname);
|
||||
anim->basepic = R_TextureNumForName(animdef->startname);
|
||||
anim->basepic = start;
|
||||
anim->picnum = R_CheckTextureNumForName(animdef->endname, TEXTURETYPE_TEXTURE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean P_FindFlatForAnimation(anim_t *anim, animdef_t *animdef)
|
||||
{
|
||||
if (R_CheckFlatNumForName(animdef->startname) == -1)
|
||||
INT32 start = R_CheckTextureNumForName(animdef->startname, TEXTURETYPE_FLAT);
|
||||
if (start == -1)
|
||||
return false;
|
||||
|
||||
anim->picnum = R_CheckFlatNumForName(animdef->endname);
|
||||
anim->basepic = R_CheckFlatNumForName(animdef->startname);
|
||||
anim->basepic = start;
|
||||
anim->picnum = R_CheckTextureNumForName(animdef->endname, TEXTURETYPE_FLAT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3310,6 +3310,7 @@ static void P_DoPlayerHeadSigns(player_t *player)
|
|||
sign->frame = 2|FF_FULLBRIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!P_MobjWasRemoved(sign) && splitscreen) // Hide the sign from yourself in splitscreen - In single-screen, it wouldn't get spawned if it shouldn't be visible
|
||||
{
|
||||
|
@ -3347,7 +3348,6 @@ static void P_DoPlayerHeadSigns(player_t *player)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2024 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2025 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -182,8 +182,8 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
|||
|
||||
R_CalculatePlaneRipple(currentplane->viewangle + currentplane->plangle);
|
||||
|
||||
ds_xfrac += planeripple.xfrac;
|
||||
ds_yfrac += planeripple.yfrac;
|
||||
ds_xfrac += FixedMul(planeripple.xfrac, currentplane->xscale);
|
||||
ds_yfrac += FixedMul(planeripple.yfrac, currentplane->yscale);
|
||||
ds_bgofs >>= FRACBITS;
|
||||
|
||||
if ((y + ds_bgofs) >= viewheight)
|
||||
|
|
|
@ -80,10 +80,19 @@ UINT16 P_ApplySuperFlagToSprite2(UINT16 spr2, mobj_t *mobj)
|
|||
{
|
||||
if (mobj->player)
|
||||
{
|
||||
if (mobj->player->charflags & SF_NOSUPERSPRITES || (mobj->player->powers[pw_carry] == CR_NIGHTSMODE && (mobj->player->charflags & SF_NONIGHTSSUPER)))
|
||||
boolean is_nights = mobj->player->powers[pw_carry] == CR_NIGHTSMODE;
|
||||
|
||||
if (mobj->player->charflags & SF_NOSUPERSPRITES || (is_nights && (mobj->player->charflags & SF_NONIGHTSSUPER)))
|
||||
spr2 &= ~SPR2F_SUPER;
|
||||
else if (mobj->player->powers[pw_super] || (mobj->player->powers[pw_carry] == CR_NIGHTSMODE && (mobj->player->charflags & SF_SUPER)))
|
||||
else if (mobj->player->powers[pw_super] || (is_nights && (mobj->player->charflags & SF_SUPER)))
|
||||
spr2 |= SPR2F_SUPER;
|
||||
|
||||
// Special case for transforming when you are NiGHTS.
|
||||
// Do NOT apply the super sprites in this situation, even if they exist.
|
||||
if (is_nights && mobj->state >= &states[S_PLAY_NIGHTS_TRANS1] && mobj->state <= &states[S_PLAY_NIGHTS_TRANS6])
|
||||
{
|
||||
spr2 &= ~SPR2F_SUPER;
|
||||
}
|
||||
}
|
||||
|
||||
if (spr2 & SPR2F_SUPER)
|
||||
|
|
|
@ -925,7 +925,7 @@ Rloadtextures (INT32 i, INT32 w)
|
|||
|
||||
// printf("\"%s\" (wad: %u, lump: %u) is a single patch, dimensions %d x %d\n",W_CheckNameForNumPwad(wadnum,lumpnum),wadnum,lumpnum,width,height);
|
||||
|
||||
R_AddSinglePatchTexture(i, wadnum, lumpnum, width, height, TEXTURETYPE_SINGLEPATCH);
|
||||
R_AddSinglePatchTexture(i, wadnum, lumpnum, width, height, TEXTURETYPE_TEXTURE);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@ -1494,7 +1494,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||
resultTexture->hash = quickncasehash(newTextureName, 8);
|
||||
resultTexture->width = newTextureWidth;
|
||||
resultTexture->height = newTextureHeight;
|
||||
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
||||
resultTexture->type = TEXTURETYPE_TEXTURE;
|
||||
}
|
||||
Z_Free(texturesToken);
|
||||
texturesToken = M_GetToken(NULL);
|
||||
|
@ -1680,7 +1680,7 @@ static void AddTextureToCache(const char *name, UINT32 hash, INT32 id, UINT8 typ
|
|||
//
|
||||
// Check whether texture is available. Filter out NoTexture indicator.
|
||||
//
|
||||
INT32 R_CheckTextureNumForName(const char *name)
|
||||
INT32 R_CheckTextureNumForName(const char *name, UINT8 type)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 hash;
|
||||
|
@ -1692,14 +1692,14 @@ INT32 R_CheckTextureNumForName(const char *name)
|
|||
hash = quickncasehash(name, 8);
|
||||
|
||||
for (i = 0; i < tidcachelen; i++)
|
||||
if (tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
|
||||
if (tidcache[i].type == type && tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
|
||||
return tidcache[i].id;
|
||||
|
||||
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
||||
for (i = numtextures - 1; i >= 0; i--)
|
||||
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8))
|
||||
if (textures[i]->type == type && textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8))
|
||||
{
|
||||
AddTextureToCache(name, hash, i, textures[i]->type);
|
||||
AddTextureToCache(name, hash, i, type);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -1738,47 +1738,29 @@ const char *R_TextureNameForNum(INT32 num)
|
|||
//
|
||||
// R_TextureNumForName
|
||||
//
|
||||
// Calls R_CheckTextureNumForName, aborts with error message.
|
||||
// Calls R_CheckTextureNumForName. Returns REDWALL if not found.
|
||||
//
|
||||
INT32 R_TextureNumForName(const char *name)
|
||||
{
|
||||
const INT32 i = R_CheckTextureNumForName(name);
|
||||
INT32 i = R_CheckTextureNumForName(name, TEXTURETYPE_TEXTURE);
|
||||
|
||||
// Didn't find it, so look for a flat
|
||||
if (i == -1)
|
||||
{
|
||||
i = R_CheckTextureNumForName(name, TEXTURETYPE_FLAT);
|
||||
}
|
||||
|
||||
// Still didn't find it, so return REDWALL
|
||||
if (i == -1)
|
||||
{
|
||||
static INT32 redwall = -2;
|
||||
CONS_Debug(DBG_SETUP, "WARNING: R_TextureNumForName: %.8s not found\n", name);
|
||||
if (redwall == -2)
|
||||
redwall = R_CheckTextureNumForName("REDWALL");
|
||||
redwall = R_CheckTextureNumForName("REDWALL", TEXTURETYPE_TEXTURE);
|
||||
if (redwall != -1)
|
||||
return redwall;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
// Like R_CheckTextureNumForName, but only looks in the flat namespace specifically.
|
||||
INT32 R_CheckFlatNumForName(const char *name)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 hash;
|
||||
|
||||
// "NoTexture" marker.
|
||||
if (name[0] == '-')
|
||||
return 0;
|
||||
|
||||
hash = quickncasehash(name, 8);
|
||||
|
||||
for (i = 0; i < tidcachelen; i++)
|
||||
if (tidcache[i].type == TEXTURETYPE_FLAT && tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
|
||||
return tidcache[i].id;
|
||||
|
||||
for (i = numtextures - 1; i >= 0; i--)
|
||||
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8) && textures[i]->type == TEXTURETYPE_FLAT)
|
||||
{
|
||||
AddTextureToCache(name, hash, i, TEXTURETYPE_FLAT);
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ typedef struct
|
|||
enum
|
||||
{
|
||||
TEXTURETYPE_UNKNOWN,
|
||||
TEXTURETYPE_SINGLEPATCH,
|
||||
TEXTURETYPE_COMPOSITE,
|
||||
TEXTURETYPE_TEXTURE,
|
||||
TEXTURETYPE_FLAT
|
||||
};
|
||||
|
||||
|
@ -100,8 +99,7 @@ void R_SetFlatVars(size_t length);
|
|||
|
||||
// Returns the texture number for the texture name.
|
||||
INT32 R_TextureNumForName(const char *name);
|
||||
INT32 R_CheckTextureNumForName(const char *name);
|
||||
INT32 R_CheckFlatNumForName(const char *name);
|
||||
INT32 R_CheckTextureNumForName(const char *name, UINT8 type);
|
||||
|
||||
// Returns the texture name for the texture number (in case you ever needed it)
|
||||
const char *R_CheckTextureNameForNum(INT32 num);
|
||||
|
|
Loading…
Reference in a new issue