# Conflicts:
#	wadsrc/static/menudef.txt
This commit is contained in:
Christoph Oelckers 2016-02-21 01:55:15 +01:00
commit dfd7e08307
21 changed files with 1673 additions and 886 deletions

View file

@ -2,7 +2,7 @@ cmake_minimum_required( VERSION 2.8.7 )
if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif( COMMAND cmake_policy )
endif()
include( CheckCXXSourceCompiles )
include( CheckFunctionExists )
@ -50,7 +50,7 @@ endif()
# a system-wide version.
# Construct version numbers for searching for the FMOD library on Linux.
set( MINOR_VERSIONS "50" "49" "48" "47" "46" "45" "44" "43" "42" "41"
set( MINOR_VERSIONS "61" "50" "49" "48" "47" "46" "45" "44" "43" "42" "41"
"40" "39" "38" "37" "36" "35" "34" "33" "32" "31" "30" "29" "28"
"27" "26" "25" "24" "23" "22" "21" "20" "21" "19" "18" "17" "16"
"15" "14" "13" "12" "11" "10" "09" "08" "07" "06" "05" "04" "03"
@ -74,7 +74,12 @@ set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "../fmod" )
foreach( majver ${MAJOR_VERSIONS} )
foreach( minver ${MINOR_VERSIONS} )
set( FMOD_VERSIONS ${FMOD_VERSIONS} "fmodex${X64}-4.${majver}.${minver}" )
set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "${CMAKE_HOME_DIRECTORY}/fmodapi4${majver}${minver}linux${X64}" )
# FMOD Ex version 4.44 unified 32-bit and 64-bit linux packages into one.
if( NOT majver EQUAL "44" )
set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "${CMAKE_HOME_DIRECTORY}/fmodapi4${majver}${minver}linux${X64}" )
else()
set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "${CMAKE_HOME_DIRECTORY}/fmodapi4${majver}${minver}linux" )
endif()
endforeach()
foreach( dir ${FMOD_DIR_VERSIONS} )
set( FMOD_LOCAL_INC_DIRS ${FMOD_LOCAL_INC_DIRS} "${dir}/api/inc" )
@ -355,7 +360,7 @@ if( NOT NO_ASM )
# string( REGEX REPLACE ".*version ([0-9]+[.][0-9]+).*" "\\1" NASM_VER "${NASM_VER_STRING}" )
# if( NOT NASM_VER LESS 2 )
# message( SEND_ERROR "NASM version should be 2 or later. (Installed version is ${NASM_VER}.)" )
# endif( NOT NASM_VER LESS 2 )
# endif()
endif()
if( NOT NO_ASM )
@ -430,7 +435,7 @@ if (NOT ZDOOM_USE_SSE2)
set( SSE1_ENABLE -arch:SSE )
set( SSE2_ENABLE -arch:SSE2 )
set( SSE_MATTERS YES )
endif( )
endif()
endif()
endif()
@ -544,7 +549,7 @@ if( UNIX )
message( STATUS "Could not find clock_gettime. Timing statistics will not be available." )
add_definitions( -DNO_CLOCK_GETTIME )
endif()
else( NOT CLOCK_GETTIME_IN_RT )
else()
set( ZDOOM_LIBS ${ZDOOM_LIBS} rt )
endif()
endif()
@ -592,12 +597,12 @@ if( MPG123_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${MPG123_LIBRARIES}" )
include_directories( "${MPG123_INCLUDE_DIR}" )
endif()
if( NOT DYN_FLUIDSYNTH)
if( NOT DYN_FLUIDSYNTH )
if( FLUIDSYNTH_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${FLUIDSYNTH_LIBRARIES}" )
include_directories( "${FLUIDSYNTH_INCLUDE_DIR}" )
endif()
else( NOT DYN_FLUIDSYNTH )
else()
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${CMAKE_DL_LIBS} )
endif()

View file

@ -777,15 +777,16 @@ CCMD (warp)
Printf ("You can only warp inside a level.\n");
return;
}
if (argv.argc() != 3)
if (argv.argc() < 3 || argv.argc() > 4)
{
Printf ("Usage: warp <x> <y>\n");
Printf ("Usage: warp <x> <y> [z]\n");
}
else
{
Net_WriteByte (DEM_WARPCHEAT);
Net_WriteWord (atoi (argv[1]));
Net_WriteWord (atoi (argv[2]));
Net_WriteWord (argv.argc() == 3 ? ONFLOORZ/65536 : atoi (argv[3]));
}
}

