/********************************************************************
 *																	*
 *	Internal title routines											*
 *	by Ken Hollis													*
 *																	*
 *	Copyright (C) 1994, Bitgate Software and Clever Bits			*
 *	All rights reserved												*
 *																	*
 *	These are the internal title routines that are shown at boot	*
 *	time, to tell the user what is happening.  They are strictly	*
 *	for informative purposes.  Nothing more.						*
 *																	*
 ********************************************************************
 *																	*
 *	Update log:														*
 *																	*
 *	[20.2.94] Ken Hollis											*
 *		TShowTitle			- added									*
 *		TChangeTitleText	- added									*
 *		TEndTitle			- added									*
 *		TInitTitle			- added									*
 *																	*
 ********************************************************************/

#include "winlib.h"

static char ptn[1] = "";

TEDINFO tt_tedinfo[] = {
  {"                              ", ptn, ptn, 3,   0,   2, 4480,   0,   1,  31,   1}
};

int titleblock[] = {
  0x7f80,0x03e0,0x00ff,0x3f80,0x0000,0x01fc,0x0000,0x1fcf,
  0xe000,0x0000,0x0055,0x5550,0x0000,0x0000,0x0000,0x7f80,
  0x07f0,0x00ff,0x3f80,0x0000,0x01fc,0x0000,0x1fcf,0xe000,
  0x0000,0x00aa,0xaaa8,0x0000,0x0000,0x0000,0x3fc0,0x07f0,
  0x01fe,0x3f80,0x0000,0x01fc,0x0000,0x1fcf,0xe000,0x0000,
  0x0055,0x5554,0x0000,0x0000,0x0000,0x3fc0,0x0ff8,0x01fe,
  0x0000,0x0000,0x01fc,0x0000,0x000f,0xe000,0x0000,0x00aa,
  0x00aa,0x0000,0x0000,0x0000,0x1fe0,0x0ff8,0x03fc,0x0000,
  0x0000,0x01fc,0x0000,0x000f,0xe000,0x0000,0x0154,0x0055,
  0x0000,0x0000,0x0000,0x1fe0,0x1ffc,0x03fc,0x3f9f,0xc3fc,
  0x01fc,0x0000,0x1fcf,0xe1ff,0x0000,0x00a8,0x00aa,0x0a0a,
  0xa802,0xaa80,0x0ff0,0x1ffc,0x07f8,0x3f9f,0xcfff,0x01fc,
  0x0000,0x1fcf,0xe7ff,0xc000,0x0154,0x0055,0x1555,0x5415,
  0x5540,0x0ff0,0x1ffc,0x07f8,0x3f9f,0xffff,0xc1fc,0x0000,
  0x1fcf,0xffff,0xf000,0x02a8,0x00aa,0x2aaa,0xa8aa,0xaaa8,
  0x07f8,0x3f7e,0x0ff0,0x3f9f,0xfc3f,0xe1fc,0x0000,0x1fcf,
  0xfe0f,0xf800,0x0150,0x0154,0x1554,0x0155,0x0554,0x07f8,
  0x3f7e,0x0ff0,0x3f9f,0xf00f,0xf1fc,0x0000,0x1fcf,0xf803,
  0xfc00,0x02a8,0x0aa8,0x2aa0,0x02a8,0x00aa,0x03fc,0x7e3f,
  0x1fe0,0x3f9f,0xe007,0xf1fc,0x0000,0x1fcf,0xf001,0xfc00,
  0x0555,0x5550,0x5540,0x0550,0x0154,0x03fc,0x7e3f,0x1fe0,
  0x3f9f,0xe007,0xf9fc,0x0000,0x1fcf,0xf001,0xfe00,0x02aa,
  0xaa80,0x2a80,0x0aa0,0x00aa,0x01fe,0x7e3f,0x3fc0,0x3f9f,
  0xc003,0xf9fc,0x0000,0x1fcf,0xe000,0xfe00,0x0555,0x5400,
  0x5500,0x0540,0x0054,0x01fe,0xfc1f,0xbfc0,0x3f9f,0xc003,
  0xf9fc,0x0000,0x1fcf,0xe000,0xfe00,0x0aa0,0x0000,0xaa00,
  0x0aa0,0x00a8,0x00ff,0xfc1f,0xff80,0x3f9f,0xc003,0xf9fc,
  0x0000,0x1fcf,0xe000,0xfe00,0x0540,0x0000,0x5400,0x1540,
  0x0154,0x00ff,0xf80f,0xff80,0x3f9f,0xc003,0xf9fc,0x0000,
  0x1fcf,0xf001,0xfe00,0x0aa0,0x0000,0xaa00,0x0a80,0x02a8,
  0x007f,0xf80f,0xff00,0x3f9f,0xc003,0xf9fc,0x0000,0x1fcf,
  0xf001,0xfc00,0x1540,0x0001,0x5400,0x1540,0x0550,0x007f,
  0xf80f,0xff00,0x3f9f,0xc003,0xf9fc,0x0000,0x1fcf,0xf803,
  0xfc00,0x0a80,0x0000,0xa800,0x0aa0,0x0aa0,0x003f,0xf007,
  0xfe00,0x3f9f,0xc003,0xf9fc,0x0000,0x1fcf,0xfe0f,0xf800,
  0x1540,0x0001,0x5400,0x0550,0x1540,0x003f,0xf007,0xfe00,
  0x3f9f,0xc003,0xf9ff,0xffff,0x9fcf,0xffff,0xf000,0x2a80,
  0x0002,0xa800,0x02aa,0xaa80,0x001f,0xe003,0xfc00,0x3f9f,
  0xc003,0xf9ff,0xffff,0x9fcf,0xe7ff,0xc000,0x1500,0x0001,
  0x5000,0x0155,0x5400,0x001f,0xe003,0xfc00,0x3f9f,0xc003,
  0xf9ff,0xffff,0x9fcf,0xe1ff,0x0000,0x2a80,0x0002,0xa800,
  0x00aa,0xa000
};

