Merge branch 'master' into scripting

Conflicts:
	src/g_heretic/a_hereticweaps.cpp
	src/thingdef/thingdef_codeptr.cpp
This commit is contained in:
Christoph Oelckers 2015-06-07 09:43:54 +02:00
commit 7ba577e1b0
33 changed files with 466 additions and 220 deletions

View file

@ -111,6 +111,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
CHECK_CXX_COMPILER_FLAG( -msse DUMB_CAN_USE_SSE )
if( DUMB_CAN_USE_SSE )
set_source_files_properties( src/it/filter.cpp PROPERTIES COMPILE_FLAGS -msse )
set_source_files_properties( src/helpers/resampler.c PROPERTIES COMPILE_FLAGS -msse )
endif( DUMB_CAN_USE_SSE )
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )

View file

@ -374,6 +374,7 @@ enum ActorFlag7
MF7_FLYCHEAT = 0x00020000, // must be part of the actor so that it can be tracked properly
MF7_NODECAL = 0x00040000, // [ZK] Forces puff to have no impact decal
MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's.
MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced.
};
// --- mobj.renderflags ---
@ -790,7 +791,7 @@ public:
}
// These also set CF_INTERPVIEW for players.
void SetPitch(int p, bool interpolate);
void SetPitch(int p, bool interpolate, bool forceclamp = false);
void SetAngle(angle_t ang, bool interpolate);
void SetRoll(angle_t roll, bool interpolate);

View file

@ -1935,8 +1935,6 @@ void AM_drawSubsectors()
scalex = sec->GetXScale(sector_t::floor);
scaley = sec->GetYScale(sector_t::floor);
#ifdef _3DFLOORS
if (sec->e->XFloor.ffloors.Size())
{
secplane_t *floorplane = &sec->floorplane;
@ -1997,7 +1995,6 @@ void AM_drawSubsectors()
floorlight = *light->p_lightlevel;
colormap = light->extra_colormap;
}
#endif
if (maptex == skyflatnum)
{
continue;
@ -2153,8 +2150,6 @@ void AM_showSS()
}
}
#ifdef _3DFLOORS
//=============================================================================
//
// Determines if a 3D floor boundary should be drawn
@ -2214,7 +2209,6 @@ bool AM_Check3DFloors(line_t *line)
// All 3D floors could be matched so let's not draw a boundary.
return false;
}
#endif
//=============================================================================
//
@ -2345,12 +2339,10 @@ void AM_drawWalls (bool allmap)
{
AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change
}
#ifdef _3DFLOORS
else if (AM_Check3DFloors(&lines[i]))
{
AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border
}
#endif
else if (am_cheat > 0 && am_cheat < 4)
{
AM_drawMline(&l, AMColors.TSWallColor);

View file

@ -1100,7 +1100,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
x = self->x + ((pr_storm()&127) - 64) * FRACUNIT;
y = self->y + ((pr_storm()&127) - 64) * FRACUNIT;
mo = Spawn<ARainPillar> (x, y, ONCEILINGZ, ALLOW_REPLACE);
#ifdef _3DFLOORS
// We used bouncecount to store the 3D floor index in A_HideInCeiling
if (!mo) return 0;
fixed_t newz;
@ -1112,7 +1111,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
int moceiling = P_Find3DFloor(NULL, x, y, newz, false, false, newz);
if (moceiling >= 0)
mo->z = newz - mo->height;
#endif
mo->Translation = multiplayer ?
TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0;
mo->target = self->target;
@ -1158,7 +1156,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
{
PARAM_ACTION_PROLOGUE;
#ifdef _3DFLOORS
// We use bouncecount to store the 3D floor index
fixed_t foo;
for (unsigned int i=0; i< self->Sector->e->XFloor.ffloors.Size(); i++)
@ -1174,7 +1171,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
}
}
self->bouncecount = -1;
#endif
self->z = self->ceilingz + 4*FRACUNIT;
return 0;
}

View file

@ -272,7 +272,6 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
Z -= back->GetPlaneTexZ(sector_t::ceiling);
tex = wall->GetTexture(side_t::top);
}
#ifdef _3DFLOORS
else if (ffloor) // this is a 3d-floor segment - do this only if we know which one!
{
Sector=ffloor->model;
@ -295,7 +294,6 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
tex = ffloor->master->sidedef[0]->GetTexture(side_t::mid);
}
}
#endif
else return FNullTextureID();
CalcFracPos (wall, x, y);

View file

@ -525,7 +525,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
}
else if(condition == INVULNERABILITY)
{
if(statusBar->CPlayer->cheats&CF_GODMODE)
if(statusBar->CPlayer->cheats&(CF_GODMODE|CF_GODMODE2))
{
drawAlt = 1;
}
@ -1730,7 +1730,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
static int artiflashTick;
static fixed_t itemflashFade;
};
int CommandDrawSelectedInventory::artiflashTick = 4;
int CommandDrawSelectedInventory::artiflashTick = 0;
int CommandDrawSelectedInventory::itemflashFade = FRACUNIT*3/4;
void DSBarInfo::FlashItem(const PClass *itemtype)

View file

@ -83,7 +83,7 @@ bool GetKnownFolder(int shell_folder, REFKNOWNFOLDERID known_folder, bool create
// new to Vista, hence the reason we support both.
if (SHGetKnownFolderPath == NULL)
{
static TOptWin32Proc<HRESULT(*)(HWND, int, HANDLE, DWORD, LPTSTR)>
static TOptWin32Proc<HRESULT(WINAPI*)(HWND, int, HANDLE, DWORD, LPTSTR)>
SHGetFolderPathA("shell32.dll", "SHGetFolderPathA");
// NT4 doesn't even have this function.
@ -146,6 +146,7 @@ FString M_GetCachePath(bool create)
// Don't use GAME_DIR and such so that ZDoom and its child ports can
// share the node cache.
path += "/zdoom/cache";
path.Substitute("//", "/"); // needed because progdir ends with a slash.
return path;
}

View file

@ -644,9 +644,13 @@ class DTextEnterMenu : public DMenu
int InputGridX;
int InputGridY;
// [TP]
bool AllowColors;
public:
DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid);
// [TP] Added allowcolors
DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid, bool allowcolors = false);
void Drawer ();
bool MenuEvent (int mkey, bool fromcontroller);

View file

