Jump to content

Getting back into it...


Recommended Posts

So, recently, I've come back to the Blades of Exile project. Currently I'm attempting to get a skeleton application going to test the wxWidgets dialog interface; although it will be based a lot on the code Chokboyz wrote for porting to wxWidgets, I'm actually not using that code directly.

 

I have written a resource manager library which will give Windows users a fallback mechanism such as Mac users have always had; for example, you would be able to include a file called "fields.png" in the resource folder of your scenario and thus customize the appearance of the fields, or you would be able to include appropriately-named WAV files to replace built-in sounds with custom sounds. I'm not entirely sure how useful this will be, but it would certainly make it easier if you simply want to customize the default graphics for your scenario without changing the terrains they work for. The library is a pretty simple template library consisting of a single header; all one needs to do to support a new resource type is to write a function that loads it. Currently defined resource types are sounds (.wav because it's all wxWidgets supports), cursors (.gif, plus a .hot text file specifying the hotspot), images (.png only; .bmp support will be easy to add back though; .meg might be slightly harder, and I may choose not to support it since most scenarios have .bmp anyway), fonts (sought by typeface name rather than filename, sadly; this means it can't load MaidWord.ttf unless it's properly installed), and string lists (.str text files in which each line is one string). I might add dialogs (.dlg XML files) once I get to the point where loading a dialog from a file works; currently I can only create a blank dialog.

 

By the way, my fallback list of fonts is as follows:

Regular: Geneva,Tahoma,Liberation Sans,Futura,Arial

Bold: Silom,Arial Rounded MT Bold,Impact

Dungeon: Dungeon,MS Serif,New York,Georgia,URW Bookman L

MaidWord: MaidenWord,Apple Chancery,Monotype Corsiva,URW Chancery L,Gabriola,Segoe Print,Comic Sans MS

 

I tried to choose fonts so that everyone will definitely have at least one of the ones on the list, so if anyone sees a list from which they have no font, please let me know of a valid substitute that you do have. (I may decide to get rid of the Bold list if I discover that wxWidgets simulates bold for fonts that lack it.) I'm not entirely sure what to do about the Dungeon/MaidenWord choice, either... I think I'd probably just use MaidenWord for the dialogue, but put Dungeon as an option for anyone who wants to use it in a dialog box.

 

I also have a cFrame class (to extend for the main windows), which properly tiles the background, and a cDialog class, which for some reason doesn't. Key events seem to work in the cDialog class, in the sense that it receives them as it should; I have however encountered trouble actually forwarding the event to the appropriate button, and tab navigation is causing a mysterious crash.

 

Design suggestions are especially welcome; if it sounds like I'm doing something wrong, tell me!

 

Once the skeleton is done, I'll work on integrating it into the existing code bases.

Link to post
Share on other sites

Interesting!

 

One suggestion that I would make is that if this is going to be put into use, the code for the game on both platforms should be checked over to make sure that 1) Designers can override all resources that would be interesting, useful, and sane to override, and 2) Overridden resources are properly unloaded again when they are no longer appropriate (like when the player loads a scenario that doesn't alter the appearance of the fields, after having played one which does). I'm guessing that simple implementation will mostly accomplish these on both platforms, but it's worth being thorough.

 

Also, while I assume your plan is to use this new manager code to replace use of the system Resource Manager on Mac OS, would it be useful to you to have a portable implementation of code for reading old Macintosh resources, given that they were used in the past, and currently can't be read at all on Windows? It so happens that I've been working on just such a thing, and that as of today it seems to be fully able to read and write valid resource forks and resource maps. For this to be really useful it would still be necessary to write code to get data out of the old formats that will generally be used for resources, primarily PICT and snd, but for PICT, at least, my project was already going to require me to do such a thing, in at least a rudimentary way.

Link to post
Share on other sites

I can certainly see that as being useful, yes, though the fact that resource forks are unrepresentable on Windows could be a bit of a hurdle. I don't think it's necessary, though; an optional extra, mainly. I say this because most scenarios should come with a bmp anyway, so interpreting resource forks shouldn't be necessary... but still, as I said, it would be useful in case a scenario lacks one. Does your code manage to find the resource fork as typically represented on a FAT drive? I think it uses a RESOURCE.FRK folder or something?

 

 

At present in my resource manager, an unload/reload would be required for resource overrides to take effect or vanish, so I'd have to unload all resources when stopping or exiting a scenario; however, a way to avoid that would be advisable. I think simply having some mechanism of marking where (ie which search path) the resource was found at would do the trick, and automatically unloading any resources found at the top search path when popping it from the stack.

Link to post
Share on other sites
Quote:
Does your code manage to find the resource fork as typically represented on a FAT drive? I think it uses a RESOURCE.FRK folder or something?

The code I've written handles the format details inside the resource fork, and doesn't concern itself with where the fork data is stored. The proper storage mechanism should probably be apple double files.

Quote:
At present in my resource manager, an unload/reload would be required for resource overrides to take effect or vanish, so I'd have to unload all resources when stopping or exiting a scenario; however, a way to avoid that would be advisable. I think simply having some mechanism of marking where (ie which search path) the resource was found at would do the trick, and automatically unloading any resources found at the top search path when popping it from the stack.

A stack-based approach could be a good solution; it's roughly what Apple's original Resource Manager does.
Link to post
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...