Init commit

This commit is contained in:
Gigaslav
2025-05-21 21:09:22 +03:00
commit c59edfa1ce
1002 changed files with 332994 additions and 0 deletions

1020
.gitignore vendored Normal file

File diff suppressed because it is too large Load Diff

121
common/GameUI/IGameUI.h Normal file
View File

@@ -0,0 +1,121 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef IGAMEUI_H
#define IGAMEUI_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h"
#include "vgui/IPanel.h"
#if !defined( _X360 )
#include "xbox/xboxstubs.h"
#endif
// reasons why the user can't connect to a game server
enum ESteamLoginFailure
{
STEAMLOGINFAILURE_NONE,
STEAMLOGINFAILURE_BADTICKET,
STEAMLOGINFAILURE_NOSTEAMLOGIN,
STEAMLOGINFAILURE_VACBANNED,
STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE
};
enum ESystemNotify
{
SYSTEMNOTIFY_STORAGEDEVICES_CHANGED,
SYSTEMNOTIFY_USER_SIGNEDIN,
SYSTEMNOTIFY_USER_SIGNEDOUT,
SYSTEMNOTIFY_XUIOPENING,
SYSTEMNOTIFY_XUICLOSED,
SYSTEMNOTIFY_INVITE_SHUTDOWN, // Cross-game invite is causing us to shutdown
};
//-----------------------------------------------------------------------------
// Purpose: contains all the functions that the GameUI dll exports
//-----------------------------------------------------------------------------
abstract_class IGameUI
{
public:
// initialization/shutdown
virtual void Initialize( CreateInterfaceFn appFactory ) = 0;
virtual void PostInit() = 0;
// connect to other interfaces at the same level (gameui.dll/server.dll/client.dll)
virtual void Connect( CreateInterfaceFn gameFactory ) = 0;
virtual void Start() = 0;
virtual void Shutdown() = 0;
virtual void RunFrame() = 0;
// notifications
virtual void OnGameUIActivated() = 0;
virtual void OnGameUIHidden() = 0;
// OLD: Use OnConnectToServer2
virtual void OLD_OnConnectToServer(const char *game, int IP, int port) = 0;
virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) = 0;
virtual void OnLevelLoadingStarted(bool bShowProgressDialog) = 0;
virtual void OnLevelLoadingFinished(bool bError, const char *failureReason, const char *extendedReason) = 0;
// level loading progress, returns true if the screen needs updating
virtual bool UpdateProgressBar(float progress, const char *statusText) = 0;
// Shows progress desc, returns previous setting... (used with custom progress bars )
virtual bool SetShowProgressText( bool show ) = 0;
// !!!!!!!!!members added after "GameUI011" initial release!!!!!!!!!!!!!!!!!!!
virtual void ShowNewGameDialog( int chapter ) = 0;
// Xbox 360
virtual void SessionNotification( const int notification, const int param = 0 ) = 0;
virtual void SystemNotification( const int notification ) = 0;
virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner ) = 0;
virtual void UpdatePlayerInfo( uint64 nPlayerId, const char *pName, int nTeam, byte cVoiceState, int nPlayersNeeded, bool bHost ) = 0;
virtual void SessionSearchResult( int searchIdx, void *pHostData, XSESSION_SEARCHRESULT *pResult, int ping ) = 0;
virtual void OnCreditsFinished( void ) = 0;
// inserts specified panel as background for level load dialog
virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel ) = 0;
// Bonus maps interfaces
virtual void BonusMapUnlock( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
virtual void BonusMapComplete( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
virtual void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest ) = 0;
virtual void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) = 0;
virtual void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) = 0;
virtual void BonusMapDatabaseSave( void ) = 0;
virtual int BonusMapNumAdvancedCompleted( void ) = 0;
virtual void BonusMapNumMedals( int piNumMedals[ 3 ] ) = 0;
virtual void OnConnectToServer2(const char *game, int IP, int connectionPort, int queryPort) = 0;
// X360 Storage device validation:
// returns true right away if storage device has been previously selected.
// otherwise returns false and will set the variable pointed by pStorageDeviceValidated to 1
// once the storage device is selected by user.
virtual bool ValidateStorageDevice( int *pStorageDeviceValidated ) = 0;
virtual void SetProgressOnStart() = 0;
virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure ) = 0;
virtual void OnConfirmQuit( void ) = 0;
virtual bool IsMainMenuVisible( void ) = 0;
// Client DLL is providing us with a panel that it wants to replace the main menu with
virtual void SetMainMenuOverride( vgui::VPANEL panel ) = 0;
// Client DLL is telling us that a main menu command was issued, probably from its custom main menu panel
virtual void SendMainMenuCommand( const char *pszCommand ) = 0;
};
#define GAMEUI_INTERFACE_VERSION "GameUI011"
#endif // IGAMEUI_H

703
common/SteamCommon.h Normal file
View File

@@ -0,0 +1,703 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
/*
** The copyright to the contents herein is the property of Valve Corporation.
** The contents may be used and/or copied only with the written permission of
** Valve, or in accordance with the terms and conditions stipulated in
** the agreement/contract under which the contents have been supplied.
**
*******************************************************************************
**
** Contents:
**
** Common types used in the Steam DLL interface.
**
** This file is distributed to Steam application developers.
**
**
**
*******************************************************************************/
#ifndef INCLUDED_STEAM_COMMON_STEAMCOMMON_H
#define INCLUDED_STEAM_COMMON_STEAMCOMMON_H
#if defined(_MSC_VER) && (_MSC_VER > 1000)
#pragma once
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* Applications should not define STEAM_EXPORTS. */
#if defined ( _WIN32 )
#ifdef STEAM_EXPORTS
#define STEAM_API __declspec(dllexport)
#else
#define STEAM_API __declspec(dllimport)
#endif
#define STEAM_CALL __cdecl
#else
#define STEAM_API /* */
#define STEAM_CALL /* */
#endif
typedef void (STEAM_CALL *KeyValueIteratorCallback_t )(const char *Key, const char *Val, void *pvParam);
/******************************************************************************
**
** Exported macros and constants
**
******************************************************************************/
/* DEPRECATED -- these are ignored now, all API access is granted on SteamStartup */
#define STEAM_USING_FILESYSTEM (0x00000001)
#define STEAM_USING_LOGGING (0x00000002)
#define STEAM_USING_USERID (0x00000004)
#define STEAM_USING_ACCOUNT (0x00000008)
#define STEAM_USING_ALL (0x0000000f)
/* END DEPRECATED */
#define STEAM_MAX_PATH (255)
#define STEAM_QUESTION_MAXLEN (255)
#define STEAM_SALT_SIZE (8)
#define STEAM_PROGRESS_PERCENT_SCALE (0x00001000)
/* These are maximum significant string lengths, excluding nul-terminator. */
#define STEAM_CARD_NUMBER_SIZE (17)
#define STEAM_CARD_HOLDERNAME_SIZE (100)
#define STEAM_CARD_EXPYEAR_SIZE (4)
#define STEAM_CARD_EXPMONTH_SIZE (2)
#define STEAM_CARD_CVV2_SIZE (5)
#define STEAM_BILLING_ADDRESS1_SIZE (128)
#define STEAM_BILLING_ADDRESS2_SIZE (128)
#define STEAM_BILLING_CITY_SIZE (50)
#define STEAM_BILLING_ZIP_SIZE (16)
#define STEAM_BILLING_STATE_SIZE (32)
#define STEAM_BILLING_COUNTRY_SIZE (32)
#define STEAM_BILLING_PHONE_SIZE (20)
#define STEAM_BILLING_EMAIL_ADDRESS_SIZE (100)
#define STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE (20)
#define STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE (200)
#define STEAM_EXTERNAL_ACCOUNTNAME_SIZE (100)
#define STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE (80)
#define STEAM_BILLING_CONFIRMATION_CODE_SIZE (22)
#define STEAM_BILLING_CARD_APPROVAL_CODE_SIZE (100)
#define STEAM_BILLING_TRANS_DATE_SIZE (9) // mm/dd/yy
#define STEAM_BILLING_TRANS_TIME_SIZE (9) // hh:mm:ss
/******************************************************************************
**
** Scalar type and enumerated type definitions.
**
******************************************************************************/
typedef unsigned int SteamHandle_t;
typedef void * SteamUserIDTicketValidationHandle_t;
typedef unsigned int SteamCallHandle_t;
#if defined(_MSC_VER)
typedef unsigned __int64 SteamUnsigned64_t;
#else
typedef unsigned long long SteamUnsigned64_t;
#endif
typedef enum
{
eSteamSeekMethodSet = 0,
eSteamSeekMethodCur = 1,
eSteamSeekMethodEnd = 2
} ESteamSeekMethod;
typedef enum
{
eSteamBufferMethodFBF = 0,
eSteamBufferMethodNBF = 1
} ESteamBufferMethod;
typedef enum
{
eSteamErrorNone = 0,
eSteamErrorUnknown = 1,
eSteamErrorLibraryNotInitialized = 2,
eSteamErrorLibraryAlreadyInitialized = 3,
eSteamErrorConfig = 4,
eSteamErrorContentServerConnect = 5,
eSteamErrorBadHandle = 6,
eSteamErrorHandlesExhausted = 7,
eSteamErrorBadArg = 8,
eSteamErrorNotFound = 9,
eSteamErrorRead = 10,
eSteamErrorEOF = 11,
eSteamErrorSeek = 12,
eSteamErrorCannotWriteNonUserConfigFile = 13,
eSteamErrorCacheOpen = 14,
eSteamErrorCacheRead = 15,
eSteamErrorCacheCorrupted = 16,
eSteamErrorCacheWrite = 17,
eSteamErrorCacheSession = 18,
eSteamErrorCacheInternal = 19,
eSteamErrorCacheBadApp = 20,
eSteamErrorCacheVersion = 21,
eSteamErrorCacheBadFingerPrint = 22,
eSteamErrorNotFinishedProcessing = 23,
eSteamErrorNothingToDo = 24,
eSteamErrorCorruptEncryptedUserIDTicket = 25,
eSteamErrorSocketLibraryNotInitialized = 26,
eSteamErrorFailedToConnectToUserIDTicketValidationServer = 27,
eSteamErrorBadProtocolVersion = 28,
eSteamErrorReplayedUserIDTicketFromClient = 29,
eSteamErrorReceiveResultBufferTooSmall = 30,
eSteamErrorSendFailed = 31,
eSteamErrorReceiveFailed = 32,
eSteamErrorReplayedReplyFromUserIDTicketValidationServer = 33,
eSteamErrorBadSignatureFromUserIDTicketValidationServer = 34,
eSteamErrorValidationStalledSoAborted = 35,
eSteamErrorInvalidUserIDTicket = 36,
eSteamErrorClientLoginRateTooHigh = 37,
eSteamErrorClientWasNeverValidated = 38,
eSteamErrorInternalSendBufferTooSmall = 39,
eSteamErrorInternalReceiveBufferTooSmall = 40,
eSteamErrorUserTicketExpired = 41,
eSteamErrorCDKeyAlreadyInUseOnAnotherClient = 42,
eSteamErrorNotLoggedIn = 101,
eSteamErrorAlreadyExists = 102,
eSteamErrorAlreadySubscribed = 103,
eSteamErrorNotSubscribed = 104,
eSteamErrorAccessDenied = 105,
eSteamErrorFailedToCreateCacheFile = 106,
eSteamErrorCallStalledSoAborted = 107,
eSteamErrorEngineNotRunning = 108,
eSteamErrorEngineConnectionLost = 109,
eSteamErrorLoginFailed = 110,
eSteamErrorAccountPending = 111,
eSteamErrorCacheWasMissingRetry = 112,
eSteamErrorLocalTimeIncorrect = 113,
eSteamErrorCacheNeedsDecryption = 114,
eSteamErrorAccountDisabled = 115,
eSteamErrorCacheNeedsRepair = 116,
eSteamErrorRebootRequired = 117,
eSteamErrorNetwork = 200,
eSteamErrorOffline = 201
} ESteamError;
typedef enum
{
eNoDetailedErrorAvailable,
eStandardCerrno,
eWin32LastError,
eWinSockLastError,
eDetailedPlatformErrorCount
} EDetailedPlatformErrorType;
typedef enum /* Filter elements returned by SteamFind{First,Next} */
{
eSteamFindLocalOnly, /* limit search to local filesystem */
eSteamFindRemoteOnly, /* limit search to remote repository */
eSteamFindAll /* do not limit search (duplicates allowed) */
} ESteamFindFilter;
/******************************************************************************
**
** Exported structure and complex type definitions.
**
******************************************************************************/
typedef struct
{
ESteamError eSteamError;
EDetailedPlatformErrorType eDetailedErrorType;
int nDetailedErrorCode;
char szDesc[STEAM_MAX_PATH];
} TSteamError;
typedef struct
{
int bIsDir; /* If non-zero, element is a directory; if zero, element is a file */
unsigned int uSizeOrCount; /* If element is a file, this contains size of file in bytes */
int bIsLocal; /* If non-zero, reported item is a standalone element on local filesystem */
char cszName[STEAM_MAX_PATH]; /* Base element name (no path) */
long lLastAccessTime; /* Seconds since 1/1/1970 (like time_t) when element was last accessed */
long lLastModificationTime; /* Seconds since 1/1/1970 (like time_t) when element was last modified */
long lCreationTime; /* Seconds since 1/1/1970 (like time_t) when element was created */
} TSteamElemInfo;
typedef struct
{
unsigned int uNumSubscriptions;
unsigned int uMaxNameChars;
unsigned int uMaxApps;
} TSteamSubscriptionStats;
typedef struct
{
unsigned int uNumApps;
unsigned int uMaxNameChars;
unsigned int uMaxInstallDirNameChars;
unsigned int uMaxVersionLabelChars;
unsigned int uMaxLaunchOptions;
unsigned int uMaxLaunchOptionDescChars;
unsigned int uMaxLaunchOptionCmdLineChars;
unsigned int uMaxNumIcons;
unsigned int uMaxIconSize;
unsigned int uMaxDependencies;
} TSteamAppStats;
typedef struct
{
char *szLabel;
unsigned int uMaxLabelChars;
unsigned int uVersionId;
int bIsNotAvailable;
} TSteamAppVersion;
typedef struct
{
char *szDesc;
unsigned int uMaxDescChars;
char *szCmdLine;
unsigned int uMaxCmdLineChars;
unsigned int uIndex;
unsigned int uIconIndex;
int bNoDesktopShortcut;
int bNoStartMenuShortcut;
int bIsLongRunningUnattended;
} TSteamAppLaunchOption;
typedef struct
{
char *szName;
unsigned int uMaxNameChars;
char *szLatestVersionLabel;
unsigned int uMaxLatestVersionLabelChars;
char *szCurrentVersionLabel;
unsigned int uMaxCurrentVersionLabelChars;
char *szInstallDirName;
unsigned int uMaxInstallDirNameChars;
unsigned int uId;
unsigned int uLatestVersionId;
unsigned int uCurrentVersionId;
unsigned int uMinCacheFileSizeMB;
unsigned int uMaxCacheFileSizeMB;
unsigned int uNumLaunchOptions;
unsigned int uNumIcons;
unsigned int uNumVersions;
unsigned int uNumDependencies;
} TSteamApp;
typedef enum
{
eNoCost = 0,
eBillOnceOnly = 1,
eBillMonthly = 2,
eProofOfPrepurchaseOnly = 3,
eGuestPass = 4,
eHardwarePromo = 5,
eNumBillingTypes,
} EBillingType;
typedef struct
{
char *szName;
unsigned int uMaxNameChars;
unsigned int *puAppIds;
unsigned int uMaxAppIds;
unsigned int uId;
unsigned int uNumApps;
EBillingType eBillingType;
unsigned int uCostInCents;
unsigned int uNumDiscounts;
int bIsPreorder;
int bRequiresShippingAddress;
unsigned int uDomesticShippingCostInCents;
unsigned int uInternationalShippingCostInCents;
bool bIsCyberCafeSubscription;
unsigned int uGameCode;
char szGameCodeDesc[STEAM_MAX_PATH];
bool bIsDisabled;
bool bRequiresCD;
unsigned int uTerritoryCode;
bool bIsSteam3Subscription;
} TSteamSubscription;
typedef struct
{
char szName[STEAM_MAX_PATH];
unsigned int uDiscountInCents;
unsigned int uNumQualifiers;
} TSteamSubscriptionDiscount;
typedef struct
{
char szName[STEAM_MAX_PATH];
unsigned int uRequiredSubscription;
int bIsDisqualifier;
} TSteamDiscountQualifier;
typedef struct TSteamProgress
{
int bValid; /* non-zero if call provides progress info */
unsigned int uPercentDone; /* 0 to 100 * STEAM_PROGRESS_PERCENT_SCALE if bValid */
char szProgress[STEAM_MAX_PATH]; /* additional progress info */
} TSteamProgress;
typedef enum
{
eSteamNotifyTicketsWillExpire,
eSteamNotifyAccountInfoChanged,
eSteamNotifyContentDescriptionChanged,
eSteamNotifyPleaseShutdown,
eSteamNotifyNewContentServer,
eSteamNotifySubscriptionStatusChanged,
eSteamNotifyContentServerConnectionLost,
eSteamNotifyCacheLoadingCompleted,
eSteamNotifyCacheNeedsDecryption,
eSteamNotifyCacheNeedsRepair
} ESteamNotificationCallbackEvent;
typedef void(*SteamNotificationCallback_t)(ESteamNotificationCallbackEvent eEvent, unsigned int nData);
typedef char SteamPersonalQuestion_t[ STEAM_QUESTION_MAXLEN + 1 ];
typedef struct
{
unsigned char uchSalt[STEAM_SALT_SIZE];
} SteamSalt_t;
typedef enum
{
eVisa = 1,
eMaster = 2,
eAmericanExpress = 3,
eDiscover = 4,
eDinnersClub = 5,
eJCB = 6
} ESteamPaymentCardType;
typedef struct
{
ESteamPaymentCardType eCardType;
char szCardNumber[ STEAM_CARD_NUMBER_SIZE +1 ];
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szCardExpYear[ STEAM_CARD_EXPYEAR_SIZE + 1 ];
char szCardExpMonth[ STEAM_CARD_EXPMONTH_SIZE+ 1 ];
char szCardCVV2[ STEAM_CARD_CVV2_SIZE + 1 ];
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
char szBillingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
char szBillingEmailAddress[ STEAM_BILLING_EMAIL_ADDRESS_SIZE + 1 ];
unsigned int uExpectedCostInCents;
unsigned int uExpectedTaxInCents;
/* If the TSteamSubscription says that shipping info is required, */
/* then the following fields must be filled out. */
/* If szShippingName is empty, then assumes so are the rest. */
char szShippingName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szShippingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szShippingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szShippingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szShippingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szShippingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szShippingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
char szShippingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
unsigned int uExpectedShippingCostInCents;
} TSteamPaymentCardInfo;
typedef struct
{
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
/* A ProofOfPurchase token is not necessarily a nul-terminated string; it may be binary data
(perhaps encrypted). Hence we need a length and an array of bytes. */
unsigned int uLengthOfBinaryProofOfPurchaseToken;
char cBinaryProofOfPurchaseToken[ STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE + 1 ];
} TSteamPrepurchaseInfo;
typedef struct
{
char szAccountName[ STEAM_EXTERNAL_ACCOUNTNAME_SIZE + 1 ];
char szPassword[ STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE + 1 ];
} TSteamExternalBillingInfo;
typedef enum
{
ePaymentCardInfo = 1,
ePrepurchasedInfo = 2,
eAccountBillingInfo = 3,
eExternalBillingInfo = 4, /* indirect billing via ISP etc (not supported yet) */
ePaymentCardReceipt = 5,
ePrepurchaseReceipt = 6,
eEmptyReceipt = 7
} ESteamSubscriptionBillingInfoType;
typedef struct
{
ESteamSubscriptionBillingInfoType eBillingInfoType;
union {
TSteamPaymentCardInfo PaymentCardInfo;
TSteamPrepurchaseInfo PrepurchaseInfo;
TSteamExternalBillingInfo ExternalBillingInfo;
char bUseAccountBillingInfo;
};
} TSteamSubscriptionBillingInfo;
typedef enum
{
/* Subscribed */
eSteamSubscriptionOK = 0, /* Subscribed */
eSteamSubscriptionPending = 1, /* Awaiting transaction completion */
eSteamSubscriptionPreorder = 2, /* Is currently a pre-order */
eSteamSubscriptionPrepurchaseTransferred = 3, /* hop to this account */
/* Unusbscribed */
eSteamSubscriptionPrepurchaseInvalid = 4, /* Invalid cd-key */
eSteamSubscriptionPrepurchaseRejected = 5, /* hopped out / banned / etc */
eSteamSubscriptionPrepurchaseRevoked = 6, /* hop away from this account */
eSteamSubscriptionPaymentCardDeclined = 7, /* CC txn declined */
eSteamSubscriptionCancelledByUser = 8, /* Cancelled by client */
eSteamSubscriptionCancelledByVendor = 9, /* Cancelled by us */
eSteamSubscriptionPaymentCardUseLimit = 10, /* Card used too many times, potential fraud */
eSteamSubscriptionPaymentCardAlert = 11, /* Got a "pick up card" or the like from bank */
eSteamSubscriptionFailed = 12, /* Other Error in subscription data or transaction failed/lost */
eSteamSubscriptionPaymentCardAVSFailure = 13, /* Card failed Address Verification check */
eSteamSubscriptionPaymentCardInsufficientFunds = 14, /* Card failed due to insufficient funds */
eSteamSubscriptionRestrictedCountry = 15 /* The subscription is not available in the user's country */
} ESteamSubscriptionStatus;
typedef struct
{
ESteamPaymentCardType eCardType;
char szCardLastFourDigits[ 4 + 1 ];
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
// The following are only available after the subscription leaves "pending" status
char szCardApprovalCode[ STEAM_BILLING_CARD_APPROVAL_CODE_SIZE + 1];
char szTransDate[ STEAM_BILLING_TRANS_DATE_SIZE + 1]; /* mm/dd/yy */
char szTransTime[ STEAM_BILLING_TRANS_TIME_SIZE + 1]; /* hh:mm:ss */
unsigned int uPriceWithoutTax;
unsigned int uTaxAmount;
unsigned int uShippingCost;
} TSteamPaymentCardReceiptInfo;
typedef struct
{
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
} TSteamPrepurchaseReceiptInfo;
typedef struct
{
ESteamSubscriptionStatus eStatus;
ESteamSubscriptionStatus ePreviousStatus;
ESteamSubscriptionBillingInfoType eReceiptInfoType;
char szConfirmationCode[ STEAM_BILLING_CONFIRMATION_CODE_SIZE + 1];
union {
TSteamPaymentCardReceiptInfo PaymentCardReceiptInfo;
TSteamPrepurchaseReceiptInfo PrepurchaseReceiptInfo;
};
} TSteamSubscriptionReceipt;
typedef enum
{
ePhysicalBytesReceivedThisSession = 1,
eAppReadyToLaunchStatus = 2,
eAppPreloadStatus = 3,
eAppEntireDepot = 4,
eCacheBytesPresent = 5
} ESteamAppUpdateStatsQueryType;
typedef struct
{
SteamUnsigned64_t uBytesTotal;
SteamUnsigned64_t uBytesPresent;
} TSteamUpdateStats;
typedef enum
{
eSteamUserAdministrator = 0x00000001, /* May subscribe, unsubscribe, etc */
eSteamUserDeveloper = 0x00000002, /* Steam or App developer */
eSteamUserCyberCafe = 0x00000004 /* CyberCafe, school, etc -- UI should ask for password */
/* before allowing logout, unsubscribe, etc */
} ESteamUserTypeFlags;
typedef enum
{
eSteamAccountStatusDefault = 0x00000000,
eSteamAccountStatusEmailVerified = 0x00000001,
/* Note: Mask value 0x2 is reserved for future use. (Some, but not all, public accounts already have this set.) */
eSteamAccountDisabled = 0x00000004
} ESteamAccountStatusBitFields ;
typedef enum
{
eSteamBootstrapperError = -1,
eSteamBootstrapperDontCheckForUpdate = 0,
eSteamBootstrapperCheckForUpdateAndRerun = 7
} ESteamBootStrapperClientAppResult;
typedef enum
{
eSteamOnline = 0,
eSteamOffline = 1,
eSteamNoAuthMode = 2,
eSteamBillingOffline = 3
} eSteamOfflineStatus;
typedef struct
{
int eOfflineNow;
int eOfflineNextSession;
} TSteamOfflineStatus;
typedef struct
{
unsigned int uAppId;
int bIsSystemDefined;
char szMountPath[STEAM_MAX_PATH];
} TSteamAppDependencyInfo;
typedef enum
{
eSteamOpenFileRegular = 0x0,
eSteamOpenFileIgnoreLocal = 0x1,
eSteamOpenFileChecksumReads = 0x2
} ESteamOpenFileFlags;
typedef enum
{
eSteamValveCDKeyValidationServer = 0,
eSteamHalfLifeMasterServer = 1,
eSteamFriendsServer = 2,
eSteamCSERServer = 3,
eSteamHalfLife2MasterServer = 4,
eSteamRDKFMasterServer = 5,
eMaxServerTypes = 6
} ESteamServerType;
/******************************************************************************
**
** More exported constants
**
******************************************************************************/
#ifdef __cplusplus
const SteamHandle_t STEAM_INVALID_HANDLE = 0;
const SteamCallHandle_t STEAM_INVALID_CALL_HANDLE = 0;
const SteamUserIDTicketValidationHandle_t STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE = 0;
const unsigned int STEAM_USE_LATEST_VERSION = 0xFFFFFFFF;
#else
#define STEAM_INVALID_HANDLE ((SteamHandle_t)(0))
#define STEAM_INVALID_CALL_HANDLE ((SteamCallHandle_t)(0))
#define STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE ((SteamUserIDTicketValidationHandle_t)(0))
#define STEAM_USE_LATEST_VERSION (0xFFFFFFFFu);
#endif
/******************************************************************************
** Each Steam instance (licensed Steam Service Provider) has a unique SteamInstanceID_t.
**
** Each Steam instance as its own DB of users.
** Each user in the DB has a unique SteamLocalUserID_t (a serial number, with possible
** rare gaps in the sequence).
**
******************************************************************************/
typedef unsigned short SteamInstanceID_t; // MUST be 16 bits
#if defined ( _WIN32 )
typedef unsigned __int64 SteamLocalUserID_t; // MUST be 64 bits
#else
typedef unsigned long long SteamLocalUserID_t; // MUST be 64 bits
#endif
/******************************************************************************
**
** Applications need to be able to authenticate Steam users from ANY instance.
** So a SteamIDTicket contains SteamGlobalUserID, which is a unique combination of
** instance and user id.
**
** SteamLocalUserID is an unsigned 64-bit integer.
** For platforms without 64-bit int support, we provide access via a union that splits it into
** high and low unsigned 32-bit ints. Such platforms will only need to compare LocalUserIDs
** for equivalence anyway - not perform arithmetic with them.
**
********************************************************************************/
typedef struct
{
unsigned int Low32bits;
unsigned int High32bits;
} TSteamSplitLocalUserID;
typedef struct
{
SteamInstanceID_t m_SteamInstanceID;
union
{
SteamLocalUserID_t As64bits;
TSteamSplitLocalUserID Split;
} m_SteamLocalUserID;
} TSteamGlobalUserID;
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,103 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Swap a compiled caption file.
//
// $NoKeywords: $
//=============================================================================//
#include "utlbuffer.h"
#include "byteswap.h"
#include "filesystem.h"
#include "tier2/fileutils.h"
#include "captioncompiler.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
BEGIN_BYTESWAP_DATADESC( CompiledCaptionHeader_t )
DEFINE_FIELD( magic, FIELD_INTEGER ),
DEFINE_FIELD( version, FIELD_INTEGER ),
DEFINE_FIELD( numblocks, FIELD_INTEGER ),
DEFINE_FIELD( blocksize, FIELD_INTEGER ),
DEFINE_FIELD( directorysize, FIELD_INTEGER ),
DEFINE_FIELD( dataoffset, FIELD_INTEGER ),
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( CaptionLookup_t )
DEFINE_FIELD( hash, FIELD_INTEGER ),
DEFINE_FIELD( blockNum, FIELD_INTEGER ),
DEFINE_FIELD( offset, FIELD_SHORT ),
DEFINE_FIELD( length, FIELD_SHORT ),
END_BYTESWAP_DATADESC()
//-----------------------------------------------------------------------------
// Swap a compiled closecaption file
//-----------------------------------------------------------------------------
bool SwapClosecaptionFile( void *pData )
{
CByteswap swap;
swap.ActivateByteSwapping( true );
CompiledCaptionHeader_t *pHdr = (CompiledCaptionHeader_t*)pData;
if ( IsX360() )
{
// pre-swap file header
swap.SwapFieldsToTargetEndian( pHdr );
}
if ( pHdr->magic != COMPILED_CAPTION_FILEID || pHdr->version != COMPILED_CAPTION_VERSION )
{
// bad data
return false;
}
// lookup headers
pData = (byte*)pData + sizeof(CompiledCaptionHeader_t);
swap.SwapFieldsToTargetEndian( (CaptionLookup_t*)pData, pHdr->directorysize );
// unicode data
pData = (byte*)pHdr + pHdr->dataoffset;
swap.SwapBufferToTargetEndian( (wchar_t*)pData, (wchar_t*)pData, pHdr->numblocks * pHdr->blocksize / sizeof(wchar_t) );
if ( IsPC() )
{
// post-swap file header
swap.SwapFieldsToTargetEndian( pHdr );
}
return true;
}
#if defined( CLIENT_DLL )
//-----------------------------------------------------------------------------
// Callback for UpdateOrCreate - generates .360 file
//-----------------------------------------------------------------------------
static bool CaptionCreateCallback( const char *pSourceName, const char *pTargetName, const char *pPathID, void *pExtraData )
{
// Generate the file
CUtlBuffer buf;
bool bOk = g_pFullFileSystem->ReadFile( pSourceName, pPathID, buf );
if ( bOk )
{
bOk = SwapClosecaptionFile( buf.Base() );
if ( bOk )
{
bOk = g_pFullFileSystem->WriteFile( pTargetName, pPathID, buf );
}
else
{
Warning( "Failed to create %s\n", pTargetName );
}
}
return bOk;
}
//-----------------------------------------------------------------------------
// Calls utility function UpdateOrCreate
//-----------------------------------------------------------------------------
int UpdateOrCreateCaptionFile( const char *pSourceName, char *pTargetName, int maxLen, bool bForce )
{
return ::UpdateOrCreate( pSourceName, pTargetName, maxLen, "GAME", CaptionCreateCallback, bForce );
}
#endif

425
common/hl2orange.spa.h Normal file
View File

