# Conflicts:
#	src/r_3dfloors.cpp
#	src/r_plane.cpp
#	src/r_segs.cpp
This commit is contained in:
nashmuhandes 2016-04-27 23:30:44 +08:00
commit eda969e37f
27 changed files with 5550 additions and 56 deletions

View file

@ -381,6 +381,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 ---

View file

@ -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);
}

View file

@ -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;

View file

@ -264,6 +264,7 @@ class FMugShot
DISABLEOUCH = 0x8,
DISABLEPAIN = 0x10,
DISABLERAMPAGE = 0x20,
CUSTOM = 0x40,
};
FMugShot();

View file

@ -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;

View file

@ -1592,6 +1592,8 @@ class CommandDrawMugShot : public SBarInfoCommand
stateFlags = static_cast<FMugShot::StateFlags> (stateFlags | FMugShot::DISABLEPAIN);
else if (sc.Compare("disablerampage"))
stateFlags = static_cast<FMugShot::StateFlags> (stateFlags | FMugShot::DISABLERAMPAGE);
else if (sc.Compare("custom"))
stateFlags = static_cast<FMugShot::StateFlags> (stateFlags | FMugShot::CUSTOM);
else
sc.ScriptError("Unknown flag '%s'.", sc.String);
if (!sc.CheckToken('|'))

View file

@ -799,7 +799,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
double alen = sqrt(angx*angx + angy*angy);
mAngles.Pitch = (float)RAD2DEG(asin(angy / alen));
mAngles.Roll.Degrees = camera->Angles.Roll.Degrees;
mAngles.Roll.Degrees = ViewRoll.Degrees;
// Scroll the sky
mSky1Pos = (float)fmod(gl_frameMS * level.skyspeed1, 1024.f) * 90.f/256.f;

View file

@ -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))
{

View file

@ -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;

View file

@ -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:

View file

@ -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;
}

View file

@ -46,6 +46,7 @@
#include "p_checkposition.h"
#include "r_utility.h"
#include "p_blockmap.h"
#include "p_3dmidtex.h"
#include "s_sound.h"
#include "decallib.h"
@ -1515,9 +1516,49 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo
// Any contacted lines the step closer together will adjust them.
if (!thing->IsNoClip2())
{
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; i<newsec->e->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
{
// With noclip2, we must ignore 3D floors and go right to the uppermost ceiling and lowermost floor.
tm.floorz = tm.dropoffz = newsec->LowestFloorAt(pos, &tm.floorsector);
@ -1866,6 +1907,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)
{
@ -3974,8 +4024,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)
@ -3987,17 +4040,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;
}
@ -4065,8 +4117,35 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
(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) &&
@ -4494,9 +4573,13 @@ struct RailData
AActor *Caller;
TArray<SRailHit> RailHits;
TArray<SPortalHit> PortalHits;
FNameNoInit PuffSpecies;
bool StopAtOne;
bool StopAtInvul;
bool ThruGhosts;
bool ThruSpecies;
bool MThruSpecies;
bool ThruActors;
};
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
@ -4523,8 +4606,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;
}
@ -4599,7 +4690,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);
@ -4607,11 +4718,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;

View file

@ -699,7 +699,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

162
src/r_3dfloors.cpp Normal file
View file