@ -830,6 +830,63 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
FOptionMenuItem *it = new FOptionMenuScreenResolutionLine(sc.String);
desc->mItems.Push(it);
}
// [TP] -- Text input widget
else if ( sc.Compare( "TextField" ))
{
sc.MustGetString();
FString label = sc.String;
sc.MustGetStringName( "," );
sc.MustGetString();
FString cvar = sc.String;
FString check;
if ( sc.CheckString( "," ))
{
sc.MustGetString();
check = sc.String;
}
FOptionMenuItem* it = new FOptionMenuTextField( label, cvar, check );
desc->mItems.Push( it );
}
// [TP] -- Number input widget
else if ( sc.Compare( "NumberField" ))
{
sc.MustGetString();
FString label = sc.String;
sc.MustGetStringName( "," );
sc.MustGetString();
FString cvar = sc.String;
float minimum = 0.0f;
float maximum = 100.0f;
float step = 1.0f;
FString check;
if ( sc.CheckString( "," ))
{
sc.MustGetFloat();
minimum = (float) sc.Float;
sc.MustGetStringName( "," );
sc.MustGetFloat();
maximum = (float) sc.Float;
if ( sc.CheckString( "," ))
{
sc.MustGetFloat();
step = (float) sc.Float;
if ( sc.CheckString( "," ))
{
sc.MustGetString();
check = sc.String;
}
}
}
FOptionMenuItem* it = new FOptionMenuNumberField( label, cvar,
minimum, maximum, step, check );
desc->mItems.Push( it );
}
else
{
sc.ScriptError("Unknown keyword '%s'", sc.String);

View file

@ -40,6 +40,8 @@
#include "d_gui.h"
#include "v_font.h"
#include "v_palette.h"
// [TP] New #includes
#include "v_text.h"
IMPLEMENT_ABSTRACT_CLASS(DTextEnterMenu)
@ -64,7 +66,8 @@ CVAR(Bool, m_showinputgrid, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
//
//=============================================================================
DTextEnterMenu::DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid)
// [TP] Added allowcolors
DTextEnterMenu::DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int sizemode, bool showgrid, bool allowcolors)
: DMenu(parent)
{
mEnterString = textbuffer;
@ -83,6 +86,7 @@ DTextEnterMenu::DTextEnterMenu(DMenu *parent, char *textbuffer, int maxlen, int
InputGridX = 0;
InputGridY = 0;
}
AllowColors = allowcolors; // [TP]
}
//=============================================================================
@ -140,6 +144,10 @@ bool DTextEnterMenu::Responder(event_t *ev)
{
if (mEnterString[0])
{
// [TP] If we allow color codes, colorize the string now.
if (AllowColors)
strbin(mEnterString);
DMenu *parent = mParentMenu;
Close();
parent->MenuEvent(MKEY_Input, false);

View file

@ -31,6 +31,7 @@
**---------------------------------------------------------------------------
**
*/
#include "v_text.h"
void M_DrawConText (int color, int x, int y, const char *str);
@ -943,6 +944,207 @@ public:
}
};
//=============================================================================
//
// [TP] FOptionMenuFieldBase
//
// Base class for input fields
//
//=============================================================================
class FOptionMenuFieldBase : public FOptionMenuItem
{
public:
FOptionMenuFieldBase ( const char* label, const char* menu, const char* graycheck ) :
FOptionMenuItem ( label, menu ),
mCVar ( FindCVar( mAction, NULL )),
mGrayCheck (( graycheck && strlen( graycheck )) ? FindCVar( graycheck, NULL ) : NULL ) {}
const char* GetCVarString()
{
if ( mCVar == NULL )
return "";
return mCVar->GetGenericRep( CVAR_String ).String;
}
virtual FString Represent()
{
return GetCVarString();
}
int Draw ( FOptionMenuDescriptor*, int y, int indent, bool selected )
{
bool grayed = mGrayCheck != NULL && !( mGrayCheck->GetGenericRep( CVAR_Bool ).Bool );
drawLabel( indent, y, selected ? OptionSettings.mFontColorSelection : OptionSettings.mFontColor, grayed );
int overlay = grayed? MAKEARGB( 96, 48, 0, 0 ) : 0;
screen->DrawText( SmallFont, OptionSettings.mFontColorValue, indent + CURSORSPACE, y,
Represent().GetChars(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay, TAG_DONE );
return indent;
}
bool GetString ( int i, char* s, int len )
{
if ( i == 0 )
{
strncpy( s, GetCVarString(), len );
s[len - 1] = '\0';
return true;
}
return false;
}
bool SetString ( int i, const char* s )
{
if ( i == 0 )
{
if ( mCVar )
{
UCVarValue vval;
vval.String = s;
mCVar->SetGenericRep( vval, CVAR_String );
}
return true;
}
return false;
}
protected:
// Action is a CVar in this class and derivatives.
FBaseCVar* mCVar;
FBaseCVar* mGrayCheck;
};
//=============================================================================
//
// [TP] FOptionMenuTextField
//
// A text input field widget, for use with string CVars.
//
//=============================================================================
class FOptionMenuTextField : public FOptionMenuFieldBase
{
public:
FOptionMenuTextField ( const char *label, const char* menu, const char* graycheck ) :
FOptionMenuFieldBase ( label, menu, graycheck ),
mEntering ( false ) {}
FString Represent()
{
FString text = mEntering ? mEditName : GetCVarString();
if ( mEntering )
text += ( gameinfo.gametype & GAME_DoomStrifeChex ) ? '_' : '[';
return text;
}
bool MenuEvent ( int mkey, bool fromcontroller )
{
if ( mkey == MKEY_Enter )
{
S_Sound( CHAN_VOICE | CHAN_UI, "menu/choose", snd_menuvolume, ATTN_NONE );
strcpy( mEditName, GetCVarString() );
mEntering = true;
DMenu* input = new DTextEnterMenu ( DMenu::CurrentMenu, mEditName, sizeof mEditName, 2, fromcontroller );
M_ActivateMenu( input );
return true;
}
else if ( mkey == MKEY_Input )
{
if ( mCVar )
{
UCVarValue vval;
vval.String = mEditName;
mCVar->SetGenericRep( vval, CVAR_String );
}
mEntering = false;
return true;
}
else if ( mkey == MKEY_Abort )
{
mEntering = false;
return true;
}
return FOptionMenuItem::MenuEvent( mkey, fromcontroller );
}
private:
bool mEntering;
char mEditName[128];
};
//=============================================================================
//
// [TP] FOptionMenuNumberField
//
// A numeric input field widget, for use with number CVars where sliders are inappropriate (i.e.
// where the user is interested in the exact value specifically)
//
//=============================================================================
class FOptionMenuNumberField : public FOptionMenuFieldBase
{
public:
FOptionMenuNumberField ( const char *label, const char* menu, float minimum, float maximum,
float step, const char* graycheck )
: FOptionMenuFieldBase ( label, menu, graycheck ),
mMinimum ( minimum ),
mMaximum ( maximum ),
mStep ( step )
{
if ( mMaximum <= mMinimum )
swapvalues( mMinimum, mMaximum );
if ( mStep <= 0 )
mStep = 1;
}
bool MenuEvent ( int mkey, bool fromcontroller )
{
if ( mCVar )
{
float value = mCVar->GetGenericRep( CVAR_Float ).Float;
if ( mkey == MKEY_Left )
{
value -= mStep;
if ( value < mMinimum )
value = mMaximum;
}
else if ( mkey == MKEY_Right || mkey == MKEY_Enter )
{
value += mStep;
if ( value > mMaximum )
value = mMinimum;
}
else
return FOptionMenuItem::MenuEvent( mkey, fromcontroller );
UCVarValue vval;
vval.Float = value;
mCVar->SetGenericRep( vval, CVAR_Float );
S_Sound( CHAN_VOICE | CHAN_UI, "menu/change", snd_menuvolume, ATTN_NONE );
}
return true;
}
private:
float mMinimum;
float mMaximum;
float mStep;
};
#ifndef NO_IMP
CCMD(am_restorecolors)
{

View file

@ -41,10 +41,9 @@
#include "w_wad.h"
#include "sc_man.h"
#include "g_level.h"
#include "p_terrain.h"
#include "r_data/colormaps.h"
#ifdef _3DFLOORS
//==========================================================================
//
// 3D Floors
@ -342,7 +341,14 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
continue;
}
if (rover->model->special || rover->model->damage) P_PlayerInSpecialSector(player, rover->model);
// Apply sector specials
if (rover->model->special || rover->model->damage)
P_PlayerInSpecialSector(player, rover->model);
// Apply flat specials (using the ceiling!)
P_PlayerOnSpecialFlat(
player, TerrainTypes[rover->model->GetTexture(rover->flags & FF_INVERTSECTOR? sector_t::floor : sector_t::ceiling)]);
break;
}
}
@ -951,8 +957,6 @@ int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, b
return -1;
}
#endif
#include "c_dispatch.h"