@@ -0,0 +1,425 @@
////////////////////////////////////////////////////////////////////
//
// hl2orange.spa.h
//
// Auto-generated on Thursday, 13 September 2007 at 16:59:17
// XLAST project version 1.0.402.0
// SPA Compiler version 2.0.6274.0
//
////////////////////////////////////////////////////////////////////
#ifndef __THE_ORANGE_BOX_SPA_H__
#define __THE_ORANGE_BOX_SPA_H__
#ifdef __cplusplus
extern "C" {
#endif
//
// Title info
//
#define TITLEID_THE_ORANGE_BOX 0x4541080F
//
// Context ids
//
// These values are passed as the dwContextId to XUserSetContext.
//
#define CONTEXT_CHAPTER_HL2 0
#define CONTEXT_SCENARIO 1
#define CONTEXT_GAME 2
#define CONTEXT_CHAPTER_EP1 3
#define CONTEXT_CHAPTER_EP2 4
#define CONTEXT_CHAPTER_PORTAL 5
//
// Context values
//
// These values are passed as the dwContextValue to XUserSetContext.
//
// Values for CONTEXT_CHAPTER_HL2
#define CONTEXT_CHAPTER_HL2_POINT_INSERTION 0
#define CONTEXT_CHAPTER_HL2_A_RED_LETTER_DAY 1
#define CONTEXT_CHAPTER_HL2_ROUTE_KANAL 2
#define CONTEXT_CHAPTER_HL2_WATER_HAZARD 3
#define CONTEXT_CHAPTER_HL2_BLACK_MESA_EAST 4
#define CONTEXT_CHAPTER_HL2_RAVENHOLM 5
#define CONTEXT_CHAPTER_HL2_HIGHWAY_17 6
#define CONTEXT_CHAPTER_HL2_SANDTRAPS 7
#define CONTEXT_CHAPTER_HL2_NOVA_PROSPEKT 8
#define CONTEXT_CHAPTER_HL2_ENTANGLEMENT 9
#define CONTEXT_CHAPTER_HL2_ANTICITIZEN_ONE 10
#define CONTEXT_CHAPTER_HL2_FOLLOW_FREEMAN 11
#define CONTEXT_CHAPTER_HL2_OUR_BENEFACTORS 12
#define CONTEXT_CHAPTER_HL2_DARK_ENERGY 13
// Values for CONTEXT_SCENARIO
#define CONTEXT_SCENARIO_CTF_2FORT 0
#define CONTEXT_SCENARIO_CP_DUSTBOWL 1
#define CONTEXT_SCENARIO_CP_GRANARY 2
#define CONTEXT_SCENARIO_CP_WELL 3
#define CONTEXT_SCENARIO_CP_GRAVELPIT 4
#define CONTEXT_SCENARIO_TC_HYDRO 5
#define CONTEXT_SCENARIO_CTF_CLOAK 6
#define CONTEXT_SCENARIO_CP_CLOAK 7
// Values for CONTEXT_GAME
#define CONTEXT_GAME_GAME_HALF_LIFE_2 0
#define CONTEXT_GAME_GAME_EPISODE_ONE 1
#define CONTEXT_GAME_GAME_EPISODE_TWO 2
#define CONTEXT_GAME_GAME_PORTAL 3
#define CONTEXT_GAME_GAME_TEAM_FORTRESS 4
// Values for CONTEXT_CHAPTER_EP1
#define CONTEXT_CHAPTER_EP1_UNDUE_ALARM 0
#define CONTEXT_CHAPTER_EP1_DIRECT_INTERVENTION 1
#define CONTEXT_CHAPTER_EP1_LOWLIFE 2
#define CONTEXT_CHAPTER_EP1_URBAN_FLIGHT 3
#define CONTEXT_CHAPTER_EP1_EXIT_17 4
// Values for CONTEXT_CHAPTER_EP2
#define CONTEXT_CHAPTER_EP2_TO_THE_WHITE_FOREST 0
#define CONTEXT_CHAPTER_EP2_THIS_VORTAL_COIL 1
#define CONTEXT_CHAPTER_EP2_FREEMAN_PONTIFEX 2
#define CONTEXT_CHAPTER_EP2_RIDING_SHOTGUN 3
#define CONTEXT_CHAPTER_EP2_UNDER_THE_RADAR 4
#define CONTEXT_CHAPTER_EP2_OUR_MUTUAL_FIEND 5
#define CONTEXT_CHAPTER_EP2_T_MINUS_ONE 6
// Values for CONTEXT_CHAPTER_PORTAL
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_00 0
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_04 1
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_08 2
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_10 3
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_13 4
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_14 5
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_15 6
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_16 7
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_17 8
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_18 9
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_19 10
// Values for X_CONTEXT_PRESENCE
#define CONTEXT_PRESENCE_TF_CP 0
#define CONTEXT_PRESENCE_TF_CTF_LOSING 1
#define CONTEXT_PRESENCE_TF_CTF_TIED 2
#define CONTEXT_PRESENCE_TF_CTF_WINNING 3
#define CONTEXT_PRESENCE_APPCHOOSER 4
#define CONTEXT_PRESENCE_MENU 5
#define CONTEXT_PRESENCE_EP1_INGAME 6
#define CONTEXT_PRESENCE_HL2_INGAME 7
#define CONTEXT_PRESENCE_EP2_INGAME 8
#define CONTEXT_PRESENCE_PORTAL_INGAME 9
#define CONTEXT_PRESENCE_COMMENTARY 10
#define CONTEXT_PRESENCE_IDLE 11
// Values for X_CONTEXT_GAME_MODE
#define CONTEXT_GAME_MODE_MULTIPLAYER 0
#define CONTEXT_GAME_MODE_SINGLEPLAYER 1
//
// Property ids
//
// These values are passed as the dwPropertyId value to XUserSetProperty
// and as the dwPropertyId value in the XUSER_PROPERTY structure.
//
#define PROPERTY_CAPS_OWNED 0x10000000
#define PROPERTY_CAPS_TOTAL 0x10000001
#define PROPERTY_PLAYER_TEAM_SCORE 0x10000002
#define PROPERTY_OPPONENT_TEAM_SCORE 0x10000003
#define PROPERTY_FLAG_CAPTURE_LIMIT 0x1000000B
#define PROPERTY_NUMBER_OF_ROUNDS 0x1000000C
#define PROPERTY_GAME_SIZE 0x1000000D
#define PROPERTY_AUTOBALANCE 0x1000000E
#define PROPERTY_PRIVATE_SLOTS 0x1000000F
#define PROPERTY_MAX_GAME_TIME 0x10000010
#define PROPERTY_NUMBER_OF_KILLS 0x10000011
#define PROPERTY_DAMAGE_DEALT 0x10000012
#define PROPERTY_PLAY_TIME 0x10000013
#define PROPERTY_POINT_CAPTURES 0x10000014
#define PROPERTY_POINT_DEFENSES 0x10000015
#define PROPERTY_DOMINATIONS 0x10000016
#define PROPERTY_REVENGE 0x10000017
#define PROPERTY_BUILDINGS_DESTROYED 0x10000019
#define PROPERTY_HEADSHOTS 0x1000001A
#define PROPERTY_HEALTH_POINTS_HEALED 0x1000001B
#define PROPERTY_INVULNS 0x1000001C
#define PROPERTY_KILL_ASSISTS 0x1000001D
#define PROPERTY_BACKSTABS 0x1000001E
#define PROPERTY_HEALTH_POINTS_LEACHED 0x1000001F
#define PROPERTY_BUILDINGS_BUILT 0x10000020
#define PROPERTY_SENTRY_KILLS 0x10000021
#define PROPERTY_TELEPORTS 0x10000022
#define PROPERTY_KILLS 0x10000023
#define PROPERTY_NUMBER_OF_TEAMS 0x10000025
#define PROPERTY_TEAM_RED 0x10000026
#define PROPERTY_TEAM_BLUE 0x10000027
#define PROPERTY_TEAM_SPECTATOR 0x10000028
#define PROPERTY_TEAM 0x10000029
#define PROPERTY_WIN_LIMIT 0x1000002A
#define PROPERTY_RANKING_TEST 0x2000000A
#define PROPERTY_POINTS_SCORED 0x20000018
//
// Achievement ids
//
// These values are used in the dwAchievementId member of the
// XUSER_ACHIEVEMENT structure that is used with
// XUserWriteAchievements and XUserCreateAchievementEnumerator.
//
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHPHYSICS 43
#define ACHIEVEMENT_HLX_KILL_ENEMY_WITHHOPPERMINE 44
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHMANHACK 45
#define ACHIEVEMENT_HLX_KILL_SOLDIER_WITHHISGRENADE 46
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHONEENERGYBALL 47
#define ACHIEVEMENT_HLX_KILL_ELITESOLDIER_WITHHISENERGYBALL 48
#define ACHIEVEMENT_EPX_GET_ZOMBINEGRENADE 50
#define ACHIEVEMENT_EPX_KILL_ZOMBIES_WITHFLARES 51
#define ACHIEVEMENT_HL2_HIT_CANCOP_WITHCAN 52
#define ACHIEVEMENT_HL2_PUT_CANINTRASH 53
#define ACHIEVEMENT_HL2_ESCAPE_APARTMENTRAID 54
#define ACHIEVEMENT_HL2_BREAK_MINITELEPORTER 55
#define ACHIEVEMENT_HL2_GET_CROWBAR 56
#define ACHIEVEMENT_HL2_KILL_BARNACLESWITHBARREL 57
#define ACHIEVEMENT_HL2_GET_AIRBOAT 58
#define ACHIEVEMENT_HL2_GET_AIRBOATGUN 60
#define ACHIEVEMENT_HL2_FIND_VORTIGAUNTCAVE 61
#define ACHIEVEMENT_HL2_KILL_CHOPPER 62
#define ACHIEVEMENT_HL2_FIND_HEVFACEPLATE 63
#define ACHIEVEMENT_HL2_GET_GRAVITYGUN 64
#define ACHIEVEMENT_HL2_MAKEABASKET 65
#define ACHIEVEMENT_HL2_BEAT_RAVENHOLM_NOWEAPONS 66
#define ACHIEVEMENT_HL2_BEAT_CEMETERY 67
#define ACHIEVEMENT_HL2_KILL_ENEMIES_WITHCRANE 68
#define ACHIEVEMENT_HL2_PIN_SOLDIER_TOBILLBOARD 69
#define ACHIEVEMENT_HL2_KILL_ODESSAGUNSHIP 70
#define ACHIEVEMENT_HL2_KILL_THREEGUNSHIPS 71
#define ACHIEVEMENT_HL2_BEAT_DONTTOUCHSAND 72
#define ACHIEVEMENT_HL2_KILL_ENEMIES_WITHANTLIONS 74
#define ACHIEVEMENT_HL2_KILL_ENEMY_WITHTOILET 75
#define ACHIEVEMENT_HL2_BEAT_TURRETSTANDOFF2 76
#define ACHIEVEMENT_HL2_BEAT_TOXICTUNNEL 78
#define ACHIEVEMENT_HL2_BEAT_PLAZASTANDOFF 79
#define ACHIEVEMENT_HL2_KILL_ALLC1709SNIPERS 80
#define ACHIEVEMENT_HL2_BEAT_SUPRESSIONDEVICE 81
#define ACHIEVEMENT_HL2_BEAT_C1713STRIDERSTANDOFF 82
#define ACHIEVEMENT_HL2_BEAT_GAME 84
#define ACHIEVEMENT_HL2_FIND_ALLLAMBDAS 86
#define ACHIEVEMENT_EP1_BEAT_MAINELEVATOR 87
#define ACHIEVEMENT_EP1_BEAT_CITADELCORE 88
#define ACHIEVEMENT_EP1_BEAT_CITADELCORE_NOSTALKERKILLS 89
#define ACHIEVEMENT_EP1_KILL_ANTLIONS_WITHCARS 90
#define ACHIEVEMENT_EP1_BEAT_GARAGEELEVATORSTANDOFF 91
#define ACHIEVEMENT_EP1_KILL_ENEMIES_WITHSNIPERALYX 92
#define ACHIEVEMENT_EP1_BEAT_HOSPITALATTICGUNSHIP 93
#define ACHIEVEMENT_EP1_BEAT_CITIZENESCORT_NOCITIZENDEATHS 94
#define ACHIEVEMENT_EP1_BEAT_GAME 95
#define ACHIEVEMENT_EP1_BEAT_GAME_ONEBULLET 96
#define ACHIEVEMENT_EP2_KILL_POISONANTLION 97
#define ACHIEVEMENT_EP2_KILL_ALLGRUBS 98
#define ACHIEVEMENT_EP2_BREAK_ALLWEBS 99
#define ACHIEVEMENT_EP2_BEAT_ANTLIONINVASION 100
#define ACHIEVEMENT_EP2_BEAT_ANTLIONGUARDS 101
#define ACHIEVEMENT_EP2_KILL_ENEMIES_WITHCAR 102
#define ACHIEVEMENT_EP2_BEAT_HUNTERAMBUSH 103
#define ACHIEVEMENT_EP2_KILL_CHOPPER_NOMISSES 104
#define ACHIEVEMENT_EP2_KILL_COMBINECANNON 105
#define ACHIEVEMENT_EP2_FIND_ALLRADARCACHES 106
#define ACHIEVEMENT_EP2_BEAT_ROCKETCACHEPUZZLE 107
#define ACHIEVEMENT_EP2_BEAT_RACEWITHDOG 108
#define ACHIEVEMENT_EP2_BEAT_WHITEFORESTINN 109
#define ACHIEVEMENT_EP2_PUT_ITEMINROCKET 110
#define ACHIEVEMENT_EP2_BEAT_MISSILESILO2 111
#define ACHIEVEMENT_EP2_BEAT_OUTLAND12_NOBUILDINGSDESTROYED 112
#define ACHIEVEMENT_EP2_BEAT_GAME 113
#define ACHIEVEMENT_EP2_KILL_HUNTER_WITHFLECHETTES 114
#define ACHIEVEMENT_PORTAL_GET_PORTALGUNS 115
#define ACHIEVEMENT_PORTAL_KILL_COMPANIONCUBE 116
#define ACHIEVEMENT_PORTAL_ESCAPE_TESTCHAMBERS 117
#define ACHIEVEMENT_PORTAL_BEAT_GAME 118
#define ACHIEVEMENT_PORTAL_INFINITEFALL 119
#define ACHIEVEMENT_PORTAL_LONGJUMP 120
#define ACHIEVEMENT_PORTAL_BEAT_2ADVANCEDMAPS 121
#define ACHIEVEMENT_PORTAL_BEAT_4ADVANCEDMAPS 122
#define ACHIEVEMENT_PORTAL_BEAT_6ADVANCEDMAPS 123
#define ACHIEVEMENT_PORTAL_GET_ALLBRONZE 124
#define ACHIEVEMENT_PORTAL_GET_ALLSILVER 125
#define ACHIEVEMENT_PORTAL_GET_ALLGOLD 126
#define ACHIEVEMENT_TF_GET_TURRETKILLS 127
#define ACHIEVEMENT_TF_KILL_NEMESIS 128
#define ACHIEVEMENT_TF_GET_CONSECUTIVEKILLS_NODEATHS 129
#define ACHIEVEMENT_TF_GET_HEALED_BYENEMY 130
#define ACHIEVEMENT_TF_PLAY_GAME_FRIENDSONLY 131
#define ACHIEVEMENT_TF_WIN_MULTIPLEGAMES 132
#define ACHIEVEMENT_TF_GET_MULTIPLEKILLS 133
#define ACHIEVEMENT_TF_WIN_2FORT_NOENEMYCAPS 134
#define ACHIEVEMENT_TF_WIN_WELL_MINIMUMTIME 135
#define ACHIEVEMENT_TF_WIN_HYDRO_NOENEMYCAPS 136
#define ACHIEVEMENT_TF_WIN_DUSTBOWL_NOENEMYCAPS 137
#define ACHIEVEMENT_TF_WIN_GRAVELPIT_NOENEMYCAPS 138
#define ACHIEVEMENT_TF_PLAY_GAME_EVERYCLASS 139
#define ACHIEVEMENT_TF_PLAY_GAME_EVERYMAP 140
#define ACHIEVEMENT_TF_GET_HEALPOINTS 141
#define ACHIEVEMENT_TF_BURN_PLAYERSINMINIMIMTIME 142
#define ACHIEVEMENT_HL2_DISINTEGRATE_SOLDIERSINFIELD 143
#define ACHIEVEMENT_HL2_FOLLOW_FREEMAN 144
#define ACHIEVEMENT_TF_GET_HEADSHOTS 145
#define ACHIEVEMENT_PORTAL_DETACH_ALL_CAMERAS 146
#define ACHIEVEMENT_PORTAL_HIT_TURRET_WITH_TURRET 148
#ifndef _XBOX
#define ACHIEVEMENT_PORTAL_TRANSMISSION_RECEIVED 149
#define ACHIEVEMENT_TF_GENERAL_KILL_ENEMIES_AFTER_TELEPORTING 150
#endif // _XBOX
#define ACHIEVEMENT_TF_LAST_ORANGEBOX 150
// BriJee: Arctic Adventure achievement definitions
#define ACHIEVEMENT_AA_WELCOME_TO_ARCTIC 160
#define ACHIEVEMENT_AA_SURVIVE_THE_CHASE 161
#define ACHIEVEMENT_AA_DISCOVER_THE_SHIP 162
#define ACHIEVEMENT_AA_KILL_5_HEAVY_SOLDIERS 163
#define ACHIEVEMENT_AA_FIND_CUBE 164
#define ACHIEVEMENT_AA_FIND_CHUMTOAD 165
#define ACHIEVEMENT_AA_FIND_HAT 166
#define ACHIEVEMENT_AA_WAIT_FOR_PORTAL 167
#define ACHIEVEMENT_SHEP_FREE_SLAVES 168 //update 1
#define ACHIEVEMENT_SHEP_PUZZLE 169
#define ACHIEVEMENT_SHEP_STILLALIVE 170
#define ACHIEVEMENT_AA_SOFT_DRINKS 171
#define ACHIEVEMENT_AA_FIND_POTATOS 172
#define ACHIEVEMENT_AA2_SPECULATION 173 //update2
// BriJee: Overcharged Achievements goes here under name 200+
#define ACHIEVEMENT_OVR_ATAKMOZNO 200
#define ACHIEVEMENT_OVR_FREE_MAN 201
#define ACHIEVEMENT_OVR_DOORSTUCK 202
#define ACHIEVEMENT_OVR_BUSTED 203
#define ACHIEVEMENT_OVR_DANCINGSCANNER 204
#define ACHIEVEMENT_OVR_THE_AR3 205
#define ACHIEVEMENT_OVR_MEETXENIANS 206
#define ACHIEVEMENT_OVR_CREEDOF 207
#define ACHIEVEMENT_OVR_FINDSKULLS 208
#define ACHIEVEMENT_OVR_HEAVYWEAPONS 209
#define ACHIEVEMENT_OVR_CASTFROMPAST 210
#define ACHIEVEMENT_OVR_CRYSTALBMEAST 211
#define ACHIEVEMENT_OVR_MEMORIESOFBEAM 212
#define ACHIEVEMENT_OVR_CHANGEFIREMODES 213
#define ACHIEVEMENT_OVR_OLDHEVFIND 214
#define ACHIEVEMENT_OVR_WORKDIGGIN 215
#define ACHIEVEMENT_OVR_LIKEFATHER 216
#define ACHIEVEMENT_OVR_SPORERULES 217
#define ACHIEVEMENT_OVR_TESTDRIVE 218
#define ACHIEVEMENT_OVR_ELISPRIDE 219
#define ACHIEVEMENT_OVR_DONTLETIT 220
#define ACHIEVEMENT_OVR_THATSSOCUTE 221
#define ACHIEVEMENT_OVR_PORTABILITY 222
#define ACHIEVEMENT_OVR_WALKINGONCOAST 223
#define ACHIEVEMENT_OVR_COMBINEDREVENGE 224
#define ACHIEVEMENT_OVR_BATTLEOFTECH 225
#define ACHIEVEMENT_OVR_MONTANAMANSION 226
#define ACHIEVEMENT_OVR_FIGHTINDARK 227
#define ACHIEVEMENT_OVR_NOTIME 228
#define ACHIEVEMENT_OVR_VISINVIS 229
#define ACHIEVEMENT_OVR_VICEVERSA 230
#define ACHIEVEMENT_OVR_GNOMED 231
#define ACHIEVEMENT_OVR_DOUBLEREACT 232
#define ACHIEVEMENT_OVR_NOALCO 233
#define ACHIEVEMENT_OVR_KNOWYOURENEMY 234
#define ACHIEVEMENT_OVR_LASTMANANDVORT 235
//
// Stats view ids
//
// These are used in the dwViewId member of the XUSER_STATS_SPEC structure
// passed to the XUserReadStats* and XUserCreateStatsEnumerator* functions.
//
// Skill leaderboards for ranked game modes
#define STATS_VIEW_SKILL_RANKED_MULTIPLAYER 0xFFFF0000
#define STATS_VIEW_SKILL_RANKED_SINGLEPLAYER 0xFFFF0001
// Skill leaderboards for unranked (standard) game modes
#define STATS_VIEW_SKILL_STANDARD_MULTIPLAYER 0xFFFE0000
#define STATS_VIEW_SKILL_STANDARD_SINGLEPLAYER 0xFFFE0001
// Title defined leaderboards
#define STATS_VIEW_PLAYER_MAX_UNRANKED 1
#define STATS_VIEW_PLAYER_MAX_RANKED 2
//
// Stats view column ids
//
// These ids are used to read columns of stats views. They are specified in
// the rgwColumnIds array of the XUSER_STATS_SPEC structure. Rank, rating
// and gamertag are not retrieved as custom columns and so are not included
// in the following definitions. They can be retrieved from each row's
// header (e.g., pStatsResults->pViews[x].pRows[y].dwRank, etc.).
//
// Column ids for PLAYER_MAX_UNRANKED
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINTS_SCORED 2
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_KILLS 3
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINTS_CAPPED 1
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_DAMAGE_DEALT 4
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_PLAY_TIME 5
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINT_DEFENSES 6
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_DOMINATIONS 7
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_REVENGE 8
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BUILDINGS_DESTROYED 9
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEADSHOTS 10
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEALTH_POINTS_HEALED 11
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_INVULNS 12
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_KILL_ASSISTS 13
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BACKSTABS 14
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEALTH_POINTS_LEACHED 15
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BUILDINGS_BUILT 16
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_SENTRY_KILLS 17
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_TELEPORTS 18
// Column ids for PLAYER_MAX_RANKED
#define STATS_COLUMN_PLAYER_MAX_RANKED_POINTS_SCORED 2
//
// Matchmaking queries
//
// These values are passed as the dwProcedureIndex parameter to
// XSessionSearch to indicate which matchmaking query to run.
//
#define SESSION_MATCH_QUERY_PLAYER_MATCH 0
//
// Gamer pictures
//
// These ids are passed as the dwPictureId parameter to XUserAwardGamerTile.
//
#ifdef __cplusplus
}
#endif
#endif // __THE_ORANGE_BOX_SPA_H__

217
common/language.cpp Normal file
View File

@@ -0,0 +1,217 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: languages definition
//
//=============================================================================
#include "language.h"
#include "tier0/dbg.h"
#include "tier1/strtools.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
struct Language_t
{
const char *m_pchName;
const char *m_pchShortName;
const char *m_pchVGUILocalizationName;
const char *m_pchICUName; // used by osx; ISO-639-1 + ISO-3166-1 alpha-2. http://userguide.icu-project.org/locale/examples
ELanguage m_ELanguage;
int m_LanguageCodeID;
};
// REVIEW
// es_ES - use new world spanish country code instead?
// zh_CN - validate that SC date formats come through
// bt_BR - assume we should use Brazilian rather than Iberian portguese
static const Language_t s_LanguageNames[] =
{
{ "None", "none", "None", "none", k_Lang_None, 0 },
{ "English", "english", "#GameUI_Language_English", "en_US", k_Lang_English, 1033 },
{ "German", "german", "#GameUI_Language_German", "de_DE", k_Lang_German, 1031 } ,
{ "French", "french", "#GameUI_Language_French", "fr_FR", k_Lang_French, 1036 } ,
{ "Italian", "italian", "#GameUI_Language_Italian", "it_IT", k_Lang_Italian, 1040 } ,
{ "Korean", "koreana", "#GameUI_Language_Korean", "ko_KR", k_Lang_Korean, 1042 } ,
{ "Spanish", "spanish", "#GameUI_Language_Spanish", "es_ES", k_Lang_Spanish, 1034 },
{ "Simplified_Chinese", "schinese", "#GameUI_Language_Simplified_Chinese", "zh_CN", k_Lang_Simplified_Chinese, 2052 },
{ "Traditional_Chinese", "tchinese", "#GameUI_Language_Traditional_Chinese", "zh_TW", k_Lang_Traditional_Chinese, 1028 },
{ "Russian", "russian", "#GameUI_Language_Russian", "ru_RU", k_Lang_Russian, 1049 } ,
{ "Thai", "thai", "#GameUI_Language_Thai", "th_TH", k_Lang_Thai, 1054 } ,
{ "Japanese", "japanese", "#GameUI_Language_Japanese", "ja_JP", k_Lang_Japanese, 1041 } ,
{ "Portuguese", "portuguese", "#GameUI_Language_Portuguese", "pt_PT", k_Lang_Portuguese, 2070 } ,
{ "Polish", "polish", "#GameUI_Language_Polish", "pl_PL", k_Lang_Polish, 1045 } ,
{ "Danish", "danish", "#GameUI_Language_Danish", "da_DK", k_Lang_Danish, 1030 } ,
{ "Dutch", "dutch", "#GameUI_Language_Dutch", "nl_NL", k_Lang_Dutch, 1043 } ,
{ "Finnish", "finnish", "#GameUI_Language_Finnish", "fi_FI", k_Lang_Finnish, 1035 } ,
{ "Norwegian", "norwegian", "#GameUI_Language_Norwegian", "no_NO", k_Lang_Norwegian, 1044 } ,
{ "Swedish", "swedish", "#GameUI_Language_Swedish", "sv_SE", k_Lang_Swedish, 1053 } ,
{ "Romanian", "romanian", "#GameUI_Language_Romanian", "ro_RO", k_Lang_Romanian, 1048 } ,
{ "Turkish", "turkish", "#GameUI_Language_Turkish", "tr_TR", k_Lang_Turkish, 1055 } ,
{ "Hungarian", "hungarian", "#GameUI_Language_Hungarian", "hu_HU", k_Lang_Hungarian, 1038 } ,
{ "Czech", "czech", "#GameUI_Language_Czech", "cs_CZ", k_Lang_Czech, 1029 } ,
{ "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 } ,
{ "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 } ,
{ "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 },
};
//-----------------------------------------------------------------------------
// Purpose: translate language enum into closests windows language code ID
//-----------------------------------------------------------------------------
int GetLanguageCodeID(ELanguage eLang)
{
for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang )
{
if ( s_LanguageNames[iLang].m_ELanguage == eLang )
return s_LanguageNames[iLang].m_LanguageCodeID;
}
// default to English
return 1033;
}
//-----------------------------------------------------------------------------
// Purpose: find the language by name
//-----------------------------------------------------------------------------
ELanguage PchLanguageToELanguage( const char *pchShortName, ELanguage eDefault )
{
Assert( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
if ( !pchShortName )
return eDefault;
for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang )
{
if ( !Q_stricmp( pchShortName, s_LanguageNames[iLang].m_pchShortName ) )
{
return s_LanguageNames[iLang].m_ELanguage;
}
}
// return default
return eDefault;
}
//-----------------------------------------------------------------------------
// Purpose: find the language by ICU short code
//-----------------------------------------------------------------------------
ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefault )
{
Assert( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
if ( !pchICUCode )
return eDefault;
// Match to no more than the param length so either a short 'en' or
// full 'zh-Hant' can match
int nLen = Q_strlen( pchICUCode );
// we only have 5 character ICU codes so this should be enough room
char rchCleanedCode[ 6 ];
Q_strncpy( rchCleanedCode, pchICUCode, Q_ARRAYSIZE( rchCleanedCode ) );
if( nLen >= 3 && rchCleanedCode[ 2 ] == '-' )
{
rchCleanedCode[ 2 ] = '_';
}
for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang )
{
if ( !Q_strnicmp( rchCleanedCode, s_LanguageNames[iLang].m_pchICUName, nLen ) )
{
return s_LanguageNames[iLang].m_ELanguage;
}
}
// return default
return eDefault;
}
//-----------------------------------------------------------------------------
// Purpose: return the short string name used for this language by SteamUI
//-----------------------------------------------------------------------------
const char *GetLanguageShortName( ELanguage eLang )
{
COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang )
{
Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) );
return s_LanguageNames[ eLang + 1 ].m_pchShortName;
}
Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" );
return s_LanguageNames[0].m_pchShortName;
}
//-----------------------------------------------------------------------------
// Purpose: return the ICU code used for this language by SteamUI
//-----------------------------------------------------------------------------
const char *GetLanguageICUName( ELanguage eLang )
{
COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang )
{
Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) );
return s_LanguageNames[ eLang + 1 ].m_pchICUName;
}
Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" );
return s_LanguageNames[0].m_pchICUName;
}
//-----------------------------------------------------------------------------
// Purpose: return the CLocale name that works with setlocale()
//-----------------------------------------------------------------------------
const char *GetLangugeCLocaleName( ELanguage eLang )
{
if ( eLang == k_Lang_None )
return "";
#ifdef _WIN32
// table for Win32 is here: http://msdn.microsoft.com/en-us/library/hzz3tw78(v=VS.80).aspx
// shortname works except for chinese
switch ( eLang )
{
case k_Lang_Simplified_Chinese:
return "chs"; // or "chinese-simplified"
case k_Lang_Traditional_Chinese:
return "cht"; // or "chinese-traditional"
case k_Lang_Korean:
return "korean"; // steam likes "koreana" for the name for some reason.
default:
return GetLanguageShortName( eLang );
}
#else
switch ( eLang )
{
case k_Lang_Simplified_Chinese:
case k_Lang_Traditional_Chinese:
return "zh_CN";
default:
;
}
// ICU codes work on linux/osx
return GetLanguageICUName( eLang );
#endif
}
//-----------------------------------------------------------------------------
// Purpose: return the short string name used for this language by SteamUI
//-----------------------------------------------------------------------------
const char *GetLanguageVGUILocalization( ELanguage eLang )
{
COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang )
{
Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) );
return s_LanguageNames[ eLang + 1 ].m_pchVGUILocalizationName;
}
Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" );
return s_LanguageNames[0].m_pchVGUILocalizationName;
}

55
common/language.h Normal file
View File

@@ -0,0 +1,55 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: represent a canonical list of the languages we support,
//
//=============================================================================
#ifndef LANG_H
#define LANG_H
#ifdef _WIN32
#pragma once
#endif
// if you change this enum also change language.cpp:s_LanguageNames
enum ELanguage
{
k_Lang_None = -1,
k_Lang_First = 0,
k_Lang_English = 0,
k_Lang_German,
k_Lang_French,
k_Lang_Italian,
k_Lang_Korean,
k_Lang_Spanish,
k_Lang_Simplified_Chinese,
k_Lang_Traditional_Chinese,
k_Lang_Russian,
k_Lang_Thai,
k_Lang_Japanese,
k_Lang_Portuguese,
k_Lang_Polish,
k_Lang_Danish,
k_Lang_Dutch,
k_Lang_Finnish,
k_Lang_Norwegian,
k_Lang_Swedish,
k_Lang_Romanian,
k_Lang_Turkish,
k_Lang_Hungarian,
k_Lang_Czech,
k_Lang_Brazilian,
k_Lang_Bulgarian,
k_Lang_Greek,
k_Lang_MAX
};
#define FOR_EACH_LANGUAGE( eLang ) for ( int eLang = (int)k_Lang_First; eLang < k_Lang_MAX; ++eLang )
ELanguage PchLanguageToELanguage(const char *pchShortName, ELanguage eDefault = k_Lang_English);
ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefault = k_Lang_English );
const char *GetLanguageShortName( ELanguage eLang );
const char *GetLanguageICUName( ELanguage eLang );
const char *GetLanguageVGUILocalization( ELanguage eLang );
const char *GetLanguageName( ELanguage eLang );
#endif /* LANG_H */

53
common/lzma/lzma.h Normal file
View File

@@ -0,0 +1,53 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: LZMA Glue. Designed for Tool time Encoding/Decoding.
//
// LZMA Codec interface for engine. Based largely on LzmaUtil.c in SDK
//
// LZMA SDK 9.38 beta
// 2015-01-03 : Igor Pavlov : Public domain
// http://www.7-zip.org/
//
//====================================================================================//
#ifndef LZMA_H
#define LZMA_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
// These routines are designed for TOOL TIME encoding/decoding on the PC!
// They have not been made to encode/decode on the PPC and lack big endian awarnesss.
// Lightweight GAME TIME Decoding is part of tier1.lib, via CLZMA.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Encoding glue. Returns non-null Compressed buffer if successful.
// Caller must free.
//-----------------------------------------------------------------------------
unsigned char *LZMA_Compress(
unsigned char *pInput,
unsigned int inputSize,
unsigned int *pOutputSize );
//-----------------------------------------------------------------------------
// Decoding glue. Returns TRUE if succesful.
//-----------------------------------------------------------------------------
bool LZMA_Uncompress(
unsigned char *pInput,
unsigned char **ppOutput,
unsigned int *pOutputSize );
//-----------------------------------------------------------------------------
// Decoding helper, returns TRUE if buffer is LZMA compressed.
//-----------------------------------------------------------------------------
bool LZMA_IsCompressed( unsigned char *pInput );
//-----------------------------------------------------------------------------
// Decoding helper, returns non-zero size of data when uncompressed, otherwise 0.
//-----------------------------------------------------------------------------
unsigned int LZMA_GetActualSize( unsigned char *pInput );
#endif

49
common/proto_version.h Normal file
View File

@@ -0,0 +1,49 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#if !defined( PROTO_VERSION_H )
#define PROTO_VERSION_H
#ifdef _WIN32
#pragma once
#endif
// The current network protocol version. Changing this makes clients and servers incompatible
#define PROTOCOL_VERSION 24
#define DEMO_BACKWARDCOMPATABILITY
// For backward compatibility of demo files (NET_MAX_PAYLOAD_BITS went away)
#define PROTOCOL_VERSION_23 23
// For backward compatibility of demo files (sound index bits used to = 13 )
#define PROTOCOL_VERSION_22 22
// For backward compatibility of demo files (before the special DSP was shipped to public)
#define PROTOCOL_VERSION_21 21
// For backward compatibility of demo files (old-style dynamic model loading)
#define PROTOCOL_VERSION_20 20
// For backward compatibility of demo files (post Halloween sound flag extra bit)
#define PROTOCOL_VERSION_19 19
// For backward compatibility of demo files (pre Halloween sound flag extra bit)
#define PROTOCOL_VERSION_18 18
// For backward compatibility of demo files (MD5 in map version)
#define PROTOCOL_VERSION_17 17
// For backward compatibility of demo files (create string tables compression flag)
#define PROTOCOL_VERSION_14 14
// For backward compatibility of demo files
#define PROTOCOL_VERSION_12 12
// The PROTOCOL_VERSION when replay shipped to public
#define PROTOCOL_VERSION_REPLAY 16
#endif

35
common/qlimits.h Normal file
View File

@@ -0,0 +1,35 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef QLIMITS_H
#define QLIMITS_H
#if defined( _WIN32 )
#pragma once
#endif
// DATA STRUCTURE INFO
#define MAX_NUM_ARGVS 50
// SYSTEM INFO
#define MAX_QPATH 96 // max length of a game pathname
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define ON_EPSILON 0.1 // point on plane side epsilon
// Resource counts;
#define MAX_MODEL_INDEX_BITS 12 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
#endif // QLIMITS_H

27
common/randoverride.cpp Normal file
View File

@@ -0,0 +1,27 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
#include "stdlib.h"
#include "vstdlib/random.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#ifdef GNUC
#define __cdecl
#endif
void __cdecl srand(unsigned int)
{
}
int __cdecl rand()
{
return RandomInt( 0, VALVE_RAND_MAX );
}
#endif // !_STATIC_LINKED || _SHARED_LIB

View File

@@ -0,0 +1,43 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef REPLAYSERIALIIZEABLE_H
#define REPLAYSERIALIIZEABLE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/ireplayserializeable.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
class CBaseReplaySerializeable : public IReplaySerializeable
{
public:
CBaseReplaySerializeable();
virtual void SetHandle( ReplayHandle_t h );
virtual ReplayHandle_t GetHandle() const;
virtual bool Read( KeyValues *pIn );
virtual void Write( KeyValues *pOut );
virtual const char *GetFilename() const;
virtual const char *GetFullFilename() const;
virtual const char *GetDebugName() const;
virtual void SetLocked( bool bLocked );
virtual bool IsLocked() const;
virtual void OnDelete();
virtual void OnUnload();
virtual void OnAddedToDirtyList();
private:
ReplayHandle_t m_hThis;
bool m_bLocked;
};
//----------------------------------------------------------------------------------------
#endif // REPLAYSERIALIIZEABLE_H

View File

@@ -0,0 +1,64 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef ICLIENTREPLAY_H
#define ICLIENTREPLAY_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
#define CLIENT_REPLAY_INTERFACE_VERSION "ClientReplay001"
//----------------------------------------------------------------------------------------
class IReplayFactory;
class IReplayScreenshotSystem;
class IReplayPerformancePlaybackHandler;
class KeyValues;
class IReplayCamera;
class CReplayPerformance;
struct RenderMovieParams_t;
class IGameEvent;
//----------------------------------------------------------------------------------------
//
// Allows the replay and engine DLL's to talk to the client.
//
class IClientReplay : public IBaseInterface
{
public:
virtual uint64 GetServerSessionId() = 0;
virtual bool CacheReplayRagdolls( const char* pFilename, int nStartTick ) = 0; // Cache replay ragdolls
virtual IReplayScreenshotSystem *GetReplayScreenshotSystem() = 0; // Get the client's replay screenshot system
virtual IReplayPerformancePlaybackHandler *GetPerformancePlaybackHandler() = 0;
virtual IReplayCamera *GetReplayCamera() = 0;
virtual void DisplayReplayMessage( const char *pLocalizeStr, bool bUrgent, bool bDlg, const char *pSound ) = 0;
virtual void DisplayReplayMessage( const wchar_t *pText, bool bUrgent, bool bDlg, const char *pSound ) = 0;
virtual void InitPerformanceEditor( ReplayHandle_t hReplay ) = 0;
virtual void HidePerformanceEditor() = 0;
virtual bool ShouldRender() = 0;
virtual void PlaySound( const char *pSound ) = 0;
virtual void UploadOgsData( KeyValues *pData, bool bIncludeTimeField ) = 0;
virtual bool ShouldCompletePendingReplay( IGameEvent *pEvent ) = 0;
virtual void OnSaveReplay( ReplayHandle_t hNewReplay, bool bShowInputDlg ) = 0;
virtual void OnDeleteReplay( ReplayHandle_t hReplay ) = 0; // Called before replay is actually removed from the replay manager
virtual void OnPlaybackComplete( ReplayHandle_t hReplay, int iPerformance ) = 0;
virtual void OnRenderStart() = 0;
virtual void OnRenderComplete( const RenderMovieParams_t &RenderParams, bool bCancelled, bool bSuccess, bool bShowBrowser ) = 0;
virtual bool OnConfirmQuit() = 0;
virtual bool OnEndOfReplayReached() = 0;
};
//----------------------------------------------------------------------------------------
#endif // ICLIENTREPLAY_H

View File

@@ -0,0 +1,58 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef ICLIENTREPLAYCONTEXT_H
#define ICLIENTREPLAYCONTEXT_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/ireplaycontext.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
#define REPLAYHISTORYMANAGER_INTERFACE_VERSION_CLIENT "VENGINE_CLIENT_REPLAY_HISTORY_MANAGER_001"
//----------------------------------------------------------------------------------------
class CReplay;
class CReplayPerformance;
class IReplayManager;
class IReplayMovieManager;
class IReplayMovieRenderer;
class IReplayScreenshotManager;
class IReplayPerformanceManager;
class IReplayPerformanceController;
class IReplayRenderQueue;
//----------------------------------------------------------------------------------------
class IClientReplayContext : public IReplayContext
{
public:
virtual CReplay *GetReplay( ReplayHandle_t hReplay ) = 0; // Shorthand to GetReplayManager()->GetReplay()
virtual IReplayManager *GetReplayManager() = 0;
virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
virtual IReplayMovieManager *GetMovieManager() = 0;
virtual IReplayScreenshotManager *GetScreenshotManager() = 0;
virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
virtual IReplayPerformanceController *GetPerformanceController() = 0;
virtual IReplayRenderQueue *GetRenderQueue() = 0;
virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
virtual void OnSignonStateFull() = 0;
virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance, bool bPlaySound ) = 0; // Play the given replay, from spawn tick to death tick
virtual bool ReconstructReplayIfNecessary( CReplay *pReplay ) = 0;
virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
virtual void GetPlaybackTimes( float &flOutTime, float &flOutLength, const CReplay *pReplay, const CReplayPerformance *pPerformance ) = 0; // Calculate the current time and length of a replay or performance - takes in tick and out tick into account for performances - flCurTime should be gpGlobals->curtime. pPerformance can be NULL.
virtual uint64 GetServerSessionId( ReplayHandle_t hReplay ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // ICLIENTREPLAYCONTEXT_H

View File

@@ -0,0 +1,104 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef ICLIENTREPLAYHISTORYMANAGER_H
#define ICLIENTREPLAYHISTORYMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/replayhandle.h"
#include "replay/screenshot.h"
#include "interface.h"
#include "qlimits.h"
#include "convar.h"
#include "engine/http.h"
#include "tier1/utllinkedlist.h"
#include "tier1/checksum_crc.h"
#include <time.h>
//----------------------------------------------------------------------------------------
class IReplayDownloadGroup;
class IReplayDownloadGroupHelper;
class CDmxElement;
class KeyValues;
struct CaptureScreenshotParams_t;
struct RenderMovieParams_t;
class CBaseReplay;
class CReplay;
class IReplayMovieRenderer;
class IReplayMovieManager;
class IReplayMovie;
class IReplayPerformanceManager;
class IGameEvent;
//----------------------------------------------------------------------------------------
class IClientReplayHistoryManager : public IBaseInterface
{
public:
virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
virtual void Shutdown() = 0;
virtual void Think() = 0;
virtual bool IsInitialized() const = 0;
virtual bool Commit( CBaseReplay *pNewReplay ) = 0;
virtual void Save() = 0; // Write the entire index and any replays/groups/movies that are marked as dirty
virtual void FlagReplayForFlush( CBaseReplay *pReplay, bool bForceImmediateWrite ) = 0; // Mark the given replay as dirty - flush to disk at the next opportunity (see CBaseReplayHistoryManager::FlushThink())
virtual void Nuke() = 0;
virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
virtual CBaseReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
virtual const char *GetBaseDirectory() = 0; // Returns full directory to wherever replays.dmx lives, e.g. c:\program files (x86)\steam\steamapps\someuser\team fortress 2\game\tf\replays\client\ (or server\) - NOTE: includes trailing slash
virtual const char *GetReplaysSubDir() = 0; // Returns "client" or "server"
// For loop through all replays - indices should not be cached
virtual int GetReplayCount() const = 0;
// virtual CBaseReplay *GetReplayAtIndex( int nIndex ) = 0;
virtual const char *GetFullReplayPath() = 0; // Get c:\...\game\tf\replays\<client or server>\
// Client-specific
virtual int GetAdjustedDeathTick( CReplay *pReplay ) = 0;
virtual void FlagDownloadGroupForFlush( IReplayDownloadGroup *pGroup, bool bForceImmediate ) = 0;
virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bForceImmediate ) = 0; // Flag the movie for flush - if pMovie is NULL, mark the index for flush
virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
virtual bool ShouldGameRenderView() = 0; // Called from V_RenderView() to determine whether the game should render - used during movie rendering
virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
virtual void UpdateCurrentReplayDataFromServer() = 0; // Updates start tick, current file url, demo filename
virtual void LinkReplayToDownloadGroup() = 0;
virtual void CaptureScreenshot( CaptureScreenshotParams_t &params ) = 0; // Schedules a screenshot capture at flDelay seconds in the future
virtual void DoCaptureScreenshot() = 0; // Takes the screenshot right now
virtual bool ShouldCaptureScreenshot() = 0; // Is screenshot scheduled to be taken right now?
virtual void GetUnpaddedScreenshotSize( int &nWidth, int &nHeight ) = 0; // Get the dimensions for a screenshot if we take one right now, based on replay_screenshotresolution and the current aspect ratio
virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0; // Deletes all screenshots associated with the given replay
virtual void PlayReplay( ReplayHandle_t hReplay ) = 0; // Play the given replay, from spawn tick to death tick
virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
virtual void CompleteRender( bool bSuccess ) = 0;
virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
virtual void OnSignonStateFull() = 0;
virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
virtual void OnReplayRecordingCvarChanged() = 0; // Called (on client only) when replay_recording is set to 1
virtual void OnGroupDeleted() = 0;
virtual CReplay *GetPlayingReplay() = 0; // Get the currently playing replay, otherwise NULL if one isn't playing
virtual CReplay *GetReplayForCurrentLife() = 0; // Gets the current replay (constant from local player spawn until next spawn/disconnect/exit)
virtual bool IsRendering() = 0; // Are we currently rendering a movie?
virtual void CancelRender() = 0; // If we're currently rendering, cancel
virtual IReplayMovieManager *GetMovieManager() = 0;
virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
virtual const RenderMovieParams_t *GetRenderSettings() = 0;
virtual IReplayDownloadGroupHelper *GetDownloadGroupHelper() = 0;
virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
};
//----------------------------------------------------------------------------------------
#endif // ICLIENTREPLAYHISTORYMANAGER_H

