Exemplo n.º 1
0
int Convert_To_Abs_Path(char *path)
{
	char* temp;
	temp = strdup(path);
	Get_Path(Get_Cwd(), path); /* weak */
	strcat(path, "/");
	strcat(path, temp);
	Free(temp);
}
void Astar(int map[m+1][n+1], int si, int sj, int di, int dj)
{
	/*si = Abs(double(si));
	sj = Abs(double(sj));
	di = Abs(double(di));
	dj = Abs(double(dj));*/
	printf("<si=%d,sj=%d,di=%d,dj=%d>\n",si,sj,di,dj);
	Get_Path(map,si,sj,di,dj);
}
Exemplo n.º 3
0
static int Sys_GetCwd(struct Interrupt_State *state)
{
	char spath[VFS_MAX_PATH_LEN] = {'\0', };
	int rc; 
	
	Enable_Interrupts();
	rc = Get_Path(Get_Cwd(), spath);
	Disable_Interrupts();
	Copy_To_User(state->ebx, spath, state->ecx);
	return rc;
}
Exemplo n.º 4
0
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmdShow)
{
	MSG msg;
	WNDCLASS wndclass,wndclass2;
	short seed;

	if (!hPrevInstance) {
		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass.lpfnWndProc = WndProc;
		wndclass.cbClsExtra = 0;
		wndclass.cbWndExtra = 0;
		wndclass.hInstance = hInstance;
		wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass.hCursor = NULL;
		wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass.lpszMenuName = MAKEINTRESOURCE(1);
		wndclass.lpszClassName = szAppName;

		RegisterClass(&wndclass);

		wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass2.lpfnWndProc = WndProc;
		wndclass2.cbClsExtra = 0;
		wndclass2.cbWndExtra = 0;
		wndclass2.hInstance = hInstance;
		wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass2.hCursor = NULL;
		wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass2.lpszMenuName = NULL;
		wndclass2.lpszClassName = szWinName;

		RegisterClass(&wndclass2);
		}

		mainPtr = CreateWindow (szAppName,
			"Classic Blades of Exile Character Editor",
			WS_OVERLAPPEDWINDOW,
			0,
			0,
			536,
			478,
			NULL,
			NULL,
			hInstance,
			NULL);

	if (!hPrevInstance) { // initialize
		Get_Path(file_path_name); //store the path to the executable
  		store_hInstance = hInstance;
		accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1));

        get_reg_data();

		load_cursors();
		seed = (short) GetCurrentTime();
		srand(seed);

		max_window(mainPtr);
		Set_up_win ();

		font = CreateFont(-9,0,0,0,0, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		small_bold_font = CreateFont(12,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		italic_font = CreateFont(12,0,0,0,0, 1,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		underline_font = CreateFont(12,0,0,0,0, 0,1,0, 0,0,
			0,0,0,"MS Sans Serif");
		bold_font = CreateFont(14,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		tiny_font = font;
		load_sounds();

		ShowWindow(mainPtr,nCmdShow);

		init_main_buttons();

		file_initialize();
		check_colors();
		cursor_stay();
		update_item_menu(1);

		cd_init_dialogs();

		FCD(900,0);
		}

		event_handled = FALSE;
		while(GetMessage(&msg,NULL,0,0)) {
			if (event_handled == FALSE) {
				if (!TranslateAccelerator(mainPtr, accel, &msg)) {
					TranslateMessage(&msg);
					DispatchMessage(&msg);
					}
				}
			}
		return msg.wParam;
}
Exemplo n.º 5
0
int WINAPI WinMain(HINSTANCE hInstance,	HINSTANCE hPrevInstance, LPSTR, int	nCmdShow)
{
    MSG msg;
    WNDCLASS wndclass, wndclass2;
    RECT windRECT;
    HINSTANCE boeSoundsDLL;

    wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
    wndclass.lpfnWndProc = WndProc;
    wndclass.cbClsExtra = 0;
    wndclass.cbWndExtra = 0;
    wndclass.hInstance = hInstance;
    wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
    wndclass.hCursor = NULL;
    wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wndclass.lpszMenuName = MAKEINTRESOURCE(1);
    wndclass.lpszClassName = szAppName;

    RegisterClass(&wndclass);

    wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
    wndclass2.lpfnWndProc = WndProc;
    wndclass2.cbClsExtra = 0;
    wndclass2.cbWndExtra = 0;
    wndclass2.hInstance = hInstance;
    wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
    wndclass2.hCursor = NULL;
    wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wndclass2.lpszMenuName = NULL;
    wndclass2.lpszClassName = szWinName;

    RegisterClass(&wndclass2);

    mainPtr = CreateWindow (szAppName, "Classic Blades of Exile",
                            WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                            0,
                            0,
                            588,
                            478,
                            NULL,
                            NULL,
                            hInstance,
                            NULL);

    if (!hPrevInstance)
    {   // initialize
        Get_Path(file_path_name);

        store_hInstance = hInstance;
        accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1));

        boeSoundsDLL = LoadLibrary("./boesounds.dll");

        if (!boeSoundsDLL)
        {
            MessageBox(mainPtr, "BOESOUNDS.DLL not found", "Error", MB_OK | MB_ICONEXCLAMATION);
            return (-1);
        }

        load_sounds(boeSoundsDLL);
        loadFonts();
        loadCursors();

        SetCursor(sword_curs);
        current_cursor = 124;
        /* cursors loaded */

        data_store = new piles_of_stuff_dumping_type;
        data_store3 = new piles_of_stuff_dumping_type3;
        data_store4 = new piles_of_stuff_dumping_type4;
        data_store5 = new piles_of_stuff_dumping_type5;
        scen_item_list = new scen_item_data_type;

        srand(GetCurrentTime());

        get_reg_data();

        if (display_mode != 5)
            max_window(mainPtr);
        else {
            GetWindowRect(GetDesktopWindow(),&windRECT);
            MoveWindow(mainPtr,(windRECT.right - (588 + 10)) / 2,
                       (windRECT.bottom - (425 + 52)) / 2 ,
                       588 + 10,425 + 52,true);
        }

        shop_sbar = CreateWindow("scrollbar",NULL,
                                 WS_CHILD | WS_TABSTOP | SBS_VERT, shop_sbar_rect.left,shop_sbar_rect.top,shop_sbar_rect.right,shop_sbar_rect.bottom,
                                 mainPtr,(HMENU) 3, store_hInstance,NULL);
        lpsi.fMask = SIF_RANGE;
        lpsi.nMax = 16;
        SetScrollInfo(shop_sbar,SB_CTL,&lpsi,false);
//		SetScrollRange(shop_sbar,SB_CTL,0,16,false);

        ShowWindow(mainPtr, nCmdShow);

        plop_fancy_startup();

        init_screen_locs();

        FlushEvents(2);

        SetTimer(mainPtr,1,620,NULL);
        SetTimer(mainPtr,2,200,NULL);

        file_initialize();

        if (GetDeviceCaps(main_dc,BITSPIXEL) * GetDeviceCaps(main_dc,PLANES) < 8)
        {
            MessageBox(mainPtr,"Blades of Exile is designed for 256 colors. The current graphics device is set for less. Exile 3 is playable with less colors, but will look somewhat odd."	,
                       "Not 256 colors!",MB_OK | MB_ICONEXCLAMATION);
            MessageBox(mainPtr,"For tips on how to get 256 colors, hit F1 for help, and then select 'Getting 256 Colors' from the table of contents."	,
                       "Not 256 colors!",MB_OK | MB_ICONEXCLAMATION);
        }

        menu_activate(0);
        cursor_stay();
        showcursor(true);
        reset_text_bar();

        adjust_window_mode();

        cd_init_dialogs();

        if (game_run_before == false) {
            FCD(986,0);
            WritePrivateProfileString("Blades of Exile", "game_run_before", "1", "./blades.ini");
        }
        else if (give_intro_hint == true) tip_of_day();

    }
    event_handled = false;

    while(GetMessage(&msg,NULL,0,0))
    {
        if (event_handled == false)
        {
            if (!TranslateAccelerator(mainPtr, accel, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    }

    delete scen_item_list;
    delete data_store5;
    delete data_store4;
    delete data_store3;
    if(data_store2 != NULL)
        delete[] data_store2;
    if(scen_headers != NULL)
        delete[] scen_headers;
    delete data_store;

    lose_graphics();

    FreeLibrary((HMODULE) boeSoundsDLL);

    return msg.wParam;
}
Exemplo n.º 6
0
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR, int nCmdShow)
{

	MSG msg;
	WNDCLASS wndclass,wndclass2;
	short seed;

	if (!hPrevInstance) {
		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass.lpfnWndProc = WndProc;
		wndclass.cbClsExtra = 0;
		wndclass.cbWndExtra = 0;
		wndclass.hInstance = hInstance;
		wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass.hCursor = NULL;
		wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass.lpszMenuName = MAKEINTRESOURCE(1);
		wndclass.lpszClassName = szAppName;

		RegisterClass(&wndclass);

		wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass2.lpfnWndProc = WndProc;
		wndclass2.cbClsExtra = 0;
		wndclass2.cbWndExtra = 0;
		wndclass2.hInstance = hInstance;
		wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass2.hCursor = NULL;
		wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass2.lpszMenuName = NULL;
		wndclass2.lpszClassName = szWinName;

		RegisterClass(&wndclass2);
		}

		mainPtr = CreateWindow (szAppName,
			"Classic Blades of Exile Scenario Editor",
			WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
			0,
			0,
			536,
			478,
			NULL,
			NULL,
			hInstance,
			NULL);


	if (!hPrevInstance) { // initialize
		//center_window(mainPtr);
 		Get_Path(file_path_name);
		store_hInstance = hInstance;
		accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1));
		loadSettingsFromFile();

		seed = (short) GetCurrentTime();
		srand(seed);

		data_store = new piles_of_stuff_dumping_type;

		max_window(mainPtr);
		GetWindowRect(mainPtr,&windRect);
		SetTimer(mainPtr,1,20,NULL);

		ShowWindow(mainPtr,nCmdShow);
		Set_up_win ();
		init_lb();
		init_rb();
		init_town(1);
		init_out();

		init_scenario();

		font = CreateFont(12,0,0,0,0, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		small_bold_font = CreateFont(12,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		italic_font = CreateFont(12,0,0,0,0, 1,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		underline_font = CreateFont(12,0,0,0,0, 0,1,0, 0,0,
			0,0,0,"MS Sans Serif");
		bold_font = CreateFont(14,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		tiny_font = font;
		load_sounds();

		right_sbar_rect.top = RIGHT_AREA_UL_Y;
		right_sbar_rect.left = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH - 16 ;
		right_sbar_rect.bottom = RIGHT_AREA_UL_Y + RIGHT_AREA_HEIGHT;
		right_sbar_rect.right = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH ;
		right_sbar = CreateWindow("scrollbar",NULL,
			WS_CHILD | WS_TABSTOP | SBS_VERT, right_sbar_rect.left + ulx,right_sbar_rect.top + uly,
			right_sbar_rect.right - right_sbar_rect.left,
			right_sbar_rect.bottom - right_sbar_rect.top,
			mainPtr,(HMENU) 1,store_hInstance,NULL);

		init_screen_locs();
		set_up_start_screen();

		file_initialize();
		check_colors();
		cursor_stay();
		update_item_menu();
		shut_down_menus(0);

		cd_init_dialogs();

 		}

		event_handled = FALSE;
		while(GetMessage(&msg,NULL,0,0)) {
			if (event_handled == FALSE) {
				if (!TranslateAccelerator(mainPtr, accel, &msg)) {
					TranslateMessage(&msg);
					DispatchMessage(&msg);
					}
				}
			}

		delete data_store;
		saveSettingsToFile();

		return msg.wParam;
}
Exemplo n.º 7
0
int main()
{
	Copyright();  //输出程序信息

	char *s = (char *)malloc(MAXLEN * sizeof(char));         //用来保存输入数据
	char *backups_s = s;                                     //备份s指针 用于释放内存
    char *filepath = (char *)malloc(MAXLEN * sizeof(char));  //用来储存文件路径
	char *backups_p = filepath;
	while (1)
	{
        Pre();
		s = backups_s;
		Read_Argv(s);
		if (*s != '-')
		{
			gets(s);
			Error();
			continue;
		}
		s ++;
		filepath = backups_p;
        
		if (Equal(s , "index"))
		{
		    int t;
			scanf("%d" , &t);
			if (t == 1)
			    printf("---Open the index function successfully.---\n");
			else
				if (t == 0)
					printf("---Close the index function successfully.---\n");
				else
					Error();
			gets(s);
			continue;
		}
		else
			if (*(s + 1) != '\0')
			{
				gets(s);
				Error();
				continue;
			}
		switch (*s) 
		{
		    case 'c' : Get_Path(filepath);
				       Create_Table(filepath);
					   break;

			case 'i' : s = backups_s;   
					   Get_Table(s);        //第二个参数 表名
				       Get_Path(filepath);
					   Import_Data(s , filepath);
					   break;

			case 's' : Get_Path(filepath);
					   Select(filepath);
					   break;

			case 'u' : Get_Path(filepath);
					   Update(filepath);
				       break;

			case 'd' : Get_Path(filepath);
					   Delete(filepath);
					   break;

			case 'h' : Help();
				       break;

		    case 'q' : Exit_pro();
					   free(backups_s);
					   free(backups_p);
					   Free();
				       return 0;

			default  : gets(s);
				       Error();
				       break;
		}
		gets(s);
	}

	return 0;
}