-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b6a7fc4
Showing
253 changed files
with
102,074 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Code/CryEngine/* linguist-vendored | ||
|
||
*.h linguist-language=C++ | ||
*.h.in linguist-language=C++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of build.") | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel") | ||
endif() | ||
|
||
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}" CACHE INTERNAL "Install target is not defined.") | ||
|
||
project(C1-Launcher VERSION 2.3 LANGUAGES CXX RC) | ||
|
||
if(NOT MSVC) | ||
message(FATAL_ERROR "MSVC is the only supported compiler!") | ||
endif() | ||
|
||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(BUILD_64BIT TRUE) | ||
message(STATUS "c1-launcher: 64-bit build") | ||
else() | ||
message(STATUS "c1-launcher: 32-bit build") | ||
endif() | ||
|
||
# prevent modern MSVC from enabling ASLR | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE:NO") | ||
|
||
option(C1LAUNCHER_GAME_LAUNCHER "Build game launcher - Crysis.exe" ON) | ||
if(C1LAUNCHER_GAME_LAUNCHER) | ||
add_executable(Crysis WIN32 | ||
Code/Launcher/Game/Main.cpp | ||
Code/Launcher/Patch.cpp | ||
Code/Launcher/Util.cpp | ||
Resources/GameLauncher.rc | ||
) | ||
target_include_directories(Crysis PRIVATE | ||
Code/Launcher | ||
Code/CryEngine/CryCommon | ||
Code/CryEngine/CryAction | ||
${PROJECT_BINARY_DIR} | ||
) | ||
if(BUILD_64BIT) | ||
target_compile_definitions(Crysis PRIVATE BUILD_64BIT) | ||
endif() | ||
endif() | ||
|
||
option(C1LAUNCHER_SERVER_LAUNCHER "Build dedicated server launcher - CrysisDedicatedServer.exe" ON) | ||
if(C1LAUNCHER_SERVER_LAUNCHER) | ||
add_executable(CrysisDedicatedServer WIN32 | ||
Code/Launcher/DedicatedServer/Main.cpp | ||
Code/Launcher/Patch.cpp | ||
Code/Launcher/Util.cpp | ||
Resources/DedicatedServerLauncher.rc | ||
) | ||
target_include_directories(CrysisDedicatedServer PRIVATE | ||
Code/Launcher | ||
Code/CryEngine/CryCommon | ||
Code/CryEngine/CryAction | ||
${PROJECT_BINARY_DIR} | ||
) | ||
if(BUILD_64BIT) | ||
target_compile_definitions(CrysisDedicatedServer PRIVATE BUILD_64BIT) | ||
endif() | ||
endif() | ||
|
||
option(C1LAUNCHER_STATIC_MSVC_RUNTIME "Enable static link of MSVC runtime library." ON) | ||
if(C1LAUNCHER_STATIC_MSVC_RUNTIME) | ||
foreach(flag | ||
CMAKE_CXX_FLAGS | ||
CMAKE_CXX_FLAGS_DEBUG | ||
CMAKE_CXX_FLAGS_RELEASE | ||
CMAKE_CXX_FLAGS_RELWITHDEBINFO | ||
CMAKE_CXX_FLAGS_MINSIZEREL) | ||
if(${flag} MATCHES "/MD") | ||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") | ||
endif() | ||
endforeach() | ||
endif() | ||
|
||
configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
/************************************************************************* | ||
Crytek Source File. | ||
Copyright (C), Crytek Studios, 2001-2004. | ||
------------------------------------------------------------------------- | ||
$Id$ | ||
$DateTime$ | ||
Description: Action Map Manager interfaces. | ||
------------------------------------------------------------------------- | ||
History: | ||
- 8:9:2004 10:20 : Created by Márcio Martins | ||
*************************************************************************/ | ||
#ifndef __IACTIONMAPMANAGER_H__ | ||
#define __IACTIONMAPMANAGER_H__ | ||
|
||
#if _MSC_VER > 1000 | ||
# pragma once | ||
#endif | ||
|
||
#include "IEntitySystem.h" | ||
#include "CryName.h" // CCryName | ||
#include "smartptr.h" | ||
|
||
typedef CCryName ActionId; | ||
|
||
// Summary | ||
// Enumeration all all the possible activation mode used for the actions | ||
enum EActionActivationMode | ||
{ | ||
eAAM_OnPress = 0x0001, // Used when the action key is pressed | ||
eAAM_OnRelease = 0x0002, // Used when the action key is released | ||
eAAM_OnHold = 0x0004, // Used when the action key is on hold | ||
eAAM_Always = 0x0008, | ||
|
||
// special modifiers | ||
eAAM_Retriggerable = 0x2000, | ||
eAAM_NoModifiers = 0x4000, | ||
eAAM_ConsoleCmd = 0x8000, | ||
}; | ||
|
||
|
||
enum EActionFilterType | ||
{ | ||
eAFT_ActionPass, | ||
eAFT_ActionFail, | ||
}; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionListener | ||
{ | ||
virtual void OnAction(const ActionId& action, int activationMode, float value) = 0; | ||
virtual void AfterAction(){}; | ||
}; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct SActionMapBindInfo | ||
{ | ||
const char* action; // name of the action | ||
const char** keys; // allocated/release by IActionMapBindInfoIterator::Next | ||
int nKeys; // number of key names in keys | ||
}; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionMapBindInfoIterator | ||
{ | ||
virtual const SActionMapBindInfo* Next() = 0; // returns the same pointer every call, 0 if no more info available | ||
virtual void AddRef() = 0; | ||
virtual void Release() = 0; | ||
}; | ||
typedef _smart_ptr<IActionMapBindInfoIterator> IActionMapBindInfoIteratorPtr; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionMap | ||
{ | ||
virtual void GetMemoryStatistics( ICrySizer * ) = 0; | ||
virtual void Release() = 0; | ||
virtual void CreateAction(const char *name, int activationMode, const char* defaultKey0 = "<unknown>", const char* defaultKey1 = "<unknown>") = 0; | ||
virtual void BindAction(const char *name, const char *keyName, int keyNumber = -1) = 0; | ||
virtual void Reset() = 0; | ||
virtual bool SerializeXML(const XmlNodeRef& root, bool bLoading) = 0; | ||
virtual IActionMapBindInfoIteratorPtr CreateBindInfoIterator() = 0; | ||
virtual void SetActionListener(EntityId id) = 0; | ||
virtual const char* GetName() = 0; | ||
virtual void Enable(bool enable) = 0; | ||
virtual bool Enabled() = 0; | ||
|
||
// Summary: | ||
// Retrieve key binding info for a specific action | ||
// Description: | ||
// Unlike CreateBindInfoIterator this function looks up the key bindings for a specific action | ||
// the outInfo needs already to be prepared, meaning keys must already be allocated up to maxKeys | ||
// Inputs: | ||
// actionId - id[name] of action which bindings should be returned | ||
// outInfo - SActionMapBindInfo structure. The SActionMapBindInfo::keys member must already be allocated | ||
// with maxKeys members. | ||
// maxKeys - number of [caller-allocated] entries in outInfo.keys. if 0, no entries will be filled in | ||
// Returns: | ||
// true if BindInfo(=Action) found -> outInfo is filled with current params, false otherwise | ||
virtual bool GetBindInfo(const ActionId& actionId, SActionMapBindInfo& outInfo, int maxKeys) = 0; | ||
}; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionMapIterator | ||
{ | ||
virtual IActionMap* Next() = 0; | ||
virtual void AddRef() = 0; | ||
virtual void Release() = 0; | ||
}; | ||
typedef _smart_ptr<IActionMapIterator> IActionMapIteratorPtr; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionFilter | ||
{ | ||
virtual void GetMemoryStatistics( ICrySizer * ) = 0; | ||
virtual void Release() = 0; | ||
virtual void Filter(const ActionId& action) = 0; | ||
virtual bool SerializeXML(const XmlNodeRef& root, bool bLoading) = 0; | ||
virtual const char* GetName() = 0; | ||
virtual void Enable(bool enable) = 0; | ||
virtual bool Enabled() = 0; | ||
}; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionFilterIterator | ||
{ | ||
virtual IActionFilter* Next() = 0; | ||
virtual void AddRef() = 0; | ||
virtual void Release() = 0; | ||
}; | ||
typedef _smart_ptr<IActionFilterIterator> IActionFilterIteratorPtr; | ||
|
||
|
||
//------------------------------------------------------------------------ | ||
struct IActionMapManager | ||
{ | ||
virtual void Update() = 0; | ||
virtual void Reset() = 0; | ||
virtual void Clear() = 0; | ||
|
||
virtual void LoadFromXML(const XmlNodeRef& node, bool bCheckVersion=false) = 0; | ||
virtual void SaveToXML(const XmlNodeRef& node) = 0; | ||
|
||
virtual IActionMap *CreateActionMap(const char *name) = 0; | ||
virtual IActionMap *GetActionMap(const char * name) = 0; | ||
virtual IActionFilter *CreateActionFilter(const char *name, EActionFilterType type) = 0; | ||
virtual IActionFilter *GetActionFilter(const char *name) = 0; | ||
virtual IActionMapIteratorPtr CreateActionMapIterator() = 0; | ||
virtual IActionFilterIteratorPtr CreateActionFilterIterator() = 0; | ||
|
||
virtual void Enable(bool enable) = 0; | ||
virtual void EnableActionMap(const char *name, bool enable) = 0; | ||
virtual void EnableFilter(const char *name, bool enable) = 0; | ||
virtual bool IsFilterEnabled(const char *name) = 0; | ||
}; | ||
|
||
|
||
template <class T> | ||
class TActionHandler | ||
{ | ||
public: | ||
// Returns true if the action should also be forwarded to scripts | ||
typedef bool (T::*TOnActionHandler)(EntityId entityId, const ActionId& actionId, int activationMode, float value); | ||
|
||
// setup action handlers | ||
void AddHandler(const ActionId& actionId, TOnActionHandler fnHandler) | ||
{ | ||
m_actionHandlers.insert( std::make_pair(actionId, fnHandler) ); | ||
} | ||
|
||
size_t GetNumHandlers() const | ||
{ | ||
return m_actionHandlers.size(); | ||
} | ||
|
||
// call action handler | ||
bool Dispatch(T* pThis, EntityId entityId, const ActionId& actionId, int activationMode, float value) | ||
{ | ||
bool rVal = false; | ||
return Dispatch(pThis, entityId, actionId, activationMode, value, rVal); | ||
} | ||
|
||
// call action handler | ||
bool Dispatch(T* pThis, EntityId entityId, const ActionId& actionId, int activationMode, float value, bool& rVal) | ||
{ | ||
rVal = false; | ||
|
||
TOnActionHandler fnHandler = GetHandler(actionId); | ||
if (fnHandler && pThis) | ||
{ | ||
rVal = (pThis->*fnHandler)(entityId, actionId, activationMode, value); | ||
return true; | ||
} | ||
else | ||
return false; | ||
} | ||
|
||
// get action handler | ||
TOnActionHandler GetHandler(const ActionId& actionId) | ||
{ | ||
typename TActionHandlerMap::iterator handler = m_actionHandlers.find(actionId); | ||
|
||
if (handler != m_actionHandlers.end()) | ||
{ | ||
return handler->second; | ||
} | ||
return 0; | ||
} | ||
|
||
private: | ||
typedef std::multimap<ActionId, TOnActionHandler> TActionHandlerMap; | ||
|
||
TActionHandlerMap m_actionHandlers; | ||
}; | ||
|
||
#endif //__IACTIONMAPMANAGER_H__ |
Oops, something went wrong.