eg:
if (room_number != item->room_number)
ItemNewRoom(item_number, room_number);
eg:
if (camera.item && (camera.type == FIXED_CAMERA || camera.type == HEAVY_CAMERA))
fixed_camera = 1;
else
{
item = lara_item;
fixed_camera = 0;
}
eg:
do AnimateLara(l); while (l->current_anim_state != AS_NULL);
Exceptions are the control vars in for loops.
eg:
for (int i = 0; i < num; i++)
{
stuff
stufffff
}
for (int i = 0; i < num; i++)
For nested loops, first name to use is i, then j, then you are free to choose. UNLESS the value is used elsewhere after the loop, then any name is fine, and the variable should be at the top of the function.
struct pointers
structs
struct arrays
float pointers
long pointers
ulong pointers
short pointers
ushort pointers
char pointers
uchar pointers
float arrays
floats
long arrays
longs
short arrays
shorts
char arrays
chars
- Empty spaces between each case
- Empty spaces between the case and the line that follows if that line is an if statement, for loop, while loop, or another switch/case
example:
switch (x)
{
case 0:
x++;
break;
case 1:
if (x == 2)
x--;
break;
case 2:
x /= 2;
break;
case 3:
x = y;
case 4:
x += z;
break;
default:
abort();
break;
}