<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://3dfxdev.net/edgewiki/index.php?action=history&amp;feed=atom&amp;title=COAL_API</id>
		<title>COAL API - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://3dfxdev.net/edgewiki/index.php?action=history&amp;feed=atom&amp;title=COAL_API"/>
		<link rel="alternate" type="text/html" href="https://3dfxdev.net/edgewiki/index.php?title=COAL_API&amp;action=history"/>
		<updated>2026-06-06T14:36:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.0</generator>

	<entry>
		<id>https://3dfxdev.net/edgewiki/index.php?title=COAL_API&amp;diff=415&amp;oldid=prev</id>
		<title>Corbin: Created page with &quot;'''Contained is the COAL_API.EC file, which is the HOST API for COAL, and cannot be modified without also modifying the engine.'''  //-----------------------------------------...&quot;</title>
		<link rel="alternate" type="text/html" href="https://3dfxdev.net/edgewiki/index.php?title=COAL_API&amp;diff=415&amp;oldid=prev"/>
				<updated>2016-04-30T02:22:18Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Contained is the COAL_API.EC file, which is the HOST API for COAL, and cannot be modified without also modifying the engine.&amp;#039;&amp;#039;&amp;#039;  //-----------------------------------------...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Contained is the COAL_API.EC file, which is the HOST API for COAL, and cannot be modified without also modifying the engine.'''&lt;br /&gt;
&lt;br /&gt;
//------------------------------------------&lt;br /&gt;
//  BASIC COAL DEFINITIONS for 3DGE&lt;br /&gt;
//------------------------------------------&lt;br /&gt;
&lt;br /&gt;
// SYSTEM&lt;br /&gt;
&lt;br /&gt;
module sys&lt;br /&gt;
{&lt;br /&gt;
    constant TICRATE = 35&lt;br /&gt;
&lt;br /&gt;
    function error(s : string) = native&lt;br /&gt;
    function print(s : string) = native&lt;br /&gt;
    function debug_print(s : string) = native&lt;br /&gt;
&lt;br /&gt;
    function edge_version() : float = native&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// MATH&lt;br /&gt;
&lt;br /&gt;
module math&lt;br /&gt;
{&lt;br /&gt;
    constant pi = 3.1415926535897932384&lt;br /&gt;
    constant e  = 2.7182818284590452354&lt;br /&gt;
&lt;br /&gt;
    function rint (val) : float = native&lt;br /&gt;
    function floor(val) : float = native&lt;br /&gt;
    function ceil (val) : float = native&lt;br /&gt;
&lt;br /&gt;
    function cos(val)   : float = native&lt;br /&gt;
    function sin(val)   : float = native&lt;br /&gt;
    function tan(val)   : float = native&lt;br /&gt;
    function log(val)   : float = native&lt;br /&gt;
&lt;br /&gt;
    function acos(val)  : float = native&lt;br /&gt;
    function asin(val)  : float = native&lt;br /&gt;
    function atan(val)  : float = native&lt;br /&gt;
    function atan2(x,y) : float = native&lt;br /&gt;
&lt;br /&gt;
    function random() : float = native&lt;br /&gt;
&lt;br /&gt;
    function rand_range(low, high) : float =&lt;br /&gt;
    {&lt;br /&gt;
      return low + (high - low) * random()&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function getx(v : vector) : float = { return v * '1 0 0' }&lt;br /&gt;
    function gety(v : vector) : float = { return v * '0 1 0' }&lt;br /&gt;
    function getz(v : vector) : float = { return v * '0 0 1' }&lt;br /&gt;
&lt;br /&gt;
    function abs(n) : float =&lt;br /&gt;
    {&lt;br /&gt;
      if (n &amp;lt; 0) return 0 - n&lt;br /&gt;
      return n&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function sqrt(n) : float =&lt;br /&gt;
    {&lt;br /&gt;
      return n ^ 0.5&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function vlen(v : vector) : float =&lt;br /&gt;
    {&lt;br /&gt;
      return (v * v) ^ 0.5&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function min(a, b) : float =&lt;br /&gt;
    {&lt;br /&gt;
      if (a &amp;lt; b) return a&lt;br /&gt;
      return b&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function max(a, b) : float =&lt;br /&gt;
    {&lt;br /&gt;
      if (a &amp;gt; b) return a&lt;br /&gt;
      return b&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function normalize(v : vector) : vector =&lt;br /&gt;
    {&lt;br /&gt;
      var len = vlen(v)&lt;br /&gt;
      if (len &amp;lt;= 0) return '0 0 0'&lt;br /&gt;
      return v * (1 / len)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// STRINGS&lt;br /&gt;
&lt;br /&gt;
module strings&lt;br /&gt;
{&lt;br /&gt;
    function len(s : string) : float = native&lt;br /&gt;
    function sub(s : string, start, end) : string = native&lt;br /&gt;
    function tonumber(s : string) : float = native&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// HUD LIBRARY&lt;br /&gt;
&lt;br /&gt;
module hud&lt;br /&gt;
{&lt;br /&gt;
    var which&lt;br /&gt;
    var automap&lt;br /&gt;
&lt;br /&gt;
    var now_time&lt;br /&gt;
    var passed_time&lt;br /&gt;
    var last_time = -1&lt;br /&gt;
&lt;br /&gt;
    // handy colors&lt;br /&gt;
    constant NO_COLOR = '-1 -1 -1'&lt;br /&gt;
&lt;br /&gt;
    constant BLACK  = '0 0 0'&lt;br /&gt;
    constant WHITE  = '255 255 255'&lt;br /&gt;
    constant RED    = '255 0 0'&lt;br /&gt;
    constant GREEN  = '0 255 0'&lt;br /&gt;
    constant BLUE   = '0 0 255'&lt;br /&gt;
    constant YELLOW = '255 255 0'&lt;br /&gt;
    constant PURPLE = '255 0 255'&lt;br /&gt;
    constant CYAN   = '0 255 255'&lt;br /&gt;
    constant ORANGE = '255 160 0'&lt;br /&gt;
    constant GRAY   = '128 128 128'&lt;br /&gt;
&lt;br /&gt;
    // automap options&lt;br /&gt;
    constant AM_GRID     = 1   // also a color&lt;br /&gt;
    constant AM_ALLMAP   = 2   // also a color&lt;br /&gt;
    constant AM_WALLS    = 3   // also a color&lt;br /&gt;
    constant AM_THINGS   = 4&lt;br /&gt;
    constant AM_FOLLOW   = 5&lt;br /&gt;
    constant AM_ROTATE   = 6&lt;br /&gt;
&lt;br /&gt;
    // automap colors&lt;br /&gt;
    constant AM_STEP     = 4&lt;br /&gt;
    constant AM_LEDGE    = 5&lt;br /&gt;
    constant AM_CEIL     = 6&lt;br /&gt;
    constant AM_SECRET   = 7&lt;br /&gt;
&lt;br /&gt;
    constant AM_PLAYER   = 8&lt;br /&gt;
    constant AM_MONSTER  = 9&lt;br /&gt;
    constant AM_CORPSE   = 10&lt;br /&gt;
    constant AM_ITEM     = 11&lt;br /&gt;
    constant AM_MISSILE  = 12&lt;br /&gt;
    constant AM_SCENERY  = 13&lt;br /&gt;
&lt;br /&gt;
    function game_mode() : string = native&lt;br /&gt;
    function game_name() : string = native&lt;br /&gt;
    function map_name()  : string = native&lt;br /&gt;
    function map_title() : string = native&lt;br /&gt;
&lt;br /&gt;
    function which_hud() : float = native&lt;br /&gt;
    function check_automap() : float = native&lt;br /&gt;
    function get_time()  : float = native&lt;br /&gt;
&lt;br /&gt;
    function coord_sys(w, h) = native&lt;br /&gt;
&lt;br /&gt;
    function text_font(font : string) = native&lt;br /&gt;
    function text_color(color : vector) = native&lt;br /&gt;
    function set_scale(scale : float) = native&lt;br /&gt;
    function set_alpha(alpha : float) = native&lt;br /&gt;
&lt;br /&gt;
    function set_render_who(index) = native&lt;br /&gt;
    function automap_color(which, color : vector) = native&lt;br /&gt;
    function automap_option(which, value) = native&lt;br /&gt;
    function automap_zoom(zoom) = native&lt;br /&gt;
&lt;br /&gt;
    function solid_box(x, y, w, h, color : vector) = native&lt;br /&gt;
    function solid_line(x1, y1, x2, y2, color : vector) = native&lt;br /&gt;
    function thin_box(x, y, w, h, color : vector) = native&lt;br /&gt;
    function gradient_box(x, y, w, h, TL:vector, BL:vector, TR:vector, BR:vector) = native&lt;br /&gt;
&lt;br /&gt;
    function draw_image(x, y, image : string) = native&lt;br /&gt;
    function stretch_image(x, y, w, h, image : string) = native&lt;br /&gt;
    function tile_image(x, y, w, h, image : string, offset_x, offset_y) = native&lt;br /&gt;
    function draw_text(x, y, text : string) = native&lt;br /&gt;
	function draw_num(x, y, w, num) = native&lt;br /&gt;
    function draw_num2(x, y, w, num) = native&lt;br /&gt;
&lt;br /&gt;
    function render_world(x, y, w, h)   = native&lt;br /&gt;
    function render_automap(x, y, w, h) = native&lt;br /&gt;
&lt;br /&gt;
    function play_sound(sound : string) = native&lt;br /&gt;
&lt;br /&gt;
    function grab_times() =&lt;br /&gt;
    {&lt;br /&gt;
      now_time = get_time()&lt;br /&gt;
      passed_time = 0&lt;br /&gt;
&lt;br /&gt;
      if (last_time &amp;gt; 0 &amp;amp;&amp;amp; last_time &amp;lt;= now_time)&lt;br /&gt;
      {&lt;br /&gt;
        passed_time = math.min(now_time - last_time, sys.TICRATE)&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      last_time = now_time&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// PLAYER LIBRARY&lt;br /&gt;
&lt;br /&gt;
module player&lt;br /&gt;
{&lt;br /&gt;
    // ammo&lt;br /&gt;
    constant BULLETS  = 1&lt;br /&gt;
    constant SHELLS   = 2&lt;br /&gt;
    constant ROCKETS  = 3&lt;br /&gt;
    constant CELLS    = 4&lt;br /&gt;
    constant PELLETS  = 5&lt;br /&gt;
    constant NAILS    = 6&lt;br /&gt;
    constant GRENADES = 7&lt;br /&gt;
    constant GAS      = 8&lt;br /&gt;
&lt;br /&gt;
    // armors&lt;br /&gt;
    constant GREEN_ARMOR  = 1&lt;br /&gt;
    constant BLUE_ARMOR   = 2&lt;br /&gt;
    constant PURPLE_ARMOR = 3&lt;br /&gt;
    constant YELLOW_ARMOR = 4&lt;br /&gt;
    constant RED_ARMOR    = 5&lt;br /&gt;
&lt;br /&gt;
    // powerups&lt;br /&gt;
    constant INVULN    = 1&lt;br /&gt;
    constant BERSERK   = 2&lt;br /&gt;
    constant INVIS     = 3&lt;br /&gt;
    constant ACID_SUIT = 4&lt;br /&gt;
    constant AUTOMAP   = 5&lt;br /&gt;
    constant GOGGLES   = 6&lt;br /&gt;
    constant JET_PACK  = 7&lt;br /&gt;
    constant NIGHT_VIS = 8&lt;br /&gt;
    constant SCUBA     = 9&lt;br /&gt;
&lt;br /&gt;
    // keys&lt;br /&gt;
    constant BLUE_CARD    = 1&lt;br /&gt;
    constant YELLOW_CARD  = 2&lt;br /&gt;
    constant RED_CARD     = 3&lt;br /&gt;
    constant GREEN_CARD   = 4&lt;br /&gt;
    constant BLUE_SKULL   = 5&lt;br /&gt;
    constant YELLOW_SKULL = 6&lt;br /&gt;
    constant RED_SKULL    = 7&lt;br /&gt;
    constant GREEN_SKULL  = 8&lt;br /&gt;
&lt;br /&gt;
    constant GOLD_KEY     = 9&lt;br /&gt;
    constant SILVER_KEY   = 10&lt;br /&gt;
    constant BRASS_KEY    = 11&lt;br /&gt;
    constant COPPER_KEY   = 12&lt;br /&gt;
    constant STEEL_KEY    = 13&lt;br /&gt;
    constant WOODEN_KEY   = 14&lt;br /&gt;
    constant FIRE_KEY     = 15&lt;br /&gt;
    constant WATER_KEY    = 16&lt;br /&gt;
&lt;br /&gt;
    function num_players()  = native&lt;br /&gt;
    function set_who(index) = native&lt;br /&gt;
&lt;br /&gt;
    function is_bot()    : float  = native&lt;br /&gt;
    function get_name()  : string = native&lt;br /&gt;
    function get_pos()   : vector = native&lt;br /&gt;
    function get_angle() : float  = native&lt;br /&gt;
    function get_mlook() : float  = native&lt;br /&gt;
&lt;br /&gt;
    function health()      : float = native&lt;br /&gt;
    function armor(type)   : float = native&lt;br /&gt;
    function total_armor() : float = native&lt;br /&gt;
    function ammo(type)    : float = native&lt;br /&gt;
    function ammomax(type) : float = native&lt;br /&gt;
    function frags()       : float = native&lt;br /&gt;
&lt;br /&gt;
    function is_swimming()  : float = native&lt;br /&gt;
    function is_jumping()   : float = native&lt;br /&gt;
    function is_crouching() : float = native&lt;br /&gt;
    function is_using()     : float = native&lt;br /&gt;
    function is_action1()   : float = native&lt;br /&gt;
    function is_action2()   : float = native&lt;br /&gt;
    function is_attacking() : float = native&lt;br /&gt;
    function is_rampaging() : float = native&lt;br /&gt;
    function is_grinning()  : float = native&lt;br /&gt;
&lt;br /&gt;
    function under_water()  : float = native&lt;br /&gt;
    function on_ground()    : float = native&lt;br /&gt;
    function move_speed()   : float = native&lt;br /&gt;
    function air_in_lungs() : float = native&lt;br /&gt;
&lt;br /&gt;
    function has_key(key)     : float = native&lt;br /&gt;
    function has_power(type)  : float = native&lt;br /&gt;
    function power_left(type) : float = native&lt;br /&gt;
    function has_weapon(name : string) : float = native&lt;br /&gt;
    function has_weapon_slot(slot) : float = native&lt;br /&gt;
    function cur_weapon()         : string = native&lt;br /&gt;
    function cur_weapon_slot(slot) : float = native&lt;br /&gt;
&lt;br /&gt;
    function main_ammo(clip)   : float = native&lt;br /&gt;
    function ammo_type(ATK)    : float = native&lt;br /&gt;
    function ammo_pershot(ATK) : float = native&lt;br /&gt;
    function clip_ammo(ATK)    : float = native&lt;br /&gt;
    function clip_size(ATK)    : float = native&lt;br /&gt;
    function clip_is_shared()  : float = native&lt;br /&gt;
&lt;br /&gt;
    function hurt_by()   : string = native&lt;br /&gt;
    function hurt_mon()  : string = native&lt;br /&gt;
    function hurt_pain()  : float = native&lt;br /&gt;
    function hurt_dir()   : float = native&lt;br /&gt;
    function hurt_angle() : float = native&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Corbin</name></author>	</entry>

	</feed>