//this is the history list window handler INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int bInitializing; switch (msg) { case WM_INITDIALOG: bInitializing = 1; { int renderer = lstPopupHistory.GetRenderer(); SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0)); SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,1)); LoadRenderer(hWnd, renderer); TranslateDialogDefault(hWnd); HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY); ListView_SetExtendedListViewStyleEx(hHistoryList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); mir_subclassWindow(hHistoryList, PopupsListSubclassProc); LoadHistoryColumns(hHistoryList); RefreshPopupHistory(hWnd, renderer); } bInitializing = 0; return TRUE; case WM_DESTROY: UnloadRenderer(hWnd, lstPopupHistory.GetRenderer()); hHistoryWindow = NULL; break; case WM_CLOSE: DestroyWindow(hWnd); break; case WM_WINDOWPOSCHANGING: { WINDOWPOS *wndPos = (WINDOWPOS *) lParam; if (wndPos->cx < MIN_HISTORY_WIDTH) wndPos->cx = MIN_HISTORY_WIDTH; if (wndPos->cy < MIN_HISTORY_HEIGHT) wndPos->cy = MIN_HISTORY_HEIGHT; RECT rParent; GetWindowRect(hWnd, &rParent); HDWP hdWnds = BeginDeferWindowPos(4); AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_CLOSE), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM); AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_HISTORY_FILTER), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_HISTORY_FILTER_CASESENSITIVE), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_BOTTOM); AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_LST_HISTORY), &rParent, wndPos, ANCHOR_ALL); EndDeferWindowPos(hdWnds); MoveCustomControl(hWnd, lstPopupHistory.GetRenderer()); //move the custom control too, if any } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CLOSE: SendMessage(hWnd, WM_CLOSE, 0, 0); break; case IDC_HISTORY_FILTER_CASESENSITIVE: if (HIWORD(wParam) == BN_CLICKED) RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer()); case IDC_HISTORY_FILTER: if (HIWORD(wParam) == EN_CHANGE) if (!bInitializing) RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer()); break; } break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case IDC_LST_HISTORY: switch (((LPNMHDR)lParam)->code) { case LVN_COLUMNCLICK: { LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam; int column = lv->iSubItem; SortParams params = {0}; params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY); params.column = column; ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM) ¶ms); lastColumn = (params.column == lastColumn) ? -1 : params.column; break; } } } break; } return 0; }
ge_Scene* geLoadScene_ge_text(const char* file){ ge_File* fp = NULL; if( !(fp = geFileOpen(file, GE_FILE_MODE_READ | GE_FILE_MODE_BINARY))){ return NULL; } char path[2048] = ""; strncpy(path, file, strlen(file)); if(strstr(path, "/")){ int A = 0; for(A=strlen(path); A>=0; A--){ if(path[A]=='/')break; path[A] = 0x0; } } ge_Scene* scene = (ge_Scene*)geMalloc(sizeof(ge_Scene)); ge_Fog* fog = (ge_Fog*)geMalloc(sizeof(ge_Fog)); memset(scene, 0, sizeof(ge_Scene)); memset(fog, 0, sizeof(ge_Fog)); scene->fog = fog; int i = 0; int rgba[4] = { -1 }; char buffer[2048] = ""; char tmp[2048] = ""; int tmp_ivec[4]; scene->cloudsGenerator = NULL; while(geFileGets(fp, buffer, 2048)){ PASS_COMMENTS; if(strstr(buffer, "RENDERER") && !strstr(buffer, "END_RENDERER")){ scene->nRenderers++; continue; } if(strstr(buffer, "LIGHT") && !strstr(buffer, "END_LIGHT")){ if(strstr(buffer,"dynamic")){ scene->nDynamicLights++; }else{ scene->nLights++; } continue; } if(geGetParamIntMulti(buffer, "clear_color", rgba, 3)){ SET_COLOR_RGBAf(scene->clear_color, rgba[0], rgba[1], rgba[2], 1.0); } if(geGetParamIntMulti(buffer, "material_ambient", rgba, 3)){ SET_COLOR_RGBAf(scene->material_ambient, rgba[0], rgba[1], rgba[2], 1.0); } if(geGetParamIntMulti(buffer, "material_diffuse", rgba, 3)){ SET_COLOR_RGBAf(scene->material_diffuse, rgba[0], rgba[1], rgba[2], 1.0); } if(geGetParamString(buffer, "skysphere", tmp, 2048)){ if(tmp[0] != 0x0 && tmp[0] != '\n'){ gePrintDebug(0x100, "sky : \"%s\"\n", tmp); scene->sky.animator = (ge_Animator*)geMalloc(sizeof(char)*2048); scene->sky.nVerts = -2; if(strstr(tmp, "generic")){ sprintf(((char*)scene->sky.animator), "default_objects/maps/%s.png", tmp); }else{ sprintf(((char*)scene->sky.animator), "%s%s", path, tmp); } } }else if(geGetParamString(buffer, "sky", tmp, 2048)){ if(tmp[0] != 0x0 && tmp[0] != '\n'){ gePrintDebug(0x102, "sky : \"%s\"\n", tmp); scene->sky.animator = (ge_Animator*)geMalloc(sizeof(char)*2048); if(strstr(tmp, "generic")){ sprintf(((char*)scene->sky.animator), "default_objects/maps/%s.png", tmp); }else{ sprintf(((char*)scene->sky.animator), "%s%s", path, tmp); } } } if(strstr(buffer,"fog"))scene->fogEnabled=true; if(strstr(buffer, "fog_mode = ")){ if(strstr(buffer, "LINEAR"))fog->mode=GE_FOG_LINEAR; if(strstr(buffer, "EXP2"))fog->mode=GE_FOG_EXP2; if(strstr(buffer, "EXP"))fog->mode=GE_FOG_EXP; } if(geGetParamIntMulti(buffer, "fog_color", rgba, 3)){ SET_COLOR_RGBAf(fog->color, rgba[0], rgba[1], rgba[2], 1.0); } geGetParamFloat(buffer, "fog_density", &fog->density); geGetParamFloat(buffer, "fog_start", &fog->start); geGetParamFloat(buffer, "fog_end", &fog->end); if(strstr(buffer, "CLOUDS_GENERATOR") && !strstr(buffer, "END_CLOUDS_GENERATOR")){ gePrintDebug(0x100, " LoadRenderer A\n"); scene->cloudsGenerator = (ge_CloudsGenerator*)geMalloc(sizeof(ge_CloudsGenerator)); while(geFileGets(fp, buffer, 2048)){ PASS_COMMENTS; if(strstr(buffer, "END_CLOUDS_GENERATOR"))break; geGetParamIntMulti(buffer, "map_size", &scene->cloudsGenerator->map_size_x, 2); if(strstr(buffer, "CLOUDS_LEVEL")){ geGetParamString(buffer, "CLOUDS_LEVEL", tmp, 2048); int type = -1; if(!strcmp(tmp, "high")){ type = GE_CLOUD_TYPE_HIGH_LEVEL; }else if(!strcmp(tmp, "mid")){ type = GE_CLOUD_TYPE_MID_LEVEL; }else if(!strcmp(tmp, "low")){ type = GE_CLOUD_TYPE_LOW_LEVEL; }else{ break; } while(geFileGets(fp, buffer, 2048)){ PASS_COMMENTS; if(strstr(buffer, "END_CLOUDS_LEVEL"))break; if(geGetParamIntMulti(buffer, "size_range", tmp_ivec, 2)){ scene->cloudsGenerator->size_min[type] = tmp_ivec[0]; scene->cloudsGenerator->size_max[type] = tmp_ivec[1]; } if(geGetParamIntMulti(buffer, "parts_range", tmp_ivec, 2)){ scene->cloudsGenerator->parts_min[type] = tmp_ivec[0]; scene->cloudsGenerator->parts_max[type] = tmp_ivec[1]; } geGetParamInt(buffer, "n_clouds", &scene->cloudsGenerator->n_clouds[type]); } } } } } geFileRewind(fp); gePrintDebug(0x100, "scene 1\n"); gePrintDebug(0x100, "scene->nLights %d\n", scene->nLights); scene->lights = (ge_Light*)geMalloc(sizeof(ge_Light)*(scene->nLights + 8)); scene->dynamicLights = scene->lights; // scene->dynamicLights = (ge_Light*)geMalloc(sizeof(ge_Light)*scene->nDynamicLights); int iS=8, iD=0; while(geFileGets(fp, buffer, 1024)){ PASS_COMMENTS; if(strstr(buffer, "LIGHT") && !strstr(buffer, "END_LIGHT")){ if(strstr(buffer,"dynamic")){ LoadLight(fp, &scene->lights[iD]); scene->lights[iD].isDynamic = true; iD++; }else{ LoadLight(fp, &scene->lights[iS]); scene->lights[iS].isDynamic = false; PrecalculateLight(&scene->lights[iS]); iS++; } } } gePrintDebug(0x100, "scene 2\n"); geFileRewind(fp); scene->renderers = (ge_Renderer*)geMalloc(sizeof(ge_Renderer)*scene->nRenderers); gePrintDebug(0x100, "scene 2.1\n"); i = 0; while(geFileGets(fp, buffer, 1024)){ PASS_COMMENTS; if(strstr(buffer, "RENDERER") && !strstr(buffer, "END_RENDERER")){ memset(&scene->renderers[i], 0, sizeof(ge_Renderer)); geGetParamString(buffer, "RENDERER", scene->renderers[i].name, 64); gePrintDebug(0x100, "scene 2.2.%d.1\n", i); LoadRenderer(path, fp, scene, &scene->renderers[i]); gePrintDebug(0x100, "scene 2.2.%d.2\n", i); i++; if(i>scene->nRenderers)break; } } gePrintDebug(0x100, "scene 3\n"); geFileClose(fp); return scene; }