Jump to content

pappavis

Members
  • Posts

    655
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by pappavis

  1. Come on to our forum, then you could request a few trial flights with the boss and then we see what happens next ;).
  2. Yes, sure please send.
  3. Well a fun movie where Glowing_Amraam's Rambo F-15 kicked Su-27 ass, you could make a film to show that a Su-27 is in fact a true Rambo ;).
  4. hoi lazer, Thanx 4 your help :)) Yes, i assumed the header file length to be 1535 bytes. This code ConfigurationSettings.AppSettings["MissionHeaderEndpos"] is a config variable which is te size of the header in chars. I have changed it to 1546 bytes. Gonna try these new setting at home tonight. My boss wont like it if i do lo-mac stuff here at work :P. Does ASCII/UTF-8 encoding have a role to play in this conversion? Coz what i do is: * read the "Su-25 Night Strike.mis" into a byte array, default dotnet encoding. * Copy the first 1536 bytes from "Su-25 Night Strike.mis" into a byte array. * Append misison XML (which is everything past byte 1536) to byte array. * Write this byte array out to file. Thought the file seems perfect when visually observed using the VS.NET2003 hex editor, there are some minor differrnces. Some bytes have differnt values. Possibly due to a ASCII/UTF-8 encoding thingy in VS2003?? Anyways, gonna try it tonight at home.
  5. Yes sure thanks. I made some new code, it seems that lockon doesnt grasp the file created by me, there are minor differences in the header bytes. I have had a look in a binary editor and sees that the first 1535 bytes makes a header of a mission file. Some byte are changed in that header. I suspect it to do with encoding, in some way or another. See attached code to convert XML from a mission to a real .mis file' bytes. I made these code to: * read a example misison file ("Su-25 Night Strike.mis") as binary. * Get the first 1535 as binary header. * Get the XML from a mission file such as "Su-25 Night Strike.mis". * Append XML from a mission file to the header. * Return a byte array, to write to file using a System.IO.Binarywriter. Prob is the first 1535 bytes of the output bytes are not equal to "Su-25 Night Strike.mis". Any ideas? #region Converts the XML missionfile to MIS. /// <summary> /// Converts the XML to lockon internal' MIS-fileformat. /// </summary> /// <param name="xDocToConvert">The xml missionfile source to convert.</param> /// <returns></returns> public byte[] GetXMLtoMIS(XmlDocument xDocToConvert) { byte[] bytMissionHeader = null; byte[] bytResult = null; try { string strBaseMissionName = AppDomain.CurrentDomain.BaseDirectory + @".\" + ConfigurationSettings.AppSettings["LockonMissionHeader"]; FileStream fs = new FileStream(strBaseMissionName, FileMode.Open); BinaryReader brInput1 = new BinaryReader(fs); //Open die voorbeeld lockon .mis-bestand, zoek naar <Lockon en vervangen met eigen misison XML. if(brInput1 != null) { bytMissionHeader = brInput1.ReadBytes(Convert.ToInt32(brInput1.BaseStream.Length)); int intMissionHeaderEndpos = int.Parse(ConfigurationSettings.AppSettings["MissionHeaderEndpos"]); byte[] bytMissionXML = Encoding.UTF8.GetBytes(xDocToConvert.OuterXml.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "")); //Recerveer een deel van geheugen, hier gaat de mission file tijdelijk in worden aangemaakt. byte[] bytTemp1 = new byte[intMissionHeaderEndpos + bytMissionXML.Length]; //kopieer mission header definite, van Eagle Dynamics. for(int intTeller = 0; intTeller < intMissionHeaderEndpos; intTeller++) { bytTemp1[intTeller] = bytMissionHeader[intTeller]; } //Plak de nieuwe door gebruiker gemaakt XML achter aan die header van ED missionfile. int tel2 = 0; for(int intTeller = intMissionHeaderEndpos + 1; intTeller < intMissionHeaderEndpos + bytMissionXML.Length; intTeller++) { bytTemp1[intTeller] = bytMissionXML[tel2]; tel2++; } bytResult = bytTemp1; } } catch(Exception ex) { throw new Exception(ex.Message + "; " + ex.StackTrace); } return bytResult; } #endregion This code writes a .mis file: public void WriteMISfile() { try { byte[] bytMIS = new clsMissionFile().GetXMLtoMIS(_xDocNewMission1); FileStream fs = new FileStream(objSaveMap.Filename, FileMode.OpenOrCreate); BinaryWriter bwOutMIS = new BinaryWriter(fs); if(bwOutMIS != null) { for(int intMisPos = 0 ; intMisPos < bytMIS.Length; intMisPos++) { bwOutMIS.Write(bytMIS[intMisPos]); } bwOutMIS.Close(); } } catch(Exception ex) { MessageBox.Show("Error: " + ex.Message + "; " + ex.StackTrace, _appNaam, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } PM me then i'll send you the complete source code, all about 1.8mb.
  6. I have written a util in C# which assists in making scene files. Its not public yet ;)
  7. yep so i have noticed, there is a minor but definite difference. After having seen this difference in values between managed C++ and unmanaged C++ there is uncertainty about the accuracy of c++ maths values. Not that i ever intent on using C++.
  8. The 159th was on alerttraining this sunday evening, some pictures of our training flight.
  9. Huh does the Indian airforce have Su-33's? You sure thats not the MiG-29K? Since when?
  10. Thanx, this worked perfect :).
  11. Hi. I am working on a lockon project. Therefore i hope sum1 could help me with something which ould be simple in C#. I dont know how to concatenate two binary arrays, such as one would easily do with a string. Look at my code. public byte[] GetXMLtoMIS(XmlDocument xDocToConvert) { string strLockonMissionHeader = ""; byte[] bytMissionHeader = null; try { StreamReader srIn1 = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @".\" + ConfigurationSettings.AppSettings["LockonMissionHeader"]); BinaryReader brInput1 = new BinaryReader(srIn1.BaseStream); if(brInput1 != null) { bytMissionHeader = brInput1.ReadBytes(Convert.ToInt32(brInput1.BaseStream.Length)); bytMissionHeader = bytMissionHeader + System.Text.Encoding.UTF8.GetBytes(xDocToConvert.OuterXml.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "")); } } catch(Exception ex) { throw new Exception(ex.Message + "; " + ex.StackTrace); } return bytMissionHeader; } This is the piece of code that annoys me: bytMissionHeader = bytMissionHeader + System.Text.Encoding.UTF8.GetBytes("bla die bl bla")); It results in error "C:\michiel\Projecten\Ander\Lockon editor\pappavis.lockon.mapeditorGUI\editor\clsMissionFile.cs(583): Operator '+' cannot be applied to operands of type 'byte[]' and 'byte[]'". ANy1 with an idea? TIA!!
  12. I have it too but not as clearly visible as yours.
  13. Hi. Who knows which shapes does vehicle units aircraft, ships, heli's, cars or Fortifications are using? Can any1 tell me what for example unit belongs to "HOME1_B"? A complete listing would be very usefull. TIA.
  14. check out the Kh-41 tutorial track on my website, featuring subtitles.
  15. SUPA! zillion :)
  16. Err, the dotnet code is copied from the example in latlong2xz.zip :confused:.
  17. Grr, i get differnt results from a dotnet Managed C++ (class library project) and the code provided by Eagle Dynamics :mad:. I have loaded that .dsw project into VS2003.NET and ran it. This is the output; Please enter the Latitude: 44.4134 Please enter the Longitude: 33.2254 The result is: X:-79981.273438 Z:-82053.031250 MiddleLongitude:33.000000 ToAngleW_E:1.434656 ToDegree:57.295780 lenSouth:7038538.023034 EndSouth:40.000000 ToLengthN_S:0.000009 realAng:0.002742 realLen:6545005.879861 Mal Variablen vergleichen und Wundern Now this is the output of the exact same code, but it was converted to a dotnet C++ class library. realAng = 0.13884959128047325 realLen = 6545005.7833973151 outX = -17015.813559228554 outZ = 805854.12593440851 WTF?!?:rolleyes: For clarity, here is the converted dotnet class code. // pappavislockonmapeditorKrimCoordinates.h #pragma once #using <mscorlib.dll> using namespace System; //Convert realworld coordinates to lockn Krimea coordinates. //see this http://forum.lockon.ru/showthread.php?p=152219#post152219 //This original code courtesy of Valery Blaznov at Eagle Dynamics, http://lockon.ru //Converted to Microsoft Dotnet on 17-jan-2006 by pappavis@hotmail.com namespace pappavislockonmapeditorKrimCoordinates { public __gc class clsKrimCoordinates { static const double pi = 3.14159265358979323846; static const float zeroX = 5000000.f; // Real coordinates beginning static const float zeroZ = 6600000.f; static const float centerX = 11465000.f - zeroX; // Circle center static const float centerZ = 6500000.f - zeroZ; static const float pn40x24_X = 4468608.57f - zeroX; // point 40dgN : 24dgE static const float pn40x24_Z = 5730893.72f - zeroZ; static const float pn48x24_X = 5357858.31f - zeroX; // point 48dgN : 24dgE static const float pn48x24_Z = 5828649.53f - zeroZ; static const float pn40x42_X = 4468608.57f - zeroX; // point 40dgN : 42dgE static const float pn40x42_Z = 7269106.20f - zeroZ; static const float pn48x42_X = 5357858.31f - zeroX; // point 48dgN : 42dgE static const float pn48x42_Z = 7171350.00f - zeroZ; static const double lenNorth = Math::Sqrt((pn48x24_X-centerX)*(pn48x24_X-centerX) + (pn48x24_Z-centerZ)*(pn48x24_Z-centerZ)); static const double lenSouth = Math::Sqrt((pn40x24_X-centerX)*(pn40x24_X-centerX) + (pn40x24_Z-centerZ)*(pn40x24_Z-centerZ)); static const double lenN_S = lenSouth - lenNorth; static const double RealAngleMaxLongitude = Math::Atan (((double)pn40x24_Z - centerZ)/(pn40x24_X - centerX)) * 180.f / pi; // Map bounds. Degrees! static const float EndWest = 24.f; static const float EndEast = 42.f; static const float EndNorth = 48.f; static const float EndSouth = 40.f; static const float MiddleLongitude = (EndWest + EndEast) / 2; static const float ToLengthN_S = (float)((EndNorth - EndSouth) / lenN_S); static const double ToAngleW_E = (MiddleLongitude - EndWest) / RealAngleMaxLongitude; static const double ToDegree = 180. / pi; private: double _outX; double _outZ; public: //Convert realworld to lockon internal coordinates. int clsKrimCoordinates::GetKrimCoords(double inLatitudeGrad, double inLongitudeGrad) { double realAng = (inLongitudeGrad - MiddleLongitude) / ToAngleW_E / ToDegree; double realLen = lenSouth - (inLatitudeGrad - EndSouth) / ToLengthN_S; _outX = centerX - realLen * Math::Cos (realAng); _outZ = centerZ + realLen * Math::Sin (realAng); return 1; } double outX() { return _outX; } double outZ() { return _outZ; } }; } Any idea what is wrong? Where have i gone wrong?:confused:
  18. Hi! Current status: * The app can load a bitmap file. * Allow a user too add, delete or edit objects onto the bitmap at specific coordinates. * Save this user additions as a template XML file. * Reload the template back for later editing. * Export these objects as a scene metadata file, ready for processing by Swingkid's scenedit2.exe proggy. Future editions: * Allow to convert a saved lockon mission file to a scene. * A custom mission editor...? The readme file: USAGE: Take a real world map from lockon, or <a href="http://earth.google.com">Google Earth</a>.Make a screenshot of the section you want to populate with objects in lo-mac. Look at the examples Sukhumi.jpg.Note down the topleft, topright etc realword coordinates, then add it into mapeditorMeta.xml, see examples. Edit the mapeditorMeta.xml.Your screenshots must be relative to directory '" + AppDomain.CurrentDomain.BaseDirectory + " Open a map, from the Editor menu, then click on the bitmap to add some objects. Start adding lockon objects, such as trees, static objects on to the map.<br> Save to a file if u want. Use [b]<b>Export</b>[/b] to create a text file, which you must manually append to a file created with scnedit.exe Recompile a new scene file using Swingkid' scnedit2.exe util. Start Lockon: Flaming Cliffs and check out your new masterpiece :) To use this app is your own risk, you have been warned :P BUT: * Converting realworld to lomac coordinates doesnt work properly. I have taken the C++ math code and converted them to C#. However when executing the code to convert a value of say, 41.2314E to realworld using the GetCoords() the c# compiler replies with "Infinity":confused:. The code isnt at all complicated. If you know java you can dig into c# very quickly. I know how it feels to struggle with other people's code. My code is rather legible, structred and some in-code documentation are available. If i can iron out the coordinates issue then the app is nearly ready for a demo release. Oke, it wont win any beauty contests :icon_karu The work continues.
  19. Zillion, please PM me. Gimme your e-mail adress too. I have a pre-release version available for getting-an-idea :). U need the M$ Dotnetframework to run it.
  20. Hi Zillion You wrote about such a thing in the ATC thread. SURE :). For now my idea is to make a editor which has a GUI. One could modify the \Bazar\Terrain\Scenes\*.scn files. Swingkid has provided me with a tool to extract a .scn to text for manipulation. That idea i want to extend further. The reasoning for my idea is because of something Swingkid and 666th_birdy are/were working on. The main aims of this scenes file editor, a first release: * Allow a user to open a lomac .scn-file. * Allow a user to add/remove user-defined objects onto any geografical location in the lo-mac world. * Save this as a custom scenes metadata XML, for later retrieval. * Then, append the custom scenes metadata onto high.scn for example. future versions; * Allow the user to add objects in groups onto the map, like create a woodland of trees. * Have templates for towns, user could click on a map area and point where to add a town. * Relocate 1 or 2 airbases from the Krim to Turkey, Bulgaria. Waaaay into the future; * It can be a missioneditor, allowing COPYING and pasting of units, great for multiplayer missions. I see a possibility of a custom lo-mac Missioneditor as a distinct real possibility, though longterm. The current missioneditor really needs a overhaul! The programming environment is M$ VS2003.NET, coding in c#. Though at home i use VS2005 Beta 2. If you dont have it, go grab the "free" express edition from the msdn website. Do you have any ideas yourself, your help will be greatly appreciated :cool:
  21. hey THANX!!:p :icon_supe It was great thanx :). Now does any1 perhaps know how to draw onto a map? I am coding in visual studio 2003 programming language is C#.. I'd like to add objects onto the bitmap.
  22. Hi guys, A non-maths mind needs some help with a mathmetical puzzle. I am working on a GUI editor project for lockon, whereby one could edit the lockon world, to add objects such as shelters, buildings etc. onto specific locations. I need some help. Whats puzzling me is how to calculate scaling from screen pixel X to realworld X. I have taken a screenshot of the airbase Khersones, determined the topleftW, toprightE, bottomleft, bottomright coordinates for both long-/and lattitude as per lo-mac missioneditor. It doesnt really matter the size of the bitmap. The following is kinda a description of my question statement: * if the X-pos on 1 pixel then the realworld lattitude West is 33.2254 in addition, * if X-pos is at 800 is then the realworld lattitude East is 33.4705 Question: what is the realworld scled (X-position) value of 1 pixel? the lomac missioneditor already has this built in. Go to the missioneditor move the mouse in the lo-mac mapeditor, or also get Google Earth and see for yourself. TIA!
  23. An airbase is a place one could land and refuel. A few months ago Swingkid released a merzifon airbase mod. Using the mod one could relocate the Razdolnoye airbase to Turkey. That raises to me a theoretical possibility to have more airbases than the >=21 currently in-game. Even better if one could add own airbases from the mission editor. Most likely the MEinit.xml will prevent adding new airbases coz they would probably all be tied to some program code inside the locokon.exe. Though many requests, the mission editor hasnt been changeed/upgraded/improved in any way whatsoever since 1.0 was released. Therefore i truly doubt any chances of any changes to the ME. In theory ED could create a FARP by using airbase objects and allow mission creators to add them in the mission editor. Which is in my €0.01 opinion unlikely to happen.
  24. BGP, i have both the Merzifon mod and the trees mod installed which seems to doesnt conflict to each other. Your mod when finished and if inclusive of the trees mod would be a great all-in-one compilation of great new community enhancements.
  25. GREAT brit, let we're all anxiously awaiting your release :). BTW, could you also include 666th_Birdy's trees mod too into this too?
×
×
  • Create New...