Jump to content

New Windows 3D Editor


Ishad Nha

Recommended Posts

Edit, 18 June 2009

There are two versions that are more recent, first is the one amended by Niemand and I:

http://www.freewebs.com/ishadnha/BoA3DEditor.zip

Then there is my own private experimental version:

http://www.freewebs.com/ishadnha/VariantBoA3DEditor.zip

For what the latter actually does, see the New Windows 3D Editor topic.

Edit:

 

 

For some bizarre reason I have been actually able to compile the Windows 3D Editor source code. This was done with the Bloodshed Dev-C++ compiler found at:

http://www.bloodshed.net/

and the source code from the BoA:

http://sourceforge.net/project/showfiles.php?group_id=129871

 

 

How the Editor was Compiled

Using the dev file supplied with the source code.

 

Making the alteration found at http://www.allegro.cc/forums/thread/598060

"All you have to do, is go to Tools->Compiler Options->Directories->Libraries -- And delete all entries (don't bother adding anything back, it won't make a difference)."

Edit:

You might need to include this at the top of Bl A Fileio.cpp

#include <ctype.h>

 

Initial success: Clear All Items now works, line 124 of Blscened.rc was invoking a funny case 13 in the Town menu not the desired case 14. (Case 13 is found in Bl A Editor.cpp, line 928.)

 

Needs a whole lot more (Shift + letter) hot keys. If you have the Caps Lock on, you can select functions with the keyboard while using the mouse with your right hand. Customized hot – keys can be created, see EdFcns.cpp line 1985, not too sure what the hintbook mode is...

Current hot key assignments:

Place Bounding Walls Shift + A

Paint Rectangle Shift + R

Select/Edit Object Shift + S

Swap Walls 1-2 Shift + W

Change Drawing Mode Spacebar

Delete An Object Delete

Insert Floor/Terrain Numeric Keypad 5

 

The Editor Itself: Improvements

All these problems are found in both versions of the Windows Editor:

 

While scen_desc[256] has provision for 256 characters, the Enter scenario display in the actual game can only handle around 240 at most.

Could support the functions fl_ed_icon_adjust and te_ed_icon_adjust. I suspect they are meant to show the icon adjustment in the 2-D display.

Creature default script is not implemented in the editor. (It is not automatically assigned to creatures having that script.)

When you try to place special encounter nodes, it suggests states like 0,1,2 which are already defined elsewhere.

Floor terrains will be “signs” if they have the same number as a terrain type that is a sign. If, for example, terrain type 194 is a sign then floor type 194 will be a sign too. As the supply of custom graphics increases, so will the number of scenarios with 200+ floor types. Changing which terrain types are signs will cause a corresponding change in the floor types.

Terrain shortcut keys can only be given to individual types of terrain, not to whole sequences as is the case for floors.

There is a funny “OK” in the Set Variable Town Entry page. It occurs on the fourth line. This is a problem in the 3D Editor only.

Have terrain scripts occur in a pop-up screen that shows all ten cells at once.

More space at bottom of editor.

 

As improvements are made they will be incorporated into the Editor found here:

http://www.freewebs.com/ishadnha/BoA3DEditor.zip

(To make this link actually work you will need to make the address bar active, then hit Enter.)

 

Link to comment
Share on other sites

  • Replies 495
  • Created
  • Last Reply

Top Posters In This Topic

Hintbook mode is a feature Jeff created to easily make the screenshots for his hintbooks—it turns off drawing of the grid lines when in zoomed out 2D mode.

 

Descriptions of implementation of some of these changes already in the existing Mac version (spoiler to prevent screen stretching doom):

Click to reveal..

Quote:
Could support the functions fl_ed_icon_adjust and te_ed_icon_adjust. I suspect they are meant to show the icon adjustment in the 2-D display.

This is done in a slightly complicated way to deal with the fact that since the editor support had been broken, most designers had not been aware of/had not used this feature. The gist of it is that if a 2D (ed) adjust is specified, we display that, and if no ed adjust is specified but a regular adjust is given, we use that, unless the user has chosen to set the strict adjust usage preference, formally known as "Kelandon's Strict 2D Icon Adjusts". ( tongue )

The code for this is scattered in a number of different places; I'll hunt it down later.

Quote:
Creature default script is not implemented in the editor. (It is not automatically assigned to creatures having that script.)

