blocks: fix open from CommandLine, fix include files

git-svn-id: svn://kolibrios.org@8919 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2021-06-22 09:24:38 +00:00
parent b9df80cf80
commit 3b72f0f39d
6 changed files with 42 additions and 36 deletions

View File

@ -48,7 +48,8 @@ struct ModelList{
char* name; char* name;
long int color, t_cr; long int color, t_cr;
float x,y,z, r_x,r_y,r_z; float x,y,z, r_x,r_y,r_z;
long int level, id_l; unsigned long level;
long int id_l;
}; };
ModelList* model_list = 0; ModelList* model_list = 0;
@ -73,8 +74,8 @@ float white_light[] = {1.0, 1.0, 1.0, 1.0}; //Цвет и интенсивнос
float lmodel_ambient[] = {0.3, 0.3, 0.3, 1.0}; //Параметры фонового освещения float lmodel_ambient[] = {0.3, 0.3, 0.3, 1.0}; //Параметры фонового освещения
char str1[] = "Show active level"; char str1[] = "Show active level";
check_box check1 = { {16,280,20,4}, 8, 0xffffff, 0x808080, 0xffffff, str1, ch_flag_middle }; check_box check1 = { {16,310,20,4}, 8, 0xffffff, 0x808080, 0xffffff, str1, ch_flag_middle };
scrollbar sb_tcr = { 200,70,19,4, 16, 1, 20,1,0, 0x808080, 0xffffff, 0x0}; scrollbar sb_tcr = { 200,100,19,4, 16, 1, 20,1,0, 0x808080, 0xffffff, 0x0};
void SetLight() void SetLight()
{ {
@ -195,9 +196,14 @@ bool init_block(){
FileInfoBlock* file; FileInfoBlock* file;
unsigned long int k; unsigned long int k;
file = FileOpen("block.bin"); k = strlen(CurrentDirectoryPath);
while(CurrentDirectoryPath[k] != '\\' && CurrentDirectoryPath[k] != '/' && k) {k--;};
memcpy(library_path,CurrentDirectoryPath,k);
strcpy(library_path+k,"block.bin");
file = FileOpen(library_path);
if (!file){ if (!file){
//SetWindowCaption("Error open file 'block.bin'"); MessageBox("Error open file 'block.bin', file not found");
return false; return false;
} }
k = FileGetLength(file); k = FileGetLength(file);
@ -218,9 +224,14 @@ bool init_block(){
f_data = 0; f_data = 0;
} }
} }
FileClose(file);
}
else {
MessageBox("Error open file 'block.bin', file length == 0");
FileClose(file);
return false;
} }
FileClose(file);
if (b_data){ if (b_data){
unsigned long i=0, n=0; unsigned long i=0, n=0;
b_count=0; b_count=0;
@ -245,7 +256,10 @@ bool init_block(){
compile_list(&b_list[n]); compile_list(&b_list[n]);
n++; n++;
}; };
} }
else {
MessageBox("Error open file 'block.bin', can't unpack file");
}
return (bool)b_data; return (bool)b_data;
} }
@ -470,7 +484,8 @@ void KolibriOnPaint(void)
// If button have ID 1, this is close button // If button have ID 1, this is close button
DrawButton(2,0xf0f0f0, 10,4,50,19); DrawButton(2,0xf0f0f0, 10,4,50,19);
DrawText(20,10,0,"Open"); DrawText(20,10,0,"Open");
DrawText(10,TOOLBAR_H+3,(1<<24)|0xffffff,DoubleToStr(sb_tcr.position,0,true)); DrawRect(70,7, 24,18, 0x333333);
DrawText(70,7,(1<<24)|0xffffff,DoubleToStr(sb_tcr.position,0,true));
sb_tcr.all_redraw=1; sb_tcr.all_redraw=1;
scrollbar_h_draw(&sb_tcr); scrollbar_h_draw(&sb_tcr);
check_box_draw(&check1); check_box_draw(&check1);
@ -567,7 +582,7 @@ void KolibriOnMouse(TThreadData /*th*/)
} }
} }
void KolibriOnSize(int window_rect[], TThreadData /*th*/) void KolibriOnSize(int [], TThreadData /*th*/)
{ {
unsigned short int width, height; unsigned short int width, height;
GetClientSize(width, height); GetClientSize(width, height);

View File

@ -11,3 +11,5 @@ double floor(double x);
const char *DoubleToStr(double x, unsigned short digits = 5, bool crop_0 = false); const char *DoubleToStr(double x, unsigned short digits = 5, bool crop_0 = false);
double StrToDouble(char *str); double StrToDouble(char *str);
long StrToInt(char *str); long StrToInt(char *str);
void MessageBox(char *str);

View File

@ -1,4 +1,4 @@
include "..\..\..\develop\info3ds\info_fun_float.inc" include "..\..\develop\info3ds\info_fun_float.inc"
align 4 align 4
proc @DoubleToStr$qduso uses esi edi proc @DoubleToStr$qduso uses esi edi
@ -292,3 +292,10 @@ proc @floor$qd
.floor_end: .floor_end:
ret ret
endp endp
align 4
proc @MessageBox$qpc
mov eax,[esp+4]
notify_window_run eax
ret
endp

View File

@ -17,11 +17,11 @@ else
dd 0 dd 0
end if end if
include "..\..\..\KOSfuncs.inc" include "..\..\KOSfuncs.inc"
include "..\..\..\proc32.inc" include "..\..\proc32.inc"
include "..\..\..\macros.inc" include "..\..\macros.inc"
include "..\..\..\dll.inc" include "..\..\dll.inc"
include "..\..\..\load_lib.mac" include "..\..\load_lib.mac"
ptr equ ptr equ
offset equ offset equ
@ -33,24 +33,6 @@ OFFSET equ
SHORT equ SHORT equ
TBYTE equ TWORD TBYTE equ TWORD
macro movsb a,b
{
if a eq & b eq
movsb
else
movsx a,b
end if
}
macro movsw a,b
{
if a eq & b eq
movsw
else
movsx a,b
end if
}
macro segment name {} macro segment name {}
macro endseg name {} macro endseg name {}

View File

@ -1,7 +1,7 @@
@@unpack$qqspvt1 equ unpack @@unpack$qqspvt1 equ unpack
include "..\..\..\system\skincfg\trunk\kglobals.inc" include "..\..\system\skincfg\trunk\kglobals.inc"
include "..\..\..\system\skincfg\trunk\unpacker.inc" include "..\..\system\skincfg\trunk\unpacker.inc"
IncludeIGlobals IncludeIGlobals
IncludeUGlobals IncludeUGlobals