View file

@ -2199,10 +2199,11 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_WARPCHEAT:
{
int x, y;
int x, y, z;
x = ReadWord (stream);
y = ReadWord (stream);
P_TeleportMove (players[player].mo, x * 65536, y * 65536, ONFLOORZ, true);
z = ReadWord (stream);
P_TeleportMove (players[player].mo, x * 65536, y * 65536, z * 65536, true);
}
break;
@ -2744,9 +2745,12 @@ void Net_SkipCommand (int type, BYTE **stream)
skip = strlen ((char *)(*stream)) + 1;
break;
case DEM_WARPCHEAT:
skip = 6;
break;
case DEM_INVUSE:
case DEM_INVDROP:
case DEM_WARPCHEAT:
skip = 4;
break;

View file

@ -121,7 +121,8 @@ public:
bool Activate()
{
M_StartMessage("Do you really want to do this?", 0);
const char *msg = GStrings("SAFEMESSAGE");
if (msg) M_StartMessage(msg, 0);
return true;
}
};

View file

@ -323,6 +323,10 @@ static const UINT32 ksl_tab[8*16]=
};
#undef DV
/* 0 / 3.0 / 1.5 / 6.0 dB/OCT */
static const UINT32 ksl_shift[4] = { 31, 1, 2, 0 };
/* sustain level table (3dB per step) */
/* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
#define SC(db) (UINT32) ( db * (2.0/ENV_STEP) )
@ -1271,9 +1275,8 @@ void set_ksl_tl(FM_OPL *OPL,int slot,int v)
{
OPL_CH *CH = &OPL->P_CH[slot/2];
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
int ksl = v>>6; /* 0 / 1.5 / 3.0 / 6.0 dB/OCT */
SLOT->ksl = ksl ? 3-ksl : 31;
SLOT->ksl = ksl_shift[v >> 6];
SLOT->TL = (v&0x3f)<<(ENV_BITS-1-7); /* 7 bits TL (bit 6 = always 0) */
SLOT->TLL = SLOT->TL + (CH->ksl_base>>SLOT->ksl);

View file

