Browse Source

oops! all rewrites

tags/1.6.1
Alison Watson 2 years ago
parent
commit
f65286fe73
100 changed files with 3141 additions and 2752 deletions
  1. +3
    -1
      filedata/jp/Arsenal_Upgrades.txt
  2. BIN
      pk7/acs/lithmain.bin
  3. +3
    -1
      pk7/language.arsenal.jp.txt
  4. +339
    -301
      pk7/lzscript/Client/Draw.zsc
  5. +7
    -7
      pk7/lzscript/Constants.zsc
  6. +0
    -0
      pk7/lzscript/Constants/p_data.zsc
  7. +0
    -0
      pk7/lzscript/Constants/p_weapons.zsc
  8. +0
    -0
      pk7/lzscript/Constants/u_names.zsc
  9. +0
    -0
      pk7/lzscript/Constants/w_data.zsc
  10. +1
    -0
      pk7/lzscript/Constants/w_scorenums.zsc
  11. +1
    -1
      pk7/lzscript/Playsim/Weapons.zsc
  12. +1
    -1
      pk7/lzscript/Utilities.zsc
  13. +31
    -39
      source/Headers/common.h
  14. +8
    -8
      source/Headers/dialogue.h
  15. +19
    -0
      source/Headers/dlgstab.h
  16. +336
    -0
      source/Headers/gui.h
  17. +12
    -12
      source/Headers/items.h
  18. +0
    -26
      source/Headers/lith_cps.h
  19. +0
    -20
      source/Headers/lith_dlgstrtable.h
  20. +0
    -114
      source/Headers/lith_drawing.h
  21. +0
    -345
      source/Headers/lith_gui.h
  22. +0
    -40
      source/Headers/lith_list.h
  23. +0
    -32
      source/Headers/lith_math.h
  24. +0
    -43
      source/Headers/lith_stab.h
  25. +0
    -47
      source/Headers/lith_str.h
  26. +0
    -53
      source/Headers/lith_types.h
  27. +0
    -4
      source/Headers/lith_upgrades_common.h
  28. +3
    -3
      source/Headers/m_base64.h
  29. +0
    -0
      source/Headers/m_char.h
  30. +20
    -0
      source/Headers/m_cps.h
  31. +145
    -0
      source/Headers/m_drawing.h
  32. +4
    -5
      source/Headers/m_file.h
  33. +61
    -0
      source/Headers/m_list.h
  34. +32
    -0
      source/Headers/m_math.h
  35. +8
    -8
      source/Headers/m_memory.h
  36. +502
    -0
      source/Headers/m_stab.h
  37. +30
    -0
      source/Headers/m_str.h
  38. +10
    -10
      source/Headers/m_tokbuf.h
  39. +5
    -5
      source/Headers/m_token.h
  40. +42
    -0
      source/Headers/m_types.h
  41. +7
    -6
      source/Headers/m_vec.h
  42. +0
    -0
      source/Headers/m_version.h
  43. +2
    -2
      source/Headers/p_attrib.h
  44. +30
    -30
      source/Headers/p_bip.h
  45. +30
    -30
      source/Headers/p_cbi.h
  46. +1
    -1
      source/Headers/p_data.h
  47. +10
    -10
      source/Headers/p_hud.h
  48. +2
    -2
      source/Headers/p_hudid.h
  49. +9
    -12
      source/Headers/p_log.h
  50. +126
    -134
      source/Headers/p_player.h
  51. +7
    -10
      source/Headers/p_savedata.h
  52. +5
    -6
      source/Headers/p_shopdef.h
  53. +9
    -11
      source/Headers/p_upgrades.h
  54. +1
    -1
      source/Headers/p_weapons.h
  55. +20
    -23
      source/Headers/p_wepinfo.h
  56. +4
    -0
      source/Headers/u_common.h
  57. +36
    -37
      source/Headers/u_data.h
  58. +2
    -2
      source/Headers/u_func.h
  59. +1
    -0
      source/Headers/u_func_beg.h
  60. +0
    -0
      source/Headers/u_func_end.h
  61. +1
    -1
      source/Headers/u_names.h
  62. +1
    -1
      source/Headers/w_data.h
  63. +0
    -0
      source/Headers/w_moninfo.h
  64. +13
    -14
      source/Headers/w_monster.h
  65. +2
    -1
      source/Headers/w_scorenums.h
  66. +48
    -54
      source/Headers/w_world.h
  67. +65
    -57
      source/Main/g_auto.c
  68. +7
    -9
      source/Main/g_button.c
  69. +6
    -9
      source/Main/g_checkbox.c
  70. +12
    -15
      source/Main/g_preset.c
  71. +33
    -36
      source/Main/g_scrollbar.c
  72. +16
    -19
      source/Main/g_slider.c
  73. +13
    -17
      source/Main/g_textbox.c
  74. +14
    -13
      source/Main/m_base64.c
  75. +22
    -25
      source/Main/m_common.c
  76. +5
    -7
      source/Main/m_cps.c
  77. +10
    -12
      source/Main/m_draw.c
  78. +23
    -25
      source/Main/m_file.c
  79. +17
    -22
      source/Main/m_list.c
  80. +21
    -23
      source/Main/m_math.c
  81. +184
    -179
      source/Main/m_namegen.c
  82. +2
    -4
      source/Main/m_print.c
  83. +21
    -23
      source/Main/m_str.c
  84. +8
    -8
      source/Main/m_tokbuf.c
  85. +8
    -8
      source/Main/m_token.c
  86. +64
    -67
      source/Main/p_bip.c
  87. +28
    -32
      source/Main/p_cbigui.c
  88. +60
    -67
      source/Main/p_data.c
  89. +74
    -83
      source/Main/p_dialogue.c
  90. +62
    -70
      source/Main/p_gui_bip.c
  91. +22
    -17
      source/Main/p_gui_cbi.c
  92. +61
    -67
      source/Main/p_gui_upgrades.c
  93. +28
    -39
      source/Main/p_hud.c
  94. +85
    -91
      source/Main/p_items.c
  95. +63
    -65
      source/Main/p_log.c
  96. +52
    -55
      source/Main/p_magic.c
  97. +6
    -8
      source/Main/p_misc.c
  98. +13
    -16
      source/Main/p_notes.c
  99. +32
    -29
      source/Main/p_obituary.c
  100. +14
    -21
      source/Main/p_payout.c

+ 3
- 1
filedata/jp/Arsenal_Upgrades.txt View File

@@ -226,7 +226,9 @@
##----------------------------------------------------------------------------|
== \#UPGRADE_TITLE_UNCEUNCE | あんすあんす
@@ \#UPGRADE_EFFEC_UNCEUNCE
翻訳なし
あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす
あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす
あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす

##----------------------------------------------------------------------------|
== \#UPGRADE_TITLE_InstaDeath | 即死


BIN
pk7/acs/lithmain.bin View File


+ 3
- 1
pk7/language.arsenal.jp.txt View File

@@ -285,7 +285,9 @@
//----------------------------------------------------------------------------|
"LITH_UPGRADE_TITLE_UNCEUNCE" = "あんすあんす";
"LITH_UPGRADE_EFFEC_UNCEUNCE" =
"翻訳なし";
"あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす "
"あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす "
"あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす あんす";

//----------------------------------------------------------------------------|
"LITH_UPGRADE_TITLE_InstaDeath" = "即死";


+ 339
- 301
pk7/lzscript/Client/Draw.zsc View File

@@ -1,4 +1,30 @@
struct Lith_URANUS_DrawData
/*
The URANUS drawing system is essentially an instruction set with a
(very) simple state machine to draw stuff to the screen, either via ACS
or via ZScript. This is meant to replace HudMessage and allow a nicer,
unified drawing system between ZScript and ACS, usable by the playsim
while still providing maximum performance, as well as multiplayer compat.
*/

extend class Lith_URANUS;

// Types ---------------------------------------------------------------------|

enum DrawType
{
dt_lin,
dt_tex,
dt_ate,
dt_cte,
dt_xte,
dt_txt,
dt_utx,
dt_cls,
dt_clc,
dt_siz,
}

struct DrawData
{
uint8 dt;
int16 x, y, z, w;
@@ -7,70 +33,65 @@ struct Lith_URANUS_DrawData
color c;
float a;

int cr;
uint8 cr;
uint8 lny;
Font fnt;
array<string> txt;
array<int> lnw;
array<int> lnx;
int lny;
}

struct Lith_URANUS_FadeMessage
struct FadeMsg
{
uint16 time;
float fsub;
float fade;
}

enum Lith_URANUS_DrawType
{
dt_lin,
dt_tex,
dt_ate,
dt_cte,
dt_xte,
dt_txt,
dt_utx,
dt_cls,
dt_clc,
dt_siz,
}
// Constants -----------------------------------------------------------------|

extend class Lith_URANUS;
const font_space = 4;

const FONT_SPACE = 4;
const c_black = 0x4d4d4d;
const c_blue = 0x6e6eff;
const c_brick = 0xeaadad;
const c_brown = 0xcc9966;
const c_gold = 0xffcc00;
const c_white = 0xffffff;
const c_yellow = 0xeeee32;
const c_tan = 0xd2b48c;
const c_gray = 0xc0c0c0;
const c_green = 0x33ff33;
const c_red = 0xff4e60;
const c_orange = 0xffaa00;
const c_lightblue = 0x33eeff;
const c_cream = 0xfecc99;
const c_olive = 0xd1d8a7;
const c_darkgreen = 0x129a12;
const c_darkred = 0xb22323;
const c_darkbrown = 0x6c5d56;
const c_purple = 0xa674d7;
const c_darkgray = 0x414141;
const c_cyan = 0x00fffe;
const c_ice = 0xafccd3;
const c_fire = 0xfb7329;
const c_sapphire = 0x6c729f;
const c_teal = 0x8cd0dc;

