The following is an overview of how the code should look like. For anybody working for Frictional Games, this is a must. For all else, see it as guidelines to have consistent code which is especially good if you want share your stuff.
Remember also to look at existing code and try and copy the looks.
System Hungarian notation is to be used for all variable names. These are the notations used:
Prefix | Description | Example | |||
c | a class | class cMyClass {} | |||
i | an interface | interface iMyInterface {} | |||
f | a float or double value. | float fX; | |||
l | any integer (char, int, uint, etc) | int lX; | |||
p | an angel script handle or C++ pointer. | iPhysicsBody@ pBody; iPhysicsBody *pBody; | |||
s | a string | cString sWord; | |||
v | a vector or array | int[] vNumbers; cVector3f vPoint | |||
mtx | a matrix | cMatrixf mtxTransform; | |||
q | a quaternion | cQuaternion qRotation; | |||
a | an argument | void Func(int alX) { | |||
m | a member variable | class cMyClass { int mlMember; } |
|||
g | a global variable, defined outside of a class or function. | int glMyGlobal; class cMyClass {} |
|||
id | this is for tID type. | tID m_idEntity. |
a variable name always starts with a lower case letter, so anything of type not specified must start with a lower case word. Example:
cMyOwnClass myClass;
If combining two prefixes, and one consist of more than one letter, then have an underscore between them. Example:
cMatrix m_mtxMemberMatrix;
Always comment the code you write; when scripting, it is always certain somebody else will work on it. Comment to make other people understand wha