diff --git a/programs/bcc32/games/blocks/models/model_b1_scarlet_macaw.bjs b/programs/bcc32/games/blocks/models/model_b1_scarlet_macaw.bjs new file mode 100644 index 0000000000..ab2103f1c1 --- /dev/null +++ b/programs/bcc32/games/blocks/models/model_b1_scarlet_macaw.bjs @@ -0,0 +1,115 @@ +// block name, color, step, coord: x,y,z, rotation: x,y,z + +const m1 = 0xff0000; //red +const m2 = 0xff; //blue +const m3 = 0x808080; //gray +const m4 = 0xffff00; //yellow +const m5 = 0x080808; //black +const m6 = 0xffffff; //white + +model_list=[ +['b10x10x1', m3, 0,-20, -20, 0, 0,0,0], +['b2x3x1', m1, 1, 0, 4, 39, 0,0,90], +['b1x1x1', m1, 1, 0, 0, 39, 0,0,0], +['b1x1x1', m1, 1, -8, 0, 39, 0,0,0], +['b1x3x1', m2, 1, 0, 12, 39, 0,0,90], +['b1x4x1', m2, 1, 4, 8, 39, 0,0,0], +['b1x4x1', m2, 1,-12, 8, 39, 0,0,0], +['b1x4x1', m2, 2,-12, 4, 42, 0,0,0], +['b1x4x1', m2, 2, 4, 4, 42, 0,0,0], +['b1x4x1', m1, 2, -8, -4, 42, 0,0,0], +['b1x4x1', m1, 2, 0, -4, 42, 0,0,0], +['b1x3x1', m2, 2, 0, 12, 42, 0,0,90], +['b2x4x1', m2, 3,-12, 0, 45, 0,0,0], +['b2x4x1', m2, 3, 0, 0, 45, 0,0,0], +['b1x2x1', m4, 3, -4, 8, 45, 0,0,0], +['b2x3x1', m1, 3, 0, -8, 45, 0,0,90], +['b2x3x1', m1, 4, 0,-12, 48, 0,0,90], +['b2x4x1', m2, 4, 0, -4, 48, 0,0,0], +['b2x4x1', m2, 4,-12, -4, 48, 0,0,0], +['b1x3x1', m4, 4, 0, 12, 48, 0,0,90], +['b1x3x1', m4, 5, 0, 12, 51, 0,0,90], +['b2x2x1', m4, 5,-12, 4, 51, 0,0,0], +['b2x2x1', m4, 5, 0, 4, 51, 0,0,0], +['b2x3x1', m2, 5,-12, -8, 51, 0,0,0], +['b2x3x1', m2, 5, 0, -8, 51, 0,0,0], +['b1x3x1', m1, 5, 0,-12, 51, 0,0,90], +['b2x3x1', m1, 6, 0,-16, 54, 0,0,90], +['b2x3x1', m1, 6, 0, 8, 54, 0,0,90], +['b1x2x1', m2, 6,-12,-12, 54, 0,0,0], +['b1x2x1', m2, 6, 4,-12, 54, 0,0,0], +['b1x4x1', m4, 6,-12, -4, 54, 0,0,0], +['b1x4x1', m4, 6, 4, -4, 54, 0,0,0], +['b2x3x1', m1, 7, 0,-16, 57, 0,0,90], +['b2x3x1', m1, 7, 0, 4, 57, 0,0,90], +['b1x1x1', m2, 7,-12,-12, 57, 0,0,0], +['b1x1x1', m2, 7, 4,-12, 57, 0,0,0], +['b1x4x1', m4, 7,-12, -8, 57, 0,0,0], +['b1x4x1', m4, 7, 4, -8, 57, 0,0,0], +['b1x2x1', m4, 8,-12,-12, 60, 0,0,0], +['b1x2x1', m4, 8, 4,-12, 60, 0,0,0], +['b2x3x1', m1, 8, 0,-16, 60, 0,0,90], +['b2x3x1', m1, 8,-12, -4, 60, 0,0,0], +['b2x3x1', m1, 8, 0, -4, 60, 0,0,0], +['b1x3x1', m1, 8, 0, 8, 60, 0,0,90], +['b2x3x1', m1, 9, 0,-12, 63, 0,0,90], +['b2x3x1', m1, 9, 0, 0, 63, 0,0,90], +['b1x4x1', m1, 9,-12,-12, 63, 0,0,0], +['b1x4x1', m1, 9, 4,-12, 63, 0,0,0], +['b2x3x1', m1, 10,-12, -8, 66, 0,0,0], +['b1x3x1', m1, 10, -4, -8, 66, 0,0,0], +['b2x3x1', m1, 10, 0, -8, 66, 0,0,0], +['b1x3x1', m6, 10, 0,-12, 66, 0,0,90], +['b1x3x1', m5, 10, 0,-16, 66, 0,0,90], +['b1x3x1', m5, 10, 0,-20, 66, 0,0,90], +['b1x1x1', m5, 10, -4,-32, 66, 0,0,0], +['b1x1x1', m6, 11, -4,-32, 69, 0,0,0], +['b2x3x1', m6, 11, 0,-16, 69, 0,0,90], +['b1x3x1', m5, 11, -4,-28, 69, 0,0,0], +['b1x1x1', m5, 11, -8,-20, 69, 0,0,0], +['b1x1x1', m5, 11, 0,-20, 69, 0,0,0], +['b1x3x1', m1, 11, 0, 0, 69, 0,0,90], +['b2x3x1', m1, 11, 0, -8, 69, 0,0,90], +['b1x3x1', m6, 12, -4,-32, 72, 0,0,0], +['b2x3x1', m6, 12, 0,-20, 72, 0,0,90], +['b1x3x1', m6, 12, 0,-12, 72, 0,0,90], +['b2x3x1', m1, 12, 0, -8, 72, 0,0,90], +['b1x3x1', m6, 13, -4,-28, 75, 0,0,0], +['b1x3x1', m6, 13, 0,-12, 75, 0,0,90], +['c1x1x1', m5, 13, -8,-16, 75, 0,0,0], +['c1x1x1', m5, 13, 0,-16, 75, 0,0,0], +['b2x3x1', m1, 13, 0, -8, 75, 0,0,90], +['b2x3x1', m6, 14, 0,-20, 78, 0,0,90], +['b1x1x1', m6, 14, -4,-24, 78, 0,0,0], +['b2x3x1', m1, 14, 0,-12, 78, 0,0,90], +['b2x3x1', m1, 15, 0,-16, 81, 0,0,90], +['b1x3x1', m1, 15, 0,-20, 81, 0,0,90], +['b2x2x1', m3, 16, 8, -4, 3, 0,0,0], +['b2x2x1', m3, 17, 8, -4, 6, 0,0,0], +['b2x2x1', m3, 18, 8, -4, 9, 0,0,0], +['b2x2x1', m3, 19, 8, -4, 12, 0,0,0], +['b2x2x1', m3, 20, 8, -4, 15, 0,0,0], +['b2x2x1', m3, 21, 8, -4, 18, 0,0,0], +['b2x2x1', m3, 22, 8, -4, 21, 0,0,0], +['b2x2x1', m3, 23, 8, -4, 24, 0,0,0], +['b2x2x1', m3, 24, 8, -4, 27, 0,0,0], +['b2x2x1', m3, 25, 8, -4, 30, 0,0,0], +['b2x8x1', m3, 25, 4, -4, 30, 0,0,90], +['b2x8x1', m3, 26, 16, -4, 33, 0,0,90], +['c1x1x1', m5, 26, -8, -8, 33, 0,0,0], +['c1x1x1', m5, 26, 0, -8, 33, 0,0,0], +['b1x3x1', m6, 27, -8, -8, 36, 0,0,0], +['b1x3x1', m6, 27, 0, -8, 36, 0,0,0], +['b1x1x1', m2, 28, -4, 12, 9, 0,0,90], +['b1x1x1', m2, 29, -4, 12, 12, 0,0,90], +['b1x2x1', m2, 30, -2, 12, 15, 0,0,90], +['b1x2x1', m2, 31, -2, 12, 18, 0,0,90], +['b1x2x1', m1, 32, -2, 12, 21, 0,0,90], +['b1x3x1', m1, 33, 0, 12, 24, 0,0,90], +['b1x3x1', m1, 34, 0, 12, 27, 0,0,90], +['b1x1x1', m1, 35, -4, 12, 30, 0,0,0], +['b1x1x1', m2, 36, -8, 12, 30, 0,0,0], +['b1x1x1', m2, 37, 0, 12, 30, 0,0,0], +['b2x3x1', m2, 38, 0, 8, 33, 0,0,90], +['b2x3x1', m2, 39, 0, 8, 36, 0,0,90], +]; \ No newline at end of file diff --git a/programs/bcc32/include/kos_lib.h b/programs/bcc32/include/kos_lib.h index df9ed88540..9c85c298f9 100644 --- a/programs/bcc32/include/kos_lib.h +++ b/programs/bcc32/include/kos_lib.h @@ -1,8 +1,13 @@ +#ifndef __KOS_LIB_H_INCLUDED_ +#define __KOS_LIB_H_INCLUDED_ + +int memcmp(const void *buf1, const void *buf2, long int count); +void *memcpy(void *dest, const void *src, unsigned int n); +void *memset(void *s, char c, unsigned int n); unsigned int strlen(const char *str); char *strcpy(char *dest, const char *src); -void *memcpy(void *dest, const void *src, unsigned int n); -void *memset(void *s, char c, unsigned int n); +char *strncpy(char *dest, const char *src, long int n); int strcmp(const char *str1, const char *str2); char *strchr(const char *str, int ch); char *strstr(const char *str1, const char *str2); @@ -12,4 +17,6 @@ const char *DoubleToStr(double x, unsigned short digits = 5, bool crop_0 = false double StrToDouble(char *str); long StrToInt(char *str); -void MessageBox(char *str); \ No newline at end of file +void MessageBox(char *str); + +#endif \ No newline at end of file diff --git a/programs/bcc32/include/kos_lib.inc b/programs/bcc32/include/kos_lib.inc index 3269054e26..286e549861 100644 --- a/programs/bcc32/include/kos_lib.inc +++ b/programs/bcc32/include/kos_lib.inc @@ -142,6 +142,41 @@ proc @strcpy$qpcpxc uses esi edi ret endp +align 4 +proc @strncpy$qpcpxcl uses esi edi + cld + mov edi,[esp+16] + mov ecx,[esp+20] + jecxz @f + mov esi,edi + xor al,al + repnz scasb + not ecx + mov edi,[esp+12] + mov edx,ecx + mov eax,edi + shr ecx,2 + rep movsd + mov ecx,edx + and ecx,3 + rep movsb +@@: + ret +endp + +align 4 +proc @memcmp$qpxvt1l uses esi edi + cld + mov ecx,[esp+20] + mov edi,[esp+16] + mov esi,[esp+12] + repe cmpsb + movzx eax,byte[esi-1] + movzx edx,byte[edi-1] + sub eax,edx + ret +endp + align 4 proc @memcpy$qpvpxvui uses esi edi cld @@ -242,11 +277,11 @@ align 4 pop esi inc esi cmp byte[edi-1],0 - jne .cycle + jne .cycle lea eax,[esi-1] .not_f: - ret + ret endp align 4 diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.asm b/programs/develop/libraries/box_lib/trunk/box_lib.asm index 37c8ca93f2..aedf85dd39 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.asm +++ b/programs/develop/libraries/box_lib/trunk/box_lib.asm @@ -22,6 +22,8 @@ include '../../../../KOSfuncs.inc' include 'box_lib.mac' ;macro which should make life easier :) ;include '../../../../debug.inc' include 'keys.inc' +include '../../../../system/skincfg/trunk/kglobals.inc' +include '../../../../system/skincfg/trunk/unpacker.inc' ;----------------------------------------------------------------------------- mem.alloc dd ? ;ЇєэъЎш  фы  т√фхыхэш  ярь Єш @@ -170,6 +172,10 @@ proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dwo endp +;фы  ЁрсюЄ√ ё KPCK +IncludeIGlobals +IncludeUGlobals + align 16 EXPORTS: diff --git a/programs/develop/libraries/box_lib/trunk/t_edit.asm b/programs/develop/libraries/box_lib/trunk/t_edit.asm index 6c755840d8..773876cb20 100644 --- a/programs/develop/libraries/box_lib/trunk/t_edit.asm +++ b/programs/develop/libraries/box_lib/trunk/t_edit.asm @@ -1263,20 +1263,12 @@ proc ted_memory_increase cmp ted_increase_size,0 je @f push eax ebx ecx - mov ecx,ted_increase_size - add ecx,ted_max_chars - mov ted_max_chars,ecx - imul ecx,sizeof.symbol - invoke mem.realloc, ted_tex,ecx mov ebx,ted_tex - mov ted_tex,eax - mov ted_tex_1,eax - add ted_tex_1,sizeof.symbol - sub edx,ebx - add edx,eax - mov ted_ptr_free_symb,edx - add eax,ecx - mov ted_tex_end,eax + mov ecx,ted_max_chars + call ted_mem_resize.no_2 + sub edx,ebx + add edx,ted_tex + mov ted_ptr_free_symb,edx pop ecx ebx eax @@: ret @@ -2546,11 +2538,39 @@ proc ted_find_help_id uses ebx ecx, end_pos:dword ret endp +;description: +; изменяем размер памяти для текста (установка ted_ptr_free_symb на 1 символ) +;input: +; ecx - число символов в файле +; edi - pointer to tedit struct +;output: +; eax, ecx - разрушаются +align 16 +ted_mem_resize: + add ecx,2 ;память для текста + служебные начальный и конечный символы +.no_2: + add ecx,ted_increase_size ;память для редактирования файла + mov ted_max_chars,ecx + imul ecx,sizeof.symbol + invoke mem.realloc, ted_tex,ecx + mov ted_tex,eax + mov ted_tex_1,eax + add ted_tex_1,sizeof.symbol + add eax,ecx + mov ted_tex_end,eax + mov ecx,ted_tex_1 + add ecx,sizeof.symbol + mov ted_ptr_free_symb,ecx + ret + ;output: ; eax = код ошибки ; ebx = колличество прочитанных байт align 16 -proc ted_open_file uses ecx edx edi, edit:dword, file:dword, f_name:dword ;функция открытия файла +proc ted_open_file uses ecx edx edi esi, edit:dword, file:dword, f_name:dword ;функция открытия файла + locals + unpac_mem dd ? + endl mov edi,[edit] ; *** проверяем размер памяти и если не хватает то увеличиваем *** @@ -2580,21 +2600,8 @@ align 4 mov edx,[edx+32] ;+32 = +0x20: qword: размер файла в байтах cmp edx,ecx jl @f - ;увеличиваем память если не хватило - mov ecx,edx ;память необходимая для открытия файла - add ecx,2 ;память для служебных начального и конечного символов - add ecx,ted_increase_size ;память для редактирования файла - mov ted_max_chars,ecx - imul ecx,sizeof.symbol - invoke mem.realloc, ted_tex,ecx - mov ted_tex,eax - mov ted_tex_1,eax - add ted_tex_1,sizeof.symbol - add eax,ecx - mov ted_tex_end,eax - mov ecx,ted_tex_1 - add ecx,sizeof.symbol - mov ted_ptr_free_symb,ecx + mov ecx,edx + call ted_mem_resize @@: ; *** пробуем открыть файл *** @@ -2617,6 +2624,32 @@ align 4 cmp ebx,-1 je .ret_f ;if open file + push eax + mov eax,ted_tex + cmp dword[eax],'KPCK' + jne .end_unpack + ;выделение памяти для распаковки файла + invoke mem.alloc,[eax+4] + mov [unpac_mem],eax + stdcall unpack,ted_tex,[unpac_mem] + mov ecx,ted_max_chars + sub ecx,2 ;ecx = максимальное число байт, для которых была выделена память + mov eax,ted_tex + mov ebx,[eax+4] + cmp ebx,ecx + jl @f ;если для распакованого файла не хватает выделенной памяти + mov ecx,ebx + call ted_mem_resize + @@: + mov edi,ted_tex + mov esi,[unpac_mem] + mov ecx,ebx + cld + rep movsb + mov edi,[edit] + invoke mem.free,[unpac_mem] + .end_unpack: + pop eax call ted_on_open_file .ret_f: ret