View file

@ -4,8 +4,6 @@
#define CenterSpot(sec) (vertex_t*)&(sec)->soundorg[0]
#define _3DFLOORS
// 3D floor flags. Most are the same as in Legacy but I added some for EDGE's and Vavoom's features as well.
typedef enum
{
@ -60,8 +58,6 @@ enum
VC_COLORMASK = 0x00FFFFFF,
};
#ifdef _3DFLOORS
struct secplane_t;
struct FDynamicColormap;
@ -149,39 +145,5 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z);
int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz);
#else
// Dummy definitions for disabled 3D floor code
struct F3DFloor
{
int dummy;
};
struct lightlist_t
{
int dummy;
};
class player_s;
inline void P_PlayerOnSpecial3DFloor(player_t* player) {}
inline void P_Get3DFloorAndCeiling(AActor * thing, sector_t * sector, fixed_t * floorz, fixed_t * ceilingz, int * floorpic) {}
inline bool P_CheckFor3DFloorHit(AActor * mo) { return false; }
inline bool P_CheckFor3DCeilingHit(AActor * mo) { return false; }
inline void P_Recalculate3DFloors(sector_t *) {}
inline void P_RecalculateAttached3DFloors(sector_t * sec) {}
inline lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside) { return NULL; }
inline void P_Spawn3DFloors( void ) {}
struct FLineOpening;
inline void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict) {}
//secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z){return sector->floorplane;}
#endif
#endif

View file

