static UIObject *CreateAddKeyObjs(Vec2i pos, EditorBrush *brush) { UIObject *o2; UIObject *c = UIObjectCreate(UITYPE_CONTEXT_MENU, 0, pos, Vec2iZero()); UIObject *o = UIObjectCreate( UITYPE_CUSTOM, 0, Vec2iZero(), Vec2iNew(TILE_WIDTH + 4, TILE_HEIGHT + 4)); o->ChangeFunc = BrushSetBrushTypeAddKey; o->u.CustomDrawFunc = DrawKey; o->OnFocusFunc = ActivateIndexedEditorBrush; o->OnUnfocusFunc = DeactivateIndexedEditorBrush; pos = Vec2iZero(); int width = 4; for (int i = 0; i < KEY_COUNT; i++) { o2 = UIObjectCopy(o); o2->IsDynamicData = 1; CMALLOC(o2->Data, sizeof(IndexedEditorBrush)); ((IndexedEditorBrush *)o2->Data)->Brush = brush; ((IndexedEditorBrush *)o2->Data)->u.ItemIndex = i; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o->Size.x; if (((i + 1) % width) == 0) { pos.x = 0; pos.y += o->Size.y; } } UIObjectDestroy(o); return c; }
static UIObject *CreateSetKeyObjs(Vec2i pos, EditorBrush *brush) { UIObject *o2; UIObject *c = UIObjectCreate(UITYPE_CONTEXT_MENU, 0, pos, Vec2iZero()); UIObject *o = UIObjectCreate( UITYPE_CUSTOM, 0, Vec2iZero(), Vec2iNew(TILE_WIDTH + 4, TILE_HEIGHT + 4)); o->ChangeFunc = BrushSetBrushTypeSetKey; o->u.CustomDrawFunc = DrawKey; o->OnFocusFunc = ActivateIndexedEditorBrush; o->OnUnfocusFunc = DeactivateIndexedEditorBrush; pos = Vec2iZero(); for (int i = -1; i < KEY_COUNT; i++) { o2 = UIObjectCopy(o); o2->IsDynamicData = 1; CMALLOC(o2->Data, sizeof(IndexedEditorBrush)); ((IndexedEditorBrush *)o2->Data)->Brush = brush; ((IndexedEditorBrush *)o2->Data)->ItemIndex = i; o2->Pos = pos; if (i == -1) { // -1 means no key CSTRDUP(o2->Tooltip, "no key"); } UIObjectAddChild(c, o2); pos.x += o->Size.x; } UIObjectDestroy(o); return c; }
UIObject *CreateAddItemObjs( Vec2i pos, EditorBrush *brush, CampaignOptions *co) { const int th = FontH(); UIObject *o2; UIObject *c = UIObjectCreate(UITYPE_CONTEXT_MENU, 0, pos, Vec2iZero()); UIObject *o = UIObjectCreate( UITYPE_LABEL, 0, Vec2iZero(), Vec2iNew(65, th)); o->Data = brush; pos = Vec2iZero(); o2 = UIObjectCopy(o); o2->Label = "Player start"; o2->ChangeFunc = BrushSetBrushTypeSetPlayerStart; o2->Pos = pos; CSTRDUP(o2->Tooltip, "Location where players start"); o2->OnFocusFunc = ActivateBrush; o2->OnUnfocusFunc = DeactivateBrush; o2->Data = brush; UIObjectAddChild(c, o2); pos.y += th; o2 = UIObjectCopy(o); o2->Label = "Map item >"; o2->Pos = pos; UIObjectAddChild(o2, CreateAddMapItemObjs( o2->Size, AddMapItemBrushObjFunc, brush, sizeof(IndexedEditorBrush), true)); UIObjectAddChild(c, o2); pos.y += th; o2 = UIObjectCopy(o); o2->Label = "Pickup spawner >"; o2->Pos = pos; UIObjectAddChild(o2, CreateAddPickupSpawnerObjs( o2->Size, AddPickupSpawnerBrushObjFunc, brush, sizeof(IndexedEditorBrush))); UIObjectAddChild(c, o2); pos.y += th; o2 = UIObjectCopy(o); o2->Label = "Character >"; o2->Pos = pos; UIObjectAddChild(o2, CreateAddCharacterObjs(o2->Size, brush, co)); UIObjectAddChild(c, o2); pos.y += th; o2 = UIObjectCopy(o); o2->Label = "Objective >"; o2->Pos = pos; UIObjectAddChild(o2, CreateAddObjectiveObjs(o2->Size, brush, co)); UIObjectAddChild(c, o2); pos.y += th; o2 = UIObjectCopy(o); o2->Label = "Key >"; o2->Pos = pos; UIObjectAddChild(o2, CreateAddKeyObjs(o2->Size, brush)); UIObjectAddChild(c, o2); UIObjectDestroy(o); return c; }
static void CreateAddCharacterSubObjs(UIObject *c, void *vData) { EditorBrushAndCampaign *data = vData; CharacterStore *store = &data->Campaign->Setting.characters; if (c->Children.size == store->OtherChars.size) { return; } // Recreate the child UI objects c->Highlighted = NULL; UIObject **objs = c->Children.data; for (int i = 0; i < (int)c->Children.size; i++, objs++) { UIObjectDestroy(*objs); } CArrayTerminate(&c->Children); CArrayInit(&c->Children, sizeof c); UIObject *o = UIObjectCreate( UITYPE_CUSTOM, 0, Vec2iZero(), Vec2iNew(TILE_WIDTH + 4, TILE_HEIGHT * 2 + 4)); o->ChangeFunc = BrushSetBrushTypeAddCharacter; o->u.CustomDrawFunc = DrawCharacter; o->OnFocusFunc = ActivateEditorBrushAndCampaignBrush; o->OnUnfocusFunc = DeactivateEditorBrushAndCampaignBrush; Vec2i pos = Vec2iZero(); int width = 8; for (int i = 0; i < (int)store->OtherChars.size; i++) { UIObject *o2 = UIObjectCopy(o); Character *ch = CArrayGet(&store->OtherChars, i); CSTRDUP(o2->Tooltip, ch->Gun->name); o2->IsDynamicData = 1; CMALLOC(o2->Data, sizeof(EditorBrushAndCampaign)); ((EditorBrushAndCampaign *)o2->Data)->Brush.Brush = data->Brush.Brush; ((EditorBrushAndCampaign *)o2->Data)->Campaign = data->Campaign; ((EditorBrushAndCampaign *)o2->Data)->Brush.u.ItemIndex = i; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o->Size.x; if (((i + 1) % width) == 0) { pos.x = 0; pos.y += o->Size.y; } } UIObjectDestroy(o); }
static UIObject *CreateAddWreckObjs(Vec2i pos, EditorBrush *brush) { UIObject *o2; UIObject *c = UIObjectCreate(UITYPE_CONTEXT_MENU, 0, pos, Vec2iZero()); UIObject *o = UIObjectCreate( UITYPE_CUSTOM, 0, Vec2iZero(), Vec2iNew(TILE_WIDTH + 4, TILE_HEIGHT + 4)); o->ChangeFunc = BrushSetBrushTypeAddWreck; o->u.CustomDrawFunc = DrawWreck; o->OnFocusFunc = ActivateIndexedEditorBrush; o->OnUnfocusFunc = DeactivateIndexedEditorBrush; pos = Vec2iZero(); const int width = 8; for (int i = 0; i < (int)gMapObjects.Destructibles.size; i++) { o2 = UIObjectCopy(o); o2->IsDynamicData = 1; CMALLOC(o2->Data, sizeof(IndexedEditorBrush)); ((IndexedEditorBrush *)o2->Data)->Brush = brush; ((IndexedEditorBrush *)o2->Data)->u.ItemIndex = i; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o->Size.x; if (((i + 1) % width) == 0) { pos.x = 0; pos.y += o->Size.y; } const char **name = CArrayGet(&gMapObjects.Destructibles, i); const MapObject *mo = StrMapObject(*name); CSTRDUP(o2->Tooltip, mo->Name); } UIObjectDestroy(o); return c; }
static void CreateAddMapItemSubObjs(UIObject *c, void *vData) { const CreateAddMapItemObjsImplData *data = vData; const int pageSize = data->GridSize.x * data->GridSize.y; // Check if we need to recreate the objs // TODO: this is a very heavyweight way to do it int count = 0; bool allChildrenSame = true; for (int i = 0; i < MapObjectsCount(&gMapObjects); i++) { MapObject *mo = IndexMapObject(i); UIObject *o2 = UIObjectCreate(UITYPE_CUSTOM, 0, svec2i_zero(), data->GridItemSize); o2->IsDynamicData = true; CCALLOC(o2->Data, data->DataSize); if (!data->ObjFunc(o2, mo, data->Data)) { UIObjectDestroy(o2); continue; } const int pageIdx = count / pageSize; if (pageIdx >= (int)c->Children.size) { allChildrenSame = false; break; } const UIObject **op = CArrayGet(&c->Children, pageIdx); const UIObject **octx = CArrayGet(&(*op)->Children, 0); const int idx = count % pageSize; if (idx >= (int)(*octx)->Children.size) { allChildrenSame = false; break; } const UIObject **oc = CArrayGet(&(*octx)->Children, idx); if (memcmp(o2->Data, (*oc)->Data, data->DataSize) != 0) { allChildrenSame = false; UIObjectDestroy(o2); break; } count++; UIObjectDestroy(o2); } int cCount = CountAddMapItemSubObjs(c); if (cCount == count && allChildrenSame) { return; } // Recreate the child UI objects c->Highlighted = NULL; UIObject **objs = c->Children.data; for (int i = 0; i < (int)c->Children.size; i++, objs++) { UIObjectDestroy(*objs); } CArrayClear(&c->Children); // Create pagination int pageNum = 1; UIObject *pageLabel = NULL; UIObject *page = NULL; UIObject *o = UIObjectCreate(UITYPE_CUSTOM, 0, svec2i_zero(), data->GridItemSize); o->ChangesData = true; const struct vec2i gridStart = svec2i_zero(); struct vec2i pos = svec2i_zero(); count = 0; for (int i = 0; i < MapObjectsCount(&gMapObjects); i++) { // Only add normal map objects MapObject *mo = IndexMapObject(i); UIObject *o2 = UIObjectCopy(o); o2->IsDynamicData = true; CCALLOC(o2->Data, data->DataSize); if (!data->ObjFunc(o2, mo, data->Data)) { UIObjectDestroy(o2); continue; } o2->Pos = pos; if (count == 0) { pageLabel = UIObjectCreate( UITYPE_LABEL, 0, svec2i((pageNum - 1) * 10, 0), svec2i(10, FontH())); char buf[32]; sprintf(buf, "%d", pageNum); UIObjectSetDynamicLabel(pageLabel, buf); page = UIObjectCreate( UITYPE_CONTEXT_MENU, 0, svec2i_add(data->PageOffset, pageLabel->Size), svec2i_zero()); UIObjectAddChild(pageLabel, page); pageNum++; } UIObjectAddChild(page, o2); pos.x += o->Size.x; if (((count + 1) % data->GridSize.x) == 0) { pos.x = gridStart.x; pos.y += o->Size.y; } count++; if (count == pageSize) { count = 0; pos = gridStart; UIObjectAddChild(c, pageLabel); } } if (pageLabel != NULL) { UIObjectAddChild(c, pageLabel); } UIObjectDestroy(o); }
static void CreateAddObjectiveSubObjs(UIObject *c, void *vData) { EditorBrushAndCampaign *data = vData; Mission *m = CampaignGetCurrentMission(data->Campaign); // Check if the data is still the same; if so don't recreate the // child UI objects // This is because during the course of UI operations, this element // could be highlighted again; if we recreate then we invalidate // UI pointers. bool needToRecreate = false; int childIndex = 0; CA_FOREACH(const Objective, obj, m->Objectives) int secondaryCount = 1; const CharacterStore *store = &data->Campaign->Setting.characters; switch (obj->Type) { case OBJECTIVE_KILL: secondaryCount = (int)store->specialIds.size; break; case OBJECTIVE_COLLECT: break; case OBJECTIVE_DESTROY: break; case OBJECTIVE_RESCUE: secondaryCount = (int)store->prisonerIds.size; break; default: continue; } for (int j = 0; j < (int)secondaryCount; j++) { if ((int)c->Children.size <= childIndex) { needToRecreate = true; break; } UIObject *o2 = *(UIObject **)CArrayGet(&c->Children, childIndex); if (((EditorBrushAndCampaign *)o2->Data)->Brush.u.ItemIndex != _ca_index || ((EditorBrushAndCampaign *)o2->Data)->Brush.Index2 != j) { needToRecreate = true; break; } childIndex++; } if (needToRecreate) { break; } CA_FOREACH_END() if (!needToRecreate) { return; } // Recreate the child UI objects c->Highlighted = NULL; CA_FOREACH(UIObject *, obj, c->Children) UIObjectDestroy(*obj); CA_FOREACH_END() CArrayTerminate(&c->Children); CArrayInit(&c->Children, sizeof c); UIObject *o = UIObjectCreate( UITYPE_CUSTOM, 0, Vec2iZero(), Vec2iNew(TILE_WIDTH + 4, TILE_HEIGHT * 2 + 4)); o->ChangeFunc = BrushSetBrushTypeAddObjective; o->u.CustomDrawFunc = DrawObjective; o->OnFocusFunc = ActivateEditorBrushAndCampaignBrush; o->OnUnfocusFunc = DeactivateEditorBrushAndCampaignBrush; Vec2i pos = Vec2iZero(); CA_FOREACH(const Objective, obj, m->Objectives) int secondaryCount = 1; const CharacterStore *store = &data->Campaign->Setting.characters; switch (obj->Type) { case OBJECTIVE_KILL: secondaryCount = (int)store->specialIds.size; o->Size.y = TILE_HEIGHT * 2 + 4; break; case OBJECTIVE_COLLECT: o->Size.y = TILE_HEIGHT + 4; break; case OBJECTIVE_DESTROY: o->Size.y = TILE_HEIGHT * 2 + 4; break; case OBJECTIVE_RESCUE: secondaryCount = (int)store->prisonerIds.size; o->Size.y = TILE_HEIGHT * 2 + 4; break; default: continue; } for (int j = 0; j < (int)secondaryCount; j++) { UIObject *o2 = UIObjectCopy(o); CSTRDUP(o2->Tooltip, ObjectiveTypeStr(obj->Type)); o2->IsDynamicData = true; CMALLOC(o2->Data, sizeof(EditorBrushAndCampaign)); ((EditorBrushAndCampaign *)o2->Data)->Brush.Brush = data->Brush.Brush; ((EditorBrushAndCampaign *)o2->Data)->Campaign = data->Campaign; ((EditorBrushAndCampaign *)o2->Data)->Brush.u.ItemIndex = _ca_index; ((EditorBrushAndCampaign *)o2->Data)->Brush.Index2 = j; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o->Size.x; } pos.x = 0; pos.y += o->Size.y; CA_FOREACH_END() UIObjectDestroy(o); }
UIObject *CreateCaveMapObjs(struct vec2i pos, CampaignOptions *co) { const int th = FontH(); UIObject *c = UIObjectCreate(UITYPE_NONE, 0, svec2i_zero(), svec2i_zero()); UIObject *o = UIObjectCreate( UITYPE_LABEL, 0, svec2i_zero(), svec2i(50, th)); const int x = pos.x; o->ChangesData = true; // Check whether the map type matches, and set visibility c->CheckVisible = MissionCheckTypeFunc; c->Data = co; UIObject *o2 = CreateCampaignSeedObj(pos, co); UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetFillPercentStr; o2->Data = co; o2->ChangeFunc = MissionChangeFillPercent; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRepeatStr; o2->Data = co; o2->ChangeFunc = MissionChangeRepeat; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetR1Str; o2->Data = co; o2->ChangeFunc = MissionChangeR1; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetR2Str; o2->Data = co; o2->ChangeFunc = MissionChangeR2; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetCorridorWidthStr; o2->Data = co; o2->ChangeFunc = MissionChangeCorridorWidth; o2->Pos = pos; o2->Size.x = 60; UIObjectAddChild(c, o2); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRoomCountStr; o2->Data = co; o2->ChangeFunc = MissionChangeRoomCount; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRoomMinStr; o2->Data = co; o2->ChangeFunc = MissionChangeRoomMin; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRoomMaxStr; o2->Data = co; o2->ChangeFunc = MissionChangeRoomMax; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCreate(UITYPE_CUSTOM, 0, pos, svec2i(60, th)); o2->ChangesData = true; o2->u.CustomDrawFunc = MissionDrawRoomsOverlap; o2->Data = co; o2->ChangeFunc = MissionChangeRoomsOverlap; UIObjectAddChild(c, o2); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRoomWallCountStr; o2->Data = co; o2->ChangeFunc = MissionChangeRoomWallCount; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRoomWallLenStr; o2->Data = co; o2->ChangeFunc = MissionChangeRoomWallLen; o2->Pos = pos; o2->Size.x = 60; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetRoomWallPadStr; o2->Data = co; o2->ChangeFunc = MissionChangeRoomWallPad; o2->Pos = pos; o2->Size.x = 60; UIObjectAddChild(c, o2); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.LabelFunc = MissionGetSquareCountStr; o2->Data = co; o2->ChangeFunc = MissionChangeSquareCount; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCreate(UITYPE_CUSTOM, 0, pos, o->Size); o2->u.CustomDrawFunc = MissionDrawDoorEnabled; o2->Data = co; o2->ChangeFunc = MissionChangeDoorEnabled; o2->ChangesData = true; o2->Pos = pos; UIObjectAddChild(c, o2); UIObjectDestroy(o); return c; }
UIObject *CreateStaticMapObjs( Vec2i pos, CampaignOptions *co, EditorBrush *brush) { int x = pos.x; const int th = FontH(); UIObject *c = UIObjectCreate(UITYPE_NONE, 0, Vec2iZero(), Vec2iZero()); UIObject *o2; // Check whether the map type matches, and set visibility c->CheckVisible = MissionCheckTypeStatic; c->Data = co; UIObject *o = UIObjectCreate(UITYPE_BUTTON, 0, Vec2iZero(), Vec2iZero()); o->Data = brush; o->OnFocusFunc = ActivateBrush; o->OnUnfocusFunc = DeactivateBrush; o->ChangesData = false; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/pencil")); o2->u.Button.IsDownFunc = BrushIsBrushTypePoint; o2->ChangeFunc = BrushSetBrushTypePoint; CSTRDUP(o2->Tooltip, "Point"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/line")); o2->u.Button.IsDownFunc = BrushIsBrushTypeLine; o2->ChangeFunc = BrushSetBrushTypeLine; CSTRDUP(o2->Tooltip, "Line"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/box")); o2->u.Button.IsDownFunc = BrushIsBrushTypeBox; o2->ChangeFunc = BrushSetBrushTypeBox; CSTRDUP(o2->Tooltip, "Box"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/box_filled")); o2->u.Button.IsDownFunc = BrushIsBrushTypeBoxFilled; o2->ChangeFunc = BrushSetBrushTypeBoxFilled; CSTRDUP(o2->Tooltip, "Box filled"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/room")); o2->u.Button.IsDownFunc = BrushIsBrushTypeRoom; o2->ChangeFunc = BrushSetBrushTypeRoom; CSTRDUP(o2->Tooltip, "Room"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/select")); o2->u.Button.IsDownFunc = BrushIsBrushTypeSelect; o2->ChangeFunc = BrushSetBrushTypeSelect; CSTRDUP(o2->Tooltip, "Select and move"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/bucket")); o2->u.Button.IsDownFunc = BrushIsBrushTypeFill; o2->ChangeFunc = BrushSetBrushTypeFill; o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/add")); o2->u.Button.IsDownFunc = BrushIsBrushTypeAddItem; CSTRDUP(o2->Tooltip, "Add items\nRight click to remove"); o2->Pos = pos; o2->OnFocusFunc = NULL; o2->OnUnfocusFunc = NULL; UIObjectAddChild(o2, CreateAddItemObjs(o2->Size, brush, co)); UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/set_key")); o2->u.Button.IsDownFunc = BrushIsBrushTypeSetKey; CSTRDUP(o2->Tooltip, "Set key required for door"); o2->Pos = pos; o2->OnFocusFunc = NULL; o2->OnUnfocusFunc = NULL; UIObjectAddChild(o2, CreateSetKeyObjs(o2->Size, brush)); UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); UIButtonSetPic(o2, PicManagerGetPic(&gPicManager, "editor/set_exit")); o2->u.Button.IsDownFunc = BrushIsBrushTypeSetExit; o2->ChangeFunc = BrushSetBrushTypeSetExit; CSTRDUP(o2->Tooltip, "Set exit area (box drag)"); o2->Pos = pos; UIObjectAddChild(c, o2); UIObjectDestroy(o); o = UIObjectCreate( UITYPE_LABEL, 0, Vec2iZero(), Vec2iNew(60, th)); pos.x = x; pos.y += o2->Size.y; o2 = UIObjectCopy(o); o2->u.LabelFunc = BrushGetMainTypeStr; o2->Data = brush; o2->ChangeFunc = BrushChangeMainType; o2->OnFocusFunc = ActivateBrush; o2->OnUnfocusFunc = DeactivateBrush; CSTRDUP(o2->Tooltip, "Left click to paint the map with this tile type"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x += o2->Size.x; o2 = UIObjectCopy(o); o2->u.LabelFunc = BrushGetSecondaryTypeStr; o2->Data = brush; o2->ChangeFunc = BrushChangeSecondaryType; o2->OnFocusFunc = ActivateBrush; o2->OnUnfocusFunc = DeactivateBrush; CSTRDUP(o2->Tooltip, "Right click to paint the map with this tile type"); o2->Pos = pos; UIObjectAddChild(c, o2); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.LabelFunc = BrushGetSizeStr; o2->Data = brush; o2->ChangeFunc = BrushChangeSize; o2->OnFocusFunc = ActivateBrush; o2->OnUnfocusFunc = DeactivateBrush; o2->Pos = pos; UIObjectAddChild(c, o2); UIObjectDestroy(o); o = UIObjectCreate(UITYPE_TEXTBOX, 0, Vec2iZero(), Vec2iNew(100, th)); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.Textbox.TextLinkFunc = BrushGetGuideImageStr; o2->u.Textbox.MaxLen = sizeof((EditorBrush *)0)->GuideImage - 1; o2->Data = brush; o2->ChangesData = 0; o2->ChangeFunc = BrushLoadGuideImage; CSTRDUP(o2->u.Textbox.Hint, "(Tracing guide image)"); o2->Pos = pos; UIObjectAddChild(c, o2); UIObjectDestroy(o); o = UIObjectCreate(UITYPE_LABEL, 0, Vec2iZero(), Vec2iNew(100, th)); pos.x = x; pos.y += th; o2 = UIObjectCopy(o); o2->u.LabelFunc = BrushGetGuideImageAlphaStr; o2->Data = brush; o2->ChangeFunc = BrushChangeGuideImageAlpha; o2->Pos = pos; UIObjectAddChild(c, o2); UIObjectDestroy(o); return c; }