Difference between revisions of "Common Script External Code"

From Wolfire Games Wiki
Jump to: navigation, search
m (ASContext class)
(Global Variables)
Line 17: Line 17:
 
<pre style="white-space: pre-wrap;">Camera camera;</pre>
 
<pre style="white-space: pre-wrap;">Camera camera;</pre>
 
<pre style="white-space: pre-wrap;">CharacterScriptGetter character_getter;</pre>
 
<pre style="white-space: pre-wrap;">CharacterScriptGetter character_getter;</pre>
<pre style="white-space: pre-wrap;">ASContext context;</pre>
+
<pre style="white-space: pre-wrap;">ASContext context; // The context for the currently running script, whether that is the menu script, level script, character script, or hotspot script</pre>
 
<pre style="white-space: pre-wrap;">float last_controller_event_time;  // The time the last game controller input event occurred</pre>
 
<pre style="white-space: pre-wrap;">float last_controller_event_time;  // The time the last game controller input event occurred</pre>
 
<pre style="white-space: pre-wrap;">float last_keyboard_event_time;  // The time the last keyboard input event occurred</pre>
 
<pre style="white-space: pre-wrap;">float last_keyboard_event_time;  // The time the last keyboard input event occurred</pre>

Revision as of 05:23, 5 November 2017

This is a list of the external code that is available inside all scripts - variables, functions, and classes that "magically" exist.

To see a list of external code that is available only in specific scripts, please see the corresponding page page - Level Script External Code Character Script External Code

This list is pulled from the ~/Documents/Wolfire/Overgrowth/ directory, from the aschar_docs.h and aslevel_docs.h files, which are automatically generated by the game.

See this page to find the location for the Wolfire/Overgrowth folder on each OS - How to clear the game's cache

TODO: These can be documented individually, possibly on their own pages - or maybe as just subsections?

TODO: Provide different groupings as well? Might be fine to duplicate them into feature sections of this page or another page.

TODO: It's possible some of these might not work in hotspot scripts. If you find that to be the case, please copy a function to level scripts/character scripts and remove it from here.

Global Variables

Camera camera;
CharacterScriptGetter character_getter;
ASContext context;  // The context for the currently running script, whether that is the menu script, level script, character script, or hotspot script
float last_controller_event_time;  // The time the last game controller input event occurred
float last_keyboard_event_time;  // The time the last keyboard input event occurred
float last_mouse_event_time;  // The time the last mouse input event occurred
Level level;
Physics physics;
uint UINT32MAX;

Constants

Types in this section that specify the base type for the enum aren't actually exposed via enums. They are defined as const instances of the base type.

Functions that take those parameters will take the base type instead. E.g. _delete_on_draw is actually defined in your script as an "const int _delete_on_draw".

enum AttachmentType {
    _at_attachment,
    _at_grip,
    _at_sheathe,
    _at_unspecified,
};
enum CameraFlags {
    kEditorCamera,
    kPreviewCamera,
};
enum DebugDrawLifespanType : int {
    _delete_on_draw,
    _delete_on_update,
    _fade,
    _persistent,
};
enum EngineState {
    kEngineNoState,
    kEngineLevelState,
    kEngineEditorLevelState,
    kEngineEngineScriptableUIState,
    kEngineCampaignState,
};
enum EntityType {
    _env_object,
    _decal_object,
    _item_object,
    _movement_object,
    _hotspot_object,
    _placeholder_object,
    _path_point_object,
    _dynamic_light_object,
};
enum ItemType : int {
    _collectable,
    _item_no_type,
    _misc,
    _weapon,
};
enum JsonValueType {
    JSONnullValue,
    JSONintValue,
    JSONuintValue,
    JSONrealValue,
    JSONstringValue,
    JSONbooleanValue,
    JSONarrayValue,
    JSONobjectValue,
};
enum KeyboardInputModeFlag {
    KIMF_NO,
    KIMF_MENU,
    KIMF_PLAYING,
    KIMF_LEVEL_EDITOR_GENERAL,
    KIMF_LEVEL_EDITOR_DIALOGUE_EDITOR,
    KIMF_GUI_GENERAL,
    KIMF_ANY,
};
enum KnockedOutType : int {
    _awake,
    _dead,
    _unconscious,
};
enum LogType {
    fatal,
    error,
    warning,
    info,
    debug,
    spam,
};
enum MessageType : int {
    _editor_msg;
    _plant_movement_msg;
};
enum SDLNumeric {
    K_ENTER,
    KP_ENTER,
    K_BACKSPACE,
    K_0,
    K_1,
    K_2,
    K_3,
    K_4,
    K_5,
    K_6,
    K_7,
    K_8,
    K_9,
    KP_0,
    KP_1,
    KP_2,
    KP_3,
    KP_4,
    KP_5,
    KP_6,
    KP_7,
    KP_8,
    KP_9,
};
enum SoundGroupPriorityType : int {
    _sound_priority_high,
    _sound_priority_low,
    _sound_priority_max,
    _sound_priority_med,
    _sound_priority_very_high,
};
enum TextAtlasFlags {
    kSmallLowercase,
};
enum UserVote {
    k_VoteUnknown,
    k_VoteNone,
    k_VoteUp,
    k_VoteDown,
};