@ -1959,13 +1959,12 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
chunk = (DWORD *)FindChunk (MAKE_ID('M','S','T','R'));
if (chunk != NULL)
{
for (DWORD i = 0; i < chunk[1]/4; ++i)
for (DWORD i = 0; i < LittleLong(chunk[1])/4; ++i)
{
// MapVarStore[chunk[i+2]] |= LibraryID;
const char *str = LookupString(MapVarStore[chunk[i+2]]);
const char *str = LookupString(MapVarStore[LittleLong(chunk[i+2])]);
if (str != NULL)
{
MapVarStore[chunk[i+2]] = GlobalACSStrings.AddString(str, NULL, 0);
MapVarStore[LittleLong(chunk[i+2])] = GlobalACSStrings.AddString(str, NULL, 0);
}
}
}
@ -1973,7 +1972,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
chunk = (DWORD *)FindChunk (MAKE_ID('A','S','T','R'));
if (chunk != NULL)
{
for (DWORD i = 0; i < chunk[1]/4; ++i)
for (DWORD i = 0; i < LittleLong(chunk[1])/4; ++i)
{
int arraynum = MapVarStore[LittleLong(chunk[i+2])];
if ((unsigned)arraynum < (unsigned)NumArrays)
@ -2000,13 +1999,13 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
// First byte is version, it should be 0
if(*chunkData++ == 0)
{
int arraynum = MapVarStore[uallong(*(const int*)(chunkData))];
int arraynum = MapVarStore[uallong(LittleLong(*(const int*)(chunkData)))];
chunkData += 4;
if ((unsigned)arraynum < (unsigned)NumArrays)
{
SDWORD *elems = ArrayStore[arraynum].Elements;
// Ending zeros may be left out.
for (int j = MIN(chunk[1]-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData)
for (int j = MIN(LittleLong(chunk[1])-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData)
{
// For ATAG, a value of 0 = Integer, 1 = String, 2 = FunctionPtr
// Our implementation uses the same tags for both String and FunctionPtr
@ -2073,7 +2072,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
ScriptFunction *func = &((ScriptFunction *)Functions)[j];
if (func->Address == 0 && func->ImportNum == 0)
{
int libfunc = lib->FindFunctionName ((char *)(chunk + 2) + chunk[3+j]);
int libfunc = lib->FindFunctionName ((char *)(chunk + 2) + LittleLong(chunk[3+j]));
if (libfunc >= 0)
{
ScriptFunction *realfunc = &((ScriptFunction *)lib->Functions)[libfunc];
@ -2086,14 +2085,14 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
if (realfunc->ArgCount != func->ArgCount)
{
Printf (TEXTCOLOR_ORANGE "Function %s in %s has %d arguments. %s expects it to have %d.\n",
(char *)(chunk + 2) + chunk[3+j], lib->ModuleName, realfunc->ArgCount,
(char *)(chunk + 2) + LittleLong(chunk[3+j]), lib->ModuleName, realfunc->ArgCount,
ModuleName, func->ArgCount);
Format = ACS_Unknown;
}
// The next two properties do not affect code compatibility, so it is
// okay for them to be different in the imported module than they are
// in this one, as long as we make sure to use the real values.
func->LocalCount = realfunc->LocalCount;
func->LocalCount = LittleLong(realfunc->LocalCount);
func->HasReturnValue = realfunc->HasReturnValue;
}
}
@ -2105,7 +2104,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
if (chunk != NULL)
{
char *parse = (char *)&chunk[2];
for (DWORD j = 0; j < chunk[1]; )
for (DWORD j = 0; j < LittleLong(chunk[1]); )
{
DWORD varNum = LittleLong(*(DWORD *)&parse[j]);
j += 4;

View file

@ -2560,7 +2560,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (abs(corpsehit->x - viletryx) > maxdist ||
abs(corpsehit->y - viletryy) > maxdist)
continue; // not actually touching
#ifdef _3DFLOORS
// Let's check if there are floors in between the archvile and its target
sector_t *vilesec = self->Sector;
sector_t *corpsec = corpsehit->Sector;
@ -2578,7 +2577,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
continue;
}
}
#endif
corpsehit->velx = corpsehit->vely = 0;
// [RH] Check against real height and radius

View file

@ -941,6 +941,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
bool forcedPain = false;
int fakeDamage = 0;
int holdDamage = 0;
int rawdamage = damage;
if (damage < 0) damage = 0;
@ -975,7 +976,11 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
return -1;
}
if ((target->flags2 & MF2_INVULNERABLE) && (damage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED)))
// [MC] Changed it to check rawdamage here for consistency, even though that doesn't actually do anything
// different here. At any rate, invulnerable is being checked before type factoring, which is then being
// checked by player cheats/invul/buddha followed by monster buddha. This is inconsistent. Don't let the
// original telefrag damage CHECK (rawdamage) be influenced by outside factors when looking at cheats/invul.
if ((target->flags2 & MF2_INVULNERABLE) && (rawdamage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED)))
{ // actor is invulnerable
if (target->player == NULL)
{
@ -1035,7 +1040,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
return -1;
}
if (damage < TELEFRAG_DAMAGE) // TELEFRAG_DAMAGE may not be reduced at all or it may not guarantee its effect.
if ((rawdamage < TELEFRAG_DAMAGE) || (target->flags7 & MF7_LAXTELEFRAGDMG)) // TELEFRAG_DAMAGE may only be reduced with NOTELEFRAGPIERCE or it may not guarantee its effect.
{
if (player && damage > 1)
{
@ -1213,7 +1218,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
{
if (player)
FriendlyFire = true;
if (damage < TELEFRAG_DAMAGE)
if (rawdamage < TELEFRAG_DAMAGE) //Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it.
{ // Still allow telefragging :-(
damage = (int)((float)damage * level.teamdamage);
if (damage < 0)
@ -1256,7 +1261,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (!(flags & DMG_FORCED))
{
// check the real player, not a voodoo doll here for invulnerability effects
if ((damage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) ||
if ((rawdamage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) ||
(player->cheats & CF_GODMODE))) ||
(player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE))
//Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2.
@ -1281,7 +1286,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
{
player->mo->Inventory->AbsorbDamage(damage, mod, newdam);
}
if (damage < TELEFRAG_DAMAGE)
if ((rawdamage < TELEFRAG_DAMAGE) || (player->mo->flags7 & MF7_LAXTELEFRAGDMG)) //rawdamage is never modified.
{
// if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise.
damage = newdam;
@ -1300,7 +1305,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
}
if (damage >= player->health && damage < TELEFRAG_DAMAGE
if (damage >= player->health && rawdamage < TELEFRAG_DAMAGE
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
&& !player->morphTics)
{ // Try to use some inventory health
@ -1324,7 +1329,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// but telefragging should still do enough damage to kill the player)
// Ignore players that are already dead.
// [MC]Buddha2 absorbs telefrag damage, and anything else thrown their way.
if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (damage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD)))
if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (rawdamage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD)))
{
// If this is a voodoo doll we need to handle the real player as well.
player->mo->health = target->health = player->health = 1;
@ -1389,7 +1394,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (target->health <= 0)
{
//[MC]Buddha flag for monsters.
if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (damage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))))
if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (rawdamage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))))
{ //FOILBUDDHA or Telefrag damage must kill it.
target->health = 1;
}

View file

@ -249,7 +249,6 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags)
sec = tmf.thing->Sector;
}
#ifdef _3DFLOORS
for (unsigned int i = 0; i<sec->e->XFloor.ffloors.Size(); i++)
{
F3DFloor* rover = sec->e->XFloor.ffloors[i];
@ -273,7 +272,6 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags)
tmf.ceilingpic = *rover->bottom.texture;
}
}
#endif
}
//==========================================================================
@ -574,6 +572,25 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
{
friction = secfriction(mo->Sector);
movefactor = secmovefac(mo->Sector) >> 1;
// Check 3D floors -- might be the source of the waterlevel
for (unsigned i = 0; i < mo->Sector->e->XFloor.ffloors.Size(); i++)
{
F3DFloor *rover = mo->Sector->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_SWIMMABLE)) continue;
if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) ||
mo->z < rover->bottom.plane->ZatPoint(mo->x, mo->y))
continue;
newfriction = secfriction(rover->model);
if (newfriction < friction || friction == ORIG_FRICTION)
{
friction = newfriction;
movefactor = secmovefac(rover->model) >> 1;
}
}
}
else if (var_friction && !(mo->flags & (MF_NOCLIP | MF_NOGRAVITY)))
{ // When the object is straddling sectors with the same
@ -584,16 +601,27 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
{
sec = m->m_sector;
#ifdef _3DFLOORS
// 3D floors must be checked, too
for (unsigned i = 0; i < sec->e->XFloor.ffloors.Size(); i++)
{
F3DFloor *rover = sec->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_SOLID)) continue;
// Player must be on top of the floor to be affected...
if (rover->flags & FF_SOLID)
{
// Must be standing on a solid floor
if (mo->z != rover->top.plane->ZatPoint(mo->x, mo->y)) continue;
}
else if (rover->flags & FF_SWIMMABLE)
{
// Or on or inside a swimmable floor (e.g. in shallow water)
if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) ||
(mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo->x, mo->y))
continue;
}
else
continue;
newfriction = secfriction(rover->model);
if (newfriction < friction || friction == ORIG_FRICTION)
{
@ -601,7 +629,6 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
movefactor = secmovefac(rover->model);
}
}
#endif
if (!(sec->special & FRICTION_MASK) &&
Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction == 0)
@ -756,14 +783,9 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
!(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP)))
{
secplane_t frontplane, backplane;
#ifdef _3DFLOORS
// Check 3D floors as well
frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
#else
frontplane = ld->frontsector->floorplane;
backplane = ld->backsector->floorplane;
#endif
if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE)
{
const msecnode_t *node = tm.thing->touching_sectorlist;
@ -1424,7 +1446,6 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
//Added by MC: Fill the tmsector.
tm.sector = newsec;
#ifdef _3DFLOORS
//Check 3D floors
if (!thing->IsNoClip2() && newsec->e->XFloor.ffloors.Size())
{
@ -1456,7 +1477,6 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
}
}
}
#endif
validcount++;
spechit.Clear();
@ -1773,7 +1793,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo
fzb <= mobj->z && bzb <= mobj->z)
{
// we must also check if some 3D floor in the backsector may be blocking
#ifdef _3DFLOORS
for (unsigned int i = 0; i<line->backsector->e->XFloor.ffloors.Size(); i++)
{
F3DFloor* rover = line->backsector->e->XFloor.ffloors[i];
@ -1788,7 +1807,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo
goto isblocking;
}
}
#endif
return;
}
}
@ -2713,7 +2731,6 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
const secplane_t *plane = &actor->floorsector->floorplane;
fixed_t planezhere = plane->ZatPoint(actor->x, actor->y);
#ifdef _3DFLOORS
for (unsigned int i = 0; i<actor->floorsector->e->XFloor.ffloors.Size(); i++)
{
F3DFloor * rover = actor->floorsector->e->XFloor.ffloors[i];
@ -2748,7 +2765,6 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
}
}
}
#endif
if (actor->floorsector != actor->Sector)
{
@ -3126,7 +3142,6 @@ struct aim_t
AActor * thing_friend, *thing_other;
angle_t pitch_friend, pitch_other;
int flags;
#ifdef _3DFLOORS
sector_t * lastsector;
secplane_t * lastfloorplane;
secplane_t * lastceilingplane;
@ -3134,13 +3149,11 @@ struct aim_t
bool crossedffloors;
bool AimTraverse3DFloors(const divline_t &trace, intercept_t * in);
#endif
void AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, AActor *target = NULL);
};
#ifdef _3DFLOORS
//============================================================================
//
// AimTraverse3DFloors
@ -3242,7 +3255,6 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in)
lastfloorplane = nextbottomplane;
return true;
}
#endif
//============================================================================
//
@ -3295,9 +3307,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
if (toppitch >= bottompitch)
return; // stop
#ifdef _3DFLOORS
if (!AimTraverse3DFloors(it.Trace(), in)) return;
#endif
continue; // shot continues
}
@ -3336,7 +3346,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
continue;
}
#ifdef _3DFLOORS
// we must do one last check whether the trace has crossed a 3D floor
if (lastsector == th->Sector && th->Sector->e->XFloor.ffloors.Size())
{
@ -3361,7 +3370,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
}
}
}
#endif
// check angles to see if the thing can be aimed at
@ -3375,7 +3383,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
if (thingbottompitch < toppitch)
continue; // shot under the thing
#ifdef _3DFLOORS
if (crossedffloors)
{
// if 3D floors were in the way do an extra visibility check for safety
@ -3394,7 +3401,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en
else return;
}
}
#endif
// this thing can be hit!
if (thingtoppitch < toppitch)
@ -3531,7 +3537,6 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL
// Information for tracking crossed 3D floors
aim.aimpitch = t1->pitch;
#ifdef _3DFLOORS
aim.crossedffloors = t1->Sector->e->XFloor.ffloors.Size() != 0;
aim.lastsector = t1->Sector;
aim.lastfloorplane = aim.lastceilingplane = NULL;
@ -3547,7 +3552,6 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL
bottomz = rover->top.plane->ZatPoint(t1->x, t1->y);
if (bottomz <= t1->z) aim.lastfloorplane = rover->top.plane;
}
#endif
aim.AimTraverse(t1->x, t1->y, x2, y2, target);
@ -5425,7 +5429,6 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
cpos.movemidtex = false;
cpos.sector = sector;
#ifdef _3DFLOORS
// Also process all sectors that have 3D floors transferred from the
// changed sector.
if (sector->e->XFloor.attached.Size())
@ -5473,8 +5476,6 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
}
}
P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists
#endif
// [RH] Use different functions for the four different types of sector
// movement.

View file

@ -1411,7 +1411,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
z = mo->z;
F3DFloor * ffloor=NULL;
#ifdef _3DFLOORS
if (line->sidedef[side^1] != NULL)
{
sector_t * backsector = line->sidedef[side^1]->sector;
@ -1431,7 +1430,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
}
}
}
#endif
DImpactDecal::StaticCreate (base->GetDecal (),
x, y, z, line->sidedef[side], ffloor);
@ -2259,7 +2257,6 @@ explode:
{
if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded
{
#ifdef _3DFLOORS
unsigned i;
for(i=0;i<mo->Sector->e->XFloor.ffloors.Size();i++)
{
@ -2270,7 +2267,6 @@ explode:
if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo->x,mo->y)==mo->floorz) break;
}
if (i==mo->Sector->e->XFloor.ffloors.Size())
#endif
return oldfloorz;
}
}
@ -3223,8 +3219,24 @@ void AActor::SetShade (int r, int g, int b)
fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
}
void AActor::SetPitch(int p, bool interpolate)
void AActor::SetPitch(int p, bool interpolate, bool forceclamp)
{
if (player != NULL || forceclamp)
{ // clamp the pitch we set
int min, max;
if (player != NULL)
{
min = player->MinPitch;
max = player->MaxPitch;
}
else
{
min = -ANGLE_90 + (1 << ANGLETOFINESHIFT);
max = ANGLE_90 - (1 << ANGLETOFINESHIFT);
}
p = clamp<int>(p, min, max);
}
if (p != pitch)
{
pitch = p;
@ -3659,12 +3671,8 @@ void AActor::Tick ()
{
secplane_t floorplane;
#ifdef _3DFLOORS
// Check 3D floors as well
floorplane = P_FindFloorPlane(floorsector, x, y, floorz);
#else
floorplane = floorsector->floorplane;
#endif
if (floorplane.c < STEEPSLOPE &&
floorplane.ZatPoint (x, y) <= floorz)
@ -3982,7 +3990,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
reset = true;
}
}
#ifdef _3DFLOORS
else
{
// Check 3D floors as well!
@ -4016,7 +4023,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
break;
}
}
#endif
}
// some additional checks to make deep sectors like Boom's splash without setting
@ -5465,7 +5471,6 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
}
#endif
#ifdef _3DFLOORS
for(unsigned int i=0;i<sec->e->XFloor.ffloors.Size();i++)
{
F3DFloor * rover = sec->e->XFloor.ffloors[i];
@ -5482,7 +5487,6 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
planez = rover->bottom.plane->ZatPoint(x, y);
if (planez < z && !(planez < thing->floorz)) return false;
}
#endif
hsec = sec->GetHeightSec();
if (hsec == NULL || !(hsec->MoreFlags & SECF_CLIPFAKEPLANES))
{
@ -5492,9 +5496,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
{
terrainnum = TerrainTypes[hsec->GetTexture(sector_t::floor)];
}
#ifdef _3DFLOORS
foundone:
#endif
int splashnum = Terrains[terrainnum].Splash;
bool smallsplash = false;
@ -5597,7 +5599,6 @@ bool P_HitFloor (AActor *thing)
break;
}
#ifdef _3DFLOORS
// Check 3D floors
for(unsigned int i=0;i<m->m_sector->e->XFloor.ffloors.Size();i++)
{
@ -5611,7 +5612,6 @@ bool P_HitFloor (AActor *thing)
}
}
}
#endif
}
if (m == NULL || m->m_sector->GetHeightSec() != NULL)
{

View file

@ -2516,7 +2516,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps
}
break;
#ifdef _3DFLOORS
case Sector_Set3DFloor:
if (msd->toptexture[0]=='#')
{
@ -2531,7 +2530,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
SetTexture(sd, side_t::bottom, msd->bottomtexture, missingtex);
break;
#endif
case TranslucentLine: // killough 4/11/98: apply translucency to 2s normal texture
if (checktranmap)

View file

@ -127,7 +127,6 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
if (topslope <= bottomslope)
return false; // stop
#ifdef _3DFLOORS
// now handle 3D-floors
if(li->frontsector->e->XFloor.ffloors.Size() || li->backsector->e->XFloor.ffloors.Size())
{
@ -219,7 +218,6 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
lastztop= FixedMul (topslope, in->frac) + sightzstart;
lastzbottom= FixedMul (bottomslope, in->frac) + sightzstart;
#endif
return true; // keep going
}
@ -401,7 +399,6 @@ bool SightCheck::P_SightTraverseIntercepts ()
}
}
#ifdef _3DFLOORS
if (lastsector==seeingthing->Sector && lastsector->e->XFloor.ffloors.Size())
{
// we must do one last check whether the trace has crossed a 3D floor in the last sector
@ -424,7 +421,6 @@ bool SightCheck::P_SightTraverseIntercepts ()
}
}
#endif
return true; // everything was traversed
}
@ -453,7 +449,6 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_
validcount++;
intercepts.Clear ();
#ifdef _3DFLOORS
// for FF_SEETHROUGH the following rule applies:
// If the viewer is in an area without FF_SEETHROUGH he can only see into areas without this flag
// If the viewer is in an area with FF_SEETHROUGH he can only see into areas with this flag
@ -472,7 +467,6 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_
break;
}
}
#endif
if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0)
x1 += FRACUNIT; // don't side exactly on a line

View file

@ -718,12 +718,6 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu
void P_PlayerOnSpecialFlat (player_t *player, int floorType)
{
if (player->mo->z > player->mo->Sector->floorplane.ZatPoint (
player->mo->x, player->mo->y) &&
!player->mo->waterlevel)
{ // Player is not touching the floor
return;
}
if (Terrains[floorType].DamageAmount &&
!(level.time & Terrains[floorType].DamageTimeMask))
{
@ -738,12 +732,13 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType)
}
}
int damage = 0;
if (ironfeet == NULL)
{
P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount,
damage = P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount,
Terrains[floorType].DamageMOD);
}
if (Terrains[floorType].Splash != -1)
if (damage > 0 && Terrains[floorType].Splash != -1)
{
S_Sound (player->mo, CHAN_AUTO,
Splashes[Terrains[floorType].Splash].NormalSplashSound, 1,
@ -1741,7 +1736,7 @@ static void P_SpawnScrollers(void)
if (lines[i].special == Sector_CopyScroller)
{
// don't allow copying the scroller if the sector has the same tag as it would just duplicate it.
if (tagManager.SectorHasTag(lines[i].frontsector, lines[i].args[0]))
if (!tagManager.SectorHasTag(lines[i].frontsector, lines[i].args[0]))
{
copyscrollers.Push(i);
}

View file

@ -49,6 +49,7 @@ public:
startForSector.Clear();
startForLine.Clear();
memset(TagHashFirst, -1, sizeof(TagHashFirst));
memset(IDHashFirst, -1, sizeof(IDHashFirst));
}
bool SectorHasTags(const sector_t *sector) const;

View file

@ -104,7 +104,6 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
res.Crossed3DWater = NULL;
*/
#ifdef _3DFLOORS
// Do a 3D floor check in the starting sector
TDeletingArray<F3DFloor*> &ff = sector->e->XFloor.ffloors;
@ -174,7 +173,6 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
}
}
}
#endif
// check for overflows and clip if necessary
SQWORD xd = (SQWORD)x + ( ( SQWORD(vx) * SQWORD(maxDist) )>>16);
@ -257,7 +255,6 @@ bool FTraceInfo::TraceTraverse (int ptflags)
fixed_t dist;
// Deal with splashes in 3D floors
#ifdef _3DFLOORS
if (CurSector->e->XFloor.ffloors.Size())
{
for(unsigned int i=0;i<CurSector->e->XFloor.ffloors.Size();i++)
@ -274,7 +271,6 @@ bool FTraceInfo::TraceTraverse (int ptflags)
}
}
}
#endif
if (in->isaline)
{
@ -381,7 +377,6 @@ bool FTraceInfo::TraceTraverse (int ptflags)
}
else
{ // made it past the wall
#ifdef _3DFLOORS
// check for 3D floors first
if (entersector->e->XFloor.ffloors.Size())
{
@ -435,9 +430,6 @@ bool FTraceInfo::TraceTraverse (int ptflags)
}
}
}
#endif
Results->HitType = TRACE_HitNone;
if (TraceFlags & TRACE_PCross)
@ -450,9 +442,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_Impact);
}
}
#ifdef _3DFLOORS
cont:
#endif
if (Results->HitType != TRACE_HitNone)
{

View file

@ -2622,7 +2622,13 @@ void P_PlayerThink (player_t *player)
{
P_PlayerInSpecialSector (player);
}
P_PlayerOnSpecialFlat (player, P_GetThingFloorType (player->mo));
if (player->mo->z <= player->mo->Sector->floorplane.ZatPoint(
player->mo->x, player->mo->y) ||
player->mo->waterlevel)
{
// Player must be touching the floor
P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo));
}
if (player->mo->velz <= -player->mo->FallingScreamMinSpeed &&
player->mo->velz >= -player->mo->FallingScreamMaxSpeed && !player->morphTics &&
player->mo->waterlevel == 0)

View file

@ -28,7 +28,7 @@ class SDLFB : public DFrameBuffer
{
DECLARE_CLASS(SDLFB, DFrameBuffer)
public:
SDLFB (int width, int height, bool fullscreen);
SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin);
~SDLFB ();
bool Lock (bool buffer);
@ -67,7 +67,6 @@ private:
SDL_Texture *Texture;
SDL_Surface *Surface;
};
SDL_Rect UpdateRect;
bool UsingRenderer;
bool NeedPalUpdate;
@ -261,6 +260,8 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
PalEntry flashColor;
int flashAmount;
SDL_Window *oldwin = NULL;
if (old != NULL)
{ // Reuse the old framebuffer if its attributes are the same
SDLFB *fb = static_cast<SDLFB *> (old);
@ -275,6 +276,10 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
}
return old;
}
oldwin = fb->Screen;
fb->Screen = NULL;
old->GetFlash (flashColor, flashAmount);
old->ObjectFlags |= OF_YesReallyDelete;
if (screen == old) screen = NULL;
@ -286,7 +291,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
flashAmount = 0;
}
SDLFB *fb = new SDLFB (width, height, fullscreen);
SDLFB *fb = new SDLFB (width, height, fullscreen, oldwin);
// If we could not create the framebuffer, try again with slightly
// different parameters in this order:
@ -340,7 +345,7 @@ void SDLVideo::SetWindowedScale (float scale)
// FrameBuffer implementation -----------------------------------------------
SDLFB::SDLFB (int width, int height, bool fullscreen)
SDLFB::SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin)
: DFrameBuffer (width, height)
{
int i;
@ -351,15 +356,27 @@ SDLFB::SDLFB (int width, int height, bool fullscreen)
NotPaletted = false;
FlashAmount = 0;
if (oldwin)
{
// In some cases (Mac OS X fullscreen) SDL2 doesn't like having multiple windows which
// appears to inevitably happen while compositor animations are running. So lets try
// to reuse the existing window.
Screen = oldwin;
SDL_SetWindowSize (Screen, width, height);
SetFullscreen (fullscreen);
}
else
{
FString caption;
caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
Screen = SDL_CreateWindow (caption,
SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter),
width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)|SDL_WINDOW_RESIZABLE);
if (Screen == NULL)
return;
}
Renderer = NULL;
Texture = NULL;
@ -381,8 +398,6 @@ SDLFB::SDLFB (int width, int height, bool fullscreen)
SDLFB::~SDLFB ()
{
if(Screen)
{
if (Renderer)
{
if (Texture)
@ -390,6 +405,8 @@ SDLFB::~SDLFB ()
SDL_DestroyRenderer (Renderer);
}
if(Screen)
{
SDL_DestroyWindow (Screen);
}
}
@ -498,7 +515,8 @@ void SDLFB::Update ()
SDL_UnlockTexture (Texture);
SDLFlipCycles.Clock();
SDL_RenderCopy(Renderer, Texture, NULL, &UpdateRect);
SDL_RenderClear(Renderer);
SDL_RenderCopy(Renderer, Texture, NULL, NULL);
SDL_RenderPresent(Renderer);
SDLFlipCycles.Unclock();
}
@ -613,6 +631,9 @@ void SDLFB::GetFlashedPalette (PalEntry pal[256])
void SDLFB::SetFullscreen (bool fullscreen)
{
if (IsFullscreen() == fullscreen)
return;
SDL_SetWindowFullscreen (Screen, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
if (!fullscreen)
{
@ -645,6 +666,8 @@ void SDLFB::ResetSDLRenderer ()
if (!Renderer)
return;
SDL_SetRenderDrawColor(Renderer, 0, 0, 0, 255);
Uint32 fmt;
switch(vid_displaybits)
{
@ -681,24 +704,14 @@ void SDLFB::ResetSDLRenderer ()
NotPaletted = false;
}
// Calculate update rectangle
// In fullscreen, set logical size according to animorphic ratio.
// Windowed modes are rendered to fill the window (usually 1:1)
if (IsFullscreen ())
{
int w, h;
SDL_GetWindowSize (Screen, &w, &h);
UpdateRect.w = w;
UpdateRect.h = h;
ScaleWithAspect (UpdateRect.w, UpdateRect.h, Width, Height);
UpdateRect.x = (w - UpdateRect.w)/2;
UpdateRect.y = (h - UpdateRect.h)/2;
}
else
{
// In windowed mode we just update the whole window.
UpdateRect.x = 0;
UpdateRect.y = 0;
UpdateRect.w = Width;
UpdateRect.h = Height;
ScaleWithAspect (w, h, Width, Height);
SDL_RenderSetLogicalSize (Renderer, w, h);
}
}
@ -726,13 +739,14 @@ void SDLFB::SetVSync (bool vsync)
void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
{
int w, h;
SDL_GetWindowSize (Screen, &w, &h);
// Detect if we're doing scaling in the Window and adjust the mouse
// coordinates accordingly. This could be more efficent, but I
// don't think performance is an issue in the menus.
if(IsFullscreen())
{
int w, h;
SDL_GetWindowSize (Screen, &w, &h);
int realw = w, realh = h;
ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT);
if (realw != SCREENWIDTH || realh != SCREENHEIGHT)
@ -751,6 +765,11 @@ void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
}
}
}
else
{
x = (SWORD)(x*Width/w);
y = (SWORD)(y*Height/h);
}
}
ADD_STAT (blit)

View file

@ -557,8 +557,25 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1;
// find positioning
xscale = FixedMul(rw_pic->xScale, sidedef->GetTextureXScale(side_t::mid));
yscale = FixedMul(rw_pic->yScale, sidedef->GetTextureYScale(side_t::mid));
side_t *scaledside;
side_t::ETexpart scaledpart;
if (rover->flags & FF_UPPERTEXTURE)
{
scaledside = curline->sidedef;
scaledpart = side_t::top;
}
else if (rover->flags & FF_LOWERTEXTURE)
{
scaledside = curline->sidedef;
scaledpart = side_t::bottom;
}
else
{
scaledside = rover->master->sidedef[0];
scaledpart = side_t::mid;
}
xscale = FixedMul(rw_pic->xScale, scaledside->GetTextureXScale(scaledpart));
yscale = FixedMul(rw_pic->yScale, scaledside->GetTextureYScale(scaledpart));
// encapsulate the lifetime of rowoffset
fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid);
dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling);

View file

@ -267,6 +267,11 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
BYTE *Pixels = const_cast<BYTE*>(tex->GetPixels());
DSimpleCanvas *Canvas = tex->GetCanvas();
// curse Doom's overuse of global variables in the renderer.
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
unsigned char *savecolormap = fixedcolormap;
FSpecialColormap *savecm = realfixedcolormap;
float savedfov = LastFOV;
R_SetFOV ((float)fov);
R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
@ -280,6 +285,8 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
FTexture::FlipNonSquareBlockRemap (Pixels, Canvas->GetBuffer(), tex->GetWidth(), tex->GetHeight(), Canvas->GetPitch(), GPalette.Remap);
}
tex->SetUpdated();
fixedcolormap = savecolormap;
realfixedcolormap = savecm;
}
//==========================================================================

View file

@ -62,9 +62,6 @@
extern bool DrawFSHUD; // [RH] Defined in d_main.cpp
EXTERN_CVAR (Bool, cl_capfps)
extern lighttable_t* fixedcolormap;
extern FSpecialColormap*realfixedcolormap;
// TYPES -------------------------------------------------------------------
struct InterpolationViewer
@ -1101,11 +1098,6 @@ void FCanvasTextureInfo::UpdateAll ()
{
FCanvasTextureInfo *probe;
// curse Doom's overuse of global variables in the renderer.
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
unsigned char *savecolormap = fixedcolormap;
FSpecialColormap *savecm = realfixedcolormap;
for (probe = List; probe != NULL; probe = probe->Next)
{
if (probe->Viewpoint != NULL && probe->Texture->bNeedsUpdate)
@ -1113,9 +1105,6 @@ void FCanvasTextureInfo::UpdateAll ()
Renderer->RenderTextureView(probe->Texture, probe->Viewpoint, probe->FOV);
}
}
fixedcolormap = savecolormap;
realfixedcolormap = savecm;
}
//==========================================================================

View file

@ -4334,7 +4334,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
pitch = clamp<int>(pitch, min, max);
}
ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE));
ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP));
return 0;
}

View file

@ -257,6 +257,8 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF7, NODECAL, AActor, flags7),
DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7),
DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
DEFINE_FLAG2(FX_ROCKET, ROCKETTRAIL, AActor, effects),

View file

@ -804,7 +804,7 @@ void write_zip(const char *zipname, dir_tree_t *trees, int update)
if (i == num_files)
{
// Write central directory.
dirend.DirectoryOffset = ftell(zip);
dirend.DirectoryOffset = LittleLong(ftell(zip));
for (i = 0; i < num_files; ++i)
{
write_central_dir(zip, sorted + i);
@ -814,8 +814,8 @@ void write_zip(const char *zipname, dir_tree_t *trees, int update)
dirend.DiskNumber = 0;
dirend.FirstDisk = 0;
dirend.NumEntriesOnAllDisks = dirend.NumEntries = LittleShort(i);
dirend.DirectorySize = LittleLong(ftell(zip) - dirend.DirectoryOffset);
dirend.DirectoryOffset = LittleLong(dirend.DirectoryOffset);
// In this case LittleLong(dirend.DirectoryOffset) is undoing the transformation done above.
dirend.DirectorySize = LittleLong(ftell(zip) - LittleLong(dirend.DirectoryOffset));
dirend.ZipCommentLength = 0;
if (fwrite(&dirend, sizeof(dirend), 1, zip) != 1)
{
@ -1405,7 +1405,7 @@ BYTE *find_central_dir(FILE *fin)
if (pos_found == 0 ||
fseek(fin, pos_found, SEEK_SET) != 0 ||
fread(&eod, sizeof(eod), 1, fin) != 1 ||
fseek(fin, LittleShort(eod.DirectoryOffset), SEEK_SET) != 0)
fseek(fin, LittleLong(eod.DirectoryOffset), SEEK_SET) != 0)
{
return NULL;
}

View file

@ -536,7 +536,7 @@ map LEVEL09 lookup "NHUSTR_9"
cluster 11
{
flat = "RROCK19"
flat = "SLIME16"
music = "$MUSIC_READ_M"
exittext = lookup, "NERVETEXT"
}

View file

@ -51,7 +51,7 @@ statusbar fullscreen, fullscreenoffsets
statusbar Normal
{
drawimage "H2BAR", 0, 135;
drawimage "H2BAR", 0, 134;
drawimage "STATBAR", 38, 162;
drawselectedinventory artiflash, INDEXFONT_RAVEN, 143, 163, 174, 184, untranslated;
@ -204,7 +204,7 @@ statusbar Normal
statusbar Automap
{
drawimage "H2BAR", 0, 135;
drawimage "H2BAR", 0, 134;
drawimage "KEYBAR", 38, 162;
drawkeybar 5, horizontal, 20, 46, 164;
drawimage hexenarmor(armor, "ARMSLOT1"), 150, 164;