This commit is contained in:
Christoph Oelckers 2014-01-04 11:29:02 +01:00
commit 005313c00e
14 changed files with 158 additions and 53 deletions

View file

@ -13,6 +13,17 @@ else(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
set( NO_GENERATOR_EXPRESSIONS ON )
endif(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
# Support cross compiling
option( FORCE_CROSSCOMPILE "Turn on cross compiling." NO )
if( FORCE_CROSSCOMPILE )
set( CMAKE_CROSSCOMPILING TRUE )
endif( FORCE_CROSSCOMPILE )
if(CMAKE_CROSSCOMPILING)
set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Export file from native build.")
include(${IMPORT_EXECUTABLES})
endif(CMAKE_CROSSCOMPILING)
# Simplify pk3 building, add_pk3(filename srcdirectory)
function( add_pk3 PK3_NAME PK3_DIR )
get_target_property(ZIPDIR_EXE zipdir LOCATION)
@ -211,3 +222,7 @@ add_subdirectory( src )
if( NOT WIN32 AND NOT APPLE )
add_subdirectory( output_sdl )
endif( NOT WIN32 AND NOT APPLE )
if( NOT CMAKE_CROSSCOMPILING )
export(TARGETS ${CROSS_EXPORTS} FILE "${CMAKE_BINARY_DIR}/ImportExecutables.cmake" )
endif( NOT CMAKE_CROSSCOMPILING )

View file

@ -15,14 +15,19 @@ endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" S
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS )
if( NOT MSVC )
if( NOT MSVC AND NOT APPLE )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( arithchk arithchk.c )
endif( NOT CMAKE_CROSSCOMPILING )
get_target_property( ARITHCHK_EXE arithchk LOCATION )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
COMMAND ${ARITHCHK_EXE} >${CMAKE_CURRENT_BINARY_DIR}/arith.h
DEPENDS arithchk )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( qnan qnan.c arith.h )
set( CROSS_EXPORTS ${CROSS_EXPORTS} arithchk qnan PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
get_target_property( QNAN_EXE qnan LOCATION )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
COMMAND ${QNAN_EXE} >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
@ -30,7 +35,7 @@ if( NOT MSVC )
set( GEN_FP_FILES arith.h gd_qnan.h )
set( GEN_FP_DEPS ${CMAKE_CURRENT_BINARY_DIR}/arith.h ${CMAKE_CURRENTY_BINARY_DIR}/gd_qnan.h )
endif( NOT MSVC )
endif( NOT MSVC AND NOT APPLE )
add_library( gdtoa
${GEN_FP_FILES}

View file

@ -32,7 +32,7 @@ THIS SOFTWARE.
#ifndef GDTOA_H_INCLUDED
#define GDTOA_H_INCLUDED
#ifdef _MSC_VER
#if defined(_MSC_VER)
/* [RH] Generating arith.h strikes me as too cumbersome under Visual
* Studio, so here's the equivalent, given the limited number of
* architectures that MSC can target. (Itanium? Who cares about that?)
@ -43,6 +43,26 @@ THIS SOFTWARE.
#ifdef _M_X64
#define X64_bit_pointers
#endif
#elif defined(__APPLE__)
/* [BL] While generating the files may be easy, on OS X we have cross
* compiling to deal with, which means we can't run the generation
* program on the target.
*/
#if defined(__x86_64__)
#define IEEE_8087
#define Arith_Kind_ASL 1
#define Long int
#define Intcast (int)(long)
#define Double_Align
#define X64_bit_pointers
#elif defined(__i386__)
#define IEEE_8087
#define Arith_Kind_ASL 1
#else
#define IEEE_MC68k
#define Arith_Kind_ASL 2
#define Double_Align
#endif
#else
#include "arith.h"
#endif

View file

@ -167,7 +167,7 @@ THIS SOFTWARE.
#define GDTOAIMP_H_INCLUDED
#include "gdtoa.h"
#ifdef _MSC_VER
#if defined(_MSC_VER)
/* [RH] Generating gd_qnan.h strikes me as too cumbersome under Visual
* Studio, so here's the equivalent, given the limited number of
* architectures that MSC can target. (Itanium? Who cares about that?)
@ -188,6 +188,34 @@ THIS SOFTWARE.
* it turns out that it has a true long double type. I thought that
* all ia32 compilers had phased out extended precision.
*/
#elif defined(__APPLE__)
#if defined(__x86_64__) || defined(__i386__)
#define f_QNAN 0xffc00000
#define d_QNAN0 0x0
#define d_QNAN1 0xfff80000
#define ld_QNAN0 0x0
#define ld_QNAN1 0xc0000000
#define ld_QNAN2 0xffff
#define ld_QNAN3 0x0
#define ldus_QNAN0 0x0
#define ldus_QNAN1 0x0
#define ldus_QNAN2 0x0
#define ldus_QNAN3 0xc000
#define ldus_QNAN4 0xffff
#else
#define f_QNAN 0xffc00000
#define d_QNAN0 0xfff80000
#define d_QNAN1 0x0
#define ld_QNAN0 0xfff80000
#define ld_QNAN1 0x0
#define ld_QNAN2 0x0
#define ld_QNAN3 0x0
#define ldus_QNAN0 0xfff8
#define ldus_QNAN1 0x0
#define ldus_QNAN2 0x0
#define ldus_QNAN3 0x0
#define ldus_QNAN4 0x0
#endif
#else
#include "gd_qnan.h"
#endif

View file

@ -1747,6 +1747,8 @@ void TryRunTics (void)
if (counts == 0 && !doWait)
{
// Check possible stall conditions
Net_CheckLastRecieved(counts);
return;
}
@ -1824,41 +1826,8 @@ void TryRunTics (void)
if (lowtic < gametic)
I_Error ("TryRunTics: lowtic < gametic");
// [Ed850] Check to see the last time a packet was recieved.
// If it's longer then 3 seconds, a node has likely stalled.
if(I_GetTime(false) - lastglobalrecvtime >= TICRATE*3)
{
lastglobalrecvtime = I_GetTime(false); //Bump the count
if(NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator)
{
//Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late.
//However, we don't send a resend request for sanity reasons.
for (i = 0; i < doomcom.numnodes; i++)
{
if (nodeingame[i] && nettics[i] < gametic + counts)
{
if (debugfile)
fprintf (debugfile, "%i is slow (%i to %i)\n",
i, nettics[i], gametic+counts);
//Send resend request to the late node. Also mark the node as waiting to display it in the hud.
if(i != 0)
remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true;
}
else
players[playerfornode[i]].waiting = false;
}
}
else
{ //Send a resend request to the Arbitrator, as it's obvious we are stuck here.
if (debugfile)
fprintf (debugfile, "Arbitrator is slow (%i to %i)\n",
nettics[Net_Arbitrator], gametic+counts);
//Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud.
if(i != 0)
remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true;
}
}
// Check possible stall conditions
Net_CheckLastRecieved (counts);
// don't stay in here forever -- give the menu a chance to work
if (I_GetTime (false) - entertic >= TICRATE/3)
@ -1901,6 +1870,44 @@ void TryRunTics (void)
}
}
void Net_CheckLastRecieved (int counts)
{
// [Ed850] Check to see the last time a packet was recieved.
// If it's longer then 3 seconds, a node has likely stalled.
if (I_GetTime(false) - lastglobalrecvtime >= TICRATE * 3)
{
lastglobalrecvtime = I_GetTime(false); //Bump the count
if (NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator)
{
//Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late.
//However, we don't send a resend request for sanity reasons.
for (int i = 0; i < doomcom.numnodes; i++)
{
if (nodeingame[i] && nettics[i] <= gametic + counts)
{
if (debugfile && !players[playerfornode[i]].waiting)
fprintf(debugfile, "%i is slow (%i to %i)\n",
i, nettics[i], gametic + counts);
//Send resend request to the late node. Also mark the node as waiting to display it in the hud.
if (i != 0)
remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true;
}
else
players[playerfornode[i]].waiting = false;
}
}
else
{ //Send a resend request to the Arbitrator, as it's obvious we are stuck here.
if (debugfile && !players[playerfornode[Net_Arbitrator]].waiting)
fprintf(debugfile, "Arbitrator is slow (%i to %i)\n",
nettics[Net_Arbitrator], gametic + counts);
//Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud.
remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true;
}
}
}
void Net_NewMakeTic (void)
{
specials.NewMakeTic ();

View file

@ -115,6 +115,9 @@ void D_QuitNetGame (void);
//? how many ticks to run?
void TryRunTics (void);
//Use for checking to see if the netgame has stalled
void Net_CheckLastRecieved(int);
// [RH] Functions for making and using special "ticcmds"
void Net_NewMakeTic ();
void Net_WriteByte (BYTE);

View file

@ -263,7 +263,7 @@ void FMugShot::Tick(player_t *player)
CurrentState = NULL;
}
}
if ((player->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(player->cheats & (CF_FROZEN | CF_TOTALLYFROZEN)) && player->ReadyWeapon)
if (player->attackdown && !(player->cheats & (CF_FROZEN | CF_TOTALLYFROZEN)) && player->ReadyWeapon)
{
if (RampageTimer != ST_RAMPAGEDELAY)
{

View file

@ -157,6 +157,10 @@ loop:
{
return TokenTrans[NUM];
}
#if __GNUC__ == 4 && __GNUC_MINOR__ == 8
// Work around GCC 4.8 bug 54570 causing release build crashes.
asm("" : "+g" (yylval));
#endif
strcpy (yylval->sym, token);
return TokenTrans[SYM];
}

View file

@ -7,3 +7,5 @@ if( WIN32 )
endif( WIN32 )
add_subdirectory( updaterevision )
add_subdirectory( zipdir )
set( CROSS_EXPORTS ${CROSS_EXPORTS} PARENT_SCOPE )

View file

@ -1,2 +1,6 @@
cmake_minimum_required( VERSION 2.4 )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( fixrtext fixrtext.c )
set( CROSS_EXPORTS ${CROSS_EXPORTS} fixrtext PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )

View file

@ -1,8 +1,11 @@
cmake_minimum_required( VERSION 2.4 )
if( NOT CMAKE_CROSSCOMPILING )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
add_executable( lemon lemon.c )
set( CROSS_EXPORTS ${CROSS_EXPORTS} lemon PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
# Lemon wants lempar.c in its directory
if( NOT NO_GENERATOR_EXPRESSIONS )

View file

@ -1,4 +1,7 @@
cmake_minimum_required( VERSION 2.4 )
if( NOT CMAKE_CROSSCOMPILING )
include( CheckFunctionExists )
include( CheckTypeSize )
@ -30,3 +33,7 @@ add_executable( re2c
scanner.cc
substr.cc
translate.cc )
set( CROSS_EXPORTS ${CROSS_EXPORTS} re2c PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )

View file

@ -17,7 +17,10 @@ if( WIN32 )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
endif( WIN32 )
if( NOT CMAKE_CROSSCOMPILING )
add_executable( updaterevision updaterevision.c ${TRUSTINFO} )
set( CROSS_EXPORTS ${CROSS_EXPORTS} updaterevision PARENT_SCOPE )
endif( NOT CMAKE_CROSSCOMPILING )
if( MT_MERGE )
get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )

View file

@ -1,4 +1,6 @@
cmake_minimum_required( VERSION 2.4 )
if(NOT CMAKE_CROSSCOMPILING)
message(STATUS "${ZLIB_INCLUDE_DIR}" )
message(STATUS "${BZIP2_INCLUDE_DIR}" )
message(STATUS "${LZMA_INCLUDE_DIR}" )
@ -6,3 +8,5 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUD
add_executable( zipdir
zipdir.c )
target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )
set( CROSS_EXPORTS ${CROSS_EXPORTS} zipdir PARENT_SCOPE )
endif(NOT CMAKE_CROSSCOMPILING)