@ -0,0 +1,162 @@
/*
** r_3dfloors.cpp
** software 3D floors addon
**
** by kgsws
*/
#include "templates.h"
#include "doomdef.h"
#include "p_local.h"
#include "c_dispatch.h"
#include "r_local.h"
#include "r_bsp.h"
#include "r_plane.h"
#include "c_cvars.h"
#include "r_3dfloors.h"
// external variables
int fake3D;
F3DFloor *fakeFloor;
fixed_t fakeHeight;
fixed_t fakeAlpha;
int fakeActive = 0;
double sclipBottom;
double sclipTop;
HeightLevel *height_top = NULL;
HeightLevel *height_cur = NULL;
int CurrentMirror = 0;
int CurrentSkybox = 0;
CVAR(Int, r_3dfloors, true, 0);
// private variables
int height_max = -1;
TArray<HeightStack> toplist;
ClipStack *clip_top = NULL;
ClipStack *clip_cur = NULL;
void R_3D_DeleteHeights()
{
height_cur = height_top;
while(height_cur) {
height_top = height_cur;
height_cur = height_cur->next;
M_Free(height_top);
}
height_max = -1;
height_top = height_cur = NULL;
}
void R_3D_AddHeight(secplane_t *add, sector_t *sec)
{
HeightLevel *near;
HeightLevel *curr;
double height = add->ZatPoint(ViewPos);
if(height >= sec->CenterCeiling()) return;
if(height <= sec->CenterFloor()) return;
fakeActive = 1;
if(height_max >= 0) {
near = height_top;
while(near && near->height < height) near = near->next;
if(near) {
if(near->height == height) return;
curr = (HeightLevel*)M_Malloc(sizeof(HeightLevel));
curr->height = height;
curr->prev = near->prev;
curr->next = near;
if(near->prev) near->prev->next = curr;
else height_top = curr;
near->prev = curr;
} else {
curr = (HeightLevel*)M_Malloc(sizeof(HeightLevel));
curr->height = height;
curr->prev = height_cur;
curr->next = NULL;
height_cur->next = curr;
height_cur = curr;
}
} else {
height_top = height_cur = (HeightLevel*)M_Malloc(sizeof(HeightLevel));
height_top->height = height;
height_top->prev = NULL;
height_top->next = NULL;
}
height_max++;
}
void R_3D_NewClip()
{
ClipStack *curr;
// extern short floorclip[MAXWIDTH];
// extern short ceilingclip[MAXWIDTH];
curr = (ClipStack*)M_Malloc(sizeof(ClipStack));
curr->next = 0;
memcpy(curr->floorclip, floorclip, sizeof(short) * MAXWIDTH);
memcpy(curr->ceilingclip, ceilingclip, sizeof(short) * MAXWIDTH);
curr->ffloor = fakeFloor;
assert(fakeFloor->floorclip == NULL);
assert(fakeFloor->ceilingclip == NULL);
fakeFloor->floorclip = curr->floorclip;
fakeFloor->ceilingclip = curr->ceilingclip;
if(clip_top) {
clip_cur->next = curr;
clip_cur = curr;
} else {
clip_top = clip_cur = curr;
}
}
void R_3D_ResetClip()
{
clip_cur = clip_top;
while(clip_cur)
{
assert(clip_cur->ffloor->floorclip != NULL);
assert(clip_cur->ffloor->ceilingclip != NULL);
clip_cur->ffloor->ceilingclip = clip_cur->ffloor->floorclip = NULL;
clip_top = clip_cur;
clip_cur = clip_cur->next;
M_Free(clip_top);
}
clip_cur = clip_top = NULL;
}
void R_3D_EnterSkybox()
{
HeightStack current;
current.height_top = height_top;
current.height_cur = height_cur;
current.height_max = height_max;
toplist.Push(current);
height_top = NULL;
height_cur = NULL;
height_max = -1;
CurrentSkybox++;
}
void R_3D_LeaveSkybox()
{
HeightStack current;
current.height_top = NULL;
current.height_cur = NULL;
current.height_max = -1;
toplist.Pop(current);
height_top = current.height_top;
height_cur = current.height_cur;
height_max = current.height_max;
CurrentSkybox--;
}

1836
src/r_plane.cpp Normal file

File diff suppressed because it is too large Load diff

3311
src/r_segs.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -109,6 +109,7 @@ int viewwindowy;
DVector3 ViewPos;
DAngle ViewAngle;
DAngle ViewPitch;
DAngle ViewRoll;
DVector3 ViewPath[2];
extern "C"
@ -543,11 +544,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<DAngle>((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.
@ -800,6 +803,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.
@ -869,6 +873,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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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),

View file

@ -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 ()
{

View file

@ -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)

View file

@ -42,6 +42,7 @@ ACTOR Actor native //: Thinker
native bool IsPointerEqual(int ptr_select1, int ptr_select2);
native int CountInv(class<Inventory> 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<Actor> item, int dropamount = -1, int chance = 256);

View file

@ -15,6 +15,7 @@ ACTOR SecurityCamera native
+NOGRAVITY
+DONTSPLASH
RenderStyle None
CameraHeight 0
}
ACTOR AimingCamera : SecurityCamera native

View file

@ -28,6 +28,7 @@ ACTOR ActorMover : PathFollower native
ACTOR MovingCamera : PathFollower native
{
CameraHeight 0
}

View file

@ -51,6 +51,7 @@ ACTOR MapSpot
+NOGRAVITY
+DONTSPLASH
RenderStyle None
CameraHeight 0
}
// same with different editor number for Legacy maps -----------------------

View file

@ -230,3 +230,4 @@ enum
443 = 0, Generic_Crusher(0)
444 = 0, Teleport(0)
445 = 0, Teleport_NoFog(0)
446 = 0, Teleport_Line(0)