/*
The URANUS drawing system is essentially an instruction set with a
(very) simple state machine to draw stuff to the screen, either via ACS
or via ZScript. This is meant to replace HudMessage and allow a nicer,
unified drawing system between ZScript and ACS, usable by the playsim
while still providing maximum performance, as well as multiplayer compat.
*/
// Members -------------------------------------------------------------------|

private transient play Lith_URANUS_DrawData[400] m_d;
private transient play DrawData[400] m_d;
private transient play uint m_p;
private transient play Lith_URANUS_FadeMessage[32] m_fmsg;
private transient play FadeMsg[32] m_fmsg;
private transient play vector2 m_vsc;
private transient play int m_dww;
private transient play bool m_nodraw;
private transient play bool m_forcedraw;

float, float GetScSized(float x, float y, bool kludge = false)
{
float vw = m_vsc.x;
float vh = m_vsc.y;

float sw = Screen.GetWidth();
float sh = Screen.GetHeight();

vector2 xy, sc;

if(kludge) [sc, xy] = Screen.VirtualToRealCoords((0, 0), ( x, y), (vw, vh));
else [xy, sc] = Screen.VirtualToRealCoords((x, y), (sw, sh), (vw, vh));
bool m_fontloaded;
bool m_eng;

return xy.x, xy.y;
}
// Static Functions ----------------------------------------------------------|

static void ForceDraw(bool on)
{
@@ -94,13 +115,24 @@ static void LZ(Actor mo, int w, int h)
cl.m_vsc = (w, h);
}

static void LF(Actor mo, int num, int time, double fade)
/* BIT LAYOUT OF ARGUMENTS

0123 4567 8901 2345 6789 0123 4567 8901 OF SZ - DESCRIPTION

arg0
1111 1111 1111 1111 ---- ---- ---- ---- 16 16 - fade speed
---- ---- ---- ---- ---1 1111 11-- ---- 6 7 - time (tics)
---- ---- ---- ---- ---- ---- --11 1111 0 6 - fade num
*/
static void LF(Actor mo, int arg0)
{
let cl = Lith_URANUS(Find("Lith_URANUS"));
if(!cl.m_forcedraw && mo != players[consoleplayer].camera) return;

cl.m_fmsg[num].time = time;
cl.m_fmsg[num].fsub = fade;
uint num = arg0 & 0x3f;

cl.m_fmsg[num].time = (arg0 >> 6) & 0x7f;
cl.m_fmsg[num].fsub = float(arg0 >> 16) / 0xffff;
cl.m_fmsg[num].fade = 1;
}

@@ -185,51 +217,52 @@ static void LS(Actor mo, string tex, int x, int y, int xa, int ya, double a = -1
cl.m_p++;
}

