Skip to content

Commit

Permalink
ACS|Hexen: Simplified ACScript => BytecodeScriptInfo lookup
Browse files Browse the repository at this point in the history
ACScript instances only ever exist while the bytecode which defines
said script is in memory. Once loaded/populated, the script info db
is never reallocated (only modified). Therefore, linking the info to
a given ACScript thinker can be done directly, using a pointer.
  • Loading branch information
danij-deng committed Feb 1, 2014
1 parent 298e450 commit 5914238
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 271 deletions.
10 changes: 4 additions & 6 deletions doomsday/plugins/hexen/include/acscript.h
Expand Up @@ -34,6 +34,7 @@
#define MAX_ACS_WORLD_VARS 64
#define ACS_STACK_DEPTH 32

struct BytecodeScriptInfo;
#ifdef __cplusplus
class ACScriptInterpreter;
#endif
Expand All @@ -46,8 +47,7 @@ typedef struct acscript_s {
mobj_t *activator;
Line *line;
int side;
int number;
int infoIndex;
BytecodeScriptInfo *_info;
int delayCount;
int stack[ACS_STACK_DEPTH];
int stackPtr;
Expand All @@ -57,6 +57,8 @@ typedef struct acscript_s {
#ifdef __cplusplus
ACScriptInterpreter &interpreter() const;

BytecodeScriptInfo &info() const;

void runTick();

/**
Expand Down Expand Up @@ -89,8 +91,6 @@ void ACScript_Thinker(ACScript *script);
#endif

#ifdef __cplusplus
struct BytecodeScriptInfo;

/**
* Action-Code Script (ACS) bytecode interpreter.
*/
Expand Down Expand Up @@ -209,8 +209,6 @@ class ACScriptInterpreter
public: /// @todo make private:
BytecodeScriptInfo &scriptInfoByIndex(int index);

BytecodeScriptInfo &scriptInfoFor(ACScript *script);

private:
/**
* Returns the logical index of a @a scriptNumber; otherwise @c -1.
Expand Down

0 comments on commit 5914238

Please sign in to comment.