1
0
KF2-Dev-Scripts/Core/Globals.uci

145 lines
5.7 KiB
Plaintext
Raw Normal View History

2020-12-13 15:01:13 +00:00
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
/**
* Globals.uci - Unreal Engine global include file for UnrealScript.
* Never include this file before the class definition.
*/
/**
* Macro for including the current function name in a string.
*/
`define Location "("$Name$") `{ClassName}::"$GetStateName()$":"$GetFuncName()
`define StaticLocation "`{ClassName}::"$GetStateName()$":"$GetFuncName()
/**
* Expands to an in-line if statement with a log if debug is defined;
* it expands to nothing if debug is not defined. The debug macro takes
* its value from the -debug flag on the script compilation command line.
*
* Also demonstrates how to use backslashes to declare a multi-line macro.
*
* @param msg the string that should be logged
* @param cond [opt] the condition that is used to evaluate whether the message should be written
* @param tag [opt] the tag for the log statement
*/
/*
this macro is now added to the hardcoded symbol table, so don't try adding it again
`if(`isdefined(debug))
`define Logd(msg,cond,tag)\
`if(`cond)\
if (`cond)\
`{endif}\
log(`msg`if(`tag),`tag`endif)
`else
`define Logd
`endif
*/
/**
* Expands to an in-line if statement with a log unless FINAL_RELEASE is defined;
*
*
* @param msg the string that should be logged
* @param cond [opt] the condition that is used to evaluate whether the message should be written
* @param tag [opt] the tag for the log statement
*/
/*
this macro is now added to the hardcoded symbol table, so don't try adding it again
`if( `isdefined(FINAL_RELEASE) )
`if(`isdefined(FINAL_RELEASE_DEBUGCONSOLE))
`define Log(msg,cond,tag) `if(`cond)if(`cond)`{endif}log(`msg`if(`tag),`tag`endif)
`else
`define Log(msg,cond,tag)
`endif
`else
`define Log(msg,cond,tag) `if(`cond)if(`cond)`{endif}log(`msg`if(`tag),`tag`endif)
`endif
*/
/**
* Macro for easily logging a property or function return value. Expands into a string
* containing the name of the expression and value of the expression.
* Useful for writing self-documenting log statements.
*
* @param expr the expression that you want to log
* @param name [opt] the text that will immediately preceed the expression's value
* in the log statement. if not specified, uses expr.
*/
`define ShowVar(expr,name) "`if(`name)`name`else`expr`endif:'"$`expr$"'"
/**
* Macro for easily logging a property or function return value. Expands into a string
* containing the name of the expression and value of the expression.
* Useful for writing self-documenting log statements.
*
* @param expr the expression that you want to log
* @param name [opt] the text that will immediately preceed the expression's value
* in the log statement. if not specified, uses expr.
*/
`define ShowEnum(enum,expr,name) "`if(`name)`name`else`expr`endif:'"$GetEnum(Enum'`enum',`expr)$"'"
/**
* Macro for easily logging the name of an object. Useful for logging objects without extraneous
* checks against None.
*
* @param obj the object that you want to log
* @param name [opt] the text that will immediately preceed the object's name
* in the log statement. if not specified, uses obj.
*/
`define ShowObj(Obj,name) "`if(`name)`name`else`Obj`endif:"$(`Obj != None ? string(`Obj.Name) : "None")
/**
* Macro for logging the entry into a function.
*
* @param msg [opt] any additional text you'd like included in the log message
* @param cond [opt] the condition that is used to evaluate whether the message should be written
*/
`define Entry(msg,cond,tag) `log(">> "$ `Location `if(`msg)@`msg`endif, `if(`cond), `cond`{endif}`if(`tag), `tag`{endif})
/**
* Macro for logging the exit from a function.
*
* @param msg [opt] any additional text you'd like included in the log message
* @param cond [opt] the condition that is used to evaluate whether the message should be written
*/
`define Exit(msg,cond,tag) `log("<< "$ `Location `if(`msg)@`msg`endif, `if(`cond), `cond`{endif}`if(`tag), `tag`{endif})
/**
* Macro for logging an IP address
*
* @param addr the IP address you want to log
*/
// `define ShowAddr(addr) " Addr:'"$IpAddrToString(`addr)$"'"
`define LogFatal(cat,msg) `log("FATAL:" @ `msg,,`cat)
`define LogError(cat,msg) `log("ERROR:" @ `msg,,`cat)
`define LogWarn(cat,msg) `log("WARN:" @ `msg,,`cat)
`define LogInfo(cat,msg) `log("INFO:" @ `msg,,`cat)
`define LogDebug(cat,msg) `log("DEBUG:" @ `msg,,`cat)
`define LogTrace(cat,msg) `log("TRACE:" @ `msg,,`cat)
/** Convenience macro for inventory debugging */
`define LogInv(msg) `log(WorldInfo.TimeSeconds @ "Self:" @ Self @ "Instigator:" @ Instigator @ GetStateName() $ "::" $ GetFuncName() @ `msg,,'Inventory')
`define DLog(msg) `Log(WorldInfo.TimeSeconds @ Self @ GetStateName() $ "::" $ GetFuncName() @ `msg)
/** This is a slick way to to do thing like: TimeSince(LastFoo) < Delta where the macro makes it a lot easier to read what the code is doing **/
`define TimeSince(Time) (WorldInfo.TimeSeconds - `Time)
/** This is used for classes which are object derived and do not have access to WorldInfo so we need to pass in the Actor to get a worldinfo **/
`define TimeSinceEx(Actor,Time) (`Actor.WorldInfo.TimeSeconds - `Time)
//@HSL_BEGIN_XBOX
`define AddUniqueItemToArray(Array,Item) if (`Array.Find(`Item) == INDEX_NONE) { `Array.AddItem(`Item); }
//@igs(jc): Make players and controllers 16 globally for our purposes. If you change these
// numbers, make sure you also adjust the ones in UnDingo.h
`define MAX_NUM_PLAYERS 24
`define MAX_NUM_CONTROLLERS 24
//@HSL_END_XBOX
/** To use WITH_PHYSX directive in uc files. Comment this out when using WITH_NOVODEX **/
`define WITH_PHYSX