static int LTArgsN(uint x, uint y, uint xa, uint ya)
{
return (x << 14) | (y << 5) | (xa << 2) | ya;
}
/* BIT LAYOUT OF ARGUMENTS

static int LTArgsA(uint x, uint y, uint xa, uint ya, double a)
{
return LTArgsN(x, y, xa, ya) | 0x40000000 | (uint(a * 0x3F) << 24);
}
0123 4567 8901 2345 6789 0123 4567 8901 OF SZ - DESCRIPTION

arg0
1--- ---- ---- ---- ---- ---- ---- ---- 31 1 - "no unicode" flag
-1-- ---- ---- ---- ---- ---- ---- ---- 30 1 - alpha flag
--11 1111 ---- ---- ---- ---- ---- ---- 24 6 - alpha OR fade num
---- ---- ---- ---- ---- ---- 1111 1111 0 8 - color

// BIT LAYOUT OF ARGUMENT
// 0123 4567 8901 2345 6789 0123 4567 8901 OF SZ - DESCRIPTION
// 1000 0000 0000 0000 0000 0000 0000 0000 31 1 - "no unicode" flag
// 0100 0000 0000 0000 0000 0000 0000 0000 30 1 - alpha flag
// 0011 1111 0000 0000 0000 0000 0000 0000 24 6 - alpha OR fade num
// 0000 0000 1111 1111 1100 0000 0000 0000 14 10 - X position
// 0000 0000 0000 0000 0011 1111 1110 0000 5 9 - Y position
// 0000 0000 0000 0000 0000 0000 0001 1100 2 3 - X alignment
// 0000 0000 0000 0000 0000 0000 0000 0011 0 2 - Y alignment
static void LT(Actor mo, string txt, string fnt, int cr, int arg)
arg1
1--- ---- ---- ---- ---- ---- ---- ---- 31 1 - X sign
-1-- ---- ---- ---- ---- ---- ---- ---- 30 1 - Y sign
---- ---- 1111 1111 11-- ---- ---- ---- 14 10 - X position
---- ---- ---- ---- --11 1111 111- ---- 5 9 - Y position
---- ---- ---- ---- ---- ---- ---1 11-- 2 3 - X alignment
---- ---- ---- ---- ---- ---- ---- --11 0 2 - Y alignment
*/
static void LT(Actor mo, string txt, string fnt, int arg0, int arg1)
{
let cl = Lith_URANUS(Find("Lith_URANUS"));
if(!cl.m_forcedraw && mo != players[consoleplayer].camera) return;

bool af = arg & 0x40000000;
uint aa = (arg >> 24) & 0x3F;
bool af = arg0 & 0x40000000;
uint aa = (arg0 >> 24) & 0x3F;

if((af && aa == 0) || cl.m_nodraw) return;

uint x = (arg >> 14) & 0x3FF;
uint y = (arg >> 5) & 0x1FF;
uint xa = (arg >> 2) & 0x7;
uint ya = (arg ) & 0x3;

bool uf = arg & 0x80000000;
int x = (arg1 >> 14) & 0x3FF;
int y = (arg1 >> 5) & 0x1FF;
uint xa = (arg1 >> 2) & 0x7;
uint ya = arg1 & 0x3;
bool uf = arg0 & 0x80000000;

uint lns, lnx = 0;
if(arg1 & 0x80000000) x = x - 0x400;
if(arg1 & 0x40000000) y = y - 0x200;

let p = cl.m_p;

cl.m_d[p].a = !af && aa != 0 ? cl.m_fmsg[aa - 1].fade
: af ? aa ? double(aa) / 0x3F
: af ? aa ? float(aa) / 0x3F
: 0.0
: 1.0;
cl.m_d[p].cr = cr;
cl.m_d[p].cr = arg0 & 0xff;

uint lns, lnx = 0;

if(uf || cl.m_eng)
{
@@ -272,17 +305,20 @@ static void LT(Actor mo, string txt, string fnt, int cr, int arg)

for(pos = 0, sta = 0, len = brl[i].length(); pos < len;)
{
string utf = CharAtUtf8(brl[i], pos);
pos += utf.length();

if(utf.charCodeAt(0) == Ch_Color) continue;
let str = brl[i];
uint uclen, ucp; [uclen, ucp] = Utf32AtUtf8(str, pos);
pos += uclen;

int ucp = Utf8ToUtf32(utf, 0);
if(ucp == Ch_Color)
{
name _; [_, pos] = ParseColor(str, pos);
continue;
}

uint ww;

if(ucp == Ch_Space)
ww = FONT_SPACE;
ww = font_space;
else
{
let metr = CallACS("Lith_GetFontMetric", ucp);
@@ -292,7 +328,7 @@ static void LT(Actor mo, string txt, string fnt, int cr, int arg)

if(w + ww > (cl.m_dww ? cl.m_dww : 0x7fff))
{
if(ucp != Ch_Space) pos -= utf.length();
if(ucp != Ch_Space) pos -= uclen;

cl.m_d[p].txt.push(brl[i].mid(sta, pos - sta));
cl.m_d[p].lnw.push(w);
@@ -344,15 +380,35 @@ static void LT(Actor mo, string txt, string fnt, int cr, int arg)
cl.m_p++;
}

static void LC(Actor mo, int x, int y, int w, int h, int ww)
/* BIT LAYOUT OF ARGUMENTS

0123 4567 8901 2345 6789 0123 4567 8901 OF SZ - DESCRIPTION

arg0
1111 1111 1111 1111 ---- ---- ---- ---- 16 16 - Y position
---- ---- ---- ---- 1111 1111 1111 1111 0 16 - X position

arg1
1111 1111 1111 1111 ---- ---- ---- ---- 16 16 - height
---- ---- ---- ---- 1111 1111 1111 1111 0 16 - width

arg2
---- ---- ---- ---- 1111 1111 1111 1111 0 16 - wrap width
*/
static void LC(Actor mo, int arg0 = 0, int arg1 = 0, int arg2 = 0)
{
let cl = Lith_URANUS(Find("Lith_URANUS"));
if(!cl.m_forcedraw && mo != players[consoleplayer].camera) return;

let p = cl.m_p;

if(x || y || w || h)
if(arg0 || arg1)
{
uint x = arg0 & 0xffff;
uint y = (arg0 >> 16) & 0xffff;
uint w = arg1 & 0xffff;
uint h = (arg1 >> 16) & 0xffff;

// simple optimization (which also prevents division by zero)
if((cl.m_nodraw = w <= 0 || h <= 0)) return;

@@ -367,7 +423,7 @@ static void LC(Actor mo, int x, int y, int w, int h, int ww)
cl.m_d[p].dt = dt_clc;
}

cl.m_dww = ww;
cl.m_dww = arg2;
cl.m_p++;
}

@@ -388,30 +444,23 @@ static void LE()
}
}

// CharAtUtf8 and Utf8ToUtf32 are
// Copyright (c) 2018 Benjamin Moir. All rights reserved.
// This work is licensed under the terms of the MIT license.
// To obtain a copy, visit <https://opensource.org/licenses/MIT>.
static clearscope string CharAtUtf8(string str, uint pos)
static int LTArgsN(uint x, uint y, uint xa, uint ya)
{
int b0 = str.charCodeAt(pos) & 0xff, b1, b2, b3;
return (x << 14) | (y << 5) | (xa << 2) | ya;
}

// color code
if(b0 == Ch_Color)
{
string s;
static int LTArgsA(uint x, uint y, uint xa, uint ya, float a)
{
return LTArgsN(x, y, xa, ya) | 0x40000000 | (uint(a * 0x3F) << 24);
}

if(str.charCodeAt(pos + 1) == Ch_BrackO)
{
uint sta = pos;
while(str.charCodeAt(pos++) != Ch_BrackC);
return str.mid(sta, pos - sta);
}
else
return str.mid(pos, 2);
}
static clearscope uint, uint Utf32AtUtf8(string str, uint pos)
{
// Copyright (c) 2018 Benjamin Moir. All rights reserved.
// This work is licensed under the terms of the MIT license.
// To obtain a copy, visit <https://opensource.org/licenses/MIT>.
uint len, b0 = str.charCodeAt(pos) & 0xff, b1, b2, b3;

int len;
if(b0 < 0x80) len = 1;
else if(b0 < 0xe0) len = 2;
else if(b0 < 0xf0) len = 3;
@@ -426,60 +475,23 @@ static clearscope string CharAtUtf8(string str, uint pos)

switch(len) {
default:
case 1: return String.Format("%c", b0);
case 2: return String.Format("%c%c", b0, b1);
case 3: return String.Format("%c%c%c", b0, b1, b2);
case 4: return String.Format("%c%c%c%c", b0, b1, b2, b3);
}
}

static clearscope int Utf8ToUtf32(string ch, int sta = 0)
{
int len, b0 = ch.CharCodeAt(sta) & 0xff, b1, b2, b3;

if(b0 < 0x80) len = 1;
else if(b0 < 0xe0) len = 2;
else if(b0 < 0xf0) len = 3;
else len = 4;

switch(len) {
case 4: b3 = ch.charCodeAt(sta + 3) & 0xff;
case 3: b2 = ch.charCodeAt(sta + 2) & 0xff;
case 2: b1 = ch.charCodeAt(sta + 1) & 0xff;
case 1: break;
}

switch(len) {
default:
case 1: return b0;
case 2: return (b0 - 0xc0) * 0x40 | (b1 - 0x80);
case 3: return (b0 - 0xe0) * 0x1000 | (b1 - 0x80) * 0x40 | (b2 - 0x80);
case 4: return (b0 - 0xf0) * 0x40000 | (b1 - 0x80) * 0x1000 | (b2 - 0x80) * 0x40 | (b3 - 0x80);
case 1: return len, b0;
case 2: return len, (b0 - 0xc0) << 6 | (b1 - 0x80);
case 3: return len, (b0 - 0xe0) << 12 | (b1 - 0x80) << 6 | (b2 - 0x80);
case 4: return len, (b0 - 0xf0) << 18 | (b1 - 0x80) << 12 | (b2 - 0x80) << 6 | (b3 - 0x80);
}
}

bool m_fontloaded;
bool m_eng;

override void WorldLoaded(WorldEvent evt)
static clearscope name, uint ParseColor(string str, uint pos)
{
if(m_fontloaded) return;

// Unfortunately, due to the script runaway limit in ACS, we need to do this
// here so everything is initialized without breaking.
for(int fontnum = 0;; fontnum++)
if(str.charCodeAt(pos) == Ch_BrackO)
{
if(!CallACS("Lith_SetupFontsBegin", fontnum)) break;
while(CallACS("Lith_SetupFontsContinue"));
uint sta = pos;
while(str.charCodeAt(++pos) != Ch_BrackC);
return str.mid(sta, pos - sta), pos;
}

m_fontloaded = true;
}

override void WorldTick()
{
m_eng = StringTable.Localize("LITH_CHECK", false) == "Eng";
if(!m_eng) CallACS("Lith_SetFontFace", CVar.GetCVar('lith_gui_jpfont', players[consoleplayer]).getInt());
else
return str.charAt(pos++), pos;
}

static int GetTex(string gfx)
@@ -503,156 +515,155 @@ static int GetTexH(int gfx_)
return h;
}

const c_black = 0x4d4d4d;
const c_blue = 0x6e6eff;
const c_brick = 0xeaadad;
const c_brown = 0xcc9966;
const c_gold = 0xffcc00;
const c_white = 0xffffff;
const c_yellow = 0xeeee32;
const c_tan = 0xd2b48c;
const c_gray = 0xc0c0c0;
const c_green = 0x33ff33;
const c_red = 0xff4e60;
const c_orange = 0xffaa00;
const c_lightblue = 0x33eeff;
const c_cream = 0xfecc99;
const c_olive = 0xd1d8a7;
const c_darkgreen = 0x129a12;
const c_darkred = 0xb22323;
const c_darkbrown = 0x6c5d56;
const c_purple = 0xa674d7;
const c_darkgray = 0x414141;
const c_cyan = 0x00fffe;
const c_ice = 0xafccd3;
const c_fire = 0xfb7329;
const c_sapphire = 0x6c729f;
const c_teal = 0x8cd0dc;
// Member Functions ----------------------------------------------------------|

override void WorldLoaded(WorldEvent evt)
{
if(m_fontloaded) return;

// Unfortunately, due to the script runaway limit in ACS, we need to do this
// here so everything is initialized without breaking.
for(int fontnum = 0;; fontnum++)
{
if(!CallACS("Lith_SetupFontsBegin", fontnum)) break;
while(CallACS("Lith_SetupFontsContinue"));
}

m_fontloaded = true;
}

override void WorldTick()
{
if(!(m_eng = StringTable.Localize("LITH_CHECK", false) == "Eng"))
CallACS("Lith_SetFontFace",
CVar.GetCVar('lith_gui_jpfont', players[consoleplayer]).getInt());
}

override void RenderOverlay(RenderEvent evt)
{
int scw = 320;
int sch = 240;
int scw = 320, sch = 240;

if(!automapactive) for(uint i = 0; i < m_p; i++)
if(!automapactive) for(uint i = 0; i < m_p; i++) switch(m_d[i].dt)
{
switch(m_d[i].dt) {
case dt_lin:
Screen.DrawLine(m_d[i].x, m_d[i].y, m_d[i].z, m_d[i].w, m_d[i].c);
break;
case dt_tex:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0);
break;
case dt_ate:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0,
case dt_lin:
Screen.DrawLine(m_d[i].x, m_d[i].y, m_d[i].z, m_d[i].w, m_d[i].c);
break;
case dt_tex:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0);
break;
case dt_ate:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0,
DTA_Alpha, m_d[i].a);
break;
case dt_cte:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0,
DTA_FillColor, m_d[i].c);
break;
case dt_xte:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0,
DTA_Alpha, m_d[i].a,
DTA_FillColor, m_d[i].c);
break;
case dt_txt:
for(uint ln = 0, lns = m_d[i].lnx.size(); ln < lns; ln++)
Screen.DrawText(m_d[i].fnt, m_d[i].cr,
m_d[i].x-m_d[i].lnx[ln], m_d[i].y+m_d[i].lny*ln, m_d[i].txt[ln],
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch,
DTA_Alpha, m_d[i].a);
break;
case dt_cte:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0,
DTA_FillColor, m_d[i].c);
break;
case dt_xte:
Screen.DrawTexture(m_d[i].tex, false, m_d[i].x, m_d[i].y,
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch, DTA_TopOffset,0,DTA_LeftOffset,0,
DTA_Alpha, m_d[i].a,
DTA_FillColor, m_d[i].c);
break;
case dt_txt:
for(uint ln = 0, lns = m_d[i].lnx.size(); ln < lns; ln++)
Screen.DrawText(m_d[i].fnt, m_d[i].cr,
m_d[i].x-m_d[i].lnx[ln], m_d[i].y+m_d[i].lny*ln, m_d[i].txt[ln],
DTA_VirtualWidth, scw, DTA_VirtualHeight, sch,
DTA_Alpha, m_d[i].a);
break;
case dt_utx: {
uint defcr;
switch(m_d[i].cr) {
case Font.CR_BLACK: defcr = c_black; break;
case Font.CR_BLUE: defcr = c_blue; break;
case Font.CR_BRICK: defcr = c_brick; break;
case Font.CR_BROWN: defcr = c_brown; break;
case Font.CR_CREAM: defcr = c_cream; break;
case Font.CR_CYAN: defcr = c_cyan; break;
case Font.CR_DARKBROWN: defcr = c_darkbrown; break;
case Font.CR_DARKGRAY: defcr = c_darkgray; break;
case Font.CR_DARKGREEN: defcr = c_darkgreen; break;
case Font.CR_DARKRED: defcr = c_darkred; break;
case Font.CR_FIRE: defcr = c_fire; break;
case Font.CR_GOLD: defcr = c_gold; break;
case Font.CR_GREEN: defcr = c_green; break;
case Font.CR_GRAY: defcr = c_gray; break;
case Font.CR_ICE: defcr = c_ice; break;
case Font.CR_LIGHTBLUE: defcr = c_lightblue; break;
case Font.CR_OLIVE: defcr = c_olive; break;
case Font.CR_ORANGE: defcr = c_orange; break;
case Font.CR_PURPLE: defcr = c_purple; break;
case Font.CR_RED: defcr = c_red; break;
case Font.CR_SAPPHIRE: defcr = c_sapphire; break;
case Font.CR_TAN: defcr = c_tan; break;
case Font.CR_TEAL: defcr = c_teal; break;
default:
case Font.CR_UNTRANSLATED:
case Font.CR_WHITE: defcr = c_white; break;
case Font.CR_YELLOW: defcr = c_yellow; break;
}
uint cr = defcr;
for(uint ln = 0, lns = m_d[i].lnx.size(), y = m_d[i].y + m_d[i].lny; ln < lns; ln++)
break;
case dt_utx:
{
uint defcr;
switch(m_d[i].cr) {
case Font.CR_BLACK: defcr = c_black; break;
case Font.CR_BLUE: defcr = c_blue; break;
case Font.CR_BRICK: defcr = c_brick; break;
case Font.CR_BROWN: defcr = c_brown; break;
case Font.CR_CREAM: defcr = c_cream; break;
case Font.CR_CYAN: defcr = c_cyan; break;
case Font.CR_DARKBROWN: defcr = c_darkbrown; break;
case Font.CR_DARKGRAY: defcr = c_darkgray; break;
case Font.CR_DARKGREEN: defcr = c_darkgreen; break;
case Font.CR_DARKRED: defcr = c_darkred; break;
case Font.CR_FIRE: defcr = c_fire; break;
case Font.CR_GOLD: defcr = c_gold; break;
case Font.CR_GREEN: defcr = c_green; break;
case Font.CR_GRAY: defcr = c_gray; break;
case Font.CR_ICE: defcr = c_ice; break;
case Font.CR_LIGHTBLUE: defcr = c_lightblue; break;
case Font.CR_OLIVE: defcr = c_olive; break;
case Font.CR_ORANGE: defcr = c_orange; break;
case Font.CR_PURPLE: defcr = c_purple; break;
case Font.CR_RED: defcr = c_red; break;
case Font.CR_SAPPHIRE: defcr = c_sapphire; break;
case Font.CR_TAN: defcr = c_tan; break;
case Font.CR_TEAL: defcr = c_teal; break;
default:
case Font.CR_UNTRANSLATED:
case Font.CR_WHITE: defcr = c_white; break;
case Font.CR_YELLOW: defcr = c_yellow; break;
}

uint cr = defcr;
for(uint ln = 0, lns = m_d[i].lnx.size(), y = m_d[i].y + m_d[i].lny; ln < lns; ln++)
{
int x = m_d[i].x - m_d[i].lnx[ln];
int xo = x;

for(uint pos = 0, len = m_d[i].txt[ln].length(); pos < len;)
{
int x = m_d[i].x - m_d[i].lnx[ln];
int xo = x;
let str = m_d[i].txt[ln];
uint uclen, ucp; [uclen, ucp] = Utf32AtUtf8(str, pos);
pos += uclen;

for(uint pos = 0, len = m_d[i].txt[ln].length(); pos < len;)
if(ucp == Ch_Color)
{
string utf = CharAtUtf8(m_d[i].txt[ln], pos);
pos += utf.length();

if(utf.charCodeAt(0) == Ch_Color)
{
name colo = utf.mid(1, 256);
switch(colo) {
default:
case '-':
case 'l': cr = defcr; break;
case 'a': cr = c_brick; break;
case 'b': cr = c_tan; break;
case 'c': cr = c_gray; break;
case 'd': cr = c_green; break;
case 'e': cr = c_brown; break;
case 'f': cr = c_gold; break;
case 'g': cr = c_red; break;
case 'h': cr = c_blue; break;
case 'i': cr = c_orange; break;
case 'j': cr = c_white; break;
case 'k': cr = c_yellow; break;
case 'm': cr = c_black; break;
case 'n': cr = c_lightblue; break;
case 'o': cr = c_cream; break;
case 'p': cr = c_olive; break;
case 'q': cr = c_darkgreen; break;
case 'r': cr = c_darkred; break;
case 's': cr = c_darkbrown; break;
case 't': cr = c_purple; break;
case 'u': cr = c_darkgray; break;
case 'v': cr = c_cyan; break;
case 'w': cr = c_ice; break;
case 'x': cr = c_fire; break;
case 'y': cr = c_sapphire; break;
case 'z': cr = c_teal; break;
case '[Lith_Blue]': cr = 0x3b47f8; break;
case '[Lith_Green]': cr = 0x00ff00; break;
case '[Lith_Grey]': cr = 0xbfbfbf; break;
case '[Lith_Purple]': cr = 0x8c3bf8; break;
case '[Lith_Red]': cr = 0xbf0f4a; break;
}
continue;
name colo; [colo, pos] = ParseColor(str, pos);

switch(colo) {
default:
case 'a': cr = c_brick; break;
case 'b': cr = c_tan; break;
case 'c': cr = c_gray; break;
case 'd': cr = c_green; break;
case 'e': cr = c_brown; break;
case 'f': cr = c_gold; break;
case 'g': cr = c_red; break;
case 'h': cr = c_blue; break;
case 'i': cr = c_orange; break;
case 'j': cr = c_white; break;
case 'k': cr = c_yellow; break;
case '-':
case 'l': cr = defcr; break;
case 'm': cr = c_black; break;
case 'n': cr = c_lightblue; break;
case 'o': cr = c_cream; break;
case 'p': cr = c_olive; break;
case 'q': cr = c_darkgreen; break;
case 'r': cr = c_darkred; break;
case 's': cr = c_darkbrown; break;
case 't': cr = c_purple; break;
case 'u': cr = c_darkgray; break;
case 'v': cr = c_cyan; break;
case 'w': cr = c_ice; break;
case 'x': cr = c_fire; break;
case 'y': cr = c_sapphire; break;
case 'z': cr = c_teal; break;
case '[Lith_Blue]': cr = 0x3b47f8; break;
case '[Lith_Green]': cr = 0x00ff00; break;
case '[Lith_Grey]': cr = 0xbfbfbf; break;
case '[Lith_Purple]': cr = 0x8c3bf8; break;
case '[Lith_Red]': cr = 0xbf0f4a; break;
}

int ucp = Utf8ToUtf32(utf, 0);
if(ucp == Ch_Space) {x += FONT_SPACE; continue;}

}
else if(ucp == Ch_Space)
x += font_space;
else
{
int metr = CallACS("Lith_GetFontMetric", ucp);
int gfx_ = CallACS("Lith_Metr_Tex", metr);
if(gfx_ < 0) continue;
@@ -674,26 +685,53 @@ override void RenderOverlay(RenderEvent evt)
y += m_d[i].lny;
x = xo;

while((utf = CharAtUtf8(m_d[i].txt[ln], pos)) == " ")
pos += utf.length();
for(;;)
{
[uclen, ucp] = Utf32AtUtf8(str, pos);
if(ucp != Ch_Space) break;
pos += uclen;
}
}
else
x += xadv;
}
}

y += m_d[i].lny;
}
break;
}
case dt_cls: Screen.SetClipRect(m_d[i].x, m_d[i].y, m_d[i].z, m_d[i].w); break;
case dt_clc: Screen.ClearClipRect(); break;
case dt_siz: scw = m_d[i].x; sch = m_d[i].y; break;

y += m_d[i].lny;
}
break;
}
case dt_cls:
Screen.SetClipRect(m_d[i].x, m_d[i].y, m_d[i].z, m_d[i].w);
break;
case dt_clc:
Screen.ClearClipRect();
break;
case dt_siz:
scw = m_d[i].x;
sch = m_d[i].y;
break;
}