This is done, in the sense that the default script name is displayed unless the designer specifically chooses another script. In Graphics.cpp:

Code:
3710,3713c3479,3486<			if (strlen(town.creatures[selected_item_number % 1000].char_script) <= 0)<				sprintf((char *) draw_str,"  Script: Default");<				else sprintf((char *) draw_str,"  Script: %s",<			  	 town.creatures[selected_item_number % 1000].char_script); --->			if (strlen(town.creatures[selected_item_number % 1000].char_script) <= 0){>				if(strlen(scen_data.scen_creatures[town.creatures[selected_item_number % 1000].number].default_script) <=0)>					sprintf((char *) draw_str,"  Script: basicnpc");>				else>					sprintf((char *) draw_str,"  Script: %s", scen_data.scen_creatures[town.creatures[selected_item_number % 1000].number].default_script);>			}>			else >				sprintf((char *) draw_str,"  Script: %s",town.creatures[selected_item_number % 1000].char_script); 

 

Quote:
When you try to place special encounter nodes, it suggests states like 0,1,2 which are already defined elsewhere.

This is dealt with to a limited extent by starting counting from state 10, as it is the first actually usable custom state. This isn't perfect, but is a simple change which makes a drastic improvement. If you think of a better algorithm for choosing the initial guess, we can use that instead.

Code:
1699c1524<							town.spec_id[i] = (unsigned char)edit_special_num(/* 0,*/ i);--->							town.spec_id[i] = (unsigned char)edit_special_num(i+10);1717c1537<							current_terrain.spec_id[i] = edit_special_num(/* 0,*/ i);--->							current_terrain.spec_id[i] = edit_special_num(i+10);

Quote:
Floor terrains will be “signs” if they have the same number as a terrain type that is a sign. If, for example, terrain type 194 is a sign then floor type 194 will be a sign too. As the supply of custom graphics increases, so will the number of scenarios with 200+ floor types. Changing which terrain types are signs will cause a corresponding change in the floor types.

This bug is caused by the fact that drawing terrains and floors is handled by a single function, which fails to make the necessary drawing mode check before doing the sign terrain specific operations. A fix for this will be included in my undo system implementation patch.

