From 5cccff08aa483699c7cea2fdd4bc1bccd8118fc1 Mon Sep 17 00:00:00 2001 From: Sryder Date: Fri, 29 May 2020 20:43:34 +0100 Subject: [PATCH] Basic merge some of the easier HW files. hw_main and hw_md2 still need merge. hw_cache needs evaluating for encore mode. --- src/hardware/hw_bsp.c | 6 - src/hardware/hw_cache.c | 115 +-- src/hardware/hw_clip.c | 4 - src/hardware/hw_data.h | 8 - src/hardware/hw_defs.h | 26 +- src/hardware/hw_draw.c | 66 +- src/hardware/hw_drv.h | 25 - src/hardware/hw_glob.h | 14 +- src/hardware/hw_light.c | 1451 ------------------------------------- src/hardware/hw_md2load.c | 6 - src/hardware/hw_md3load.c | 6 - src/hardware/hw_model.c | 14 - src/hardware/hw_model.h | 12 - 13 files changed, 9 insertions(+), 1744 deletions(-) diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index 3f7a00bea..8925bdc8b 100644 --- a/src/hardware/hw_bsp.c +++ b/src/hardware/hw_bsp.c @@ -754,13 +754,10 @@ static INT32 SolveTProblem(void) return 0; CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n"); -<<<<<<< HEAD -======= #ifdef HWR_LOADING_SCREEN CON_Drawer(); //let the user know what we are doing I_FinishUpdate(); // page flip or blit buffer #endif ->>>>>>> srb2/next numsplitpoly = 0; @@ -888,11 +885,8 @@ void HWR_CreatePlanePolygons(INT32 bspnum) CON_Drawer(); //let the user know what we are doing I_FinishUpdate(); // page flip or blit buffer #endif -<<<<<<< HEAD -======= HWR_ClearPolys(); ->>>>>>> srb2/next // find min/max boundaries of map //CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n"); diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index e1c4915e3..05f8b7fb6 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -25,11 +25,8 @@ #include "../z_zone.h" #include "../v_video.h" #include "../r_draw.h" -<<<<<<< HEAD -======= #include "../r_patch.h" #include "../p_setup.h" ->>>>>>> srb2/next // Values set after a call to HWR_ResizeBlock() static INT32 blocksize, blockwidth, blockheight; @@ -423,55 +420,11 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap, else patchcol = (const column_t *)((const UINT8 *)realpatch + LONG(realpatch->columnofs[xfrac>>FRACBITS])); -<<<<<<< HEAD - dest = block + (position*blockmodulo); - while (count > 0) - { - count--; - - texel = source[yfrac>>FRACBITS]; - alpha = 0xff; - - //Hurdler: not perfect, but better than holes - if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED)) - alpha = 0x00; - - //Hurdler: 25/04/2000: now support colormap in hardware mode - if (mipmap->colormap) - texel = mipmap->colormap[texel]; - - // hope compiler will get this switch out of the loops (dreams...) - // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) - // Alam: SRB2 uses Mingw, HUGS - switch (bpp) - { - case 2 : texelu16 = (UINT16)((alpha<<8) | texel); - memcpy(dest, &texelu16, sizeof(UINT16)); - break; - case 3 : colortemp = V_GetColor(texel); - memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); - break; - case 4 : colortemp = V_GetColor(texel); - colortemp.s.alpha = alpha; - memcpy(dest, &colortemp, sizeof(RGBA_t)); - break; - // default is 1 - default: *dest = texel; - break; - } - - dest += blockmodulo; - yfrac += yfracstep; - } - patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4); - } -======= ColumnDrawerPointer(patchcol, block, mipmap, pblockheight, blockmodulo, yfracstep, scale_y, patch, height, bpp); ->>>>>>> srb2/next } } @@ -525,23 +478,6 @@ static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight, (void)grInfo; #endif -<<<<<<< HEAD - // size up to nearest power of 2 - blockwidth = 1; - while (blockwidth < originalwidth) - blockwidth <<= 1; - // scale down the original graphics to fit in 2048 - if (blockwidth > 2048) - blockwidth = 2048; - - // size up to nearest power of 2 - blockheight = 1; - while (blockheight < originalheight) - blockheight <<= 1; - // scale down the original graphics to fit in 2048 - if (blockheight > 2048) - blockheight = 2048; -======= // find a power of 2 width/height if (cv_grrounddown.value) { @@ -582,7 +518,6 @@ static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight, blockheight = originalheight; #endif } ->>>>>>> srb2/next // do the boring LOD stuff.. blech! #ifdef GLIDE_API_COMPATIBILITY @@ -799,10 +734,6 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, bo Z_Free(grMipmap->grInfo.data); grMipmap->grInfo.data = NULL; -<<<<<<< HEAD - newwidth = min(grPatch->width, blockwidth); - newheight = min(grPatch->height, blockheight); -======= // if rounddown, rounddown patches as well as textures if (cv_grrounddown.value) { @@ -815,7 +746,6 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, bo newwidth = min(grPatch->width, blockwidth); newheight = min(grPatch->height, blockheight); } ->>>>>>> srb2/next if (makebitmap) { @@ -849,14 +779,6 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch) { GLPatch_t* const pat = patch; (void)patchnum; //unused -<<<<<<< HEAD - while (grpatch->mipmap->nextcolormap) - { - GLMipmap_t *grmip = grpatch->mipmap->nextcolormap; - grpatch->mipmap->nextcolormap = grmip->nextcolormap; - if (grmip->grInfo.data) Z_Free(grmip->grInfo.data); - free(grmip); -======= // The patch must be valid, obviously if (!pat) @@ -889,7 +811,6 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch) // Free the old colormap mipmap from memory. free(next); ->>>>>>> srb2/next } } @@ -934,11 +855,6 @@ void HWR_LoadTextures(size_t pnumtextures) // Why not Z_Malloc? gr_numtextures = pnumtextures; -<<<<<<< HEAD - gr_textures = calloc(pnumtextures, sizeof (*gr_textures)); - if (gr_textures == NULL) - I_Error("HWR_PrepLevelCache: can't alloc gr_textures"); -======= gr_textures = calloc(gr_numtextures, sizeof(*gr_textures)); gr_flats = calloc(gr_numtextures, sizeof(*gr_flats)); @@ -946,7 +862,6 @@ void HWR_LoadTextures(size_t pnumtextures) // should never ever happen (right?!) if ((gr_textures == NULL) || (gr_flats == NULL)) I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!"); ->>>>>>> srb2/next } void HWR_SetPalette(RGBA_t *palette) @@ -1076,17 +991,15 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum) } // Download a Doom 'flat' to the hardware cache and make it ready for use -<<<<<<< HEAD -void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap) -======= -void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum) ->>>>>>> srb2/next +void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum, boolean noencoremap) { GLMipmap_t *grmip; if (flatlumpnum == LUMPERROR) return; -<<<<<<< HEAD + if (needpatchflush) + W_FlushCachedPatches(); + grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap; grmip->colormap = colormaps; @@ -1103,11 +1016,6 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum) grmip->colormap += (256*32); #endif -======= - if (needpatchflush) - W_FlushCachedPatches(); ->>>>>>> srb2/next - grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap; if (!grmip->downloaded && !grmip->grInfo.data) HWR_CacheFlat(grmip, flatlumpnum); @@ -1194,14 +1102,6 @@ void HWR_GetPatch(GLPatch_t *gpatch) { // load the software patch, PU_STATIC or the Z_Malloc for hardware patch will // flush the software patch before the conversion! oh yeah I suffered -<<<<<<< HEAD - patch_t *patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); - HWR_MakePatch(patch, gpatch, gpatch->mipmap, true); - - // this is inefficient.. but the hardware patch in heap is purgeable so it should - // not fragment memory, and besides the REAL cache here is the hardware memory - Z_Free(patch); -======= patch_t *ptr = gpatch->rawpatch; if (!ptr) ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); @@ -1211,7 +1111,6 @@ void HWR_GetPatch(GLPatch_t *gpatch) // not fragment memory, and besides the REAL cache here is the hardware memory if (!gpatch->rawpatch) Z_Free(ptr); ->>>>>>> srb2/next } HWD.pfnSetTexture(gpatch->mipmap); @@ -1274,8 +1173,6 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch) Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED); } -<<<<<<< HEAD -======= static const INT32 picmode2GR[] = { GR_TEXFMT_P_8, // PALETTE @@ -1433,7 +1330,6 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum) return grpatch; } ->>>>>>> srb2/next GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum) { aatree_t *hwrcache = wadfiles[wadnum]->hwrcache; @@ -1548,12 +1444,9 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum) { GLMipmap_t *grmip; -<<<<<<< HEAD -======= if (needpatchflush) W_FlushCachedPatches(); ->>>>>>> srb2/next grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap; if (!grmip->downloaded && !grmip->grInfo.data) diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c index 40f2697ac..c08824147 100644 --- a/src/hardware/hw_clip.c +++ b/src/hardware/hw_clip.c @@ -381,11 +381,7 @@ void gld_FrustrumSetup(void) float t; float clip[16]; -<<<<<<< HEAD pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); -======= - pglGeFloatv(GL_PROJECTION_MATRIX, projMatrix); ->>>>>>> srb2/next pglGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix); clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12); diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index b7d6d4d85..6ce8aa96f 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -14,15 +14,12 @@ #ifndef _HWR_DATA_ #define _HWR_DATA_ -<<<<<<< HEAD -======= #if defined (_WIN32) && !defined (__CYGWIN__) //#define WIN32_LEAN_AND_MEAN #define RPC_NO_WINDOWS_H #include #endif ->>>>>>> srb2/next #include "../doomdef.h" #include "../screen.h" @@ -116,14 +113,9 @@ struct GLPatch_s float max_s,max_t; UINT16 wadnum; // the software patch lump num for when the hardware patch UINT16 lumpnum; // was flushed, and we need to re-create it -<<<<<<< HEAD - GLMipmap_t *mipmap; - boolean notfound; // if the texture file was not found, mark it here (used in model texture loading) -======= void *rawpatch; // :^) GLMipmap_t *mipmap; ->>>>>>> srb2/next } ATTRPACK; typedef struct GLPatch_s GLPatch_t; diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 7e7882a41..ad74ad031 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -43,13 +43,10 @@ typedef unsigned char FBOOLEAN; // byte value for paletted graphics, which represent the transparent color #define HWR_PATCHES_CHROMAKEY_COLORINDEX 255 -<<<<<<< HEAD -======= //#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130 // the chroma key color shows on border sprites, set it to black #define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen() ->>>>>>> srb2/next // RGBA Color components with float type ranging [ 0 ... 1 ] struct FRGBAFloat @@ -148,8 +145,6 @@ typedef struct gr_vissprite_s // Vanilla features //#define USE_MODEL_NEXTFRAME -<<<<<<< HEAD -======= //Hurdler: Transform (coords + angles) //BP: transform order : scale(rotation_x(rotation_y(translation(v)))) @@ -160,7 +155,6 @@ typedef struct gr_vissprite_s // Vanilla features #define USE_MODEL_NEXTFRAME ->>>>>>> srb2/next typedef struct { FLOAT x,y,z; // position @@ -173,13 +167,8 @@ typedef struct FLOAT fovxangle, fovyangle; UINT8 splitscreen; boolean flip; // screenflip -<<<<<<< HEAD -#ifdef USE_FTRANSFORM_MIRROR - boolean mirror; // SRB2Kart: Encore Mode -#endif boolean shearing; // 14042019 angle_t viewaiming; // 17052019 -======= boolean roll; SINT8 rollflip; FLOAT rollangle; // done to not override USE_FTRANSFORM_ANGLEZ @@ -188,7 +177,6 @@ typedef struct #ifdef USE_FTRANSFORM_MIRROR boolean mirror; // SRB2Kart: Encore Mode #endif ->>>>>>> srb2/next } FTransform; // Transformed vector, as passed to HWR API @@ -226,15 +214,9 @@ enum EPolyFlags PF_Decal = 0x00000800, // Enable polygon offset PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB) // When set, pass the color constant into the FSurfaceInfo -> FlatColor -<<<<<<< HEAD - PF_NoTexture = 0x00002000, // Disable texture - PF_Ripple = 0x00004000, // Water shader effect - // 0x00008000 -======= PF_NoTexture = 0x00002000, // Use the small white texture PF_Corona = 0x00004000, // Tell the rendrer we are drawing a corona PF_Unused = 0x00008000, // Unused ->>>>>>> srb2/next PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y PF_ForceWrapX = 0x00020000, // Force repeat texture on X PF_ForceWrapY = 0x00040000, // Force repeat texture on Y @@ -277,15 +259,11 @@ typedef struct FSurfaceInfo FSurfaceInfo; enum hwdsetspecialstate { -<<<<<<< HEAD - HWD_SET_SHADERS, - -======= - HWD_SET_MODEL_LIGHTING = 1, + HWD_SET_SHADERS = 1, + HWD_SET_MODEL_LIGHTING, HWD_SET_FOG_MODE, HWD_SET_FOG_COLOR, HWD_SET_FOG_DENSITY, ->>>>>>> srb2/next HWD_SET_TEXTUREFILTERMODE, HWD_SET_TEXTUREANISOTROPICMODE, diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 67b86dd35..3c38dcda5 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -200,13 +200,12 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t cy -= offsety; } -<<<<<<< HEAD if (option & V_SPLITSCREEN) cy += FIXED_TO_FLOAT((BASEVIDHEIGHT/2)<>>>>>> srb2/next if (!(option & V_NOSCALESTART)) { @@ -377,19 +375,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t if (alphalevel) { FSurfaceInfo Surf; -<<<<<<< HEAD - Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; -======= Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency]; else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency]; else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; ->>>>>>> srb2/next flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); } @@ -520,12 +510,6 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; -<<<<<<< HEAD - v[0].s = v[3].s = ((sx)/(float)SHORT(gpatch->width) )*gpatch->max_s; - v[2].s = v[1].s = ((w )/(float)SHORT(gpatch->width) )*gpatch->max_s; - v[0].t = v[1].t = ((sy)/(float)SHORT(gpatch->height))*gpatch->max_t; - v[2].t = v[3].t = ((h )/(float)SHORT(gpatch->height))*gpatch->max_t; -======= v[0].sow = v[3].sow = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s; if (sx + w > SHORT(gpatch->width)) v[2].sow = v[1].sow = gpatch->max_s; @@ -537,7 +521,6 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal v[2].tow = v[3].tow = gpatch->max_t; else v[2].tow = v[3].tow = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t; ->>>>>>> srb2/next flags = PF_Translucent|PF_NoDepthTest; @@ -550,19 +533,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal if (alphalevel) { FSurfaceInfo Surf; -<<<<<<< HEAD - Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; -======= Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency]; else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency]; else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; ->>>>>>> srb2/next flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); } @@ -635,11 +610,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum v[0].t = v[1].t = (float)((y & flatflag)/dflatsize); v[2].t = v[3].t = (float)(v[0].t + h/dflatsize); -<<<<<<< HEAD - HWR_GetFlat(flatlumpnum, false); // Never Encore map drawflatfill, duh. -======= - HWR_LiterallyGetFlat(flatlumpnum); ->>>>>>> srb2/next + HWR_LiterallyGetFlat(flatlumpnum, false); //Hurdler: Boris, the same comment as above... but maybe for pics // it not a problem since they don't have any transparent pixel @@ -660,33 +631,6 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum // 0--1 void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength) { -<<<<<<< HEAD - FOutVector v[4]; - FSurfaceInfo Surf; - - v[0].x = v[3].x = -1.0f; - v[2].x = v[1].x = 1.0f; - v[0].y = v[1].y = -1.0f; - v[2].y = v[3].y = 1.0f; - v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - - v[0].s = v[3].s = 0.0f; - v[2].s = v[1].s = 1.0f; - v[0].t = v[1].t = 1.0f; - v[2].t = v[3].t = 0.0f; - - if (color & 0xFF00) // Do COLORMAP fade. - { - Surf.PolyColor.rgba = UINT2RGBA(0x01010160); - Surf.PolyColor.s.alpha = (strength*8); - } - else // Do TRANSMAP** fade. - { - Surf.PolyColor.rgba = pLocalPalette[color].rgba; - Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f); - } - HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); -======= FOutVector v[4]; FSurfaceInfo Surf; @@ -887,7 +831,6 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac Surf.FlatColor.s.alpha = softwaretranstogl[strength]; } HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); ->>>>>>> srb2/next } // Draw the console background with translucency support @@ -1357,13 +1300,8 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 v[0].t = v[1].t = 0.0f; v[2].t = v[3].t = 1.0f; -<<<<<<< HEAD - Surf.PolyColor.rgba = UINT2RGBA(color); - Surf.PolyColor.s.alpha = 0x80; -======= Surf.FlatColor.rgba = UINT2RGBA(actualcolor); Surf.FlatColor.s.alpha = 0x80; ->>>>>>> srb2/next HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 8862427f3..c2b11b504 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -26,14 +26,6 @@ // STANDARD DLL EXPORTS // ========================================================================== -<<<<<<< HEAD -EXPORT boolean HWRAPI(Init) (void); -#if defined (PURESDL) || defined (macintosh) -EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma); -#else -EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma); -#endif -======= EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction); #ifndef HAVE_SDL EXPORT void HWRAPI(Shutdown) (void); @@ -42,7 +34,6 @@ EXPORT void HWRAPI(Shutdown) (void); EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes); #endif EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal); ->>>>>>> srb2/next EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl); EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color); EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags); @@ -58,24 +49,15 @@ EXPORT void HWRAPI(ClearMipMapCache) (void); EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value); //Hurdler: added for new development -<<<<<<< HEAD EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface); EXPORT void HWRAPI(CreateModelVBOs) (model_t *model); EXPORT void HWRAPI(SetTransform) (FTransform *stransform); -======= -EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 *color); -EXPORT void HWRAPI(CreateModelVBOs) (model_t *model); -EXPORT void HWRAPI(SetTransform) (FTransform *ptransform); ->>>>>>> srb2/next EXPORT INT32 HWRAPI(GetTextureUsed) (void); -<<<<<<< HEAD EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform); -======= #define SCREENVERTS 10 EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]); ->>>>>>> srb2/next EXPORT void HWRAPI(FlushScreenTextures) (void); EXPORT void HWRAPI(StartScreenWipe) (void); EXPORT void HWRAPI(EndScreenWipe) (void); @@ -120,17 +102,11 @@ struct hwdriver_s ReadRect pfnReadRect; GClipRect pfnGClipRect; ClearMipMapCache pfnClearMipMapCache; -<<<<<<< HEAD - SetSpecialState pfnSetSpecialState; -======= SetSpecialState pfnSetSpecialState;//Hurdler: added for backward compatibility ->>>>>>> srb2/next DrawModel pfnDrawModel; CreateModelVBOs pfnCreateModelVBOs; SetTransform pfnSetTransform; GetTextureUsed pfnGetTextureUsed; -<<<<<<< HEAD -======= GetRenderVersion pfnGetRenderVersion; #ifdef _WINDOWS GetModeList pfnGetModeList; @@ -138,7 +114,6 @@ struct hwdriver_s #ifndef HAVE_SDL Shutdown pfnShutdown; #endif ->>>>>>> srb2/next PostImgRedraw pfnPostImgRedraw; FlushScreenTextures pfnFlushScreenTextures; StartScreenWipe pfnStartScreenWipe; diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 0c224e508..855a09f04 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -16,20 +16,15 @@ #include "hw_defs.h" #include "../m_misc.h" -<<<<<<< HEAD #include "../r_defs.h" -======= #include "../p_setup.h" // the original aspect ratio of Doom graphics isn't square #define ORIGINAL_ASPECT (320.0f/200.0f) ->>>>>>> srb2/next // Uncomment this to enable the OpenGL loading screen //#define HWR_LOADING_SCREEN -<<<<<<< HEAD -======= // ----------- // structures // ----------- @@ -85,7 +80,6 @@ typedef struct gr_vissprite_s float z1, z2; } gr_vissprite_t; ->>>>>>> srb2/next // -------- // hw_bsp.c // -------- @@ -100,14 +94,8 @@ void HWR_FreeTextureCache(void); void HWR_FreeMipmapCache(void); void HWR_FreeExtraSubsectors(void); -<<<<<<< HEAD -void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap); -// ^ some flats must NOT be remapped to encore, since we remap them as we cache them for ease, adding a toggle here seems wise. - -======= void HWR_GetLevelFlat(levelflat_t *levelflat); -void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum); ->>>>>>> srb2/next +void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum, boolean noencoremap); GLTexture_t *HWR_GetTexture(INT32 tex); void HWR_GetPatch(GLPatch_t *gpatch); void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap); diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 9683a8232..079349c37 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -24,1455 +24,4 @@ #include "../r_main.h" #include "../p_local.h" -<<<<<<< HEAD -======= -//============================================================================= -// DEFINES -//============================================================================= - -#define DL_SQRRADIUS(x) dynlights->p_lspr[(x)]->dynamic_sqrradius -#define DL_RADIUS(x) dynlights->p_lspr[(x)]->dynamic_radius -#define LIGHT_POS(i) dynlights->position[(i)] - -#define DL_HIGH_QUALITY -//#define STATICLIGHT //Hurdler: TODO! -//#define LIGHTMAPFLAGS (PF_Masked|PF_Clip|PF_NoAlphaTest) // debug see overdraw -#define LIGHTMAPFLAGS (PF_Modulated|PF_Additive|PF_Clip) - -#ifdef ALAM_LIGHTING -static dynlights_t view_dynlights[2]; // 2 players in splitscreen mode -static dynlights_t *dynlights = &view_dynlights[0]; -#endif - -#define UNDEFINED_SPR 0x0 // actually just for testing -#define CORONA_SPR 0x1 // a light source which only emit a corona -#define DYNLIGHT_SPR 0x2 // a light source which is only used for dynamic lighting -#define LIGHT_SPR (DYNLIGHT_SPR|CORONA_SPR) -#define ROCKET_SPR (DYNLIGHT_SPR|CORONA_SPR|0x10) -//#define MONSTER_SPR 4 -//#define AMMO_SPR 8 -//#define BONUS_SPR 16 - -//Hurdler: now we can change those values via FS :) -light_t lspr[NUMLIGHTS] = -{ - // type offset x, y coronas color, c_size,light color,l_radius, sqr radius computed at init - // NOLIGHT: 0 - { UNDEFINED_SPR, 0.0f, 0.0f, 0x00000000, 24.0f, 0x00000000, 0.0f, 0.0f}, - // weapons - // RINGSPARK_L - { LIGHT_SPR, 0.0f, 0.0f, 0x0000e0ff, 16.0f, 0x0000e0ff, 32.0f, 0.0f}, // Tails 09-08-2002 - // SUPERSONIC_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0xff00e0ff, 32.0f, 0xff00e0ff, 128.0f, 0.0f}, // Tails 09-08-2002 - // SUPERSPARK_L - { LIGHT_SPR, 0.0f, 0.0f, 0xe0ffffff, 8.0f, 0xe0ffffff, 64.0f, 0.0f}, - // INVINCIBLE_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x10ffaaaa, 16.0f, 0x10ffaaaa, 128.0f, 0.0f}, - // GREENSHIELD_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x602b7337, 32.0f, 0x602b7337, 128.0f, 0.0f}, - // BLUESHIELD_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x60cb0000, 32.0f, 0x60cb0000, 128.0f, 0.0f}, - - // tall lights - // YELLOWSHIELD_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x601f7baf, 32.0f, 0x601f7baf, 128.0f, 0.0f}, - - // REDSHIELD_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x600000cb, 32.0f, 0x600000cb, 128.0f, 0.0f}, - - // BLACKSHIELD_L // Black light? lol - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x60010101, 32.0f, 0x60ff00ff, 128.0f, 0.0f}, - - // WHITESHIELD_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x60ffffff, 32.0f, 0x60ffffff, 128.0f, 0.0f}, - - // SMALLREDBALL_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x606060f0, 0.0f, 0x302070ff, 32.0f, 0.0f}, - - // small lights - // RINGLIGHT_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x60b0f0f0, 0.0f, 0x30b0f0f0, 100.0f, 0.0f}, - // GREENSMALL_L - { LIGHT_SPR, 0.0f, 14.0f, 0x6070ff70, 60.0f, 0x4070ff70, 100.0f, 0.0f}, - // REDSMALL_L - { LIGHT_SPR, 0.0f, 14.0f, 0x705070ff, 60.0f, 0x405070ff, 100.0f, 0.0f}, - - // type offset x, y coronas color, c_size,light color,l_radius, sqr radius computed at init - // GREENSHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xff00ff00, 64.0f, 0xff00ff00, 256.0f, 0.0f}, - // ORANGESHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xff0080ff, 64.0f, 0xff0080ff, 256.0f, 0.0f}, - // PINKSHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xffe080ff, 64.0f, 0xffe080ff, 256.0f, 0.0f}, - // BLUESHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xffff0000, 64.0f, 0xffff0000, 256.0f, 0.0f}, - // REDSHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xff0000ff, 64.0f, 0xff0000ff, 256.0f, 0.0f}, - // LBLUESHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xffff8080, 64.0f, 0xffff8080, 256.0f, 0.0f}, - // GREYSHINE_L - { LIGHT_SPR, 0.0f, 0.0f, 0xffe0e0e0, 64.0f, 0xffe0e0e0, 256.0f, 0.0f}, - - // monsters - // REDBALL_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x606060ff, 0.0f, 0x606060ff, 100.0f, 0.0f}, - // GREENBALL_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x6060ff60, 120.0f, 0x6060ff60, 100.0f, 0.0f}, - // BLUEBALL_L - { DYNLIGHT_SPR, 0.0f, 0.0f, 0x60ff6060, 120.0f, 0x60ff6060, 100.0f, 0.0f}, - - // NIGHTSLIGHT_L - { LIGHT_SPR, 0.0f, 6.0f, 0x60ffffff, 16.0f, 0x30ffffff, 32.0f, 0.0f}, - - // JETLIGHT_L - { DYNLIGHT_SPR, 0.0f, 6.0f, 0x60ffaaaa, 16.0f, 0x30ffaaaa, 64.0f, 0.0f}, - - // GOOPLIGHT_L - { DYNLIGHT_SPR, 0.0f, 6.0f, 0x60ff00ff, 16.0f, 0x30ff00ff, 32.0f, 0.0f}, - - // STREETLIGHT_L - { LIGHT_SPR, 0.0f, 0.0f, 0xe0ffffff, 64.0f, 0xe0ffffff, 384.0f, 0.0f}, -}; - -light_t *t_lspr[NUMSPRITES] = -{ - &lspr[NOLIGHT], // SPR_NULL - &lspr[NOLIGHT], // SPR_UNKN - - &lspr[NOLIGHT], // SPR_THOK - &lspr[SUPERSONIC_L],// SPR_PLAY - - // Enemies - &lspr[NOLIGHT], // SPR_POSS - &lspr[NOLIGHT], // SPR_SPOS - &lspr[NOLIGHT], // SPR_FISH - &lspr[NOLIGHT], // SPR_BUZZ - &lspr[NOLIGHT], // SPR_RBUZ - &lspr[NOLIGHT], // SPR_JETB - &lspr[NOLIGHT], // SPR_JETG - &lspr[NOLIGHT], // SPR_CCOM - &lspr[NOLIGHT], // SPR_DETN - &lspr[NOLIGHT], // SPR_SKIM - &lspr[NOLIGHT], // SPR_TRET - &lspr[NOLIGHT], // SPR_TURR - &lspr[NOLIGHT], // SPR_SHRP - &lspr[NOLIGHT], // SPR_CRAB - &lspr[NOLIGHT], // SPR_CR2B - &lspr[NOLIGHT], // SPR_CSPR - &lspr[NOLIGHT], // SPR_JJAW - &lspr[NOLIGHT], // SPR_SNLR - &lspr[NOLIGHT], // SPR_VLTR - &lspr[NOLIGHT], // SPR_PNTY - &lspr[NOLIGHT], // SPR_ARCH - &lspr[NOLIGHT], // SPR_CBFS - &lspr[JETLIGHT_L], // SPR_STAB - &lspr[NOLIGHT], // SPR_SPSH - &lspr[NOLIGHT], // SPR_ESHI - &lspr[NOLIGHT], // SPR_GSNP - &lspr[NOLIGHT], // SPR_GSNL - &lspr[NOLIGHT], // SPR_GSNH - &lspr[NOLIGHT], // SPR_MNUS - &lspr[NOLIGHT], // SPR_MNUD - &lspr[NOLIGHT], // SPR_SSHL - &lspr[NOLIGHT], // SPR_UNID - &lspr[NOLIGHT], // SPR_CANA - &lspr[NOLIGHT], // SPR_CANG - &lspr[NOLIGHT], // SPR_PYRE - &lspr[NOLIGHT], // SPR_PTER - &lspr[NOLIGHT], // SPR_DRAB - - // Generic Boos Items - &lspr[JETLIGHT_L], // SPR_JETF // Boss jet fumes - - // Boss 1, (Greenflower) - &lspr[NOLIGHT], // SPR_EGGM - &lspr[NOLIGHT], // SPR_EGLZ - - // Boss 2, (Techno Hill) - &lspr[NOLIGHT], // SPR_EGGN - &lspr[NOLIGHT], // SPR_TANK - &lspr[NOLIGHT], // SPR_GOOP - - // Boss 3 (Deep Sea) - &lspr[NOLIGHT], // SPR_EGGO - &lspr[NOLIGHT], // SPR_SEBH - &lspr[NOLIGHT], // SPR_FAKE - &lspr[LBLUESHINE_L],// SPR_SHCK - - // Boss 4 (Castle Eggman) - &lspr[NOLIGHT], // SPR_EGGP - &lspr[REDBALL_L], // SPR_EFIR - &lspr[NOLIGHT], // SPR_EGR1 - - // Boss 5 (Arid Canyon) - &lspr[NOLIGHT], // SPR_FANG // replaces EGGQ - &lspr[NOLIGHT], // SPR_BRKN - &lspr[NOLIGHT], // SPR_WHAT - &lspr[INVINCIBLE_L], // SPR_VWRE - &lspr[INVINCIBLE_L], // SPR_PROJ - &lspr[NOLIGHT], // SPR_FBOM - &lspr[NOLIGHT], // SPR_FSGN - &lspr[REDBALL_L], // SPR_BARX // bomb explosion (also used by barrel) - &lspr[NOLIGHT], // SPR_BARD // bomb dust (also used by barrel) - - // Boss 6 (Red Volcano) - &lspr[NOLIGHT], // SPR_EEGR - - // Boss 7 (Dark City) - &lspr[NOLIGHT], // SPR_BRAK - &lspr[NOLIGHT], // SPR_BGOO - &lspr[NOLIGHT], // SPR_BMSL - - // Boss 8 (Egg Rock) - &lspr[NOLIGHT], // SPR_EGGT - - &lspr[NOLIGHT], //SPR_RCKT - &lspr[NOLIGHT], //SPR_ELEC - &lspr[NOLIGHT], //SPR_TARG - &lspr[NOLIGHT], //SPR_NPLM - &lspr[NOLIGHT], //SPR_MNPL - - // Metal Sonic - &lspr[NOLIGHT], // SPR_METL - &lspr[NOLIGHT], // SPR_MSCF - &lspr[NOLIGHT], // SPR_MSCB - - // Collectible Items - &lspr[NOLIGHT], // SPR_RING - &lspr[NOLIGHT], // SPR_TRNG - &lspr[NOLIGHT], // SPR_TOKE - &lspr[REDBALL_L], // SPR_RFLG - &lspr[BLUEBALL_L], // SPR_BFLG - &lspr[NOLIGHT], // SPR_SPHR - &lspr[NOLIGHT], // SPR_NCHP - &lspr[NOLIGHT], // SPR_NSTR - &lspr[NOLIGHT], // SPR_EMBM - &lspr[NOLIGHT], // SPR_CEMG - &lspr[NOLIGHT], // SPR_SHRD - - // Interactive Objects - &lspr[NOLIGHT], // SPR_BBLS - &lspr[NOLIGHT], // SPR_SIGN - &lspr[NOLIGHT], // SPR_SPIK - &lspr[NOLIGHT], // SPR_SFLM - &lspr[NOLIGHT], // SPR_USPK - &lspr[NOLIGHT], // SPR_WSPK - &lspr[NOLIGHT], // SPR_WSPB - &lspr[NOLIGHT], // SPR_STPT - &lspr[NOLIGHT], // SPR_BMNE - &lspr[NOLIGHT], // SPR_PUMI - - // Monitor Boxes - &lspr[NOLIGHT], // SPR_MSTV - &lspr[NOLIGHT], // SPR_XLTV - - &lspr[NOLIGHT], // SPR_TRRI - &lspr[NOLIGHT], // SPR_TBRI - - &lspr[NOLIGHT], // SPR_TVRI - &lspr[NOLIGHT], // SPR_TVPI - &lspr[NOLIGHT], // SPR_TVAT - &lspr[NOLIGHT], // SPR_TVFO - &lspr[NOLIGHT], // SPR_TVAR - &lspr[NOLIGHT], // SPR_TVWW - &lspr[NOLIGHT], // SPR_TVEL - &lspr[NOLIGHT], // SPR_TVSS - &lspr[NOLIGHT], // SPR_TVIV - &lspr[NOLIGHT], // SPR_TV1U - &lspr[NOLIGHT], // SPR_TV1P - &lspr[NOLIGHT], // SPR_TVEG - &lspr[NOLIGHT], // SPR_TVMX - &lspr[NOLIGHT], // SPR_TVMY - &lspr[NOLIGHT], // SPR_TVGV - &lspr[NOLIGHT], // SPR_TVRC - &lspr[NOLIGHT], // SPR_TV1K - &lspr[NOLIGHT], // SPR_TVTK - &lspr[NOLIGHT], // SPR_TVFL - &lspr[NOLIGHT], // SPR_TVBB - &lspr[NOLIGHT], // SPR_TVZP - - // Projectiles - &lspr[NOLIGHT], // SPR_MISL - &lspr[SMALLREDBALL_L], // SPR_LASR - &lspr[REDSHINE_L], // SPR_LASF - &lspr[NOLIGHT], // SPR_TORP - &lspr[NOLIGHT], // SPR_ENRG - &lspr[NOLIGHT], // SPR_MINE - &lspr[NOLIGHT], // SPR_JBUL - &lspr[SMALLREDBALL_L], // SPR_TRLS - &lspr[NOLIGHT], // SPR_CBLL - &lspr[NOLIGHT], // SPR_AROW - &lspr[NOLIGHT], // SPR_CFIR - - // Greenflower Scenery - &lspr[NOLIGHT], // SPR_FWR1 - &lspr[NOLIGHT], // SPR_FWR2 - &lspr[NOLIGHT], // SPR_FWR3 - &lspr[NOLIGHT], // SPR_FWR4 - &lspr[NOLIGHT], // SPR_BUS1 - &lspr[NOLIGHT], // SPR_BUS2 - &lspr[NOLIGHT], // SPR_BUS3 - // Trees (both GFZ and misc) - &lspr[NOLIGHT], // SPR_TRE1 - &lspr[NOLIGHT], // SPR_TRE2 - &lspr[NOLIGHT], // SPR_TRE3 - &lspr[NOLIGHT], // SPR_TRE4 - &lspr[NOLIGHT], // SPR_TRE5 - &lspr[NOLIGHT], // SPR_TRE6 - - // Techno Hill Scenery - &lspr[NOLIGHT], // SPR_THZP - &lspr[NOLIGHT], // SPR_FWR5 - &lspr[REDBALL_L], // SPR_ALRM - - // Deep Sea Scenery - &lspr[NOLIGHT], // SPR_GARG - &lspr[NOLIGHT], // SPR_SEWE - &lspr[NOLIGHT], // SPR_DRIP - &lspr[NOLIGHT], // SPR_CRL1 - &lspr[NOLIGHT], // SPR_CRL2 - &lspr[NOLIGHT], // SPR_CRL3 - &lspr[NOLIGHT], // SPR_BCRY - - // Castle Eggman Scenery - &lspr[NOLIGHT], // SPR_CHAN - &lspr[REDBALL_L], // SPR_FLAM - &lspr[NOLIGHT], // SPR_ESTA - &lspr[NOLIGHT], // SPR_SMCH - &lspr[NOLIGHT], // SPR_BMCH - &lspr[NOLIGHT], // SPR_SMCE - &lspr[NOLIGHT], // SPR_BMCE - &lspr[NOLIGHT], // SPR_YSPB - &lspr[NOLIGHT], // SPR_RSPB - &lspr[REDBALL_L], // SPR_SFBR - &lspr[REDBALL_L], // SPR_BFBR - &lspr[NOLIGHT], // SPR_BANR - &lspr[NOLIGHT], // SPR_PINE - &lspr[NOLIGHT], // SPR_CEZB - &lspr[REDBALL_L], // SPR_CNDL - &lspr[NOLIGHT], // SPR_FLMH - &lspr[REDBALL_L], // SPR_CTRC - &lspr[NOLIGHT], // SPR_CFLG - &lspr[NOLIGHT], // SPR_CSTA - &lspr[NOLIGHT], // SPR_CBBS - - // Arid Canyon Scenery - &lspr[NOLIGHT], // SPR_BTBL - &lspr[NOLIGHT], // SPR_STBL - &lspr[NOLIGHT], // SPR_CACT - &lspr[NOLIGHT], // SPR_WWSG - &lspr[NOLIGHT], // SPR_WWS2 - &lspr[NOLIGHT], // SPR_WWS3 - &lspr[NOLIGHT], // SPR_OILL - &lspr[NOLIGHT], // SPR_OILF - &lspr[NOLIGHT], // SPR_BARR - &lspr[NOLIGHT], // SPR_REMT - &lspr[NOLIGHT], // SPR_TAZD - &lspr[NOLIGHT], // SPR_ADST - &lspr[NOLIGHT], // SPR_MCRT - &lspr[NOLIGHT], // SPR_MCSP - &lspr[NOLIGHT], // SPR_SALD - &lspr[NOLIGHT], // SPR_TRAE - &lspr[NOLIGHT], // SPR_TRAI - &lspr[NOLIGHT], // SPR_STEA - - // Red Volcano Scenery - &lspr[REDBALL_L], // SPR_FLME - &lspr[REDBALL_L], // SPR_DFLM - &lspr[NOLIGHT], // SPR_LFAL - &lspr[NOLIGHT], // SPR_JPLA - &lspr[NOLIGHT], // SPR_TFLO - &lspr[NOLIGHT], // SPR_WVIN - - // Dark City Scenery - - // Egg Rock Scenery - - // Christmas Scenery - &lspr[NOLIGHT], // SPR_XMS1 - &lspr[NOLIGHT], // SPR_XMS2 - &lspr[NOLIGHT], // SPR_XMS3 - &lspr[NOLIGHT], // SPR_XMS4 - &lspr[NOLIGHT], // SPR_XMS5 - &lspr[NOLIGHT], // SPR_XMS6 - &lspr[NOLIGHT], // SPR_FHZI - &lspr[NOLIGHT], // SPR_ROSY - - // Halloween Scenery - &lspr[RINGLIGHT_L], // SPR_PUMK - &lspr[NOLIGHT], // SPR_HHPL - &lspr[NOLIGHT], // SPR_SHRM - &lspr[NOLIGHT], // SPR_HHZM - - // Azure Temple Scenery - &lspr[NOLIGHT], // SPR_BGAR - &lspr[NOLIGHT], // SPR_RCRY - &lspr[GREENBALL_L], // SPR_CFLM - - // Botanic Serenity Scenery - &lspr[NOLIGHT], // SPR_BSZ1 - &lspr[NOLIGHT], // SPR_BSZ2 - &lspr[NOLIGHT], // SPR_BSZ3 - //&lspr[NOLIGHT], -- SPR_BSZ4 - &lspr[NOLIGHT], // SPR_BST1 - &lspr[NOLIGHT], // SPR_BST2 - &lspr[NOLIGHT], // SPR_BST3 - &lspr[NOLIGHT], // SPR_BST4 - &lspr[NOLIGHT], // SPR_BST5 - &lspr[NOLIGHT], // SPR_BST6 - &lspr[NOLIGHT], // SPR_BSZ5 - &lspr[NOLIGHT], // SPR_BSZ6 - &lspr[NOLIGHT], // SPR_BSZ7 - &lspr[NOLIGHT], // SPR_BSZ8 - - // Misc Scenery - &lspr[NOLIGHT], // SPR_STLG - &lspr[NOLIGHT], // SPR_DBAL - - // Powerup Indicators - &lspr[NOLIGHT], // SPR_ARMA - &lspr[NOLIGHT], // SPR_ARMF - &lspr[NOLIGHT], // SPR_ARMB - &lspr[NOLIGHT], // SPR_WIND - &lspr[NOLIGHT], // SPR_MAGN - &lspr[NOLIGHT], // SPR_ELEM - &lspr[NOLIGHT], // SPR_FORC - &lspr[NOLIGHT], // SPR_PITY - &lspr[NOLIGHT], // SPR_FIRS - &lspr[NOLIGHT], // SPR_BUBS - &lspr[NOLIGHT], // SPR_ZAPS - &lspr[INVINCIBLE_L], // SPR_IVSP - &lspr[SUPERSPARK_L], // SPR_SSPK - - &lspr[NOLIGHT], // SPR_GOAL - - // Flickies - &lspr[NOLIGHT], // SPR_FBUB - &lspr[NOLIGHT], // SPR_FL01 - &lspr[NOLIGHT], // SPR_FL02 - &lspr[NOLIGHT], // SPR_FL03 - &lspr[NOLIGHT], // SPR_FL04 - &lspr[NOLIGHT], // SPR_FL05 - &lspr[NOLIGHT], // SPR_FL06 - &lspr[NOLIGHT], // SPR_FL07 - &lspr[NOLIGHT], // SPR_FL08 - &lspr[NOLIGHT], // SPR_FL09 - &lspr[NOLIGHT], // SPR_FL10 - &lspr[NOLIGHT], // SPR_FL11 - &lspr[NOLIGHT], // SPR_FL12 - &lspr[NOLIGHT], // SPR_FL13 - &lspr[NOLIGHT], // SPR_FL14 - &lspr[NOLIGHT], // SPR_FL15 - &lspr[NOLIGHT], // SPR_FL16 - &lspr[NOLIGHT], // SPR_FS01 - &lspr[NOLIGHT], // SPR_FS02 - - // Springs - &lspr[NOLIGHT], // SPR_FANS - &lspr[NOLIGHT], // SPR_STEM - &lspr[NOLIGHT], // SPR_BUMP - &lspr[NOLIGHT], // SPR_BLON - &lspr[NOLIGHT], // SPR_SPRY - &lspr[NOLIGHT], // SPR_SPRR - &lspr[NOLIGHT], // SPR_SPRB - &lspr[NOLIGHT], // SPR_YSPR - &lspr[NOLIGHT], // SPR_RSPR - &lspr[NOLIGHT], // SPR_BSPR - &lspr[NOLIGHT], // SPR_SSWY - &lspr[NOLIGHT], // SPR_SSWR - &lspr[NOLIGHT], // SPR_SSWB - &lspr[NOLIGHT], // SPR_BSTY - &lspr[NOLIGHT], // SPR_BSTR - - // Environmental Effects - &lspr[NOLIGHT], // SPR_RAIN - &lspr[NOLIGHT], // SPR_SNO1 - &lspr[NOLIGHT], // SPR_SPLH - &lspr[NOLIGHT], // SPR_LSPL - &lspr[NOLIGHT], // SPR_SPLA - &lspr[NOLIGHT], // SPR_SMOK - &lspr[NOLIGHT], // SPR_BUBL - &lspr[RINGLIGHT_L], // SPR_WZAP - &lspr[NOLIGHT], // SPR_DUST - &lspr[NOLIGHT], // SPR_FPRT - &lspr[SUPERSPARK_L], // SPR_TFOG - &lspr[NIGHTSLIGHT_L], // SPR_SEED - &lspr[NOLIGHT], // SPR_PRTL - - // Game Indicators - &lspr[NOLIGHT], // SPR_SCOR - &lspr[NOLIGHT], // SPR_DRWN - &lspr[NOLIGHT], // SPR_FLII - &lspr[NOLIGHT], // SPR_LCKN - &lspr[NOLIGHT], // SPR_TTAG - &lspr[NOLIGHT], // SPR_GFLG - &lspr[NOLIGHT], // SPR_FNSF - - &lspr[NOLIGHT], // SPR_CORK - &lspr[NOLIGHT], // SPR_LHRT - - // Ring Weapons - &lspr[RINGLIGHT_L], // SPR_RRNG - &lspr[RINGLIGHT_L], // SPR_RNGB - &lspr[RINGLIGHT_L], // SPR_RNGR - &lspr[RINGLIGHT_L], // SPR_RNGI - &lspr[RINGLIGHT_L], // SPR_RNGA - &lspr[RINGLIGHT_L], // SPR_RNGE - &lspr[RINGLIGHT_L], // SPR_RNGS - &lspr[RINGLIGHT_L], // SPR_RNGG - - &lspr[RINGLIGHT_L], // SPR_PIKB - &lspr[RINGLIGHT_L], // SPR_PIKR - &lspr[RINGLIGHT_L], // SPR_PIKA - &lspr[RINGLIGHT_L], // SPR_PIKE - &lspr[RINGLIGHT_L], // SPR_PIKS - &lspr[RINGLIGHT_L], // SPR_PIKG - - &lspr[RINGLIGHT_L], // SPR_TAUT - &lspr[RINGLIGHT_L], // SPR_TGRE - &lspr[RINGLIGHT_L], // SPR_TSCR - - // Mario-specific stuff - &lspr[NOLIGHT], // SPR_COIN - &lspr[NOLIGHT], // SPR_CPRK - &lspr[NOLIGHT], // SPR_GOOM - &lspr[NOLIGHT], // SPR_BGOM - &lspr[REDBALL_L], // SPR_FFWR - &lspr[SMALLREDBALL_L], // SPR_FBLL - &lspr[NOLIGHT], // SPR_SHLL - &lspr[REDBALL_L], // SPR_PUMA - &lspr[NOLIGHT], // SPR_HAMM - &lspr[NOLIGHT], // SPR_KOOP - &lspr[REDBALL_L], // SPR_BFLM - &lspr[NOLIGHT], // SPR_MAXE - &lspr[NOLIGHT], // SPR_MUS1 - &lspr[NOLIGHT], // SPR_MUS2 - &lspr[NOLIGHT], // SPR_TOAD - - // NiGHTS Stuff - &lspr[SUPERSONIC_L], // SPR_NDRN // NiGHTS drone - &lspr[NOLIGHT], // SPR_NSPK - &lspr[NOLIGHT], // SPR_NBMP - &lspr[NOLIGHT], // SPR_HOOP - &lspr[NOLIGHT], // SPR_HSCR - &lspr[NOLIGHT], // SPR_NPRU - &lspr[NOLIGHT], // SPR_CAPS - &lspr[INVINCIBLE_L], // SPR_IDYA - &lspr[NOLIGHT], // SPR_NTPN - &lspr[NOLIGHT], // SPR_SHLP - - // Secret badniks and hazards, shhhh - &lspr[NOLIGHT], // SPR_PENG - &lspr[NOLIGHT], // SPR_POPH, - &lspr[NOLIGHT], // SPR_HIVE - &lspr[NOLIGHT], // SPR_BUMB, - &lspr[NOLIGHT], // SPR_BBUZ - &lspr[NOLIGHT], // SPR_FMCE, - &lspr[NOLIGHT], // SPR_HMCE, - &lspr[NOLIGHT], // SPR_CACO, - &lspr[BLUEBALL_L], // SPR_BAL2, - &lspr[NOLIGHT], // SPR_SBOB, - &lspr[BLUEBALL_L], // SPR_SBFL, - &lspr[BLUEBALL_L], // SPR_SBSK, - &lspr[NOLIGHT], // SPR_BATT, - - // Debris - &lspr[RINGSPARK_L], // SPR_SPRK - &lspr[NOLIGHT], // SPR_BOM1 - &lspr[SUPERSPARK_L], // SPR_BOM2 - &lspr[SUPERSPARK_L], // SPR_BOM3 - &lspr[NOLIGHT], // SPR_BOM4 - &lspr[REDBALL_L], // SPR_BMNB - - // Crumbly rocks - &lspr[NOLIGHT], // SPR_ROIA - &lspr[NOLIGHT], // SPR_ROIB - &lspr[NOLIGHT], // SPR_ROIC - &lspr[NOLIGHT], // SPR_ROID - &lspr[NOLIGHT], // SPR_ROIE - &lspr[NOLIGHT], // SPR_ROIF - &lspr[NOLIGHT], // SPR_ROIG - &lspr[NOLIGHT], // SPR_ROIH - &lspr[NOLIGHT], // SPR_ROII - &lspr[NOLIGHT], // SPR_ROIJ - &lspr[NOLIGHT], // SPR_ROIK - &lspr[NOLIGHT], // SPR_ROIL - &lspr[NOLIGHT], // SPR_ROIM - &lspr[NOLIGHT], // SPR_ROIN - &lspr[NOLIGHT], // SPR_ROIO - &lspr[NOLIGHT], // SPR_ROIP - - // Level debris - &lspr[NOLIGHT], // SPR_GFZD - &lspr[NOLIGHT], // SPR_BRIC - &lspr[NOLIGHT], // SPR_WDDB - - // Gravity Well Objects - &lspr[NOLIGHT], // SPR_GWLG - &lspr[NOLIGHT], // SPR_GWLR - - // Free slots - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], - &lspr[NOLIGHT], -}; - -#ifdef ALAM_LIGHTING - -//============================================================================= -// PROTOS -//============================================================================= - -static void HWR_SetLight(void); - -// -------------------------------------------------------------------------- -// calcul la projection d'un point sur une droite (determin� par deux -// points) et ensuite calcul la distance (au carr� de ce point au point -// project�sur cette droite -// -------------------------------------------------------------------------- -static float HWR_DistP2D(FOutVector *p1, FOutVector *p2, FVector *p3, FVector *inter) -{ - if (p1->z == p2->z) - { - inter->x = p3->x; - inter->z = p1->z; - } - else if (p1->x == p2->x) - { - inter->x = p1->x; - inter->z = p3->z; - } - else - { - register float local, pente; - // Wat een mooie formula! Hurdler's math;-) - pente = (p1->z-p2->z) / (p1->x-p2->x); - local = p1->z - p1->x*pente; - inter->x = (p3->z - local + p3->x/pente) * (pente/(pente*pente+1)); - inter->z = inter->x*pente + local; - } - - return (p3->x-inter->x)*(p3->x-inter->x) + (p3->z-inter->z)*(p3->z-inter->z); -} - -// check if sphere (radius r) centred in p3 touch the bounding box defined by p1, p2 -static boolean SphereTouchBBox3D(FOutVector *p1, FOutVector *p2, FVector *p3, float r) -{ - float minx = p1->x,maxx = p2->x,miny = p2->y,maxy = p1->y,minz = p2->z,maxz = p1->z; - - if (minx > maxx) - { - minx = maxx; - maxx = p1->x; - } - if (miny > maxy) - { - miny = maxy; - maxy = p2->y; - } - if (minz > maxz) - { - minz = maxz; - maxz = p2->z; - } - - if (minx-r > p3->x) return false; - if (maxx+r < p3->x) return false; - if (miny-r > p3->y) return false; - if (maxy+r < p3->y) return false; - if (minz-r > p3->z) return false; - if (maxz+r < p3->z) return false; - return true; -} - -// Hurdler: The old code was removed by me because I don't think it will be used one day. -// (It's still available on the CVS for educational purpose: Revision 1.8) - -// -------------------------------------------------------------------------- -// calcul du dynamic lighting sur les murs -// lVerts contient les coords du mur sans le mlook (up/down) -// -------------------------------------------------------------------------- -void HWR_WallLighting(FOutVector *wlVerts) -{ - int i, j; - - // dynlights->nb == 0 if cv_grdynamiclighting.value is not set - for (j = 0; j < dynlights->nb; j++) - { - FVector inter; - FSurfaceInfo Surf; - float dist_p2d, d[4], s; - - if (!dynlights->mo[j]) - continue; - if (P_MobjWasRemoved(dynlights->mo[j])) - { - P_SetTarget(&dynlights->mo[j], NULL); - continue; - } - - // check bounding box first - if (SphereTouchBBox3D(&wlVerts[2], &wlVerts[0], &LIGHT_POS(j), DL_RADIUS(j))==false) - continue; - d[0] = wlVerts[2].x - wlVerts[0].x; - d[1] = wlVerts[2].z - wlVerts[0].z; - d[2] = LIGHT_POS(j).x - wlVerts[0].x; - d[3] = LIGHT_POS(j).z - wlVerts[0].z; - // backface cull - if (d[2]*d[1] - d[3]*d[0] < 0) - continue; - // check exact distance - dist_p2d = HWR_DistP2D(&wlVerts[2], &wlVerts[0], &LIGHT_POS(j), &inter); - if (dist_p2d >= DL_SQRRADIUS(j)) - continue; - - d[0] = (float)sqrt((wlVerts[0].x-inter.x)*(wlVerts[0].x-inter.x) - + (wlVerts[0].z-inter.z)*(wlVerts[0].z-inter.z)); - d[1] = (float)sqrt((wlVerts[2].x-inter.x)*(wlVerts[2].x-inter.x) - + (wlVerts[2].z-inter.z)*(wlVerts[2].z-inter.z)); - //dAB = sqrtf((wlVerts[0].x-wlVerts[2].x)*(wlVerts[0].x-wlVerts[2].x)+(wlVerts[0].z-wlVerts[2].z)*(wlVerts[0].z-wlVerts[2].z)); - //if ((d[0] < dAB) && (d[1] < dAB)) // test if the intersection is on the wall - //{ - // d[0] = -d[0]; // if yes, the left distcance must be negative for texcoord - //} - // test if the intersection is on the wall - if ((wlVerts[0].x < inter.x && wlVerts[2].x > inter.x) || - (wlVerts[0].x > inter.x && wlVerts[2].x < inter.x) || - (wlVerts[0].z < inter.z && wlVerts[2].z > inter.z) || - (wlVerts[0].z > inter.z && wlVerts[2].z < inter.z)) - { - d[0] = -d[0]; // if yes, the left distcance must be negative for texcoord - } - d[2] = d[1]; d[3] = d[0]; -#ifdef DL_HIGH_QUALITY - s = 0.5f / DL_RADIUS(j); -#else - s = 0.5f / sqrtf(DL_SQRRADIUS(j)-dist_p2d); -#endif - for (i = 0; i < 4; i++) - { - wlVerts[i].sow = (float)(0.5f + d[i]*s); - wlVerts[i].tow = (float)(0.5f + (wlVerts[i].y-LIGHT_POS(j).y)*s*1.2f); - } - - HWR_SetLight(); - - Surf.FlatColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color); -#ifdef DL_HIGH_QUALITY - Surf.FlatColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha); -#endif - // next state is null so fade out with alpha - if (dynlights->mo[j]->state->nextstate == S_NULL) - Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha); - - HWD.pfnDrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS); - - } // end for (j = 0; j < dynlights->nb; j++) -} - -// -------------------------------------------------------------------------- -// calcul du dynamic lighting sur le sol -// clVerts contient les coords du sol avec le mlook (up/down) -// -------------------------------------------------------------------------- -void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts) -{ - int i, j; - FOutVector p1,p2; - - p1.z = FIXED_TO_FLOAT(hwbbox[BOXTOP ]); - p1.x = FIXED_TO_FLOAT(hwbbox[BOXLEFT ]); - p2.z = FIXED_TO_FLOAT(hwbbox[BOXBOTTOM]); - p2.x = FIXED_TO_FLOAT(hwbbox[BOXRIGHT ]); - p2.y = clVerts[0].y; - p1.y = clVerts[0].y; - - for (j = 0; j < dynlights->nb; j++) - { - FSurfaceInfo Surf; - float dist_p2d, s; - - if (!dynlights->mo[j]) - continue; - if (P_MobjWasRemoved(dynlights->mo[j])) - { - P_SetTarget(&dynlights->mo[j], NULL); - continue; - } - - // BP: The kickass Optimization: check if light touch bounding box - if (SphereTouchBBox3D(&p1, &p2, &dynlights->position[j], DL_RADIUS(j))==false) - continue; - // backface cull - //Hurdler: doesn't work with new TANDL code - if ((clVerts[0].y > atransform.z) // true mean it is a ceiling false is a floor - ^ (LIGHT_POS(j).y < clVerts[0].y)) // true mean light is down plane false light is up plane - continue; - dist_p2d = (clVerts[0].y-LIGHT_POS(j).y); - dist_p2d *= dist_p2d; - // done in SphereTouchBBox3D - //if (dist_p2d >= DL_SQRRADIUS(j)) - // continue; - -#ifdef DL_HIGH_QUALITY - s = 0.5f / DL_RADIUS(j); -#else - s = 0.5f / sqrtf(DL_SQRRADIUS(j)-dist_p2d); -#endif - for (i = 0; i < nrClipVerts; i++) - { - clVerts[i].sow = 0.5f + (clVerts[i].x-LIGHT_POS(j).x)*s; - clVerts[i].tow = 0.5f + (clVerts[i].z-LIGHT_POS(j).z)*s*1.2f; - } - - HWR_SetLight(); - - Surf.FlatColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color); -#ifdef DL_HIGH_QUALITY - Surf.FlatColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha); -#endif - // next state is null so fade out with alpha - if ((dynlights->mo[j]->state->nextstate == S_NULL)) - Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha); - - HWD.pfnDrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS); - - } // end for (j = 0; j < dynlights->nb; j++) -} - - -static lumpnum_t coronalumpnum = LUMPERROR; -#ifndef NEWCORONAS -// -------------------------------------------------------------------------- -// coronas lighting -// -------------------------------------------------------------------------- -void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) -{ - light_t *p_lspr; - - if (coronalumpnum == LUMPERROR) - return; - - //CONS_Debug(DBG_RENDER, "sprite (type): %d (%s)\n", spr->type, sprnames[spr->type]); - p_lspr = t_lspr[spr->mobj->sprite]; - if ((spr->mobj->state>=&states[S_EXPLODE1] && spr->mobj->state<=&states[S_EXPLODE3]) - || (spr->mobj->state>=&states[S_FATSHOTX1] && spr->mobj->state<=&states[S_FATSHOTX3])) - { - p_lspr = &lspr[ROCKETEXP_L]; - } - - if (cv_grcoronas.value && (p_lspr->type & CORONA_SPR)) - { // it's an object which emits light - FOutVector light[4]; - FSurfaceInfo Surf; - float cx = 0.0f, cy = 0.0f, cz = 0.0f; // gravity center - float size; - UINT8 i; - - switch (p_lspr->type) - { - case LIGHT_SPR: - size = p_lspr->corona_radius * ((outVerts[0].z+120.0f)/950.0f); // d'ou vienne ces constante ? - break; - case ROCKET_SPR: - p_lspr->corona_color = (((M_RandomByte()>>1)&0xff)<<24)|0x0040ff; - // don't need a break - case CORONA_SPR: - size = p_lspr->corona_radius * ((outVerts[0].z+60.0f)/100.0f); // d'ou vienne ces constante ? - break; - default: - I_Error("HWR_DoCoronasLighting: unknow light type %d",p_lspr->type); - return; - } - if (size > p_lspr->corona_radius) - size = p_lspr->corona_radius; - size *= FIXED_TO_FLOAT(cv_grcoronasize.value<<1); - - // compute position doing average - for (i = 0; i < 4; i++) - { - cx += outVerts[i].x; - cy += outVerts[i].y; - cz += outVerts[i].z; - } - cx /= 4.0f; cy /= 4.0f; cz /= 4.0f; - - // more realistique corona ! - if (cz >= 255*8+250) - return; - Surf.FlatColor.rgba = p_lspr->corona_color; - if (cz > 250.0f) - Surf.FlatColor.s.alpha = 0xff-((int)cz-250)/8; - else - Surf.FlatColor.s.alpha = 0xff; - - // do not be hide by sprite of the light itself ! - cz = cz - 2.0f; - - // Bp; je comprend pas, ou est la rotation haut/bas ? - // tu ajoute un offset a y mais si la tu la reguarde de haut - // sa devrais pas marcher ... comprend pas :( - // (...) bon je croit que j'ai comprit il est tout pourit le code ? - // car comme l'offset est minime sa ce voit pas ! - light[0].x = cx-size; light[0].z = cz; - light[0].y = cy-size*1.33f+p_lspr->light_yoffset; - light[0].sow = 0.0f; light[0].tow = 0.0f; - - light[1].x = cx+size; light[1].z = cz; - light[1].y = cy-size*1.33f+p_lspr->light_yoffset; - light[1].sow = 1.0f; light[1].tow = 0.0f; - - light[2].x = cx+size; light[2].z = cz; - light[2].y = cy+size*1.33f+p_lspr->light_yoffset; - light[2].sow = 1.0f; light[2].tow = 1.0f; - - light[3].x = cx-size; light[3].z = cz; - light[3].y = cy+size*1.33f+p_lspr->light_yoffset; - light[3].sow = 0.0f; light[3].tow = 1.0f; - - HWR_GetPic(coronalumpnum); /// \todo use different coronas - - HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_Corona | PF_NoDepthTest); - } -} -#endif - -#ifdef NEWCORONAS -// use the lightlist of the frame to draw the coronas at the top of everythink -void HWR_DrawCoronas(void) -{ - int j; - - if (!cv_grcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR) - return; - - HWR_GetPic(coronalumpnum); /// \todo use different coronas - for (j = 0;j < dynlights->nb;j++) - { - FOutVector light[4]; - FSurfaceInfo Surf; - float cx = LIGHT_POS(j).x; - float cy = LIGHT_POS(j).y; - float cz = LIGHT_POS(j).z; // gravity center - float size; - light_t *p_lspr = dynlights->p_lspr[j]; - - // it's an object which emits light - if (!(p_lspr->type & CORONA_SPR)) - continue; - - if (!dynlights->mo[j]) - continue; - if (P_MobjWasRemoved(dynlights->mo[j])) - { - P_SetTarget(&dynlights->mo[j], NULL); - continue; - } - - transform(&cx,&cy,&cz); - - // more realistique corona ! - if (cz >= 255*8+250) - continue; - Surf.FlatColor.rgba = p_lspr->corona_color; - if (cz > 250.0f) - Surf.FlatColor.s.alpha = (UINT8)(0xff-(UINT8)(((int)cz-250)/8)); - else - Surf.FlatColor.s.alpha = 0xff; - - switch (p_lspr->type) - { - case LIGHT_SPR: - size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ? - break; - case ROCKET_SPR: - Surf.FlatColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff); - // don't need a break - case CORONA_SPR: - size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ? - break; - default: - I_Error("HWR_DoCoronasLighting: unknow light type %d",p_lspr->type); - continue; - } - if (size > p_lspr->corona_radius) - size = p_lspr->corona_radius; - size = (float)(FIXED_TO_FLOAT(cv_grcoronasize.value<<1)*size); - - // put light little forward the sprite so there is no - // z-buffer problem (coplanar polygons) - // BP: use PF_Decal do not help :( - cz = cz - 5.0f; - - light[0].x = cx-size; light[0].z = cz; - light[0].y = cy-size*1.33f; - light[0].sow = 0.0f; light[0].tow = 0.0f; - - light[1].x = cx+size; light[1].z = cz; - light[1].y = cy-size*1.33f; - light[1].sow = 1.0f; light[1].tow = 0.0f; - - light[2].x = cx+size; light[2].z = cz; - light[2].y = cy+size*1.33f; - light[2].sow = 1.0f; light[2].tow = 1.0f; - - light[3].x = cx-size; light[3].z = cz; - light[3].y = cy+size*1.33f; - light[3].sow = 0.0f; light[3].tow = 1.0f; - - HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_NoDepthTest | PF_Corona); - } -} -#endif - -// -------------------------------------------------------------------------- -// Remove all the dynamic lights at eatch frame -// -------------------------------------------------------------------------- -void HWR_ResetLights(void) -{ - while (dynlights->nb) - P_SetTarget(&dynlights->mo[--dynlights->nb], NULL); -} - -// -------------------------------------------------------------------------- -// Change view, thus change lights (splitscreen) -// -------------------------------------------------------------------------- -void HWR_SetLights(int viewnumber) -{ - dynlights = &view_dynlights[viewnumber]; -} - -// -------------------------------------------------------------------------- -// Add a light for dynamic lighting -// The light position is already transformed execpt for mlook -// -------------------------------------------------------------------------- -void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) -{ - light_t *p_lspr; - - //Hurdler: moved here because it's better;-) - (void)patch; - if (!cv_grdynamiclighting.value) - return; - - if (!spr->mobj) -#ifdef PARANOIA - I_Error("vissprite without mobj !!!"); -#else - return; -#endif - - if (dynlights->nb >= DL_MAX_LIGHT) - return; - - // check if sprite contain dynamic light - p_lspr = t_lspr[spr->mobj->sprite]; - if (!(p_lspr->type & DYNLIGHT_SPR)) - return; - if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) - return; - - LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); - LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(spr->mobj->z)+FIXED_TO_FLOAT(spr->mobj->height>>1)+p_lspr->light_yoffset; - LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(spr->mobj->y); - - P_SetTarget(&dynlights->mo[dynlights->nb], spr->mobj); - - dynlights->p_lspr[dynlights->nb] = p_lspr; - - dynlights->nb++; -} - -static GLMipmap_t lightmappatchmipmap; -static GLPatch_t lightmappatch = { .mipmap = &lightmappatchmipmap }; - -void HWR_InitLight(void) -{ - size_t i; - - // precalculate sqr radius - for (i = 0;i < NUMLIGHTS;i++) - lspr[i].dynamic_sqrradius = lspr[i].dynamic_radius*lspr[i].dynamic_radius; - - lightmappatch.mipmap->downloaded = false; - coronalumpnum = W_CheckNumForName("CORONA"); -} - -// -----------------+ -// HWR_SetLight : Download a disc shaped alpha map for rendering fake lights -// -----------------+ -static void HWR_SetLight(void) -{ - int i, j; - - if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->grInfo.data) - { - - UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->grInfo.data); - - for (i = 0; i < 128; i++) - { - for (j = 0; j < 128; j++) - { - int pos = ((i-64)*(i-64))+((j-64)*(j-64)); - if (pos <= 63*63) - Data[i*128+j] = (UINT16)(((UINT8)(255-(4*(float)sqrt((float)pos)))) << 8 | 0xff); - else - Data[i*128+j] = 0; - } - } - lightmappatch.mipmap->grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88; - - lightmappatch.width = 128; - lightmappatch.height = 128; - lightmappatch.mipmap->width = 128; - lightmappatch.mipmap->height = 128; -#ifdef GLIDE_API_COMPATIBILITY - lightmappatch.mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_128; - lightmappatch.mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_128; - lightmappatch.mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; -#endif - lightmappatch.mipmap->flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw ! - } - HWD.pfnSetTexture(lightmappatch.mipmap); - - // The system-memory data can be purged now. - Z_ChangeTag(lightmappatch.mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED); -} - -//********************************************************** -// Hurdler: new code for faster static lighting and and T&L -//********************************************************** - -#ifdef STATICLIGHT -// is this really necessary? -static sector_t *lgr_backsector; -static seg_t *lgr_curline; -#endif - -// p1 et p2 c'est le deux bou du seg en float -static inline void HWR_BuildWallLightmaps(FVector *p1, FVector *p2, int lighnum, seg_t *line) -{ - lightmap_t *lp; - - // (...) calcul presit de la projection et de la distance - -// if (dist_p2d >= DL_SQRRADIUS(lightnum)) -// return; - - // (...) attention faire le backfase cull histoir de faire mieux que Q3 ! - - (void)lighnum; - (void)p1; - (void)p2; - lp = malloc(sizeof (*lp)); - lp->next = line->lightmaps; - line->lightmaps = lp; - - // (...) encore des b�calcul bien lourd et on stock tout sa dans la lightmap -} - -#ifdef STATICLIGHT -static void HWR_AddLightMapForLine(int lightnum, seg_t *line) -{ - /* - int x1; - int x2; - angle_t angle1; - angle_t angle2; - angle_t span; - angle_t tspan; - */ - FVector p1,p2; - - lgr_curline = line; - lgr_backsector = line->backsector; - - // Reject empty lines used for triggers and special events. - // Identical floor and ceiling on both sides, - // identical light levels on both sides, - // and no middle texture. -/* - if ( lgr_backsector->ceilingpic == gr_frontsector->ceilingpic - && lgr_backsector->floorpic == gr_frontsector->floorpic - && lgr_backsector->lightlevel == gr_frontsector->lightlevel - && lgr_curline->sidedef->midtexture == 0) - { - return; - } -*/ - - p1.y = FIXED_TO_FLOAT(lgr_curline->v1->y); - p1.x = FIXED_TO_FLOAT(lgr_curline->v1->x); - p2.y = FIXED_TO_FLOAT(lgr_curline->v2->y); - p2.x = FIXED_TO_FLOAT(lgr_curline->v2->x); - - // check bbox of the seg -// if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false) -// return; - - HWR_BuildWallLightmaps(&p1, &p2, lightnum, line); -} - -/// \todo see what HWR_AddLine does -static void HWR_CheckSubsector(size_t num, fixed_t *bbox) -{ - int count; - seg_t *line; - subsector_t *sub; - FVector p1,p2; - int lightnum; - - p1.y = FIXED_TO_FLOAT(bbox[BOXTOP ]); - p1.x = FIXED_TO_FLOAT(bbox[BOXLEFT ]); - p2.y = FIXED_TO_FLOAT(bbox[BOXBOTTOM]); - p2.x = FIXED_TO_FLOAT(bbox[BOXRIGHT ]); - - - if (num < numsubsectors) - { - sub = &subsectors[num]; // subsector - for (lightnum = 0; lightnum < dynlights->nb; lightnum++) - { -// if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false) -// continue; - - if (!dynlights->mo[lightnum]) - continue; - if (P_MobjWasRemoved(dynlights->mo[lightnum])) - { - P_SetTarget(&dynlights->mo[lightnum], NULL); - continue; - } - - count = sub->numlines; // how many linedefs - line = &segs[sub->firstline]; // first line seg - while (count--) - { - HWR_AddLightMapForLine (lightnum, line); // compute lightmap - line++; - } - } - } -} - - -// -------------------------------------------------------------------------- -// Hurdler: this adds lights by mobj. -// -------------------------------------------------------------------------- -static void HWR_AddMobjLights(mobj_t *thing) -{ - if (dynlights->nb >= DL_MAX_LIGHT) - return; - if (!(t_lspr[thing->sprite]->type & CORONA_SPR)) - return; - - LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(thing->x); - LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(thing->z) + t_lspr[thing->sprite]->light_yoffset; - LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(thing->y); - - P_SetTarget(&dynlights->mo[dynlights->nb], thing); - - dynlights->p_lspr[dynlights->nb] = t_lspr[thing->sprite]; - - dynlights->nb++; -} - -//Hurdler: The goal of this function is to walk through all the bsp starting -// on the top. -// We need to do that to know all the lights in the map and all the walls -static void HWR_ComputeLightMapsInBSPNode(int bspnum, fixed_t *bbox) -{ - if (bspnum & NF_SUBSECTOR) // Found a subsector? - { - if (bspnum == -1) - HWR_CheckSubsector(0, bbox); // probably unecessary: see boris' comment in hw_bsp - else - HWR_CheckSubsector(bspnum&(~NF_SUBSECTOR), bbox); - return; - } - HWR_ComputeLightMapsInBSPNode(nodes[bspnum].children[0], nodes[bspnum].bbox[0]); - HWR_ComputeLightMapsInBSPNode(nodes[bspnum].children[1], nodes[bspnum].bbox[1]); -} - -static void HWR_SearchLightsInMobjs(void) -{ - thinker_t * th; - //mobj_t * mobj; - - // search in the list of thinkers - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) - HWR_AddMobjLights((mobj_t *)th); -} -#endif - -// -// HWR_CreateStaticLightmaps() -// -void HWR_CreateStaticLightmaps(int bspnum) -{ -#ifdef STATICLIGHT - CONS_Debug(DBG_RENDER, "HWR_CreateStaticLightmaps\n"); - - HWR_ResetLights(); - - // First: Searching for lights - // BP: if i was you, I will make it in create mobj since mobj can be create - // at runtime now with fragle scipt - HWR_SearchLightsInMobjs(); - CONS_Debug(DBG_RENDER, "%d lights found\n", dynlights->nb); - - // Second: Build all lightmap for walls covered by lights - validcount++; // to be sure - HWR_ComputeLightMapsInBSPNode(bspnum, NULL); -#else - (void)bspnum; -#endif -} - -/** - \todo - - - Les coronas ne sont pas g�er avec le nouveau systeme, seul le dynamic lighting l'est - - calculer l'offset des coronas au chargement du level et non faire la moyenne - au moment de l'afficher - BP: euh non en fait il faux encoder la position de la light dans le sprite - car c'est pas focement au mileux de plus il peut en y avoir plusieur (chandelier) - - changer la comparaison pour l'affichage des coronas (+ un epsilon) - BP: non non j'ai trouver mieux :) : lord du AddSprite tu rajoute aussi la coronas - dans la sprite list ! avec un z de epsilon (attention au ZCLIP_PLANE) et donc on - l'affiche en dernier histoir qu'il puisse etre cacher par d'autre sprite :) - Bon fait metre pas mal de code special dans hwr_project sprite mais sa vaux le - coup - - gerer dynamic et static : retenir le nombre de lightstatic et clearer toute les - light > lightstatic (les dynamique) et les lightmap correspondant dans les segs - puit refaire une passe avec le code si dessus mais rien que pour les dynamiques - (tres petite modification) - - finalement virer le hack splitscreen, il n'est plus necessaire ! -*/ -#endif ->>>>>>> srb2/next #endif // HWRENDER diff --git a/src/hardware/hw_md2load.c b/src/hardware/hw_md2load.c index 38082a7b4..fed81e411 100644 --- a/src/hardware/hw_md2load.c +++ b/src/hardware/hw_md2load.c @@ -252,11 +252,8 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat) md2triangle_t *tris; md2texcoord_t *texcoords; md2frame_t *frames; -<<<<<<< HEAD -======= char *fname = NULL; int foffset = 0; ->>>>>>> srb2/next int t; @@ -331,8 +328,6 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat) texcoords = (md2texcoord_t*)&buffer[header->offsetST]; frames = (md2frame_t*)&buffer[header->offsetFrames]; -<<<<<<< HEAD -======= retModel->framenames = (char*)Z_Calloc(header->numFrames*16, ztag, 0); fname = retModel->framenames; for (i = 0; i < header->numFrames; i++) @@ -343,7 +338,6 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat) fname += 16; } ->>>>>>> srb2/next // Read in textures retModel->numMaterials = header->numSkins; diff --git a/src/hardware/hw_md3load.c b/src/hardware/hw_md3load.c index 255977f38..87931d27b 100644 --- a/src/hardware/hw_md3load.c +++ b/src/hardware/hw_md3load.c @@ -148,11 +148,8 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat) { const float WUNITS = 1.0f; model_t *retModel = NULL; -<<<<<<< HEAD -======= md3Frame *frames = NULL; char *fname = NULL; ->>>>>>> srb2/next md3modelHeader *mdh; long fileLen; long fileReadLen; @@ -232,8 +229,6 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat) retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t)*retModel->numMeshes, ztag, 0); -<<<<<<< HEAD -======= frames = (md3Frame*)&buffer[mdh->offsetFrames]; retModel->framenames = (char*)Z_Calloc(mdh->numFrames*16, ztag, 0); fname = retModel->framenames; @@ -244,7 +239,6 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat) frames++; } ->>>>>>> srb2/next matCount = 0; for (i = 0, surfEnd = 0; i < mdh->numSurfaces; i++) { diff --git a/src/hardware/hw_model.c b/src/hardware/hw_model.c index 4ae3483ca..ac73f8aca 100644 --- a/src/hardware/hw_model.c +++ b/src/hardware/hw_model.c @@ -7,13 +7,6 @@ the licensing is for Sonic Robo Blast 2. */ -<<<<<<< HEAD -#include "../z_zone.h" -#include "../doomdef.h" -#include "hw_model.h" -#include "hw_md2load.h" -#include "hw_md3load.h" -======= #include "../doomdef.h" #include "../doomtype.h" #include "../info.h" @@ -22,7 +15,6 @@ #include "hw_md2load.h" #include "hw_md3load.h" #include "hw_md2.h" ->>>>>>> srb2/next #include "u_list.h" #include @@ -206,12 +198,9 @@ model_t *LoadModel(const char *filename, int ztag) Optimize(model); GeneratePolygonNormals(model, ztag); -<<<<<<< HEAD -======= LoadModelSprite2(model); if (!model->spr2frames) LoadModelInterpolationSettings(model); ->>>>>>> srb2/next // Default material properties for (i = 0 ; i < model->numMaterials; i++) @@ -235,8 +224,6 @@ model_t *LoadModel(const char *filename, int ztag) return model; } -<<<<<<< HEAD -======= void HWR_ReloadModels(void) { size_t i; @@ -375,7 +362,6 @@ void LoadModelSprite2(model_t *model) model->spr2frames = spr2frames; } ->>>>>>> srb2/next // // GenerateVertexNormals // diff --git a/src/hardware/hw_model.h b/src/hardware/hw_model.h index 644324d73..2a5240bde 100644 --- a/src/hardware/hw_model.h +++ b/src/hardware/hw_model.h @@ -73,8 +73,6 @@ typedef struct tag_s // matrix_t transform; } tag_t; -<<<<<<< HEAD -======= #define MODEL_INTERPOLATION_FLAG "+i" typedef struct @@ -84,7 +82,6 @@ typedef struct boolean interpolate; } modelspr2frames_t; ->>>>>>> srb2/next typedef struct model_s { int maxNumFrames; @@ -98,32 +95,23 @@ typedef struct model_s char *mdlFilename; boolean unloaded; -<<<<<<< HEAD -======= char *framenames; boolean interpolate[256]; modelspr2frames_t *spr2frames; ->>>>>>> srb2/next } model_t; extern int numModels; extern model_t *modelHead; -<<<<<<< HEAD -======= void HWR_ReloadModels(void); ->>>>>>> srb2/next tag_t *GetTagByName(model_t *model, char *name, int frame); model_t *LoadModel(const char *filename, int ztag); void UnloadModel(model_t *model); void Optimize(model_t *model); -<<<<<<< HEAD -======= void LoadModelInterpolationSettings(model_t *model); void LoadModelSprite2(model_t *model); ->>>>>>> srb2/next void GenerateVertexNormals(model_t *model); void GeneratePolygonNormals(model_t *model, int ztag); void CreateVBOTiny(mesh_t *mesh, tinyframe_t *frame);