diff --git a/src/b_game.cpp b/src/b_game.cpp index 5f852d043d..44545f73dc 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -369,14 +369,6 @@ bool FCajunMaster::DoAddBot (BYTE *info, botskill_t skill) D_ReadUserInfoStrings (bnum, &info, false); - if (!deathmatch && playerstarts[bnum].type == 0) - { - Printf ("%s tried to join, but there was no player %d start\n", - players[bnum].userinfo.GetName(), bnum+1); - ClearPlayer (bnum, false); // Make the bot inactive again - return false; - } - multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost). players[bnum].Bot = new DBot; players[bnum].Bot->player = &players[bnum]; diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 6c5fbb6c5c..3010de16de 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -60,7 +60,7 @@ static FRandom pr_pickteam ("PickRandomTeam"); -CVAR (Float, autoaim, 5000.f, CVAR_USERINFO | CVAR_ARCHIVE); +CVAR (Float, autoaim, 35.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (String, name, "Player", CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Color, color, 0x40cf00, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Int, colorset, 0, CVAR_USERINFO | CVAR_ARCHIVE); @@ -518,9 +518,9 @@ void D_UserInfoChanged (FBaseCVar *cvar) autoaim = 0.0f; return; } - else if (autoaim > 5000.0f) + else if (autoaim > 35.0f) { - autoaim = 5000.f; + autoaim = 35.f; return; } } diff --git a/src/d_player.h b/src/d_player.h index 38879a63a4..d6b039896c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -492,6 +492,7 @@ public: crouchdir = 0; crouching = 0; crouchviewdelta = 0; + viewheight = mo->ViewHeight; } bool CanCrouch() const diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 0945b1b4fe..3060c65aa1 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1082,7 +1082,7 @@ void FParser::SF_Teleport(void) } if(mo) - EV_Teleport(0, tag, NULL, 0, mo, true, true, false); + EV_Teleport(0, tag, NULL, 0, mo, TELF_DESTFOG | TELF_SOURCEFOG); } } @@ -1111,7 +1111,7 @@ void FParser::SF_SilentTeleport(void) } if(mo) - EV_Teleport(0, tag, NULL, 0, mo, false, false, true); + EV_Teleport(0, tag, NULL, 0, mo, TELF_KEEPORIENTATION); } } diff --git a/src/g_game.cpp b/src/g_game.cpp index c97ea21982..7f6305ca48 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1422,6 +1422,8 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing) fixed_t z, oldz; int i; + if (mthing->type == 0) return false; + x = mthing->x; y = mthing->y; z = mthing->z; @@ -1573,6 +1575,11 @@ void G_DeathMatchSpawnPlayer (int playernum) // FPlayerStart *G_PickPlayerStart(int playernum, int flags) { + if (AllPlayerStarts.Size() == 0) // No starts to pick + { + return NULL; + } + if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM) || playerstarts[playernum].type == 0) { @@ -1624,6 +1631,18 @@ static void G_QueueBody (AActor *body) translationtables[TRANSLATION_PlayerCorpses][modslot]->UpdateNative(); } + const int skinidx = body->player->userinfo.GetSkin(); + + if (0 != skinidx && !(body->flags4 & MF4_NOSKIN)) + { + // Apply skin's scale to actor's scale, it will be lost otherwise + const AActor *const defaultActor = body->GetDefault(); + const FPlayerSkin &skin = skins[skinidx]; + + body->scaleX = Scale(body->scaleX, skin.ScaleX, defaultActor->scaleX); + body->scaleY = Scale(body->scaleY, skin.ScaleY, defaultActor->scaleY); + } + bodyqueslot++; } @@ -2629,12 +2648,12 @@ bool G_ProcessIFFDemo (FString &mapname) if (uncompSize > 0) { - BYTE *uncompressed = new BYTE[uncompSize]; + BYTE *uncompressed = (BYTE*)M_Malloc(uncompSize); int r = uncompress (uncompressed, &uncompSize, demo_p, uLong(zdembodyend - demo_p)); if (r != Z_OK) { Printf ("Could not decompress demo! %s\n", M_ZLibError(r).GetChars()); - delete[] uncompressed; + M_Free(uncompressed); return true; } M_Free (demobuffer); diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index fb833fdedc..77079d9b6e 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -97,7 +97,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase) spot = iterator.Next (); if (spot != NULL) { - P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, true, true, false); + P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, TELF_SOURCEFOG | TELF_DESTFOG); } P_StartScript (self, NULL, 249, NULL, NULL, 0, 0); @@ -136,7 +136,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase) self->tracer = spot; if (spot) { - P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, true, true, false); + P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, TELF_SOURCEFOG | TELF_DESTFOG); } } } diff --git a/src/g_hexen/a_teleportother.cpp b/src/g_hexen/a_teleportother.cpp index 14edd75197..0ee5b31b32 100644 --- a/src/g_hexen/a_teleportother.cpp +++ b/src/g_hexen/a_teleportother.cpp @@ -162,7 +162,7 @@ void P_TeleportToPlayerStarts (AActor *victim) destX = start->x; destY = start->y; destAngle = ANG45 * (start->angle/45); - P_Teleport (victim, destX, destY, ONFLOORZ, destAngle, true, true, false); + P_Teleport (victim, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG); } //=========================================================================== @@ -184,7 +184,7 @@ void P_TeleportToDeathmatchStarts (AActor *victim) destX = deathmatchstarts[i].x; destY = deathmatchstarts[i].y; destAngle = ANG45 * (deathmatchstarts[i].angle/45); - P_Teleport (victim, destX, destY, ONFLOORZ, destAngle, true, true, false); + P_Teleport (victim, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG); } else { diff --git a/src/g_level.cpp b/src/g_level.cpp index 1cc1e86418..55c1272667 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1195,74 +1195,83 @@ void G_FinishTravel () TThinkerIterator it (STAT_TRAVELLING); APlayerPawn *pawn, *pawndup, *oldpawn, *next; AInventory *inv; + FPlayerStart *start; + int pnum; next = it.Next (); while ( (pawn = next) != NULL) { next = it.Next (); + pnum = int(pawn->player - players); pawn->ChangeStatNum (STAT_PLAYER); pawndup = pawn->player->mo; + start = NULL; assert (pawn != pawndup); if (pawndup == NULL) { // Oh no! there was no start for this player! - pawn->flags |= MF_NOSECTOR|MF_NOBLOCKMAP; - pawn->Destroy (); + start = G_PickPlayerStart(pnum, PPS_FORCERANDOM); + if (start != NULL) pawndup = P_SpawnPlayer(start, pnum, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); + if (pawndup == NULL) + { + pawn->flags |= MF_NOSECTOR | MF_NOBLOCKMAP; + pawn->Destroy(); + continue; + } } - else + + if (start == NULL) start = G_PickPlayerStart(pnum, 0); + oldpawn = pawndup; + + // The player being spawned here is a short lived dummy and + // must not start any ENTER script or big problems will happen. + pawndup = P_SpawnPlayer(start, pnum, SPF_TEMPPLAYER); + if (!(changeflags & CHANGELEVEL_KEEPFACING)) { - oldpawn = pawndup; + pawn->angle = pawndup->angle; + pawn->pitch = pawndup->pitch; + } + pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z()); + pawn->velx = pawndup->velx; + pawn->vely = pawndup->vely; + pawn->velz = pawndup->velz; + pawn->Sector = pawndup->Sector; + pawn->floorz = pawndup->floorz; + pawn->ceilingz = pawndup->ceilingz; + pawn->dropoffz = pawndup->dropoffz; + pawn->floorsector = pawndup->floorsector; + pawn->floorpic = pawndup->floorpic; + pawn->floorterrain = pawndup->floorterrain; + pawn->ceilingsector = pawndup->ceilingsector; + pawn->ceilingpic = pawndup->ceilingpic; + pawn->floorclip = pawndup->floorclip; + pawn->waterlevel = pawndup->waterlevel; + pawn->target = NULL; + pawn->lastenemy = NULL; + pawn->player->mo = pawn; + pawn->player->camera = pawn; + pawn->player->viewheight = pawn->ViewHeight; + pawn->flags2 &= ~MF2_BLASTED; + DObject::StaticPointerSubstitution (oldpawn, pawn); + oldpawn->Destroy(); + pawndup->Destroy (); + pawn->LinkToWorld (); + pawn->AddToHash (); + pawn->SetState(pawn->SpawnState); + pawn->player->SendPitchLimits(); - // The player being spawned here is a short lived dummy and - // must not start any ENTER script or big problems will happen. - pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], int(pawn->player - players), SPF_TEMPPLAYER); - if (!(changeflags & CHANGELEVEL_KEEPFACING)) - { - pawn->angle = pawndup->angle; - pawn->pitch = pawndup->pitch; - } - pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z()); - pawn->velx = pawndup->velx; - pawn->vely = pawndup->vely; - pawn->velz = pawndup->velz; - pawn->Sector = pawndup->Sector; - pawn->floorz = pawndup->floorz; - pawn->ceilingz = pawndup->ceilingz; - pawn->dropoffz = pawndup->dropoffz; - pawn->floorsector = pawndup->floorsector; - pawn->floorpic = pawndup->floorpic; - pawn->floorterrain = pawndup->floorterrain; - pawn->ceilingsector = pawndup->ceilingsector; - pawn->ceilingpic = pawndup->ceilingpic; - pawn->floorclip = pawndup->floorclip; - pawn->waterlevel = pawndup->waterlevel; - pawn->target = NULL; - pawn->lastenemy = NULL; - pawn->player->mo = pawn; - pawn->player->camera = pawn; - pawn->player->viewheight = pawn->ViewHeight; - pawn->flags2 &= ~MF2_BLASTED; - DObject::StaticPointerSubstitution (oldpawn, pawn); - oldpawn->Destroy(); - pawndup->Destroy (); - pawn->LinkToWorld (); - pawn->AddToHash (); - pawn->SetState(pawn->SpawnState); - pawn->player->SendPitchLimits(); - - for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) - { - inv->ChangeStatNum (STAT_INVENTORY); - inv->LinkToWorld (); - inv->Travelled (); - } - if (ib_compatflags & BCOMPATF_RESETPLAYERSPEED) - { - pawn->Speed = pawn->GetDefault()->Speed; - } - if (level.FromSnapshot) - { - FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true); - } + for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) + { + inv->ChangeStatNum (STAT_INVENTORY); + inv->LinkToWorld (); + inv->Travelled (); + } + if (ib_compatflags & BCOMPATF_RESETPLAYERSPEED) + { + pawn->Speed = pawn->GetDefault()->Speed; + } + if (level.FromSnapshot) + { + FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true); } } diff --git a/src/g_raven/a_artitele.cpp b/src/g_raven/a_artitele.cpp index 0778eac4be..9922f75f00 100644 --- a/src/g_raven/a_artitele.cpp +++ b/src/g_raven/a_artitele.cpp @@ -43,7 +43,7 @@ bool AArtiTeleport::Use (bool pickup) destY = start->y; destAngle = ANG45 * (start->angle/45); } - P_Teleport (Owner, destX, destY, ONFLOORZ, destAngle, true, true, false); + P_Teleport (Owner, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG); bool canlaugh = true; if (Owner->player->morphTics && (Owner->player->MorphStyle & MORPH_UNDOBYCHAOSDEVICE)) { // Teleporting away will undo any morph effects (pig) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index faa5392b71..42b286f531 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1500,7 +1500,9 @@ void APowerTimeFreezer::InitEffect() } else { - EffectTics++; + // Compensate for skipped tic, but beware of overflow. + if(EffectTics < INT_MAX) + EffectTics++; } } diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index 725b858e33..1e536faa81 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -70,7 +70,7 @@ void AFastProjectile::Tick () { if (--ripcount <= 0) { - tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen + tm.LastRipped.Clear(); // [RH] Do rip damage each step, like Hexen } if (!P_TryMove (this, X() + xfrac,Y() + yfrac, true, NULL, tm)) diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 44f52485c4..1dc4b2f1aa 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -591,6 +591,9 @@ void DIntermissionScreenCast::Drawer () // draw the current frame in the middle of the screen if (caststate != NULL) { + double castscalex = FIXED2DBL(mDefaults->scaleX); + double castscaley = FIXED2DBL(mDefaults->scaleY); + int castsprite = caststate->sprite; if (!(mDefaults->flags4 & MF4_NOSKIN) && @@ -604,7 +607,15 @@ void DIntermissionScreenCast::Drawer () { if (PlayerClasses[i].Type == mClass) { - castsprite = skins[players[consoleplayer].userinfo.GetSkin()].sprite; + FPlayerSkin *skin = &skins[players[consoleplayer].userinfo.GetSkin()]; + castsprite = skin->sprite; + + if (!(mDefaults->flags4 & MF4_NOSKIN)) + { + castscaley = FIXED2DBL(skin->ScaleY); + castscalex = FIXED2DBL(skin->ScaleX); + } + } } } @@ -615,6 +626,10 @@ void DIntermissionScreenCast::Drawer () screen->DrawTexture (pic, 160, 170, DTA_320x200, true, DTA_FlipX, sprframe->Flip & 1, + DTA_DestHeightF, pic->GetScaledHeightDouble() * castscaley, + DTA_DestWidthF, pic->GetScaledWidthDouble() * castscalex, + DTA_RenderStyle, mDefaults->RenderStyle, + DTA_Alpha, mDefaults->alpha, DTA_Translation, casttranslation, TAG_DONE); } diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index 58b08fc38b..e6e25b3947 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -479,7 +479,8 @@ void FSliderItem::Drawer(bool selected) screen->DrawText(mFont, selected? OptionSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE); int x = SmallFont->StringWidth ("Green") + 8 + mXpos; - DrawSlider (x, mYpos); + int x2 = SmallFont->StringWidth (mText) + 8 + mXpos; + DrawSlider (MAX(x2, x), mYpos); } @@ -630,14 +631,7 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc) li = GetItem(NAME_Autoaim); if (li != NULL) { - int sel = - autoaim == 0 ? 0 : - autoaim <= 0.25 ? 1 : - autoaim <= 0.5 ? 2 : - autoaim <= 1 ? 3 : - autoaim <= 2 ? 4 : - autoaim <= 3 ? 5:6; - li->SetValue(0, sel); + li->SetValue(0, (int)autoaim); } li = GetItem(NAME_Switch); @@ -966,13 +960,11 @@ void DPlayerMenu::SkinChanged (FListMenuItem *li) void DPlayerMenu::AutoaimChanged (FListMenuItem *li) { - static const float ranges[] = { 0, 0.25, 0.5, 1, 2, 3, 5000 }; - int sel; if (li->GetValue(0, &sel)) { - autoaim = ranges[sel]; + autoaim = (float)sel; } } diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 84ed4c16fe..62ddb7d3d4 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -132,7 +132,9 @@ CUSTOM_CVAR( Int, r_maxparticles, 4000, CVAR_ARCHIVE ) { if ( self == 0 ) self = 4000; - else if ( self < 100 ) + else if (self > 65535) + self = 65535; + else if (self < 100) self = 100; if ( gamestate != GS_STARTUP ) diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index a85dc94d95..b8e3eb5c60 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -1114,7 +1114,8 @@ static void CreateCachedNodes(MapData *map) for(int i=0;ihealth >= 0) it->SetState (it->FindState(NAME_Pain)); return true; } diff --git a/src/p_local.h b/src/p_local.h index c39bcef784..395a05990c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -445,13 +445,12 @@ struct FCheckPosition // [RH] These are used by PIT_CheckThing and P_XYMovement to apply // ripping damage once per tic instead of once per move. bool DoRipping; - AActor *LastRipped; + TMap LastRipped; int PushTime; FCheckPosition(bool rip=false) { DoRipping = rip; - LastRipped = NULL; PushTime = 0; FromPMove = false; } diff --git a/src/p_map.cpp b/src/p_map.cpp index 1aacff9820..31f31e16c2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1286,9 +1286,10 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) { if (!(tm.thing->flags6 & MF6_NOBOSSRIP) || !(thing->flags2 & MF2_BOSS)) { - if (tm.LastRipped != thing) + bool *check = tm.LastRipped.CheckKey(thing); + if (check == NULL || !*check) { - tm.LastRipped = thing; + tm.LastRipped[thing] = true; if (!(thing->flags & MF_NOBLOOD) && !(thing->flags2 & MF2_REFLECTIVE) && !(tm.thing->flags3 & MF3_BLOODLESSIMPACT) && diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index c9693ba477..789c468d13 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4431,6 +4431,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) ( gameaction != ga_worlddone ) && ( p->mo != NULL ) && ( !(p->mo->Sector->Flags & SECF_NORESPAWN) ) && + ( NULL != p->attacker ) && // don't respawn on damaging floors ( p->mo->Sector->damageamount < TELEFRAG_DAMAGE )) // this really should be a bit smarter... { spawn_x = p->mo->X(); diff --git a/src/p_spec.h b/src/p_spec.h index 2f99e48899..b4a88b5670 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -902,13 +902,22 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag); // // P_TELEPT // +enum +{ + TELF_DESTFOG = 1, + TELF_SOURCEFOG = 2, + TELF_KEEPORIENTATION = 4, + TELF_KEEPVELOCITY = 8, + TELF_KEEPHEIGHT = 16, +}; + void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele = true, bool setTarget = false); //Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false). inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTele = true, bool setTarget = false) { P_SpawnTeleportFog(mobj, pos.x, pos.y, pos.z, beforeTele, setTarget); } -bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false); -bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false); +bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int flags); // bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false +bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags); bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse); bool EV_TeleportOther (int other_tid, int dest_tid, bool fog); bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_tid, bool moveSource, bool fog); diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 85b668bf00..254d341300 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -96,8 +96,7 @@ void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool befo // TELEPORTATION // -bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, - bool useFog, bool sourceFog, bool keepOrientation, bool bHaltVelocity, bool keepHeight) +bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int flags) { bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING)); @@ -123,7 +122,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, { // We don't measure z velocity, because it doesn't change. missilespeed = xs_CRoundToInt(TVector2(thing->velx, thing->vely).Length()); } - if (keepHeight) + if (flags & TELF_KEEPHEIGHT) { z = floorheight + aboveFloor; } @@ -142,7 +141,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, else { z = floorheight; - if (!keepOrientation) + if (!(flags & TELF_KEEPORIENTATION)) { resetpitch = false; } @@ -173,7 +172,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, player->mo->pitch = 0; } } - if (!keepOrientation) + if (!(flags & TELF_KEEPORIENTATION)) { thing->angle = angle; } @@ -182,11 +181,11 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, angle = thing->angle; } // Spawn teleport fog at source and destination - if (sourceFog && !predicting) + if ((flags & TELF_SOURCEFOG) && !predicting) { P_SpawnTeleportFog(thing, old, true, true); //Passes the actor through which then pulls the TeleFog metadata types based on properties. } - if (useFog) + if (flags & TELF_DESTFOG) { if (!predicting) { @@ -199,12 +198,12 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, { // [RH] Zoom player's field of vision // [BC] && bHaltVelocity. - if (telezoom && thing->player->mo == thing && bHaltVelocity) + if (telezoom && thing->player->mo == thing && !(flags & TELF_KEEPVELOCITY)) thing->player->FOV = MIN (175.f, thing->player->DesiredFOV + 45.f); } } // [BC] && bHaltVelocity. - if (thing->player && (useFog || !keepOrientation) && bHaltVelocity) + if (thing->player && ((flags & TELF_DESTFOG) || !(flags & TELF_KEEPORIENTATION)) && !(flags & TELF_KEEPVELOCITY)) { // Freeze player for about .5 sec if (thing->Inventory == NULL || !thing->Inventory->GetNoTeleportFreeze()) @@ -217,8 +216,8 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, thing->vely = FixedMul (missilespeed, finesine[angle]); } // [BC] && bHaltVelocity. - else if (!keepOrientation && bHaltVelocity) // no fog doesn't alter the player's momentum - { + else if (!(flags & TELF_KEEPORIENTATION) && !(flags & TELF_KEEPVELOCITY)) + { // no fog doesn't alter the player's momentum thing->velx = thing->vely = thing->velz = 0; // killough 10/98: kill all bobbing velocity too if (player) @@ -322,10 +321,8 @@ static AActor *SelectTeleDest (int tid, int tag, bool norandom) return NULL; } -bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, - bool sourceFog, bool keepOrientation, bool haltVelocity, bool keepHeight) +bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags) { - AActor *searcher; fixed_t z; angle_t angle = 0; @@ -352,7 +349,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool return false; } // [RH] Lee Killough's changes for silent teleporters from BOOM - if (keepOrientation && line) + if ((flags & TELF_KEEPORIENTATION) && line) { // Get the angle between the exit thing and source linedef. // Rotate 90 degrees, so that walking perpendicularly across @@ -382,10 +379,10 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool { badangle = 1 << ANGLETOFINESHIFT; } - if (P_Teleport (thing, searcher->X(), searcher->Y(), z, searcher->angle + badangle, fog, sourceFog, keepOrientation, haltVelocity, keepHeight)) + if (P_Teleport (thing, searcher->X(), searcher->Y(), z, searcher->angle + badangle, flags)) { // [RH] Lee Killough's changes for silent teleporters from BOOM - if (!fog && line && keepOrientation) + if (!(flags & TELF_DESTFOG) && line && (flags & TELF_KEEPORIENTATION)) { // Rotate thing according to difference in angles thing->angle += angle; @@ -601,7 +598,8 @@ bool EV_TeleportOther (int other_tid, int dest_tid, bool fog) while ( (victim = iterator.Next ()) ) { - didSomething |= EV_Teleport (dest_tid, 0, NULL, 0, victim, fog, fog, !fog); + didSomething |= EV_Teleport (dest_tid, 0, NULL, 0, victim, + fog ? (TELF_DESTFOG | TELF_SOURCEFOG) : TELF_KEEPORIENTATION); } } @@ -621,7 +619,7 @@ static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool fl P_Teleport (victim, dest->X() + newX, dest->Y() + newY, floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z(), - 0, fog, fog, !fog); + 0, fog ? (TELF_DESTFOG | TELF_SOURCEFOG) : TELF_KEEPORIENTATION); // P_Teleport only changes angle if fog is true victim->angle = dest->angle + offAngle; @@ -689,7 +687,7 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t { didSomething |= P_Teleport (sourceOrigin, destOrigin->X(), destOrigin->Y(), - floorz ? ONFLOORZ : destOrigin->Z(), 0, false, false, true); + floorz ? ONFLOORZ : destOrigin->Z(), 0, TELF_KEEPORIENTATION); sourceOrigin->angle = destOrigin->angle; } diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 397d29f9b6..8f13f259b1 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -541,7 +541,7 @@ void R_AddLine (seg_t *line) if (WallC.Init(tx1, ty1, tx2, ty2, 32)) return; - if (WallC.sx1 > WindowRight || WallC.sx2 < WindowLeft) + if (WallC.sx1 >= WindowRight || WallC.sx2 <= WindowLeft) return; if (line->linedef == NULL) diff --git a/src/r_main.cpp b/src/r_main.cpp index b136d9cc6c..4cb78311f4 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -667,10 +667,10 @@ void R_EnterMirror (drawseg_t *ds, int depth) ActiveWallMirror = ds->curline; R_ClearPlanes (false); - R_ClearClipSegs (ds->x1, ds->x2 + 1); + R_ClearClipSegs (ds->x1, ds->x2); - memcpy (ceilingclip + ds->x1, openings + ds->sprtopclip, (ds->x2 - ds->x1 + 1)*sizeof(*ceilingclip)); - memcpy (floorclip + ds->x1, openings + ds->sprbottomclip, (ds->x2 - ds->x1 + 1)*sizeof(*floorclip)); + memcpy (ceilingclip + ds->x1, openings + ds->sprtopclip, (ds->x2 - ds->x1)*sizeof(*ceilingclip)); + memcpy (floorclip + ds->x1, openings + ds->sprbottomclip, (ds->x2 - ds->x1)*sizeof(*floorclip)); WindowLeft = ds->x1; WindowRight = ds->x2; @@ -777,7 +777,7 @@ void R_RenderActorView (AActor *actor, bool dontmaplines) } WindowLeft = 0; - WindowRight = viewwidth - 1; + WindowRight = viewwidth; MirrorFlags = 0; ActiveWallMirror = NULL; diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 84967c164c..8238adec27 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -708,8 +708,8 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl check->colormap = basecolormap; // [RH] Save colormap check->sky = sky; check->skybox = skybox; - check->minx = viewwidth; // Was SCREENWIDTH -- killough 11/98 - check->maxx = -1; + check->left = viewwidth; // Was SCREENWIDTH -- killough 11/98 + check->right = 0; check->extralight = stacked_extralight; check->visibility = stacked_visibility; check->viewx = stacked_viewx; @@ -740,38 +740,38 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop) int x; assert (start >= 0 && start < viewwidth); - assert (stop >= start && stop < viewwidth); + assert (stop > start && stop <= viewwidth); - if (start < pl->minx) + if (start < pl->left) { - intrl = pl->minx; + intrl = pl->left; unionl = start; } else { - unionl = pl->minx; + unionl = pl->left; intrl = start; } - if (stop > pl->maxx) + if (stop > pl->right) { - intrh = pl->maxx; + intrh = pl->right; unionh = stop; } else { - unionh = pl->maxx; + unionh = pl->right; intrh = stop; } - for (x = intrl; x <= intrh && pl->top[x] == 0x7fff; x++) + for (x = intrl; x < intrh && pl->top[x] == 0x7fff; x++) ; - if (x > intrh) + if (x >= intrh) { // use the same visplane - pl->minx = unionl; - pl->maxx = unionh; + pl->left = unionl; + pl->right = unionh; } else { @@ -811,8 +811,8 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop) new_pl->MirrorFlags = pl->MirrorFlags; new_pl->CurrentSkybox = pl->CurrentSkybox; pl = new_pl; - pl->minx = start; - pl->maxx = stop; + pl->left = start; + pl->right = stop; clearbufshort (pl->top, viewwidth, 0x7fff); } return pl; @@ -922,23 +922,23 @@ static void R_DrawSky (visplane_t *pl) { int x; - if (pl->minx > pl->maxx) + if (pl->left >= pl->right) return; dc_iscale = skyiscale; - clearbuf (swall+pl->minx, pl->maxx-pl->minx+1, dc_iscale<<2); + clearbuf (swall+pl->left, pl->right-pl->left, dc_iscale<<2); if (MirrorFlags & RF_XFLIP) { - for (x = pl->minx; x <= pl->maxx; ++x) + for (x = pl->left; x < pl->right; ++x) { lwall[x] = (viewwidth - x) << FRACBITS; } } else { - for (x = pl->minx; x <= pl->maxx; ++x) + for (x = pl->left; x < pl->right; ++x) { lwall[x] = x << FRACBITS; } @@ -961,7 +961,7 @@ static void R_DrawSky (visplane_t *pl) { lastskycol[x] = 0xffffffff; } - wallscan (pl->minx, pl->maxx, (short *)pl->top, (short *)pl->bottom, swall, lwall, + wallscan (pl->left, pl->right, (short *)pl->top, (short *)pl->bottom, swall, lwall, frontyScale, backskytex == NULL ? R_GetOneSkyColumn : R_GetTwoSkyColumns); } else @@ -1001,7 +1001,7 @@ static void R_DrawSkyStriped (visplane_t *pl) while (yl < viewheight) { - for (x = pl->minx; x <= pl->maxx; ++x) + for (x = pl->left; x < pl->right; ++x) { top[x] = MAX (yl, (short)pl->top[x]); bot[x] = MIN (yh, (short)pl->bottom[x]); @@ -1010,7 +1010,7 @@ static void R_DrawSkyStriped (visplane_t *pl) { lastskycol[x] = 0xffffffff; } - wallscan (pl->minx, pl->maxx, top, bot, swall, lwall, rw_pic->yScale, + wallscan (pl->left, pl->right, top, bot, swall, lwall, rw_pic->yScale, backskytex == NULL ? R_GetOneSkyColumn : R_GetTwoSkyColumns); yl = yh; yh += drawheight; @@ -1094,7 +1094,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske { // pl->angle = pa<minx > pl->maxx) + if (pl->left >= pl->right) return; if (r_drawflat) @@ -1205,7 +1205,7 @@ void R_DrawSkyBoxes () visplanes[MAXVISPLANES] = pl->next; pl->next = NULL; - if (pl->maxx < pl->minx || !r_skyboxes || numskyboxes == MAX_SKYBOX_PLANES) + if (pl->right < pl->left || !r_skyboxes || numskyboxes == MAX_SKYBOX_PLANES) { R_DrawSinglePlane (pl, OPAQUE, false, false); *freehead = pl; @@ -1250,11 +1250,11 @@ void R_DrawSkyBoxes () validcount++; // Make sure we see all sprites R_ClearPlanes (false); - R_ClearClipSegs (pl->minx, pl->maxx + 1); - WindowLeft = pl->minx; - WindowRight = pl->maxx; + R_ClearClipSegs (pl->left, pl->right); + WindowLeft = pl->left; + WindowRight = pl->right; - for (i = pl->minx; i <= pl->maxx; i++) + for (i = pl->left; i < pl->right; i++) { if (pl->top[i] == 0x7fff) { @@ -1274,16 +1274,16 @@ void R_DrawSkyBoxes () ds_p->siz2 = INT_MAX; ds_p->sz1 = 0; ds_p->sz2 = 0; - ds_p->x1 = pl->minx; - ds_p->x2 = pl->maxx; + ds_p->x1 = pl->left; + ds_p->x2 = pl->right; ds_p->silhouette = SIL_BOTH; - ds_p->sprbottomclip = R_NewOpening (pl->maxx - pl->minx + 1); - ds_p->sprtopclip = R_NewOpening (pl->maxx - pl->minx + 1); + ds_p->sprbottomclip = R_NewOpening (pl->right - pl->left); + ds_p->sprtopclip = R_NewOpening (pl->right - pl->left); ds_p->maskedtexturecol = ds_p->swall = -1; ds_p->bFogBoundary = false; ds_p->fake = 0; - memcpy (openings + ds_p->sprbottomclip, floorclip + pl->minx, (pl->maxx - pl->minx + 1)*sizeof(short)); - memcpy (openings + ds_p->sprtopclip, ceilingclip + pl->minx, (pl->maxx - pl->minx + 1)*sizeof(short)); + memcpy (openings + ds_p->sprbottomclip, floorclip + pl->left, (pl->right - pl->left)*sizeof(short)); + memcpy (openings + ds_p->sprtopclip, ceilingclip + pl->left, (pl->right - pl->left)*sizeof(short)); firstvissprite = vissprite_p; firstdrawseg = ds_p++; @@ -1542,7 +1542,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske ystepscale = (DWORD)(-(SDWORD)ystepscale); } - int x = pl->maxx - halfviewwidth; + int x = pl->right - halfviewwidth - 1; planeang = (planeang + (ANG90 >> ANGLETOFINESHIFT)) & FINEMASK; basexfrac = FixedMul (xscale, finecosine[planeang]) + x*xstepscale; baseyfrac = FixedMul (yscale, -finesine[planeang]) + x*ystepscale; @@ -1742,7 +1742,7 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1)) { - int x = pl->maxx; + int x = pl->right - 1; int t2 = pl->top[x]; int b2 = pl->bottom[x]; @@ -1751,7 +1751,7 @@ void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1)) clearbufshort (spanend+t2, b2-t2, x); } - for (--x; x >= pl->minx; --x) + for (--x; x >= pl->left; --x) { int t1 = pl->top[x]; int b1 = pl->bottom[x]; @@ -1790,7 +1790,7 @@ void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1)) // Draw any spans that are still open while (t2 < b2) { - mapfunc (--b2, pl->minx); + mapfunc (--b2, pl->left); } } diff --git a/src/r_plane.h b/src/r_plane.h index 231fa3ad4c..cb1448dcca 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -38,7 +38,7 @@ struct visplane_s FTextureID picnum; int lightlevel; fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats - int minx, maxx; + int left, right; FDynamicColormap *colormap; // [RH] Support multiple colormaps fixed_t xscale, yscale; // [RH] Support flat scaling angle_t angle; // [RH] Support flat rotation diff --git a/src/r_segs.cpp b/src/r_segs.cpp index ebf525569f..d55b31bbee 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -206,13 +206,13 @@ void ClipMidtex(int x1, int x2) short most[MAXWIDTH]; WallMost(most, curline->frontsector->ceilingplane, &WallC); - for (int i = x1; i <= x2; ++i) + for (int i = x1; i < x2; ++i) { if (wallupper[i] < most[i]) wallupper[i] = most[i]; } WallMost(most, curline->frontsector->floorplane, &WallC); - for (int i = x1; i <= x2; ++i) + for (int i = x1; i < x2; ++i) { if (walllower[i] > most[i]) walllower[i] = most[i]; @@ -398,12 +398,12 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) OWallMost(walllower, textop - texheight, &WallC); } - for (i = x1; i <= x2; i++) + for (i = x1; i < x2; i++) { if (wallupper[i] < mceilingclip[i]) wallupper[i] = mceilingclip[i]; } - for (i = x1; i <= x2; i++) + for (i = x1; i < x2; i++) { if (walllower[i] > mfloorclip[i]) walllower[i] = mfloorclip[i]; @@ -426,7 +426,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) // draw the columns one at a time if (drawmode == DoDraw0) { - for (dc_x = x1; dc_x <= x2; ++dc_x) + for (dc_x = x1; dc_x < x2; ++dc_x) { BlastMaskedColumn (R_DrawMaskedColumn, tex); } @@ -434,9 +434,9 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) else { // [RH] Draw up to four columns at once - int stop = (x2+1) & ~3; + int stop = x2 & ~3; - if (x1 > x2) + if (x1 >= x2) goto clearfog; dc_x = x1; @@ -458,7 +458,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) dc_x++; } - while (dc_x <= x2) + while (dc_x < x2) { BlastMaskedColumn (R_DrawMaskedColumn, tex); dc_x++; @@ -486,7 +486,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) if (fake3D & FAKE3D_CLIPTOP) { OWallMost(wallupper, sclipTop - viewz, &WallC); - for (i = x1; i <= x2; i++) + for (i = x1; i < x2; i++) { if (wallupper[i] < mceilingclip[i]) wallupper[i] = mceilingclip[i]; @@ -496,7 +496,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) if (fake3D & FAKE3D_CLIPBOTTOM) { OWallMost(walllower, sclipBottom - viewz, &WallC); - for (i = x1; i <= x2; i++) + for (i = x1; i < x2; i++) { if (walllower[i] > mfloorclip[i]) walllower[i] = mfloorclip[i]; @@ -520,11 +520,11 @@ clearfog: if (fake3D & FAKE3D_REFRESHCLIP) { assert(ds->bkup >= 0); - memcpy(openings + ds->sprtopclip, openings + ds->bkup, (ds->x2-ds->x1+1) * 2); + memcpy(openings + ds->sprtopclip, openings + ds->bkup, (ds->x2 - ds->x1) * 2); } else { - clearbufshort(openings + ds->sprtopclip - ds->x1 + x1, x2-x1+1, viewheight); + clearbufshort(openings + ds->sprtopclip - ds->x1 + x1, x2 - x1, viewheight); } } return; @@ -539,7 +539,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) fixed_t Alpha = Scale(rover->alpha, OPAQUE, 255); ESPSResult drawmode; drawmode = R_SetPatchStyle (LegacyRenderStyles[rover->flags & FF_ADDITIVETRANS ? STYLE_Add : STYLE_Translucent], - Alpha, 0, 0); + Alpha, 0, 0); if(drawmode == DontDraw) { R_FinishSetPatchStyle(); @@ -617,12 +617,12 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) OWallMost(wallupper, sclipTop - viewz, &WallC); OWallMost(walllower, sclipBottom - viewz, &WallC); - for (i = x1; i <= x2; i++) + for (i = x1; i < x2; i++) { if (wallupper[i] < mceilingclip[i]) wallupper[i] = mceilingclip[i]; } - for (i = x1; i <= x2; i++) + for (i = x1; i < x2; i++) { if (walllower[i] > mfloorclip[i]) walllower[i] = mfloorclip[i]; @@ -1093,7 +1093,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t palookupoffse[3] = dc_colormap; } - for(; (x <= x2) && (x & 3); ++x) + for(; (x < x2) && (x & 3); ++x) { light += rw_lightstep; y1ve[0] = uwal[x];//max(uwal[x],umost[x]); @@ -1116,7 +1116,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t dovline1(); } - for(; x <= x2-3; x += 4) + for(; x < x2-3; x += 4) { bad = 0; for (z = 3; z>= 0; --z) @@ -1186,7 +1186,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t } } } - for(;x<=x2;x++) + for(;x x2); + assert(WallC.sx2 >= x2); // kg3D - fake floors instead of zdoom light list for (unsigned int i = 0; i < frontsector->e->XFloor.lightlist.Size(); i++) @@ -1235,7 +1235,7 @@ void wallscan_striped (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, int j = WallMost (most3, frontsector->e->XFloor.lightlist[i].plane, &WallC); if (j != 3) { - for (int j = x1; j <= x2; ++j) + for (int j = x1; j < x2; ++j) { down[j] = clamp (most3[j], up[j], dwal[j]); } @@ -1317,7 +1317,7 @@ void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed int j = OWallMost(most3, partition - viewz, &WallC); if (j != 3) { - for (int j = x1; j <= x2; ++j) + for (int j = x1; j < x2; ++j) { down[j] = clamp(most3[j], up[j], dwal[j]); } @@ -1341,7 +1341,7 @@ void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed int j = OWallMost(most3, partition - viewz, &WallC); if (j != 12) { - for (int j = x1; j <= x2; ++j) + for (int j = x1; j < x2; ++j) { up[j] = clamp(most3[j], uwal[j], down[j]); } @@ -1460,7 +1460,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe domvline1(); } - for(; x <= x2-3; x += 4, p+= 4) + for(; x < x2-3; x += 4, p+= 4) { bad = 0; for (z = 3, dax = x+3; z >= 0; --z, --dax) @@ -1528,7 +1528,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe } } } - for(; x <= x2; ++x, ++p) + for(; x < x2; ++x, ++p) { light += rw_lightstep; y1ve[0] = uwal[x]; @@ -1612,7 +1612,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, palookupoffse[3] = dc_colormap; } - for(; (x <= x2) && ((size_t)p & 3); ++x, ++p) + for(; (x < x2) && ((size_t)p & 3); ++x, ++p) { light += rw_lightstep; y1ve[0] = uwal[x];//max(uwal[x],umost[x]); @@ -1633,7 +1633,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, tmvline1(); } - for(; x <= x2-3; x += 4, p+= 4) + for(; x < x2-3; x += 4, p+= 4) { bad = 0; for (z = 3, dax = x+3; z >= 0; --z, --dax) @@ -1704,7 +1704,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, } } } - for(; x <= x2; ++x, ++p) + for(; x < x2; ++x, ++p) { light += rw_lightstep; y1ve[0] = uwal[x]; @@ -1855,11 +1855,11 @@ void R_RenderSegLoop () } if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits) { - wallscan_np2(x1, x2-1, walltop, wallbottom, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false); + wallscan_np2(x1, x2, walltop, wallbottom, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false); } else { - call_wallscan(x1, x2-1, walltop, wallbottom, swall, lwall, yscale, false); + call_wallscan(x1, x2, walltop, wallbottom, swall, lwall, yscale, false); } } clearbufshort (ceilingclip+x1, x2-x1, viewheight); @@ -1898,11 +1898,11 @@ void R_RenderSegLoop () } if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits) { - wallscan_np2(x1, x2-1, walltop, wallupper, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false); + wallscan_np2(x1, x2, walltop, wallupper, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false); } else { - call_wallscan(x1, x2-1, walltop, wallupper, swall, lwall, yscale, false); + call_wallscan(x1, x2, walltop, wallupper, swall, lwall, yscale, false); } } memcpy (ceilingclip+x1, wallupper+x1, (x2-x1)*sizeof(short)); @@ -1944,11 +1944,11 @@ void R_RenderSegLoop () } if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits) { - wallscan_np2(x1, x2-1, walllower, wallbottom, swall, lwall, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false); + wallscan_np2(x1, x2, walllower, wallbottom, swall, lwall, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false); } else { - call_wallscan(x1, x2-1, walllower, wallbottom, swall, lwall, yscale, false); + call_wallscan(x1, x2, walllower, wallbottom, swall, lwall, yscale, false); } } memcpy (floorclip+x1, walllower+x1, (x2-x1)*sizeof(short)); @@ -2368,7 +2368,7 @@ void R_StoreWallRange (int start, int stop) ds_p->siz1 = (DWORD)DivScale32 (1, WallC.sz1) >> 1; ds_p->siz2 = (DWORD)DivScale32 (1, WallC.sz2) >> 1; ds_p->x1 = rw_x = start; - ds_p->x2 = stop-1; + ds_p->x2 = stop; ds_p->curline = curline; rw_stopx = stop; ds_p->bFogBoundary = false; @@ -2547,7 +2547,7 @@ void R_StoreWallRange (int start, int stop) { if (ceilingplane) { // killough 4/11/98: add NULL ptr checks - ceilingplane = R_CheckPlane (ceilingplane, start, stop-1); + ceilingplane = R_CheckPlane (ceilingplane, start, stop); } else { @@ -2559,7 +2559,7 @@ void R_StoreWallRange (int start, int stop) { if (floorplane) { // killough 4/11/98: add NULL ptr checks - floorplane = R_CheckPlane (floorplane, start, stop-1); + floorplane = R_CheckPlane (floorplane, start, stop); } else { @@ -2707,8 +2707,8 @@ int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc) #endif if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight; - if (mostbuf[ix2] < 0) mostbuf[ix2] = 0; - else if (mostbuf[ix2] > viewheight) mostbuf[ix2] = (short)viewheight; + if (mostbuf[ix2-1] < 0) mostbuf[ix2-1] = 0; + else if (mostbuf[ix2-1] > viewheight) mostbuf[ix2-1] = (short)viewheight; return bad; } @@ -2865,8 +2865,8 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc) if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight; - if (mostbuf[ix2] < 0) mostbuf[ix2] = 0; - else if (mostbuf[ix2] > viewheight) mostbuf[ix2] = (short)viewheight; + if (mostbuf[ix2-1] < 0) mostbuf[ix2-1] = 0; + else if (mostbuf[ix2-1] > viewheight) mostbuf[ix2-1] = (short)viewheight; return bad; } @@ -3063,7 +3063,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, x1 = WallC.sx1; x2 = WallC.sx2; - if (x1 > clipper->x2 || x2 <= clipper->x1) + if (x1 >= clipper->x2 || x2 <= clipper->x1) goto done; WallT.InitFromWallCoords(&WallC); @@ -3126,14 +3126,8 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, dc_texturemid = topoff + FixedDiv (zpos - viewz, yscale); // Clip sprite to drawseg - if (x1 < clipper->x1) - { - x1 = clipper->x1; - } - if (x2 > clipper->x2) - { - x2 = clipper->x2 + 1; - } + x1 = MAX(clipper->x1, x1); + x2 = MIN(clipper->x2, x2); if (x1 >= x2) { goto done; diff --git a/src/r_things.cpp b/src/r_things.cpp index 8ad5f76a9a..57a82ebb01 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -352,7 +352,7 @@ void R_DrawVisSprite (vissprite_t *vis) else // DoDraw1 { // Up to four columns at a time - stop4 = (vis->x2 + 1) & ~3; + stop4 = vis->x2 & ~3; } tex = vis->pic; @@ -366,7 +366,7 @@ void R_DrawVisSprite (vissprite_t *vis) sprtopscreen = centeryfrac - FixedMul (dc_texturemid, spryscale); dc_x = vis->x1; - x2 = vis->x2 + 1; + x2 = vis->x2; if (dc_x < x2) { @@ -412,7 +412,7 @@ void R_DrawWallSprite(vissprite_t *spr) fixed_t yscale; x1 = MAX(spr->x1, spr->wallc.sx1); - x2 = MIN(spr->x2 + 1, spr->wallc.sx2 + 1); + x2 = MIN(spr->x2, spr->wallc.sx2); if (x1 >= x2) return; WallT.InitFromWallCoords(&spr->wallc); @@ -868,7 +868,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor x1 = centerx + MulScale32 (tx, xscale); // off the right side? - if (x1 > WindowRight) + if (x1 >= WindowRight) return; tx += tex->GetWidth() * thingxscalemul; @@ -880,7 +880,6 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor xscale = FixedDiv(FixedMul(spritescaleX, xscale), tex->xScale); iscale = (tex->GetWidth() << FRACBITS) / (x2 - x1); - x2--; fixed_t yscale = SafeDivScale16(spritescaleY, tex->yScale); @@ -1062,7 +1061,7 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f if (wallc.Init(lx1, ly1, lx2, ly2, TOO_CLOSE_Z)) return; - if (wallc.sx1 > WindowRight || wallc.sx2 <= WindowLeft) + if (wallc.sx1 >= WindowRight || wallc.sx2 <= WindowLeft) return; // Sprite sorting should probably treat these as walls, not sprites, @@ -1076,7 +1075,7 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f vis = R_NewVisSprite(); vis->x1 = wallc.sx1 < WindowLeft ? WindowLeft : wallc.sx1; - vis->x2 = wallc.sx2 >= WindowRight ? WindowRight : wallc.sx2-1; + vis->x2 = wallc.sx2 >= WindowRight ? WindowRight : wallc.sx2; vis->yscale = yscale; vis->idepth = (unsigned)DivScale32(1, tz) >> 1; vis->depth = tz; @@ -1213,10 +1212,10 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ return; tx += tex->GetScaledWidth() << FRACBITS; - x2 = ((centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS) - 1; + x2 = ((centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS); // off the left side - if (x2 < 0) + if (x2 <= 0) return; // store information in a vissprite @@ -1255,7 +1254,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ vis->texturemid -= BaseRatioSizes[WidescreenRatio][2]; } vis->x1 = x1 < 0 ? 0 : x1; - vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; + vis->x2 = x2 >= viewwidth ? viewwidth : x2; vis->xscale = DivScale16(pspritexscale, tex->xScale); vis->yscale = DivScale16(pspriteyscale, tex->yScale); vis->Translation = 0; // [RH] Use default colors @@ -1807,7 +1806,7 @@ void R_DrawSprite (vissprite_t *spr) x2 = spr->x2; // [RH] Quickly reject sprites with bad x ranges. - if (x1 > x2) + if (x1 >= x2) return; // [RH] Sprites split behind a one-sided line can also be discarded. @@ -2050,7 +2049,7 @@ void R_DrawSprite (vissprite_t *spr) return; } - i = x2 - x1 + 1; + i = x2 - x1; clip1 = clipbot + x1; clip2 = cliptop + x1; do @@ -2073,7 +2072,7 @@ void R_DrawSprite (vissprite_t *spr) // kg3D - no clipping on fake segs if(ds->fake) continue; // determine if the drawseg obscures the sprite - if (ds->x1 > x2 || ds->x2 < x1 || + if (ds->x1 >= x2 || ds->x2 <= x1 || (!(ds->silhouette & SIL_BOTH) && ds->maskedtexturecol == -1 && !ds->bFogBoundary) ) { @@ -2116,7 +2115,7 @@ void R_DrawSprite (vissprite_t *spr) { clip1 = clipbot + r1; clip2 = openings + ds->sprbottomclip + r1 - ds->x1; - i = r2 - r1 + 1; + i = r2 - r1; do { if (*clip1 > *clip2) @@ -2130,7 +2129,7 @@ void R_DrawSprite (vissprite_t *spr) { clip1 = cliptop + r1; clip2 = openings + ds->sprtopclip + r1 - ds->x1; - i = r2 - r1 + 1; + i = r2 - r1; do { if (*clip1 < *clip2) @@ -2182,7 +2181,7 @@ void R_DrawSprite (vissprite_t *spr) } if (x2 < viewwidth - 1) { - clearbufshort(cliptop + x2 + 1, viewwidth - x2 - 1, viewheight); + clearbufshort(cliptop + x2, viewwidth - x2, viewheight); } int minvoxely = spr->gzt <= hzt ? 0 : (spr->gzt - hzt) / spr->yscale; int maxvoxely = spr->gzb > hzb ? INT_MAX : (spr->gzt - hzb) / spr->yscale; @@ -2459,13 +2458,13 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis) drawseg_t *ds = &drawsegs[InterestingDrawsegs[p]]; // kg3D - no fake segs if(ds->fake) continue; - if (ds->x1 >= x2 || ds->x2 < x1) + if (ds->x1 >= x2 || ds->x2 <= x1) { continue; } if (Scale (ds->siz2 - ds->siz1, (x2 + x1)/2 - ds->sx1, ds->sx2 - ds->sx1) + ds->siz1 < vis->idepth) { - R_RenderMaskedSegRange (ds, MAX (ds->x1, x1), MIN (ds->x2, x2-1)); + R_RenderMaskedSegRange (ds, MAX(ds->x1, x1), MIN(ds->x2, x2)); } } } @@ -2480,7 +2479,7 @@ void R_DrawParticle (vissprite_t *vis) int yl = vis->gzb; int ycount = vis->gzt - yl + 1; int x1 = vis->x1; - int countbase = vis->x2 - x1 + 1; + int countbase = vis->x2 - x1; R_DrawMaskedSegsBehindParticle (vis); diff --git a/src/sound/i_sound.cpp b/src/sound/i_sound.cpp index 78c4526e86..8997c91572 100644 --- a/src/sound/i_sound.cpp +++ b/src/sound/i_sound.cpp @@ -283,6 +283,7 @@ void I_InitSound () if ((!GSnd || !GSnd->IsValid()) && IsOpenALPresent()) { Printf (TEXTCOLOR_RED"FMod Ex Sound init failed. Trying OpenAL.\n"); + I_CloseSound(); GSnd = new OpenALSoundRenderer; snd_backend = "openal"; } @@ -300,6 +301,7 @@ void I_InitSound () if ((!GSnd || !GSnd->IsValid()) && IsFModExPresent()) { Printf (TEXTCOLOR_RED"OpenAL Sound init failed. Trying FMod Ex.\n"); + I_CloseSound(); GSnd = new FMODSoundRenderer; snd_backend = "fmod"; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 85f0c46755..f49b925230 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4975,6 +4975,133 @@ enum RadiusGiveFlags RGF_EITHER = 1 << 17, }; +static bool DoRadiusGive(AActor *self, AActor *thing, const PClass *item, int amount, fixed_t distance, int flags, const PClass *filter, FName species, fixed_t mindist) +{ + // [MC] We only want to make an exception for missiles here. Nothing else. + bool missilePass = !!((flags & RGF_MISSILES) && thing->isMissile()); + if (thing == self) + { + if (!(flags & RGF_GIVESELF)) + return false; + } + else if (thing->isMissile()) + { + if (!missilePass) + return false; + } + + //[MC] Check for a filter, species, and the related exfilter/expecies/either flag(s). + bool filterpass = DoCheckClass(thing, filter, !!(flags & RGF_EXFILTER)), + speciespass = DoCheckSpecies(thing, species, !!(flags & RGF_EXSPECIES)); + + if ((flags & RGF_EITHER) ? (!(filterpass || speciespass)) : (!(filterpass && speciespass))) + { + if (thing != self) //Don't let filter and species obstruct RGF_GIVESELF. + return false; + } + + //Check for target, master, and tracer flagging. + bool targetPass = true; + bool masterPass = true; + bool tracerPass = true; + bool ptrPass = false; + if ((thing != self) && (flags & (RGF_NOTARGET | RGF_NOMASTER | RGF_NOTRACER))) + { + if ((thing == self->target) && (flags & RGF_NOTARGET)) + targetPass = false; + if ((thing == self->master) && (flags & RGF_NOMASTER)) + masterPass = false; + if ((thing == self->tracer) && (flags & RGF_NOTRACER)) + tracerPass = false; + + ptrPass = (flags & RGF_INCLUSIVE) ? (targetPass || masterPass || tracerPass) : (targetPass && masterPass && tracerPass); + + //We should not care about what the actor is here. It's safe to abort this actor. + if (!ptrPass) + return false; + } + + //Next, actor flag checking. + bool selfPass = !!((flags & RGF_GIVESELF) && thing == self); + bool corpsePass = !!((flags & RGF_CORPSES) && thing->flags & MF_CORPSE); + bool killedPass = !!((flags & RGF_KILLED) && thing->flags6 & MF6_KILLED); + bool monsterPass = !!((flags & RGF_MONSTERS) && thing->flags3 & MF3_ISMONSTER); + bool objectPass = !!((flags & RGF_OBJECTS) && (thing->player == NULL) && (!(thing->flags3 & MF3_ISMONSTER)) + && ((thing->flags & MF_SHOOTABLE) || (thing->flags6 & MF6_VULNERABLE))); + bool playerPass = !!((flags & RGF_PLAYERS) && (thing->player != NULL) && (thing->player->mo == thing)); + bool voodooPass = !!((flags & RGF_VOODOO) && (thing->player != NULL) && (thing->player->mo != thing)); + //Self calls priority over the rest of this. + if (!selfPass) + { + //If it's specifically a monster/object/player/voodoo... Can be either or... + if (monsterPass || objectPass || playerPass || voodooPass) + { + //...and is dead, without desire to give to the dead... + if (((thing->health <= 0) && !(corpsePass || killedPass))) + { + //Skip! + return false; + } + } + } + + bool itemPass = !!((flags & RGF_ITEMS) && thing->IsKindOf(RUNTIME_CLASS(AInventory))); + + if (selfPass || monsterPass || corpsePass || killedPass || itemPass || objectPass || missilePass || playerPass || voodooPass) + { + + fixedvec3 diff = self->Vec3To(thing); + diff.z += (thing->height - self->height) / 2; + if (flags & RGF_CUBE) + { // check if inside a cube + double dx = fabs((double)(diff.x)); + double dy = fabs((double)(diff.y)); + double dz = fabs((double)(diff.z)); + double dist = (double)distance; + double min = (double)mindist; + if ((dx > dist || dy > dist || dz > dist) || (min && (dx < min && dy < min && dz < min))) + { + return false; + } + } + else + { // check if inside a sphere + double distsquared = double(distance) * double(distance); + double minsquared = double(mindist) * double(mindist); + double lengthsquared = TVector3(diff.x, diff.y, diff.z).LengthSquared(); + if (lengthsquared > distsquared || (minsquared && (lengthsquared < minsquared))) + { + return false; + } + } + + if ((flags & RGF_NOSIGHT) || P_CheckSight(thing, self, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)) + { // OK to give; target is in direct path, or the monster doesn't care about it being in line of sight. + AInventory *gift = static_cast(Spawn(item, 0, 0, 0, NO_REPLACE)); + if (gift->IsKindOf(RUNTIME_CLASS(AHealth))) + { + gift->Amount *= amount; + } + else + { + gift->Amount = amount; + } + gift->flags |= MF_DROPPED; + gift->ClearCounters(); + if (!gift->CallTryPickup(thing)) + { + gift->Destroy(); + return false; + } + else + { + return true; + } + } + } + return false; +} + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) { ACTION_PARAM_START(7); @@ -4997,126 +5124,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) { amount = 1; } - FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), distance)); - AActor *thing; bool given = false; - while ((thing = it.Next())) + if (flags & RGF_MISSILES) { - //[MC] Check for a filter, species, and the related exfilter/expecies/either flag(s). - bool filterpass = DoCheckClass(thing, filter, !!(flags & RGF_EXFILTER)), - speciespass = DoCheckSpecies(thing, species, !!(flags & RGF_EXSPECIES)); - - if ((flags & RGF_EITHER) ? (!(filterpass || speciespass)) : (!(filterpass && speciespass))) + TThinkerIterator it; + while ((thing = it.Next())) { - if (thing != self) //Don't let filter and species obstruct RGF_GIVESELF. - continue; + if (DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist)) given = true; } - - if (thing == self) + } + else + { + FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), distance)); + while ((thing = it.Next())) { - if (!(flags & RGF_GIVESELF)) - continue; - } - - //Check for target, master, and tracer flagging. - bool targetPass = true; - bool masterPass = true; - bool tracerPass = true; - bool ptrPass = false; - if ((thing != self) && (flags & (RGF_NOTARGET | RGF_NOMASTER | RGF_NOTRACER))) - { - if ((thing == self->target) && (flags & RGF_NOTARGET)) - targetPass = false; - if ((thing == self->master) && (flags & RGF_NOMASTER)) - masterPass = false; - if ((thing == self->tracer) && (flags & RGF_NOTRACER)) - tracerPass = false; - - ptrPass = (flags & RGF_INCLUSIVE) ? (targetPass || masterPass || tracerPass) : (targetPass && masterPass && tracerPass); - - //We should not care about what the actor is here. It's safe to abort this actor. - if (!ptrPass) - continue; - } - - //Next, actor flag checking. - bool selfPass = !!((flags & RGF_GIVESELF) && thing == self); - bool corpsePass = !!((flags & RGF_CORPSES) && thing->flags & MF_CORPSE); - bool killedPass = !!((flags & RGF_KILLED) && thing->flags6 & MF6_KILLED); - bool monsterPass = !!((flags & RGF_MONSTERS) && thing->flags3 & MF3_ISMONSTER); - bool objectPass = !!((flags & RGF_OBJECTS) && (thing->player == NULL) && (!(thing->flags3 & MF3_ISMONSTER)) - && ((thing->flags & MF_SHOOTABLE) || (thing->flags6 & MF6_VULNERABLE))); - bool playerPass = !!((flags & RGF_PLAYERS) && (thing->player != NULL) && (thing->player->mo == thing)); - bool voodooPass = !!((flags & RGF_VOODOO) && (thing->player != NULL) && (thing->player->mo != thing)); - //Self calls priority over the rest of this. - if (!selfPass) - { - //If it's specifically a monster/object/player/voodoo... Can be either or... - if (monsterPass || objectPass || playerPass || voodooPass) - { - //...and is dead, without desire to give to the dead... - if (((thing->health <= 0) && !(corpsePass || killedPass))) - { - //Skip! - continue; - } - } - } - - bool itemPass = !!((flags & RGF_ITEMS) && thing->IsKindOf(RUNTIME_CLASS(AInventory))); - bool missilePass = !!((flags & RGF_MISSILES) && thing->flags & MF_MISSILE); - - if (selfPass || monsterPass || corpsePass || killedPass || itemPass || objectPass || missilePass || playerPass || voodooPass) - { - - fixedvec3 diff = self->Vec3To(thing); - diff.z += (thing->height - self->height) / 2; - if (flags & RGF_CUBE) - { // check if inside a cube - double dx = fabs((double)(diff.x)); - double dy = fabs((double)(diff.y)); - double dz = fabs((double)(diff.z)); - double dist = (double)distance; - double min = (double)mindist; - if ((dx > dist || dy > dist || dz > dist) || (min && (dx < min && dy < min && dz < min))) - { - continue; - } - } - else - { // check if inside a sphere - double distsquared = double(distance) * double(distance); - double minsquared = double(mindist) * double(mindist); - double lengthsquared = TVector3(diff.x, diff.y, diff.z).LengthSquared(); - if (lengthsquared > distsquared || (minsquared && (lengthsquared < minsquared))) - { - continue; - } - } - - if ((flags & RGF_NOSIGHT) || P_CheckSight(thing, self, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)) - { // OK to give; target is in direct path, or the monster doesn't care about it being in line of sight. - AInventory *gift = static_cast(Spawn(item, 0, 0, 0, NO_REPLACE)); - if (gift->IsKindOf(RUNTIME_CLASS(AHealth))) - { - gift->Amount *= amount; - } - else - { - gift->Amount = amount; - } - gift->flags |= MF_DROPPED; - gift->ClearCounters(); - if (!gift->CallTryPickup(thing)) - { - gift->Destroy(); - } - else - { - given = true; - } - } + if (DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist)) given = true; } } ACTION_SET_RESULT(given); diff --git a/src/v_video.cpp b/src/v_video.cpp index d48bd91ae3..042469193c 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1424,13 +1424,11 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real *cleany = cy2; } - if (*cleanx > 1 && *cleany > 1 && *cleanx != *cleany) - { - if (*cleanx < *cleany) - *cleany = *cleanx; - else - *cleanx = *cleany; - } + if (*cleanx < *cleany) + *cleany = *cleanx; + else + *cleanx = *cleany; + if (_cx1 != NULL) *_cx1 = cx1; if (_cx2 != NULL) *_cx2 = cx2; } diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 941fc15de1..328caea061 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -525,6 +525,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_DISPLAYCHANGE: + case WM_STYLECHANGED: if (SpawnEAXWindow) { SpawnEAXWindow = false; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 731e779bf2..0417d7a89b 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -364,18 +364,6 @@ OptionValue "Gender" 2, "Other" } -OptionValue "Autoaim" -{ - 0, "Never" - 1, "Very low" - 2, "Low" - 3, "Medium" - 4, "High" - 5, "Very high" - 6, "Always" -} - - ListMenu "PlayerMenu" { StaticTextCentered 160, 6, "$MNU_PLAYERSETUP" @@ -414,7 +402,7 @@ ListMenu "PlayerMenu" ValueText "Class", "Class" ValueText "Skin", "Skin" ValueText "Gender", "Gender", "Gender" - ValueText "Autoaim", "Autoaim", "Autoaim" + Slider "Autoaim", "Autoaim", 0, 35, 1 ValueText "Switch on pickup", "Switch", "OffOn" ValueText "Always Run", "AlwaysRun", "OnOff" Class "PlayerMenu" @@ -710,6 +698,8 @@ OptionMenu "VideoOptions" Option "Teleporter zoom", "telezoom", "OnOff" Slider "Earthquake shake intensity", "r_quakeintensity", 0.0, 1.0, 0.05, 2 Option "Interpolate monster movement", "nomonsterinterpolation", "NoYes" + Slider "Menu dim", "dimamount", 0, 1.0, 0.05, 2 + ColorPicker "Dim color", "dimcolor" } //-------------------------------------------------------------------------------------------