mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 15:52:09 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
60a78a0d9b
40 changed files with 188 additions and 483 deletions
|
@ -1216,7 +1216,6 @@ set (PCH_SOURCES
|
||||||
statistics.cpp
|
statistics.cpp
|
||||||
stats.cpp
|
stats.cpp
|
||||||
stringtable.cpp
|
stringtable.cpp
|
||||||
tables.cpp
|
|
||||||
teaminfo.cpp
|
teaminfo.cpp
|
||||||
tempfiles.cpp
|
tempfiles.cpp
|
||||||
v_blend.cpp
|
v_blend.cpp
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#define __P_MOBJ_H__
|
#define __P_MOBJ_H__
|
||||||
|
|
||||||
// Basics.
|
// Basics.
|
||||||
#include "tables.h"
|
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
|
|
||||||
// We need the thinker_t stuff.
|
// We need the thinker_t stuff.
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#define __B_BOT_H__
|
#define __B_BOT_H__
|
||||||
|
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "tables.h"
|
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "d_ticcmd.h"
|
#include "d_ticcmd.h"
|
||||||
|
|
|
@ -72,6 +72,14 @@ typedef DWORD dsfixed_t; // fixedpt used by span drawer
|
||||||
#define DWORD_MIN ((uint32)0)
|
#define DWORD_MIN ((uint32)0)
|
||||||
#define DWORD_MAX ((uint32)0xffffffff)
|
#define DWORD_MAX ((uint32)0xffffffff)
|
||||||
|
|
||||||
|
// the last remnants of tables.h
|
||||||
|
#define ANGLE_90 (0x40000000)
|
||||||
|
#define ANGLE_180 (0x80000000)
|
||||||
|
#define ANGLE_270 (0xc0000000)
|
||||||
|
#define ANGLE_MAX (0xffffffff)
|
||||||
|
|
||||||
|
typedef uint32 angle_t;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define GCCPRINTF(stri,firstargi) __attribute__((format(printf,stri,firstargi)))
|
#define GCCPRINTF(stri,firstargi) __attribute__((format(printf,stri,firstargi)))
|
||||||
|
|
|
@ -438,7 +438,7 @@ void PType::SkipValue(FArchive &ar, int tag)
|
||||||
ar.Read(buff, 2);
|
ar.Read(buff, 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VAL_Int32: case VAL_UInt32: case VAL_Float32: case VAL_Fixed: case VAL_BAM:
|
case VAL_Int32: case VAL_UInt32: case VAL_Float32:
|
||||||
ar.Read(buff, 4);
|
ar.Read(buff, 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -936,10 +936,8 @@ bool PInt::ReadValue(FArchive &ar, void *addr) const
|
||||||
BYTE val8;
|
BYTE val8;
|
||||||
WORD val16;
|
WORD val16;
|
||||||
DWORD val32;
|
DWORD val32;
|
||||||
fixed_t fix;
|
|
||||||
float single;
|
float single;
|
||||||
double dbl;
|
double dbl;
|
||||||
angle_t ang;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ar << tag;
|
ar << tag;
|
||||||
|
@ -955,8 +953,6 @@ bool PInt::ReadValue(FArchive &ar, void *addr) const
|
||||||
case VAL_UInt32: ar << val32; uval = val32; break;
|
case VAL_UInt32: ar << val32; uval = val32; break;
|
||||||
case VAL_Int64: ar << sval; break;
|
case VAL_Int64: ar << sval; break;
|
||||||
case VAL_UInt64: ar << uval; break;
|
case VAL_UInt64: ar << uval; break;
|
||||||
case VAL_Fixed: ar << fix; sval = fix >> FRACBITS; break; // fixed -> int
|
|
||||||
case VAL_BAM: ar << ang; uval = ang / ANGLE_1; break; // BAM -> degrees
|
|
||||||
case VAL_Float32: ar << single; sval = (SQWORD)single; break;
|
case VAL_Float32: ar << single; sval = (SQWORD)single; break;
|
||||||
case VAL_Float64: ar << dbl; sval = (SQWORD)dbl; break;
|
case VAL_Float64: ar << dbl; sval = (SQWORD)dbl; break;
|
||||||
default: SkipValue(ar, tag); return false; // Incompatible type
|
default: SkipValue(ar, tag); return false; // Incompatible type
|
||||||
|
@ -1317,8 +1313,6 @@ static bool ReadValueDbl(FArchive &ar, double *addr, unsigned tag)
|
||||||
case VAL_UInt32: ar << val32; val = val32; break;
|
case VAL_UInt32: ar << val32; val = val32; break;
|
||||||
case VAL_Int64: ar << val64; val = (double)(SQWORD)val64; break;
|
case VAL_Int64: ar << val64; val = (double)(SQWORD)val64; break;
|
||||||
case VAL_UInt64: ar << val64; val = (double)val64; break;
|
case VAL_UInt64: ar << val64; val = (double)val64; break;
|
||||||
case VAL_Fixed: ar << fix; val = FIXED2DBL(fix); break;
|
|
||||||
case VAL_BAM: ar << ang; val = ang * (90.0 / ANGLE_90); break; // BAM -> degrees
|
|
||||||
case VAL_Float32: ar << single; val = single; break;
|
case VAL_Float32: ar << single; val = single; break;
|
||||||
case VAL_Float64: ar << val; break;
|
case VAL_Float64: ar << val; break;
|
||||||
default: PType::SkipValue(ar, tag); return false; // Incompatible type
|
default: PType::SkipValue(ar, tag); return false; // Incompatible type
|
||||||
|
|
|
@ -904,8 +904,6 @@ enum ETypeVal : BYTE
|
||||||
VAL_One,
|
VAL_One,
|
||||||
VAL_Float32,
|
VAL_Float32,
|
||||||
VAL_Float64,
|
VAL_Float64,
|
||||||
VAL_Fixed,
|
|
||||||
VAL_BAM,
|
|
||||||
VAL_String,
|
VAL_String,
|
||||||
VAL_Name,
|
VAL_Name,
|
||||||
VAL_Struct,
|
VAL_Struct,
|
||||||
|
|
|
@ -121,7 +121,6 @@ extern int viewwindowx;
|
||||||
extern int viewwindowy;
|
extern int viewwindowy;
|
||||||
extern "C" int viewheight;
|
extern "C" int viewheight;
|
||||||
extern "C" int viewwidth;
|
extern "C" int viewwidth;
|
||||||
extern "C" int halfviewwidth; // [RH] Half view width, for plane drawing
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ DEarthquake::DEarthquake()
|
||||||
|
|
||||||
DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration,
|
DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration,
|
||||||
int damrad, int tremrad, FSoundID quakesound, int flags,
|
int damrad, int tremrad, FSoundID quakesound, int flags,
|
||||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity,
|
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint,
|
||||||
double rollWave)
|
double rollIntensity, double rollWave)
|
||||||
: DThinker(STAT_EARTHQUAKE)
|
: DThinker(STAT_EARTHQUAKE)
|
||||||
{
|
{
|
||||||
m_QuakeSFX = quakesound;
|
m_QuakeSFX = quakesound;
|
||||||
|
@ -283,7 +283,8 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
||||||
double dist = quake->m_Spot->Distance2D (victim, true);
|
double dist = quake->m_Spot->Distance2D (victim, true);
|
||||||
if (dist < quake->m_TremorRadius)
|
if (dist < quake->m_TremorRadius)
|
||||||
{
|
{
|
||||||
double falloff = quake->GetFalloff(dist);
|
const double falloff = quake->GetFalloff(dist);
|
||||||
|
const double rfalloff = (quake->m_RollIntensity != 0) ? falloff : 0.;
|
||||||
++count;
|
++count;
|
||||||
double x = quake->GetModIntensity(quake->m_Intensity.X);
|
double x = quake->GetModIntensity(quake->m_Intensity.X);
|
||||||
double y = quake->GetModIntensity(quake->m_Intensity.Y);
|
double y = quake->GetModIntensity(quake->m_Intensity.Y);
|
||||||
|
@ -293,6 +294,7 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
||||||
if (!(quake->m_Flags & QF_WAVE))
|
if (!(quake->m_Flags & QF_WAVE))
|
||||||
{
|
{
|
||||||
jiggers.Falloff = MAX(falloff, jiggers.Falloff);
|
jiggers.Falloff = MAX(falloff, jiggers.Falloff);
|
||||||
|
jiggers.RFalloff = MAX(rfalloff, jiggers.RFalloff);
|
||||||
jiggers.RollIntensity = MAX(r, jiggers.RollIntensity);
|
jiggers.RollIntensity = MAX(r, jiggers.RollIntensity);
|
||||||
if (quake->m_Flags & QF_RELATIVE)
|
if (quake->m_Flags & QF_RELATIVE)
|
||||||
{
|
{
|
||||||
|
@ -310,11 +312,11 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jiggers.WFalloff = MAX(falloff, jiggers.WFalloff);
|
jiggers.WFalloff = MAX(falloff, jiggers.WFalloff);
|
||||||
double mr = r * quake->GetModWave(quake->m_RollWave);
|
jiggers.RWFalloff = MAX(rfalloff, jiggers.RWFalloff);
|
||||||
|
jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave);
|
||||||
double mx = x * quake->GetModWave(quake->m_WaveSpeed.X);
|
double mx = x * quake->GetModWave(quake->m_WaveSpeed.X);
|
||||||
double my = y * quake->GetModWave(quake->m_WaveSpeed.Y);
|
double my = y * quake->GetModWave(quake->m_WaveSpeed.Y);
|
||||||
double mz = z * quake->GetModWave(quake->m_WaveSpeed.Z);
|
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
|
// [RH] This only gives effect to the last sine quake. I would
|
||||||
// prefer if some way was found to make multiples coexist
|
// prefer if some way was found to make multiples coexist
|
||||||
|
@ -349,7 +351,7 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
||||||
bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration,
|
bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration,
|
||||||
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
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)
|
double rollIntensity, double rollWave)
|
||||||
{
|
{
|
||||||
AActor *center;
|
AActor *center;
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
|
@ -153,7 +153,7 @@ struct FQuakeJiggers
|
||||||
DVector3 RelIntensity;
|
DVector3 RelIntensity;
|
||||||
DVector3 Offset;
|
DVector3 Offset;
|
||||||
DVector3 RelOffset;
|
DVector3 RelOffset;
|
||||||
double Falloff, WFalloff;
|
double Falloff, WFalloff, RFalloff, RWFalloff;
|
||||||
double RollIntensity, RollWave;
|
double RollIntensity, RollWave;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class DEarthquake : public DThinker
|
||||||
public:
|
public:
|
||||||
DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration,
|
DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration,
|
||||||
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
||||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave);
|
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave);
|
||||||
|
|
||||||
void Serialize (FArchive &arc);
|
void Serialize (FArchive &arc);
|
||||||
void Tick ();
|
void Tick ();
|
||||||
|
|
|
@ -8750,23 +8750,24 @@ scriptwait:
|
||||||
{
|
{
|
||||||
int tag = STACK(3);
|
int tag = STACK(3);
|
||||||
int secnum;
|
int secnum;
|
||||||
DVector2 pos(ACSToDouble(STACK(2)), ACSToDouble(STACK(1)));
|
double x = double(STACK(2));
|
||||||
|
double y = double(STACK(1));
|
||||||
double z = 0;
|
double z = 0;
|
||||||
|
|
||||||
if (tag != 0)
|
if (tag != 0)
|
||||||
secnum = P_FindFirstSectorFromTag (tag);
|
secnum = P_FindFirstSectorFromTag (tag);
|
||||||
else
|
else
|
||||||
secnum = int(P_PointInSector (pos) - sectors);
|
secnum = int(P_PointInSector (x, y) - sectors);
|
||||||
|
|
||||||
if (secnum >= 0)
|
if (secnum >= 0)
|
||||||
{
|
{
|
||||||
if (pcd == PCD_GETSECTORFLOORZ)
|
if (pcd == PCD_GETSECTORFLOORZ)
|
||||||
{
|
{
|
||||||
z = sectors[secnum].floorplane.ZatPoint (pos);
|
z = sectors[secnum].floorplane.ZatPoint (x, y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = sectors[secnum].ceilingplane.ZatPoint (pos);
|
z = sectors[secnum].ceilingplane.ZatPoint (x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp -= 2;
|
sp -= 2;
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vectors.h"
|
#include "vectors.h"
|
||||||
#include "tables.h"
|
|
||||||
|
|
||||||
#define FX_ROCKET 0x00000001
|
#define FX_ROCKET 0x00000001
|
||||||
#define FX_GRENADE 0x00000002
|
#define FX_GRENADE 0x00000002
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define __P_ENEMY_H__
|
#define __P_ENEMY_H__
|
||||||
|
|
||||||
#include "thingdef/thingdef.h"
|
#include "thingdef/thingdef.h"
|
||||||
#include "tables.h"
|
|
||||||
|
|
||||||
struct sector_t;
|
struct sector_t;
|
||||||
class AActor;
|
class AActor;
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "s_sndseq.h"
|
#include "s_sndseq.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "tables.h"
|
|
||||||
#include "farchive.h"
|
#include "farchive.h"
|
||||||
#include "p_3dmidtex.h"
|
#include "p_3dmidtex.h"
|
||||||
#include "p_spec.h"
|
#include "p_spec.h"
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "p_enemy.h"
|
#include "p_enemy.h"
|
||||||
#include "g_level.h"
|
#include "g_level.h"
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "tables.h"
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "a_lightning.h"
|
#include "a_lightning.h"
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "tables.h"
|
|
||||||
#include "vectors.h"
|
#include "vectors.h"
|
||||||
|
|
||||||
const double NO_VALUE = FLT_MAX;
|
const double NO_VALUE = FLT_MAX;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
// Basic data types.
|
// Basic data types.
|
||||||
// Needs fixed point, and BAM angles.
|
// Needs fixed point, and BAM angles.
|
||||||
#include "tables.h"
|
|
||||||
#include "thingdef/thingdef.h"
|
#include "thingdef/thingdef.h"
|
||||||
|
|
||||||
#define WEAPONBOTTOM 128.
|
#define WEAPONBOTTOM 128.
|
||||||
|
|
|
@ -698,7 +698,7 @@ void P_DoDeferedScripts (void);
|
||||||
//
|
//
|
||||||
// [RH] p_quake.c
|
// [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, int rollIntensity, double rollWave);
|
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 rollIntensity, double rollWave);
|
||||||
bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
|
bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "tables.h"
|
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "tables.h"
|
|
||||||
|
|
||||||
class UDMFParserBase
|
class UDMFParserBase
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "m_bbox.h"
|
#include "m_bbox.h"
|
||||||
#include "tables.h"
|
|
||||||
#include "s_sndseq.h"
|
#include "s_sndseq.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "p_3dmidtex.h"
|
#include "p_3dmidtex.h"
|
||||||
|
|
|
@ -60,7 +60,6 @@ extern int ST_Y;
|
||||||
|
|
||||||
BYTE* viewimage;
|
BYTE* viewimage;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
int halfviewwidth;
|
|
||||||
int ylookup[MAXHEIGHT];
|
int ylookup[MAXHEIGHT];
|
||||||
BYTE *dc_destorg;
|
BYTE *dc_destorg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#define __R_LOCAL_H__
|
#define __R_LOCAL_H__
|
||||||
|
|
||||||
// Binary Angles, sine/cosine/atan lookups.
|
// Binary Angles, sine/cosine/atan lookups.
|
||||||
#include "tables.h"
|
|
||||||
|
|
||||||
// Screen size related parameters.
|
// Screen size related parameters.
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
|
@ -165,31 +165,6 @@ static int lastcenteryfrac;
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// viewangletox
|
|
||||||
//
|
|
||||||
// Used solely for construction the xtoviewangle table.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
static inline int viewangletox(int i)
|
|
||||||
{
|
|
||||||
if (finetangent[i] > FRACUNIT*2)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (finetangent[i] < -FRACUNIT*2)
|
|
||||||
{
|
|
||||||
return viewwidth+1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double t = FIXED2DBL(finetangent[i]) * FocalLengthX;
|
|
||||||
return clamp(xs_CeilToInt(CenterX - t), -1, viewwidth+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_InitTextureMapping
|
// R_InitTextureMapping
|
||||||
|
@ -198,46 +173,29 @@ static inline int viewangletox(int i)
|
||||||
|
|
||||||
void R_InitTextureMapping ()
|
void R_InitTextureMapping ()
|
||||||
{
|
{
|
||||||
int i, x;
|
int i;
|
||||||
|
|
||||||
// Calc focallength so FieldOfView fineangles covers viewwidth.
|
// Calc focallength so FieldOfView angles cover viewwidth.
|
||||||
FocalLengthX = CenterX / FocalTangent;
|
FocalLengthX = CenterX / FocalTangent;
|
||||||
FocalLengthY = FocalLengthX * YaspectMul;
|
FocalLengthY = FocalLengthX * YaspectMul;
|
||||||
|
|
||||||
// This is 1/FocalTangent before the widescreen extension of FOV.
|
// This is 1/FocalTangent before the widescreen extension of FOV.
|
||||||
viewingrangerecip = DivScale32(1, finetangent[FINEANGLES/4+(FieldOfView/2)]);
|
viewingrangerecip = FLOAT2FIXED(1. / tan(FieldOfView.Radians() / 2));
|
||||||
|
|
||||||
// [RH] Do not generate viewangletox, because texture mapping is no
|
|
||||||
// longer done with trig, so it's not needed.
|
|
||||||
|
|
||||||
// Now generate xtoviewangle for sky texture mapping.
|
// Now generate xtoviewangle for sky texture mapping.
|
||||||
// We do this with a hybrid approach: The center 90 degree span is
|
// [RH] Do not generate viewangletox, because texture mapping is no
|
||||||
// constructed as per the original code:
|
// longer done with trig, so it's not needed.
|
||||||
// Scan xtoviewangle to find the smallest view angle that maps to x.
|
const double slopestep = FocalTangent / centerx;
|
||||||
// (viewangletox is sorted in non-increasing order.)
|
double slope;
|
||||||
// This reduces the chances of "doubling-up" of texture columns in
|
|
||||||
// the drawn sky texture.
|
|
||||||
// The remaining arcs are done with tantoangle instead.
|
|
||||||
|
|
||||||
const int t1 = MAX(int(CenterX - FocalLengthX), 0);
|
for (i = centerx, slope = 0; i <= viewwidth; i++, slope += slopestep)
|
||||||
const int t2 = MIN(int(CenterX + FocalLengthX), viewwidth);
|
|
||||||
const fixed_t dfocus = FLOAT2FIXED(FocalLengthX) >> DBITS;
|
|
||||||
|
|
||||||
for (i = 0, x = t2; x >= t1; --x)
|
|
||||||
{
|
{
|
||||||
while (viewangletox(i) > x)
|
xtoviewangle[i] = angle_t((2 * M_PI - atan(slope)) * (ANGLE_180 / M_PI));
|
||||||
{
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
xtoviewangle[x] = (i << ANGLETOFINESHIFT) - ANGLE_90;
|
|
||||||
}
|
}
|
||||||
for (x = t2 + 1; x <= viewwidth; ++x)
|
for (i = 0; i < centerx; i++)
|
||||||
{
|
{
|
||||||
xtoviewangle[x] = ANGLE_270 + tantoangle[dfocus / (x - centerx)];
|
xtoviewangle[i] = 0 - xtoviewangle[viewwidth - i - 1];
|
||||||
}
|
|
||||||
for (x = 0; x < t1; ++x)
|
|
||||||
{
|
|
||||||
xtoviewangle[x] = (angle_t)(-(signed)xtoviewangle[viewwidth - x]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +309,6 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
fuzzviewheight = viewheight - 2; // Maximum row the fuzzer can draw to
|
fuzzviewheight = viewheight - 2; // Maximum row the fuzzer can draw to
|
||||||
halfviewwidth = (viewwidth >> 1) - 1;
|
|
||||||
|
|
||||||
lastcenteryfrac = 1<<30;
|
lastcenteryfrac = 1<<30;
|
||||||
CenterX = centerx;
|
CenterX = centerx;
|
||||||
|
|
127
src/r_plane.cpp
127
src/r_plane.cpp
|
@ -582,29 +582,25 @@ static visplane_t *new_visplane (unsigned hash)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive,
|
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive,
|
||||||
const FTransform &xform,
|
const FTransform &xxform,
|
||||||
int sky, FSectorPortal *portal)
|
int sky, FSectorPortal *portal)
|
||||||
{
|
{
|
||||||
secplane_t plane;
|
secplane_t plane;
|
||||||
visplane_t *check;
|
visplane_t *check;
|
||||||
unsigned hash; // killough
|
unsigned hash; // killough
|
||||||
bool isskybox;
|
bool isskybox;
|
||||||
fixed_t xoffs = FLOAT2FIXED(xform.xOffs);
|
const FTransform *xform = &xxform;
|
||||||
fixed_t yoffs = FLOAT2FIXED(xform.yOffs + xform.baseyOffs);
|
|
||||||
fixed_t xscale = FLOAT2FIXED(xform.xScale);
|
|
||||||
fixed_t yscale = FLOAT2FIXED(xform.yScale);
|
|
||||||
fixed_t alpha = FLOAT2FIXED(Alpha);
|
fixed_t alpha = FLOAT2FIXED(Alpha);
|
||||||
angle_t angle = (xform.Angle + xform.baseAngle).BAMs();
|
//angle_t angle = (xform.Angle + xform.baseAngle).BAMs();
|
||||||
|
|
||||||
if (picnum == skyflatnum) // killough 10/98
|
if (picnum == skyflatnum) // killough 10/98
|
||||||
{ // most skies map together
|
{ // most skies map together
|
||||||
|
FTransform nulltransform;
|
||||||
lightlevel = 0;
|
lightlevel = 0;
|
||||||
xoffs = 0;
|
xform = &nulltransform;
|
||||||
yoffs = 0;
|
nulltransform.xOffs = nulltransform.yOffs = nulltransform.baseyOffs = 0;
|
||||||
xscale = 0;
|
nulltransform.xScale = nulltransform.yScale = 1;
|
||||||
yscale = 0;
|
nulltransform.Angle = nulltransform.baseAngle = 0.0;
|
||||||
angle = 0;
|
|
||||||
alpha = 0;
|
|
||||||
additive = false;
|
additive = false;
|
||||||
// [RH] Map floor skies and ceiling skies to separate visplanes. This isn't
|
// [RH] Map floor skies and ceiling skies to separate visplanes. This isn't
|
||||||
// always necessary, but it is needed if a floor and ceiling sky are in the
|
// always necessary, but it is needed if a floor and ceiling sky are in the
|
||||||
|
@ -656,13 +652,8 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
|
||||||
(plane == check->height &&
|
(plane == check->height &&
|
||||||
picnum == check->picnum &&
|
picnum == check->picnum &&
|
||||||
lightlevel == check->lightlevel &&
|
lightlevel == check->lightlevel &&
|
||||||
|
|
||||||
xoffs == check->xoffs && // killough 2/28/98: Add offset checks
|
|
||||||
yoffs == check->yoffs &&
|
|
||||||
basecolormap == check->colormap && // [RH] Add more checks
|
basecolormap == check->colormap && // [RH] Add more checks
|
||||||
xscale == check->xscale &&
|
*xform == check->xform
|
||||||
yscale == check->yscale &&
|
|
||||||
angle == check->angle
|
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
check->viewangle == stacked_angle
|
check->viewangle == stacked_angle
|
||||||
|
@ -683,12 +674,8 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
|
||||||
if (plane == check->height &&
|
if (plane == check->height &&
|
||||||
picnum == check->picnum &&
|
picnum == check->picnum &&
|
||||||
lightlevel == check->lightlevel &&
|
lightlevel == check->lightlevel &&
|
||||||
xoffs == check->xoffs && // killough 2/28/98: Add offset checks
|
|
||||||
yoffs == check->yoffs &&
|
|
||||||
basecolormap == check->colormap && // [RH] Add more checks
|
basecolormap == check->colormap && // [RH] Add more checks
|
||||||
xscale == check->xscale &&
|
*xform == check->xform &&
|
||||||
yscale == check->yscale &&
|
|
||||||
angle == check->angle &&
|
|
||||||
sky == check->sky &&
|
sky == check->sky &&
|
||||||
CurrentPortalUniq == check->CurrentPortalUniq &&
|
CurrentPortalUniq == check->CurrentPortalUniq &&
|
||||||
MirrorFlags == check->MirrorFlags &&
|
MirrorFlags == check->MirrorFlags &&
|
||||||
|
@ -705,11 +692,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
|
||||||
check->height = plane;
|
check->height = plane;
|
||||||
check->picnum = picnum;
|
check->picnum = picnum;
|
||||||
check->lightlevel = lightlevel;
|
check->lightlevel = lightlevel;
|
||||||
check->xoffs = xoffs; // killough 2/28/98: Save offsets
|
check->xform = *xform;
|
||||||
check->yoffs = yoffs;
|
|
||||||
check->xscale = xscale;
|
|
||||||
check->yscale = yscale;
|
|
||||||
check->angle = angle;
|
|
||||||
check->colormap = basecolormap; // [RH] Save colormap
|
check->colormap = basecolormap; // [RH] Save colormap
|
||||||
check->sky = sky;
|
check->sky = sky;
|
||||||
check->portal = portal;
|
check->portal = portal;
|
||||||
|
@ -794,11 +777,7 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop)
|
||||||
new_pl->height = pl->height;
|
new_pl->height = pl->height;
|
||||||
new_pl->picnum = pl->picnum;
|
new_pl->picnum = pl->picnum;
|
||||||
new_pl->lightlevel = pl->lightlevel;
|
new_pl->lightlevel = pl->lightlevel;
|
||||||
new_pl->xoffs = pl->xoffs; // killough 2/28/98
|
new_pl->xform = pl->xform;
|
||||||
new_pl->yoffs = pl->yoffs;
|
|
||||||
new_pl->xscale = pl->xscale; // [RH] copy these, too
|
|
||||||
new_pl->yscale = pl->yscale;
|
|
||||||
new_pl->angle = pl->angle;
|
|
||||||
new_pl->colormap = pl->colormap;
|
new_pl->colormap = pl->colormap;
|
||||||
new_pl->portal = pl->portal;
|
new_pl->portal = pl->portal;
|
||||||
new_pl->extralight = pl->extralight;
|
new_pl->extralight = pl->extralight;
|
||||||
|
@ -1117,8 +1096,8 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
masked = false;
|
masked = false;
|
||||||
}
|
}
|
||||||
R_SetupSpanBits(tex);
|
R_SetupSpanBits(tex);
|
||||||
pl->xscale = fixed_t(pl->xscale * tex->Scale.X);
|
double xscale = pl->xform.xScale * tex->Scale.X;
|
||||||
pl->yscale = fixed_t(pl->yscale * tex->Scale.Y);
|
double yscale = pl->xform.yScale * tex->Scale.Y;
|
||||||
ds_source = tex->GetPixels ();
|
ds_source = tex->GetPixels ();
|
||||||
|
|
||||||
basecolormap = pl->colormap;
|
basecolormap = pl->colormap;
|
||||||
|
@ -1126,11 +1105,11 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
|
|
||||||
if (r_drawflat || (!pl->height.isSlope() && !tilt))
|
if (r_drawflat || (!pl->height.isSlope() && !tilt))
|
||||||
{
|
{
|
||||||
R_DrawNormalPlane (pl, alpha, additive, masked);
|
R_DrawNormalPlane(pl, xscale, yscale, alpha, additive, masked);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_DrawTiltedPlane (pl, alpha, additive, masked);
|
R_DrawTiltedPlane(pl, xscale, yscale, alpha, additive, masked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NetUpdate ();
|
NetUpdate ();
|
||||||
|
@ -1502,7 +1481,7 @@ void R_DrawSkyPlane (visplane_t *pl)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked)
|
void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked)
|
||||||
{
|
{
|
||||||
#ifdef X86_ASM
|
#ifdef X86_ASM
|
||||||
if (ds_source != ds_cursource)
|
if (ds_source != ds_cursource)
|
||||||
|
@ -1516,31 +1495,30 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
angle_t planeang = pl->angle;
|
DAngle planeang = pl->xform.Angle + pl->xform.baseAngle;
|
||||||
xscale = pl->xscale << (16 - ds_xbits);
|
xscale = xs_ToFixed(32 - ds_xbits, _xscale);
|
||||||
yscale = pl->yscale << (16 - ds_ybits);
|
yscale = xs_ToFixed(32 - ds_ybits, _yscale);
|
||||||
if (planeang != 0)
|
if (planeang != 0)
|
||||||
{
|
{
|
||||||
double rad = planeang * (M_PI / ANGLE_180);
|
double cosine = cos(planeang.Radians()), sine = sin(planeang.Radians());
|
||||||
double cosine = cos(rad), sine = sin(rad);
|
pviewx = FLOAT2FIXED(pl->xform.xOffs + ViewPos.X * cosine - ViewPos.Y * sine);
|
||||||
|
pviewy = FLOAT2FIXED(pl->xform.yOffs - ViewPos.X * sine - ViewPos.Y * cosine);
|
||||||
pviewx = xs_RoundToInt(pl->xoffs + FLOAT2FIXED(ViewPos.X * cosine - ViewPos.Y * sine));
|
|
||||||
pviewy = xs_RoundToInt(pl->yoffs - FLOAT2FIXED(ViewPos.X * sine - ViewPos.Y * cosine));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pviewx = pl->xoffs + FLOAT2FIXED(ViewPos.X);
|
pviewx = FLOAT2FIXED(pl->xform.xOffs + ViewPos.X);
|
||||||
pviewy = pl->yoffs - FLOAT2FIXED(ViewPos.Y);
|
pviewy = FLOAT2FIXED(pl->xform.yOffs - ViewPos.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
pviewx = FixedMul (xscale, pviewx);
|
pviewx = FixedMul (xscale, pviewx);
|
||||||
pviewy = FixedMul (yscale, pviewy);
|
pviewy = FixedMul (yscale, pviewy);
|
||||||
|
|
||||||
// left to right mapping
|
// left to right mapping
|
||||||
planeang = (ViewAngle.BAMs() - ANG90 + planeang) >> ANGLETOFINESHIFT;
|
planeang = ViewAngle - 90 + planeang;
|
||||||
|
|
||||||
// Scale will be unit scale at FocalLengthX (normally SCREENWIDTH/2) distance
|
// Scale will be unit scale at FocalLengthX (normally SCREENWIDTH/2) distance
|
||||||
xstepscale = fixed_t(FixedMul(xscale, finecosine[planeang]) / FocalLengthX);
|
xstepscale = xs_RoundToInt(xscale * cos(planeang.Radians()) / FocalLengthX);
|
||||||
ystepscale = fixed_t(FixedMul(yscale, -finesine[planeang]) / FocalLengthX);
|
ystepscale = xs_RoundToInt(yscale * -sin(planeang.Radians()) / FocalLengthX);
|
||||||
|
|
||||||
// [RH] flip for mirrors
|
// [RH] flip for mirrors
|
||||||
if (MirrorFlags & RF_XFLIP)
|
if (MirrorFlags & RF_XFLIP)
|
||||||
|
@ -1549,10 +1527,10 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
ystepscale = (DWORD)(-(SDWORD)ystepscale);
|
ystepscale = (DWORD)(-(SDWORD)ystepscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = pl->right - halfviewwidth - 1;
|
int x = pl->right - centerx;
|
||||||
planeang = (planeang + (ANG90 >> ANGLETOFINESHIFT)) & FINEMASK;
|
planeang += 90;
|
||||||
basexfrac = FixedMul (xscale, finecosine[planeang]) + x*xstepscale;
|
basexfrac = xs_RoundToInt(xscale * cos(planeang.Radians())) + x*xstepscale;
|
||||||
baseyfrac = FixedMul (yscale, -finesine[planeang]) + x*ystepscale;
|
baseyfrac = xs_RoundToInt(yscale * -sin(planeang.Radians())) + x*ystepscale;
|
||||||
|
|
||||||
planeheight = fabs(pl->height.Zat0() - ViewPos.Z);
|
planeheight = fabs(pl->height.Zat0() - ViewPos.Z);
|
||||||
|
|
||||||
|
@ -1620,7 +1598,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked)
|
void R_DrawTiltedPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked)
|
||||||
{
|
{
|
||||||
static const float ifloatpow2[16] =
|
static const float ifloatpow2[16] =
|
||||||
{
|
{
|
||||||
|
@ -1634,7 +1612,7 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
double lxscale, lyscale;
|
double lxscale, lyscale;
|
||||||
double xscale, yscale;
|
double xscale, yscale;
|
||||||
FVector3 p, m, n;
|
FVector3 p, m, n;
|
||||||
double ang;
|
DAngle ang;
|
||||||
double zeroheight;
|
double zeroheight;
|
||||||
|
|
||||||
if (alpha <= 0)
|
if (alpha <= 0)
|
||||||
|
@ -1642,44 +1620,45 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lxscale = FIXED2DBL(pl->xscale) * ifloatpow2[ds_xbits];
|
lxscale = _xscale * ifloatpow2[ds_xbits];
|
||||||
lyscale = FIXED2DBL(pl->yscale) * ifloatpow2[ds_ybits];
|
lyscale = _yscale * ifloatpow2[ds_ybits];
|
||||||
xscale = 64.f / lxscale;
|
xscale = 64.f / lxscale;
|
||||||
yscale = 64.f / lyscale;
|
yscale = 64.f / lyscale;
|
||||||
zeroheight = pl->height.ZatPoint(ViewPos);
|
zeroheight = pl->height.ZatPoint(ViewPos);
|
||||||
|
|
||||||
pviewx = MulScale (pl->xoffs, pl->xscale, ds_xbits);
|
pviewx = xs_ToFixed(32 - ds_xbits, pl->xform.xOffs * pl->xform.xScale);
|
||||||
pviewy = MulScale (pl->yoffs, pl->yscale, ds_ybits);
|
pviewy = xs_ToFixed(32 - ds_ybits, pl->xform.yOffs * pl->xform.yScale);
|
||||||
|
|
||||||
// p is the texture origin in view space
|
// p is the texture origin in view space
|
||||||
// Don't add in the offsets at this stage, because doing so can result in
|
// Don't add in the offsets at this stage, because doing so can result in
|
||||||
// errors if the flat is rotated.
|
// errors if the flat is rotated.
|
||||||
ang = (DAngle(270.) - ViewAngle).Radians();
|
ang = DAngle(270.) - ViewAngle;
|
||||||
p[0] = ViewPos.X * cos(ang) - ViewPos.Y * sin(ang);
|
p[0] = ViewPos.X * ang.Cos() - ViewPos.Y * ang.Sin();
|
||||||
p[2] = ViewPos.X * sin(ang) + ViewPos.Y * cos(ang);
|
p[2] = ViewPos.X * ang.Sin() + ViewPos.Y * ang.Cos();
|
||||||
p[1] = pl->height.ZatPoint(0.0, 0.0) - ViewPos.Z;
|
p[1] = pl->height.ZatPoint(0.0, 0.0) - ViewPos.Z;
|
||||||
|
|
||||||
// m is the v direction vector in view space
|
// m is the v direction vector in view space
|
||||||
ang = (DAngle(180.) - ViewAngle).Radians();
|
ang = DAngle(180.) - ViewAngle;
|
||||||
m[0] = yscale * cos(ang);
|
m[0] = yscale * cos(ang.Radians());
|
||||||
m[2] = yscale * sin(ang);
|
m[2] = yscale * sin(ang.Radians());
|
||||||
// m[1] = pl->height.ZatPointF (0, iyscale) - pl->height.ZatPointF (0,0));
|
// m[1] = pl->height.ZatPointF (0, iyscale) - pl->height.ZatPointF (0,0));
|
||||||
// VectorScale2 (m, 64.f/VectorLength(m));
|
// VectorScale2 (m, 64.f/VectorLength(m));
|
||||||
|
|
||||||
// n is the u direction vector in view space
|
// n is the u direction vector in view space
|
||||||
ang += PI/2;
|
ang += 90;
|
||||||
n[0] = -xscale * cos(ang);
|
n[0] = -xscale * cos(ang.Radians());
|
||||||
n[2] = -xscale * sin(ang);
|
n[2] = -xscale * sin(ang.Radians());
|
||||||
// n[1] = pl->height.ZatPointF (ixscale, 0) - pl->height.ZatPointF (0,0));
|
// n[1] = pl->height.ZatPointF (ixscale, 0) - pl->height.ZatPointF (0,0));
|
||||||
// VectorScale2 (n, 64.f/VectorLength(n));
|
// VectorScale2 (n, 64.f/VectorLength(n));
|
||||||
|
|
||||||
// This code keeps the texture coordinates constant across the x,y plane no matter
|
// This code keeps the texture coordinates constant across the x,y plane no matter
|
||||||
// how much you slope the surface. Use the commented-out code above instead to keep
|
// how much you slope the surface. Use the commented-out code above instead to keep
|
||||||
// the textures a constant size across the surface's plane instead.
|
// the textures a constant size across the surface's plane instead.
|
||||||
ang = pl->angle * (M_PI / ANGLE_180);
|
ang = pl->xform.Angle + pl->xform.baseAngle;
|
||||||
m[1] = pl->height.ZatPoint(ViewPos.X + yscale * sin(ang), ViewPos.Y + yscale * cos(ang)) - zeroheight;
|
double cosine = cos(ang.Radians()), sine = sin(ang.Radians());
|
||||||
ang += PI/2;
|
m[1] = pl->height.ZatPoint(ViewPos.X + yscale * sine, ViewPos.Y + yscale * cosine) - zeroheight;
|
||||||
n[1] = pl->height.ZatPoint(ViewPos.X + xscale * sin(ang), ViewPos.Y + xscale * cos(ang)) - zeroheight;
|
ang += 90;
|
||||||
|
n[1] = pl->height.ZatPoint(ViewPos.X + xscale * sine, ViewPos.Y + xscale * cosine) - zeroheight;
|
||||||
|
|
||||||
plane_su = p ^ m;
|
plane_su = p ^ m;
|
||||||
plane_sv = p ^ n;
|
plane_sv = p ^ n;
|
||||||
|
|
|
@ -34,16 +34,15 @@ struct visplane_s
|
||||||
{
|
{
|
||||||
struct visplane_s *next; // Next visplane in hash chain -- killough
|
struct visplane_s *next; // Next visplane in hash chain -- killough
|
||||||
|
|
||||||
|
FDynamicColormap *colormap; // [RH] Support multiple colormaps
|
||||||
|
FSectorPortal *portal; // [RH] Support sky boxes
|
||||||
|
|
||||||
|
FTransform xform;
|
||||||
secplane_t height;
|
secplane_t height;
|
||||||
FTextureID picnum;
|
FTextureID picnum;
|
||||||
int lightlevel;
|
int lightlevel;
|
||||||
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
|
|
||||||
int left, right;
|
int left, right;
|
||||||
FDynamicColormap *colormap; // [RH] Support multiple colormaps
|
|
||||||
fixed_t xscale, yscale; // [RH] Support flat scaling
|
|
||||||
angle_t angle; // [RH] Support flat rotation
|
|
||||||
int sky;
|
int sky;
|
||||||
FSectorPortal *portal; // [RH] Support sky boxes
|
|
||||||
|
|
||||||
// [RH] This set of variables copies information from the time when the
|
// [RH] This set of variables copies information from the time when the
|
||||||
// visplane is created. They are only used by stacks so that you can
|
// visplane is created. They are only used by stacks so that you can
|
||||||
|
@ -90,8 +89,8 @@ void R_ClearPlanes (bool fullclear);
|
||||||
int R_DrawPlanes ();
|
int R_DrawPlanes ();
|
||||||
void R_DrawPortals ();
|
void R_DrawPortals ();
|
||||||
void R_DrawSkyPlane (visplane_t *pl);
|
void R_DrawSkyPlane (visplane_t *pl);
|
||||||
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked);
|
void R_DrawNormalPlane (visplane_t *pl, double xscale, double yscale, fixed_t alpha, bool additive, bool masked);
|
||||||
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked);
|
void R_DrawTiltedPlane (visplane_t *pl, double xscale, double yscale, fixed_t alpha, bool additive, bool masked);
|
||||||
void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
|
void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
|
||||||
|
|
||||||
visplane_t *R_FindPlane
|
visplane_t *R_FindPlane
|
||||||
|
|
|
@ -2670,53 +2670,51 @@ int OWallMost (short *mostbuf, double z, const FWallCoords *wallc)
|
||||||
s3 = globaldclip * wallc->sz1; s4 = globaldclip * wallc->sz2;
|
s3 = globaldclip * wallc->sz1; s4 = globaldclip * wallc->sz2;
|
||||||
bad = (z<s1)+((z<s2)<<1)+((z>s3)<<2)+((z>s4)<<3);
|
bad = (z<s1)+((z<s2)<<1)+((z>s3)<<2)+((z>s4)<<3);
|
||||||
|
|
||||||
#if 1
|
|
||||||
if ((bad&3) == 3)
|
if ((bad&3) == 3)
|
||||||
{
|
{ // entire line is above the screen
|
||||||
memset (&mostbuf[wallc->sx1], 0, (wallc->sx2 - wallc->sx1)*sizeof(mostbuf[0]));
|
memset (&mostbuf[wallc->sx1], 0, (wallc->sx2 - wallc->sx1)*sizeof(mostbuf[0]));
|
||||||
return bad;
|
return bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bad&12) == 12)
|
if ((bad&12) == 12)
|
||||||
{
|
{ // entire line is below the screen
|
||||||
clearbufshort (&mostbuf[wallc->sx1], wallc->sx2 - wallc->sx1, viewheight);
|
clearbufshort (&mostbuf[wallc->sx1], wallc->sx2 - wallc->sx1, viewheight);
|
||||||
return bad;
|
return bad;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
ix1 = wallc->sx1; iy1 = wallc->sz1;
|
ix1 = wallc->sx1; iy1 = wallc->sz1;
|
||||||
ix2 = wallc->sx2; iy2 = wallc->sz2;
|
ix2 = wallc->sx2; iy2 = wallc->sz2;
|
||||||
#if 1
|
#if 1
|
||||||
if (bad & 3)
|
if (bad & 3)
|
||||||
{
|
{ // the line intersects the top of the screen
|
||||||
double t = (z-s1) / (s2-s1);
|
double t = (z-s1) / (s2-s1);
|
||||||
double inty = wallc->sz1 + t * (wallc->sz2 - wallc->sz1);
|
double inty = wallc->sz1 + t * (wallc->sz2 - wallc->sz1);
|
||||||
int xcross = xs_RoundToInt(wallc->sx1 + (t * wallc->sz2 * (wallc->sx2 - wallc->sx1)) / inty);
|
int xcross = xs_RoundToInt(wallc->sx1 + (t * wallc->sz2 * (wallc->sx2 - wallc->sx1)) / inty);
|
||||||
|
|
||||||
if ((bad & 3) == 2)
|
if ((bad & 3) == 2)
|
||||||
{
|
{ // the right side is above the screen
|
||||||
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
||||||
if (wallc->sx2 > xcross) memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
if (wallc->sx2 > xcross) memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // the left side is above the screen
|
||||||
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
||||||
if (xcross > wallc->sx1) memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
if (xcross > wallc->sx1) memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad & 12)
|
if (bad & 12)
|
||||||
{
|
{ // the line intersects the bottom of the screen
|
||||||
double t = (z-s3) / (s4-s3);
|
double t = (z-s3) / (s4-s3);
|
||||||
double inty = wallc->sz1 + t * (wallc->sz2 - wallc->sz1);
|
double inty = wallc->sz1 + t * (wallc->sz2 - wallc->sz1);
|
||||||
int xcross = xs_RoundToInt(wallc->sx1 + (t * wallc->sz2 * (wallc->sx2 - wallc->sx1)) / inty);
|
int xcross = xs_RoundToInt(wallc->sx1 + (t * wallc->sz2 * (wallc->sx2 - wallc->sx1)) / inty);
|
||||||
|
|
||||||
if ((bad & 12) == 8)
|
if ((bad & 12) == 8)
|
||||||
{
|
{ // the right side is below the screen
|
||||||
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
||||||
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2 - xcross, viewheight);
|
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2 - xcross, viewheight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // the left side is below the screen
|
||||||
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
||||||
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross - wallc->sx1, viewheight);
|
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross - wallc->sx1, viewheight);
|
||||||
}
|
}
|
||||||
|
@ -2779,6 +2777,7 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
||||||
int bad, ix1, ix2;
|
int bad, ix1, ix2;
|
||||||
double iy1, iy2;
|
double iy1, iy2;
|
||||||
|
|
||||||
|
// Get Z coordinates at both ends of the line
|
||||||
if (MirrorFlags & RF_XFLIP)
|
if (MirrorFlags & RF_XFLIP)
|
||||||
{
|
{
|
||||||
x = curline->v2->fX();
|
x = curline->v2->fX();
|
||||||
|
@ -2847,20 +2846,20 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
||||||
oz1 = z1; oz2 = z2;
|
oz1 = z1; oz2 = z2;
|
||||||
|
|
||||||
if ((bad&3) == 3)
|
if ((bad&3) == 3)
|
||||||
{
|
{ // The entire line is above the screen
|
||||||
memset (&mostbuf[ix1], -1, (ix2-ix1)*sizeof(mostbuf[0]));
|
memset (&mostbuf[ix1], 0, (ix2-ix1)*sizeof(mostbuf[0]));
|
||||||
return bad;
|
return bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bad&12) == 12)
|
if ((bad&12) == 12)
|
||||||
{
|
{ // The entire line is below the screen
|
||||||
clearbufshort (&mostbuf[ix1], ix2-ix1, viewheight);
|
clearbufshort (&mostbuf[ix1], ix2-ix1, viewheight);
|
||||||
return bad;
|
return bad;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad&3)
|
if (bad&3)
|
||||||
{
|
{ // The line intersects the top of the screen
|
||||||
//inty = intz / (globaluclip>>16)
|
//inty = intz / (globaluclip>>16)
|
||||||
double t = (oz1-s1) / (s2-s1+oz1-oz2);
|
double t = (oz1-s1) / (s2-s1+oz1-oz2);
|
||||||
double inty = wallc->sz1 + t * (wallc->sz2-wallc->sz1);
|
double inty = wallc->sz1 + t * (wallc->sz2-wallc->sz1);
|
||||||
|
@ -2872,19 +2871,19 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
||||||
//intz = z1 + mulscale30(z2-z1,t);
|
//intz = z1 + mulscale30(z2-z1,t);
|
||||||
|
|
||||||
if ((bad&3) == 2)
|
if ((bad&3) == 2)
|
||||||
{
|
{ // The right side of the line is above the screen
|
||||||
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
||||||
memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // The left side of the line is above the screen
|
||||||
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
||||||
memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad&12)
|
if (bad&12)
|
||||||
{
|
{ // The line intersects the bottom of the screen
|
||||||
//inty = intz / (globaldclip>>16)
|
//inty = intz / (globaldclip>>16)
|
||||||
double t = (oz1-s3) / (s4-s3+oz1-oz2);
|
double t = (oz1-s3) / (s4-s3+oz1-oz2);
|
||||||
double inty = wallc->sz1 + t * (wallc->sz2-wallc->sz1);
|
double inty = wallc->sz1 + t * (wallc->sz2-wallc->sz1);
|
||||||
|
@ -2896,12 +2895,12 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
||||||
//intz = z1 + mulscale30(z2-z1,t);
|
//intz = z1 + mulscale30(z2-z1,t);
|
||||||
|
|
||||||
if ((bad&12) == 8)
|
if ((bad&12) == 8)
|
||||||
{
|
{ // The right side of the line is below the screen
|
||||||
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
||||||
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2-xcross, viewheight);
|
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2-xcross, viewheight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // The left side of the line is below the screen
|
||||||
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
||||||
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross-wallc->sx1, viewheight);
|
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross-wallc->sx1, viewheight);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,8 @@ void R_InitSkyMap ()
|
||||||
skyiscale = float(r_Yaspect / freelookviewheight);
|
skyiscale = float(r_Yaspect / freelookviewheight);
|
||||||
skyscale = freelookviewheight / r_Yaspect;
|
skyscale = freelookviewheight / r_Yaspect;
|
||||||
|
|
||||||
skyiscale *= FieldOfView / 2048.f;
|
skyiscale *= float(FieldOfView.Degrees / 90.);
|
||||||
skyscale *= 2048.0 / FieldOfView;
|
skyscale *= float(90. / FieldOfView.Degrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skystretch)
|
if (skystretch)
|
||||||
|
|
|
@ -82,7 +82,7 @@ extern AActor* camera; // [RH] camera instead of viewplayer
|
||||||
extern sector_t* viewsector; // [RH] keep track of sector viewing from
|
extern sector_t* viewsector; // [RH] keep track of sector viewing from
|
||||||
|
|
||||||
extern angle_t xtoviewangle[MAXWIDTH+1];
|
extern angle_t xtoviewangle[MAXWIDTH+1];
|
||||||
extern int FieldOfView;
|
extern DAngle FieldOfView;
|
||||||
|
|
||||||
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
|
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,6 @@ void R_SetupColormap(player_t *);
|
||||||
void R_SetupFreelook();
|
void R_SetupFreelook();
|
||||||
void R_InitRenderer();
|
void R_InitRenderer();
|
||||||
|
|
||||||
extern float LastFOV;
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// DCanvas :: Init
|
// DCanvas :: Init
|
||||||
|
@ -272,8 +270,8 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
|
||||||
unsigned char *savecolormap = fixedcolormap;
|
unsigned char *savecolormap = fixedcolormap;
|
||||||
FSpecialColormap *savecm = realfixedcolormap;
|
FSpecialColormap *savecm = realfixedcolormap;
|
||||||
|
|
||||||
float savedfov = LastFOV;
|
DAngle savedfov = FieldOfView;
|
||||||
R_SetFOV ((float)fov);
|
R_SetFOV ((double)fov);
|
||||||
R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
|
R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
|
||||||
R_SetFOV (savedfov);
|
R_SetFOV (savedfov);
|
||||||
if (Pixels == Canvas->GetBuffer())
|
if (Pixels == Canvas->GetBuffer())
|
||||||
|
|
|
@ -678,7 +678,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the voxel, either directly to the screen or offscreen.
|
// Render the voxel, either directly to the screen or offscreen.
|
||||||
R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->angle,
|
R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->Angle,
|
||||||
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.colormap, cliptop, clipbot,
|
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.colormap, cliptop, clipbot,
|
||||||
minslabz, maxslabz, flags);
|
minslabz, maxslabz, flags);
|
||||||
|
|
||||||
|
@ -994,7 +994,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
vis->texturemid = tex->TopOffset - (ViewPos.Z - pos.Z + thing->Floorclip) / yscale;
|
vis->texturemid = tex->TopOffset - (ViewPos.Z - pos.Z + thing->Floorclip) / yscale;
|
||||||
vis->x1 = x1 < WindowLeft ? WindowLeft : x1;
|
vis->x1 = x1 < WindowLeft ? WindowLeft : x1;
|
||||||
vis->x2 = x2 > WindowRight ? WindowRight : x2;
|
vis->x2 = x2 > WindowRight ? WindowRight : x2;
|
||||||
vis->angle = thing->Angles.Yaw.BAMs();
|
vis->Angle = thing->Angles.Yaw;
|
||||||
|
|
||||||
if (renderflags & RF_XFLIP)
|
if (renderflags & RF_XFLIP)
|
||||||
{
|
{
|
||||||
|
@ -1024,13 +1024,13 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
|
|
||||||
pos.Z -= thing->Floorclip;
|
pos.Z -= thing->Floorclip;
|
||||||
|
|
||||||
vis->angle = thing->Angles.Yaw.BAMs() + voxel->AngleOffset.BAMs();
|
vis->Angle = thing->Angles.Yaw + voxel->AngleOffset;
|
||||||
|
|
||||||
int voxelspin = (thing->flags & MF_DROPPED) ? voxel->DroppedSpin : voxel->PlacedSpin;
|
int voxelspin = (thing->flags & MF_DROPPED) ? voxel->DroppedSpin : voxel->PlacedSpin;
|
||||||
if (voxelspin != 0)
|
if (voxelspin != 0)
|
||||||
{
|
{
|
||||||
DAngle ang = double(I_FPSTime()) * voxelspin / 1000;
|
DAngle ang = double(I_FPSTime()) * voxelspin / 1000;
|
||||||
vis->angle -= ang.BAMs();
|
vis->Angle -= ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
vis->pa.vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z };
|
vis->pa.vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z };
|
||||||
|
@ -2664,7 +2664,7 @@ void R_DrawParticle (vissprite_t *vis)
|
||||||
extern double BaseYaspectMul;;
|
extern double BaseYaspectMul;;
|
||||||
|
|
||||||
void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
||||||
const FVector3 &dasprpos, angle_t dasprang,
|
const FVector3 &dasprpos, DAngle dasprang,
|
||||||
fixed_t daxscale, fixed_t dayscale, FVoxel *voxobj,
|
fixed_t daxscale, fixed_t dayscale, FVoxel *voxobj,
|
||||||
lighttable_t *colormap, short *daumost, short *dadmost, int minslabz, int maxslabz, int flags)
|
lighttable_t *colormap, short *daumost, short *dadmost, int minslabz, int maxslabz, int flags)
|
||||||
{
|
{
|
||||||
|
@ -2698,10 +2698,10 @@ void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
||||||
dayscale = dayscale / (0xC000 >> 6);
|
dayscale = dayscale / (0xC000 >> 6);
|
||||||
|
|
||||||
angle_t viewang = viewangle.BAMs();
|
angle_t viewang = viewangle.BAMs();
|
||||||
cosang = finecosine[viewang >> ANGLETOFINESHIFT] >> 2;
|
cosang = FLOAT2FIXED(viewangle.Cos()) >> 2;
|
||||||
sinang = -finesine[viewang >> ANGLETOFINESHIFT] >> 2;
|
sinang = FLOAT2FIXED(-viewangle.Sin()) >> 2;
|
||||||
sprcosang = finecosine[dasprang >> ANGLETOFINESHIFT] >> 2;
|
sprcosang = FLOAT2FIXED(dasprang.Cos()) >> 2;
|
||||||
sprsinang = -finesine[dasprang >> ANGLETOFINESHIFT] >> 2;
|
sprsinang = FLOAT2FIXED(-dasprang.Sin()) >> 2;
|
||||||
|
|
||||||
R_SetupDrawSlab(colormap);
|
R_SetupDrawSlab(colormap);
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,16 @@ struct vissprite_t
|
||||||
FVector3 gpos; // origin in world coordinates
|
FVector3 gpos; // origin in world coordinates
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
float gzb, gzt; // global bottom / top for silhouette clipping
|
struct
|
||||||
int y1, y2; // top / bottom of particle on screen
|
{
|
||||||
|
float gzb, gzt; // global bottom / top for silhouette clipping
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int y1, y2; // top / bottom of particle on screen
|
||||||
|
};
|
||||||
};
|
};
|
||||||
angle_t angle;
|
DAngle Angle;
|
||||||
fixed_t xscale;
|
fixed_t xscale;
|
||||||
float yscale;
|
float yscale;
|
||||||
float depth;
|
float depth;
|
||||||
|
@ -135,7 +141,7 @@ void R_CheckOffscreenBuffer(int width, int height, bool spansonly);
|
||||||
enum { DVF_OFFSCREEN = 1, DVF_SPANSONLY = 2, DVF_MIRRORED = 4 };
|
enum { DVF_OFFSCREEN = 1, DVF_SPANSONLY = 2, DVF_MIRRORED = 4 };
|
||||||
|
|
||||||
void R_DrawVoxel(const FVector3 &viewpos, FAngle viewangle,
|
void R_DrawVoxel(const FVector3 &viewpos, FAngle viewangle,
|
||||||
const FVector3 &sprpos, angle_t dasprang,
|
const FVector3 &sprpos, DAngle dasprang,
|
||||||
fixed_t daxscale, fixed_t dayscale, struct FVoxel *voxobj,
|
fixed_t daxscale, fixed_t dayscale, struct FVoxel *voxobj,
|
||||||
lighttable_t *colormap, short *daumost, short *dadmost, int minslabz, int maxslabz, int flags);
|
lighttable_t *colormap, short *daumost, short *dadmost, int minslabz, int maxslabz, int flags);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,6 @@ angle_t LocalViewAngle;
|
||||||
int LocalViewPitch;
|
int LocalViewPitch;
|
||||||
bool LocalKeyboardTurner;
|
bool LocalKeyboardTurner;
|
||||||
|
|
||||||
float LastFOV;
|
|
||||||
int WidescreenRatio;
|
int WidescreenRatio;
|
||||||
int setblocks;
|
int setblocks;
|
||||||
int extralight;
|
int extralight;
|
||||||
|
@ -147,7 +146,7 @@ double FocalTangent;
|
||||||
|
|
||||||
unsigned int R_OldBlend = ~0;
|
unsigned int R_OldBlend = ~0;
|
||||||
int validcount = 1; // increment every time a check is made
|
int validcount = 1; // increment every time a check is made
|
||||||
int FieldOfView = 2048; // Fineangles in the SCREENWIDTH wide window
|
DAngle FieldOfView = 90.; // Angles in the SCREENWIDTH wide window
|
||||||
|
|
||||||
FCanvasTextureInfo *FCanvasTextureInfo::List;
|
FCanvasTextureInfo *FCanvasTextureInfo::List;
|
||||||
|
|
||||||
|
@ -158,63 +157,6 @@ DAngle viewpitch;
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
static void R_Shutdown ();
|
static void R_Shutdown ();
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_InitPointToAngle
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_InitPointToAngle (void)
|
|
||||||
{
|
|
||||||
double f;
|
|
||||||
int i;
|
|
||||||
//
|
|
||||||
// slope (tangent) to angle lookup
|
|
||||||
//
|
|
||||||
for (i = 0; i <= SLOPERANGE; i++)
|
|
||||||
{
|
|
||||||
f = g_atan2 ((double)i, (double)SLOPERANGE) / (6.28318530718 /* 2*pi */);
|
|
||||||
tantoangle[i] = (angle_t)(0xffffffff*f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_InitTables
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_InitTables (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const double pimul = PI*2/FINEANGLES;
|
|
||||||
|
|
||||||
// viewangle tangent table
|
|
||||||
finetangent[0] = (fixed_t)(FRACUNIT*g_tan ((0.5-FINEANGLES/4)*pimul)+0.5);
|
|
||||||
for (i = 1; i < FINEANGLES/2; i++)
|
|
||||||
{
|
|
||||||
finetangent[i] = (fixed_t)(FRACUNIT*g_tan ((i-FINEANGLES/4)*pimul)+0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
// finesine table
|
|
||||||
for (i = 0; i < FINEANGLES/4; i++)
|
|
||||||
{
|
|
||||||
finesine[i] = (fixed_t)(FRACUNIT * g_sin (i*pimul));
|
|
||||||
}
|
|
||||||
for (i = 0; i < FINEANGLES/4; i++)
|
|
||||||
{
|
|
||||||
finesine[i+FINEANGLES/4] = finesine[FINEANGLES/4-1-i];
|
|
||||||
}
|
|
||||||
for (i = 0; i < FINEANGLES/2; i++)
|
|
||||||
{
|
|
||||||
finesine[i+FINEANGLES/2] = -finesine[i];
|
|
||||||
}
|
|
||||||
finesine[FINEANGLES/4] = FRACUNIT;
|
|
||||||
finesine[FINEANGLES*3/4] = -FRACUNIT;
|
|
||||||
memcpy (&finesine[FINEANGLES], &finesine[0], sizeof(angle_t)*FINEANGLES/4);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_SetFOV
|
// R_SetFOV
|
||||||
|
@ -223,33 +165,18 @@ void R_InitTables (void)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_SetFOV (float fov)
|
void R_SetFOV (DAngle fov)
|
||||||
{
|
{
|
||||||
if (fov < 5.f)
|
|
||||||
fov = 5.f;
|
if (fov < 5.) fov = 5.;
|
||||||
else if (fov > 170.f)
|
else if (fov > 170.) fov = 170.;
|
||||||
fov = 170.f;
|
if (fov != FieldOfView)
|
||||||
if (fov != LastFOV)
|
|
||||||
{
|
{
|
||||||
LastFOV = fov;
|
FieldOfView = fov;
|
||||||
FieldOfView = (int)(fov * (float)FINEANGLES / 360.f);
|
|
||||||
setsizeneeded = true;
|
setsizeneeded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_GetFOV
|
|
||||||
//
|
|
||||||
// Returns the current field of view in degrees
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
float R_GetFOV ()
|
|
||||||
{
|
|
||||||
return LastFOV;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_SetViewSize
|
// R_SetViewSize
|
||||||
|
@ -313,18 +240,16 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int fov = FieldOfView;
|
DAngle fov = FieldOfView;
|
||||||
|
|
||||||
// For widescreen displays, increase the FOV so that the middle part of the
|
// For widescreen displays, increase the FOV so that the middle part of the
|
||||||
// screen that would be visible on a 4:3 display has the requested FOV.
|
// screen that would be visible on a 4:3 display has the requested FOV.
|
||||||
if (centerxwide != centerx)
|
if (centerxwide != centerx)
|
||||||
{ // centerxwide is what centerx would be if the display was not widescreen
|
{ // centerxwide is what centerx would be if the display was not widescreen
|
||||||
fov = int(atan(double(centerx)*tan(double(fov)*M_PI/(FINEANGLES))/double(centerxwide))*(FINEANGLES)/M_PI);
|
fov = DAngle::ToDegrees(2 * atan(centerx * tan(fov.Radians()/2) / double(centerxwide)));
|
||||||
if (fov > 170*FINEANGLES/360)
|
if (fov > 170.) fov = 170.;
|
||||||
fov = 170*FINEANGLES/360;
|
|
||||||
}
|
}
|
||||||
|
FocalTangent = tan(fov.Radians() / 2);
|
||||||
FocalTangent = FIXED2FLOAT(finetangent[FINEANGLES/4+fov/2]);
|
|
||||||
Renderer->SetWindow(windowSize, fullWidth, fullHeight, stHeight, trueratio);
|
Renderer->SetWindow(windowSize, fullWidth, fullHeight, stHeight, trueratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,8 +335,6 @@ void R_Init ()
|
||||||
//R_InitColormaps ();
|
//R_InitColormaps ();
|
||||||
//StartScreen->Progress();
|
//StartScreen->Progress();
|
||||||
|
|
||||||
R_InitPointToAngle ();
|
|
||||||
R_InitTables ();
|
|
||||||
R_InitTranslationTables ();
|
R_InitTranslationTables ();
|
||||||
R_SetViewSize (screenblocks);
|
R_SetViewSize (screenblocks);
|
||||||
Renderer->Init();
|
Renderer->Init();
|
||||||
|
@ -874,7 +797,7 @@ void R_SetupFrame (AActor *actor)
|
||||||
|
|
||||||
if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0)
|
if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0)
|
||||||
{
|
{
|
||||||
ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff);
|
ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.RFalloff, jiggers.RWFalloff);
|
||||||
}
|
}
|
||||||
if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0)
|
if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,8 +85,7 @@ bool R_GetViewInterpolationStatus();
|
||||||
void R_ClearInterpolationPath();
|
void R_ClearInterpolationPath();
|
||||||
void R_AddInterpolationPoint(const DVector3a &vec);
|
void R_AddInterpolationPoint(const DVector3a &vec);
|
||||||
void R_SetViewSize (int blocks);
|
void R_SetViewSize (int blocks);
|
||||||
void R_SetFOV (float fov);
|
void R_SetFOV (DAngle fov);
|
||||||
float R_GetFOV ();
|
|
||||||
void R_SetupFrame (AActor * camera);
|
void R_SetupFrame (AActor * camera);
|
||||||
void R_SetViewAngle ();
|
void R_SetViewAngle ();
|
||||||
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// $Id:$
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
//
|
|
||||||
// This source is available for distribution and/or modification
|
|
||||||
// only under the terms of the DOOM Source Code License as
|
|
||||||
// published by id Software. All rights reserved.
|
|
||||||
//
|
|
||||||
// The source is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// Lookup tables.
|
|
||||||
// Do not try to look them up :-).
|
|
||||||
// In the order of appearance:
|
|
||||||
//
|
|
||||||
// int finetangent[4096] - Tangens LUT.
|
|
||||||
// Should work with BAM fairly well (12 of 16bit,
|
|
||||||
// effectively, by shifting).
|
|
||||||
//
|
|
||||||
// int finesine[10240] - Sine lookup.
|
|
||||||
// Guess what, serves as cosine, too.
|
|
||||||
// Remarkable thing is, how to use BAMs with this?
|
|
||||||
//
|
|
||||||
// int tantoangle[2049] - ArcTan LUT,
|
|
||||||
// maps tan(angle) to angle fast. Gotta search.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "tables.h"
|
|
||||||
|
|
||||||
fixed_t finetangent[4096];
|
|
||||||
fixed_t finesine[10240];
|
|
||||||
angle_t tantoangle[2049];
|
|
||||||
|
|
||||||
cosine_inline finecosine; // in case this is actually needed
|
|
111
src/tables.h
111
src/tables.h
|
@ -1,111 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// $Id:$
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
//
|
|
||||||
// This source is available for distribution and/or modification
|
|
||||||
// only under the terms of the DOOM Source Code License as
|
|
||||||
// published by id Software. All rights reserved.
|
|
||||||
//
|
|
||||||
// The source is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// Lookup tables.
|
|
||||||
// Do not try to look them up :-).
|
|
||||||
// In the order of appearance:
|
|
||||||
//
|
|
||||||
// int finetangent[4096] - Tangens LUT.
|
|
||||||
// Should work with BAM fairly well (12 of 16bit,
|
|
||||||
// effectively, by shifting).
|
|
||||||
//
|
|
||||||
// int finesine[10240] - Sine lookup.
|
|
||||||
// Guess what, serves as cosine, too.
|
|
||||||
// Remarkable thing is, how to use BAMs with this?
|
|
||||||
//
|
|
||||||
// int tantoangle[2049] - ArcTan LUT,
|
|
||||||
// maps tan(angle) to angle fast. Gotta search.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __TABLES_H__
|
|
||||||
#define __TABLES_H__
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include "basictypes.h"
|
|
||||||
|
|
||||||
#ifndef PI
|
|
||||||
#define PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define FINEANGLEBITS 13
|
|
||||||
#define FINEANGLES 8192
|
|
||||||
#define FINEMASK (FINEANGLES-1)
|
|
||||||
|
|
||||||
// 0x100000000 to 0x2000
|
|
||||||
#define ANGLETOFINESHIFT 19
|
|
||||||
|
|
||||||
#define BOBTOFINESHIFT (FINEANGLEBITS - 6)
|
|
||||||
|
|
||||||
// Effective size is 10240.
|
|
||||||
extern fixed_t finesine[5*FINEANGLES/4];
|
|
||||||
|
|
||||||
// Re-use data, is just PI/2 phase shift.
|
|
||||||
// [RH] Instead of using a pointer, use some inline code
|
|
||||||
// (encapsulated in a struct so that we can still use array accesses).
|
|
||||||
struct cosine_inline
|
|
||||||
{
|
|
||||||
fixed_t operator[] (unsigned int x) const
|
|
||||||
{
|
|
||||||
return finesine[x+FINEANGLES/4];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
extern cosine_inline finecosine;
|
|
||||||
|
|
||||||
// Effective size is 4096.
|
|
||||||
extern fixed_t finetangent[FINEANGLES/2];
|
|
||||||
|
|
||||||
// Binary Angle Measument, BAM.
|
|
||||||
#define ANG45 (0x20000000)
|
|
||||||
#define ANG90 (0x40000000)
|
|
||||||
#define ANG180 (0x80000000)
|
|
||||||
#define ANG270 (0xc0000000)
|
|
||||||
|
|
||||||
#define ANGLE_45 (0x20000000)
|
|
||||||
#define ANGLE_90 (0x40000000)
|
|
||||||
#define ANGLE_180 (0x80000000)
|
|
||||||
#define ANGLE_270 (0xc0000000)
|
|
||||||
#define ANGLE_MAX (0xffffffff)
|
|
||||||
#define ANGLE_1 (ANGLE_45/45)
|
|
||||||
#define ANGLE_60 (ANGLE_180/3)
|
|
||||||
|
|
||||||
|
|
||||||
#define SLOPERANGE 2048
|
|
||||||
#define SLOPEBITS 11
|
|
||||||
#define DBITS (FRACBITS-SLOPEBITS)
|
|
||||||
|
|
||||||
typedef uint32 angle_t;
|
|
||||||
|
|
||||||
// Previously seen all over the place, code like this: abs(ang1 - ang2)
|
|
||||||
// Clang warns (and is absolutely correct) that technically, this
|
|
||||||
// could be optimized away and do nothing:
|
|
||||||
// warning: taking the absolute value of unsigned type 'unsigned int' has no effect
|
|
||||||
// note: remove the call to 'abs' since unsigned values cannot be negative
|
|
||||||
inline angle_t absangle(angle_t a)
|
|
||||||
{
|
|
||||||
return (angle_t)abs((int32_t)a);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Effective size is 2049;
|
|
||||||
// The +1 size is to handle the case when x==y
|
|
||||||
// without additional checking.
|
|
||||||
extern angle_t tantoangle[SLOPERANGE+1];
|
|
||||||
|
|
||||||
#endif // __TABLES_H__
|
|
|
@ -72,6 +72,10 @@ FTextureManager::FTextureManager ()
|
||||||
{
|
{
|
||||||
memset (HashFirst, -1, sizeof(HashFirst));
|
memset (HashFirst, -1, sizeof(HashFirst));
|
||||||
|
|
||||||
|
for (int i = 0; i < 2048; ++i)
|
||||||
|
{
|
||||||
|
sintable[i] = short(sin(i*(M_PI / 1024)) * 16384);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -517,6 +517,12 @@ private:
|
||||||
TArray<FSwitchDef *> mSwitchDefs;
|
TArray<FSwitchDef *> mSwitchDefs;
|
||||||
TArray<FDoorAnimation> mAnimatedDoors;
|
TArray<FDoorAnimation> mAnimatedDoors;
|
||||||
TArray<BYTE *> BuildTileFiles;
|
TArray<BYTE *> BuildTileFiles;
|
||||||
|
public:
|
||||||
|
short sintable[2048]; // for texture warping
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SINMASK = 2047
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// A texture that doesn't really exist
|
// A texture that doesn't really exist
|
||||||
|
@ -554,7 +560,7 @@ protected:
|
||||||
BYTE *Pixels;
|
BYTE *Pixels;
|
||||||
Span **Spans;
|
Span **Spans;
|
||||||
float Speed;
|
float Speed;
|
||||||
int WidthOffsetMultipiler, HeightOffsetMultipiler; // [mxd]
|
int WidthOffsetMultiplier, HeightOffsetMultiplier; // [mxd]
|
||||||
|
|
||||||
virtual void MakeTexture (DWORD time);
|
virtual void MakeTexture (DWORD time);
|
||||||
int NextPo2 (int v); // [mxd]
|
int NextPo2 (int v); // [mxd]
|
||||||
|
|
|
@ -120,9 +120,9 @@ const BYTE *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out
|
||||||
return Pixels + column*Height;
|
return Pixels + column*Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FWarpTexture::MakeTexture (DWORD time)
|
void FWarpTexture::MakeTexture(DWORD time)
|
||||||
{
|
{
|
||||||
const BYTE *otherpix = SourcePic->GetPixels ();
|
const BYTE *otherpix = SourcePic->GetPixels();
|
||||||
|
|
||||||
if (Pixels == NULL)
|
if (Pixels == NULL)
|
||||||
{
|
{
|
||||||
|
@ -130,17 +130,17 @@ void FWarpTexture::MakeTexture (DWORD time)
|
||||||
}
|
}
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans(Spans);
|
||||||
Spans = NULL;
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenTime = time;
|
GenTime = time;
|
||||||
|
|
||||||
BYTE *buffer = (BYTE *)alloca (MAX (Width, Height));
|
BYTE *buffer = (BYTE *)alloca(MAX(Width, Height));
|
||||||
int xsize = Width;
|
int xsize = Width;
|
||||||
int ysize = Height;
|
int ysize = Height;
|
||||||
int xmul = WidthOffsetMultipiler; // [mxd]
|
int xmul = WidthOffsetMultiplier; // [mxd]
|
||||||
int ymul = HeightOffsetMultipiler; // [mxd]
|
int ymul = HeightOffsetMultiplier; // [mxd]
|
||||||
int xmask = WidthMask;
|
int xmask = WidthMask;
|
||||||
int ymask = Height - 1;
|
int ymask = Height - 1;
|
||||||
int ybits = HeightBits;
|
int ybits = HeightBits;
|
||||||
|
@ -153,39 +153,39 @@ void FWarpTexture::MakeTexture (DWORD time)
|
||||||
|
|
||||||
DWORD timebase = DWORD(time * Speed * 32 / 28);
|
DWORD timebase = DWORD(time * Speed * 32 / 28);
|
||||||
// [mxd] Rewrote to fix animation for NPo2 textures
|
// [mxd] Rewrote to fix animation for NPo2 textures
|
||||||
for (y = ysize-1; y >= 0; y--)
|
for (y = ysize - 1; y >= 0; y--)
|
||||||
{
|
{
|
||||||
int xf = (finesine[(timebase+y*ymul)&FINEMASK]>>13) % xsize;
|
int xf = (TexMan.sintable[((timebase + y*ymul) >> 2)&TexMan.SINMASK] >> 11) % xsize;
|
||||||
if(xf < 0) xf += xsize;
|
if (xf < 0) xf += xsize;
|
||||||
int xt = xf;
|
int xt = xf;
|
||||||
const BYTE *source = otherpix + y;
|
const BYTE *source = otherpix + y;
|
||||||
BYTE *dest = Pixels + y;
|
BYTE *dest = Pixels + y;
|
||||||
for (xt = xsize; xt; xt--, xf = (xf+1)%xsize, dest += ysize)
|
for (xt = xsize; xt; xt--, xf = (xf + 1) % xsize, dest += ysize)
|
||||||
*dest = source[xf + ymask * xf];
|
*dest = source[xf + ymask * xf];
|
||||||
}
|
}
|
||||||
timebase = DWORD(time * Speed * 23 / 28);
|
timebase = DWORD(time * Speed * 23 / 28);
|
||||||
for (x = xsize-1; x >= 0; x--)
|
for (x = xsize - 1; x >= 0; x--)
|
||||||
{
|
{
|
||||||
int yf = (finesine[(time+(x+17)*xmul)&FINEMASK]>>13) % ysize;
|
int yf = (TexMan.sintable[((time + (x + 17)*xmul) >> 2)&TexMan.SINMASK] >> 11) % ysize;
|
||||||
if(yf < 0) yf += ysize;
|
if (yf < 0) yf += ysize;
|
||||||
int yt = yf;
|
int yt = yf;
|
||||||
const BYTE *source = Pixels + (x + ymask * x);
|
const BYTE *source = Pixels + (x + ymask * x);
|
||||||
BYTE *dest = buffer;
|
BYTE *dest = buffer;
|
||||||
for (yt = ysize; yt; yt--, yf = (yf+1)%ysize)
|
for (yt = ysize; yt; yt--, yf = (yf + 1) % ysize)
|
||||||
*dest++ = source[yf];
|
*dest++ = source[yf];
|
||||||
memcpy (Pixels+(x+ymask*x), buffer, ysize);
|
memcpy(Pixels + (x + ymask*x), buffer, ysize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// [mxd] Non power of 2 textures need different offset multipliers, otherwise warp animation won't sync across texture
|
// [mxd] Non power of 2 textures need different offset multipliers, otherwise warp animation won't sync across texture
|
||||||
void FWarpTexture::SetupMultipliers (int width, int height)
|
void FWarpTexture::SetupMultipliers (int width, int height)
|
||||||
{
|
{
|
||||||
WidthOffsetMultipiler = width;
|
WidthOffsetMultiplier = width;
|
||||||
HeightOffsetMultipiler = height;
|
HeightOffsetMultiplier = height;
|
||||||
int widthpo2 = NextPo2(Width);
|
int widthpo2 = NextPo2(Width);
|
||||||
int heightpo2 = NextPo2(Height);
|
int heightpo2 = NextPo2(Height);
|
||||||
if(widthpo2 != Width) WidthOffsetMultipiler = (int)(WidthOffsetMultipiler * ((float)widthpo2 / Width));
|
if(widthpo2 != Width) WidthOffsetMultiplier = (int)(WidthOffsetMultiplier * ((float)widthpo2 / Width));
|
||||||
if(heightpo2 != Height) HeightOffsetMultipiler = (int)(HeightOffsetMultipiler * ((float)heightpo2 / Height));
|
if(heightpo2 != Height) HeightOffsetMultiplier = (int)(HeightOffsetMultiplier * ((float)heightpo2 / Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
int FWarpTexture::NextPo2 (int v)
|
int FWarpTexture::NextPo2 (int v)
|
||||||
|
@ -225,8 +225,8 @@ void FWarp2Texture::MakeTexture (DWORD time)
|
||||||
|
|
||||||
int xsize = Width;
|
int xsize = Width;
|
||||||
int ysize = Height;
|
int ysize = Height;
|
||||||
int xmul = WidthOffsetMultipiler; // [mxd]
|
int xmul = WidthOffsetMultiplier; // [mxd]
|
||||||
int ymul = HeightOffsetMultipiler; // [mxd]
|
int ymul = HeightOffsetMultiplier; // [mxd]
|
||||||
int xmask = WidthMask;
|
int xmask = WidthMask;
|
||||||
int ymask = Height - 1;
|
int ymask = Height - 1;
|
||||||
int ybits = HeightBits;
|
int ybits = HeightBits;
|
||||||
|
@ -245,12 +245,12 @@ void FWarp2Texture::MakeTexture (DWORD time)
|
||||||
for (y = 0; y < ysize; y++)
|
for (y = 0; y < ysize; y++)
|
||||||
{
|
{
|
||||||
int xt = (x + 128
|
int xt = (x + 128
|
||||||
+ ((finesine[(y*ymul + timebase*5 + 900) & FINEMASK]*2)>>FRACBITS)
|
+ ((TexMan.sintable[((y*ymul + timebase*5 + 900) >> 2) & TexMan.SINMASK])>>13)
|
||||||
+ ((finesine[(x*xmul + timebase*4 + 300) & FINEMASK]*2)>>FRACBITS)) % xsize;
|
+ ((TexMan.sintable[((x*xmul + timebase*4 + 300) >> 2) & TexMan.SINMASK])>>13)) % xsize;
|
||||||
|
|
||||||
int yt = (y + 128
|
int yt = (y + 128
|
||||||
+ ((finesine[(y*ymul + timebase*3 + 700) & FINEMASK]*2)>>FRACBITS)
|
+ ((TexMan.sintable[((y*ymul + timebase*3 + 700) >> 2) & TexMan.SINMASK])>>13)
|
||||||
+ ((finesine[(x*xmul + timebase*4 + 1200) & FINEMASK]*2)>>FRACBITS)) % ysize;
|
+ ((TexMan.sintable[((x*xmul + timebase*4 + 1200) >> 2) & TexMan.SINMASK])>>13)) % ysize;
|
||||||
|
|
||||||
*dest++ = otherpix[(xt + ymask * xt) + yt];
|
*dest++ = otherpix[(xt + ymask * xt) + yt];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4985,7 +4985,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx)
|
||||||
PARAM_FLOAT_OPT(mulWaveZ) { mulWaveZ = 1.; }
|
PARAM_FLOAT_OPT(mulWaveZ) { mulWaveZ = 1.; }
|
||||||
PARAM_INT_OPT(falloff) { falloff = 0; }
|
PARAM_INT_OPT(falloff) { falloff = 0; }
|
||||||
PARAM_INT_OPT(highpoint) { highpoint = 0; }
|
PARAM_INT_OPT(highpoint) { highpoint = 0; }
|
||||||
PARAM_INT_OPT(rollIntensity) { rollIntensity = 0; }
|
PARAM_FLOAT_OPT(rollIntensity) { rollIntensity = 0.; }
|
||||||
PARAM_FLOAT_OPT(rollWave) { rollWave = 0.; }
|
PARAM_FLOAT_OPT(rollWave) { rollWave = 0.; }
|
||||||
P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint,
|
P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint,
|
||||||
rollIntensity, rollWave);
|
rollIntensity, rollWave);
|
||||||
|
|
|
@ -281,7 +281,7 @@ ACTOR Actor native //: Thinker
|
||||||
native void A_SetUserArrayFloat(name varname, int index, float value);
|
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_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_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, int rollIntensity = 0, float rollWave = 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, float rollIntensity = 0, float rollWave = 0);
|
||||||
action native A_SetTics(int tics);
|
action native A_SetTics(int tics);
|
||||||
native void A_SetDamageType(name damagetype);
|
native void A_SetDamageType(name damagetype);
|
||||||
native void A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
|
native void A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
|
||||||
|
|
Loading…
Reference in a new issue