diff --git a/gamemodes/new.amx b/gamemodes/new.amx deleted file mode 100644 index e29707b..0000000 Binary files a/gamemodes/new.amx and /dev/null differ diff --git a/gamemodes/new.pwn b/gamemodes/new.pwn index 4646d9b..de52f9e 100644 --- a/gamemodes/new.pwn +++ b/gamemodes/new.pwn @@ -50,7 +50,7 @@ main(){} static http_address_available_version[] = "https://pastebin.com/raw/xebukdmH"; -const Float:CURRENT_PAEDITOR_VERSION = 1.1; +const Float:CURRENT_PAEDITOR_VERSION = 1.2; public OnGameModeInit() diff --git a/language/dialogs.inc b/language/dialogs.inc index cda92f4..7a7a01a 100644 --- a/language/dialogs.inc +++ b/language/dialogs.inc @@ -106,27 +106,38 @@ new const language_dialog[][][] = //DG__MAIN_MENU_HELP, "Manage \n\ - Left-click opens a dialogue with created processes\n\ - - Right-click opens a dialogue for selecting multiple processes simultaneously\n\ - Export - Export project\n\ - New - Create a new process\n\ - Delete - Delete process\n\ - Duplicate - Duplicate process\n\ - Bone - Modify bone for the current process\n\ - Symmetry - Create a symmetrical mirrored object from the current one\n\ + - Right-click opens a dialogue for selecting multiple processes simultaneously\n\n\ + Export\n\ + - Export project\n\n\ + New\n\ + - Create a new process\n\n\ + Delete\n\ + - Delete process\n\n\ + Duplicate\n\ + - Duplicate process\n\n\ + Bone\n\ + - Modify bone for the current process\n\n\ + Symmetry\n\ + - Create a symmetrical mirrored object from the current one\n\n\ Objects\n\ - - Left-click opens a dialogue for choosing to set an object or selecting from the list\n\ - - Right-click opens a menu for selecting objects from the list\n\ - Edit - Edit object\n\ + - Left-click opens a dialogue for choosing to set an object or selecting from the list\n\n\ + - Right-click opens a menu for selecting objects from the list\n\n\ + Edit\n\ + - Edit object\n\n\ Color\n\ - Left-click opens a dialogue for choosing to set a color or selecting from the list\n\ - - Right-click opens a menu for selecting colors from the list\n\ - Camera Move - Enable/disable camera rotation with an active panel\n\ - Skin - Set skin\n\ + - Right-click opens a menu for selecting colors from the list\n\n\ + Camera Move\n\ + - Enable/disable camera rotation with an active panel\n\n\ + Skin\n\ + - Set skin\n\n\ Prev Skin & Next Skin\n\ - Left-click enables quick skin change\n\ - - Right-click enables quick skin change and automatic project export\n\ - Animation - Set animation\n\ - Clear Anim - Clear animation\n\n\ + - Right-click enables quick skin change and automatic project export\n\n\ + Animation\n\ + - Set animation\n\n\ + Clear Anim\n\ + - Clear animation\n\n\ /headmove - Enable/disable character head rotation\n\ /setweather - Set weather\n\ /settime - Set time" @@ -244,27 +255,38 @@ new const language_dialog[][][] = //DG__MAIN_MENU_HELP, "Manage \n\ - Нажатие левой кнопкой мыши, открывает диалог с созданными процессами\n\ - - Нажатие правой кнопкой мыши, открывает диалог для выбора несколько процессов одновременно\n\ - Export - Экспортировать проект\n\ - New - Создать новый процесс\n\ - Delete - Удалить процесс\n\ - Dublicate - Продублировать процесс\n\ - Bone - Изменить кость для текущего процесса\n\ - Symmetry - Создать симметрический отзеркаленый объект от текущего\n\ + - Нажатие правой кнопкой мыши, открывает диалог для выбора несколько процессов одновременно\n\n\ + Export\n\ + - Экспортировать проект\n\n\ + New\n\ + - Создать новый процесс\n\n\ + Delete\n\ + - Удалить процесс\n\n\ + Dublicate\n\ + - Продублировать процесс\n\n\ + Bone\n\ + - Изменить кость для текущего процесса\n\n\ + Symmetry\n\ + - Создать симметрический отзеркаленый объект от текущего\n\n\ Objects\n\ - Нажатие левой кнопкой мыши, открывает диалог с выбором установить объект или выбрать из списка\n\ - - Нажатие правой кнопкой мыши, открывает меню выбора объектов из списка\n\ - Edit - Редактирование объекта\n\ + - Нажатие правой кнопкой мыши, открывает меню выбора объектов из списка\n\n\ + Edit\n\ + - Редактирование объекта\n\n\ Color\n\ - Нажатие левой кнопкой мыши, открывает диалог с выбором установить цвет или выбрать из списка\n\ - - Нажатие правой кнопкой мыши, открывает меню выбора цвета из списка\n\ - Camera Move - Включить/отключить вращение камеры при активной панели\n\ - Skin - Установить skin\n\ - Prev Skin & Next Skin\n\ + - Нажатие правой кнопкой мыши, открывает меню выбора цвета из списка\n\n\ + Camera Move\n\ + - Включить/отключить вращение камеры при активной панели\n\n\ + Skin\n\ + - Установить skin\n\ + Prev Skin & Next Skin\n\n\ - Нажатие левой кнопкой мыши, быстрая смена скина\n\ - - Нажатие правой кнопкой мыши, быстрая смена скина и автоматический экспорт проекта\n\ - Animation - Установить анимацию\n\ - Clear Anim - Очистить анимацию\n\n\ + - Нажатие правой кнопкой мыши, быстрая смена скина и автоматический экспорт проекта\n\n\ + Animation\n\ + - Установить анимацию\n\ + Clear Anim\n\ + - Очистить анимацию\n\n\ /headmove - Включить/отключить вращение головы у персонажа\n\ /setweather - Установить погоду\n\ /settime - Установить время" @@ -385,27 +407,38 @@ new const language_dialog[][][] = //DG_MAIN_MENU_HELP, "Manage \n\ - Натискання лiвої кнопки мишi вiдкриває дiалог зi створеними процесами\n\ - - Натискання правої кнопки мишi вiдкриває дiалог для вибору декiлькох процесiв одночасно\n\ - Export - Експорт проекту\n\ - New - Створити новий процес\n\ - Delete - Видалити процес\n\ - Duplicate - Створити копiю процесу\n\ - Bone - Змiнити кiстку для поточного процесу\n\ - Symmetry - Створити симетричний вiдзеркалений об'єкт вiд поточного\n\ + - Натискання правої кнопки мишi вiдкриває дiалог для вибору декiлькох процесiв одночасно\n\n\ + Export\n\ + - Експорт проекту\n\n\ + New\n\ + - Створити новий процес\n\n\ + Delete\n\ + - Видалити процес\n\n\ + Duplicate\n\ + - Створити копiю процесу\n\n\ + Bone\n\ + - Змiнити кiстку для поточного процесу\n\n\ + Symmetry\n\ + - Створити симетричний вiдзеркалений об'єкт вiд поточного\n\n\ Objects\n\ - Натискання лiвої кнопки мишi вiдкриває дiалог для вибору установки об'єкта або вибору зi списку\n\ - - Натискання правої кнопки мишi вiдкриває меню вибору об'єктiв iз списку\n\ - Edit - Редагування об'єкта\n\ + - Натискання правої кнопки мишi вiдкриває меню вибору об'єктiв iз списку\n\n\ + Edit\n\ + - Редагування об'єкта\n\n\ Color\n\ - Натискання лiвої кнопки мишi вiдкриває дiалог для вибору установки кольору або вибору зi списку\n\ - - Натискання правої кнопки мишi вiдкриває меню вибору кольорiв iз списку\n\ - Camera Move - Увiмкнути/вимкнути обертання камери при активнiй панелi\n\ - Skin - Встановити шкiру\n\ + - Натискання правої кнопки мишi вiдкриває меню вибору кольорiв iз списку\n\n\ + Camera Move\n\ + - Увiмкнути/вимкнути обертання камери при активнiй панелi\n\n\ + Skin\n\ + - Встановити шкiру\n\n\ Prev Skin & Next Skin\n\ - Натискання лiвої кнопки мишi для швидкої змiни скина\n\ - - Натискання правої кнопки мишi для швидкої змiни скина та автоматичного експорту проекту\n\ - Animation - Встановити анiмацiю\n\ - Clear Anim - Очистити анiмацiю\n\n\ + - Натискання правої кнопки мишi для швидкої змiни скина та автоматичного експорту проекту\n\n\ + Animation\n\ + - Встановити анiмацiю\n\n\ + Clear Anim\n\ + - Очистити анiмацiю\n\n\ /headmove - Увiмкнути/вимкнути обертання голови у персонажа\n\ /setweather - Встановити погоду\n\ /settime - Встановити час" @@ -523,29 +556,40 @@ new const language_dialog[][][] = }, { //DG_MAIN_MENU_HELP, - "Manage \n\ + "Manage\n\ - Нацiсканне левай кнопкай мышы адчыняе дыялог з створанымi працэсамi\n\ - - Нацiсканне правай кнопкай мышы адчыняе дыялог для выбару некалькiх працэсаў адначасова\n\ - Export - Экспартаваць праект\n\ - New - Стварыць новы працэс\n\ - Delete - Выдалiць працэс\n\ - Dublicate - Прадубляваць працэс\n\ - Bone - Змянiць косьць для бягучага працэсу\n\ - Symmetry - Стварыць сiметрычны адзеркалены аб'ект ад бягучага\n\ + - Нацiсканне правай кнопкай мышы адчыняе дыялог для выбару некалькiх працэсаў адначасова\n\n\ + Export\n\ + - Экспартаваць праект\n\n\ + New\n\ + - Стварыць новы працэс\n\n\ + Delete\n\ + - Выдалiць працэс\n\n\ + Dublicate\n\ + - Прадубляваць працэс\n\n\ + Bone\n\ + - Змянiць косьць для бягучага працэсу\n\n\ + Symmetry\n\ + - Стварыць сiметрычны адзеркалены аб'ект ад бягучага\n\n\ Objects\n\ - Нацiсканне левай кнопкай мышы адчыняе дыялог з выбарам устанавiць аб'ект цi выбраць з спiсу\n\ - - Нацiсканне правай кнопкай мышы адчыняе мэню выбару аб'ектаў з спiсу\n\ - Edit - Рэдагаванне аб'екта\n\ + - Нацiсканне правай кнопкай мышы адчыняе мэню выбару аб'ектаў з спiсу\n\n\ + Edit\n\ + - Рэдагаванне аб'екта\n\n\ Color\n\ - Нацiсканне левай кнопкай мышы адчыняе дыялог з выбарам устанавiць колер цi выбраць з спiсу\n\ - - Нацiсканне правай кнопкай мышы адчыняе мэню выбару колеру з спiсу\n\ - Camera Move - Уключыць/адключыць варачэнне камеры пры актыўнай панэлi\n\ - Skin - Устанавiць скiн\n\ + - Нацiсканне правай кнопкай мышы адчыняе мэню выбару колеру з спiсу\n\n\ + Camera Move\n\ + - Уключыць/адключыць варачэнне камеры пры актыўнай панэлi\n\n\ + Skin\n\ + - Устанавiць скiн\n\n\ Prev Skin & Next Skin\n\ - Нацiсканне левай кнопкай мышы, хуткая змена скiна\n\ - - Нацiсканне правай кнопкай мышы, хуткая змена скiна i аўтаматычны экспарт праекта\n\ - Animation - Устанавiць анiмацыю\n\ - Clear Anim - Ачысцiць анiмацыю\n\n\ + - Нацiсканне правай кнопкай мышы, хуткая змена скiна i аўтаматычны экспарт праекта\n\n\ + Animation\n\ + - Устанавiць анiмацыю\n\n\ + Clear Anim\n\ + - Ачысцiць анiмацыю\n\n\ /headmove - Уключыць/адключыць варачэнне галавы ў персанажа\n\ /setweather - Устанавiць надвор'е\n\ /settime - Устанавiць час" diff --git a/source/attach_menu/animations.inc b/source/attach_menu/animations.inc index 4cd904d..65d7fd6 100644 --- a/source/attach_menu/animations.inc +++ b/source/attach_menu/animations.inc @@ -23,7 +23,7 @@ public OnGuiAttachMenuClicked(playerid, typeid) else if (typeid == GUI_ATTACH_MENU_ANIMATION_CLEAR) { ClearAnimations(playerid); - attachmain_JsonSaveAnimation(playerid, -1); + project_JsonSaveAnimation(playerid, -1); return 1; } #if defined attachanim_OnGuiAttachMenu @@ -189,7 +189,7 @@ DialogResponse:dAttachAnimationAction(playerid, response, listitem, inputtext[]) new anim_index = gAttachAnimationsLibraryIndex[playerid][0]; attachanim_ApplyAnimationIndex(playerid, anim_index); - attachmain_JsonSaveAnimation(playerid, anim_index); + project_JsonSaveAnimation(playerid, anim_index); language_MessageInfo(playerid, MSG_ANIM_APPLIED_TO_CHARACTER); } else diff --git a/source/attach_menu/bone.inc b/source/attach_menu/bone.inc index 3f2f7ed..2b8551f 100644 --- a/source/attach_menu/bone.inc +++ b/source/attach_menu/bone.inc @@ -77,7 +77,7 @@ DialogResponse:dAttachMenuChangeBone(playerid, response, listitem, inputtext[]) new modelid = attachmain_GetObjectSlotId(playerid, slotid); attachmain_SetBoneSlotId(playerid, slotid, boneid); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); SendClientMessage(playerid, COLOR_WHITE, ""); diff --git a/source/attach_menu/colors.inc b/source/attach_menu/colors.inc index 8c48309..f83e4a7 100644 --- a/source/attach_menu/colors.inc +++ b/source/attach_menu/colors.inc @@ -79,6 +79,16 @@ public OnVirtualKeyReleased(playerid, key_vk) if ((ATTACH_COLOR_C1_COORD_BTN_MIN_X <= x <= ATTACH_COLOR_C1_COORD_BTN_MAX_X) && (ATTACH_COLOR_C1_COORD_BTN_MIN_Y <= y <= ATTACH_COLOR_C1_COORD_BTN_MAX_Y)) { + if (!attachmain_IsCreateProcess(playerid)) + { + language_MessageError(playerid, MSG_PROCESS_START_PRESS_NEW); + return 0; + } + if (!attachmain_IsValidObject(playerid)) + { + language_MessageError(playerid, MSG_START_SELECT_OBJ_PRESS_OBJ); + return 0; + } gAttachColorsSelectColorId[playerid] = 0; gAttachColorsPage[playerid] = 0; gAttachObjectOpenRmouse[playerid] = true; @@ -88,6 +98,16 @@ public OnVirtualKeyReleased(playerid, key_vk) else if ((ATTACH_COLOR_C2_COORD_BTN_MIN_X <= x <= ATTACH_COLOR_C2_COORD_BTN_MAX_X) && (ATTACH_COLOR_C2_COORD_BTN_MIN_Y <= y <= ATTACH_COLOR_C2_COORD_BTN_MAX_Y)) { + if (!attachmain_IsCreateProcess(playerid)) + { + language_MessageError(playerid, MSG_PROCESS_START_PRESS_NEW); + return 0; + } + if (!attachmain_IsValidObject(playerid)) + { + language_MessageError(playerid, MSG_START_SELECT_OBJ_PRESS_OBJ); + return 0; + } gAttachColorsSelectColorId[playerid] = 1; gAttachColorsPage[playerid] = 0; gAttachObjectOpenRmouse[playerid] = true; @@ -166,7 +186,7 @@ DialogResponse:dAttachColorMenu(playerid, response, listitem, inputtext[]) { attachmain_SetMaterialColor2(playerid, slotid, 0); } - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); attachmain_SetMainAttachObject(playerid, slotid); language_MessageInfo(playerid, MSG_COLOR_HEX_REMOVED_SUCCESS); @@ -229,7 +249,7 @@ DialogResponse:dAttachColorInput(playerid, response, listitem, inputtext[]) attachmain_SetMaterialColor2(playerid, slotid, hex_code); } attachmain_SetMainAttachObject(playerid, slotid); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); language_MessageInfo(playerid, MSG_COLOR_HEX_APPLIED_SUCCESS); return 1; @@ -400,7 +420,7 @@ DialogResponse:dAttachColorsAction(playerid, response, listitem, inputtext[]) attachmain_SetMaterialColor2(playerid, slotid, hex_code); } attachmain_SetMainAttachObject(playerid, slotid); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); language_MessageInfo(playerid, MSG_COLOR_HEX_APPLIED_SUCCESS); } diff --git a/source/attach_menu/delete.inc b/source/attach_menu/delete.inc index 1bda4a8..f25c579 100644 --- a/source/attach_menu/delete.inc +++ b/source/attach_menu/delete.inc @@ -67,14 +67,30 @@ DialogResponse:dAttachDeleteMenu(playerid, response, listitem, inputtext[]) return 0; } new slotid = attachmain_GetCurrentSlotId(playerid); + new per_slotid = Iter_Previous(AttachObjectSlots[playerid], slotid); + new last_slotid = Iter_Last(AttachObjectSlots[playerid]); + new new_slotid; attachmain_ClearSlotId(playerid, slotid); attachmain_IterRemoveSlotId(playerid, slotid); - attachmain_JsonDeleteAttach(playerid, slotid); - - new first_slotid = attachmain_GetFirstSlotId(playerid); + project_JsonDeleteAttach(playerid, slotid); - attachmain_SetCurrentSlotId(playerid, first_slotid); + if (per_slotid > last_slotid) + { + new_slotid = Iter_First(AttachObjectSlots[playerid]); + } + else + { + new_slotid = per_slotid; + } + if (Iter_Count(AttachObjectSlots[playerid]) == 0) + { + attachmain_SetCurrentSlotId(playerid, ITER_NONE); + } + else + { + attachmain_SetCurrentSlotId(playerid, new_slotid); + } return 1; } @@ -116,7 +132,7 @@ DialogResponse:dAttachMultiDeleteMenu(playerid, response, listitem, inputtext[]) } attachmain_ClearSlotId(playerid, i); attachmain_IterRemoveSlotId(playerid, i); - attachmain_JsonDeleteAttach(playerid, i); + project_JsonDeleteAttach(playerid, i); attachmain_SetMultiObjSlot(playerid, i, ITER_NONE); Iter_SafeRemove(AttachMultiObjectSlots[playerid], i, i); diff --git a/source/attach_menu/dublicate.inc b/source/attach_menu/dublicate.inc index 4fa6d38..e761cff 100644 --- a/source/attach_menu/dublicate.inc +++ b/source/attach_menu/dublicate.inc @@ -162,7 +162,7 @@ DialogResponse:dAttachMenuDublicateNote(playerid, response, listitem, inputtext[ materialcolor1, materialcolor2 ); - attachmain_JsonSaveAttach(playerid, new_slotid); + project_JsonSaveAttach(playerid, new_slotid); attachmain_SetCurrentSlotId(playerid, new_slotid); attachmain_AddIterSlotId(playerid, new_slotid); attachmain_SetMainAttachObject(playerid, new_slotid); diff --git a/source/attach_menu/edit.inc b/source/attach_menu/edit.inc index 39d6b75..5174aa7 100644 --- a/source/attach_menu/edit.inc +++ b/source/attach_menu/edit.inc @@ -96,7 +96,7 @@ public OnPlayerEditAttachedObject( fScaleZ ); language_MessageInfo(playerid, MSG_CHANGES_SAVED_AFTER_EDIT); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); } gui_atatch_menu_ShowCursor(playerid); gui_camera_rot_ShowInfo(playerid); diff --git a/source/attach_menu/edit_button.inc b/source/attach_menu/edit_button.inc index d9b8a37..6e65918 100644 --- a/source/attach_menu/edit_button.inc +++ b/source/attach_menu/edit_button.inc @@ -400,7 +400,7 @@ stock attacheditbtn_PressSave(playerid) material_color_2 ); attachmain_SetMainAttachObject(playerid, i); - attachmain_JsonSaveAttach(playerid, i); + project_JsonSaveAttach(playerid, i); } gui_ath_edit_DestroyTextdraws(playerid); attacheditbtn_SetStartEdit(playerid, false); diff --git a/source/attach_menu/export.inc b/source/attach_menu/export.inc index 25bc961..ac9a7d4 100644 --- a/source/attach_menu/export.inc +++ b/source/attach_menu/export.inc @@ -7,14 +7,23 @@ public OnGuiAttachMenuClicked(playerid, typeid) { if (typeid == GUI_ATTACH_MENU_EXPORT) { - if (!attachmain_IsCreateProcess(playerid)) + if (Iter_Count(AttachObjectSlots[playerid]) == 0) { language_MessageError(playerid, MSG_PROCESS_START_PRESS_NEW); return 0; } - if (!attachmain_IsValidObject(playerid)) + new bool: is_valid_export; + foreach (AttachObjectSlots[playerid], i) { - language_MessageError(playerid, MSG_START_SELECT_OBJ_PRESS_OBJ); + if (attachmain_GetObjectSlotId(playerid, i) != CORE_INVALID_OBJECT_MODEL) + { + is_valid_export = true; + break; + } + } + if (!is_valid_export) + { + language_MessageError(playerid, MSG_TO_SET_OBJECT_PRESS_OBJECTS); return 0; } if (attacheditbtn_IsStartEdit(playerid)) diff --git a/source/attach_menu/main.inc b/source/attach_menu/main.inc index d3cdae4..de99ff0 100644 --- a/source/attach_menu/main.inc +++ b/source/attach_menu/main.inc @@ -457,176 +457,6 @@ stock attachmain_GetMultiObjSlot(playerid, slotid) return gAttachMenuMultiObject[playerid][slotid]; } - -stock attachmain_JsonSaveSkin(playerid) -{ - new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; - project_GetJsonName(playerid, name_project); - - new JsonNode:node; - new JsonCallResult:result = JSON_ParseFile(name_project, node); - - if (result == JSON_CALL_NO_ERR) - { - JSON_SetInt(node, "skinid", GetPlayerSkin(playerid)); - JSON_SaveFile(name_project, node, 4); - } - JSON_Cleanup(node); - return 1; -} - -stock attachmain_JsonSaveAnimation(playerid, index_anim) -{ - new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; - - project_GetJsonName(playerid, name_project); - - new JsonNode:node; - new JsonCallResult:result = JSON_ParseFile(name_project, node); - - if (result == JSON_CALL_NO_ERR) - { - JSON_SetInt(node, "animation", index_anim); - JSON_SaveFile(name_project, node, 4); - } - JSON_Cleanup(node); - return 1; -} - -stock attachmain_JsonSaveAttach(playerid, slotid) -{ - new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; - - project_GetJsonName(playerid, name_project); - - new - JsonNode:node, - JsonNode:item, - JsonNode:obj, - JsonCallResult:result = JSON_ParseFile(name_project, node); - - if (result == JSON_CALL_NO_ERR) - { - new note[CORE_MAX_LENGHT_NAME_NOTE + 1]; - - new - objectid, - boneid, - Float:offset_x, - Float:offset_y, - Float:offset_z, - Float:rot_x, - Float:rot_y, - Float:rot_z, - Float:scale_x, - Float:scale_y, - Float:scale_z, - material_color_1, - material_color_2; - - attachmain_GetObjectSlotNote(playerid, slotid, note); - - attachmain_GetMainAttachData( - playerid, - slotid, - objectid, - boneid, - offset_x, - offset_y, - offset_z, - rot_x, - rot_y, - rot_z, - scale_x, - scale_y, - scale_z, - material_color_1, - material_color_2 - ); - new length; - new json_slotid; - - JSON_GetObject(node, "attach", obj); - JSON_ArrayLength(obj, length); - - for (new i; i < length; i++) - { - JSON_ArrayObject(obj, i, item); - - JSON_GetInt(item, "slotid", json_slotid); - - if (json_slotid == slotid) - { - JSON_ArrayRemoveIndex(node, "attach", i); - break; - } - } - JSON_ArrayAppend(node, "attach", JSON_Object( - "slotid", JSON_Int(slotid), - "boneid", JSON_Int(boneid), - "objectid", JSON_Int(objectid), - "offset_x", JSON_Float(offset_x), - "offset_y", JSON_Float(offset_y), - "offset_z", JSON_Float(offset_z), - "rot_x", JSON_Float(rot_x), - "rot_y", JSON_Float(rot_y), - "rot_z", JSON_Float(rot_z), - "scale_x", JSON_Float(scale_x), - "scale_y", JSON_Float(scale_y), - "scale_z", JSON_Float(scale_z), - "material_color_1", JSON_Int(material_color_1), - "material_color_2", JSON_Int(material_color_2), - "note", JSON_String(note)) - ); - JSON_SaveFile(name_project, node, 4); - } - JSON_Cleanup(obj); - JSON_Cleanup(item); - JSON_Cleanup(node); - return 1; -} - - -stock attachmain_JsonDeleteAttach(playerid, slotid) -{ - new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; - - project_GetJsonName(playerid, name_project); - - new - JsonNode:node, - JsonNode:item, - JsonNode:attachArray, - JsonCallResult:result = JSON_ParseFile(name_project, node); - - if (result == JSON_CALL_NO_ERR) - { - new length; - new json_slotid; - - JSON_GetObject(node, "attach", attachArray); - JSON_ArrayLength(attachArray, length); - - for (new i; i < length; i++) - { - JSON_ArrayObject(attachArray, i, item); - - JSON_GetInt(item, "slotid", json_slotid); - - if (json_slotid == slotid) - { - JSON_ArrayRemoveIndex(node, "attach", i); - break; - } - } - JSON_SaveFile(name_project, node, 4); - } - JSON_Cleanup(attachArray); - JSON_Cleanup(item); - JSON_Cleanup(node); - return 1; -} - stock attachmain_IsCreateProcess(playerid) { new slotid = attachmain_GetCurrentSlotId(playerid); diff --git a/source/attach_menu/new.inc b/source/attach_menu/new.inc index a686278..7448646 100644 --- a/source/attach_menu/new.inc +++ b/source/attach_menu/new.inc @@ -10,7 +10,7 @@ public OnGuiAttachMenuClicked(playerid, typeid) { if (attachmain_GetFreeSlotId(playerid) == ITER_NONE) { - language_MessageInfo(playerid, MSG_NO_AVAILABLE_ATTACH_SLOTS); + language_MessageError(playerid, MSG_NO_AVAILABLE_ATTACH_SLOTS); return 0; } Dialog_Show(playerid, "dAttachMenuNew"); @@ -75,7 +75,7 @@ DialogResponse:dAttachMenuNew(playerid, response, listitem, inputtext[]) attachmain_SetCurrentSlotId(playerid, slotid); attachmain_SetBoneSlotId(playerid, slotid, boneid); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); SendClientMessage(playerid, COLOR_WHITE, ""); diff --git a/source/attach_menu/objects.inc b/source/attach_menu/objects.inc index 742a43d..9f0efa7 100644 --- a/source/attach_menu/objects.inc +++ b/source/attach_menu/objects.inc @@ -301,7 +301,7 @@ DialogResponse:dAttachMenuObjectNote(playerid, response, listitem, inputtext[]) playerid, slotid, !lenght_note ? CORE_EMPTY_NOTE : inputtext ); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); attachmain_SetMainAttachObject(playerid, slotid); gui_ath_obj_DestroyTextdraws(playerid); diff --git a/source/attach_menu/skins.inc b/source/attach_menu/skins.inc index 04206ff..8b48bce 100644 --- a/source/attach_menu/skins.inc +++ b/source/attach_menu/skins.inc @@ -152,7 +152,7 @@ DialogResponse:dAttachSkinMenu(playerid, response, listitem, inputtext[]) gui_atatch_menu_ShowCursor(playerid); gui_camera_rot_ShowInfo(playerid); - attachmain_JsonSaveSkin(playerid); + project_JsonSaveSkin(playerid); return 1; } @@ -165,7 +165,7 @@ static attachskin_SetPrevSkin(playerid, bool: is_export = false) skinid = ATTACH_SKIN_MAX_ID_SKIN; } SetPlayerSkin(playerid, skinid); - attachmain_JsonSaveSkin(playerid); + project_JsonSaveSkin(playerid); new string[38 + (- 2 + 3) * 2] = "~y~Skin %d"; @@ -191,7 +191,7 @@ static attachskin_SetNextSkin(playerid, bool: is_export = false) skinid = ATTACH_SKIN_MIN_ID_SKIN; } SetPlayerSkin(playerid, skinid); - attachmain_JsonSaveSkin(playerid); + project_JsonSaveSkin(playerid); new string[38 + (- 2 + 3) * 2] = "~y~Skin %d"; diff --git a/source/attach_menu/symmetry.inc b/source/attach_menu/symmetry.inc index d6d59c2..2a323df 100644 --- a/source/attach_menu/symmetry.inc +++ b/source/attach_menu/symmetry.inc @@ -420,7 +420,7 @@ stock asymmetry_PressSave(playerid) material_color_1, material_color_2 ); - attachmain_JsonSaveAttach(playerid, slotid); + project_JsonSaveAttach(playerid, slotid); attachmain_SetCurrentSlotId(playerid, slotid); attachmain_AddIterSlotId(playerid, slotid); attachmain_SetMainAttachObject(playerid, slotid); diff --git a/source/connect.inc b/source/connect.inc index 9c608e6..a44325f 100644 --- a/source/connect.inc +++ b/source/connect.inc @@ -49,7 +49,7 @@ public OnPlayerConnect(playerid) SetSpawnInfo(playerid, 255, 0, 0, 0, 0, 1.0, -1, -1, -1, -1, -1, -1); TogglePlayerSpectating(playerid, false); - GameTextForPlayer(playerid, "~g~Player Attach Editor", 3000, 4); + GameTextForPlayer(playerid, "~y~PAEditor", 3000, 4); Dialog_Show(playerid, "dLanguageChoose"); return 1; diff --git a/source/gui/attach_menu.inc b/source/gui/attach_menu.inc index 4f62a61..3571b4f 100644 --- a/source/gui/attach_menu.inc +++ b/source/gui/attach_menu.inc @@ -696,7 +696,7 @@ public OnGameModeInit() gui_AttachMenu[69] = TextDrawCreate(450.0999, 420.8927, "<____>"); TextDrawLetterSize(gui_AttachMenu[69], 0.3123, 1.2764); TextDrawAlignment(gui_AttachMenu[69], 1); - TextDrawColor(gui_AttachMenu[69], -1); + TextDrawColor(gui_AttachMenu[69], -1061109505); TextDrawBackgroundColor(gui_AttachMenu[69], 255); TextDrawFont(gui_AttachMenu[69], 1); TextDrawSetProportional(gui_AttachMenu[69], 1); diff --git a/source/language.inc b/source/language.inc index dd96f18..116428d 100644 --- a/source/language.inc +++ b/source/language.inc @@ -4,7 +4,7 @@ #define _language_inc -const LANGUAGE_MAX_LENGHT_STRING_DL = 1450; +const LANGUAGE_MAX_LENGHT_STRING_DL = 1600; //////////////////////////////////////// static enum diff --git a/source/project/loading.inc b/source/project/loading.inc index 0da3359..4435d97 100644 --- a/source/project/loading.inc +++ b/source/project/loading.inc @@ -187,17 +187,17 @@ DialogResponse:dAttachMainLoadProjectAct(playerid, response, listitem, inputtext new slotid; new boneid; new modelid; - new Float:fOffsetX; - new Float:fOffsetY; - new Float:fOffsetZ; - new Float:fRotX; - new Float:fRotY; - new Float:fRotZ; - new Float:fScaleX; - new Float:fScaleY; - new Float:fScaleZ; - new materialcolor1; - new materialcolor2; + new Float:offset_x; + new Float:offset_y; + new Float:offset_z; + new Float:rot_x; + new Float:rot_y; + new Float:rot_z; + new Float:scale_x; + new Float:scale_y; + new Float:scale_z; + new material_color_1; + new material_color_2; new note[CORE_MAX_LENGHT_NAME_NOTE + 1]; new skinid; @@ -220,20 +220,20 @@ DialogResponse:dAttachMainLoadProjectAct(playerid, response, listitem, inputtext JSON_GetInt(item, "boneid", boneid); JSON_GetInt(item, "objectid", modelid); - JSON_GetFloat(item, "fOffsetX", fOffsetX); - JSON_GetFloat(item, "fOffsetY", fOffsetY); - JSON_GetFloat(item, "fOffsetZ", fOffsetZ); + JSON_GetFloat(item, "fOffsetX", offset_x); + JSON_GetFloat(item, "fOffsetY", offset_y); + JSON_GetFloat(item, "fOffsetZ", offset_z); - JSON_GetFloat(item, "fRotX", fRotX); - JSON_GetFloat(item, "fRotY", fRotY); - JSON_GetFloat(item, "fRotZ", fRotZ); + JSON_GetFloat(item, "fRotX", rot_x); + JSON_GetFloat(item, "fRotY", rot_y); + JSON_GetFloat(item, "fRotZ", rot_z); - JSON_GetFloat(item, "fScaleX", fScaleX); - JSON_GetFloat(item, "fScaleY", fScaleY); - JSON_GetFloat(item, "fScaleZ", fScaleZ); + JSON_GetFloat(item, "fScaleX", scale_x); + JSON_GetFloat(item, "fScaleY", scale_y); + JSON_GetFloat(item, "fScaleZ", scale_z); - JSON_GetInt(item, "materialcolor1", materialcolor1); - JSON_GetInt(item, "materialcolor2", materialcolor2); + JSON_GetInt(item, "materialcolor1", material_color_1); + JSON_GetInt(item, "materialcolor2", material_color_2); JSON_GetString(item, "note", note, sizeof(note)); @@ -242,17 +242,17 @@ DialogResponse:dAttachMainLoadProjectAct(playerid, response, listitem, inputtext slotid, modelid, boneid, - fOffsetX, - fOffsetY, - fOffsetZ, - fRotX, - fRotY, - fRotZ, - fScaleX, - fScaleY, - fScaleZ, - materialcolor1, - materialcolor2 + offset_x, + offset_y, + offset_z, + rot_x, + rot_y, + rot_z, + scale_x, + scale_y, + scale_z, + material_color_1, + material_color_2 ); attachmain_SetObjectSlotNote(playerid, slotid, note); diff --git a/source/project/main.inc b/source/project/main.inc index dc07a07..7d6fec9 100644 --- a/source/project/main.inc +++ b/source/project/main.inc @@ -169,4 +169,174 @@ stock project_SetFileName(playerid, const name[]) gProjectFileName[playerid][0] = EOS; strcat(gProjectFileName[playerid], string); return 1; +} + + +stock project_JsonSaveSkin(playerid) +{ + new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; + project_GetJsonName(playerid, name_project); + + new JsonNode:node; + new JsonCallResult:result = JSON_ParseFile(name_project, node); + + if (result == JSON_CALL_NO_ERR) + { + JSON_SetInt(node, "skinid", GetPlayerSkin(playerid)); + JSON_SaveFile(name_project, node, 4); + } + JSON_Cleanup(node); + return 1; +} + +stock project_JsonSaveAnimation(playerid, index_anim) +{ + new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; + + project_GetJsonName(playerid, name_project); + + new JsonNode:node; + new JsonCallResult:result = JSON_ParseFile(name_project, node); + + if (result == JSON_CALL_NO_ERR) + { + JSON_SetInt(node, "animation", index_anim); + JSON_SaveFile(name_project, node, 4); + } + JSON_Cleanup(node); + return 1; +} + +stock project_JsonSaveAttach(playerid, slotid) +{ + new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; + + project_GetJsonName(playerid, name_project); + + new + JsonNode:node, + JsonNode:item, + JsonNode:obj, + JsonCallResult:result = JSON_ParseFile(name_project, node); + + if (result == JSON_CALL_NO_ERR) + { + new note[CORE_MAX_LENGHT_NAME_NOTE + 1]; + + new + objectid, + boneid, + Float:offset_x, + Float:offset_y, + Float:offset_z, + Float:rot_x, + Float:rot_y, + Float:rot_z, + Float:scale_x, + Float:scale_y, + Float:scale_z, + material_color_1, + material_color_2; + + attachmain_GetObjectSlotNote(playerid, slotid, note); + + attachmain_GetMainAttachData( + playerid, + slotid, + objectid, + boneid, + offset_x, + offset_y, + offset_z, + rot_x, + rot_y, + rot_z, + scale_x, + scale_y, + scale_z, + material_color_1, + material_color_2 + ); + new length; + new json_slotid; + + JSON_GetObject(node, "attach", obj); + JSON_ArrayLength(obj, length); + + for (new i; i < length; i++) + { + JSON_ArrayObject(obj, i, item); + + JSON_GetInt(item, "slotid", json_slotid); + + if (json_slotid == slotid) + { + JSON_ArrayRemoveIndex(node, "attach", i); + break; + } + } + JSON_ArrayAppend(node, "attach", JSON_Object( + "slotid", JSON_Int(slotid), + "boneid", JSON_Int(boneid), + "objectid", JSON_Int(objectid), + "fOffsetX", JSON_Float(offset_x), + "fOffsetY", JSON_Float(offset_y), + "fOffsetZ", JSON_Float(offset_z), + "fRotX", JSON_Float(rot_x), + "fRotY", JSON_Float(rot_y), + "fRotZ", JSON_Float(rot_z), + "fScaleX", JSON_Float(scale_x), + "fScaleY", JSON_Float(scale_y), + "fScaleZ", JSON_Float(scale_z), + "materialcolor1", JSON_Int(material_color_1), + "materialcolor2", JSON_Int(material_color_2), + "note", JSON_String(note)) + ); + JSON_SaveFile(name_project, node, 4); + } + JSON_Cleanup(obj); + JSON_Cleanup(item); + JSON_Cleanup(node); + return 1; +} + + +stock project_JsonDeleteAttach(playerid, slotid) +{ + new name_project[CORE_MAX_LENGHT_FOLDER_PROJECT]; + + project_GetJsonName(playerid, name_project); + + new + JsonNode:node, + JsonNode:item, + JsonNode:attachArray, + JsonCallResult:result = JSON_ParseFile(name_project, node); + + if (result == JSON_CALL_NO_ERR) + { + new length; + new json_slotid; + + JSON_GetObject(node, "attach", attachArray); + JSON_ArrayLength(attachArray, length); + + for (new i; i < length; i++) + { + JSON_ArrayObject(attachArray, i, item); + + JSON_GetInt(item, "slotid", json_slotid); + + if (json_slotid == slotid) + { + JSON_ArrayRemoveIndex(node, "attach", i); + break; + } + } + JSON_SaveFile(name_project, node, 4); + } + JSON_Cleanup(attachArray); + JSON_Cleanup(item); + JSON_Cleanup(node); + return 1; } \ No newline at end of file