BITBLK tt_bitblk[] = {
  {titleblock,  0x001e, 0x0016, 0x0000, 0x0000, 0x0001}
};

static char string_1[] = "By Ken Hollis and Karl ˛ygard";
static char string_2[] = "From Bitgate PD and Clever Bits";

OBJECT tt_object[] = {
  /* Tree #0*/
  {  -1,   1,   1,0x0014,0x0000,0x0000, (long)(0x00001173L),   0,   0,1570,  10},
  {   0,   2,   6,0x0014,FL3DBAK,DRAW3D, (long)(0x00021100L), 768, 768,  34, 521},
  {   4,   3,   3,0x0017,0x0000,0x0000, (long)(&tt_bitblk[0]),   2,1024,  30,1538},
  {   2,  -1,  -1,0x1117,0x0000,0x0000, (long)(0x000000faL), 276,   0,  10,1794},
  {   5,  -1,  -1,0x0016,FL3DACT,DRAW3D, (long)(&tt_tedinfo[0]),   1,   4,  32,   2},
  {   6,  -1,  -1,0x001c,0x0000,0x0000, (long)(string_1),1026,1798,  29,   1},
  {   1,  -1,  -1,0x001c,0x0020,0x0000, (long)(string_2),1025,1799,  31,   1}
};

OBJECT *TITLE = tt_object;

GLOBAL void TInitTitle(void)
{
	RFix_ObjectPos(TITLE);
	fix_object(TITLE, TRUE);
	form_center(TITLE, &TITLE->ob_x, &TITLE->ob_y, &TITLE->ob_width, &TITLE->ob_height);
}

GLOBAL void TShowTitle(void)
{
	form_dial(0, TITLE->ob_x, TITLE->ob_y, TITLE->ob_width, TITLE->ob_height,
			TITLE->ob_x, TITLE->ob_y, TITLE->ob_width, TITLE->ob_height);
	objc_draw(TITLE, 0, 99, TITLE->ob_x, TITLE->ob_y, TITLE->ob_width, TITLE->ob_height);
}

GLOBAL void TEndTitle(void)
{
	form_dial(3, TITLE->ob_x, TITLE->ob_y, TITLE->ob_width, TITLE->ob_height,
			TITLE->ob_x, TITLE->ob_y, TITLE->ob_width, TITLE->ob_height);
}

GLOBAL void TChangeTitleText(char *text)
{
	ChangeObjectText(TITLE, 4, text, 5, TE_CNTR);
	objc_draw(TITLE, 4, 99, desk.g_x, desk.g_y, desk.g_w, desk.g_h);
}