@ -4564,13 +4564,13 @@ bool GetVarAddrType(AActor *self, FName varname, int index, void *&addr, PType *
{
PField *var = dyn_cast<PField>(self->GetClass()->Symbols.FindSymbol(varname, true));
PArray *arraytype;
BYTE *baddr = reinterpret_cast<BYTE *>(self) + var->Offset;
if (var == NULL || (var->Flags & VARF_Native))
{
return false;
}
type = var->Type;
BYTE *baddr = reinterpret_cast<BYTE *>(self) + var->Offset;
arraytype = dyn_cast<PArray>(type);
if (arraytype != NULL)
{

View file

@ -5495,7 +5495,7 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
// Also process all sectors that have 3D floors transferred from the
// changed sector.
if (sector->e->XFloor.attached.Size())
if (sector->e->XFloor.attached.Size() && floorOrCeil != 2)
{
unsigned i;
sector_t* sec;
@ -5601,7 +5601,7 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
}
} while (n); // repeat from scratch until all things left are marked valid
sector->CheckPortalPlane(floorOrCeil); // check for portal obstructions after everything is done.
if (floorOrCeil != 2) sector->CheckPortalPlane(floorOrCeil); // check for portal obstructions after everything is done.
if (!cpos.nofit && !isreset /* && sector->MoreFlags & (SECF_UNDERWATERMASK)*/)
{

View file

@ -55,6 +55,8 @@ std2:
/*!re2c
"/*" { goto comment; } /* C comment */
"//" (any\"\n")* "\n" { goto newline; } /* C++ comment */
("#region"|"#endregion") (any\"\n")* "\n"
{ goto newline; } /* Region blocks [mxd] */
(["](([\\]["])|[^"])*["]) { RET(TK_StringConst); }
'stop' { RET(TK_Stop); }
@ -80,6 +82,8 @@ std2:
/*!re2c
"/*" { goto comment; } /* C comment */
"//" (any\"\n")* "\n" { goto newline; } /* C++ comment */
("#region"|"#endregion") (any\"\n")* "\n"
{ goto newline; } /* Region blocks [mxd] */
/* C Keywords */
'break' { RET(TK_Break); }
@ -269,6 +273,8 @@ std2:
/*!re2c
"/*" { goto comment; } /* C comment */
("//"|";") (any\"\n")* "\n" { goto newline; } /* C++/Hexen comment */
("#region"|"#endregion") (any\"\n")* "\n"
{ goto newline; } /* Region blocks [mxd] */
WSP+ { goto std1; } /* whitespace */
"\n" { goto newline; }
@ -287,6 +293,8 @@ std2:
/*!re2c
"/*" { goto comment; } /* C comment */
"//" (any\"\n")* "\n" { goto newline; } /* C++ comment */
("#region"|"#endregion") (any\"\n")* "\n"
{ goto newline; } /* Region blocks [mxd] */
WSP+ { goto std1; } /* whitespace */
"\n" { goto newline; }

View file

@ -555,8 +555,11 @@ protected:
BYTE *Pixels;
Span **Spans;
float Speed;
int WidthOffsetMultipiler, HeightOffsetMultipiler; // [mxd]
virtual void MakeTexture (DWORD time);
int NextPo2 (int v); // [mxd]
void SetupMultipliers (int width, int height); // [mxd]
};
// [GRB] Eternity-like warping

View file

@ -44,6 +44,7 @@ FWarpTexture::FWarpTexture (FTexture *source)
: GenTime (0), SourcePic (source), Pixels (0), Spans (0), Speed (1.f)
{
CopyInfo(source);
SetupMultipliers(128, 128); // [mxd]
bWarped = 1;
}
@ -138,6 +139,8 @@ void FWarpTexture::MakeTexture (DWORD time)
BYTE *buffer = (BYTE *)alloca (MAX (Width, Height));
int xsize = Width;
int ysize = Height;
int xmul = WidthOffsetMultipiler; // [mxd]
int ymul = HeightOffsetMultipiler; // [mxd]
int xmask = WidthMask;
int ymask = Height - 1;
int ybits = HeightBits;
@ -149,30 +152,58 @@ void FWarpTexture::MakeTexture (DWORD time)
}
DWORD timebase = DWORD(time * Speed * 32 / 28);
// [mxd] Rewrote to fix animation for NPo2 textures
for (y = ysize-1; y >= 0; y--)
{
int xt, xf = (finesine[(timebase+y*128)&FINEMASK]>>13) & xmask;
int xf = (finesine[(timebase+y*ymul)&FINEMASK]>>13) % xsize;
if(xf < 0) xf += xsize;
int xt = xf;
const BYTE *source = otherpix + y;
BYTE *dest = Pixels + y;
for (xt = xsize; xt; xt--, xf = (xf+1)&xmask, dest += ysize)
*dest = source[xf << ybits];
for (xt = xsize; xt; xt--, xf = (xf+1)%xsize, dest += ysize)
*dest = source[xf + ymask * xf];
}
timebase = DWORD(time * Speed * 23 / 28);
for (x = xsize-1; x >= 0; x--)
{
int yt, yf = (finesine[(time+(x+17)*128)&FINEMASK]>>13) & ymask;
const BYTE *source = Pixels + (x << ybits);
int yf = (finesine[(time+(x+17)*xmul)&FINEMASK]>>13) % ysize;
if(yf < 0) yf += ysize;
int yt = yf;
const BYTE *source = Pixels + (x + ymask * x);
BYTE *dest = buffer;
for (yt = ysize; yt; yt--, yf = (yf+1)&ymask)
for (yt = ysize; yt; yt--, yf = (yf+1)%ysize)
*dest++ = source[yf];
memcpy (Pixels+(x<<ybits), 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
void FWarpTexture::SetupMultipliers (int width, int height)
{
WidthOffsetMultipiler = width;
HeightOffsetMultipiler = height;
int widthpo2 = NextPo2(Width);
int heightpo2 = NextPo2(Height);
if(widthpo2 != Width) WidthOffsetMultipiler = (int)(WidthOffsetMultipiler * ((float)widthpo2 / Width));
if(heightpo2 != Height) HeightOffsetMultipiler = (int)(HeightOffsetMultipiler * ((float)heightpo2 / Height));
}
int FWarpTexture::NextPo2 (int v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
return ++v;
}
// [GRB] Eternity-like warping
FWarp2Texture::FWarp2Texture (FTexture *source)
: FWarpTexture (source)
{
SetupMultipliers(256, 128); // [mxd]
bWarped = 2;
}
@ -194,6 +225,8 @@ void FWarp2Texture::MakeTexture (DWORD time)
int xsize = Width;
int ysize = Height;
int xmul = WidthOffsetMultipiler; // [mxd]
int ymul = HeightOffsetMultipiler; // [mxd]
int xmask = WidthMask;
int ymask = Height - 1;
int ybits = HeightBits;
@ -205,18 +238,21 @@ void FWarp2Texture::MakeTexture (DWORD time)
}
DWORD timebase = DWORD(time * Speed * 40 / 28);
for (x = 0; x < xsize; ++x)
// [mxd] Rewrote to fix animation for NPo2 textures
for (x = 0; x < xsize; x++)
{
BYTE *dest = Pixels + (x << ybits);
for (y = 0; y < ysize; ++y)
BYTE *dest = Pixels + (x + ymask * x);
for (y = 0; y < ysize; y++)
{
int xt = (x + 128
+ ((finesine[(y*128 + timebase*5 + 900) & FINEMASK]*2)>>FRACBITS)
+ ((finesine[(x*256 + timebase*4 + 300) & FINEMASK]*2)>>FRACBITS)) & xmask;
+ ((finesine[(y*ymul + timebase*5 + 900) & FINEMASK]*2)>>FRACBITS)
+ ((finesine[(x*xmul + timebase*4 + 300) & FINEMASK]*2)>>FRACBITS)) % xsize;
int yt = (y + 128
+ ((finesine[(y*128 + timebase*3 + 700) & FINEMASK]*2)>>FRACBITS)
+ ((finesine[(x*256 + timebase*4 + 1200) & FINEMASK]*2)>>FRACBITS)) & ymask;
*dest++ = otherpix[(xt << ybits) + yt];
+ ((finesine[(y*ymul + timebase*3 + 700) & FINEMASK]*2)>>FRACBITS)
+ ((finesine[(x*xmul + timebase*4 + 1200) & FINEMASK]*2)>>FRACBITS)) % ysize;
*dest++ = otherpix[(xt + ymask * xt) + yt];
}
}
}