View File

@@ -0,0 +1,116 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IENGINEREPLAY_H
#define IENGINEREPLAY_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
#define ENGINE_REPLAY_INTERFACE_VERSION "EngineReplay001"
#if !defined( DEDICATED )
# define ENGINE_REPLAY_CLIENT_INTERFACE_VERSION "EngineClientReplay001"
#endif
//----------------------------------------------------------------------------------------
class IServer;
class INetChannel;
class IReplayServer;
class IClientEntityList;
class IClientReplay;
struct demoheader_t;
class CGlobalVarsBase;
class IDemoBuffer;
class CBaseRecordingSessionBlock;
//----------------------------------------------------------------------------------------
//
// Allows the replay, client & server DLL's to talk to the engine
//
class IEngineReplay : public IBaseInterface
{
public:
virtual bool IsSupportedModAndPlatform() = 0;
virtual float GetHostTime() = 0;
virtual int GetHostTickCount() = 0;
virtual int TimeToTicks( float flTime ) = 0;
virtual float TicksToTime( int nTick ) = 0;
virtual bool ReadDemoHeader( const char *pFilename, demoheader_t &header ) = 0;
virtual const char *GetGameDir() = 0;
virtual void Cbuf_AddText( const char *pCmd ) = 0;
virtual void Cbuf_Execute() = 0;
virtual void Host_Disconnect( bool bShowMainMenu ) = 0;
virtual void HostState_Shutdown() = 0;
virtual const char *GetModDir() = 0;
virtual bool CopyFile( const char *pSource, const char *pDest ) = 0;
virtual bool LZSS_Compress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
virtual bool LZSS_Decompress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
virtual bool MD5_HashBuffer( unsigned char pDigest[16], const unsigned char *pBuffer, int nSize, unsigned int pSeed[4] ) = 0;
// Server-specific
virtual IReplayServer *GetReplayServer() = 0;
virtual IServer *GetReplayServerAsIServer() = 0;
virtual IServer *GetGameServer() = 0;
virtual bool GetSessionRecordBuffer( uint8 **ppSessionBuffer, int *pSize ) = 0;
virtual bool IsDedicated() = 0;
virtual void ResetReplayRecordBuffer() = 0;
virtual demoheader_t *GetReplayDemoHeader() = 0;
virtual void RecalculateTags() = 0;
virtual bool NET_GetHostnameAsIP( const char *pHostname, char *pOut, int nOutSize ) = 0;
};
//
// Allows the replay and client DLL's to talk to the engine
//
#if !defined( DEDICATED )
class IEngineClientReplay : public IBaseInterface
{
public:
virtual INetChannel *GetNetChannel() = 0;
virtual bool IsConnected() = 0;
virtual bool IsListenServer() = 0;
virtual float GetLastServerTickTime() = 0;
virtual const char *GetLevelName() = 0;
virtual const char *GetLevelNameShort() = 0;
virtual int GetPlayerSlot() = 0;
virtual bool IsPlayingReplayDemo() = 0;
virtual IClientEntityList *GetClientEntityList() = 0;
virtual IClientReplay *GetClientReplayInt() = 0;
virtual uint32 GetClientSteamID() = 0;
virtual void Con_NPrintf( int nPos, PRINTF_FORMAT_STRING const char *pFormat, ... ) = 0;
virtual CGlobalVarsBase *GetClientGlobalVars() = 0;
virtual void VGui_PlaySound( const char *pSound ) = 0;
virtual void EngineVGui_ConfirmQuit() = 0;
virtual int GetScreenWidth() = 0;
virtual int GetScreenHeight() = 0;
virtual bool IsDemoPlayingBack() = 0;
virtual bool IsGamePathValidAndSafeForDownload( const char *pGamePath ) = 0;
virtual bool IsInGame() = 0;
virtual void InitSoundRecord() = 0;
virtual void Wave_CreateTmpFile( const char *pFilename ) = 0;
virtual void Wave_AppendTmpFile( const char *pFilename, void *pBuffer, int nNumSamples ) = 0;
virtual void Wave_FixupTmpFile( const char *pFilename ) = 0;
};
#endif // !defined( DEDICATED )
//----------------------------------------------------------------------------------------
#endif // IENGINEREPLAY_H

View File

@@ -0,0 +1,46 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IQUERYABLEREPLAYITEM_H
#define IQUERYABLEREPLAYITEM_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "iqueryablereplayitem.h"
#include "replay/replayhandle.h"
#include "replay/replaytime.h"
//----------------------------------------------------------------------------------------
class CReplay;
//----------------------------------------------------------------------------------------
typedef int QueryableReplayItemHandle_t;
//----------------------------------------------------------------------------------------
abstract_class IQueryableReplayItem : public IBaseInterface
{
public:
virtual const CReplayTime &GetItemDate() const = 0;
virtual bool IsItemRendered() const = 0;
virtual CReplay *GetItemReplay() = 0;
virtual ReplayHandle_t GetItemReplayHandle() const = 0;
virtual QueryableReplayItemHandle_t GetItemHandle() const = 0; // Get the handle of this item
virtual const wchar_t *GetItemTitle() const = 0;
virtual void SetItemTitle( const wchar_t *pTitle ) = 0;
virtual float GetItemLength() const = 0;
virtual void *GetUserData() = 0;
virtual void SetUserData( void *pUserData ) = 0;
virtual bool IsItemAMovie() const = 0;
};
//----------------------------------------------------------------------------------------
#endif // IQUERYABLEREPLAYITEM_H

View File