(I'm describing all changes in standard diff format, which should make short changes like these easy to understand and longer ones easy to apply automatically using the patch utility.)

 

Quote:
Have terrain scripts occur in a pop-up screen that shows all ten cells at once.

More space at bottom of editor.

These things may be difficult to implement; I'm at least fairly certain that the will be in the Mac version. The sizes and locations of controls are not very conveniently handled, in part because (again, at least on the Mac side) nearly everything is drawn with totally custom code.

 

It will take me a while to figure out what all the changes I made to Mac version were before I had the sense to start using SVN to keep track of stuff (I would urge you to do likewise), but I can list a few:

-Changing the size of the 3D mode view area to match that used in the game. This was difficult but very worthwhile.

-Adding flood-fill, copy, and paste operations for terrains and floors. The backing code for this is simple and portable, but see next point:

-Rearranging function buttons at lower right of editor window to add more space and include new tools. This was rather difficult and in part involved breaking up the drawing code for the right side of the window to separate the tool buttons from the palettes above them, as I recall.

Link to comment
Share on other sites

Currently it is only the Clear All Items tool and the Build number.

 

To be realistic, it will take some time for me to find my way around the code, and I don't know too much about programming anyway.

 

I will need to read and digest Niemand's notes above first.

 

Edit:

I don't know whether I made myself clear about the default script, I meant a custom default script assigned in the scenario data script, like:

cr_default_script = "greaternpc";

Currently custom creature script is not assigned in the scenario when a monster is manually placed, unlike terrain scripts being assigned by the placing of relevant terrain types.

Link to comment
Share on other sites

I'm not sure quite what you mean by your claim in your edit. When you place a creature, it always has it's default script, as defined by the data script. The editor originally just didn't show anything besides saying 'Default'. You can see this by checking around line 3710 of Graphics.cpp, which is exactly the removed code that I gave in the diff above. The new code I added shows the name of the default script explicitly.

Link to comment
Share on other sites

When I place a creature with a custom script, the script does not show up in the editor anywhere. I am of course using the current Windows 3D editor, not yours, which won't run on my (Windows) computer.

 

As for programming, my knowledge is fairly basic, I am not qualified in any way shape or form. I can handle anything in Avernumscript.

 

Edit:

Managed to put in some hot keys, especially one that immediately returns you to basic drawing terrain mode. This enables you to switch at will between edit script/monster/item and edit terrain. In my latest upload I also included the original 3D Editor Readme, with a couple of notes. I also added 6 pixels to the dimension of the main screen, thus removing that annoying cut-off at the bottom.

Link to comment
Share on other sites

I could cry. I've spent about 8 hours hand editing patch files to add the undo system to the Windows Editor, and patch is too colossally stupid to apply the patches correctly; it even fails on patches that come straight from diff without any modification. I'm having to start over using the much more annoying unified diff format, which seems to be less susceptible to such failure.

 

In much happier news, I think that I have figured out how to use Dreamhost's Subversion repository setup, so I think I could now host these projects on my website with proper revision control. I plan to migrate my personal Mac 3D Editor repository there, and I can create a repository for the Windows project as well, where it can be worked on until with much greater ease. I think that this would be a very good way for us to collaborate and keep track of our changes, and that we should start using it as soon as possible. I'm guessing (correct me if I'm wrong) that you probably haven't used such software before, Ishad Nha, but I assure you that it's quite easy using good GUI software, TortoiseSVN being what all my Windows using acquaintances swear by. What do you think?

Link to comment
Share on other sites

Great! I'll get started setting things up. When things are ready I'll send you an email with more details, like your username and password. (One rather peculiar feature of Dreamhost's setup is that I have to know every user's plaintext password. I'll put something in for you and change it later if you want.)

 

I would comment that the most interesting bits of the source are probably Bl A Fileio.cpp, Graphics.cpp, and EdFcns.cpp, as these are where most of the work happens. You can look in dlogtool.cpp and keydlgs.cpp if you want, but I warn you that it may cost you your sanity.

Link to comment
Share on other sites

Editor was made to open at a town in overhead mode. Also it can now re-sized. Then I was able to get rid of the stray “OK” in the Variable Town Entry dialog.

 

If the current dialog mode is wacko, why did Jeff choose it? I get the impression that many of his programming decisions are idiosyncratic. Is there any apparent reason why he chose this, anything he thought that the conventional methods did not have? Can it be bypassed for new dialogs? If not, we will have to learn to put up with it.

 

Using Word and Excel I was able to draw up a list of the buttons and their meanings. So I will be able to follow it easier.

 

Link to comment
Share on other sites

The dialog system is the one part of the code for which Jeff abstracted out the platform specific code, which was a noble goal. The trouble is that much of it was done in a rather "quick and dirty" manner which makes it painful to to work with. I think that the Windows side of it will be less burdened by this, since the resources (dialogs, buttons, text fields) seem to be read from a plain text format, while the format used by the Mac side has been deprecated for years now, and at this point it's hard to find software to work with it at all.

 

I'm not sure I understand the point of messing with the editor's starting mode. What if the designer wanted to open up the scenario and get back to working on the outdoors? Also, most designers will want to use 3D mode most of the time, I'm guessing, so why start them in one of the 2D modes?

 

What exactly do you mean by resized? The editor window? The main editing view inside the window? That last is something everyone, myself included, has wanted for years, but which I found very difficult to do; it was a lot of work just to correct the size of the view in 3D mode to match the view size used by the actual game.

Link to comment
Share on other sites

What we really need is an ini file that can handle everyone's preferences for starting mode and accelerator keys. (Especially the latter.) If starting mode becomes an issue, it can always be changed.

 

Resized means the entire editor window can be reduced in size so I can look at the menus and the source code at the same time. As for increasing the 9x9 view that is now possible for PCs, it won't work on laptops though. You might want two versions here, one for laptops and one for PCs with large screens.

 

As for redo and undo, if you continue to hit big problems you could just have the game save the entire scenario/outdoor/record. The sizes are fairly small:

7,480

12,892

21,466

27,866

36,826

Thus 100 versions of the largest town record would come to 3.5MB.

Link to comment
Share on other sites

I'm not sure what you're numbers there are (a large town record is 20480 bytes), but dear god, no, that's not how to implement undo. Trust me: the version I wrote for the Mac editor has been in use for just under two years; I think it works. tongue The issue was with trying to get the code in a form to pass to you to apply to the Windows code base, and this is now a non issue, because I can just edit it right into the code files and commit them to the repository.

 

With regard to how the undo system I wrote works: The program keeps to stacks, one for undo steps, one for redo steps. Each step describes one or more terrain, floor, or height drawing operations. When the user wants to undo an operation, the record is taken off of the undo stack, each sub-operation it describes is undone, the record is inverted, and added to the redo stack. One way that we might want to extend this would be to include other operations than drawing, such as placing and removing objects, and so on, but this would add a lot of complexity and honestly, as a user myself, I've never really wanted such a capability particularly.

 

Configurable key bindings would be nice, but I think we should also avoid getting ahead of ourselves trying to add new features before we port features that are already coded and tested for the other platform.

 

By resizing the view, what I mean is that in 3D mode the windows editor still uses the same view size as it does in 2D mode. A while back I corrected the Mac version to make the 3D view the same size as the one actually used by the game. This helps a lot when designing cutscenes and the like as it make it easy to know how much the player is going to be able to see. However, the coding, at least on the Mac, was somewhat painful because all of the sizes of the objects drawn onscreen were hard coded. As far as I got was hard coding a different set of values which are used in 3D mode. Making the editor window and the main view freely resizable would be nice, but difficult. I do agree that we should keep the default screen size about as it is, just in case of small screens. (Since when are laptop screens necessarily small, though? My laptop has a wider screen than my desktop. tongue My point is really that it's best not to make assumptions.)

 

With regard to the repository: Are things working for you, and if so, will you be committing some of your changes soon? It's usually better to commit each change when it's ready rather than building up a huge set of alterations and committing them all at once.

Link to comment
Share on other sites

I count the total size of a town, the town record of 16,346 bytes and the variable part (Big_tr_type = 20,480 or Ave_tr_type = 11,520 or Tiny_tr_type = 5,120 as the case may be.)

 

Latest change, I managed to alter the editor to clear the left text part of the screen bottom by choosing mode 0, pencil mode.

 

Edit:

Now I am looking at special cursors for placing barrels &&. There is a freeware program called RealWorld Cursor Editor that enables the creation of any sort of cursor, monochrome or color. It can also work from BoA graphics.

Link to comment
Share on other sites

What do you mean by clear the left part of the screen? The text below the main view? That does seem useful.

 

I would argue that it would be best not to have a special cursor for placing barrels, or any other single object type, unless you can set a cursor for each placeable object. (Each, potentially custom, creature, item, and so on.) Otherwise it would be inconsistent, and possibly confusing to users. Anyway, there's probably a better way to do it than creating a dedicated cursor from each image.

Link to comment
Share on other sites

Paint the object underneath the cursor? Even if you're able to create a custom cursor on the fly, most people wouldn't appreciate it if the custom cursor remained after the user mouses out of the editor window. Nifty idea, though it's probably a good idea to give the user the option to turn the behaviour off.

Link to comment
Share on other sites

Yes, the left part of the screen, the part that gives the information about creatures, items and terrain scripts. (In your Mac Editor code it is void place_left_text() found at line 3447 of graphics.cpp.) It is done by setting "selected_item_number = -1;" in my equivalent of your case 'P', pencil drawing.

 

It would be quite easy to have a unique cursor for everything, if you can do one you can do them all. In point of fact this program or its icon equivalent may make it easy to generate good editor icons for any type terrain.

Link to comment
Share on other sites

No, my argument is that that external program is useless to us, as it would only make it possible to create cursors/icons from specific graphics ahead of time. How could it be used to create correct icons or cursors when a user works with custom graphics? The only way to supply this is if the editor itself generates the icons/cursors from whatever graphics it has loaded.

 

I'll see about adding the deselection feature to the Mac Editor. It seems to me that it will require more work than you describe, though, as there are several ways to enter the simple drawing mode: clicking the button for it, pressing the hot-key, and clicking in the floor or terrain palette. Also, the correction should also be applied to the other drawing tools, like the paintbrushes and so on.

Link to comment
Share on other sites

I have tried this, the barrel cursor was turned into an editor icon, it looked quite promising. As cur files and bitmaps are wholly incompatible you would need to change the cur file to a bmp, that can be done by a print screen being copied into Paint. A scenario author could do this him/herself, it requires little know-how.

 

Now, how do you implement a new cursor? I have used the barrel cursor to replace the hand but I can't add an eleventh cursor. I have altered Blscened.rc and Resource.h but still the cursor does not actually show.

Link to comment
Share on other sites

Quote:
can be done by a print screen being copied into Paint. A scenario author could do this him/herself, it requires little know-how.


This is utterly user unfriendly. Imaging if your spellchecker came with an empty dictionary because the creators argued: "There's no need, users can easily use this utility program to add words to their own dictionaries!" It's just not the right way to approach the problem.

As for how to add cursors at all, I have no idea how to do it in a Windows program; I have no experience with windows libraries. You'll have to look closely at how the program handles the cursors to figure out what it takes to add another.
Link to comment
Share on other sites

There is a related icon program which may be more user-friendly here.

 

Now as for cursors, the file is keydlgs.cpp, I was able to create a barrel cursor. I also altered the Blscened.rc and Resources.h files. It initially didn't work because I used the same cur file for two different cursors. (I had replaced #7 with the barrel to check the graphics.)

Link to comment
Share on other sites

May I step in here, for a brief moment?

 

As much as I, a Windows user, am grateful to you for taking the time to do this (I certainly couldn't), I think there are more important things than custom cursors to be worrying over.

 

Namely, I'd like to see an undo function, a fill terrain function, having placed special encounters start at "10" instead of "0" - the boring things, really, but the things that will make scenario-drawing that much more easier/pleasant.

 

Cursors for placing barrels would be neat, but the current system is fine. You click the "place barrel" button, and you know that the next time you click, you're going to place a barrel. A new icon isn't necessary. What WOULD be nice, though, is the chance to place many barrels, without having to click the "place barrel" button after every one.

 

tl, dr? Less of the nice, but ultimately shallow/less-meaningful changes, more of the simple-yet-awesome changes (like the fix for Clear All Items which you already implemented).

Link to comment
Share on other sites

Quote:
Namely, I'd like to see an undo function, a fill terrain function, having placed special encounters start at "10" instead of "0"


Fear not, these features are on the way. I am in the process of adding the underlying functions to the code. Ishad Nha will then have to get the user interface for them fully implemented.

With regard to placing many barrels: Good Point. The Mac Editor has a 'sticky' mode for placing items and creatures, which we need to duplicate on the Windows side, and while we're at it we can extend it to apply to similar placing functions like barrels, etc.
Link to comment
Share on other sites

I only work here and barrel cursors is all I am good for, unlike Niemand I an not a serious programmer. If you want serious reform, rather than purely cosmetic reform at a snail's pace, he is the guy you need to speak to. To me the ability to change the cursors is a minor miracle because until recently I could not change anything.

 

Now we can compile we can increase the number of shortcut keys for terrain too.

 

As for a repeat key, I have been thinking of that too, it is a good idea.

 

Edit:

I don't know whether The Master was referring to placement of barrels by a Rectangle or by a repeat key. I have just implemented a repeat key for all fields and stains, as well as waypoints and spawn points. Each field has its own hot key too, so you can switch fields quite easily.

Link to comment
Share on other sites

Originally Posted By: Ishad Nha

I don't know whether The Master was referring to placement of barrels by a Rectangle or by a repeat key. I have just implemented a repeat key for all fields and stains, as well as waypoints and spawn points. Each field has its own hot key too, so you can switch fields quite easily.


Heh, wrong Time Lord.

I didn't particularly mean anything. A rectangle might be useful, but probably less so than a repeat key. What I originally meant was by selecting the "place barrel" button, the editor would continue to paint barrels when I clicked on terrain, rather than reverting back to the arrow/paintbrush after every one.
Link to comment
Share on other sites

I have uploaded the latest version of my Editor: if you choose the place barrel command once, every time you press U the command is activated. (This assumes that the Caps Lock key is on.) U is the hotkey for the repeat command and works for fields and stains.

 

I may be able to track down the problem with placed encounters starting at 0. Rest of the stuff will need Niemand to sort out.

Link to comment
Share on other sites

Luckily, one doesn't need much beyond a simple knowledge of C, and knowledge of Avernumscript alone is likely enough to be able to read a good portion of the code and see what's happening. I think that's all Ishad Nha was saying.

 

I'll start looking into implementing the sticky mode. It's just a matter of using variables that are already there; hardly rocket science.

Link to comment
Share on other sites

Niemand promised an Undo feature in his post: "154753 - Feb 12, 2009 10:11 PM". The feature is now functional. Now the Undo and Redo seem to be working. But they seem to be working all in one go, not just one change at a time. Maybe it keeps Undoing until there is nothing left to Undo.

 

The purge Undo seems not to work in practice. It seemed to work in one town (size: Small) but that was only because the relevant area had x,y coordinates greater than 32. (The area where I had performed terrain Un/redo s in a Medium size town.)

You might want separate Undo/Redo stacks for town and outdoors, otherwise an undo/redo sequence relevant to a town could be called outdoors.

Link to comment
Share on other sites

Uh oh, that sounds like there might be a problem. A couple of questions:

-What kind of change does it undo all at once? It is supposed to group together all changes that happen while the mouse is held down, like most paint programs. So if your hand slips and you draw a huge swath of something, it's a single operation and undone by a single keystroke. In contrast if you're carefully changing one square at a time with single clicks, each one should be separate, and undone/redone as such.

-What functions do your menu items/key-bindings call? It should just be performUndo() and performRedo().

 

EDIT: With regard to separating town/outdoor undo: This is not necessary because only one can be edited at a time, thus when the user switches from one to the other all undo steps are simply thrown away. This is what the PurgeXYZ() calls do. If they aren't being purged when they should be, I may have missed putting some in. (They need to guard every time something happens like another zone being loaded.) Tell me exactly what you did and I'll check that code path.

Link to comment
Share on other sites

Terrain or floor is being done one square at a time, then Undo wipes out everything in one go. Purge undo is not happening even when a new scenario is being loaded.

 

If you check the Blscened.rc and Edfcns.cpp you will see that it is just the performundo() and performRedo(). I don't know whether a Mac compiler can load a Windows rc file, if not use a text editor like Crimson Editor.

 

Edit:

The undo/redo seems to be happening in groups of terrain/floors. It seems like each group is defined by the use of Undo/Redo, actions occurring between any two uses of undo/redo form a group.

 

Edit:

As for the problem with editor suggesting placed special encounter state numbers like 1 or 2, that has been fixed. One problem remains, the program can't read the town/outdoor zone script, so it may suggest a state number that is not placed but is already used in the script, a state you don't want to place anywhere.

Link to comment
Share on other sites

They're supposed to be bound to those keys already. Is this the latest revision that you posted, Ishad Nha?

 

Obviously what we need is to add an automated way to include the build number in the application's about box, like the Mac version now does. I'll take a look at this; since Dev-C++ just runs a Makefile, this may be as easy as adding a target which invokes sed and svnversion. Alternately, I may be able to adapt the perl script that the the Xcode project uses. Suffice it to say that I'll look into this.

 

Other things I would ask testers to check: Does the Add Height Rectangle command work? (Shift plus click Change Height Rectangle tool) Does the sticky mode for clearing spaces, placing webs, barriers, etc. work as expected? (Again shift plus click the tool buttons.) Is the bug where floors could be treated as signs if they had the same number as sign terrains?

 

Further work for us developers:

  • Fix crashing in BoE import feature
  • Replace delete last town feature with delete current town
  • Add change town size command
  • Rearrange tool buttons
  • Add eyedropper, floodfill, terrain copy, and terrain paste tools
  • Add list views when selecting town/outdoor section to load and when selecting town/outdoor section to import
  • Add creature and item palettes

 

EDIT: With regard to shortcuts for Undo and Redo: I was never against this; I just didn't notice that there are two places that this seems to need to be specified in the resource file, and so I only included the first, which apparently only adds a label without actually binding the shortcut. Sorry about that.

Link to comment
Share on other sites

Yes, I think it is a good idea but Niemand didn't. I think editor diversity is a good thing.

I have no idea what a sticky key is or what it does, but it seems not to be working.

Edit:

It seems that Niemand did think it was a good idea but the keys got lost in the changes we both made to the same files.

 

As for porting, I just successfully used the 3D editor to port an unfinished Exile 3 template to BoA. But all other ports have been unsuccessful, problem may be one of two things:

3D Editor can't handle a lot of customized terrain, items and monsters

there may be errors in the affected files, like item strength greater than 10

 

Edit:

I successfully ported Bladbase.exs to the BoA world. Initially it crashed, but then I deleted all the specials in town 0 along with the dialog, personality names and the area rectangle names. I will have to create a scenario with a lot of custom items and see what happens if there is no town dialog. It may not be a lot of errors, it may only one or two. Hence it might be easy to pinpoint the exact cause of the crash. The unfinished Exile 1 and Exile 3 templates have no custom terrain, items and monsters. They also have no placed specials or dialog.

Link to comment
Share on other sites

Well we have all gone quiet, hopefully everyone is off enjoying Niemand's new Window editor.

 

Porting BoE Scenarios:

Does it work with the Mac 3D Editor, does it work with other people's Windows 3D Editors? It works all the time with Windows 2D editor, but it rarely ever works with any version of the 3D editor.

 

Function for porting is found in Bl A Fileio.cpp, actually there are several functions. I opened this file in Crimson Editor, along with its 2D equivalent Bl A Fileio.c. Then I flipped between the two files, like using a blink comparator. One thing that stood out was the word "int", it occurs all the time in the 3D files in places where it is not found in the 2D files. On my computer int is 4 bytes and short int is 2 bytes, that may be one cause of a crash.

 

C v C++ incompatibility may occur at key points. The 2D editor is written in C whereas the 3D editor in written in C++. Most of the 3D code is lifted straight from the 2D file.

Link to comment
Share on other sites

By the way, there's no reason to put my name specifically on this; many people have contributed, of whom I'm hardly the most significant.

 

I'll give the porting function on the mac version a try; as far as I recall it worked the last time I tested it, but that was a while ago.

 

If you need to compare two similar source code files and find all of the differences, I recommend using a graphical diff/merging tool. I've never used one on Windows, but a cursory search found this page which lists and describes several such programs.

 

With regard to C and C++ usage:

Quote:
The 2D editor is written in C whereas the 3D editor in written in C++

Not really true, we compile all the source code as C++ these days, but nearly all of it is still written in the intersection of the two languages.

 

Quote:
C v C++ incompatibility may occur at key points

Such a thing isn't really an issue in this project; none of the code uses advanced C++ features and also none uses any of the newer C features which don't exist in C++, thus our ability to simply compile the entire thing as C++.

Link to comment
Share on other sites

Make that the Notus/Isaac/Niemand 3D Editor. Both Notus and Isaac seem to have vanished into thin air.

 

No clear C/C++ incompatibilities, that is what makes it odd, usually there is a crash leaving a 0KB bas file. There is no apparent reason for such a total crash. Odder still, it does sometimes port, when the scenario has no custom items, text and special items. Then again it may crash leaving a partial scenario script of 4 or 8 KB.

 

I can't get the debugger to work reliably.

Link to comment
Share on other sites

Valley of Dying Things, a 4,096 byte bas file. Wormwood, a 8,192 byte scenario script. This gets better all the time. The crash is happening fairly soon in the proceedings, that is clear.

 

I will have to check the translations of the BoE calls versus the BoE editor help file versus the BoE editor node information screens, some of those translations look a bit dodgy.

 

One thing I noticed is the lack of suitable functions, you have:

void add_short_string_to_file(FILE *file_id,char *str1,short num,char *str2);

void add_big_string_to_file(FILE *file_id,char *str1,short num1,char *str2,short num2,char *str3,short num3,char *str4);

But there is no function for only two numbers.

Link to comment
Share on other sites

If you look at the definition of add_big_string_to_file() you'll see that it actually handles, in a rather clumsy way, the cases for interleaving a set of strings with 0, 1, 2, or 3 numbers.

 

P.S. I just found something that looks interesting: In the Mac version I altered the add_string_to_file() function:

Code:
void add_string_to_file(short file_id,char *str){	if (strlen(str) == 0)		return;	//this block of code was used to convert ~ characters to " characters	//for some reason it was failing unpredictably, and I can't see anything	//wrong with it. However, use of the \" escape code in strings makes it 	//totally unecessary.	/*for (short i = 0; i < (short)strlen(str); i++){		if (str[i] == '~'){			str[i] = '"';		}	}*/	long len = (long) (strlen((char *)str));	FSWrite(file_id, &len, (char *) str);}

 

You might try making this change, and then also replacing every '~' character that's in a string to be written to the file to the escape sequence '\"'.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...