Global Functions

float abs(float);
float acos(float);
float asin(float);
void assert(bool val);
float atan(float);
float atan2(float, float);
float atof(const string &in str);
int atoi(const string &in str);
float ceil(float);
float cos(float);
vec3 cross(const vec3 &in, const vec3 &in);  // Calculate the cross-product between two vec3 values - https://en.wikipedia.org/wiki/Cross_product
float distance(const vec2 &in, const vec2 &in);  // Get the distance between two vec2 values
float distance(const vec3 &in, const vec3 &in);  // Get the distance between two vec3 values
float distance_squared(const vec2 &in, const vec2 &in);  // Get the squared distance between two vec2 values (faster than distance function, no square-root done)
float distance_squared(const vec3 &in, const vec3 &in);  // Get the squared distance between two vec3 values (faster than distance function, no square-root done)
float dot(const vec2 &in, const vec2 &in);  // Calculate the dot-product between two vec2 values - https://en.wikipedia.org/wiki/Dot_product
float dot(const vec3 &in, const vec3 &in);  // Calculate the dot-product between two vec3 values - https://en.wikipedia.org/wiki/Dot_product
float floor(float);
double fpFromIEEE(uint64);
float fpFromIEEE(uint);
uint fpToIEEE(float);
uint64 fpToIEEE(double);
BoneTransform mix(const BoneTransform &in a, const BoneTransform &in b, float alpha);  // Linear interpolation between two bone transform matrices
float mix(float a, float b, float amount);  // Linear interpolation between two float values
mat4 mix(const mat4 &in a, const mat4 &in b, float alpha);  // Linear interpolation between two 4x4 matrices
quaternion mix(const quaternion &in a, const quaternion &in b, float alpha);  // Linear interpolation between two quaternions
vec2 mix(vec2 a, vec2 b, float alpha);  // Linear interpolation between two vec2 values
vec3 mix(vec3 a, vec3 b, float alpha);  // Linear interpolation between two vec3 values
vec4 mix(vec4 a, vec4 b, float alpha);  // Linear interpolation between two vec4 values (including alpha)
vec2 normalize(const vec2 &in);  // Shrink or grow a vec2 value to be unit length, with the same direction
vec3 normalize(const vec3 &in);  // Shrink or grow a vec3 value to be unit length, with the same direction
float pow(float val, float exponent);
int rand();
vec2 reflect(const vec2 &in vec, const vec2 &in normal);
// Calculate the reflection of a vec2, relative to the surface with the given normal - https://en.wikipedia.org/wiki/Reflection_(mathematics)
vec3 reflect(const vec3 &in vec, const vec3 &in normal);
// Calculate the reflection of a vec3, relative to the surface with the given normal - https://en.wikipedia.org/wiki/Reflection_(mathematics)
float sin(float angle_in_radians);
float sqrt(float angle_in_radians);
float tan(float angle_in_radians);
mat4 transpose(mat4);  // Get the mathematical transpose of this 4x4 matrix - https://en.wikipedia.org/wiki/Transpose
float xz_distance(const vec3 &in, const vec3 &in);  // Get the distance on the x/z plane between two vec3 values (flat)
float xz_distance_squared(const vec3 &in, const vec3 &in);
// Get the squared distance on the x/z plane between two vec3 values (flat. faster than xz_distance function, no square-root done)
void ActivateKeyboardEvents();
void AddDebugDrawRibbonPoint(int which, vec3 pos, vec4 color, float width);
bool AddMusic(const string &in);
void Breakpoint(int);
bool CheckSaveLevelChanges();
void ClearTemporaryDecals();  // Like blood splats and footprints
void ClearUndoHistory();
void ConnectParticles(uint32 id_a, uint32 id_b);  // Used for ribbon particles, like throat-cut blood
void CreateCustomHull(const string &in key, const array<vec3> &vertices);
int CreateObject(const string &in path);
int CreateObject(const string &in path, bool exclude_from_save);
void DeactivateAllMods();
void DeactivateKeyboardEvents();
int DebugDrawBillboard(const string &in path, vec3 center, float scale, vec4 color, int lifespan);
int DebugDrawCircle(mat4 transform, vec4 color, int lifespan);
int DebugDrawLine(vec3 start, vec3 end, vec3 color, int lifespan);
int DebugDrawLine(vec3 start, vec3 end, vec3 start_color, vec3 end_color, int lifespan);
int DebugDrawLine(vec3 start, vec3 end, vec4 start_color, vec4 end_color, int lifespan);
int DebugDrawLines(const array<vec3> &vertices, vec4 color, int lifespan);
int DebugDrawPoint(vec3 pos, vec4 color, int lifespan);
void DebugDrawRemove(int id);
int DebugDrawRibbon(int lifespan);
int DebugDrawRibbon(vec3 start, vec3 end, vec4 start_color, vec4 end_color, float start_width, float end_width, int lifespan);
int DebugDrawText(vec3 pos, string text, float scale, bool screen_space, int lifespan);
int DebugDrawWireBox(vec3 pos, vec3 dimensions, vec3 color, int lifespan);
int DebugDrawWireCylinder(vec3 pos, float radius, float height, vec3 color, int lifespan);
int DebugDrawWireMesh(string path, mat4 transform, vec4 color, int lifespan);
int DebugDrawWireScaledSphere(vec3 pos, float radius, vec3 scale, vec3 color, int lifespan);
int DebugDrawWireScaledSphere(vec3 pos, float radius, vec3 scale, vec4 color, int lifespan);
int DebugDrawWireSphere(vec3 pos, float radius, vec3 color, int lifespan);
bool DebugKeysEnabled();
int DebugSetPosition(int id, vec3 pos);
void DebugText(string key, string display_text, float lifetime);
void DeleteObjectID(int);
void DeselectAll();
void DisplayError(const string &in title, const string &in contents);
void DisposeTextAtlases();
bool DoesItemFitInItem(int item_id, int holster_item_id);
void DrawTextAtlas(const string &in path, int pixel_height, int flags, const string &in txt, int x, int y, vec4 color);
void DrawTextAtlas2(const string &in path, int pixel_height, int flags, const string &in txt, int x, int y, vec4 color, uint char_limit);
int DuplicateObject(Object@ obj);
bool EditorEnabled();
bool EditorModeActive();
void EnterTelemetryZone(const string &in name);
bool FileExists(string &in);
int FindFirstCharacterInGroup(int id);
string FloatString(float val, int digits);
array<ModID>@ GetActiveModSids();
array<string>@ GetAvailableBindingCategories();
array<string>@ GetAvailableBindings(const string &in);
vec3 GetBaseSkyTint();
string GetBindingValue(string binding_category, string binding);
int GetBloodLevel();
const vec3& GetBloodTint();
string GetBuildTimestamp( );
string GetBuildVersionFull( );
string GetBuildVersionShort( );
Campaign GetCampaign(string& campaign_id);
array<Campaign>@ GetCampaigns();
void GetCharacters(array<int>@ id_array);
void GetCharactersInHull(string model_path, mat4, array<int>@ id_array);
void GetCharactersInSphere(vec3 position, float radius, array<int>@ id_array);
int GetCodeForKey(string key_name);
uint GetCodepointCount( const string &in );
bool GetConfigValueBool(string index);
float GetConfigValueFloat(string index);
int GetConfigValueInt(string key);
array<string>@ GetConfigValueOptions(string index);
string GetConfigValueString(string index);
string GetCurrCampaignID();
string GetCurrLevel();
string GetCurrLevelAbsPath();
string GetCurrLevelID();
string GetCurrLevelName();
string GetCurrLevelRelPath();
string GetCurrentLevelModsourceID();
string GetCurrentMenuModsourceID();
int GetFontFaceID(const string &in path, int pixel_height);
float GetFriction(const vec3 &in position);
float GetHDRBlackPoint(void);
float GetHDRBloomMult(void);
float GetHDRWhitePoint(void);
bool GetInputDown(int controller_id, const string &in input_label);
bool GetInputDownFiltered(int controller_id, const string &in input_label, uint filter);
uint GetInputMode();
bool GetInputPressed(int controller_id, const string &in input_label);
bool GetInputPressedFiltered(int controller_id, const string &in input_label, uint filter);
string GetInterlevelData(const string &in);
float GetLayerGain(const string &in layer);
array<string>@ GetLayerNames();
uint GetLengthInBytesForNCodepoints( const string &in, uint codepoint_index );
string GetLevelName(const string& path);
string GetLocaleStringForScancode(int scancode);
float GetLookXAxis(int controller_id);
float GetLookYAxis(int controller_id);
bool GetMenuPaused();  // Is game paused by a menu
array<ModID>@ GetModSids();
float GetMoveXAxis(int controller_id);
float GetMoveYAxis(int controller_id);
int GetNumCharacters();
int GetNumHotspots();
int GetNumItems();
array<int>@ GetObjectIDs();
array<int>@ GetObjectIDsType(int type);
void GetObjectsInHull(string model_path, mat4, array<int>@ id_array);
uint64 GetPerformanceCounter();  // Get high precision time info for profiling
uint64 GetPerformanceFrequency();  // Used to convert PerformanceCounter into seconds
array<vec2>@ GetPossibleResolutions();
array<KeyboardPress>@ GetRawKeyboardInputs();
void GetRotationBetweenVectors(const vec3 &in start, const vec3 &in end, quaternion &out rotation);  // Get a relative rotation from one direction vector to another
int GetScreenHeight();
int GetScreenWidth();
string GetSegment();
vec3 GetSkyTint();
string GetSong();
bool GetSplitscreen();
string GetStringDescriptionForBinding( const string &in, const string &in );
float GetSunAmbient();
vec3 GetSunColor();
vec3 GetSunPosition();
TextMetrics GetTextAtlasMetrics(const string &in path, int pixel_height, int flags, const string &in txt );
TextMetrics GetTextAtlasMetrics2(const string &in path, int pixel_height, int flags, const string &in txt, uint char_limit );
bool IsGroupDerived(int id);
bool IsKeyDown(int key_code);
bool IsWorkshopAvailable();
bool IsWorkshopMod(ModID& id);
bool IsWorkshopSubscribed(ModID& id);
void LeaveTelemetryZone();
void LoadEditorLevel();
void LoadLevel(string level_path);
void LoadLevelID(string id);
void Log( LogType level, const string &in str );
uint32 MakeParticle(string path, vec3 pos, vec3 vel);
uint32 MakeParticle(string path, vec3 pos, vec3 vel, vec3 color);
mat3 Mat3FromQuaternion(const quaternion &in);  // Convert a quaternion to its corresponding 3x3 rotation matrix
mat4 Mat4FromQuaternion(const quaternion &in);  // Convert a quaternion to its corresponding 4x4 rotation matrix
bool MediaMode();
bool ModActivation(ModID& sid, bool active);
bool ModCanActivate(ModID& id);
string ModGetAuthor(ModID& id);
array<ModLevel>@ ModGetCampaignLevels(ModID& sid);
string ModGetDescription(ModID& id);
string ModGetID(ModID& id);
array<MenuItem>@ ModGetMenuItems(ModID& sid);
string ModGetName(ModID& id);
string ModGetPath(ModID& sid);
array<ModLevel>@ ModGetSingleLevels(ModID& sid);
int ModGetSource(ModID& id);
string ModGetTags(ModID& id);
string ModGetThumbnail(ModID& sid);
UserVote ModGetUserVote(ModID& sid);
string ModGetValidityString(ModID& sid);
string ModGetVersion(ModID& id);
bool ModIsActive(ModID& id);
bool ModIsCore(ModID& id);
bool ModIsFavorite(ModID& id);
bool ModIsValid(ModID& id);
bool ModNeedsRestart(ModID& id);
bool MovementObjectExists(int id);
vec3 Mult(quaternion, vec3);  // Applies a quaternion rotation to a vector
bool ObjectExists();
bool ObjectExists(int id);
void OpenModAuthorWorkshopPage(ModID& id);
void OpenModWorkshopPage(ModID& id);
void OpenWorkshop();
void PlaySegment(const string &in);
void PlaySong(const string &in);
int PlaySound(string path);
int PlaySound(string path, vec3 position);
int PlaySoundGroup(string path);
int PlaySoundGroup(string path, float gain);
int PlaySoundGroup(string path, vec3 position);
int PlaySoundGroup(string path, vec3 position, float gain);
int PlaySoundGroup(string path, vec3 position, int priority);
int PlaySoundLoop(const string &in path, float gain);
int PlaySoundLoopAtLocation(const string &in path, vec3 pos, float gain);
void PrintCallstack();
quaternion QuaternionFromMat4(const mat4 &in);  // Convert a 4x4 matrix to its corresponding quaternion
void QueueDeleteObjectID(int);
void QueueSegment(const string &in);
float RangedRandomFloat(float min, float max);
MovementObject@ ReadCharacter(int index);  // e.g. first character in scene
MovementObject@ ReadCharacterID(int id);  // e.g. character with object ID 39
EnvObject@ ReadEnvObjectID(int id);
Hotspot@ ReadHotspot(int index);
ItemObject@ ReadItem(int index);
ItemObject@ ReadItemID(int id);
Object@ ReadObjectFromID(int);
void ReloadMods();
void ReloadStaticValues();
bool RemoveMusic(const string &in);
void RequestModSetFavorite(ModID& id, bool fav);
void RequestModSetUserVote(ModID& id, bool voteup);
void RequestWorkshopSubscribe(ModID& id);
void RequestWorkshopUnSubscribe(ModID& id);
void ResetBinding(string binding_category, string binding);
void ResetLevel();
void RibbonItemFlash(const string &in);
void RibbonItemSetEnabled(const string &in, bool);
void RibbonItemSetToggled(const string &in, bool);
string SaveConfig();
void SendGlobalMessage(string msg);
void SendMessage(int target, int type, vec3 vec_a, vec3 vec_b);
void SendMessage(int type, string msg);
void SetAirWhoosh(float volume, float pitch);
void SetBindingValue(string binding_category, string binding, string value);
void SetCampaignID(string id);
void SetConfigValueBool(string key, bool value);
void SetConfigValueFloat(string key, float value);
void SetConfigValueInt(string key, int value);
void SetConfigValueString(string key, string value);
void SetFlareDiffuse(float);
void SetGrabMouse(bool);
void SetHDRBlackPoint(float);
void SetHDRBloomMult(float);
void SetHDRWhitePoint(float);
void SetInterlevelData(const string &in, const string &in);
void SetKeyboardBindingValue(string binding_category, string binding, uint32 scancode);
void SetLayerGain(const string &in layer, float gain);
void SetMediaMode(bool);
void SetPaused(bool paused);
void SetSegment(const string &in);
void SetSkyTint(vec3);
void SetSong(const string &in);
void SetSoundGain(int handle, float gain);
void SetSoundPitch(int handle, float pitch);
void SetSoundPosition(int handle, vec3 pos);
void SetSunAmbient(float);
void SetSunColor(vec3);
void SetSunPosition(vec3);
void StartStopwatch();
void StartTextInput();
uint64 StopAndReportStopwatch();
void StopSound(int handle);
void StopTextInput();
int StorageGetInt32(string index);
string StorageGetString(string index);
bool StorageHasInt32(string index);
bool StorageHasString(string index);
void StorageSetInt32(string index, int value);
void StorageSetString(string index, string value);
void TimedSlowMotion(float target_time_scale, float how_long, float delay);  // Used to trigger brief periods of slow motion
void TintParticle(uint32 id, const vec3 &in color);
string ToUpper(string &in);
void UpdateListener(vec3 pos, vec3 vel, vec3 facing, vec3 up);
uint WorkshopDownloadPendingCount();
uint WorkshopDownloadingCount();
uint WorkshopNeedsUpdateCount();
uint WorkshopSubscribedNotInstalledCount();
float WorkshopTotalDownloadProgress();

Classes

array class

class array<T>;

A generic array for holding indexable lists of values of the same type.

See this page for documentation on this class: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_arrays.html


mat3 class

class mat3;

A 3x3 matrix for doing linear algebra (transformations on objects)

methods

mat3()  // Default constructor. Does no initialization
mat3(const mat3 &in)  // Copy constructor

operators

float& opIndex(uint index)  // Index operator
const float& opIndex(uint index) const  // Const index operator
vec3 opMul(const vec3 &in) const  // Multiply operator (mat3 * vec3)

related functions

mat3 Mat3FromQuaternion(const quaternion &in);  // Convert a quaternion to its corresponding 3x3 rotation matrix

mat4 class

class mat4;

A 4x4 matrix for doing linear algebra (transformations on objects)

methods

mat4();  // Default constructor. Does no initialization
mat4(const mat4 &in);  // Copy constructor
void SetTranslationPart(vec3);  // Set the translation components of the matrix
vec3 GetTranslationPart() const;  // Get the translation components of the matrix
void SetRotationPart(mat4);  // Set (only) the rotation components of the matrix (also overwriting all scale components)
mat4 GetRotationPart() const;  // Get a copy of the matrix, preserving only the rotation (and scale) components
void SetRotationX(float angle_in_radians);  // Set the x rotation components (also overwriting y/z scale components)
void SetRotationY(float angle_in_radians);  // Set the y rotation components (also overwriting x/z scale components)
void SetRotationZ(float angle_in_radians);  // Set the z rotation components (also overwriting x/y scale components)
void SetColumn(int, vec3);  // Set the first three values in a column of the matrix
vec3 GetColumn(int);  // Get the first three values from a column of the matrix

operators

float &opIndex(uint);  //Index operator
const float &opIndex(uint) const;  // Const index operator
mat4 opMul(mat4) const;  // Multiply operator (mat4 * mat4)
vec3 opMul(vec3) const;  // Multiply operator (mat4 * vec3)
vec3 opMul(vec4) const;  // Multiply operator (mat4 * vec4)

related functions

mat4 mix(const mat4 &in a, const mat4 &in b, float alpha);  // Linear interpolation between two 4x4 matrices
mat4 transpose(mat4);  // Get the mathematical transpose of this 4x4 matrix - https://en.wikipedia.org/wiki/Transpose
mat4 Mat4FromQuaternion(const quaternion &in);  // Convert a quaternion to its corresponding 4x4 rotation matrix
quaternion QuaternionFromMat4(const mat4 &in);  // Convert a 4x4 matrix to its corresponding quaternion

quaternion class

class quaternion;

A quaternion for doing linear algebra (rotations on objects)

properties

float x;
float y;
float z;
float w;

methods

quaternion();  // Default constructor. Sets to identity. Same result as quaternion(0.0f, 0.0f, 0.0f, 1.0f);
quaternion(const quaternion &in);  // Copy constructor
quaternion(float, float, float, float);  // Construct from components
quaternion(vec4); // Constructor from rotation, in axis-angle form (axis.x, axis.y, axis.z, angle_in_radians)

operators

quaternion& opAssign(const quaternion &in);  // Assignment operator (quaternion = quaternion) - by value, not by reference
quaternion& opAddAssign(const quaternion &in);  // Addition-and-assign operator (quaternion += quaternion)
bool opEquals(const quaternion &in) const;  // Equality operator (quaternion == quaternion)
quaternion opAdd(const quaternion &in) const;  // Addition operator (quaternion + quaternion)
quaternion opMul(const quaternion &in) const;  // Multiplication operator (quaternion * quaternion)
vec3 opMul(const vec3 &in) const;  // Multiply operator (quaternion * vec3)

related functions

mat3 Mat3FromQuaternion(const quaternion &in);  // Convert a quaternion to its corresponding 3x3 rotation matrix
mat4 Mat4FromQuaternion(const quaternion &in);  // Convert a quaternion to its corresponding 4x4 rotation matrix
quaternion mix(const quaternion &in a, const quaternion &in b, float alpha);  // Linear interpolation between two quaternions
quaternion QuaternionFromMat4(const mat4 &in);  // Convert a 4x4 matrix to its corresponding quaternion
vec3 Mult(quaternion, vec3);  // Applies a quaternion rotation to a vector
void GetRotationBetweenVectors(const vec3 &in start, const vec3 &in end, quaternion &out rotation);  // Get a relative rotation from one direction vector to another

vec2 class

class vec2;

A two-dimensional vector, useful for specifying x/y coordinates

properties

float x;
float y;

methods

vec2();  // Default constructor. Same as vec2(0.0f, 0.0f)
vec2(const vec2 &in);  // Copy constructor
vec2(float);  // Single value constructor. Same as vec2(0.0f, 0.0f)
vec2(float, float);  // Construct from components

operators

vec2& opAddAssign(const vec2 &in);  // Add-and-assign operator (vec2 += vec2)
vec2& opSubAssign(const vec2 &in);  // Subtract-and-assign operator (vec2 -= vec2)
vec2& opMulAssign(float);  // Multiply-and-assign operator (vec2 *= float)
vec2& opDivAssign(float);  // Divide-and-assign operator (vec2 /= float)
bool opEquals(const vec2 &in) const;  // Equality operator (vec2 == vec2)
vec2 opAdd(const vec2 &in) const;  // Add operator (vec2 + vec2)
vec2 opSub(const vec2 &in) const;  // Subtract operator (vec2 - vec2)
vec2 opMul(float) const;  // Scalar multiply operator (vec2 * float)
vec2 opMul_r(float) const;  // Scalar multiply operator (float * vec2)
vec2 opDiv(float) const;  // Scalar divide operator (vec2 / float)

related functions

float distance(const vec2 &in, const vec2 &in);  // Get the distance between two vec2 values
float distance_squared(const vec2 &in, const vec2 &in);  // Get the squared distance between two vec2 values (faster than distance function, no square-root done)
float dot(const vec2 &in, const vec2 &in);  // Calculate the dot-product between two vec2 values - https://en.wikipedia.org/wiki/Dot_product
vec2 mix(vec2 a, vec2 b, float alpha);  // Linear interpolation between two vec2 values
vec2 normalize(const vec2 &in);  // Shrink or grow a vec2 value to be unit length, with the same direction
vec2 reflect(const vec2 &in vec, const vec2 &in normal);
// Calculate the reflection of a vector, relative to the surface with the given normal - https://en.wikipedia.org/wiki/Reflection_(mathematics)

vec3 class

class vec3;

A three-dimensional vector, useful for specifying x/y/z coordinates

properties

float x;
float y;
float z;

methods

vec3();  // Default constructor. Same as vec3(0.0f, 0.0f, 0.0f)
vec3(const vec3 &in);  // Copy constructor
vec3(float value);  // Single value constructor. Same as vec3(value, value, value)
vec3(float x, float y, float z);  // Construct from components

operators

vec3& opAddAssign(const vec3 &in);  // Add-and-assign operator (vec3 += vec3)
vec3& opSubAssign(const vec3 &in);  // Subtract-and-assign operator (vec3 -= vec3)
vec3& opMulAssign(float);  // Multiply-and-assign operator (vec3 *= float)
vec3& opDivAssign(float);  // Divide-and-assign operator (vec3 /= float)
bool opEquals(const vec3 &in) const;  // Equality operator (vec3 == vec3)
vec3 opAdd(const vec3 &in) const;  // Add operator (vec3 + vec3)
vec3 opSub(const vec3 &in) const;  // Subtract operator (vec3 - vec3)
vec3 opMul(float) const;  // Scalar multiply operator (vec3 * float)
vec3 opMul_r(float) const;  // Scalar multiply operator (float * vec3)
vec3 opDiv(float) const;  // Scalar divide operator (vec3 / float)
float& opIndex(int index);  // Access vector components by index

