Author Topic: Updating Lem3Edit {v2.1 - 05/05/2018}  (Read 25495 times)

0 Members and 1 Guest are viewing this topic.

Offline kieranmillar

  • Posts: 286
    • View Profile
Updating Lem3Edit {v2.1 - 05/05/2018}
« on: November 10, 2017, 10:01:32 PM »
Now on Github: https://github.com/kieranmillar/lem3edit

I promised myself next time I had a day off, I'd spend it trying to do some programming. I'm seriously amateur-hour at programming so wanted to edit an existing program to as a way to learn.

About 8 years ago Mindless made a Lemmings 3 level editor, lem3edit, then before finishing it decided to redo it in C++, but unfortunately abandoned it before re-implementing some key features... like the ability to save! So I sat down with a tutorial on how to get SDL to work in your environment and today's project became adding in a save ability to Lem3Edit. You can find Mindless's original source code here: https://bitbucket.org/mindless/lemmings-tools

It turns out it was pretty easy to add in the save feature, you just do the opposite of loading the level, hah!

So I looked to do a few more things because the save feature got implemented pretty quickly. Now you can cycle an object through all of the object ids so you can actually change what is in the level, this was a heck of a lot tougher to implement because the object ids are not contiguous and jump all over the place! But I got there in the end.

Lastly I made a quick "backgrounds only" view because it was quick to do and it's nice to be able to properly select and edit the backgrounds when they hide behind the terrain.

Unfortunately, making levels looks like it will be an unbelievable pain in the ass with the current interface, so I'll have to revisit this on my next day off and work on this some more. But at least now, if you also use a hex editor to edit some of the other level properties, you can actually make a fully-functioning mod!

P.S. If you want to play around, make sure to read the README file for controls. Note that you can't create new objects or terrain from scratch without copying and pasting existing ones then cycling through the object ids to change what they are. All objects are one of two types, terrain, and everything else.

To use the program, it needs to be put in the folder one step up from the GRAPHICS, LEVELS and STYLES folders. Those are on the CD, so copy your CD contents to your harddrive. And backup all of the files in your level folder! The program only loads levels via a command line argument, so make a shortcut to the exe file and put the level number (e.g. 123) directly after the link to the exe in your shortcut's properties.
EDIT: This is no longer how the program works. Read the README file!

I don't know how to use source control, so have uploaded my source to comply with the licencing. Maybe learning source control should be my next mini-project!
« Last Edit: May 05, 2018, 08:24:12 PM by kieranmillar »

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: Fixing Lem3Edit
« Reply #1 on: November 11, 2017, 12:22:10 AM »
Quote
I don't know how to use source control, so have uploaded my source to comply with the licencing. Maybe learning source control should be my next mini-project!

I thought it seemed like a lot of effort when I first heard about it, but I don't know how I lived without it now.
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline mobius

  • Posts: 2752
  • relax.
    • View Profile
Re: Fixing Lem3Edit
« Reply #2 on: November 11, 2017, 01:56:29 AM »
:thumbsup:
:thumbsup:
:thumbsup:
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


Offline kieranmillar

  • Posts: 286
    • View Profile
Re: Fixing Lem3Edit {v0.4 - 12/11/2017}
« Reply #3 on: November 12, 2017, 08:42:19 PM »
I was enjoying this too much, so I just spent the whole weekend on it too!

I've attached v0.4 and its source code to the opening post. This feature comes with what I think is a really important addition for usability, a zoom feature!

Adding this was not so simple. Everything I could see online suggested I use SDL2 instead of SDL1.2 that lem3edit was coded in, so I could easily scale up the graphics using textures instead of manually duplicating the bits to the screen. I figured an update of SDL would be good practice and it's not like this is a huge program, so that's what I did. It ended up being quite a significant task as the paletted graphics the game uses were not immediately suited for it, but as you can see I got there in the end! This may mean for those of you who have computers with graphics cards (and not this integrated chipset nonsense my 10-year-old laptop uses) you might see some significant speed increases on complex levels like level 110, which seems to have about 900 objects in it for some nonsensical reason, just object after object layered on top of one another.