let p = Lith_Player(evt.camera);
if(p && p.m_cs) p.m_cs.Lith_Render();
}

float, float GetScSized(float x, float y, bool kludge = false)
{
float vw = m_vsc.x;
float vh = m_vsc.y;

float sw = Screen.GetWidth();
float sh = Screen.GetHeight();

vector2 xy, sc;

if(kludge) [sc, xy] = Screen.VirtualToRealCoords((0, 0), ( x, y), (vw, vh));
else [xy, sc] = Screen.VirtualToRealCoords((x, y), (sw, sh), (vw, vh));

return xy.x, xy.y;
}

// EOF

+ 7
- 7
pk7/lzscript/Constants.zsc View File

@@ -1,10 +1,10 @@
#include "lzscript/Headers/lith_weapons.h"
#include "lzscript/Headers/lith_pdata.h"
#include "lzscript/Headers/lith_wdata.h"
#include "lzscript/Headers/lith_upgradenames.h"
#include "lzscript/Headers/lith_scorenums.h"
#include "lzscript/Constants/p_weapons.zsc"
#include "lzscript/Constants/p_data.zsc"
#include "lzscript/Constants/w_data.zsc"
#include "lzscript/Constants/u_names.zsc"
#include "lzscript/Constants/w_scorenums.zsc"

