diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index cb3088cb6..74e991845 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -794,6 +794,13 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum) // the flat raw data needn't be converted with palettized textures W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum), PU_HWRCACHE, &grMipmap->data)); + +#ifdef GLENCORE + flat = grMipmap->data; + for (steppy = 0; steppy < size; steppy++) + if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX) + flat[steppy] = grMipmap->colormap[flat[steppy]]; +#endif } static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum) @@ -824,13 +831,6 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum, boolean noencoremap) grmip->colormap = colormaps; -#ifdef GLENCORE - if (!noencoremap && encoremap) - grmip->colormap += (256*32); -#endif - - grmip->colormap = colormaps; - #ifdef GLENCORE if (!noencoremap && encoremap) grmip->colormap += (256*32); diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 2e5ebd6d2..30b456350 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -51,9 +51,11 @@ struct GLMipmap_s UINT16 width; UINT32 downloaded; // the dll driver have it in there cache ? - struct GLMipmap_s *nextmipmap; - struct GLMipmap_s *nextcolormap; - const UINT8 *colormap; + struct GLMipmap_s *nextcolormap; + const UINT8 *colormap; + + // opengl + struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver }; typedef struct GLMipmap_s GLMipmap_t; diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index c49c9186d..8ac1bc4c3 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1003,7 +1003,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 intx = (INT32)fx; inty = (INT32)fy; - K_AdjustXYWithSnap(&intx, &inty, options, dupx, dupy); + K_AdjustXYWithSnap(&intx, &inty, color, dupx, dupy); fx = (float)intx; fy = (float)inty; } diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index cca13f33b..f62b6ed77 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -25,6 +25,9 @@ // Uncomment this to enable the OpenGL loading screen //#define HWR_LOADING_SCREEN +// SRB2Kart +#define GLENCORE + // ----------- // structures // ----------- @@ -84,6 +87,9 @@ typedef struct gl_vissprite_s extern extrasubsector_t *extrasubsectors; extern size_t addsubsector; +void HWR_InitPolyPool(void); +void HWR_FreePolyPool(void); + // -------- // hw_cache.c // -------- @@ -99,6 +105,7 @@ void HWR_GetPatch(GLPatch_t *gpatch); void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap); void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap); void HWR_UnlockCachedPatch(GLPatch_t *gpatch); +GLPatch_t *HWR_GetPic(lumpnum_t lumpnum); void HWR_SetPalette(RGBA_t *palette); GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump); GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index cb0a5b140..b13fcdbac 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3693,7 +3693,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) FSurfaceInfo Surf; const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES); extracolormap_t *colormap; - FUINT lightlevel; + FUINT lightlevel = 255; FBITFIELD blend = 0; FBITFIELD occlusion; boolean use_linkdraw_hack = false; @@ -3867,7 +3867,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) if (brightmode == 2) lightlevel = 128 + (lightlevel>>1); } - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; } if (i + 1 < sector->numlights) @@ -4078,7 +4078,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) // colormap test { sector_t *sector = spr->mobj->subsector->sector; - UINT8 lightlevel = 255; + FUINT lightlevel = 255; UINT8 brightmode = 0; extracolormap_t *colormap = sector->extra_colormap; @@ -5406,10 +5406,10 @@ static void HWR_DrawSkyBackground(player_t *player) { FTransform dometransform; const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); - postimg_t *type; - UINT8 i; + postimg_t *type = &postimgtype[0]; + SINT8 i; - for (i = r_splitscreen; i > 0; i--) + for (i = r_splitscreen; i >= 0; i--) { if (player == &players[displayplayers[i]]) { @@ -5636,10 +5636,10 @@ static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) { const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); - postimg_t *type; - UINT8 i; + postimg_t *type = &postimgtype[0]; + SINT8 i; - for (i = r_splitscreen; i > 0; i--) + for (i = r_splitscreen; i >= 0; i--) { if (player == &players[displayplayers[i]]) { @@ -5833,14 +5833,14 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) { const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); - postimg_t *type; - UINT8 i; + postimg_t *type = &postimgtype[0]; + SINT8 i; const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on FRGBAFloat ClearColor; - for (i = r_splitscreen; i > 0; i--) + for (i = r_splitscreen; i >= 0; i--) { if (player == &players[displayplayers[i]]) { @@ -6063,7 +6063,9 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) // 3D ENGINE COMMANDS // ========================================================================== +#ifdef BAD_MODEL_OPTIONS static CV_PossibleValue_t grmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}}; +#endif static CV_PossibleValue_t grfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}}; static CV_PossibleValue_t grshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}}; @@ -6313,12 +6315,12 @@ INT32 HWR_GetTextureUsed(void) void HWR_DoPostProcessor(player_t *player) { - postimg_t *type; - UINT8 i; + postimg_t *type = &postimgtype[0]; + SINT8 i; HWD.pfnUnSetShader(); - for (i = r_splitscreen; i > 0; i--) + for (i = r_splitscreen; i >= 0; i--) { if (player == &players[displayplayers[i]]) { diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index c6b659c6a..b4d7f85ad 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -42,6 +42,10 @@ #include "hw_main.h" #include "../v_video.h" + +// SRB2Kart +#include "../k_color.h" + #ifdef HAVE_PNG #ifndef _MSC_VER @@ -733,7 +737,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, // TC_METALSONIC includes an actual skincolor translation, on top of its flashing. if (skinnum == TC_METALSONIC) - color = SKINCOLOR_COBALT; + color = SKINCOLOR_MIDNIGHT; if (color != SKINCOLOR_NONE && color < numskincolors) { @@ -835,7 +839,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, else { // All settings that use skincolors! - UINT16 brightness; + UINT8 brightness; if (translen <= 0) { @@ -853,9 +857,8 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, } else { - UINT16 imagebright, blendbright; - SETBRIGHTNESS(imagebright,image->s.red,image->s.green,image->s.blue); - SETBRIGHTNESS(blendbright,blendimage->s.red,blendimage->s.green,blendimage->s.blue); + UINT8 imagebright = K_ColorRelativeLuminance(image->s.red, image->s.green, image->s.blue); + UINT8 blendbright = K_ColorRelativeLuminance(blendimage->s.red, blendimage->s.green, blendimage->s.blue); // slightly dumb average between the blend image color and base image colour, usually one or the other will be fully opaque anyway brightness = (imagebright*(255-blendimage->s.alpha))/255 + (blendbright*blendimage->s.alpha)/255; } @@ -869,7 +872,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, } else { - SETBRIGHTNESS(brightness,blendimage->s.red,blendimage->s.green,blendimage->s.blue); + brightness = K_ColorRelativeLuminance(blendimage->s.red, blendimage->s.green, blendimage->s.blue); } } @@ -903,7 +906,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, for (i = 0; i < translen; i++) { RGBA_t tempc = V_GetColor(translation[i]); - SETBRIGHTNESS(colorbrightnesses[i], tempc.s.red, tempc.s.green, tempc.s.blue); // store brightnesses for comparison + colorbrightnesses[i] = K_ColorRelativeLuminance(tempc.s.red, tempc.s.green, tempc.s.blue); // store brightnesses for comparison } for (i = 0; i < translen; i++) @@ -1001,9 +1004,8 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, if (skinnum == TC_RAINBOW) { UINT32 tempcolor; - UINT16 colorbright; + UINT8 colorbright = K_ColorRelativeLuminance(blendcolor.s.red, blendcolor.s.green, blendcolor.s.blue); - SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue); if (colorbright == 0) colorbright = 1; // no dividing by 0 please @@ -1160,6 +1162,8 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t { UINT8 super = 0, i = 0; + (void)player; + if (!md2 || !md2->model || !md2->model->spr2frames || !skin) return 0; @@ -1413,15 +1417,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) { if (spr->mobj->colorized) skinnum = TC_RAINBOW; - else if (spr->mobj->player && spr->mobj->player->dashmode >= DASHMODE_THRESHOLD - && (spr->mobj->player->charflags & SF_DASHMODE) - && ((leveltime/2) & 1)) - { - if (spr->mobj->player->charflags & SF_MACHINE) - skinnum = TC_DASHMODE; - else - skinnum = TC_RAINBOW; - } else if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) skinnum = (INT32)((skin_t*)spr->mobj->skin-skins); else diff --git a/src/p_user.c b/src/p_user.c index 588c94917..460a929f2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1528,8 +1528,6 @@ static void P_CheckBustableBlocks(player_t *player) // If it's not an FF_STRONGBUST, you can break if you are spinning (and not jumping) // or you are super - // or you are in dashmode with SF_DASHMODE - // or you are drilling in NiGHTS // or you are recording for Metal Sonic if (!((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED)) && !(player->powers[pw_super])