View file

@ -165,7 +165,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
stack.Call(state->ActionFunc, params, countof(params), wantret, numret);
// As long as even one state succeeds, the whole chain succeeds unless aborted below.
// A state that wants to jump does not count as "succeeded".
if (nextstate != NULL)
if (nextstate == NULL)
{
result |= retval;
}
@ -2008,13 +2008,15 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory)
{
PARAM_ACTION_PROLOGUE;
ACTION_RETURN_BOOL(DoGiveInventory(self, false, VM_ARGS_NAMES));
bool result = DoGiveInventory(self, false, VM_ARGS_NAMES);
ACTION_RETURN_BOOL(result);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
{
PARAM_ACTION_PROLOGUE;
ACTION_RETURN_BOOL(DoGiveInventory(self->target, false, VM_ARGS_NAMES));
bool result = DoGiveInventory(self->target, false, VM_ARGS_NAMES);
ACTION_RETURN_BOOL(result);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
@ -2094,13 +2096,15 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory)
{
PARAM_ACTION_PROLOGUE;
ACTION_RETURN_BOOL(DoTakeInventory(self, false, VM_ARGS_NAMES));
bool result = DoTakeInventory(self, false, VM_ARGS_NAMES);
ACTION_RETURN_BOOL(result);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
{
PARAM_ACTION_PROLOGUE;
ACTION_RETURN_BOOL(DoTakeInventory(self->target, false, VM_ARGS_NAMES));
bool result = DoTakeInventory(self->target, false, VM_ARGS_NAMES);
ACTION_RETURN_BOOL(result);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
@ -2401,7 +2405,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
AActor *mo = Spawn( missile, self->Vec3Angle(distance, self->angle, -self->floorclip + self->GetBobOffset() + zheight), ALLOW_REPLACE);
int flags = (transfer_translation ? SIXF_TRANSFERTRANSLATION : 0) + (useammo ? SIXF_SETMASTER : 0);
ACTION_RETURN_BOOL(InitSpawnedItem(self, mo, flags)); // for an inventory item's use state
bool result = InitSpawnedItem(self, mo, flags);
ACTION_RETURN_BOOL(result); // for an inventory item's use state
}
//===========================================================================
@ -3250,7 +3255,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf)
PARAM_BOOL (condition);
PARAM_STATE (jump);
ACTION_RETURN_STATE(condition ? jump : NULL);
if (!condition) jump = NULL;
ACTION_RETURN_STATE(jump);
}
//===========================================================================

View file

@ -361,6 +361,10 @@ endofstate:
void AddImplicitReturn(FxSequence *code, const PPrototype *proto, FScanner &sc)
{
if (code == NULL)
{
return;
}
if (proto == NULL || proto->ReturnTypes.Size() == 0)
{ // Returns nothing. Good. We can safely add an implied return.
code->Add(new FxReturnStatement(NULL, sc));
@ -368,7 +372,7 @@ void AddImplicitReturn(FxSequence *code, const PPrototype *proto, FScanner &sc)
else
{ // Something was returned earlier in the sequence. Make it an error
// instead of adding an implicit one.
sc.ScriptError("Action list must end with a return statement");
sc.ScriptError("Action list must return a value");
}
}
@ -483,8 +487,9 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg
proto = ReturnCheck(proto, true_proto, sc);
proto = ReturnCheck(proto, false_proto, sc);
// If one side does not end with a return, we don't consider the if statement
// to end with a return.
if (true_ret && (false_proto == NULL || false_ret))
// to end with a return. If the else case is missing, it can never be considered
// as ending with a return.
if (true_ret && false_ret)
{
lastwasret = true;
}

View file

@ -61,11 +61,11 @@ const char *GetVersionString();
// Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones.
// Otherwise, it should be safe to leave it alone.
#define DEMOGAMEVERSION 0x21D
#define DEMOGAMEVERSION 0x21E
// Minimum demo version we can play.
// Bump it whenever you change or remove existing DEM_ commands.
#define MINDEMOVERSION 0x21D
#define MINDEMOVERSION 0x21E
// SAVEVER is the version of the information stored in level snapshots.
// Note that SAVEVER is not directly comparable to VERSION.