enum Lith_ASCII
enum ASCII
{
Ch_NUL, // null
Ch_SOH, // start of heading
@@ -99,7 +99,7 @@ enum Lith_ASCII
Ch_Y, // Y
Ch_Z, // Z
Ch_BrackO, // [
Ch_Backslash, // \
Ch_Backslash, // \ backslash
Ch_BrackC, // ]
Ch_Exponent, // ^
Ch_Underscore, // _


pk7/lzscript/Headers/lith_pdata.h → pk7/lzscript/Constants/p_data.zsc View File


pk7/lzscript/Headers/lith_weapons.h → pk7/lzscript/Constants/p_weapons.zsc View File


pk7/lzscript/Headers/lith_upgradenames.h → pk7/lzscript/Constants/u_names.zsc View File


pk7/lzscript/Headers/lith_wdata.h → pk7/lzscript/Constants/w_data.zsc View File


pk7/lzscript/Headers/lith_scorenums.h → pk7/lzscript/Constants/w_scorenums.zsc View File

@@ -2,6 +2,7 @@
// Edit only if you aren't going to recompile.

// Copyright © 2016-2017 Alison Sanderson, all rights reserved.

enum ScoreNum
{
// Score values

+ 1
- 1
pk7/lzscript/Playsim/Weapons.zsc View File

@@ -5,7 +5,7 @@ static void Lith_IonizeFX(Actor mo)
mo.A_SpawnItemEx("Lith_IonizedFX", 0,0,0, 0,0,-1, 0, SXF_NOCHECKPOSITION|SXF_TRANSFERSPRITEFRAME|SXF_TRANSFERSCALE);
}

static void Lith_DelearSprite(Actor mo)
static void DelearSprite(Actor mo)
{
let w = Lith_Delear(mo.findInventory("Lith_Delear"));
if(!w) return;


+ 1
- 1
pk7/lzscript/Utilities.zsc View File

@@ -3,7 +3,7 @@ struct Lith_UTIL
{
static double Lerp(double a, double b, double t)
{
return ((1 - t) * a) + (t * b);
return (1 - t) * a + t * b;
}

static int Round(double n)


source/Headers/lith_common.h → source/Headers/common.h View File

@@ -1,8 +1,7 @@
// Copyright © 2016-2017 Alison Sanderson, all rights reserved.
#ifndef lith_common_h
#define lith_common_h
// Copyright © 2016-2018 Alison Sanderson, all rights reserved.
#ifndef common_h
#define common_h

// unfortunate early project decisions.
#pragma GDCC FIXED_LITERAL ON

#include <ACS_ZDoom.h>
@@ -10,13 +9,13 @@
#include <stdlib.h>
#include <string.h>

#include "lith_types.h"
#include "lith_memory.h"
#include "lith_drawing.h"
#include "lith_math.h"
#include "lith_str.h"
#include "lith_stab.h"
#include "lith_char.h"
#include "m_types.h"
#include "m_memory.h"
#include "m_drawing.h"
#include "m_math.h"
#include "m_str.h"
#include "m_stab.h"
#include "m_char.h"

#define ifw(decl, ...) __with(decl;) if(__VA_ARGS__)
#define ifauto(type, name, ...) ifw(type name = (__VA_ARGS__), name)
@@ -28,7 +27,7 @@
#define CloseEnough(x, y) (IsSmallNumber(x - y))

#define LogDebug(level, ...) \
do if(ACS_GetCVar(s_debug_level) & (level)) \
do if(ACS_GetCVar(sc_debug_level) & (level)) \
Log(c"" #level ": " __VA_ARGS__); \
while(0)

@@ -59,7 +58,7 @@
#define GetZ ACS_GetActorZ

#if LITHIUM
#define Lith_IsPaused ServCallI(s_GetPaused)
#define Lith_IsPaused ServCallI(sm_GetPaused)
#define Lith_PausableTick() do ACS_Delay(1); while(Lith_IsPaused)

#define CVAR "lith_"
@@ -86,13 +85,13 @@
#define sLANG s"" LANG
#define sOBJ s"" OBJ

#define ServCallI(...) SCallI(s_Serv, __VA_ARGS__)
#define ServCallK(...) SCallK(s_Serv, __VA_ARGS__)
#define ServCallS(...) SCallS(s_Serv, __VA_ARGS__)
#define ServCallI(...) SCallI(sm_Serv, __VA_ARGS__)
#define ServCallK(...) SCallK(sm_Serv, __VA_ARGS__)
#define ServCallS(...) SCallS(sm_Serv, __VA_ARGS__)

#define DrawCallI(...) SCallI(s_Draw, __VA_ARGS__)
#define DrawCallK(...) SCallK(s_Draw, __VA_ARGS__)
#define DrawCallS(...) SCallS(s_Draw, __VA_ARGS__)
#define DrawCallI(...) SCallI(sm_Draw, __VA_ARGS__)
#define DrawCallK(...) SCallK(sm_Draw, __VA_ARGS__)
#define DrawCallS(...) SCallS(sm_Draw, __VA_ARGS__)

#define DebugStat(...) \
(world.dbgLevel & log_devh ? Lith_DebugStat(__VA_ARGS__) : (void)0)
@@ -127,33 +126,26 @@ void Log(char const *fmt, ...);

script void Lith_PrintMem(void const *data, size_t size);

stkcall void Lith_FadeFlash(int r, int g, int b, fixed amount, fixed seconds);
script optargs(1) int Lith_GetTID(int tid, int ptr);
script optargs(1) int Lith_GetPlayerNumber(int tid, int ptr);
script optargs(1) bool Lith_ValidPointer(int tid, int ptr);
script optargs(2) bool Lith_SetPointer(int tid, int ptr, int assign, int tid2, int ptr2, int flags);
stkcall int Lith_CheckActorInventory(int tid, __str item);
stkcall void Lith_GiveActorInventory(int tid, __str item, int amount);
stkcall void Lith_TakeActorInventory(int tid, __str item, int amount);
stkcall void Lith_SetActorInventory (int tid, __str item, int amount);
void Lith_DebugStat(__str fmt, ...);
void Lith_DebugNote(__str fmt, ...);
stkcall void Lith_FadeFlash(i32 r, i32 g, i32 b, k32 amount, k32 seconds);
script optargs(1) i32 Lith_GetTID(i32 tid, i32 ptr);
script optargs(1) i32 Lith_GetPlayerNumber(i32 tid, i32 ptr);
script optargs(1) bool Lith_ValidPointer(i32 tid, i32 ptr);
script optargs(2) bool Lith_SetPointer(i32 tid, i32 ptr, i32 assign, i32 tid2, i32 ptr2, i32 flags);
stkcall i32 Lith_CheckActorInventory(i32 tid, str item);
stkcall void Lith_GiveActorInventory(i32 tid, str item, i32 amount);
stkcall void Lith_TakeActorInventory(i32 tid, str item, i32 amount);
stkcall void Lith_SetActorInventory (i32 tid, str item, i32 amount);
void Lith_DebugStat(char const *fmt, ...);
void Lith_DebugNote(char const *fmt, ...);

// Address Space Definitions -------------------------------------------------|

// This doesn't actually cause anything bad to happen. ZDoom expects that all
// modules know the exact size of every array, even if they don't use them
// at all and even account for that. So, we hide this to hide warnings.
#ifndef EXTERNAL_CODE
__addrdef extern __mod_arr lmvar;
__addrdef extern __hub_arr lwvar;
#endif

// Extern Objects ------------------------------------------------------------|

#ifndef EXTERNAL_CODE
extern __str dbgstat[], dbgnote[];
extern int dbgstatnum, dbgnotenum;
#endif
extern str dbgstat[], dbgnote[];
extern i32 dbgstatnum, dbgnotenum;

#endif

source/Headers/lith_dialogue.h → source/Headers/dialogue.h View File

@@ -76,18 +76,18 @@ DCD(INFO)
DCD(PICT)
DCD(TRMWAIT)
#undef DCD
#elif !defined(lith_dialogue_h)
#define lith_dialogue_h
#elif !defined(dialogue_h)
#define dialogue_h

#include "lith_world.h"
#include "lith_darray.h"
#include "w_world.h"
#include "m_vec.h"

// Types ---------------------------------------------------------------------|

enum
{
#define DCD(name) DCD_##name,
#include "lith_dialogue.h"
#include "dialogue.h"
};

enum
@@ -106,9 +106,9 @@ enum

struct dlgdef
{
int num;
int pages[48];
Vec_Decl(int, code);
i32 num;
i32 pages[48];
Vec_Decl(i32, code);
Vec_Decl(char, stab);

struct dlgdef *next;

+ 19
- 0
source/Headers/dlgstab.h View File

@@ -0,0 +1,19 @@
// Copyright © 2016-2017 Alison Sanderson, all rights reserved.
Str(NULL, "")
Str(class, "class")
Str(dialogue, "dialogue")
Str(else, "else")
Str(exec, "exec")
Str(failure, "failure")
Str(finished, "finished")
Str(if, "if")
Str(item, "item")
Str(option, "option")
Str(page, "page")
Str(terminal, "terminal")
Str(Informant, "Informant")
Str(unfinished, "unfinished")

#undef Str

// EOF

+ 336
- 0
source/Headers/gui.h View File

@@ -0,0 +1,336 @@
// Copyright © 2016-2017 Alison Sanderson, all rights reserved.
#ifndef gui_h
#define gui_h

#include "m_cps.h"

#define LineHash ((u32)__LINE__ * FileHash)

#define Pre(name) .preset = &gui_p.name

// Fixed ID
#define Lith_GUI_Button_FId(g, id, ...) Lith_GUI_Button_Impl (g, id, &(struct gui_arg_btn const){__VA_ARGS__})
#define Lith_GUI_Checkbox_FId(g, id, ...) Lith_GUI_Checkbox_Impl (g, id, &(struct gui_arg_cbx const){__VA_ARGS__})
#define Lith_GUI_ScrollBegin_FId(g, id, ...) Lith_GUI_ScrollBegin_Impl(g, id, &(struct gui_arg_scr const){__VA_ARGS__})
#define Lith_GUI_Slider_FId(g, id, ...) Lith_GUI_Slider_Impl (g, id, &(struct gui_arg_sld const){__VA_ARGS__})
#define Lith_GUI_TextBox_FId(g, id, ...) Lith_GUI_TextBox_Impl (g, id, &(struct gui_arg_txt const){__VA_ARGS__})

// Dynamic ID
#define Lith_GUI_Button_Id(g, id, ...) Lith_GUI_Button_FId (g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_Checkbox_Id(g, id, ...) Lith_GUI_Checkbox_FId (g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_ScrollBegin_Id(g, id, ...) Lith_GUI_ScrollBegin_FId(g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_Slider_Id(g, id, ...) Lith_GUI_Slider_FId (g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_TextBox_Id(g, id, ...) Lith_GUI_TextBox_FId (g, id + LineHash, __VA_ARGS__)

// Dynamic
#define Lith_GUI_Button(g, ...) Lith_GUI_Button_Id (g, 0, __VA_ARGS__)
#define Lith_GUI_Checkbox(g, ...) Lith_GUI_Checkbox_Id (g, 0, __VA_ARGS__)
#define Lith_GUI_ScrollBegin(g, ...) Lith_GUI_ScrollBegin_Id(g, 0, __VA_ARGS__)
#define Lith_GUI_Slider(g, ...) Lith_GUI_Slider_Id (g, 0, __VA_ARGS__)
#define Lith_GUI_TextBox(g, ...) Lith_GUI_TextBox_Id (g, 0, __VA_ARGS__)

#define Lith_GUI_GenPreset(type, def) \
type pre; \
if(a->preset) pre = *a->preset; \
else pre = def

#define Lith_GUI_Prefix(set) \
if(set) { \
ACS_BeginPrint(); \
PrintChrSt(g->gfxprefix); \
ACS_PrintString(set); \
set = ACS_EndStrParam(); \
} else (void)0
#define Lith_GUI_Prefix1(g, pre, mem) \
(!(pre)->external \
? ((pre)->mem ? (ACS_BeginPrint(), \
PrintChrSt((g)->gfxprefix), \
ACS_PrintString((pre)->mem), \
ACS_EndStrParam()) : nil) \
: (pre)->mem)
#define Lith_GUI_Prefix2(g, gfx, pre, mem) \
do { \
if(!(pre)->mem) \
(gfx)[0] = '\0'; \
else if((pre)->external) \
strncpy(gfx, (pre)->mem, sizeof(gfx)); \
else \
{ \
strcpy(gfx, (g)->gfxprefix); \
strcat(gfx, (pre)->mem); \
} \
} while(0)

#define Lith_GUI_ScrollReset(g, st) \
(*(st) = (struct gui_scr){})

#define Lith_GUI_Tabs(g, st, names, x, y, yy) \
do { \
for(i32 _i = 0; _i < countof(names); _i++) \
{ \
if(Lith_GUI_Button_Id(g, _i, names[_i], gui_p.btntab.w * _i + (x), \
gui_p.btntab.h * (yy) + (y), _i == *(st), .preset = &gui_p.btntab)) \
{ \
*(st) = _i; \
} \
} \
} while(0)

#define Lith_GUI_BasicCheckbox(g, st, ...) \
if(Lith_GUI_Checkbox((g), *(st), __VA_ARGS__)) \
*(st) = !*(st); \
else \
(void)0

#define Lith_GUI_TextBox_Reset(st) ((st)->tbptr = 0)

#define Lith_GUI_TextBox_OnTextEntered(st) \
__with(char const *txt_buf = Cps_Print(st->txtbuf, st->tbptr);) \
ifauto(char const *, _c, strchr(txt_buf, '\n')) \
__with(size_t txt_len = _c - txt_buf; Lith_GUI_TextBox_Reset(st);)

// Types ---------------------------------------------------------------------|

struct gui_scr
{
i32 ox;
i32 oy;
i32 occludeS;
i32 occludeE;
k64 y;
k64 grabpos;
bool grabbed;
i32 nextsnd;
};

struct gui_typ
{
str txt;
i32 len;
i32 pos;
};

struct gui_txt
{
Cps_Decl(txtbuf, 128);
i32 tbptr;
};

struct gui_delta
{
k64 cx, cy;

bool clicklft;
bool clickrgt;
bool clickany;
};

struct gui_state
{
anonymous
struct gui_delta cur;
struct gui_delta old;

i32 ox, oy;
i32 w, h;

u32 active, hot, slide;
i32 slidecount, slidetime;

bool useclip;
i32 clpxS, clpyS, clpxE, clpyE;

void *state;

char const *gfxprefix;
};

struct gui_pre_btn
{
char const *gfx;
char const *hot;
char const *snd;
char const *cdef;
char const *cact;
char const *chot;
char const *cdis;
char const *font;
i32 ax;
i32 ay;
i32 w;
i32 h;
bool external;
};

struct gui_arg_btn
{
char const *label;
i32 x, y;
bool disabled;
char const *color;
bool slide;
struct gui_pre_btn const *preset;
};

struct gui_pre_cbx
{
str gfx;
str hot;
str dis;
str sndup;
str snddn;
str chkgfx;
str chkhot;
str chkact;
str chkdis;
bool external;
i32 w;
i32 h;
};

struct gui_arg_cbx
{
bool on;
i32 x, y;
bool disabled;
struct gui_pre_cbx const *preset;
};

struct gui_pre_scr
{
str capS;
str capE;
str scrl;
str notchgfx;
str notchhot;
bool external;
i32 scrlw;
i32 scrlh;
};

struct gui_arg_scr
{
struct gui_scr *st;
i32 x;
i32 y;
i32 w;
i32 h;
i32 contenth;
i32 ww;
struct gui_pre_scr const *preset;
};

struct gui_pre_sld
{
str gfx;
str snd;
str notch;
str notchhot;
str font;
bool external;
i32 pad;
i32 w;
i32 h;
};

struct gui_arg_sld
{
i32 x;
i32 y;
k64 minima;
k64 maxima;
k64 val;
bool integ;
char const *suf;
struct gui_pre_sld const *preset;
};

struct gui_arg_txt
{
struct gui_txt *st;
i32 x, y;
struct player *p;
};

struct gui_presets {
struct gui_pre_btn btndef;
struct gui_pre_btn btntab;
struct gui_pre_btn btnexit;
struct gui_pre_btn btnnext;
struct gui_pre_btn btnprev;
struct gui_pre_btn btnnexts;
struct gui_pre_btn btnprevs;
struct gui_pre_btn btnlist;
struct gui_pre_btn btnlistsel;
struct gui_pre_btn btnlistactive;
struct gui_pre_btn btnlistactivated;
struct gui_pre_btn btnbipmain;
struct gui_pre_btn btnbipback;
struct gui_pre_btn btndlgsel;
struct gui_pre_btn btnclear;
struct gui_pre_btn btnnote;
struct gui_pre_cbx cbxdef;
struct gui_pre_cbx cbxsmall;
struct gui_pre_scr scrdef;
struct gui_pre_sld slddef;
};

enum cursor
{
gui_curs_green,
gui_curs_pink,
gui_curs_blue,
gui_curs_orange,
gui_curs_red,
gui_curs_white,
gui_curs_outline,
gui_curs_outline2,
gui_curs_outlineinv,
gui_curs_outline2inv,
gui_curs_max,
};

// Extern Objects ------------------------------------------------------------|

extern struct gui_presets const gui_p;

// Extern Functions ----------------------------------------------------------|

stkcall optargs(1)
void Lith_GUI_Auto(struct gui_state *g, u32 id, i32 x, i32 y, i32 w, i32 h, bool slide);

stkcall optargs(1)
void Lith_GUI_Init(struct gui_state *g, void *state);

stkcall
void Lith_GUI_UpdateState(struct gui_state *g, struct player *p);

stkcall optargs(2)
void Lith_GUI_Begin(struct gui_state *g, i32 w, i32 h);
stkcall
void Lith_GUI_End(struct gui_state *g, enum cursor curs);

stkcall optargs(1)
void Lith_GUI_Clip(struct gui_state *g, i32 x, i32 y, i32 w, i32 h, i32 ww);
stkcall
void Lith_GUI_ClipRelease(struct gui_state *g);

stkcall char const *RemoveTextColors_str(char __str_ars const *s, i32 size);
stkcall char const *RemoveTextColors (char const *s, i32 size);

stkcall
void Lith_GUI_TypeOn(struct gui_state *g, struct gui_typ *typeon, str text);
stkcall
struct gui_typ const *Lith_GUI_TypeOnUpdate(struct gui_state *g, struct gui_typ *typeon);

void Lith_GUI_ScrollEnd(struct gui_state *g, struct gui_scr *scr);
optargs(1)
bool Lith_GUI_ScrollOcclude(struct gui_state *g, struct gui_scr const *scr, i32 y, i32 h);

bool Lith_GUI_Button_Impl (struct gui_state *g, u32 id, struct gui_arg_btn const *a);
bool Lith_GUI_Checkbox_Impl (struct gui_state *g, u32 id, struct gui_arg_cbx const *a);
void Lith_GUI_ScrollBegin_Impl(struct gui_state *g, u32 id, struct gui_arg_scr const *a);
k64 Lith_GUI_Slider_Impl (struct gui_state *g, u32 id, struct gui_arg_sld const *a);
struct gui_txt *Lith_GUI_TextBox_Impl (struct gui_state *g, u32 id, struct gui_arg_txt const *a);

#endif

source/Headers/lith_items.h → source/Headers/items.h View File

@@ -1,8 +1,8 @@
// Copyright © 2017-2018 Alison Sanderson, all rights reserved.
#ifndef lith_items_h
#define lith_items_h
#ifndef items_h
#define items_h

#define foritem(cont) forlist(item_t *it, (cont).items) if(it)
#define for_item(cont) for_list(item_t *it, (cont).items) if(it)

// NB: these need to be ScriptS or they'll disappear on map load
// (we can't use a GSReinit callback because that would be really bad)
@@ -12,8 +12,8 @@ script typedef void (*item_p_cb_t)(struct item *item, struct container *cont);

typedef struct itemdata
{
__str name, spr, tag;
uint w, h;
str name, spr, tag;
u32 w, h;
i96 scr;

item_b_cb_t Use;
@@ -26,19 +26,19 @@ typedef struct item
{
anonymous itemdata_t data;

uint x, y;
u32 x, y;

struct container *container;
struct player *user;

list_t link;
list link;
} item_t;

typedef struct container
{
uint w, h;
__str bg;
list_t items;
u32 w, h;
str bg;
list items;
struct player *user;
} container_t;

@@ -59,9 +59,9 @@ script void Lith_Item_Destroy(item_t *item);
script bool Lith_Item_Use(item_t *item);
script void Lith_Item_Place(item_t *item, container_t *cont);

optargs(1) bagitem_t *Lith_BagItem_New(int w, int h, __str bg, itemdata_t const *data);
optargs(1) bagitem_t *Lith_BagItem_New(i32 w, i32 h, str bg, itemdata_t const *data);

bool Lith_ItemPlace(container_t *cont, item_t *item, int x, int y);
bool Lith_ItemPlace(container_t *cont, item_t *item, i32 x, i32 y);

script bool Lith_ItemPlaceFirst(container_t *cont, item_t *item);


+ 0
- 26
source/Headers/lith_cps.h View File

@@ -1,26 +0,0 @@
// Copyright © 2018 Alison Sanderson, all rights reserved.
#ifndef lith_cps_h
#define lith_cps_h

#define Lith_CPS_Count(name) (countof(name) * 4)

#define Lith_CPS_Len(len) ((len) / 4 + (len) % 4)

#define Lith_CPS_Defn(name, len) \
u32 (name)[Lith_CPS_Len(len)] = {}

#define Lith_CPS_Decl(name, len) \
u32 (name)[Lith_CPS_Len(len)]

#define Lith_CPS_Shif(i, set) ((set) << ((i) % 4 * 8))

#define Lith_CPS_SetC(name, i, set) \
((name)[(i) / 4] &= ~Lith_CPS_Shif(i, 0xFF), \
(name)[(i) / 4] |= Lith_CPS_Shif(i, set & 0xFF))

#define Lith_CPS_GetC(name, i) \
(((name)[(i) / 4] & (0xFF << ((i) % 4 * 8))) >> ((i) % 4 * 8))

char const *Lith_CPS_Print(u32 *cps, int l);

#endif

+ 0
- 20
source/Headers/lith_dlgstrtable.h View File

@@ -1,20 +0,0 @@
// Copyright © 2016-2017 Alison Sanderson, all rights reserved.
Str(NULL, "")
Str(class, "class")
Str(dialogue, "dialogue")
Str(else, "else")
Str(exec, "exec")
Str(failure, "failure")
Str(finished, "finished")
Str(if, "if")
Str(item, "item")
Str(option, "option")
Str(page, "page")
Str(terminal, "terminal")
Str(Informant, "Informant")
Str(unfinished, "unfinished")

#undef Str

// EOF


+ 0
- 114
source/Headers/lith_drawing.h View File

@@ -1,114 +0,0 @@
// Copyright © 2018 Alison Sanderson, all rights reserved.

// Not 1.0 / 35.0 or even 0.028 because ZDoom is stupid.
#define TS 0.029

#define PrintSprite(name, x, xa, y, ya) \
DrawCallI(s_LS, name, (int)(x), (int)(y), (int)(xa), (int)(ya))

#define PrintSpriteA(name, x, xa, y, ya, a) \
DrawCallI(s_LS, name, (int)(x), (int)(y), (int)(xa), (int)(ya), (fixed)(a))

#define PrintSpriteF(name, x, xa, y, ya, n) \
DrawCallI(s_LS, name, (int)(x), (int)(y), (int)(xa), (int)(ya), (fixed)(-(n) - 2))

#define PrintTextFmt(...) StrParamBegin(__VA_ARGS__)
#define PrintTextStr(s) (ACS_BeginPrint(), ACS_PrintString(s))
#define PrintTextChr(s, n) (ACS_BeginPrint(), PrintChars(s, n))

#define PrintTextArgs_N(x, y, xa, ya) \
(((uint)(x) << 14) | ((uint)(y) << 5) | ((uint)(xa) << 2) | (uint)(ya))

#define PrintTextArgs_A(x, y, xa, ya, a) \
(PrintTextArgs_N(x, y, xa, ya) | 0x40000000 | ((uint)((fixed)(a) * 0x3F) << 24))

#define PrintTextArgs_F(x, y, xa, ya, n) \
(PrintTextArgs_N(x, y, xa, ya) | (((uint)(n) + 1) << 24))

#define PrintText(font, cr, x, xa, y, ya) \
DrawCallI(s_LT, ACS_EndStrParam(), font, cr, PrintTextArgs_N(x, y, xa, ya))

#define PrintTextX(font, cr, x, xa, y, ya) \
DrawCallI(s_LT, ACS_EndStrParam(), font, cr, PrintTextArgs_N(x, y, xa, ya) | 0x80000000)

#define PrintTextA(font, cr, x, xa, y, ya, a) \
DrawCallI(s_LT, ACS_EndStrParam(), font, cr, PrintTextArgs_A(x, y, xa, ya, a))

#define PrintTextF(font, cr, x, xa, y, ya, n) \
DrawCallI(s_LT, ACS_EndStrParam(), font, cr, PrintTextArgs_F(x, y, xa, ya, n))

#define PrintTextFX(font, cr, x, xa, y, ya, n) \
DrawCallI(s_LT, ACS_EndStrParam(), font, cr, PrintTextArgs_F(x, y, xa, ya, n) | 0x80000000)

#define SetClip(x, y, w, h) \
DrawCallI(s_LC, (int)(x), (int)(y), (int)(w), (int)(h), 0)

#define SetClipW(x, y, w, h, ww) \
DrawCallI(s_LC, (int)(x), (int)(y), (int)(w), (int)(h), (int)(ww))

#define ClearClip() \
DrawCallI(s_LC, 0, 0, 0, 0, 0)

#define SetSize(w, h) \
DrawCallI(s_LZ, (int)(w), (int)(h))

#define SetFade(n, time, fade) \
DrawCallI(s_LF, (int)(n), (int)(time), (fixed)(fade))

#define CheckFade(n) \
DrawCallI(s_LX, n)

#define HudMessageLog(...) \
( \
HudMessage(__VA_ARGS__), \
ACS_OptHudMessage(HUDMSG_NOTWITHFULLMAP|HUDMSG_NOTWITH3DVIEW|HUDMSG_NOTWITHOVERLAYMAP|HUDMSG_LOG, hid_log_throwaway, CR_UNTRANSLATED, 0, 0, TS), \
ACS_EndHudMessage() \
)

#define HudMessageF(font, ...) \
( \
ACS_SetFont(font), \
HudMessage(__VA_ARGS__) \
)

#define HudMessageParams(flags, id, tr, x, y, hold, ...) \
( \
ACS_OptHudMessage((flags) | HUDMSG_NOTWITHFULLMAP, id, tr, x, y, hold), \
ACS_EndHudMessage(__VA_ARGS__) \
)

#define HudMessagePlain(id, x, y, hold) \
( \
ACS_OptHudMessage(HUDMSG_PLAIN | HUDMSG_NOTWITHFULLMAP, id, CR_UNTRANSLATED, x, y, hold), \
ACS_EndHudMessage() \
)

#define HudMessageFade(id, x, y, hold, fadetime) \
( \
ACS_OptHudMessage(HUDMSG_FADEOUT | HUDMSG_NOTWITHFULLMAP, id, CR_UNTRANSLATED, x, y, hold), \
ACS_EndHudMessage(fadetime) \
)

#define HudMessageAlpha(id, x, y, hold, alpha) \
( \
HudMessageParams(HUDMSG_ALPHA, id, CR_UNTRANSLATED, x, y, hold, alpha) \
)

enum
{
font_misaki_gothic, // 美咲ゴシック
font_misaki_mincho, // 美咲明朝
font_jfdot_gothic, // JFドットk6x8
font_num,
};

stkcall void DrawSprite(__str name, int flags, int id, fixed x, fixed y, fixed hold);
stkcall void DrawSpriteX(__str name, int flags, int id, fixed x, fixed y, fixed hold, fixed a1);
stkcall void DrawSpriteXX(__str name, int flags, int id, fixed x, fixed y, fixed hold, fixed a1, fixed a2);
stkcall void DrawSpriteXXX(__str name, int flags, int id, fixed x, fixed y, fixed hold, fixed a1, fixed a2, fixed a3);
stkcall void DrawSpritePlain(__str name, int id, fixed x, fixed y, fixed hold);
stkcall void DrawSpriteAlpha(__str name, int id, fixed x, fixed y, fixed hold, fixed alpha);
stkcall void DrawSpriteFade(__str name, int id, fixed x, fixed y, fixed hold, fixed fadetime);
void HudMessage(__str fmt, ...);

// EOF

+ 0
- 345
source/Headers/lith_gui.h View File

@@ -1,345 +0,0 @@
// Copyright © 2016-2017 Alison Sanderson, all rights reserved.
#ifndef lith_gui_h
#define lith_gui_h

#include "lith_cps.h"

#define LineHash ((id_t)__LINE__ * FileHash)

#define Pre(name) .preset = &guipre.name

// Fixed ID
#define Lith_GUI_Button_FId(g, id, ...) Lith_GUI_Button_Impl (g, id, &(gui_button_args_t const){__VA_ARGS__})
#define Lith_GUI_Checkbox_FId(g, id, ...) Lith_GUI_Checkbox_Impl (g, id, &(gui_checkb_args_t const){__VA_ARGS__})
#define Lith_GUI_ScrollBegin_FId(g, id, ...) Lith_GUI_ScrollBegin_Impl(g, id, &(gui_scroll_args_t const){__VA_ARGS__})
#define Lith_GUI_Slider_FId(g, id, ...) Lith_GUI_Slider_Impl (g, id, &(gui_slider_args_t const){__VA_ARGS__})
#define Lith_GUI_TextBox_FId(g, id, ...) Lith_GUI_TextBox_Impl (g, id, &(gui_txtbox_args_t const){__VA_ARGS__})

// Dynamic ID
#define Lith_GUI_Button_Id(g, id, ...) Lith_GUI_Button_FId (g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_Checkbox_Id(g, id, ...) Lith_GUI_Checkbox_FId (g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_ScrollBegin_Id(g, id, ...) Lith_GUI_ScrollBegin_FId(g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_Slider_Id(g, id, ...) Lith_GUI_Slider_FId (g, id + LineHash, __VA_ARGS__)
#define Lith_GUI_TextBox_Id(g, id, ...) Lith_GUI_TextBox_FId (g, id + LineHash, __VA_ARGS__)

// Dynamic
#define Lith_GUI_Button(g, ...) Lith_GUI_Button_Id (g, 0, __VA_ARGS__)
#define Lith_GUI_Checkbox(g, ...) Lith_GUI_Checkbox_Id (g, 0, __VA_ARGS__)
#define Lith_GUI_ScrollBegin(g, ...) Lith_GUI_ScrollBegin_Id(g, 0, __VA_ARGS__)
#define Lith_GUI_Slider(g, ...) Lith_GUI_Slider_Id (g, 0, __VA_ARGS__)
#define Lith_GUI_TextBox(g, ...) Lith_GUI_TextBox_Id (g, 0, __VA_ARGS__)

#define Lith_GUI_GenPreset(type, def) \
type pre; \
if(a->preset) pre = *a->preset; \
else pre = def

#define Lith_GUI_Prefix(set) \
if(set) { \
ACS_BeginPrint(); \
PrintChars(g->gfxprefix, g->gfxprefixsz); \
ACS_PrintString(set); \
set = ACS_EndStrParam(); \
} else (void)0
#define Lith_GUI_Prefix1(g, pre, mem) \
(!(pre)->external \
? ((pre)->mem ? (ACS_BeginPrint(), \
PrintChars((g)->gfxprefix, (g)->gfxprefixsz), \
ACS_PrintString((pre)->mem), \
ACS_EndStrParam()) : null) \
: (pre)->mem)
#define Lith_GUI_Prefix2(g, gfx, pre, mem) \
do { \
if(!(pre)->mem) \
(gfx)[0] = '\0'; \
else if((pre)->external) \
strncpy(gfx, (pre)->mem, sizeof(gfx)); \
else \
{ \
memmove(gfx, (g)->gfxprefix, (g)->gfxprefixsz + 1); \
strcat(gfx, (pre)->mem); \
} \
} while(0)

#define Lith_GUI_ScrollReset(g, st) \
(*(st) = (gui_scroll_state_t){})

#define Lith_GUI_Tabs(g, st, names, x, y, yy) \
do { \
for(int _i = 0; _i < countof(names); _i++) \
{ \
if(Lith_GUI_Button_Id(g, _i, names[_i], guipre.btntab.w * _i + (x), \
guipre.btntab.h * (yy) + (y), _i == *(st), .preset = &guipre.btntab)) \
{ \
*(st) = _i; \
} \
} \
} while(0)

#define Lith_GUI_BasicCheckbox(g, st, ...) \
if(Lith_GUI_Checkbox((g), *(st), __VA_ARGS__)) \
*(st) = !*(st); \
else \
(void)0

#define Lith_GUI_TextBox_Reset(st) ((st)->tbptr = 0)

#define Lith_GUI_TextBox_OnTextEntered(st) \
__with(char const *txt_buf = Lith_CPS_Print(st->txtbuf, st->tbptr);) \
ifauto(char const *, _c, strchr(txt_buf, '\n')) \
__with(size_t txt_len = _c - txt_buf; Lith_GUI_TextBox_Reset(st);)

// Types ---------------------------------------------------------------------|

typedef u32 id_t;

typedef struct gui_scroll_state_s
{
int ox;
int oy;
int occludeS;
int occludeE;
fixed64 y;
fixed64 grabpos;
bool grabbed;
int nextsnd;
} gui_scroll_state_t;

typedef struct gui_typeon_state_s
{
__str txt;
int len;
int pos;
} gui_typeon_state_t;

typedef struct gui_txtbox_state_s
{
Lith_CPS_Decl(txtbuf, 128);
int tbptr;
} gui_txtbox_state_t;

typedef struct gui_delta_s
{
fixed64 cx, cy;

bool clicklft;
bool clickrgt;
bool clickany;
} gui_delta_t;

typedef struct gui_state_s
{
anonymous
gui_delta_t cur;
gui_delta_t old;

int ox, oy;
int w, h;

id_t active, hot, slide;
int slidecount, slidetime;

bool useclip;
int clpxS, clpyS, clpxE, clpyE;

void *state;

char const *gfxprefix;
uint gfxprefixsz;
} gui_state_t;

typedef struct gui_button_preset_s
{
char const *gfx;
char const *hot;
char const *snd;
char const *cdef;
char const *cact;
char const *chot;
char const *cdis;
char const *font;
int ax;
int ay;
int w;
int h;
bool external;
} gui_button_preset_t;

typedef struct gui_button_args_s
{
char const *label;
int x, y;
bool disabled;
char const *color;
bool slide;
gui_button_preset_t const *preset;
} gui_button_args_t;

typedef struct gui_checkb_preset_s
{
__str gfx;
__str hot;
__str dis;
__str sndup;
__str snddn;
__str chkgfx;
__str chkhot;
__str chkact;
__str chkdis;
bool external;
int w;
int h;
} gui_checkb_preset_t;

typedef struct gui_checkb_args_s
{
bool on;
int x, y;
bool disabled;
gui_checkb_preset_t const *preset;
} gui_checkb_args_t;

typedef struct gui_scroll_preset_s
{
__str capS;
__str capE;
__str scrl;
__str notchgfx;
__str notchhot;
bool external;
int scrlw;
int scrlh;
} gui_scroll_preset_t;

typedef struct gui_scroll_args_s
{
gui_scroll_state_t *st;
int x;
int y;
int w;
int h;
int contenth;
int ww;
gui_scroll_preset_t const *preset;
} gui_scroll_args_t;

typedef struct gui_slider_preset_s
{
__str gfx;
__str snd;
__str notch;
__str notchhot;
__str font;
bool external;
int pad;
int w;
int h;
} gui_slider_preset_t;

typedef struct gui_slider_args_s
{
int x;
int y;
fixed64 minima;
fixed64 maxima;
fixed64 val;
bool integ;
char const *suf;
gui_slider_preset_t const *preset;
} gui_slider_args_t;

typedef struct gui_txtbox_args_s
{
gui_txtbox_state_t *st;
int x, y;
struct player *p;
} gui_txtbox_args_t;

struct gui_presets {
gui_button_preset_t btndef;
gui_button_preset_t btntab;
gui_button_preset_t btnexit;
gui_button_preset_t btnnext;
gui_button_preset_t btnprev;
gui_button_preset_t btnnexts;
gui_button_preset_t btnprevs;
gui_button_preset_t btnlist;
gui_button_preset_t btnlistsel;
gui_button_preset_t btnlistactive;
gui_button_preset_t btnlistactivated;
gui_button_preset_t btnbipmain;
gui_button_preset_t btnbipback;
gui_button_preset_t btndlgsel;
gui_button_preset_t btnclear;
gui_button_preset_t btnnote;
gui_checkb_preset_t cbxdef;
gui_checkb_preset_t cbxsmall;
gui_scroll_preset_t scrdef;
gui_slider_preset_t slddef;
};

enum cursor
{
gui_curs_green,
gui_curs_pink,
gui_curs_blue,
gui_curs_orange,
gui_curs_red,
gui_curs_white,
gui_curs_outline,
gui_curs_outline2,
gui_curs_outlineinv,
gui_curs_outline2inv,
gui_curs_max,
};

// Extern Objects ------------------------------------------------------------|

#ifndef EXTERNAL_CODE
extern struct gui_presets const guipre;
#else
struct gui_presets const *Lith_GUIPreExtern(void);
#define guipre (*Lith_GUIPreExtern())
#endif

// Extern Functions ----------------------------------------------------------|

stkcall optargs(1)
void Lith_GUI_Auto(gui_state_t *g, id_t id, int x, int y, int w, int h, bool slide);

stkcall optargs(1)
void Lith_GUI_Init(gui_state_t *g, void *state);

stkcall
void Lith_GUI_UpdateState(gui_state_t *g, struct player *p);

stkcall optargs(2)
void Lith_GUI_Begin(gui_state_t *g, int w, int h);
stkcall
void Lith_GUI_End(gui_state_t *g, enum cursor curs);

stkcall optargs(1)
void Lith_GUI_Clip(gui_state_t *g, int x, int y, int w, int h, int ww);
stkcall
void Lith_GUI_ClipRelease(gui_state_t *g);

stkcall
__str Lith_RemoveTextColors(__str str, int size);

stkcall
void Lith_GUI_TypeOn(gui_state_t *g, gui_typeon_state_t *typeon, __str text);
stkcall
gui_typeon_state_t const *Lith_GUI_TypeOnUpdate(gui_state_t *g, gui_typeon_state_t *typeon);

void Lith_GUI_ScrollEnd(gui_state_t *g, gui_scroll_state_t *scr);
optargs(1)
bool Lith_GUI_ScrollOcclude(gui_state_t *g, gui_scroll_state_t const *scr, int y, int h);

bool Lith_GUI_Button_Impl (gui_state_t *g, id_t id, gui_button_args_t const *a);
bool Lith_GUI_Checkbox_Impl (gui_state_t *g, id_t id, gui_checkb_args_t const *a);
void Lith_GUI_ScrollBegin_Impl(gui_state_t *g, id_t id, gui_scroll_args_t const *a);
fixed64 Lith_GUI_Slider_Impl (gui_state_t *g, id_t id, gui_slider_args_t const *a);
gui_txtbox_state_t *Lith_GUI_TextBox_Impl (gui_state_t *g, id_t id, gui_txtbox_args_t const *a);

#endif


+ 0
- 40
source/Headers/lith_list.h View File

@@ -1,40 +0,0 @@
// Copyright © 2016-2017 Alison Sanderson, all rights reserved.
#ifndef lith_list_h
#define lith_list_h

#include "lith_common.h"

#include <stddef.h>