xonix: use skinned window (no more legacy windows finally?)

git-svn-id: svn://kolibrios.org@5822 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2015-09-08 20:36:22 +00:00
parent 13e4fb3d40
commit 877c841e94
3 changed files with 218 additions and 113 deletions

View File

@ -392,7 +392,7 @@ void kos_DefineAndDrawWindow(
Dword mainAreaColour, Dword mainAreaColour,
Byte headerType, Byte headerType,
Dword headerColour, Dword headerColour,
Dword borderColour char *title
) )
{ {
Dword arg1, arg2, arg3, arg4; Dword arg1, arg2, arg3, arg4;
@ -409,7 +409,7 @@ void kos_DefineAndDrawWindow(
mov ecx, arg2 mov ecx, arg2
mov edx, arg3 mov edx, arg3
mov esi, arg4 mov esi, arg4
mov edi, borderColour mov edi, title
int 0x40 int 0x40
} }
} }
@ -726,6 +726,17 @@ void kos_DisplayNumberToWindow(
} }
// 48, 4 -- get skin height
Dword kos_GetSkinHeight()
{
__asm{
mov eax, 48
mov ebx, 4
int 0x40
}
}
// ôóíêöèÿ 70 äîñòóï ê ôàéëîâîé ñèñòåìå // ôóíêöèÿ 70 äîñòóï ê ôàéëîâîé ñèñòåìå
Dword kos_FileSystemAccess( kosFileInfo *fileInfo ) Dword kos_FileSystemAccess( kosFileInfo *fileInfo )
{ {
@ -816,6 +827,17 @@ void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY )
} }
// 71,1 set window caption
void kos_SetWindowCaption(char *caption)
{
__asm{
mov eax, 71
mov ebx, 1
mov ecx, caption
int 0x40
}
}
// âûçîâ àáñòðàêòíîãî ìåòîäà // âûçîâ àáñòðàêòíîãî ìåòîäà
int __cdecl _purecall() int __cdecl _purecall()

View File

@ -86,6 +86,12 @@ union sProcessInfo
Dword x_size; Dword x_size;
Dword y_size; Dword y_size;
Word slot_state; Word slot_state;
Word reserved2;
Dword client_x;
Dword client_y;
Dword client_width;
Dword client_height;
Byte window_state;
} processInfo; } processInfo;
}; };
@ -131,7 +137,7 @@ void kos_DefineAndDrawWindow(
Word sizeX, Word sizeY, Word sizeX, Word sizeY,
Byte mainAreaType, Dword mainAreaColour, Byte mainAreaType, Dword mainAreaColour,
Byte headerType, Dword headerColour, Byte headerType, Dword headerColour,
Dword borderColour char *title
); );
// ôóíêöèÿ 1 ïîñòàâèòü òî÷êó // ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
void kos_PutPixel( Dword x, Dword y, Dword colour ); void kos_PutPixel( Dword x, Dword y, Dword colour );
@ -188,6 +194,8 @@ void kos_DisplayNumberToWindow(
eNumberBase nBase = nbDecimal, eNumberBase nBase = nbDecimal,
bool valueIsPointer = false bool valueIsPointer = false
); );
// ôóíêöèÿ 48,4 get skin height
Dword kos_GetSkinHeight();
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå // ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
Dword kos_FileSystemAccess( kosFileInfo *fileInfo ); Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
// ôóíêöèÿ 63 // ôóíêöèÿ 63
@ -200,6 +208,8 @@ void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
bool kos_ApplicationMemoryResize( Dword targetSize ); bool kos_ApplicationMemoryResize( Dword targetSize );
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû // ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
void kos_SetKeyboardDataMode( Dword mode ); void kos_SetKeyboardDataMode( Dword mode );
// ôóíêöèÿ 71,1 set window caption
void kos_SetWindowCaption(char *caption);
// //
void kos_Main(); void kos_Main();

View File

