foxygit / doom Log in
commit 714b700b1cf7f9cb0f6dca3c9bc7b0653a74f270
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Fri Jan 5 01:47:19 2018 +0100
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Fri Jan 5 01:47:19 2018 +0100

    hexen: Add doc comments for new functions.
---
 src/hexen/p_acs.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c
index d52d8a74..f0cf190b 100644
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -874,14 +874,34 @@ static void Drop(void)
     ACScript->stackPtr--;
 }

+//==========================================================================
+//
+// ReadCodeImmediate
+//
+// Some instructions take "immediate" parameters which are stored in the
+// bytecode immediately following the instruction. This function should be
+// used to read them.
+//
+//==========================================================================
+
 static int ReadCodeImmediate(void)
 {
     int result;
+    // TODO: Add bounds checking
     result = *PCodePtr;
     ++PCodePtr;
     return result;
 }

+//==========================================================================
+//
+// ReadScriptVar
+//
+// Read a script variable index as an immediate value, validating the
+// result is a valid script variable number.
+//
+//==========================================================================
+
 static int ReadScriptVar(void)
 {
     int var = ReadCodeImmediate();
@@ -891,6 +911,15 @@ static int ReadScriptVar(void)
     return var;
 }

+//==========================================================================
+//
+// ReadMapVar
+//
+// Read a map variable index as an immediate value, validating the
+// result is a valid map variable number.
+//
+//==========================================================================
+
 static int ReadMapVar(void)
 {
     int var = ReadCodeImmediate();
@@ -900,6 +929,15 @@ static int ReadMapVar(void)
     return var;
 }

+//==========================================================================
+//
+// ReadWorldVar
+//
+// Read a world variable index as an immediate value, validating the
+// result is a valid world variable number.
+//
+//==========================================================================
+
 static int ReadWorldVar(void)
 {
     int var = ReadCodeImmediate();
@@ -909,6 +947,15 @@ static int ReadWorldVar(void)
     return var;
 }

+//==========================================================================
+//
+// StringLookup
+//
+// Look up the given string in the strings table by index, validating that
+// it is a valid string index.
+//
+//==========================================================================
+
 static char *StringLookup(int string_index)
 {
     ACSAssert(string_index >= 0,