related functions

float distance(const vec3 &in, const vec3 &in);  // Get the distance between two vec3 values
float distance_squared(const vec3 &in, const vec3 &in);  // Get the squared distance between two vec3 values (faster than distance function, no square-root done)
float dot(const vec3 &in, const vec3 &in);  // Calculate the dot-product between two vec3 values - https://en.wikipedia.org/wiki/Dot_product
float xz_distance(const vec3 &in, const vec3 &in);  // Get the distance on the x/z plane between two vec3 values (flat)
float xz_distance_squared(const vec3 &in, const vec3 &in);
// Get the squared distance on the x/z plane between two vec3 values (flat. faster than xz_distance function, no square-root done)
vec3 cross(const vec3 &in, const vec3 &in);  // Calculate the cross-product between two vec3 values - https://en.wikipedia.org/wiki/Cross_product
vec3 mix(vec3 a, vec3 b, float alpha);  // Linear interpolation between two vec3 values
vec3 Mult(quaternion, vec3);  // Applies a quaternion rotation to a vector
vec3 normalize(const vec3 &in);  // Shrink or grow a vec3 value to be unit length, with the same direction
vec3 reflect(const vec3 &in vec, const vec3 &in normal);
// Calculate the reflection of a vec3, relative to the surface with the given normal - https://en.wikipedia.org/wiki/Reflection_(mathematics)
void GetRotationBetweenVectors(const vec3 &in start, const vec3 &in end, quaternion &out rotation);  // Get a relative rotation from one direction vector to another

vec4 class

class vec4;

A four-dimensional vector, useful for specifying r/g/b/alpha colors

properties

float x;
float y;
float z;
float a;

methods

vec4();  // Default constructor. Same as vec4(0.0f, 0.0f, 0.0f, 1.0f)
vec4(const vec4 &in);  // Copy constructor
vec4(const vec3 &in, float a);  // Copy constructor, with custom alpha
vec4(float value);  // Single value constructor. Same as vec4(value, value, value, value)
vec4(float x, float y, float z, float a);  // Construct from components

related functions

vec4 mix(vec4 a, vec4 b, float alpha);  // Linear interpolation between two vec4 values (including alpha)

ASContext class

class ASContext;

A helper class that lets you print the global variables from a running angel script context

methods

void PrintGlobalVars();  // Print the global variables in this script context in the console

related global variables

ASContext context;  // The context for the currently running script, whether that is the menu script, level script, character script, or hotspot script

class AnimationClient;  // A game object component on a RiggedObject that lets you modify animations
class BoneTransform;  // An efficient way to define an unscaled transformation
class Camera;  // A camera object, either bound to the editor camera or the player camera
class Campaign;  // A helper class that helps you retrieve data about a campaign ("story")
class CharacterScriptGetter;  // A helper class that lets you load a character XML and provide access to its data
class EnvObject;  // An environmental game object, such as a plant or rock
class Hotspot;  // A game object that supports custom per-object logic, and possibly supports enter/exit events
class ItemObject;  // An item game object, such as a weapon or an inert object you can pick up
class JSON;  // A JSON object, for reading and writing JSON files
class JSONValue;  // An individual value (variable or array) inside a JSON object
class KeyboardPress;
class Level;
// An instance of the currently running level, which gives you access to parameters and send global "level" messages
class LevelDetails;  // A helper class providing details (just Name for now) for a ModLevel (not actually just mods)
class MenuItem;  // A helper class to retrieve data about a main menu/play menu entry added by a mod
class ModID;  // A helper class used to access mods and to query if a mod is "valid"
class ModLevel;  // A helper class to retrieve data about a level (not just mod levels)
class MovementObject;  // A character game object
class Object;  // The base class for all game objects, for accessing common behavior
class PathPointObject;
class Physics;
class RiggedObject;  // A game object component that is attached to a MovementObject, that supports skeletal rigging
class ScriptParams;  // A class that lets you access level or game object script parameters
class Skeleton;  // A game object component on a RiggedObject that handles skeletal rigging
class TextCanvasTexture;
class TextMetrics;
class TextStyle;