diff --git a/src/actor.h b/src/actor.h index c2be0554f..32a972699 100644 --- a/src/actor.h +++ b/src/actor.h @@ -380,6 +380,7 @@ enum ActorFlag7 MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's. MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced. MF7_ICESHATTER = 0x00200000, // [MC] Shatters ice corpses regardless of damagetype. + MF7_ALLOWTHRUFLAGS = 0x00400000, // [MC] Allow THRUACTORS and the likes on puffs to prevent mod breakage. }; // --- mobj.renderflags --- diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index a970f8969..f2f2e9b57 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -37,7 +37,8 @@ DEarthquake::DEarthquake() DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesound, int flags, - double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint) + double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, + double rollWave) : DThinker(STAT_EARTHQUAKE) { m_QuakeSFX = quakesound; @@ -53,6 +54,8 @@ DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int int m_Falloff = falloff; m_Highpoint = highpoint; m_MiniCount = highpoint; + m_RollIntensity = rollIntensity; + m_RollWave = rollWave; } //========================================================================== @@ -69,6 +72,10 @@ void DEarthquake::Serialize (FArchive &arc) << m_QuakeSFX << m_Flags << m_CountdownStart << m_WaveSpeed << m_Falloff << m_Highpoint << m_MiniCount; + if (SaveVersion >= 4544) + { + arc << m_RollIntensity << m_RollWave; + } } //========================================================================== @@ -281,11 +288,12 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger double x = quake->GetModIntensity(quake->m_Intensity.X); double y = quake->GetModIntensity(quake->m_Intensity.Y); double z = quake->GetModIntensity(quake->m_Intensity.Z); - + double r = quake->GetModIntensity(quake->m_RollIntensity); if (!(quake->m_Flags & QF_WAVE)) { jiggers.Falloff = MAX(falloff, jiggers.Falloff); + jiggers.RollIntensity = MAX(r, jiggers.RollIntensity); if (quake->m_Flags & QF_RELATIVE) { jiggers.RelIntensity.X = MAX(x, jiggers.RelIntensity.X); @@ -302,9 +310,11 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger else { jiggers.WFalloff = MAX(falloff, jiggers.WFalloff); + double mr = r * quake->GetModWave(quake->m_RollWave); double mx = x * quake->GetModWave(quake->m_WaveSpeed.X); double my = y * quake->GetModWave(quake->m_WaveSpeed.Y); double mz = z * quake->GetModWave(quake->m_WaveSpeed.Z); + jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave); // [RH] This only gives effect to the last sine quake. I would // prefer if some way was found to make multiples coexist @@ -338,7 +348,8 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, - double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint) + double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, + int rollIntensity, double rollWave) { AActor *center; bool res = false; @@ -352,7 +363,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, if (activator != NULL) { new DEarthquake(activator, intensityX, intensityY, intensityZ, duration, damrad, tremrad, - quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint); + quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave); return true; } } @@ -363,7 +374,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, { res = true; new DEarthquake(center, intensityX, intensityY, intensityZ, duration, damrad, tremrad, - quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint); + quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave); } } @@ -372,5 +383,5 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx) { //Maintains original behavior by passing 0 to intensityZ, flags, and everything else after QSFX. - return P_StartQuakeXYZ(activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0); + return P_StartQuakeXYZ(activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0, 0, 0); } diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index f746375d3..e3a30fc67 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -153,8 +153,8 @@ struct FQuakeJiggers DVector3 RelIntensity; DVector3 Offset; DVector3 RelOffset; - double Falloff; - double WFalloff; + double Falloff, WFalloff; + double RollIntensity, RollWave; }; class DEarthquake : public DThinker @@ -164,7 +164,7 @@ class DEarthquake : public DThinker public: DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, - double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint); + double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave); void Serialize (FArchive &arc); void Tick (); @@ -178,6 +178,8 @@ public: DVector3 m_WaveSpeed; double m_Falloff; int m_Highpoint, m_MiniCount; + double m_RollIntensity, m_RollWave; + double GetModIntensity(double intensity) const; double GetModWave(double waveMultiplier) const; diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 560a7500a..03901f66f 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -264,6 +264,7 @@ class FMugShot DISABLEOUCH = 0x8, DISABLEPAIN = 0x10, DISABLERAMPAGE = 0x20, + CUSTOM = 0x40, }; FMugShot(); diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index b26541c99..148b7cb32 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -489,7 +489,7 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu if (CurrentState != NULL) { int skin = player->userinfo.GetSkin(); - const char *skin_face = player->morphTics ? player->MorphedPlayerClass->Face.GetChars() : skins[skin].face; + const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? player->MorphedPlayerClass->Face.GetChars() : skins[skin].face); return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle); } return NULL; diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index 26b4c9510..854cb4106 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -1578,23 +1578,25 @@ class CommandDrawMugShot : public SBarInfoCommand sc.ScriptError("Expected a number between 1 and 9, got %d instead.", sc.Number); accuracy = sc.Number; sc.MustGetToken(','); - while(sc.CheckToken(TK_Identifier)) + while (sc.CheckToken(TK_Identifier)) { - if(sc.Compare("xdeathface")) - stateFlags = static_cast (stateFlags|FMugShot::XDEATHFACE); - else if(sc.Compare("animatedgodmode")) - stateFlags = static_cast (stateFlags|FMugShot::ANIMATEDGODMODE); - else if(sc.Compare("disablegrin")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEGRIN); - else if(sc.Compare("disableouch")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEOUCH); - else if(sc.Compare("disablepain")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEPAIN); - else if(sc.Compare("disablerampage")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLERAMPAGE); + if (sc.Compare("xdeathface")) + stateFlags = static_cast (stateFlags | FMugShot::XDEATHFACE); + else if (sc.Compare("animatedgodmode")) + stateFlags = static_cast (stateFlags | FMugShot::ANIMATEDGODMODE); + else if (sc.Compare("disablegrin")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEGRIN); + else if (sc.Compare("disableouch")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEOUCH); + else if (sc.Compare("disablepain")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEPAIN); + else if (sc.Compare("disablerampage")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLERAMPAGE); + else if (sc.Compare("custom")) + stateFlags = static_cast (stateFlags | FMugShot::CUSTOM); else sc.ScriptError("Unknown flag '%s'.", sc.String); - if(!sc.CheckToken('|')) + if (!sc.CheckToken('|')) sc.MustGetToken(','); } diff --git a/src/m_specialpaths.cpp b/src/m_specialpaths.cpp index 60ccf08a8..abfb5db8f 100644 --- a/src/m_specialpaths.cpp +++ b/src/m_specialpaths.cpp @@ -198,6 +198,13 @@ FString M_GetConfigPath(bool for_reading) FString path; HRESULT hr; + path.Format("%s" GAMENAME "_portable.ini", progdir.GetChars()); + if (FileExists(path)) + { + return path; + } + path = ""; + // Construct a user-specific config name if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path)) { diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 384d24c8c..125e5dc14 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -790,7 +790,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li lowestceilingsec = j == 0 ? linedef->frontsector : linedef->backsector; } - if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->Z() >= ff_top)) + if(ff_top > highestfloor && delta1 <= delta2 && (!restrict || thing->Z() >= ff_top)) { highestfloor = ff_top; highestfloorpic = *rover->top.texture; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 266ff0bdc..088612e2a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5768,7 +5768,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) argCount > 10 ? ACSToDouble(args[10]) : 1.0, argCount > 11 ? ACSToDouble(args[11]) : 1.0, argCount > 12 ? args[12] : 0, - argCount > 13 ? args[13] : 0); + argCount > 13 ? args[13] : 0, + argCount > 14 ? args[14] : 0, + argCount > 15 ? args[15] : 0); } case ACSF_SetLineActivation: diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 8aeba4c8b..73f18be36 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1068,11 +1068,11 @@ FUNC(LS_Teleport_NoFog) break; case 2: - flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOM; // adjust to exit thing like Boom (i.e. with incorrect reversed angle) + if (ln != NULL) flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOM; // adjust to exit thing like Boom (i.e. with incorrect reversed angle) break; case 3: - flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOMINVERSE; // adjust to exit thing correctly + if (ln != NULL) flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOMINVERSE; // adjust to exit thing correctly break; } diff --git a/src/p_map.cpp b/src/p_map.cpp index 3d04c6889..959412a13 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -45,6 +45,7 @@ #include "p_checkposition.h" #include "r_utility.h" #include "p_blockmap.h" +#include "p_3dmidtex.h" #include "s_sound.h" #include "decallib.h" @@ -1514,7 +1515,47 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo // Any contacted lines the step closer together will adjust them. if (!thing->IsNoClip2()) { - P_GetFloorCeilingZ(tm, FFCF_SAMESECTOR); + if (!newsec->PortalBlocksMovement(sector_t::ceiling) || !newsec->PortalBlocksMovement(sector_t::floor)) + { + // Use P_GetFloorCeilingZ only if there's portals to consider. Its logic is subtly different than what is needed here for 3D floors. + P_GetFloorCeilingZ(tm, FFCF_SAMESECTOR); + } + else + { + tm.floorz = tm.dropoffz = newsec->floorplane.ZatPoint(pos); + tm.floorpic = newsec->GetTexture(sector_t::floor); + tm.ceilingz = newsec->ceilingplane.ZatPoint(pos); + tm.ceilingpic = newsec->GetTexture(sector_t::ceiling); + tm.floorsector = tm.ceilingsector = newsec; + tm.floorterrain = newsec->GetTerrain(sector_t::floor); + } + + F3DFloor* rover; + double thingtop = thing->Height > 0 ? thing->Top() : thing->Z() + 1; + + for (unsigned i = 0; ie->XFloor.ffloors.Size(); i++) + { + rover = newsec->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; + + double ff_bottom = rover->bottom.plane->ZatPoint(pos); + double ff_top = rover->top.plane->ZatPoint(pos); + + double delta1 = thing->Z() - (ff_bottom + ((ff_top - ff_bottom) / 2)); + double delta2 = thingtop - (ff_bottom + ((ff_top - ff_bottom) / 2)); + + if (ff_top > tm.floorz && fabs(delta1) < fabs(delta2)) + { + tm.floorz = tm.dropoffz = ff_top; + tm.floorpic = *rover->top.texture; + tm.floorterrain = rover->model->GetTerrain(rover->top.isceiling); + } + if (ff_bottom < tm.ceilingz && abs(delta1) >= abs(delta2)) + { + tm.ceilingz = ff_bottom; + tm.ceilingpic = *rover->bottom.texture; + } + } } else { @@ -1865,6 +1906,15 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 * if (fzt >= mobj->Top() && bzt >= mobj->Top() && fzb <= mobj->Z() && bzb <= mobj->Z()) { + if (line->flags & ML_3DMIDTEX) + { + double top, bot; + P_GetMidTexturePosition(line, side, &top, &bot); + if (bot < mobj->Top() && top > mobj->Z()) + { + goto isblocking; + } + } // we must also check if some 3D floor in the backsector may be blocking for (auto rover : line->backsector->e->XFloor.ffloors) { @@ -3973,8 +4023,11 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin struct Origin { AActor *Caller; + FNameNoInit PuffSpecies; bool hitGhosts; - bool hitSameSpecies; + bool MThruSpecies; + bool ThruSpecies; + bool ThruActors; }; static ETraceStatus CheckForActor(FTraceResults &res, void *userdata) @@ -3986,17 +4039,16 @@ static ETraceStatus CheckForActor(FTraceResults &res, void *userdata) Origin *data = (Origin *)userdata; - // check for physical attacks on spectrals - if (res.Actor->flags4 & MF4_SPECTRAL) - { - return TRACE_Skip; - } + // Skip actors if the puff has: + // 1. THRUACTORS or SPECTRAL + // 2. MTHRUSPECIES on puff and the shooter has same species as the hit actor + // 3. THRUSPECIES on puff and the puff has same species as the hit actor + // 4. THRUGHOST on puff and the GHOST flag on the hit actor - if (data->hitSameSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) - { - return TRACE_Skip; - } - if (data->hitGhosts && res.Actor->flags3 & MF3_GHOST) + if ((data->ThruActors) || (res.Actor->flags4 & MF4_SPECTRAL) || + (data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) || + (data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) || + (data->hitGhosts && res.Actor->flags3 & MF3_GHOST)) { return TRACE_Skip; } @@ -4058,14 +4110,41 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, // We need to check the defaults of the replacement here AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement()); - + TData.hitGhosts = (t1->player != NULL && t1->player->ReadyWeapon != NULL && (t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) || (puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST)); - TData.hitSameSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES)); + TData.MThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES)); + TData.PuffSpecies = NAME_None; + // [MC] To prevent possible mod breakage, this flag is pretty much necessary. + // Somewhere, someone is relying on these to spawn on actors and move through them. + + if ((puffDefaults->flags7 & MF7_ALLOWTHRUFLAGS)) + { + TData.ThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_THRUSPECIES)); + TData.ThruActors = (puffDefaults && (puffDefaults->flags2 & MF2_THRUACTORS)); + + // [MC] Because this is a one-hit trace event, we need to spawn the puff, get the species + // and destroy it. Assume there is no species unless tempuff isn't NULL. We cannot get + // a proper species the same way as puffDefaults flags it appears... + + AActor *tempuff = NULL; + if (pufftype != NULL) + tempuff = Spawn(pufftype, t1->Pos(), ALLOW_REPLACE); + if (tempuff != NULL) + { + TData.PuffSpecies = tempuff->GetSpecies(); + tempuff->Destroy(); + } + } + else + { + TData.ThruSpecies = false; + TData.ThruActors = false; + } // if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type. // All other explicitly passed damage types (currenty only MDK) will be preserved. if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) && @@ -4493,9 +4572,13 @@ struct RailData AActor *Caller; TArray RailHits; TArray PortalHits; + FNameNoInit PuffSpecies; bool StopAtOne; bool StopAtInvul; + bool ThruGhosts; bool ThruSpecies; + bool MThruSpecies; + bool ThruActors; }; static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata) @@ -4522,8 +4605,16 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata) return TRACE_Stop; } - // Skip actors with the same species if the puff has MTHRUSPECIES. - if (data->ThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) + // Skip actors if the puff has: + // 1. THRUACTORS (This one did NOT include a check for spectral) + // 2. MTHRUSPECIES on puff and the shooter has same species as the hit actor + // 3. THRUSPECIES on puff and the puff has same species as the hit actor + // 4. THRUGHOST on puff and the GHOST flag on the hit actor + + if ((data->ThruActors) || + (data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) || + (data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) || + (data->ThruGhosts && res.Actor->flags3 & MF3_GHOST)) { return TRACE_Skip; } @@ -4598,7 +4689,27 @@ void P_RailAttack(FRailParams *p) // disabled because not complete yet. flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? TRACE_ReportPortals : TRACE_PCross | TRACE_Impact | TRACE_ReportPortals; rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true; - rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false; + rail_data.MThruSpecies = ((puffDefaults->flags6 & MF6_MTHRUSPECIES)) ? true : false; + + // Prevent mod breakage as somewhere, someone is relying on these to spawn on an actor + // and move through them... + if ((puffDefaults->flags7 & MF7_ALLOWTHRUFLAGS)) + { + rail_data.ThruGhosts = !!(puffDefaults->flags2 & MF2_THRUGHOST); + rail_data.ThruSpecies = !!(puffDefaults->flags6 & MF6_THRUSPECIES); + rail_data.ThruActors = !!(puffDefaults->flags2 & MF2_THRUACTORS); + } + else + { + rail_data.ThruGhosts = false; + rail_data.MThruSpecies = false; + rail_data.ThruActors = false; + } + // used as damage inflictor + AActor *thepuff = NULL; + + if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE); + rail_data.PuffSpecies = (thepuff != NULL) ? thepuff->GetSpecies() : NAME_None; Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data); @@ -4606,11 +4717,6 @@ void P_RailAttack(FRailParams *p) unsigned int i; FName damagetype = (puffDefaults == NULL || puffDefaults->DamageType == NAME_None) ? FName(NAME_Railgun) : puffDefaults->DamageType; - // used as damage inflictor - AActor *thepuff = NULL; - - if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE); - for (i = 0; i < rail_data.RailHits.Size(); i++) { bool spawnpuff; diff --git a/src/p_spec.h b/src/p_spec.h index 7bd04f48c..28c73914e 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -698,7 +698,7 @@ void P_DoDeferedScripts (void); // // [RH] p_quake.c // -bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint); +bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave); bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx); #endif diff --git a/src/r_3dfloors.cpp b/src/r_3dfloors.cpp index ee7dc4c81..61a23187d 100644 --- a/src/r_3dfloors.cpp +++ b/src/r_3dfloors.cpp @@ -53,11 +53,10 @@ void R_3D_AddHeight(secplane_t *add, sector_t *sec) HeightLevel *near; HeightLevel *curr; - double fheight = add->ZatPoint(ViewPos); - if(fheight >= sec->CenterCeiling()) return; - if(fheight <= sec->CenterFloor()) return; + double height = add->ZatPoint(ViewPos); + if(height >= sec->CenterCeiling()) return; + if(height <= sec->CenterFloor()) return; - fixed_t height = FLOAT2FIXED(fheight); fakeActive = 1; if(height_max >= 0) { diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 790bb9309..a3877010f 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -287,21 +287,21 @@ void R_CalcTiltedLighting (double lval, double lend, int width) } if (width > 0) { - lval = planeshade - lval; - lend = planeshade - lend; + lval = FIXED2DBL(planeshade) - lval; + lend = FIXED2DBL(planeshade) - lend; lstep = (lend - lval) / width; if (lstep < 0) { // Going from dark to light - if (lval < FRACUNIT) + if (lval < 1.) { // All bright lightfiller = basecolormapdata; } else { - if (lval >= NUMCOLORMAPS*FRACUNIT) + if (lval >= NUMCOLORMAPS) { // Starts beyond the dark end BYTE *clight = basecolormapdata + ((NUMCOLORMAPS-1) << COLORMAPSHIFT); - while (lval >= NUMCOLORMAPS*FRACUNIT && i <= width) + while (lval >= NUMCOLORMAPS && i <= width) { tiltlighting[i++] = clight; lval += lstep; @@ -319,7 +319,7 @@ void R_CalcTiltedLighting (double lval, double lend, int width) } else { // Going from light to dark - if (lval >= (NUMCOLORMAPS-1)*FRACUNIT) + if (lval >= (NUMCOLORMAPS-1)) { // All dark lightfiller = basecolormapdata + ((NUMCOLORMAPS-1) << COLORMAPSHIFT); } @@ -332,7 +332,7 @@ void R_CalcTiltedLighting (double lval, double lend, int width) } if (i > width) return; - while (i <= width && lval < (NUMCOLORMAPS-1)*FRACUNIT) + while (i <= width && lval < (NUMCOLORMAPS-1)) { tiltlighting[i++] = basecolormapdata + (xs_ToInt(lval) << COLORMAPSHIFT); lval += lstep; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 696e30b7c..87b5f15a2 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -558,7 +558,7 @@ clearfog: void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) { int i; - fixed_t xscale; + double xscale; double yscale; fixed_t Alpha = Scale(rover->alpha, OPAQUE, 255); @@ -599,7 +599,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) scaledside = rover->master->sidedef[0]; scaledpart = side_t::mid; } - xscale = FLOAT2FIXED(rw_pic->Scale.X * scaledside->GetTextureXScale(scaledpart)); + xscale = rw_pic->Scale.X * scaledside->GetTextureXScale(scaledpart); yscale = rw_pic->Scale.Y * scaledside->GetTextureYScale(scaledpart); double rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); @@ -616,7 +616,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) // still be positioned in world units rather than texels. dc_texturemid = dc_texturemid + rowoffset * yscale; - rw_offset = MulScale16 (rw_offset, xscale); + rw_offset = xs_RoundToInt(rw_offset * xscale); } else { @@ -666,8 +666,8 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) int i,j; F3DFloor *rover, *fover = NULL; int passed, last; - fixed_t floorheight; - fixed_t ceilingheight; + double floorHeight; + double ceilingHeight; sprflipvert = false; curline = ds->curline; @@ -686,16 +686,16 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) frontsector = sec; } - floorheight = FLOAT2FIXED(backsector->CenterFloor()); - ceilingheight = FLOAT2FIXED(backsector->CenterCeiling()); + floorHeight = backsector->CenterFloor(); + ceilingHeight = backsector->CenterCeiling(); // maybe fix clipheights - if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight; - if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight; + if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorHeight; + if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingHeight; // maybe not visible - if (sclipBottom >= FLOAT2FIXED(frontsector->CenterCeiling())) return; - if (sclipTop <= FLOAT2FIXED(frontsector->CenterFloor())) return; + if (sclipBottom >= frontsector->CenterCeiling()) return; + if (sclipTop <= frontsector->CenterFloor()) return; if (fake3D & FAKE3D_DOWN2UP) { // bottom to viewz @@ -709,8 +709,8 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) passed = 0; if (!(rover->flags & FF_RENDERSIDES) || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() || rover->top.plane->Zat0() <= sclipBottom || - rover->bottom.plane->Zat0() >= ceilingheight || - rover->top.plane->Zat0() <= floorheight) + rover->bottom.plane->Zat0() >= ceilingHeight || + rover->top.plane->Zat0() <= floorHeight) { if (!i) { @@ -892,8 +892,8 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) if (!(rover->flags & FF_RENDERSIDES) || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() || rover->bottom.plane->Zat0() >= sclipTop || - rover->top.plane->Zat0() <= floorheight || - rover->bottom.plane->Zat0() >= ceilingheight) + rover->top.plane->Zat0() <= floorHeight || + rover->bottom.plane->Zat0() >= ceilingHeight) { if ((unsigned)i == backsector->e->XFloor.ffloors.Size() - 1) { @@ -2910,12 +2910,12 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc) y = z1 * InvZtoScale / iy1; if (ix2 == ix1) { - mostbuf[ix1] = (short)xs_RoundToInt(y/65536.0 + CenterY); + mostbuf[ix1] = (short)xs_RoundToInt(y + CenterY); } else { fixed_t yinc = FLOAT2FIXED(((z2 * InvZtoScale / iy2) - y) / (ix2-ix1)); - qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, FLOAT2FIXED(y/65536.0 + CenterY), yinc); + qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, FLOAT2FIXED(y + CenterY), yinc); } return bad; diff --git a/src/r_utility.cpp b/src/r_utility.cpp index d948657e7..20f3d506c 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -108,6 +108,7 @@ int viewwindowy; DVector3 ViewPos; DAngle ViewAngle; DAngle ViewPitch; +DAngle ViewRoll; DVector3 ViewPath[2]; extern "C" @@ -542,11 +543,13 @@ void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *ivie ViewAngle = (nviewangle + AngleToFloat(LocalViewAngle & 0xFFFF0000)).Normalized180(); DAngle delta = player->centering ? DAngle(0.) : AngleToFloat(int(LocalViewPitch & 0xFFFF0000)); ViewPitch = clamp((iview->New.Angles.Pitch - delta).Normalized180(), player->MinPitch, player->MaxPitch); + ViewRoll = iview->New.Angles.Roll.Normalized180(); } else { ViewPitch = (iview->Old.Angles.Pitch + deltaangle(iview->Old.Angles.Pitch, iview->New.Angles.Pitch) * Frac).Normalized180(); ViewAngle = (oviewangle + deltaangle(oviewangle, nviewangle) * Frac).Normalized180(); + ViewRoll = (iview->Old.Angles.Roll + deltaangle(iview->Old.Angles.Roll, iview->New.Angles.Roll) * Frac).Normalized180(); } // Due to interpolation this is not necessarily the same as the sector the camera is in. @@ -799,6 +802,7 @@ void R_SetupFrame (AActor *actor) P_AimCamera (camera, campos, camangle, viewsector, unlinked); // fixme: This needs to translate the angle, too. iview->New.Pos = campos; iview->New.Angles.Yaw = camangle; + r_showviewer = true; // Interpolating this is a very complicated thing because nothing keeps track of the aim camera's movement, so whenever we detect a portal transition // it's probably best to just reset the interpolation for this move. @@ -868,6 +872,10 @@ void R_SetupFrame (AActor *actor) double quakefactor = r_quakeintensity; DAngle an; + if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0) + { + ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff); + } if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0) { an = camera->Angles.Yaw; diff --git a/src/r_utility.h b/src/r_utility.h index a89e4e50c..f15d42052 100644 --- a/src/r_utility.h +++ b/src/r_utility.h @@ -15,6 +15,7 @@ extern DCanvas *RenderTarget; extern DVector3 ViewPos; extern DAngle ViewAngle; extern DAngle ViewPitch; +extern DAngle ViewRoll; extern DVector3 ViewPath[2]; extern "C" int centerx, centerxwide; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d801a7e80..fe464b137 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -320,6 +320,40 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) return 0; } +//========================================================================== +// +// GetAngle +// +// NON-ACTION function to get the angle in degrees (normalized to -180..180) +// +//========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetAngle) +{ + if (numret > 0) + { + assert(ret != NULL); + PARAM_SELF_PROLOGUE(AActor); + PARAM_BOOL(relative); + PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } + + AActor *target = COPY_AAPTR(self, ptr); + + if (!target || target == self) + { + ret->SetFloat(0); + } + else + { + DVector3 diff = self->Vec3To(target); + DAngle angto = diff.Angle(); + if (relative) angto = deltaangle(self->Angles.Yaw, angto); + ret->SetFloat(angto.Degrees); + } + return 1; + } + return 0; +} + //========================================================================== // // GetSpawnHealth @@ -4951,7 +4985,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx) PARAM_FLOAT_OPT(mulWaveZ) { mulWaveZ = 1.; } PARAM_INT_OPT(falloff) { falloff = 0; } PARAM_INT_OPT(highpoint) { highpoint = 0; } - P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint); + PARAM_INT_OPT(rollIntensity) { rollIntensity = 0; } + PARAM_FLOAT_OPT(rollWave) { rollWave = 0.; } + P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint, + rollIntensity, rollWave); return 0; } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 55f20df03..efb7be0c2 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -256,6 +256,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7), DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7), DEFINE_FLAG(MF7, ICESHATTER, AActor, flags7), + DEFINE_FLAG(MF7, ALLOWTHRUFLAGS, AActor, flags7), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), diff --git a/src/vectors.h b/src/vectors.h index 8b81d05b2..caa9c2f20 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -1135,7 +1135,8 @@ struct TRotator Angle Pitch; // up/down Angle Yaw; // left/right - Angle Roll; // rotation about the forward axis + Angle Roll; // rotation about the forward axis. + Angle CamRoll; // Roll specific to actor cameras. Used by quakes. TRotator () { diff --git a/src/version.h b/src/version.h index fba8d0786..47f3a347c 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4543 +#define SAVEVER 4544 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 9222741bd..b6543cd7e 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -42,6 +42,7 @@ ACTOR Actor native //: Thinker native bool IsPointerEqual(int ptr_select1, int ptr_select2); native int CountInv(class itemtype, int ptr_select = AAPTR_DEFAULT); native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT); + native float GetAngle(bool relative, int ptr = AAPTR_DEFAULT); native int GetSpawnHealth(); native int GetGibHealth(); @@ -280,7 +281,7 @@ ACTOR Actor native //: Thinker native void A_SetUserArrayFloat(name varname, int index, float value); native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); - native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); + native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0, int rollIntensity = 0, float rollWave = 0); action native A_SetTics(int tics); native void A_SetDamageType(name damagetype); native void A_DropItem(class item, int dropamount = -1, int chance = 256); diff --git a/wadsrc/static/actors/shared/camera.txt b/wadsrc/static/actors/shared/camera.txt index 2dcc12aab..46816f9ea 100644 --- a/wadsrc/static/actors/shared/camera.txt +++ b/wadsrc/static/actors/shared/camera.txt @@ -15,6 +15,7 @@ ACTOR SecurityCamera native +NOGRAVITY +DONTSPLASH RenderStyle None + CameraHeight 0 } ACTOR AimingCamera : SecurityCamera native diff --git a/wadsrc/static/actors/shared/movingcamera.txt b/wadsrc/static/actors/shared/movingcamera.txt index 13ae8a922..4ba229154 100644 --- a/wadsrc/static/actors/shared/movingcamera.txt +++ b/wadsrc/static/actors/shared/movingcamera.txt @@ -28,6 +28,7 @@ ACTOR ActorMover : PathFollower native ACTOR MovingCamera : PathFollower native { + CameraHeight 0 } diff --git a/wadsrc/static/actors/shared/sharedmisc.txt b/wadsrc/static/actors/shared/sharedmisc.txt index 04bfe0f46..bfe7d5519 100644 --- a/wadsrc/static/actors/shared/sharedmisc.txt +++ b/wadsrc/static/actors/shared/sharedmisc.txt @@ -51,6 +51,7 @@ ACTOR MapSpot +NOGRAVITY +DONTSPLASH RenderStyle None + CameraHeight 0 } // same with different editor number for Legacy maps ----------------------- diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt index bca1a6769..bfdac2cec 100644 --- a/wadsrc/static/xlat/eternity.txt +++ b/wadsrc/static/xlat/eternity.txt @@ -230,3 +230,4 @@ enum 443 = 0, Generic_Crusher(0) 444 = 0, Teleport(0) 445 = 0, Teleport_NoFog(0) +446 = 0, Teleport_Line(0)