From 8bf0ee1f09eed9dcc4e7023b01cc6b18ce311c2e Mon Sep 17 00:00:00 2001
From: hidnplayr <hidnplayr@kolibrios.org>
Date: Sun, 19 Jan 2014 13:10:54 +0000
Subject: [PATCH] fara: use skinned windows.

git-svn-id: svn://kolibrios.org@4481 a494cfbc-eb01-0410-851d-a64ba20cac60
---
 programs/games/fara/trunk/gameWnd.cpp  | 19 +++++++------------
 programs/games/fara/trunk/kosSyst.cpp  | 16 ++++++++++++++--
 programs/games/fara/trunk/kosSyst.h    |  4 +++-
 programs/games/fara/trunk/mainWnd.cpp  | 15 +++++----------
 programs/games/fara/trunk/top10wnd.cpp | 19 +++++++------------
 5 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/programs/games/fara/trunk/gameWnd.cpp b/programs/games/fara/trunk/gameWnd.cpp
index 833dab8997..100faf5035 100644
--- a/programs/games/fara/trunk/gameWnd.cpp
+++ b/programs/games/fara/trunk/gameWnd.cpp
@@ -38,12 +38,12 @@ CFishka *fishki[blocksNum];
 //
 char *gameWndTitle;
 #if LANG == RUS
-char gameWndTitle1[] = "��࠮� ���� ⥡� :)";
-char gameWndTitle2[] = "�� ���...";
+char gameWndTitle1[] = "��࠮� ���� ⥡� :)\0";
+char gameWndTitle2[] = "�� ���...\0";
 char gameOverText[] = "����� ��ண� ���!";
 #else
-char gameWndTitle1[] = "Pharaoh waits for you :)";
-char gameWndTitle2[] = "Well...";
+char gameWndTitle1[] = "Pharaoh waits for you :)\0";
+char gameWndTitle2[] = "Well...\0";
 char gameOverText[] = "No further way!";
 #endif
 //
@@ -1427,17 +1427,12 @@ void DrawGameWindow()
 	kos_DefineAndDrawWindow(
 		WNDLEFT, WNDTOP,
 		gcx + 1, gcy + 21,
-		0, 0x0,
+		0x14, 0x0,
 		0, WNDHEADCOLOUR,
-		WNDHEADCOLOUR
+		gameWndTitle
 		);
 	// ��������� ����
-	kos_WriteTextToWindow(
-		4, 7,
-		0x10, WNDTITLECOLOUR,
-		gameWndTitle, strlen(gameWndTitle)
-		);
-	//
+	  kos_ChangeWindowCaption(gameWndTitle);
 	gameFace.Draw( 1, 21 );
 	drawGameMap();
 	drawGameMeters();
diff --git a/programs/games/fara/trunk/kosSyst.cpp b/programs/games/fara/trunk/kosSyst.cpp
index 3f388ddb18..f9efec38df 100644
--- a/programs/games/fara/trunk/kosSyst.cpp
+++ b/programs/games/fara/trunk/kosSyst.cpp
@@ -365,7 +365,7 @@ void kos_DefineAndDrawWindow(
 	Dword mainAreaColour,
 	Byte headerType,
 	Dword headerColour,
-	Dword borderColour
+	char *textPtr
 	)
 {
 	Dword arg1, arg2, arg3, arg4;
@@ -382,7 +382,7 @@ void kos_DefineAndDrawWindow(
 		mov ecx, arg2
 		mov edx, arg3
 		mov esi, arg4
-		mov edi, borderColour
+		mov edi, textPtr
 		int 0x40
 	}
 }
@@ -867,4 +867,16 @@ void crtStartUp()
 	kos_ExitApp();
 }
 
+// sysfn 71.1
+void kos_ChangeWindowCaption(
+	char *textPtr
+	)
+{
+	__asm{
+		mov eax, 71
+		mov ebx, 1
+		mov ecx, textPtr
+		int 0x40
+	}
+}
 
