From 54d79415d578b03d8df79895b25f99a77803fcac Mon Sep 17 00:00:00 2001 From: katsy Date: Thu, 31 Dec 2020 02:21:14 -0600 Subject: [PATCH 1/4] add carry type to fans --- src/d_player.h | 3 ++- src/deh_tables.c | 1 + src/p_map.c | 7 ++++--- src/p_spec.c | 8 ++++++-- src/p_user.c | 23 +++++++++++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 79f2a3b92..7193ce591 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -243,7 +243,8 @@ typedef enum CR_MINECART, CR_ROLLOUT, CR_PTERABYTE, - CR_DUSTDEVIL + CR_DUSTDEVIL, + CR_FAN } carrytype_t; // pw_carry // Player powers. (don't edit this comment) diff --git a/src/deh_tables.c b/src/deh_tables.c index b907e2206..54f3288f0 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4984,6 +4984,7 @@ struct int_const_s const INT_CONST[] = { {"CR_ROLLOUT",CR_ROLLOUT}, {"CR_PTERABYTE",CR_PTERABYTE}, {"CR_DUSTDEVIL",CR_DUSTDEVIL}, + {"CR_FAN",CR_FAN}, // Ring weapons (ringweapons_t) // Useful for A_GiveWeapon diff --git a/src/p_map.c b/src/p_map.c index b934e3255..da68b9511 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -498,11 +498,12 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) if (flipval*object->momz > FixedMul(speed, spring->scale)) object->momz = flipval*FixedMul(speed, spring->scale); - if (p && !p->powers[pw_tailsfly]) // doesn't reset anim for Tails' flight + if (p && !p->powers[pw_tailsfly] && !p->powers[pw_carry]) // doesn't reset anim for Tails' flight { P_ResetPlayer(p); - if (p->panim != PA_FALL) - P_SetPlayerMobjState(object, S_PLAY_FALL); + P_SetPlayerMobjState(object, S_PLAY_FALL); + P_SetTarget(&object->tracer, spring); + p->powers[pw_carry] = CR_FAN; } break; case MT_STEAM: // Steam diff --git a/src/p_spec.c b/src/p_spec.c index 5b9e05c61..00fe3ca0e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4662,9 +4662,13 @@ DoneSection2: if (player->mo->momz > mobjinfo[MT_FAN].mass) player->mo->momz = mobjinfo[MT_FAN].mass; - P_ResetPlayer(player); - if (player->panim != PA_FALL) + if (!player->powers[pw_carry]) + { + P_ResetPlayer(player); P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + P_SetTarget(&player->mo->tracer, player->mo); + player->powers[pw_carry] = CR_FAN; + } break; case 6: // Super Sonic transformer diff --git a/src/p_user.c b/src/p_user.c index 2dcc21009..f0172ce6b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12694,6 +12694,29 @@ void P_PlayerAfterThink(player_t *player) break; } + case CR_FAN: + { + fixed_t zdist; + mobj_t *mo = player->mo, *fan = player->mo->tracer; + + if (!(player->pflags & PF_JUMPSTASIS)) + player->pflags |= PF_JUMPSTASIS; + + if (fan->eflags & MFE_VERTICALFLIP) + zdist = (mo->z + mo->height) - (fan->z + fan->height); + else + zdist = mo->z - fan->z; + + if ((fan->type != MT_FAN && !P_PlayerTouchingSectorSpecial(player, 4, 5)) + || (fan->type == MT_FAN && (abs(mo->x - fan->x) > fan->radius || abs(mo->y - fan->y) > fan->radius || zdist > (fan->health << FRACBITS)))) + { + P_SetTarget(&player->mo->tracer, NULL); + player->pflags &= ~PF_JUMPSTASIS; + player->powers[pw_carry] = CR_NONE; + break; + } + break; + } case CR_ROLLOUT: { mobj_t *mo = player->mo, *rock = player->mo->tracer; From 91aeba6c660d28db3b5a1c232c90ed5e35d48164 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Fri, 8 Oct 2021 22:47:22 +0300 Subject: [PATCH 2/4] Request 24-bit depth buffer from SDL Should fix problems caused by 16-bit depth buffer usage --- src/sdl/i_video.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 0ed10463f..b1bf68bce 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1620,6 +1620,11 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #ifdef HWRENDER if (vid.glstate == VID_GL_LIBRARY_LOADED) flags |= SDL_WINDOW_OPENGL; + + // Without a 24-bit depth buffer many visuals are ruined by z-fighting. + // Some GPU drivers may give us a 16-bit depth buffer since the + // default value for SDL_GL_DEPTH_SIZE is 16. + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); #endif // Create a window From b7dd3ac4bf5135c6b41b7fc6ea89c39e07092fa8 Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 16 Sep 2022 22:56:26 +0200 Subject: [PATCH 3/4] Restore CR_FAN application for fan sectors --- src/p_spec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 78878de1d..491652dd8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4965,9 +4965,13 @@ static void P_EvaluateSpecialFlags(player_t *player, sector_t *sector, sector_t if (player->mo->momz > mobjinfo[MT_FAN].mass) player->mo->momz = mobjinfo[MT_FAN].mass; - P_ResetPlayer(player); - if (player->panim != PA_FALL) + if (!player->powers[pw_carry]) + { + P_ResetPlayer(player); P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + P_SetTarget(&player->mo->tracer, player->mo); + player->powers[pw_carry] = CR_FAN; + } } if (sector->specialflags & SSF_SUPERTRANSFORM) { From 2664fc700aab29a045718535830c3ec72ee2b526 Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 16 Sep 2022 23:05:24 +0200 Subject: [PATCH 4/4] Check for sector special flag instead of special number --- src/p_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 8d4e39a72..1607b9fcb 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1966,22 +1966,22 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->angle = (mobj->player ? mobj->player->drawangle : mobj->angle); ghost->rollangle = mobj->rollangle; - + ghost->sprite = mobj->sprite; ghost->sprite2 = mobj->sprite2; ghost->frame = mobj->frame; ghost->tics = -1; ghost->frame &= ~FF_TRANSMASK; ghost->frame |= tr_trans50<renderflags = mobj->renderflags; ghost->blendmode = mobj->blendmode; - + ghost->spritexscale = mobj->spritexscale; ghost->spriteyscale = mobj->spriteyscale; ghost->spritexoffset = mobj->spritexoffset; ghost->spriteyoffset = mobj->spriteyoffset; - + ghost->fuse = ghost->info->damage; ghost->skin = mobj->skin; @@ -12602,7 +12602,7 @@ void P_PlayerAfterThink(player_t *player) else zdist = mo->z - fan->z; - if ((fan->type != MT_FAN && !P_PlayerTouchingSectorSpecial(player, 4, 5)) + if ((fan->type != MT_FAN && !P_PlayerTouchingSectorSpecialFlag(player, SSF_FAN)) || (fan->type == MT_FAN && (abs(mo->x - fan->x) > fan->radius || abs(mo->y - fan->y) > fan->radius || zdist > (fan->health << FRACBITS)))) { P_SetTarget(&player->mo->tracer, NULL);