The change to SDL2 came with a few other minor changes. Gone is full screen mode, but I plan to eventually allow a resizable window so you won't need fullscreen. The selection boxes are no longer complicated marching ants selection boxes but much simpler semi-transparent rectangles, because hey with SDL2 we have easy alpha rendering now!

The zoom is triggered with only the mouse-wheel so far. It currently uses the top-left corner as the centre of zoom which is almost always not what you actually want, but that will be for another day.

Happy editing, this time without lots of squinting!

Offline kieranmillar

  • Posts: 286
    • View Profile
Re: Fixing Lem3Edit {v0.4 - 12/11/2017}
« Reply #4 on: November 13, 2017, 10:31:54 PM »
I want to write a ToDo list to make the time I spend on this more efficient, so might as well post it here. Tasks higher up their respective list are higher priority for me. If you have any plans to use this program sometime soon and have some suggestions or would like to see something earlier, post about it and I'm happy to reprioritise. Besides, posting it here lets me do funky strikethroughs in the text! This post will change over time as I do things, make releases or think of more things to add.

Smaller Tasks

    Medium Tasks
    • Test level button.
    • Investigate why lemming and monster palettes are wrong

    Larger Tasks
    • Program appears to load animations. Show these?
    « Last Edit: February 17, 2018, 11:18:23 PM by kieranmillar »

    Offline Ryemanni

    • Posts: 328
    • Indeed.
      • View Profile
    Re: Fixing Lem3Edit {v0.4 - 12/11/2017}
    « Reply #5 on: November 14, 2017, 02:07:45 PM »
    I really love what you're doing here. Maybe I should try to make some L3 levels? ;)

    Offline Simon

    • Administrator
    • Posts: 3875
      • View Profile
      • Lix
    Re: Fixing Lem3Edit {v0.4 - 12/11/2017}
    « Reply #6 on: November 14, 2017, 03:42:15 PM »
    Very nice. I've skimmed the source, but haven't bulit it yet. I assume the build instructions are: Install SDL2, build all cpp files of the editor, and link against SDL2.

    Proper hosting on github would be lovely. I've played git helpdesk for Lix development back in 2011 and will happily answer questions in IRC about the git command line. If you prefer a GUI over command-line git, Nepster and namida have used Sourcetree.

    -- Simon

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.4 - 12/11/2017}
    « Reply #7 on: November 14, 2017, 08:27:02 PM »
    Very nice. I've skimmed the source, but haven't bulit it yet. I assume the build instructions are: Install SDL2, build all cpp files of the editor, and link against SDL2.

    Proper hosting on github would be lovely. I've played git helpdesk for Lix development back in 2011 and will happily answer questions in IRC about the git command line. If you prefer a GUI over command-line git, Nepster and namida have used Sourcetree.

    -- Simon
    Yes that sounds about right for setting up SDL2. I followed this tutorial:
    http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index.php
    And it was easy as hell. And if I can do it I imagine you will have no problems at all. The editor is currently pretty simple and only has this single dependency, so there's not much to it.

    I'll definitely give Sourcetree a look over. Maybe it's what I need to help me get over the hump on learning how to use git.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.4 - 12/11/2017}
    « Reply #8 on: November 14, 2017, 09:31:58 PM »

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.4.1 - 18/11/2017}
    « Reply #9 on: November 18, 2017, 09:05:58 PM »
    After spending most of the week encountering some coding challenges for the first time, messing it up, and reverting back to where I started, I decided to push out a few quick updates so those unwilling to compile from the latest source can take advantage of the latest features. These are not major updates, but are nice to have.

    The Windows binary for version 0.4.1 can be found attached to the opening post. I will no longer be attaching the source code to the latest post as it is now on Github.

    v0.4.1 changelog:
    • Program window can now be resized. It's also a bit larger by default.
    • Unimplemented monster that crashes the game can no longer be added to your levels.
    • Dashed lines now help make the level borders more visible given objects and terrain can go over the edges.

    The next version will be more useful, my current focus is on two things; a) an interface to browse and add objects and terrain pieces instead of copying existing ones and then cycling through all possibilities and b) dragging the dashed lines at the level border to resize the level.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.5 - 20/11/2017}
    « Reply #10 on: November 20, 2017, 10:03:01 PM »
    Here comes a new major update, the object bar!

    This lets you browse through all of the available objects and terrain pieces, and you can place new pieces onto the level by clicking on them to pick one up and clicking again in the level to place it.

    Use the 1 and 2 keys on the keyboard to choose either backgrounds and objects, or terrain.

    If you're wondering why there is a big grey square to the left of the bar, that is reserved space for a panel that will have buttons on it to do things that are currently only available by keyboard commands, like save or toggle background view. But that will have to be in a future update.

    The Windows binary for version 0.5 can be found attached to the opening post.

    v0.5 changelog:
    • New object bar!
    • Z and X no longer cycle through object types, but instead scroll the object bar.
    • Scrolling at screen edges disabled. Currently can only scroll with IJKL keys.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.5.1 - 20/11/2017}
    « Reply #11 on: November 20, 2017, 10:56:08 PM »
    I'm such an idiot sometimes. Can't believe this has been present since my first release!

    v0.5.1 changelog:
    • Levels now save to the correct file, instead of always saving to level number 0.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.6 - 22/11/2017}
    « Reply #12 on: November 22, 2017, 10:25:16 PM »
    Another important update, resizable level and much better camera control!

    v0.6 changelog:
    • Level borders can be dragged to resize them, constrained to L3's maximum and minimum width and height. Levels can't be all that tall, but can be ridiculously wide. Selecting objects under the cursor takes priority over grabbing a level border, so sometimes it's worthwhile to zoom out and grab the border far away from the main level.
    • You can now scroll with the mouse by holding down the right mouse button
    • Zooming now properly focusses on the mouse cursor
    • Re-added cycling ids of selected objects, as sometimes useful, e.g. to make easier changes to Classic's organic backgrounds. Now set to the [ and ] keys.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.6.1 - 25/11/2017}
    « Reply #13 on: November 25, 2017, 07:39:18 PM »
    I always knew there was something about this program that was causing massive lag, and this started to get very severe when there are lots of objects in the level. Level 016 is the worst example, with over 1,000 objects. And the lag got so bad that the program became basically unresponsive, not even closing when you tried to close the window unless you sat and waited for a couple of minutes.

    Anyway I found the culprit, looking up object properties by iterating through every object instead of using a sensible searching method. Fixing this lowered the time per frame by about 75%! The program now remains mostly responsive at all times, but there are further improvements that can be made here.

    Also Ctrl got busted at some point so I fixed it!

    v0.6.1 changelog:
    • Fixed Ctrl-click which broke at some point. Handling of selecting and dragging objects is also much improved.
    • When saving, the number of extra lemmings and number of monsters are saved as required by the level format.
    • Major optimisation to looking up object properties, resulting in very large speed increases in a number of places.
    • If drawing is taking too long, drawing is skipped for a frame to allow the program to catch up and not get swamped in events, resulting in the program becoming unresponsive.
    • SDL2 prevents std::cout and similar from working, so now uses SDL_Log to display debug information in the console.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.7 - 28/11/2017}
    « Reply #14 on: November 28, 2017, 08:04:45 PM »
    A new major update, with the start of the graphical button interface for executing some important commands. No longer do you need to remember a million keyboard hotkeys.

    v0.7 changelog:
    • Tool and Creature objects split onto their own separate layer.
    • Each layer's visibility can be toggled separately, instead of background-only mode.
    • Buttons in the bottom-left of the screen can be clicked to execute common commands, such as changing the type of object showing in the bar, and saving.
    • Move to Front and Move to Back added to change draw order of selected objects.
    • Feedback when saving to prove it did something. Currently just a standard SDL Simple Message Box.
    • Program can now drop multiple frames in a row instead of just one in moments of extreme lag to remain responsive.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Fixing Lem3Edit {v0.7 - 28/11/2017}
    « Reply #15 on: November 28, 2017, 09:10:59 PM »
    I want to jot down my thoughts about level file management for Lemmings 3 and a potential solution for lem3edit to eventually take. Somebody might be interested, so I'll explain it here.

    When editing Lemmings 2, I only had to deal with a single level file. I could name the file anything I wanted to, test them individually in the editor, then when it came to release the pack, copy over any files that changed and rename them appropriately into LEVEL###.DAT according to its tribe and position. Not the quickest process when it comes to releasing an update, but it was easy to organise.

    In Lemmings 3 there is not one file, but three. LEVEL###.DAT, PERM###.OBS and TEMP###.OBS. The DAT file is tiny and contains basic level properties, like its size, which Tribe it is, time limit, that sort of thing, while the two OBS files contain the positions and types of all of the objects and terrain pieces that the level uses. Straight away we can see a huge problem, making a release or changing the order of the levels involves triple the work, as all 3 files need renaming. Doing this manually will be a huge pain, but its doable. And if you want to rename the levels while working on them to something easier to remember so you know which level is which, ideally you want all 3 files to have a similar naming convention. So a huge pain in the butt, still doable manually but very tedious.

    But wait! Lemmings 3 has one more really annoying trick up its sleeve! This isn't actually how it works at all! You see, when the game wants to load Classic 1, it loads up LEVEL001.DAT as you'd expect, but inside LEVEL001.DAT two numbers are saved, one for the number in the PERM filename, and one for the number in the OBJ filename. So renaming those latter two files is technically unnecessary, and PERM001.OBS doesn't even necessarily get read by LEVEL001.DAT.

    This leaves two choices if someone is making a level pack and wants to reorder two levels manually:
    1) Just rename the DAT file, leaving the OBS files with the same name and let the folder descend into a chaotically numbered mess, which is terrible for latter reorganisation and runs an easy risk of accidentally overwriting some other level's OBS file or deleting the wrong level's data.
    2) Try to keep file numbers strictly correct, by first resaving level A to a different number, then open and save level B to A's old position, then go back to level A and save it yet again to B's old position. This is not really user friendly at all, but at least it keeps things in order.

    Clearly, doing things manually will be awful no matter which way you cut it, so this leaves the program begging for another option, automating this mess with a proper level pack management system.

    There's a couple of ways this can be done. My current thought is as follows:
    • The editor can load and save individual levels in the default format, but you can also create a level pack. When using a level pack, a folder is created to store level files in, and the level pack itself is just a simple text file that stores all of the organisational data.
    • Users are given an interface of 3 columns, one for each Tribe, with up to 30 slots, and players can load in individual levels or create new ones by clicking on an empty slot. You can assign each level done this way with an internal name to remember it by, and the level files themselves are stored using this name, they can all be tested from within the editor using an L2Suite-style temporary file moving and renaming so for now this is just for organisational purposes internally.
    • Levels can be easily reordered by swapping them in the interface within a tribe, or saved down under the traditional file names for individual release/archiving and/or deleted.
    • Finally, there's a publish button, which creates a folder with all of the level files in the proper named format so that they can be zipped up and distributed for others to play.

    I feel like something like this is necessary for users to not go insane trying to make a level pack in the event anybody wants to. It sounds like a lot of work, but once the groundwork is done for handling an ini file for file paths for testing, and a way to test from the editor, you've already got the hard stuff out of the way.

    Offline Simon

    • Administrator
    • Posts: 3875
      • View Profile
      • Lix
    Re: Fixing Lem3Edit {v0.7 - 28/11/2017}
    « Reply #16 on: November 29, 2017, 02:22:38 AM »
    Scary design problem. :lix-scared: I love it.

    I'd keep the data tree pristine, with the DAT always pointing to same-numbered OBS files as the DAT's filename suggests. Reason: The data is public, it has some documentation flying around on the net, and will be read by programs other than our own. It's okay if the user interface is nasty to deal with this.

    Since the format is concocted, it sounds wise to view the entire level tree as one thing, and offer swap in the interface.

    If you save levels with names in the filename, not numbers in the filename, this makes the tree incompatible with L3, therefore it's almost like defining your own format. If your level filenames contain level names, not numbers, how will you handle the (number fields that choose an OBS file) in the DAT? Leave arbitrary values in there until export?

    But for loose levels, saving with name-in-filenames (not number in filenames) is probably required anyway. Will look forward to your result.

    -- Simon
    « Last Edit: November 29, 2017, 02:55:59 AM by Simon »

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v0.8 - 27/12/2017}
    « Reply #17 on: December 27, 2017, 10:56:08 PM »
    Time for another small release before I work on some more substantial features that will take a bit of work. You can now edit the in-game camera's starting position. Press space to bring up a camera box and drag it to where you want the camera to begin.

    v0.8 changelog:
    • Starting camera position can now be set.
    • Fixed bug introduced in v0.7 where tools and creatures moved when you resized the level.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.0 - 31/12/2017}
    « Reply #18 on: December 31, 2017, 02:29:17 PM »
    Here's an important milestone release, version 1.0!

    Why is this release a milestone? This version marks the first time all relevant level features can be edited via the level editor. No more need for hex editors! Of course there's still more to do to make things even easier, but now you can fully edit the official levels with no need for any other tools.

    The main addition for this release is a dialog with which to edit miscellaneous level properties, such as the release rate and time limit.

    v1.0 changelog:
    • New menu available through which release rate, initial spawn delay, and time limit can be edited. The maximum time limit is 7 mins constrained by the game, but the editor will allow inputs up to 7:59, although will change this to 7:00 internally. Hotkey: p
    • More buttons at the bottom of the screen to rely less on hotkeys. The one gap remaining is reserved for a future test level feature.
    • Tooltips display when hovering over a button to explain what they do.
    • The numpad can now be used for number inputs and changing layers.
    • For developers only: New external library used: SDL_ttf.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.1 - 13/01/2018}
    « Reply #19 on: January 13, 2018, 09:54:36 PM »
    Version 1.1 now attached to the opening post.

    This version adds area select. Clicking and dragging over an empty area draws a box, all pieces within that box when the mouse is released are selected. Modifiable with Ctrl to add pieces to the existing selection. Holding down Alt will force drawing a box over any other left-click action.

    v1.1 changelog:
    • New area select feature to easily select multiple pieces at once.
    • Fixed bug on some systems where resizing the window caused all textures to be lost. - Thanks to Nessy for reporting and testing.
    • Developers only - CMake support added for easier setup. - Thanks to Simon for this.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.2 - 03/02/2018}
    « Reply #20 on: February 03, 2018, 04:07:00 PM »
    Version 1.2 now attached to the opening post!

    There are substantial changes made to the way Lem3edit reads files in this release. Most importantly, Lem3edit no longer needs to be situated in the same location as the game data. You are highly encouraged to move the program out of the game data location and into its own location.

    Loading levels via command line arguments also no longer works. You now directly browse to and open the level you need.

    In reality these features are just to pave the way for the level pack organisation tool and easy testing, but there's been a lot of work in the backend made to get the program this far.

    v1.2 changelog:
    • Lem3edit now asks for and stores the location of the game data upon first run (or first after upgrading to this version or newer).
    • Levels now loaded directly by browsing to them via a typical file browsing dialog. Command line arguments no longer work.
    • Improved readability of tooltips.

    Offline Simon

    • Administrator
    • Posts: 3875
      • View Profile
      • Lix
    Re: Updating Lem3Edit {v1.2 - 03/02/2018}
    « Reply #21 on: February 09, 2018, 12:36:05 AM »
    Doesn't build here (Linux, Arch, 64-bit) anymore despite passsing CMake configuration. It looks like the CMake files need to check for the newer dependencies.

    #include <filesystem> is not found on Linux; the wise internet suggests #include <experimental/filesystem> and that works here. Nonetheless, I haven't researched further how standard this is, and what the standard way to write platform-independent code here would be.

    Build instructions should explain the GUI library and the CMake files should check for that. Maybe ship the GUI library with the project source, but I'm not sure if that would be good style.

    -- Simon

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.2 - 03/02/2018}
    « Reply #22 on: February 09, 2018, 01:14:40 PM »
    Thanks for trying to compile Simon. I should have asked someone earlier to give it a try. I'll look closer at these tonight when I get home.

    I don't believe the experimental filesystem include is right anymore as its no longer experimental and now an official part of the C++ spec, maybe your compiler is out of date? I followed the latest Visual Studio instructions to include the filesystem in a crods-platform manner but I'll look into it further.

    The dependencies have not changed. Only nw inclusion is TinyFileDialogs and that is designed to drop right into the project as a .c and .h file pair so as far as I understood nothing more is needed? I'll double-check.

    Offline 607

    • Posts: 468
      • View Profile
    Re: Updating Lem3Edit {v1.2 - 03/02/2018}
    « Reply #23 on: February 12, 2018, 03:31:45 PM »
    I've skimmed through these changelogs: very cool!

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #24 on: February 12, 2018, 09:07:16 PM »
    Version 1.3 now attached to the opening post!

    Lem3edit now has a main menu. Instead of automatically trying to load a level, you will be presented with a menu from which you can create, load, copy, renumber or delete a level! Due to the nature of Lemmings 3's level format, it can potentially be non-obvious what files to delete or change, so now lem3edit can handle this for you.

    On the main menu you will find some options struck-through. These are still to be implemented in a future update!

    The new additional features on the main menu aren't really meant to be used that much, the upcoming level pack feature is intended to make organising your level pack much easier.

    v1.3 changelog:
    • Implemented main menu (Note: unimplemented features are on the menu, struck-through and unselectable)
    • Closing a level now returns to the main menu instead of quitting the program.
    • Can now create new levels from scratch.
    • Can now copy or renumber levels.
    • Can now delete levels.
    • Can now save and load levels with arbitrary names for the .DAT file. The .OBS file names are still enforced per the level file specification.
    • When inputting numbers you can now use the Delete key instead of just backspace to remove digits.
    • Proper checking of L3's data files on program start and after first-time setup instead of just accepting that you pointed to some exe file and hoping it's the right one
    « Last Edit: February 12, 2018, 09:13:20 PM by kieranmillar »

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #25 on: February 12, 2018, 09:18:02 PM »
    Simon, when you have a spare moment I would appreciate it if you could try re-building this and see if it still works.

    I haven't had a chance to look at CMake yet so it might have to be manual. I did look at other projects though that didn't have CMake and they all seem to expect you to store the SDL files separately then link them, so I think include SDL with the project isn't a good idea. It's a pretty common library. Perhaps CMake is overkill for this project? Not sure.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #26 on: February 14, 2018, 07:08:50 AM »
    I figured out last night why the build instructions don't work any more. Tinyfiledialogs adds files with the extensions .c and .h while every other file has .cpp and .hpp.

    Offline Simon

    • Administrator
    • Posts: 3875
      • View Profile
      • Lix
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #27 on: February 14, 2018, 07:20:10 AM »
    Sorry for not catching your questions earlier. >_>

    Now the build aborts in with
    Spoiler (click to show/hide)

    Commit f31adab. This sort of dumb warning differences can happen across compilers. No time now but maybe later today.

    -- Simon

    Offline ccexplore

    • Posts: 5311
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #28 on: February 14, 2018, 08:01:41 AM »
    We need a spoiler for that? :o ??? :P

    Code: [Select]
    In file included from /home/simon/c/notown/lem3edit/src/Main Menu/mainmenu.cpp:25:0:
    /home/simon/c/notown/lem3edit/src/Main Menu/mainmenu.hpp:96:7: error: extra qualification ‘Mainmenu::’ on member ‘typedNumber’ [-fpermissive]
      void Mainmenu::typedNumber(const unsigned int value);
           ^~~~~~~~

    This seems legit from what I can remember about C++.  You can do this ("A"):

    Code: [Select]
    // this is typically in a header file
    class Mainmenu {
        void typedNumber(const unsigned int value); // just declare the method inside the class definition, no implementation
    };

    Or this ("B"):

    Code: [Select]
    // typically in a .cpp file, outside of the class definition
    void Mainmenu::typedNumber(const unsigned int value) { /* implementation code */ }

    But you can't mix B's syntax (specifically qualifying the method name with the class name) in A's.  At the very least it's almost never done, if not outright disallowed by the grammar of the language.  Removing the extraneous "Mainmenu::" on the line in the header file pointed out by the error should fix that error.
    « Last Edit: February 14, 2018, 08:09:20 AM by ccexplore »

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #29 on: February 14, 2018, 12:51:29 PM »
    Haha whoops what a dumb mistake. Visual Studio accepted that so I didnt even realise Id done it. Thats 'll be because I wrote the function in the cpp file first instead of initially doing the header first, so a copy paste fail. I didnt even reslise it'd be accepted as valid syntax.

    Offline Simon

    • Administrator
    • Posts: 3875
      • View Profile
      • Lix
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #30 on: February 15, 2018, 02:55:32 AM »
    We need a spoiler for that? :o ??? :P

    Very nice, I had a good laugh earlier. Yeah, maybe others want to see the build fail and discover the exciting errors for themselves. >_>

    I forgot about the code tag, which makes far more sense and also limits vertical height of long code.



    Okay, I got the CMake/make build to compile: The CMake compiles all C files in src, not only C++ files, and it will link against stdc++fs. With this, the project compiles and links on Linux with GCC. :thumbsup: I will make a pull request from this. No idea whether this library is the same for all compilers.

    When I run the game, I get a hollow editor window (you can see through it to application windows or the desktop behind it) and a nice file browser to select the L3CD.EXE.

    When I select the L3CD.EXE, program crashes:

    Code: [Select]
    import Tkinter,tkMessageBox;root=Tkinter.Tk();root.withdraw();res=tkMessageBox.showinfo(icon='info',title='Welcome to Lem3edit!',message='Excellent! You've successfully set up Lem3edit!\n\nThis was one-time installation.');
    ^
    SyntaxError: invalid syntax
    Thread 1 "lem3edit" received signal SIGSEGV, Segmentation fault.
    0x00007ffff7b09e3c in ?? () from /usr/lib/libSDL2-2.0.so.0
    (gdb) bt
    #0  0x00007ffff7b09e3c in ?? () from /usr/lib/libSDL2-2.0.so.0
    #1  0x00005555555986b1 in Mainmenu::refreshPreviousPackText() ()
    #2  0x0000555555597bf3 in Mainmenu::Mainmenu(Ini*, Editor*) ()
    #3  0x00005555555a8d8a in main ()

    When I run lem3edit again, I get "Oh no! Lem3edit could not find all of the data it will need to run. [...]", and program terminates without segfault.

    -- Simon
    « Last Edit: February 15, 2018, 03:21:25 AM by Simon »

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #31 on: February 15, 2018, 07:21:26 AM »
    Well that stinks.

    Hopefully your ini file saved the path to L3CD.EXE successfully. It's stored in the same location as the executable. Could you please open it up and check that the first entry shows a valid file path to L3CD.EXE and hopefully not some garbage.

    Offline Simon

    • Administrator
    • Posts: 3875
      • View Profile
      • Lix
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #32 on: February 15, 2018, 07:29:10 AM »
    Here's my lem3edit.ini:

    Code: [Select]
    CD="/home/simon/c/notown/l3cd-edit/L3CD.EXE"
    INSTALL=""
    DOSBOX=""
    LASTPACK=""

    The file named between the quotes exists (I can copy this string into a shell, prepend with the 'file' command, and have that tell me it's an MS-DOS executable), and it's the L3 executable.

    I haven't tried serious debugging yet. At least in Mainmenu::refreshPreviousPackText, it's not enough to wrap the usage of PreviousPackText in a non-null check. I'll continue to dabble with the debugger and random changes that seem meaningful.

    -- Simon

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #33 on: February 15, 2018, 07:42:38 AM »
    Ok that's good. However future runs falling over at finding the game data is odd and implies there is some issue with the c++ filesystem code you're linking. Similarly the first line of your error suggests the game data was all found but then there was a problem displaying the message box to tell you it was all OK. Weird.

    I'll look into this after work but if you want to help with debugging, then I think validate() in ini.cpp is the first place to start. Or it has a name similar to that at least.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v1.3 - 12/02/2018}
    « Reply #34 on: February 15, 2018, 07:46:02 AM »
    Actually my ini file doesn't show any of the double quotes on any line. I presume that's just a way it needs to be done on UNIX but maybe that's a source of the problem too, when tying to load that path in future runs.

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v2.0 - 17/02/2018}
    « Reply #35 on: February 17, 2018, 11:21:58 PM »
    This version sees the first release of the level pack tool, a feature that helps in the organisation of your levels.

    It's really important that you read the documentation on this tool in the README file. As long as you don't muck around with the files in the directory manually, it's pretty robust, but may want to make a backup of your precious levels just in case.

    v2.0 changelog:
    • New level pack tool! Better organise and re-order your levels with a special interface.
    • Level Editor now asks if you want to save before closing the level.
    • More robust handling of copying single levels.
    • Fixed bug with the ini file saving filepaths with double-quotes when compiling on Linux.
    • Many crash fixes on Linux.
    • Better CMake support and build instructions. (Thanks Simon!)
    « Last Edit: February 18, 2018, 12:06:48 AM by kieranmillar »

    Offline kieranmillar

    • Posts: 286
      • View Profile
    Re: Updating Lem3Edit {v2.1 - 05/05/2018}
    « Reply #36 on: May 05, 2018, 08:42:30 PM »
    Got a new laptop! Discovered when setting things up that the lem3edit download didn't work properly from a fresh install as it was missing a dll! Whoops! Anyway I took the opportunity to fix and outstanding bug and add a feature I was planning to add.

    I have also decided that the test level feature isn't something I want to add. I did just fine without it making all of the levels of my L3 pack. As such, there is nothing left that I really want to implement and so I am going to take this tool out of active development and move it into support. I will update any bugs and may add some features if requested. Thanks to all who supported the development of this, particularly Simon. I am sure one day I will finish these 8 remaining Shadow levels and can release a full L3 pack that nobody will ever play. Hooray!

    v2.1 changelog:
    • Bug fix: Level starting screen position no longer allows invalid vertical starting positions.
    • Bug fix: Download now contains all dlls needed for the program to function (error in previous version download)
    • Can now scroll through the pack editor lists with the scroll wheel.
    • Main menu no longer contains struck-out Options menu.
    • Added check on program start to ensure gfx folder exists to prevent crash.
    • Ini file no longer contains unused options.

    Offline 607

    • Posts: 468
      • View Profile
    Re: Updating Lem3Edit {v2.1 - 05/05/2018}
    « Reply #37 on: May 22, 2018, 01:27:30 PM »
    Very good! I'll have to admit I also likely won't ever use it... :P But I'm glad a fully functional tool exists!