diff --git a/programs/games/fara/trunk/kosSyst.h b/programs/games/fara/trunk/kosSyst.h
index 7c8323dcdb..5bc41e6ffd 100644
--- a/programs/games/fara/trunk/kosSyst.h
+++ b/programs/games/fara/trunk/kosSyst.h
@@ -121,7 +121,7 @@ void kos_DefineAndDrawWindow(
 	Word sizeX, Word sizeY,
 	Byte mainAreaType, Dword mainAreaColour,
 	Byte headerType, Dword headerColour,
-	Dword borderColour
+	char *textPtr
 	);
 // ������� 1 ��������� �����
 void kos_PutPixel( Dword x, Dword y, Dword colour );
@@ -193,5 +193,7 @@ void* __stdcall kos_realloc(void* mptr, Dword size);
 // ������� 66 ����� ��������� ������ �� ����������
 void kos_SetKeyboardDataMode( Dword mode );
 
+void kos_ChangeWindowCaption(char *textPtr);
+
 //
 void kos_Main();
diff --git a/programs/games/fara/trunk/mainWnd.cpp b/programs/games/fara/trunk/mainWnd.cpp
index 3999cad071..d745747d4e 100644
--- a/programs/games/fara/trunk/mainWnd.cpp
+++ b/programs/games/fara/trunk/mainWnd.cpp
@@ -18,13 +18,13 @@ RGB bmPMButton[] = {
 
 //
 #if LANG == RUS
-char mainWndTitle[] = "PHARAON's CRYPT";
+char mainWndTitle[] = "PHARAON's CRYPT\0";
 char mainWndCopyright[] = "(C) MMVI by Rabid Rabbit";
 char mainWndMenuStart[] = "1. ����� ����";
 char mainWndMenuExit[] = "2. ��室";
 char mainWndMenuLevel[] = "��砫�� �஢��� - %U";
 #else
-char mainWndTitle[] = "PHARAON's CRYPT";
+char mainWndTitle[] = "PHARAON's CRYPT\0";
 char mainWndCopyright[] = "(C) MMVI by Rabid Rabbit";
 char mainWndMenuStart[] = "1. Start game";
 char mainWndMenuExit[] = "2. Exit";
@@ -151,17 +151,12 @@ void DrawMainWindow()
 	kos_DefineAndDrawWindow(
 		WNDLEFT, WNDTOP,
 		mcx + 1, mcy + 21,
-		0, 0x0,
+		0x14, 0x0,
 		0, WNDHEADCOLOUR,
-		WNDHEADCOLOUR
+		mainWndTitle
 		);
 	// ��������� ����
-	kos_WriteTextToWindow(
-		4, 7,
-		0x10, WNDTITLECOLOUR,
-		mainWndTitle, sizeof(mainWndTitle)-1
-		);
-	//
+	  kos_ChangeWindowCaption(mainWndTitle);
 	mainWndFace.Draw( 1, 21 );
 	// ������ ������
 	kos_WriteTextToWindow(
diff --git a/programs/games/fara/trunk/top10wnd.cpp b/programs/games/fara/trunk/top10wnd.cpp
index 6314bcc85d..dd2685924a 100644
--- a/programs/games/fara/trunk/top10wnd.cpp
+++ b/programs/games/fara/trunk/top10wnd.cpp
@@ -153,11 +153,11 @@ hiScoreFile *top10Heroes = NULL;
 
 //
 #if LANG == RUS
-char Top10WndTitle[] = "Top 10";
+char Top10WndTitle[] = "Top 10\0";
 char top10str1[] = "ENTER - ��� Ok.";
 char top10str2[] = "ESC - ��室 � ����";
 #else
-char Top10WndTitle[] = "Top 10";
+char Top10WndTitle[] = "Top 10\0";
 char top10str1[] = "Enter - name Ok.";
 char top10str2[] = "Esc - leave to menu";
 #endif
@@ -243,18 +243,13 @@ void DrawTop10Window()
 	kos_DefineAndDrawWindow(
 		100, 100,
 		TOP10_WND_SIZE_X, TOP10_WND_SIZE_Y,
-		0, 0,
+		0x14, 0,
 		0, 0x2040A0,
-		0x2040A0
+		Top10WndTitle
 		);
-	//
-	kos_WriteTextToWindow(
-		4, 4,
-		0x0, 0x42D2E2,
-		Top10WndTitle,
-		sizeof( Top10WndTitle ) - 1
-		);
-	//
+
+	kos_ChangeWindowCaption(Top10WndTitle);
+
 	for ( i = 0; i < TOP_TBL_SIZE; i++ )
 	{
 		//