From c24586ce02f884882c053bfcc95eb96ea771e1b3 Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 21 Apr 2015 11:53:28 +0200 Subject: [PATCH 1/8] Reworked the result output GUI on the main page --- addons/atragmx/RscTitles.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index fca0a6fcfe..5fd3339f28 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -523,9 +523,12 @@ class ATragMX_Display { x=0.550*safezoneW+safezoneX+0.32; text="Cur"; }; - class TEXT_ELEVATION_OUTPUT_ABSOLUTE: ATragMX_RscEdit { + class TEXT_ELEVATION_OUTPUT_ABSOLUTE: ATragMX_RscText { idc=400; - w=0.07; + style=160; + sizeEx=0.025; + w=0.065; + h=0.032; x=0.550*safezoneW+safezoneX+0.17; y=0.265*safezoneH+safezoneY+0.50; text=""; @@ -537,7 +540,6 @@ class ATragMX_Display { class TEXT_ELEVATION_INPUT_CURRENT: TEXT_ELEVATION_OUTPUT_ABSOLUTE { idc=402; x=0.550*safezoneW+safezoneX+0.323; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(parse_input); call FUNC(update_result)}); }; class TEXT_WINDAGE: TEXT_ELEVATION { idc=41; @@ -555,7 +557,6 @@ class ATragMX_Display { class TEXT_WINDAGE_INPUT_CURRENT: TEXT_WINDAGE_OUTPUT_ABSOLUTE { idc=412; x=0.550*safezoneW+safezoneX+0.323; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(parse_input); call FUNC(update_result)}); }; class TEXT_LEAD: TEXT_GUN { idc=42; From aabec2aea2a95ec0a386e563657d2196dfafcb89 Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Tue, 21 Apr 2015 04:02:10 -0700 Subject: [PATCH 2/8] Converting Tabs to Spaces. Confirming UTF-8 --- tools/make.py | 1690 +++++++++++++++++++++++++------------------------ 1 file changed, 846 insertions(+), 844 deletions(-) diff --git a/tools/make.py b/tools/make.py index 5146a666bb..aaaf6501c5 100644 --- a/tools/make.py +++ b/tools/make.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python # vim: set fileencoding=utf-8 : # make.py @@ -35,8 +35,8 @@ __version__ = "0.4" import sys if sys.version_info[0] == 2: - print("Python 3 is required.") - sys.exit(1) + print("Python 3 is required.") + sys.exit(1) import os import os.path @@ -52,7 +52,7 @@ import time import re if sys.platform == "win32": - import winreg + import winreg ######## GLOBALS ######### work_drive = "" @@ -70,369 +70,371 @@ optionals_root = "" # -1 -> Directory does not exist # -2 -> General error (see stack traceback) def get_directory_hash(directory): - directory_hash = hashlib.sha1() - if not os.path.exists (directory): - return -1 + directory_hash = hashlib.sha1() + if not os.path.exists (directory): + return -1 - try: - for root, dirs, files in os.walk(directory): - for names in files: - path = os.path.join(root, names) - try: - f = open(path, 'rb') - except: - # You can't open the file for some reason - f.close() - continue + try: + for root, dirs, files in os.walk(directory): + for names in files: + path = os.path.join(root, names) + try: + f = open(path, 'rb') + except: + # You can't open the file for some reason + f.close() + continue - while 1: - # Read file in as little chunks - buf = f.read(4096) - if not buf: break - new = hashlib.sha1(buf) - directory_hash.update(new.digest()) - f.close() + while 1: + # Read file in as little chunks + buf = f.read(4096) + if not buf: break + new = hashlib.sha1(buf) + directory_hash.update(new.digest()) + f.close() - except: - # Print the stack traceback - traceback.print_exc() - return -2 + except: + # Print the stack traceback + traceback.print_exc() + return -2 - return directory_hash.hexdigest() + return directory_hash.hexdigest() # Copyright (c) André Burgaud # http://www.burgaud.com/bring-colors-to-the-windows-console-with-python/ if sys.platform == "win32": - from ctypes import windll, Structure, c_short, c_ushort, byref + from ctypes import windll, Structure, c_short, c_ushort, byref - SHORT = c_short - WORD = c_ushort + SHORT = c_short + WORD = c_ushort - class COORD(Structure): - """struct in wincon.h.""" - _fields_ = [ - ("X", SHORT), - ("Y", SHORT)] + class COORD(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("X", SHORT), + ("Y", SHORT)] - class SMALL_RECT(Structure): - """struct in wincon.h.""" - _fields_ = [ - ("Left", SHORT), - ("Top", SHORT), - ("Right", SHORT), - ("Bottom", SHORT)] + class SMALL_RECT(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("Left", SHORT), + ("Top", SHORT), + ("Right", SHORT), + ("Bottom", SHORT)] - class CONSOLE_SCREEN_BUFFER_INFO(Structure): - """struct in wincon.h.""" - _fields_ = [ - ("dwSize", COORD), - ("dwCursorPosition", COORD), - ("wAttributes", WORD), - ("srWindow", SMALL_RECT), - ("dwMaximumWindowSize", COORD)] + class CONSOLE_SCREEN_BUFFER_INFO(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("dwSize", COORD), + ("dwCursorPosition", COORD), + ("wAttributes", WORD), + ("srWindow", SMALL_RECT), + ("dwMaximumWindowSize", COORD)] - # winbase.h - STD_INPUT_HANDLE = -10 - STD_OUTPUT_HANDLE = -11 - STD_ERROR_HANDLE = -12 + # winbase.h + STD_INPUT_HANDLE = -10 + STD_OUTPUT_HANDLE = -11 + STD_ERROR_HANDLE = -12 - # wincon.h - FOREGROUND_BLACK = 0x0000 - FOREGROUND_BLUE = 0x0001 - FOREGROUND_GREEN = 0x0002 - FOREGROUND_CYAN = 0x0003 - FOREGROUND_RED = 0x0004 - FOREGROUND_MAGENTA = 0x0005 - FOREGROUND_YELLOW = 0x0006 - FOREGROUND_GREY = 0x0007 - FOREGROUND_INTENSITY = 0x0008 # foreground color is intensified. + # wincon.h + FOREGROUND_BLACK = 0x0000 + FOREGROUND_BLUE = 0x0001 + FOREGROUND_GREEN = 0x0002 + FOREGROUND_CYAN = 0x0003 + FOREGROUND_RED = 0x0004 + FOREGROUND_MAGENTA = 0x0005 + FOREGROUND_YELLOW = 0x0006 + FOREGROUND_GREY = 0x0007 + FOREGROUND_INTENSITY = 0x0008 # foreground color is intensified. - BACKGROUND_BLACK = 0x0000 - BACKGROUND_BLUE = 0x0010 - BACKGROUND_GREEN = 0x0020 - BACKGROUND_CYAN = 0x0030 - BACKGROUND_RED = 0x0040 - BACKGROUND_MAGENTA = 0x0050 - BACKGROUND_YELLOW = 0x0060 - BACKGROUND_GREY = 0x0070 - BACKGROUND_INTENSITY = 0x0080 # background color is intensified. + BACKGROUND_BLACK = 0x0000 + BACKGROUND_BLUE = 0x0010 + BACKGROUND_GREEN = 0x0020 + BACKGROUND_CYAN = 0x0030 + BACKGROUND_RED = 0x0040 + BACKGROUND_MAGENTA = 0x0050 + BACKGROUND_YELLOW = 0x0060 + BACKGROUND_GREY = 0x0070 + BACKGROUND_INTENSITY = 0x0080 # background color is intensified. - stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) - SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute - GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo + stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) + SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute + GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo - def get_text_attr(): - """Returns the character attributes (colors) of the console screen - buffer.""" - csbi = CONSOLE_SCREEN_BUFFER_INFO() - GetConsoleScreenBufferInfo(stdout_handle, byref(csbi)) - return csbi.wAttributes + def get_text_attr(): + """Returns the character attributes (colors) of the console screen + buffer.""" + csbi = CONSOLE_SCREEN_BUFFER_INFO() + GetConsoleScreenBufferInfo(stdout_handle, byref(csbi)) + return csbi.wAttributes - def set_text_attr(color): - """Sets the character attributes (colors) of the console screen - buffer. Color is a combination of foreground and background color, - foreground and background intensity.""" - SetConsoleTextAttribute(stdout_handle, color) + def set_text_attr(color): + """Sets the character attributes (colors) of the console screen + buffer. Color is a combination of foreground and background color, + foreground and background intensity.""" + SetConsoleTextAttribute(stdout_handle, color) ############################################################################### def find_bi_tools(work_drive): - """Find BI tools.""" + """Find BI tools.""" - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) - try: - k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") - arma3tools_path = winreg.QueryValueEx(k, "path")[0] - winreg.CloseKey(k) - except: - raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + try: + k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") + arma3tools_path = winreg.QueryValueEx(k, "path")[0] + winreg.CloseKey(k) + except: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") - addonbuilder_path = os.path.join(arma3tools_path, "AddonBuilder", "AddonBuilder.exe") - dssignfile_path = os.path.join(arma3tools_path, "DSSignFile", "DSSignFile.exe") - dscreatekey_path = os.path.join(arma3tools_path, "DSSignFile", "DSCreateKey.exe") - cfgconvert_path = os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe") + addonbuilder_path = os.path.join(arma3tools_path, "AddonBuilder", "AddonBuilder.exe") + dssignfile_path = os.path.join(arma3tools_path, "DSSignFile", "DSSignFile.exe") + dscreatekey_path = os.path.join(arma3tools_path, "DSSignFile", "DSCreateKey.exe") + cfgconvert_path = os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe") - if os.path.isfile(addonbuilder_path) and os.path.isfile(dssignfile_path) and os.path.isfile(dscreatekey_path) and os.path.isfile(cfgconvert_path): - return [addonbuilder_path, dssignfile_path, dscreatekey_path, cfgconvert_path] - else: - raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + if os.path.isfile(addonbuilder_path) and os.path.isfile(dssignfile_path) and os.path.isfile(dscreatekey_path) and os.path.isfile(cfgconvert_path): + return [addonbuilder_path, dssignfile_path, dscreatekey_path, cfgconvert_path] + else: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") def find_depbo_tools(regKey): - """Use registry entries to find DePBO-based tools.""" - stop = False + """Use registry entries to find DePBO-based tools.""" + stop = False - if regKey == "HKCU": - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) - stop = True - else: - reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + if regKey == "HKCU": + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + stop = True + else: + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - try: - try: - k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\pboProject") - except FileNotFoundError: - k = winreg.OpenKey(reg, r"Software\Mikero\pboProject") - try: - pboproject_path = winreg.QueryValueEx(k, "exe")[0] - winreg.CloseKey(k) - print("Found pboproject.") - except: - print_error("ERROR: Could not find pboProject.") + try: + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\pboProject") + except FileNotFoundError: + k = winreg.OpenKey(reg, r"Software\Mikero\pboProject") + try: + pboproject_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found pboproject.") + except: + print_error("ERROR: Could not find pboProject.") - try: - k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\rapify") - except FileNotFoundError: - k = winreg.OpenKey(reg, r"Software\Mikero\rapify") - try: - rapify_path = winreg.QueryValueEx(k, "exe")[0] - winreg.CloseKey(k) - print("Found rapify.") - except: - print_error("Could not find rapify.") + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\rapify") + except FileNotFoundError: + k = winreg.OpenKey(reg, r"Software\Mikero\rapify") + try: + rapify_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found rapify.") + except: + print_error("Could not find rapify.") - try: - k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\MakePbo") - except FileNotFoundError: - k = winreg.OpenKey(reg, r"Software\Mikero\MakePbo") - try: - makepbo_path = winreg.QueryValueEx(k, "exe")[0] - winreg.CloseKey(k) - print("Found makepbo.") - except: - print_error("Could not find makepbo.") - except: - if stop == True: - raise Exception("BadDePBO", "DePBO tools not installed correctly") - return -1 + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\MakePbo") + except FileNotFoundError: + k = winreg.OpenKey(reg, r"Software\Mikero\MakePbo") + try: + makepbo_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found makepbo.") + except: + print_error("Could not find makepbo.") + except: + if stop == True: + raise Exception("BadDePBO", "DePBO tools not installed correctly") + return -1 - #Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths. - return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')] + #Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths. + return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')] def color(color): - """Set the color. Works on Win32 and normal terminals.""" - if sys.platform == "win32": - if color == "green": - set_text_attr(FOREGROUND_GREEN | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) - elif color == "red": - set_text_attr(FOREGROUND_RED | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) - elif color == "blue": - set_text_attr(FOREGROUND_BLUE | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) - elif color == "reset": - set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) - elif color == "grey": - set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) - else : - if color == "green": - sys.stdout.write('\033[92m') - elif color == "red": - sys.stdout.write('\033[91m') - elif color == "blue": - sys.stdout.write('\033[94m') - elif color == "reset": - sys.stdout.write('\033[0m') + """Set the color. Works on Win32 and normal terminals.""" + if sys.platform == "win32": + if color == "green": + set_text_attr(FOREGROUND_GREEN | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "yellow": + set_text_attr(FOREGROUND_YELLOW | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "red": + set_text_attr(FOREGROUND_RED | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "blue": + set_text_attr(FOREGROUND_BLUE | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "reset": + set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) + elif color == "grey": + set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) + else : + if color == "green": + sys.stdout.write('\033[92m') + elif color == "red": + sys.stdout.write('\033[91m') + elif color == "blue": + sys.stdout.write('\033[94m') + elif color == "reset": + sys.stdout.write('\033[0m') def print_error(msg): - color("red") - print ("ERROR: " + msg) - color("reset") + color("red") + print ("ERROR: " + msg) + color("reset") def print_green(msg): - color("green") - print(msg) - color("reset") + color("green") + print(msg) + color("reset") def print_blue(msg): - color("blue") - print(msg) - color("reset") + color("blue") + print(msg) + color("reset") def print_yellow(msg): - color("yellow") - print(msg) - color("reset") + color("yellow") + print(msg) + color("reset") - + def copy_important_files(source_dir,destination_dir): - - originalDir = os.getcwd() - importantFiles = ["mod.cpp", - "README.md", - "AUTHORS.txt", - "LICENSE", - "logo_ace3_ca.paa" - ] - - print_yellow ("source_dir: " + source_dir) - print_yellow("destination_dir: " + destination_dir) - - #copy importantFiles - try: - print_blue("\nSearching for important files in " + source_dir) - for file in importantFiles: - print_green("Copying file => " + os.path.join(source_dir,file)) - shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) - except: - print_error("COPYING IMPORTANT FILES.") - raise - - #copy all extension dlls - try: - os.chdir(os.path.join(source_dir)) - print_blue("\nSearching for DLLs in " + os.getcwd()) - filenames = glob.glob("*.dll") - - if not filenames: - print ("Empty SET") - - for dll in filenames: - print_green("Copying dll => " + os.path.join(source_dir,dll)) - if os.path.isfile(dll): - shutil.copyfile(os.path.join(source_dir,dll),os.path.join(destination_dir,dll)) - except: - print_error("COPYING DLL FILES.") - raise - finally: - os.chdir(originalDir) + + originalDir = os.getcwd() + importantFiles = ["mod.cpp", + "README.md", + "AUTHORS.txt", + "LICENSE", + "logo_ace3_ca.paa" + ] + + print_yellow ("source_dir: " + source_dir) + print_yellow("destination_dir: " + destination_dir) + + #copy importantFiles + try: + print_blue("\nSearching for important files in " + source_dir) + for file in importantFiles: + print_green("Copying file => " + os.path.join(source_dir,file)) + shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) + except: + print_error("COPYING IMPORTANT FILES.") + raise + + #copy all extension dlls + try: + os.chdir(os.path.join(source_dir)) + print_blue("\nSearching for DLLs in " + os.getcwd()) + filenames = glob.glob("*.dll") + + if not filenames: + print ("Empty SET") + + for dll in filenames: + print_green("Copying dll => " + os.path.join(source_dir,dll)) + if os.path.isfile(dll): + shutil.copyfile(os.path.join(source_dir,dll),os.path.join(destination_dir,dll)) + except: + print_error("COPYING DLL FILES.") + raise + finally: + os.chdir(originalDir) def copy_optionals_for_building(mod,pbos): - src_directories = os.listdir(optionals_root) - current_dir = os.getcwd() - - print("") - try: - - #special server.pbo processing - files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo")) - for file in files: - file_name = os.path.basename(file) - print ("Adding the following file: " + file_name) - pbos.append(file_name) - pbo_path = os.path.join(release_dir, "@ace","optionals",file_name) - if (os.path.isfile(pbo_path)): - print("Moving " + pbo_path + " for processing.") - shutil.move(pbo_path, os.path.join(release_dir,"@ace","addons",file_name)) + src_directories = os.listdir(optionals_root) + current_dir = os.getcwd() + + print("") + try: + + #special server.pbo processing + files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo")) + for file in files: + file_name = os.path.basename(file) + print ("Adding the following file: " + file_name) + pbos.append(file_name) + pbo_path = os.path.join(release_dir, "@ace","optionals",file_name) + if (os.path.isfile(pbo_path)): + print("Moving " + pbo_path + " for processing.") + shutil.move(pbo_path, os.path.join(release_dir,"@ace","addons",file_name)) - except: - print_error("Error in moving") - raise - finally: - os.chdir(current_dir) + except: + print_error("Error in moving") + raise + finally: + os.chdir(current_dir) - print("") - try: - for dir_name in src_directories: - mod.append(dir_name) - if (dir_name == "userconfig"): - destination = os.path.join(work_drive,dir_name) - else: - destination = os.path.join(module_root,dir_name) + print("") + try: + for dir_name in src_directories: + mod.append(dir_name) + if (dir_name == "userconfig"): + destination = os.path.join(work_drive,dir_name) + else: + destination = os.path.join(module_root,dir_name) - print("Temporarily copying " + os.path.join(optionals_root,dir_name) + " => " + destination + " for building.") - shutil.rmtree(destination, True) - shutil.copytree(os.path.join(optionals_root,dir_name), destination) - except: - print_error("Copy Optionals Failed") - raise - finally: - os.chdir(current_dir) - + print("Temporarily copying " + os.path.join(optionals_root,dir_name) + " => " + destination + " for building.") + shutil.rmtree(destination, True) + shutil.copytree(os.path.join(optionals_root,dir_name), destination) + except: + print_error("Copy Optionals Failed") + raise + finally: + os.chdir(current_dir) + def cleanup_optionals(mod,pbos): - print("") - try: - for dir_name in mod: - if (dir_name == "userconfig"): - destination = os.path.join(work_drive,dir_name) - else: - destination = os.path.join(module_root,dir_name) - - print("Cleaning " + destination) - - try: - file_name = "ace_{}.pbo".format(dir_name) - src_file_path = os.path.join(release_dir, "@ace","addons",file_name) - dst_file_path = os.path.join(release_dir, "@ace","optionals",file_name) - if (os.path.isfile(src_file_path)): - #print("Preserving " + file_name) - os.renames(src_file_path,dst_file_path) - except FileExistsError: - print_error(file_name + " already exists") - continue - shutil.rmtree(destination) - - except: - print_error("Cleaning Optionals Failed") - raise + print("") + try: + for dir_name in mod: + if (dir_name == "userconfig"): + destination = os.path.join(work_drive,dir_name) + else: + destination = os.path.join(module_root,dir_name) + + print("Cleaning " + destination) + + try: + file_name = "ace_{}.pbo".format(dir_name) + src_file_path = os.path.join(release_dir, "@ace","addons",file_name) + dst_file_path = os.path.join(release_dir, "@ace","optionals",file_name) + if (os.path.isfile(src_file_path)): + #print("Preserving " + file_name) + os.renames(src_file_path,dst_file_path) + except FileExistsError: + print_error(file_name + " already exists") + continue + shutil.rmtree(destination) + + except: + print_error("Cleaning Optionals Failed") + raise ############################################################################### def main(argv): - """Build an Arma addon suite in a directory from rules in a make.cfg file.""" - print_blue(("\nmake.py for Arma, modified for Advanced Combat Environment v" + __version__)) + """Build an Arma addon suite in a directory from rules in a make.cfg file.""" + print_blue(("\nmake.py for Arma, modified for Advanced Combat Environment v" + __version__)) - if sys.platform != "win32": - print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.") - sys.exit(1) + if sys.platform != "win32": + print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.") + sys.exit(1) - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) - try: - k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") - arma3tools_path = winreg.QueryValueEx(k, "path")[0] - winreg.CloseKey(k) - except: - raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + try: + k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") + arma3tools_path = winreg.QueryValueEx(k, "path")[0] + winreg.CloseKey(k) + except: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") - # Default behaviors - test = False # Copy to Arma 3 directory? - arg_modules = False # Only build modules on command line? - make_release = False # Make zip file from the release? - release_version = 0 # Version of release - use_pboproject = True # Default to pboProject build tool - make_target = "DEFAULT" # Which section in make.cfg to use for the build - new_key = False # Make a new key and use it to sign? - quiet = False # Suppress output from build tool? + # Default behaviors + test = False # Copy to Arma 3 directory? + arg_modules = False # Only build modules on command line? + make_release = False # Make zip file from the release? + release_version = 0 # Version of release + use_pboproject = True # Default to pboProject build tool + make_target = "DEFAULT" # Which section in make.cfg to use for the build + new_key = False # Make a new key and use it to sign? + quiet = False # Suppress output from build tool? - # Parse arguments - if "help" in argv or "-h" in argv or "--help" in argv: - print (""" + # Parse arguments + if "help" in argv or "-h" in argv or "--help" in argv: + print (""" make.py [help] [test] [force] [key ] [target ] [release ] [module name] [module name] [...] @@ -463,539 +465,539 @@ If a file called $NOBIN$ is found in the module directory, that module will not See the make.cfg file for additional build options. """) - sys.exit(0) - - if "force" in argv: - argv.remove("force") - force_build = True - else: - force_build = False - - if "test" in argv: - test = True - argv.remove("test") - - if "release" in argv: - make_release = True - release_version = argv[argv.index("release") + 1] - argv.remove(release_version) - argv.remove("release") - - if "target" in argv: - make_target = argv[argv.index("target") + 1] - argv.remove("target") - argv.remove(make_target) - force_build = True - - if "key" in argv: - new_key = True - key_name = argv[argv.index("key") + 1] - argv.remove("key") - argv.remove(key_name) - - if "quiet" in argv: - quiet = True - argv.remove("quiet") - - if "checkexternal" in argv: - argv.remove("checkexternal") - check_external = True - else: - check_external = False - - # Get the directory the make script is in. - make_root = os.path.dirname(os.path.realpath(__file__)) - make_root_parent = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) - os.chdir(make_root) - - # Get latest commit ID - try: - gitpath = os.path.join(os.path.dirname(make_root), ".git") - assert os.path.exists(gitpath) - - commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"]) - commit_id = str(commit_id, "utf-8")[:8] - except: - print_error("FAILED TO DETERMINE COMMIT ID.") - commit_id = "NOGIT" - - cfg = configparser.ConfigParser(); - try: - global work_drive - global module_root - global release_dir - global module_root_parent - global optionals_root - - cfg.read(os.path.join(make_root, "make.cfg")) - - # Project name (with @ symbol) - project = cfg.get(make_target, "project", fallback="@"+os.path.basename(os.getcwd())) - - # Private key path - key = cfg.get(make_target, "key", fallback=None) - - # Project prefix (folder path) - prefix = cfg.get(make_target, "prefix", fallback="") - - # Should we autodetect modules on a complete build? - module_autodetect = cfg.getboolean(make_target, "module_autodetect", fallback=True) - - # Manual list of modules to build for a complete build - modules = cfg.get(make_target, "modules", fallback=None) - # Parse it out - if modules: - modules = [x.strip() for x in modules.split(',')] - else: - modules = [] - - # List of directories to ignore when detecting - ignore = [x.strip() for x in cfg.get(make_target, "ignore", fallback="release").split(',')] - - # BI Tools work drive on Windows - work_drive = cfg.get(make_target, "work_drive", fallback="P:\\") - - # Which build tool should we use? - build_tool = cfg.get(make_target, "build_tool", fallback="addonbuilder").lower() - - # Release/build directory, relative to script dir - release_dir = cfg.get(make_target, "release_dir", fallback="release") - - # Project PBO file prefix (files are renamed to prefix_name.pbo) - pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None) - - # Project module Root - module_root_parent = os.path.abspath(os.path.join(os.path.join(work_drive, prefix), os.pardir)) - module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons")) - optionals_root = os.path.join(module_root_parent, "optionals") - print_green ("module_root: " + module_root) - - if (os.path.isdir(module_root)): - os.chdir(module_root) - else: - print_error ("Directory " + module_root + " does not exist.") - sys.exit() - - if (os.path.isdir(optionals_root)): - print_green ("optionals_root: " + optionals_root) - else: - print_error ("Directory " + optionals_root + " does not exist.") - sys.exit() - - print_green ("release_dir: " + release_dir) - - except: - raise - print_error("Could not parse make.cfg.") - sys.exit(1) - - # See if we have been given specific modules to build from command line. - if len(argv) > 1 and not make_release: - arg_modules = True - modules = argv[1:] - - # Find the tools we need. - try: - tools = find_bi_tools(work_drive) - addonbuilder = tools[0] - dssignfile = tools[1] - dscreatekey = tools[2] - cfgconvert = tools[3] - - except: - print_error("Arma 3 Tools are not installed correctly or the P: drive has not been created.") - sys.exit(1) - - if build_tool == "pboproject": - try: - depbo_tools = find_depbo_tools("HKLM") - if depbo_tools == -1: - depbo_tools = find_depbo_tools("HKCU") - pboproject = depbo_tools[0] - rapifyTool = depbo_tools[1] - makepboTool = depbo_tools[2] - except: - raise - print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files") - sys.exit(1) - - # Try to open and deserialize build cache file. - try: - cache = {} - with open(os.path.join(make_root, "make.cache"), 'r') as f: - cache_raw = f.read() - - cache = json.loads(cache_raw) - - except: - print ("No cache found.") - cache = {} - - #Temporarily copy optionals_root for building. They will be removed later. - optionals_modules = [] - optional_files = [] - copy_optionals_for_building(optionals_modules,optional_files) - - # Get list of subdirs in make root. - dirs = next(os.walk(module_root))[1] - - # Autodetect what directories to build. - if module_autodetect and not arg_modules: - modules = [] - for path in dirs: - # Any dir that has a config.cpp in its root is an addon to build. - config_path = os.path.join(path, 'config.cpp') - if os.path.isfile(config_path) and not path in ignore: - modules.append(path) - - # Make the key specified from command line if necessary. - if new_key: - if not os.path.isfile(os.path.join(module_root, key_name + ".biprivatekey")): - print_green("\nRequested key does not exist.") - ret = subprocess.call([dscreatekey, key_name]) # Created in make_root - if ret == 0: - print_blue("Created: " + os.path.join(module_root, key_name + ".biprivatekey")) - else: - print_error("Failed to create key!") - - try: - print_blue("Copying public key to release directory.") - - try: - os.makedirs(os.path.join(module_root, release_dir, "Keys")) - except: - pass - - shutil.copyfile(os.path.join(module_root, key_name + ".bikey"), os.path.join(module_root, release_dir, "Keys", key_name + ".bikey")) - - except: - raise - print_error("Could not copy key to release directory.") - - else: - print_green("\nNOTE: Using key " + os.path.join(module_root, key_name + ".biprivatekey")) - - key = os.path.join(module_root, key_name + ".biprivatekey") - - - # For each module, prep files and then build. - for module in modules: - print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) - missing = False - - # Cache check - if module in cache: - old_sha = cache[module] - else: - old_sha = "" - - #We always build ACE_common so we can properly show the correct version stamp in the RPT file. - if module == "common": - old_sha = "" - - # Hash the module - new_sha = get_directory_hash(os.path.join(module_root, module)) - - # Is the pbo file missing? - missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module))) - if missing: - print("ace_{}.pbo".format(module) + " is missing. Building...") - - # Check if it needs rebuilt - # print ("Hash:", new_sha) - if old_sha == new_sha and not missing: - if not force_build: - print("Module has not changed.") - # Skip everything else - continue - - # Only do this if the project isn't stored directly on the work drive. - # Split the path at the drive name and see if they are on the same drive (usually P:) - if os.path.splitdrive(module_root)[0] != os.path.splitdrive(work_drive)[0]: - try: - # Remove old work drive version (ignore errors) - shutil.rmtree(os.path.join(work_drive, prefix, module), True) - - # Copy module to the work drive - shutil.copytree(module, os.path.join(work_drive, prefix, module)) - - except: - raise - print_error("ERROR: Could not copy module to work drive. Does the module exist?") - input("Press Enter to continue...") - print("Resuming build...") - continue - #else: - #print("WARNING: Module is stored on work drive (" + work_drive + ").") - - try: - # Remove the old pbo, key, and log - old = os.path.join(module_root, release_dir, project, "Addons", module) + "*" - files = glob.glob(old) - for f in files: - os.remove(f) - - if pbo_name_prefix: - old = os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module) + "*" - files = glob.glob(old) - for f in files: - os.remove(f) - except: - raise - print_error("ERROR: Could not copy module to work drive. Does the module exist?") - input("Press Enter to continue...") - print("Resuming build...") - continue - - # Build the module into a pbo - print_blue("Building: " + os.path.join(work_drive, prefix, module)) - print_blue("Destination: " + os.path.join(module_root, release_dir, project, "Addons")) - - # Make destination folder (if needed) - try: - os.makedirs(os.path.join(module_root, release_dir, project, "Addons")) - except: - pass - - # Run build tool - build_successful = False - if build_tool == "pboproject": - try: - #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) - - os.chdir("P:\\") - - cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] - ret = subprocess.call(cmd) - if ret != 0: - print_error("CfgConvert -bin return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] - ret = subprocess.call(cmd) - if ret != 0: - print_error("CfgConvert -txt return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - - # Include build number - try: - configpath = os.path.join(work_drive, prefix, module, "config.cpp") - f = open(configpath, "r") - configtext = f.read() - f.close() - - if configtext: - patchestext = re.search(r"class CfgPatches\n\{(.*?)\n\}", configtext, re.DOTALL).group(1) - patchestext = re.sub(r'version(.*?)="(.*?)"', r'version\1="\2-{}"'.format(commit_id), patchestext) - configtext = re.sub(r"class CfgPatches\n\{(.*?)\n\}", "class CfgPatches\n{"+patchestext+"\n}", configtext, flags=re.DOTALL) - f = open(configpath, "w") - f.write(configtext) - f.close() - else: - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - except: - raise - print_error("Failed to include build number") - continue - - if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): - print_green("$NOBIN$ Found. Proceeding with non-binarizing!") - cmd = [makepboTool, "-P","-A","-L","-N","-G", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"Addons")] - - else: - if check_external: - cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "+X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] - else: - cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "-X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] - - color("grey") - if quiet: - devnull = open(os.devnull, 'w') - ret = subprocess.call(cmd, stdout=devnull) - devnull.close() - else: - ret = subprocess.call(cmd) - color("reset") - - if ret == 0: - print_green("pboProject return code == " + str(ret)) - # Prettyprefix rename the PBO if requested. - if pbo_name_prefix: - try: - os.rename(os.path.join(module_root, release_dir, project, "Addons", module+".pbo"), os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) - except: - raise - print_error("Could not rename built PBO with prefix.") - # Sign result - if key: - print("Signing with " + key + ".") - if pbo_name_prefix: - ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) - else: - ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", module + ".pbo")]) - - if ret == 0: - build_successful = True - else: - build_successful = True - - if not build_successful: - print_error("pboProject return code == " + str(ret)) - print_error("Module not successfully built/signed.") - print ("Resuming build...") - continue - - #PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp - #print_green("\Pabst (restoring): " + os.path.join(work_drive, prefix, module, "config.cpp")) - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - os.remove(os.path.join(work_drive, prefix, module, "config.bin")) - os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - # Back to the root - os.chdir(module_root) - - except: - raise - print_error("Could not run Addon Builder.") - input("Press Enter to continue...") - print ("Resuming build...") - continue - - elif build_tool== "addonbuilder": - # Detect $NOBIN$ and do not binarize if found. - if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): - do_binarize = False - print("$NOBIN$ file found in module, packing only.") - else: - do_binarize = True - try: - # Call AddonBuilder - os.chdir("P:\\") - - cmd = [addonbuilder, os.path.join(work_drive, prefix, module), os.path.join(make_root, release_dir, project, "Addons"), "-clear", "-project="+work_drive] - if not do_binarize: - cmd.append("-packonly") - - if quiet: - previousDirectory = os.getcwd() - os.chdir(arma3tools_path) - devnull = open(os.devnull, 'w') - ret = subprocess.call(cmd, stdout=devnull) - devnull.close() - os.chdir(previousDirectory) - else: - previousDirectory = os.getcwd() - os.chdir(arma3tools_path) - print_error("Current directory - " + os.getcwd()) - ret = subprocess.call(cmd) - os.chdir(previousDirectory) - print_error("Current directory - " + os.getcwd()) - color("reset") - print_green("completed") - # Prettyprefix rename the PBO if requested. - if pbo_name_prefix: - try: - os.rename(os.path.join(make_root, release_dir, project, "Addons", module+".pbo"), os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) - except: - raise - print_error("Could not rename built PBO with prefix.") - - if ret == 0: - # Sign result - if key: - print("Signing with " + key + ".") - if pbo_name_prefix: - ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) - else: - ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", module + ".pbo")]) - - if ret == 0: - build_successful = True - else: - build_successful = True - - if not build_successful: - print_error("Module not successfully built.") - - # Back to the root - os.chdir(make_root) - - except: - raise - print_error("Could not run Addon Builder.") - input("Press Enter to continue...") - print ("Resuming build...") - continue - - else: - print_error("Unknown build_tool " + build_tool + "!") - - # Update the hash for a successfully built module - if build_successful: - cache[module] = new_sha - - # Done building all modules! - - # Write out the cache state - cache_out = json.dumps(cache) - with open(os.path.join(make_root, "make.cache"), 'w') as f: - f.write(cache_out) - - # Delete the pboproject temp files if building a release. - if make_release and build_tool == "pboproject": - try: - shutil.rmtree(os.path.join(module_root, release_dir, project, "temp"), True) - except: - print_error("ERROR: Could not delete pboProject temp files.") - - print_green("\nDone.") - - # Make release - if make_release: - print_blue("\nMaking release: " + project + "-" + release_version + ".zip") - - try: - # Delete all log files - for root, dirs, files in os.walk(os.path.join(module_root, release_dir, project, "Addons")): - for currentFile in files: - if currentFile.lower().endswith("log"): - os.remove(os.path.join(root, currentFile)) - - # Create a zip with the contents of release/ in it - shutil.make_archive(project + "-" + release_version, "zip", os.path.join(module_root, release_dir)) - except: - raise - print_error("Could not make release.") - - # Copy to Arma 3 folder for testing - if test: - print_blue("\nCopying to Arma 3.") - - if sys.platform == "win32": - reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - try: - k = winreg.OpenKey(reg, r"SOFTWARE\Wow6432Node\Bohemia Interactive\Arma 3") - a3_path = winreg.EnumValue(k, 1)[1] - winreg.CloseKey(k) - except: - print_error("Could not find Arma 3's directory in the registry.") - else: - a3_path = cygwin_a3path - - if os.path.exists(a3_path): - try: - shutil.rmtree(os.path.join(a3_path, project), True) - shutil.copytree(os.path.join(module_root, release_dir, project), os.path.join(a3_path, project)) - except: - print_error("Could not copy files. Is Arma 3 running?") - - copy_important_files(module_root_parent,os.path.join(release_dir, "@ace")) - cleanup_optionals(optionals_modules,optional_files) + sys.exit(0) + + if "force" in argv: + argv.remove("force") + force_build = True + else: + force_build = False + + if "test" in argv: + test = True + argv.remove("test") + + if "release" in argv: + make_release = True + release_version = argv[argv.index("release") + 1] + argv.remove(release_version) + argv.remove("release") + + if "target" in argv: + make_target = argv[argv.index("target") + 1] + argv.remove("target") + argv.remove(make_target) + force_build = True + + if "key" in argv: + new_key = True + key_name = argv[argv.index("key") + 1] + argv.remove("key") + argv.remove(key_name) + + if "quiet" in argv: + quiet = True + argv.remove("quiet") + + if "checkexternal" in argv: + argv.remove("checkexternal") + check_external = True + else: + check_external = False + + # Get the directory the make script is in. + make_root = os.path.dirname(os.path.realpath(__file__)) + make_root_parent = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + os.chdir(make_root) + + # Get latest commit ID + try: + gitpath = os.path.join(os.path.dirname(make_root), ".git") + assert os.path.exists(gitpath) + + commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"]) + commit_id = str(commit_id, "utf-8")[:8] + except: + print_error("FAILED TO DETERMINE COMMIT ID.") + commit_id = "NOGIT" + + cfg = configparser.ConfigParser(); + try: + global work_drive + global module_root + global release_dir + global module_root_parent + global optionals_root + + cfg.read(os.path.join(make_root, "make.cfg")) + + # Project name (with @ symbol) + project = cfg.get(make_target, "project", fallback="@"+os.path.basename(os.getcwd())) + + # Private key path + key = cfg.get(make_target, "key", fallback=None) + + # Project prefix (folder path) + prefix = cfg.get(make_target, "prefix", fallback="") + + # Should we autodetect modules on a complete build? + module_autodetect = cfg.getboolean(make_target, "module_autodetect", fallback=True) + + # Manual list of modules to build for a complete build + modules = cfg.get(make_target, "modules", fallback=None) + # Parse it out + if modules: + modules = [x.strip() for x in modules.split(',')] + else: + modules = [] + + # List of directories to ignore when detecting + ignore = [x.strip() for x in cfg.get(make_target, "ignore", fallback="release").split(',')] + + # BI Tools work drive on Windows + work_drive = cfg.get(make_target, "work_drive", fallback="P:\\") + + # Which build tool should we use? + build_tool = cfg.get(make_target, "build_tool", fallback="addonbuilder").lower() + + # Release/build directory, relative to script dir + release_dir = cfg.get(make_target, "release_dir", fallback="release") + + # Project PBO file prefix (files are renamed to prefix_name.pbo) + pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None) + + # Project module Root + module_root_parent = os.path.abspath(os.path.join(os.path.join(work_drive, prefix), os.pardir)) + module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons")) + optionals_root = os.path.join(module_root_parent, "optionals") + print_green ("module_root: " + module_root) + + if (os.path.isdir(module_root)): + os.chdir(module_root) + else: + print_error ("Directory " + module_root + " does not exist.") + sys.exit() + + if (os.path.isdir(optionals_root)): + print_green ("optionals_root: " + optionals_root) + else: + print_error ("Directory " + optionals_root + " does not exist.") + sys.exit() + + print_green ("release_dir: " + release_dir) + + except: + raise + print_error("Could not parse make.cfg.") + sys.exit(1) + + # See if we have been given specific modules to build from command line. + if len(argv) > 1 and not make_release: + arg_modules = True + modules = argv[1:] + + # Find the tools we need. + try: + tools = find_bi_tools(work_drive) + addonbuilder = tools[0] + dssignfile = tools[1] + dscreatekey = tools[2] + cfgconvert = tools[3] + + except: + print_error("Arma 3 Tools are not installed correctly or the P: drive has not been created.") + sys.exit(1) + + if build_tool == "pboproject": + try: + depbo_tools = find_depbo_tools("HKLM") + if depbo_tools == -1: + depbo_tools = find_depbo_tools("HKCU") + pboproject = depbo_tools[0] + rapifyTool = depbo_tools[1] + makepboTool = depbo_tools[2] + except: + raise + print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files") + sys.exit(1) + + # Try to open and deserialize build cache file. + try: + cache = {} + with open(os.path.join(make_root, "make.cache"), 'r') as f: + cache_raw = f.read() + + cache = json.loads(cache_raw) + + except: + print ("No cache found.") + cache = {} + + #Temporarily copy optionals_root for building. They will be removed later. + optionals_modules = [] + optional_files = [] + copy_optionals_for_building(optionals_modules,optional_files) + + # Get list of subdirs in make root. + dirs = next(os.walk(module_root))[1] + + # Autodetect what directories to build. + if module_autodetect and not arg_modules: + modules = [] + for path in dirs: + # Any dir that has a config.cpp in its root is an addon to build. + config_path = os.path.join(path, 'config.cpp') + if os.path.isfile(config_path) and not path in ignore: + modules.append(path) + + # Make the key specified from command line if necessary. + if new_key: + if not os.path.isfile(os.path.join(module_root, key_name + ".biprivatekey")): + print_green("\nRequested key does not exist.") + ret = subprocess.call([dscreatekey, key_name]) # Created in make_root + if ret == 0: + print_blue("Created: " + os.path.join(module_root, key_name + ".biprivatekey")) + else: + print_error("Failed to create key!") + + try: + print_blue("Copying public key to release directory.") + + try: + os.makedirs(os.path.join(module_root, release_dir, "Keys")) + except: + pass + + shutil.copyfile(os.path.join(module_root, key_name + ".bikey"), os.path.join(module_root, release_dir, "Keys", key_name + ".bikey")) + + except: + raise + print_error("Could not copy key to release directory.") + + else: + print_green("\nNOTE: Using key " + os.path.join(module_root, key_name + ".biprivatekey")) + + key = os.path.join(module_root, key_name + ".biprivatekey") + + + # For each module, prep files and then build. + for module in modules: + print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) + missing = False + + # Cache check + if module in cache: + old_sha = cache[module] + else: + old_sha = "" + + #We always build ACE_common so we can properly show the correct version stamp in the RPT file. + if module == "common": + old_sha = "" + + # Hash the module + new_sha = get_directory_hash(os.path.join(module_root, module)) + + # Is the pbo file missing? + missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module))) + if missing: + print("ace_{}.pbo".format(module) + " is missing. Building...") + + # Check if it needs rebuilt + # print ("Hash:", new_sha) + if old_sha == new_sha and not missing: + if not force_build: + print("Module has not changed.") + # Skip everything else + continue + + # Only do this if the project isn't stored directly on the work drive. + # Split the path at the drive name and see if they are on the same drive (usually P:) + if os.path.splitdrive(module_root)[0] != os.path.splitdrive(work_drive)[0]: + try: + # Remove old work drive version (ignore errors) + shutil.rmtree(os.path.join(work_drive, prefix, module), True) + + # Copy module to the work drive + shutil.copytree(module, os.path.join(work_drive, prefix, module)) + + except: + raise + print_error("ERROR: Could not copy module to work drive. Does the module exist?") + input("Press Enter to continue...") + print("Resuming build...") + continue + #else: + #print("WARNING: Module is stored on work drive (" + work_drive + ").") + + try: + # Remove the old pbo, key, and log + old = os.path.join(module_root, release_dir, project, "Addons", module) + "*" + files = glob.glob(old) + for f in files: + os.remove(f) + + if pbo_name_prefix: + old = os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module) + "*" + files = glob.glob(old) + for f in files: + os.remove(f) + except: + raise + print_error("ERROR: Could not copy module to work drive. Does the module exist?") + input("Press Enter to continue...") + print("Resuming build...") + continue + + # Build the module into a pbo + print_blue("Building: " + os.path.join(work_drive, prefix, module)) + print_blue("Destination: " + os.path.join(module_root, release_dir, project, "Addons")) + + # Make destination folder (if needed) + try: + os.makedirs(os.path.join(module_root, release_dir, project, "Addons")) + except: + pass + + # Run build tool + build_successful = False + if build_tool == "pboproject": + try: + #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) + + os.chdir("P:\\") + + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] + ret = subprocess.call(cmd) + if ret != 0: + print_error("CfgConvert -bin return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] + ret = subprocess.call(cmd) + if ret != 0: + print_error("CfgConvert -txt return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + + # Include build number + try: + configpath = os.path.join(work_drive, prefix, module, "config.cpp") + f = open(configpath, "r") + configtext = f.read() + f.close() + + if configtext: + patchestext = re.search(r"class CfgPatches\n\{(.*?)\n\}", configtext, re.DOTALL).group(1) + patchestext = re.sub(r'version(.*?)="(.*?)"', r'version\1="\2-{}"'.format(commit_id), patchestext) + configtext = re.sub(r"class CfgPatches\n\{(.*?)\n\}", "class CfgPatches\n{"+patchestext+"\n}", configtext, flags=re.DOTALL) + f = open(configpath, "w") + f.write(configtext) + f.close() + else: + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + except: + raise + print_error("Failed to include build number") + continue + + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): + print_green("$NOBIN$ Found. Proceeding with non-binarizing!") + cmd = [makepboTool, "-P","-A","-L","-N","-G", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"Addons")] + + else: + if check_external: + cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "+X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] + else: + cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "-X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] + + color("grey") + if quiet: + devnull = open(os.devnull, 'w') + ret = subprocess.call(cmd, stdout=devnull) + devnull.close() + else: + ret = subprocess.call(cmd) + color("reset") + + if ret == 0: + print_green("pboProject return code == " + str(ret)) + # Prettyprefix rename the PBO if requested. + if pbo_name_prefix: + try: + os.rename(os.path.join(module_root, release_dir, project, "Addons", module+".pbo"), os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) + except: + raise + print_error("Could not rename built PBO with prefix.") + # Sign result + if key: + print("Signing with " + key + ".") + if pbo_name_prefix: + ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) + else: + ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", module + ".pbo")]) + + if ret == 0: + build_successful = True + else: + build_successful = True + + if not build_successful: + print_error("pboProject return code == " + str(ret)) + print_error("Module not successfully built/signed.") + print ("Resuming build...") + continue + + #PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp + #print_green("\Pabst (restoring): " + os.path.join(work_drive, prefix, module, "config.cpp")) + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + os.remove(os.path.join(work_drive, prefix, module, "config.bin")) + os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + # Back to the root + os.chdir(module_root) + + except: + raise + print_error("Could not run Addon Builder.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + elif build_tool== "addonbuilder": + # Detect $NOBIN$ and do not binarize if found. + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): + do_binarize = False + print("$NOBIN$ file found in module, packing only.") + else: + do_binarize = True + try: + # Call AddonBuilder + os.chdir("P:\\") + + cmd = [addonbuilder, os.path.join(work_drive, prefix, module), os.path.join(make_root, release_dir, project, "Addons"), "-clear", "-project="+work_drive] + if not do_binarize: + cmd.append("-packonly") + + if quiet: + previousDirectory = os.getcwd() + os.chdir(arma3tools_path) + devnull = open(os.devnull, 'w') + ret = subprocess.call(cmd, stdout=devnull) + devnull.close() + os.chdir(previousDirectory) + else: + previousDirectory = os.getcwd() + os.chdir(arma3tools_path) + print_error("Current directory - " + os.getcwd()) + ret = subprocess.call(cmd) + os.chdir(previousDirectory) + print_error("Current directory - " + os.getcwd()) + color("reset") + print_green("completed") + # Prettyprefix rename the PBO if requested. + if pbo_name_prefix: + try: + os.rename(os.path.join(make_root, release_dir, project, "Addons", module+".pbo"), os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) + except: + raise + print_error("Could not rename built PBO with prefix.") + + if ret == 0: + # Sign result + if key: + print("Signing with " + key + ".") + if pbo_name_prefix: + ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) + else: + ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", module + ".pbo")]) + + if ret == 0: + build_successful = True + else: + build_successful = True + + if not build_successful: + print_error("Module not successfully built.") + + # Back to the root + os.chdir(make_root) + + except: + raise + print_error("Could not run Addon Builder.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + else: + print_error("Unknown build_tool " + build_tool + "!") + + # Update the hash for a successfully built module + if build_successful: + cache[module] = new_sha + + # Done building all modules! + + # Write out the cache state + cache_out = json.dumps(cache) + with open(os.path.join(make_root, "make.cache"), 'w') as f: + f.write(cache_out) + + # Delete the pboproject temp files if building a release. + if make_release and build_tool == "pboproject": + try: + shutil.rmtree(os.path.join(module_root, release_dir, project, "temp"), True) + except: + print_error("ERROR: Could not delete pboProject temp files.") + + print_green("\nDone.") + + # Make release + if make_release: + print_blue("\nMaking release: " + project + "-" + release_version + ".zip") + + try: + # Delete all log files + for root, dirs, files in os.walk(os.path.join(module_root, release_dir, project, "Addons")): + for currentFile in files: + if currentFile.lower().endswith("log"): + os.remove(os.path.join(root, currentFile)) + + # Create a zip with the contents of release/ in it + shutil.make_archive(project + "-" + release_version, "zip", os.path.join(module_root, release_dir)) + except: + raise + print_error("Could not make release.") + + # Copy to Arma 3 folder for testing + if test: + print_blue("\nCopying to Arma 3.") + + if sys.platform == "win32": + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + try: + k = winreg.OpenKey(reg, r"SOFTWARE\Wow6432Node\Bohemia Interactive\Arma 3") + a3_path = winreg.EnumValue(k, 1)[1] + winreg.CloseKey(k) + except: + print_error("Could not find Arma 3's directory in the registry.") + else: + a3_path = cygwin_a3path + + if os.path.exists(a3_path): + try: + shutil.rmtree(os.path.join(a3_path, project), True) + shutil.copytree(os.path.join(module_root, release_dir, project), os.path.join(a3_path, project)) + except: + print_error("Could not copy files. Is Arma 3 running?") + + copy_important_files(module_root_parent,os.path.join(release_dir, "@ace")) + cleanup_optionals(optionals_modules,optional_files) if __name__ == "__main__": - main(sys.argv) + main(sys.argv) input("Press Enter to continue...") From 8a55c282e17eba4ae63957773597f3634ec335ee Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 21 Apr 2015 13:27:45 +0200 Subject: [PATCH 3/8] add repair module icon --- extras/assets/icons/Icons_Modules.psd | Bin 2356619 -> 2326533 bytes .../png/Icon_Module/Icon_Module_Repair_ca.png | Bin 0 -> 1621 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 extras/assets/icons/png/Icon_Module/Icon_Module_Repair_ca.png diff --git a/extras/assets/icons/Icons_Modules.psd b/extras/assets/icons/Icons_Modules.psd index 9dcfa6a38b961c88def30c9f968c6a33349eb68f..968664452112dd74a054a33c3115fa92130ef8a2 100644 GIT binary patch delta 23791 zcmeHP33MFAnXc-QWZf3F4(qbpNCrC~P50bmJ3g^6*am}*xng3;mW>l330qFc0nIMK zBoJ_nU@IH;g|NAHmt+@5>>J)2-y=>!vLV36fRmTQG1$f!e8^JoS5;j-GnyG` zBqP}OR%+FBbsc~G_1FLZ_19nBb>HD#^zJ(!pkL8T+tx*vT(&AFhw#5$Y{OoydiTP+ z>behpuI>zLv7SA7cT3Uwhx0|DMqXx7psKuc@6xB zn#{o5U}&x{99#U1ww6u}HW`5?pSjlbBWzuY$^RFae$JN&G6qt^HN+`$~Z zWm$Bw5eQsjMwdmF1x(xwbE!YHtmTrR88AcP*iApyev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VUmf3a;xg?trOG3RNY zI%xz-gic+nOAqbES6SV*I`^f6-g<8O@bHq+t5;vu4S5G`gEx2Wlvz`Ap4|C-)Y~E5 ze>kF`6A&$&wc_GlK)K?9#@m*_S>$^N+)rASQ`LVXx-VMWhcqU(ZZGvcOY-LqoGnfG zd3FP*5g=lAzKn&R0kKOz(3+AS9OpIyi+sPxz?e3_Y@j}D^eoS|Cj7y@IL_`K=+WW^ z&V_-pZr;rneOBZG8`qBxZ_e)L{?rQ8`_C31hA9Q8VY+M`C!b|jHvPJ*hC91zS>M`+ zr`u0%?W%(+$5UFyr*CbD{FaRI#~pc2J`cMSwa(vhlDPgT?+)Ie{})1hxVo(tp;OJ+gEKe@hM1ONa4 literal 0 HcmV?d00001 From 483319386001ebdfbf6fe6346b5464c178d315e5 Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 21 Apr 2015 15:01:23 +0200 Subject: [PATCH 4/8] Added a new solution setup menu --- addons/atragmx/RscTitles.hpp | 91 ++++++++++++++++++- addons/atragmx/XEH_preInit.sqf | 3 + .../atragmx/functions/fnc_create_dialog.sqf | 1 + .../functions/fnc_cycle_scope_unit.sqf | 1 + addons/atragmx/functions/fnc_init.sqf | 3 + .../functions/fnc_show_solution_setup.sqf | 20 ++++ .../functions/fnc_toggle_solution_setup.sqf | 38 ++++++++ .../functions/fnc_update_range_card.sqf | 17 ++-- .../atragmx/functions/fnc_update_result.sqf | 25 +++-- .../functions/fnc_update_solution_setup.sqf | 31 +++++++ .../functions/fnc_update_target_selection.sqf | 5 +- 11 files changed, 214 insertions(+), 21 deletions(-) create mode 100644 addons/atragmx/functions/fnc_show_solution_setup.sqf create mode 100644 addons/atragmx/functions/fnc_toggle_solution_setup.sqf create mode 100644 addons/atragmx/functions/fnc_update_solution_setup.sqf diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 5fd3339f28..2194b2b27a 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -608,7 +608,7 @@ class ATragMX_Display { w=0.03; x=0.550*safezoneW+safezoneX+0.27; text="4"; - action=""; + action=QUOTE(call FUNC(toggle_solution_setup)); }; class TEXT_CALCULATE: TEXT_SCOPE_UNIT { idc=3000; @@ -1368,5 +1368,94 @@ class ATragMX_Display { class TEXT_TARGET_DATA_NEXT: TEXT_TARGET_SPEED_ASSIST_NEXT { idc=14011; }; + + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=15000; + style=64; + w=0.25; + h=0.07; + x=0.550*safezoneW+safezoneX+0.13; + y=0.265*safezoneH+safezoneY+0.32; + text="Show result in"; + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1: TEXT_TARGET_A { + idc=15001; + w=0.04; + x=0.550*safezoneW+safezoneX+0.14; + y=0.265*safezoneH+safezoneY+0.35; + text="1"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 1; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_2: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15002; + x=0.550*safezoneW+safezoneX+0.18; + text="2"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 2; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_3: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15003; + x=0.550*safezoneW+safezoneX+0.22; + text="3"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 3; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_4: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15004; + x=0.550*safezoneW+safezoneX+0.26; + text="4"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 4; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_8: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15005; + x=0.550*safezoneW+safezoneX+0.30; + text="8"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 8; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_10: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15006; + x=0.550*safezoneW+safezoneX+0.34; + text="10"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 10; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=15007; + style=64; + w=0.25; + h=0.07; + x=0.550*safezoneW+safezoneX+0.13; + y=0.265*safezoneH+safezoneY+0.42; + text="Clicks per"; + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER_TMOA: TEXT_TARGET_A { + idc=15008; + w=0.05; + x=0.550*safezoneW+safezoneX+0.15; + y=0.265*safezoneH+safezoneY+0.45; + text="TMOA"; + action=QUOTE(GVAR(currentScopeClickUnitTemp) = 0; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER_SMOA: TEXT_SOLUTION_SETUP_CLICKS_PER_TMOA { + idc=15009; + x=0.550*safezoneW+safezoneX+0.23; + text="SMOA"; + action=QUOTE(GVAR(currentScopeClickUnitTemp) = 1; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER_MILS: TEXT_SOLUTION_SETUP_CLICKS_PER_TMOA { + idc=15010; + x=0.550*safezoneW+safezoneX+0.31; + text="MILS"; + action=QUOTE(GVAR(currentScopeClickUnitTemp) = 2; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { + idc=15011; + x=0.550*safezoneW+safezoneX+0.18; + y=0.265*safezoneH+safezoneY+0.55; + action=QUOTE(1 call FUNC(toggle_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CANCEL: TEXT_TARGET_SPEED_ASSIST_CANCEL { + idc=15012; + x=0.550*safezoneW+safezoneX+0.26; + y=0.265*safezoneH+safezoneY+0.55; + action=QUOTE(0 call FUNC(toggle_solution_setup)); + }; }; }; \ No newline at end of file diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index b85e325494..4718e6c31a 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -34,6 +34,7 @@ PREP(show_gun_list); PREP(show_main_page); PREP(show_range_card); PREP(show_range_card_setup); +PREP(show_solution_setup); PREP(show_target_data); PREP(show_target_range_assist); PREP(show_target_speed_assist); @@ -46,6 +47,7 @@ PREP(toggle_gun_ammo_data); PREP(toggle_gun_list); PREP(toggle_range_card); PREP(toggle_range_card_setup); +PREP(toggle_solution_setup); PREP(toggle_target_data); PREP(toggle_target_range_assist); PREP(toggle_target_speed_assist); @@ -59,6 +61,7 @@ PREP(update_range_card); PREP(update_relative_click_memory); PREP(update_result); PREP(update_scope_unit); +PREP(update_solution_setup); PREP(update_target); PREP(update_target_data); PREP(update_target_selection); diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index b4d51bd894..09e413d535 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -35,6 +35,7 @@ if (GVAR(showRangeCard)) then { [] call FUNC(update_range_card); }; GVAR(showRangeCardSetup) call FUNC(show_range_card_setup); +GVAR(showSolutionSetup) call FUNC(show_solution_setup); GVAR(showTargetData) call FUNC(show_target_data); GVAR(showTargetRangeAssist) call FUNC(show_target_range_assist); GVAR(showTargetSpeedAssist) call FUNC(show_target_speed_assist); diff --git a/addons/atragmx/functions/fnc_cycle_scope_unit.sqf b/addons/atragmx/functions/fnc_cycle_scope_unit.sqf index 36f704bd2d..ea9e2bd8e8 100644 --- a/addons/atragmx/functions/fnc_cycle_scope_unit.sqf +++ b/addons/atragmx/functions/fnc_cycle_scope_unit.sqf @@ -18,6 +18,7 @@ [] call FUNC(parse_input); GVAR(currentScopeUnit) = (GVAR(currentScopeUnit) + 1) % (count GVAR(scopeUnits)); +GVAR(workingMemory) set [6, GVAR(currentScopeUnit)]; [] call FUNC(update_scope_unit); [] call FUNC(update_result); diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index 2e613ca9e6..16c0b7eb86 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -42,7 +42,9 @@ GVAR(currentGun) = 0; GVAR(currentTarget) = 0; GVAR(currentScopeUnit) = 0; GVAR(currentScopeClickUnit) = 2; +GVAR(currentScopeClickUnitTemp) = 2; GVAR(currentScopeClickNumber) = 10; +GVAR(currentScopeClickNumberTemp) = 10; GVAR(atmosphereModeTBH) = true; GVAR(altitude) = 0; @@ -74,6 +76,7 @@ GVAR(showGunAmmoData) = false; GVAR(showGunList) = false; GVAR(showRangeCard) = false; GVAR(showRangeCardSetup) = false; +GVAR(showSolutionSetup) = false; GVAR(showTargetData) = false; GVAR(showTargetRangeAssist) = false; GVAR(showTargetSpeedAssist) = false; diff --git a/addons/atragmx/functions/fnc_show_solution_setup.sqf b/addons/atragmx/functions/fnc_show_solution_setup.sqf new file mode 100644 index 0000000000..761df45e6f --- /dev/null +++ b/addons/atragmx/functions/fnc_show_solution_setup.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ruthberg + * Shows/Hides the solution setup controls + * + * Arguments: + * visible - + * + * Return Value: + * Nothing + * + * Example: + * false call ace_atragmx_fnc_show_solution_setup + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(showSolutionSetup) = _this; + +{ctrlShow [_x, _this]} forEach [15000, 15001, 15002, 15003, 15004, 15005, 15006, 15007, 15008, 15009, 15010, 15011, 15012]; diff --git a/addons/atragmx/functions/fnc_toggle_solution_setup.sqf b/addons/atragmx/functions/fnc_toggle_solution_setup.sqf new file mode 100644 index 0000000000..0e9f702383 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_solution_setup.sqf @@ -0,0 +1,38 @@ +/* + * Author: Ruthberg + * Toggles the solution setup screen on/off + * + * Arguments: + * Apply new data? + * + * Return Value: + * Nothing + * + * Example: + * 1 call ace_atragmx_fnc_toggle_solution_setup + * + * Public: No + */ +#include "script_component.hpp" + +if (ctrlVisible 15000) then { + false call FUNC(show_solution_setup); + true call FUNC(show_main_page); + + if (_this == 1) then { + GVAR(currentScopeClickUnit) = GVAR(currentScopeClickUnitTemp); + GVAR(currentScopeClickNumber) = GVAR(currentScopeClickNumberTemp); + GVAR(workingMemory) set [7, GVAR(currentScopeClickUnit)]; + GVAR(workingMemory) set [8, GVAR(currentScopeClickNumber)]; + [] call FUNC(update_scope_unit); + [] call FUNC(update_result); + }; +} else { + true call FUNC(show_solution_setup); + false call FUNC(show_main_page); + + GVAR(currentScopeClickUnitTemp) = GVAR(currentScopeClickUnit); + GVAR(currentScopeClickNumberTemp) = GVAR(currentScopeClickNumber); + + [] call FUNC(update_solution_setup); +}; diff --git a/addons/atragmx/functions/fnc_update_range_card.sqf b/addons/atragmx/functions/fnc_update_range_card.sqf index 0c49b6f794..7e19abc36e 100644 --- a/addons/atragmx/functions/fnc_update_range_card.sqf +++ b/addons/atragmx/functions/fnc_update_range_card.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_range", "_elevation", "_windage1", "_windage2", "_elevationScopeStep", "_windageScopeStep", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"]; +private ["_range", "_elevation", "_windage1", "_windage2", "_clickSize", "_clickNumber", "_clickInterval", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"]; _lastColumnOutput = ""; if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then { @@ -54,12 +54,17 @@ lnbClear 5007; _windage2 = _windage2 * 1.047; }; case 3: { - _elevationScopeStep = (GVAR(workingMemory) select 7); - _windageScopeStep = (GVAR(workingMemory) select 8); + switch (GVAR(workingMemory) select 7) do { + case 0: { _clickSize = 1; }; + case 1: { _clickSize = 1 / 1.047; }; + case 2: { _clickSize = 3.38; }; + }; + _clickNumber = GVAR(workingMemory) select 8; + _clickInterval = _clickSize / _clickNumber; - _elevation = Round(_elevation / _elevationScopeStep); - _windage1 = Round(_windage1 / _windageScopeStep); - _windage2 = Round(_windage2 / _windageScopeStep); + _elevation = Round(_elevation / _clickInterval); + _windage1 = Round(_windage1 / _clickInterval); + _windage2 = Round(_windage2 / _clickInterval); }; }; diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index a86170fd45..64f121bc86 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_wind2", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"]; +private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_wind2", "_windageRel", "_windageCur", "_lead", "_clickSize", "_clickNumber", "_clickInterval"]; _elevationAbs = GVAR(elevationOutput) select GVAR(currentTarget); _windageAbs = GVAR(windage1Output) select GVAR(currentTarget); @@ -55,19 +55,24 @@ switch (GVAR(currentScopeUnit)) do { _windageCur = _windageCur * 1.047; }; case 3: { - _elevationScopeStep = (GVAR(workingMemory) select 7); - _windageScopeStep = (GVAR(workingMemory) select 8); + switch (GVAR(workingMemory) select 7) do { + case 0: { _clickSize = 1; }; + case 1: { _clickSize = 1 / 1.047; }; + case 2: { _clickSize = 3.38; }; + }; + _clickNumber = GVAR(workingMemory) select 8; + _clickInterval = _clickSize / _clickNumber; - _elevationAbs = Round(_elevationAbs / _elevationScopeStep); - _windageAbs = Round(_windageAbs / _windageScopeStep); + _elevationAbs = Round(_elevationAbs / _clickInterval); + _windageAbs = Round(_windageAbs / _clickInterval); - _wind2 = Round(_wind2 / _windageScopeStep); + _wind2 = Round(_wind2 / _clickInterval); - _elevationRel = Round(_elevationRel / _elevationScopeStep); - _windageRel = Round(_windageRel / _windageScopeStep); + _elevationRel = Round(_elevationRel / _clickInterval); + _windageRel = Round(_windageRel / _clickInterval); - _elevationCur = Round(_elevationCur / _elevationScopeStep); - _windageCur = Round(_windageCur / _windageScopeStep); + _elevationCur = Round(_elevationCur / _clickInterval); + _windageCur = Round(_windageCur / _clickInterval); }; }; diff --git a/addons/atragmx/functions/fnc_update_solution_setup.sqf b/addons/atragmx/functions/fnc_update_solution_setup.sqf new file mode 100644 index 0000000000..204a844c9d --- /dev/null +++ b/addons/atragmx/functions/fnc_update_solution_setup.sqf @@ -0,0 +1,31 @@ +/* + * Author: Ruthberg + * Updates all solution setup input fields + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_update_solution_setup + * + * Public: No + */ +#include "script_component.hpp" + +{((uiNamespace getVariable "ATragMX_Display") displayCtrl _x) ctrlEnable true} forEach [15001, 15002, 15003, 15004, 15005, 15006, 15008, 15009, 15010]; + +switch (GVAR(currentScopeClickNumberTemp)) do { + case 1: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15001) ctrlEnable false; }; + case 2: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15002) ctrlEnable false; }; + case 3: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15003) ctrlEnable false; }; + case 4: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15004) ctrlEnable false; }; + case 8: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15005) ctrlEnable false; }; + case 10: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15006) ctrlEnable false; }; +}; + +((uiNamespace getVariable "ATragMX_Display") displayCtrl (15008 + GVAR(currentScopeClickUnitTemp))) ctrlEnable false; + +ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15011); diff --git a/addons/atragmx/functions/fnc_update_target_selection.sqf b/addons/atragmx/functions/fnc_update_target_selection.sqf index d63f84a90c..d9fd6002c9 100644 --- a/addons/atragmx/functions/fnc_update_target_selection.sqf +++ b/addons/atragmx/functions/fnc_update_target_selection.sqf @@ -15,10 +15,7 @@ */ #include "script_component.hpp" -((uiNamespace getVariable "ATragMX_Display") displayCtrl 500) ctrlEnable true; -((uiNamespace getVariable "ATragMX_Display") displayCtrl 501) ctrlEnable true; -((uiNamespace getVariable "ATragMX_Display") displayCtrl 502) ctrlEnable true; -((uiNamespace getVariable "ATragMX_Display") displayCtrl 503) ctrlEnable true; +{((uiNamespace getVariable "ATragMX_Display") displayCtrl _x) ctrlEnable true} forEach [500, 501, 502, 503]; ((uiNamespace getVariable "ATragMX_Display") displayCtrl 500 + GVAR(currentTarget)) ctrlEnable false; From c27f3fb1317ed8478a5aba5e207927416b020a7c Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 21 Apr 2015 15:46:53 +0200 Subject: [PATCH 5/8] Added target speed direction switch / Improved the solution result output --- addons/atragmx/RscTitles.hpp | 10 +++ addons/atragmx/XEH_preInit.sqf | 1 + .../atragmx/functions/fnc_clear_user_data.sqf | 1 + .../fnc_cycle_target_speed_direction.sqf | 22 +++++ addons/atragmx/functions/fnc_init.sqf | 1 + addons/atragmx/functions/fnc_parse_input.sqf | 7 +- .../functions/fnc_restore_user_data.sqf | 1 + .../functions/fnc_show_target_data.sqf | 2 +- .../atragmx/functions/fnc_store_user_data.sqf | 1 + .../atragmx/functions/fnc_update_result.sqf | 88 +++++++++++++++++-- .../functions/fnc_update_target_data.sqf | 5 ++ 11 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 2194b2b27a..94416aba23 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -1338,6 +1338,16 @@ class ATragMX_Display { idc=140050; y=0.265*safezoneH+safezoneY+0.480; }; + class TEXT_TARGET_DATA_TARGET_SPEED_DIRECTION: ATragMX_RscButton { + idc=140051; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + w=0.0231; + x=0.550*safezoneW+safezoneX+0.305; + y=0.265*safezoneH+safezoneY+0.480; + text=">"; + action=QUOTE(call FUNC(cycle_target_speed_direction)); + }; class TEXT_TARGET_DATA_TARGET_RANGE: TEXT_TARGET_DATA_LATITUDE { idc=14006; y=0.265*safezoneH+safezoneY+0.520; diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index 4718e6c31a..6ec288b9c7 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -20,6 +20,7 @@ PREP(cycle_num_ticks_units); PREP(cycle_range_card_columns); PREP(cycle_scope_unit); PREP(cycle_target_size_units); +PREP(cycle_target_speed_direction); PREP(delete_gun); PREP(init); PREP(parse_input); diff --git a/addons/atragmx/functions/fnc_clear_user_data.sqf b/addons/atragmx/functions/fnc_clear_user_data.sqf index f805ce66b1..308b5bbf12 100644 --- a/addons/atragmx/functions/fnc_clear_user_data.sqf +++ b/addons/atragmx/functions/fnc_clear_user_data.sqf @@ -36,6 +36,7 @@ profileNamespace setVariable ["ACE_ATragMX_windSpeed2", nil]; profileNamespace setVariable ["ACE_ATragMX_windDirection", nil]; profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", nil]; profileNamespace setVariable ["ACE_ATragMX_targetSpeed", nil]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeedDirection", nil]; profileNamespace setVariable ["ACE_ATragMX_targetRange", nil]; profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", nil]; diff --git a/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf b/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf new file mode 100644 index 0000000000..3c77fab792 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf @@ -0,0 +1,22 @@ +/* + * Author: Ruthberg + * Cycles through the target directions left/right + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_target_direction + * + * Public: No + */ +#include "script_component.hpp" + +if ((ctrlText 140051) == ">") then { + ctrlSetText [140051, "<"]; +} else { + ctrlSetText [140051, ">"]; +}; diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index 16c0b7eb86..e4fe1b67a4 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -59,6 +59,7 @@ GVAR(windSpeed2) = [0, 0, 0, 0]; GVAR(windDirection) = [12, 12, 12, 12]; GVAR(inclinationAngle) = [0, 0, 0, 0]; GVAR(targetSpeed) = [0, 0, 0, 0]; +GVAR(targetSpeedDirection) = [1, 1, 1, 1]; GVAR(targetRange) = [0, 0, 0, 0]; GVAR(showWind2) = false; diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf index ca289302c9..25ff7d764c 100644 --- a/addons/atragmx/functions/fnc_parse_input.sqf +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -40,7 +40,12 @@ if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget) GVAR(inclinationAngle) set [GVAR(currentTarget), round(acos(_inclinationAngleCosine))]; }; }; -GVAR(targetSpeed) set [GVAR(currentTarget), -50 max abs(parseNumber(ctrlText 140050)) min 50]; +GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140050)) min 50]; +if ((ctrlText 140051) == ">") then { + GVAR(targetSpeedDirection) set [GVAR(currentTarget), +1]; +} else { + GVAR(targetSpeedDirection) set [GVAR(currentTarget), -1]; +}; GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000]; if (GVAR(currentUnit) != 2) then { GVAR(windSpeed1) set [GVAR(currentTarget), (GVAR(windSpeed1) select GVAR(currentTarget)) * 0.44704]; diff --git a/addons/atragmx/functions/fnc_restore_user_data.sqf b/addons/atragmx/functions/fnc_restore_user_data.sqf index 7204f17426..896455ec7a 100644 --- a/addons/atragmx/functions/fnc_restore_user_data.sqf +++ b/addons/atragmx/functions/fnc_restore_user_data.sqf @@ -33,6 +33,7 @@ GVAR(windSpeed2) = profileNamespace getVariable ["ACE_ATragMX_windSpeed2", [0, 0 GVAR(windDirection) = profileNamespace getVariable ["ACE_ATragMX_windDirection", [12, 12, 12, 12]]; GVAR(inclinationAngle) = profileNamespace getVariable ["ACE_ATragMX_inclinationAngle", [0, 0, 0, 0]]; GVAR(targetSpeed) = profileNamespace getVariable ["ACE_ATragMX_targetSpeed", [0, 0, 0, 0]]; +GVAR(targetSpeedDirection) = profileNamespace getVariable ["ACE_ATragMX_targetSpeedDirection", [1, 1, 1, 1]]; GVAR(targetRange) = profileNamespace getVariable ["ACE_ATragMX_targetRange", [0, 0, 0, 0]]; GVAR(rangeCardStartRange) = 0 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardStartRange", 200]) min 3000; diff --git a/addons/atragmx/functions/fnc_show_target_data.sqf b/addons/atragmx/functions/fnc_show_target_data.sqf index 48e419f65f..f1b432edf8 100644 --- a/addons/atragmx/functions/fnc_show_target_data.sqf +++ b/addons/atragmx/functions/fnc_show_target_data.sqf @@ -17,7 +17,7 @@ GVAR(showTargetData) = _this; -{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; +{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 140051, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; if (_this) then { [] call FUNC(update_target_data); diff --git a/addons/atragmx/functions/fnc_store_user_data.sqf b/addons/atragmx/functions/fnc_store_user_data.sqf index 01a5810fe2..5cfe7f2ae0 100644 --- a/addons/atragmx/functions/fnc_store_user_data.sqf +++ b/addons/atragmx/functions/fnc_store_user_data.sqf @@ -35,6 +35,7 @@ profileNamespace setVariable ["ACE_ATragMX_windSpeed2", GVAR(windSpeed2)]; profileNamespace setVariable ["ACE_ATragMX_windDirection", GVAR(windDirection)]; profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", GVAR(inclinationAngle)]; profileNamespace setVariable ["ACE_ATragMX_targetSpeed", GVAR(targetSpeed)]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeedDirection", GVAR(targetSpeedDirection)]; profileNamespace setVariable ["ACE_ATragMX_targetRange", GVAR(targetRange)]; profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", GVAR(rangeCardStartRange)]; diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index 64f121bc86..bb708efaab 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -82,16 +82,88 @@ if (GVAR(showWind2)) then { ctrlSetText [42, "Lead"]; }; -ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)]; -ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)]; -ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)]; +_elevationAbs = Round(_elevationAbs * 100) / 100; +if (_elevationAbs > 0) then { + ctrlSetText [400, format["%1", abs(_elevationAbs)]]; +} else { + if (_elevationAbs < 0) then { + ctrlSetText [400, format["%1D", abs(_elevationAbs)]]; + } else { + ctrlSetText [400, "0.0"]; + }; +}; +_elevationRel = Round(_elevationRel * 100) / 100; +if (_elevationRel > 0) then { + ctrlSetText [401, format["%1", abs(_elevationRel)]]; +} else { + if (_elevationRel < 0) then { + ctrlSetText [401, format["%1D", abs(_elevationRel)]]; + } else { + ctrlSetText [401, "0.0"]; + }; +}; +_elevationCur = Round(_elevationCur * 100) / 100; +if (_elevationCur > 0) then { + ctrlSetText [402, format["%1", abs(_elevationCur)]]; +} else { + if (_elevationCur < 0) then { + ctrlSetText [402, format["%1D", abs(_elevationCur)]]; + } else { + ctrlSetText [402, "0.0"]; + }; +}; -ctrlSetText [410, Str(Round(_windageAbs * 100) / 100)]; -ctrlSetText [411, Str(Round(_windageRel * 100) / 100)]; -ctrlSetText [412, Str(Round(_windageCur * 100) / 100)]; +_windageAbs = Round(_windageAbs * 100) / 100; +if (_windageAbs > 0) then { + ctrlSetText [410, format["%1R", abs(_windageAbs)]]; +} else { + if (_windageAbs < 0) then { + ctrlSetText [410, format["%1L", abs(_windageAbs)]]; + } else { + ctrlSetText [410, "0.0"]; + }; +}; +_windageRel = Round(_windageRel * 100) / 100; +if (_windageRel > 0) then { + ctrlSetText [411, format["%1R", abs(_windageRel)]]; +} else { + if (_windageRel < 0) then { + ctrlSetText [411, format["%1L", abs(_windageRel)]]; + } else { + ctrlSetText [411, "0.0"]; + }; +}; +_windageCur = Round(_windageCur * 100) / 100; +if (_windageCur > 0) then { + ctrlSetText [412, format["%1R", abs(_windageCur)]]; +} else { + if (_windageCur < 0) then { + ctrlSetText [412, format["%1L", abs(_windageCur)]]; + } else { + ctrlSetText [412, "0.0"]; + }; +}; if (GVAR(showWind2)) then { - ctrlSetText [420, Str(Round(_wind2 * 100) / 100)]; + _wind2 = Round(_wind2 * 100) / 100; + if (_wind2 > 0) then { + ctrlSetText [420, format["%1R", abs(_wind2)]]; + } else { + if (_wind2 < 0) then { + ctrlSetText [420, format["%1L", abs(_wind2)]]; + } else { + ctrlSetText [420, "0.0"]; + }; + }; } else { - ctrlSetText [420, Str(Round(_lead * 100) / 100)]; + _lead = Round(_lead * 100) / 100; + if (_lead > 0) then { + if ((GVAR(targetSpeedDirection) select GVAR(currentTarget)) == 1) then { + ctrlSetText [420, format["%1R", abs(_lead)]]; + } else { + ctrlSetText [420, format["%1L", abs(_lead)]]; + }; + } else { + ctrlSetText [420, "0.0"]; + }; }; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_update_target_data.sqf b/addons/atragmx/functions/fnc_update_target_data.sqf index b5e6dcf85a..6fa9035a62 100644 --- a/addons/atragmx/functions/fnc_update_target_data.sqf +++ b/addons/atragmx/functions/fnc_update_target_data.sqf @@ -32,6 +32,11 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [140050, Str(Round((GVAR(targetSpeed) select GVAR(currentTarget)) * 100) / 100)]; }; +if ((GVAR(targetSpeedDirection) select GVAR(currentTarget)) == 1) then { + ctrlSetText [140051, ">"]; +} else { + ctrlSetText [140051, "<"]; +}; if (GVAR(currentUnit) == 1) then { ctrlSetText [140060, Str(Round((GVAR(targetRange) select GVAR(currentTarget)) * 1.0936133))]; } else { From e22a7e1aad4207e437a1a2ed1d256f1a2e4f3113 Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 21 Apr 2015 16:01:53 +0200 Subject: [PATCH 6/8] Improved the range card column spacing --- addons/atragmx/RscTitles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 94416aba23..76f06744dc 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -128,7 +128,7 @@ class ATragMX_RscListBox { class ATragMX_RscListNBox: ATragMX_RscListBox { idc=-1; type=102; - columns[]={0.0, 0.225, 0.475, 0.725}; + columns[]={0.0, 0.225, 0.475, 0.7}; drawSideArrows=0; idcLeft=-1; idcRight=-1; From 7c57ad25bd35cc3db939b12fe89db9f5f7eb3cb2 Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 21 Apr 2015 16:54:26 +0200 Subject: [PATCH 7/8] Fixes a recently introduced bug in the relative click memory --- addons/atragmx/functions/fnc_parse_input.sqf | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf index 25ff7d764c..504c45fb28 100644 --- a/addons/atragmx/functions/fnc_parse_input.sqf +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -95,9 +95,9 @@ if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) GVAR(workingMemory) set [1, _muzzleVelocity]; GVAR(workingMemory) set [2, _zeroRange]; -private ["_elevationCur", "_windageCur", "_elevationScopeStep", "_windageScopeStep"]; -_elevationCur = parseNumber(ctrlText 402); -_windageCur = parseNumber(ctrlText 412); +private ["_elevationCur", "_windageCur", "_clickSize", "_clickNumber", "_clickInterval"]; +_elevationCur = GVAR(workingMemory) select 10; +_windageCur = GVAR(workingMemory) select 11; switch (GVAR(currentScopeUnit)) do { case 0: { @@ -109,11 +109,16 @@ switch (GVAR(currentScopeUnit)) do { _windageCur = _windageCur / 1.047; }; case 3: { - _elevationScopeStep = (GVAR(workingMemory) select 7); - _windageScopeStep = (GVAR(workingMemory) select 8); + switch (GVAR(workingMemory) select 7) do { + case 0: { _clickSize = 1; }; + case 1: { _clickSize = 1 / 1.047; }; + case 2: { _clickSize = 3.38; }; + }; + _clickNumber = GVAR(workingMemory) select 8; + _clickInterval = _clickSize / _clickNumber; - _elevationCur = _elevationCur * _elevationScopeStep; - _windageCur = _windageCur * _windageScopeStep; + _elevationCur = Round(_elevationCur / _clickInterval); + _windageCur = Round(_windageCur / _clickInterval); }; }; From f888dcdb88e458f9845ab19680e40216cacd09eb Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 21 Apr 2015 08:22:50 -0700 Subject: [PATCH 8/8] Carry & Drag documentation. --- documentation/framework/carry-drag.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 documentation/framework/carry-drag.md diff --git a/documentation/framework/carry-drag.md b/documentation/framework/carry-drag.md new file mode 100644 index 0000000000..daaa9fb95a --- /dev/null +++ b/documentation/framework/carry-drag.md @@ -0,0 +1,27 @@ +--- +layout: wiki +title: Carry and Drag System +group: framework +order: 5 +parent: wiki +--- + +# 1. Config Values + +``` +class CfgVehicles { + class MyVehicle { + + + ace_dragging_canDrag = 1; // can this object be dragged?; 1 yes, 0 no (0 default) + ace_dragging_dragPosition[] = {0,1.2,0} // Offset of the model from the body while dragging, comparable to the offset in attachTo (It's the same actually) + ace_dragging_dragDirection = 0; // how much degrees is the model rotatated after dragging it (a global setDir after attachTo) + + ace_dragging_canCarry = 1; // can this object be carried?; 1 yes, 0 no (0 default) + ace_dragging_carryPosition[] = {0,1.2,0}; // Same as drag, but for carrying objects + ace_dragging_carryDirection = 0; // Same as drag, but for carrying objects + + }; +}; +``` +