mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-16 09:42:57 +00:00
Merge branch 'public_next' into master
This commit is contained in:
commit
d09016c808
14 changed files with 608 additions and 23 deletions
33
.travis.yml
Normal file
33
.travis.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
language: c
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
env:
|
||||
- CFLAGS=-Wno-absolute-value -Werror
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/srb2_cache
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsdl2-mixer-dev
|
||||
- libpng-dev
|
||||
- libgl1-mesa-dev
|
||||
- libgme-dev
|
||||
- p7zip-full
|
||||
|
||||
before_script:
|
||||
- mkdir $HOME/srb2_cache
|
||||
- wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O $HOME/srb2_cache/SRB2-v2114-Installer.exe
|
||||
- 7z x $HOME/srb2_cache/SRB2-v2114-Installer.exe -oassets
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ..
|
||||
|
||||
script: make
|
|
@ -80,9 +80,6 @@ endif()
|
|||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
add_definitions(-DMACOSX)
|
||||
if(${CMAKE_C_COMPILER_ID} MATCHES "Clang")
|
||||
set(CLANG ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
|
|
@ -168,7 +168,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||
p_tick.h
|
||||
)
|
||||
|
||||
if(NOT CLANG)
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
|
||||
endif()
|
||||
|
||||
|
@ -406,10 +406,14 @@ endif()
|
|||
|
||||
# Compatibility flag with later versions of GCC
|
||||
# We should really fix our code to not need this
|
||||
if(NOT CLANG AND NOT MSVC)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
|
||||
endif()
|
||||
|
||||
add_definitions(-DCMAKECONFIG)
|
||||
|
||||
#add_library(SRB2Core STATIC
|
||||
|
@ -431,4 +435,4 @@ endif()
|
|||
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
|||
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
{
|
||||
cmd->forwardmove = sonic->player->cmd.forwardmove;
|
||||
cmd->angleturn = abs(tails->angle - sonic->angle)>>16;
|
||||
cmd->angleturn = abs((tails->angle - sonic->angle))>>16;
|
||||
if (sonic->angle < tails->angle)
|
||||
cmd->angleturn = -cmd->angleturn;
|
||||
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
|
||||
|
|
|
@ -603,7 +603,7 @@ static void F_IntroDrawScene(void)
|
|||
|
||||
if (finalecount-84 < 58) { // Pure Fat is driving up!
|
||||
int ftime = (finalecount-84);
|
||||
x = (-189<<FRACBITS) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
||||
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "../r_things.h"
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "../v_video.h"
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
@ -881,6 +882,59 @@ static void md2_loadTexture(md2_t *model)
|
|||
HWR_UnlockCachedPatch(grpatch);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// md2_loadBlendTexture : Download a pcx or png texture for blending MD2 models
|
||||
// -----------------+
|
||||
static void md2_loadBlendTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
|
||||
strcpy(filename, model->filename);
|
||||
|
||||
FIL_ForceExtension(filename, "_blend.png");
|
||||
|
||||
if (model->blendgrpatch)
|
||||
{
|
||||
grpatch = model->blendgrpatch;
|
||||
Z_Free(grpatch->mipmap.grInfo.data);
|
||||
}
|
||||
else
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendgrpatch));
|
||||
|
||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap.grInfo.format == 0)
|
||||
#endif
|
||||
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap.grInfo.format == 0)
|
||||
{
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap.downloaded = 0;
|
||||
grpatch->mipmap.flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap.width = (UINT16)w;
|
||||
grpatch->mipmap.height = (UINT16)h;
|
||||
|
||||
// not correct!
|
||||
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
}
|
||||
HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
}
|
||||
|
||||
// Don't spam the console, or the OS with fopen requests!
|
||||
static boolean nomd2s = false;
|
||||
|
||||
|
@ -1050,6 +1104,490 @@ spritemd2found:
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
|
||||
if (grmip->width == 0)
|
||||
{
|
||||
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grmip->flags = 0;
|
||||
// setup the texture info
|
||||
grmip->grInfo.format = GR_RGBA;
|
||||
}
|
||||
|
||||
Z_Free(grmip->grInfo.data);
|
||||
grmip->grInfo.data = NULL;
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap.grInfo.data;
|
||||
blendimage = blendgpatch->mipmap.grInfo.data;
|
||||
|
||||
switch (color)
|
||||
{
|
||||
case SKINCOLOR_WHITE:
|
||||
blendcolor = V_GetColor(3);
|
||||
break;
|
||||
case SKINCOLOR_SILVER:
|
||||
blendcolor = V_GetColor(10);
|
||||
break;
|
||||
case SKINCOLOR_GREY:
|
||||
blendcolor = V_GetColor(15);
|
||||
break;
|
||||
case SKINCOLOR_BLACK:
|
||||
blendcolor = V_GetColor(27);
|
||||
break;
|
||||
case SKINCOLOR_CYAN:
|
||||
blendcolor = V_GetColor(215);
|
||||
break;
|
||||
case SKINCOLOR_TEAL:
|
||||
blendcolor = V_GetColor(221);
|
||||
break;
|
||||
case SKINCOLOR_STEELBLUE:
|
||||
blendcolor = V_GetColor(203);
|
||||
break;
|
||||
case SKINCOLOR_BLUE:
|
||||
blendcolor = V_GetColor(232);
|
||||
break;
|
||||
case SKINCOLOR_PEACH:
|
||||
blendcolor = V_GetColor(71);
|
||||
break;
|
||||
case SKINCOLOR_TAN:
|
||||
blendcolor = V_GetColor(79);
|
||||
break;
|
||||
case SKINCOLOR_PINK:
|
||||
blendcolor = V_GetColor(147);
|
||||
break;
|
||||
case SKINCOLOR_LAVENDER:
|
||||
blendcolor = V_GetColor(251);
|
||||
break;
|
||||
case SKINCOLOR_PURPLE:
|
||||
blendcolor = V_GetColor(195);
|
||||
break;
|
||||
case SKINCOLOR_ORANGE:
|
||||
blendcolor = V_GetColor(87);
|
||||
break;
|
||||
case SKINCOLOR_ROSEWOOD:
|
||||
blendcolor = V_GetColor(94);
|
||||
break;
|
||||
case SKINCOLOR_BEIGE:
|
||||
blendcolor = V_GetColor(40);
|
||||
break;
|
||||
case SKINCOLOR_BROWN:
|
||||
blendcolor = V_GetColor(57);
|
||||
break;
|
||||
case SKINCOLOR_RED:
|
||||
blendcolor = V_GetColor(130);
|
||||
break;
|
||||
case SKINCOLOR_DARKRED:
|
||||
blendcolor = V_GetColor(139);
|
||||
break;
|
||||
case SKINCOLOR_NEONGREEN:
|
||||
blendcolor = V_GetColor(184);
|
||||
break;
|
||||
case SKINCOLOR_GREEN:
|
||||
blendcolor = V_GetColor(166);
|
||||
break;
|
||||
case SKINCOLOR_ZIM:
|
||||
blendcolor = V_GetColor(180);
|
||||
break;
|
||||
case SKINCOLOR_OLIVE:
|
||||
blendcolor = V_GetColor(108);
|
||||
break;
|
||||
case SKINCOLOR_YELLOW:
|
||||
blendcolor = V_GetColor(104);
|
||||
break;
|
||||
case SKINCOLOR_GOLD:
|
||||
blendcolor = V_GetColor(115);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SUPER1:
|
||||
blendcolor = V_GetColor(97);
|
||||
break;
|
||||
case SKINCOLOR_SUPER2:
|
||||
blendcolor = V_GetColor(100);
|
||||
break;
|
||||
case SKINCOLOR_SUPER3:
|
||||
blendcolor = V_GetColor(103);
|
||||
break;
|
||||
case SKINCOLOR_SUPER4:
|
||||
blendcolor = V_GetColor(113);
|
||||
break;
|
||||
case SKINCOLOR_SUPER5:
|
||||
blendcolor = V_GetColor(116);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TSUPER1:
|
||||
blendcolor = V_GetColor(81);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER2:
|
||||
blendcolor = V_GetColor(82);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER3:
|
||||
blendcolor = V_GetColor(84);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER4:
|
||||
blendcolor = V_GetColor(85);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER5:
|
||||
blendcolor = V_GetColor(87);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_KSUPER1:
|
||||
blendcolor = V_GetColor(122);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER2:
|
||||
blendcolor = V_GetColor(123);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER3:
|
||||
blendcolor = V_GetColor(124);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER4:
|
||||
blendcolor = V_GetColor(125);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER5:
|
||||
blendcolor = V_GetColor(126);
|
||||
break;
|
||||
default:
|
||||
blendcolor = V_GetColor(247);
|
||||
break;
|
||||
}
|
||||
|
||||
while (size--)
|
||||
{
|
||||
if (blendimage->s.alpha == 0)
|
||||
{
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
cur->rgba = image->rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 tempcolor;
|
||||
INT16 tempmult, tempalpha;
|
||||
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
|
||||
if (tempalpha > 255)
|
||||
tempalpha = 255;
|
||||
else if (tempalpha < 0)
|
||||
tempalpha = 0;
|
||||
|
||||
tempmult = (blendimage->s.red-127)*2;
|
||||
if (tempmult > 255)
|
||||
tempmult = 255;
|
||||
else if (tempmult < 0)
|
||||
tempmult = 0;
|
||||
|
||||
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
|
||||
cur++; image++; blendimage++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
{
|
||||
if (grmip->downloaded && grmip->grInfo.data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If here, the blended texture has not been created
|
||||
// So we create it
|
||||
|
||||
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
|
||||
if (grmip->width == 0)
|
||||
{
|
||||
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grmip->flags = 0;
|
||||
// setup the texture info
|
||||
grmip->grInfo.format = GR_RGBA;
|
||||
}
|
||||
|
||||
Z_Free(grmip->grInfo.data);
|
||||
grmip->grInfo.data = NULL;
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap.grInfo.data;
|
||||
blendimage = blendgpatch->mipmap.grInfo.data;
|
||||
|
||||
switch (color)
|
||||
{
|
||||
case SKINCOLOR_WHITE:
|
||||
blendcolor = V_GetColor(3);
|
||||
break;
|
||||
case SKINCOLOR_SILVER:
|
||||
blendcolor = V_GetColor(10);
|
||||
break;
|
||||
case SKINCOLOR_GREY:
|
||||
blendcolor = V_GetColor(15);
|
||||
break;
|
||||
case SKINCOLOR_BLACK:
|
||||
blendcolor = V_GetColor(27);
|
||||
break;
|
||||
case SKINCOLOR_CYAN:
|
||||
blendcolor = V_GetColor(215);
|
||||
break;
|
||||
case SKINCOLOR_TEAL:
|
||||
blendcolor = V_GetColor(221);
|
||||
break;
|
||||
case SKINCOLOR_STEELBLUE:
|
||||
blendcolor = V_GetColor(203);
|
||||
break;
|
||||
case SKINCOLOR_BLUE:
|
||||
blendcolor = V_GetColor(232);
|
||||
break;
|
||||
case SKINCOLOR_PEACH:
|
||||
blendcolor = V_GetColor(71);
|
||||
break;
|
||||
case SKINCOLOR_TAN:
|
||||
blendcolor = V_GetColor(79);
|
||||
break;
|
||||
case SKINCOLOR_PINK:
|
||||
blendcolor = V_GetColor(147);
|
||||
break;
|
||||
case SKINCOLOR_LAVENDER:
|
||||
blendcolor = V_GetColor(251);
|
||||
break;
|
||||
case SKINCOLOR_PURPLE:
|
||||
blendcolor = V_GetColor(195);
|
||||
break;
|
||||
case SKINCOLOR_ORANGE:
|
||||
blendcolor = V_GetColor(87);
|
||||
break;
|
||||
case SKINCOLOR_ROSEWOOD:
|
||||
blendcolor = V_GetColor(94);
|
||||
break;
|
||||
case SKINCOLOR_BEIGE:
|
||||
blendcolor = V_GetColor(40);
|
||||
break;
|
||||
case SKINCOLOR_BROWN:
|
||||
blendcolor = V_GetColor(57);
|
||||
break;
|
||||
case SKINCOLOR_RED:
|
||||
blendcolor = V_GetColor(130);
|
||||
break;
|
||||
case SKINCOLOR_DARKRED:
|
||||
blendcolor = V_GetColor(139);
|
||||
break;
|
||||
case SKINCOLOR_NEONGREEN:
|
||||
blendcolor = V_GetColor(184);
|
||||
break;
|
||||
case SKINCOLOR_GREEN:
|
||||
blendcolor = V_GetColor(166);
|
||||
break;
|
||||
case SKINCOLOR_ZIM:
|
||||
blendcolor = V_GetColor(180);
|
||||
break;
|
||||
case SKINCOLOR_OLIVE:
|
||||
blendcolor = V_GetColor(108);
|
||||
break;
|
||||
case SKINCOLOR_YELLOW:
|
||||
blendcolor = V_GetColor(104);
|
||||
break;
|
||||
case SKINCOLOR_GOLD:
|
||||
blendcolor = V_GetColor(115);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SUPER1:
|
||||
blendcolor = V_GetColor(97);
|
||||
break;
|
||||
case SKINCOLOR_SUPER2:
|
||||
blendcolor = V_GetColor(100);
|
||||
break;
|
||||
case SKINCOLOR_SUPER3:
|
||||
blendcolor = V_GetColor(103);
|
||||
break;
|
||||
case SKINCOLOR_SUPER4:
|
||||
blendcolor = V_GetColor(113);
|
||||
break;
|
||||
case SKINCOLOR_SUPER5:
|
||||
blendcolor = V_GetColor(116);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TSUPER1:
|
||||
blendcolor = V_GetColor(81);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER2:
|
||||
blendcolor = V_GetColor(82);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER3:
|
||||
blendcolor = V_GetColor(84);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER4:
|
||||
blendcolor = V_GetColor(85);
|
||||
break;
|
||||
case SKINCOLOR_TSUPER5:
|
||||
blendcolor = V_GetColor(87);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_KSUPER1:
|
||||
blendcolor = V_GetColor(122);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER2:
|
||||
blendcolor = V_GetColor(123);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER3:
|
||||
blendcolor = V_GetColor(124);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER4:
|
||||
blendcolor = V_GetColor(125);
|
||||
break;
|
||||
case SKINCOLOR_KSUPER5:
|
||||
blendcolor = V_GetColor(126);
|
||||
break;
|
||||
default:
|
||||
blendcolor = V_GetColor(247);
|
||||
break;
|
||||
}
|
||||
|
||||
while (size--)
|
||||
{
|
||||
if (blendimage->s.alpha == 0)
|
||||
{
|
||||
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||
cur->rgba = image->rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 tempcolor;
|
||||
INT16 tempmult, tempalpha;
|
||||
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
|
||||
if (tempalpha > 255)
|
||||
tempalpha = 255;
|
||||
else if (tempalpha < 0)
|
||||
tempalpha = 0;
|
||||
|
||||
tempmult = (blendimage->s.red-127)*2;
|
||||
if (tempmult > 255)
|
||||
tempmult = 255;
|
||||
else if (tempmult < 0)
|
||||
tempmult = 0;
|
||||
|
||||
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.red = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.green = (UINT8)tempcolor;
|
||||
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
|
||||
cur->s.blue = (UINT8)tempcolor;
|
||||
cur->s.alpha = image->s.alpha;
|
||||
}
|
||||
|
||||
cur++; image++; blendimage++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
{
|
||||
if (grmip->downloaded && grmip->grInfo.data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If here, the blended texture has not been created
|
||||
// So we create it
|
||||
|
||||
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
|
@ -1180,13 +1718,25 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
gpatch = md2->grpatch;
|
||||
if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded)
|
||||
md2_loadTexture(md2);
|
||||
|
||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
|
||||
if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded))
|
||||
md2_loadBlendTexture(md2);
|
||||
|
||||
if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
{
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -120,6 +120,7 @@ typedef struct
|
|||
float offset;
|
||||
md2_model_t *model;
|
||||
void *grpatch;
|
||||
void *blendgrpatch;
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
} md2_t;
|
||||
|
|
|
@ -4266,7 +4266,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
MT_GOOP, // painchance
|
||||
sfx_dmpain, // painsound
|
||||
S_EGGMOBILE2_PAIN2, // meleestate
|
||||
MT_EGGMOBILE2_POGO, // missilestate
|
||||
(statenum_t)MT_EGGMOBILE2_POGO, // missilestate
|
||||
S_EGGMOBILE2_DIE1, // deathstate
|
||||
S_EGGMOBILE2_FLEE1,// xdeathstate
|
||||
sfx_cybdth, // deathsound
|
||||
|
|
|
@ -6074,7 +6074,7 @@ static void M_RoomMenu(INT32 choice)
|
|||
|
||||
for (i = 0; room_list[i].header.buffer[0]; i++)
|
||||
{
|
||||
if(room_list[i].name != '\0')
|
||||
if(*room_list[i].name != '\0')
|
||||
{
|
||||
MP_RoomMenu[i+1].text = room_list[i].name;
|
||||
roomIds[i] = room_list[i].id;
|
||||
|
|
|
@ -677,7 +677,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
|
|||
else
|
||||
snprintf(maptext, 8, "Unknown");
|
||||
|
||||
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl)
|
||||
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl[0] != '\0')
|
||||
snprintf(lvlttltext, 48, "%s%s%s",
|
||||
mapheaderinfo[gamemap-1]->lvlttl,
|
||||
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",
|
||||
|
|
|
@ -6362,7 +6362,7 @@ void A_Boss2PogoTarget(mobj_t *actor)
|
|||
|
||||
if (actor->info->missilestate) // spawn the pogo stick collision box
|
||||
{
|
||||
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, actor->info->missilestate);
|
||||
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, (mobjtype_t)actor->info->missilestate);
|
||||
pogo->target = actor;
|
||||
}
|
||||
|
||||
|
|
|
@ -2646,8 +2646,8 @@ isblocking:
|
|||
|
||||
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
|
||||
|
||||
if (((!slidemo->player->climbing && abs(slidemo->angle - ANGLE_90 - climbline) < ANGLE_45)
|
||||
|| (slidemo->player->climbing == 1 && abs(slidemo->angle - climbline) < ANGLE_135))
|
||||
if (((!slidemo->player->climbing && abs((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|
||||
|| (slidemo->player->climbing == 1 && abs((slidemo->angle - climbline)) < ANGLE_135))
|
||||
&& P_IsClimbingValid(slidemo->player, climbangle))
|
||||
{
|
||||
slidemo->angle = climbangle;
|
||||
|
|
|
@ -7993,9 +7993,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
if (player == &players[consoleplayer])
|
||||
{
|
||||
if (focusangle >= localangle)
|
||||
localangle += abs(focusangle - localangle)>>5;
|
||||
localangle += abs((focusangle - localangle))>>5;
|
||||
else
|
||||
localangle -= abs(focusangle - localangle)>>5;
|
||||
localangle -= abs((focusangle - localangle))>>5;
|
||||
}
|
||||
}
|
||||
else if (P_AnalogMove(player)) // Analog
|
||||
|
|
|
@ -117,7 +117,7 @@ if(${SDL2_FOUND})
|
|||
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
|
||||
|
||||
if(CLANG)
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
add_framework(CoreFoundation SRB2SDL2)
|
||||
add_framework(SDL2 SRB2SDL2)
|
||||
add_framework(SDL2_mixer SRB2SDL2)
|
||||
|
@ -224,7 +224,7 @@ if(${SDL2_FOUND})
|
|||
endif()
|
||||
|
||||
#### Installation ####
|
||||
if (CLANG)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
install(TARGETS SRB2SDL2
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
|
@ -265,7 +265,7 @@ if(${SDL2_FOUND})
|
|||
|
||||
|
||||
# Mac bundle fixup
|
||||
if(CLANG)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"
|
||||
|
@ -279,4 +279,4 @@ if(${SDL2_FOUND})
|
|||
else()
|
||||
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
|
||||
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue