This commit is contained in:
Christoph Oelckers 2015-12-14 09:06:42 +01:00
commit 68a72d64a4
9 changed files with 163 additions and 12 deletions

View file

@ -496,6 +496,11 @@ if( NOT MSVC )
add_definitions( -D__forceinline=inline )
endif( NOT MSVC )
# Fix stat in v140_xp (broken in RTM and Update 1 so far)
if( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
add_definitions( -D_stat64i32=VS14Stat )
endif( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
if( UNIX )
CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT )
if( NOT CLOCK_GETTIME_IN_RT )

View file

@ -973,7 +973,7 @@ void NetUpdate (void)
{
I_StartTic ();
D_ProcessEvents ();
if ((maketic - gametic) / ticdup >= BACKUPTICS/2-1)
if (pauseext || (maketic - gametic) / ticdup >= BACKUPTICS/2-1)
break; // can't hold any more
//Printf ("mk:%i ",maketic);
@ -1204,7 +1204,7 @@ void NetUpdate (void)
// Send current network delay
// The number of tics we just made should be removed from the count.
netbuffer[k++] = ((maketic - newtics - gametic) / ticdup);
netbuffer[k++] = ((maketic - numtics - gametic) / ticdup);
if (numtics > 0)
{
@ -1810,7 +1810,8 @@ void TryRunTics (void)
// If paused, do not eat more CPU time than we need, because it
// will all be wasted anyway.
if (pauseext) r_NoInterpolate = true;
if (pauseext)
r_NoInterpolate = true;
bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/;
// get real tics
@ -1828,6 +1829,9 @@ void TryRunTics (void)
// get available tics
NetUpdate ();
if (pauseext)
return;
lowtic = INT_MAX;
numplaying = 0;
for (i = 0; i < doomcom.numnodes; i++)
@ -1935,7 +1939,7 @@ void TryRunTics (void)
C_Ticker ();
M_Ticker ();
I_GetTime (true);
if (!pauseext) G_Ticker();
G_Ticker();
gametic++;
NetUpdate (); // check for new console commands

View file

@ -4442,7 +4442,6 @@ enum EACSFunctions
ACSF_GetActorRoll,
ACSF_QuakeEx,
ACSF_Warp, // 92
ACSF_GetAspectRatio,
/* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0),
@ -5917,9 +5916,6 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return false;
}
case ACSF_GetAspectRatio:
return CheckRatio(screen->GetWidth(), screen->GetHeight());
default:
break;
}

View file

@ -44,7 +44,7 @@ extern HWND Window;
#define FALSE 0
#define TRUE 1
#endif
#ifdef __APPLE__
#if defined(__FreeBSD__) || defined(__APPLE__)
#include <stdlib.h>
#elif __sun
#include <alloca.h>

View file

@ -5893,6 +5893,103 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
self->RipLevelMax = max;
}
//==========================================================================
//
// A_CheckProximity(jump, classname, distance, count, flags, ptr)
//
// Checks to see if a certain actor class is close to the
// actor/pointer within distance, in numbers.
//==========================================================================
enum CPXFflags
{
CPXF_ANCESTOR = 1,
CPXF_LESSOREQUAL = 1 << 1,
CPXF_NOZ = 1 << 2,
CPXF_COUNTDEAD = 1 << 3,
CPXF_DEADONLY = 1 << 4,
CPXF_EXACT = 1 << 5,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
{
ACTION_PARAM_START(6);
ACTION_PARAM_STATE(jump, 0);
ACTION_PARAM_CLASS(classname, 1);
ACTION_PARAM_FIXED(distance, 2);
ACTION_PARAM_INT(count, 3);
ACTION_PARAM_INT(flags, 4);
ACTION_PARAM_INT(ptr, 5);
ACTION_SET_RESULT(false); //No inventory chain results please.
AActor *ref = COPY_AAPTR(self, ptr);
//We need these to check out.
if (!ref || !jump || !classname || distance <= 0)
return;
int counter = 0;
bool result = false;
TThinkerIterator<AActor> it;
AActor * mo;
//[MC] Process of elimination, I think, will get through this as quickly and
//efficiently as possible.
while ((mo = it.Next()))
{
if (mo == ref) //Don't count self.
continue;
//Check inheritance for the classname. Taken partly from CheckClass DECORATE function.
if (flags & CPXF_ANCESTOR)
{
if (!(mo->GetClass()->IsAncestorOf(classname)))
continue;
}
//Otherwise, just check for the regular class name.
else if (classname != mo->GetClass())
continue;
//Make sure it's in range and respect the desire for Z or not.
if (P_AproxDistance(ref->x - mo->x, ref->y - mo->y) < distance &&
((flags & CPXF_NOZ) ||
((ref->z > mo->z && ref->z - (mo->z + mo->height) < distance) ||
(ref->z <= mo->z && mo->z - (ref->z + ref->height) < distance))))
{
if (mo->flags6 & MF6_KILLED)
{
if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY)))
continue;
counter++;
}
else
{
if (flags & CPXF_DEADONLY)
continue;
counter++;
}
//Abort if the number of matching classes nearby is greater, we have obviously succeeded in our goal.
if (counter > count)
{
result = (flags & (CPXF_LESSOREQUAL | CPXF_EXACT)) ? false : true;
break;
}
}
}
if (counter == count)
result = true;
else if (counter < count)
result = !!((flags & CPXF_LESSOREQUAL) && !(flags & CPXF_EXACT));
if (result)
{
ACTION_JUMP(jump);
}
}
/*===========================================================================
A_CheckBlock
(state block, int flags, int ptr)
@ -5951,4 +6048,4 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
{
ACTION_JUMP(block);
}
}
}

View file

@ -1726,3 +1726,36 @@ FString I_GetLongPathName(FString shortpath)
delete[] buff;
return longpath;
}
#if _MSC_VER == 1900 && defined(_USING_V110_SDK71_)
//==========================================================================
//
// VS14Stat
//
// Work around an issue where stat doesn't work with v140_xp. This was
// supposedly fixed, but as of Update 1 continues to not function on XP.
//
//==========================================================================
#include <sys/stat.h>
int VS14Stat(const char *path, struct _stat64i32 *buffer)
{
WIN32_FILE_ATTRIBUTE_DATA data;
if(!GetFileAttributesEx(path, GetFileExInfoStandard, &data))
return -1;
buffer->st_ino = 0;
buffer->st_mode = ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? S_IFDIR : S_IFREG)|
((data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? S_IREAD : S_IREAD|S_IWRITE);
buffer->st_dev = buffer->st_rdev = 0;
buffer->st_nlink = 1;
buffer->st_uid = 0;
buffer->st_gid = 0;
buffer->st_size = data.nFileSizeLow;
buffer->st_atime = (*(QWORD*)&data.ftLastAccessTime) / 10000000 - 11644473600LL;
buffer->st_mtime = (*(QWORD*)&data.ftLastWriteTime) / 10000000 - 11644473600LL;
buffer->st_ctime = (*(QWORD*)&data.ftCreationTime) / 10000000 - 11644473600LL;
return 0;
}
#endif

View file

@ -3061,6 +3061,7 @@ struct lemon *lemp;
FILE *in;
char *tpltname;
char *cp;
Boolean tpltnameinbuf;
cp = strrchr(lemp->filename,'.');
if( cp ){
@ -3070,10 +3071,13 @@ struct lemon *lemp;
}
if( access(buf,004)==0 ){
tpltname = buf;
tpltnameinbuf = LEMON_TRUE;
}else if( access(templatename,004)==0 ){
tpltname = templatename;
tpltnameinbuf = LEMON_TRUE;
}else{
tpltname = pathsearch(lemp->argv0,templatename,0);
tpltnameinbuf = LEMON_FALSE;
}
if( tpltname==0 ){
fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
@ -3084,11 +3088,11 @@ struct lemon *lemp;
in = fopen(tpltname,"rb");
if( in==0 ){
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
free(tpltname);
if (tpltnameinbuf == LEMON_FALSE) free(tpltname);
lemp->errorcnt++;
return 0;
}
free(tpltname);
if (tpltnameinbuf == LEMON_FALSE) free(tpltname);
return in;
}

View file

@ -337,6 +337,7 @@ ACTOR Actor native //: Thinker
action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min);
action native A_SetRipMax(int max);
action native A_CheckProximity(state jump, class<Actor> classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT);
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT);
action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
action native A_CheckRange(float distance, state label, bool two_dimension = false);

View file

@ -484,6 +484,17 @@ enum
QF_WAVE = 1 << 5,
};
// A_CheckProximity flags
enum
{
CPXF_ANCESTOR = 1,
CPXF_LESSOREQUAL = 1 << 1,
CPXF_NOZ = 1 << 2,
CPXF_COUNTDEAD = 1 << 3,
CPXF_DEADONLY = 1 << 4,
CPXF_EXACT = 1 << 5,
};
// Flags for A_CheckBlock
// These flags only affect the calling actor('s pointer), not the ones being searched.
enum