From 5b6ed4711381ae00a97f92c1a459e84375f5f2fe Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 1 Jun 2020 23:28:15 +0100 Subject: [PATCH] hw_main I wouldn't be surprised if some vanilla changes haven't made it in here I also wouldn't be too surprised if this broke a lot. My recommendation for when Hannu finishes implementing his changes for vanilla is to take the files as-is from there and re-implement our changes. --- src/hardware/hw_main.c | 1907 +--------------------------------------- src/hardware/hw_main.h | 58 -- 2 files changed, 10 insertions(+), 1955 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9083385af..359e36958 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -28,13 +28,9 @@ #include "../p_local.h" #include "../p_setup.h" #include "../r_local.h" -<<<<<<< HEAD -#include "../r_bsp.h" // R_NoEncore #include "../r_main.h" // cv_fov -======= #include "../r_patch.h" -#include "../r_bsp.h" ->>>>>>> srb2/next +#include "../r_bsp.h" // R_NoEncore #include "../d_clisrv.h" #include "../w_wad.h" #include "../z_zone.h" @@ -43,18 +39,10 @@ #include "../st_stuff.h" #include "../i_system.h" #include "../m_cheat.h" -<<<<<<< HEAD -#include "../r_things.h" // R_GetShadowZ - -#ifdef ESLOPE -#include "../p_slopes.h" -#endif -======= #include "../f_finale.h" #include "../r_things.h" // R_GetShadowZ #include "../p_slopes.h" #include "hw_md2.h" ->>>>>>> srb2/next #include // qsort @@ -69,7 +57,6 @@ struct hwdriver_s hwdriver; // Commands and console variables // ========================================================================== -<<<<<<< HEAD static void CV_filtermode_ONChange(void); static void CV_anisotropic_ONChange(void); @@ -102,203 +89,6 @@ static void CV_anisotropic_ONChange(void) { HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value); } -======= - -static void HWR_AddSprites(sector_t *sec); -static void HWR_ProjectSprite(mobj_t *thing); -#ifdef HWPRECIP -static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing); -#endif - -#ifdef SORTING -void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, - INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap); -void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, - INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap); -#else -static void HWR_Add3DWater(levelflat_t *levelflat, extrasubsector_t *xsub, fixed_t fixedheight, - INT32 lightlevel, INT32 alpha, sector_t *FOFSector); -static void HWR_Render3DWater(void); -static void HWR_RenderTransparentWalls(void); -#endif -static void HWR_FoggingOn(void); -static UINT32 atohex(const char *s); - -boolean drawsky = true; - -/* - * lookuptable for lightvalues - * calculated as follow: - * floatlight = (1.0-exp((light^3)*gamma)) / (1.0-exp(1.0*gamma)); - * gamma=-0,2;-2,0;-4,0;-6,0;-8,0 - * light = 0,0 .. 1,0 - */ -static const float lighttable[5][256] = -{ - { - 0.00000f,0.00000f,0.00000f,0.00000f,0.00000f,0.00001f,0.00001f,0.00002f,0.00003f,0.00004f, - 0.00006f,0.00008f,0.00010f,0.00013f,0.00017f,0.00020f,0.00025f,0.00030f,0.00035f,0.00041f, - 0.00048f,0.00056f,0.00064f,0.00073f,0.00083f,0.00094f,0.00106f,0.00119f,0.00132f,0.00147f, - 0.00163f,0.00180f,0.00198f,0.00217f,0.00237f,0.00259f,0.00281f,0.00305f,0.00331f,0.00358f, - 0.00386f,0.00416f,0.00447f,0.00479f,0.00514f,0.00550f,0.00587f,0.00626f,0.00667f,0.00710f, - 0.00754f,0.00800f,0.00848f,0.00898f,0.00950f,0.01003f,0.01059f,0.01117f,0.01177f,0.01239f, - 0.01303f,0.01369f,0.01437f,0.01508f,0.01581f,0.01656f,0.01734f,0.01814f,0.01896f,0.01981f, - 0.02069f,0.02159f,0.02251f,0.02346f,0.02444f,0.02544f,0.02647f,0.02753f,0.02862f,0.02973f, - 0.03088f,0.03205f,0.03325f,0.03448f,0.03575f,0.03704f,0.03836f,0.03971f,0.04110f,0.04252f, - 0.04396f,0.04545f,0.04696f,0.04851f,0.05009f,0.05171f,0.05336f,0.05504f,0.05676f,0.05852f, - 0.06031f,0.06214f,0.06400f,0.06590f,0.06784f,0.06981f,0.07183f,0.07388f,0.07597f,0.07810f, - 0.08027f,0.08248f,0.08473f,0.08702f,0.08935f,0.09172f,0.09414f,0.09659f,0.09909f,0.10163f, - 0.10421f,0.10684f,0.10951f,0.11223f,0.11499f,0.11779f,0.12064f,0.12354f,0.12648f,0.12946f, - 0.13250f,0.13558f,0.13871f,0.14188f,0.14511f,0.14838f,0.15170f,0.15507f,0.15850f,0.16197f, - 0.16549f,0.16906f,0.17268f,0.17635f,0.18008f,0.18386f,0.18769f,0.19157f,0.19551f,0.19950f, - 0.20354f,0.20764f,0.21179f,0.21600f,0.22026f,0.22458f,0.22896f,0.23339f,0.23788f,0.24242f, - 0.24702f,0.25168f,0.25640f,0.26118f,0.26602f,0.27091f,0.27587f,0.28089f,0.28596f,0.29110f, - 0.29630f,0.30156f,0.30688f,0.31226f,0.31771f,0.32322f,0.32879f,0.33443f,0.34013f,0.34589f, - 0.35172f,0.35761f,0.36357f,0.36960f,0.37569f,0.38185f,0.38808f,0.39437f,0.40073f,0.40716f, - 0.41366f,0.42022f,0.42686f,0.43356f,0.44034f,0.44718f,0.45410f,0.46108f,0.46814f,0.47527f, - 0.48247f,0.48974f,0.49709f,0.50451f,0.51200f,0.51957f,0.52721f,0.53492f,0.54271f,0.55058f, - 0.55852f,0.56654f,0.57463f,0.58280f,0.59105f,0.59937f,0.60777f,0.61625f,0.62481f,0.63345f, - 0.64217f,0.65096f,0.65984f,0.66880f,0.67783f,0.68695f,0.69615f,0.70544f,0.71480f,0.72425f, - 0.73378f,0.74339f,0.75308f,0.76286f,0.77273f,0.78268f,0.79271f,0.80283f,0.81304f,0.82333f, - 0.83371f,0.84417f,0.85472f,0.86536f,0.87609f,0.88691f,0.89781f,0.90880f,0.91989f,0.93106f, - 0.94232f,0.95368f,0.96512f,0.97665f,0.98828f,1.00000f - }, - { - 0.00000f,0.00000f,0.00000f,0.00000f,0.00001f,0.00002f,0.00003f,0.00005f,0.00007f,0.00010f, - 0.00014f,0.00019f,0.00024f,0.00031f,0.00038f,0.00047f,0.00057f,0.00069f,0.00081f,0.00096f, - 0.00112f,0.00129f,0.00148f,0.00170f,0.00193f,0.00218f,0.00245f,0.00274f,0.00306f,0.00340f, - 0.00376f,0.00415f,0.00456f,0.00500f,0.00547f,0.00597f,0.00649f,0.00704f,0.00763f,0.00825f, - 0.00889f,0.00957f,0.01029f,0.01104f,0.01182f,0.01264f,0.01350f,0.01439f,0.01532f,0.01630f, - 0.01731f,0.01836f,0.01945f,0.02058f,0.02176f,0.02298f,0.02424f,0.02555f,0.02690f,0.02830f, - 0.02974f,0.03123f,0.03277f,0.03436f,0.03600f,0.03768f,0.03942f,0.04120f,0.04304f,0.04493f, - 0.04687f,0.04886f,0.05091f,0.05301f,0.05517f,0.05738f,0.05964f,0.06196f,0.06434f,0.06677f, - 0.06926f,0.07181f,0.07441f,0.07707f,0.07979f,0.08257f,0.08541f,0.08831f,0.09126f,0.09428f, - 0.09735f,0.10048f,0.10368f,0.10693f,0.11025f,0.11362f,0.11706f,0.12056f,0.12411f,0.12773f, - 0.13141f,0.13515f,0.13895f,0.14281f,0.14673f,0.15072f,0.15476f,0.15886f,0.16303f,0.16725f, - 0.17153f,0.17587f,0.18028f,0.18474f,0.18926f,0.19383f,0.19847f,0.20316f,0.20791f,0.21272f, - 0.21759f,0.22251f,0.22748f,0.23251f,0.23760f,0.24274f,0.24793f,0.25318f,0.25848f,0.26383f, - 0.26923f,0.27468f,0.28018f,0.28573f,0.29133f,0.29697f,0.30266f,0.30840f,0.31418f,0.32001f, - 0.32588f,0.33179f,0.33774f,0.34374f,0.34977f,0.35585f,0.36196f,0.36810f,0.37428f,0.38050f, - 0.38675f,0.39304f,0.39935f,0.40570f,0.41207f,0.41847f,0.42490f,0.43136f,0.43784f,0.44434f, - 0.45087f,0.45741f,0.46398f,0.47057f,0.47717f,0.48379f,0.49042f,0.49707f,0.50373f,0.51041f, - 0.51709f,0.52378f,0.53048f,0.53718f,0.54389f,0.55061f,0.55732f,0.56404f,0.57075f,0.57747f, - 0.58418f,0.59089f,0.59759f,0.60429f,0.61097f,0.61765f,0.62432f,0.63098f,0.63762f,0.64425f, - 0.65086f,0.65746f,0.66404f,0.67060f,0.67714f,0.68365f,0.69015f,0.69662f,0.70307f,0.70948f, - 0.71588f,0.72224f,0.72857f,0.73488f,0.74115f,0.74739f,0.75359f,0.75976f,0.76589f,0.77199f, - 0.77805f,0.78407f,0.79005f,0.79599f,0.80189f,0.80774f,0.81355f,0.81932f,0.82504f,0.83072f, - 0.83635f,0.84194f,0.84747f,0.85296f,0.85840f,0.86378f,0.86912f,0.87441f,0.87964f,0.88482f, - 0.88995f,0.89503f,0.90005f,0.90502f,0.90993f,0.91479f,0.91959f,0.92434f,0.92903f,0.93366f, - 0.93824f,0.94276f,0.94723f,0.95163f,0.95598f,0.96027f,0.96451f,0.96868f,0.97280f,0.97686f, - 0.98086f,0.98481f,0.98869f,0.99252f,0.99629f,1.00000f - }, - { - 0.00000f,0.00000f,0.00000f,0.00001f,0.00002f,0.00003f,0.00005f,0.00008f,0.00013f,0.00018f, - 0.00025f,0.00033f,0.00042f,0.00054f,0.00067f,0.00083f,0.00101f,0.00121f,0.00143f,0.00168f, - 0.00196f,0.00227f,0.00261f,0.00299f,0.00339f,0.00383f,0.00431f,0.00483f,0.00538f,0.00598f, - 0.00661f,0.00729f,0.00802f,0.00879f,0.00961f,0.01048f,0.01140f,0.01237f,0.01340f,0.01447f, - 0.01561f,0.01680f,0.01804f,0.01935f,0.02072f,0.02215f,0.02364f,0.02520f,0.02682f,0.02850f, - 0.03026f,0.03208f,0.03397f,0.03594f,0.03797f,0.04007f,0.04225f,0.04451f,0.04684f,0.04924f, - 0.05172f,0.05428f,0.05691f,0.05963f,0.06242f,0.06530f,0.06825f,0.07129f,0.07441f,0.07761f, - 0.08089f,0.08426f,0.08771f,0.09125f,0.09487f,0.09857f,0.10236f,0.10623f,0.11019f,0.11423f, - 0.11836f,0.12257f,0.12687f,0.13125f,0.13571f,0.14027f,0.14490f,0.14962f,0.15442f,0.15931f, - 0.16427f,0.16932f,0.17445f,0.17966f,0.18496f,0.19033f,0.19578f,0.20130f,0.20691f,0.21259f, - 0.21834f,0.22417f,0.23007f,0.23605f,0.24209f,0.24820f,0.25438f,0.26063f,0.26694f,0.27332f, - 0.27976f,0.28626f,0.29282f,0.29944f,0.30611f,0.31284f,0.31962f,0.32646f,0.33334f,0.34027f, - 0.34724f,0.35426f,0.36132f,0.36842f,0.37556f,0.38273f,0.38994f,0.39718f,0.40445f,0.41174f, - 0.41907f,0.42641f,0.43378f,0.44116f,0.44856f,0.45598f,0.46340f,0.47084f,0.47828f,0.48573f, - 0.49319f,0.50064f,0.50809f,0.51554f,0.52298f,0.53042f,0.53784f,0.54525f,0.55265f,0.56002f, - 0.56738f,0.57472f,0.58203f,0.58932f,0.59658f,0.60381f,0.61101f,0.61817f,0.62529f,0.63238f, - 0.63943f,0.64643f,0.65339f,0.66031f,0.66717f,0.67399f,0.68075f,0.68746f,0.69412f,0.70072f, - 0.70726f,0.71375f,0.72017f,0.72653f,0.73282f,0.73905f,0.74522f,0.75131f,0.75734f,0.76330f, - 0.76918f,0.77500f,0.78074f,0.78640f,0.79199f,0.79751f,0.80295f,0.80831f,0.81359f,0.81880f, - 0.82393f,0.82898f,0.83394f,0.83883f,0.84364f,0.84836f,0.85301f,0.85758f,0.86206f,0.86646f, - 0.87078f,0.87502f,0.87918f,0.88326f,0.88726f,0.89118f,0.89501f,0.89877f,0.90245f,0.90605f, - 0.90957f,0.91301f,0.91638f,0.91966f,0.92288f,0.92601f,0.92908f,0.93206f,0.93498f,0.93782f, - 0.94059f,0.94329f,0.94592f,0.94848f,0.95097f,0.95339f,0.95575f,0.95804f,0.96027f,0.96244f, - 0.96454f,0.96658f,0.96856f,0.97049f,0.97235f,0.97416f,0.97591f,0.97760f,0.97924f,0.98083f, - 0.98237f,0.98386f,0.98530f,0.98669f,0.98803f,0.98933f,0.99058f,0.99179f,0.99295f,0.99408f, - 0.99516f,0.99620f,0.99721f,0.99817f,0.99910f,1.00000f - }, - { - 0.00000f,0.00000f,0.00000f,0.00001f,0.00002f,0.00005f,0.00008f,0.00012f,0.00019f,0.00026f, - 0.00036f,0.00048f,0.00063f,0.00080f,0.00099f,0.00122f,0.00148f,0.00178f,0.00211f,0.00249f, - 0.00290f,0.00335f,0.00386f,0.00440f,0.00500f,0.00565f,0.00636f,0.00711f,0.00793f,0.00881f, - 0.00975f,0.01075f,0.01182f,0.01295f,0.01416f,0.01543f,0.01678f,0.01821f,0.01971f,0.02129f, - 0.02295f,0.02469f,0.02652f,0.02843f,0.03043f,0.03252f,0.03469f,0.03696f,0.03933f,0.04178f, - 0.04433f,0.04698f,0.04973f,0.05258f,0.05552f,0.05857f,0.06172f,0.06498f,0.06834f,0.07180f, - 0.07537f,0.07905f,0.08283f,0.08672f,0.09072f,0.09483f,0.09905f,0.10337f,0.10781f,0.11236f, - 0.11701f,0.12178f,0.12665f,0.13163f,0.13673f,0.14193f,0.14724f,0.15265f,0.15817f,0.16380f, - 0.16954f,0.17538f,0.18132f,0.18737f,0.19351f,0.19976f,0.20610f,0.21255f,0.21908f,0.22572f, - 0.23244f,0.23926f,0.24616f,0.25316f,0.26023f,0.26739f,0.27464f,0.28196f,0.28935f,0.29683f, - 0.30437f,0.31198f,0.31966f,0.32740f,0.33521f,0.34307f,0.35099f,0.35896f,0.36699f,0.37506f, - 0.38317f,0.39133f,0.39952f,0.40775f,0.41601f,0.42429f,0.43261f,0.44094f,0.44929f,0.45766f, - 0.46604f,0.47443f,0.48283f,0.49122f,0.49962f,0.50801f,0.51639f,0.52476f,0.53312f,0.54146f, - 0.54978f,0.55807f,0.56633f,0.57457f,0.58277f,0.59093f,0.59905f,0.60713f,0.61516f,0.62314f, - 0.63107f,0.63895f,0.64676f,0.65452f,0.66221f,0.66984f,0.67739f,0.68488f,0.69229f,0.69963f, - 0.70689f,0.71407f,0.72117f,0.72818f,0.73511f,0.74195f,0.74870f,0.75536f,0.76192f,0.76839f, - 0.77477f,0.78105f,0.78723f,0.79331f,0.79930f,0.80518f,0.81096f,0.81664f,0.82221f,0.82768f, - 0.83305f,0.83832f,0.84347f,0.84853f,0.85348f,0.85832f,0.86306f,0.86770f,0.87223f,0.87666f, - 0.88098f,0.88521f,0.88933f,0.89334f,0.89726f,0.90108f,0.90480f,0.90842f,0.91194f,0.91537f, - 0.91870f,0.92193f,0.92508f,0.92813f,0.93109f,0.93396f,0.93675f,0.93945f,0.94206f,0.94459f, - 0.94704f,0.94941f,0.95169f,0.95391f,0.95604f,0.95810f,0.96009f,0.96201f,0.96386f,0.96564f, - 0.96735f,0.96900f,0.97059f,0.97212f,0.97358f,0.97499f,0.97634f,0.97764f,0.97888f,0.98007f, - 0.98122f,0.98231f,0.98336f,0.98436f,0.98531f,0.98623f,0.98710f,0.98793f,0.98873f,0.98949f, - 0.99021f,0.99090f,0.99155f,0.99218f,0.99277f,0.99333f,0.99387f,0.99437f,0.99486f,0.99531f, - 0.99575f,0.99616f,0.99654f,0.99691f,0.99726f,0.99759f,0.99790f,0.99819f,0.99847f,0.99873f, - 0.99897f,0.99920f,0.99942f,0.99963f,0.99982f,1.00000f - }, - { - 0.00000f,0.00000f,0.00000f,0.00001f,0.00003f,0.00006f,0.00010f,0.00017f,0.00025f,0.00035f, - 0.00048f,0.00064f,0.00083f,0.00106f,0.00132f,0.00163f,0.00197f,0.00237f,0.00281f,0.00330f, - 0.00385f,0.00446f,0.00513f,0.00585f,0.00665f,0.00751f,0.00845f,0.00945f,0.01054f,0.01170f, - 0.01295f,0.01428f,0.01569f,0.01719f,0.01879f,0.02048f,0.02227f,0.02415f,0.02614f,0.02822f, - 0.03042f,0.03272f,0.03513f,0.03765f,0.04028f,0.04303f,0.04589f,0.04887f,0.05198f,0.05520f, - 0.05855f,0.06202f,0.06561f,0.06933f,0.07318f,0.07716f,0.08127f,0.08550f,0.08987f,0.09437f, - 0.09900f,0.10376f,0.10866f,0.11369f,0.11884f,0.12414f,0.12956f,0.13512f,0.14080f,0.14662f, - 0.15257f,0.15865f,0.16485f,0.17118f,0.17764f,0.18423f,0.19093f,0.19776f,0.20471f,0.21177f, - 0.21895f,0.22625f,0.23365f,0.24117f,0.24879f,0.25652f,0.26435f,0.27228f,0.28030f,0.28842f, - 0.29662f,0.30492f,0.31329f,0.32175f,0.33028f,0.33889f,0.34756f,0.35630f,0.36510f,0.37396f, - 0.38287f,0.39183f,0.40084f,0.40989f,0.41897f,0.42809f,0.43723f,0.44640f,0.45559f,0.46479f, - 0.47401f,0.48323f,0.49245f,0.50167f,0.51088f,0.52008f,0.52927f,0.53843f,0.54757f,0.55668f, - 0.56575f,0.57479f,0.58379f,0.59274f,0.60164f,0.61048f,0.61927f,0.62799f,0.63665f,0.64524f, - 0.65376f,0.66220f,0.67056f,0.67883f,0.68702f,0.69511f,0.70312f,0.71103f,0.71884f,0.72655f, - 0.73415f,0.74165f,0.74904f,0.75632f,0.76348f,0.77053f,0.77747f,0.78428f,0.79098f,0.79756f, - 0.80401f,0.81035f,0.81655f,0.82264f,0.82859f,0.83443f,0.84013f,0.84571f,0.85117f,0.85649f, - 0.86169f,0.86677f,0.87172f,0.87654f,0.88124f,0.88581f,0.89026f,0.89459f,0.89880f,0.90289f, - 0.90686f,0.91071f,0.91445f,0.91807f,0.92157f,0.92497f,0.92826f,0.93143f,0.93450f,0.93747f, - 0.94034f,0.94310f,0.94577f,0.94833f,0.95081f,0.95319f,0.95548f,0.95768f,0.95980f,0.96183f, - 0.96378f,0.96565f,0.96744f,0.96916f,0.97081f,0.97238f,0.97388f,0.97532f,0.97669f,0.97801f, - 0.97926f,0.98045f,0.98158f,0.98266f,0.98369f,0.98467f,0.98560f,0.98648f,0.98732f,0.98811f, - 0.98886f,0.98958f,0.99025f,0.99089f,0.99149f,0.99206f,0.99260f,0.99311f,0.99359f,0.99404f, - 0.99446f,0.99486f,0.99523f,0.99559f,0.99592f,0.99623f,0.99652f,0.99679f,0.99705f,0.99729f, - 0.99751f,0.99772f,0.99792f,0.99810f,0.99827f,0.99843f,0.99857f,0.99871f,0.99884f,0.99896f, - 0.99907f,0.99917f,0.99926f,0.99935f,0.99943f,0.99951f,0.99958f,0.99964f,0.99970f,0.99975f, - 0.99980f,0.99985f,0.99989f,0.99993f,0.99997f,1.00000f - } -}; - -#define gld_CalcLightLevel(lightlevel) (lighttable[1][max(min((lightlevel),255),0)]) - -// ========================================================================== -// VIEW GLOBALS -// ========================================================================== -// Fineangles in the SCREENWIDTH wide window. -#define FIELDOFVIEW ANGLE_90 -#define ABS(x) ((x) < 0 ? -(x) : (x)) - -static angle_t gr_clipangle; - -// The viewangletox[viewangle + FINEANGLES/4] lookup -// maps the visible view angles to screen X coordinates, -// flattening the arc to a flat projection plane. -// There will be many angles mapped to the same X. -static INT32 gr_viewangletox[FINEANGLES/2]; - -// The xtoviewangleangle[] table maps a screen pixel -// to the lowest viewangle that maps back to x ranges -// from clipangle to -clipangle. -static angle_t gr_xtoviewangle[MAXVIDWIDTH+1]; ->>>>>>> srb2/next // ========================================================================== // Globals @@ -463,11 +253,6 @@ static FUINT HWR_CalcWallLight(seg_t *line, FUINT lightnum) // Floor and ceiling generation from subsectors // ========================================================================== -<<<<<<< HEAD -// HWR_RenderPlane -// Render a floor or ceiling convex polygon -void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap) -======= #ifdef DOPLANES // -----------------+ @@ -475,7 +260,6 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei // -----------------+ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, boolean fogplane, extracolormap_t *planecolormap) ->>>>>>> srb2/next { polyvertex_t * pv; float height; //constant y for all points on the convex flat polygon @@ -528,10 +312,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (nrPlaneVerts < 3) //not even a triangle ? return; -<<<<<<< HEAD -======= // This check is so inconsistent between functions, it hurts. ->>>>>>> srb2/next if (nrPlaneVerts > INT16_MAX) // FIXME: exceeds plVerts size { CONS_Debug(DBG_RENDER, "polygon size of %d exceeds max value of %d vertices\n", nrPlaneVerts, INT16_MAX); @@ -599,24 +380,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool { if (!isceiling) // it's a floor { -<<<<<<< HEAD - scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize; -======= scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatwidth; scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatheight; ->>>>>>> srb2/next angle = FOFsector->floorpic_angle; } else // it's a ceiling { -<<<<<<< HEAD - scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize; -======= scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatwidth; scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatheight; ->>>>>>> srb2/next angle = FOFsector->ceilingpic_angle; } } @@ -624,24 +395,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool { if (!isceiling) // it's a floor { -<<<<<<< HEAD - scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize; -======= scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatwidth; scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatheight; ->>>>>>> srb2/next angle = gr_frontsector->floorpic_angle; } else // it's a ceiling { -<<<<<<< HEAD - scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize; - scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize; -======= scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatwidth; scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatheight; ->>>>>>> srb2/next angle = gr_frontsector->ceilingpic_angle; } } @@ -649,19 +410,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (angle) // Only needs to be done if there's an altered angle { -<<<<<<< HEAD - - angle = (InvAngle(angle)+ANGLE_180)>>ANGLETOFINESHIFT; - - // This needs to be done so that it scrolls in a different direction after rotation like software - /*tempxsow = FLOAT_TO_FIXED(scrollx); - tempytow = FLOAT_TO_FIXED(scrolly); - scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));*/ - -======= angle = InvAngle(angle)>>ANGLETOFINESHIFT; ->>>>>>> srb2/next // This needs to be done so everything aligns after rotation // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does tempxsow = FLOAT_TO_FIXED(flatxref); @@ -670,29 +419,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); } -<<<<<<< HEAD - - for (i = 0; i < nrPlaneVerts; i++,v3d++,pv++) - { - // Hurdler: add scrolling texture on floor/ceiling - v3d->s = (float)((pv->x / fflatsize) - flatxref + scrollx); - v3d->t = (float)(flatyref - (pv->y / fflatsize) + scrolly); - - //v3d->s = (float)(pv->x / fflatsize); - //v3d->t = (float)(pv->y / fflatsize); - - // Need to rotate before translate - if (angle) // Only needs to be done if there's an altered angle - { - tempxsow = FLOAT_TO_FIXED(v3d->s); - tempytow = FLOAT_TO_FIXED(v3d->t); - v3d->s = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - v3d->t = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); - } - - //v3d->s = (float)(v3d->s - flatxref + scrollx); - //v3d->t = (float)(flatyref - v3d->t + scrolly); -======= #define SETUP3DVERT(vert, vx, vy) {\ /* Hurdler: add scrolling texture on floor/ceiling */\ if (texflat)\ @@ -727,16 +453,12 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool vert->y = FIXED_TO_FLOAT(fixedheight);\ }\ } ->>>>>>> srb2/next for (i = 0, v3d = planeVerts; i < nrPlaneVerts; i++,v3d++,pv++) SETUP3DVERT(v3d, pv->x, pv->y); HWR_Lighting(&Surf, lightlevel, planecolormap); -<<<<<<< HEAD - if (PolyFlags & (PF_Translucent|PF_Fog)) -======= // use different light tables // for horizontal / vertical / diagonal // note: try to get the same visual feel as the original @@ -744,7 +466,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool Surf.FlatColor.s.blue = LightLevelToLum(lightlevel); // Don't take from the frontsector, or the game will crash if (planecolormap) ->>>>>>> srb2/next { Surf.PolyColor.s.alpha = (UINT8)alpha; PolyFlags |= PF_Modulated; @@ -760,8 +481,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool HWD.pfnSetShader(1); // floor shader HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags); -<<<<<<< HEAD -======= if (subsector) { @@ -884,7 +603,6 @@ static void HWR_RenderSkyPlane(extrasubsector_t *xsub, fixed_t fixedheight) HWD.pfnDrawPolygon(NULL, planeVerts, nrPlaneVerts, PF_Clip|PF_Invisible|PF_NoTexture|PF_Occlude); ->>>>>>> srb2/next } #ifdef WALLSPLATS @@ -1046,13 +764,8 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa INT32 solid, i; lightlist_t * list = sector->lightlist; -<<<<<<< HEAD const UINT8 alpha = Surf->PolyColor.s.alpha; FUINT lightnum = HWR_CalcWallLight(gr_curline, sector->lightlevel); -======= - const UINT8 alpha = Surf->FlatColor.s.alpha; - FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y); ->>>>>>> srb2/next extracolormap_t *colormap = NULL; realtop = top = wallVerts[3].y; @@ -1069,44 +782,24 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa for (i = 0; i < sector->numlights; i++) { -<<<<<<< HEAD -#ifdef ESLOPE - if (endtop < endrealbot) -#endif - if (top < realbot) - return; - -======= if (endtop < endrealbot && top < realbot) return; // There's a compiler warning here if this comment isn't here because of indentation ->>>>>>> srb2/next if (!(list[i].flags & FF_NOSHADE)) { if (pfloor && (pfloor->flags & FF_FOG)) { -<<<<<<< HEAD lightnum = HWR_CalcWallLight(gr_curline, pfloor->master->frontsector->lightlevel); -======= - lightnum = HWR_CalcWallLight(pfloor->master->frontsector->lightlevel, v1x, v1y, v2x, v2y); ->>>>>>> srb2/next colormap = pfloor->master->frontsector->extra_colormap; } else { -<<<<<<< HEAD lightnum = HWR_CalcWallLight(gr_curline, *list[i].lightlevel); colormap = list[i].extra_colormap; -======= - lightnum = HWR_CalcWallLight(*list[i].lightlevel, v1x, v1y, v2x, v2y); - colormap = *list[i].extra_colormap; ->>>>>>> srb2/next } } - solid = false; - if ((sector->lightlist[i].flags & FF_CUTSOLIDS) && !(cutflag & FF_EXTRA)) solid = true; else if ((sector->lightlist[i].flags & FF_CUTEXTRA) && (cutflag & FF_EXTRA)) @@ -1168,12 +861,7 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa if (endbot < endrealbot) endbot = endrealbot; -<<<<<<< HEAD -#endif - Surf->PolyColor.s.alpha = alpha; -======= Surf->FlatColor.s.alpha = alpha; ->>>>>>> srb2/next wallVerts[3].t = pegt + ((realtop - top) * pegmul); wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); @@ -1225,11 +913,7 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa // HWR_DrawSkyWall // Draw walls into the depth buffer so that anything behind is culled properly -<<<<<<< HEAD -void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf) -======= static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf) ->>>>>>> srb2/next { HWD.pfnSetTexture(NULL); // no texture @@ -1237,13 +921,8 @@ static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf) wallVerts[0].t = wallVerts[1].t = 0; wallVerts[0].s = wallVerts[3].s = 0; wallVerts[2].s = wallVerts[1].s = 0; -<<<<<<< HEAD - - HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_NoTexture, 255, NULL); -======= // this no longer sets top/bottom coords, this should be done before caling the function HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_Clip|PF_NoTexture, 255, NULL); ->>>>>>> srb2/next // PF_Invisible so it's not drawn into the colour buffer // PF_NoTexture for no texture // PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer @@ -1316,11 +995,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT)); } -<<<<<<< HEAD lightnum = HWR_CalcWallLight(gr_curline, gr_frontsector->lightlevel); -======= - lightnum = HWR_CalcWallLight(gr_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); ->>>>>>> srb2/next colormap = gr_frontsector->extra_colormap; if (gr_frontsector) @@ -1337,7 +1012,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight) #undef SLOPEPARAMS -<<<<<<< HEAD // Sky culling if (!gr_curline->polyseg) // Don't do it for polyobjects { @@ -1386,43 +1060,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom #endif HWR_DrawSkyWall(wallVerts, &Surf); } -======= - // hack to allow height changes in outdoor areas - // This is what gets rid of the upper textures if there should be sky - if (gr_frontsector->ceilingpic == skyflatnum - && gr_backsector->ceilingpic == skyflatnum) - { - bothceilingssky = true; - } - - // likewise, but for floors and upper textures - if (gr_frontsector->floorpic == skyflatnum - && gr_backsector->floorpic == skyflatnum) - { - bothfloorssky = true; - } - - if (!bothceilingssky) - gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); - if (!bothfloorssky) - gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); - - // check TOP TEXTURE - if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gr_toptexture) - { - { - fixed_t texturevpegtop; // top - - grTex = HWR_GetTexture(gr_toptexture); - - // PEGGING - if (gr_linedef->flags & ML_DONTPEGTOP) - texturevpegtop = 0; - else if (gr_linedef->flags & ML_EFFECT1) - texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop; - else - texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight; ->>>>>>> srb2/next // Sky Floors @@ -1878,44 +1515,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, blendmode, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap); -<<<<<<< HEAD -======= - - // If there is a colormap change, remove it. -/* if (!(Surf.FlatColor.s.red + Surf.FlatColor.s.green + Surf.FlatColor.s.blue == Surf.FlatColor.s.red/3) - { - Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; - Surf.FlatColor.rgba = 0xffffffff; - }*/ - } - -#if 1 - // Sky culling - // No longer so much a mess as before! - if (!gr_curline->polyseg) // Don't do it for polyobjects - { - if (gr_frontsector->ceilingpic == skyflatnum) - { - if (gr_backsector->ceilingpic != skyflatnum) // don't cull if back sector is also sky - { - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space - wallVerts[0].y = FIXED_TO_FLOAT(worldtop); - wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); - HWR_DrawSkyWall(wallVerts, &Surf); - } - } - - if (gr_frontsector->floorpic == skyflatnum) - { - if (gr_backsector->floorpic != skyflatnum) // don't cull if back sector is also sky - { - wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space - HWR_DrawSkyWall(wallVerts, &Surf); - } - } ->>>>>>> srb2/next } #endif } @@ -1923,12 +1522,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // Single sided line... Deal only with the middletexture (if one exists) gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); -<<<<<<< HEAD - if (gr_midtexture - && gr_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL -======= if (gr_midtexture && gr_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL ->>>>>>> srb2/next { { fixed_t texturevpeg; @@ -1968,17 +1562,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); -<<<<<<< HEAD -#else - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom); -#endif - -======= // I don't think that solid walls can use translucent linedef types... ->>>>>>> srb2/next if (gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL); // I don't think that solid walls can use translucent linedef types... @@ -2015,37 +1600,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector { -<<<<<<< HEAD - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(INT32_MAX); -#ifdef ESLOPE - wallVerts[0].y = FIXED_TO_FLOAT(worldtop); - wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); -#else - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop); -#endif -======= wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space wallVerts[0].y = FIXED_TO_FLOAT(worldtop); wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); ->>>>>>> srb2/next HWR_DrawSkyWall(wallVerts, &Surf); } if (gr_frontsector->floorpic == skyflatnum) { -<<<<<<< HEAD -#ifdef ESLOPE - wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); - wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); -#else - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(worldbottom); -#endif - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); - -======= wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space ->>>>>>> srb2/next HWR_DrawSkyWall(wallVerts, &Surf); } } @@ -2167,11 +1731,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode = PF_Fog|PF_NoTexture; -<<<<<<< HEAD lightnum = HWR_CalcWallLight(gr_curline, rover->master->frontsector->lightlevel); -======= - lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); ->>>>>>> srb2/next colormap = rover->master->frontsector->extra_colormap; Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); @@ -2271,11 +1831,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode = PF_Fog|PF_NoTexture; -<<<<<<< HEAD lightnum = HWR_CalcWallLight(gr_curline, rover->master->frontsector->lightlevel); -======= - lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y); ->>>>>>> srb2/next colormap = rover->master->frontsector->extra_colormap; Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); @@ -2353,7 +1909,6 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) { frontf1 = frontf2 = afrontsector-> floorheight; frontc1 = frontc2 = afrontsector->ceilingheight; -<<<<<<< HEAD backf1 = backf2 = abacksector->floorheight; backc1 = backc2 = abacksector->ceilingheight; } @@ -2394,44 +1949,10 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) return false; if (backf1 > frontf1 || backf2 > frontf2) -======= - backf1 = backf2 = abacksector-> floorheight; - backc1 = backc2 = abacksector->ceilingheight; - } - // properly render skies (consider door "open" if both ceilings are sky) - // same for floors - if (!bothceilingssky && !bothfloorssky) - { - // now check for closed sectors! - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) - { - checkforemptylines = false; - return true; - } - - if (backc1 <= backf1 && backc2 <= backf2) - { - // preserve a kind of transparent door/lift special effect: - if (((backc1 >= frontc1 && backc2 >= frontc2) || seg->sidedef->toptexture) - && ((backf1 <= frontf1 && backf2 <= frontf2) || seg->sidedef->bottomtexture)) - { - checkforemptylines = false; - return true; - } - } - } - - if (!bothceilingssky) { - if (backc1 != frontc1 || backc2 != frontc2) - { - checkforemptylines = false; ->>>>>>> srb2/next return false; } } -<<<<<<< HEAD // Window. // We know it's a window when the above isn't true and the back and front sectors don't match if (backc1 != frontc1 || backc2 != frontc2 @@ -2439,14 +1960,6 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) { checkforemptylines = false; return false; -======= - if (!bothfloorssky) { - if (backf1 != frontf1 || backf2 != frontf2) - { - checkforemptylines = false; - return false; - } ->>>>>>> srb2/next } // In this case we just need to check whether there is actually a need to render any lines, so checkforempty lines @@ -2460,22 +1973,12 @@ void HWR_AddLine(seg_t *line) { angle_t angle1, angle2; -<<<<<<< HEAD // SoM: Backsector needs to be run through R_FakeFlat static sector_t tempsec; fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t #ifdef POLYOBJECTS if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) -======= -// needs fix: walls are incorrectly clipped one column less -static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - -static void printsolidsegs(void) -{ - cliprange_t * start; - if (!hw_newend) ->>>>>>> srb2/next return; #endif @@ -2520,476 +2023,8 @@ static void printsolidsegs(void) return; } -<<<<<<< HEAD HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D return; -======= - if (last <= next->last) - { - // Bottom is contained in next. - // Adjust the clip size. - start->last = next->last; - goto crunch; - } - } - - if (first == next->first+1) // 1 line texture - { - if (!cv_grclipwalls.value) - { - if (!poorhack) HWR_StoreWallRange(first,last); - poorhack = true; - } - else - HWR_StoreWallRange(0, 1); - } - else - { - // There is a fragment after *next. - if (!cv_grclipwalls.value) - { - if (!poorhack) HWR_StoreWallRange(first,last); - poorhack = true; - } - else - { - lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); - HWR_StoreWallRange(lowfrac, 1); - } - } - - // Adjust the clip size. - start->last = last; - - // Remove start+1 to next from the clip list, - // because start now covers their area. -crunch: - if (next == start) - { - printsolidsegs(); - // Post just extended past the bottom of one post. - return; - } - - - while (next++ != hw_newend) - { - // Remove a post. - *++start = *next; - } - - hw_newend = start; - printsolidsegs(); -} - -// -// handle LineDefs with upper and lower texture (windows) -// -static void HWR_ClipPassWallSegment(INT32 first, INT32 last) -{ - cliprange_t *start; - float lowfrac, highfrac; - //to allow noclipwalls but still solidseg reject of non-visible walls - boolean poorhack = false; - - // Find the first range that touches the range - // (adjacent pixels are touching). - start = gr_solidsegs; - while (start->last < first - 1) - start++; - - if (first < start->first) - { - if (last < start->first-1) - { - // Post is entirely visible (above start). - HWR_StoreWallRange(0, 1); - return; - } - - // There is a fragment above *start. - if (!cv_grclipwalls.value) - { //20/08/99: Changed by Hurdler (taken from faB's code) - if (!poorhack) HWR_StoreWallRange(0, 1); - poorhack = true; - } - else - { - highfrac = HWR_ClipViewSegment(min(start->first + 1, - start->last), (polyvertex_t *)gr_curline->pv1, - (polyvertex_t *)gr_curline->pv2); - HWR_StoreWallRange(0, highfrac); - } - } - - // Bottom contained in start? - if (last <= start->last) - return; - - while (last >= (start+1)->first-1) - { - // There is a fragment between two posts. - if (!cv_grclipwalls.value) - { - if (!poorhack) HWR_StoreWallRange(0, 1); - poorhack = true; - } - else - { - lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); - highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2); - HWR_StoreWallRange(lowfrac, highfrac); - } - start++; - - if (last <= start->last) - return; - } - - if (first == start->first+1) // 1 line texture - { - if (!cv_grclipwalls.value) - { - if (!poorhack) HWR_StoreWallRange(0, 1); - poorhack = true; - } - else - HWR_StoreWallRange(0, 1); - } - else - { - // There is a fragment after *next. - if (!cv_grclipwalls.value) - { - if (!poorhack) HWR_StoreWallRange(0,1); - poorhack = true; - } - else - { - lowfrac = HWR_ClipViewSegment(max(start->last - 1, - start->first), (polyvertex_t *)gr_curline->pv1, - (polyvertex_t *)gr_curline->pv2); - HWR_StoreWallRange(lowfrac, 1); - } - } -} - -// -------------------------------------------------------------------------- -// HWR_ClipToSolidSegs check if it is hide by wall (solidsegs) -// -------------------------------------------------------------------------- -static boolean HWR_ClipToSolidSegs(INT32 first, INT32 last) -{ - cliprange_t * start; - - // Find the first range that touches the range - // (adjacent pixels are touching). - start = gr_solidsegs; - while (start->last < first-1) - start++; - - if (first < start->first) - return true; - - // Bottom contained in start? - if (last <= start->last) - return false; - - return true; -} - -// -// HWR_ClearClipSegs -// -static void HWR_ClearClipSegs(void) -{ - gr_solidsegs[0].first = -0x7fffffff; - gr_solidsegs[0].last = -1; - gr_solidsegs[1].first = vid.width; //viewwidth; - gr_solidsegs[1].last = 0x7fffffff; - hw_newend = gr_solidsegs+2; -} -#endif // NEWCLIP - -// -----------------+ -// HWR_AddLine : Clips the given segment and adds any visible pieces to the line list. -// Notes : gr_cursectorlight is set to the current subsector -> sector -> light value -// : (it may be mixed with the wall's own flat colour in the future ...) -// -----------------+ -static void HWR_AddLine(seg_t * line) -{ - angle_t angle1, angle2; -#ifndef NEWCLIP - INT32 x1, x2; - angle_t span, tspan; - boolean bothceilingssky = false, bothfloorssky = false; -#endif - - // SoM: Backsector needs to be run through R_FakeFlat - static sector_t tempsec; - - fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t - if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) - return; - - gr_curline = line; - - v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x); - v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y); - v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x); - v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y); - - // OPTIMIZE: quickly reject orthogonal back sides. - angle1 = R_PointToAngle(v1x, v1y); - angle2 = R_PointToAngle(v2x, v2y); - -#ifdef NEWCLIP - // PrBoom: Back side, i.e. backface culling - read: endAngle >= startAngle! - if (angle2 - angle1 < ANGLE_180) - return; - - // PrBoom: use REAL clipping math YAYYYYYYY!!! - - if (!gld_clipper_SafeCheckRange(angle2, angle1)) - { - return; - } - - checkforemptylines = true; -#else - // Clip to view edges. - span = angle1 - angle2; - - // backface culling : span is < ANGLE_180 if ang1 > ang2 : the seg is facing - if (span >= ANGLE_180) - return; - - // Global angle needed by segcalc. - //rw_angle1 = angle1; - angle1 -= dup_viewangle; - angle2 -= dup_viewangle; - - tspan = angle1 + gr_clipangle; - if (tspan > 2*gr_clipangle) - { - tspan -= 2*gr_clipangle; - - // Totally off the left edge? - if (tspan >= span) - return; - - angle1 = gr_clipangle; - } - tspan = gr_clipangle - angle2; - if (tspan > 2*gr_clipangle) - { - tspan -= 2*gr_clipangle; - - // Totally off the left edge? - if (tspan >= span) - return; - - angle2 = (angle_t)-(signed)gr_clipangle; - } - -#if 0 - { - float fx1,fx2,fy1,fy2; - //BP: test with a better projection than viewangletox[R_PointToAngle(angle)] - // do not enable this at release 4 mul and 2 div - fx1 = ((polyvertex_t *)(line->pv1))->x-gr_viewx; - fy1 = ((polyvertex_t *)(line->pv1))->y-gr_viewy; - fy2 = (fx1 * gr_viewcos + fy1 * gr_viewsin); - if (fy2 < 0) - // the point is back - fx1 = 0; - else - fx1 = gr_windowcenterx + (fx1 * gr_viewsin - fy1 * gr_viewcos) * gr_centerx / fy2; - - fx2 = ((polyvertex_t *)(line->pv2))->x-gr_viewx; - fy2 = ((polyvertex_t *)(line->pv2))->y-gr_viewy; - fy1 = (fx2 * gr_viewcos + fy2 * gr_viewsin); - if (fy1 < 0) - // the point is back - fx2 = vid.width; - else - fx2 = gr_windowcenterx + (fx2 * gr_viewsin - fy2 * gr_viewcos) * gr_centerx / fy1; - - x1 = fx1+0.5f; - x2 = fx2+0.5f; - } -#else - // The seg is in the view range, - // but not necessarily visible. - angle1 = (angle1+ANGLE_90)>>ANGLETOFINESHIFT; - angle2 = (angle2+ANGLE_90)>>ANGLETOFINESHIFT; - - x1 = gr_viewangletox[angle1]; - x2 = gr_viewangletox[angle2]; -#endif - // Does not cross a pixel? -// if (x1 == x2) -/* { - // BP: HERE IS THE MAIN PROBLEM ! - //CONS_Debug(DBG_RENDER, "tineline\n"); - return; - } -*/ -#endif - - gr_backsector = line->backsector; - -#ifdef NEWCLIP - if (!line->backsector) - { - gld_clipper_SafeAddClipRange(angle2, angle1); - } - else - { - boolean bothceilingssky = false, bothfloorssky = false; - - gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); - - if (gr_backsector->ceilingpic == skyflatnum && gr_frontsector->ceilingpic == skyflatnum) - bothceilingssky = true; - if (gr_backsector->floorpic == skyflatnum && gr_frontsector->floorpic == skyflatnum) - bothfloorssky = true; - - if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then - { - if (!line->polyseg && - !line->sidedef->midtexture - && ((!gr_frontsector->ffloors && !gr_backsector->ffloors) - || (gr_frontsector->tag == gr_backsector->tag))) - return; // line is empty, don't even bother - // treat like wide open window instead - HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D - return; - } - - if (CheckClip(line, gr_frontsector, gr_backsector)) - { - gld_clipper_SafeAddClipRange(angle2, angle1); - checkforemptylines = false; - } - // 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 (checkforemptylines && R_IsEmptyLine(line, gr_frontsector, gr_backsector)) - return; - } - - HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D - return; -#else - // Single sided line? - if (!gr_backsector) - goto clipsolid; - - gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); - - if (gr_backsector->ceilingpic == skyflatnum && gr_frontsector->ceilingpic == skyflatnum) - bothceilingssky = true; - if (gr_backsector->floorpic == skyflatnum && gr_frontsector->floorpic == skyflatnum) - bothfloorssky = true; - - if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then - { - if (!line->polyseg && - !line->sidedef->midtexture - && ((!gr_frontsector->ffloors && !gr_backsector->ffloors) - || (gr_frontsector->tag == gr_backsector->tag))) - return; // line is empty, don't even bother - - goto clippass; // treat like wide open window instead - } - - if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope) - { - fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends - fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends - -#define SLOPEPARAMS(slope, end1, end2, normalheight) \ - end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ - end2 = P_GetZAt(slope, v2x, v2y, normalheight); - - SLOPEPARAMS(gr_frontsector->f_slope, frontf1, frontf2, gr_frontsector-> floorheight) - SLOPEPARAMS(gr_frontsector->c_slope, frontc1, frontc2, gr_frontsector->ceilingheight) - SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector-> floorheight) - SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) -#undef SLOPEPARAMS - // if both ceilings are skies, consider it always "open" - // same for floors - if (!bothceilingssky && !bothfloorssky) - { - // Closed door. - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) - { - goto clipsolid; - } - - // Check for automap fix. - if (backc1 <= backf1 && backc2 <= backf2 - && ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture) - && ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture)) - goto clipsolid; - } - - // Window. - if (!bothceilingssky) // ceilings are always the "same" when sky - if (backc1 != frontc1 || backc2 != frontc2) - goto clippass; - if (!bothfloorssky) // floors are always the "same" when sky - if (backf1 != frontf1 || backf2 != frontf2) - goto clippass; - } - else - { - // if both ceilings are skies, consider it always "open" - // same for floors - if (!bothceilingssky && !bothfloorssky) - { - // Closed door. - if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || - gr_backsector->floorheight >= gr_frontsector->ceilingheight) - goto clipsolid; - - // Check for automap fix. - if (gr_backsector->ceilingheight <= gr_backsector->floorheight - && ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture) - && ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture)) - goto clipsolid; - } - - // Window. - if (!bothceilingssky) // ceilings are always the "same" when sky - if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight) - goto clippass; - if (!bothfloorssky) // floors are always the "same" when sky - if (gr_backsector->floorheight != gr_frontsector->floorheight) - goto clippass; - } - - // 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 (R_IsEmptyLine(gr_curline, gr_frontsector, gr_backsector)) - return; - -clippass: - if (x1 == x2) - { x2++;x1 -= 2; } - HWR_ClipPassWallSegment(x1, x2-1); - return; - -clipsolid: - if (x1 == x2) - goto clippass; - HWR_ClipSolidWallSegment(x1, x2-1); -#endif ->>>>>>> srb2/next } // HWR_CheckBBox @@ -3076,14 +2111,9 @@ void HWR_AddPolyObjectSegs(void) Z_Free(gr_fakeline); } -<<<<<<< HEAD -#ifdef POLYOBJECTS_PLANES -void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap) -======= static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap) ->>>>>>> srb2/next { float height; //constant y for all points on the convex flat polygon FOutVector *v3d; @@ -3109,11 +2139,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, if (nrPlaneVerts < 3) //not even a triangle ? return; -<<<<<<< HEAD - if (nrPlaneVerts > INT16_MAX) // FIXME: exceeds plVerts size -======= if (nrPlaneVerts > (size_t)UINT16_MAX) // FIXME: exceeds plVerts size ->>>>>>> srb2/next { CONS_Debug(DBG_RENDER, "polygon size of %s exceeds max value of %d vertices\n", sizeu1(nrPlaneVerts), UINT16_MAX); return; @@ -3227,11 +2253,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++) { -<<<<<<< HEAD - // Hurdler: add scrolling texture on floor/ceiling - v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations - v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations -======= // Go from the polysector's original vertex locations // Means the flat is offset based on the original vertex locations if (texflat) @@ -3244,24 +2265,16 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, v3d->sow = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx); v3d->tow = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly); } ->>>>>>> srb2/next // Need to rotate before translate if (angle) // Only needs to be done if there's an altered angle { -<<<<<<< HEAD - tempxsow = FLOAT_TO_FIXED(v3d->s); - tempytow = FLOAT_TO_FIXED(v3d->t); - v3d->s = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - v3d->t = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); -======= tempxsow = FLOAT_TO_FIXED(v3d->sow); tempytow = FLOAT_TO_FIXED(v3d->tow); if (texflat) tempytow = -tempytow; v3d->sow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); v3d->tow = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); ->>>>>>> srb2/next } v3d->x = FIXED_TO_FLOAT(polysector->vertices[i]->x); @@ -3310,15 +2323,6 @@ void HWR_AddPolyObjectPlanes(void) if (po_ptrs[i]->translucency > 0) { FSurfaceInfo Surf; -<<<<<<< HEAD - FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); - HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->floorpic].lumpnum, po_ptrs[i], false, polyobjsector->floorheight, - polyobjsector->lightlevel, Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL); - } - else - { - HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum, R_NoEncore(polyobjsector, false)); -======= FBITFIELD blendmode; memset(&Surf, 0x00, sizeof(Surf)); blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); @@ -3328,7 +2332,6 @@ void HWR_AddPolyObjectPlanes(void) else { HWR_GetLevelFlat(&levelflats[polyobjsector->floorpic]); ->>>>>>> srb2/next HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude, (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->floorpic], polyobjsector, 255, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); @@ -3346,21 +2349,12 @@ void HWR_AddPolyObjectPlanes(void) FBITFIELD blendmode; memset(&Surf, 0x00, sizeof(Surf)); blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf); -<<<<<<< HEAD - HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->ceilingpic].lumpnum, po_ptrs[i], true, polyobjsector->ceilingheight, - polyobjsector->lightlevel, Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL); - } - else - { - HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum, R_NoEncore(polyobjsector, true)); -======= HWR_AddTransparentPolyobjectFloor(&levelflats[polyobjsector->ceilingpic], po_ptrs[i], true, polyobjsector->ceilingheight, (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), Surf.FlatColor.s.alpha, polyobjsector, blendmode, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); } else { HWR_GetLevelFlat(&levelflats[polyobjsector->ceilingpic]); ->>>>>>> srb2/next HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude, (light == -1 ? gr_frontsector->lightlevel : *gr_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->ceilingpic], polyobjsector, 255, (light == -1 ? gr_frontsector->extra_colormap : *gr_frontsector->lightlist[light].extra_colormap)); @@ -3485,21 +2479,12 @@ void HWR_Subsector(size_t num) { if (sub->validcount != validcount) { -<<<<<<< HEAD - HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum, R_NoEncore(gr_frontsector, false)); - HWR_RenderPlane(&extrasubsectors[num], false, - // Hack to make things continue to work around slopes. - locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, - // We now return you to your regularly scheduled rendering. - PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap); -======= - HWR_GetLevelFlat(&levelflats[gr_frontsector->floorpic]); + HWR_GetLevelFlat(&levelflats[gr_frontsector->floorpic], R_NoEncore(gr_frontsector, false)); HWR_RenderPlane(sub, &extrasubsectors[num], false, // Hack to make things continue to work around slopes. locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, // We now return you to your regularly scheduled rendering. PF_Occlude, floorlightlevel, &levelflats[gr_frontsector->floorpic], NULL, 255, false, floorcolormap); ->>>>>>> srb2/next } } } @@ -3510,21 +2495,12 @@ void HWR_Subsector(size_t num) { if (sub->validcount != validcount) { -<<<<<<< HEAD - HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum, R_NoEncore(gr_frontsector, true)); - HWR_RenderPlane(&extrasubsectors[num], true, - // Hack to make things continue to work around slopes. - locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, - // We now return you to your regularly scheduled rendering. - PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, ceilingcolormap); -======= - HWR_GetLevelFlat(&levelflats[gr_frontsector->ceilingpic]); + HWR_GetLevelFlat(&levelflats[gr_frontsector->ceilingpic], R_NoEncore(gr_frontsector, true)); HWR_RenderPlane(sub, &extrasubsectors[num], true, // Hack to make things continue to work around slopes. locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, // We now return you to your regularly scheduled rendering. PF_Occlude, ceilinglightlevel, &levelflats[gr_frontsector->ceilingpic], NULL, 255, false, ceilingcolormap); ->>>>>>> srb2/next } } } @@ -3549,13 +2525,8 @@ void HWR_Subsector(size_t num) if (centerHeight <= locCeilingHeight && centerHeight >= locFloorHeight && -<<<<<<< HEAD - ((viewz < cullHeight && !(rover->flags & FF_INVERTPLANES)) || - (viewz > cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) -======= ((dup_viewz < cullHeight && (rover->flags & FF_BOTHPLANES || !(rover->flags & FF_INVERTPLANES))) || (dup_viewz > cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) ->>>>>>> srb2/next { if (rover->flags & FF_FOG) { @@ -3575,10 +2546,6 @@ void HWR_Subsector(size_t num) } else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient { -<<<<<<< HEAD - light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false); - HWR_AddTransparentFloor(levelflats[*rover->bottompic].lumpnum, -======= light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); #ifndef SORTING HWR_Add3DWater(&levelflats[*rover->bottompic], @@ -3588,33 +2555,20 @@ void HWR_Subsector(size_t num) rover->alpha-1, rover->master->frontsector); #else HWR_AddTransparentFloor(&levelflats[*rover->bottompic], ->>>>>>> srb2/next &extrasubsectors[num], false, *rover->bottomheight, *gr_frontsector->lightlist[light].lightlevel, -<<<<<<< HEAD - rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, - false, gr_frontsector->lightlist[light].extra_colormap); - } - else - { - HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gr_frontsector, false)); - light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false); - HWR_RenderPlane(&extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum, - rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap); -======= rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, PF_Translucent, false, *gr_frontsector->lightlist[light].extra_colormap); #endif } else { - HWR_GetLevelFlat(&levelflats[*rover->bottompic]); + HWR_GetLevelFlat(&levelflats[*rover->bottompic], R_NoEncore(gr_frontsector, false)); light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], rover->master->frontsector, 255, false, *gr_frontsector->lightlist[light].extra_colormap); ->>>>>>> srb2/next } } @@ -3624,13 +2578,8 @@ void HWR_Subsector(size_t num) if (centerHeight >= locFloorHeight && centerHeight <= locCeilingHeight && -<<<<<<< HEAD - ((viewz > cullHeight && !(rover->flags & FF_INVERTPLANES)) || - (viewz < cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) -======= ((dup_viewz > cullHeight && (rover->flags & FF_BOTHPLANES || !(rover->flags & FF_INVERTPLANES))) || (dup_viewz < cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) ->>>>>>> srb2/next { if (rover->flags & FF_FOG) { @@ -3650,10 +2599,6 @@ void HWR_Subsector(size_t num) } else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) { -<<<<<<< HEAD - light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false); - HWR_AddTransparentFloor(levelflats[*rover->toppic].lumpnum, -======= light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); #ifndef SORTING HWR_Add3DWater(&levelflats[*rover->toppic], @@ -3663,22 +2608,10 @@ void HWR_Subsector(size_t num) rover->alpha-1, rover->master->frontsector); #else HWR_AddTransparentFloor(&levelflats[*rover->toppic], ->>>>>>> srb2/next &extrasubsectors[num], true, *rover->topheight, *gr_frontsector->lightlist[light].lightlevel, -<<<<<<< HEAD - rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, - false, gr_frontsector->lightlist[light].extra_colormap); - } - else - { - HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gr_frontsector, true)); - light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false); - HWR_RenderPlane(&extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum, - rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap); -======= rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, PF_Translucent, false, *gr_frontsector->lightlist[light].extra_colormap); #endif @@ -3686,11 +2619,10 @@ void HWR_Subsector(size_t num) } else { - HWR_GetLevelFlat(&levelflats[*rover->toppic]); + HWR_GetLevelFlat(&levelflats[*rover->toppic], R_NoEncore(gr_frontsector, true)); light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], rover->master->frontsector, 255, false, *gr_frontsector->lightlist[light].extra_colormap); ->>>>>>> srb2/next } } } @@ -3867,7 +2799,6 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v return false; } -<<<<<<< HEAD static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) { const fixed_t thingxpos = thing->x + thing->sprxoff; @@ -3892,37 +2823,11 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) floorz = R_GetShadowZ(thing, &floorslope); floordiff = abs(thingzpos - floorz); -======= -static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale) -{ - GLPatch_t *gpatch; - FOutVector shadowVerts[4]; - FSurfaceInfo sSurf; - float fscale; float fx; float fy; float offset; - UINT8 lightlevel = 255; - extracolormap_t *colormap = NULL; - UINT8 i; - - INT32 light; - fixed_t scalemul; - UINT16 alpha; - fixed_t floordiff; - fixed_t floorz; - fixed_t slopez; - pslope_t *floorslope; - - floorz = R_GetShadowZ(thing, &floorslope); - - //if (abs(floorz - gr_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes - - floordiff = abs(thing->z - floorz); ->>>>>>> srb2/next alpha = floordiff / (4*FRACUNIT) + 75; if (alpha >= 255) return; alpha = 255 - alpha; -<<<<<<< HEAD if (thing->whiteshadow) { gpatch = (GLPatch_t *)W_CachePatchName("LSHADOW", PU_CACHE); @@ -3934,26 +2839,15 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale lightlevel = 0; } -======= - gpatch = (GLPatch_t *)W_CachePatchName("DSHADOW", PU_CACHE); ->>>>>>> srb2/next if (!(gpatch && gpatch->mipmap->grInfo.format)) return; HWR_GetPatch(gpatch); scalemul = FixedMul(FRACUNIT - floordiff/640, scale); -<<<<<<< HEAD - scalemul = FixedMul(scalemul, (thing->radius*2) / gpatch->height); - - fscale = FIXED_TO_FLOAT(scalemul); - fx = FIXED_TO_FLOAT(thingxpos); - fy = FIXED_TO_FLOAT(thingypos); -======= scalemul = FixedMul(scalemul, (thing->radius*2) / SHORT(gpatch->height)); fscale = FIXED_TO_FLOAT(scalemul); fx = FIXED_TO_FLOAT(thing->x); fy = FIXED_TO_FLOAT(thing->y); ->>>>>>> srb2/next // 3--2 // | /| @@ -3961,23 +2855,6 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale // 0--1 if (thing && fabsf(fscale - 1.0f) > 1.0E-36f) -<<<<<<< HEAD - offset = (gpatch->height/2) * fscale; - else - offset = (float)(gpatch->height/2); - - shadowVerts[2].x = shadowVerts[3].x = fx + offset; - shadowVerts[1].x = shadowVerts[0].x = fx - offset; - shadowVerts[1].z = shadowVerts[2].z = fy - offset; - shadowVerts[0].z = shadowVerts[3].z = fy + offset; - - for (i = 0; i < 4; i++) - { - float oldx = shadowVerts[i].x; - float oldy = shadowVerts[i].z; - shadowVerts[i].x = fx + ((oldx - fx) * gr_viewcos) - ((oldy - fy) * gr_viewsin); - shadowVerts[i].z = fy + ((oldx - fx) * gr_viewsin) + ((oldy - fy) * gr_viewcos); -======= offset = (SHORT(gpatch->height)/2) * fscale; else offset = (float)(SHORT(gpatch->height)/2); @@ -4010,40 +2887,10 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale { shadowVerts[0].sow = shadowVerts[3].sow = 0; shadowVerts[2].sow = shadowVerts[1].sow = gpatch->max_s; ->>>>>>> srb2/next } if (floorslope) { -<<<<<<< HEAD - for (i = 0; i < 4; i++) - { - slopez = P_GetZAt(floorslope, FLOAT_TO_FIXED(shadowVerts[i].x), FLOAT_TO_FIXED(shadowVerts[i].z)); - shadowVerts[i].y = FIXED_TO_FLOAT(slopez) + 0.05f; - } - } - else - { - for (i = 0; i < 4; i++) - shadowVerts[i].y = FIXED_TO_FLOAT(floorz) + 0.05f; - } - - shadowVerts[0].s = shadowVerts[3].s = 0; - shadowVerts[2].s = shadowVerts[1].s = gpatch->max_s; - - shadowVerts[3].t = shadowVerts[2].t = 0; - shadowVerts[0].t = shadowVerts[1].t = gpatch->max_t; - - if (thing->subsector->sector->numlights) - { - light = R_GetPlaneLight(thing->subsector->sector, floorz, false); // Always use the light at the top instead of whatever I was doing before - - if (thing->subsector->sector->lightlist[light].extra_colormap) - colormap = thing->subsector->sector->lightlist[light].extra_colormap; - } - else - { -======= shadowVerts[3].tow = shadowVerts[2].tow = gpatch->max_t; shadowVerts[0].tow = shadowVerts[1].tow = 0; } @@ -4069,27 +2916,15 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale { lightlevel = thing->subsector->sector->lightlevel; ->>>>>>> srb2/next if (thing->subsector->sector->extra_colormap) colormap = thing->subsector->sector->extra_colormap; } -<<<<<<< HEAD HWR_Lighting(&sSurf, lightlevel, colormap); sSurf.PolyColor.s.alpha = alpha; HWD.pfnSetShader(3); // sprite shader HWD.pfnDrawPolygon(&sSurf, shadowVerts, 4, PF_Translucent|PF_Modulated); -======= - if (colormap) - sSurf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false); - else - sSurf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false); - - sSurf.FlatColor.s.alpha = alpha; - - HWD.pfnDrawPolygon(&sSurf, shadowVerts, 4, PF_Translucent|PF_Modulated|PF_Clip); ->>>>>>> srb2/next } // This is expecting a pointer to an array containing 4 wallVerts for a sprite @@ -4256,17 +3091,11 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) temp = FLOAT_TO_FIXED(realtop); -#ifdef ESLOPE // Start with the lightlevel and colormap from the top of the sprite -<<<<<<< HEAD - lightlevel = 255; - colormap = list[sector->numlights - 1].extra_colormap; -======= lightlevel = *list[sector->numlights - 1].lightlevel; colormap = *list[sector->numlights - 1].extra_colormap; i = 0; temp = FLOAT_TO_FIXED(realtop); ->>>>>>> srb2/next if (!(spr->mobj->frame & FF_FULLBRIGHT)) { @@ -4281,33 +3110,15 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (h <= temp) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) -<<<<<<< HEAD { lightlevel = *list[i-1].lightlevel; if (spr->mobj->frame & FF_SEMIBRIGHT) lightlevel = 128 + (lightlevel>>1); } - colormap = list[i-1].extra_colormap; - break; - } - } -#else - i = R_GetPlaneLight(sector, temp, false); - if (!(spr->mobj->frame & FF_FULLBRIGHT)) - { - lightlevel = *list[i].lightlevel; - if (spr->mobj->frame & FF_SEMIBRIGHT) - lightlevel = 128 + (lightlevel>>1); - } - colormap = list[i].extra_colormap; -#endif -======= - lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel; colormap = *list[i-1].extra_colormap; break; } } ->>>>>>> srb2/next for (i = 0; i < sector->numlights; i++) { @@ -4318,17 +3129,12 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) -<<<<<<< HEAD { lightlevel = *list[i].lightlevel; if (spr->mobj->frame & FF_SEMIBRIGHT) lightlevel = 128 + (lightlevel>>1); } - colormap = list[i].extra_colormap; -======= - lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; colormap = *list[i].extra_colormap; ->>>>>>> srb2/next } if (i + 1 < sector->numlights) @@ -4357,18 +3163,10 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (endbot < endrealbot) endbot = endrealbot; -<<<<<<< HEAD -#ifdef ESLOPE - wallVerts[3].t = towtop + ((realtop - top) * towmult); - wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult); - wallVerts[0].t = towtop + ((realtop - bot) * towmult); - wallVerts[1].t = towtop + ((endrealtop - endbot) * towmult); -======= wallVerts[3].tow = towtop + ((realtop - top) * towmult); wallVerts[2].tow = towtop + ((endrealtop - endtop) * towmult); wallVerts[0].tow = towtop + ((realtop - bot) * towmult); wallVerts[1].tow = towtop + ((endrealtop - endbot) * towmult); ->>>>>>> srb2/next wallVerts[3].y = top; wallVerts[2].y = endtop; @@ -4386,35 +3184,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; heightmult = (endrealtop - endtop) / endrealheight; -<<<<<<< HEAD - wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; - wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; - - heightmult = (realtop - bot) / realheight; - wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; - wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; - - heightmult = (endrealtop - endbot) / endrealheight; - wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; - wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; - } -#else - wallVerts[3].t = wallVerts[2].t = towtop + ((realtop - top) * towmult); - wallVerts[0].t = wallVerts[1].t = towtop + ((realtop - bot) * towmult); - - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; - - // The x and y only need to be adjusted in the case that it's not a papersprite - if (cv_grspritebillboarding.value && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)) - { - // Get the x and z of the vertices so billboarding draws correctly - realheight = realbot - realtop; - heightmult = (realtop - top) / realheight; - wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; - wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; -======= ->>>>>>> srb2/next wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; @@ -4444,33 +3213,15 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) return; // If we're ever down here, somehow the above loop hasn't draw all the light levels of sprite -<<<<<<< HEAD -#ifdef ESLOPE - wallVerts[3].t = towtop + ((realtop - top) * towmult); - wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult); - wallVerts[0].t = towtop + ((realtop - bot) * towmult); - wallVerts[1].t = towtop + ((endrealtop - endbot) * towmult); -======= wallVerts[3].tow = towtop + ((realtop - top) * towmult); wallVerts[2].tow = towtop + ((endrealtop - endtop) * towmult); wallVerts[0].tow = towtop + ((realtop - bot) * towmult); wallVerts[1].tow = towtop + ((endrealtop - endbot) * towmult); ->>>>>>> srb2/next wallVerts[3].y = top; wallVerts[2].y = endtop; wallVerts[0].y = bot; wallVerts[1].y = endbot; -<<<<<<< HEAD -#else - wallVerts[3].t = wallVerts[2].t = towtop + ((realtop - top) * towmult); - wallVerts[0].t = wallVerts[1].t = towtop + ((realtop - bot) * towmult); - - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; -#endif -======= ->>>>>>> srb2/next HWR_Lighting(&Surf, lightlevel, colormap); @@ -4573,12 +3324,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) } // Let dispoffset work first since this adjust each vertex -<<<<<<< HEAD - // ...nah - HWR_RotateSpritePolyToAim(spr, wallVerts); -======= HWR_RotateSpritePolyToAim(spr, wallVerts, false); ->>>>>>> srb2/next // push it toward the camera to mitigate floor-clipping sprites { @@ -4604,15 +3350,11 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) extracolormap_t *colormap = sector->extra_colormap; if (!(spr->mobj->frame & FF_FULLBRIGHT)) -<<<<<<< HEAD { lightlevel = sector->lightlevel; if (spr->mobj->frame & FF_SEMIBRIGHT) lightlevel = 128 + (lightlevel>>1); } -======= - lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; ->>>>>>> srb2/next HWR_Lighting(&Surf, lightlevel, colormap); } @@ -4842,13 +3584,10 @@ typedef struct static size_t numpolyplanes = 0; // a list of transparent poyobject floors to be drawn static polyplaneinfo_t *polyplaneinfo = NULL; -<<<<<<< HEAD -======= #ifndef SORTING size_t numfloors = 0; #else //Hurdler: 3D water sutffs ->>>>>>> srb2/next typedef struct gr_drawnode_s { planeinfo_t *plane; @@ -4861,12 +3600,8 @@ typedef struct gr_drawnode_s #define MAX_TRANSPARENTFLOOR 512 // This will likely turn into a copy of HWR_Add3DWater and replace it. -<<<<<<< HEAD -void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap) -======= void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap) ->>>>>>> srb2/next { static size_t allocedplanes = 0; @@ -4897,12 +3632,8 @@ void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boo // Adding this for now until I can create extrasubsector info for polyobjects // When that happens it'll just be done through HWR_AddTransparentFloor and HWR_RenderPlane -<<<<<<< HEAD -void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap) -======= void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap) ->>>>>>> srb2/next { static size_t allocedpolyplanes = 0; @@ -5061,15 +3792,9 @@ void HWR_RenderDrawNodes(void) gr_frontsector = NULL; if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture)) -<<<<<<< HEAD - HWR_GetFlat(sortnode[sortindex[i]].plane->lumpnum, R_NoEncore(sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->isceiling)); - HWR_RenderPlane(sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel, - sortnode[sortindex[i]].plane->lumpnum, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, /*sortnode[sortindex[i]].plane->fogplane,*/ sortnode[sortindex[i]].plane->planecolormap); -======= - HWR_GetLevelFlat(sortnode[sortindex[i]].plane->levelflat); + HWR_GetLevelFlat(sortnode[sortindex[i]].plane->levelflat, R_NoEncore(sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->isceiling)); HWR_RenderPlane(NULL, sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel, sortnode[sortindex[i]].plane->levelflat, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, sortnode[sortindex[i]].plane->fogplane, sortnode[sortindex[i]].plane->planecolormap); ->>>>>>> srb2/next } else if (sortnode[sortindex[i]].polyplane) { @@ -5077,11 +3802,7 @@ void HWR_RenderDrawNodes(void) gr_frontsector = NULL; if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture)) -<<<<<<< HEAD - HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum, R_NoEncore(sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->isceiling)); -======= - HWR_GetLevelFlat(sortnode[sortindex[i]].polyplane->levelflat); ->>>>>>> srb2/next + HWR_GetLevelFlat(sortnode[sortindex[i]].polyplane->levelflat, R_NoEncore(sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->isceiling)); HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel, sortnode[sortindex[i]].polyplane->levelflat, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap); } @@ -5143,7 +3864,6 @@ void HWR_DrawSprites(void) } } else -<<<<<<< HEAD { if (!cv_grmdls.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f) { @@ -5152,34 +3872,6 @@ void HWR_DrawSprites(void) else { HWR_DrawMD2(spr); -======= -#endif - { - if (spr->mobj && spr->mobj->shadowscale && cv_shadow.value) - { - HWR_DrawDropShadow(spr->mobj, spr, spr->mobj->shadowscale); - } - - if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) - { - if (!cv_grmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) - HWR_DrawSprite(spr); - else - { - if (!HWR_DrawModel(spr)) - HWR_DrawSprite(spr); - } - } - else - { - if (!cv_grmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f) - HWR_DrawSprite(spr); - else - { - if (!HWR_DrawModel(spr)) - HWR_DrawSprite(spr); - } ->>>>>>> srb2/next } } } @@ -5194,12 +3886,8 @@ void HWR_AddSprites(sector_t *sec) { mobj_t *thing; precipmobj_t *precipthing; -<<<<<<< HEAD - fixed_t approx_dist, limit_dist; -======= #endif fixed_t limit_dist, hoop_limit_dist; ->>>>>>> srb2/next INT32 splitflags; boolean split_drawsprite; // drawing with splitscreen flags @@ -5216,111 +3904,8 @@ void HWR_AddSprites(sector_t *sec) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. -<<<<<<< HEAD - if ((limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale)) - { - for (thing = sec->thinglist; thing; thing = thing->snext) - { - - split_drawsprite = false; - - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) - continue; - - splitflags = thing->eflags & (MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4); - - if (r_splitscreen && splitflags) - { - if (thing->eflags & MFE_DRAWONLYFORP1) - if (viewssnum == 0) - split_drawsprite = true; - - if (thing->eflags & MFE_DRAWONLYFORP2) - if (viewssnum == 1) - split_drawsprite = true; - - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) - if (viewssnum == 2) - split_drawsprite = true; - - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) - if (viewssnum == 3) - split_drawsprite = true; - } - else - split_drawsprite = true; - - if (!split_drawsprite) - continue; - - approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - - if (approx_dist > limit_dist) - continue; - - HWR_ProjectSprite(thing); - } - } - else - { - // Draw everything in sector, no checks - for (thing = sec->thinglist; thing; thing = thing->snext) - { - - split_drawsprite = false; - - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) - continue; - - splitflags = thing->eflags & (MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4); - - if (r_splitscreen && splitflags) - { - if (thing->eflags & MFE_DRAWONLYFORP1) - if (viewssnum == 0) - split_drawsprite = true; - - if (thing->eflags & MFE_DRAWONLYFORP2) - if (viewssnum == 1) - split_drawsprite = true; - - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) - if (viewssnum == 2) - split_drawsprite = true; - - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) - if (viewssnum == 3) - split_drawsprite = true; - } - else - split_drawsprite = true; - - if (!split_drawsprite) - continue; - - HWR_ProjectSprite(thing); - } - } - - // No to infinite precipitation draw distance. - if ((limit_dist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale)) - { - for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) - { - if (precipthing->precipflags & PCF_INVISIBLE) - continue; - - approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - - if (approx_dist > limit_dist) - continue; - - HWR_ProjectPrecipitationSprite(precipthing); - } - } -======= - limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS; - hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS; + limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale; + hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) * mapobjectscale; for (thing = sec->thinglist; thing; thing = thing->snext) { if (R_ThingVisibleWithinDist(thing, limit_dist, hoop_limit_dist)) @@ -5329,7 +3914,7 @@ void HWR_AddSprites(sector_t *sec) #ifdef HWPRECIP // no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off - if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS)) + if ((limit_dist = (fixed_t)cv_drawdist_precip.value * mapobjectscale)) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) { @@ -5338,7 +3923,6 @@ void HWR_AddSprites(sector_t *sec) } } #endif ->>>>>>> srb2/next } // -------------------------------------------------------------------------- @@ -5366,22 +3950,13 @@ void HWR_ProjectSprite(mobj_t *thing) md2_t *md2; size_t lumpoff; unsigned rot; -<<<<<<< HEAD - UINT8 flip; - boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP)); -======= UINT16 flip; boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP)); ->>>>>>> srb2/next angle_t ang; const boolean papersprite = (thing->frame & FF_PAPERSPRITE); -<<<<<<< HEAD - INT32 heightsec, phs; -======= angle_t mobjangle = (thing->player ? thing->player->drawangle : thing->angle); float z1, z2; ->>>>>>> srb2/next fixed_t spr_width, spr_height; fixed_t spr_offset, spr_topoffset; @@ -5403,10 +3978,6 @@ void HWR_ProjectSprite(mobj_t *thing) tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); // thing is behind view plane? -<<<<<<< HEAD - if (tz < ZCLIP_PLANE && !papersprite && (!cv_grmdls.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear - return; -======= if (tz < ZCLIP_PLANE && !papersprite) { if (cv_grmodels.value) //Yellow: Only MD2's dont disappear @@ -5422,7 +3993,6 @@ void HWR_ProjectSprite(mobj_t *thing) else return; } ->>>>>>> srb2/next // The above can stay as it works for cutting sprites that are too close tr_x = FIXED_TO_FLOAT(thingxpos); @@ -5468,14 +4038,7 @@ void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif -<<<<<<< HEAD - if (thing->player) - ang = R_PointToAngle (thingxpos, thingypos) - thing->player->frameangle; - else - ang = R_PointToAngle (thingxpos, thingypos) - thing->angle; -======= ang = R_PointToAngle (thing->x, thing->y) - mobjangle; ->>>>>>> srb2/next if (sprframe->rotate == SRF_SINGLE) { @@ -5578,15 +4141,6 @@ void HWR_ProjectSprite(mobj_t *thing) if (vflip) { -<<<<<<< HEAD - gz = FIXED_TO_FLOAT(thingzpos + thing->height) - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale; - gzt = gz + FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale; - } - else - { - gzt = FIXED_TO_FLOAT(thingzpos) + FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale; - gz = gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale; -======= gz = FIXED_TO_FLOAT(thing->z+thing->height) - FIXED_TO_FLOAT(spr_topoffset) * this_scale; gzt = gz + FIXED_TO_FLOAT(spr_height) * this_scale; } @@ -5594,7 +4148,6 @@ void HWR_ProjectSprite(mobj_t *thing) { gzt = FIXED_TO_FLOAT(thing->z) + FIXED_TO_FLOAT(spr_topoffset) * this_scale; gz = gzt - FIXED_TO_FLOAT(spr_height) * this_scale; ->>>>>>> srb2/next } if (thing->subsector->sector->cullheight) @@ -5660,8 +4213,6 @@ void HWR_ProjectSprite(mobj_t *thing) // New colormap stuff for skins Tails 06-07-2002 if (thing->colorized) vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE); -<<<<<<< HEAD -======= else if (thing->player && thing->player->dashmode >= DASHMODE_THRESHOLD && (thing->player->charflags & SF_DASHMODE) && ((leveltime/2) & 1)) @@ -5671,7 +4222,6 @@ void HWR_ProjectSprite(mobj_t *thing) else vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE); } ->>>>>>> srb2/next else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player! { size_t skinnum = (skin_t*)thing->skin-skins; @@ -5772,7 +4322,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; -<<<<<<< HEAD // okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok if (!(thing->precipflags & PCF_THUNK)) { @@ -5780,8 +4329,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) thing->precipflags |= PCF_THUNK; } -======= ->>>>>>> srb2/next // // store information in a vissprite // @@ -5819,42 +4366,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) thing->precipflags |= PCF_THUNK; } } -<<<<<<< HEAD - -static boolean drewsky = false; - -void HWR_DrawSkyBackground(float fpov) -{ - FTransform dometransform; - - if (drewsky) - return; - - memset(&dometransform, 0x00, sizeof(FTransform)); - - //04/01/2000: Hurdler: added for T&L - // It should replace all other gr_viewxxx when finished - if (!atransform.shearing) - dometransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - - dometransform.flip = atransform.flip; - dometransform.mirror = atransform.mirror; - dometransform.shearing = atransform.shearing; - dometransform.viewaiming = atransform.viewaiming; - - dometransform.scalex = 1; - dometransform.scaley = (float)vid.width/vid.height; - dometransform.scalez = 1; - dometransform.fovxangle = fpov; // Tails - dometransform.fovyangle = fpov; // Tails - dometransform.splitscreen = splitscreen; - - HWR_GetTexture(texturetranslation[skytexture]); - HWD.pfnSetShader(7); // sky shader - HWD.pfnRenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform); - HWD.pfnSetShader(0); -======= #endif // ========================================================================== @@ -5982,7 +4493,6 @@ static void HWR_DrawSkyBackground(player_t *player) HWD.pfnDrawPolygon(NULL, v, 4, 0); } ->>>>>>> srb2/next } @@ -6036,40 +4546,10 @@ void HWR_SetViewSize(void) // ========================================================================== void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) { -<<<<<<< HEAD angle_t a1; const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); postimg_t *postprocessor = &postimgtype[0]; INT32 i; -======= - const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); - postimg_t *type; - - if (splitscreen && player == &players[secondarydisplayplayer]) - type = &postimgtype2; - else - type = &postimgtype; - - { - // do we really need to save player (is it not the same)? - player_t *saved_player = stplyr; - stplyr = player; - ST_doPaletteStuff(); - stplyr = saved_player; -#ifdef ALAM_LIGHTING - HWR_SetLights(viewnumber); -#endif - } - - // note: sets viewangle, viewx, viewy, viewz - R_SkyboxFrame(player); - - // copy view cam position for local use - dup_viewx = viewx; - dup_viewy = viewy; - dup_viewz = viewz; - dup_viewangle = viewangle; ->>>>>>> srb2/next // set window position gr_centerx = gr_basecenterx; @@ -6100,27 +4580,10 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) gr_viewsin = FIXED_TO_FLOAT(viewsin); gr_viewcos = FIXED_TO_FLOAT(viewcos); -<<<<<<< HEAD // Set T&L transform atransform.x = gr_viewx; atransform.y = gr_viewy; atransform.z = gr_viewz; -======= - gr_viewludsin = FIXED_TO_FLOAT(FINECOSINE(aimingangle>>ANGLETOFINESHIFT)); - gr_viewludcos = FIXED_TO_FLOAT(-FINESINE(aimingangle>>ANGLETOFINESHIFT)); - - //04/01/2000: Hurdler: added for T&L - // It should replace all other gr_viewxxx when finished - memset(&atransform, 0x00, sizeof(FTransform)); - - atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - - if (*type == postimg_flip) - atransform.flip = true; - else - atransform.flip = false; ->>>>>>> srb2/next atransform.scalex = 1; atransform.scaley = (float)vid.width/vid.height; @@ -6145,17 +4608,7 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails -<<<<<<< HEAD atransform.splitscreen = r_splitscreen; -======= - if (player->viewrollangle != 0) - { - fixed_t rol = AngleFixed(player->viewrollangle); - atransform.rollangle = FIXED_TO_FLOAT(rol); - atransform.roll = true; - } - atransform.splitscreen = splitscreen; ->>>>>>> srb2/next for (i = 0; i <= splitscreen; i++) { @@ -6171,14 +4624,9 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) if (*postprocessor == postimg_mirror) atransform.mirror = true; -<<<<<<< HEAD // Clear view, set viewport (glViewport), set perspective... HWR_ClearView(); HWR_ClearSprites(); -======= - if (drawsky) - HWR_DrawSkyBackground(player); ->>>>>>> srb2/next ST_doPaletteStuff(); @@ -6210,19 +4658,7 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) // Recursively "render" the BSP tree. HWR_RenderBSPNode((INT32)numnodes-1); -<<<<<<< HEAD if (cv_grbatching.value) -======= -#ifndef NEWCLIP - // Make a viewangle int so we can render things based on mouselook - if (player == &players[consoleplayer]) - viewangle = localaiming; - else if (splitscreen && player == &players[secondarydisplayplayer]) - viewangle = localaiming2; - - // Handle stuff when you are looking farther up or down. - if ((aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) ->>>>>>> srb2/next { int dummy = 0;// the vars in RenderBatches are meant for render stats. But we don't have that stuff in this branch // so that stuff could be removed... @@ -6261,12 +4697,6 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) // ========================================================================== void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) { -<<<<<<< HEAD -======= - const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); - postimg_t *type; - ->>>>>>> srb2/next const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on // Clear the color buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs. @@ -6282,12 +4712,8 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) HWD.pfnClearBuffer(true, false, &ClearColor); } -<<<<<<< HEAD if (viewnumber > 3) return; -======= - // note: sets viewangle, viewx, viewy, viewz - R_SetupFrame(player); framecount++; // timedemo // copy view cam position for local use @@ -6295,7 +4721,6 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) dup_viewy = viewy; dup_viewz = viewz; dup_viewangle = viewangle; ->>>>>>> srb2/next // Render the skybox if there is one. drewsky = false; @@ -6309,7 +4734,6 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) HWR_RenderFrame(viewnumber, player, false); } -<<<<<<< HEAD // ========================================================================== // 3D ENGINE COMMANDS // ========================================================================== @@ -6317,290 +4741,11 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) // ************************************************************************** // 3D ENGINE SETUP // ************************************************************************** -======= - //04/01/2000: Hurdler: added for T&L - // It should replace all other gr_viewxxx when finished - memset(&atransform, 0x00, sizeof(FTransform)); - - atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - - if (*type == postimg_flip) - atransform.flip = true; - else - atransform.flip = false; - - atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx) - atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy) - atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz) - atransform.scalex = 1; - atransform.scaley = (float)vid.width/vid.height; - atransform.scalez = 1; - atransform.fovxangle = fpov; // Tails - atransform.fovyangle = fpov; // Tails - if (player->viewrollangle != 0) - { - fixed_t rol = AngleFixed(player->viewrollangle); - atransform.rollangle = FIXED_TO_FLOAT(rol); - atransform.roll = true; - } - atransform.splitscreen = splitscreen; - - gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); - - //------------------------------------------------------------------------ - HWR_ClearView(); // Clears the depth buffer and resets the view I believe - -if (0) -{ // I don't think this is ever used. - if (cv_grfog.value) - HWR_FoggingOn(); // First of all, turn it on, set the default user settings too - else - HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off -} - - if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox - HWR_DrawSkyBackground(player); - - //Hurdler: it doesn't work in splitscreen mode - drawsky = splitscreen; - - HWR_ClearSprites(); - -#ifdef SORTING - drawcount = 0; -#endif -#ifdef NEWCLIP - if (rendermode == render_opengl) - { - angle_t a1 = gld_FrustumAngle(); - gld_clipper_Clear(); - gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1); -#ifdef HAVE_SPHEREFRUSTRUM - gld_FrustrumSetup(); -#endif - } -#else - HWR_ClearClipSegs(); -#endif - - //04/01/2000: Hurdler: added for T&L - // Actually it only works on Walls and Planes - HWD.pfnSetTransform(&atransform); - - validcount++; - - HWR_RenderBSPNode((INT32)numnodes-1); - -#ifndef NEWCLIP - // Make a viewangle int so we can render things based on mouselook - if (player == &players[consoleplayer]) - viewangle = localaiming; - else if (splitscreen && player == &players[secondarydisplayplayer]) - viewangle = localaiming2; - - // Handle stuff when you are looking farther up or down. - if ((aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) - { - dup_viewangle += ANGLE_90; - HWR_ClearClipSegs(); - HWR_RenderBSPNode((INT32)numnodes-1); //left - - dup_viewangle += ANGLE_90; - if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45)) - { - HWR_ClearClipSegs(); - HWR_RenderBSPNode((INT32)numnodes-1); //back - } - - dup_viewangle += ANGLE_90; - HWR_ClearClipSegs(); - HWR_RenderBSPNode((INT32)numnodes-1); //right - - dup_viewangle += ANGLE_90; - } -#endif - - // Check for new console commands. - NetUpdate(); - -#ifdef ALAM_LIGHTING - //14/11/99: Hurdler: moved here because it doesn't work with - // subsector, see other comments; - HWR_ResetLights(); -#endif - - // Draw MD2 and sprites -#ifdef SORTING - HWR_SortVisSprites(); -#endif - -#ifdef SORTING - HWR_DrawSprites(); -#endif -#ifdef NEWCORONAS - //Hurdler: they must be drawn before translucent planes, what about gl fog? - HWR_DrawCoronas(); -#endif - -#ifdef SORTING - if (numplanes || numpolyplanes || numwalls) //Hurdler: render 3D water and transparent walls after everything - { - HWR_CreateDrawNodes(); - } -#else - if (numfloors || numpolyplanes || numwalls) - { - HWD.pfnSetTransform(&atransform); - if (numfloors) - HWR_Render3DWater(); - if (numwalls) - HWR_RenderTransparentWalls(); - } -#endif - - HWD.pfnSetTransform(NULL); - - // put it off for menus etc - if (cv_grfog.value) - HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); - - HWR_DoPostProcessor(player); - - // Check for new console commands. - NetUpdate(); - - // added by Hurdler for correct splitscreen - // moved here by hurdler so it works with the new near clipping plane - HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE); -} - -// ========================================================================== -// FOG -// ========================================================================== - -/// \author faB - -static UINT32 atohex(const char *s) -{ - INT32 iCol; - const char *sCol; - char cCol; - INT32 i; - - if (strlen(s)<6) - return 0; - - iCol = 0; - sCol = s; - for (i = 0; i < 6; i++, sCol++) - { - iCol <<= 4; - cCol = *sCol; - if (cCol >= '0' && cCol <= '9') - iCol |= cCol - '0'; - else - { - if (cCol >= 'F') - cCol -= 'a' - 'A'; - if (cCol >= 'A' && cCol <= 'F') - iCol = iCol | (cCol - 'A' + 10); - } - } - //CONS_Debug(DBG_RENDER, "col %x\n", iCol); - return iCol; -} - -static void HWR_FoggingOn(void) -{ - HWD.pfnSetSpecialState(HWD_SET_FOG_COLOR, atohex(cv_grfogcolor.string)); - HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value); - HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 1); -} - -// ========================================================================== -// 3D ENGINE COMMANDS -// ========================================================================== - -static CV_PossibleValue_t grsoftwarefog_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "LightPlanes"}, {0, NULL}}; -static CV_PossibleValue_t grmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}}; - -static void CV_grmodellighting_OnChange(void); -static void CV_grfiltermode_OnChange(void); -static void CV_granisotropic_OnChange(void); -static void CV_grfogdensity_OnChange(void); - -static CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"}, - {HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"}, - {HWD_SET_TEXTUREFILTER_MIXED1, "Linear_Nearest"}, - {HWD_SET_TEXTUREFILTER_MIXED2, "Nearest_Linear"}, - {HWD_SET_TEXTUREFILTER_MIXED3, "Nearest_Mipmap"}, - {0, NULL}}; -CV_PossibleValue_t granisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NULL}}; - -consvar_t cv_fovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfog = {"gr_fog", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfogcolor = {"gr_fogcolor", "AAAAAA", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grsoftwarefog = {"gr_softwarefog", "Off", CV_SAVE, grsoftwarefog_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - -#ifdef ALAM_LIGHTING -consvar_t cv_grdynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE|CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif - -consvar_t cv_grmodels = {"gr_models", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grmodelinterpolation = {"gr_modelinterpolation", "Sometimes", CV_SAVE, grmodelinterpolation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grmodellighting = {"gr_modellighting", "Off", CV_SAVE|CV_CALL, CV_OnOff, CV_grmodellighting_OnChange, 0, NULL, NULL, 0, 0, NULL}; - -consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfakecontrast = {"gr_fakecontrast", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - -consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned, - CV_grfogdensity_OnChange, 0, NULL, NULL, 0, 0, NULL}; - -consvar_t cv_grfiltermode = {"gr_filtermode", "Nearest", CV_SAVE|CV_CALL, grfiltermode_cons_t, - CV_grfiltermode_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_granisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotropicmode_cons_t, - CV_granisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL}; - -consvar_t cv_grcorrecttricks = {"gr_correcttricks", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - -static void CV_grmodellighting_OnChange(void) -{ - if (rendermode == render_opengl) - HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_grmodellighting.value); -} - -static void CV_grfogdensity_OnChange(void) -{ - if (rendermode == render_opengl) - HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value); -} - -static void CV_grfiltermode_OnChange(void) -{ - if (rendermode == render_opengl) - HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value); -} - -static void CV_granisotropic_OnChange(void) -{ - if (rendermode == render_opengl) - HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value); -} ->>>>>>> srb2/next //added by Hurdler: console varibale that are saved void HWR_AddCommands(void) { -<<<<<<< HEAD CV_RegisterVar(&cv_grrounddown); -======= CV_RegisterVar(&cv_fovchange); CV_RegisterVar(&cv_grfogdensity); @@ -6623,15 +4768,12 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grspritebillboarding); CV_RegisterVar(&cv_grfakecontrast); ->>>>>>> srb2/next CV_RegisterVar(&cv_grfiltermode); CV_RegisterVar(&cv_grrounddown); CV_RegisterVar(&cv_grcorrecttricks); CV_RegisterVar(&cv_grsolvetjoin); -<<<<<<< HEAD CV_RegisterVar(&cv_grbatching); -======= #ifndef NEWCLIP CV_RegisterVar(&cv_grclipwalls); #endif @@ -6646,7 +4788,6 @@ void HWR_AddSessionCommands(void) CV_RegisterVar(&cv_granisotropicmode); alreadycalled = true; ->>>>>>> srb2/next } // -------------------------------------------------------------------------- @@ -6660,10 +4801,6 @@ void HWR_Startup(void) if (!startupdone) { CONS_Printf("HWR_Startup()...\n"); -<<<<<<< HEAD - HWR_InitTextureCache(); - HWR_InitMD2(); -======= HWR_InitPolyPool(); HWR_AddSessionCommands(); HWR_InitTextureCache(); @@ -6671,7 +4808,6 @@ void HWR_Startup(void) #ifdef ALAM_LIGHTING HWR_InitLight(); #endif ->>>>>>> srb2/next } if (rendermode == render_opengl) @@ -6708,9 +4844,6 @@ void HWR_Shutdown(void) HWD.pfnFlushScreenTextures(); } -<<<<<<< HEAD -void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) -======= void transform(float *cx, float *cy, float *cz) { float tr_x,tr_y; @@ -6834,7 +4967,6 @@ static void HWR_Render3DWater(void) #endif static void HWR_AddTransparentWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) ->>>>>>> srb2/next { static size_t allocedwalls = 0; @@ -6859,12 +4991,8 @@ static void HWR_AddTransparentWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, I numwalls++; } -<<<<<<< HEAD -void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) -======= #ifndef SORTING static void HWR_RenderTransparentWalls(void) ->>>>>>> srb2/next { FBITFIELD blendmode = blend; UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha @@ -6872,9 +5000,6 @@ static void HWR_RenderTransparentWalls(void) // Lighting is done here instead so that fog isn't drawn incorrectly on transparent walls after sorting HWR_Lighting(pSurf, lightlevel, wallcolormap); -<<<<<<< HEAD - pSurf->PolyColor.s.alpha = alpha; // put the alpha back after lighting -======= for (i = 0; i < numwalls; i++) { HWR_GetTexture(wallinfo[i].texnum); @@ -6890,7 +5015,6 @@ static void HWR_RenderWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, FBITFIE UINT8 i; FOutVector *wv; UINT8 alpha; ->>>>>>> srb2/next HWD.pfnSetShader(2); // wall shader @@ -6911,15 +5035,12 @@ static void HWR_RenderWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, FBITFIE if (gr_curline->linedef->splats && cv_splats.value) HWR_DrawSegsSplats(pSurf); #endif -<<<<<<< HEAD -======= #endif } INT32 HWR_GetTextureUsed(void) { return HWD.pfnGetTextureUsed(); ->>>>>>> srb2/next } void HWR_DoPostProcessor(player_t *player) @@ -7020,10 +5141,7 @@ void HWR_StartScreenWipe(void) void HWR_EndScreenWipe(void) { -<<<<<<< HEAD -======= //CONS_Debug(DBG_RENDER, "In HWR_EndScreenWipe()\n"); ->>>>>>> srb2/next HWD.pfnEndScreenWipe(); } @@ -7065,10 +5183,6 @@ static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) return false; // again, shouldn't get here if it is a bad size } -<<<<<<< HEAD - HWR_GetFadeMask(lumpnum); - HWD.pfnDoScreenWipe(); -======= return true; } @@ -7085,7 +5199,6 @@ void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum) { // It does the same thing HWR_DoWipe(wipenum, scrnnum); ->>>>>>> srb2/next } void HWR_MakeScreenFinalTexture(void) diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index f5aff2fbb..1905a7e8c 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -37,7 +37,6 @@ void HWR_Startup(void); void HWR_Switch(void); void HWR_Shutdown(void); -<<<<<<< HEAD extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy; extern float gr_basewindowcenterx, gr_basewindowcentery; @@ -56,29 +55,6 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength); void HWR_DrawConsoleBack(UINT32 color, INT32 height); void HWR_DrawViewBorder(INT32 clearlines); void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum); -======= -void HWR_drawAMline(const fline_t *fl, INT32 color); -void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength); -void HWR_DrawConsoleBack(UINT32 color, INT32 height); -void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight); -void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player); -void HWR_RenderPlayerView(INT32 viewnumber, player_t *player); -void HWR_DrawViewBorder(INT32 clearlines); -void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum); -void HWR_InitTextureMapping(void); -void HWR_SetViewSize(void); -void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option); -void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap); -void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h); -void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap); -void HWR_CreatePlanePolygons(INT32 bspnum); -void HWR_CreateStaticLightmaps(INT32 bspnum); -void HWR_LoadTextures(size_t pnumtextures); -void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color); -void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength); -void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right. -void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum); ->>>>>>> srb2/next UINT8 *HWR_GetScreenshot(void); boolean HWR_Screenshot(const char *lbmname); @@ -89,7 +65,6 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player); void HWR_LoadShaders(UINT16 wadnum, boolean PK3); void HWR_SetViewSize(void); void HWR_AddCommands(void); -<<<<<<< HEAD // My original intention was to split hw_main.c // into files like hw_bsp.c, hw_sprites.c... @@ -101,13 +76,6 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf); // hw_main.c: Post-rendering -======= -void HWR_AddSessionCommands(void); -void HWR_CorrectSWTricks(void); -void transform(float *cx, float *cy, float *cz); -FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf); -INT32 HWR_GetTextureUsed(void); ->>>>>>> srb2/next void HWR_DoPostProcessor(player_t *player); void HWR_StartScreenWipe(void); void HWR_EndScreenWipe(void); @@ -141,7 +109,6 @@ void HWR_DrawSkyBackground(float fpov); #ifdef POLYOBJECTS void HWR_AddPolyObjectSegs(void); #endif -<<<<<<< HEAD // hw_main.c: BSP void HWR_RenderBSPNode(INT32 bspnum); @@ -170,14 +137,8 @@ extern consvar_t cv_grshaders; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; extern consvar_t cv_grmdls; -======= -extern consvar_t cv_grmodels; -extern consvar_t cv_grmodelinterpolation; -extern consvar_t cv_grmodellighting; ->>>>>>> srb2/next extern consvar_t cv_grfog; extern consvar_t cv_grfogdensity; -<<<<<<< HEAD extern consvar_t cv_grgammared; extern consvar_t cv_grgammagreen; extern consvar_t cv_grgammablue; @@ -191,24 +152,5 @@ extern consvar_t cv_grfakecontrast; extern consvar_t cv_grfallbackplayermodel; extern CV_PossibleValue_t granisotropicmode_cons_t[]; -======= -extern consvar_t cv_grsoftwarefog; -extern consvar_t cv_grfiltermode; -extern consvar_t cv_granisotropicmode; -extern consvar_t cv_grcorrecttricks; -extern consvar_t cv_fovchange; -extern consvar_t cv_grsolvetjoin; -extern consvar_t cv_grspritebillboarding; -extern consvar_t cv_grskydome; -extern consvar_t cv_grfakecontrast; - -extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy; - -extern float gr_viewwindowx, gr_basewindowcentery; - -// BP: big hack for a test in lighting ref : 1249753487AB -extern fixed_t *hwbbox; -extern FTransform atransform; ->>>>>>> srb2/next #endif