C4: update window, -1 IMG sector

git-svn-id: svn://kolibrios.org@7982 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-25 15:20:10 +00:00
parent 5df2bd058a
commit 559d0cc062
4 changed files with 13 additions and 51 deletions

View File

@ -14,9 +14,13 @@
#code32 TRUE #code32 TRUE
#ifndef ENTRY_POINT
#define ENTRY_POINT #______INIT______
#endif
char os_name[8] = {'M','E','N','U','E','T','0','1'}; char os_name[8] = {'M','E','N','U','E','T','0','1'};
dword os_version = 0x00000001; dword os_version = 0x00000001;
dword start_addr = #______INIT______; dword start_addr = ENTRY_POINT;
dword final_addr = #______STOP______+32; dword final_addr = #______STOP______+32;
dword alloc_mem = MEMSIZE; dword alloc_mem = MEMSIZE;
dword x86esp_reg = MEMSIZE; dword x86esp_reg = MEMSIZE;
@ -644,7 +648,7 @@ inline fastcall dword GetStartTime()
dword __generator; // random number generator init dword __generator; // random number generator init
//The initialization of the initial data before running //The initialization of the initial data before running
void ______INIT______() :void ______INIT______()
{ {
skin_height = @GetSkinHeight(); skin_height = @GetSkinHeight();
screen.width = @GetScreenWidth()+1; screen.width = @GetScreenWidth()+1;

View File

@ -5,6 +5,8 @@
*/ */
#define MEMSIZE 1024 * 20 #define MEMSIZE 1024 * 20
#define ENTRY_POINT #main
#include "..\lib\gui.h" #include "..\lib\gui.h"
#include "..\lib\random.h" #include "..\lib\random.h"
@ -104,7 +106,7 @@ void main()
case evReDraw: case evReDraw:
sc.get(); sc.get();
DefineAndDrawWindow(215,100,WIN_W + 9,WIN_H+4+skin_height, DefineAndDrawWindow(215,100,WIN_W + 9,WIN_H+4+GetSkinHeight(),
0x34,0xC0C0C0,"Memory Blocks",0); 0x34,0xC0C0C0,"Memory Blocks",0);
Draw_Panel(); Draw_Panel();
Draw_Game_Pole(); Draw_Game_Pole();

View File

@ -719,12 +719,12 @@ updatePlayerStatusText:
; ;
; window definition ; window definition
; ;
windowtitle db "C4 0.1",0 windowtitle db "C4",0
window: window:
istruc WND istruc WND
at WND.xposandsize, dd MOS_DWORD(0,WND_WIDTH) at WND.xposandsize, dd MOS_DWORD(0,WND_WIDTH)
at WND.yposandsize, dd MOS_DWORD(0,WND_HEIGHT) at WND.yposandsize, dd MOS_DWORD(0,WND_HEIGHT)
at WND.workcolor, dd 0x03000000 | WND_WORKCOLOR at WND.workcolor, dd 0x14000000 | WND_WORKCOLOR
at WND.grabcolor, dd 0 at WND.grabcolor, dd 0
at WND.framecolor, dd 0 at WND.framecolor, dd 0
at WND.caption, dd windowtitle at WND.caption, dd windowtitle

View File

@ -128,59 +128,15 @@ drawWindow:
mov cx,[edi + WND.yposandsize] mov cx,[edi + WND.yposandsize]
.positionok: ; ebx/ecx contain dimensions .positionok: ; ebx/ecx contain dimensions
;
; colors
;
push edi push edi
mov edx,[edi + WND.workcolor]
test dword [edi + WND.flags],WND_DEFAULT_WORKCOLOR
jz short .workcolorok
and edx,0xff000000
or edx,[WNDCOLORS + MOS_WNDCOLORS.work]
.workcolorok:
mov esi,[edi + WND.grabcolor]
test dword [edi + WND.flags],WND_DEFAULT_GRABCOLOR
jz short .grabcolorok
and esi,0xff000000
or esi,[WNDCOLORS + MOS_WNDCOLORS.grab]
.grabcolorok:
test dword [edi + WND.flags],WND_DEFAULT_FRAMECOLOR
mov edi,[edi + WND.framecolor]
jz short .framecolorok
and edi,0xff000000
or edi,[WNDCOLORS + MOS_WNDCOLORS.frame]
.framecolorok:
; define window ; define window
mov eax,MOS_SC_DEFINEWINDOW mov eax,MOS_SC_DEFINEWINDOW
mov edx,[edi + WND.workcolor]
mov edi,windowtitle
int 0x40 int 0x40
pop edi pop edi
;
; caption
;
cmp dword [edi + WND.caption],0 ; is there a caption ?
je short .captionok ; nope -> do nothing
mov ebx,MOS_DWORD(8,8) ; ebx = position
mov edx,[edi + WND.caption] ; edx -> string
push edi ; get string length
mov edi,edx
mov ecx,-1
xor al,al ; scan for zero byte
repne scasb
sub edi,edx
dec edi
mov esi,edi
pop edi ; esi = string length
mov ecx,[edi + WND.captioncolor]
test dword [edi + WND.flags],WND_DEFAULT_CAPTIONCOLOR
jz short .captioncolorok
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabText]
.captioncolorok:
mov eax,MOS_SC_WRITETEXT
int 0x40
.captionok:
popad popad
popfd popfd
leave leave