@ -189,11 +189,11 @@ int GetCompletePercents();
#define blockSize 8 #define blockSize 8
#define ENTRY_WND_SIZE_X 400 #define ENTRY_CLIENT_SIZE_X (400 - 2)
#define ENTRY_WND_SIZE_Y 144 #define ENTRY_CLIENT_SIZE_Y (144 - 2 - 20)
#define TOP10_WND_SIZE_X 176 #define TOP10_CLIENT_SIZE_X (176 - 2)
#define TOP10_WND_SIZE_Y 144 #define TOP10_CLIENT_SIZE_Y (144 - 2 - 20)
#define MAX_X_SIZE 96 #define MAX_X_SIZE 96
#define MIN_X_SIZE 48 #define MIN_X_SIZE 48
@ -201,8 +201,6 @@ int GetCompletePercents();
#define MIN_Y_SIZE 28 #define MIN_Y_SIZE 28
#define flipMapSize ((mapSizeX * mapSizeY) / 4) #define flipMapSize ((mapSizeX * mapSizeY) / 4)
#define wndXOffet 1
#define wndYOffset 22
#define freeSpaceCount ((mapSizeX - 4) * (mapSizeY - 4)) #define freeSpaceCount ((mapSizeX - 4) * (mapSizeY - 4))
// //
#define gmEmpty 0 #define gmEmpty 0
@ -378,11 +376,15 @@ struct hiScoreFile
/// ///
hiScoreFile *top10Heroes = NULL; hiScoreFile *top10Heroes = NULL;
sProcessInfo process_info;
// çàãîëîâîê ãëàâíîãî îêíà // çàãîëîâîê ãëàâíîãî îêíà
char MainWindowTitle[] = "XONIX (C) MMVI by Rabid Rabbit"; char MainWindowTitle[] = "XONIX (C) MMVI by Rabid Rabbit";
char WindowTitle[128];
char Top10WndTitle[] = "Top 10";
#if LANG == RUS #if LANG == RUS
char goWndTitle[] = "“஢¥­ì %U, § ¢¥à襭® %U%%, ¦¨§­¥©: %U, áçñâ: %U"; char goWndTitle[] = "“஢¥­ì %U, § ¢¥à襭® %U%%, ¦¨§­¥©: %U, áçñâ: %U";
char goWndTitleSuperHero[] = "“஢¥­ì %U, § ¢¥à襭® %U%%, ¦¨§­¥©: %U, áçñâ: %U, á㯥ࣥன: %U%%";
char menuStr1[] = "1. <20> ç âì ¨£àã"; char menuStr1[] = "1. <20> ç âì ¨£àã";
char menuStr2[] = "2. ‚ë室"; char menuStr2[] = "2. ‚ë室";
char menuStr3[] = "“¯à ¢«¥­¨¥: <E28098>Šˆ - ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï."; char menuStr3[] = "“¯à ¢«¥­¨¥: <E28098>Šˆ - ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï.";
@ -394,6 +396,7 @@ char top10str1[] = "ENTER -
char top10str2[] = "ESC - ¢ë室 ¢ ¬¥­î"; char top10str2[] = "ESC - ¢ë室 ¢ ¬¥­î";
#else #else
char goWndTitle[] = "Level %U, completed %U%%, lives: %U, scores: %U"; char goWndTitle[] = "Level %U, completed %U%%, lives: %U, scores: %U";
char goWndTitle[] = "Level %U, completed %U%%, lives: %U, scores: %U, superhero: %U%%";
char menuStr1[] = "1. Start game"; char menuStr1[] = "1. Start game";
char menuStr2[] = "2. Exit"; char menuStr2[] = "2. Exit";
char menuStr3[] = "Control: ARROWS - direction of movement."; char menuStr3[] = "Control: ARROWS - direction of movement.";
@ -412,8 +415,8 @@ int heroDX = 0, heroDY = 0, lastMoveDirection = 0;
// //
Byte * worldMap = NULL; Byte * worldMap = NULL;
// //
int wndSizeX = ENTRY_WND_SIZE_X; int wndSizeX = 0;
int wndSizeY = ENTRY_WND_SIZE_Y; int wndSizeY = 0;
int mapSizeX = 64; int mapSizeX = 64;
int mapSizeY = 32; int mapSizeY = 32;
int loopDelay = DEFAULT_LOOP_DELAY; int loopDelay = DEFAULT_LOOP_DELAY;
@ -903,10 +906,11 @@ void checkAndSetBonus1()
Dword i; Dword i;
// //
if ( (!bonus1Set) if ((!bonus1Set)
&& rtlRand() > 0x80000000 && rtlRand() > 0x80000000
&& lifeCount < 2 && lifeCount < 2
&& GetCompletePercents() > 75 ) && GetCompletePercents() > 75 )
{ {
// //
bonus1Set = true; bonus1Set = true;
@ -1350,7 +1354,7 @@ void ApplyMapDiffs( bool drawTitle )
int i, j; int i, j;
// //
kos_WindowRedrawStatus( 1 ); // kos_WindowRedrawStatus( 1 );
// //
if ( drawTitle ) drawWndTitleGo(); if ( drawTitle ) drawWndTitleGo();
// //
@ -1358,24 +1362,16 @@ void ApplyMapDiffs( bool drawTitle )
// //
for ( i = 0; i < j; i++ ) for ( i = 0; i < j; i++ )
{ {
////
//kos_DrawBar(
// wndXOffet + ( ( ( mapDiffList[i].elPtr - worldMap ) % mapSizeX ) * blockSize ),
// wndYOffset + ( ( ( mapDiffList[i].elPtr - worldMap ) / mapSizeX ) * blockSize ),
// blockSize, blockSize,
// mapColours[mapDiffList[i].mapEl]
//);
//
kos_PutImage( kos_PutImage(
mapColours[mapDiffList[i].mapEl], mapColours[mapDiffList[i].mapEl],
blockSize, blockSize,
blockSize, blockSize,
wndXOffet + ( ( ( mapDiffList[i].elPtr - worldMap ) % mapSizeX ) * blockSize ), ( ( mapDiffList[i].elPtr - worldMap ) % mapSizeX ) * blockSize,
wndYOffset + ( ( ( mapDiffList[i].elPtr - worldMap ) / mapSizeX ) * blockSize ) ( ( mapDiffList[i].elPtr - worldMap ) / mapSizeX ) * blockSize
); );
} }
// //
kos_WindowRedrawStatus( 2 ); // kos_WindowRedrawStatus( 2 );
// //
mapDiffList.Clear(); mapDiffList.Clear();
} }
@ -1461,20 +1457,21 @@ void SetGameVars()
scoreCount = 0; scoreCount = 0;
enterName = -1; enterName = -1;
// //
wndSizeX = ((mapSizeX*blockSize)+2); wndSizeX = ((mapSizeX*blockSize) + 5*2);
wndSizeY = ((mapSizeY*blockSize)+23); wndSizeY = ((mapSizeY*blockSize) + kos_GetSkinHeight() + 5);
// //
kos_ChangeWindow( -1, -1, wndSizeX, wndSizeY ); kos_ChangeWindow( -1, -1, wndSizeX-1, wndSizeY-1 );
} }
// //
void SetEntryVars() void SetEntryVars()
{ {
// //
wndSizeX = ENTRY_WND_SIZE_X; wndSizeX = ENTRY_CLIENT_SIZE_X + 5*2;
wndSizeY = ENTRY_WND_SIZE_Y; wndSizeY = ENTRY_CLIENT_SIZE_Y + kos_GetSkinHeight() + 5;
// //
kos_ChangeWindow( -1, -1, wndSizeX, wndSizeY ); kos_SetWindowCaption(MainWindowTitle);
kos_ChangeWindow( -1, -1, wndSizeX-1, wndSizeY-1 );
kos_SetKeyboardDataMode( KM_SCANS ); kos_SetKeyboardDataMode( KM_SCANS );
} }
@ -1521,8 +1518,10 @@ void SetUpTop10()
while ( kos_CheckForEvent() == 2 ) kos_GetKey( keyCode ); while ( kos_CheckForEvent() == 2 ) kos_GetKey( keyCode );
// //
kos_SetKeyboardDataMode( KM_CHARS ); kos_SetKeyboardDataMode( KM_CHARS );
kos_SetWindowCaption(Top10WndTitle);
// //
kos_ChangeWindow( -1, -1, TOP10_WND_SIZE_X, TOP10_WND_SIZE_Y ); kos_ChangeWindow(-1, -1, TOP10_CLIENT_SIZE_X + 5 * 2 - 1, TOP10_CLIENT_SIZE_Y + kos_GetSkinHeight() + 5 - 1);
// //
for ( i = 0; i < TOP_TBL_SIZE; i++ ) for ( i = 0; i < TOP_TBL_SIZE; i++ )
{ {
@ -1559,13 +1558,16 @@ void kos_Main()
bool workOn = true; bool workOn = true;
char *cPtr; char *cPtr;
wndSizeX = ENTRY_CLIENT_SIZE_X + 5 * 2;
wndSizeY = ENTRY_CLIENT_SIZE_Y + kos_GetSkinHeight() + 5;
// îòäåëÿåì èìÿ ìîäóëÿ îò ïóòè // îòäåëÿåì èìÿ ìîäóëÿ îò ïóòè
cPtr = strrchr( kosExePath, '/' ); cPtr = strrchr( kosExePath, '/' );
// ïðîâåðêà ;) // ïðîâåðêà ;)
if ( cPtr == NULL ) if ( cPtr == NULL )
{ {
// //
rtlDebugOutString( "Invalid path to executable." ); rtlDebugOutString( "xonix: Invalid path to executable." );
// //
return; return;
} }
@ -1606,7 +1608,7 @@ void kos_Main()
appState = appStateGo; appState = appStateGo;
SetGameVars(); SetGameVars();
initWorldMap(); initWorldMap();
DrawAppWindow(); // DrawAppWindow();
break; break;
// //
@ -1645,14 +1647,18 @@ void kos_Main()
break; break;
// //
case BT_LOOP_MINUS: case BT_LOOP_MINUS:
loopDelay++;; loopDelay++;
if ( loopDelay > MAX_LOOP_DELAY ) loopDelay = MAX_LOOP_DELAY; if ( loopDelay > MAX_LOOP_DELAY ) loopDelay = MAX_LOOP_DELAY;
break; break;
// //
case BT_LOOP_PLUS: case BT_LOOP_PLUS:
loopDelay--;; loopDelay--;
if ( loopDelay < MIN_LOOP_DELAY ) loopDelay = MIN_LOOP_DELAY; if ( loopDelay < MIN_LOOP_DELAY ) loopDelay = MIN_LOOP_DELAY;
break; break;
case 1:
xonixFree();
workOn = false;
break;
// //
default: default:
break; break;
@ -1803,6 +1809,14 @@ void kos_Main()
break; break;
// //
case 3:
kos_GetButtonID(buttonID);
if (buttonID == 1)
{
xonixFree();
workOn = false;
}
break;
default: default:
// //
if ( MoveHero() ) if ( MoveHero() )
@ -1848,16 +1862,13 @@ void kos_Main()
break; break;
// //
case 3: case 3:
if ( kos_GetButtonID( buttonID ) ) kos_GetButtonID(buttonID);
if ( buttonID == 1 )
{ {
// //
if ( buttonID == 1 ) appState = appStateTop10;
{ SetUpTop10();
// DrawAppWindow();
appState = appStateTop10;
SetUpTop10();
DrawAppWindow();
}
} }
// //
default: default:
@ -1930,6 +1941,14 @@ void kos_Main()
// //
break; break;
// //
case 3:
kos_GetButtonID(buttonID);
if (buttonID == 1)
{
xonixFree();
workOn = false;
}
break;
default: default:
break; break;
} }
@ -1951,7 +1970,14 @@ void kos_Main()
appState = appStateGo; appState = appStateGo;
} }
break; break;
case 3:
kos_GetButtonID(buttonID);
if (buttonID == 1)
{
xonixFree();
workOn = false;
}
break;
default: default:
break; break;
} }
@ -2021,46 +2047,50 @@ void DrawEntryScreen()
{ {
PRINTK pr; PRINTK pr;
char line[64]; char line[64];
// //
kos_DefineAndDrawWindow( kos_DefineAndDrawWindow(
100, 100, 100, 100,
wndSizeX, wndSizeY, wndSizeX-1, wndSizeY-1,
0x34, 0,
0, 0, 0, 0,
0, 0x2040A0, MainWindowTitle
0x2040A0
); );
// //
if (process_info.processInfo.window_state & 0x06)
return;
/*
kos_WriteTextToWindow( kos_WriteTextToWindow(
4, 4, 4, 4,
0x10, 0x42D2E2, 0x10, 0x42D2E2,
MainWindowTitle, MainWindowTitle,
sizeof( MainWindowTitle ) - 1 sizeof( MainWindowTitle ) - 1
); );
*/
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
8, 32, 8-1, 32-21,
0x10, 0x12FF12, 0x10, 0x12FF12,
menuStr1, menuStr1,
sizeof( menuStr1 ) - 1 sizeof( menuStr1 ) - 1
); );
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
8, 48, 8-1, 48-21,
0x10, 0x12FF12, 0x10, 0x12FF12,
menuStr2, menuStr2,
sizeof( menuStr2 ) - 1 sizeof( menuStr2 ) - 1
); );
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
8, 80, 8-1, 80-21,
0x10, 0xD0FF12, 0x10, 0xD0FF12,
menuStr3, menuStr3,
sizeof( menuStr3 ) - 1 sizeof( menuStr3 ) - 1
); );
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
8, 96, 8-1, 96-21,
0x10, 0xD0FF12, 0x10, 0xD0FF12,
menuStr4, menuStr4,
sizeof( menuStr4 ) - 1 sizeof( menuStr4 ) - 1
@ -2072,47 +2102,55 @@ void DrawEntryScreen()
sprintk( line, &pr ); sprintk( line, &pr );
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
8, 112, 8-1, 112-21,
0x10, 0x12C0D0, 0x10, 0x12C0D0,
line, line,
strlen( line ) strlen( line )
); );
// êíîïêè X // êíîïêè X
// xo oo
// oo
kos_DefineButton( kos_DefineButton(
ENTRY_WND_SIZE_X - 58, 112, ENTRY_CLIENT_SIZE_X - 62, 112-24,
12, 12, 13, 13,
BT_SIZE_X_MINUS, BT_SIZE_X_MINUS,
0xCCCCCC 0xCCCCCC
); );
// //
kos_PutImage( bmPMButton + 12, 6, 2, ENTRY_WND_SIZE_X - 58 + 3, 117 ); kos_PutImage( bmPMButton + 12, 6, 2, ENTRY_CLIENT_SIZE_X - (62-1) + 3, 117-23 );
// //
// ox oo
// oo
kos_DefineButton( kos_DefineButton(
ENTRY_WND_SIZE_X - 45, 112, ENTRY_CLIENT_SIZE_X - 48, 112-24,
12, 12, 13, 13,
BT_SIZE_X_PLUS, BT_SIZE_X_PLUS,
0xCCCCCC 0xCCCCCC
); );
// //
kos_PutImage( bmPMButton, 6, 6, ENTRY_WND_SIZE_X - 45 + 3, 115 ); kos_PutImage( bmPMButton, 6, 6, ENTRY_CLIENT_SIZE_X - (48-1) + 3, 115-23 );
// êíîïêè Y // êíîïêè Y
// oo xo
// oo
kos_DefineButton( kos_DefineButton(
ENTRY_WND_SIZE_X - 29, 112, ENTRY_CLIENT_SIZE_X - 31, 112-24,
12, 12, 13, 13,
BT_SIZE_Y_MINUS, BT_SIZE_Y_MINUS,
0xCCCCCC 0xCCCCCC
); );
// //
kos_PutImage( bmPMButton + 12, 6, 2, ENTRY_WND_SIZE_X - 29 + 3, 117 ); kos_PutImage( bmPMButton + 12, 6, 2, ENTRY_CLIENT_SIZE_X - (31-1) + 3, 117-23 );
// //
// oo ox
// oo
kos_DefineButton( kos_DefineButton(
ENTRY_WND_SIZE_X - 16, 112, ENTRY_CLIENT_SIZE_X - 17, 112-24,
12, 12, 13, 13,
BT_SIZE_Y_PLUS, BT_SIZE_Y_PLUS,
0xCCCCCC 0xCCCCCC
); );
// //
kos_PutImage( bmPMButton, 6, 6, ENTRY_WND_SIZE_X - 16 + 3, 115 ); kos_PutImage( bmPMButton, 6, 6, ENTRY_CLIENT_SIZE_X - (17-1) + 3, 115-23 );
// //
//çàäåðæêà â öèêëå âûáîðêè ñîîáùåíèé //çàäåðæêà â öèêëå âûáîðêè ñîîáùåíèé
pr.fmtline = mainLoopDelayStr; pr.fmtline = mainLoopDelayStr;
@ -2120,79 +2158,82 @@ void DrawEntryScreen()
sprintk( line, &pr ); sprintk( line, &pr );
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
8, 128, 8-1, 128-21,
0x10, 0x12C0D0, 0x10, 0x12C0D0,
line, line,
strlen( line ) strlen( line )
); );
// //
kos_DefineButton( kos_DefineButton(
ENTRY_WND_SIZE_X - 29, 128, ENTRY_CLIENT_SIZE_X - 31, 128-23,
12, 12, 13, 13,
BT_LOOP_MINUS, BT_LOOP_MINUS,
0xCCCCCC 0xCCCCCC
); );
// //
kos_PutImage( bmPMButton + 12, 6, 2, ENTRY_WND_SIZE_X - 29 + 3, 133 ); kos_PutImage( bmPMButton + 12, 6, 2, ENTRY_CLIENT_SIZE_X - (31-1) + 3, 133-22 );
// //
kos_DefineButton( kos_DefineButton(
ENTRY_WND_SIZE_X - 16, 128, ENTRY_CLIENT_SIZE_X - 17, 128-23,
12, 12, 13, 13,
BT_LOOP_PLUS, BT_LOOP_PLUS,
0xCCCCCC 0xCCCCCC
); );
// //
kos_PutImage( bmPMButton, 6, 6, ENTRY_WND_SIZE_X - 16 + 3, 131 ); kos_PutImage( bmPMButton, 6, 6, ENTRY_CLIENT_SIZE_X - (17-1) + 3, 131-22 );
} }
// //
void DrawAppWindow() void DrawAppWindow()
{ {
//
kos_WindowRedrawStatus( 1 ); kos_WindowRedrawStatus( 1 );
kos_ProcessInfo(&process_info, -1);
switch ( appState ) switch (appState)
{ {
// //
case appStateTop10: case appStateTop10:
DrawTop10Window(); DrawTop10Window();
break; break;
// //
case appStateEntry: case appStateEntry:
// //
DrawEntryScreen(); DrawEntryScreen();
break; break;
// //
case appStateGo: case appStateGo:
case appStateShowMap: case appStateShowMap:
case appStatePause: case appStatePause:
if (process_info.processInfo.window_state & 0x06)
{
appState = appStatePause;
}
drawWorldMap(); drawWorldMap();
break; break;
// //
case appStateAfterDeath: case appStateAfterDeath:
// //
drawWorldMap(); drawWorldMap();
// //
kos_DefineButton( kos_DefineButton(
( wndSizeX / 2 ) - 64, ((wndSizeX - 10) / 2) - 64,
( wndSizeY / 2 ) - 16, ((wndSizeY - kos_GetSkinHeight() - 5) / 2) - 16,
128, 32, 128, 32,
1, 1,
0x136793 0x136793
); );
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
( wndSizeX / 2 ) - ( sizeof( thatsAllStr ) * 4 ), ((wndSizeX - 10) / 2) - (sizeof(thatsAllStr)* 4),
( wndSizeY / 2 ) - 4, ((wndSizeY - kos_GetSkinHeight() - 5) / 2) - 4,
0x10, 0xFFFFFF, 0x10, 0xFFFFFF,
thatsAllStr, thatsAllStr,
sizeof ( thatsAllStr ) - 1 sizeof (thatsAllStr)-1
); );
//
//
break; break;
// //
case appStateHideMap: case appStateHideMap:
drawWorldMapForFlip(); drawWorldMapForFlip();
break; break;
@ -2313,10 +2354,10 @@ void drawWorldMap()
// //
kos_DefineAndDrawWindow( kos_DefineAndDrawWindow(
100, 100, 100, 100,
wndSizeX, wndSizeY, wndSizeX-1, wndSizeY-1,
0x74, 0,
0, 0, 0, 0,
0, 0x2040A0, MainWindowTitle
0x2040A0
); );
// //
drawWndTitleGo(); drawWndTitleGo();
@ -2342,30 +2383,66 @@ int GetCompletePercents()
void drawWndTitleGo() void drawWndTitleGo()
{ {
PRINTK pr; PRINTK pr;
char line[64]; static char prev_title[64] = {'\0'};
// //
/*
kos_DrawBar( kos_DrawBar(
1, 1, 1, 1,
wndSizeX - 2, 18, wndSizeX - 2, 18,
0x2040A0 0x2040A0
); );
*/
// //
pr.fmtline = goWndTitle; //pr.fmtline = goWndTitle;
pr.args[0] = currentLevel; pr.args[0] = currentLevel;
pr.args[1] = GetCompletePercents(); pr.args[1] = GetCompletePercents();
pr.args[2] = lifeCount; pr.args[2] = lifeCount;
pr.args[3] = scoreCount; pr.args[3] = scoreCount;
sprintk( line, &pr );
if (bonus1Count > 0)
{
pr.args[4] = 100*bonus1Count/BONUS1_LIFETIME;
pr.fmtline = goWndTitleSuperHero;
}
else
{
pr.fmtline = goWndTitle;
}
sprintk(WindowTitle, &pr);
// //
bool same = true;
for (int i = 0; i < 64; i++)
{
if (WindowTitle[i] != prev_title[i])
{
same = false;
break;
}
if ((WindowTitle[i] == '\0') || (prev_title[i] == '\0'))
{
break;
}
}
if (!same)
{
kos_SetWindowCaption(WindowTitle);
strcpy(prev_title, WindowTitle);
}
/*
kos_WriteTextToWindow( kos_WriteTextToWindow(
4, 4, 4, 4,
0x10, 0x42D2E2, 0x10, 0x42D2E2,
line, line,
strlen( line ) strlen( line )
); );
*/
// //
/*
if ( bonus1Count > 0 ) if ( bonus1Count > 0 )
{ {
// //
@ -2380,7 +2457,8 @@ void drawWndTitleGo()
( bonus1Count * ( wndSizeX - 4 ) ) / BONUS1_LIFETIME, BONUS1_IND_HSIZE, ( bonus1Count * ( wndSizeX - 4 ) ) / BONUS1_LIFETIME, BONUS1_IND_HSIZE,
0x5720B0 0x5720B0
); );
}
}*/
} }
// //
@ -2389,26 +2467,20 @@ void drawWorldMapForFlip()
int i, j; int i, j;
Byte *mPtr = worldMap; Byte *mPtr = worldMap;
if (process_info.processInfo.window_state & 0x06)
return;
// //
for ( i = 0; i < mapSizeY; i++ ) for ( i = 0; i < mapSizeY; i++ )
{ {
// //
for ( j = 0; j < mapSizeX; j++ ) for ( j = 0; j < mapSizeX; j++ )
{ {
////
//kos_DrawBar(
// wndXOffet + ( j * blockSize ),
// wndYOffset + ( i * blockSize ),
// blockSize, blockSize,
// mapColours[*mPtr]
//);
//
kos_PutImage( kos_PutImage(
mapColours[*mPtr], mapColours[*mPtr],
blockSize, blockSize,
blockSize, blockSize,
wndXOffet + ( j * blockSize ), j * blockSize,
wndYOffset + ( i * blockSize ) i * blockSize
); );
// //
mPtr++; mPtr++;
@ -2445,9 +2517,6 @@ void clearWorldMap()
} }
//
char Top10WndTitle[] = "Top 10";
// //
void DrawTop10Window() void DrawTop10Window()
{ {
@ -2456,24 +2525,28 @@ void DrawTop10Window()
// //
kos_DefineAndDrawWindow( kos_DefineAndDrawWindow(
100, 100, 100, 100,
TOP10_WND_SIZE_X, TOP10_WND_SIZE_Y,
0, 0, 0, 0,
0, 0x2040A0, 0x34, 0,
0x2040A0 0, 0,
Top10WndTitle
); );
// //
if (process_info.processInfo.window_state & 0x06)
return;
/*
kos_WriteTextToWindow( kos_WriteTextToWindow(
4, 4, 4, 4,
0x0, 0x42D2E2, 0x0, 0x42D2E2,
Top10WndTitle, Top10WndTitle,
sizeof( Top10WndTitle ) - 1 sizeof( Top10WndTitle ) - 1
); );
*/
// //
for ( i = 0; i < TOP_TBL_SIZE; i++ ) for ( i = 0; i < TOP_TBL_SIZE; i++ )
{ {
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
6, wndYOffset + 2 + (i * 10), 6-1, 2 + (i * 10),
0x0, enterName != i ? 0xFFFFFF : 0x00FF00, 0x0, enterName != i ? 0xFFFFFF : 0x00FF00,
heroTbl[i].name, heroTbl[i].name,
sizeof( heroTbl[0].name ) sizeof( heroTbl[0].name )
@ -2482,7 +2555,7 @@ void DrawTop10Window()
kos_DisplayNumberToWindow( kos_DisplayNumberToWindow(
heroTbl[i].score, heroTbl[i].score,
8, 8,
112, wndYOffset + 2 + (i * 10), 112-1, 2 + (i * 10),
0xFFFF55, 0xFFFF55,
nbDecimal, nbDecimal,
false false
@ -2490,7 +2563,7 @@ void DrawTop10Window()
} }
// //
kos_WriteTextToWindow( kos_WriteTextToWindow(
6, wndYOffset + 6 + (i * 10), 6-1, 6 + (i * 10),
0x10, 0x1060D0, 0x10, 0x1060D0,
enterName >= 0 ? top10str1 : top10str2, enterName >= 0 ? top10str1 : top10str2,
enterName >= 0 ? sizeof(top10str1) - 1 : sizeof(top10str2) - 1 enterName >= 0 ? sizeof(top10str1) - 1 : sizeof(top10str2) - 1