Skip to content

Commit

Permalink
Added AAS Documentation from ModWiki + DoomArchives
Browse files Browse the repository at this point in the history
  • Loading branch information
FriskTheFallenHuman committed Feb 26, 2024
1 parent d2b12d1 commit 4084cbe
Show file tree
Hide file tree
Showing 9 changed files with 2,164 additions and 35 deletions.
26 changes: 26 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ gh_edit_repository: "https://github.com/FriskTheFallenHuman/idtecharchives"
baseurl: "" # the subpath of your site, e.g. /blog
url: https://friskthefallenhuman.github.io/idtecharchives/ # the base hostname & protocol for your site, e.g. http://example.com

# Callouts
callouts:
highlight:
color: yellow
important:
title: Important
color: blue
new:
title: New
color: green
note:
title: Note
color: purple
warning:
title: Warning
color: red
todo:
title: TODO
color: blue
quake4:
title: Quake IV Only
color: yellow
prey06:
title: Prey 2006 Only
color: blue

# Build settings
theme: just-the-docs
plugins:
Expand Down
154 changes: 154 additions & 0 deletions docs/code_style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
layout: default
title: Style Guide
nav_order: 2
---

# Code Style Guide.
{: .fs-9 }

---

Naming Conventions:
{: .fs-6 }

---

- Variables: Use camelCase for local variables. Prefix global variables with `g_` and static class variables with `s_`, followed by camelCase:

```cpp
int countEnts;
int g_globalData;
bool s_mapParse;
```

- Functions and Methods: Use camelCase, starting with a verb that describes the function's action:
```cpp
void IdActor::myAwesomeFunction() {
/* Some code goes here */
}
```
- Classes and Structs: Use PascalCase. Prefix interfaces with I and abstract classes with Abstract:
```cpp
struct idStructExample {
int structVariable;
};
```
{: .note }
> Official release idtech4 codebases names their interfaces/Classes with different names `hh` for HumanHead (Prey 2006) and `rv` for RavenSoftware (Quake 4).
- Constants and Enums: Use `UPPER_CASE` with underscores between words:
```cpp
typedef enum {
ENUM_ONE,
ENUM_TWO,
ENUM_THREE
} enumListType_t;
```
- Files: Source files (.cpp) and header files (.h) should match the class name they define. Use lower_case with underscores for non-class-specific files:
```
+-- ..
|-- (Doom 3 GPL Release)
|
|-- game
| |-- Entity.cpp
| |-- Entity.h
| |-- Game_Local.h
| |-- Game_Something.h
|
+-- ..
```
Formatting and Style:
{: .fs-6 }
---
- Brace Style: Use the [K&R BSD KNF style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style), with open brace on the same line:
```cpp
void IdActor::SetFOV( float fov ) {
}
```
- Pointer and Reference Symbols: Attach to the type, not the variable name.
- One Statement Per Line: Avoid multiple statements on the same line to enhance readability.
- Indentation: Use tabs, not space, with a size of 2 tabs per indentation level.
- Spaces: Use spaces around operators and after commas to improve readability.
- Line Length: Try to keep lines under 80 characters when possible, breaking longer lines logically.
Comments and Documentation:
{: .fs-6 }
---
- Use doxygen-style comments for documenting classes, methods, and functions:
```cpp
/*
=====================
idCameraView::Stop
=====================
*/
```
- Place brief descriptions on the same line as the comment start, and detailed descriptions on subsequent lines:
```cpp
/*
================
idGameEdit::ParseSpawnArgsToRenderEntity
parse the static model parameters
this is the canonical renderEntity parm parsing,
which should be used by dmap and the editor
================
*/
```
- Comment every class, public method, and complex block of code to explain intent, not how the code works.
Best Practices:
{: .fs-6 }
---
- Initialize all variables upon declaration:
```cpp
class idActor : public idAFEntity_Gibbable {
/* IdActor code goes here... */
bool dontBleed;
/* IdActor code goes here... */
}
class idActor::IdActor() {
dontBleed = false;
}
```
- Prefer const correctness. Use const wherever possible.
- Explicitly define copy constructors and assignment operators for classes managing resources.
- Prefer C++ casts over C-style casts.
- Use nullptr instead of NULL or 0 for pointer initialization and comparison.
- Adhere to the Rule of Three/Five, providing custom copy constructor, copy assignment operator, and destructor when you manually manage resource allocation.
- Organize class definitions with public members first, followed by protected, then private.
- Prefer prefix over postfix increment/decrement operators for non-primitive types.
File Organization:
{: .fs-6 }
---
- Header files should start with a guard to prevent multiple inclusions and include only necessary headers to minimize dependencies.
- Group include directives logically, starting with standard library headers, followed by third-party libraries, and then project-specific headers.
17 changes: 17 additions & 0 deletions docs/doom3/doom3_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: default
title: Doom 3
nav_order: 4
has_children: true
---

# DOOM 3 & DOOM 3: RoE.
{: .fs-9 }

The game that debuted with the engine.
{: .fs-6 .fw-300 }

---

{: .warning }
> This is a **WIP** Wiki.
Loading

0 comments on commit 4084cbe

Please sign in to comment.