From 8e9073f11f96868baf173dbf6be07d00193fd202 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 10 Jan 2021 21:55:25 -0600 Subject: [PATCH 01/54] CR_PTERABYTE tweaks --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index a70dceb8b..27e1498da 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12774,13 +12774,13 @@ void P_PlayerAfterThink(player_t *player) if (!ptera->movefactor) goto dropoff; - if (ptera->cusval >= 50) + if (ptera->cusval >= 30) { player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); player->mo->momz = 9*FRACUNIT; - player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; + player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; } From 058b681660cc002e470a087f37a74fa8ca20cd93 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 10 Jan 2021 22:01:41 -0600 Subject: [PATCH 02/54] P_SetObjectMomz --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 27e1498da..be16a03cc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12779,7 +12779,7 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); - player->mo->momz = 9*FRACUNIT; + P_SetObjectMomZ(player->mo, 9*FRACUNIT, false); player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; From 1917155adf2a70f867d51e650a7be9bb53d68fb5 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 11 Jan 2021 00:19:56 -0600 Subject: [PATCH 03/54] PF_THOKKED --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index be16a03cc..f5b44d494 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12780,7 +12780,7 @@ void P_PlayerAfterThink(player_t *player) P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); P_SetObjectMomZ(player->mo, 9*FRACUNIT, false); - player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED; + player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; } From 129ac4633c61752d3107f04cd6ae40001cb78377 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 11 Jan 2021 13:25:42 -0600 Subject: [PATCH 04/54] Increased launch height --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index f5b44d494..7e61c91fa 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12779,7 +12779,7 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); - P_SetObjectMomZ(player->mo, 9*FRACUNIT, false); + P_SetObjectMomZ(player->mo, 16*FRACUNIT, false); player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; From 216f227539b0b9456eae1a55c8f9f89e19cd533d Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Wed, 13 Jan 2021 12:03:02 -0600 Subject: [PATCH 05/54] 12 --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 7e61c91fa..3fdbe4d8f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12779,7 +12779,7 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); - P_SetObjectMomZ(player->mo, 16*FRACUNIT, false); + P_SetObjectMomZ(player->mo, 12*FRACUNIT, false); player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; From 3f086ff6123341cfe236165908edb779014aa854 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 7 Apr 2021 01:14:32 -0500 Subject: [PATCH 06/54] The intial --- src/deh_tables.c | 3 +++ src/p_mobj.c | 41 ++++++++++++++++++++++++++++++++++++----- src/r_defs.h | 4 ++++ 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index dd6d7d69f..f3a77d528 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4905,6 +4905,9 @@ struct int_const_s const INT_CONST[] = { {"RF_SHADOWDRAW",RF_SHADOWDRAW}, {"RF_SHADOWEFFECTS",RF_SHADOWEFFECTS}, {"RF_DROPSHADOW",RF_DROPSHADOW}, + {"RF_FORCESUPER",RF_FORCESUPER}, + {"RF_FORCENOSUPER",RF_FORCENOSUPER}, + {"RF_REVERSESUPER",RF_REVERSESUPER}, // Level flags {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, diff --git a/src/p_mobj.c b/src/p_mobj.c index 49db6daee..3f77f28aa 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -325,9 +325,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) mobj->tics = st->tics; // Adjust the player's animation speed to match their velocity. - if (state == S_PLAY_STND && player->powers[pw_super] && skins[player->skin].sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) // if no super wait, don't wait at all - mobj->tics = -1; - else if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE)) + if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE)) mobj->tics = 2; else if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST)) { @@ -396,8 +394,26 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) if (skin) { - spr2 = P_GetSkinSprite2(skin, (((player->powers[pw_super] && !(player->charflags & SF_NOSUPERSPRITES)) ? FF_SPR2SUPER : 0)|st->frame) & FF_FRAMEMASK, mobj->player); + UINT16 stateframe = st->frame; + + // Add/Remove FF_SPR2SUPER based on certain conditions + if (player->powers[pw_super] && !(player->charflags & SF_NOSUPERSPRITES)) + stateframe = stateframe | FF_SPR2SUPER; + + if (stateframe & FF_SPR2SUPER) + { + if (mobj->renderflags & RF_FORCENOSUPER) + stateframe = stateframe & ~FF_SPR2SUPER; + } + else if (mobj->renderflags & RF_FORCESUPER) + stateframe = stateframe | FF_SPR2SUPER; + + // Get the sprite2 and frame number + spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), mobj->player); numframes = skin->sprites[spr2].numframes; + + if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) + mobj->tics = -1; // If no super wait, don't wait at all } else { @@ -522,8 +538,23 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) if (skin) { - spr2 = P_GetSkinSprite2(skin, st->frame & FF_FRAMEMASK, mobj->player); + UINT16 stateframe = st->frame; + + // Add/Remove FF_SPR2SUPER based on certain conditions + if (stateframe & FF_SPR2SUPER) + { + if (mobj->renderflags & RF_FORCENOSUPER) + stateframe = stateframe & ~FF_SPR2SUPER; + } + else if (mobj->renderflags & RF_FORCESUPER) + stateframe = stateframe | FF_SPR2SUPER; + + // Get the sprite2 and frame number + spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), NULL); numframes = skin->sprites[spr2].numframes; + + if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) + mobj->tics = -1; // If no super wait, don't wait at all } else { diff --git a/src/r_defs.h b/src/r_defs.h index 9c649fbc4..31f30dd6f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -738,6 +738,10 @@ typedef enum RF_SHADOWDRAW = 0x10000, // Stretches and skews the sprite like a shadow. RF_SHADOWEFFECTS = 0x20000, // Scales and becomes transparent like a shadow. RF_DROPSHADOW = (RF_SHADOWDRAW | RF_SHADOWEFFECTS | RF_FULLDARK), + + RF_FORCESUPER = 0x40000, // Forces an object to use super sprites with SPR_PLAY. + RF_FORCENOSUPER = 0x80000, // Forces an object to NOT use super sprites with SPR_PLAY. + RF_REVERSESUPER = (RF_FORCESUPER | RF_FORCENOSUPER), //Use normal sprites in place of super sprites and vice-versa } renderflags_t; typedef enum From 228668ce986e2f44fec2e085c9ee7e174ed3f3d3 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Mon, 19 Apr 2021 14:25:34 -0500 Subject: [PATCH 07/54] Change the render flags to extra flags and improve SF_NOSUPERSPRITES --- src/deh_tables.c | 5 ++--- src/p_mobj.c | 12 +++++++----- src/p_mobj.h | 29 +++++++++++++++++------------ src/r_defs.h | 4 ---- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index f3a77d528..621c6aae4 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4351,6 +4351,8 @@ const char *const MOBJEFLAG_LIST[] = { "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement "TRACERANGLE", // Compute and trigger on mobj angle relative to tracer + "FORCESUPER", // Forces an object to use super sprites with SPR_PLAY. + "FORCENOSUPER", // Forces an object to NOT use super sprites with SPR_PLAY. NULL }; @@ -4905,9 +4907,6 @@ struct int_const_s const INT_CONST[] = { {"RF_SHADOWDRAW",RF_SHADOWDRAW}, {"RF_SHADOWEFFECTS",RF_SHADOWEFFECTS}, {"RF_DROPSHADOW",RF_DROPSHADOW}, - {"RF_FORCESUPER",RF_FORCESUPER}, - {"RF_FORCENOSUPER",RF_FORCENOSUPER}, - {"RF_REVERSESUPER",RF_REVERSESUPER}, // Level flags {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, diff --git a/src/p_mobj.c b/src/p_mobj.c index 3f77f28aa..4e9015e8a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -397,15 +397,17 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) UINT16 stateframe = st->frame; // Add/Remove FF_SPR2SUPER based on certain conditions - if (player->powers[pw_super] && !(player->charflags & SF_NOSUPERSPRITES)) + if (player->charflags & SF_NOSUPERSPRITES) + stateframe = stateframe & ~FF_SPR2SUPER; + else if (player->powers[pw_super]) stateframe = stateframe | FF_SPR2SUPER; if (stateframe & FF_SPR2SUPER) { - if (mobj->renderflags & RF_FORCENOSUPER) + if (mobj->eflags & MFE_FORCENOSUPER) stateframe = stateframe & ~FF_SPR2SUPER; } - else if (mobj->renderflags & RF_FORCESUPER) + else if (mobj->eflags & MFE_FORCESUPER) stateframe = stateframe | FF_SPR2SUPER; // Get the sprite2 and frame number @@ -543,10 +545,10 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) // Add/Remove FF_SPR2SUPER based on certain conditions if (stateframe & FF_SPR2SUPER) { - if (mobj->renderflags & RF_FORCENOSUPER) + if (mobj->eflags & MFE_FORCENOSUPER) stateframe = stateframe & ~FF_SPR2SUPER; } - else if (mobj->renderflags & RF_FORCESUPER) + else if (mobj->eflags & MFE_FORCESUPER) stateframe = stateframe | FF_SPR2SUPER; // Get the sprite2 and frame number diff --git a/src/p_mobj.h b/src/p_mobj.h index 5bb7c908e..c4567c27d 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -218,33 +218,38 @@ typedef enum typedef enum { // The mobj stands on solid floor (not on another mobj or in air) - MFE_ONGROUND = 1, + MFE_ONGROUND = 1, // The mobj just hit the floor while falling, this is cleared on next frame // (instant damage in lava/slime sectors to prevent jump cheat..) - MFE_JUSTHITFLOOR = 1<<1, + MFE_JUSTHITFLOOR = 1<<1, // The mobj stands in a sector with water, and touches the surface // this bit is set once and for all at the start of mobjthinker - MFE_TOUCHWATER = 1<<2, + MFE_TOUCHWATER = 1<<2, // The mobj stands in a sector with water, and his waist is BELOW the water surface // (for player, allows swimming up/down) - MFE_UNDERWATER = 1<<3, + MFE_UNDERWATER = 1<<3, // used for ramp sectors - MFE_JUSTSTEPPEDDOWN = 1<<4, + MFE_JUSTSTEPPEDDOWN = 1<<4, // Vertically flip sprite/allow upside-down physics - MFE_VERTICALFLIP = 1<<5, + MFE_VERTICALFLIP = 1<<5, // Goo water - MFE_GOOWATER = 1<<6, + MFE_GOOWATER = 1<<6, // The mobj is touching a lava block - MFE_TOUCHLAVA = 1<<7, + MFE_TOUCHLAVA = 1<<7, // Mobj was already pushed this tic - MFE_PUSHED = 1<<8, + MFE_PUSHED = 1<<8, // Mobj was already sprung this tic - MFE_SPRUNG = 1<<9, + MFE_SPRUNG = 1<<9, // Platform movement - MFE_APPLYPMOMZ = 1<<10, + MFE_APPLYPMOMZ = 1<<10, // Compute and trigger on mobj angle relative to tracer // See Linedef Exec 457 (Track mobj angle to point) - MFE_TRACERANGLE = 1<<11, + MFE_TRACERANGLE = 1<<11, + // Forces an object to use super sprites with SPR_PLAY. + MFE_FORCESUPER = 1<<12, + // Forces an object to NOT use super sprites with SPR_PLAY. + MFE_FORCENOSUPER = 1<<13, + // free: to and including 1<<15 } mobjeflag_t; diff --git a/src/r_defs.h b/src/r_defs.h index 31f30dd6f..9c649fbc4 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -738,10 +738,6 @@ typedef enum RF_SHADOWDRAW = 0x10000, // Stretches and skews the sprite like a shadow. RF_SHADOWEFFECTS = 0x20000, // Scales and becomes transparent like a shadow. RF_DROPSHADOW = (RF_SHADOWDRAW | RF_SHADOWEFFECTS | RF_FULLDARK), - - RF_FORCESUPER = 0x40000, // Forces an object to use super sprites with SPR_PLAY. - RF_FORCENOSUPER = 0x80000, // Forces an object to NOT use super sprites with SPR_PLAY. - RF_REVERSESUPER = (RF_FORCESUPER | RF_FORCENOSUPER), //Use normal sprites in place of super sprites and vice-versa } renderflags_t; typedef enum From abc886b9ac25cd5528142b09c62498b335f3c22f Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 21 Apr 2021 18:20:56 -0500 Subject: [PATCH 08/54] REVERSESUPER rises from the grave --- src/deh_lua.c | 5 +++++ src/p_mobj.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/deh_lua.c b/src/deh_lua.c index e6a436421..e920154cc 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -264,6 +264,11 @@ static inline int lib_getenum(lua_State *L) lua_pushinteger(L, ((lua_Integer)1< Date: Tue, 8 Jun 2021 23:45:50 -0400 Subject: [PATCH 09/54] Calculate maxstep for pushables --- src/p_map.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 922c0d9ec..55b8a9d7e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2698,6 +2698,17 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, thing->scale); + + if (thing->flags & MF_PUSHABLE) + { + // If using type Section1:13, double the maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + maxstep <<= 1; + + // If using type Section1:14, no maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + maxstep = 0; + } if (thing->player) { From 165be342063012ea694f75734102b003242de72e Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Wed, 9 Jun 2021 12:59:06 -0400 Subject: [PATCH 10/54] Fix player maxstep, oops --- src/p_map.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 55b8a9d7e..fbc7447ce 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2698,17 +2698,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, thing->scale); - - if (thing->flags & MF_PUSHABLE) - { - // If using type Section1:13, double the maxstep. - if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) - maxstep <<= 1; - - // If using type Section1:14, no maxstep. - if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) - maxstep = 0; - } if (thing->player) { @@ -2728,6 +2717,16 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) && P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale)) maxstep = 0; } + else if (thing->flags & MF_PUSHABLE) + { + // If using type Section1:13, double the maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + maxstep <<= 1; + + // If using type Section1:14, no maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + maxstep = 0; + } if (thing->type == MT_SKIM) maxstep = 0; From 389cea2bc18a29f34132c41ad1027a1e588b6205 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 22 Jun 2021 01:38:37 -0500 Subject: [PATCH 11/54] You probably don't want to memorise the formula to convert arccos to arcsin so --- src/lua_mathlib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index e6f8c98c1..bd9218a3d 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -88,6 +88,12 @@ static int lib_finetangent(lua_State *L) return 1; } +static int lib_fixedasin(lua_State *L) +{ + lua_pushangle(L, -FixedAcos(luaL_checkfixed(L, 1)) + ANGLE_90); + return 1; +} + static int lib_fixedacos(lua_State *L) { lua_pushangle(L, FixedAcos(luaL_checkfixed(L, 1))); @@ -199,6 +205,7 @@ static luaL_Reg lib_math[] = { {"sin", lib_finesine}, {"cos", lib_finecosine}, {"tan", lib_finetangent}, + {"asin", lib_fixedasin}, {"acos", lib_fixedacos}, {"FixedAngle", lib_fixedangle}, {"fixangle" , lib_fixedangle}, From 791b981fd80cb23cee19d27170b347e10ce96ef1 Mon Sep 17 00:00:00 2001 From: katsy Date: Wed, 22 Sep 2021 16:22:47 -0500 Subject: [PATCH 12/54] null gamestate during pre-intermission to prevent unwanted interaction --- src/g_game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index de1a774f4..e497aa13f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3927,6 +3927,9 @@ static void G_DoCompleted(void) if (metalrecording) G_StopMetalRecording(false); + G_SetGamestate(GS_NULL); + wipegamestate = GS_NULL; + for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) G_PlayerFinishLevel(i); // take away cards and stuff From f70491b2b58c3a48857602d5004b09c70224ed48 Mon Sep 17 00:00:00 2001 From: Vincent Robinson Date: Mon, 4 Oct 2021 12:20:15 -0700 Subject: [PATCH 13/54] Make linedef 96 apply to tags from 97-99, but not to itself --- src/p_setup.c | 77 ++++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 588815aee..7f9674e4e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3046,48 +3046,55 @@ static void P_AddBinaryMapTags(void) { size_t i; - for (i = 0; i < numlines; i++) - { - // 96: Apply Tag to Tagged Sectors + for (i = 0; i < numlines; i++) { // 97: Apply Tag to Front Sector // 98: Apply Tag to Back Sector // 99: Apply Tag to Front and Back Sectors - if (lines[i].special == 96) { - size_t j; - mtag_t tag = Tag_FGet(&lines[i].frontsector->tags); - mtag_t target_tag = Tag_FGet(&lines[i].tags); - mtag_t offset_tags[4]; - memset(offset_tags, 0, sizeof(mtag_t)*4); - if (lines[i].flags & ML_EFFECT6) { - offset_tags[0] = (INT32)sides[lines[i].sidenum[0]].textureoffset / FRACUNIT; - offset_tags[1] = (INT32)sides[lines[i].sidenum[0]].rowoffset / FRACUNIT; - } - if (lines[i].flags & ML_TFERLINE) { - offset_tags[2] = (INT32)sides[lines[i].sidenum[1]].textureoffset / FRACUNIT; - offset_tags[3] = (INT32)sides[lines[i].sidenum[1]].rowoffset / FRACUNIT; - } + if (lines[i].special == 97 || lines[i].special == 99) + P_AddBinaryMapTagsFromLine(lines[i].frontsector, &lines[i]); + if (lines[i].special == 98 || lines[i].special == 99) + P_AddBinaryMapTagsFromLine(lines[i].backsector, &lines[i]); + } - for (j = 0; j < numsectors; j++) { - boolean matches_target_tag = target_tag && Tag_Find(§ors[j].tags, target_tag); - size_t k; for (k = 0; k < 4; k++) { - if (lines[i].flags & ML_EFFECT5) { - if (matches_target_tag || (offset_tags[k] && Tag_Find(§ors[j].tags, offset_tags[k]))) { - Tag_Add(§ors[j].tags, tag); - break; - } - } else if (matches_target_tag) { - if (k == 0) - Tag_Add(§ors[j].tags, tag); - if (offset_tags[k]) - Tag_Add(§ors[j].tags, offset_tags[k]); + // Run this loop after the 97-99 loop to ensure that 96 can search through all of the + // 97-99-applied tags. + for (i = 0; i < numlines; i++) { + size_t j; + mtag_t tag, target_tag; + mtag_t offset_tags[4]; + + // 96: Apply Tag to Tagged Sectors + if (lines[i].special != 96) + continue; + + tag = Tag_FGet(&lines[i].frontsector->tags); + target_tag = Tag_FGet(&lines[i].tags); + memset(offset_tags, 0, sizeof(mtag_t)*4); + if (lines[i].flags & ML_EFFECT6) { + offset_tags[0] = (INT32)sides[lines[i].sidenum[0]].textureoffset / FRACUNIT; + offset_tags[1] = (INT32)sides[lines[i].sidenum[0]].rowoffset / FRACUNIT; + } + if (lines[i].flags & ML_TFERLINE) { + offset_tags[2] = (INT32)sides[lines[i].sidenum[1]].textureoffset / FRACUNIT; + offset_tags[3] = (INT32)sides[lines[i].sidenum[1]].rowoffset / FRACUNIT; + } + + for (j = 0; j < numsectors; j++) { + boolean matches_target_tag = target_tag && Tag_Find(§ors[j].tags, target_tag); + size_t k; + for (k = 0; k < 4; k++) { + if (lines[i].flags & ML_EFFECT5) { + if (matches_target_tag || (offset_tags[k] && Tag_Find(§ors[j].tags, offset_tags[k]))) { + Tag_Add(§ors[j].tags, tag); + break; } + } else if (matches_target_tag) { + if (k == 0) + Tag_Add(§ors[j].tags, tag); + if (offset_tags[k]) + Tag_Add(§ors[j].tags, offset_tags[k]); } } - } else { - if (lines[i].special == 97 || lines[i].special == 99) - P_AddBinaryMapTagsFromLine(lines[i].frontsector, &lines[i]); - if (lines[i].special == 98 || lines[i].special == 99) - P_AddBinaryMapTagsFromLine(lines[i].backsector, &lines[i]); } } } From 86edb1e4caf4798d612ae373a50b0309ca6737da Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Fri, 3 Dec 2021 23:20:07 -0600 Subject: [PATCH 14/54] Fix player disappearing when drowning in painstate --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index f21118a81..ee76d29a8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12206,7 +12206,7 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) + if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1) && player->playerstate == PST_LIVE) player->mo->flags2 |= MF2_DONTDRAW; else player->mo->flags2 &= ~MF2_DONTDRAW; From 3802f601a9b9a459f556b35776c6ce3dbae1f7a2 Mon Sep 17 00:00:00 2001 From: sphere Date: Mon, 15 Nov 2021 18:03:07 +0100 Subject: [PATCH 15/54] blentran part 1: Flag changes & semibright support. --- src/deh_tables.c | 25 ++++++++++++++++------ src/hardware/hw_draw.c | 44 +++++++++------------------------------ src/hardware/hw_main.c | 6 ++++++ src/hu_stuff.c | 22 ++++++++++++-------- src/m_menu.c | 10 ++++----- src/p_pspr.h | 47 ++++++++++++++++++++++++++++++------------ src/r_data.h | 3 --- src/r_defs.h | 23 +++++++++++++-------- src/r_things.c | 22 ++++++++++++++++---- src/r_things.h | 16 +++++++------- src/v_video.c | 29 ++++++++------------------ src/v_video.h | 22 +++++++++++++------- 12 files changed, 151 insertions(+), 118 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index f30f7c14d..146a04f7f 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4843,9 +4843,18 @@ struct int_const_s const INT_CONST[] = { {"FF_RANDOMANIM",FF_RANDOMANIM}, {"FF_GLOBALANIM",FF_GLOBALANIM}, {"FF_FULLBRIGHT",FF_FULLBRIGHT}, + {"FF_SEMIBRIGHT",FF_SEMIBRIGHT}, + {"FF_FULLDARK",FF_FULLDARK}, {"FF_VERTICALFLIP",FF_VERTICALFLIP}, {"FF_HORIZONTALFLIP",FF_HORIZONTALFLIP}, {"FF_PAPERSPRITE",FF_PAPERSPRITE}, + {"FF_FLOORSPRITE",FF_FLOORSPRITE}, + {"FF_BLENDMASK",FF_BLENDMASK}, + {"FF_BLENDSHIFT",FF_BLENDSHIFT}, + {"FF_ADD",FF_ADD}, + {"FF_SUBTRACT",FF_SUBTRACT}, + {"FF_REVERSESUBTRACT",FF_REVERSESUBTRACT}, + {"FF_MODULATE",FF_MODULATE}, {"FF_TRANSMASK",FF_TRANSMASK}, {"FF_TRANSSHIFT",FF_TRANSSHIFT}, // new preshifted translucency (used in source) @@ -4900,9 +4909,10 @@ struct int_const_s const INT_CONST[] = { {"RF_OBJECTSLOPESPLAT",RF_OBJECTSLOPESPLAT}, {"RF_NOSPLATBILLBOARD",RF_NOSPLATBILLBOARD}, {"RF_NOSPLATROLLANGLE",RF_NOSPLATROLLANGLE}, - {"RF_BLENDMASK",RF_BLENDMASK}, + {"RF_BRIGHTMASK",RF_BRIGHTMASK}, {"RF_FULLBRIGHT",RF_FULLBRIGHT}, {"RF_FULLDARK",RF_FULLDARK}, + {"RF_SEMIBRIGHT",RF_SEMIBRIGHT}, {"RF_NOCOLORMAPS",RF_NOCOLORMAPS}, {"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK}, {"RF_PAPERSPRITE",RF_PAPERSPRITE}, @@ -5391,9 +5401,12 @@ struct int_const_s const INT_CONST[] = { {"V_HUDTRANSHALF",V_HUDTRANSHALF}, {"V_HUDTRANS",V_HUDTRANS}, {"V_HUDTRANSDOUBLE",V_HUDTRANSDOUBLE}, - {"V_AUTOFADEOUT",V_AUTOFADEOUT}, - {"V_RETURN8",V_RETURN8}, - {"V_OFFSET",V_OFFSET}, + {"V_BLENDSHIFT",V_BLENDSHIFT}, + {"V_BLENDMASK",V_BLENDMASK}, + {"V_ADD",V_ADD}, + {"V_SUBTRACT",V_SUBTRACT}, + {"V_REVERSESUBTRACT",V_REVERSESUBTRACT}, + {"V_MODULATE",V_MODULATE}, {"V_ALLOWLOWERCASE",V_ALLOWLOWERCASE}, {"V_FLIP",V_FLIP}, {"V_CENTERNAMETAG",V_CENTERNAMETAG}, @@ -5401,8 +5414,8 @@ struct int_const_s const INT_CONST[] = { {"V_SNAPTOBOTTOM",V_SNAPTOBOTTOM}, {"V_SNAPTOLEFT",V_SNAPTOLEFT}, {"V_SNAPTORIGHT",V_SNAPTORIGHT}, - {"V_WRAPX",V_WRAPX}, - {"V_WRAPY",V_WRAPY}, + {"V_AUTOFADEOUT",V_AUTOFADEOUT}, + {"V_RETURN8",V_RETURN8}, {"V_NOSCALESTART",V_NOSCALESTART}, {"V_PERPLAYER",V_PERPLAYER}, diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 8223705bd..89d43a6b4 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -119,11 +119,6 @@ void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option) flags = PF_Translucent|PF_NoDepthTest; - if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY; - // clip it since it is used for bunny scroll in doom I HWD.pfnDrawPolygon(NULL, v, 4, flags); } @@ -145,9 +140,6 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p UINT8 perplayershuffle = 0; - if (alphalevel >= 10 && alphalevel < 13) - return; - // make patch ready in hardware cache if (!colormap) HWR_GetPatch(gpatch); @@ -191,15 +183,9 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p offsetx = (float)(gpatch->leftoffset) * fscalew; // top offset - // TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!? + // TODO: make some kind of vertical version of V_FLIP offsety = (float)(gpatch->topoffset) * fscaleh; - if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs - { - offsetx *= dupx; - offsety *= dupy; - } - cx -= offsetx; cy -= offsety; } @@ -361,19 +347,15 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p flags = PF_Translucent|PF_NoDepthTest; - if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY; - // clip it since it is used for bunny scroll in doom I if (alphalevel) { FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; + + if (alphalevel == 10) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; + else if (alphalevel == 11) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; + else if (alphalevel == 12) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); @@ -399,9 +381,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, UINT8 perplayershuffle = 0; - if (alphalevel >= 10 && alphalevel < 13) - return; - // make patch ready in hardware cache if (!colormap) HWR_GetPatch(gpatch); @@ -591,11 +570,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, flags = PF_Translucent|PF_NoDepthTest; - if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY; - // Auto-crop at splitscreen borders! if (splitscreen && (option & V_PERPLAYER)) { @@ -671,10 +645,12 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, { FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; + + if (alphalevel == 10) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; + else if (alphalevel == 11) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; + else if (alphalevel == 12) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); } diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9bade3d6f..c5e5a3218 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3916,6 +3916,9 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) } } + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + for (i = 0; i < sector->numlights; i++) { if (endtop < endrealbot && top < realbot) @@ -4269,6 +4272,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else if (!lightset) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f4c5e4c3b..129724585 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1869,7 +1869,7 @@ static void HU_DrawChat_Old(void) static inline void HU_DrawCrosshair(void) { - INT32 i, y; + INT32 i, y, dupz; i = cv_crosshair.value & 3; if (!i) @@ -1885,12 +1885,14 @@ static inline void HU_DrawCrosshair(void) #endif y = viewwindowy + (viewheight>>1); - V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); + dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); + + V_DrawFixedPatch(vid.width<<(FRACBITS-1), y<>1); - if (splitscreen) - { -#ifdef HWRENDER + if (!splitscreen) + return; + + #ifdef HWRENDER if (rendermode != render_soft) y += (INT32)gl_viewheight; else -#endif + #endif y += viewheight; - V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); - } + dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); + + V_DrawFixedPatch(vid.width<<(FRACBITS-1), y<width - p->leftoffset; for (i = 0; i < 16; i++) { - V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH)); + V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(centerlump[i & 1], PU_PATCH)); xx += 8; } V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_PATCH)); @@ -4134,7 +4134,7 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) p = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH); for (n = 0; n < boxlines; n++) { - V_DrawScaledPatch(cx, cy, V_WRAPY, p); + V_DrawScaledPatch(cx, cy, 0, p); cy += step; } V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BL], PU_PATCH)); @@ -4146,8 +4146,8 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) cy = y; while (width > 0) { - V_DrawScaledPatch(cx, cy, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH)); - V_DrawScaledPatch(cx, y + boff + boxlines*step, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH)); + V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH)); + V_DrawScaledPatch(cx, y + boff + boxlines*step, 0, W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH)); width--; cx += step; } @@ -4159,7 +4159,7 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) p = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH); for (n = 0; n < boxlines; n++) { - V_DrawScaledPatch(cx, cy, V_WRAPY, p); + V_DrawScaledPatch(cx, cy, 0, p); cy += step; } V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BR], PU_PATCH)); diff --git a/src/p_pspr.h b/src/p_pspr.h index 4525ba14c..27002b713 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -41,9 +41,20 @@ /// \brief Frame flags - SPR2: Super sprite2 #define FF_SPR2SUPER 0x80 /// \brief Frame flags - SPR2: A change of state at the end of Sprite2 animation -#define FF_SPR2ENDSTATE 0x1000 +#define FF_SPR2ENDSTATE 0x100 /// \brief Frame flags - SPR2: 50% of starting in middle of Sprite2 animation -#define FF_SPR2MIDSTART 0x2000 +#define FF_SPR2MIDSTART 0x200 + +/// \brief Frame flags: blend types +#define FF_BLENDMASK 0x7000 +/// \brief shift for FF_BLENDMASK +#define FF_BLENDSHIFT 12 +/// \brief preshifted blend flags minus 1 as effects don't distinguish between AST_COPY and AST_TRANSLUCENT +#define FF_ADD ((AST_ADD-1)<= MAXLIGHTSCALE) lindex = MAXLIGHTSCALE-1; + + if (newsprite->cut & SC_SEMIBRIGHT) + lindex = (MAXLIGHTSCALE/2) + (lindex >>1); + newsprite->colormap = spritelights[lindex]; } } @@ -2023,6 +2027,8 @@ static void R_ProjectSprite(mobj_t *thing) if (R_ThingIsFullBright(oldthing) || oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) vis->cut |= SC_FULLBRIGHT; + else if (R_ThingIsSemiBright(oldthing)) + vis->cut |= SC_SEMIBRIGHT; else if (R_ThingIsFullDark(oldthing)) vis->cut |= SC_FULLDARK; @@ -2045,6 +2051,9 @@ static void R_ProjectSprite(mobj_t *thing) if (lindex >= MAXLIGHTSCALE) lindex = MAXLIGHTSCALE-1; + if (vis->cut & SC_SEMIBRIGHT) + lindex = (MAXLIGHTSCALE/2) + (lindex >> 1); + vis->colormap = spritelights[lindex]; } @@ -3012,7 +3021,7 @@ boolean R_ThingVisible (mobj_t *thing) { return (!( thing->sprite == SPR_NULL || - ( thing->flags2 & (MF2_DONTDRAW) ) || + ( thing->flags2 & (MF2_DONTDRAW) ) || ( thing->renderflags & (RF_DONTDRAW) ) || (r_viewmobj && (thing == r_viewmobj || (r_viewmobj->player && r_viewmobj->player->followmobj == thing))) )); } @@ -3073,17 +3082,22 @@ boolean R_ThingIsPaperSprite(mobj_t *thing) boolean R_ThingIsFloorSprite(mobj_t *thing) { - return (thing->flags2 & MF2_SPLAT || thing->renderflags & RF_FLOORSPRITE); + return (thing->flags2 & MF2_SPLAT || thing->frame & FF_FLOORSPRITE || thing->renderflags & RF_FLOORSPRITE); } boolean R_ThingIsFullBright(mobj_t *thing) { - return (thing->frame & FF_FULLBRIGHT || thing->renderflags & RF_FULLBRIGHT); + return ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT || (thing->renderflags & RF_BRIGHTMASK) == RF_FULLBRIGHT); +} + +boolean R_ThingIsSemiBright(mobj_t *thing) +{ + return ((thing->frame & FF_BRIGHTMASK) == FF_SEMIBRIGHT || (thing->renderflags & RF_BRIGHTMASK) == RF_SEMIBRIGHT); } boolean R_ThingIsFullDark(mobj_t *thing) { - return (thing->renderflags & RF_FULLDARK); + return ((thing->frame & FF_BRIGHTMASK) == FF_FULLDARK || (thing->renderflags & RF_BRIGHTMASK) == RF_FULLDARK); } // diff --git a/src/r_things.h b/src/r_things.h index 79dc80d94..b1ff32b1e 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -82,6 +82,7 @@ boolean R_ThingIsPaperSprite (mobj_t *thing); boolean R_ThingIsFloorSprite (mobj_t *thing); boolean R_ThingIsFullBright (mobj_t *thing); +boolean R_ThingIsSemiBright (mobj_t *thing); boolean R_ThingIsFullDark (mobj_t *thing); // -------------- @@ -123,13 +124,14 @@ typedef enum SC_PRECIP = 1<<2, SC_LINKDRAW = 1<<3, SC_FULLBRIGHT = 1<<4, - SC_FULLDARK = 1<<5, - SC_VFLIP = 1<<6, - SC_ISSCALED = 1<<7, - SC_ISROTATED = 1<<8, - SC_SHADOW = 1<<9, - SC_SHEAR = 1<<10, - SC_SPLAT = 1<<11, + SC_SEMIBRIGHT = 1<<5, + SC_FULLDARK = 1<<6, + SC_VFLIP = 1<<7, + SC_ISSCALED = 1<<8, + SC_ISROTATED = 1<<9, + SC_SHADOW = 1<<10, + SC_SHEAR = 1<<11, + SC_SPLAT = 1<<12, // masks SC_CUTMASK = SC_TOP|SC_BOTTOM, SC_FLAGMASK = ~SC_CUTMASK diff --git a/src/v_video.c b/src/v_video.c index c39938544..ad0164816 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -540,11 +540,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca v_translevel = NULL; if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) { - if (alphalevel == 13) + if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; - else if (alphalevel == 14) + else if (alphalevel == 11) alphalevel = 10 - st_translucency; - else if (alphalevel == 15) + else if (alphalevel == 12) alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) @@ -591,10 +591,6 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca colfrac = FixedDiv(FRACUNIT, fdup); rowfrac = FixedDiv(FRACUNIT, vdup); - // So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible - // For now let's just at least give V_OFFSET the ability to support V_FLIP - // I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff - // -- Monster Iestyn 29/10/18 { fixed_t offsetx = 0, offsety = 0; @@ -605,15 +601,8 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca offsetx = FixedMul(patch->leftoffset<topoffset<> V_ALPHASHIFT))) { - if (alphalevel == 13) + if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; - else if (alphalevel == 14) + else if (alphalevel == 11) alphalevel = 10 - st_translucency; - else if (alphalevel == 15) + else if (alphalevel == 12) alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) @@ -1411,11 +1400,11 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT))) { - if (alphalevel == 13) + if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; - else if (alphalevel == 14) + else if (alphalevel == 11) alphalevel = 10 - st_translucency; - else if (alphalevel == 15) + else if (alphalevel == 12) alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) diff --git a/src/v_video.h b/src/v_video.h index c10ab22ce..bcb39706e 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -122,17 +122,23 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue); #define V_70TRANS 0x00070000 #define V_80TRANS 0x00080000 // used to be V_8020TRANS #define V_90TRANS 0x00090000 -#define V_HUDTRANSHALF 0x000D0000 -#define V_HUDTRANS 0x000E0000 // draw the hud translucent -#define V_HUDTRANSDOUBLE 0x000F0000 +#define V_HUDTRANSHALF 0x000A0000 +#define V_HUDTRANS 0x000B0000 // draw the hud translucent +#define V_HUDTRANSDOUBLE 0x000C0000 // Macros follow #define V_USERHUDTRANSHALF ((10-(cv_translucenthud.value/2))< Date: Mon, 15 Nov 2021 19:07:20 +0100 Subject: [PATCH 16/54] blentran part 2: Sprite & patch blendmodes. --- src/hardware/hw_draw.c | 16 ++++++++++++---- src/hardware/hw_main.c | 32 +++++++++++++++++++++++++------- src/r_things.c | 14 ++++++++++---- src/v_video.c | 22 ++++++++++++++++------ 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 89d43a6b4..e02dbea5b 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -130,6 +130,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p float cx = FIXED_TO_FLOAT(x); float cy = FIXED_TO_FLOAT(y); UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT8 blendmode = ((option & V_BLENDMASK) >> V_BLENDSHIFT); GLPatch_t *hwrPatch; // 3--2 @@ -345,9 +346,12 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p v[0].t = v[1].t = 0.0f; v[2].t = v[3].t = hwrPatch->max_t; - flags = PF_Translucent|PF_NoDepthTest; - // clip it since it is used for bunny scroll in doom I + if (blendmode) + flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest; + else + flags = PF_Translucent|PF_NoDepthTest; + if (alphalevel) { FSurfaceInfo Surf; @@ -371,6 +375,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, float cx = FIXED_TO_FLOAT(x); float cy = FIXED_TO_FLOAT(y); UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT8 blendmode = ((option & V_BLENDMASK) >> V_BLENDSHIFT); GLPatch_t *hwrPatch; // 3--2 @@ -568,8 +573,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, else v[2].t = v[3].t = (FIXED_TO_FLOAT(sy+h)/(float)(gpatch->height))*hwrPatch->max_t; - flags = PF_Translucent|PF_NoDepthTest; - // Auto-crop at splitscreen borders! if (splitscreen && (option & V_PERPLAYER)) { @@ -641,6 +644,11 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, } // clip it since it is used for bunny scroll in doom I + if (blendmode) + flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest; + else + flags = PF_Translucent|PF_NoDepthTest; + if (alphalevel) { FSurfaceInfo Surf; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c5e5a3218..63f1191ca 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3853,6 +3853,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) else occlusion = PF_Occlude; + INT32 blendmode; + if (spr->mobj->frame & FF_BLENDMASK) + blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = spr->mobj->blendmode; + if (!cv_translucency.value) // translucency disabled { Surf.PolyColor.s.alpha = 0xFF; @@ -3862,12 +3868,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) else if (spr->mobj->flags2 & MF2_SHADOW) { Surf.PolyColor.s.alpha = 0x40; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode); + blend = HWR_GetBlendModeFlag(blendmode); } else if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); + blend = HWR_SurfaceBlend(blendmode, trans, &Surf); } else { @@ -3876,7 +3882,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // Hurdler: PF_Environement would be cool, but we need to fix // the issue with the fog before Surf.PolyColor.s.alpha = 0xFF; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|occlusion; + blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } @@ -4291,6 +4297,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else occlusion = PF_Occlude; + INT32 blendmode; + if (spr->mobj->frame & FF_BLENDMASK) + blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = spr->mobj->blendmode; + if (!cv_translucency.value) // translucency disabled { Surf.PolyColor.s.alpha = 0xFF; @@ -4300,12 +4312,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else if (spr->mobj->flags2 & MF2_SHADOW) { Surf.PolyColor.s.alpha = 0x40; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode); + blend = HWR_GetBlendModeFlag(blendmode); } else if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); + blend = HWR_SurfaceBlend(blendmode, trans, &Surf); } else { @@ -4314,7 +4326,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) // Hurdler: PF_Environement would be cool, but we need to fix // the issue with the fog before Surf.PolyColor.s.alpha = 0xFF; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|occlusion; + blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } @@ -5009,10 +5021,16 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->spritexscale < 1 || thing->spriteyscale < 1) return; + INT32 blendmode; + if (thing->frame & FF_BLENDMASK) + blendmode = ((thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = thing->blendmode; + // Visibility check by the blend mode. if (thing->frame & FF_TRANSMASK) { - if (!R_BlendLevelVisible(thing->blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)) + if (!R_BlendLevelVisible(blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)) return; } diff --git a/src/r_things.c b/src/r_things.c index 5d5be8753..accd1e2b3 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1802,13 +1802,19 @@ static void R_ProjectSprite(mobj_t *thing) return; } + INT32 blendmode; + if (oldthing->frame & FF_BLENDMASK) + blendmode = ((oldthing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = oldthing->blendmode; + // Determine the translucency value. if (oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK else if (oldthing->frame & FF_TRANSMASK) { trans = (oldthing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT; - if (!R_BlendLevelVisible(oldthing->blendmode, trans)) + if (!R_BlendLevelVisible(blendmode, trans)) return; } else @@ -2020,8 +2026,8 @@ static void R_ProjectSprite(mobj_t *thing) vis->scale += FixedMul(scalestep, spriteyscale) * (vis->x1 - x1); } - if ((oldthing->blendmode != AST_COPY) && cv_translucency.value) - vis->transmap = R_GetBlendTable(oldthing->blendmode, trans); + if ((blendmode != AST_COPY) && cv_translucency.value) + vis->transmap = R_GetBlendTable(blendmode, trans); else vis->transmap = NULL; @@ -3021,7 +3027,7 @@ boolean R_ThingVisible (mobj_t *thing) { return (!( thing->sprite == SPR_NULL || - ( thing->flags2 & (MF2_DONTDRAW) ) || ( thing->renderflags & (RF_DONTDRAW) ) || + ( thing->flags2 & (MF2_DONTDRAW) ) || (r_viewmobj && (thing == r_viewmobj || (r_viewmobj->player && r_viewmobj->player->followmobj == thing))) )); } diff --git a/src/v_video.c b/src/v_video.c index ad0164816..12588f9c2 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -511,7 +511,8 @@ static inline UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fix void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap) { UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t); - UINT32 alphalevel = 0; + UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT); fixed_t col, ofs, colfrac, rowfrac, fdup, vdup; INT32 dupx, dupy; @@ -538,7 +539,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca patchdrawfunc = standardpdraw; v_translevel = NULL; - if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) + if (alphalevel) { if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; @@ -552,7 +553,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca if (alphalevel) { - v_translevel = R_GetTranslucencyTable(alphalevel); + if (blendmode) + v_translevel = R_GetBlendTable(blendmode+1, alphalevel); + else + v_translevel = R_GetTranslucencyTable(alphalevel); + patchdrawfunc = translucentpdraw; } } @@ -801,7 +806,8 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h) { UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t); - UINT32 alphalevel = 0; + UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT); // boolean flip = false; fixed_t col, ofs, colfrac, rowfrac, fdup, vdup; @@ -827,7 +833,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN patchdrawfunc = standardpdraw; v_translevel = NULL; - if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) + if (alphalevel) { if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; @@ -841,7 +847,11 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN if (alphalevel) { - v_translevel = R_GetTranslucencyTable(alphalevel); + if (blendmode) + v_translevel = R_GetBlendTable(blendmode+1, alphalevel); + else + v_translevel = R_GetTranslucencyTable(alphalevel); + patchdrawfunc = translucentpdraw; } } From 7601afb6c1fe3fb0648c4f5404eb268554856273 Mon Sep 17 00:00:00 2001 From: sphere Date: Fri, 19 Nov 2021 19:01:41 +0100 Subject: [PATCH 17/54] blentran part 3: Wall & plane blendmodes. --- src/hardware/hw_main.c | 68 ++++++++++++++++++++++++++---------------- src/lua_maplib.c | 8 +++++ src/p_setup.c | 39 +++++++++++++++--------- src/p_spec.c | 11 ++++++- src/r_defs.h | 2 ++ src/r_draw.c | 3 ++ src/r_plane.c | 32 +++++++------------- src/r_segs.c | 43 ++++++++++++-------------- 8 files changed, 120 insertions(+), 86 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 63f1191ca..a1dd53eb7 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -556,7 +556,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool HWR_Lighting(&Surf, lightlevel, planecolormap); - if (PolyFlags & (PF_Translucent|PF_Fog)) + if (PolyFlags & (PF_Translucent|PF_Fog|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) { Surf.PolyColor.s.alpha = (UINT8)alpha; PolyFlags |= PF_Modulated; @@ -980,8 +980,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, if (cutflag & FF_FOG) HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); - else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); + else if (polyflags & (PF_Translucent|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) + HWR_AddTransparentWall(wallVerts, Surf, texnum, polyflags, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); @@ -1009,8 +1009,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, if (cutflag & FF_FOG) HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); - else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); + else if (polyflags & (PF_Translucent|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) + HWR_AddTransparentWall(wallVerts, Surf, texnum, polyflags, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); } @@ -1264,6 +1264,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } + gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture); if (gl_midtexture) { @@ -1453,10 +1454,20 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom case 221: case 253: case 256: - blendmode = PF_Translucent; + if (gl_linedef->blendmode) + blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + else + blendmode = PF_Translucent; break; default: - if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) + if (gl_linedef->blendmode) + { + if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) + blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + else + blendmode = HWR_GetBlendModeFlag(gl_linedef->blendmode); + } + else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf); else blendmode = PF_Masked; @@ -1481,11 +1492,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (gl_frontsector->numlights) { if (!(blendmode & PF_Masked)) - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, PF_Decal); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, blendmode); else - { - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, PF_Decal); - } + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, blendmode); } else if (!(blendmode & PF_Masked)) HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap); @@ -1745,7 +1754,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, blendmode); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1753,14 +1762,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { FBITFIELD blendmode = PF_Masked; - if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) + if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { - blendmode = PF_Translucent; + blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent; Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1; } if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, blendmode); else { if (blendmode != PF_Masked) @@ -1868,7 +1877,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gl_backsector->numlights) - HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, blendmode); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1876,14 +1885,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { FBITFIELD blendmode = PF_Masked; - if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) + if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { - blendmode = PF_Translucent; + blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent; Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1; } if (gl_backsector->numlights) - HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, blendmode); else { if (blendmode != PF_Masked) @@ -2960,6 +2969,13 @@ static void HWR_AddPolyObjectPlanes(void) } } +static FBITFIELD HWR_RippleBlend(sector_t *sector, ffloor_t *rover, boolean ceiling) +{ + (void)sector; + (void)ceiling; + return /*R_IsRipplePlane(sector, rover, ceiling)*/ (rover->flags & FF_RIPPLE) ? PF_Ripple : 0; +} + // -----------------+ // HWR_Subsector : Determine floor/ceiling planes. // : Add sprites of things in sector. @@ -3150,7 +3166,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, rover->master->frontsector->extra_colormap); } - else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient + else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) // SoM: Flags are more efficient { light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); @@ -3159,14 +3175,15 @@ static void HWR_Subsector(size_t num) false, *rover->bottomheight, *gl_frontsector->lightlist[light].lightlevel, - rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, + rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, + HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, *gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetLevelFlat(&levelflats[*rover->bottompic]); light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], + HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } @@ -3195,7 +3212,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, rover->master->frontsector->extra_colormap); } - else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) + else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); @@ -3204,14 +3221,15 @@ static void HWR_Subsector(size_t num) true, *rover->topheight, *gl_frontsector->lightlist[light].lightlevel, - rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, + rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, + HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, *gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetLevelFlat(&levelflats[*rover->toppic]); light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], + HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 9031c99f1..04e6fde8d 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -196,6 +196,7 @@ enum ffloor_e { ffloor_next, ffloor_prev, ffloor_alpha, + ffloor_blend, }; static const char *const ffloor_opt[] = { @@ -214,6 +215,7 @@ static const char *const ffloor_opt[] = { "next", "prev", "alpha", + "blend", NULL}; #ifdef HAVE_LUA_SEGS @@ -1807,6 +1809,9 @@ static int ffloor_get(lua_State *L) case ffloor_alpha: lua_pushinteger(L, ffloor->alpha); return 1; + case ffloor_blend: + lua_pushinteger(L, ffloor->blend); + return 1; } return 0; } @@ -1885,6 +1890,9 @@ static int ffloor_set(lua_State *L) case ffloor_alpha: ffloor->alpha = (INT32)luaL_checkinteger(L, 3); break; + case ffloor_blend: + ffloor->blend = (INT32)luaL_checkinteger(L, 3); + break; } return 0; } diff --git a/src/p_setup.c b/src/p_setup.c index 588815aee..6320edc22 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1350,8 +1350,11 @@ static void P_LoadSidedefs(UINT8 *data) if (msd->toptexture[0] == '#') { char *col = msd->toptexture; - sd->toptexture = sd->bottomtexture = - ((col[1]-'0')*100 + (col[2]-'0')*10 + col[3]-'0') + 1; + sd->toptexture = + ((col[1]-'0')*100 + (col[2]-'0')*10 + col[3]-'0')+1; + if (col[4]) // extra num for blendmode + sd->toptexture += (col[4]-'0')*1000; + sd->bottomtexture = sd->toptexture; sd->midtexture = R_TextureNumForName(msd->midtexture); } else @@ -3314,22 +3317,30 @@ static void P_ConvertBinaryMap(void) lines[i].args[4] |= TMSC_BACKTOFRONTCEILING; lines[i].special = 720; break; - - case 900: //Translucent wall (10%) - case 901: //Translucent wall (20%) - case 902: //Translucent wall (30%) - case 903: //Translucent wall (40%) - case 904: //Translucent wall (50%) - case 905: //Translucent wall (60%) - case 906: //Translucent wall (70%) - case 907: //Translucent wall (80%) - case 908: //Translucent wall (90%) - lines[i].alpha = ((909 - lines[i].special) << FRACBITS)/10; - break; default: break; } + // Set alpha for translucent walls + if (lines[i].special >= 900 && lines[i].special < 909) + lines[i].alpha = ((909 - lines[i].special) << FRACBITS)/10; + + // Set alpha for additive/subtractive/reverse subtractive walls + if (lines[i].special >= 910 && lines[i].special <= 939) + lines[i].alpha = ((10 - lines[i].special % 10) << FRACBITS)/10; + + if (lines[i].special >= 910 && lines[i].special <= 919) // additive + lines[i].blendmode = AST_ADD; + + if (lines[i].special >= 920 && lines[i].special <= 929) // subtractive + lines[i].blendmode = AST_SUBTRACT; + + if (lines[i].special >= 930 && lines[i].special <= 939) // reverse subtractive + lines[i].blendmode = AST_REVERSESUBTRACT; + + if (lines[i].special == 940) // modulate + lines[i].blendmode = AST_MODULATE; + //Linedef executor delay if (lines[i].special >= 400 && lines[i].special < 500) { diff --git a/src/p_spec.c b/src/p_spec.c index 07410efa2..ebabe6a79 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5601,7 +5601,16 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f if (flags & FF_TRANSLUCENT) { if (sides[master->sidenum[0]].toptexture > 0) - fflr->alpha = sides[master->sidenum[0]].toptexture; // for future reference, "#0" is 1, and "#255" is 256. Be warned + { + // for future reference, "#0" is 1, and "#255" is 256. Be warned + fflr->alpha = sides[master->sidenum[0]].toptexture; + + if (fflr->alpha >= 1001) // fourth digit + { + fflr->blend = (fflr->alpha/1000)+1; // becomes an AST + fflr->alpha %= 1000; + } + } else fflr->alpha = 0x80; } diff --git a/src/r_defs.h b/src/r_defs.h index f4ab58295..3c2178937 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -184,6 +184,7 @@ typedef struct ffloor_s INT32 lastlight; INT32 alpha; + UINT8 blend; // blendmode tic_t norender; // for culling // these are saved for netgames, so do not let Lua touch these! @@ -397,6 +398,7 @@ typedef struct line_s // Visual appearance: sidedefs. UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided fixed_t alpha; // translucency + UINT8 blendmode; // blendmode INT32 executordelay; fixed_t bbox[4]; // bounding box for the extent of the linedef diff --git a/src/r_draw.c b/src/r_draw.c index f0a19a462..65bb87bfb 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -248,6 +248,9 @@ static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt) result.s.green = max(0, result.s.green - blendamt); result.s.blue = max(0, result.s.blue - blendamt); + //probably incorrect, but does look better at lower opacity... + //result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt); + table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); } } diff --git a/src/r_plane.c b/src/r_plane.c index 45719ce58..d854c2342 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -855,28 +855,16 @@ void R_DrawSinglePlane(visplane_t *pl) spanfunctype = (pl->ffloor->master->flags & ML_EFFECT6) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS; // Hacked up support for alpha value in software mode Tails 09-24-2002 - if (pl->ffloor->alpha < 12) - return; // Don't even draw it - else if (pl->ffloor->alpha < 38) - ds_transmap = R_GetTranslucencyTable(tr_trans90); - else if (pl->ffloor->alpha < 64) - ds_transmap = R_GetTranslucencyTable(tr_trans80); - else if (pl->ffloor->alpha < 89) - ds_transmap = R_GetTranslucencyTable(tr_trans70); - else if (pl->ffloor->alpha < 115) - ds_transmap = R_GetTranslucencyTable(tr_trans60); - else if (pl->ffloor->alpha < 140) - ds_transmap = R_GetTranslucencyTable(tr_trans50); - else if (pl->ffloor->alpha < 166) - ds_transmap = R_GetTranslucencyTable(tr_trans40); - else if (pl->ffloor->alpha < 192) - ds_transmap = R_GetTranslucencyTable(tr_trans30); - else if (pl->ffloor->alpha < 217) - ds_transmap = R_GetTranslucencyTable(tr_trans20); - else if (pl->ffloor->alpha < 243) - ds_transmap = R_GetTranslucencyTable(tr_trans10); - else // Opaque, but allow transparent flat pixels - spanfunctype = SPANDRAWFUNC_SPLAT; + // ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021 + { + INT32 trans = (10*((256+12) - pl->ffloor->alpha))/255; + if (trans >= 10) + return; // Don't even draw it + if (pl->ffloor->blend) // additive, (reverse) subtractive, modulative + ds_transmap = R_GetBlendTable(pl->ffloor->blend, trans); + else if (!(ds_transmap = R_GetTranslucencyTable(trans))) + spanfunctype = SPANDRAWFUNC_SPLAT; // Opaque, but allow transparent flat pixels + } if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG))) light = (pl->lightlevel >> LIGHTSEGSHIFT); diff --git a/src/r_segs.c b/src/r_segs.c index a8c85ec33..4460f9f90 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -155,11 +155,18 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (!ldef->alpha) return; - if (ldef->alpha > 0 && ldef->alpha < FRACUNIT) + if (ldef->blendmode) + { + if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE) + dc_transmap = R_GetBlendTable(ldef->blendmode, 0); + else + dc_transmap = R_GetBlendTable(ldef->blendmode, R_GetLinedefTransTable(ldef->alpha)); + colfunc = colfuncs[COLDRAWFUNC_FUZZY]; + } + else if (ldef->alpha > 0 && ldef->alpha < FRACUNIT) { dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha)); colfunc = colfuncs[COLDRAWFUNC_FUZZY]; - } else if (ldef->special == 909) { @@ -600,28 +607,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) boolean fuzzy = true; // Hacked up support for alpha value in software mode Tails 09-24-2002 - if (pfloor->alpha < 12) - return; // Don't even draw it - else if (pfloor->alpha < 38) - dc_transmap = R_GetTranslucencyTable(tr_trans90); - else if (pfloor->alpha < 64) - dc_transmap = R_GetTranslucencyTable(tr_trans80); - else if (pfloor->alpha < 89) - dc_transmap = R_GetTranslucencyTable(tr_trans70); - else if (pfloor->alpha < 115) - dc_transmap = R_GetTranslucencyTable(tr_trans60); - else if (pfloor->alpha < 140) - dc_transmap = R_GetTranslucencyTable(tr_trans50); - else if (pfloor->alpha < 166) - dc_transmap = R_GetTranslucencyTable(tr_trans40); - else if (pfloor->alpha < 192) - dc_transmap = R_GetTranslucencyTable(tr_trans30); - else if (pfloor->alpha < 217) - dc_transmap = R_GetTranslucencyTable(tr_trans20); - else if (pfloor->alpha < 243) - dc_transmap = R_GetTranslucencyTable(tr_trans10); - else - fuzzy = false; // Opaque + // ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021 + { + INT32 trans = (10*((256+12) - pfloor->alpha))/255; + if (trans >= 10) + return; // Don't even draw it + if (pfloor->blend) // additive, (reverse) subtractive, modulative + dc_transmap = R_GetBlendTable(pfloor->blend, trans); + else if (!(dc_transmap = R_GetTranslucencyTable(trans))) + fuzzy = false; // Opaque + } if (fuzzy) colfunc = colfuncs[COLDRAWFUNC_FUZZY]; From 55fc7cbd67234d30b50139bed1958bc2ee986fdc Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 5 Dec 2021 07:20:55 +0100 Subject: [PATCH 18/54] Fix "all players" check in T_EachTimeThinker --- src/p_floor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 263644f70..dd9331e73 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1516,8 +1516,8 @@ void T_EachTimeThinker(eachtime_t *eachtime) { for (i = 0; i < MAXPLAYERS; i++) { - if (P_IsPlayerValid(i) && playersArea[i]) - continue; + if (P_IsPlayerValid(i) && !playersArea[i]) + return; } } From b2d693a54704f08eecca461192753c1f57f44acf Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 5 Dec 2021 02:13:09 -0600 Subject: [PATCH 19/54] minor spike optimisations --- src/info.c | 6 +- src/p_map.c | 152 ++++++++++++++++++++++++--------------------------- src/p_mobj.c | 98 +++++++++++++++++++-------------- 3 files changed, 129 insertions(+), 127 deletions(-) diff --git a/src/info.c b/src/info.c index f56e5d78e..65185517a 100644 --- a/src/info.c +++ b/src/info.c @@ -7977,7 +7977,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_SPIKE, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPHEIGHT, // flags + MF_SOLID|MF_SCENERY, // flags S_NULL // raisestate }, @@ -8004,7 +8004,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_SPIKE, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION, // flags + MF_SOLID|MF_NOGRAVITY|MF_SCENERY|MF_PAPERCOLLISION, // flags S_NULL // raisestate }, @@ -8031,7 +8031,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING, // flags + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIP|MF_NOCLIPTHING, // flags S_NULL // raisestate }, diff --git a/src/p_map.c b/src/p_map.c index 836e75c4e..b2dd52127 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1465,86 +1465,6 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - // Sprite Spikes! - // Do not return because solidity code comes below. - if (tmthing->type == MT_SPIKE && tmthing->flags & MF_SOLID && thing->player) // moving spike rams into player?! - { - if (tmthing->eflags & MFE_VERTICALFLIP) - { - if (thing->z + thing->height <= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) - && thing->z + thing->height + thing->momz >= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz - && !(thing->player->charability == CA_BOUNCE && thing->player->panim == PA_ABILITY && thing->eflags & MFE_VERTICALFLIP)) - P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); - } - else if (thing->z >= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) - && thing->z + thing->momz <= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz - && !(thing->player->charability == CA_BOUNCE && thing->player->panim == PA_ABILITY && !(thing->eflags & MFE_VERTICALFLIP))) - P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); - } - else if (thing->type == MT_SPIKE && thing->flags & MF_SOLID && tmthing->player) // unfortunate player falls into spike?! - { - if (thing->eflags & MFE_VERTICALFLIP) - { - if (tmthing->z + tmthing->height <= thing->z - FixedMul(FRACUNIT, thing->scale) - && tmthing->z + tmthing->height + tmthing->momz >= thing->z - FixedMul(FRACUNIT, thing->scale) - && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && tmthing->eflags & MFE_VERTICALFLIP)) - P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); - } - else if (tmthing->z >= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) - && tmthing->z + tmthing->momz <= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) - && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && !(tmthing->eflags & MFE_VERTICALFLIP))) - P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); - } - - if (tmthing->type == MT_WALLSPIKE && tmthing->flags & MF_SOLID && thing->player) // wall spike impales player - { - fixed_t bottomz, topz; - bottomz = tmthing->z; - topz = tmthing->z + tmthing->height; - if (tmthing->eflags & MFE_VERTICALFLIP) - bottomz -= FixedMul(FRACUNIT, tmthing->scale); - else - topz += FixedMul(FRACUNIT, tmthing->scale); - - if (thing->z + thing->height > bottomz // above bottom - && thing->z < topz) // below top - // don't check angle, the player was clearly in the way in this case - P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); - } - else if (thing->type == MT_WALLSPIKE && thing->flags & MF_SOLID && tmthing->player) - { - fixed_t bottomz, topz; - angle_t touchangle = R_PointToAngle2(thing->tracer->x, thing->tracer->y, tmthing->x, tmthing->y); - - if (P_PlayerInPain(tmthing->player) && (tmthing->momx || tmthing->momy)) - { - angle_t playerangle = R_PointToAngle2(0, 0, tmthing->momx, tmthing->momy) - touchangle; - if (playerangle > ANGLE_180) - playerangle = InvAngle(playerangle); - if (playerangle < ANGLE_90) - return true; // Yes, this is intentionally outside the z-height check. No standing on spikes whilst moving away from them. - } - - bottomz = thing->z; - topz = thing->z + thing->height; - - if (thing->eflags & MFE_VERTICALFLIP) - bottomz -= FixedMul(FRACUNIT, thing->scale); - else - topz += FixedMul(FRACUNIT, thing->scale); - - if (tmthing->z + tmthing->height > bottomz // above bottom - && tmthing->z < topz // below top - && !P_MobjWasRemoved(thing->tracer)) // this probably wouldn't work if we didn't have a tracer - { // use base as a reference point to determine what angle you touched the spike at - touchangle = thing->angle - touchangle; - if (touchangle > ANGLE_180) - touchangle = InvAngle(touchangle); - if (touchangle <= ANGLE_22h) // if you touched it at this close an angle, you get poked! - P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); - } - } - if (thing->flags & MF_PUSHABLE) { if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM) @@ -1623,6 +1543,22 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player) { + if (tmthing->type == MT_WALLSPIKE && (tmthing->flags & MF_SOLID)) // wall spike impales player + { + fixed_t bottomz, topz; + bottomz = tmthing->z; + topz = tmthing->z + tmthing->height; + if (tmthing->eflags & MFE_VERTICALFLIP) + bottomz -= FixedMul(FRACUNIT, tmthing->scale); + else + topz += FixedMul(FRACUNIT, tmthing->scale); + + if (thing->z + thing->height > bottomz // above bottom + && thing->z < topz) // below top + // don't check angle, the player was clearly in the way in this case + P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); + } + // Doesn't matter what gravity player's following! Just do your stuff in YOUR direction only if (tmthing->eflags & MFE_VERTICALFLIP && (tmthing->z + tmthing->height + tmthing->momz < thing->z @@ -1657,6 +1593,55 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!tmthing->health) return true; + if (thing->type == MT_SPIKE && (thing->flags & MF_SOLID)) // unfortunate player falls into spike?! + { + if (thing->eflags & MFE_VERTICALFLIP) + { + if (tmthing->z + tmthing->height <= thing->z - FixedMul(FRACUNIT, thing->scale) + && tmthing->z + tmthing->height + tmthing->momz >= thing->z - FixedMul(FRACUNIT, thing->scale) + && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && tmthing->eflags & MFE_VERTICALFLIP)) + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + else if (tmthing->z >= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) + && tmthing->z + tmthing->momz <= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) + && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && !(tmthing->eflags & MFE_VERTICALFLIP))) + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + + if (thing->type == MT_WALLSPIKE && (thing->flags & MF_SOLID)) + { + fixed_t bottomz, topz; + angle_t touchangle = R_PointToAngle2(thing->tracer->x, thing->tracer->y, tmthing->x, tmthing->y); + + if (P_PlayerInPain(tmthing->player) && (tmthing->momx || tmthing->momy)) + { + angle_t playerangle = R_PointToAngle2(0, 0, tmthing->momx, tmthing->momy) - touchangle; + if (playerangle > ANGLE_180) + playerangle = InvAngle(playerangle); + if (playerangle < ANGLE_90) + return true; // Yes, this is intentionally outside the z-height check. No standing on spikes whilst moving away from them. + } + + bottomz = thing->z; + topz = thing->z + thing->height; + + if (thing->eflags & MFE_VERTICALFLIP) + bottomz -= FixedMul(FRACUNIT, thing->scale); + else + topz += FixedMul(FRACUNIT, thing->scale); + + if (tmthing->z + tmthing->height > bottomz // above bottom + && tmthing->z < topz // below top + && !P_MobjWasRemoved(thing->tracer)) // this probably wouldn't work if we didn't have a tracer + { // use base as a reference point to determine what angle you touched the spike at + touchangle = thing->angle - touchangle; + if (touchangle > ANGLE_180) + touchangle = InvAngle(touchangle); + if (touchangle <= ANGLE_22h) // if you touched it at this close an angle, you get poked! + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + } + if (thing->type == MT_FAN || thing->type == MT_STEAM) P_DoFanAndGasJet(thing, tmthing); else if (thing->flags & MF_SPRING && tmthing->player->powers[pw_carry] != CR_MINECART) @@ -1721,8 +1706,8 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if ((tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM || tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) && (thing->player)) - ; // springs, gas jets and springs should never be able to step up onto a player + if ((thing->player) && (tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM)) + ; // springs and gas jets should never be able to step up onto a player // z checking at last // Treat noclip things as non-solid! else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID @@ -1730,6 +1715,9 @@ static boolean PIT_CheckThing(mobj_t *thing) { fixed_t topz, tmtopz; + if (tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) // do not run height checks if you are a spike + return true; + if (tmthing->eflags & MFE_VERTICALFLIP) { // pass under diff --git a/src/p_mobj.c b/src/p_mobj.c index 83f9ebf3c..e43414a80 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7842,6 +7842,48 @@ static void P_MobjSceneryThink(mobj_t *mobj) if (P_MobjFlip(mobj)*mobj->momz < mobj->info->speed) mobj->momz = P_MobjFlip(mobj)*mobj->info->speed; break; + case MT_SPIKE: + if (mobj->fuse) + { + mobj->fuse--; + break; + } + P_SetMobjState(mobj, mobj->state->nextstate); + mobj->fuse = mobj->info->speed; + if (mobj->spawnpoint) + mobj->fuse += mobj->spawnpoint->angle; + break; + case MT_WALLSPIKE: + if (mobj->fuse) + { + mobj->fuse--; + break; + } + P_SetMobjState(mobj, mobj->state->nextstate); + mobj->fuse = mobj->info->speed; + if (mobj->spawnpoint) + mobj->fuse += (mobj->spawnpoint->angle / 360); + break; + case MT_WALLSPIKEBASE: + if (!mobj->target) + { + P_RemoveMobj(mobj); + return; + } + mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|(mobj->target->frame & FF_FRAMEMASK); +#if 0 + if (mobj->angle != mobj->target->angle + ANGLE_90) // reposition if not the correct angle + { + mobj_t* target = mobj->target; // shortcut + const fixed_t baseradius = target->radius - (target->scale/2); //FixedMul(FRACUNIT/2, target->scale); + P_UnsetThingPosition(mobj); + mobj->x = target->x - P_ReturnThrustX(target, target->angle, baseradius); + mobj->y = target->y - P_ReturnThrustY(target, target->angle, baseradius); + P_SetThingPosition(mobj); + mobj->angle = target->angle + ANGLE_90; + } +#endif + break; case MT_ROCKCRUMBLE1: case MT_ROCKCRUMBLE2: case MT_ROCKCRUMBLE3: @@ -9238,25 +9280,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) switch (mobj->type) { - case MT_WALLSPIKEBASE: - if (!mobj->target) { - P_RemoveMobj(mobj); - return false; - } - mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|(mobj->target->frame & FF_FRAMEMASK); -#if 0 - if (mobj->angle != mobj->target->angle + ANGLE_90) // reposition if not the correct angle - { - mobj_t* target = mobj->target; // shortcut - const fixed_t baseradius = target->radius - (target->scale/2); //FixedMul(FRACUNIT/2, target->scale); - P_UnsetThingPosition(mobj); - mobj->x = target->x - P_ReturnThrustX(target, target->angle, baseradius); - mobj->y = target->y - P_ReturnThrustY(target, target->angle, baseradius); - P_SetThingPosition(mobj); - mobj->angle = target->angle + ANGLE_90; - } -#endif - break; case MT_FALLINGROCK: // Despawn rocks here in case zmovement code can't do so (blame slopes) if (!mobj->momx && !mobj->momy && !mobj->momz @@ -9942,18 +9965,6 @@ static boolean P_FuseThink(mobj_t *mobj) break; case MT_METALSONIC_BATTLE: break; // don't remove - case MT_SPIKE: - P_SetMobjState(mobj, mobj->state->nextstate); - mobj->fuse = mobj->info->speed; - if (mobj->spawnpoint) - mobj->fuse += mobj->spawnpoint->angle; - break; - case MT_WALLSPIKE: - P_SetMobjState(mobj, mobj->state->nextstate); - mobj->fuse = mobj->info->speed; - if (mobj->spawnpoint) - mobj->fuse += (mobj->spawnpoint->angle / 360); - break; case MT_NIGHTSCORE: P_RemoveMobj(mobj); return false; @@ -12956,17 +12967,18 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean // Pop up spikes! if (mthing->options & MTF_OBJECTSPECIAL) { - mobj->flags &= ~MF_SCENERY; mobj->fuse = (16 - mthing->extrainfo)*(mthing->angle + mobj->info->speed)/16; if (mthing->options & MTF_EXTRA) P_SetMobjState(mobj, mobj->info->meleestate); } - // Use per-thing collision for spikes if the deaf flag isn't checked. - if (!(mthing->options & MTF_AMBUSH) && !metalrecording) + else + mobj->flags |= MF_NOTHINK; + // no collision for spikes if the ambush flag is checked + if ((mthing->options & MTF_AMBUSH) || metalrecording) { P_UnsetThingPosition(mobj); - mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT); - mobj->flags |= MF_SOLID; + mobj->flags |= (MF_NOBLOCKMAP|MF_NOCLIPHEIGHT); + mobj->flags &= ~MF_SOLID; P_SetThingPosition(mobj); } break; @@ -12974,20 +12986,20 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean // Pop up spikes! if (mthing->options & MTF_OBJECTSPECIAL) { - mobj->flags &= ~MF_SCENERY; mobj->fuse = (16 - mthing->extrainfo)*((mthing->angle/360) + mobj->info->speed)/16; if (mthing->options & MTF_EXTRA) P_SetMobjState(mobj, mobj->info->meleestate); } - // Use per-thing collision for spikes if the deaf flag isn't checked. - if (!(mthing->options & MTF_AMBUSH) && !metalrecording) + else + mobj->flags |= MF_NOTHINK; + // no collision for spikes if the ambush flag is checked + if ((mthing->options & MTF_AMBUSH) || metalrecording) { P_UnsetThingPosition(mobj); - mobj->flags &= ~(MF_NOBLOCKMAP | MF_NOCLIPHEIGHT); - mobj->flags |= MF_SOLID; + mobj->flags |= (MF_NOBLOCKMAP|MF_NOCLIPHEIGHT); + mobj->flags &= ~MF_SOLID; P_SetThingPosition(mobj); } - // spawn base { const angle_t mobjangle = FixedAngle(mthing->angle << FRACBITS); // the mobj's own angle hasn't been set quite yet so... @@ -13001,6 +13013,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean P_SetScale(base, mobj->scale); P_SetTarget(&base->target, mobj); P_SetTarget(&mobj->tracer, base); + if (!(mthing->options & MTF_OBJECTSPECIAL)) + base->flags |= MF_NOTHINK; } break; case MT_RING_BOX: From fdc825721f5f2961e29defb52f32de69c870f7bc Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 5 Dec 2021 12:47:20 +0100 Subject: [PATCH 20/54] some hud fixes, by Confusion --- src/hu_stuff.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f4c5e4c3b..3107057a1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2472,7 +2472,7 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) V_DrawString(x + 10, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? 0 : V_TRANSLUCENT) + | (greycheck ? V_TRANSLUCENT : 0) | V_ALLOWLOWERCASE, name); if (gametyperules & GTR_TEAMFLAGS) @@ -2733,12 +2733,12 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline if (circuitmap) { if (players[tab[i].num].exiting) - V_DrawRightAlignedThinString(x+146, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); + V_DrawRightAlignedThinString(x+100, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); else - V_DrawRightAlignedThinString(x+146, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); } else - V_DrawRightAlignedThinString(x+146, y, (greycheck ? V_TRANSLUCENT : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); + V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); } else V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); @@ -2786,7 +2786,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) V_DrawString(x + 10, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? 0 : V_TRANSLUCENT) + | (greycheck ? V_TRANSLUCENT : 0) | V_ALLOWLOWERCASE, name); if (G_GametypeUsesLives()) //show lives @@ -2846,13 +2846,13 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor if (players[tab[i].num].exiting) V_DrawRightAlignedThinString(x+128, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); else - V_DrawRightAlignedThinString(x+128, y, (greycheck ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+128, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); } else - V_DrawRightAlignedThinString(x+128, y, (greycheck ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); + V_DrawRightAlignedThinString(x+128, y, (greycheck ? V_TRANSLUCENT : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); } else - V_DrawRightAlignedThinString(x+128, y, (greycheck ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+128, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); y += 9; if (i == 16) @@ -3091,7 +3091,7 @@ static void HU_DrawRankings(void) HU_DrawTeamTabRankings(tab, whiteplayer); else if (scorelines <= 9 && !cv_compactscoreboard.value) HU_DrawTabRankings(40, 32, tab, scorelines, whiteplayer); - else if (scorelines <= 20 && !cv_compactscoreboard.value) + else if (scorelines <= 18 && !cv_compactscoreboard.value) HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer); else HU_Draw32TabRankings(14, 28, tab, scorelines, whiteplayer); From f271f88c7f3084523a03ca7f47060d6527724796 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 5 Dec 2021 17:59:33 +0100 Subject: [PATCH 21/54] Fix MusicChange hook crashing when called BRUH MOMENT BRUH MOMENT PREPARE THE HALL OF SHAME --- src/lua_hooklib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index a72b22b5a..287a185bc 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1117,7 +1117,7 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param) lua_pushstring(gL, oldname);/* the only constant value */ lua_pushstring(gL, param->newname);/* semi constant */ - for (k = 0; k <= map->numHooks; ++k) + for (k = 0; k < map->numHooks; ++k) { get_hook(&hook, map->ids, k); From 97e2fe18c6d36fae3d1321de3d26e47163ba5d84 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 6 Dec 2021 18:00:30 -0600 Subject: [PATCH 22/54] fix spike sandwich teleportation issue --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 836e75c4e..59756d8a6 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1152,9 +1152,9 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // underneath if (tmthing->eflags & MFE_VERTICALFLIP) - thing->z = tmthing->z - thing->height - FixedMul(FRACUNIT, tmthing->scale); + P_TeleportMove(thing, thing->x, thing->y, tmthing->z - thing->height - FixedMul(FRACUNIT, tmthing->scale)); else - thing->z = tmthing->z + tmthing->height + FixedMul(FRACUNIT, tmthing->scale); + P_TeleportMove(thing, thing->x, thing->y, tmthing->z + tmthing->height + FixedMul(FRACUNIT, tmthing->scale)); if (thing->flags & MF_SHOOTABLE) P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); return true; From f3c5addab7cb028c164b8af149402e9d11aef1ef Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Tue, 7 Dec 2021 22:35:04 +0200 Subject: [PATCH 23/54] Improve OpenGL GDI Generic error message --- src/sdl/ogl_sdl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index c426e6792..bdc693ca5 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -177,7 +177,9 @@ boolean OglSdlSurface(INT32 w, INT32 h) // Also set the renderer variable back to software so the next launch won't // repeat this error. CV_StealthSet(&cv_renderer, "Software"); - I_Error("OpenGL Error: Failed to access the GPU. There may be an issue with your graphics drivers."); + I_Error("OpenGL Error: Failed to access the GPU. Possible reasons include:\n" + "- GPU vendor has dropped OpenGL support on your GPU and OS. (Old GPU?)\n" + "- GPU drivers are missing or broken. You may need to update your drivers."); } } first_init = true; From c420de6f119c8b362dcc4991a544928ccca6bba5 Mon Sep 17 00:00:00 2001 From: John FrostFox Date: Thu, 9 Dec 2021 11:42:06 +0300 Subject: [PATCH 24/54] Include pmomz for mobjs in net savestates and load if it exists --- src/p_saveg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 1270064c0..722340f41 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1603,7 +1603,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 = 0; // not the default but the most probable - if (mobj->momx != 0 || mobj->momy != 0 || mobj->momz != 0) + if (mobj->momx != 0 || mobj->momy != 0 || mobj->momz != 0 || mobj->pmomz !=0) diff |= MD_MOM; if (mobj->radius != mobj->info->radius) diff |= MD_RADIUS; @@ -1778,6 +1778,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, mobj->momx); WRITEFIXED(save_p, mobj->momy); WRITEFIXED(save_p, mobj->momz); + WRITEFIXED(save_p, mobj->pmomz); } if (diff & MD_RADIUS) WRITEFIXED(save_p, mobj->radius); @@ -2776,6 +2777,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->momx = READFIXED(save_p); mobj->momy = READFIXED(save_p); mobj->momz = READFIXED(save_p); + mobj->pmomz = READFIXED(save_p); } // otherwise they're zero, and the memset took care of it if (diff & MD_RADIUS) From 6f5b34f7c16e3012b481a7522613b3dcc744a4fe Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 9 Dec 2021 12:45:18 +0100 Subject: [PATCH 25/54] Don't award end-of-level bonuses to bots. --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index f24436d40..288a821e6 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2023,7 +2023,7 @@ static void Y_AwardCoopBonuses(void) for (i = 0; i < MAXPLAYERS; ++i) { - if (!playeringame[i] || players[i].lives < 1) // not active or game over + if (!playeringame[i] || players[i].lives < 1 || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) // not active, game over or tails bot bonusnum = 0; // all null else bonusnum = mapheaderinfo[prevmap]->bonustype + 1; // -1 is none @@ -2073,7 +2073,7 @@ static void Y_AwardSpecialStageBonus(void) { oldscore = players[i].score; - if (!playeringame[i] || players[i].lives < 1) // not active or game over + if (!playeringame[i] || players[i].lives < 1 || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) // not active, game over or tails bot { Y_SetNullBonus(&players[i], &localbonuses[0]); Y_SetNullBonus(&players[i], &localbonuses[1]); From f431b209112b451d0caea4ed245596f4e86b2726 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 12 Dec 2021 06:54:48 +0100 Subject: [PATCH 26/54] Add new blendmode linedef types to config --- extras/conf/SRB2-22.cfg | 186 +++++++++++++++++++ extras/conf/udb/Includes/SRB222_linedefs.cfg | 155 ++++++++++++++++ 2 files changed, 341 insertions(+) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 4ed68e1ca..2b4bdbcd7 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -3251,6 +3251,192 @@ linedeftypes title = "Fog Wall"; prefix = "(909)"; } + + 910 + { + title = "100% Additive"; + prefix = "(910)"; + } + + 911 + { + title = "90% Additive"; + prefix = "(911)"; + } + + 912 + { + title = "80% Additive"; + prefix = "(912)"; + } + + 913 + { + title = "70% Additive"; + prefix = "(913)"; + } + + 914 + { + title = "60% Additive"; + prefix = "(914)"; + } + + 915 + { + title = "50% Additive"; + prefix = "(915)"; + } + + 916 + { + title = "40% Additive"; + prefix = "(916)"; + } + + 917 + { + title = "30% Additive"; + prefix = "(917)"; + } + + 918 + { + title = "20% Additive"; + prefix = "(918)"; + } + + 919 + { + title = "10% Additive"; + prefix = "(919)"; + } + + 920 + { + title = "100% Subtractive"; + prefix = "(920)"; + } + + 921 + { + title = "90% Subtractive"; + prefix = "(921)"; + } + + 922 + { + title = "80% Subtractive"; + prefix = "(922)"; + } + + 923 + { + title = "70% Subtractive"; + prefix = "(923)"; + } + + 924 + { + title = "60% Subtractive"; + prefix = "(924)"; + } + + 925 + { + title = "50% Subtractive"; + prefix = "(925)"; + } + + 926 + { + title = "40% Subtractive"; + prefix = "(926)"; + } + + 927 + { + title = "30% Subtractive"; + prefix = "(927)"; + } + + 928 + { + title = "20% Subtractive"; + prefix = "(928)"; + } + + 929 + { + title = "10% Subtractive"; + prefix = "(929)"; + } + + 930 + { + title = "100% Reverse Subtractive"; + prefix = "(930)"; + } + + 931 + { + title = "90% Reverse Subtractive"; + prefix = "(931)"; + } + + 932 + { + title = "80% Reverse Subtractive"; + prefix = "(932)"; + } + + 933 + { + title = "70% Reverse Subtractive"; + prefix = "(933)"; + } + + 934 + { + title = "60% Reverse Subtractive"; + prefix = "(934)"; + } + + 935 + { + title = "50% Reverse Subtractive"; + prefix = "(935)"; + } + + 936 + { + title = "40% Reverse Subtractive"; + prefix = "(936)"; + } + + 937 + { + title = "30% Reverse Subtractive"; + prefix = "(937)"; + } + + 938 + { + title = "20% Reverse Subtractive"; + prefix = "(938)"; + } + + 939 + { + title = "10% Reverse Subtractive"; + prefix = "(939)"; + } + + 940 + { + title = "Modulate"; + prefix = "(940)"; + } } } diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 1f87c2c3a..c6b0cb1c8 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -1500,6 +1500,161 @@ doom title = "Fog Wall"; prefix = "(909)"; } + 910 + { + title = "100% Additive"; + prefix = "(910)"; + } + 911 + { + title = "90% Additive"; + prefix = "(911)"; + } + 912 + { + title = "80% Additive"; + prefix = "(912)"; + } + 913 + { + title = "70% Additive"; + prefix = "(913)"; + } + 914 + { + title = "60% Additive"; + prefix = "(914)"; + } + 915 + { + title = "50% Additive"; + prefix = "(915)"; + } + 916 + { + title = "40% Additive"; + prefix = "(916)"; + } + 917 + { + title = "30% Additive"; + prefix = "(917)"; + } + 918 + { + title = "20% Additive"; + prefix = "(918)"; + } + 919 + { + title = "10% Additive"; + prefix = "(919)"; + } + 920 + { + title = "100% Subtractive"; + prefix = "(920)"; + } + 921 + { + title = "90% Subtractive"; + prefix = "(921)"; + } + 922 + { + title = "80% Subtractive"; + prefix = "(922)"; + } + 923 + { + title = "70% Subtractive"; + prefix = "(923)"; + } + 924 + { + title = "60% Subtractive"; + prefix = "(924)"; + } + 925 + { + title = "50% Subtractive"; + prefix = "(925)"; + } + 926 + { + title = "40% Subtractive"; + prefix = "(926)"; + } + 927 + { + title = "30% Subtractive"; + prefix = "(927)"; + } + 928 + { + title = "20% Subtractive"; + prefix = "(928)"; + } + 929 + { + title = "10% Subtractive"; + prefix = "(929)"; + } + 930 + { + title = "100% Reverse Subtractive"; + prefix = "(930)"; + } + 931 + { + title = "90% Reverse Subtractive"; + prefix = "(931)"; + } + 932 + { + title = "80% Reverse Subtractive"; + prefix = "(932)"; + } + 933 + { + title = "70% Reverse Subtractive"; + prefix = "(933)"; + } + 934 + { + title = "60% Reverse Subtractive"; + prefix = "(934)"; + } + 935 + { + title = "50% Reverse Subtractive"; + prefix = "(935)"; + } + 936 + { + title = "40% Reverse Subtractive"; + prefix = "(936)"; + } + 937 + { + title = "30% Reverse Subtractive"; + prefix = "(937)"; + } + 938 + { + title = "20% Reverse Subtractive"; + prefix = "(938)"; + } + 939 + { + title = "10% Reverse Subtractive"; + prefix = "(939)"; + } + 940 + { + title = "Modulate"; + prefix = "(940)"; + } } } From ac3dd146c7cf238df536f47d2649e276cbaf798f Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 12 Dec 2021 07:02:17 +0100 Subject: [PATCH 27/54] Expose blendmodes to UDMF --- extras/conf/udb/Includes/SRB222_common.cfg | 4 ++-- extras/conf/udb/Includes/SRB222_misc.cfg | 9 ++++++--- src/p_setup.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_common.cfg b/extras/conf/udb/Includes/SRB222_common.cfg index d67835aeb..b752e3654 100644 --- a/extras/conf/udb/Includes/SRB222_common.cfg +++ b/extras/conf/udb/Includes/SRB222_common.cfg @@ -264,10 +264,10 @@ mapformat_udmf } // LINEDEF RENDERSTYLES - /*linedefrenderstyles + linedefrenderstyles { include("SRB222_misc.cfg", "linedefrenderstyles"); - }*/ + } // THING FLAGS thingflags diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 68629149e..1b4fb4b4b 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -63,11 +63,14 @@ linedefflags_udmf transfer = "Transfer Line"; } -/*linedefrenderstyles +linedefrenderstyles { translucent = "Translucent"; - fog = "Fog"; -}*/ + add = "Add"; + subtract = "Subtract"; + reversesubtract = "Reverse subtract"; + modulate = "Modulate"; +} sectorflags { diff --git a/src/p_setup.c b/src/p_setup.c index 6320edc22..6f0e11c03 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1701,6 +1701,19 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) lines[i].sidenum[1] = atol(val); else if (fastcmp(param, "alpha")) lines[i].alpha = FLOAT_TO_FIXED(atof(val)); + else if (fastcmp(param, "blendmode") || fastcmp(param, "renderstyle")) + { + if (fastcmp(val, "translucent")) + lines[i].blendmode = AST_COPY; + else if (fastcmp(val, "add")) + lines[i].blendmode = AST_ADD; + else if (fastcmp(val, "subtract")) + lines[i].blendmode = AST_SUBTRACT; + else if (fastcmp(val, "reversesubtract")) + lines[i].blendmode = AST_REVERSESUBTRACT; + else if (fastcmp(val, "modulate")) + lines[i].blendmode = AST_MODULATE; + } else if (fastcmp(param, "executordelay")) lines[i].executordelay = atol(val); From e7a7a3b2138017b08d19276cb95497f4298aef8c Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 13 Dec 2021 15:20:43 +0100 Subject: [PATCH 28/54] Prevent Pyrefly fire from warping up nearby ledges. --- src/info.c | 4 ++-- src/p_mobj.c | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/info.c b/src/info.c index f56e5d78e..086293cd6 100644 --- a/src/info.c +++ b/src/info.c @@ -5198,11 +5198,11 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // speed 24*FRACUNIT, // radius 34*FRACUNIT, // height - 0, // display offset + 1, // display offset DMG_FIRE, // mass 0, // damage sfx_None, // activesound - MF_NOGRAVITY|MF_NOBLOCKMAP|MF_FIRE|MF_PAIN, // flags + MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_FIRE|MF_PAIN, // flags S_NULL // raisestate }, diff --git a/src/p_mobj.c b/src/p_mobj.c index 83f9ebf3c..4b0337873 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -395,13 +395,13 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) if (skin) { UINT16 stateframe = st->frame; - + // Add/Remove FF_SPR2SUPER based on certain conditions if (player->charflags & SF_NOSUPERSPRITES) stateframe = stateframe & ~FF_SPR2SUPER; else if (player->powers[pw_super]) stateframe = stateframe | FF_SPR2SUPER; - + if (stateframe & FF_SPR2SUPER) { if (mobj->eflags & MFE_FORCENOSUPER) @@ -409,11 +409,11 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) } else if (mobj->eflags & MFE_FORCESUPER) stateframe = stateframe | FF_SPR2SUPER; - + // Get the sprite2 and frame number spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), mobj->player); numframes = skin->sprites[spr2].numframes; - + if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) mobj->tics = -1; // If no super wait, don't wait at all } @@ -541,7 +541,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) if (skin) { UINT16 stateframe = st->frame; - + // Add/Remove FF_SPR2SUPER based on certain conditions if (stateframe & FF_SPR2SUPER) { @@ -550,11 +550,11 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) } else if (mobj->eflags & MFE_FORCESUPER) stateframe = stateframe | FF_SPR2SUPER; - + // Get the sprite2 and frame number spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), NULL); numframes = skin->sprites[spr2].numframes; - + if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) mobj->tics = -1; // If no super wait, don't wait at all } @@ -1872,7 +1872,7 @@ void P_XYMovement(mobj_t *mo) // blocked move moved = false; - if (player) + if (player) B_MoveBlocked(player); if (LUA_HookMobjMoveBlocked(mo, tmhitthing, blockingline)) @@ -3323,7 +3323,7 @@ void P_MobjCheckWater(mobj_t *mobj) { // Water removes electric and non-water fire shields... if (electric) P_FlashPal(p, PAL_WHITE, 1); - + p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; } } @@ -7059,6 +7059,8 @@ static void P_PyreFlyBurn(mobj_t *mobj, fixed_t hoffs, INT16 vrange, mobjtype_t fixed_t zoffs = P_RandomRange(-vrange, vrange)*FRACUNIT; mobj_t *particle = P_SpawnMobjFromMobj(mobj, xoffs, yoffs, zoffs, mobjtype); particle->momz = momz; + particle->flags2 |= MF2_LINKDRAW; + P_SetTarget(&particle->tracer, mobj); } static void P_MobjScaleThink(mobj_t *mobj) @@ -10422,7 +10424,7 @@ static fixed_t P_DefaultMobjShadowScale (mobj_t *thing) case MT_RING: case MT_FLINGRING: - + case MT_COIN: case MT_FLINGCOIN: From 9b10473e0df43842ad77bb9c7f45b7a7edc0308a Mon Sep 17 00:00:00 2001 From: katsy Date: Fri, 24 Dec 2021 19:36:26 -0600 Subject: [PATCH 29/54] add invert flashpal constant --- src/deh_tables.c | 1 + src/p_local.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index f30f7c14d..b80e88ec2 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5088,6 +5088,7 @@ struct int_const_s const INT_CONST[] = { {"PAL_MIXUP",PAL_MIXUP}, {"PAL_RECYCLE",PAL_RECYCLE}, {"PAL_NUKE",PAL_NUKE}, + {"PAL_INVERT",PAL_INVERT}, // for P_DamageMobj //// Damage types {"DMG_WATER",DMG_WATER}, diff --git a/src/p_local.h b/src/p_local.h index 1fcd3050d..28a77afe5 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -349,6 +349,7 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration); #define PAL_MIXUP 2 #define PAL_RECYCLE 3 #define PAL_NUKE 4 +#define PAL_INVERT 5 // // P_ENEMY From 243a797efe9fe89c4b51c974b5137afeedded808 Mon Sep 17 00:00:00 2001 From: katsy <205-katsy@users.noreply.git.do.srb2.org> Date: Sun, 26 Dec 2021 12:41:49 +0000 Subject: [PATCH 30/54] Set a default botleader if we don't have one (resolves #717) --- src/b_bot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index cdd74fc07..bf2dbbb68 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -29,11 +29,16 @@ void B_UpdateBotleader(player_t *player) { if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo) continue; - if (!player->mo) //Can't do distance calculations if there's no player object, so we'll just take the first we find + + if (!player->botleader) { - player->botleader = &players[i]; + player->botleader = &players[i]; // set default return; } + + if (!player->mo) + return; + //Update best candidate based on nearest distance dist = R_PointToDist2(player->mo->x, player->mo->y, players[i].mo->x, players[i].mo->y); if (neardist > dist) From bb514d227ca5f2d53e6295c8b599a1dc205c69f1 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 26 Dec 2021 21:12:39 +0100 Subject: [PATCH 31/54] Don't count music.dta as a main wad when using listwad --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cca3102d0..fe7e7678f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3763,7 +3763,7 @@ static void Command_ListWADS_f(void) nameonly(tempname = va("%s", wadfiles[i]->filename)); if (!i) CONS_Printf("\x82 IWAD\x80: %s\n", tempname); - else if (i <= mainwads) + else if (i < mainwads) CONS_Printf("\x82 * %.2d\x80: %s\n", i, tempname); else if (!wadfiles[i]->important) CONS_Printf("\x86 %.2d: %s\n", i, tempname); From b830fee2e30ae5f9d36b85781c22d2484af59931 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 26 Dec 2021 21:30:36 +0100 Subject: [PATCH 32/54] Allow changing the master server address while hosting a netgame. --- src/m_menu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index fc1e33b67..3ec49356c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11588,9 +11588,7 @@ static void M_ServerOptions(INT32 choice) OP_ServerOptionsMenu[ 2].status = IT_STRING | IT_CVAR; OP_ServerOptionsMenu[ 3].status = IT_STRING | IT_CVAR; OP_ServerOptionsMenu[ 4].status = IT_STRING | IT_CVAR; - OP_ServerOptionsMenu[36].status = (netgame - ? IT_GRAYEDOUT - : (IT_STRING | IT_CVAR | IT_CV_STRING)); + OP_ServerOptionsMenu[36].status = IT_STRING | IT_CVAR | IT_CV_STRING; OP_ServerOptionsMenu[37].status = IT_STRING | IT_CVAR; OP_ServerOptionsMenu[38].status = IT_STRING | IT_CVAR; } From 1040141560d717fc60e09e71f5d78aa5780d0d14 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 27 Dec 2021 12:41:04 +0100 Subject: [PATCH 33/54] Fix enemy/boss/minecart explosions in death pits --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 40ef447f8..39c6731b8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2522,7 +2522,7 @@ boolean P_ZMovement(mobj_t *mo) { P_KillMobj(mo, NULL, NULL, 0); } - return false; + return !P_MobjWasRemoved(mo); // allows explosion states to run } else { From effcb948ade86387fcf446b234fd212eb79aa951 Mon Sep 17 00:00:00 2001 From: katsy <205-katsy@users.noreply.git.do.srb2.org> Date: Wed, 29 Dec 2021 09:59:54 +0000 Subject: [PATCH 34/54] Don't count bots in playersforexit --- src/g_game.c | 2 +- src/p_user.c | 4 ++-- src/st_stuff.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 3955834b2..e671eb2d7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3300,7 +3300,7 @@ boolean G_EnoughPlayersFinished(void) for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i] || players[i].spectator || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) + if (!playeringame[i] || players[i].spectator || players[i].bot) continue; if (players[i].quittime > 30 * TICRATE) continue; diff --git a/src/p_user.c b/src/p_user.c index ee76d29a8..b6c30256f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11588,7 +11588,7 @@ void P_PlayerThink(player_t *player) for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i] || players[i].spectator || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) + if (!playeringame[i] || players[i].spectator || players[i].bot) continue; if (players[i].lives <= 0) continue; @@ -11620,7 +11620,7 @@ void P_PlayerThink(player_t *player) for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i] || players[i].spectator || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) + if (!playeringame[i] || players[i].spectator || players[i].bot) continue; if (players[i].quittime > 30 * TICRATE) continue; diff --git a/src/st_stuff.c b/src/st_stuff.c index a328d669e..ebf188a06 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2291,7 +2291,7 @@ static void ST_drawTextHUD(void) for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i] || players[i].spectator) + if (!playeringame[i] || players[i].spectator || players[i].bot) continue; if (players[i].lives <= 0) continue; From 0a38fef147666bbf09320f0e88dc4fb900c5e21f Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 16 Dec 2021 15:28:37 +0100 Subject: [PATCH 35/54] Several changes to default control settings: - Renamed Simple to Automatic, and made it the default - Renamed Standard to Manual - Changed some camera settings to make Automatic easier to control - Changed most default gamepad controls, to fit Automatic playstyle - Changed a few default keyboard controls - Added default binds for custom actions 1-3 - Removed forced camera settings in the tutorial (to account for upcoming tutorial update) - Also lowered default sound/music volume a little bit --- src/g_game.c | 46 +++++++++++++++++++-------------------- src/g_input.c | 60 ++++++++++++++++++++++++++++----------------------- src/m_menu.c | 29 +++++++++++++------------ src/p_user.c | 30 +++++++++----------------- src/s_sound.c | 6 +++--- 5 files changed, 84 insertions(+), 87 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e671eb2d7..44860bbbc 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -346,8 +346,8 @@ consvar_t cv_analog[2] = { CVAR_INIT ("sessionanalog2", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog2_OnChange), }; consvar_t cv_useranalog[2] = { - CVAR_INIT ("configanalog", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog_OnChange), - CVAR_INIT ("configanalog2", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog2_OnChange), + CVAR_INIT ("configanalog", "On", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog_OnChange), + CVAR_INIT ("configanalog2", "On", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog2_OnChange), }; // deez New User eXperiences @@ -362,8 +362,8 @@ consvar_t cv_autobrake2 = CVAR_INIT ("autobrake2", "On", CV_SAVE|CV_CALL, CV_OnO // hi here's some new controls static CV_PossibleValue_t zerotoone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; consvar_t cv_cam_shiftfacing[2] = { - CVAR_INIT ("cam_shiftfacingchar", "0.33", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), - CVAR_INIT ("cam2_shiftfacingchar", "0.33", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), + CVAR_INIT ("cam_shiftfacingchar", "0.375", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), + CVAR_INIT ("cam2_shiftfacingchar", "0.375", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), }; consvar_t cv_cam_turnfacing[2] = { CVAR_INIT ("cam_turnfacingchar", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), @@ -374,12 +374,12 @@ consvar_t cv_cam_turnfacingability[2] = { CVAR_INIT ("cam2_turnfacingability", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), }; consvar_t cv_cam_turnfacingspindash[2] = { - CVAR_INIT ("cam_turnfacingspindash", "0.5", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), - CVAR_INIT ("cam2_turnfacingspindash", "0.5", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), + CVAR_INIT ("cam_turnfacingspindash", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), + CVAR_INIT ("cam2_turnfacingspindash", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), }; consvar_t cv_cam_turnfacinginput[2] = { - CVAR_INIT ("cam_turnfacinginput", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), - CVAR_INIT ("cam2_turnfacinginput", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), + CVAR_INIT ("cam_turnfacinginput", "0.375", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), + CVAR_INIT ("cam2_turnfacinginput", "0.375", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL), }; static CV_PossibleValue_t centertoggle_cons_t[] = {{0, "Hold"}, {1, "Toggle"}, {2, "Sticky Hold"}, {0, NULL}}; @@ -403,28 +403,28 @@ static CV_PossibleValue_t lockedassist_cons_t[] = { {0, NULL} }; consvar_t cv_cam_lockonboss[2] = { - CVAR_INIT ("cam_lockaimassist", "Bosses", CV_SAVE, lockedassist_cons_t, NULL), - CVAR_INIT ("cam2_lockaimassist", "Bosses", CV_SAVE, lockedassist_cons_t, NULL), + CVAR_INIT ("cam_lockaimassist", "Full", CV_SAVE, lockedassist_cons_t, NULL), + CVAR_INIT ("cam2_lockaimassist", "Full", CV_SAVE, lockedassist_cons_t, NULL), }; -consvar_t cv_turnaxis = CVAR_INIT ("joyaxis_turn", "X-Rudder", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_moveaxis = CVAR_INIT ("joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_sideaxis = CVAR_INIT ("joyaxis_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_lookaxis = CVAR_INIT ("joyaxis_look", "Y-Rudder-", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_turnaxis = CVAR_INIT ("joyaxis_turn", "X-Rudder", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_jumpaxis = CVAR_INIT ("joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_spinaxis = CVAR_INIT ("joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_fireaxis = CVAR_INIT ("joyaxis_fire", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_fireaxis = CVAR_INIT ("joyaxis_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_firenaxis = CVAR_INIT ("joyaxis_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_deadzone = CVAR_INIT ("joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); consvar_t cv_digitaldeadzone = CVAR_INIT ("joy_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); -consvar_t cv_turnaxis2 = CVAR_INIT ("joyaxis2_turn", "X-Rudder", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_moveaxis2 = CVAR_INIT ("joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_sideaxis2 = CVAR_INIT ("joyaxis2_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_lookaxis2 = CVAR_INIT ("joyaxis2_look", "Y-Rudder-", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_turnaxis2 = CVAR_INIT ("joyaxis2_turn", "X-Rudder", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_jumpaxis2 = CVAR_INIT ("joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_spinaxis2 = CVAR_INIT ("joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_fireaxis2 = CVAR_INIT ("joyaxis2_fire", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_fireaxis2 = CVAR_INIT ("joyaxis2_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); consvar_t cv_deadzone2 = CVAR_INIT ("joy_deadzone2", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); consvar_t cv_digitaldeadzone2 = CVAR_INIT ("joy_digdeadzone2", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); @@ -1551,8 +1551,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { // Fix offset angle for P2-controlled Tailsbot when P2's controls are set to non-Strafe cmd->angleturn = (INT16)((localangle - *myangle) >> 16); - } - + } + *myangle += (cmd->angleturn<<16); if (controlstyle == CS_LMAOGALOG) { @@ -2335,7 +2335,7 @@ void G_Ticker(boolean run) else if (players[i].bot == BOT_MPAI) { B_BuildTiccmd(&players[i], &players[i].cmd); } - + // Do angle adjustments. if (players[i].bot == BOT_NONE || players[i].bot == BOT_2PHUMAN) { @@ -2350,7 +2350,7 @@ void G_Ticker(boolean run) P_ForceLocalAngle(&players[i], players[i].angleturn << 16); else players[i].cmd.angleturn = players[i].angleturn; - + players[i].cmd.angleturn &= ~TICCMD_RECEIVED; // Use the leveltime sent in the player's ticcmd to determine control lag players[i].cmd.latency = min(((leveltime & 0xFF) - players[i].cmd.latency) & 0xFF, MAXPREDICTTICS-1); @@ -3056,15 +3056,15 @@ void G_DoReborn(INT32 playernum) return; } - + // Additional players (e.g. independent bots) in Single Player - if (playernum != consoleplayer && !(netgame || multiplayer)) - { + if (playernum != consoleplayer && !(netgame || multiplayer)) + { mobj_t *oldmo = NULL; // Do nothing if out of lives if (player->lives <= 0) return; - + // Otherwise do respawn, starting by removing the player object if (player->mo) { @@ -3075,7 +3075,7 @@ void G_DoReborn(INT32 playernum) G_SpawnPlayer(playernum); if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); - + return; //Exit function to avoid proccing other SP related mechanics } diff --git a/src/g_input.c b/src/g_input.c index 6383c3f00..250a24772 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -684,14 +684,18 @@ void G_DefineDefaultControls(void) gamecontroldefault[gcs_fps][GC_LOOKDOWN ][0] = KEY_DOWNARROW; gamecontroldefault[gcs_fps][GC_TURNLEFT ][0] = KEY_LEFTARROW; gamecontroldefault[gcs_fps][GC_TURNRIGHT ][0] = KEY_RIGHTARROW; - gamecontroldefault[gcs_fps][GC_CENTERVIEW ][0] = KEY_END; + gamecontroldefault[gcs_fps][GC_CENTERVIEW ][0] = KEY_LCTRL; gamecontroldefault[gcs_fps][GC_JUMP ][0] = KEY_SPACE; gamecontroldefault[gcs_fps][GC_SPIN ][0] = KEY_LSHIFT; gamecontroldefault[gcs_fps][GC_FIRE ][0] = KEY_RCTRL; gamecontroldefault[gcs_fps][GC_FIRE ][1] = KEY_MOUSE1+0; - gamecontroldefault[gcs_fps][GC_FIRENORMAL ][0] = 'c'; + gamecontroldefault[gcs_fps][GC_FIRENORMAL ][0] = KEY_RALT; + gamecontroldefault[gcs_fps][GC_FIRENORMAL ][1] = KEY_MOUSE1+1; + gamecontroldefault[gcs_fps][GC_CUSTOM1 ][0] = 'z'; + gamecontroldefault[gcs_fps][GC_CUSTOM2 ][0] = 'x'; + gamecontroldefault[gcs_fps][GC_CUSTOM3 ][0] = 'c'; - // Platform game controls (arrow keys) + // Platform game controls (arrow keys), currently unused gamecontroldefault[gcs_platform][GC_FORWARD ][0] = KEY_UPARROW; gamecontroldefault[gcs_platform][GC_BACKWARD ][0] = KEY_DOWNARROW; gamecontroldefault[gcs_platform][GC_STRAFELEFT ][0] = 'a'; @@ -734,34 +738,36 @@ void G_DefineDefaultControls(void) gamecontroldefault[i][GC_VIEWPOINT ][0] = KEY_F12; // Gamepad controls -- same for both schemes - gamecontroldefault[i][GC_WEAPONNEXT ][1] = KEY_JOY1+1; // B - gamecontroldefault[i][GC_WEAPONPREV ][1] = KEY_JOY1+2; // X - gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_JOY1+0; // A - gamecontroldefault[i][GC_SPIN ][1] = KEY_JOY1+4; // LB - gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_HAT1+0; // D-Pad Up - gamecontroldefault[i][GC_CAMRESET ][1] = KEY_JOY1+3; // Y + gamecontroldefault[i][GC_JUMP ][1] = KEY_JOY1+0; // A + gamecontroldefault[i][GC_SPIN ][1] = KEY_JOY1+2; // X + gamecontroldefault[i][GC_CUSTOM1 ][1] = KEY_JOY1+1; // B + gamecontroldefault[i][GC_CUSTOM2 ][1] = KEY_JOY1+3; // Y + gamecontroldefault[i][GC_CUSTOM3 ][1] = KEY_JOY1+8; // Left Stick gamecontroldefault[i][GC_CENTERVIEW ][1] = KEY_JOY1+9; // Right Stick - gamecontroldefault[i][GC_TALKKEY ][1] = KEY_HAT1+2; // D-Pad Left - gamecontroldefault[i][GC_SCORES ][1] = KEY_HAT1+3; // D-Pad Right - gamecontroldefault[i][GC_JUMP ][1] = KEY_JOY1+5; // RB - gamecontroldefault[i][GC_PAUSE ][1] = KEY_JOY1+6; // Back - gamecontroldefault[i][GC_SCREENSHOT ][1] = KEY_HAT1+1; // D-Pad Down + gamecontroldefault[i][GC_WEAPONPREV ][1] = KEY_JOY1+4; // LB + gamecontroldefault[i][GC_WEAPONNEXT ][1] = KEY_JOY1+5; // RB + gamecontroldefault[i][GC_SCREENSHOT ][1] = KEY_JOY1+6; // Back gamecontroldefault[i][GC_SYSTEMMENU ][0] = KEY_JOY1+7; // Start + gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_HAT1+0; // D-Pad Up + gamecontroldefault[i][GC_VIEWPOINT ][1] = KEY_HAT1+1; // D-Pad Down + gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_HAT1+2; // D-Pad Left + gamecontroldefault[i][GC_SCORES ][1] = KEY_HAT1+3; // D-Pad Right // Second player controls only have joypad defaults - gamecontrolbisdefault[i][GC_WEAPONNEXT][0] = KEY_2JOY1+1; // B - gamecontrolbisdefault[i][GC_WEAPONPREV][0] = KEY_2JOY1+2; // X - gamecontrolbisdefault[i][GC_TOSSFLAG ][0] = KEY_2JOY1+0; // A - gamecontrolbisdefault[i][GC_SPIN ][0] = KEY_2JOY1+4; // LB - gamecontrolbisdefault[i][GC_CAMRESET ][0] = KEY_2JOY1+3; // Y - gamecontrolbisdefault[i][GC_CENTERVIEW][0] = KEY_2JOY1+9; // Right Stick - gamecontrolbisdefault[i][GC_JUMP ][0] = KEY_2JOY1+5; // RB - //gamecontrolbisdefault[i][GC_PAUSE ][0] = KEY_2JOY1+6; // Back - //gamecontrolbisdefault[i][GC_SYSTEMMENU][0] = KEY_2JOY1+7; // Start - gamecontrolbisdefault[i][GC_CAMTOGGLE ][0] = KEY_2HAT1+0; // D-Pad Up - gamecontrolbisdefault[i][GC_SCREENSHOT][0] = KEY_2HAT1+1; // D-Pad Down - //gamecontrolbisdefault[i][GC_TALKKEY ][0] = KEY_2HAT1+2; // D-Pad Left - //gamecontrolbisdefault[i][GC_SCORES ][0] = KEY_2HAT1+3; // D-Pad Right + gamecontrolbisdefault[i][GC_JUMP ][1] = KEY_2JOY1+0; // A + gamecontrolbisdefault[i][GC_SPIN ][1] = KEY_2JOY1+2; // X + gamecontrolbisdefault[i][GC_CUSTOM1 ][1] = KEY_2JOY1+1; // B + gamecontrolbisdefault[i][GC_CUSTOM2 ][1] = KEY_2JOY1+3; // Y + gamecontrolbisdefault[i][GC_CUSTOM3 ][1] = KEY_2JOY1+8; // Left Stick + gamecontrolbisdefault[i][GC_CENTERVIEW ][1] = KEY_2JOY1+9; // Right Stick + gamecontrolbisdefault[i][GC_WEAPONPREV ][1] = KEY_2JOY1+4; // LB + gamecontrolbisdefault[i][GC_WEAPONNEXT ][1] = KEY_2JOY1+5; // RB + gamecontrolbisdefault[i][GC_SCREENSHOT ][1] = KEY_2JOY1+6; // Back + //gamecontrolbisdefault[i][GC_SYSTEMMENU ][0] = KEY_2JOY1+7; // Start + gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2HAT1+0; // D-Pad Up + gamecontrolbisdefault[i][GC_VIEWPOINT ][1] = KEY_2HAT1+1; // D-Pad Down + gamecontrolbisdefault[i][GC_TOSSFLAG ][1] = KEY_2HAT1+2; // D-Pad Left + //gamecontrolbisdefault[i][GC_SCORES ][1] = KEY_2HAT1+3; // D-Pad Right } } diff --git a/src/m_menu.c b/src/m_menu.c index 3ec49356c..7d9b2249f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4438,22 +4438,21 @@ static void M_DrawGenericMenu(void) } } -const char *PlaystyleNames[4] = {"Strafe", "Standard", "Simple", "Old Analog??"}; +const char *PlaystyleNames[4] = {"\x86Strafe\x80", "Manual", "Automatic", "Old Analog??"}; const char *PlaystyleDesc[4] = { - // Legacy - "The play style used for\n" - "old-school SRB2.\n" + // Strafe (or Legacy) + "A play style resembling\n" + "old-school SRB2 gameplay.\n" "\n" "This play style is identical\n" - "to Standard, except that the\n" + "to Manual, except that the\n" "player always looks in the\n" "direction of the camera." , - // Standard - "The default play style,\n" - "designed for full control\n" - "with a keyboard and mouse.\n" + // Manual (formerly Standard) + "A play style made for full control,\n" + "using a keyboard and mouse.\n" "\n" "The camera rotates only when\n" "you tell it to. The player\n" @@ -4465,8 +4464,8 @@ const char *PlaystyleDesc[4] = { "open up the highest level of play!" , - // Simple - "A play style designed for\n" + // Automatic (formerly Simple) + "The default play style, designed for\n" "gamepads and hassle-free play.\n" "\n" "The camera rotates automatically\n" @@ -4475,7 +4474,8 @@ const char *PlaystyleDesc[4] = { "they're moving.\n" "\n" "Hold \x82" "Center View\x80 to lock the\n" - "camera behind the player!\n" + "camera behind the player, or target\n" + "enemies, bosses and monitors!\n" , // Old Analog @@ -4486,7 +4486,7 @@ const char *PlaystyleDesc[4] = { "your config file and brought it back.\n" "\n" "That's absolutely valid, but I implore\n" - "you to try the new Simple play style\n" + "you to try the new Automatic play style\n" "instead!" }; @@ -9062,7 +9062,7 @@ static void M_LoadGame(INT32 choice) if (tutorialmap && cv_tutorialprompt.value) { - M_StartMessage("Do you want to \x82play a brief Tutorial\x80?\n\nWe highly recommend this because \nthe controls are slightly different \nfrom other games.\n\nPress 'Y' or 'Enter' to go\nPress 'N' or any key to skip\n", + M_StartMessage("Do you want to \x82play a brief Tutorial\x80?\n\nWe highly recommend this because \nthe controls are slightly different \nfrom other games.\n\nPress the \x82\Y\x80 key or the \x83\A button\x80 to go\nPress the \x82\N\x80 key or the \x83\Y button\x80 to skip\n", M_FirstTimeResponse, MM_YESNO); return; } @@ -13008,6 +13008,7 @@ static void M_DrawPlaystyleMenu(void) if (i == playstyle_currentchoice) { + V_DrawFill(20, 40, 280, 150, 159); V_DrawScaledPatch((i+1)*BASEVIDWIDTH/4 - 8, 10, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); V_DrawString(30, 50, V_ALLOWLOWERCASE, PlaystyleDesc[i]); } diff --git a/src/p_user.c b/src/p_user.c index 9b48442fe..bfb8d9283 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1191,7 +1191,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) { if (!player) return; - + if ((player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) && player->botleader) player = player->botleader; @@ -9624,7 +9624,7 @@ consvar_t cv_cam_still = CVAR_INIT ("cam_still", "Off", 0, CV_OnOff, NULL); consvar_t cv_cam_speed = CVAR_INIT ("cam_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL); consvar_t cv_cam_rotate = CVAR_INIT ("cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange); consvar_t cv_cam_rotspeed = CVAR_INIT ("cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL); -consvar_t cv_cam_turnmultiplier = CVAR_INIT ("cam_turnmultiplier", "1.0", CV_FLOAT|CV_SAVE, multiplier_cons_t, NULL); +consvar_t cv_cam_turnmultiplier = CVAR_INIT ("cam_turnmultiplier", "0.75", CV_FLOAT|CV_SAVE, multiplier_cons_t, NULL); consvar_t cv_cam_orbit = CVAR_INIT ("cam_orbit", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_cam_adjust = CVAR_INIT ("cam_adjust", "On", CV_SAVE, CV_OnOff, NULL); consvar_t cv_cam2_dist = CVAR_INIT ("cam2_curdist", "160", CV_FLOAT, NULL, NULL); @@ -9633,19 +9633,19 @@ consvar_t cv_cam2_still = CVAR_INIT ("cam2_still", "Off", 0, CV_OnOff, NULL); consvar_t cv_cam2_speed = CVAR_INIT ("cam2_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL); consvar_t cv_cam2_rotate = CVAR_INIT ("cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange); consvar_t cv_cam2_rotspeed = CVAR_INIT ("cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL); -consvar_t cv_cam2_turnmultiplier = CVAR_INIT ("cam2_turnmultiplier", "1.0", CV_FLOAT|CV_SAVE, multiplier_cons_t, NULL); +consvar_t cv_cam2_turnmultiplier = CVAR_INIT ("cam2_turnmultiplier", "0.75", CV_FLOAT|CV_SAVE, multiplier_cons_t, NULL); consvar_t cv_cam2_orbit = CVAR_INIT ("cam2_orbit", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_cam2_adjust = CVAR_INIT ("cam2_adjust", "On", CV_SAVE, CV_OnOff, NULL); // [standard vs simple][p1 or p2] consvar_t cv_cam_savedist[2][2] = { { // standard - CVAR_INIT ("cam_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), - CVAR_INIT ("cam2_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), + CVAR_INIT ("cam_dist", "192", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), + CVAR_INIT ("cam2_dist", "192", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), }, { // simple - CVAR_INIT ("cam_simpledist", "224", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), - CVAR_INIT ("cam2_simpledist", "224", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), + CVAR_INIT ("cam_simpledist", "256", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), + CVAR_INIT ("cam2_simpledist", "256", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), } }; @@ -9838,17 +9838,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (P_CameraThinker(player, thiscam, resetcalled)) return true; - if (tutorialmode) - { - // force defaults because we have a camera look section - camspeed = (INT32)(atof(cv_cam_speed.defaultvalue) * FRACUNIT); - camstill = (!stricmp(cv_cam_still.defaultvalue, "off")) ? false : true; - camorbit = (!stricmp(cv_cam_orbit.defaultvalue, "off")) ? false : true; - camrotate = atoi(cv_cam_rotate.defaultvalue); - camdist = FixedMul((INT32)(atof(cv_cam_dist.defaultvalue) * FRACUNIT), mo->scale); - camheight = FixedMul((INT32)(atof(cv_cam_height.defaultvalue) * FRACUNIT), mo->scale); - } - else if (thiscam == &camera) + if (thiscam == &camera) { camspeed = cv_cam_speed.value; camstill = cv_cam_still.value; @@ -11619,7 +11609,7 @@ void P_PlayerThink(player_t *player) INT32 i, total = 0, exiting = 0; for (i = 0; i < MAXPLAYERS; i++) - { + { if (!playeringame[i] || players[i].spectator || players[i].bot) continue; if (players[i].quittime > 30 * TICRATE) @@ -12560,7 +12550,7 @@ void P_PlayerAfterThink(player_t *player) player->mo->momy = tails->momy; player->mo->momz = tails->momz; } - + if (G_CoopGametype() && tails->player && tails->player->bot != BOT_2PAI) { player->mo->angle = tails->angle; diff --git a/src/s_sound.c b/src/s_sound.c index 30f242369..76f0d67c1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -74,9 +74,9 @@ consvar_t stereoreverse = CVAR_INIT ("stereoreverse", "Off", CV_SAVE, CV_OnOff, static consvar_t precachesound = CVAR_INIT ("precachesound", "Off", CV_SAVE, CV_OnOff, NULL); // actual general (maximum) sound & music volume, saved into the config -consvar_t cv_soundvolume = CVAR_INIT ("soundvolume", "18", CV_SAVE, soundvolume_cons_t, NULL); -consvar_t cv_digmusicvolume = CVAR_INIT ("digmusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL); -consvar_t cv_midimusicvolume = CVAR_INIT ("midimusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL); +consvar_t cv_soundvolume = CVAR_INIT ("soundvolume", "16", CV_SAVE, soundvolume_cons_t, NULL); +consvar_t cv_digmusicvolume = CVAR_INIT ("digmusicvolume", "16", CV_SAVE, soundvolume_cons_t, NULL); +consvar_t cv_midimusicvolume = CVAR_INIT ("midimusicvolume", "16", CV_SAVE, soundvolume_cons_t, NULL); static void Captioning_OnChange(void) { From 4d1fb04327bbd52c7b654a0da34adfd1a376f4ac Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 17 Dec 2021 11:53:10 +0100 Subject: [PATCH 36/54] Update playstyle names on the input display --- src/st_stuff.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index ebf188a06..f17b58fa6 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1176,7 +1176,17 @@ static void ST_drawInput(void) break; case CS_SIMPLE: - V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "SIMPLE"); + V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "AUTOMATIC"); + y -= 8; + break; + + case CS_STANDARD: + V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "MANUAL"); + y -= 8; + break; + + case CS_LEGACY: + V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "STRAFE"); y -= 8; break; From 17251895ea33f106874cb680b9c45e1cf995af46 Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 24 Dec 2021 18:07:14 +0100 Subject: [PATCH 37/54] Increase default camera height for both playstyles --- src/p_user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index bfb8d9283..0aff39949 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9651,12 +9651,12 @@ consvar_t cv_cam_savedist[2][2] = { }; consvar_t cv_cam_saveheight[2][2] = { { // standard - CVAR_INIT ("cam_height", "25", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), - CVAR_INIT ("cam2_height", "25", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), + CVAR_INIT ("cam_height", "40", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), + CVAR_INIT ("cam2_height", "40", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), }, { // simple - CVAR_INIT ("cam_simpleheight", "48", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), - CVAR_INIT ("cam2_simpleheight", "48", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), + CVAR_INIT ("cam_simpleheight", "60", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist), + CVAR_INIT ("cam2_simpleheight", "60", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist), } }; From d9410e3e6a7cd19c5b68a53bc24d58b5bbe635fe Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 30 Dec 2021 16:29:37 +0100 Subject: [PATCH 38/54] fix compile warnings (this really puts the mess in message) --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 7d9b2249f..af22e62a0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -9062,7 +9062,7 @@ static void M_LoadGame(INT32 choice) if (tutorialmap && cv_tutorialprompt.value) { - M_StartMessage("Do you want to \x82play a brief Tutorial\x80?\n\nWe highly recommend this because \nthe controls are slightly different \nfrom other games.\n\nPress the \x82\Y\x80 key or the \x83\A button\x80 to go\nPress the \x82\N\x80 key or the \x83\Y button\x80 to skip\n", + M_StartMessage("Do you want to \x82play a brief Tutorial\x80?\n\nWe highly recommend this because \nthe controls are slightly different \nfrom other games.\n\nPress the\x82 Y\x80 key or the\x83 A button\x80 to go\nPress the\x82 N\x80 key or the\x83 Y button\x80 to skip\n", M_FirstTimeResponse, MM_YESNO); return; } From 2886a277d8d4a4deb725a1e840579d8e5dc1070e Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 31 Dec 2021 15:00:27 +0100 Subject: [PATCH 39/54] Turn the fog wall linedef type into a blendmode --- extras/conf/udb/Includes/SRB222_misc.cfg | 1 + src/deh_tables.c | 1 + src/hardware/hw_main.c | 4 ++-- src/p_setup.c | 5 +++++ src/r_defs.h | 2 +- src/r_segs.c | 14 +++++++------- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 1b4fb4b4b..50c83e456 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -70,6 +70,7 @@ linedefrenderstyles subtract = "Subtract"; reversesubtract = "Reverse subtract"; modulate = "Modulate"; + fog = "Fog"; } sectorflags diff --git a/src/deh_tables.c b/src/deh_tables.c index 146a04f7f..e07d44453 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4898,6 +4898,7 @@ struct int_const_s const INT_CONST[] = { {"AST_REVERSESUBTRACT",AST_REVERSESUBTRACT}, {"AST_MODULATE",AST_MODULATE}, {"AST_OVERLAY",AST_OVERLAY}, + {"AST_FOG",AST_FOG}, // Render flags {"RF_HORIZONTALFLIP",RF_HORIZONTALFLIP}, diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a1dd53eb7..13b2a39c3 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1454,13 +1454,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom case 221: case 253: case 256: - if (gl_linedef->blendmode) + if (gl_linedef->blendmode != AST_FOG) blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); else blendmode = PF_Translucent; break; default: - if (gl_linedef->blendmode) + if (gl_linedef->blendmode != AST_FOG) { if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); diff --git a/src/p_setup.c b/src/p_setup.c index 6f0e11c03..6f06abf1b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1713,6 +1713,8 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) lines[i].blendmode = AST_REVERSESUBTRACT; else if (fastcmp(val, "modulate")) lines[i].blendmode = AST_MODULATE; + if (fastcmp(val, "fog")) + lines[i].blendmode = AST_FOG; } else if (fastcmp(param, "executordelay")) lines[i].executordelay = atol(val); @@ -3330,6 +3332,9 @@ static void P_ConvertBinaryMap(void) lines[i].args[4] |= TMSC_BACKTOFRONTCEILING; lines[i].special = 720; break; + case 909: //Fog wall + lines[i].blendmode = AST_FOG; + break; default: break; } diff --git a/src/r_defs.h b/src/r_defs.h index 3c2178937..fa63de400 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -716,7 +716,7 @@ typedef struct #endif // Possible alpha types for a patch. -enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY}; +enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY, AST_FOG}; typedef enum { diff --git a/src/r_segs.c b/src/r_segs.c index 4460f9f90..2459436b5 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -155,7 +155,13 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (!ldef->alpha) return; - if (ldef->blendmode) + if (ldef->blendmode == AST_FOG) + { + colfunc = colfuncs[COLDRAWFUNC_FOG]; + windowtop = frontsector->ceilingheight; + windowbottom = frontsector->floorheight; + } + else if (ldef->blendmode) { if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE) dc_transmap = R_GetBlendTable(ldef->blendmode, 0); @@ -168,12 +174,6 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha)); colfunc = colfuncs[COLDRAWFUNC_FUZZY]; } - else if (ldef->special == 909) - { - colfunc = colfuncs[COLDRAWFUNC_FOG]; - windowtop = frontsector->ceilingheight; - windowbottom = frontsector->floorheight; - } else colfunc = colfuncs[BASEDRAWFUNC]; From 719ceb0586bdc462f14800a902a4af9502a59896 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sat, 1 Jan 2022 19:34:27 +0100 Subject: [PATCH 40/54] Add collision check for flipped water drops --- src/p_mobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 39c6731b8..87e20fd4a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7740,7 +7740,8 @@ static void P_MobjSceneryThink(mobj_t *mobj) break; case MT_WATERDROP: P_SceneryCheckWater(mobj); - if ((mobj->z <= mobj->floorz || mobj->z <= mobj->watertop) + if (((!(mobj->eflags & MFE_VERTICALFLIP) && (mobj->z <= mobj->floorz || mobj->z <= mobj->watertop)) + || (mobj->eflags & MFE_VERTICALFLIP && mobj->z + mobj->height >= mobj->ceilingz)) && mobj->health > 0) { mobj->health = 0; From 1a21ca14f018748e930ba7cf8eb116a658a9e31c Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 2 Jan 2022 20:44:24 +0100 Subject: [PATCH 41/54] Fix cyan pixel cutting in Software --- src/r_plane.c | 2 +- src/r_segs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index d854c2342..1f5c0192e 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -862,7 +862,7 @@ void R_DrawSinglePlane(visplane_t *pl) return; // Don't even draw it if (pl->ffloor->blend) // additive, (reverse) subtractive, modulative ds_transmap = R_GetBlendTable(pl->ffloor->blend, trans); - else if (!(ds_transmap = R_GetTranslucencyTable(trans))) + else if (!(ds_transmap = R_GetTranslucencyTable(trans)) || trans == 0) spanfunctype = SPANDRAWFUNC_SPLAT; // Opaque, but allow transparent flat pixels } diff --git a/src/r_segs.c b/src/r_segs.c index 2459436b5..157cf466e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -614,7 +614,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) return; // Don't even draw it if (pfloor->blend) // additive, (reverse) subtractive, modulative dc_transmap = R_GetBlendTable(pfloor->blend, trans); - else if (!(dc_transmap = R_GetTranslucencyTable(trans))) + else if (!(dc_transmap = R_GetTranslucencyTable(trans)) || trans == 0) fuzzy = false; // Opaque } From f9d2fd9ce573b1c47f44c5a09fe9ae65cb4b6e11 Mon Sep 17 00:00:00 2001 From: sphere Date: Mon, 15 Nov 2021 18:03:07 +0100 Subject: [PATCH 42/54] blentran part 1: Flag changes & semibright support. --- src/deh_tables.c | 25 ++++++++++++++++------ src/hardware/hw_draw.c | 44 +++++++++------------------------------ src/hardware/hw_main.c | 6 ++++++ src/hu_stuff.c | 22 ++++++++++++-------- src/m_menu.c | 10 ++++----- src/p_pspr.h | 47 ++++++++++++++++++++++++++++++------------ src/r_data.h | 3 --- src/r_defs.h | 23 +++++++++++++-------- src/r_things.c | 22 ++++++++++++++++---- src/r_things.h | 16 +++++++------- src/v_video.c | 29 ++++++++------------------ src/v_video.h | 22 +++++++++++++------- 12 files changed, 151 insertions(+), 118 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index b80e88ec2..730ae959b 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4843,9 +4843,18 @@ struct int_const_s const INT_CONST[] = { {"FF_RANDOMANIM",FF_RANDOMANIM}, {"FF_GLOBALANIM",FF_GLOBALANIM}, {"FF_FULLBRIGHT",FF_FULLBRIGHT}, + {"FF_SEMIBRIGHT",FF_SEMIBRIGHT}, + {"FF_FULLDARK",FF_FULLDARK}, {"FF_VERTICALFLIP",FF_VERTICALFLIP}, {"FF_HORIZONTALFLIP",FF_HORIZONTALFLIP}, {"FF_PAPERSPRITE",FF_PAPERSPRITE}, + {"FF_FLOORSPRITE",FF_FLOORSPRITE}, + {"FF_BLENDMASK",FF_BLENDMASK}, + {"FF_BLENDSHIFT",FF_BLENDSHIFT}, + {"FF_ADD",FF_ADD}, + {"FF_SUBTRACT",FF_SUBTRACT}, + {"FF_REVERSESUBTRACT",FF_REVERSESUBTRACT}, + {"FF_MODULATE",FF_MODULATE}, {"FF_TRANSMASK",FF_TRANSMASK}, {"FF_TRANSSHIFT",FF_TRANSSHIFT}, // new preshifted translucency (used in source) @@ -4900,9 +4909,10 @@ struct int_const_s const INT_CONST[] = { {"RF_OBJECTSLOPESPLAT",RF_OBJECTSLOPESPLAT}, {"RF_NOSPLATBILLBOARD",RF_NOSPLATBILLBOARD}, {"RF_NOSPLATROLLANGLE",RF_NOSPLATROLLANGLE}, - {"RF_BLENDMASK",RF_BLENDMASK}, + {"RF_BRIGHTMASK",RF_BRIGHTMASK}, {"RF_FULLBRIGHT",RF_FULLBRIGHT}, {"RF_FULLDARK",RF_FULLDARK}, + {"RF_SEMIBRIGHT",RF_SEMIBRIGHT}, {"RF_NOCOLORMAPS",RF_NOCOLORMAPS}, {"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK}, {"RF_PAPERSPRITE",RF_PAPERSPRITE}, @@ -5392,9 +5402,12 @@ struct int_const_s const INT_CONST[] = { {"V_HUDTRANSHALF",V_HUDTRANSHALF}, {"V_HUDTRANS",V_HUDTRANS}, {"V_HUDTRANSDOUBLE",V_HUDTRANSDOUBLE}, - {"V_AUTOFADEOUT",V_AUTOFADEOUT}, - {"V_RETURN8",V_RETURN8}, - {"V_OFFSET",V_OFFSET}, + {"V_BLENDSHIFT",V_BLENDSHIFT}, + {"V_BLENDMASK",V_BLENDMASK}, + {"V_ADD",V_ADD}, + {"V_SUBTRACT",V_SUBTRACT}, + {"V_REVERSESUBTRACT",V_REVERSESUBTRACT}, + {"V_MODULATE",V_MODULATE}, {"V_ALLOWLOWERCASE",V_ALLOWLOWERCASE}, {"V_FLIP",V_FLIP}, {"V_CENTERNAMETAG",V_CENTERNAMETAG}, @@ -5402,8 +5415,8 @@ struct int_const_s const INT_CONST[] = { {"V_SNAPTOBOTTOM",V_SNAPTOBOTTOM}, {"V_SNAPTOLEFT",V_SNAPTOLEFT}, {"V_SNAPTORIGHT",V_SNAPTORIGHT}, - {"V_WRAPX",V_WRAPX}, - {"V_WRAPY",V_WRAPY}, + {"V_AUTOFADEOUT",V_AUTOFADEOUT}, + {"V_RETURN8",V_RETURN8}, {"V_NOSCALESTART",V_NOSCALESTART}, {"V_PERPLAYER",V_PERPLAYER}, diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 8223705bd..89d43a6b4 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -119,11 +119,6 @@ void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option) flags = PF_Translucent|PF_NoDepthTest; - if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY; - // clip it since it is used for bunny scroll in doom I HWD.pfnDrawPolygon(NULL, v, 4, flags); } @@ -145,9 +140,6 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p UINT8 perplayershuffle = 0; - if (alphalevel >= 10 && alphalevel < 13) - return; - // make patch ready in hardware cache if (!colormap) HWR_GetPatch(gpatch); @@ -191,15 +183,9 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p offsetx = (float)(gpatch->leftoffset) * fscalew; // top offset - // TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!? + // TODO: make some kind of vertical version of V_FLIP offsety = (float)(gpatch->topoffset) * fscaleh; - if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs - { - offsetx *= dupx; - offsety *= dupy; - } - cx -= offsetx; cy -= offsety; } @@ -361,19 +347,15 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p flags = PF_Translucent|PF_NoDepthTest; - if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY; - // clip it since it is used for bunny scroll in doom I if (alphalevel) { FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; + + if (alphalevel == 10) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; + else if (alphalevel == 11) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; + else if (alphalevel == 12) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); @@ -399,9 +381,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, UINT8 perplayershuffle = 0; - if (alphalevel >= 10 && alphalevel < 13) - return; - // make patch ready in hardware cache if (!colormap) HWR_GetPatch(gpatch); @@ -591,11 +570,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, flags = PF_Translucent|PF_NoDepthTest; - if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY; - // Auto-crop at splitscreen borders! if (splitscreen && (option & V_PERPLAYER)) { @@ -671,10 +645,12 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, { FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; + + if (alphalevel == 10) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; + else if (alphalevel == 11) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; + else if (alphalevel == 12) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); } diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9bade3d6f..c5e5a3218 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3916,6 +3916,9 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) } } + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + for (i = 0; i < sector->numlights; i++) { if (endtop < endrealbot && top < realbot) @@ -4269,6 +4272,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else if (!lightset) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 3107057a1..cf7118fbe 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1869,7 +1869,7 @@ static void HU_DrawChat_Old(void) static inline void HU_DrawCrosshair(void) { - INT32 i, y; + INT32 i, y, dupz; i = cv_crosshair.value & 3; if (!i) @@ -1885,12 +1885,14 @@ static inline void HU_DrawCrosshair(void) #endif y = viewwindowy + (viewheight>>1); - V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); + dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); + + V_DrawFixedPatch(vid.width<<(FRACBITS-1), y<>1); - if (splitscreen) - { -#ifdef HWRENDER + if (!splitscreen) + return; + + #ifdef HWRENDER if (rendermode != render_soft) y += (INT32)gl_viewheight; else -#endif + #endif y += viewheight; - V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); - } + dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); + + V_DrawFixedPatch(vid.width<<(FRACBITS-1), y<width - p->leftoffset; for (i = 0; i < 16; i++) { - V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH)); + V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(centerlump[i & 1], PU_PATCH)); xx += 8; } V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_PATCH)); @@ -4134,7 +4134,7 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) p = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH); for (n = 0; n < boxlines; n++) { - V_DrawScaledPatch(cx, cy, V_WRAPY, p); + V_DrawScaledPatch(cx, cy, 0, p); cy += step; } V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BL], PU_PATCH)); @@ -4146,8 +4146,8 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) cy = y; while (width > 0) { - V_DrawScaledPatch(cx, cy, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH)); - V_DrawScaledPatch(cx, y + boff + boxlines*step, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH)); + V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH)); + V_DrawScaledPatch(cx, y + boff + boxlines*step, 0, W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH)); width--; cx += step; } @@ -4159,7 +4159,7 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) p = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH); for (n = 0; n < boxlines; n++) { - V_DrawScaledPatch(cx, cy, V_WRAPY, p); + V_DrawScaledPatch(cx, cy, 0, p); cy += step; } V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BR], PU_PATCH)); diff --git a/src/p_pspr.h b/src/p_pspr.h index 4525ba14c..27002b713 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -41,9 +41,20 @@ /// \brief Frame flags - SPR2: Super sprite2 #define FF_SPR2SUPER 0x80 /// \brief Frame flags - SPR2: A change of state at the end of Sprite2 animation -#define FF_SPR2ENDSTATE 0x1000 +#define FF_SPR2ENDSTATE 0x100 /// \brief Frame flags - SPR2: 50% of starting in middle of Sprite2 animation -#define FF_SPR2MIDSTART 0x2000 +#define FF_SPR2MIDSTART 0x200 + +/// \brief Frame flags: blend types +#define FF_BLENDMASK 0x7000 +/// \brief shift for FF_BLENDMASK +#define FF_BLENDSHIFT 12 +/// \brief preshifted blend flags minus 1 as effects don't distinguish between AST_COPY and AST_TRANSLUCENT +#define FF_ADD ((AST_ADD-1)<= MAXLIGHTSCALE) lindex = MAXLIGHTSCALE-1; + + if (newsprite->cut & SC_SEMIBRIGHT) + lindex = (MAXLIGHTSCALE/2) + (lindex >>1); + newsprite->colormap = spritelights[lindex]; } } @@ -2023,6 +2027,8 @@ static void R_ProjectSprite(mobj_t *thing) if (R_ThingIsFullBright(oldthing) || oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) vis->cut |= SC_FULLBRIGHT; + else if (R_ThingIsSemiBright(oldthing)) + vis->cut |= SC_SEMIBRIGHT; else if (R_ThingIsFullDark(oldthing)) vis->cut |= SC_FULLDARK; @@ -2045,6 +2051,9 @@ static void R_ProjectSprite(mobj_t *thing) if (lindex >= MAXLIGHTSCALE) lindex = MAXLIGHTSCALE-1; + if (vis->cut & SC_SEMIBRIGHT) + lindex = (MAXLIGHTSCALE/2) + (lindex >> 1); + vis->colormap = spritelights[lindex]; } @@ -3012,7 +3021,7 @@ boolean R_ThingVisible (mobj_t *thing) { return (!( thing->sprite == SPR_NULL || - ( thing->flags2 & (MF2_DONTDRAW) ) || + ( thing->flags2 & (MF2_DONTDRAW) ) || ( thing->renderflags & (RF_DONTDRAW) ) || (r_viewmobj && (thing == r_viewmobj || (r_viewmobj->player && r_viewmobj->player->followmobj == thing))) )); } @@ -3073,17 +3082,22 @@ boolean R_ThingIsPaperSprite(mobj_t *thing) boolean R_ThingIsFloorSprite(mobj_t *thing) { - return (thing->flags2 & MF2_SPLAT || thing->renderflags & RF_FLOORSPRITE); + return (thing->flags2 & MF2_SPLAT || thing->frame & FF_FLOORSPRITE || thing->renderflags & RF_FLOORSPRITE); } boolean R_ThingIsFullBright(mobj_t *thing) { - return (thing->frame & FF_FULLBRIGHT || thing->renderflags & RF_FULLBRIGHT); + return ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT || (thing->renderflags & RF_BRIGHTMASK) == RF_FULLBRIGHT); +} + +boolean R_ThingIsSemiBright(mobj_t *thing) +{ + return ((thing->frame & FF_BRIGHTMASK) == FF_SEMIBRIGHT || (thing->renderflags & RF_BRIGHTMASK) == RF_SEMIBRIGHT); } boolean R_ThingIsFullDark(mobj_t *thing) { - return (thing->renderflags & RF_FULLDARK); + return ((thing->frame & FF_BRIGHTMASK) == FF_FULLDARK || (thing->renderflags & RF_BRIGHTMASK) == RF_FULLDARK); } // diff --git a/src/r_things.h b/src/r_things.h index 79dc80d94..b1ff32b1e 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -82,6 +82,7 @@ boolean R_ThingIsPaperSprite (mobj_t *thing); boolean R_ThingIsFloorSprite (mobj_t *thing); boolean R_ThingIsFullBright (mobj_t *thing); +boolean R_ThingIsSemiBright (mobj_t *thing); boolean R_ThingIsFullDark (mobj_t *thing); // -------------- @@ -123,13 +124,14 @@ typedef enum SC_PRECIP = 1<<2, SC_LINKDRAW = 1<<3, SC_FULLBRIGHT = 1<<4, - SC_FULLDARK = 1<<5, - SC_VFLIP = 1<<6, - SC_ISSCALED = 1<<7, - SC_ISROTATED = 1<<8, - SC_SHADOW = 1<<9, - SC_SHEAR = 1<<10, - SC_SPLAT = 1<<11, + SC_SEMIBRIGHT = 1<<5, + SC_FULLDARK = 1<<6, + SC_VFLIP = 1<<7, + SC_ISSCALED = 1<<8, + SC_ISROTATED = 1<<9, + SC_SHADOW = 1<<10, + SC_SHEAR = 1<<11, + SC_SPLAT = 1<<12, // masks SC_CUTMASK = SC_TOP|SC_BOTTOM, SC_FLAGMASK = ~SC_CUTMASK diff --git a/src/v_video.c b/src/v_video.c index c39938544..ad0164816 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -540,11 +540,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca v_translevel = NULL; if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) { - if (alphalevel == 13) + if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; - else if (alphalevel == 14) + else if (alphalevel == 11) alphalevel = 10 - st_translucency; - else if (alphalevel == 15) + else if (alphalevel == 12) alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) @@ -591,10 +591,6 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca colfrac = FixedDiv(FRACUNIT, fdup); rowfrac = FixedDiv(FRACUNIT, vdup); - // So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible - // For now let's just at least give V_OFFSET the ability to support V_FLIP - // I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff - // -- Monster Iestyn 29/10/18 { fixed_t offsetx = 0, offsety = 0; @@ -605,15 +601,8 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca offsetx = FixedMul(patch->leftoffset<topoffset<> V_ALPHASHIFT))) { - if (alphalevel == 13) + if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; - else if (alphalevel == 14) + else if (alphalevel == 11) alphalevel = 10 - st_translucency; - else if (alphalevel == 15) + else if (alphalevel == 12) alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) @@ -1411,11 +1400,11 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT))) { - if (alphalevel == 13) + if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; - else if (alphalevel == 14) + else if (alphalevel == 11) alphalevel = 10 - st_translucency; - else if (alphalevel == 15) + else if (alphalevel == 12) alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) diff --git a/src/v_video.h b/src/v_video.h index c10ab22ce..bcb39706e 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -122,17 +122,23 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue); #define V_70TRANS 0x00070000 #define V_80TRANS 0x00080000 // used to be V_8020TRANS #define V_90TRANS 0x00090000 -#define V_HUDTRANSHALF 0x000D0000 -#define V_HUDTRANS 0x000E0000 // draw the hud translucent -#define V_HUDTRANSDOUBLE 0x000F0000 +#define V_HUDTRANSHALF 0x000A0000 +#define V_HUDTRANS 0x000B0000 // draw the hud translucent +#define V_HUDTRANSDOUBLE 0x000C0000 // Macros follow #define V_USERHUDTRANSHALF ((10-(cv_translucenthud.value/2))< Date: Mon, 15 Nov 2021 19:07:20 +0100 Subject: [PATCH 43/54] blentran part 2: Sprite & patch blendmodes. --- src/hardware/hw_draw.c | 16 ++++++++++++---- src/hardware/hw_main.c | 32 +++++++++++++++++++++++++------- src/r_things.c | 14 ++++++++++---- src/v_video.c | 22 ++++++++++++++++------ 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 89d43a6b4..e02dbea5b 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -130,6 +130,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p float cx = FIXED_TO_FLOAT(x); float cy = FIXED_TO_FLOAT(y); UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT8 blendmode = ((option & V_BLENDMASK) >> V_BLENDSHIFT); GLPatch_t *hwrPatch; // 3--2 @@ -345,9 +346,12 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p v[0].t = v[1].t = 0.0f; v[2].t = v[3].t = hwrPatch->max_t; - flags = PF_Translucent|PF_NoDepthTest; - // clip it since it is used for bunny scroll in doom I + if (blendmode) + flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest; + else + flags = PF_Translucent|PF_NoDepthTest; + if (alphalevel) { FSurfaceInfo Surf; @@ -371,6 +375,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, float cx = FIXED_TO_FLOAT(x); float cy = FIXED_TO_FLOAT(y); UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT8 blendmode = ((option & V_BLENDMASK) >> V_BLENDSHIFT); GLPatch_t *hwrPatch; // 3--2 @@ -568,8 +573,6 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, else v[2].t = v[3].t = (FIXED_TO_FLOAT(sy+h)/(float)(gpatch->height))*hwrPatch->max_t; - flags = PF_Translucent|PF_NoDepthTest; - // Auto-crop at splitscreen borders! if (splitscreen && (option & V_PERPLAYER)) { @@ -641,6 +644,11 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, } // clip it since it is used for bunny scroll in doom I + if (blendmode) + flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest; + else + flags = PF_Translucent|PF_NoDepthTest; + if (alphalevel) { FSurfaceInfo Surf; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c5e5a3218..63f1191ca 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3853,6 +3853,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) else occlusion = PF_Occlude; + INT32 blendmode; + if (spr->mobj->frame & FF_BLENDMASK) + blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = spr->mobj->blendmode; + if (!cv_translucency.value) // translucency disabled { Surf.PolyColor.s.alpha = 0xFF; @@ -3862,12 +3868,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) else if (spr->mobj->flags2 & MF2_SHADOW) { Surf.PolyColor.s.alpha = 0x40; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode); + blend = HWR_GetBlendModeFlag(blendmode); } else if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); + blend = HWR_SurfaceBlend(blendmode, trans, &Surf); } else { @@ -3876,7 +3882,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // Hurdler: PF_Environement would be cool, but we need to fix // the issue with the fog before Surf.PolyColor.s.alpha = 0xFF; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|occlusion; + blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } @@ -4291,6 +4297,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else occlusion = PF_Occlude; + INT32 blendmode; + if (spr->mobj->frame & FF_BLENDMASK) + blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = spr->mobj->blendmode; + if (!cv_translucency.value) // translucency disabled { Surf.PolyColor.s.alpha = 0xFF; @@ -4300,12 +4312,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else if (spr->mobj->flags2 & MF2_SHADOW) { Surf.PolyColor.s.alpha = 0x40; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode); + blend = HWR_GetBlendModeFlag(blendmode); } else if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); + blend = HWR_SurfaceBlend(blendmode, trans, &Surf); } else { @@ -4314,7 +4326,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) // Hurdler: PF_Environement would be cool, but we need to fix // the issue with the fog before Surf.PolyColor.s.alpha = 0xFF; - blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|occlusion; + blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } @@ -5009,10 +5021,16 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->spritexscale < 1 || thing->spriteyscale < 1) return; + INT32 blendmode; + if (thing->frame & FF_BLENDMASK) + blendmode = ((thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = thing->blendmode; + // Visibility check by the blend mode. if (thing->frame & FF_TRANSMASK) { - if (!R_BlendLevelVisible(thing->blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)) + if (!R_BlendLevelVisible(blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)) return; } diff --git a/src/r_things.c b/src/r_things.c index 5d5be8753..accd1e2b3 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1802,13 +1802,19 @@ static void R_ProjectSprite(mobj_t *thing) return; } + INT32 blendmode; + if (oldthing->frame & FF_BLENDMASK) + blendmode = ((oldthing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = oldthing->blendmode; + // Determine the translucency value. if (oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK else if (oldthing->frame & FF_TRANSMASK) { trans = (oldthing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT; - if (!R_BlendLevelVisible(oldthing->blendmode, trans)) + if (!R_BlendLevelVisible(blendmode, trans)) return; } else @@ -2020,8 +2026,8 @@ static void R_ProjectSprite(mobj_t *thing) vis->scale += FixedMul(scalestep, spriteyscale) * (vis->x1 - x1); } - if ((oldthing->blendmode != AST_COPY) && cv_translucency.value) - vis->transmap = R_GetBlendTable(oldthing->blendmode, trans); + if ((blendmode != AST_COPY) && cv_translucency.value) + vis->transmap = R_GetBlendTable(blendmode, trans); else vis->transmap = NULL; @@ -3021,7 +3027,7 @@ boolean R_ThingVisible (mobj_t *thing) { return (!( thing->sprite == SPR_NULL || - ( thing->flags2 & (MF2_DONTDRAW) ) || ( thing->renderflags & (RF_DONTDRAW) ) || + ( thing->flags2 & (MF2_DONTDRAW) ) || (r_viewmobj && (thing == r_viewmobj || (r_viewmobj->player && r_viewmobj->player->followmobj == thing))) )); } diff --git a/src/v_video.c b/src/v_video.c index ad0164816..12588f9c2 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -511,7 +511,8 @@ static inline UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fix void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap) { UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t); - UINT32 alphalevel = 0; + UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT); fixed_t col, ofs, colfrac, rowfrac, fdup, vdup; INT32 dupx, dupy; @@ -538,7 +539,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca patchdrawfunc = standardpdraw; v_translevel = NULL; - if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) + if (alphalevel) { if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; @@ -552,7 +553,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca if (alphalevel) { - v_translevel = R_GetTranslucencyTable(alphalevel); + if (blendmode) + v_translevel = R_GetBlendTable(blendmode+1, alphalevel); + else + v_translevel = R_GetTranslucencyTable(alphalevel); + patchdrawfunc = translucentpdraw; } } @@ -801,7 +806,8 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h) { UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t); - UINT32 alphalevel = 0; + UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT); + UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT); // boolean flip = false; fixed_t col, ofs, colfrac, rowfrac, fdup, vdup; @@ -827,7 +833,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN patchdrawfunc = standardpdraw; v_translevel = NULL; - if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) + if (alphalevel) { if (alphalevel == 10) alphalevel = hudminusalpha[st_translucency]; @@ -841,7 +847,11 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN if (alphalevel) { - v_translevel = R_GetTranslucencyTable(alphalevel); + if (blendmode) + v_translevel = R_GetBlendTable(blendmode+1, alphalevel); + else + v_translevel = R_GetTranslucencyTable(alphalevel); + patchdrawfunc = translucentpdraw; } } From f455bf347beea6c9a96c2865fb8b7228d4ea810d Mon Sep 17 00:00:00 2001 From: sphere Date: Fri, 19 Nov 2021 19:01:41 +0100 Subject: [PATCH 44/54] blentran part 3: Wall & plane blendmodes. --- src/hardware/hw_main.c | 68 ++++++++++++++++++++++++++---------------- src/lua_maplib.c | 8 +++++ src/p_setup.c | 39 +++++++++++++++--------- src/p_spec.c | 11 ++++++- src/r_defs.h | 2 ++ src/r_draw.c | 3 ++ src/r_plane.c | 32 +++++++------------- src/r_segs.c | 43 ++++++++++++-------------- 8 files changed, 120 insertions(+), 86 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 63f1191ca..a1dd53eb7 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -556,7 +556,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool HWR_Lighting(&Surf, lightlevel, planecolormap); - if (PolyFlags & (PF_Translucent|PF_Fog)) + if (PolyFlags & (PF_Translucent|PF_Fog|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) { Surf.PolyColor.s.alpha = (UINT8)alpha; PolyFlags |= PF_Modulated; @@ -980,8 +980,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, if (cutflag & FF_FOG) HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); - else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); + else if (polyflags & (PF_Translucent|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) + HWR_AddTransparentWall(wallVerts, Surf, texnum, polyflags, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); @@ -1009,8 +1009,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, if (cutflag & FF_FOG) HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); - else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); + else if (polyflags & (PF_Translucent|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) + HWR_AddTransparentWall(wallVerts, Surf, texnum, polyflags, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); } @@ -1264,6 +1264,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } + gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture); if (gl_midtexture) { @@ -1453,10 +1454,20 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom case 221: case 253: case 256: - blendmode = PF_Translucent; + if (gl_linedef->blendmode) + blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + else + blendmode = PF_Translucent; break; default: - if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) + if (gl_linedef->blendmode) + { + if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) + blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + else + blendmode = HWR_GetBlendModeFlag(gl_linedef->blendmode); + } + else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf); else blendmode = PF_Masked; @@ -1481,11 +1492,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (gl_frontsector->numlights) { if (!(blendmode & PF_Masked)) - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, PF_Decal); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, blendmode); else - { - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, PF_Decal); - } + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, blendmode); } else if (!(blendmode & PF_Masked)) HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap); @@ -1745,7 +1754,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, blendmode); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1753,14 +1762,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { FBITFIELD blendmode = PF_Masked; - if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) + if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { - blendmode = PF_Translucent; + blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent; Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1; } if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, blendmode); else { if (blendmode != PF_Masked) @@ -1868,7 +1877,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gl_backsector->numlights) - HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, blendmode); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1876,14 +1885,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { FBITFIELD blendmode = PF_Masked; - if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) + if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { - blendmode = PF_Translucent; + blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent; Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1; } if (gl_backsector->numlights) - HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, 0); + HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, blendmode); else { if (blendmode != PF_Masked) @@ -2960,6 +2969,13 @@ static void HWR_AddPolyObjectPlanes(void) } } +static FBITFIELD HWR_RippleBlend(sector_t *sector, ffloor_t *rover, boolean ceiling) +{ + (void)sector; + (void)ceiling; + return /*R_IsRipplePlane(sector, rover, ceiling)*/ (rover->flags & FF_RIPPLE) ? PF_Ripple : 0; +} + // -----------------+ // HWR_Subsector : Determine floor/ceiling planes. // : Add sprites of things in sector. @@ -3150,7 +3166,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, rover->master->frontsector->extra_colormap); } - else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient + else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) // SoM: Flags are more efficient { light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); @@ -3159,14 +3175,15 @@ static void HWR_Subsector(size_t num) false, *rover->bottomheight, *gl_frontsector->lightlist[light].lightlevel, - rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, + rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, + HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, *gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetLevelFlat(&levelflats[*rover->bottompic]); light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], + HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } @@ -3195,7 +3212,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, rover->master->frontsector->extra_colormap); } - else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) + else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); @@ -3204,14 +3221,15 @@ static void HWR_Subsector(size_t num) true, *rover->topheight, *gl_frontsector->lightlist[light].lightlevel, - rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent, + rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, + HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, *gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetLevelFlat(&levelflats[*rover->toppic]); light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], + HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 9031c99f1..04e6fde8d 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -196,6 +196,7 @@ enum ffloor_e { ffloor_next, ffloor_prev, ffloor_alpha, + ffloor_blend, }; static const char *const ffloor_opt[] = { @@ -214,6 +215,7 @@ static const char *const ffloor_opt[] = { "next", "prev", "alpha", + "blend", NULL}; #ifdef HAVE_LUA_SEGS @@ -1807,6 +1809,9 @@ static int ffloor_get(lua_State *L) case ffloor_alpha: lua_pushinteger(L, ffloor->alpha); return 1; + case ffloor_blend: + lua_pushinteger(L, ffloor->blend); + return 1; } return 0; } @@ -1885,6 +1890,9 @@ static int ffloor_set(lua_State *L) case ffloor_alpha: ffloor->alpha = (INT32)luaL_checkinteger(L, 3); break; + case ffloor_blend: + ffloor->blend = (INT32)luaL_checkinteger(L, 3); + break; } return 0; } diff --git a/src/p_setup.c b/src/p_setup.c index 7f9674e4e..591b446c8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1350,8 +1350,11 @@ static void P_LoadSidedefs(UINT8 *data) if (msd->toptexture[0] == '#') { char *col = msd->toptexture; - sd->toptexture = sd->bottomtexture = - ((col[1]-'0')*100 + (col[2]-'0')*10 + col[3]-'0') + 1; + sd->toptexture = + ((col[1]-'0')*100 + (col[2]-'0')*10 + col[3]-'0')+1; + if (col[4]) // extra num for blendmode + sd->toptexture += (col[4]-'0')*1000; + sd->bottomtexture = sd->toptexture; sd->midtexture = R_TextureNumForName(msd->midtexture); } else @@ -3321,22 +3324,30 @@ static void P_ConvertBinaryMap(void) lines[i].args[4] |= TMSC_BACKTOFRONTCEILING; lines[i].special = 720; break; - - case 900: //Translucent wall (10%) - case 901: //Translucent wall (20%) - case 902: //Translucent wall (30%) - case 903: //Translucent wall (40%) - case 904: //Translucent wall (50%) - case 905: //Translucent wall (60%) - case 906: //Translucent wall (70%) - case 907: //Translucent wall (80%) - case 908: //Translucent wall (90%) - lines[i].alpha = ((909 - lines[i].special) << FRACBITS)/10; - break; default: break; } + // Set alpha for translucent walls + if (lines[i].special >= 900 && lines[i].special < 909) + lines[i].alpha = ((909 - lines[i].special) << FRACBITS)/10; + + // Set alpha for additive/subtractive/reverse subtractive walls + if (lines[i].special >= 910 && lines[i].special <= 939) + lines[i].alpha = ((10 - lines[i].special % 10) << FRACBITS)/10; + + if (lines[i].special >= 910 && lines[i].special <= 919) // additive + lines[i].blendmode = AST_ADD; + + if (lines[i].special >= 920 && lines[i].special <= 929) // subtractive + lines[i].blendmode = AST_SUBTRACT; + + if (lines[i].special >= 930 && lines[i].special <= 939) // reverse subtractive + lines[i].blendmode = AST_REVERSESUBTRACT; + + if (lines[i].special == 940) // modulate + lines[i].blendmode = AST_MODULATE; + //Linedef executor delay if (lines[i].special >= 400 && lines[i].special < 500) { diff --git a/src/p_spec.c b/src/p_spec.c index 07410efa2..ebabe6a79 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5601,7 +5601,16 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f if (flags & FF_TRANSLUCENT) { if (sides[master->sidenum[0]].toptexture > 0) - fflr->alpha = sides[master->sidenum[0]].toptexture; // for future reference, "#0" is 1, and "#255" is 256. Be warned + { + // for future reference, "#0" is 1, and "#255" is 256. Be warned + fflr->alpha = sides[master->sidenum[0]].toptexture; + + if (fflr->alpha >= 1001) // fourth digit + { + fflr->blend = (fflr->alpha/1000)+1; // becomes an AST + fflr->alpha %= 1000; + } + } else fflr->alpha = 0x80; } diff --git a/src/r_defs.h b/src/r_defs.h index f4ab58295..3c2178937 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -184,6 +184,7 @@ typedef struct ffloor_s INT32 lastlight; INT32 alpha; + UINT8 blend; // blendmode tic_t norender; // for culling // these are saved for netgames, so do not let Lua touch these! @@ -397,6 +398,7 @@ typedef struct line_s // Visual appearance: sidedefs. UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided fixed_t alpha; // translucency + UINT8 blendmode; // blendmode INT32 executordelay; fixed_t bbox[4]; // bounding box for the extent of the linedef diff --git a/src/r_draw.c b/src/r_draw.c index f0a19a462..65bb87bfb 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -248,6 +248,9 @@ static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt) result.s.green = max(0, result.s.green - blendamt); result.s.blue = max(0, result.s.blue - blendamt); + //probably incorrect, but does look better at lower opacity... + //result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt); + table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); } } diff --git a/src/r_plane.c b/src/r_plane.c index 45719ce58..d854c2342 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -855,28 +855,16 @@ void R_DrawSinglePlane(visplane_t *pl) spanfunctype = (pl->ffloor->master->flags & ML_EFFECT6) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS; // Hacked up support for alpha value in software mode Tails 09-24-2002 - if (pl->ffloor->alpha < 12) - return; // Don't even draw it - else if (pl->ffloor->alpha < 38) - ds_transmap = R_GetTranslucencyTable(tr_trans90); - else if (pl->ffloor->alpha < 64) - ds_transmap = R_GetTranslucencyTable(tr_trans80); - else if (pl->ffloor->alpha < 89) - ds_transmap = R_GetTranslucencyTable(tr_trans70); - else if (pl->ffloor->alpha < 115) - ds_transmap = R_GetTranslucencyTable(tr_trans60); - else if (pl->ffloor->alpha < 140) - ds_transmap = R_GetTranslucencyTable(tr_trans50); - else if (pl->ffloor->alpha < 166) - ds_transmap = R_GetTranslucencyTable(tr_trans40); - else if (pl->ffloor->alpha < 192) - ds_transmap = R_GetTranslucencyTable(tr_trans30); - else if (pl->ffloor->alpha < 217) - ds_transmap = R_GetTranslucencyTable(tr_trans20); - else if (pl->ffloor->alpha < 243) - ds_transmap = R_GetTranslucencyTable(tr_trans10); - else // Opaque, but allow transparent flat pixels - spanfunctype = SPANDRAWFUNC_SPLAT; + // ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021 + { + INT32 trans = (10*((256+12) - pl->ffloor->alpha))/255; + if (trans >= 10) + return; // Don't even draw it + if (pl->ffloor->blend) // additive, (reverse) subtractive, modulative + ds_transmap = R_GetBlendTable(pl->ffloor->blend, trans); + else if (!(ds_transmap = R_GetTranslucencyTable(trans))) + spanfunctype = SPANDRAWFUNC_SPLAT; // Opaque, but allow transparent flat pixels + } if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG))) light = (pl->lightlevel >> LIGHTSEGSHIFT); diff --git a/src/r_segs.c b/src/r_segs.c index a8c85ec33..4460f9f90 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -155,11 +155,18 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (!ldef->alpha) return; - if (ldef->alpha > 0 && ldef->alpha < FRACUNIT) + if (ldef->blendmode) + { + if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE) + dc_transmap = R_GetBlendTable(ldef->blendmode, 0); + else + dc_transmap = R_GetBlendTable(ldef->blendmode, R_GetLinedefTransTable(ldef->alpha)); + colfunc = colfuncs[COLDRAWFUNC_FUZZY]; + } + else if (ldef->alpha > 0 && ldef->alpha < FRACUNIT) { dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha)); colfunc = colfuncs[COLDRAWFUNC_FUZZY]; - } else if (ldef->special == 909) { @@ -600,28 +607,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) boolean fuzzy = true; // Hacked up support for alpha value in software mode Tails 09-24-2002 - if (pfloor->alpha < 12) - return; // Don't even draw it - else if (pfloor->alpha < 38) - dc_transmap = R_GetTranslucencyTable(tr_trans90); - else if (pfloor->alpha < 64) - dc_transmap = R_GetTranslucencyTable(tr_trans80); - else if (pfloor->alpha < 89) - dc_transmap = R_GetTranslucencyTable(tr_trans70); - else if (pfloor->alpha < 115) - dc_transmap = R_GetTranslucencyTable(tr_trans60); - else if (pfloor->alpha < 140) - dc_transmap = R_GetTranslucencyTable(tr_trans50); - else if (pfloor->alpha < 166) - dc_transmap = R_GetTranslucencyTable(tr_trans40); - else if (pfloor->alpha < 192) - dc_transmap = R_GetTranslucencyTable(tr_trans30); - else if (pfloor->alpha < 217) - dc_transmap = R_GetTranslucencyTable(tr_trans20); - else if (pfloor->alpha < 243) - dc_transmap = R_GetTranslucencyTable(tr_trans10); - else - fuzzy = false; // Opaque + // ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021 + { + INT32 trans = (10*((256+12) - pfloor->alpha))/255; + if (trans >= 10) + return; // Don't even draw it + if (pfloor->blend) // additive, (reverse) subtractive, modulative + dc_transmap = R_GetBlendTable(pfloor->blend, trans); + else if (!(dc_transmap = R_GetTranslucencyTable(trans))) + fuzzy = false; // Opaque + } if (fuzzy) colfunc = colfuncs[COLDRAWFUNC_FUZZY]; From 84dfea458033456deb5cb9ab35a54b50b730ee02 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 12 Dec 2021 06:54:48 +0100 Subject: [PATCH 45/54] Add new blendmode linedef types to config --- extras/conf/SRB2-22.cfg | 186 +++++++++++++++++++ extras/conf/udb/Includes/SRB222_linedefs.cfg | 155 ++++++++++++++++ 2 files changed, 341 insertions(+) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 4ed68e1ca..2b4bdbcd7 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -3251,6 +3251,192 @@ linedeftypes title = "Fog Wall"; prefix = "(909)"; } + + 910 + { + title = "100% Additive"; + prefix = "(910)"; + } + + 911 + { + title = "90% Additive"; + prefix = "(911)"; + } + + 912 + { + title = "80% Additive"; + prefix = "(912)"; + } + + 913 + { + title = "70% Additive"; + prefix = "(913)"; + } + + 914 + { + title = "60% Additive"; + prefix = "(914)"; + } + + 915 + { + title = "50% Additive"; + prefix = "(915)"; + } + + 916 + { + title = "40% Additive"; + prefix = "(916)"; + } + + 917 + { + title = "30% Additive"; + prefix = "(917)"; + } + + 918 + { + title = "20% Additive"; + prefix = "(918)"; + } + + 919 + { + title = "10% Additive"; + prefix = "(919)"; + } + + 920 + { + title = "100% Subtractive"; + prefix = "(920)"; + } + + 921 + { + title = "90% Subtractive"; + prefix = "(921)"; + } + + 922 + { + title = "80% Subtractive"; + prefix = "(922)"; + } + + 923 + { + title = "70% Subtractive"; + prefix = "(923)"; + } + + 924 + { + title = "60% Subtractive"; + prefix = "(924)"; + } + + 925 + { + title = "50% Subtractive"; + prefix = "(925)"; + } + + 926 + { + title = "40% Subtractive"; + prefix = "(926)"; + } + + 927 + { + title = "30% Subtractive"; + prefix = "(927)"; + } + + 928 + { + title = "20% Subtractive"; + prefix = "(928)"; + } + + 929 + { + title = "10% Subtractive"; + prefix = "(929)"; + } + + 930 + { + title = "100% Reverse Subtractive"; + prefix = "(930)"; + } + + 931 + { + title = "90% Reverse Subtractive"; + prefix = "(931)"; + } + + 932 + { + title = "80% Reverse Subtractive"; + prefix = "(932)"; + } + + 933 + { + title = "70% Reverse Subtractive"; + prefix = "(933)"; + } + + 934 + { + title = "60% Reverse Subtractive"; + prefix = "(934)"; + } + + 935 + { + title = "50% Reverse Subtractive"; + prefix = "(935)"; + } + + 936 + { + title = "40% Reverse Subtractive"; + prefix = "(936)"; + } + + 937 + { + title = "30% Reverse Subtractive"; + prefix = "(937)"; + } + + 938 + { + title = "20% Reverse Subtractive"; + prefix = "(938)"; + } + + 939 + { + title = "10% Reverse Subtractive"; + prefix = "(939)"; + } + + 940 + { + title = "Modulate"; + prefix = "(940)"; + } } } diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 1f87c2c3a..c6b0cb1c8 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -1500,6 +1500,161 @@ doom title = "Fog Wall"; prefix = "(909)"; } + 910 + { + title = "100% Additive"; + prefix = "(910)"; + } + 911 + { + title = "90% Additive"; + prefix = "(911)"; + } + 912 + { + title = "80% Additive"; + prefix = "(912)"; + } + 913 + { + title = "70% Additive"; + prefix = "(913)"; + } + 914 + { + title = "60% Additive"; + prefix = "(914)"; + } + 915 + { + title = "50% Additive"; + prefix = "(915)"; + } + 916 + { + title = "40% Additive"; + prefix = "(916)"; + } + 917 + { + title = "30% Additive"; + prefix = "(917)"; + } + 918 + { + title = "20% Additive"; + prefix = "(918)"; + } + 919 + { + title = "10% Additive"; + prefix = "(919)"; + } + 920 + { + title = "100% Subtractive"; + prefix = "(920)"; + } + 921 + { + title = "90% Subtractive"; + prefix = "(921)"; + } + 922 + { + title = "80% Subtractive"; + prefix = "(922)"; + } + 923 + { + title = "70% Subtractive"; + prefix = "(923)"; + } + 924 + { + title = "60% Subtractive"; + prefix = "(924)"; + } + 925 + { + title = "50% Subtractive"; + prefix = "(925)"; + } + 926 + { + title = "40% Subtractive"; + prefix = "(926)"; + } + 927 + { + title = "30% Subtractive"; + prefix = "(927)"; + } + 928 + { + title = "20% Subtractive"; + prefix = "(928)"; + } + 929 + { + title = "10% Subtractive"; + prefix = "(929)"; + } + 930 + { + title = "100% Reverse Subtractive"; + prefix = "(930)"; + } + 931 + { + title = "90% Reverse Subtractive"; + prefix = "(931)"; + } + 932 + { + title = "80% Reverse Subtractive"; + prefix = "(932)"; + } + 933 + { + title = "70% Reverse Subtractive"; + prefix = "(933)"; + } + 934 + { + title = "60% Reverse Subtractive"; + prefix = "(934)"; + } + 935 + { + title = "50% Reverse Subtractive"; + prefix = "(935)"; + } + 936 + { + title = "40% Reverse Subtractive"; + prefix = "(936)"; + } + 937 + { + title = "30% Reverse Subtractive"; + prefix = "(937)"; + } + 938 + { + title = "20% Reverse Subtractive"; + prefix = "(938)"; + } + 939 + { + title = "10% Reverse Subtractive"; + prefix = "(939)"; + } + 940 + { + title = "Modulate"; + prefix = "(940)"; + } } } From 3b08a1586057c2b037625f91537465c86b84de3a Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 12 Dec 2021 07:02:17 +0100 Subject: [PATCH 46/54] Expose blendmodes to UDMF --- extras/conf/udb/Includes/SRB222_common.cfg | 4 ++-- extras/conf/udb/Includes/SRB222_misc.cfg | 9 ++++++--- src/p_setup.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_common.cfg b/extras/conf/udb/Includes/SRB222_common.cfg index d67835aeb..b752e3654 100644 --- a/extras/conf/udb/Includes/SRB222_common.cfg +++ b/extras/conf/udb/Includes/SRB222_common.cfg @@ -264,10 +264,10 @@ mapformat_udmf } // LINEDEF RENDERSTYLES - /*linedefrenderstyles + linedefrenderstyles { include("SRB222_misc.cfg", "linedefrenderstyles"); - }*/ + } // THING FLAGS thingflags diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 68629149e..1b4fb4b4b 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -63,11 +63,14 @@ linedefflags_udmf transfer = "Transfer Line"; } -/*linedefrenderstyles +linedefrenderstyles { translucent = "Translucent"; - fog = "Fog"; -}*/ + add = "Add"; + subtract = "Subtract"; + reversesubtract = "Reverse subtract"; + modulate = "Modulate"; +} sectorflags { diff --git a/src/p_setup.c b/src/p_setup.c index 591b446c8..9a2e14cab 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1701,6 +1701,19 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) lines[i].sidenum[1] = atol(val); else if (fastcmp(param, "alpha")) lines[i].alpha = FLOAT_TO_FIXED(atof(val)); + else if (fastcmp(param, "blendmode") || fastcmp(param, "renderstyle")) + { + if (fastcmp(val, "translucent")) + lines[i].blendmode = AST_COPY; + else if (fastcmp(val, "add")) + lines[i].blendmode = AST_ADD; + else if (fastcmp(val, "subtract")) + lines[i].blendmode = AST_SUBTRACT; + else if (fastcmp(val, "reversesubtract")) + lines[i].blendmode = AST_REVERSESUBTRACT; + else if (fastcmp(val, "modulate")) + lines[i].blendmode = AST_MODULATE; + } else if (fastcmp(param, "executordelay")) lines[i].executordelay = atol(val); From 8c17bb57e68305afae177096fc9d9bd34edd69cb Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 31 Dec 2021 15:00:27 +0100 Subject: [PATCH 47/54] Turn the fog wall linedef type into a blendmode --- extras/conf/udb/Includes/SRB222_misc.cfg | 1 + src/deh_tables.c | 1 + src/hardware/hw_main.c | 4 ++-- src/p_setup.c | 5 +++++ src/r_defs.h | 2 +- src/r_segs.c | 14 +++++++------- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 1b4fb4b4b..50c83e456 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -70,6 +70,7 @@ linedefrenderstyles subtract = "Subtract"; reversesubtract = "Reverse subtract"; modulate = "Modulate"; + fog = "Fog"; } sectorflags diff --git a/src/deh_tables.c b/src/deh_tables.c index 730ae959b..cfc98f631 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4898,6 +4898,7 @@ struct int_const_s const INT_CONST[] = { {"AST_REVERSESUBTRACT",AST_REVERSESUBTRACT}, {"AST_MODULATE",AST_MODULATE}, {"AST_OVERLAY",AST_OVERLAY}, + {"AST_FOG",AST_FOG}, // Render flags {"RF_HORIZONTALFLIP",RF_HORIZONTALFLIP}, diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a1dd53eb7..13b2a39c3 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1454,13 +1454,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom case 221: case 253: case 256: - if (gl_linedef->blendmode) + if (gl_linedef->blendmode != AST_FOG) blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); else blendmode = PF_Translucent; break; default: - if (gl_linedef->blendmode) + if (gl_linedef->blendmode != AST_FOG) { if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); diff --git a/src/p_setup.c b/src/p_setup.c index 9a2e14cab..4f21922a0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1713,6 +1713,8 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) lines[i].blendmode = AST_REVERSESUBTRACT; else if (fastcmp(val, "modulate")) lines[i].blendmode = AST_MODULATE; + if (fastcmp(val, "fog")) + lines[i].blendmode = AST_FOG; } else if (fastcmp(param, "executordelay")) lines[i].executordelay = atol(val); @@ -3337,6 +3339,9 @@ static void P_ConvertBinaryMap(void) lines[i].args[4] |= TMSC_BACKTOFRONTCEILING; lines[i].special = 720; break; + case 909: //Fog wall + lines[i].blendmode = AST_FOG; + break; default: break; } diff --git a/src/r_defs.h b/src/r_defs.h index 3c2178937..fa63de400 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -716,7 +716,7 @@ typedef struct #endif // Possible alpha types for a patch. -enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY}; +enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY, AST_FOG}; typedef enum { diff --git a/src/r_segs.c b/src/r_segs.c index 4460f9f90..2459436b5 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -155,7 +155,13 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (!ldef->alpha) return; - if (ldef->blendmode) + if (ldef->blendmode == AST_FOG) + { + colfunc = colfuncs[COLDRAWFUNC_FOG]; + windowtop = frontsector->ceilingheight; + windowbottom = frontsector->floorheight; + } + else if (ldef->blendmode) { if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE) dc_transmap = R_GetBlendTable(ldef->blendmode, 0); @@ -168,12 +174,6 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha)); colfunc = colfuncs[COLDRAWFUNC_FUZZY]; } - else if (ldef->special == 909) - { - colfunc = colfuncs[COLDRAWFUNC_FOG]; - windowtop = frontsector->ceilingheight; - windowbottom = frontsector->floorheight; - } else colfunc = colfuncs[BASEDRAWFUNC]; From c7281d1801d45036e60bebbaa703af419b3bb20a Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 2 Jan 2022 20:44:24 +0100 Subject: [PATCH 48/54] Fix cyan pixel cutting in Software --- src/r_plane.c | 2 +- src/r_segs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index d854c2342..1f5c0192e 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -862,7 +862,7 @@ void R_DrawSinglePlane(visplane_t *pl) return; // Don't even draw it if (pl->ffloor->blend) // additive, (reverse) subtractive, modulative ds_transmap = R_GetBlendTable(pl->ffloor->blend, trans); - else if (!(ds_transmap = R_GetTranslucencyTable(trans))) + else if (!(ds_transmap = R_GetTranslucencyTable(trans)) || trans == 0) spanfunctype = SPANDRAWFUNC_SPLAT; // Opaque, but allow transparent flat pixels } diff --git a/src/r_segs.c b/src/r_segs.c index 2459436b5..157cf466e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -614,7 +614,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) return; // Don't even draw it if (pfloor->blend) // additive, (reverse) subtractive, modulative dc_transmap = R_GetBlendTable(pfloor->blend, trans); - else if (!(dc_transmap = R_GetTranslucencyTable(trans))) + else if (!(dc_transmap = R_GetTranslucencyTable(trans)) || trans == 0) fuzzy = false; // Opaque } From 5149699def1c54cb4666fb10cce5598687f349da Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 7 Jan 2022 18:00:56 +0100 Subject: [PATCH 49/54] Update VS project files --- src/sdl/Srb2SDL-vc10.vcxproj | 5 ++++ src/sdl/Srb2SDL-vc10.vcxproj.filters | 35 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 105e1def8..d79dde766 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -245,6 +245,7 @@ + @@ -304,6 +305,7 @@ + @@ -415,6 +417,7 @@ + @@ -475,10 +478,12 @@ + + true diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index 404890397..4d2532ca4 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -135,6 +135,16 @@ D_Doom + + D_Doom + + + D_Doom + + + D_Doom + + D_Doom @@ -288,6 +298,9 @@ I_Interface + + I_Interface + I_Interface @@ -402,6 +415,9 @@ P_Play + + P_Play + R_Rend @@ -600,6 +616,16 @@ D_Doom + + D_Doom + + + D_Doom + + + D_Doom + + D_Doom @@ -747,6 +773,9 @@ LUA + + LUA + LUA @@ -792,6 +821,9 @@ M_Misc + + M_Misc + O_Other @@ -852,6 +884,9 @@ P_Play + + P_Play + P_Play From 3248556fa9987c9cbb30893a0657a20581cdcb42 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 7 Jan 2022 18:42:56 +0100 Subject: [PATCH 50/54] Speed up taglist creation --- src/taglist.c | 38 +++++++++++++++++++++++++++++++++++--- src/taglist.h | 1 + 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/taglist.c b/src/taglist.c index ad1b9dc4b..d08750f9b 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -191,6 +191,38 @@ void Taggroup_Add (taggroup_t *garray[], const mtag_t tag, size_t id) group->elements[i] = id; } +static void Taggroup_Add_Init(taggroup_t *garray[], const mtag_t tag, size_t id) +{ + taggroup_t *group; + + if (tag == MTAG_GLOBAL) + return; + + group = garray[(UINT16)tag]; + + if (! in_bit_array(tags_available, tag)) + { + num_tags++; + set_bit_array(tags_available, tag); + } + + // Create group if empty. + if (!group) + group = garray[(UINT16)tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL); + else if (group->elements[group->count - 1] == id) + return; // Don't add duplicates + + group->count++; + + if (group->count > group->capacity) + { + group->capacity = 2 * group->count; + group->elements = Z_Realloc(group->elements, group->capacity * sizeof(size_t), PU_LEVEL, NULL); + } + + group->elements[group->count - 1] = id; +} + static size_t total_elements_with_tag (const mtag_t tag) { return @@ -250,17 +282,17 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id) static void Taglist_AddToSectors (const mtag_t tag, const size_t itemid) { - Taggroup_Add(tags_sectors, tag, itemid); + Taggroup_Add_Init(tags_sectors, tag, itemid); } static void Taglist_AddToLines (const mtag_t tag, const size_t itemid) { - Taggroup_Add(tags_lines, tag, itemid); + Taggroup_Add_Init(tags_lines, tag, itemid); } static void Taglist_AddToMapthings (const mtag_t tag, const size_t itemid) { - Taggroup_Add(tags_mapthings, tag, itemid); + Taggroup_Add_Init(tags_mapthings, tag, itemid); } /// After all taglists have been built for each element (sectors, lines, things), diff --git a/src/taglist.h b/src/taglist.h index d045eb827..ae1a81c89 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -41,6 +41,7 @@ typedef struct { size_t *elements; size_t count; + size_t capacity; } taggroup_t; extern bitarray_t tags_available[]; From 95e909400f90a53a9ee7d83e38e8259cbf2da2b4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 9 Jan 2022 13:45:56 +0100 Subject: [PATCH 51/54] Fix blendmode regression in OpenGL caused by faulty fog wall support --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 13b2a39c3..d2982afe4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1454,13 +1454,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom case 221: case 253: case 256: - if (gl_linedef->blendmode != AST_FOG) + if (gl_linedef->blendmode && gl_linedef->blendmode != AST_FOG) blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); else blendmode = PF_Translucent; break; default: - if (gl_linedef->blendmode != AST_FOG) + if (gl_linedef->blendmode && gl_linedef->blendmode != AST_FOG) { if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); From 2e4c5d1446f312d830b02d2d2d9163d233ca6d88 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 10 Jan 2022 19:32:21 -0600 Subject: [PATCH 52/54] alternate fix to #555 which doesn't crash the game --- src/r_patchrotation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index dae3a7b53..5dbc30286 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -227,10 +227,10 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle ox = (newwidth / 2) + (leftoffset - xpivot); oy = (newheight / 2) + (patch->topoffset - ypivot); - width = (maxx+1 - minx); - height = (maxy+1 - miny); + width = (maxx - minx); + height = (maxy - miny); - if ((unsigned)(width * height) != size) + if ((unsigned)(width * height) > size) { UINT16 *src, *dest; From 93512ae9f9c39363f0b9da9eac7fbb8fd8ec3443 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 12 Jan 2022 00:46:24 +0100 Subject: [PATCH 53/54] Update Zone Builder configuration. --- extras/conf/SRB2-22.cfg | 92 +++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 2b4bdbcd7..b780ff75f 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -1091,6 +1091,7 @@ linedeftypes { title = "Water, Opaque"; prefix = "(120)"; + flags2text = "[1] Make lava intangible"; flags8text = "[3] Slope skew sides"; flags64text = "[6] Use two light levels"; flags512text = "[9] Use target light level"; @@ -1106,6 +1107,7 @@ linedeftypes { title = "Water, Translucent"; prefix = "(121)"; + flags2text = "[1] Make lava intangible"; flags8text = "[3] Slope skew sides"; flags64text = "[6] Use two light levels"; flags512text = "[9] Use target light level"; @@ -1122,6 +1124,7 @@ linedeftypes { title = "Water, Opaque, No Sides"; prefix = "(122)"; + flags2text = "[1] Make lava intangible"; flags64text = "[6] Use two light levels"; flags512text = "[9] Use target light level"; flags1024text = "[10] Ripple effect"; @@ -1136,6 +1139,7 @@ linedeftypes { title = "Water, Translucent, No Sides"; prefix = "(123)"; + flags2text = "[1] Make lava intangible"; flags64text = "[6] Use two light levels"; flags512text = "[9] Use target light level"; flags1024text = "[10] Ripple effect"; @@ -1151,6 +1155,7 @@ linedeftypes { title = "Goo Water, Translucent"; prefix = "(124)"; + flags2text = "[1] Make lava intangible"; flags8text = "[3] Slope skew sides"; flags64text = "[6] Use two light levels"; flags512text = "[9] Use target light level"; @@ -1167,6 +1172,7 @@ linedeftypes { title = "Goo Water, Translucent, No Sides"; prefix = "(125)"; + flags2text = "[1] Make lava intangible"; flags64text = "[6] Use two light levels"; flags512text = "[9] Use target light level"; flags1024text = "[10] Ripple effect"; @@ -1669,12 +1675,14 @@ linedeftypes { title = "Continuous"; prefix = "(300)"; + flags1024text = "[10] Use faster, unordered execution"; } 301 { title = "Each Time"; prefix = "(301)"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Also trigger on exit"; } @@ -1682,6 +1690,7 @@ linedeftypes { title = "Once"; prefix = "(302)"; + flags1024text = "[10] Use faster, unordered execution"; } 303 @@ -1691,6 +1700,7 @@ linedeftypes flags2text = "[1] Rings greater or equal"; flags64text = "[6] Rings less or equal"; flags512text = "[9] Consider all players"; + flags1024text = "[10] Use faster, unordered execution"; } 304 @@ -1700,18 +1710,21 @@ linedeftypes flags2text = "[1] Rings greater or equal"; flags64text = "[6] Rings less or equal"; flags512text = "[9] Consider all players"; + flags1024text = "[10] Use faster, unordered execution"; } 305 { title = "Character Ability - Continuous"; prefix = "(305)"; + flags1024text = "[10] Use faster, unordered execution"; } 306 { title = "Character Ability - Each Time"; prefix = "(306)"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Also trigger on exit"; } @@ -1719,24 +1732,28 @@ linedeftypes { title = "Character Ability - Once"; prefix = "(307)"; + flags1024text = "[10] Use faster, unordered execution"; } 308 { title = "Race Only - Once"; prefix = "(308)"; + flags1024text = "[10] Use faster, unordered execution"; } 309 { title = "CTF Red Team - Continuous"; prefix = "(309)"; + flags1024text = "[10] Use faster, unordered execution"; } 310 { title = "CTF Red Team - Each Time"; prefix = "(310)"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Also trigger on exit"; } @@ -1744,12 +1761,14 @@ linedeftypes { title = "CTF Blue Team - Continuous"; prefix = "(311)"; + flags1024text = "[10] Use faster, unordered execution"; } 312 { title = "CTF Blue Team - Each Time"; prefix = "(312)"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Also trigger on exit"; } @@ -1757,6 +1776,7 @@ linedeftypes { title = "No More Enemies - Once"; prefix = "(313)"; + flags1024text = "[10] Use faster, unordered execution"; } 314 @@ -1765,6 +1785,7 @@ linedeftypes prefix = "(314)"; flags64text = "[6] Number greater or equal"; flags512text = "[9] Number less"; + flags1024text = "[10] Use faster, unordered execution"; } 315 @@ -1773,30 +1794,35 @@ linedeftypes prefix = "(315)"; flags64text = "[6] Number greater or equal"; flags512text = "[9] Number less"; + flags1024text = "[10] Use faster, unordered execution"; } 317 { title = "Condition Set Trigger - Continuous"; prefix = "(317)"; + flags1024text = "[10] Use faster, unordered execution"; } 318 { title = "Condition Set Trigger - Once"; prefix = "(318)"; + flags1024text = "[10] Use faster, unordered execution"; } 319 { title = "Unlockable - Continuous"; prefix = "(319)"; + flags1024text = "[10] Use faster, unordered execution"; } 320 { title = "Unlockable - Once"; prefix = "(320)"; + flags1024text = "[10] Use faster, unordered execution"; } 321 @@ -1804,6 +1830,7 @@ linedeftypes title = "Trigger After X Calls - Continuous"; prefix = "(321)"; flags64text = "[6] Trigger more than once"; + flags1024text = "[10] Use faster, unordered execution"; } @@ -1812,6 +1839,7 @@ linedeftypes title = "Trigger After X Calls - Each Time"; prefix = "(322)"; flags64text = "[6] Trigger more than once"; + flags1024text = "[10] Use faster, unordered execution"; } 323 @@ -1826,6 +1854,7 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Run if no more mares"; flags32768text = "[15] Run if player is not NiGHTS"; } @@ -1833,6 +1862,7 @@ linedeftypes 324 { title = "NiGHTSerize - Once"; + prefix = "(324)"; flags2text = "[1] Mare >= Front X Offset"; flags8text = "[3] Run only if player is NiGHTS"; flags16text = "[4] Count from lowest of players"; @@ -1841,14 +1871,15 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Run if no more mares"; flags32768text = "[15] Run if player is not NiGHTS"; - prefix = "(324)"; } 325 { title = "De-NiGHTSerize - Each Time"; + prefix = "(325)"; flags2text = "[1] Mare >= Front X Offset"; flags8text = "[3] Run if anyone is NiGHTS"; flags16text = "[4] Count from lowest of players"; @@ -1857,13 +1888,14 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; + flags1024text = "[10] Use faster, unordered execution"; flags32768text = "[15] Run if no one is NiGHTS"; - prefix = "(325)"; } 326 { title = "De-NiGHTSerize - Once"; + prefix = "(326)"; flags2text = "[1] Mare >= Front X Offset"; flags8text = "[3] Run if anyone is NiGHTS"; flags16text = "[4] Count from lowest of players"; @@ -1872,13 +1904,14 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; + flags1024text = "[10] Use faster, unordered execution"; flags32768text = "[15] Run if no one is NiGHTS"; - prefix = "(326)"; } 327 { title = "NiGHTS Lap - Each Time"; + prefix = "(327)"; flags2text = "[1] Mare >= Front X Offset"; flags16text = "[4] Count from lowest of players"; flags32text = "[5] Lap <= Front Y Offset"; @@ -1886,12 +1919,13 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; - prefix = "(327)"; + flags1024text = "[10] Use faster, unordered execution"; } 328 { title = "NiGHTS Lap - Once"; + prefix = "(328)"; flags2text = "[1] Mare >= Front X Offset"; flags16text = "[4] Count from lowest of players"; flags32text = "[5] Lap <= Front Y Offset"; @@ -1899,12 +1933,13 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; - prefix = "(328)"; + flags1024text = "[10] Use faster, unordered execution"; } 329 { title = "Ideya Capture Touch - Each Time"; + prefix = "(329)"; flags2text = "[1] Mare >= Front X Offset"; flags8text = "[3] Run regardless of spheres"; flags16text = "[4] Count from lowest of players"; @@ -1913,14 +1948,15 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Only if not enough spheres"; flags32768text = "[15] Run when entering Capture"; - prefix = "(329)"; } 330 { title = "Ideya Capture Touch - Once"; + prefix = "(330)"; flags2text = "[1] Mare >= Front X Offset"; flags8text = "[3] Run regardless of spheres"; flags16text = "[4] Count from lowest of players"; @@ -1929,57 +1965,64 @@ linedeftypes flags128text = "[7] Lap >= Front Y Offset"; flags256text = "[8] Count laps from Bonus Time"; flags512text = "[9] Count from triggering player"; + flags1024text = "[10] Use faster, unordered execution"; flags16384text = "[14] Only if not enough spheres"; flags32768text = "[15] Run when entering Capture"; - prefix = "(330)"; } 331 { title = "Player Skin - Continuous"; - flags64text = "[6] Disable for this skin"; prefix = "(331)"; + flags64text = "[6] Disable for this skin"; + flags1024text = "[10] Use faster, unordered execution"; } 332 { title = "Player Skin - Each Time"; - flags64text = "[6] Disable for this skin"; prefix = "(332)"; + flags64text = "[6] Disable for this skin"; + flags1024text = "[10] Use faster, unordered execution"; } 333 { title = "Player Skin - Once"; - flags64text = "[6] Disable for this skin"; prefix = "(333)"; + flags64text = "[6] Disable for this skin"; + flags1024text = "[10] Use faster, unordered execution"; } 334 { title = "Object Dye - Continuous"; - flags64text = "[6] Disable for this color"; prefix = "(334)"; + flags64text = "[6] Disable for this color"; + flags1024text = "[10] Use faster, unordered execution"; } 335 { title = "Object Dye - Each Time"; - flags64text = "[6] Disable for this color"; prefix = "(335)"; + flags64text = "[6] Disable for this color"; + flags1024text = "[10] Use faster, unordered execution"; } 336 { title = "Object Dye - Once"; - flags64text = "[6] Disable for this color"; prefix = "(336)"; + flags64text = "[6] Disable for this color"; + flags1024text = "[10] Use faster, unordered execution"; } 399 { title = "Level Load"; prefix = "(399)"; + flags1024text = "[10] Use faster, unordered execution"; } } @@ -2662,7 +2705,7 @@ linedeftypes 502 { - title = "Scroll Tagged Wall"; + title = "Scroll Tagged Walls"; prefix = "(502)"; flags128text = "[7] Use texture offsets"; flags256text = "[8] Scroll back side"; @@ -2670,7 +2713,7 @@ linedeftypes 503 { - title = "Scroll Tagged Wall (Accelerative)"; + title = "Scroll Tagged Walls (Accelerative)"; prefix = "(503)"; flags128text = "[7] Use texture offsets"; flags256text = "[8] Scroll back side"; @@ -2678,7 +2721,7 @@ linedeftypes 504 { - title = "Scroll Tagged Wall (Displacement)"; + title = "Scroll Tagged Walls (Displacement)"; prefix = "(504)"; flags128text = "[7] Use texture offsets"; flags256text = "[8] Scroll back side"; @@ -3112,7 +3155,7 @@ linedeftypes 723 { title = "Copy Backside Floor Slope from Line Tag"; - prefix = "(720)"; + prefix = "(723)"; slope = "copy"; slopeargs = 4; } @@ -3120,7 +3163,7 @@ linedeftypes 724 { title = "Copy Backside Ceiling Slope from Line Tag"; - prefix = "(721)"; + prefix = "(724)"; slope = "copy"; slopeargs = 8; } @@ -3128,7 +3171,7 @@ linedeftypes 725 { title = "Copy Backside Floor and Ceiling Slope from Line Tag"; - prefix = "(722)"; + prefix = "(725)"; slope = "copy"; slopeargs = 12; } @@ -3190,7 +3233,7 @@ linedeftypes transwall { - title = "Translucent Wall"; + title = "Translucent Walls"; 900 { @@ -3966,6 +4009,7 @@ thingtypes sprite = "BUMBA1"; width = 16; height = 32; + flags8text = "[8] Cannot move"; } 124 { @@ -3996,7 +4040,6 @@ thingtypes width = 24; height = 76; flags4text = "[4] End level on death"; - flags8text = "[8] Alternate laser attack"; } 201 { @@ -4031,6 +4074,7 @@ thingtypes height = 60; flags1text = "[1] Grayscale mode"; flags4text = "[4] End level on death"; + flags8text = "[8] Skip intro"; } 206 { @@ -5232,7 +5276,7 @@ thingtypes width = 8; height = 16; hangs = 1; - angletext = "Dripping interval"; + angletext = "Dripping delay"; fixedrotation = 1; } 1003 @@ -5574,6 +5618,8 @@ thingtypes width = 20; height = 72; arrow = 1; + flags4text = "[4] Move right"; + flags8text = "[8] Move left"; } 1128 { @@ -5726,6 +5772,7 @@ thingtypes width = 24; height = 63; arrow = 1; + flags8text = "[8] Not pushable"; } 1217 { @@ -5861,6 +5908,7 @@ thingtypes height = 32; angletext = "Initial delay"; fixedrotation = 1; + hangs = 1; flags8text = "[8] Double size"; } 1305 From 323cfaace966168473fdfe17859bb3249440576c Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 14 Jan 2022 19:40:45 +0100 Subject: [PATCH 54/54] Add blendmode support to FOFs --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 62 ++++- extras/conf/udb/Includes/SRB222_misc.cfg | 64 +++++ src/doomdata.h | 2 +- src/p_setup.c | 201 +++++++-------- src/p_spec.c | 252 ++++++++++--------- src/p_spec.h | 9 + src/r_defs.h | 2 +- 7 files changed, 360 insertions(+), 232 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index be0f3f0f3..e431de70c 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -1910,6 +1910,12 @@ udmf default = 255; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Appearance"; type = 12; @@ -1923,7 +1929,7 @@ udmf 32 = "Cut cyan flat pixels"; } } - arg3 + arg4 { title = "Tangibility"; type = 12; @@ -1946,6 +1952,12 @@ udmf default = 128; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Flags"; type = 12; @@ -2013,12 +2025,18 @@ udmf default = 255; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Tangibility"; type = 12; enum = "tangibility"; } - arg3 + arg4 { title = "Flags"; type = 12; @@ -2048,6 +2066,12 @@ udmf default = 255; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Appearance"; type = 12; @@ -2061,17 +2085,17 @@ udmf 32 = "Cut cyan flat pixels"; } } - arg3 + arg4 { title = "Tangibility"; type = 12; enum = "tangibility"; } - arg4 + arg5 { title = "Speed"; } - arg5 + arg6 { title = "Flags"; type = 12; @@ -2126,6 +2150,12 @@ udmf default = 255; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Appearance"; type = 12; @@ -2212,6 +2242,12 @@ udmf default = 255; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Bustable type"; type = 11; @@ -2223,7 +2259,7 @@ udmf 3 = "Strong"; } } - arg3 + arg4 { title = "Flags"; type = 12; @@ -2235,7 +2271,7 @@ udmf 8 = "Cut cyan flat pixels"; } } - arg4 + arg5 { title = "Linedef executor tag"; type = 15; @@ -2282,6 +2318,12 @@ udmf default = 128; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Flags"; type = 12; @@ -2308,6 +2350,12 @@ udmf default = 255; } arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Flags"; type = 12; diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 50c83e456..7fecf65f7 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -236,6 +236,26 @@ universalfields type = 0; default = 0; } + arg6 + { + type = 0; + default = 0; + } + arg7 + { + type = 0; + default = 0; + } + arg8 + { + type = 0; + default = 0; + } + arg9 + { + type = 0; + default = 0; + } stringarg0 { type = 2; @@ -264,6 +284,41 @@ universalfields thing { + arg5 + { + type = 0; + default = 0; + } + arg6 + { + type = 0; + default = 0; + } + arg7 + { + type = 0; + default = 0; + } + arg8 + { + type = 0; + default = 0; + } + arg9 + { + type = 0; + default = 0; + } + stringarg0 + { + type = 2; + default = ""; + } + stringarg1 + { + type = 2; + default = ""; + } } } @@ -448,6 +503,15 @@ enums 4 = "Don't block players"; 8 = "Don't block non-players"; } + + blendmodes + { + 0 = "Translucent"; + 1 = "Add"; + 2 = "Subtract"; + 3 = "Reverse subtract"; + 4 = "Modulate"; + } } //Default things filters diff --git a/src/doomdata.h b/src/doomdata.h index e317fec1b..630e18615 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -196,7 +196,7 @@ typedef struct #pragma pack() #endif -#define NUMMAPTHINGARGS 6 +#define NUMMAPTHINGARGS 10 #define NUMMAPTHINGSTRINGARGS 2 // Thing definition, position, orientation and type, diff --git a/src/p_setup.c b/src/p_setup.c index 694f15ef7..10bc1dfd3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3117,6 +3117,24 @@ static void P_AddBinaryMapTags(void) } } +static void P_SetBinaryFOFAlpha(line_t *line) +{ + if (sides[line->sidenum[0]].toptexture > 0) + { + line->args[1] = sides[line->sidenum[0]].toptexture; + if (sides[line->sidenum[0]].toptexture >= 1001) + { + line->args[2] = (sides[line->sidenum[0]].toptexture/1000); + line->args[1] %= 1000; + } + } + else + { + line->args[1] = 128; + line->args[2] = TMB_TRANSLUCENT; + } +} + //For maps in binary format, converts setup of specials to UDMF format. static void P_ConvertBinaryMap(void) { @@ -3195,36 +3213,33 @@ static void P_ConvertBinaryMap(void) if (lines[i].special == 102) { if (lines[i].flags & ML_NOCLIMB) - lines[i].args[2] |= TMFA_INSIDES; - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + lines[i].args[3] |= TMFA_INSIDES; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; } else lines[i].args[1] = 255; //Appearance if (lines[i].special == 105) - lines[i].args[2] |= TMFA_NOPLANES|TMFA_NOSIDES; + lines[i].args[3] |= TMFA_NOPLANES|TMFA_NOSIDES; else if (lines[i].special == 104) - lines[i].args[2] |= TMFA_NOSIDES; + lines[i].args[3] |= TMFA_NOSIDES; else if (lines[i].special == 103) - lines[i].args[2] |= TMFA_NOPLANES; + lines[i].args[3] |= TMFA_NOPLANES; if (lines[i].special != 100 && (lines[i].special != 104 || !(lines[i].flags & ML_NOCLIMB))) - lines[i].args[2] |= TMFA_NOSHADE; + lines[i].args[3] |= TMFA_NOSHADE; if (lines[i].flags & ML_EFFECT6) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; //Tangibility if (lines[i].flags & ML_EFFECT1) - lines[i].args[3] |= TMFT_DONTBLOCKOTHERS; + lines[i].args[4] |= TMFT_DONTBLOCKOTHERS; if (lines[i].flags & ML_EFFECT2) - lines[i].args[3] |= TMFT_DONTBLOCKPLAYER; + lines[i].args[4] |= TMFT_DONTBLOCKPLAYER; lines[i].special = 100; break; @@ -3241,35 +3256,32 @@ static void P_ConvertBinaryMap(void) lines[i].args[1] = 255; else { - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[2] |= TMFW_SPLAT; + lines[i].args[3] |= TMFW_SPLAT; } //No sides? if (lines[i].special == 122 || lines[i].special == 123 || lines[i].special == 125) - lines[i].args[2] |= TMFW_NOSIDES; + lines[i].args[3] |= TMFW_NOSIDES; //Flags if (lines[i].flags & ML_NOCLIMB) - lines[i].args[2] |= TMFW_DOUBLESHADOW; + lines[i].args[3] |= TMFW_DOUBLESHADOW; if (lines[i].flags & ML_EFFECT4) - lines[i].args[2] |= TMFW_COLORMAPONLY; + lines[i].args[3] |= TMFW_COLORMAPONLY; if (!(lines[i].flags & ML_EFFECT5)) - lines[i].args[2] |= TMFW_NORIPPLE; + lines[i].args[3] |= TMFW_NORIPPLE; //Goo? if (lines[i].special >= 124) - lines[i].args[2] |= TMFW_GOOWATER; + lines[i].args[3] |= TMFW_GOOWATER; //Splat rendering? if (lines[i].flags & ML_EFFECT6) - lines[i].args[2] |= TMFW_SPLAT; + lines[i].args[3] |= TMFW_SPLAT; lines[i].special = 120; break; @@ -3286,41 +3298,38 @@ static void P_ConvertBinaryMap(void) if (lines[i].special == 141 || lines[i].special == 142 || lines[i].special == 144 || lines[i].special == 145) { if (lines[i].flags & ML_NOCLIMB) - lines[i].args[2] |= TMFA_INSIDES; - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + lines[i].args[3] |= TMFA_INSIDES; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; } else lines[i].args[1] = 255; //Appearance if (lines[i].special == 142 || lines[i].special == 145) - lines[i].args[2] |= TMFA_NOSIDES; + lines[i].args[3] |= TMFA_NOSIDES; else if (lines[i].special == 146) - lines[i].args[2] |= TMFA_NOPLANES; + lines[i].args[3] |= TMFA_NOPLANES; if (lines[i].special != 146 && (lines[i].flags & ML_NOCLIMB)) - lines[i].args[2] |= TMFA_NOSHADE; + lines[i].args[3] |= TMFA_NOSHADE; if (lines[i].flags & ML_EFFECT6) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; //Tangibility if (lines[i].special <= 142) - lines[i].args[3] |= TMFT_INTANGIBLEBOTTOM; + lines[i].args[4] |= TMFT_INTANGIBLEBOTTOM; else if (lines[i].special <= 145) - lines[i].args[3] |= TMFT_INTANGIBLETOP; + lines[i].args[4] |= TMFT_INTANGIBLETOP; else - lines[i].args[3] |= TMFT_INTANGIBLEBOTTOM|TMFT_INTANGIBLETOP; + lines[i].args[4] |= TMFT_INTANGIBLEBOTTOM|TMFT_INTANGIBLETOP; if (lines[i].flags & ML_EFFECT1) - lines[i].args[3] |= TMFT_DONTBLOCKOTHERS; + lines[i].args[4] |= TMFT_DONTBLOCKOTHERS; if (lines[i].flags & ML_EFFECT2) - lines[i].args[3] |= TMFT_DONTBLOCKPLAYER; + lines[i].args[4] |= TMFT_DONTBLOCKPLAYER; lines[i].special = 100; break; @@ -3360,38 +3369,35 @@ static void P_ConvertBinaryMap(void) //Alpha if (lines[i].special >= 174 && lines[i].special <= 175) { - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[3] |= TMFC_SPLAT; + lines[i].args[4] |= TMFC_SPLAT; } else lines[i].args[1] = 255; if (lines[i].special >= 172 && lines[i].special <= 175) { - lines[i].args[2] |= TMFT_INTANGIBLEBOTTOM; + lines[i].args[3] |= TMFT_INTANGIBLEBOTTOM; if (lines[i].flags & ML_NOCLIMB) - lines[i].args[3] |= TMFC_NOSHADE; + lines[i].args[4] |= TMFC_NOSHADE; } if (lines[i].special % 2 == 1) - lines[i].args[3] |= TMFC_NORETURN; + lines[i].args[4] |= TMFC_NORETURN; if (lines[i].special == 176 || lines[i].special == 177 || lines[i].special == 180) - lines[i].args[3] |= TMFC_AIRBOB; + lines[i].args[4] |= TMFC_AIRBOB; if (lines[i].special >= 176 && lines[i].special <= 179) - lines[i].args[3] |= TMFC_FLOATBOB; + lines[i].args[4] |= TMFC_FLOATBOB; if (lines[i].flags & ML_EFFECT6) - lines[i].args[3] |= TMFC_SPLAT; + lines[i].args[4] |= TMFC_SPLAT; if (lines[i].flags & ML_EFFECT1) - lines[i].args[2] |= TMFT_DONTBLOCKOTHERS; + lines[i].args[3] |= TMFT_DONTBLOCKOTHERS; if (lines[i].flags & ML_EFFECT2) - lines[i].args[2] |= TMFT_DONTBLOCKPLAYER; + lines[i].args[3] |= TMFT_DONTBLOCKPLAYER; lines[i].special = 170; break; @@ -3406,44 +3412,41 @@ static void P_ConvertBinaryMap(void) //Translucency if (lines[i].special == 192 || lines[i].special == 195) { - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; } else lines[i].args[1] = 255; //Appearance if (lines[i].special == 193) - lines[i].args[2] |= TMFA_NOPLANES|TMFA_NOSIDES; + lines[i].args[3] |= TMFA_NOPLANES|TMFA_NOSIDES; if (lines[i].special >= 194) - lines[i].args[2] |= TMFA_INSIDES; + lines[i].args[3] |= TMFA_INSIDES; if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB)) - lines[i].args[2] |= TMFA_NOSHADE; + lines[i].args[3] |= TMFA_NOSHADE; if (lines[i].flags & ML_EFFECT6) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; //Tangibility if (lines[i].flags & ML_EFFECT1) - lines[i].args[3] |= TMFT_DONTBLOCKOTHERS; + lines[i].args[4] |= TMFT_DONTBLOCKOTHERS; if (lines[i].flags & ML_EFFECT2) - lines[i].args[3] |= TMFT_DONTBLOCKPLAYER; + lines[i].args[4] |= TMFT_DONTBLOCKPLAYER; if (lines[i].special >= 194) - lines[i].args[3] |= TMFT_INTANGIBLEBOTTOM; + lines[i].args[4] |= TMFT_INTANGIBLEBOTTOM; //Speed - lines[i].args[4] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[5] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; //Flags if (lines[i].flags & ML_BLOCKMONSTERS) - lines[i].args[5] |= TMFR_REVERSE; + lines[i].args[6] |= TMFR_REVERSE; if (lines[i].flags & ML_BLOCKMONSTERS) - lines[i].args[5] |= TMFR_SPINDASH; + lines[i].args[6] |= TMFR_SPINDASH; lines[i].special = 190; break; @@ -3466,27 +3469,24 @@ static void P_ConvertBinaryMap(void) //Alpha if (lines[i].special == 221) { - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; } else lines[i].args[1] = 255; //Appearance if (lines[i].special == 222) - lines[i].args[2] |= TMFA_NOPLANES; + lines[i].args[3] |= TMFA_NOPLANES; if (lines[i].special == 221) - lines[i].args[2] |= TMFA_INSIDES; + lines[i].args[3] |= TMFA_INSIDES; if (lines[i].special != 220 && !(lines[i].flags & ML_NOCLIMB)) - lines[i].args[2] |= TMFA_NOSHADE; + lines[i].args[3] |= TMFA_NOSHADE; if (lines[i].flags & ML_EFFECT6) - lines[i].args[2] |= TMFA_SPLAT; + lines[i].args[3] |= TMFA_SPLAT; lines[i].special = 220; break; @@ -3527,40 +3527,37 @@ static void P_ConvertBinaryMap(void) //Alpha if (lines[i].special == 253 || lines[i].special == 256) { - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[3] |= TMFB_SPLAT; + lines[i].args[4] |= TMFB_SPLAT; } else lines[i].args[1] = 255; //Bustable type if (lines[i].special <= 253) - lines[i].args[2] = TMFB_TOUCH; + lines[i].args[3] = TMFB_TOUCH; else if (lines[i].special >= 255) - lines[i].args[2] = TMFB_SPIN; + lines[i].args[3] = TMFB_SPIN; else if (lines[i].flags & ML_NOCLIMB) - lines[i].args[2] = TMFB_STRONG; + lines[i].args[3] = TMFB_STRONG; else - lines[i].args[2] = TMFB_REGULAR; + lines[i].args[3] = TMFB_REGULAR; //Flags if (lines[i].flags & ML_EFFECT4) - lines[i].args[3] |= TMFB_PUSHABLES; + lines[i].args[4] |= TMFB_PUSHABLES; if (lines[i].flags & ML_EFFECT5) { - lines[i].args[3] |= TMFB_EXECUTOR; - lines[i].args[4] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[4] |= TMFB_EXECUTOR; + lines[i].args[5] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; } if (lines[i].special == 252 && lines[i].flags & ML_NOCLIMB) - lines[i].args[3] |= TMFB_ONLYBOTTOM; + lines[i].args[4] |= TMFB_ONLYBOTTOM; if (lines[i].flags & ML_EFFECT6) - lines[i].args[3] |= TMFB_SPLAT; + lines[i].args[4] |= TMFB_SPLAT; lines[i].special = 254; break; @@ -3575,17 +3572,14 @@ static void P_ConvertBinaryMap(void) lines[i].args[0] = tag; //Alpha - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Flags if (lines[i].flags & ML_EFFECT1) - lines[i].args[2] |= TMFL_NOBOSSES; + lines[i].args[3] |= TMFL_NOBOSSES; //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].flags & ML_EFFECT6 || lines[i].args[1] == 256) - lines[i].args[2] |= TMFL_SPLAT; + lines[i].args[3] |= TMFL_SPLAT; break; case 259: //Custom FOF @@ -3593,20 +3587,17 @@ static void P_ConvertBinaryMap(void) I_Error("Custom FOF (tag %d) found without a linedef back side!", tag); lines[i].args[0] = tag; - lines[i].args[2] = sides[lines[i].sidenum[1]].toptexture; + lines[i].args[3] = sides[lines[i].sidenum[1]].toptexture; if (lines[i].flags & ML_EFFECT6) - lines[i].args[2] |= FF_SPLAT; - lines[i].args[3] = sides[lines[i].sidenum[1]].midtexture; - if (lines[i].args[2] & FF_TRANSLUCENT) + lines[i].args[3] |= FF_SPLAT; + lines[i].args[4] = sides[lines[i].sidenum[1]].midtexture; + if (lines[i].args[3] & FF_TRANSLUCENT) { - if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; - else - lines[i].args[1] = 128; + P_SetBinaryFOFAlpha(&lines[i]); //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels if (lines[i].args[1] == 256) - lines[i].args[2] |= FF_SPLAT; + lines[i].args[3] |= FF_SPLAT; } else lines[i].args[1] = 255; diff --git a/src/p_spec.c b/src/p_spec.c index 56fe98154..2b3e5a000 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -118,7 +118,7 @@ static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, ext static void P_AddBlockThinker(sector_t *sec, line_t *sourceline); static void P_AddFloatThinker(sector_t *sec, UINT16 tag, line_t *sourceline); //static void P_AddBridgeThinker(line_t *sourceline, sector_t *sec); -static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, ffloortype_e ffloorflags, thinkerlist_t *secthinkers); +static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, UINT8 blendmode, ffloortype_e ffloorflags, thinkerlist_t *secthinkers); static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec); static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 referrer); static void P_AddPlaneDisplaceThinker(INT32 type, fixed_t speed, INT32 control, INT32 affectee, UINT8 reverse); @@ -5467,12 +5467,13 @@ static inline void P_AddFFloorToList(sector_t *sec, ffloor_t *fflr) * \param sec2 Control sector. * \param master Control linedef. * \param alpha Alpha value (0-255). + * \param blendmode Blending mode. * \param flags Options affecting this 3Dfloor. * \param secthinkers List of relevant thinkers sorted by sector. May be NULL. * \return Pointer to the new 3Dfloor. * \sa P_AddFFloor, P_AddFakeFloorsByLine, P_SpawnSpecials */ -static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, INT32 alpha, ffloortype_e flags, thinkerlist_t *secthinkers) +static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, INT32 alpha, UINT8 blendmode, ffloortype_e flags, thinkerlist_t *secthinkers) { ffloor_t *fflr; thinker_t *th; @@ -5598,15 +5599,29 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, I { fflr->flags |= FF_TRANSLUCENT; fflr->spawnflags = fflr->flags; - - if (sides[master->sidenum[0]].toptexture >= 1001) - { - fflr->blend = (sides[master->sidenum[0]].toptexture / 1000) + 1; // becomes an AST - fflr->alpha %= 1000; - } } fflr->spawnalpha = fflr->alpha; // save for netgames + switch (blendmode) + { + case TMB_TRANSLUCENT: + default: + fflr->blend = AST_COPY; + break; + case TMB_ADD: + fflr->blend = AST_ADD; + break; + case TMB_SUBTRACT: + fflr->blend = AST_SUBTRACT; + break; + case TMB_REVERSESUBTRACT: + fflr->blend = AST_REVERSESUBTRACT; + break; + case TMB_MODULATE: + fflr->blend = AST_MODULATE; + break; + } + if (flags & FF_QUICKSAND) CheckForQuicksand = true; @@ -6459,29 +6474,81 @@ void P_SpawnSpecials(boolean fromnetsave) ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL; //Appearance settings - if (lines[i].args[2] & TMFA_NOPLANES) + if (lines[i].args[3] & TMFA_NOPLANES) ffloorflags &= ~FF_RENDERPLANES; - if (lines[i].args[2] & TMFA_NOSIDES) + if (lines[i].args[3] & TMFA_NOSIDES) ffloorflags &= ~FF_RENDERSIDES; - if (lines[i].args[2] & TMFA_INSIDES) + if (lines[i].args[3] & TMFA_INSIDES) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_BOTHPLANES; if (ffloorflags & FF_RENDERSIDES) ffloorflags |= FF_ALLSIDES; } - if (lines[i].args[2] & TMFA_ONLYINSIDES) + if (lines[i].args[3] & TMFA_ONLYINSIDES) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_INVERTPLANES; if (ffloorflags & FF_RENDERSIDES) ffloorflags |= FF_INVERTSIDES; } - if (lines[i].args[2] & TMFA_NOSHADE) + if (lines[i].args[3] & TMFA_NOSHADE) ffloorflags |= FF_NOSHADE; - if (lines[i].args[2] & TMFA_SPLAT) + if (lines[i].args[3] & TMFA_SPLAT) ffloorflags |= FF_SPLAT; + //Tangibility settings + if (lines[i].args[4] & TMFT_INTANGIBLETOP) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[4] & TMFT_INTANGIBLEBOTTOM) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[4] & TMFT_DONTBLOCKPLAYER) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[4] & TMFT_DONTBLOCKOTHERS) + ffloorflags &= ~FF_BLOCKOTHERS; + + //Cutting options + if (ffloorflags & FF_RENDERALL) + { + //If translucent or player can enter it, cut inner walls + if ((lines[i].args[1] < 255) || (lines[i].args[4] & TMFT_VISIBLEFROMINSIDE)) + ffloorflags |= FF_CUTEXTRA|FF_EXTRA; + else + ffloorflags |= FF_CUTLEVEL; + } + + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + break; + + case 120: // FOF (water) + ffloorflags = FF_EXISTS|FF_RENDERPLANES|FF_SWIMMABLE|FF_BOTHPLANES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; + if (!(lines[i].args[3] & TMFW_NOSIDES)) + ffloorflags |= FF_RENDERSIDES|FF_ALLSIDES; + if (lines[i].args[3] & TMFW_DOUBLESHADOW) + ffloorflags |= FF_DOUBLESHADOW; + if (lines[i].args[3] & TMFW_COLORMAPONLY) + ffloorflags |= FF_COLORMAPONLY; + if (!(lines[i].args[3] & TMFW_NORIPPLE)) + ffloorflags |= FF_RIPPLE; + if (lines[i].args[3] & TMFW_GOOWATER) + ffloorflags |= FF_GOOWATER; + if (lines[i].args[3] & TMFW_SPLAT) + ffloorflags |= FF_SPLAT; + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + break; + + case 150: // FOF (Air bobbing) + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_SOLID|FF_RENDERALL, secthinkers); + P_AddAirbob(lines[i].frontsector, lines[i].args[0], lines[i].args[1] << FRACBITS, !!(lines[i].args[2] & TMFB_REVERSE), !!(lines[i].args[2] & TMFB_SPINDASH), !!(lines[i].args[2] & TMFB_DYNAMIC)); + break; + + case 160: // FOF (Water bobbing) + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB, secthinkers); + break; + + case 170: // FOF (Crumbling) + ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CRUMBLE; + //Tangibility settings if (lines[i].args[3] & TMFT_INTANGIBLETOP) ffloorflags |= FF_REVERSEPLATFORM; @@ -6492,76 +6559,24 @@ void P_SpawnSpecials(boolean fromnetsave) if (lines[i].args[3] & TMFT_DONTBLOCKOTHERS) ffloorflags &= ~FF_BLOCKOTHERS; - //Cutting options - if (ffloorflags & FF_RENDERALL) - { - //If translucent or player can enter it, cut inner walls - if ((lines[i].args[1] < 255) || (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE)) - ffloorflags |= FF_CUTEXTRA|FF_EXTRA; - else - ffloorflags |= FF_CUTLEVEL; - } - - P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers); - break; - - case 120: // FOF (water) - ffloorflags = FF_EXISTS|FF_RENDERPLANES|FF_SWIMMABLE|FF_BOTHPLANES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (!(lines[i].args[2] & TMFW_NOSIDES)) - ffloorflags |= FF_RENDERSIDES|FF_ALLSIDES; - if (lines[i].args[2] & TMFW_DOUBLESHADOW) - ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].args[2] & TMFW_COLORMAPONLY) - ffloorflags |= FF_COLORMAPONLY; - if (!(lines[i].args[2] & TMFW_NORIPPLE)) - ffloorflags |= FF_RIPPLE; - if (lines[i].args[2] & TMFW_GOOWATER) - ffloorflags |= FF_GOOWATER; - if (lines[i].args[2] & TMFW_SPLAT) - ffloorflags |= FF_SPLAT; - P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers); - break; - - case 150: // FOF (Air bobbing) - P_AddFakeFloorsByLine(i, 0xff, FF_EXISTS|FF_SOLID|FF_RENDERALL, secthinkers); - P_AddAirbob(lines[i].frontsector, lines[i].args[0], lines[i].args[1] << FRACBITS, !!(lines[i].args[2] & TMFB_REVERSE), !!(lines[i].args[2] & TMFB_SPINDASH), !!(lines[i].args[2] & TMFB_DYNAMIC)); - break; - - case 160: // FOF (Water bobbing) - P_AddFakeFloorsByLine(i, 0xff, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB, secthinkers); - break; - - case 170: // FOF (Crumbling) - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CRUMBLE; - - //Tangibility settings - if (lines[i].args[2] & TMFT_INTANGIBLETOP) - ffloorflags |= FF_REVERSEPLATFORM; - if (lines[i].args[2] & TMFT_INTANGIBLEBOTTOM) - ffloorflags |= FF_PLATFORM; - if (lines[i].args[2] & TMFT_DONTBLOCKPLAYER) - ffloorflags &= ~FF_BLOCKPLAYER; - if (lines[i].args[2] & TMFT_DONTBLOCKOTHERS) - ffloorflags &= ~FF_BLOCKOTHERS; - //Flags - if (lines[i].args[3] & TMFC_NOSHADE) + if (lines[i].args[4] & TMFC_NOSHADE) ffloorflags |= FF_NOSHADE; - if (lines[i].args[3] & TMFC_NORETURN) + if (lines[i].args[4] & TMFC_NORETURN) ffloorflags |= FF_NORETURN; - if (lines[i].args[3] & TMFC_FLOATBOB) + if (lines[i].args[4] & TMFC_FLOATBOB) ffloorflags |= FF_FLOATBOB; - if (lines[i].args[3] & TMFC_SPLAT) + if (lines[i].args[4] & TMFC_SPLAT) ffloorflags |= FF_SPLAT; //If translucent or player can enter it, cut inner walls - if (lines[i].args[1] < 0xff || (lines[i].args[2] & TMFT_VISIBLEFROMINSIDE)) + if (lines[i].args[1] < 0xff || (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE)) ffloorflags |= FF_CUTEXTRA|FF_EXTRA; else ffloorflags |= FF_CUTLEVEL; //If player can enter it, render insides - if (lines[i].args[2] & TMFT_VISIBLEFROMINSIDE) + if (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_BOTHPLANES; @@ -6569,8 +6584,8 @@ void P_SpawnSpecials(boolean fromnetsave) ffloorflags |= FF_ALLSIDES; } - P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers); - if (lines[i].args[3] & TMFC_AIRBOB) + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + if (lines[i].args[4] & TMFC_AIRBOB) P_AddAirbob(lines[i].frontsector, lines[i].args[0], 16*FRACUNIT, false, false, false); break; @@ -6582,58 +6597,58 @@ void P_SpawnSpecials(boolean fromnetsave) ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL; //Appearance settings - if (lines[i].args[2] & TMFA_NOPLANES) + if (lines[i].args[3] & TMFA_NOPLANES) ffloorflags &= ~FF_RENDERPLANES; - if (lines[i].args[2] & TMFA_NOSIDES) + if (lines[i].args[3] & TMFA_NOSIDES) ffloorflags &= ~FF_RENDERSIDES; - if (lines[i].args[2] & TMFA_INSIDES) + if (lines[i].args[3] & TMFA_INSIDES) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_BOTHPLANES; if (ffloorflags & FF_RENDERSIDES) ffloorflags |= FF_ALLSIDES; } - if (lines[i].args[2] & TMFA_ONLYINSIDES) + if (lines[i].args[3] & TMFA_ONLYINSIDES) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_INVERTPLANES; if (ffloorflags & FF_RENDERSIDES) ffloorflags |= FF_INVERTSIDES; } - if (lines[i].args[2] & TMFA_NOSHADE) + if (lines[i].args[3] & TMFA_NOSHADE) ffloorflags |= FF_NOSHADE; - if (lines[i].args[2] & TMFA_SPLAT) + if (lines[i].args[3] & TMFA_SPLAT) ffloorflags |= FF_SPLAT; //Tangibility settings - if (lines[i].args[3] & TMFT_INTANGIBLETOP) + if (lines[i].args[4] & TMFT_INTANGIBLETOP) ffloorflags |= FF_REVERSEPLATFORM; - if (lines[i].args[3] & TMFT_INTANGIBLEBOTTOM) + if (lines[i].args[4] & TMFT_INTANGIBLEBOTTOM) ffloorflags |= FF_PLATFORM; - if (lines[i].args[3] & TMFT_DONTBLOCKPLAYER) + if (lines[i].args[4] & TMFT_DONTBLOCKPLAYER) ffloorflags &= ~FF_BLOCKPLAYER; - if (lines[i].args[3] & TMFT_DONTBLOCKOTHERS) + if (lines[i].args[4] & TMFT_DONTBLOCKOTHERS) ffloorflags &= ~FF_BLOCKOTHERS; //Cutting options if (ffloorflags & FF_RENDERALL) { //If translucent or player can enter it, cut inner walls - if ((lines[i].args[1] < 255) || (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE)) + if ((lines[i].args[1] < 255) || (lines[i].args[4] & TMFT_VISIBLEFROMINSIDE)) ffloorflags |= FF_CUTEXTRA|FF_EXTRA; else ffloorflags |= FF_CUTLEVEL; } - P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, lines[i].args[0], lines[i].args[4] << FRACBITS, ceilingtop, ceilingbottom, !!(lines[i].args[5] & TMFR_REVERSE), !!(lines[i].args[5] & TMFR_SPINDASH)); + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + P_AddRaiseThinker(lines[i].frontsector, lines[i].args[0], lines[i].args[5] << FRACBITS, ceilingtop, ceilingbottom, !!(lines[i].args[6] & TMFR_REVERSE), !!(lines[i].args[6] & TMFR_SPINDASH)); break; } case 200: // Light block ffloorflags = FF_EXISTS|FF_CUTSPRITES; if (!lines[i].args[1]) ffloorflags |= FF_DOUBLESHADOW; - P_AddFakeFloorsByLine(i, 0xff, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); break; case 202: // Fog @@ -6642,41 +6657,41 @@ void P_SpawnSpecials(boolean fromnetsave) // SoM: Because it's fog, check for an extra colormap and set the fog flag... if (sectors[sec].extra_colormap) sectors[sec].extra_colormap->flags = CMF_FOG; - P_AddFakeFloorsByLine(i, 0xff, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); break; case 220: //Intangible ffloorflags = FF_EXISTS|FF_RENDERALL|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; //Appearance settings - if (lines[i].args[2] & TMFA_NOPLANES) + if (lines[i].args[3] & TMFA_NOPLANES) ffloorflags &= ~FF_RENDERPLANES; - if (lines[i].args[2] & TMFA_NOSIDES) + if (lines[i].args[3] & TMFA_NOSIDES) ffloorflags &= ~FF_RENDERSIDES; - if (!(lines[i].args[2] & TMFA_INSIDES)) + if (!(lines[i].args[3] & TMFA_INSIDES)) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_BOTHPLANES; if (ffloorflags & FF_RENDERSIDES) ffloorflags |= FF_ALLSIDES; } - if (lines[i].args[2] & TMFA_ONLYINSIDES) + if (lines[i].args[3] & TMFA_ONLYINSIDES) { if (ffloorflags & FF_RENDERPLANES) ffloorflags |= FF_INVERTPLANES; if (ffloorflags & FF_RENDERSIDES) ffloorflags |= FF_INVERTSIDES; } - if (lines[i].args[2] & TMFA_NOSHADE) + if (lines[i].args[3] & TMFA_NOSHADE) ffloorflags |= FF_NOSHADE; - if (lines[i].args[2] & TMFA_SPLAT) + if (lines[i].args[3] & TMFA_SPLAT) ffloorflags |= FF_SPLAT; - P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); break; case 223: // FOF (intangible, invisible) - for combining specials in a sector - P_AddFakeFloorsByLine(i, 0xff, FF_EXISTS|FF_NOSHADE, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_NOSHADE, secthinkers); break; case 250: // Mario Block @@ -6686,14 +6701,14 @@ void P_SpawnSpecials(boolean fromnetsave) if (lines[i].args[1] & TMFM_INVISIBLE) ffloorflags &= ~(FF_SOLID|FF_RENDERALL|FF_CUTLEVEL); - P_AddFakeFloorsByLine(i, 0xff, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); break; case 251: // A THWOMP! { UINT16 sound = (lines[i].stringargs[0]) ? get_number(lines[i].stringargs[0]) : sfx_thwomp; P_AddThwompThinker(lines[i].frontsector, &lines[i], lines[i].args[1] << (FRACBITS - 3), lines[i].args[2] << (FRACBITS - 3), sound); - P_AddFakeFloorsByLine(i, 0xff, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); break; } @@ -6705,7 +6720,7 @@ void P_SpawnSpecials(boolean fromnetsave) ffloorflags = FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP; //Bustable type - switch (lines[i].args[2]) + switch (lines[i].args[3]) { case TMFB_TOUCH: busttype = BT_TOUCH; @@ -6722,13 +6737,13 @@ void P_SpawnSpecials(boolean fromnetsave) } //Flags - if (lines[i].args[3] & TMFB_PUSHABLES) + if (lines[i].args[4] & TMFB_PUSHABLES) bustflags |= FB_PUSHABLES; - if (lines[i].args[3] & TMFB_EXECUTOR) + if (lines[i].args[4] & TMFB_EXECUTOR) bustflags |= FB_EXECUTOR; - if (lines[i].args[3] & TMFB_ONLYBOTTOM) + if (lines[i].args[4] & TMFB_ONLYBOTTOM) bustflags |= FB_ONLYBOTTOM; - if (lines[i].args[3] & TMFB_SPLAT) + if (lines[i].args[4] & TMFB_SPLAT) ffloorflags |= FF_SPLAT; if (busttype != BT_TOUCH || bustflags & FB_ONLYBOTTOM) @@ -6736,12 +6751,12 @@ void P_SpawnSpecials(boolean fromnetsave) TAG_ITER_SECTORS(lines[i].args[0], s) { - ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], ffloorflags, secthinkers); + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); if (!fflr) continue; fflr->bustflags = bustflags; fflr->busttype = busttype; - fflr->busttag = lines[i].args[4]; + fflr->busttag = lines[i].args[5]; } break; } @@ -6752,7 +6767,7 @@ void P_SpawnSpecials(boolean fromnetsave) TAG_ITER_SECTORS(lines[i].args[0], s) { - ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, 0xff, ffloorflags, secthinkers); + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); if (!fflr) continue; fflr->sinkspeed = abs(lines[i].args[2]) << (FRACBITS - 1); @@ -6762,28 +6777,28 @@ void P_SpawnSpecials(boolean fromnetsave) case 258: // Laser block ffloorflags = FF_EXISTS|FF_RENDERALL|FF_NOSHADE|FF_EXTRA|FF_CUTEXTRA|FF_TRANSLUCENT; - P_AddLaserThinker(lines[i].args[0], lines + i, !!(lines[i].args[2] & TMFL_NOBOSSES)); - if (lines[i].args[2] & TMFL_SPLAT) + P_AddLaserThinker(lines[i].args[0], lines + i, !!(lines[i].args[3] & TMFL_NOBOSSES)); + if (lines[i].args[3] & TMFL_SPLAT) ffloorflags |= FF_SPLAT; - P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); break; case 259: // Custom FOF TAG_ITER_SECTORS(lines[i].args[0], s) { - ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], secthinkers); + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], lines[i].args[3], secthinkers); if (!fflr) continue; if (!udmf) // Ugly backwards compatibility stuff { - if (lines[i].args[2] & FF_QUICKSAND) + if (lines[i].args[3] & FF_QUICKSAND) { fflr->sinkspeed = abs(lines[i].dx) >> 1; fflr->friction = abs(lines[i].dy) >> 6; } - if (lines[i].args[2] & FF_BUSTUP) + if (lines[i].args[3] & FF_BUSTUP) { - switch (lines[i].args[3] % TMFB_ONLYBOTTOM) + switch (lines[i].args[4] % TMFB_ONLYBOTTOM) { case TMFB_TOUCH: fflr->busttype = BT_TOUCH; @@ -6799,7 +6814,7 @@ void P_SpawnSpecials(boolean fromnetsave) break; } - if (lines[i].args[3] & TMFB_ONLYBOTTOM) + if (lines[i].args[4] & TMFB_ONLYBOTTOM) fflr->bustflags |= FB_ONLYBOTTOM; if (lines[i].flags & ML_EFFECT4) fflr->bustflags |= FB_PUSHABLES; @@ -6874,7 +6889,7 @@ void P_SpawnSpecials(boolean fromnetsave) } } - P_AddFakeFloorsByLine(i, dopacity, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, dopacity, TMB_TRANSLUCENT, ffloorflags, secthinkers); } break; @@ -7280,12 +7295,13 @@ void P_SpawnSpecials(boolean fromnetsave) * * \param line Control linedef to use. * \param alpha Alpha value (0-255). + * \param blendmode Blending mode. * \param ffloorflags 3Dfloor flags to use. * \param secthkiners Lists of thinkers sorted by sector. May be NULL. * \sa P_SpawnSpecials, P_AddFakeFloor * \author Graue */ -static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, ffloortype_e ffloorflags, thinkerlist_t *secthinkers) +static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, UINT8 blendmode, ffloortype_e ffloorflags, thinkerlist_t *secthinkers) { INT32 s; mtag_t tag = lines[line].args[0]; @@ -7293,7 +7309,7 @@ static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, ffloortype_e ffloorf line_t* li = lines + line; TAG_ITER_SECTORS(tag, s) - P_AddFakeFloor(§ors[s], §ors[sec], li, alpha, ffloorflags, secthinkers); + P_AddFakeFloor(§ors[s], §ors[sec], li, alpha, blendmode, ffloorflags, secthinkers); } /* diff --git a/src/p_spec.h b/src/p_spec.h index 536b6c313..a3dbb9322 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -102,6 +102,15 @@ typedef enum TMFL_SPLAT = 1<<1, } textmapfoflaserflags_t; +typedef enum +{ + TMB_TRANSLUCENT = 0, + TMB_ADD = 1, + TMB_SUBTRACT = 2, + TMB_REVERSESUBTRACT = 3, + TMB_MODULATE = 4, +} textmapblendmodes_t; + // GETSECSPECIAL (specialval, section) // // Pulls out the special # from a particular section. diff --git a/src/r_defs.h b/src/r_defs.h index 43caa3d79..8bb0b4b9f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -402,7 +402,7 @@ typedef enum #define HORIZONSPECIAL 41 -#define NUMLINEARGS 6 +#define NUMLINEARGS 10 #define NUMLINESTRINGARGS 2 typedef struct line_s