#ifndef q_teletype_h
#define q_teletype_h
//
// teletype.h
//
// ----------------------------------------------------------------------------------
//#include <acknex.h>
//#include <default.c>
// ----------------------------------------------------------------------------------
// DEFINES
#define teletype_size 128
//
// GLOBAL VARIABLES
//
var vTTpan1var1 = 0.0;
var vTTpan1var2 = 0.0;
var vTTpan1var3 = 0.0;
var vTTpan1var4 = 0.0;
var vTT_qFile_BUSY = 0; // flag: the queue file is currently active
var vTTaddTextBUSY = 0; // flag: the addText function is processing already
var vTTscrollupBUSY = 0; // flag: the scrollup routine is processing already
var vTT_clrAll_BUSY = 0; // flag: all text objects are being cleared
var vTT_clr_BUSY = 0; // flag: a text object is being cleared
var vTT_FlagCheck = 0; // flag: shows the result from TTcheckFlags
var vTT_GLbusy = 0; // used as a global all-busy flag
var vTT_BUSY = 0;
var vTT_LineLength = 0;
var vTT_TotalLines = 0;
var vTT_temp = 0.0;
// global vars for teletype.c
var vTT_FileHandle = 0;
FONT* vTTfont10N = "fonts\\asrc_10n.bmp";
FONT* vTTfont10C = "fonts\\asrc_10nC.bmp";
FONT* vTTfont10Y = "fonts\\asrc_10nY.bmp";
FONT* vTTfont14N = "fonts\\asrc_14n.bmp";
FONT* vTTfont10Ntt = "ASRC TERMINAL#10";
FONT* vTTfont12Ntt = "ASRC TERMINAL#12";
FONT* vTTfont14Ntt = "ASRC TERMINAL#14";
FONT* vTTfont16Ntt = "ASRC TERMINAL#16";
FONT* vTTfont18Ntt = "ASRC TERMINAL#18";
FONT* vTTfont16Natt = "ARIAL#16";
FONT* vTTfontGS20 = "asot12.bmp";
//FONT* vTTfontGS20 = "tracer#20";
//
// GLOBAL OBJECTS
//
var vTT_Cline[5] = { 0,0,0,0,0 }; // these vars are used to track which line (string #) the cursor is on.
// when the function TT_addText() is called, these values are incremented,
// if the value is greater than the number of strings in the text object
// then the scroll_up routine is called and the new text is added.
// since arrays are base-0, we add an extra index so we can have 1 = 1 not 0 = 1
// truncate text at 127 chars
var TTtxt1trunc = 127;
var TTtxt1coloractive[3] = { 128,128,255 }; // coloring text only works if the font is a truetype font,
var TTtxt1colorinactive[3] = { 128,128,128 }; // because bitmaps fonts use whatever color the bitmap is
TEXT* TTtxt1 =
{
layer = 200;
pos_x = 202;
pos_y = 808;
font = vTTfont10Y;
strings = 25;
}
// truncate text at 80 chars
var TTtxt2trunc = 80;
var TTtxt2coloractive[3] = { 255,255,255 };
var TTtxt2colorinactive[3] = { 120,255,120 };
TEXT* TTtxt2 =
{
layer = 200;
pos_x = 566;
pos_y = 808;
font = vTTfont16Ntt;
strings = 24;
}
// truncate text at 65 chars
var TTtxt3trunc = 65;
var TTtxt3coloractive[3] = { 128,255,255 };
var TTtxt3colorinactive[3] = { 255,196,128 };
TEXT* TTtxt3 =
{
layer = 200;
pos_x = 1366;
pos_y = 808;
font = vTTfont16Ntt;
strings = 24;
}
// truncate text at 65 chars
var TTtxt4trunc = 65;
var TTtxt4coloractive[3] = { 255,255,255 };
var TTtxt4colorinactive[3] = { 096,096,255 };
TEXT* TTtxt4 =
{
layer = 200;
pos_x = 8;
pos_y = 808;
font = vTTfont16Ntt;
strings = 24; // accessed as base-0, so [0] - [23]
}
// these are used for the text queuing functions
TEXT* TTq1 =
{
strings = 300;
}
TEXT* TTq2 =
{
strings = 300;
}
TEXT* TTq3 =
{
strings = 300;
}
TEXT* TTq4 =
{
strings = 300;
}
TEXT* pTTq[4096]; // array of text object pointers, which tells which text object the string belongs to
TEXT* sTTq = { strings = 4096; } // main queue for string entries into the TTtxt<x> objects
var vTTqdelay[4096]; // for each queue, this value holds a delay value used when printing the string
var vTTqindex[4096]; // store the numeric value associated with the text object (i.e. 1 = TTtxt1, and so on)
var vTTqtrunc[4096]; // stores the truncation value associated with the given text object
TEXT* TTtxtInfo =
{
layer = 200;
pos_x = 8;
pos_y = 766;
// font = vTTfont14N;
font = vTTfontGS20;
strings = 1;
}
PANEL* TTpan1 =
{
pos_x = 15; pos_y = 600;layer = 99;
digits(0 , 0 ,"pan1var1 = %7.3f",vTTfont10N,1,vTTpan1var1);
digits(0 ,15 ,"pan1var2 = %7.3f",vTTfont10N,1,vTTpan1var2);
digits(0 ,30 ,"pan1var3 = %7.3f",vTTfont10N,1,vTTpan1var3);
digits(0 ,45 ,"pan1var4 = %7.3f",vTTfont10N,1,vTTpan1var4);
flags = VISIBLE;
}
PANEL* TTpanFLAGS =
{
pos_x = 400; pos_y = 20; layer = 99;
digits(0, 0,"vTT_qFile_BUSY (01)= %2.0f",vTTfont10N,1,vTT_qFile_BUSY);
digits(0, 20,"vTTaddTextBUSY (02)= %2.0f",vTTfont10N,1,vTTaddTextBUSY);
digits(0, 40,"vTTscrollupBUSY (04)= %2.0f",vTTfont10N,1,vTTscrollupBUSY);
digits(0, 60,"vTT_clrAll_BUSY (08)= %2.0f",vTTfont10N,1,vTT_clrAll_BUSY);
digits(0, 80,"vTT_clr_BUSY (16)= %2.0f",vTTfont10N,1,vTT_clr_BUSY);
digits(0,110,"vTT_FlagCheck = %2.0f",vTTfont10N,1,vTT_FlagCheck);
//flags = VISIBLE;
}
// -------------------
// FUNCTION PROTOTYPES
// -------------------
void TTteletype_init(void);
void TTteletype_clearvars(void);
// ---------------------------------------------------------------------------
void TT_addText(TEXT* tx, var toNbr, STRING* istring, var trunc, var slowvar);
void TT_scrollup(TEXT* tx, var howmany);
void TTqueue(var tn, var slowvar, STRING* istring); // text object index, output delay value, string to display
void TTqueueFile(var tn, var slowvar, STRING* fn); // text object index, output delay value, filename
void TTclearText(var tn);
void TTclearTextAll(void);
var TTcheckFlags(var vmask); // the mask is a binary mask to show which flags you want checked
void TTshowInfo(STRING* istring);
// TESTING -------------------------------------------------------------------
void TTtest1(void);
void TTtest2(void);
void TTtest3(void);
void TTclear3(void);
void TTforceFlagCheck(void);
// ---------------------------------------------------------------------------
#endif