@@ -0,0 +1,27 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IRECORDINGSESSION_H
#define IRECORDINGSESSION_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CBaseRecordingSessionBlock;
class IRecordingSession : public IBaseInterface
{
public:
virtual void AddBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IRECORDINGSESSION_H

View File

@@ -0,0 +1,30 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IRECORDINGSESSIONBLOCKMANAGER_H
#define IRECORDINGSESSIONBLOCKMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
class IRecordingSessionBlockManager : public IBaseInterface
{
public:
virtual CBaseRecordingSessionBlock *GetBlock( ReplayHandle_t hBlock ) = 0;
virtual void DeleteBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
virtual void UnloadBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
virtual const char *GetBlockPath() const = 0;
virtual void LoadBlockFromFileName( const char *pFilename, IRecordingSession *pSession ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IRECORDINGSESSIONBLOCKMANAGER_H

View File

@@ -0,0 +1,33 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IRECORDINGSESSIONMANAGER_H
#define IRECORDINGSESSIONMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
class CBaseRecordingSession;
//----------------------------------------------------------------------------------------
class IRecordingSessionManager : public IBaseInterface
{
public:
virtual CBaseRecordingSession *FindSession( ReplayHandle_t hSession ) = 0;
virtual const CBaseRecordingSession *FindSession( ReplayHandle_t hSession ) const = 0;
virtual void FlagSessionForFlush( CBaseRecordingSession *pSession, bool bForceImmediate ) = 0;
virtual int GetServerStartTickForSession( ReplayHandle_t hSession ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IRECORDINGSESSIONMANAGER_H

View File

@@ -0,0 +1,25 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//----------------------------------------------------------------------------------------
#ifndef IREPLAYCAMERA_H
#define IREPLAYCAMERA_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
abstract_class IReplayCamera : public IBaseInterface
{
public:
virtual void ClearOverrideView() = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYCAMERA_H

View File

@@ -0,0 +1,47 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYCONTEXT_H
#define IREPLAYCONTEXT_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
class IRecordingSessionManager;
class IRecordingSessionBlockManager;
class IRecordingSession;
class IReplayErrorSystem;
//----------------------------------------------------------------------------------------
class IReplayContext : public IBaseInterface
{
public:
virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
virtual void Shutdown() = 0;
virtual void Think() = 0;
virtual bool IsInitialized() const = 0;
virtual const char *GetRelativeBaseDir() const = 0; // Returns path to wherever the index .dmx lives relative to the game path, e.g. "replay\client\"
virtual const char *GetBaseDir() const = 0; // Returns full directory to wherever the index .dmx lives, e.g. c:\program files (x86)\steam\steamapps\<username>\team fortress 2\tf\replays\<client|server>\ -- NOTE: includes trailing slash
virtual const char *GetReplaySubDir() const = 0; // Returns "client" or "server"
virtual IReplayErrorSystem *GetErrorSystem() = 0;
virtual IRecordingSessionManager *GetRecordingSessionManager() = 0;
virtual IRecordingSessionBlockManager *GetRecordingSessionBlockManager() = 0;
virtual IRecordingSession *GetRecordingSession( ReplayHandle_t hSession ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYCONTEXT_H

View File

@@ -0,0 +1,42 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYDEMOPLAYER_H
#define IREPLAYDEMOPLAYER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replay.h"
//----------------------------------------------------------------------------------------
#define INTERFACEVERSION_REPLAYDEMOPLAYER "ReplayDemoPlayer001"
//----------------------------------------------------------------------------------------
//
// Interface for replay demo player
//
class IReplayDemoPlayer : public IBaseInterface
{
public:
virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance ) = 0;
virtual void PlayNextReplay() = 0;
virtual void ClearReplayList() = 0;
virtual void AddReplayToList( ReplayHandle_t hReplay, int iPerformance ) = 0;
virtual CReplay *GetCurrentReplay() = 0;
virtual CReplayPerformance *GetCurrentPerformance() = 0; // The playing replay, or NULL if playing the original replay
virtual void PauseReplay() = 0;
virtual bool IsReplayPaused() = 0;
virtual void ResumeReplay() = 0;
virtual void OnSignonStateFull() = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYDEMOPLAYER_H

View File

@@ -0,0 +1,33 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYERRORSYSYTEM_H
#define IREPLAYERRORSYSYTEM_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class KeyValues;
//----------------------------------------------------------------------------------------
//
// Replay error system
//
class IReplayErrorSystem : public IBaseInterface
{
public:
virtual void AddErrorFromTokenName( const char *pToken ) = 0;
virtual void AddFormattedErrorFromTokenName( const char *pFormatToken, KeyValues *pFormatArgs ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYERRORSYSYTEM_H

View File

@@ -0,0 +1,31 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYFACTORY_H
#define IREPLAYFACTORY_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CReplay;
//----------------------------------------------------------------------------------------
abstract_class IReplayFactory : public IBaseInterface
{
public:
virtual CReplay *Create() = 0;
};
#define INTERFACE_VERSION_REPLAY_FACTORY "IReplayFactory001"
//----------------------------------------------------------------------------------------
#endif // IREPLAYFACTORY_H

View File

@@ -0,0 +1,42 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYMANAGER_H
#define IREPLAYMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
#include "utllinkedlist.h"
//----------------------------------------------------------------------------------------
class CReplay;
class IQueryableReplayItem;
//----------------------------------------------------------------------------------------
class IReplayManager : public IBaseInterface
{
public:
virtual CReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
virtual CReplay *GetPlayingReplay() = 0;
virtual CReplay *GetReplayForCurrentLife() = 0;
virtual void FlagReplayForFlush( CReplay *pReplay, bool bForceImmediate ) = 0;
virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
virtual int GetReplayCount() const = 0;
virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
virtual void GetReplays( CUtlLinkedList< CReplay *, int > &lstReplays ) = 0;
virtual void GetReplaysAsQueryableItems( CUtlLinkedList< IQueryableReplayItem *, int > &lstReplays ) = 0;
virtual float GetDownloadProgress( const CReplay *pReplay ) = 0;
virtual const char *GetReplaysDir() const = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYMANAGER_H

View File

@@ -0,0 +1,42 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYMOVIE_H
#define IREPLAYMOVIE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "iqueryablereplayitem.h"
#include "replay/rendermovieparams.h"
//----------------------------------------------------------------------------------------
abstract_class IReplayMovie : public IQueryableReplayItem
{
public:
virtual ReplayHandle_t GetMovieHandle() const = 0;
virtual ReplayHandle_t GetReplayHandle() const = 0;
virtual const ReplayRenderSettings_t &GetRenderSettings() = 0;
virtual void GetFrameDimensions( int &nWidth, int &nHeight ) = 0;
virtual void SetIsRendered( bool bIsRendered ) = 0;
virtual void SetMovieFilename( const char *pFilename ) = 0;
virtual const char *GetMovieFilename() const = 0;
virtual void SetMovieTitle( const wchar_t *pTitle ) = 0;
virtual void SetRenderTime( float flRenderTime ) = 0;
virtual float GetRenderTime() const = 0;
virtual void CaptureRecordTime() = 0;
virtual void SetLength( float flLength ) = 0;
virtual bool IsUploaded() const = 0;
virtual void SetUploaded( bool bUploaded ) = 0;
virtual void SetUploadURL( const char *pURL ) = 0;
virtual const char *GetUploadURL() const = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYMOVIE_H

View File

@@ -0,0 +1,56 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYMOVIEMANAGER_H
#define IREPLAYMOVIEMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "utlstring.h"
#include "utllinkedlist.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
class IReplayMovie;
class CReplay;
struct RenderMovieParams_t;
class IQueryableReplayItem;
//----------------------------------------------------------------------------------------
abstract_class IReplayMovieManager : public IBaseInterface
{
public:
virtual int GetMovieCount() = 0;
virtual void GetMovieList( CUtlLinkedList< IReplayMovie * > &list ) = 0; // Fills the list with all movies
virtual IReplayMovie *GetMovie( ReplayHandle_t hMovie ) = 0;
virtual IReplayMovie *CreateAndAddMovie( ReplayHandle_t hReplay ) = 0; // Creates and adds a movie based on the given replay
virtual void DeleteMovie( ReplayHandle_t hMovie ) = 0; // Delete a movie
virtual int GetNumMoviesDependentOnReplay( const CReplay *pReplay ) = 0; // Get the number of movies that depend on the given replay
virtual void GetCachedMovieTitleAndClear( wchar_t *pOut, int nOutBufLength ) = 0; // TODO: This is a hack - fix this
virtual void SetPendingMovie( IReplayMovie *pMovie ) = 0;
virtual IReplayMovie *GetPendingMovie() = 0;
virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bImmediate ) = 0;
virtual void GetMoviesAsQueryableItems( CUtlLinkedList< IQueryableReplayItem *, int > &lstMovies ) = 0;
virtual const char *GetRenderDir() const = 0;
virtual const char *GetRawExportDir() const = 0;
// TODO: Is this the best place for code that actually manages rendering?
virtual bool IsRendering() const = 0;
virtual bool RenderingCancelled() const = 0;
virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
virtual void RenderNextMovie() = 0;
virtual void CompleteRender( bool bSuccess, bool bShowBrowser ) = 0;
virtual void CancelRender() = 0;
virtual void ClearRenderCancelledFlag() = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYMOVIEMANAGER_H

View File

@@ -0,0 +1,33 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYMOVIERENDERER_H
#define IREPLAYMOVIERENDERER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
class IReplayMovie;
struct RenderMovieParams_t;
//----------------------------------------------------------------------------------------
abstract_class IReplayMovieRenderer : public IBaseInterface
{
public:
virtual bool SetupRenderer( RenderMovieParams_t &params, IReplayMovie *pMovie ) = 0;
virtual void ShutdownRenderer() = 0;
virtual void RenderVideo() = 0;
virtual void RenderAudio( unsigned char *pBuffer, int nSize, int nNumSamples ) = 0;
virtual void SetAudioSyncFrame( bool isSync = false ) = 0;
virtual bool IsAudioSyncFrame() = 0;
virtual float GetRecordingFrameDuration() = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYMOVIERENDERER_H

View File

@@ -0,0 +1,107 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYPERFORMANCECONTROLLER_H
#define IREPLAYPERFORMANCECONTROLLER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "tier1/strtools.h"
//----------------------------------------------------------------------------------------
class IReplayPerformanceEditor;
class CReplay;
class Vector;
class QAngle;
class CReplayPerformance;
//----------------------------------------------------------------------------------------
// These values are what we use to represent
struct SetViewParams_t
{
SetViewParams_t() { V_memset( this, 0, sizeof( SetViewParams_t ) ); }
SetViewParams_t( float flTime, Vector *pOrigin, QAngle *pAngles, float flFov, float flAccel,
float flSpeed, float flRotFilter )
: m_flTime( flTime ),
m_pOrigin( pOrigin ),
m_pAngles( pAngles ),
m_flFov( flFov ),
m_flAccel( flAccel ),
m_flSpeed( flSpeed ),
m_flRotationFilter( flRotFilter )
{
}
float m_flTime;
Vector *m_pOrigin;
QAngle *m_pAngles;
float m_flFov;
// Right now only used for updating UI during playback:
float m_flAccel;
float m_flSpeed;
float m_flRotationFilter;
};
//----------------------------------------------------------------------------------------
class IReplayPerformanceController : public IBaseInterface
{
public:
virtual void SetEditor( IReplayPerformanceEditor *pEditor ) = 0;
virtual bool IsPlaybackDataLeft() = 0;
virtual void StartRecording( CReplay *pReplay, bool bSnip ) = 0;
virtual void NotifyRewinding() = 0;
virtual void Stop() = 0;
virtual bool SaveAsync() = 0;
virtual bool SaveAsAsync( const wchar *pTitle ) = 0;
virtual bool IsSaving() const = 0;
virtual void SaveThink() = 0;
virtual bool GetLastSaveStatus() const = 0;
virtual bool IsRecording() const = 0;
virtual bool IsPlaying() const = 0;
virtual bool IsDirty() const = 0;
virtual void NotifyDirty() = 0;
virtual CReplayPerformance *GetPerformance() = 0;
virtual CReplayPerformance *GetSavedPerformance() = 0;
virtual bool HasSavedPerformance() = 0;
virtual void NotifyPauseState( bool bPaused ) = 0;
virtual void ClearRewinding() = 0;
virtual void OnSignonStateFull() = 0;
virtual float GetPlaybackTimeScale() const = 0;
//
// Recorder-specific:
//
virtual void AddEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
virtual void AddEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
virtual void AddEvent_Camera_Change_Free( float flTime ) = 0;
virtual void AddEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
virtual void AddEvent_Camera_SetView( const SetViewParams_t &params ) = 0;
virtual void AddEvent_TimeScale( float flTime, float flScale ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPERFORMANCECONTROLLER_H

View File

@@ -0,0 +1,33 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYPERFORMANCEEDITOR_H
#define IREPLAYPERFORMANCEEDITOR_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CReplay;
//----------------------------------------------------------------------------------------
//
// Interface to allow the replay DLL to talk to the actual UI.
//
class IReplayPerformanceEditor : public IBaseInterface
{
public:
virtual CReplay *GetReplay() = 0;
virtual void OnRewindComplete() = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPERFORMANCEEDITOR_H

View File

@@ -0,0 +1,36 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYPERFORMANCEMANAGER_H
#define IREPLAYPERFORMANCEMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CReplayPerformance;
class CReplay;
//----------------------------------------------------------------------------------------
class IReplayPerformanceManager : public IBaseInterface
{
public:
virtual CReplayPerformance *CreatePerformance( CReplay *pReplay ) = 0;
virtual void DeletePerformance( CReplayPerformance *pPerformance ) = 0;
virtual const char *GetRelativePath() const = 0;
virtual const char *GetFullPath() const = 0;
virtual const char *GeneratePerformanceFilename( CReplay *pReplay ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPERFORMANCEMANAGER_H

View File

@@ -0,0 +1,36 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYPERFORMANCEPLAYBACKHANDLER_H
#define IREPLAYPERFORMANCEPLAYBACKHANDLER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/ireplayperformancecontroller.h"
//----------------------------------------------------------------------------------------
class Vector;
class QAngle;
//----------------------------------------------------------------------------------------
class IReplayPerformancePlaybackHandler : public IBaseInterface
{
public:
virtual void OnEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
virtual void OnEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
virtual void OnEvent_Camera_Change_Free( float flTime ) = 0;
virtual void OnEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
virtual void OnEvent_Camera_SetView( const SetViewParams_t &params ) = 0;
virtual void OnEvent_TimeScale( float flTime, float flScale ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPERFORMANCEPLAYBACKHANDLER_H

View File

@@ -0,0 +1,33 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYPERFORMANCEPLAYER_H
#define IREPLAYPERFORMANCEPLAYER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CReplay;
class CReplayPerformance;
//----------------------------------------------------------------------------------------
class IReplayPerformancePlayer : public IBaseInterface
{
public:
virtual void BeginPerformancePlay( CReplayPerformance *pPerformance ) = 0;
virtual void EndPerformancePlay() = 0;
virtual bool IsPlaying() const = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPERFORMANCEPLAYER_H

View File

@@ -0,0 +1,49 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYPERFORMANCERECORDER_H
#define IREPLAYPERFORMANCERECORDER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CReplay;
class Vector;
class QAngle;
class CReplayPerformance;
//----------------------------------------------------------------------------------------
class IReplayPerformanceRecorder : public IBaseInterface
{
public:
virtual void BeginPerformanceRecord( CReplay *pReplay ) = 0;
virtual void EndPerformanceRecord() = 0;
virtual void NotifyPauseState( bool bPaused ) = 0;
virtual CReplayPerformance *GetPerformance() = 0;
virtual bool IsRecording() const = 0;
virtual void SnipAtTime( float flTime ) = 0;
virtual void NotifySkipping() = 0;
virtual void ClearSkipping() = 0;
virtual void AddEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
virtual void AddEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
virtual void AddEvent_Camera_Change_Free( float flTime ) = 0;
virtual void AddEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
virtual void AddEvent_Camera_SetView( float flTime, const Vector& origin, const QAngle &angles, float fov ) = 0;
virtual void AddEvent_Slowmo( float flTime, float flScale ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPERFORMANCERECORDER_H

View File

@@ -0,0 +1,41 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//----------------------------------------------------------------------------------------
#ifndef IREPLAYPLAYERCACHE_H
#define IREPLAYPLAYERCACHE_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h"
//----------------------------------------------------------------------------------------
#define REPLAYPLAYERCACHE_INTERFACE_VERSION "VENGINE_REPLAY_PLAYER_CACHE_001"
//----------------------------------------------------------------------------------------
abstract_class IReplayPlayerCache : public IBaseInterface
{
public:
virtual bool Init() = 0;
virtual void Shutdown() = 0;
virtual void SetupPlayer( int nEntIndex ) = 0;
virtual void DeletePlayerEntry( int nEntIndex ) = 0;
virtual bool PlayerHasCacheEntry( int nEntIndex ) = 0;
virtual void SetPlayerClass( int nEntIndex, const char *pPlayerClass ) = 0;
virtual void SetPlayerSpawnTick( int nEntIndex, int nTick ) = 0;
virtual void SetPlayerDeathTick( int nEntIndex, int nTick ) = 0;
virtual const char *GetPlayerClass( int nEntIndex ) = 0;
virtual int GetPlayerSpawnTick( int nEntIndex ) = 0;
virtual int GetPlayerDeathTick( int nEntIndex ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYPLAYERCACHE_H

View File

@@ -0,0 +1,32 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYRENDERQUEUE_H
#define IREPLAYRENDERQUEUE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
abstract_class IReplayRenderQueue : IBaseInterface
{
public:
virtual void Add( ReplayHandle_t hReplay, int iPerformance ) = 0;
virtual void Remove( ReplayHandle_t hReplay, int iPerformance ) = 0;
virtual void Clear() = 0;
virtual int GetCount() const = 0;
virtual bool GetEntryData( int iIndex, ReplayHandle_t *pHandleOut, int *pPerformanceOut ) const = 0;
virtual bool IsInQueue( ReplayHandle_t hReplay, int iPerformance ) const = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYRENDERQUEUE_H

View File

@@ -0,0 +1,32 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYSCREENSHOTMANAGER_H
#define IREPLAYSCREENSHOTMANAGER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class CReplay;
struct CaptureScreenshotParams_t;
//----------------------------------------------------------------------------------------
class IReplayScreenshotManager : public IBaseInterface
{
public:
virtual void CaptureScreenshot( CaptureScreenshotParams_t& params ) = 0;
virtual void GetUnpaddedScreenshotSize( int &nOutWidth, int &nOutHeight ) = 0;
virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYSCREENSHOTMANAGER_H

View File

@@ -0,0 +1,34 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYSCREENSHOTSYSTEM_H
#define IREPLAYSCREENSHOTSYSTEM_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
struct WriteReplayScreenshotParams_t;
//----------------------------------------------------------------------------------------
//
// Implementation lives in the client - allows replay to tell the client to grab a
// screenshot or update the cache.
//
class IReplayScreenshotSystem : public IBaseInterface
{
public:
virtual void WriteReplayScreenshot( WriteReplayScreenshotParams_t &params ) = 0;
virtual void UpdateReplayScreenshotCache() = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYSCREENSHOTSYSTEM_H

View File

@@ -0,0 +1,48 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYSERIALIIZEABLE_H
#define IREPLAYSERIALIIZEABLE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
#include "replay/replayhandle.h"
//----------------------------------------------------------------------------------------
class KeyValues;
//----------------------------------------------------------------------------------------
class IReplaySerializeable : public IBaseInterface
{
public:
virtual void SetHandle( ReplayHandle_t h ) = 0;
virtual ReplayHandle_t GetHandle() const = 0;
virtual bool Read( KeyValues *pIn ) = 0;
virtual void Write( KeyValues *pOut ) = 0;
virtual const char *GetSubKeyTitle() const = 0;
virtual const char *GetFilename() const = 0;
virtual const char *GetPath() const = 0;
virtual const char *GetFullFilename() const = 0;
virtual void SetLocked( bool bLocked ) = 0;
virtual bool IsLocked() const = 0;
virtual void OnDelete() = 0;
virtual void OnUnload() = 0;
virtual const char *GetDebugName() const = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYSERIALIIZEABLE_H

View File

@@ -0,0 +1,48 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#ifndef IREPLAYSERVER_H
#define IREPLAYSERVER_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
#include "interface.h"
//-----------------------------------------------------------------------------
class IServer;
class IReplayDirector;
class IGameEvent;
struct netadr_s;
class CServerReplay;
//-----------------------------------------------------------------------------
// Interface the Replay module exposes to the engine
//-----------------------------------------------------------------------------
#define INTERFACEVERSION_REPLAYSERVER "ReplayServer001"
class IReplayServer : public IBaseInterface
{
public:
virtual ~IReplayServer() {}
virtual IServer *GetBaseServer() = 0; // get Replay base server interface
virtual IReplayDirector *GetDirector() = 0; // get director interface
virtual int GetReplaySlot() = 0; // return entity index-1 of Replay in game
virtual float GetOnlineTime() = 0; // seconds since broadcast started
virtual void BroadcastEvent(IGameEvent *event) = 0; // send a director command to all specs
virtual bool IsRecording() = 0;
virtual void StartRecording() = 0;
virtual void StopRecording() = 0;
};
#endif

View File

@@ -0,0 +1,27 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYSESSIONRECORDER_H
#define IREPLAYSESSIONRECORDER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class IReplaySessionRecorder : public IBaseInterface
{
public:
virtual void StartRecording() = 0;
virtual void StopRecording( bool bAborting ) = 0;
virtual void SetCurrentRecordingStartTick( int nStartTick ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // IREPLAYSESSIONRECORDER_H

View File

@@ -0,0 +1,60 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IREPLAYSYSTEM_H
#define IREPLAYSYSTEM_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "appframework/IAppSystem.h"
//----------------------------------------------------------------------------------------
class IClientReplayContext;
class IServerReplayContext;
class IGameEvent;
//----------------------------------------------------------------------------------------
abstract_class IReplaySystem : public IAppSystem
{
public:
// IAppSystem:
virtual bool Connect( CreateInterfaceFn fnFactory ) = 0;
virtual void Disconnect() = 0;
virtual InitReturnVal_t Init() = 0;
virtual void Shutdown() = 0;
// To be called client- & server-side
virtual void Think() = 0;
virtual bool IsReplayEnabled() = 0;
virtual bool IsRecording() = 0;
// To be called client-side only - on dedicated servers, only subs defined
virtual bool CL_Init( CreateInterfaceFn fnClientFactory ) = 0;
virtual void CL_Shutdown() = 0;
virtual void CL_Render() = 0;
virtual IClientReplayContext *CL_GetContext() = 0;
// To be called server-side only
virtual bool SV_Init( CreateInterfaceFn fnFactory ) = 0;
virtual void SV_Shutdown() = 0;
virtual void SV_EndRecordingSession( bool bForceSynchronousPublish = false ) = 0;
virtual void SV_SendReplayEvent( const char *pEventName, int nClientSlot ) = 0;
virtual void SV_SendReplayEvent( IGameEvent *pEvent, int nClientSlot ) = 0;
virtual bool SV_ShouldBeginRecording( bool bIsInWaitingForPlayers ) = 0;
virtual void SV_NotifyReplayRequested() = 0;
virtual IServerReplayContext *SV_GetContext() = 0;
};
//----------------------------------------------------------------------------------------
#define REPLAY_INTERFACE_VERSION "ReplaySystem001"
//----------------------------------------------------------------------------------------
#endif // IREPLAYSYSTEM_H

View File

@@ -0,0 +1,27 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef ISERVERENGINE_H
#define ISERVERENGINE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
class IReplayServerEngine : public IBaseInterface
{
public:
virtual void EndReplayRecordingSession() = 0;
virtual bool IsReplayRecording() = 0;
virtual bool IsReplay() = 0;
};
//----------------------------------------------------------------------------------------
#endif // ISERVERENGINE_H

View File

@@ -0,0 +1,37 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef ISERVERREPLAY_H
#define ISERVERREPLAY_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "interface.h"
//----------------------------------------------------------------------------------------
#define SERVER_REPLAY_INTERFACE_VERSION "ServerReplay001"
//----------------------------------------------------------------------------------------
class IReplayFactory;
class KeyValues;
//----------------------------------------------------------------------------------------
//
// Allows the replay DLL to talk to the server
//
class IServerReplay : public IBaseInterface
{
public:
virtual void UploadOgsData( KeyValues *pData, bool bIncludeTimeField ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // ISERVERREPLAY_H

View File

@@ -0,0 +1,38 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef ISERVERREPLAYCONTEXT_H
#define ISERVERREPLAYCONTEXT_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/ireplaycontext.h"
//----------------------------------------------------------------------------------------
class IGameEvent;
class IReplaySessionRecorder;
//----------------------------------------------------------------------------------------
#define REPLAYHISTORYMANAGER_INTERFACE_VERSION_SERVER "VENGINE_SERVER_REPLAY_HISTORY_MANAGER_001"
//----------------------------------------------------------------------------------------
class IServerReplayContext : public IReplayContext
{
public:
virtual void FlagForConVarSanityCheck() = 0; // Checks replay_enable / replay_local_fileserver_path / replay_downloadurlport / replay_downloadurlpath
virtual IGameEvent *CreateReplaySessionInfoEvent() = 0; // Create "replay_sessioninfo" event w/ appropriate fields filled in
virtual IReplaySessionRecorder *GetSessionRecorder() = 0;
virtual const char *GetLocalFileServerPath() const = 0; // Returns the local path where session blocks and such should be published for download
virtual void CreateSessionOnClient( int nClientSlot ) = 0;
};
//----------------------------------------------------------------------------------------
#endif // ISERVERREPLAYCONTEXT_H

View File

@@ -0,0 +1,63 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef REPLAYPERFORMANCE_H
#define REPLAYPERFORMANCE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "shared_defs.h"
#include "qlimits.h"
//----------------------------------------------------------------------------------------
class CReplay;
class KeyValues;
//----------------------------------------------------------------------------------------
class CReplayPerformance
{
public:
CReplayPerformance( CReplay *pReplay );
inline bool HasInTick() const { return m_nTickIn >= 0; }
inline bool HasOutTick() const { return m_nTickOut >= 0; }
inline int GetTickIn() const { return m_nTickIn; }
inline int GetTickOut() const { return m_nTickOut; }
void Copy( const CReplayPerformance *pSrc );
void CopyTicks( const CReplayPerformance *pSrc );
void SetFilename( const char *pFilename );
const char *GetFullPerformanceFilename();
void AutoNameIfHasNoTitle( const char *pMapName );
void SetTitle( const wchar_t *pTitle );
// NOTE: Doesn't copy exactly - gets a valid filename for the returned performance.
CReplayPerformance *MakeCopy() const;
void Read( KeyValues *pIn );
void Write( KeyValues *pOut );
// NOTE: Any changes made here should be reflected in the copy constructor
// (which is called from MakeCopy()).
wchar_t m_wszTitle[MAX_TAKE_TITLE_LENGTH];
char m_szBaseFilename[ MAX_OSPATH ];
CReplay *m_pReplay;
int m_nTickIn;
int m_nTickOut;
private:
CReplayPerformance( const CReplayPerformance *pPerformance );
};
//----------------------------------------------------------------------------------------
#endif // REPLAYPERFORMANCE_H

View File

@@ -0,0 +1,62 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef RENDERMOVIEPARAMS_H
#define RENDERMOVIEPARAMS_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "tier1/utlstring.h"
#include "tier1/strtools.h"
#include "replay/replayhandle.h"
#include "replay/shared_defs.h"
#include "video/ivideoservices.h"
//----------------------------------------------------------------------------------------
typedef unsigned int MovieHandle_t;
struct RenderMovieParams_t
{
inline RenderMovieParams_t() : m_iPerformance( -1 ) { V_memset( this, 0, sizeof( RenderMovieParams_t ) ); m_Settings.m_FPS.SetFPS( 0, false ); }
ReplayHandle_t m_hReplay;
int m_iPerformance; // -1 for default view, otherwise this is an index into the replay's m_vecPerformances vector.
wchar_t m_wszTitle[MAX_REPLAY_TITLE_LENGTH];
char m_szVideoPreset[64];
char m_szExtension[16]; // File extension
bool m_bQuitWhenFinished;
bool m_bExportRaw; // Export movie as raw TGA frames and a .WAV
float m_flEngineFps;
struct ReplayRenderSettings_t
{
uint16 m_nWidth;
uint16 m_nHeight;
int8 m_nMotionBlurQuality; // [0,MAX_MOTION_BLUR_QUALITY]
VideoFrameRate_t m_FPS; // Actual framerate can be calculated with m_FPS.GetFps()
VideoEncodeCodec_t m_Codec;
bool m_bMotionBlurEnabled; // Motion blur enabled?
bool m_bAAEnabled; // Antialiasing enabled?
int8 m_nEncodingQuality; // [0,100]
bool m_bRaw; // This movie was exported as raw TGA frames and a .WAV file?
}
m_Settings;
};
typedef RenderMovieParams_t::ReplayRenderSettings_t ReplayRenderSettings_t;
//----------------------------------------------------------------------------------------
#define MAX_DOF_QUALITY 2
#define MAX_MOTION_BLUR_QUALITY 3
#define SUBPIXEL_JITTER_SAMPLES 16
#define CHEAP_DOF_SAMPLES 4
//----------------------------------------------------------------------------------------
#endif // RENDERMOVIEPARAMS_H

146
common/replay/replay.h Normal file
View File

@@ -0,0 +1,146 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef REPLAY_H
#define REPLAY_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/iqueryablereplayitem.h"
#include "replay/replaytime.h"
#include "replay/basereplayserializeable.h"
#include "qlimits.h"
#include "utlstring.h"
#include "utlvector.h"
#include "replay/shared_defs.h"
//----------------------------------------------------------------------------------------
class IReplayDownloadEventHandler;
class CReplayScreenshot;
class CReplayPerformance;
//----------------------------------------------------------------------------------------
class CReplay : public CBaseReplaySerializeable,
public IQueryableReplayItem
{
typedef CBaseReplaySerializeable BaseClass;
public:
enum ReplayStatus_t
{
REPLAYSTATUS_INVALID,
REPLAYSTATUS_ERROR,
REPLAYSTATUS_DOWNLOADPHASE, // Multiple sub-states during download state
REPLAYSTATUS_READYTOCONVERT, // Download is complete, ready to convert
REPLAYSTATUS_RENDERING, // Currently rendering the file
REPLAYSTATUS_RENDERED,
REPLAYSTATUS_MAX
};
CReplay();
virtual ~CReplay() {}
//
// IReplaySerializeable
//
virtual const char *GetSubKeyTitle() const;
virtual const char *GetPath() const;
virtual void OnDelete();
virtual bool Read( KeyValues *pIn );
virtual void Write( KeyValues *pOut );
virtual void DumpGameSpecificData() const {}
virtual void Update() {}
// Hooks to allow replays to setup event listeners, etc.
virtual void OnBeginRecording() {}
virtual void OnEndRecording() {}
// Called when a replay is "completed"
virtual void OnComplete();
// Should we allow this replay to be deleted?
virtual bool ShouldAllowDelete() const { return true; }
void AutoNameTitleIfEmpty();
void AddScreenshot( int nWidth, int nHeight, const char *pBaseFilename );
bool HasReconstructedReplay() const;
bool IsSignificantBlock( int iBlockReconstruction ) const; // Does this replay care about the given block?
CReplayPerformance *AddNewPerformance( bool bGenTitle = true, bool bGenFilename = true );
void AddPerformance( KeyValues *pIn );
void AddPerformance( CReplayPerformance *pPerformance );
// Accessors:
inline int GetScreenshotCount() const { return m_vecScreenshots.Count(); }
inline const CReplayScreenshot *GetScreenshot( int i ) const { return m_vecScreenshots[ i ]; }
bool IsDownloaded() const;
inline int GetPerformanceCount() const { return m_vecPerformances.Count(); }
CReplayPerformance *GetPerformance( int i );
const CReplayPerformance *GetPerformance( int i ) const;
inline bool HasPerformance( CReplayPerformance *pPerformance ) { return m_vecPerformances.Find( pPerformance ) != m_vecPerformances.InvalidIndex(); }
bool FindPerformance( CReplayPerformance *pPerformance, int &iResult );
CReplayPerformance *GetPerformanceWithTitle( const wchar_t *pTitle );
inline const char *GetMapName() const { return m_szMapName; }
inline int GetSpawnTick() const { return m_nSpawnTick; }
inline int GetDeathTick() const { return m_nDeathTick; }
// IQueryableReplayItem implementation:
virtual const CReplayTime &GetItemDate() const;
virtual bool IsItemRendered() const;
virtual CReplay *GetItemReplay();
virtual ReplayHandle_t GetItemReplayHandle() const;
virtual QueryableReplayItemHandle_t GetItemHandle() const;
virtual const wchar_t *GetItemTitle() const;
virtual void SetItemTitle( const wchar_t *pTitle );
virtual float GetItemLength() const;
virtual void *GetUserData();
virtual void SetUserData( void* pUserData );
virtual bool IsItemAMovie() const;
// Non-persistent data
mutable IReplayDownloadEventHandler *m_pDownloadEventHandler; // Implemented by replay browser - the reason we've got one per replay rather than
// one per download group is because the browser needs to receive events per-thumbnail
bool m_bSaved; // True as soon as the replay is saved to disk for the first time
bool m_bRequestedByUser; // Did the user request to save this replay?
bool m_bComplete; // Indicates whether the replay is done recording - this should be false
// until the player dies, the round ends, or the level changes
void *m_pUserData;
float m_flNextUpdateTime;
bool m_bDirty;
// Persistent data
ReplayHandle_t m_hSession; // The recording session in which this replay was recorded
char m_szMapName[MAX_OSPATH];
ReplayStatus_t m_nStatus;
const char* m_pFileURL; // In the form <protocol>://<server address>:<port number>/path/file - points to the string in the download group
wchar_t m_wszTitle[MAX_REPLAY_TITLE_LENGTH];
CUtlString m_strKilledBy; // Name of player who killed, if any
int m_nDeathTime;
int m_nSpawnTick;
int m_nDeathTick;
float m_flLength; // The length of the entire replay, including the post-death time, in seconds
bool m_bRendered; // Has the replay been rendered yet?
int m_nPlayerSlot; // Player slot (+1), used to determine which player recorded the demo during playback
int m_nPostDeathRecordTime; // replay_postdeathrecordtime at the time of record
CUtlVector< CReplayScreenshot * > m_vecScreenshots;
CUtlVector< CReplayPerformance * > m_vecPerformances;
int m_iMaxSessionBlockRequired; // The maximum session block required to reconstruct a viewable .dem file from spawn tick until length
CReplayTime m_RecordTime; // Contains time/date when spawn tick was recorded
float m_flStartTime; // Start time (uses engine's host_time)
CUtlString m_strReconstructedFilename;
bool m_bSavedDuringThisSession;
};
//----------------------------------------------------------------------------------------
#endif // REPLAY_H

View File

@@ -0,0 +1,25 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef REPLAYHANDLE_H
#define REPLAYHANDLE_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "platform.h"
//----------------------------------------------------------------------------------------
typedef uint32 ReplayHandle_t;
//----------------------------------------------------------------------------------------
#define REPLAY_HANDLE_INVALID ( (ReplayHandle_t)-1 )
//----------------------------------------------------------------------------------------
#endif // REPLAYHANDLE_H

21
common/replay/replaylib.h Normal file
View File

@@ -0,0 +1,21 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef REPLAYLIB_H
#define REPLAYLIB_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
class IClientReplayContext;
//----------------------------------------------------------------------------------------
bool ReplayLib_Init( const char *pGameDir, IClientReplayContext *pClientReplayContext );
//----------------------------------------------------------------------------------------
#endif // REPLAYLIB_H

View File

@@ -0,0 +1,57 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef REPLAYTIME_H
#define REPLAYTIME_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
class KeyValues;
//----------------------------------------------------------------------------------------
#include "vgui/ILocalize.h"
//----------------------------------------------------------------------------------------
class CReplayTime
{
public:
CReplayTime();
void InitDateAndTimeToNow();
void Read( KeyValues *pIn );
void Write( KeyValues *pOut );
// Modifiers:
void SetDate( int nDay, int nMonth, int nYear );
void SetTime( int nHour, int nMin, int nSec );
inline void SetRawDate( int nRawDate ) { m_fDate = nRawDate; }
inline void SetRawTime( int nRawTime ) { m_fTime = nRawTime; }
// Accessors:
void GetTime( int &nHour, int &nMin, int &nSec ) const;
void GetDate( int &nDay, int &nMonth, int &nYear ) const;
static const char *FormatTimeString( int nSecs );
static const char *FormatPreciseTimeString( float flSecs );
static const wchar_t *GetLocalizedMonth( vgui::ILocalize *pLocalize, int nMonth );
static const wchar_t *GetLocalizedDay( vgui::ILocalize *pLocalize, int nDay );
static const wchar_t *GetLocalizedYear( vgui::ILocalize *pLocalize, int nYear );
static const wchar_t *GetLocalizedTime( vgui::ILocalize *pLocalize, int nHour, int nMin, int nSec );
static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, int nDay, int nMonth, int nYear,
int *pHour = NULL, int *pMin = NULL, int *pSec = NULL, bool bForceFullFormat = false ); // bForceFullFormat true will keep from returning "today" or "yesterday"
static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, const CReplayTime &t, bool bForceFullFormat = false );
int m_fDate; // Representation of a date (bitfield)
int m_fTime; // Representation of time (bitfield)
};
//----------------------------------------------------------------------------------------
#endif // REPLAYTIME_H

View File

@@ -0,0 +1,43 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//----------------------------------------------------------------------------------------
#ifndef REPLAYUTILS_H
#define REPLAYUTILS_H
#ifdef _WIN32
#pragma once
#endif
#include "utlstring.h"
void Replay_GetFirstAvailableFilename( char *pDst, int nDstLen, const char *pIdealFilename, const char *pExt,
const char *pFilePath, int nStartIndex );
void Replay_ConstructReplayFilenameString( CUtlString &strOut, const char *pReplaySubDir, const char *pFilename, const char *pGameDir );
//----------------------------------------------------------------------------------------
// Util function, copied from src/engine/common.cpp
//----------------------------------------------------------------------------------------
char *Replay_va( PRINTF_FORMAT_STRING const char *format, ... );
//----------------------------------------------------------------------------------------
// Return the base dir, e.g. "c:\...\game\tf\replays\"
//----------------------------------------------------------------------------------------
const char *Replay_GetBaseDir();
//----------------------------------------------------------------------------------------
// Set the game directory (only to be called from ReplayLib_Init())
//----------------------------------------------------------------------------------------
void Replay_SetGameDir( const char *pGameDir );
//----------------------------------------------------------------------------------------
// Return the base dir, e.g. "c:\...\game\tf\replays\"
//----------------------------------------------------------------------------------------
const char *Replay_GetGameDir();
//----------------------------------------------------------------------------------------
// Get a name of the format "<map>: <current date & time>" - used for replays and takes.
//----------------------------------------------------------------------------------------
void Replay_GetAutoName( OUT_Z_BYTECAP(nDestSizeInBytes) wchar_t *pDest, int nDestSizeInBytes, const char *pMapName );
#endif // REPLAY_H

View File

@@ -0,0 +1,72 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef SCREENSHOT_H
#define SCREENSHOT_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/basereplayserializeable.h"
#include "mathlib/vector.h"
#include "qlimits.h"
#include "strtools.h"
//----------------------------------------------------------------------------------------
#define SUBDIR_SCREENSHOTS "screenshots"
//----------------------------------------------------------------------------------------
class CReplayScreenshot : public CBaseReplaySerializeable
{
public:
inline CReplayScreenshot( int nWidth = 0, int nHeight = 0, const char *pBaseFilename = NULL )
: m_nWidth( nWidth ), m_nHeight( nHeight )
{
if ( pBaseFilename )
{
V_strncpy( m_szBaseFilename, pBaseFilename, sizeof( m_szBaseFilename ) );
}
}
virtual bool Read( KeyValues *pIn );
virtual void Write( KeyValues *pOut );
virtual const char *GetSubKeyTitle() const;
virtual const char *GetPath() const;
int m_nWidth; // Screenshot width (does not include power-of-2 padding)
int m_nHeight; // Screenshot height (does not include power-of-2 padding)
char m_szBaseFilename[ MAX_OSPATH ];
};
//----------------------------------------------------------------------------------------
struct CaptureScreenshotParams_t // To be passed from the client into IReplayHistoryManager::CaptureScreenshot()
{
float m_flDelay; // Delay from now (in seconds) when we will take the screenshot
int m_nEntity; // Should be 0 if no camera adjustment is needed, otherwise should be the index of the entity index from which m_posCamera will be based
Vector m_posCamera; // Local position, relative to entity's index (if m_nEntity > 0) for camera position
QAngle m_angCamera; // World angles of camera - used if m_bUseCameraAngles is true
bool m_bUseCameraAngles; // Should we use m_angCamera - m_nEntity can't be 0
bool m_bIgnoreMinTimeBetweenScreenshots; // Force screenshot, regardless of replay_mintimebetweenscreenshots?
bool m_bPrimary; // Only set to true for the primary screenshot, which is taken when the user saves their replay
};
//----------------------------------------------------------------------------------------
struct WriteReplayScreenshotParams_t // Passed from the engine into the client to take a screenshot
{
const char *m_pFilename;
int m_nWidth;
int m_nHeight;
Vector *m_pOrigin; // Perspective origin from which to render. Can be NULL
QAngle *m_pAngles; // Perspective angles from which to render. Can be NULL
};
//----------------------------------------------------------------------------------------
#endif // SCREENSHOT_H

View File

@@ -0,0 +1,73 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef SHARED_DEFS_H
#define SHARED_DEFS_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "platform.h"
//----------------------------------------------------------------------------------------
#define SUBDIR_REPLAY "replay"
#define SUBDIR_REPLAYS "replays"
#define SUBDIR_SESSIONS "sessions"
#define SUBDIR_BLOCKS "blocks"
#define SUBDIR_CLIENT "client"
#define SUBDIR_MOVIES "movies"
#define SUBDIR_PERFORMANCES "edits"
#define SUBDIR_SERVER "server"
#define SUBDIR_RENDERED "rendered"
#define SUBDIR_TMP "tmp"
//----------------------------------------------------------------------------------------
#define BLOCK_FILE_EXTENSION "block"
#define GENERIC_FILE_EXTENSION "dmx"
#define DEMO_FILE_EXTENSION "dem"
//----------------------------------------------------------------------------------------
#define MOVIE_HANDLE_BASE 10000 // 10,000
//----------------------------------------------------------------------------------------
#define BUILD_CURL ( defined( WIN32 ) && !defined( _X360 ) ) || defined( POSIX )
//----------------------------------------------------------------------------------------
#define MIN_SERVER_DUMP_INTERVAL 10
#define MAX_SERVER_DUMP_INTERVAL 30
#define DOWNLOAD_TIMEOUT_THRESHOLD 90 // Timeout for a replay download - if no blocks
// are added or updated after this many seconds,
// the replay will be put in the error state.
//----------------------------------------------------------------------------------------
#define MAX_TIMES_TO_SHOW_REPLAY_WELCOME_DLG 1
//----------------------------------------------------------------------------------------
#define MAX_SESSIONNAME_LENGTH 260
#define MAX_REPLAY_TITLE_LENGTH 256
#define MAX_TAKE_TITLE_LENGTH 256
//----------------------------------------------------------------------------------------
#define DEFAULT_COMPRESSOR_TYPE COMPRESSORTYPE_BZ2
//----------------------------------------------------------------------------------------
#define JOB_FAILED ( (JobStatus_t) -1 )
#define DOWNLOAD_MAX_SIZE ( 8 * 1024 * 1024 ) // 8 MB
//----------------------------------------------------------------------------------------
#endif // SHARED_DEFS_H

3168
common/studiobyteswap.cpp Normal file

File diff suppressed because it is too large Load Diff

38
common/studiobyteswap.h Normal file
View File

@@ -0,0 +1,38 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: StudioMDL byteswapping functions.
//
// $NoKeywords: $
//=============================================================================
#ifndef STUDIOBYTESWAP_H
#define STUDIOBYTESWAP_H
#if defined(_WIN32)
#pragma once
#endif
#include "byteswap.h"
struct studiohdr_t;
class IPhysicsCollision;
namespace StudioByteSwap
{
typedef bool (*CompressFunc_t)( const void *pInput, int inputSize, void **pOutput, int *pOutputSize );
//void SetTargetBigEndian( bool bigEndian );
void ActivateByteSwapping( bool bActivate );
void SourceIsNative( bool bActivate );
void SetVerbose( bool bVerbose );
void SetCollisionInterface( IPhysicsCollision *pPhysicsCollision );
int ByteswapStudioFile( const char *pFilename, void *pOutBase, const void *pFileBase, int fileSize, studiohdr_t *pHdr, CompressFunc_t pCompressFunc = NULL );
int ByteswapPHY( void *pOutBase, const void *pFileBase, int fileSize );
int ByteswapANI( studiohdr_t* pHdr, void *pOutBase, const void *pFileBase, int filesize );
int ByteswapVVD( void *pOutBase, const void *pFileBase, int fileSize );
int ByteswapVTX( void *pOutBase, const void *pFileBase, int fileSize );
int ByteswapMDL( void *pOutBase, const void *pFileBase, int fileSize );
#define BYTESWAP_ALIGNMENT_PADDING 4096
}
#endif // STUDIOBYTESWAP_H

32
common/userid.h Normal file
View File

@@ -0,0 +1,32 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef USERID_H
#define USERID_H
#ifdef _WIN32
#pragma once
#endif
#include "strtools.h"
#include "steam/steamclientpublic.h"
#if !defined( INCLUDED_STEAM_STEAMUSERIDTYPES_H )
#define INCLUDED_STEAM2_USERID_STRUCTS
#include "SteamCommon.h"
#endif
#define IDTYPE_WON 0
#define IDTYPE_STEAM 1
#define IDTYPE_VALVE 2
#define IDTYPE_HLTV 3
#define IDTYPE_REPLAY 4
typedef struct USERID_s
{
int idtype;
CSteamID steamid;
} USERID_t;
#endif // USERID_H

237
common/xbox/xboxstubs.h Normal file
View File

@@ -0,0 +1,237 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Win32 replacements for XBox.
//
//=============================================================================
#if !defined( XBOXSTUBS_H ) && !defined( _X360 )
#define XBOXSTUBS_H
#ifdef _WIN32
#pragma once
#endif
#include "tier0/platform.h"
// Content creation/open flags
#define XCONTENTFLAG_NONE 0x00
#define XCONTENTFLAG_CREATENEW 0x00
#define XCONTENTFLAG_CREATEALWAYS 0x00
#define XCONTENTFLAG_OPENEXISTING 0x00
#define XCONTENTFLAG_OPENALWAYS 0x00
#define XCONTENTFLAG_TRUNCATEEXISTING 0x00
// Content attributes
#define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00
#define XCONTENTFLAG_NODEVICE_TRANSFER 0x00
#define XCONTENTFLAG_STRONG_SIGNED 0x00
#define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00
#define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00
// Console device ports
#define XDEVICE_PORT0 0
#define XDEVICE_PORT1 1
#define XDEVICE_PORT2 2
#define XDEVICE_PORT3 3
#define XUSER_MAX_COUNT 4
#define XUSER_INDEX_NONE 0x000000FE
#define XBX_CLR_DEFAULT 0xFF000000
#define XBX_CLR_WARNING 0x0000FFFF
#define XBX_CLR_ERROR 0x000000FF
#define XBOX_MINBORDERSAFE 0
#define XBOX_MAXBORDERSAFE 0
typedef enum
{
XK_NULL,
XK_BUTTON_UP,
XK_BUTTON_DOWN,
XK_BUTTON_LEFT,
XK_BUTTON_RIGHT,
XK_BUTTON_START,
XK_BUTTON_BACK,
XK_BUTTON_STICK1,
XK_BUTTON_STICK2,
XK_BUTTON_A,
XK_BUTTON_B,
XK_BUTTON_X,
XK_BUTTON_Y,
XK_BUTTON_LEFT_SHOULDER,
XK_BUTTON_RIGHT_SHOULDER,
XK_BUTTON_LTRIGGER,
XK_BUTTON_RTRIGGER,
XK_STICK1_UP,
XK_STICK1_DOWN,
XK_STICK1_LEFT,
XK_STICK1_RIGHT,
XK_STICK2_UP,
XK_STICK2_DOWN,
XK_STICK2_LEFT,
XK_STICK2_RIGHT,
XK_MAX_KEYS,
} xKey_t;
//typedef enum
//{
// XVRB_NONE, // off
// XVRB_ERROR, // fatal error
// XVRB_ALWAYS, // no matter what
// XVRB_WARNING, // non-fatal warnings
// XVRB_STATUS, // status reports
// XVRB_ALL,
//} xverbose_e;
typedef unsigned short WORD;
#ifndef POSIX
typedef unsigned long DWORD;
typedef void* HANDLE;
typedef unsigned __int64 ULONGLONG;
#endif
#ifdef POSIX
typedef DWORD COLORREF;
#endif
#ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
#endif
// typedef struct {
// IN_ADDR ina; // IP address (zero if not static/DHCP)
// IN_ADDR inaOnline; // Online IP address (zero if not online)
// WORD wPortOnline; // Online port
// BYTE abEnet[6]; // Ethernet MAC address
// BYTE abOnline[20]; // Online identification
// } XNADDR;
typedef int XNADDR;
typedef uint64 XUID;
typedef struct {
BYTE ab[8]; // xbox to xbox key identifier
} XNKID;
typedef struct {
BYTE ab[16]; // xbox to xbox key exchange key
} XNKEY;
typedef struct _XSESSION_INFO
{
XNKID sessionID; // 8 bytes
XNADDR hostAddress; // 36 bytes
XNKEY keyExchangeKey; // 16 bytes
} XSESSION_INFO, *PXSESSION_INFO;
typedef struct _XUSER_DATA
{
BYTE type;
union
{
int nData; // XUSER_DATA_TYPE_INT32
int64 i64Data; // XUSER_DATA_TYPE_INT64
double dblData; // XUSER_DATA_TYPE_DOUBLE
struct // XUSER_DATA_TYPE_UNICODE
{
uint cbData; // Includes null-terminator
char * pwszData;
} string;
float fData; // XUSER_DATA_TYPE_FLOAT
struct // XUSER_DATA_TYPE_BINARY
{
uint cbData;
char * pbData;
} binary;
};
} XUSER_DATA, *PXUSER_DATA;
typedef struct _XUSER_PROPERTY
{
DWORD dwPropertyId;
XUSER_DATA value;
} XUSER_PROPERTY, *PXUSER_PROPERTY;
typedef struct _XUSER_CONTEXT
{
DWORD dwContextId;
DWORD dwValue;
} XUSER_CONTEXT, *PXUSER_CONTEXT;
typedef struct _XSESSION_SEARCHRESULT
{
XSESSION_INFO info;
DWORD dwOpenPublicSlots;
DWORD dwOpenPrivateSlots;
DWORD dwFilledPublicSlots;
DWORD dwFilledPrivateSlots;
DWORD cProperties;
DWORD cContexts;
PXUSER_PROPERTY pProperties;
PXUSER_CONTEXT pContexts;
} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT;
typedef struct _XSESSION_SEARCHRESULT_HEADER
{
DWORD dwSearchResults;
XSESSION_SEARCHRESULT *pResults;
} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER;
typedef struct _XSESSION_REGISTRANT
{
uint64 qwMachineID;
DWORD bTrustworthiness;
DWORD bNumUsers;
XUID *rgUsers;
} XSESSION_REGISTRANT;
typedef struct _XSESSION_REGISTRATION_RESULTS
{
DWORD wNumRegistrants;
XSESSION_REGISTRANT *rgRegistrants;
} XSESSION_REGISTRATION_RESULTS, *PXSESSION_REGISTRATION_RESULTS;
typedef struct {
BYTE bFlags;
BYTE bReserved;
WORD cProbesXmit;
WORD cProbesRecv;
WORD cbData;
BYTE * pbData;
WORD wRttMinInMsecs;
WORD wRttMedInMsecs;
DWORD dwUpBitsPerSec;
DWORD dwDnBitsPerSec;
} XNQOSINFO;
typedef struct {
uint cxnqos;
uint cxnqosPending;
XNQOSINFO axnqosinfo[1];
} XNQOS;
#define XSESSION_CREATE_HOST 0
#define XUSER_DATA_TYPE_INT32 0
#define XSESSION_CREATE_USES_ARBITRATION 0
#define XNET_QOS_LISTEN_ENABLE 0
#define XNET_QOS_LISTEN_DISABLE 0
#define XNET_QOS_LISTEN_SET_DATA 0
FORCEINLINE void XBX_ProcessEvents() {}
FORCEINLINE unsigned int XBX_GetSystemTime() { return 0; }
FORCEINLINE int XBX_GetPrimaryUserId() { return 0; }
FORCEINLINE void XBX_SetPrimaryUserId( DWORD idx ) {}
FORCEINLINE int XBX_GetStorageDeviceId() { return 0; }
FORCEINLINE void XBX_SetStorageDeviceId( DWORD idx ) {}
FORCEINLINE const char *XBX_GetLanguageString() { return ""; }
FORCEINLINE bool XBX_IsLocalized() { return false; }
#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
#define XCONTENT_MAX_FILENAME_LENGTH 42
#define XBX_INVALID_STORAGE_ID ((DWORD) -1)
#define XBX_STORAGE_DECLINED ((DWORD) -2)
#endif // XBOXSTUBS_H

5
createallprojects Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
pushd `dirname $0`
devtools/bin/vpc /hl2 /episodic +everything /mksln everything
popd

1
createallprojects.bat Normal file
View File

@@ -0,0 +1 @@
devtools\bin\vpc.exe /hl2 /episodic +everything /mksln everything.sln

5
creategameprojects Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
pushd `dirname $0`
devtools/bin/vpc /hl2 /episodic +game /mksln games
popd

1
creategameprojects.bat Normal file
View File

@@ -0,0 +1 @@
devtools\bin\vpc.exe /hl2 /episodic +game /mksln games.sln

Binary file not shown.

View File

@@ -0,0 +1,472 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CSHADER_H
#define CSHADER_H
#ifdef _WIN32
#pragma once
#endif
// uncomment this if you want to build for nv3x
//#define NV3X 1
// This is what all shaders include.
// CBaseShader will become CShader in this file.
#include "materialsystem/ishaderapi.h"
#include "utlvector.h"
#include "materialsystem/imaterialvar.h"
#include "materialsystem/imaterial.h"
#include "BaseShader.h"
#include "materialsystem/itexture.h"
// Included for convenience because they are used in a bunch of shaders
#include "materialsystem/imesh.h"
#include "materialsystem/imaterialsystemhardwareconfig.h"
#include "materialsystem/materialsystem_config.h"
#include "shaderlib/ShaderDLL.h"
// make "local variable is initialized but not referenced" warnings errors for combo checking macros
#pragma warning ( error : 4189 )
//-----------------------------------------------------------------------------
// Global interfaces
//-----------------------------------------------------------------------------
extern IMaterialSystemHardwareConfig *g_pHardwareConfig;
extern const MaterialSystem_Config_t *g_pConfig;
extern bool g_shaderConfigDumpEnable;
// Helper method
bool IsUsingGraphics();
#define SOFTWARE_VERTEX_SHADER(name) \
static void SoftwareVertexShader_ ## name( CMeshBuilder &meshBuilder, IMaterialVar **params, IShaderDynamicAPI* pShaderAPI )
#define FORWARD_DECLARE_SOFTWARE_VERTEX_SHADER(name)\
static void SoftwareVertexShader_ ## name( CMeshBuilder &meshBuilder, IMaterialVar **params, IShaderDynamicAPI* pShaderAPI );
#define USE_SOFTWARE_VERTEX_SHADER(name) \
m_SoftwareVertexShader = SoftwareVertexShader_ ## name
#define SHADER_INIT_PARAMS() \
virtual void OnInitShaderParams( IMaterialVar **params, const char *pMaterialName )
#define SHADER_FALLBACK \
virtual char const* GetFallbackShader( IMaterialVar** params ) const
// Typesafe flag setting
inline void CShader_SetFlags( IMaterialVar **params, MaterialVarFlags_t _flag )
{
params[FLAGS]->SetIntValue( params[FLAGS]->GetIntValue() | (_flag) );
}
inline bool CShader_IsFlagSet( IMaterialVar **params, MaterialVarFlags_t _flag )
{
return ((params[FLAGS]->GetIntValue() & (_flag) ) != 0);
}
#define SET_FLAGS( _flag ) CShader_SetFlags( params, _flag )
#define CLEAR_FLAGS( _flag ) params[FLAGS]->SetIntValue( params[FLAGS]->GetIntValue() & ~(_flag) )
#define IS_FLAG_SET( _flag ) CShader_IsFlagSet( params, _flag )
#define IS_FLAG_DEFINED( _flag ) ((params[FLAGS_DEFINED]->GetIntValue() & (_flag) ) != 0)
#define IS_PARAM_DEFINED( _param ) ( ( ( _param >= 0 ) && ( params[_param]->IsDefined() ) ) )
#define SET_PARAM_STRING_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetStringValue( kDefaultValue ); \
}
#define SET_PARAM_INT_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetIntValue( kDefaultValue ); \
}
#define SET_PARAM_FLOAT_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetFloatValue( kDefaultValue ); \
}
#define SET_PARAM_VEC_IF_NOT_DEFINED( nParamIndex, kDefaultValue, nSize ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetVecValue( kDefaultValue, nSize ); \
}
// Typesafe flag setting
inline void CShader_SetFlags2( IMaterialVar **params, MaterialVarFlags2_t _flag )
{
params[FLAGS2]->SetIntValue( params[FLAGS2]->GetIntValue() | (_flag) );
}
inline bool CShader_IsFlag2Set( IMaterialVar **params, MaterialVarFlags2_t _flag )
{
return ((params[FLAGS2]->GetIntValue() & (_flag) ) != 0);
}
#define SET_FLAGS2( _flag ) CShader_SetFlags2( params, _flag )
#define CLEAR_FLAGS2( _flag ) params[FLAGS2]->SetIntValue( params[FLAGS2]->GetIntValue() & ~(_flag) )
#define IS_FLAG2_SET( _flag ) CShader_IsFlag2Set( params, _flag )
#define IS_FLAG2_DEFINED( _flag ) ((params[FLAGS_DEFINED2]->GetIntValue() & (_flag) ) != 0)
#define __BEGIN_SHADER_INTERNAL(_baseclass, name, help, flags) \
namespace name \
{\
typedef _baseclass CBaseClass;\
static const char *s_HelpString = help; \
static const char *s_Name = #name; \
static int s_nFlags = flags; \
class CShaderParam;\
static CUtlVector<CShaderParam *> s_ShaderParams;\
static CShaderParam *s_pShaderParamOverrides[NUM_SHADER_MATERIAL_VARS];\
class CShaderParam\
{\
public:\
CShaderParam( ShaderMaterialVars_t var, ShaderParamType_t type, const char *pDefaultParam, const char *pHelp, int nFlags )\
{\
m_Info.m_pName = "override";\
m_Info.m_Type = type;\
m_Info.m_pDefaultValue = pDefaultParam;\
m_Info.m_pHelp = pHelp;\
m_Info.m_nFlags = nFlags;\
AssertMsg( !s_pShaderParamOverrides[var], ( "Shader parameter override duplicately defined!" ) );\
s_pShaderParamOverrides[var] = this;\
m_Index = var;\
}\
CShaderParam( const char *pName, ShaderParamType_t type, const char *pDefaultParam, const char *pHelp, int nFlags )\
{\
m_Info.m_pName = pName;\
m_Info.m_Type = type;\
m_Info.m_pDefaultValue = pDefaultParam;\
m_Info.m_pHelp = pHelp;\
m_Info.m_nFlags = nFlags;\
m_Index = NUM_SHADER_MATERIAL_VARS + s_ShaderParams.Count();\
s_ShaderParams.AddToTail( this );\
}\
operator int() \
{\
return m_Index;\
}\
const char *GetName()\
{\
return m_Info.m_pName;\
}\
ShaderParamType_t GetType()\
{\
return m_Info.m_Type;\
}\
const char *GetDefault()\
{\
return m_Info.m_pDefaultValue;\
}\
int GetFlags() const\
{\
return m_Info.m_nFlags;\
}\
const char *GetHelp()\
{\
return m_Info.m_pHelp;\
}\
private:\
ShaderParamInfo_t m_Info; \
int m_Index;\
};\
#define BEGIN_SHADER(name,help) __BEGIN_SHADER_INTERNAL( CBaseShader, name, help, 0 )
#define BEGIN_SHADER_FLAGS(name,help,flags) __BEGIN_SHADER_INTERNAL( CBaseShader, name, help, flags )
#define BEGIN_SHADER_PARAMS
#define SHADER_PARAM( param, paramtype, paramdefault, paramhelp ) \
static CShaderParam param( "$" #param, paramtype, paramdefault, paramhelp, 0 );
#define SHADER_PARAM_FLAGS( param, paramtype, paramdefault, paramhelp, flags ) \
static CShaderParam param( "$" #param, paramtype, paramdefault, paramhelp, flags );
#define SHADER_PARAM_OVERRIDE( param, paramtype, paramdefault, paramhelp, flags ) \
static CShaderParam param( (ShaderMaterialVars_t) ::param, paramtype, paramdefault, paramhelp, flags );
// regarding the macro above: the "::" was added to the first argument in order to disambiguate it for GCC.
// for example, in cloak.cpp, this usage appears:
// SHADER_PARAM_OVERRIDE( COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
// which in turn tries to ask the compiler to instantiate an object like so:
// static CShaderParam COLOR( (ShaderMaterialVars_t)COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
// and GCC thinks that the reference to COLOR in the arg list is actually a reference to the object we're in the middle of making.
// and you get --> error: invalid cast from type Cloak_DX90::CShaderParam to type ShaderMaterialVars_t
// Resolved: add the "::" so compiler knows that reference is to the enum, not to the name of the object being made.
#define END_SHADER_PARAMS \
class CShader : public CBaseClass\
{\
public:
#define END_SHADER }; \
static CShader s_ShaderInstance;\
} // namespace
#define SHADER_INIT \
char const* GetName() const \
{ \
return s_Name; \
} \
int GetFlags() const \
{ \
return s_nFlags; \
} \
int GetNumParams() const \
{\
return CBaseClass::GetNumParams() + s_ShaderParams.Count();\
}\
char const* GetParamName( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
return CBaseClass::GetParamName(param); \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetName(); \
}\
char const* GetParamHelp( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamHelp( param ); \
else \
return s_pShaderParamOverrides[param]->GetHelp(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetHelp(); \
}\
ShaderParamType_t GetParamType( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
return CBaseClass::GetParamType( param ); \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetType(); \
}\
char const* GetParamDefault( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamDefault( param ); \
else \
return s_pShaderParamOverrides[param]->GetDefault(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetDefault(); \
}\
int GetParamFlags( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamFlags( param ); \
else \
return s_pShaderParamOverrides[param]->GetFlags(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetFlags(); \
}\
void OnInitShaderInstance( IMaterialVar **params, IShaderInit *pShaderInit, const char *pMaterialName )
#define SHADER_DRAW \
void OnDrawElements( IMaterialVar **params, IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr )
#define SHADOW_STATE if (pShaderShadow)
#define DYNAMIC_STATE if (pShaderAPI)
#define ShaderWarning if (pShaderShadow) Warning
//-----------------------------------------------------------------------------
// Used to easily define a shader which *always* falls back
//-----------------------------------------------------------------------------
#define DEFINE_FALLBACK_SHADER( _shadername, _fallbackshadername ) \
BEGIN_SHADER( _shadername, "" ) \
BEGIN_SHADER_PARAMS \
END_SHADER_PARAMS \
SHADER_FALLBACK { return #_fallbackshadername; } \
SHADER_INIT {} \
SHADER_DRAW {} \
END_SHADER
//-----------------------------------------------------------------------------
// Used to easily define a shader which inherits from another shader
//-----------------------------------------------------------------------------
// FIXME: There's a compiler bug preventing this from working.
// Maybe it'll work under VC7!
/*
//#define BEGIN_INHERITED_SHADER( name, _baseclass, help ) \
// namespace _baseclass \
// {\
// __BEGIN_SHADER_INTERNAL( _baseclass::CShader, name, help )
*/
//#define END_INHERITED_SHADER END_SHADER }
//#define CHAIN_SHADER_INIT_PARAMS() CBaseClass::OnInitShaderParams( params, pMaterialName )
//#define CHAIN_SHADER_FALLBACK() CBaseClass::GetFallbackShader( params )
//#define CHAIN_SHADER_INIT() CBaseClass::OnInitShaderInstance( params, pShaderInit, pMaterialName )
//#define CHAIN_SHADER_DRAW() CBaseClass::OnDrawElements( params, pShaderShadow, pShaderAPI )
// A dumbed-down version which does what I need now which works
// This version doesn't allow you to do chain *anything* down to the base class
#define BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, _flags ) \
namespace _base\
{\
namespace _name\
{\
static const char *s_Name = #_name; \
static const char *s_HelpString = _help;\
static int s_nFlags = _flags;\
class CShader : public _base::CShader\
{\
public:\
char const* GetName() const \
{ \
return s_Name; \
} \
int GetFlags() const \
{ \
return s_nFlags; \
}
#define BEGIN_INHERITED_SHADER( _name, _base, _help ) BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, 0 )
#define END_INHERITED_SHADER END_SHADER }
// psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER
#define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \
shader ## _Dynamic_Index _pshIndex( pShaderAPI ); \
const int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_VERTEX_SHADER
#define DECLARE_DYNAMIC_VERTEX_SHADER( shader ) \
shader ## _Dynamic_Index _vshIndex( pShaderAPI ); \
const int vsh ## shader = 1
// psh ## shader is used here to generate a warning if you don't ever call SET_STATIC_PIXEL_SHADER
#define DECLARE_STATIC_PIXEL_SHADER( shader ) \
shader ## _Static_Index _pshIndex( pShaderShadow, params ); \
const int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_STATIC_VERTEX_SHADER
#define DECLARE_STATIC_VERTEX_SHADER( shader ) \
shader ## _Static_Index _vshIndex( pShaderShadow, params ); \
const int vsh ## shader = 1
// psh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_PIXEL_SHADER block.
#define SET_DYNAMIC_PIXEL_SHADER_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
const int psh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_PIXEL_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_VERTEX_SHADER block.
#define SET_DYNAMIC_VERTEX_SHADER_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
const int vsh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_VERTEX_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_PIXEL_SHADER block.
#define SET_STATIC_PIXEL_SHADER_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
const int psh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_PIXEL_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_VERTEX_SHADER block.
#define SET_STATIC_VERTEX_SHADER_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
const int vsh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_VERTEX_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_testAllCombos adds up all of the psh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_DYNAMIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_PIXEL_SHADER( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderAPI->SetPixelShaderIndex( _pshIndex.GetIndex() )
#define SET_DYNAMIC_PIXEL_SHADER_CMD( cmdstream, shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
cmdstream.SetPixelShaderIndex( _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_DYNAMIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_VERTEX_SHADER( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderAPI->SetVertexShaderIndex( _vshIndex.GetIndex() )
#define SET_DYNAMIC_VERTEX_SHADER_CMD( cmdstream, shader ) \
static_assert( shaderDynamicTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
cmdstream.SetVertexShaderIndex( _vshIndex.GetIndex() )
// psh_testAllCombos adds up all of the psh_forgot_to_set_static_ ## var's from
// SET_STATIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_STATIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_STATIC_PIXEL_SHADER( shader ) \
static_assert( ( shaderStaticTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderShadow->SetPixelShader( #shader, _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_static_ ## var's from
// SET_STATIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_STATIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_STATIC_VERTEX_SHADER( shader ) \
static_assert( shaderStaticTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() )
#endif // CSHADER_H

View File

@@ -0,0 +1,472 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CSHADER_H
#define CSHADER_H
#ifdef _WIN32
#pragma once
#endif
// uncomment this if you want to build for nv3x
//#define NV3X 1
// This is what all shaders include.
// CBaseShader will become CShader in this file.
#include "materialsystem/ishaderapi.h"
#include "utlvector.h"
#include "materialsystem/imaterialvar.h"
#include "materialsystem/imaterial.h"
#include "BaseShader.h"
#include "materialsystem/itexture.h"
// Included for convenience because they are used in a bunch of shaders
#include "materialsystem/imesh.h"
#include "materialsystem/imaterialsystemhardwareconfig.h"
#include "materialsystem/materialsystem_config.h"
#include "shaderlib/ShaderDLL.h"
// make "local variable is initialized but not referenced" warnings errors for combo checking macros
#pragma warning ( error : 4189 )
//-----------------------------------------------------------------------------
// Global interfaces
//-----------------------------------------------------------------------------
extern IMaterialSystemHardwareConfig *g_pHardwareConfig;
extern const MaterialSystem_Config_t *g_pConfig;
extern bool g_shaderConfigDumpEnable;
// Helper method
bool IsUsingGraphics();
#define SOFTWARE_VERTEX_SHADER(name) \
static void SoftwareVertexShader_ ## name( CMeshBuilder &meshBuilder, IMaterialVar **params, IShaderDynamicAPI* pShaderAPI )
#define FORWARD_DECLARE_SOFTWARE_VERTEX_SHADER(name)\
static void SoftwareVertexShader_ ## name( CMeshBuilder &meshBuilder, IMaterialVar **params, IShaderDynamicAPI* pShaderAPI );
#define USE_SOFTWARE_VERTEX_SHADER(name) \
m_SoftwareVertexShader = SoftwareVertexShader_ ## name
#define SHADER_INIT_PARAMS() \
virtual void OnInitShaderParams( IMaterialVar **params, const char *pMaterialName )
#define SHADER_FALLBACK \
virtual char const* GetFallbackShader( IMaterialVar** params ) const
// Typesafe flag setting
inline void CShader_SetFlags( IMaterialVar **params, MaterialVarFlags_t _flag )
{
params[FLAGS]->SetIntValue( params[FLAGS]->GetIntValue() | (_flag) );
}
inline bool CShader_IsFlagSet( IMaterialVar **params, MaterialVarFlags_t _flag )
{
return ((params[FLAGS]->GetIntValue() & (_flag) ) != 0);
}
#define SET_FLAGS( _flag ) CShader_SetFlags( params, _flag )
#define CLEAR_FLAGS( _flag ) params[FLAGS]->SetIntValue( params[FLAGS]->GetIntValue() & ~(_flag) )
#define IS_FLAG_SET( _flag ) CShader_IsFlagSet( params, _flag )
#define IS_FLAG_DEFINED( _flag ) ((params[FLAGS_DEFINED]->GetIntValue() & (_flag) ) != 0)
#define IS_PARAM_DEFINED( _param ) ( ( ( _param >= 0 ) && ( params[_param]->IsDefined() ) ) )
#define SET_PARAM_STRING_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetStringValue( kDefaultValue ); \
}
#define SET_PARAM_INT_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetIntValue( kDefaultValue ); \
}
#define SET_PARAM_FLOAT_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetFloatValue( kDefaultValue ); \
}
#define SET_PARAM_VEC_IF_NOT_DEFINED( nParamIndex, kDefaultValue, nSize ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetVecValue( kDefaultValue, nSize ); \
}
// Typesafe flag setting
inline void CShader_SetFlags2( IMaterialVar **params, MaterialVarFlags2_t _flag )
{
params[FLAGS2]->SetIntValue( params[FLAGS2]->GetIntValue() | (_flag) );
}
inline bool CShader_IsFlag2Set( IMaterialVar **params, MaterialVarFlags2_t _flag )
{
return ((params[FLAGS2]->GetIntValue() & (_flag) ) != 0);
}
#define SET_FLAGS2( _flag ) CShader_SetFlags2( params, _flag )
#define CLEAR_FLAGS2( _flag ) params[FLAGS2]->SetIntValue( params[FLAGS2]->GetIntValue() & ~(_flag) )
#define IS_FLAG2_SET( _flag ) CShader_IsFlag2Set( params, _flag )
#define IS_FLAG2_DEFINED( _flag ) ((params[FLAGS_DEFINED2]->GetIntValue() & (_flag) ) != 0)
#define __BEGIN_SHADER_INTERNAL(_baseclass, name, help, flags) \
namespace name \
{\
typedef _baseclass CBaseClass;\
static const char *s_HelpString = help; \
static const char *s_Name = #name; \
static int s_nFlags = flags; \
class CShaderParam;\
static CUtlVector<CShaderParam *> s_ShaderParams;\
static CShaderParam *s_pShaderParamOverrides[NUM_SHADER_MATERIAL_VARS];\
class CShaderParam\
{\
public:\
CShaderParam( ShaderMaterialVars_t var, ShaderParamType_t type, const char *pDefaultParam, const char *pHelp, int nFlags )\
{\
m_Info.m_pName = "override";\
m_Info.m_Type = type;\
m_Info.m_pDefaultValue = pDefaultParam;\
m_Info.m_pHelp = pHelp;\
m_Info.m_nFlags = nFlags;\
AssertMsg( !s_pShaderParamOverrides[var], ( "Shader parameter override duplicately defined!" ) );\
s_pShaderParamOverrides[var] = this;\
m_Index = var;\
}\
CShaderParam( const char *pName, ShaderParamType_t type, const char *pDefaultParam, const char *pHelp, int nFlags )\
{\
m_Info.m_pName = pName;\
m_Info.m_Type = type;\
m_Info.m_pDefaultValue = pDefaultParam;\
m_Info.m_pHelp = pHelp;\
m_Info.m_nFlags = nFlags;\
m_Index = NUM_SHADER_MATERIAL_VARS + s_ShaderParams.Count();\
s_ShaderParams.AddToTail( this );\
}\
operator int() \
{\
return m_Index;\
}\
const char *GetName()\
{\
return m_Info.m_pName;\
}\
ShaderParamType_t GetType()\
{\
return m_Info.m_Type;\
}\
const char *GetDefault()\
{\
return m_Info.m_pDefaultValue;\
}\
int GetFlags() const\
{\
return m_Info.m_nFlags;\
}\
const char *GetHelp()\
{\
return m_Info.m_pHelp;\
}\
private:\
ShaderParamInfo_t m_Info; \
int m_Index;\
};\
#define BEGIN_SHADER(name,help) __BEGIN_SHADER_INTERNAL( CBaseShader, name, help, 0 )
#define BEGIN_SHADER_FLAGS(name,help,flags) __BEGIN_SHADER_INTERNAL( CBaseShader, name, help, flags )
#define BEGIN_SHADER_PARAMS
#define SHADER_PARAM( param, paramtype, paramdefault, paramhelp ) \
static CShaderParam param( "$" #param, paramtype, paramdefault, paramhelp, 0 );
#define SHADER_PARAM_FLAGS( param, paramtype, paramdefault, paramhelp, flags ) \
static CShaderParam param( "$" #param, paramtype, paramdefault, paramhelp, flags );
#define SHADER_PARAM_OVERRIDE( param, paramtype, paramdefault, paramhelp, flags ) \
static CShaderParam param( (ShaderMaterialVars_t) ::param, paramtype, paramdefault, paramhelp, flags );
// regarding the macro above: the "::" was added to the first argument in order to disambiguate it for GCC.
// for example, in cloak.cpp, this usage appears:
// SHADER_PARAM_OVERRIDE( COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
// which in turn tries to ask the compiler to instantiate an object like so:
// static CShaderParam COLOR( (ShaderMaterialVars_t)COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
// and GCC thinks that the reference to COLOR in the arg list is actually a reference to the object we're in the middle of making.
// and you get --> error: invalid cast from type Cloak_DX90::CShaderParam to type ShaderMaterialVars_t
// Resolved: add the "::" so compiler knows that reference is to the enum, not to the name of the object being made.
#define END_SHADER_PARAMS \
class CShader : public CBaseClass\
{\
public:
#define END_SHADER }; \
static CShader s_ShaderInstance;\
} // namespace
#define SHADER_INIT \
char const* GetName() const \
{ \
return s_Name; \
} \
int GetFlags() const \
{ \
return s_nFlags; \
} \
int GetNumParams() const \
{\
return CBaseClass::GetNumParams() + s_ShaderParams.Count();\
}\
char const* GetParamName( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
return CBaseClass::GetParamName(param); \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetName(); \
}\
char const* GetParamHelp( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamHelp( param ); \
else \
return s_pShaderParamOverrides[param]->GetHelp(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetHelp(); \
}\
ShaderParamType_t GetParamType( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
return CBaseClass::GetParamType( param ); \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetType(); \
}\
char const* GetParamDefault( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamDefault( param ); \
else \
return s_pShaderParamOverrides[param]->GetDefault(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetDefault(); \
}\
int GetParamFlags( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamFlags( param ); \
else \
return s_pShaderParamOverrides[param]->GetFlags(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetFlags(); \
}\
void OnInitShaderInstance( IMaterialVar **params, IShaderInit *pShaderInit, const char *pMaterialName )
#define SHADER_DRAW \
void OnDrawElements( IMaterialVar **params, IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr )
#define SHADOW_STATE if (pShaderShadow)
#define DYNAMIC_STATE if (pShaderAPI)
#define ShaderWarning if (pShaderShadow) Warning
//-----------------------------------------------------------------------------
// Used to easily define a shader which *always* falls back
//-----------------------------------------------------------------------------
#define DEFINE_FALLBACK_SHADER( _shadername, _fallbackshadername ) \
BEGIN_SHADER( _shadername, "" ) \
BEGIN_SHADER_PARAMS \
END_SHADER_PARAMS \
SHADER_FALLBACK { return #_fallbackshadername; } \
SHADER_INIT {} \
SHADER_DRAW {} \
END_SHADER
//-----------------------------------------------------------------------------
// Used to easily define a shader which inherits from another shader
//-----------------------------------------------------------------------------
// FIXME: There's a compiler bug preventing this from working.
// Maybe it'll work under VC7!
/*
//#define BEGIN_INHERITED_SHADER( name, _baseclass, help ) \
// namespace _baseclass \
// {\
// __BEGIN_SHADER_INTERNAL( _baseclass::CShader, name, help )
*/
//#define END_INHERITED_SHADER END_SHADER }
//#define CHAIN_SHADER_INIT_PARAMS() CBaseClass::OnInitShaderParams( params, pMaterialName )
//#define CHAIN_SHADER_FALLBACK() CBaseClass::GetFallbackShader( params )
//#define CHAIN_SHADER_INIT() CBaseClass::OnInitShaderInstance( params, pShaderInit, pMaterialName )
//#define CHAIN_SHADER_DRAW() CBaseClass::OnDrawElements( params, pShaderShadow, pShaderAPI )
// A dumbed-down version which does what I need now which works
// This version doesn't allow you to do chain *anything* down to the base class
#define BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, _flags ) \
namespace _base\
{\
namespace _name\
{\
static const char *s_Name = #_name; \
static const char *s_HelpString = _help;\
static int s_nFlags = _flags;\
class CShader : public _base::CShader\
{\
public:\
char const* GetName() const \
{ \
return s_Name; \
} \
int GetFlags() const \
{ \
return s_nFlags; \
}
#define BEGIN_INHERITED_SHADER( _name, _base, _help ) BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, 0 )
#define END_INHERITED_SHADER END_SHADER }
// psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER
#define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \
shader ## _Dynamic_Index _pshIndex( pShaderAPI ); \
constexpr int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_VERTEX_SHADER
#define DECLARE_DYNAMIC_VERTEX_SHADER( shader ) \
shader ## _Dynamic_Index _vshIndex( pShaderAPI ); \
constexpr int vsh ## shader = 1
// psh ## shader is used here to generate a warning if you don't ever call SET_STATIC_PIXEL_SHADER
#define DECLARE_STATIC_PIXEL_SHADER( shader ) \
shader ## _Static_Index _pshIndex( pShaderShadow, params ); \
constexpr int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_STATIC_VERTEX_SHADER
#define DECLARE_STATIC_VERTEX_SHADER( shader ) \
shader ## _Static_Index _vshIndex( pShaderShadow, params ); \
constexpr int vsh ## shader = 1
// psh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_PIXEL_SHADER block.
#define SET_DYNAMIC_PIXEL_SHADER_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
constexpr int psh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_PIXEL_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_VERTEX_SHADER block.
#define SET_DYNAMIC_VERTEX_SHADER_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
constexpr int vsh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_VERTEX_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_PIXEL_SHADER block.
#define SET_STATIC_PIXEL_SHADER_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
constexpr int psh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_PIXEL_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_VERTEX_SHADER block.
#define SET_STATIC_VERTEX_SHADER_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
constexpr int vsh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_VERTEX_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_testAllCombos adds up all of the psh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_DYNAMIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_PIXEL_SHADER( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderAPI->SetPixelShaderIndex( _pshIndex.GetIndex() )
#define SET_DYNAMIC_PIXEL_SHADER_CMD( cmdstream, shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
cmdstream.SetPixelShaderIndex( _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_DYNAMIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_VERTEX_SHADER( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderAPI->SetVertexShaderIndex( _vshIndex.GetIndex() )
#define SET_DYNAMIC_VERTEX_SHADER_CMD( cmdstream, shader ) \
static_assert( shaderDynamicTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
cmdstream.SetVertexShaderIndex( _vshIndex.GetIndex() )
// psh_testAllCombos adds up all of the psh_forgot_to_set_static_ ## var's from
// SET_STATIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_STATIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_STATIC_PIXEL_SHADER( shader ) \
static_assert( ( shaderStaticTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderShadow->SetPixelShader( #shader, _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_static_ ## var's from
// SET_STATIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_STATIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_STATIC_VERTEX_SHADER( shader ) \
static_assert( shaderStaticTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() )
#endif // CSHADER_H

View File

@@ -0,0 +1,146 @@
@echo off
set TTEXE=..\..\devtools\bin\timeprecise.exe
if not exist %TTEXE% goto no_ttexe
goto no_ttexe_end
:no_ttexe
set TTEXE=time /t
:no_ttexe_end
echo.
echo ==================== buildshaders %* ==================
%TTEXE% -cur-Q
set tt_start=%ERRORLEVEL%
set tt_chkpt=%tt_start%
REM ****************
REM usage: buildshaders <shaderProjectName>
REM ****************
setlocal
set arg_filename=%1
set shadercompilecommand=ShaderCompile.exe
set targetdir=shaders
set SrcDirBase=..\..
set shaderDir=shaders
set SDKArgs=-local
if "%1" == "" goto usage
set inputbase=%1
REM ignore -dx9_30
if /i "%6" == "-dx9_30" shift /6
if /i "%6" == "-force30" goto set_force30_arg
goto set_force_end
:set_force30_arg
set IS30=1
goto set_force_end
:set_force_end
if /i "%2" == "-game" goto set_mod_args
goto build_shaders
REM ****************
REM USAGE
REM ****************
:usage
echo.
echo "usage: buildshaders <shaderProjectName> [-game] [gameDir if -game was specified] [-source sourceDir]"
echo " gameDir is where gameinfo.txt is (where it will store the compiled shaders)."
echo " sourceDir is where the source code is (where it will find scripts and compilers)."
echo "ex : buildshaders myshaders"
echo "ex : buildshaders myshaders -game c:\steam\steamapps\sourcemods\mymod -source c:\mymod\src"
goto :end
REM ****************
REM MOD ARGS - look for -game or the vproject environment variable
REM ****************
:set_mod_args
if not exist "C:\SourceCodes\SourceCode2013\src_RTT\devtools\ShaderCompilerStandAlone\bin\ShaderCompile.exe" goto NoShaderCompile
set ChangeToDir=%SrcDirBase%\devtools\bin\
if /i "%4" NEQ "-source" goto NoSourceDirSpecified
set SrcDirBase=%~5
REM ** use the -game parameter to tell us where to put the files
set targetdir=%~3\shaders
if not exist "%~3\gameinfo.txt" goto InvalidGameDirectory
if not exist "C:\SourceCodes\SourceCode2013\src_RTT\materialsystem\stdshaders\filelist.txt" goto InvalidInputFile
goto build_shaders
REM ****************
REM ERRORS
REM ****************
:InvalidGameDirectory
echo Error: "%~3" is not a valid game directory.
echo (The -game directory must have a gameinfo.txt file)
goto end
:InvalidInputFile
echo Error: "%inputbase%.txt" is not a valid file.
goto end
:NoSourceDirSpecified
echo ERROR: If you specify -game on the command line, you must specify -source.
goto usage
goto end
:NoShaderCompile
echo - ERROR: ShaderCompile.exe doesn't exist in devtools\bin
goto end
REM ****************
REM BUILD SHADERS
REM ****************
:build_shaders
rem echo --------------------------------
rem echo %inputbase%
rem echo --------------------------------
REM make sure that target dirs exist
REM files will be built in these targets and copied to their final destination
if not exist include mkdir include
if not exist %shaderDir% mkdir %shaderDir%
if not exist %shaderDir%\fxc mkdir %shaderDir%\fxc
REM Nuke some files that we will add to later.
set SHVER=20b
if defined IS30 (
set SHVER=30
)
title %1 %SHVER%
echo Building inc files and worklist for %inputbase%...
set DYNAMIC=
if "%dynamic_shaders%" == "1" set DYNAMIC=-Dynamic
powershell -NoLogo -ExecutionPolicy Bypass -Command "C:\SourceCodes\SourceCode2013\src_RTT\devtools\ShaderCompilerStandAlone\bin\process_shaders.ps1 %DYNAMIC% -Version %SHVER% '%inputbase%.txt'"
REM ****************
REM PC Shader copy
REM Publish the generated files to the output dir using XCOPY
REM This batch file may have been invoked standalone or slaved (master does final smart mirror copy)
REM ****************
:DoXCopy
if not "%dynamic_shaders%" == "1" (
if not exist "%targetdir%" md "%targetdir%"
if not "%targetdir%"=="%shaderDir%" xcopy %shaderDir%\*.* "%targetdir%" /e /y
)
goto end
REM ****************
REM END
REM ****************
:end
%TTEXE% -diff %tt_start%
echo.

46
devtools/base.xcconfig Normal file
View File

@@ -0,0 +1,46 @@
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS) $(SDKROOT)/usr/include/malloc
ARCHS = i386
ONLY_ACTIVE_ARCH = NO
COPY_PHASE_STRIP = NO
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
DEAD_CODE_STRIPPING = YES
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
GCC_C_LANGUAGE_STANDARD = gnu99
GCC_ENABLE_OBJC_EXCEPTIONS = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
GCC_REUSE_STRINGS = YES
// CPP11_NO_LIBCXX is used to gate some C++11 features that require that we
// switch to libc++. We haven't switched to libc++11 because we have been unable
// to find a clean way to build libcef_dll_wrapper with libc++.
// We currently build libcef for Steam which needs to run on 10.5, and Xcode
// does not support linking with libc++ and targeting 10.5.
// Once libcef_dll_wrapper has been built with libc++, and you rebuild protobuf
// with libc++ (which is trivial), you can remove CPP11_NO_LIBCXX and add the
// following line to the xcconfig:
// CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = _DLL_EXT=.dylib NO_MALLOC_OVERRIDE=1 VPROF_LEVEL=1 NO_HOOK_MALLOC=1 PNG_NO_PEDANTIC_WARNINGS CPP11_NO_LIBCXX
BASE_CFLAGS= -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE -ftemplate-depth=512
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO
WARNING_CFLAGS = -Wno-deprecated-writable-strings -Wno-switch-enum -Wno-switch -Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses -Wno-c++11-narrowing
// CLANG - and use the ccache wrapper
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
CC = $(SOURCE_ROOT)/devtools/bin/osx32/xcode_ccache_wrapper
LDPLUSPLUS = $(DT_TOOLCHAIN_DIR)/usr/bin/clang++
CLANG_WARN_CXX0X_EXTENSIONS = NO
CLANG_CXX_LANGUAGE_STANDARD = gnu++11
// include <memory.h> gets confused, 'cause ivp has one, and the system has one, and only one
// gets into the header map, so sacrifice speed for corectness.
USE_HEADERMAP = NO
SDKROOT = macosx10.9
MACOSX_DEPLOYMENT_TARGET = 10.5
GCC_FAST_MATH = YES

4
devtools/debug.xcconfig Normal file
View File

@@ -0,0 +1,4 @@
#include "base.xcconfig"
GCC_OPTIMIZATION_LEVEL = 0
OTHER_CFLAGS = $(derived) $(BASE_CFLAGS)

44
devtools/gendbg.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
OBJCOPY=objcopy
function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]"
echo ""
}
if [ $# == 0 ]; then
usage
exit 2
fi
if [ $(basename $1) == $1 ]; then
INFILEDIR=$PWD
else
INFILEDIR=$(cd ${1%/*} && echo $PWD)
fi
INFILE=$(basename $1)
OUTFILEDIR=$INFILEDIR
OUTFILE=$INFILE.dbg
while getopts "o:" opt; do
case $opt in
o)
OUTFILEDIR=$(cd ${OPTARG%/*} && echo $PWD)
OUTFILE=$(basename $OPTARG)
;;
esac
done
if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then
INFILE=${INFILEDIR}/${INFILE}
OUTFILE=${OUTFILEDIR}/${OUTFILE}
fi
pushd "$INFILEDIR"
$OBJCOPY "$INFILE" "$OUTFILE"
$OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE"
popd

View File

@@ -0,0 +1,4 @@
#include "base.xcconfig"
GCC_OPTIMIZATION_LEVEL = 2
OTHER_CFLAGS = $(derived) $(BASE_CFLAGS) -ftree-vectorize -funswitch-loops

View File

@@ -0,0 +1,3 @@
#defines these macros so that we skip VSIGN and P4 steps in the SDK
SOURCE_SDK=1
VALVE_NO_AUTO_P4=1

View File

@@ -0,0 +1,14 @@
{
global: *;
local:
extern "C++" {
*std::*;
__cxxabi*;
__gcc*;
__gxx*;
__gnu_cxx*;
__cxa*;
operator*;
__dynamic_cast
};
};

373
everything.sln Normal file
View File

@@ -0,0 +1,373 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Captioncompiler", "utils\captioncompiler\captioncompiler.vcxproj", "{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (HL2)", "game\client\client_hl2.vcxproj", "{09E5D61D-4897-7B98-288B-C87442D14BFF}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (Episodic)", "game\client\client_episodic.vcxproj", "{353A799F-E73F-7A69-07AD-B2AD57F3B775}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fgdlib", "fgdlib\fgdlib.vcxproj", "{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shaders (HL2)", "materialsystem\stdshaders\game_shader_dx9_hl2.vcxproj", "{74805285-4145-C5A1-26B3-11567E18F6FB}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shaders (Episodic)", "materialsystem\stdshaders\game_shader_dx9_episodic.vcxproj", "{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glview", "utils\glview\glview.vcxproj", "{DC76828F-1DD4-7E83-371E-EA4058FEE050}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Height2normal", "utils\height2normal\height2normal.vcxproj", "{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib.vcxproj", "{BAB92FF0-D72A-D7E5-1988-74628D39B94F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Motionmapper", "utils\motionmapper\motionmapper.vcxproj", "{C805838C-256D-6672-3417-589B6AF7D95E}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Phonemeextractor", "utils\phonemeextractor\phonemeextractor.vcxproj", "{079933D6-F849-3176-49FC-D50E4B461AC4}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QC_Eyes", "utils\qc_eyes\qc_eyes.vcxproj", "{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}"
ProjectSection(ProjectDependencies) = postProject
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Raytrace", "raytrace\raytrace.vcxproj", "{95D67225-8415-236F-9128-DCB171B7DEC6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (HL2)", "game\server\server_hl2.vcxproj", "{C3EE918E-6836-5578-1FA2-5703048552B9}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (Episodic)", "game\server\server_episodic.vcxproj", "{7855B476-B6D4-535D-F7A9-D623245F8B07}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Serverplugin_empty", "utils\serverplugin_sample\serverplugin_empty.vcxproj", "{394B82B6-3999-E576-5458-2D2EB4229509}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tgadiff", "utils\tgadiff\tgadiff.vcxproj", "{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1\tier1.vcxproj", "{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vbsp", "utils\vbsp\vbsp.vcxproj", "{E4F39B89-9731-571D-B69D-C1B8FE56C056}"
ProjectSection(ProjectDependencies) = postProject
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6} = {A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\vgui_controls\vgui_controls.vcxproj", "{F69B3672-C5E8-CD1A-257F-253A25B5B939}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vice", "utils\vice\vice.vcxproj", "{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vrad_dll", "utils\vrad\vrad_dll.vcxproj", "{90A78BD4-2532-39D9-6D34-7A3C2648508C}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{95D67225-8415-236F-9128-DCB171B7DEC6} = {95D67225-8415-236F-9128-DCB171B7DEC6}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vrad_launcher", "utils\vrad_launcher\vrad_launcher.vcxproj", "{0B6929D0-4447-E035-E47A-EBFCE557D5B3}"
ProjectSection(ProjectDependencies) = postProject
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vtf2tga", "utils\vtf2tga\vtf2tga.vcxproj", "{6B017447-F682-A137-8DF4-4608281F2C9F}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vtfdiff", "utils\vtfdiff\vtfdiff.vcxproj", "{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vvis_dll", "utils\vvis\vvis_dll.vcxproj", "{AC70A841-561F-4DAE-7864-E50541AD99ED}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vvis_launcher", "utils\vvis_launcher\vvis_launcher.vcxproj", "{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}"
ProjectSection(ProjectDependencies) = postProject
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Debug|Win32.ActiveCfg = Debug|Win32
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Debug|Win32.Build.0 = Debug|Win32
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Debug|x64.ActiveCfg = Debug|x64
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Debug|x64.Build.0 = Debug|x64
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Release|Win32.ActiveCfg = Release|Win32
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Release|Win32.Build.0 = Release|Win32
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Release|x64.ActiveCfg = Release|x64
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Release|x64.Build.0 = Release|x64
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|Win32.ActiveCfg = Debug|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|Win32.Build.0 = Debug|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|x64.ActiveCfg = Debug|x64
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|x64.Build.0 = Debug|x64
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|Win32.ActiveCfg = Release|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|Win32.Build.0 = Release|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|x64.ActiveCfg = Release|x64
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|x64.Build.0 = Release|x64
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|Win32.ActiveCfg = Debug|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|Win32.Build.0 = Debug|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|x64.ActiveCfg = Debug|x64
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|x64.Build.0 = Debug|x64
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|Win32.ActiveCfg = Release|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|Win32.Build.0 = Release|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|x64.ActiveCfg = Release|x64
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|x64.Build.0 = Release|x64
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Debug|Win32.ActiveCfg = Debug|Win32
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Debug|Win32.Build.0 = Debug|Win32
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Debug|x64.ActiveCfg = Debug|x64
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Debug|x64.Build.0 = Debug|x64
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Release|Win32.ActiveCfg = Release|Win32
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Release|Win32.Build.0 = Release|Win32
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Release|x64.ActiveCfg = Release|x64
{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}.Release|x64.Build.0 = Release|x64
{74805285-4145-C5A1-26B3-11567E18F6FB}.Debug|Win32.ActiveCfg = Debug|Win32
{74805285-4145-C5A1-26B3-11567E18F6FB}.Debug|Win32.Build.0 = Debug|Win32
{74805285-4145-C5A1-26B3-11567E18F6FB}.Debug|x64.ActiveCfg = Debug|Win32
{74805285-4145-C5A1-26B3-11567E18F6FB}.Release|Win32.ActiveCfg = Release|Win32
{74805285-4145-C5A1-26B3-11567E18F6FB}.Release|Win32.Build.0 = Release|Win32
{74805285-4145-C5A1-26B3-11567E18F6FB}.Release|x64.ActiveCfg = Release|Win32
{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}.Debug|Win32.ActiveCfg = Debug|Win32
{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}.Debug|Win32.Build.0 = Debug|Win32
{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}.Debug|x64.ActiveCfg = Debug|Win32
{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}.Release|Win32.ActiveCfg = Release|Win32
{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}.Release|Win32.Build.0 = Release|Win32
{73F37A6E-6BFF-33FB-E47D-67E8212A7C6D}.Release|x64.ActiveCfg = Release|Win32
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Debug|Win32.ActiveCfg = Debug|Win32
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Debug|Win32.Build.0 = Debug|Win32
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Debug|x64.ActiveCfg = Debug|x64
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Debug|x64.Build.0 = Debug|x64
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Release|Win32.ActiveCfg = Release|Win32
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Release|Win32.Build.0 = Release|Win32
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Release|x64.ActiveCfg = Release|x64
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Release|x64.Build.0 = Release|x64
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Debug|Win32.ActiveCfg = Debug|Win32
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Debug|Win32.Build.0 = Debug|Win32
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Debug|x64.ActiveCfg = Debug|x64
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Debug|x64.Build.0 = Debug|x64
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Release|Win32.ActiveCfg = Release|Win32
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Release|Win32.Build.0 = Release|Win32
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Release|x64.ActiveCfg = Release|x64
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Release|x64.Build.0 = Release|x64
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|Win32.ActiveCfg = Debug|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|Win32.Build.0 = Debug|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|x64.ActiveCfg = Debug|x64
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|x64.Build.0 = Debug|x64
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|Win32.ActiveCfg = Release|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|Win32.Build.0 = Release|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|x64.ActiveCfg = Release|x64
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|x64.Build.0 = Release|x64
{C805838C-256D-6672-3417-589B6AF7D95E}.Debug|Win32.ActiveCfg = Debug|Win32
{C805838C-256D-6672-3417-589B6AF7D95E}.Debug|Win32.Build.0 = Debug|Win32
{C805838C-256D-6672-3417-589B6AF7D95E}.Debug|x64.ActiveCfg = Debug|x64
{C805838C-256D-6672-3417-589B6AF7D95E}.Debug|x64.Build.0 = Debug|x64
{C805838C-256D-6672-3417-589B6AF7D95E}.Release|Win32.ActiveCfg = Release|Win32
{C805838C-256D-6672-3417-589B6AF7D95E}.Release|Win32.Build.0 = Release|Win32
{C805838C-256D-6672-3417-589B6AF7D95E}.Release|x64.ActiveCfg = Release|x64
{C805838C-256D-6672-3417-589B6AF7D95E}.Release|x64.Build.0 = Release|x64
{079933D6-F849-3176-49FC-D50E4B461AC4}.Debug|Win32.ActiveCfg = Debug|Win32
{079933D6-F849-3176-49FC-D50E4B461AC4}.Debug|Win32.Build.0 = Debug|Win32
{079933D6-F849-3176-49FC-D50E4B461AC4}.Debug|x64.ActiveCfg = Debug|x64
{079933D6-F849-3176-49FC-D50E4B461AC4}.Debug|x64.Build.0 = Debug|x64
{079933D6-F849-3176-49FC-D50E4B461AC4}.Release|Win32.ActiveCfg = Release|Win32
{079933D6-F849-3176-49FC-D50E4B461AC4}.Release|Win32.Build.0 = Release|Win32
{079933D6-F849-3176-49FC-D50E4B461AC4}.Release|x64.ActiveCfg = Release|x64
{079933D6-F849-3176-49FC-D50E4B461AC4}.Release|x64.Build.0 = Release|x64
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Debug|Win32.ActiveCfg = Debug|Win32
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Debug|Win32.Build.0 = Debug|Win32
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Debug|x64.ActiveCfg = Debug|x64
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Debug|x64.Build.0 = Debug|x64
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Release|Win32.ActiveCfg = Release|Win32
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Release|Win32.Build.0 = Release|Win32
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Release|x64.ActiveCfg = Release|x64
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Release|x64.Build.0 = Release|x64
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|Win32.ActiveCfg = Debug|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|Win32.Build.0 = Debug|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|x64.ActiveCfg = Debug|x64
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|x64.Build.0 = Debug|x64
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|Win32.ActiveCfg = Release|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|Win32.Build.0 = Release|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|x64.ActiveCfg = Release|x64
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|x64.Build.0 = Release|x64
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|Win32.ActiveCfg = Debug|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|Win32.Build.0 = Debug|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|x64.ActiveCfg = Debug|x64
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|x64.Build.0 = Debug|x64
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|Win32.ActiveCfg = Release|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|Win32.Build.0 = Release|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|x64.ActiveCfg = Release|x64
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|x64.Build.0 = Release|x64
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|Win32.ActiveCfg = Debug|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|Win32.Build.0 = Debug|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|x64.ActiveCfg = Debug|x64
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|x64.Build.0 = Debug|x64
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|Win32.ActiveCfg = Release|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|Win32.Build.0 = Release|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|x64.ActiveCfg = Release|x64
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|x64.Build.0 = Release|x64
{394B82B6-3999-E576-5458-2D2EB4229509}.Debug|Win32.ActiveCfg = Debug|Win32
{394B82B6-3999-E576-5458-2D2EB4229509}.Debug|Win32.Build.0 = Debug|Win32
{394B82B6-3999-E576-5458-2D2EB4229509}.Debug|x64.ActiveCfg = Debug|x64
{394B82B6-3999-E576-5458-2D2EB4229509}.Debug|x64.Build.0 = Debug|x64
{394B82B6-3999-E576-5458-2D2EB4229509}.Release|Win32.ActiveCfg = Release|Win32
{394B82B6-3999-E576-5458-2D2EB4229509}.Release|Win32.Build.0 = Release|Win32
{394B82B6-3999-E576-5458-2D2EB4229509}.Release|x64.ActiveCfg = Release|x64
{394B82B6-3999-E576-5458-2D2EB4229509}.Release|x64.Build.0 = Release|x64
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Debug|Win32.ActiveCfg = Debug|Win32
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Debug|Win32.Build.0 = Debug|Win32
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Debug|x64.ActiveCfg = Debug|x64
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Debug|x64.Build.0 = Debug|x64
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Release|Win32.ActiveCfg = Release|Win32
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Release|Win32.Build.0 = Release|Win32
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Release|x64.ActiveCfg = Release|x64
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Release|x64.Build.0 = Release|x64
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|Win32.ActiveCfg = Debug|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|Win32.Build.0 = Debug|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|x64.ActiveCfg = Debug|x64
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|x64.Build.0 = Debug|x64
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|Win32.ActiveCfg = Release|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|Win32.Build.0 = Release|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|x64.ActiveCfg = Release|x64
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|x64.Build.0 = Release|x64
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Debug|Win32.ActiveCfg = Debug|Win32
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Debug|Win32.Build.0 = Debug|Win32
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Debug|x64.ActiveCfg = Debug|x64
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Debug|x64.Build.0 = Debug|x64
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Release|Win32.ActiveCfg = Release|Win32
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Release|Win32.Build.0 = Release|Win32
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Release|x64.ActiveCfg = Release|x64
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Release|x64.Build.0 = Release|x64
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|Win32.ActiveCfg = Debug|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|Win32.Build.0 = Debug|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|x64.ActiveCfg = Debug|x64
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|x64.Build.0 = Debug|x64
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|Win32.ActiveCfg = Release|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|Win32.Build.0 = Release|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|x64.ActiveCfg = Release|x64
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|x64.Build.0 = Release|x64
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Debug|Win32.ActiveCfg = Debug|Win32
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Debug|Win32.Build.0 = Debug|Win32
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Debug|x64.ActiveCfg = Debug|x64
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Debug|x64.Build.0 = Debug|x64
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Release|Win32.ActiveCfg = Release|Win32
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Release|Win32.Build.0 = Release|Win32
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Release|x64.ActiveCfg = Release|x64
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Release|x64.Build.0 = Release|x64
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Debug|Win32.ActiveCfg = Debug|Win32
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Debug|Win32.Build.0 = Debug|Win32
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Debug|x64.ActiveCfg = Debug|x64
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Debug|x64.Build.0 = Debug|x64
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Release|Win32.ActiveCfg = Release|Win32
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Release|Win32.Build.0 = Release|Win32
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Release|x64.ActiveCfg = Release|x64
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Release|x64.Build.0 = Release|x64
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Debug|Win32.ActiveCfg = Debug|Win32
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Debug|Win32.Build.0 = Debug|Win32
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Debug|x64.ActiveCfg = Debug|x64
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Debug|x64.Build.0 = Debug|x64
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Release|Win32.ActiveCfg = Release|Win32
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Release|Win32.Build.0 = Release|Win32
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Release|x64.ActiveCfg = Release|x64
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Release|x64.Build.0 = Release|x64
{6B017447-F682-A137-8DF4-4608281F2C9F}.Debug|Win32.ActiveCfg = Debug|Win32
{6B017447-F682-A137-8DF4-4608281F2C9F}.Debug|Win32.Build.0 = Debug|Win32
{6B017447-F682-A137-8DF4-4608281F2C9F}.Debug|x64.ActiveCfg = Debug|x64
{6B017447-F682-A137-8DF4-4608281F2C9F}.Debug|x64.Build.0 = Debug|x64
{6B017447-F682-A137-8DF4-4608281F2C9F}.Release|Win32.ActiveCfg = Release|Win32
{6B017447-F682-A137-8DF4-4608281F2C9F}.Release|Win32.Build.0 = Release|Win32
{6B017447-F682-A137-8DF4-4608281F2C9F}.Release|x64.ActiveCfg = Release|x64
{6B017447-F682-A137-8DF4-4608281F2C9F}.Release|x64.Build.0 = Release|x64
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Debug|Win32.ActiveCfg = Debug|Win32
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Debug|Win32.Build.0 = Debug|Win32
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Debug|x64.ActiveCfg = Debug|x64
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Debug|x64.Build.0 = Debug|x64
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Release|Win32.ActiveCfg = Release|Win32
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Release|Win32.Build.0 = Release|Win32
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Release|x64.ActiveCfg = Release|x64
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Release|x64.Build.0 = Release|x64
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Debug|Win32.ActiveCfg = Debug|Win32
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Debug|Win32.Build.0 = Debug|Win32
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Debug|x64.ActiveCfg = Debug|x64
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Debug|x64.Build.0 = Debug|x64
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Release|Win32.ActiveCfg = Release|Win32
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Release|Win32.Build.0 = Release|Win32
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Release|x64.ActiveCfg = Release|x64
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Release|x64.Build.0 = Release|x64
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Debug|Win32.ActiveCfg = Debug|Win32
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Debug|Win32.Build.0 = Debug|Win32
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Debug|x64.ActiveCfg = Debug|x64
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Debug|x64.Build.0 = Debug|x64
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Release|Win32.ActiveCfg = Release|Win32
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Release|Win32.Build.0 = Release|Win32
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Release|x64.ActiveCfg = Release|x64
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

420
fgdlib/fgdlib.vcxproj Normal file
View File

@@ -0,0 +1,420 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>Fgdlib</ProjectName>
<ProjectGuid>{A2ACA839-712B-1CD6-60AA-5D1BC7C8BAE6}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<TargetName>fgdlib</TargetName>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<TargetName>fgdlib</TargetName>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<TargetName>fgdlib</TargetName>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<TargetName>fgdlib</TargetName>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\public\.\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\.\</IntDir>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\devtools\vstools;$(ExecutablePath);$(Path)</ExecutablePath>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\devtools\vstools;$(ExecutablePath);$(Path)</ExecutablePath>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreLinkEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PostBuildEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PostBuildEventUseInBuild>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\public\.\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\.\</IntDir>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\devtools\vstools;$(ExecutablePath);$(Path)</ExecutablePath>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\devtools\vstools;$(ExecutablePath);$(Path)</ExecutablePath>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreBuildEventUseInBuild>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreLinkEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PostBuildEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>if EXIST ..\lib\public\.\$(TargetName).lib ( for /f "delims=" %%A in ('attrib "..\lib\public\.\$(TargetName).lib"') do set valveTmpIsReadOnly="%%A"
) else ( if not EXIST ..\lib\public\. mkdir ..\lib\public\. )
set valveTmpIsReadOnlyLetter=%valveTmpIsReadOnly:~6,1%
if "%valveTmpIsReadOnlyLetter%"=="R" (
attrib -r ..\lib\public\.\$(TargetName).lib
..\devtools\bin\gnu\touch.exe -d "1999-01-01" ..\lib\public\.\$(TargetName).lib
attrib +r ..\lib\public\.\$(TargetName).lib
)
if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalOptions> /Gw</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\common;..\public;..\public\tier0;..\public\tier1;..\utils\common</AdditionalIncludeDirectories>
<PreprocessorDefinitions>VPC;RAD_TELEMETRY_DISABLED;_HAS_ITERATOR_DEBUGGING=0;WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions);COMPILER_MSVC32;COMPILER_MSVC32;COMPILER_MSVC;_DLL_EXT=.dll;LIBNAME=fgdlib;BINK_VIDEO;AVI_VIDEO;WMV_VIDEO;DEV_BUILD;FRAME_POINTER_OMISSION_DISABLED;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=VALVE;PROJECTDIR=C:\games\source-sdk-2013-master\sp\src\fgdlib;_DLL_EXT=.dll;VPCGAME=valve;SOURCE1=1</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)/</AssemblerListingLocation>
<ObjectFileName>$(IntDir)/</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)/</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>false</BrowseInformation>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<UseFullPaths>true</UseFullPaths>
<DisableSpecificWarnings>;4316</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BrowseInformationFile>$(IntDir)/</BrowseInformationFile>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>..\lib\public\.\fgdlib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalOptions> /ignore:4221</AdditionalOptions>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)/fgdlib.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
</PostBuildEvent>
<CustomBuildStep>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>if EXIST ..\lib\public\.\$(TargetName).lib ( for /f "delims=" %%A in ('attrib "..\lib\public\.\$(TargetName).lib"') do set valveTmpIsReadOnly="%%A"
) else ( if not EXIST ..\lib\public\. mkdir ..\lib\public\. )
set valveTmpIsReadOnlyLetter=%valveTmpIsReadOnly:~6,1%
if "%valveTmpIsReadOnlyLetter%"=="R" (
attrib -r ..\lib\public\.\$(TargetName).lib
..\devtools\bin\gnu\touch.exe -d "1999-01-01" ..\lib\public\.\$(TargetName).lib
attrib +r ..\lib\public\.\$(TargetName).lib
)
if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalOptions> /Gw</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\common;..\public;..\public\tier0;..\public\tier1;..\utils\common</AdditionalIncludeDirectories>
<PreprocessorDefinitions>VPC;RAD_TELEMETRY_DISABLED;_HAS_ITERATOR_DEBUGGING=0;WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions);COMPILER_MSVC32;COMPILER_MSVC32;COMPILER_MSVC;_DLL_EXT=.dll;LIBNAME=fgdlib;BINK_VIDEO;AVI_VIDEO;WMV_VIDEO;DEV_BUILD;FRAME_POINTER_OMISSION_DISABLED;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=VALVE;PROJECTDIR=C:\games\source-sdk-2013-master\sp\src\fgdlib;_DLL_EXT=.dll;VPCGAME=valve;SOURCE1=1</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)/</AssemblerListingLocation>
<ObjectFileName>$(IntDir)/</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)/</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>false</BrowseInformation>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<UseFullPaths>true</UseFullPaths>
<DisableSpecificWarnings>;4316</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BrowseInformationFile>$(IntDir)/</BrowseInformationFile>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent />
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>..\lib\public\.\fgdlib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalOptions> /ignore:4221</AdditionalOptions>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)/fgdlib.bsc</OutputFile>
</Bscmake>
<PostBuildEvent />
<CustomBuildStep />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>if EXIST ..\lib\public\.\$(TargetName).lib ( for /f "delims=" %%A in ('attrib "..\lib\public\.\$(TargetName).lib"') do set valveTmpIsReadOnly="%%A"
) else ( if not EXIST ..\lib\public\. mkdir ..\lib\public\. )
set valveTmpIsReadOnlyLetter=%valveTmpIsReadOnly:~6,1%
if "%valveTmpIsReadOnlyLetter%"=="R" (
attrib -r ..\lib\public\.\$(TargetName).lib
..\devtools\bin\gnu\touch.exe -d "1999-01-01" ..\lib\public\.\$(TargetName).lib
attrib +r ..\lib\public\.\$(TargetName).lib
)
if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalOptions>/d2Zi+ /Gw</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\common;..\public;..\public\tier0;..\public\tier1;..\utils\common</AdditionalIncludeDirectories>
<PreprocessorDefinitions>VPC;RAD_TELEMETRY_DISABLED;WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions);COMPILER_MSVC32;COMPILER_MSVC32;COMPILER_MSVC;_DLL_EXT=.dll;LIBNAME=fgdlib;BINK_VIDEO;AVI_VIDEO;WMV_VIDEO;DEV_BUILD;FRAME_POINTER_OMISSION_DISABLED;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=VALVE;PROJECTDIR=C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib;_DLL_EXT=.dll;VPCGAME=valve;SOURCE1=1</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)/</AssemblerListingLocation>
<ObjectFileName>$(IntDir)/</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)/</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>false</BrowseInformation>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<UseFullPaths>true</UseFullPaths>
<DisableSpecificWarnings>;4316</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BrowseInformationFile>$(IntDir)/</BrowseInformationFile>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>..\lib\public\.\fgdlib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalOptions> /ignore:4221</AdditionalOptions>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)/fgdlib.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
</PostBuildEvent>
<CustomBuildStep>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>if EXIST ..\lib\public\.\$(TargetName).lib ( for /f "delims=" %%A in ('attrib "..\lib\public\.\$(TargetName).lib"') do set valveTmpIsReadOnly="%%A"
) else ( if not EXIST ..\lib\public\. mkdir ..\lib\public\. )
set valveTmpIsReadOnlyLetter=%valveTmpIsReadOnly:~6,1%
if "%valveTmpIsReadOnlyLetter%"=="R" (
attrib -r ..\lib\public\.\$(TargetName).lib
..\devtools\bin\gnu\touch.exe -d "1999-01-01" ..\lib\public\.\$(TargetName).lib
attrib +r ..\lib\public\.\$(TargetName).lib
)
if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalOptions>/d2Zi+ /Gw</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\common;..\public;..\public\tier0;..\public\tier1;..\utils\common</AdditionalIncludeDirectories>
<PreprocessorDefinitions>VPC;RAD_TELEMETRY_DISABLED;WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions);COMPILER_MSVC32;COMPILER_MSVC32;COMPILER_MSVC;_DLL_EXT=.dll;LIBNAME=fgdlib;BINK_VIDEO;AVI_VIDEO;WMV_VIDEO;DEV_BUILD;FRAME_POINTER_OMISSION_DISABLED;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=VALVE;PROJECTDIR=C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib;_DLL_EXT=.dll;VPCGAME=valve;SOURCE1=1</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)/</AssemblerListingLocation>
<ObjectFileName>$(IntDir)/</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)/</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>false</BrowseInformation>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<UseFullPaths>true</UseFullPaths>
<DisableSpecificWarnings>;4316</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BrowseInformationFile>$(IntDir)/</BrowseInformationFile>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent />
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>..\lib\public\.\fgdlib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalOptions> /ignore:4221</AdditionalOptions>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)/fgdlib.bsc</OutputFile>
</Bscmake>
<PostBuildEvent />
<CustomBuildStep />
</ItemDefinitionGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\fgdlib\fgdlib.h" />
<ClInclude Include="..\public\fgdlib\gamedata.h" />
<ClInclude Include="..\public\fgdlib\gdclass.h" />
<ClInclude Include="..\public\fgdlib\gdvar.h" />
<ClInclude Include="..\public\fgdlib\helperinfo.h" />
<ClInclude Include="..\public\fgdlib\ieditortexture.h" />
<ClInclude Include="..\public\fgdlib\inputoutput.h" />
<ClInclude Include="..\public\fgdlib\wckeyvalues.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="gamedata.cpp" />
<ClCompile Include="gdclass.cpp" />
<ClCompile Include="gdvar.cpp" />
<ClCompile Include="inputoutput.cpp" />
<ClCompile Include="wckeyvalues.cpp" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fgdlib.vpc">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Running VPC CRC Check - fgdlib.vpc</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Running VPC CRC Check - fgdlib.vpc</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
echo crc_complete &gt; C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
echo crc_complete &gt; C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Running VPC CRC Check - fgdlib.vpc</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Running VPC CRC Check - fgdlib.vpc</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
echo crc_complete &gt; C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "fgdlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
echo crc_complete &gt; C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\fgdlib\fgdlib.vpc.sentinel</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="..\vpc_scripts\platform_dirs.vpc" />
<None Include="..\vpc_scripts\source_base.vpc" />
<None Include="..\vpc_scripts\source_lib_base.vpc" />
<None Include="..\vpc_scripts\source_lib_win32_base.vpc" />
<None Include="..\vpc_scripts\source_lib_win32_debug.vpc" />
<None Include="..\vpc_scripts\source_lib_win32_release.vpc" />
<None Include="..\vpc_scripts\source_video_base.vpc" />
<None Include="..\vpc_scripts\source_win32_base.vpc" />
<None Include="..\vpc_scripts\version.vpc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{1680C80B-FF1E-EA4D-9817-CC12254F2E40}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{BA03E055-4FA2-FCE3-8A1C-D348547D379C}</UniqueIdentifier>
</Filter>
<Filter Include="VPC Scripts">
<UniqueIdentifier>{A40EE377-781A-C6B9-0C7C-B3BE118D248E}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\fgdlib\fgdlib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\gamedata.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\gdclass.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\gdvar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\helperinfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\ieditortexture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\inputoutput.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\fgdlib\wckeyvalues.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="gamedata.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gdclass.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gdvar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="inputoutput.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="wckeyvalues.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fgdlib.vpc">
<Filter>VPC Scripts</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="..\vpc_scripts\platform_dirs.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_base.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_lib_base.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_lib_win32_base.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_lib_win32_debug.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_lib_win32_release.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_video_base.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\source_win32_base.vpc">
<Filter>VPC Scripts</Filter>
</None>
<None Include="..\vpc_scripts\version.vpc">
<Filter>VPC Scripts</Filter>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,14 @@
[vpc crc file version 2]
8209bbc3 C:\games\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\source-sdk-2013-master\sp\src\devtools\bin\vpc.exe
_Nc_VS2013/vpcgame:valve_
ed801fba fgdlib.vpc
30577f77 ..\vpc_scripts\source_lib_base.vpc
d752cf80 ..\vpc_scripts\platform_dirs.vpc
6c4a5ff1 ..\vpc_scripts\source_base.vpc
5dd0225a ..\vpc_scripts\source_lib_win32_base.vpc
486b766d ..\vpc_scripts\version.vpc
fe1ec01f ..\vpc_scripts\source_lib_win32_debug.vpc
e0f4e727 ..\vpc_scripts\source_lib_win32_release.vpc
34c37fcf ..\vpc_scripts\source_win32_base.vpc
346bda4a ..\vpc_scripts\source_video_base.vpc
30bf2216 ..\vpc_scripts\definitions\win32_2010.def

40
fgdlib/fgdlib.vpc Normal file
View File

@@ -0,0 +1,40 @@
//-----------------------------------------------------------------------------
// FGDLIB.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR ".."
$Include "$SRCDIR\vpc_scripts\source_lib_base.vpc"
$Configuration
{
$Compiler
{
$AdditionalIncludeDirectories "$BASE,$SRCDIR\utils\common"
}
}
$Project "Fgdlib"
{
$Folder "Source Files"
{
$File "gamedata.cpp"
$File "gdclass.cpp"
$File "gdvar.cpp"
$File "inputoutput.cpp"
$File "wckeyvalues.cpp"
}
$Folder "Header Files"
{
$File "$SRCDIR\public\fgdlib\fgdlib.h"
$File "$SRCDIR\public\fgdlib\gamedata.h"
$File "$SRCDIR\public\fgdlib\gdclass.h"
$File "$SRCDIR\public\fgdlib\gdvar.h"
$File "$SRCDIR\public\fgdlib\helperinfo.h"
$File "$SRCDIR\public\fgdlib\ieditortexture.h"
$File "$SRCDIR\public\fgdlib\inputoutput.h"
$File "$SRCDIR\public\fgdlib\wckeyvalues.h"
}
}

886
fgdlib/gamedata.cpp Normal file
View File

@@ -0,0 +1,886 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=============================================================================
#include <windows.h>
#include <tier0/dbg.h>
#include <io.h>
#include <WorldSize.h>
#include "fgdlib/GameData.h"
#include "fgdlib/HelperInfo.h"
#include "KeyValues.h"
#include "filesystem_tools.h"
#include "tier1/strtools.h"
#include "utlmap.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#pragma warning(disable:4244)
const int MAX_ERRORS = 5;
static GameDataMessageFunc_t g_pMsgFunc = NULL;
//-----------------------------------------------------------------------------
// Sets the function used for emitting error messages while loading gamedata files.
//-----------------------------------------------------------------------------
void GDSetMessageFunc(GameDataMessageFunc_t pFunc)
{
g_pMsgFunc = pFunc;
}
//-----------------------------------------------------------------------------
// Purpose: Fetches the next token from the file.
// Input : tr -
// ppszStore - Destination buffer, one of the following:
// pointer to NULL - token will be placed in an allocated buffer
// pointer to non-NULL buffer - token will be placed in buffer
// ttexpecting -
// pszExpecting -
// Output :
//-----------------------------------------------------------------------------
static bool DoGetToken(TokenReader &tr, char **ppszStore, int nSize, trtoken_t ttexpecting, const char *pszExpecting)
{
trtoken_t ttype;
if (*ppszStore != NULL)
{
// Reads the token into the given buffer.
ttype = tr.NextToken(*ppszStore, nSize);
}
else
{
// Allocates a buffer to hold the token.
ttype = tr.NextTokenDynamic(ppszStore);
}
if (ttype == TOKENSTRINGTOOLONG)
{
GDError(tr, "unterminated string or string too long");
return false;
}
//
// Check for a bad token type.
//
char *pszStore = *ppszStore;
bool bBadTokenType = false;
if ((ttype != ttexpecting) && (ttexpecting != TOKENNONE))
{
//
// If we were expecting a string and got an integer, don't worry about it.
// We can translate from integer to string.
//
if (!((ttexpecting == STRING) && (ttype == INTEGER)))
{
bBadTokenType = true;
}
}
if (bBadTokenType && (pszExpecting == NULL))
{
//
// We didn't get the expected token type but no expected
// string was specified.
//
char *pszTokenName;
switch (ttexpecting)
{
case IDENT:
{
pszTokenName = "identifier";
break;
}
case INTEGER:
{
pszTokenName = "integer";
break;
}
case STRING:
{
pszTokenName = "string";
break;
}
case OPERATOR:
default:
{
pszTokenName = "symbol";
break;
}
}
GDError(tr, "expecting %s", pszTokenName);
return false;
}
else if (bBadTokenType || ((pszExpecting != NULL) && !IsToken(pszStore, pszExpecting)))
{
//
// An expected string was specified, and we got either the wrong type or
// the right type but the wrong string,
//
GDError(tr, "expecting '%s', but found '%s'", pszExpecting, pszStore);
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : tr -
// error -
// Output :
//-----------------------------------------------------------------------------
bool GDError(TokenReader &tr, const char *error, ...)
{
char szBuf[128];
va_list vl;
va_start(vl, error);
vsprintf(szBuf, error, vl);
va_end(vl);
if (g_pMsgFunc)
{
// HACK: should use an enumeration for error level
g_pMsgFunc(1, tr.Error(szBuf));
}
if (tr.GetErrorCount() >= MAX_ERRORS)
{
if (g_pMsgFunc)
{
// HACK: should use an enumeration for error level
g_pMsgFunc(1, " - too many errors; aborting.");
}
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Fetches the next token from the file.
// Input : tr - The token reader object with which to fetch the token.
// pszStore - Buffer in which to place the token, NULL to discard the token.
// ttexpecting - The token type that we are expecting. If this is not TOKENNONE
// and token type read is different, the operation will fail.
// pszExpecting - The token string that we are expecting. If this string
// is not NULL and the token string read is different, the operation will fail.
// Output : Returns TRUE if the operation succeeded, FALSE if there was an error.
// If there was an error, the error will be reported in the message window.
//-----------------------------------------------------------------------------
bool GDGetToken(TokenReader &tr, char *pszStore, int nSize, trtoken_t ttexpecting, const char *pszExpecting)
{
Assert(pszStore != NULL);
if (pszStore != NULL)
{
return DoGetToken(tr, &pszStore, nSize, ttexpecting, pszExpecting);
}
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Fetches the next token from the file.
// Input : tr - The token reader object with which to fetch the token.
// pszStore - Buffer in which to place the token, NULL to discard the token.
// ttexpecting - The token type that we are expecting. If this is not TOKENNONE
// and token type read is different, the operation will fail.
// pszExpecting - The token string that we are expecting. If this string
// is not NULL and the token string read is different, the operation will fail.
// Output : Returns TRUE if the operation succeeded, FALSE if there was an error.
// If there was an error, the error will be reported in the message window.
//-----------------------------------------------------------------------------
bool GDSkipToken(TokenReader &tr, trtoken_t ttexpecting, const char *pszExpecting)
{
//
// Read the next token into a buffer and discard it.
//
char szDiscardBuf[MAX_TOKEN];
char *pszDiscardBuf = szDiscardBuf;
return DoGetToken(tr, &pszDiscardBuf, sizeof(szDiscardBuf), ttexpecting, pszExpecting);
}
//-----------------------------------------------------------------------------
// Purpose: Fetches the next token from the file, allocating a buffer exactly
// large enough to hold the token.
// Input : tr -
// ppszStore -
// ttexpecting -
// pszExpecting -
// Output :
//-----------------------------------------------------------------------------
bool GDGetTokenDynamic(TokenReader &tr, char **ppszStore, trtoken_t ttexpecting, const char *pszExpecting)
{
if (ppszStore == NULL)
{
return false;
}
*ppszStore = NULL;
return DoGetToken(tr, ppszStore, -1, ttexpecting, pszExpecting);
}
//-----------------------------------------------------------------------------
// Purpose: Constructor.
//-----------------------------------------------------------------------------
GameData::GameData(void)
{
m_nMaxMapCoord = 8192;
m_nMinMapCoord = -8192;
m_InstanceClass = NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Destructor.
//-----------------------------------------------------------------------------
GameData::~GameData(void)
{
ClearData();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void GameData::ClearData(void)
{
// delete classes.
int nCount = m_Classes.Count();
for (int i = 0; i < nCount; i++)
{
GDclass *pm = m_Classes.Element(i);
delete pm;
}
m_Classes.RemoveAll();
}
//-----------------------------------------------------------------------------
// Purpose: Loads a gamedata (FGD) file into this object.
// Input : pszFilename -
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL GameData::Load(const char *pszFilename)
{
TokenReader tr;
if(GetFileAttributes(pszFilename) == 0xffffffff)
return FALSE;
if(!tr.Open(pszFilename))
return FALSE;
trtoken_t ttype;
char szToken[128];
while (1)
{
if (tr.GetErrorCount() >= MAX_ERRORS)
{
break;
}
ttype = tr.NextToken(szToken, sizeof(szToken));
if(ttype == TOKENEOF)
break;
if(ttype != OPERATOR || !IsToken(szToken, "@"))
{
if(!GDError(tr, "expected @"))
return FALSE;
}
// check what kind it is, and parse a new object
if (tr.NextToken(szToken, sizeof(szToken)) != IDENT)
{
if(!GDError(tr, "expected identifier after @"))
return FALSE;
}
if (IsToken(szToken, "baseclass") || IsToken(szToken, "pointclass") || IsToken(szToken, "solidclass") || IsToken(szToken, "keyframeclass") ||
IsToken(szToken, "moveclass") || IsToken(szToken, "npcclass") || IsToken(szToken, "filterclass"))
{
//
// New class.
//
GDclass *pNewClass = new GDclass;
if (!pNewClass->InitFromTokens(tr, this))
{
tr.IgnoreTill(OPERATOR, "@"); // go to next section
delete pNewClass;
}
else
{
if (IsToken(szToken, "baseclass")) // Not directly available to user.
{
pNewClass->SetBaseClass(true);
}
else if (IsToken(szToken, "pointclass")) // Generic point class.
{
pNewClass->SetPointClass(true);
}
else if (IsToken(szToken, "solidclass")) // Tied to solids.
{
pNewClass->SetSolidClass(true);
}
else if (IsToken(szToken, "npcclass")) // NPC class - can be spawned by npc_maker.
{
pNewClass->SetPointClass(true);
pNewClass->SetNPCClass(true);
}
else if (IsToken(szToken, "filterclass")) // Filter class - can be used as a filter
{
pNewClass->SetPointClass(true);
pNewClass->SetFilterClass(true);
}
else if (IsToken(szToken, "moveclass")) // Animating
{
pNewClass->SetMoveClass(true);
pNewClass->SetPointClass(true);
}
else if (IsToken(szToken, "keyframeclass")) // Animation keyframes
{
pNewClass->SetKeyFrameClass(true);
pNewClass->SetPointClass(true);
}
// Check and see if this new class matches an existing one. If so we will override the previous definition.
int nExistingClassIndex = 0;
GDclass *pExistingClass = ClassForName(pNewClass->GetName(), &nExistingClassIndex);
if (NULL != pExistingClass)
{
m_Classes.InsertAfter(nExistingClassIndex, pNewClass);
m_Classes.Remove(nExistingClassIndex);
}
else
{
m_Classes.AddToTail(pNewClass);
}
}
}
else if (IsToken(szToken, "include"))
{
if (GDGetToken(tr, szToken, sizeof(szToken), STRING))
{
// Let's assume it's in the same directory.
char justPath[MAX_PATH], loadFilename[MAX_PATH];
if ( Q_ExtractFilePath( pszFilename, justPath, sizeof( justPath ) ) )
{
Q_snprintf( loadFilename, sizeof( loadFilename ), "%s%s", justPath, szToken );
}
else
{
Q_strncpy( loadFilename, szToken, sizeof( loadFilename ) );
}
// First try our fully specified directory
if (!Load(loadFilename))
{
// Failing that, try our start directory
if (!Load(szToken))
{
GDError(tr, "error including file: %s", szToken);
}
}
}
}
else if (IsToken(szToken, "mapsize"))
{
if (!ParseMapSize(tr))
{
// Error in map size specifier, skip to next @ sign.
tr.IgnoreTill(OPERATOR, "@");
}
}
else if ( IsToken( szToken, "materialexclusion" ) )
{
if ( !LoadFGDMaterialExclusions( tr ) )
{
// FGD exclusions not defined; skip to next @ sign.
tr.IgnoreTill(OPERATOR, "@");
}
}
else if ( IsToken( szToken, "autovisgroup" ) )
{
if ( !LoadFGDAutoVisGroups( tr ) )
{
// FGD AutoVisGroups not defined; skip to next @ sign.
tr.IgnoreTill(OPERATOR, "@");
}
}
else
{
GDError(tr, "unrecognized section name %s", szToken);
tr.IgnoreTill(OPERATOR, "@");
}
}
if (tr.GetErrorCount() > 0)
{
return FALSE;
}
tr.Close();
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose: Parses the "mapsize" specifier, which should be of the form:
//
// mapsize(min, max)
//
// ex: mapsize(-8192, 8192)
//
// Input : tr -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool GameData::ParseMapSize(TokenReader &tr)
{
if (!GDSkipToken(tr, OPERATOR, "("))
{
return false;
}
char szToken[128];
if (!GDGetToken(tr, szToken, sizeof(szToken), INTEGER))
{
return false;
}
int nMin = atoi(szToken);
if (!GDSkipToken(tr, OPERATOR, ","))
{
return false;
}
if (!GDGetToken(tr, szToken, sizeof(szToken), INTEGER))
{
return false;
}
int nMax = atoi(szToken);
if (nMin != nMax)
{
m_nMinMapCoord = min(nMin, nMax);
m_nMaxMapCoord = max(nMin, nMax);
}
if (!GDSkipToken(tr, OPERATOR, ")"))
{
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pszName -
// piIndex -
// Output :
//-----------------------------------------------------------------------------
GDclass *GameData::ClassForName(const char *pszName, int *piIndex)
{
int nCount = m_Classes.Count();
for (int i = 0; i < nCount; i++)
{
GDclass *mp = m_Classes.Element(i);
if(!strcmp(mp->GetName(), pszName))
{
if(piIndex)
piIndex[0] = i;
return mp;
}
}
return NULL;
}
// These are 'standard' keys that every entity uses, but they aren't specified that way in the .fgd
static const char *RequiredKeys[] =
{
"Origin",
"Angles",
NULL
};
//-----------------------------------------------------------------------------
// Purpose: this function will set up the initial class about to be instanced
// Input : pszClassName - the class name of the entity to be instanced
// pszInstancePrefix - the prefix to be used for all name fields
// Origin - the origin offset of the instance
// Angles - the angle rotation of the instance
// Output : if successful, will return the game data class of the class name
//-----------------------------------------------------------------------------
GDclass *GameData::BeginInstanceRemap( const char *pszClassName, const char *pszInstancePrefix, Vector &Origin, QAngle &Angle )
{
m_InstanceOrigin = Origin;
m_InstanceAngle = Angle;
AngleMatrix( m_InstanceAngle, m_InstanceOrigin, m_InstanceMat );
strcpy( m_InstancePrefix, pszInstancePrefix );
if ( m_InstanceClass )
{
delete m_InstanceClass;
m_InstanceClass = NULL;
}
if ( strcmpi( pszClassName, "info_overlay_accessor" ) == 0 )
{ // yucky hack for a made up entity in the bsp process
pszClassName = "info_overlay";
}
GDclass *BaseClass = ClassForName( pszClassName );
if ( BaseClass )
{
m_InstanceClass = new GDclass();
m_InstanceClass->Parent = this;
m_InstanceClass->AddBase( BaseClass );
for( int i = 0; RequiredKeys[ i ]; i++ )
{
if ( m_InstanceClass->VarForName( RequiredKeys[ i ] ) == NULL )
{
BaseClass = ClassForName( RequiredKeys[ i ] );
if ( BaseClass )
{
m_InstanceClass->AddBase( BaseClass );
}
}
}
}
else
{
m_InstanceClass = NULL;
}
return m_InstanceClass;
}
enum tRemapOperation
{
REMAP_NAME = 0,
REMAP_POSITION,
REMAP_ANGLE,
REMAP_ANGLE_NEGATIVE_PITCH,
};
static CUtlMap< GDIV_TYPE, tRemapOperation > RemapOperation;
//-----------------------------------------------------------------------------
// Purpose: function to sort the class type for the RemapOperations map
// Input : type1 - the first type to compare against
// type2 - the second type to compare against
// Output : returns true if the first type is less than the second one
//-----------------------------------------------------------------------------
static bool CUtlType_LessThan( const GDIV_TYPE &type1, const GDIV_TYPE &type2 )
{
return ( type1 < type2 );
}
//-----------------------------------------------------------------------------
// Purpose: this function will attempt to remap a key's value
// Input : pszKey - the name of the key
// pszInvalue - the original value
// AllowNameRemapping - only do name remapping if this parameter is true.
// this is generally only false on the instance level.
// Output : returns true if the value changed
// pszOutValue - the new value if changed
//-----------------------------------------------------------------------------
bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *pszOutValue, TNameFixup NameFixup )
{
if ( RemapOperation.Count() == 0 )
{
RemapOperation.SetLessFunc( &CUtlType_LessThan );
RemapOperation.Insert( ivAngle, REMAP_ANGLE );
RemapOperation.Insert( ivTargetDest, REMAP_NAME );
RemapOperation.Insert( ivTargetSrc, REMAP_NAME );
RemapOperation.Insert( ivOrigin, REMAP_POSITION );
RemapOperation.Insert( ivAxis, REMAP_ANGLE );
RemapOperation.Insert( ivAngleNegativePitch, REMAP_ANGLE_NEGATIVE_PITCH );
}
if ( !m_InstanceClass )
{
return false;
}
GDinputvariable *KVVar = m_InstanceClass->VarForName( pszKey );
if ( !KVVar )
{
return false;
}
GDIV_TYPE KVType = KVVar->GetType();
int KVRemapIndex = RemapOperation.Find( KVType );
if ( KVRemapIndex == RemapOperation.InvalidIndex() )
{
return false;
}
strcpy( pszOutValue, pszInValue );
switch( RemapOperation[ KVRemapIndex ] )
{
case REMAP_NAME:
if ( KVType != ivInstanceVariable )
{
RemapNameField( pszInValue, pszOutValue, NameFixup );
}
break;
case REMAP_POSITION:
{
Vector inPoint( 0.0f, 0.0f, 0.0f ), outPoint;
sscanf ( pszInValue, "%f %f %f", &inPoint.x, &inPoint.y, &inPoint.z );
VectorTransform( inPoint, m_InstanceMat, outPoint );
sprintf( pszOutValue, "%g %g %g", outPoint.x, outPoint.y, outPoint.z );
}
break;
case REMAP_ANGLE:
if ( m_InstanceAngle.x != 0.0f || m_InstanceAngle.y != 0.0f || m_InstanceAngle.z != 0.0f )
{
QAngle inAngles( 0.0f, 0.0f, 0.0f ), outAngles;
matrix3x4_t angToWorld, localMatrix;
sscanf ( pszInValue, "%f %f %f", &inAngles.x, &inAngles.y, &inAngles.z );
AngleMatrix( inAngles, angToWorld );
MatrixMultiply( m_InstanceMat, angToWorld, localMatrix );
MatrixAngles( localMatrix, outAngles );
sprintf( pszOutValue, "%g %g %g", outAngles.x, outAngles.y, outAngles.z );
}
break;
case REMAP_ANGLE_NEGATIVE_PITCH:
if ( m_InstanceAngle.x != 0.0f || m_InstanceAngle.y != 0.0f || m_InstanceAngle.z != 0.0f )
{
QAngle inAngles( 0.0f, 0.0f, 0.0f ), outAngles;
matrix3x4_t angToWorld, localMatrix;
sscanf ( pszInValue, "%f", &inAngles.x ); // just the pitch
inAngles.x = -inAngles.x;
AngleMatrix( inAngles, angToWorld );
MatrixMultiply( m_InstanceMat, angToWorld, localMatrix );
MatrixAngles( localMatrix, outAngles );
sprintf( pszOutValue, "%g", -outAngles.x ); // just the pitch
}
break;
}
return ( strcmpi( pszInValue, pszOutValue ) != 0 );
}
//-----------------------------------------------------------------------------
// Purpose: this function will attempt to remap a name field.
// Input : pszInvalue - the original value
// AllowNameRemapping - only do name remapping if this parameter is true.
// this is generally only false on the instance level.
// Output : returns true if the value changed
// pszOutValue - the new value if changed
//-----------------------------------------------------------------------------
bool GameData::RemapNameField( const char *pszInValue, char *pszOutValue, TNameFixup NameFixup )
{
strcpy( pszOutValue, pszInValue );
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' )
{ // ! at the start of a value means it is global and should not be remaped
switch( NameFixup )
{
case NAME_FIXUP_PREFIX:
sprintf( pszOutValue, "%s-%s", m_InstancePrefix, pszInValue );
break;
case NAME_FIXUP_POSTFIX:
sprintf( pszOutValue, "%s-%s", pszInValue, m_InstancePrefix );
break;
}
}
return ( strcmpi( pszInValue, pszOutValue ) != 0 );
}
//-----------------------------------------------------------------------------
// Purpose: Gathers any FGD-defined material directory exclusions
// Input :
// Output :
//-----------------------------------------------------------------------------
bool GameData::LoadFGDMaterialExclusions( TokenReader &tr )
{
if ( !GDSkipToken( tr, OPERATOR, "[" ) )
{
return false;
}
while ( 1 )
{
char szToken[128];
bool bMatchFound = false;
if ( tr.PeekTokenType( szToken, sizeof( szToken ) ) == OPERATOR )
{
break;
}
else if ( GDGetToken( tr, szToken, sizeof( szToken ), STRING ) )
{
// Make sure we haven't loaded this from another FGD
for ( int i = 0; i < m_FGDMaterialExclusions.Count(); i++ )
{
if ( !stricmp( szToken, m_FGDMaterialExclusions[i].szDirectory ) )
{
bMatchFound = true;
break;
}
}
// Parse the string
if ( bMatchFound == false )
{
int index = m_FGDMaterialExclusions.AddToTail();
Q_strncpy( m_FGDMaterialExclusions[index].szDirectory, szToken, sizeof( m_FGDMaterialExclusions[index].szDirectory ) );
m_FGDMaterialExclusions[index].bUserGenerated = false;
}
}
}
//
// Closing square brace.
//
if ( !GDSkipToken( tr, OPERATOR, "]" ) )
{
return( FALSE );
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Gathers any FGD-defined Auto VisGroups
// Input :
// Output :
//-----------------------------------------------------------------------------
bool GameData::LoadFGDAutoVisGroups( TokenReader &tr )
{
int gindex = 0; // Index of AutoVisGroups
int cindex = 0; // Index of Classes
char szToken[128];
// Handle the Parent -- World Geometry, Entities, World Detail
if ( GDSkipToken( tr, OPERATOR, "=" ) )
{
// We expect a name
if ( !GDGetToken( tr, szToken, sizeof( szToken ), STRING ) )
{
return( FALSE );
}
gindex = m_FGDAutoVisGroups.AddToTail();
Q_strncpy( m_FGDAutoVisGroups[gindex].szParent, szToken, sizeof( m_FGDAutoVisGroups[gindex].szParent ) );
// We expect a Class
if ( !GDSkipToken( tr, OPERATOR, "[" ) )
{
return( FALSE );
}
}
// Handle the Class(es) -- Brush Entities, Occluders, Lights
while ( 1 )
{
if ( GDGetToken( tr, szToken, sizeof( szToken ), STRING ) )
{
cindex = m_FGDAutoVisGroups[gindex].m_Classes.AddToTail();
Q_strncpy( m_FGDAutoVisGroups[gindex].m_Classes[cindex].szClass, szToken, sizeof( m_FGDAutoVisGroups[gindex].m_Classes[cindex].szClass ) );
if ( !GDSkipToken( tr, OPERATOR, "[" ) )
{
return( FALSE );
}
// Parse objects/entities -- func_detail, point_template, light_spot
while ( 1 )
{
if ( tr.PeekTokenType( szToken, sizeof( szToken ) ) == OPERATOR )
{
break;
}
if ( !GDGetToken( tr, szToken, sizeof( szToken ), STRING ) )
{
return( FALSE );
}
m_FGDAutoVisGroups[gindex].m_Classes[cindex].szEntities.CopyAndAddToTail( szToken );
}
if ( !GDSkipToken( tr, OPERATOR, "]" ) )
{
return( FALSE );
}
// See if we have another Class coming up
if ( tr.PeekTokenType( szToken, sizeof( szToken ) ) == STRING )
{
continue;
}
// If no more Classes, we now expect a terminating ']'
if ( !GDSkipToken( tr, OPERATOR, "]" ) )
{
return( FALSE );
}
// We're done
return true;
}
// We don't have another Class; look for a terminating brace
else
{
if ( !GDSkipToken( tr, OPERATOR, "]" ) )
{
return( FALSE );
}
}
}
// Safety net
GDError( tr, "Malformed AutoVisGroup -- Last processed: %s", szToken );
return( FALSE );
}
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgoff.h"

1041
fgdlib/gdclass.cpp Normal file

File diff suppressed because it is too large Load Diff

729
fgdlib/gdvar.cpp Normal file
View File

@@ -0,0 +1,729 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=============================================================================
#include "fgdlib/fgdlib.h"
#include "fgdlib/GameData.h"
#include "fgdlib/WCKeyValues.h"
#include "fgdlib/gdvar.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
typedef struct
{
GDIV_TYPE eType; // The enumeration of this type.
char *pszName; // The name of this type.
trtoken_t eStoreAs; // How this type is stored (STRING, INTEGER, etc).
} TypeMap_t;
//-----------------------------------------------------------------------------
// Maps type names to type enums and parsing logic for values.
//-----------------------------------------------------------------------------
static TypeMap_t TypeMap[] =
{
{ ivAngle, "angle", STRING },
{ ivChoices, "choices", STRING },
{ ivColor1, "color1", STRING },
{ ivColor255, "color255", STRING },
{ ivDecal, "decal", STRING },
{ ivFlags, "flags", INTEGER },
{ ivInteger, "integer", INTEGER },
{ ivSound, "sound", STRING },
{ ivSprite, "sprite", STRING },
{ ivString, "string", STRING },
{ ivStudioModel, "studio", STRING },
{ ivTargetDest, "target_destination", STRING },
{ ivTargetSrc, "target_source", STRING },
{ ivTargetNameOrClass, "target_name_or_class", STRING }, // Another version of target_destination that accepts class names
{ ivVector, "vector", STRING },
{ ivNPCClass, "npcclass", STRING },
{ ivFilterClass, "filterclass", STRING },
{ ivFloat, "float", STRING },
{ ivMaterial, "material", STRING },
{ ivScene, "scene", STRING },
{ ivSide, "side", STRING },
{ ivSideList, "sidelist", STRING },
{ ivOrigin, "origin", STRING },
{ ivAxis, "axis", STRING },
{ ivVecLine, "vecline", STRING },
{ ivPointEntityClass, "pointentityclass", STRING },
{ ivNodeDest, "node_dest", INTEGER },
{ ivInstanceFile, "instance_file", STRING },
{ ivAngleNegativePitch, "angle_negative_pitch", STRING },
{ ivInstanceVariable, "instance_variable", STRING },
{ ivInstanceParm, "instance_parm", STRING },
};
char *GDinputvariable::m_pszEmpty = "";
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
GDinputvariable::GDinputvariable(void)
{
m_szDefault[0] = 0;
m_nDefault = 0;
m_szValue[0] = 0;
m_bReportable = FALSE;
m_bReadOnly = false;
m_pszDescription = NULL;
}
//-----------------------------------------------------------------------------
// Purpose: construct generally used for creating a temp instance parm type
// Input : szType - the textual type of this variable
// szName - the name description of this variable
//-----------------------------------------------------------------------------
GDinputvariable::GDinputvariable( const char *szType, const char *szName )
{
m_szDefault[0] = 0;
m_nDefault = 0;
m_szValue[0] = 0;
m_bReportable = FALSE;
m_bReadOnly = false;
m_pszDescription = NULL;
m_eType = GetTypeFromToken( szType );
strcpy( m_szName, szName );
}
//-----------------------------------------------------------------------------
// Purpose: Destructor.
//-----------------------------------------------------------------------------
GDinputvariable::~GDinputvariable(void)
{
delete [] m_pszDescription;
m_Items.RemoveAll();
}
//-----------------------------------------------------------------------------
// Purpose: Implements the copy operator.
//-----------------------------------------------------------------------------
GDinputvariable &GDinputvariable::operator =(GDinputvariable &Other)
{
m_eType = Other.GetType();
strcpy(m_szName, Other.m_szName);
strcpy(m_szLongName, Other.m_szLongName);
strcpy(m_szDefault, Other.m_szDefault);
//
// Copy the description.
//
delete [] m_pszDescription;
if (Other.m_pszDescription != NULL)
{
m_pszDescription = new char[strlen(Other.m_pszDescription) + 1];
strcpy(m_pszDescription, Other.m_pszDescription);
}
else
{
m_pszDescription = NULL;
}
m_nDefault = Other.m_nDefault;
m_bReportable = Other.m_bReportable;
m_bReadOnly = Other.m_bReadOnly;
m_Items.RemoveAll();
int nCount = Other.m_Items.Count();
for (int i = 0; i < nCount; i++)
{
m_Items.AddToTail(Other.m_Items.Element(i));
}
return(*this);
}
//-----------------------------------------------------------------------------
// Purpose: Returns the storage format of a given variable type.
// Input : pszToken - Sting containing the token.
// Output : GDIV_TYPE corresponding to the token in the string, ivBadType if the
// string does not correspond to a valid type.
//-----------------------------------------------------------------------------
trtoken_t GDinputvariable::GetStoreAsFromType(GDIV_TYPE eType)
{
for (int i = 0; i < sizeof(TypeMap) / sizeof(TypeMap[0]); i++)
{
if (TypeMap[i].eType == eType)
{
return(TypeMap[i].eStoreAs);
}
}
Assert(FALSE);
return(STRING);
}
//-----------------------------------------------------------------------------
// Purpose: Returns the enumerated type of a string token.
// Input : pszToken - Sting containing the token.
// Output : GDIV_TYPE corresponding to the token in the string, ivBadType if the
// string does not correspond to a valid type.
//-----------------------------------------------------------------------------
GDIV_TYPE GDinputvariable::GetTypeFromToken(const char *pszToken)
{
for (int i = 0; i < sizeof(TypeMap) / sizeof(TypeMap[0]); i++)
{
if (IsToken(pszToken, TypeMap[i].pszName))
{
return(TypeMap[i].eType);
}
}
return(ivBadType);
}
//-----------------------------------------------------------------------------
// Purpose: Returns a string representing the type of this variable, eg. "integer".
//-----------------------------------------------------------------------------
const char *GDinputvariable::GetTypeText(void)
{
for (int i = 0; i < sizeof(TypeMap) / sizeof(TypeMap[0]); i++)
{
if (TypeMap[i].eType == m_eType)
{
return(TypeMap[i].pszName);
}
}
return("unknown");
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : tr -
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL GDinputvariable::InitFromTokens(TokenReader& tr)
{
char szToken[128];
if (!GDGetToken(tr, m_szName, sizeof(m_szName), IDENT))
{
return FALSE;
}
if (!GDSkipToken(tr, OPERATOR, "("))
{
return FALSE;
}
// check for "reportable" marker
trtoken_t ttype = tr.NextToken(szToken, sizeof(szToken));
if (ttype == OPERATOR)
{
if (!strcmp(szToken, "*"))
{
m_bReportable = true;
}
}
else
{
tr.Stuff(ttype, szToken);
}
// get type
if (!GDGetToken(tr, szToken, sizeof(szToken), IDENT))
{
return FALSE;
}
if (!GDSkipToken(tr, OPERATOR, ")"))
{
return FALSE;
}
//
// Check for known variable types.
//
m_eType = GetTypeFromToken(szToken);
if (m_eType == ivBadType)
{
GDError(tr, "'%s' is not a valid variable type", szToken);
return FALSE;
}
//
// Look ahead at the next token.
//
ttype = tr.PeekTokenType(szToken,sizeof(szToken));
//
// Check for the "readonly" specifier.
//
if ((ttype == IDENT) && IsToken(szToken, "readonly"))
{
tr.NextToken(szToken, sizeof(szToken));
m_bReadOnly = true;
//
// Look ahead at the next token.
//
ttype = tr.PeekTokenType(szToken,sizeof(szToken));
}
//
// Check for the ':' indicating a long name.
//
if (ttype == OPERATOR && IsToken(szToken, ":"))
{
//
// Eat the ':'.
//
tr.NextToken(szToken, sizeof(szToken));
if (m_eType == ivFlags)
{
GDError(tr, "flag sets do not have long names");
return FALSE;
}
//
// Get the long name.
//
if (!GDGetToken(tr, m_szLongName, sizeof(m_szLongName), STRING))
{
return(FALSE);
}
//
// Look ahead at the next token.
//
ttype = tr.PeekTokenType(szToken,sizeof(szToken));
//
// Check for the ':' indicating a default value.
//
if (ttype == OPERATOR && IsToken(szToken, ":"))
{
//
// Eat the ':'.
//
tr.NextToken(szToken, sizeof(szToken));
//
// Look ahead at the next token.
//
ttype = tr.PeekTokenType(szToken,sizeof(szToken));
if (ttype == OPERATOR && IsToken(szToken, ":"))
{
//
// No default value provided, skip to the description.
//
}
else
{
//
// Determine how to parse the default value. If this is a choices field, the
// default could either be a string or an integer, so we must look ahead and
// use whichever is there.
//
trtoken_t eStoreAs = GetStoreAsFromType(m_eType);
if (eStoreAs == STRING)
{
if (!GDGetToken(tr, m_szDefault, sizeof(m_szDefault), STRING))
{
return(FALSE);
}
}
else if (eStoreAs == INTEGER)
{
if (!GDGetToken(tr, szToken, sizeof(szToken), INTEGER))
{
return(FALSE);
}
m_nDefault = atoi(szToken);
}
//
// Look ahead at the next token.
//
ttype = tr.PeekTokenType(szToken,sizeof(szToken));
}
}
//
// Check for the ':' indicating a description.
//
if (ttype == OPERATOR && IsToken(szToken, ":"))
{
//
// Eat the ':'.
//
tr.NextToken(szToken, sizeof(szToken));
//
// Read the description.
//
// If we've already read a description then free it to avoid memory leaks.
if ( m_pszDescription )
{
delete [] m_pszDescription;
m_pszDescription = NULL;
}
if (!GDGetTokenDynamic(tr, &m_pszDescription, STRING))
{
return(FALSE);
}
//
// Look ahead at the next token.
//
ttype = tr.PeekTokenType(szToken,sizeof(szToken));
}
}
else
{
//
// Default long name is short name.
//
strcpy(m_szLongName, m_szName);
}
//
// Check for the ']' indicating the end of the class definition.
//
if ((ttype == OPERATOR && IsToken(szToken, "]")) || ttype != OPERATOR)
{
if (m_eType == ivFlags || m_eType == ivChoices)
{
//
// Can't define a flags or choices variable without providing any flags or choices.
//
GDError(tr, "no %s specified", m_eType == ivFlags ? "flags" : "choices");
return(FALSE);
}
return(TRUE);
}
if (!GDSkipToken(tr, OPERATOR, "="))
{
return(FALSE);
}
if (m_eType != ivFlags && m_eType != ivChoices)
{
GDError(tr, "didn't expect '=' here");
return(FALSE);
}
// should be '[' to start flags/choices
if (!GDSkipToken(tr, OPERATOR, "["))
{
return(FALSE);
}
// get flags?
if (m_eType == ivFlags)
{
GDIVITEM ivi;
while (1)
{
ttype = tr.PeekTokenType();
if (ttype != INTEGER)
{
break;
}
// store bitflag value
GDGetToken(tr, szToken, sizeof(szToken), INTEGER);
sscanf( szToken, "%lu", &ivi.iValue );
// colon..
if (!GDSkipToken(tr, OPERATOR, ":"))
{
return FALSE;
}
// get description
if (!GDGetToken(tr, szToken, sizeof(szToken), STRING))
{
return FALSE;
}
strcpy(ivi.szCaption, szToken);
// colon..
if (!GDSkipToken(tr, OPERATOR, ":"))
{
return FALSE;
}
// get default setting
if (!GDGetToken(tr, szToken, sizeof(szToken), INTEGER))
{
return FALSE;
}
ivi.bDefault = atoi(szToken) ? TRUE : FALSE;
// add item to array of items
m_Items.AddToTail(ivi);
}
// Set the default value.
unsigned long nDefault = 0;
for (int i = 0; i < m_Items.Count(); i++)
{
if (m_Items[i].bDefault)
nDefault |= m_Items[i].iValue;
}
m_nDefault = (int)nDefault;
Q_snprintf( m_szDefault, sizeof( m_szDefault ), "%d", m_nDefault );
}
else if (m_eType == ivChoices)
{
GDIVITEM ivi;
while (1)
{
ttype = tr.PeekTokenType();
if ((ttype != INTEGER) && (ttype != STRING))
{
break;
}
// store choice value
GDGetToken(tr, szToken, sizeof(szToken), ttype);
ivi.iValue = 0;
strcpy(ivi.szValue, szToken);
// colon
if (!GDSkipToken(tr, OPERATOR, ":"))
{
return FALSE;
}
// get description
if (!GDGetToken(tr, szToken, sizeof(szToken), STRING))
{
return FALSE;
}
strcpy(ivi.szCaption, szToken);
m_Items.AddToTail(ivi);
}
}
if (!GDSkipToken(tr, OPERATOR, "]"))
{
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose: Decodes a key value from a string.
// Input : pkv - Pointer to the key value object containing string encoded value.
//-----------------------------------------------------------------------------
void GDinputvariable::FromKeyValue(MDkeyvalue *pkv)
{
trtoken_t eStoreAs = GetStoreAsFromType(m_eType);
if (eStoreAs == STRING)
{
strcpy(m_szValue, pkv->szValue);
}
else if (eStoreAs == INTEGER)
{
m_nValue = atoi(pkv->szValue);
}
}
//-----------------------------------------------------------------------------
// Purpose: Determines whether the given flag is set (assuming this is an ivFlags).
// Input : uCheck - Flag to check.
// Output : Returns TRUE if flag is set, FALSE if not.
//-----------------------------------------------------------------------------
BOOL GDinputvariable::IsFlagSet(unsigned int uCheck)
{
Assert(m_eType == ivFlags);
return (((unsigned int)m_nValue & uCheck) == uCheck) ? TRUE : FALSE;
}
//-----------------------------------------------------------------------------
// Purpose: Combines the flags or choices items from another variable into our
// list of flags or choices. Ours take priority if collisions occur.
// Input : Other - The variable whose items are being merged with ours.
//-----------------------------------------------------------------------------
void GDinputvariable::Merge(GDinputvariable &Other)
{
//
// Only valid if we are of the same type.
//
if (Other.GetType() != GetType())
{
return;
}
//
// Add Other's items to this ONLY if there is no same-value entry
// for a specific item.
//
bool bFound = false;
int nOurItems = m_Items.Count();
for (int i = 0; i < Other.m_Items.Count(); i++)
{
GDIVITEM &TheirItem = Other.m_Items[i];
for (int j = 0; j < nOurItems; j++)
{
GDIVITEM &OurItem = m_Items[j];
if (TheirItem.iValue == OurItem.iValue)
{
bFound = true;
break;
}
}
if (!bFound)
{
//
// Not found in our list - add their item to our list.
//
m_Items.AddToTail(TheirItem);
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Determines whether the given flag is set (assuming this is an ivFlags).
// Input : uFlags - Flags to set.
// bSet - TRUE to set the flags, FALSE to clear them.
//-----------------------------------------------------------------------------
void GDinputvariable::SetFlag(unsigned int uFlags, BOOL bSet)
{
Assert(m_eType == ivFlags);
if (bSet)
{
m_nValue |= uFlags;
}
else
{
m_nValue &= ~uFlags;
}
}
//-----------------------------------------------------------------------------
// Purpose: Sets this keyvalue to its default value.
//-----------------------------------------------------------------------------
void GDinputvariable::ResetDefaults(void)
{
if (m_eType == ivFlags)
{
m_nValue = 0;
//
// Run thru flags and set any default flags.
//
int nCount = m_Items.Count();
for (int i = 0; i < nCount; i++)
{
if (m_Items[i].bDefault)
{
m_nValue |= GetFlagMask(i);
}
}
}
else
{
m_nValue = m_nDefault;
strcpy(m_szValue, m_szDefault);
}
}
//-----------------------------------------------------------------------------
// Purpose: Encodes a key value as a string.
// Input : pkv - Pointer to the key value object to receive the encoded string.
//-----------------------------------------------------------------------------
void GDinputvariable::ToKeyValue(MDkeyvalue *pkv)
{
strcpy(pkv->szKey, m_szName);
trtoken_t eStoreAs = GetStoreAsFromType(m_eType);
if (eStoreAs == STRING)
{
strcpy(pkv->szValue, m_szValue);
}
else if (eStoreAs == INTEGER)
{
itoa(m_nValue, pkv->szValue, 10);
}
}
//-----------------------------------------------------------------------------
// Purpose: Returns the description string that corresponds to a value string
// for a choices list.
// Input : pszString - The choices value string.
// Output : Returns the description string.
//-----------------------------------------------------------------------------
const char *GDinputvariable::ItemStringForValue(const char *szValue)
{
int nCount = m_Items.Count();
for (int i = 0; i < nCount; i++)
{
if (!stricmp(m_Items[i].szValue, szValue))
{
return(m_Items[i].szCaption);
}
}
return(NULL);
}
//-----------------------------------------------------------------------------
// Purpose: Returns the value string that corresponds to a description string
// for a choices list.
// Input : pszString - The choices description string.
// Output : Returns the value string.
//-----------------------------------------------------------------------------
const char *GDinputvariable::ItemValueForString(const char *szString)
{
int nCount = m_Items.Count();
for (int i = 0; i < nCount; i++)
{
if (!strcmpi(m_Items[i].szCaption, szString))
{
return(m_Items[i].szValue);
}
}
return(NULL);
}
//-----------------------------------------------------------------------------
// Purpose: this function will let you iterate through the text names of the variable types
// Input : eType - the type to get the text of
// Output : returns the textual name
//-----------------------------------------------------------------------------
const char *GDinputvariable::GetVarTypeName( GDIV_TYPE eType )
{
return TypeMap[ eType ].pszName;
}

171
fgdlib/inputoutput.cpp Normal file
View File

@@ -0,0 +1,171 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#include <tier0/dbg.h>
#include "fgdlib/InputOutput.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
typedef struct
{
InputOutputType_t eType; // The enumeration of this type.
char *pszName; // The name of this type.
} TypeMap_t;
char *CClassInputOutputBase::g_pszEmpty = "";
//-----------------------------------------------------------------------------
// Maps type names to type enums for inputs and outputs.
//-----------------------------------------------------------------------------
static TypeMap_t TypeMap[] =
{
{ iotVoid, "void" },
{ iotInt, "integer" },
{ iotBool, "bool" },
{ iotString, "string" },
{ iotFloat, "float" },
{ iotVector, "vector" },
{ iotEHandle, "target_destination" },
{ iotColor, "color255" },
{ iotEHandle, "ehandle" }, // for backwards compatibility
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CClassInputOutputBase::CClassInputOutputBase(void)
{
m_eType = iotInvalid;
m_pszDescription = NULL;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pszName -
// eType -
//-----------------------------------------------------------------------------
CClassInputOutputBase::CClassInputOutputBase(const char *pszName, InputOutputType_t eType)
{
m_pszDescription = NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Destructor.
//-----------------------------------------------------------------------------
CClassInputOutputBase::~CClassInputOutputBase(void)
{
delete m_pszDescription;
m_pszDescription = NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Returns a string representing the type of this I/O, eg. "integer".
//-----------------------------------------------------------------------------
const char *CClassInputOutputBase::GetTypeText(void)
{
for (int i = 0; i < sizeof(TypeMap) / sizeof(TypeMap[0]); i++)
{
if (TypeMap[i].eType == m_eType)
{
return(TypeMap[i].pszName);
}
}
return("unknown");
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : szType -
// Output : InputOutputType_t
//-----------------------------------------------------------------------------
InputOutputType_t CClassInputOutputBase::SetType(const char *szType)
{
for (int i = 0; i < sizeof(TypeMap) / sizeof(TypeMap[0]); i++)
{
if (!stricmp(TypeMap[i].pszName, szType))
{
m_eType = TypeMap[i].eType;
return(m_eType);
}
}
return(iotInvalid);
}
//-----------------------------------------------------------------------------
// Purpose: Assignment operator.
//-----------------------------------------------------------------------------
CClassInputOutputBase &CClassInputOutputBase::operator =(CClassInputOutputBase &Other)
{
strcpy(m_szName, Other.m_szName);
m_eType = Other.m_eType;
//
// Copy the description.
//
delete m_pszDescription;
if (Other.m_pszDescription != NULL)
{
m_pszDescription = new char[strlen(Other.m_pszDescription) + 1];
strcpy(m_pszDescription, Other.m_pszDescription);
}
else
{
m_pszDescription = NULL;
}
return(*this);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CClassInput::CClassInput(void)
{
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pszName -
// eType -
//-----------------------------------------------------------------------------
CClassInput::CClassInput(const char *pszName, InputOutputType_t eType)
: CClassInputOutputBase(pszName, eType)
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CClassOutput::CClassOutput(void)
{
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pszName -
// eType -
//-----------------------------------------------------------------------------
CClassOutput::CClassOutput(const char *pszName, InputOutputType_t eType)
: CClassInputOutputBase(pszName, eType)
{
}

282
fgdlib/wckeyvalues.cpp Normal file
View File

@@ -0,0 +1,282 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#include "fgdlib/WCKeyValues.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
//-----------------------------------------------------------------------------
// Purpose: Destructor.
//-----------------------------------------------------------------------------
MDkeyvalue::~MDkeyvalue(void)
{
}
//-----------------------------------------------------------------------------
// Purpose: Assignment operator.
//-----------------------------------------------------------------------------
MDkeyvalue &MDkeyvalue::operator =(const MDkeyvalue &other)
{
V_strcpy_safe(szKey, other.szKey);
V_strcpy_safe(szValue, other.szValue);
return(*this);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void WCKVBase_Vector::RemoveKeyAt(int nIndex)
{
Assert(nIndex >= 0);
Assert(nIndex < (int)m_KeyValues.Count());
if ((nIndex >= 0) && (nIndex < (int)m_KeyValues.Count()))
{
m_KeyValues.Remove(nIndex);
}
}
//-----------------------------------------------------------------------------
// Purpose: Adds the key to the keyvalue array. Allows duplicate keys.
//
// NOTE: This should only be used for keyvalue lists that do not require
// unique key names! If you use this function then you should use GetCount
// and GetKey/Value by index rather than GetValue by key name.
//-----------------------------------------------------------------------------
void WCKVBase_Vector::AddKeyValue(const char *pszKey, const char *pszValue)
{
if (!pszKey || !pszValue)
{
return;
}
char szTmpKey[KEYVALUE_MAX_KEY_LENGTH];
char szTmpValue[KEYVALUE_MAX_VALUE_LENGTH];
V_strcpy_safe(szTmpKey, pszKey);
V_strcpy_safe(szTmpValue, pszValue);
StripEdgeWhiteSpace(szTmpKey);
StripEdgeWhiteSpace(szTmpValue);
//
// Add the keyvalue to our list.
//
MDkeyvalue newkv;
V_strcpy_safe(newkv.szKey, szTmpKey);
V_strcpy_safe(newkv.szValue, szTmpValue);
m_KeyValues.AddToTail(newkv);
}
int WCKVBase_Vector::FindByKeyName( const char *pKeyName ) const
{
for ( int i=0; i < m_KeyValues.Count(); i++ )
{
if ( V_stricmp( m_KeyValues[i].szKey, pKeyName ) == 0 )
return i;
}
return GetInvalidIndex();
}
void WCKVBase_Vector::InsertKeyValue( const MDkeyvalue &kv )
{
m_KeyValues.AddToTail( kv );
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void WCKVBase_Dict::RemoveKeyAt(int nIndex)
{
m_KeyValues.RemoveAt(nIndex);
}
int WCKVBase_Dict::FindByKeyName( const char *pKeyName ) const
{
return m_KeyValues.Find( pKeyName );
}
void WCKVBase_Dict::InsertKeyValue( const MDkeyvalue &kv )
{
m_KeyValues.Insert( kv.szKey, kv );
}
//-----------------------------------------------------------------------------
// Purpose: Constructor. Sets the initial size of the keyvalue array.
//-----------------------------------------------------------------------------
template<class Base>
WCKeyValuesT<Base>::WCKeyValuesT(void)
{
}
//-----------------------------------------------------------------------------
// Purpose: Destructor. Deletes the contents of this keyvalue array.
//-----------------------------------------------------------------------------
template<class Base>
WCKeyValuesT<Base>::~WCKeyValuesT(void)
{
//int i = 0;
//while (i < m_KeyValues.GetSize())
//{
// delete m_KeyValues.GetAt(i++);
//}
RemoveAll();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
template<class Base>
const char *WCKeyValuesT<Base>::GetValue(const char *pszKey, int *piIndex) const
{
int i = FindByKeyName( pszKey );
if ( i == GetInvalidIndex() )
{
return NULL;
}
else
{
if(piIndex)
piIndex[0] = i;
return m_KeyValues[i].szValue;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
template<class Base>
void WCKeyValuesT<Base>::RemoveKey(const char *pszKey)
{
SetValue(pszKey, (const char *)NULL);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
template<class Base>
void WCKeyValuesT<Base>::SetValue(const char *pszKey, int iValue)
{
char szValue[100];
itoa(iValue, szValue, 10);
SetValue(pszKey, szValue);
}
//-----------------------------------------------------------------------------
// Purpose: Strips leading and trailing whitespace from the string.
// Input : psz -
//-----------------------------------------------------------------------------
void StripEdgeWhiteSpace(char *psz)
{
if (!psz || !*psz)
return;
char *pszBase = psz;
while (V_isspace(*psz))
{
psz++;
}
int iLen = strlen(psz) - 1;
if ( iLen >= 0 )
{
while (V_isspace(psz[iLen]))
{
psz[iLen--] = 0;
}
}
if (psz != pszBase)
{
memmove(pszBase, psz, iLen + 2);
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pszKey -
// pszValue -
//-----------------------------------------------------------------------------
template<class Base>
void WCKeyValuesT<Base>::SetValue(const char *pszKey, const char *pszValue)
{
char szTmpKey[KEYVALUE_MAX_KEY_LENGTH];
char szTmpValue[KEYVALUE_MAX_VALUE_LENGTH];
V_strcpy_safe(szTmpKey, pszKey);
if (pszValue != NULL)
{
V_strcpy_safe(szTmpValue, pszValue);
}
else
{
szTmpValue[0] = 0;
}
StripEdgeWhiteSpace(szTmpKey);
StripEdgeWhiteSpace(szTmpValue);
int i = FindByKeyName( szTmpKey );
if ( i == GetInvalidIndex() )
{
if ( pszValue )
{
//
// Add the keyvalue to our list.
//
MDkeyvalue newkv;
Q_strncpy( newkv.szKey, szTmpKey, sizeof( newkv.szKey ) );
Q_strncpy( newkv.szValue, szTmpValue, sizeof( newkv.szValue ) );
InsertKeyValue( newkv );
}
}
else
{
if (pszValue != NULL)
{
V_strncpy(m_KeyValues[i].szValue, szTmpValue, sizeof(m_KeyValues[i].szValue));
}
//
// If we are setting to a NULL value, delete the key.
//
else
{
RemoveKeyAt( i );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
template<class Base>
void WCKeyValuesT<Base>::RemoveAll(void)
{
m_KeyValues.RemoveAll();
}
// Explicit instantiations.
template class WCKeyValuesT<WCKVBase_Dict>;
template class WCKeyValuesT<WCKVBase_Vector>;

View File

@@ -0,0 +1,53 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Acts exactly like "AnimatedTexture", but ONLY if the texture
// it's working on matches the desired texture to work on.
//
// This assumes that some other proxy will be switching out the textures.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "materialsystem/imaterialproxy.h"
#include "materialsystem/imaterialvar.h"
#include "materialsystem/imaterial.h"
#include "materialsystem/itexture.h"
#include "baseanimatedtextureproxy.h"
#include "utlstring.h"
#include <KeyValues.h>
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class CAnimateSpecificTexture : public CBaseAnimatedTextureProxy
{
private:
CUtlString m_OnlyAnimateOnTexture;
public:
virtual float GetAnimationStartTime( void* pBaseEntity ) { return 0; }
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
virtual void OnBind( void *pC_BaseEntity );
virtual void Release( void ) { delete this; }
};
bool CAnimateSpecificTexture::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
char const* pszAnimateOnTexture = pKeyValues->GetString( "onlyAnimateOnTexture" );
if( !pszAnimateOnTexture )
return false;
m_OnlyAnimateOnTexture.Set( pszAnimateOnTexture );
return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
}
void CAnimateSpecificTexture::OnBind( void *pC_BaseEntity )
{
if( FStrEq( m_AnimatedTextureVar->GetTextureValue()->GetName(), m_OnlyAnimateOnTexture ) )
{
CBaseAnimatedTextureProxy::OnBind( pC_BaseEntity );
}
//else do nothing
}
EXPOSE_INTERFACE( CAnimateSpecificTexture, IMaterialProxy, "AnimateSpecificTexture" IMATERIAL_PROXY_INTERFACE_VERSION );

View File

@@ -0,0 +1,165 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef C_ENVPROJECTEDTEXTURE_H
#define C_ENVPROJECTEDTEXTURE_H
#ifdef _WIN32
#pragma once
#endif
#include "c_baseentity.h"
#include "basetypes.h"
#ifdef ASW_PROJECTED_TEXTURES
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class C_EnvProjectedTexture : public C_BaseEntity
{
DECLARE_CLASS( C_EnvProjectedTexture, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();
void SetMaterial( IMaterial *pMaterial );
void SetLightColor( byte r, byte g, byte b, byte a );
void SetSize( float flSize );
void SetRotation( float flRotation );
virtual void OnDataChanged( DataUpdateType_t updateType );
void ShutDownLightHandle( void );
#ifdef MAPBASE
virtual void Simulate();
#else
virtual bool Simulate();
#endif
void UpdateLight( void );
C_EnvProjectedTexture();
~C_EnvProjectedTexture();
static void SetVisibleBBoxMinHeight( float flVisibleBBoxMinHeight ) { m_flVisibleBBoxMinHeight = flVisibleBBoxMinHeight; }
static float GetVisibleBBoxMinHeight( void ) { return m_flVisibleBBoxMinHeight; }
static C_EnvProjectedTexture *Create( );
private:
inline bool IsBBoxVisible( void );
bool IsBBoxVisible( Vector vecExtentsMin,
Vector vecExtentsMax );
ClientShadowHandle_t m_LightHandle;
bool m_bForceUpdate;
EHANDLE m_hTargetEntity;
#ifdef MAPBASE
bool m_bDontFollowTarget;
#endif
bool m_bState;
bool m_bAlwaysUpdate;
float m_flLightFOV;
#ifdef MAPBASE
float m_flLightHorFOV;
#endif
bool m_bEnableShadows;
bool m_bLightOnlyTarget;
bool m_bLightWorld;
bool m_bCameraSpace;
float m_flBrightnessScale;
color32 m_LightColor;
Vector m_CurrentLinearFloatLightColor;
float m_flCurrentLinearFloatLightAlpha;
#ifdef MAPBASE
float m_flCurrentBrightnessScale;
#endif
float m_flColorTransitionTime;
float m_flAmbient;
float m_flNearZ;
float m_flFarZ;
char m_SpotlightTextureName[ MAX_PATH ];
CTextureReference m_SpotlightTexture;
int m_nSpotlightTextureFrame;
int m_nShadowQuality;
#ifdef MAPBASE
float m_flConstantAtten;
float m_flLinearAtten;
float m_flQuadraticAtten;
float m_flShadowAtten;
bool m_bAlwaysDraw;
//bool m_bProjectedTextureVersion;
#endif
Vector m_vecExtentsMin;
Vector m_vecExtentsMax;
static float m_flVisibleBBoxMinHeight;
};
bool C_EnvProjectedTexture::IsBBoxVisible( void )
{
return IsBBoxVisible( GetAbsOrigin() + m_vecExtentsMin, GetAbsOrigin() + m_vecExtentsMax );
}
#else
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class C_EnvProjectedTexture : public C_BaseEntity
{
DECLARE_CLASS( C_EnvProjectedTexture, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();
C_EnvProjectedTexture();
~C_EnvProjectedTexture();
virtual void OnDataChanged( DataUpdateType_t updateType );
void ShutDownLightHandle( void );
virtual void Simulate();
void UpdateLight( bool bForceUpdate );
bool ShadowsEnabled();
float GetFOV();
private:
ClientShadowHandle_t m_LightHandle;
EHANDLE m_hTargetEntity;
bool m_bState;
float m_flLightFOV;
bool m_bEnableShadows;
bool m_bLightOnlyTarget;
bool m_bLightWorld;
bool m_bCameraSpace;
color32 m_cLightColor;
float m_flAmbient;
char m_SpotlightTextureName[ MAX_PATH ];
int m_nSpotlightTextureFrame;
int m_nShadowQuality;
bool m_bCurrentShadow;
public:
C_EnvProjectedTexture *m_pNext;
};
C_EnvProjectedTexture* GetEnvProjectedTextureList();
#endif
#endif // C_ENVPROJECTEDTEXTURE_H

View File

@@ -0,0 +1,798 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Material Modify control entity.
//
//=============================================================================//
#include "cbase.h"
#include "proxyentity.h"
#include "materialsystem/imaterial.h"
#include "materialsystem/imaterialvar.h"
#include "materialsystem/itexture.h"
#include "iviewrender.h"
#include "texture_group_names.h"
#include "baseanimatedtextureproxy.h"
#include "toolframework_client.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define MATERIAL_MODIFY_STRING_SIZE 255
#define MATERIAL_MODIFY_ANIMATION_UNSET -1
// Must match MaterialModifyControl.cpp
enum MaterialModifyMode_t
{
MATERIAL_MODIFY_MODE_NONE = 0,
MATERIAL_MODIFY_MODE_SETVAR = 1,
MATERIAL_MODIFY_MODE_ANIM_SEQUENCE = 2,
MATERIAL_MODIFY_MODE_FLOAT_LERP = 3,
};
// forward declarations
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
ConVar debug_materialmodifycontrol_client( "debug_materialmodifycontrol_client", "0" );
struct materialanimcommands_t
{
int iFrameStart;
int iFrameEnd;
bool bWrap;
float flFrameRate;
};
struct materialfloatlerpcommands_t
{
int flStartValue;
int flEndValue;
float flTransitionTime;
};
//------------------------------------------------------------------------------
// FIXME: This really should inherit from something more lightweight
//------------------------------------------------------------------------------
class C_MaterialModifyControl : public C_BaseEntity
{
public:
DECLARE_CLASS( C_MaterialModifyControl, C_BaseEntity );
C_MaterialModifyControl();
void OnPreDataChanged( DataUpdateType_t updateType );
void OnDataChanged( DataUpdateType_t updateType );
bool ShouldDraw();
IMaterial *GetMaterial( void ) { return m_pMaterial; }
const char *GetMaterialVariableName( void ) { return m_szMaterialVar; }
const char *GetMaterialVariableValue( void ) { return m_szMaterialVarValue; }
DECLARE_CLIENTCLASS();
// Animated texture and Float Lerp usage
bool HasNewAnimationCommands( void ) { return m_bHasNewAnimationCommands; }
void ClearAnimationCommands( void ) { m_bHasNewAnimationCommands = false; }
// Animated texture usage
void GetAnimationCommands( materialanimcommands_t *pCommands );
// FloatLerp usage
void GetFloatLerpCommands( materialfloatlerpcommands_t *pCommands );
void SetAnimationStartTime( float flTime )
{
m_flAnimationStartTime = flTime;
}
float GetAnimationStartTime( void ) const
{
return m_flAnimationStartTime;
}
MaterialModifyMode_t GetModifyMode( void ) const
{
return ( MaterialModifyMode_t)m_nModifyMode;
}
private:
char m_szMaterialName[MATERIAL_MODIFY_STRING_SIZE];
char m_szMaterialVar[MATERIAL_MODIFY_STRING_SIZE];
char m_szMaterialVarValue[MATERIAL_MODIFY_STRING_SIZE];
IMaterial *m_pMaterial;
bool m_bHasNewAnimationCommands;
// Animation commands from the server
int m_iFrameStart;
int m_iFrameEnd;
bool m_bWrap;
float m_flFramerate;
bool m_bNewAnimCommandsSemaphore;
bool m_bOldAnimCommandsSemaphore;
// Float lerp commands from the server
float m_flFloatLerpStartValue;
float m_flFloatLerpEndValue;
float m_flFloatLerpTransitionTime;
bool m_bFloatLerpWrap;
float m_flAnimationStartTime;
int m_nModifyMode;
};
IMPLEMENT_CLIENTCLASS_DT(C_MaterialModifyControl, DT_MaterialModifyControl, CMaterialModifyControl)
RecvPropString( RECVINFO( m_szMaterialName ) ),
RecvPropString( RECVINFO( m_szMaterialVar ) ),
RecvPropString( RECVINFO( m_szMaterialVarValue ) ),
RecvPropInt( RECVINFO(m_iFrameStart) ),
RecvPropInt( RECVINFO(m_iFrameEnd) ),
RecvPropInt( RECVINFO(m_bWrap) ),
RecvPropFloat( RECVINFO(m_flFramerate) ),
RecvPropInt( RECVINFO(m_bNewAnimCommandsSemaphore) ),
RecvPropFloat( RECVINFO(m_flFloatLerpStartValue) ),
RecvPropFloat( RECVINFO(m_flFloatLerpEndValue) ),
RecvPropFloat( RECVINFO(m_flFloatLerpTransitionTime) ),
RecvPropInt( RECVINFO(m_bFloatLerpWrap) ),
RecvPropInt( RECVINFO(m_nModifyMode) ),
END_RECV_TABLE()
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
C_MaterialModifyControl::C_MaterialModifyControl()
{
m_pMaterial = NULL;
m_bOldAnimCommandsSemaphore = false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_MaterialModifyControl::OnPreDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnPreDataChanged( updateType );
m_bOldAnimCommandsSemaphore = m_bNewAnimCommandsSemaphore;
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void C_MaterialModifyControl::OnDataChanged( DataUpdateType_t updateType )
{
if( updateType == DATA_UPDATE_CREATED )
{
m_pMaterial = materials->FindMaterial( m_szMaterialName, TEXTURE_GROUP_OTHER );
// Clear out our variables
m_bHasNewAnimationCommands = true;
}
// Detect changes in the anim commands
if ( m_bNewAnimCommandsSemaphore != m_bOldAnimCommandsSemaphore )
{
m_bHasNewAnimationCommands = true;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_MaterialModifyControl::GetAnimationCommands( materialanimcommands_t *pCommands )
{
pCommands->iFrameStart = m_iFrameStart;
pCommands->iFrameEnd = m_iFrameEnd;
pCommands->bWrap = m_bWrap;
pCommands->flFrameRate = m_flFramerate;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_MaterialModifyControl::GetFloatLerpCommands( materialfloatlerpcommands_t *pCommands )
{
pCommands->flStartValue = m_flFloatLerpStartValue;
pCommands->flEndValue = m_flFloatLerpEndValue;
pCommands->flTransitionTime = m_flFloatLerpTransitionTime;
}
//------------------------------------------------------------------------------
// Purpose: We don't draw.
//------------------------------------------------------------------------------
bool C_MaterialModifyControl::ShouldDraw()
{
return false;
}
//=============================================================================
//
// THE MATERIALMODIFYPROXY ITSELF
//
class CMaterialModifyProxy : public CBaseAnimatedTextureProxy
{
public:
CMaterialModifyProxy();
virtual ~CMaterialModifyProxy();
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
virtual void OnBind( void *pEntity );
virtual IMaterial *GetMaterial();
private:
void OnBindSetVar( C_MaterialModifyControl *pControl );
void OnBindAnimatedTexture( C_MaterialModifyControl *pControl );
void OnBindFloatLerp( C_MaterialModifyControl *pControl );
float GetAnimationStartTime( void* pArg );
void AnimationWrapped( void* pArg );
IMaterial *m_pMaterial;
// texture animation stuff
int m_iFrameStart;
int m_iFrameEnd;
bool m_bReachedEnd;
bool m_bCustomWrap;
float m_flCustomFramerate;
// float lerp stuff
IMaterialVar *m_pMaterialVar;
int m_flStartValue;
int m_flEndValue;
float m_flStartTime;
float m_flTransitionTime;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CMaterialModifyProxy::CMaterialModifyProxy()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CMaterialModifyProxy::~CMaterialModifyProxy()
{
}
bool CMaterialModifyProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
// set var stuff
m_pMaterial = pMaterial;
// float lerp stuff
m_flStartValue = MATERIAL_MODIFY_ANIMATION_UNSET;
m_flEndValue = MATERIAL_MODIFY_ANIMATION_UNSET;
// animated stuff
// m_pMaterial = pMaterial;
// m_iFrameStart = MATERIAL_MODIFY_ANIMATION_UNSET;
// m_iFrameEnd = MATERIAL_MODIFY_ANIMATION_UNSET;
// m_bReachedEnd = false;
// return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
return true;
}
void CMaterialModifyProxy::OnBind( void *pEntity )
{
// Get the modified material vars from the entity input
IClientRenderable *pRend = (IClientRenderable *)pEntity;
if ( pRend )
{
C_BaseEntity *pBaseEntity = pRend->GetIClientUnknown()->GetBaseEntity();
if ( pBaseEntity )
{
if( debug_materialmodifycontrol_client.GetBool() )
{
// DevMsg( 1, "%s\n", pBaseEntity->GetDebugName() );
}
int numChildren = 0;
bool gotOne = false;
for ( C_BaseEntity *pChild = pBaseEntity->FirstMoveChild(); pChild; pChild = pChild->NextMovePeer() )
{
numChildren++;
C_MaterialModifyControl *pControl = dynamic_cast<C_MaterialModifyControl*>( pChild );
if ( !pControl )
continue;
if( debug_materialmodifycontrol_client.GetBool() )
{
// DevMsg( 1, "pControl: 0x%p\n", pControl );
}
switch( pControl->GetModifyMode() )
{
case MATERIAL_MODIFY_MODE_NONE:
break;
case MATERIAL_MODIFY_MODE_SETVAR:
gotOne = true;
OnBindSetVar( pControl );
break;
case MATERIAL_MODIFY_MODE_ANIM_SEQUENCE:
OnBindAnimatedTexture( pControl );
break;
case MATERIAL_MODIFY_MODE_FLOAT_LERP:
OnBindFloatLerp( pControl );
break;
default:
Assert( 0 );
break;
}
}
if( gotOne )
{
// DevMsg( 1, "numChildren: %d\n", numChildren );
}
}
}
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
IMaterial *CMaterialModifyProxy::GetMaterial()
{
return m_pMaterial;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CMaterialModifyProxy::OnBindSetVar( C_MaterialModifyControl *pControl )
{
IMaterial *pMaterial = pControl->GetMaterial();
if( !pMaterial )
{
Assert( 0 );
return;
}
if ( pMaterial != m_pMaterial )
{
// Warning( "\t%s!=%s\n", pMaterial->GetName(), m_pMaterial->GetName() );
return;
}
bool bFound;
IMaterialVar *pMaterialVar = pMaterial->FindVar( pControl->GetMaterialVariableName(), &bFound, false );
if ( !bFound )
return;
if( Q_strcmp( pControl->GetMaterialVariableValue(), "" ) )
{
// const char *pMaterialName = m_pMaterial->GetName();
// const char *pMaterialVarName = pMaterialVar->GetName();
// const char *pMaterialVarValue = pControl->GetMaterialVariableValue();
// if( debug_materialmodifycontrol_client.GetBool()
// && Q_stristr( m_pMaterial->GetName(), "faceandhair" )
// && Q_stristr( pMaterialVar->GetName(), "self" )
// )
// {
// static int count = 0;
// DevMsg( 1, "CMaterialModifyProxy::OnBindSetVar \"%s\" %s=%s %d pControl=0x%p\n",
// m_pMaterial->GetName(), pMaterialVar->GetName(), pControl->GetMaterialVariableValue(), count++, pControl );
// }
pMaterialVar->SetValueAutodetectType( pControl->GetMaterialVariableValue() );
}
}
//-----------------------------------------------------------------------------
// Does the dirty deed
//-----------------------------------------------------------------------------
void CMaterialModifyProxy::OnBindAnimatedTexture( C_MaterialModifyControl *pControl )
{
assert ( m_AnimatedTextureVar );
if( m_AnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
return;
ITexture *pTexture;
pTexture = m_AnimatedTextureVar->GetTextureValue();
if ( !pControl )
return;
if ( pControl->HasNewAnimationCommands() )
{
// Read the data from the modify entity
materialanimcommands_t sCommands;
pControl->GetAnimationCommands( &sCommands );
m_iFrameStart = sCommands.iFrameStart;
m_iFrameEnd = sCommands.iFrameEnd;
m_bCustomWrap = sCommands.bWrap;
m_flCustomFramerate = sCommands.flFrameRate;
m_bReachedEnd = false;
m_flStartTime = gpGlobals->curtime;
pControl->ClearAnimationCommands();
}
// Init all the vars based on whether we're using the base material settings,
// or the custom ones from the entity input.
int numFrames;
bool bWrapAnimation;
float flFrameRate;
int iLastFrame;
// Do we have a custom frame section from the server?
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
{
if ( m_iFrameEnd == MATERIAL_MODIFY_ANIMATION_UNSET )
{
m_iFrameEnd = pTexture->GetNumAnimationFrames();
}
numFrames = (m_iFrameEnd - m_iFrameStart) + 1;
bWrapAnimation = m_bCustomWrap;
flFrameRate = m_flCustomFramerate;
iLastFrame = (m_iFrameEnd - 1);
}
else
{
numFrames = pTexture->GetNumAnimationFrames();
bWrapAnimation = m_WrapAnimation;
flFrameRate = m_FrameRate;
iLastFrame = (numFrames - 1);
}
// Have we already reached the end? If so, stay there.
if ( m_bReachedEnd && !bWrapAnimation )
{
m_AnimatedTextureFrameNumVar->SetIntValue( iLastFrame );
return;
}
// NOTE: Must not use relative time based methods here
// because the bind proxy can be called many times per frame.
// Prevent multiple Wrap callbacks to be sent for no wrap mode
float startTime;
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
{
startTime = m_flStartTime;
}
else
{
startTime = GetAnimationStartTime(pControl);
}
float deltaTime = gpGlobals->curtime - startTime;
float prevTime = deltaTime - gpGlobals->frametime;
// Clamp..
if (deltaTime < 0.0f)
deltaTime = 0.0f;
if (prevTime < 0.0f)
prevTime = 0.0f;
float frame = flFrameRate * deltaTime;
float prevFrame = flFrameRate * prevTime;
int intFrame = ((int)frame) % numFrames;
int intPrevFrame = ((int)prevFrame) % numFrames;
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
{
intFrame += m_iFrameStart;
intPrevFrame += m_iFrameStart;
}
// Report wrap situation...
if (intPrevFrame > intFrame)
{
m_bReachedEnd = true;
if (bWrapAnimation)
{
AnimationWrapped( pControl );
}
else
{
// Only sent the wrapped message once.
// when we're in non-wrapping mode
if (prevFrame < numFrames)
AnimationWrapped( pControl );
intFrame = numFrames - 1;
}
}
m_AnimatedTextureFrameNumVar->SetIntValue( intFrame );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CMaterialModifyProxy::GetAnimationStartTime( void* pArg )
{
IClientRenderable *pRend = (IClientRenderable *)pArg;
if (!pRend)
return 0.0f;
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
if (pEntity)
{
return pEntity->GetTextureAnimationStartTime();
}
return 0.0f;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CMaterialModifyProxy::AnimationWrapped( void* pArg )
{
IClientRenderable *pRend = (IClientRenderable *)pArg;
if (!pRend)
return;
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
if (pEntity)
{
pEntity->TextureAnimationWrapped();
}
}
//-----------------------------------------------------------------------------
// Does the dirty deed
//-----------------------------------------------------------------------------
void CMaterialModifyProxy::OnBindFloatLerp( C_MaterialModifyControl *pControl )
{
if ( !pControl )
return;
if ( pControl->HasNewAnimationCommands() )
{
pControl->SetAnimationStartTime( gpGlobals->curtime );
pControl->ClearAnimationCommands();
}
// Read the data from the modify entity
materialfloatlerpcommands_t sCommands;
pControl->GetFloatLerpCommands( &sCommands );
m_flStartValue = sCommands.flStartValue;
m_flEndValue = sCommands.flEndValue;
m_flTransitionTime = sCommands.flTransitionTime;
m_flStartTime = pControl->GetAnimationStartTime();
bool bFound;
m_pMaterialVar = m_pMaterial->FindVar( pControl->GetMaterialVariableName(), &bFound, false );
if( bFound )
{
float currentValue;
if( m_flTransitionTime > 0.0f )
{
currentValue = m_flStartValue + ( m_flEndValue - m_flStartValue ) * clamp( ( ( gpGlobals->curtime - m_flStartTime ) / m_flTransitionTime ), 0.0f, 1.0f );
}
else
{
currentValue = m_flEndValue;
}
if( debug_materialmodifycontrol_client.GetBool() && Q_stristr( m_pMaterial->GetName(), "faceandhair" ) && Q_stristr( m_pMaterialVar->GetName(), "warp" ) )
{
static int count = 0;
DevMsg( 1, "CMaterialFloatLerpProxy::OnBind \"%s\" %s=%f %d\n", m_pMaterial->GetName(), m_pMaterialVar->GetName(), currentValue, count++ );
}
m_pMaterialVar->SetFloatValue( currentValue );
}
}
//=============================================================================
//
// MATERIALMODIFYANIMATED PROXY
//
class CMaterialModifyAnimatedProxy : public CBaseAnimatedTextureProxy
{
public:
CMaterialModifyAnimatedProxy() {};
virtual ~CMaterialModifyAnimatedProxy() {};
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
virtual void OnBind( void *pEntity );
virtual float GetAnimationStartTime( void* pBaseEntity );
virtual void AnimationWrapped( void* pC_BaseEntity );
private:
IMaterial *m_pMaterial;
int m_iFrameStart;
int m_iFrameEnd;
bool m_bReachedEnd;
float m_flStartTime;
bool m_bCustomWrap;
float m_flCustomFramerate;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CMaterialModifyAnimatedProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
m_pMaterial = pMaterial;
m_iFrameStart = MATERIAL_MODIFY_ANIMATION_UNSET;
m_iFrameEnd = MATERIAL_MODIFY_ANIMATION_UNSET;
m_bReachedEnd = false;
return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
}
//-----------------------------------------------------------------------------
// Does the dirty deed
//-----------------------------------------------------------------------------
void CMaterialModifyAnimatedProxy::OnBind( void *pEntity )
{
assert ( m_AnimatedTextureVar );
if( m_AnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
return;
ITexture *pTexture;
pTexture = m_AnimatedTextureVar->GetTextureValue();
// Get the modified material vars from the entity input
IClientRenderable *pRend = (IClientRenderable *)pEntity;
if ( pRend )
{
C_BaseEntity *pBaseEntity = pRend->GetIClientUnknown()->GetBaseEntity();
if ( pBaseEntity )
{
for ( C_BaseEntity *pChild = pBaseEntity->FirstMoveChild(); pChild; pChild = pChild->NextMovePeer() )
{
C_MaterialModifyControl *pControl = dynamic_cast<C_MaterialModifyControl*>( pChild );
if ( !pControl )
continue;
if ( !pControl->HasNewAnimationCommands() )
continue;
// Read the data from the modify entity
materialanimcommands_t sCommands;
pControl->GetAnimationCommands( &sCommands );
m_iFrameStart = sCommands.iFrameStart;
m_iFrameEnd = sCommands.iFrameEnd;
m_bCustomWrap = sCommands.bWrap;
m_flCustomFramerate = sCommands.flFrameRate;
m_bReachedEnd = false;
m_flStartTime = gpGlobals->curtime;
pControl->ClearAnimationCommands();
}
}
}
// Init all the vars based on whether we're using the base material settings,
// or the custom ones from the entity input.
int numFrames;
bool bWrapAnimation;
float flFrameRate;
int iLastFrame;
// Do we have a custom frame section from the server?
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
{
if ( m_iFrameEnd == MATERIAL_MODIFY_ANIMATION_UNSET )
{
m_iFrameEnd = pTexture->GetNumAnimationFrames();
}
numFrames = (m_iFrameEnd - m_iFrameStart) + 1;
bWrapAnimation = m_bCustomWrap;
flFrameRate = m_flCustomFramerate;
iLastFrame = (m_iFrameEnd - 1);
}
else
{
numFrames = pTexture->GetNumAnimationFrames();
bWrapAnimation = m_WrapAnimation;
flFrameRate = m_FrameRate;
iLastFrame = (numFrames - 1);
}
// Have we already reached the end? If so, stay there.
if ( m_bReachedEnd && !bWrapAnimation )
{
m_AnimatedTextureFrameNumVar->SetIntValue( iLastFrame );
return;
}
// NOTE: Must not use relative time based methods here
// because the bind proxy can be called many times per frame.
// Prevent multiple Wrap callbacks to be sent for no wrap mode
float startTime;
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
{
startTime = m_flStartTime;
}
else
{
startTime = GetAnimationStartTime(pEntity);
}
float deltaTime = gpGlobals->curtime - startTime;
float prevTime = deltaTime - gpGlobals->frametime;
// Clamp..
if (deltaTime < 0.0f)
deltaTime = 0.0f;
if (prevTime < 0.0f)
prevTime = 0.0f;
float frame = flFrameRate * deltaTime;
float prevFrame = flFrameRate * prevTime;
int intFrame = ((int)frame) % numFrames;
int intPrevFrame = ((int)prevFrame) % numFrames;
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
{
intFrame += m_iFrameStart;
intPrevFrame += m_iFrameStart;
}
// Report wrap situation...
if (intPrevFrame > intFrame)
{
m_bReachedEnd = true;
if (bWrapAnimation)
{
AnimationWrapped( pEntity );
}
else
{
// Only sent the wrapped message once.
// when we're in non-wrapping mode
if (prevFrame < numFrames)
AnimationWrapped( pEntity );
intFrame = numFrames - 1;
}
}
m_AnimatedTextureFrameNumVar->SetIntValue( intFrame );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CMaterialModifyAnimatedProxy::GetAnimationStartTime( void* pArg )
{
IClientRenderable *pRend = (IClientRenderable *)pArg;
if (!pRend)
return 0.0f;
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
if (pEntity)
{
return pEntity->GetTextureAnimationStartTime();
}
return 0.0f;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CMaterialModifyAnimatedProxy::AnimationWrapped( void* pArg )
{
IClientRenderable *pRend = (IClientRenderable *)pArg;
if (!pRend)
return;
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
if (pEntity)
{
pEntity->TextureAnimationWrapped();
}
}
EXPOSE_INTERFACE( CMaterialModifyProxy, IMaterialProxy, "MaterialModify" IMATERIAL_PROXY_INTERFACE_VERSION );
EXPOSE_INTERFACE( CMaterialModifyAnimatedProxy, IMaterialProxy, "MaterialModifyAnimated" IMATERIAL_PROXY_INTERFACE_VERSION );

View File

@@ -0,0 +1,60 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Water LOD control entity.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "iviewrender.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//------------------------------------------------------------------------------
// FIXME: This really should inherit from something more lightweight
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Purpose : Water LOD control entity
//------------------------------------------------------------------------------
class C_WaterLODControl : public C_BaseEntity
{
public:
DECLARE_CLASS( C_WaterLODControl, C_BaseEntity );
DECLARE_CLIENTCLASS();
void OnDataChanged(DataUpdateType_t updateType);
bool ShouldDraw();
private:
float m_flCheapWaterStartDistance;
float m_flCheapWaterEndDistance;
};
IMPLEMENT_CLIENTCLASS_DT(C_WaterLODControl, DT_WaterLODControl, CWaterLODControl)
RecvPropFloat(RECVINFO(m_flCheapWaterStartDistance)),
RecvPropFloat(RECVINFO(m_flCheapWaterEndDistance)),
END_RECV_TABLE()
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void C_WaterLODControl::OnDataChanged(DataUpdateType_t updateType)
{
view->SetCheapWaterStartDistance( m_flCheapWaterStartDistance );
view->SetCheapWaterEndDistance( m_flCheapWaterEndDistance );
}
//------------------------------------------------------------------------------
// We don't draw...
//------------------------------------------------------------------------------
bool C_WaterLODControl::ShouldDraw()
{
return false;
}

View File

@@ -0,0 +1,715 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "iviewrender.h"
#include "view.h"
#include "studio.h"
#include "bone_setup.h"
#include "model_types.h"
#include "beamdraw.h"
#include "engine/ivdebugoverlay.h"
#include "iviewrender_beams.h"
#include "fx.h"
#include "iefx.h"
#include "dlight.h"
#include "IEffects.h"
#include "c_entitydissolveegon.h"
#include "movevars_shared.h"
#include "clienteffectprecachesystem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
CLIENTEFFECT_REGISTER_BEGIN(PrecacheEffectBuild2)
CLIENTEFFECT_MATERIAL("effects/tesla_glow_noz")
CLIENTEFFECT_MATERIAL("effects/spark")
CLIENTEFFECT_MATERIAL("effects/combinemuzzle2")
CLIENTEFFECT_REGISTER_END()
//-----------------------------------------------------------------------------
// Networking
//-----------------------------------------------------------------------------
IMPLEMENT_CLIENTCLASS_DT(C_EntityDissolveEgon, DT_EntityDissolveEgon, CEntityDissolveEgon)
RecvPropTime(RECVINFO(m_flStartTime)),
RecvPropFloat(RECVINFO(m_flFadeOutStart)),
RecvPropFloat(RECVINFO(m_flFadeOutLength)),
RecvPropFloat(RECVINFO(m_flFadeOutModelStart)),
RecvPropFloat(RECVINFO(m_flFadeOutModelLength)),
RecvPropFloat(RECVINFO(m_flFadeInStart)),
RecvPropFloat(RECVINFO(m_flFadeInLength)),
RecvPropInt(RECVINFO(m_nDissolveType)),
RecvPropVector(RECVINFO(m_vDissolverOrigin)),
RecvPropInt(RECVINFO(m_nMagnitude)),
END_RECV_TABLE()
extern PMaterialHandle g_Material_Spark;
PMaterialHandle g_Material_AR2Glow = NULL;
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_EntityDissolveEgon::C_EntityDissolveEgon(void)
{
m_bLinkedToServerEnt = true;
m_pController = NULL;
m_bCoreExplode = false;
m_vEffectColor = Vector(255, 255, 255);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::GetRenderBounds(Vector& theMins, Vector& theMaxs)
{
if (GetMoveParent())
{
GetMoveParent()->GetRenderBounds(theMins, theMaxs);
}
else
{
theMins = GetAbsOrigin();
theMaxs = theMaxs;
}
}
//-----------------------------------------------------------------------------
// On data changed
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::OnDataChanged(DataUpdateType_t updateType)
{
BaseClass::OnDataChanged(updateType);
if (updateType == DATA_UPDATE_CREATED)
{
m_flNextSparkTime = m_flStartTime;
SetNextClientThink(CLIENT_THINK_ALWAYS);
}
}
//-----------------------------------------------------------------------------
// Cleanup
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::UpdateOnRemove(void)
{
if (m_pController)
{
physenv->DestroyMotionController(m_pController);
m_pController = NULL;
}
BaseClass::UpdateOnRemove();
}
//------------------------------------------------------------------------------
// Apply the forces to the entity
//------------------------------------------------------------------------------
IMotionEvent::simresult_e C_EntityDissolveEgon::Simulate(IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular)
{
linear.Init();
angular.Init();
// Make it zero g
linear.z -= -1.02 * GetCurrentGravity();
Vector vel;
AngularImpulse angVel;
pObject->GetVelocity(&vel, &angVel);
vel += linear * deltaTime; // account for gravity scale
Vector unitVel = vel;
Vector unitAngVel = angVel;
float speed = VectorNormalize(unitVel);
// float angSpeed = VectorNormalize( unitAngVel );
// float speedScale = 0.0;
// float angSpeedScale = 0.0;
float flLinearLimit = 50;
float flLinearLimitDelta = 40;
if (speed > flLinearLimit)
{
float flDeltaVel = (flLinearLimit - speed) / deltaTime;
if (flLinearLimitDelta != 0.0f)
{
float flMaxDeltaVel = -flLinearLimitDelta / deltaTime;
if (flDeltaVel < flMaxDeltaVel)
{
flDeltaVel = flMaxDeltaVel;
}
}
VectorMA(linear, flDeltaVel, unitVel, linear);
}
return SIM_GLOBAL_ACCELERATION;
}
//-----------------------------------------------------------------------------
// Tesla effect
//-----------------------------------------------------------------------------
static void FX_BuildTesla(C_BaseEntity *pEntity, Vector &vecOrigin, Vector &vecEnd)
{
BeamInfo_t beamInfo;
beamInfo.m_pStartEnt = pEntity;
beamInfo.m_nStartAttachment = 0;
beamInfo.m_pEndEnt = NULL;
beamInfo.m_nEndAttachment = 0;
beamInfo.m_nType = TE_BEAMTESLA;
beamInfo.m_vecStart = vecOrigin;
beamInfo.m_vecEnd = vecEnd;
beamInfo.m_pszModelName = "sprites/lgtning.vmt";
beamInfo.m_flHaloScale = 0.0;
beamInfo.m_flLife = random->RandomFloat(0.25f, 1.0f);
beamInfo.m_flWidth = random->RandomFloat(8.0f, 14.0f);
beamInfo.m_flEndWidth = 1.0f;
beamInfo.m_flFadeLength = 0.5f;
beamInfo.m_flAmplitude = 24;
beamInfo.m_flBrightness = 255.0;
beamInfo.m_flSpeed = 150.0f;
beamInfo.m_nStartFrame = 0.0;
beamInfo.m_flFrameRate = 30.0;
beamInfo.m_flRed = 138.0;
beamInfo.m_flGreen = 112.0;
beamInfo.m_flBlue = 234.0;
beamInfo.m_nSegments = 18;
beamInfo.m_bRenderable = true;
beamInfo.m_nFlags = 0; //FBEAM_ONLYNOISEONCE;
beams->CreateBeamEntPoint(beamInfo);
}
//-----------------------------------------------------------------------------
// Purpose: Tesla effect
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::BuildTeslaEffect(mstudiobbox_t *pHitBox, const matrix3x4_t &hitboxToWorld, bool bRandom, float flYawOffset)
{
Vector vecOrigin;
QAngle vecAngles;
MatrixGetColumn(hitboxToWorld, 3, vecOrigin);
MatrixAngles(hitboxToWorld, vecAngles.Base());
C_BaseEntity *pEntity = GetMoveParent();
// Make a couple of tries at it
int iTries = -1;
Vector vecForward;
trace_t tr;
do
{
iTries++;
// Some beams are deliberatly aimed around the point, the rest are random.
if (!bRandom)
{
QAngle vecTemp = vecAngles;
vecTemp[YAW] += flYawOffset;
AngleVectors(vecTemp, &vecForward);
// Randomly angle it up or down
vecForward.z = RandomFloat(-1, 1);
}
else
{
vecForward = RandomVector(-1, 1);
}
UTIL_TraceLine(vecOrigin, vecOrigin + (vecForward * 192), MASK_SHOT, pEntity, COLLISION_GROUP_NONE, &tr);
} while (tr.fraction >= 1.0 && iTries < 3);
Vector vecEnd = tr.endpos - (vecForward * 8);
// Only spark & glow if we hit something
if (tr.fraction < 1.0)
{
if (!EffectOccluded(tr.endpos))
{
// Move it towards the camera
Vector vecFlash = tr.endpos;
Vector vecForward;
AngleVectors(MainViewAngles(), &vecForward);
vecFlash -= (vecForward * 8);
g_pEffects->EnergySplash(vecFlash, -vecForward, false);
// End glow
CSmartPtr<CSimpleEmitter> pSimple = CSimpleEmitter::Create("dust");
pSimple->SetSortOrigin(vecFlash);
SimpleParticle *pParticle;
pParticle = (SimpleParticle *)pSimple->AddParticle(sizeof(SimpleParticle), pSimple->GetPMaterial("effects/tesla_glow_noz"), vecFlash);
if (pParticle != NULL)
{
pParticle->m_flLifetime = 0.0f;
pParticle->m_flDieTime = RandomFloat(0.5, 1);
pParticle->m_vecVelocity = vec3_origin;
Vector color(1, 1, 1);
float colorRamp = RandomFloat(0.75f, 1.25f);
pParticle->m_uchColor[0] = MIN(1.0f, color[0] * colorRamp) * 255.0f;
pParticle->m_uchColor[1] = MIN(1.0f, color[1] * colorRamp) * 255.0f;
pParticle->m_uchColor[2] = MIN(1.0f, color[2] * colorRamp) * 255.0f;
pParticle->m_uchStartSize = RandomFloat(6, 13);
pParticle->m_uchEndSize = pParticle->m_uchStartSize - 2;
pParticle->m_uchStartAlpha = 255;
pParticle->m_uchEndAlpha = 10;
pParticle->m_flRoll = RandomFloat(0, 360);
pParticle->m_flRollDelta = 0;
}
}
}
// Build the tesla
FX_BuildTesla(pEntity, vecOrigin, tr.endpos);
}
//-----------------------------------------------------------------------------
// Sorts the components of a vector
//-----------------------------------------------------------------------------
static inline void SortAbsVectorComponents(const Vector& src, int* pVecIdx)
{
Vector absVec(fabs(src[0]), fabs(src[1]), fabs(src[2]));
int maxIdx = (absVec[0] > absVec[1]) ? 0 : 1;
if (absVec[2] > absVec[maxIdx])
{
maxIdx = 2;
}
// always choose something right-handed....
switch (maxIdx)
{
case 0:
pVecIdx[0] = 1;
pVecIdx[1] = 2;
pVecIdx[2] = 0;
break;
case 1:
pVecIdx[0] = 2;
pVecIdx[1] = 0;
pVecIdx[2] = 1;
break;
case 2:
pVecIdx[0] = 0;
pVecIdx[1] = 1;
pVecIdx[2] = 2;
break;
}
}
//-----------------------------------------------------------------------------
// Compute the bounding box's center, size, and basis
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::ComputeRenderInfo(mstudiobbox_t *pHitBox, const matrix3x4_t &hitboxToWorld,
Vector *pVecAbsOrigin, Vector *pXVec, Vector *pYVec)
{
// Compute the center of the hitbox in worldspace
Vector vecHitboxCenter;
VectorAdd(pHitBox->bbmin, pHitBox->bbmax, vecHitboxCenter);
vecHitboxCenter *= 0.5f;
VectorTransform(vecHitboxCenter, hitboxToWorld, *pVecAbsOrigin);
// Get the object's basis
Vector vec[3];
MatrixGetColumn(hitboxToWorld, 0, vec[0]);
MatrixGetColumn(hitboxToWorld, 1, vec[1]);
MatrixGetColumn(hitboxToWorld, 2, vec[2]);
// vec[1] *= -1.0f;
Vector vecViewDir;
VectorSubtract(CurrentViewOrigin(), *pVecAbsOrigin, vecViewDir);
VectorNormalize(vecViewDir);
// Project the shadow casting direction into the space of the hitbox
Vector localViewDir;
localViewDir[0] = DotProduct(vec[0], vecViewDir);
localViewDir[1] = DotProduct(vec[1], vecViewDir);
localViewDir[2] = DotProduct(vec[2], vecViewDir);
// Figure out which vector has the largest component perpendicular
// to the view direction...
// Sort by how perpendicular it is
int vecIdx[3];
SortAbsVectorComponents(localViewDir, vecIdx);
// Here's our hitbox basis vectors; namely the ones that are
// most perpendicular to the view direction
*pXVec = vec[vecIdx[0]];
*pYVec = vec[vecIdx[1]];
// Project them into a plane perpendicular to the view direction
*pXVec -= vecViewDir * DotProduct(vecViewDir, *pXVec);
*pYVec -= vecViewDir * DotProduct(vecViewDir, *pYVec);
VectorNormalize(*pXVec);
VectorNormalize(*pYVec);
// Compute the hitbox size
Vector boxSize;
VectorSubtract(pHitBox->bbmax, pHitBox->bbmin, boxSize);
// We project the two longest sides into the vectors perpendicular
// to the projection direction, then add in the projection of the perp direction
Vector2D size(boxSize[vecIdx[0]], boxSize[vecIdx[1]]);
size.x *= fabs(DotProduct(vec[vecIdx[0]], *pXVec));
size.y *= fabs(DotProduct(vec[vecIdx[1]], *pYVec));
// Add the third component into x and y
size.x += boxSize[vecIdx[2]] * fabs(DotProduct(vec[vecIdx[2]], *pXVec));
size.y += boxSize[vecIdx[2]] * fabs(DotProduct(vec[vecIdx[2]], *pYVec));
// Bloat a bit, since the shadow wants to extend outside the model a bit
size *= 2.0f;
// Clamp the minimum size
Vector2DMax(size, Vector2D(10.0f, 10.0f), size);
// Factor the size into the xvec + yvec
(*pXVec) *= size.x * 0.5f;
(*pYVec) *= size.y * 0.5f;
}
//-----------------------------------------------------------------------------
// Sparks!
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::DoSparks(mstudiohitboxset_t *set, matrix3x4_t *hitboxbones[MAXSTUDIOBONES])
{
if (m_flNextSparkTime > gpGlobals->curtime)
return;
float dt = m_flStartTime + m_flFadeOutStart - gpGlobals->curtime;
dt = clamp(dt, 0.0f, m_flFadeOutStart);
float flNextTime;
if (m_nDissolveType == ENTITY_DISSOLVE_ELECTRICAL)
{
flNextTime = SimpleSplineRemapVal(dt, 0.0f, m_flFadeOutStart, 2.0f * TICK_INTERVAL, 0.4f);
}
else
{
// m_nDissolveType == ENTITY_DISSOLVE_ELECTRICAL_LIGHT);
flNextTime = SimpleSplineRemapVal(dt, 0.0f, m_flFadeOutStart, 0.3f, 1.0f);
}
m_flNextSparkTime = gpGlobals->curtime + flNextTime;
// Send out beams around us
int iNumBeamsAround = 2;
int iNumRandomBeams = 1;
int iTotalBeams = iNumBeamsAround + iNumRandomBeams;
float flYawOffset = RandomFloat(0, 360);
for (int i = 0; i < iTotalBeams; i++)
{
int nHitbox = random->RandomInt(0, set->numhitboxes - 1);
mstudiobbox_t *pBox = set->pHitbox(nHitbox);
float flActualYawOffset = 0;
bool bRandom = (i >= iNumBeamsAround);
if (!bRandom)
{
flActualYawOffset = anglemod(flYawOffset + ((360 / iTotalBeams) * i));
}
BuildTeslaEffect(pBox, *hitboxbones[pBox->bone], bRandom, flActualYawOffset);
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::SetupEmitter(void)
{
if (!m_pEmitter)
{
m_pEmitter = CSimpleEmitter::Create("C_EntityDissolveEgon");
m_pEmitter->SetSortOrigin(GetAbsOrigin());
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : float
//-----------------------------------------------------------------------------
float C_EntityDissolveEgon::GetFadeInPercentage(void)
{
float dt = gpGlobals->curtime - m_flStartTime;
if (dt > m_flFadeOutStart)
return 1.0f;
if (dt < m_flFadeInStart)
return 0.0f;
if ((dt > m_flFadeInStart) && (dt < m_flFadeInStart + m_flFadeInLength))
{
dt -= m_flFadeInStart;
return (dt / m_flFadeInLength);
}
return 1.0f;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : float
//-----------------------------------------------------------------------------
float C_EntityDissolveEgon::GetFadeOutPercentage(void)
{
float dt = gpGlobals->curtime - m_flStartTime;
if (dt < m_flFadeInStart)
return 1.0f;
if (dt > m_flFadeOutStart)
{
dt -= m_flFadeOutStart;
if (dt > m_flFadeOutLength)
return 0.0f;
return 1.0f - (dt / m_flFadeOutLength);
}
return 1.0f;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : float
//-----------------------------------------------------------------------------
float C_EntityDissolveEgon::GetModelFadeOutPercentage(void)
{
float dt = gpGlobals->curtime - m_flStartTime;
if (dt < m_flFadeOutModelStart)
return 1.0f;
if (dt > m_flFadeOutModelStart)
{
dt -= m_flFadeOutModelStart;
if (dt > m_flFadeOutModelLength)
return 0.0f;
return 1.0f - (dt / m_flFadeOutModelLength);
}
return 1.0f;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_EntityDissolveEgon::ClientThink(void)
{
C_BaseEntity *pEnt = GetMoveParent();
if (!pEnt)
return;
bool bIsRagdoll;
#ifdef TF_CLIENT_DLL
bIsRagdoll = true;
#else
C_BaseAnimating *pAnimating = GetMoveParent() ? GetMoveParent()->GetBaseAnimating() : NULL;
if (!pAnimating)
return;
bIsRagdoll = pAnimating->IsRagdoll();
#endif
// NOTE: IsRagdoll means *client-side* ragdoll. We shouldn't be trying to fight
// the server ragdoll (or any server physics) on the client
if ((!m_pController) && (m_nDissolveType == ENTITY_DISSOLVE_NORMAL) && bIsRagdoll)
{
IPhysicsObject *ppList[VPHYSICS_MAX_OBJECT_LIST_COUNT];
int nCount = pEnt->VPhysicsGetObjectList(ppList, ARRAYSIZE(ppList));
if (nCount > 0)
{
m_pController = physenv->CreateMotionController(this);
for (int i = 0; i < nCount; ++i)
{
m_pController->AttachObject(ppList[i], true);
}
}
}
color32 color;
color.r = (1.0f - GetFadeInPercentage()) * m_vEffectColor.x;
color.g = (1.0f - GetFadeInPercentage()) * m_vEffectColor.y;
color.b = (1.0f - GetFadeInPercentage()) * m_vEffectColor.z;
color.a = GetModelFadeOutPercentage() * 255.0f;
// Setup the entity fade
pEnt->SetRenderMode(kRenderTransColor);
pEnt->SetRenderColor(color.r, color.g, color.b, color.a);
if (GetModelFadeOutPercentage() <= 0.2f)
{
m_bCoreExplode = true;
}
// If we're dead, fade out
/*if (GetFadeOutPercentage() <= 0.0f)
{
// Do NOT remove from the client entity list. It'll confuse the local network backdoor, and the entity will never get destroyed
// because when the server says to destroy it, the client won't be able to find it.
// ClientEntityList().RemoveEntity( GetClientHandle() );
partition->Remove(PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle());
RemoveFromLeafSystem();
//FIXME: Ick!
//Adrian: I'll assume we don't need the ragdoll either so I'll remove that too.
if (m_bLinkedToServerEnt == false)
{
Release();
C_ClientRagdoll *pRagdoll = dynamic_cast <C_ClientRagdoll *> (pEnt);
if (pRagdoll)
{
pRagdoll->ReleaseRagdoll();
}
#ifdef TF_CLIENT_DLL
else
{
pEnt->Release();
}
#endif
}
}*/
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : flags -
// Output : int
//-----------------------------------------------------------------------------
int C_EntityDissolveEgon::DrawModel(int flags)
{
// See if we should draw
if (gpGlobals->frametime == 0 || m_bReadyToDraw == false)
return 0;
C_BaseAnimating *pAnimating = GetMoveParent() ? GetMoveParent()->GetBaseAnimating() : NULL;
if (pAnimating == NULL)
return 0;
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if (pAnimating->HitboxToWorldTransforms(hitboxbones) == false)
return 0;
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel(pAnimating->GetModel());
if (pStudioHdr == NULL)
return false;
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet(pAnimating->GetHitboxSet());
if (set == NULL)
return false;
QAngle Ang;
// Make sure the emitter is setup properly
SetupEmitter();
// Get fade percentages for the effect
float fadeInPerc = GetFadeInPercentage();
float fadeOutPerc = GetFadeOutPercentage();
float fadePerc = (fadeInPerc >= 1.0f) ? fadeOutPerc : fadeInPerc;
Vector vecSkew = vec3_origin;
// Do extra effects under certain circumstances
if ((fadePerc < 0.99f) && ((m_nDissolveType == ENTITY_DISSOLVE_ELECTRICAL) || (m_nDissolveType == ENTITY_DISSOLVE_ELECTRICAL_LIGHT)))
{
DoSparks(set, hitboxbones);
}
// Skew the particles in front or in back of their targets
vecSkew = CurrentViewForward() * (8.0f - ((1.0f - fadePerc) * 32.0f));
float spriteScale = ((gpGlobals->curtime - m_flStartTime) / m_flFadeOutLength);
spriteScale = clamp(spriteScale, 0.75f, 1.0f);
// Cache off this material reference
/*if (g_Material_Spark == NULL)
{
g_Material_Spark = ParticleMgr()->GetPMaterial("effects/spark");
}
if (g_Material_AR2Glow == NULL)
{
g_Material_AR2Glow = ParticleMgr()->GetPMaterial("effects/combinemuzzle2");
}
SimpleParticle *sParticle;*/
for (int i = 0; i < set->numhitboxes; ++i)
{
Vector vecAbsOrigin, xvec, yvec;
mstudiobbox_t *pBox = set->pHitbox(i);
ComputeRenderInfo(pBox, *hitboxbones[pBox->bone], &vecAbsOrigin, &xvec, &yvec);
Vector offset;
Vector xDir, yDir;
xDir = xvec;
//float xScale = VectorNormalize(xDir) * 0.75f;
yDir = yvec;
//float yScale = VectorNormalize(yDir) * 0.75f;
int numParticles = clamp(3.0f * fadePerc, 0.f, 3.f);
int iTempParts = 2;
if (m_nDissolveType == ENTITY_DISSOLVE_CORE)
{
if (m_bCoreExplode == true)
{
numParticles = 15;
iTempParts = 20;
}
}
/*for (int j = 0; j < iTempParts; j++)
{
// Skew the origin
offset = xDir * Helper_RandomFloat(-xScale*0.5f, xScale*0.5f) + yDir * Helper_RandomFloat(-yScale*0.5f, yScale*0.5f);
offset += vecSkew;
VectorAngles(vecAbsOrigin + offset, Ang);
AddEffects(EF_EGONDISSOLVELIGHT);
DispatchParticleEffect("dissolve_egon_warp", vecAbsOrigin + offset, Ang, NULL);
}
for (int j = 0; j < numParticles; j++)
{
offset = xDir * Helper_RandomFloat(-xScale*0.5f, xScale*0.5f) + yDir * Helper_RandomFloat(-yScale*0.5f, yScale*0.5f);
offset += vecSkew;
AddEffects(EF_EGONDISSOLVELIGHT);
VectorAngles(vecAbsOrigin + offset, Ang);
DispatchParticleEffect("dissolve_egon", vecAbsOrigin + offset, Ang, NULL);
}
dlight_t *el = effects->CL_AllocDlight(index);//( index );
el->origin = offset;
el->color.r = 64;
el->color.g = 128;
el->color.b = 255;
el->color.exponent = 5;
el->radius = random->RandomInt(32, 128);
el->decay = el->radius / 0.05f;
el->die = gpGlobals->curtime + 0.05f;*/
}
return 1;
}

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram />

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram />

View File

@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
Debug|Win32|D:\SourceCodes\project_overcharged_build_10_rtt\src_RTT\|

Some files were not shown because too many files have changed in this diff Show More