Expose version constants to lua (#264)
This commit is contained in:
parent
336e3d3814
commit
3dcbd5908f
|
@ -37,7 +37,8 @@ in_files = [
|
|||
"include/dialog_ids.h",
|
||||
"include/seq_ids.h",
|
||||
"include/surface_terrains.h",
|
||||
"src/game/level_update.h"
|
||||
"src/game/level_update.h",
|
||||
"src/pc/network/version.h"
|
||||
]
|
||||
|
||||
exclude_constants = {
|
||||
|
|
|
@ -11397,3 +11397,12 @@ SPTASK_STATE_FINISHED = 3
|
|||
|
||||
--- @type SpTaskState
|
||||
SPTASK_STATE_FINISHED_DP = 4
|
||||
|
||||
--- @type integer
|
||||
MAX_VERSION_LENGTH = 10
|
||||
|
||||
--- @type integer
|
||||
MINOR_VERSION_NUMBER = 0
|
||||
|
||||
--- @type integer
|
||||
VERSION_NUMBER = 31
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
- [types.h](#typesh)
|
||||
- [enum AreaTimerType](#enum-AreaTimerType)
|
||||
- [enum SpTaskState](#enum-SpTaskState)
|
||||
- [version.h](#versionh)
|
||||
|
||||
<br />
|
||||
|
||||
|
@ -4020,3 +4021,12 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [version.h](#version.h)
|
||||
- MAX_VERSION_LENGTH
|
||||
- MINOR_VERSION_NUMBER
|
||||
- VERSION_NUMBER
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_lot'] == b['_lot'] and a['_pointer'] ~= nil and a['_lot'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_CPointer = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" return nil\n"
|
||||
|
@ -24,7 +23,6 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_SyncTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -36,7 +34,6 @@ char gSmluaConstants[] = ""
|
|||
" _set_sync_table_field(t, k, v)\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_ReadOnlyTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -45,7 +42,6 @@ char gSmluaConstants[] = ""
|
|||
" __newindex = function (t,k,v)\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param src Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -55,7 +51,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = src.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param x number\n"
|
||||
"--- @param y number\n"
|
||||
|
@ -67,7 +62,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -77,7 +71,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z + a.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @param b Vec3f\n"
|
||||
|
@ -88,7 +81,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = a.z + b.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a number\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -98,7 +90,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z * a\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
"function vec3f_normalize(dest)\n"
|
||||
|
@ -106,28 +97,23 @@ char gSmluaConstants[] = ""
|
|||
" if divisor == 0 then\n"
|
||||
" return dest\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" local invsqrt = 1.0 / divisor\n"
|
||||
" dest.x = dest.x * invsqrt\n"
|
||||
" dest.y = dest.y * invsqrt\n"
|
||||
" dest.z = dest.z * invsqrt\n"
|
||||
"\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @return number\n"
|
||||
"function vec3f_length(a)\n"
|
||||
" return math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @param b Vec3f\n"
|
||||
"--- @return number\n"
|
||||
"function vec3f_dot(a, b)\n"
|
||||
" return a.x * b.x + a.y * b.y + a.z * b.z\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param vec Vec3f\n"
|
||||
"--- @param onto Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -139,7 +125,6 @@ char gSmluaConstants[] = ""
|
|||
" vec3f_mul(out, numerator / denominator)\n"
|
||||
" return out\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param v1 Vec3f\n"
|
||||
"--- @param v2 Vec3f\n"
|
||||
"--- @return number\n"
|
||||
|
@ -149,7 +134,6 @@ char gSmluaConstants[] = ""
|
|||
" dz = v1.z - v2.z\n"
|
||||
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param src Vec3s\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -159,7 +143,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = src.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param x number\n"
|
||||
"--- @param y number\n"
|
||||
|
@ -171,7 +154,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a Vec3s\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -181,7 +163,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z + a.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a Vec3s\n"
|
||||
"--- @param b Vec3s\n"
|
||||
|
@ -192,7 +173,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = a.z + b.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a number\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -202,7 +182,6 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z * a\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param v1 Vec3s\n"
|
||||
"--- @param v2 Vec3s\n"
|
||||
"--- @return number\n"
|
||||
|
@ -212,7 +191,6 @@ char gSmluaConstants[] = ""
|
|||
" dz = v1.z - v2.z\n"
|
||||
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param current number\n"
|
||||
"--- @param target number\n"
|
||||
"--- @param inc number\n"
|
||||
|
@ -232,7 +210,6 @@ char gSmluaConstants[] = ""
|
|||
" end\n"
|
||||
" return current;\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param current number\n"
|
||||
"--- @param target number\n"
|
||||
"--- @param inc number\n"
|
||||
|
@ -250,7 +227,6 @@ char gSmluaConstants[] = ""
|
|||
" current = target\n"
|
||||
" end\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" -- keep within 32 bits\n"
|
||||
" if current > 2147483647 then\n"
|
||||
" current = -2147483648 + (current - 2147483647)\n"
|
||||
|
@ -259,7 +235,6 @@ char gSmluaConstants[] = ""
|
|||
" end\n"
|
||||
" return current;\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param bank number\n"
|
||||
"--- @param soundID number\n"
|
||||
"--- @param priority number\n"
|
||||
|
@ -269,11 +244,9 @@ char gSmluaConstants[] = ""
|
|||
" if flags == nil then flags = 0 end\n"
|
||||
" return (bank << 28) | (soundID << 16) | (priority << 8) | flags | SOUND_STATUS_WAITING\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"-------------\n"
|
||||
"-- courses --\n"
|
||||
"-------------\n"
|
||||
"\n"
|
||||
"--- @type integer\n"
|
||||
"COURSE_NONE = 0\n"
|
||||
"--- @type integer\n"
|
||||
|
@ -4002,4 +3975,7 @@ char gSmluaConstants[] = ""
|
|||
"COOP_OBJ_FLAG_NETWORK = (1 << 0)\n"
|
||||
"COOP_OBJ_FLAG_LUA = (1 << 1)\n"
|
||||
"COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n"
|
||||
"VERSION_NUMBER = 31\n"
|
||||
"MINOR_VERSION_NUMBER = 0\n"
|
||||
"MAX_VERSION_LENGTH = 10\n"
|
||||
;
|
|
@ -3,9 +3,9 @@
|
|||
#include "types.h"
|
||||
|
||||
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||
#define VERSION_TEXT "beta "
|
||||
#define VERSION_TEXT "beta"
|
||||
|
||||
char* get_version(void) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
||||
return sVersionString;
|
||||
}
|
Loading…
Reference in New Issue