Irrlicht stuff

Patches for Starsonata

Last edit: 2017/10/21

The following patches have been made while developing a new client for the game Star Sonata. The development was not only sponsored by Star Sonata, but some of the patches here are not my own but done by other Star Sonata Developers.

The patches are under the zlib-license, the same license as used in the Irrlicht engine.

The patches apply only to the Irrlicht svn version 808 which is seriously outdated by now. I keep this side around to remind me about the parts which I still want to add to the engine.

To create them I used:
Defaultdiff:
diff -abBdpuNPr --exclude="*.svn" irrlicht-svn-ss/trunk Irrlicht_starsonata > 808_all.patch

Sometimes I resolved troubles with:
diff -abBpNPwrU2 --exclude="*.svn" irrlicht-svn-ss/trunk Irrlicht_starsonata > 808_all.patch

To apply patches you probably have to run them through unix2dos (as Irrlicht switched to crlf on all platforms).
And then force patch to use those DOS endings with ----binary.
Assuming all.patch is inside trunk folder applying it should then be like: patch --binary -u -l -p1 <all.patch

A lot of patches here cause conflicts when installed with patch, so I usually add them by hand.

The patch all.patch contains all changes from irrlicht svn version 808 to the irrlicht version used by starsonata. The sub-patches should contain the same functionality, but are not 100% identical, as minor changes were necessary to split the patch. Also the sub-patches are not yet tested by applying them one-by-one, so no guarantee that I didn't miss some dependencies or accidently broke something. For some patches futher splitting would probably be nice. Makefile and Projectfiles are not yet regarded, but mentioned.


heapsort.patch: heapsort.h
- added heapsort with template comparison parameter to allow for custom sorting (also posted in forum some months ago)
guifactory_typefromname.patch: IGUIElementFactory.h, CDefaultGUIElementFactory.h, CGUIEnvironment.cpp, CGUIEnvironment.h
- function getTypeFromName (needed for default attributes)
modal_screen.patch: CGUIModalScreen.h
- basically all changes are to make it really modal and to allow stacking modal dialogs
- isVisible overloaded
- OnEvent changes (partly in Irrlicht)
- Focus changes
- Serialization added (in Irrlicht now)
font_factory.patch: IGUIFontFactory.h, IGUIFont.h, IGUIEnvironment.h, CGUIEnvironment.h, CGUIEnvironment.cpp, irrlicht.h
- fontfactory added
element_nameid.patch: IGUIElement.h
- Name (Irrlicht has that by now)
- TextID (for stringtable)
- Should be 2 patches, but couldn't seperate them. Name is always very useful as working with ID's is nasty as soon as you have more than one dialog.
TextID was necessary for me to use stringtables, but it's nothing Irrlicht really supports so far.
attributes.patch (partly in Irrlicht, but partly it's just a bad patch) (needs guifactory_typefromname.patch): EAttributes.h, IAttributes.h, CAttributeImpl.h, CAttributes.cpp, IGUIEnvironment.h, CGUIEnvironment.cpp, CGUIEnvironment.h
The basic idea is adding defaultvalues for attributes (which works)
A have patch for a newer Irrlicht for this, which I probably upload soon
- moved E_ATTRIBUTE_TYPEfrom IAttributes.h to EAttributes.h (is now in Irrlicht)
- moved IAttribute from CAttributes.h to IAttributes.h
- adding isEqualTo to IAttribute and CStringWArrayAttribute
- optimize CStringWArrayAttribute a little bit using const refs (is now in Irrlicht)
- adding new functions getDefaultAttributes, setDefaultAttributeUsage in IAttributes, CAttributes
- put getAttributeP into the IAttributes interface and make it public in CAttributes
- adding new function isEqualToDefaultAttribute to CAttributes
- adding DefaultAttributes and DefaultAttributeUsage to CAttributes
- add support for default attributes to the guienvironment
- bugfix for recursive readGUIElement call in guienvironment (seems fixed in Irrlicht)
skin_addicons.patch: IGUISkin.h, CGUISkin.cpp
- I needed a few more icons in the skin
- add EGDI_SORTED_ASCENDING, EGDI_SORTED_DESCENDING, EGDI_CURSOR_UP_PRESSED, EGDI_CURSOR_DOWN_PRESSED, EGDI_CURSOR_LEFT_PRESSED, EGDI_CURSOR_RIGHT_PRESSED, EGDI_DROP_DOWN_PRESSED, EGDI_TAB_ARROW_LEFT, EGDI_TAB_ARROW_LEFT_PRESSED, EGDI_TAB_ARROW_RIGHT, EGDI_TAB_ARROW_RIGHT_PRESSED
skin_addcolors.patch: IGUISkin.h, CGUISkin.cpp
- needed some more colors in the skin
- add EGDC_FLASH_PANE, EGDC_FOCUSED_EDITBOX
skin_flashing.patch (needs skin_addcolors.patch): IGUISkin.h, CGUISkin.h, CGUISkin.cpp
- draw3DButtonPane functions can now flash
scrollbar_features.patch (depends on skin_addicons.patch): IGUIScrollBar.h, CGUIScrollBar.h, CGUIScrollBar.cpp
- BackgroundOverrideColor
- resizable thumb
- cleanup some code
texture_defaultfix.patch: ITexture.h
- using another default value (just a hack, a clean solution is still discussed)
image_copyto.patch: IImage.h, CImage.h, CImage.cpp
- a new copyTo needed for padding DX textures
texture_npot_flag.patch (depends on image_copyto.patch): ITexture.h, COpenGLTexture.h, COpenGLTexture.cpp, CD3D8Texture.h, CD3D8Texture.cpp, CD3D9Texture.h, CD3D9Texture.cpp
- POT padding flag
- AutomaticMipmapUpdate(false) in constructors (is this from 1.4.1?)
driver_npot_rotation.patch (needs texture_npot_flag.patch): IVideoDriver.h, CNullDriver.h, CNullDriver.cpp, COpenGLDriver.h, CD3D8Driver.cpp, D3D9Driver.h, D3D9Driver.cpp, COpenGLDriver.cpp, CSoftwareDriver2.h, CSoftwareDriver2.cpp, CSoftwareDriver.h, CSoftwareDriver.cpp, CD3D8Driver.h
- add rotation to 2d texture drawing
- allows using padded textures for cards without NPOT support
guiimage_features.patch (needs driver_npot_rotation.patch): IGUIImage.h, CGUIImage.h, CGUIImage.cpp
- setSourceRect (is in Irrlicht 1.9)
- shrinkClippingArea (different solution in Irrlicht 1.9)
- setRotationDegrees
- bugfix in setImage (fixed now in 1.4.1)
listbox_features.patch (needs EGET_ELEMENT_DOUBLE_CLICKED and more_mouse.patch) :IGUIListBox.h, CGUIListBox.h, CGUIListBox.cpp
A have patch for a newer Irrlicht for the multiselection part, which I probably upload soon
- multiselection
- scrollstyle
- added function scrollToItem
- added function swapItems
- scrollbar visibility
- more color control
- irrlichtify variable naming (members 'icon' and 'text' now 'Icon' and 'Text') (done in Irrlicht 1.9)
combobox_features.patch (needs skin_addicons.patch, listbox_features.patch): IGUIComboBox.h, CGUIComboBox.h, CGUIComboBox.cpp
- add data pointer for items (it got an u32 instead in Irrlicht - I wish it would be at least a size_t or an irrlicht equivalent of uintptr_t)
- new icons
- bugfix(?)
- OnEvent cleanup (in Irrlicht now)
- IsEnabled in drawing
- bkcolor for listbox
- serialization (in Irrlicht now)
fileopen_multi.patch (needs listbox_features.patch): IGUIFileOpenDialog.h, CGUIFileOpenDialog.cpp, CGUIFileOpenDialog.h
A have patch for a newer Irrlicht which I probably upload soon
- can now multi-select files
- OnEvent cleanup
checkbox_icons.patch: IGUICheckbox.h, CGUICheckbox.h, CGUICheckbox.cpp
- icon functionality added
statictext_features.patch: IGUIStaticText.h, CGUIStaticText.h, CGUIStaticText.cpp, CGUIEnvironment.cpp
- BackgroundOverrideColor
- linescrolling
- getLineCount
- getCurrentFont (now in Irrlicht, called getActiveFont)
element_bringtotop.patch: IGUIElement.h
- added function bringToTop (needed by CGUIContextMenu::popupAt)
element_moveinside.patch: IGUIElement.h
- added function moveInside (needed by CGUIContextMenu::popupAt)
menu_features.patch (needs element_moveinside.patch): IGUIContextMenu.h, CGUIContextMenu.h, CGUIContextMenu.cpp, CGUIMenu.h, CGUIMenu.cpp
- close behaviour (in Irrlicht, although ECMC_DROP was left out as it didn't seem like a good idea)
- autochecking (now supported in Irrlicht)
- stringtable id's
- findItemWithCommandId (now in Irrlicht)
- popupAt
- setEventParent now public (is now in Irrlicht)
- closeAllSubMenus from CGUIMenu to CGUIContextMenu (already in Irrlicht)
- hasOpenSubMenu (already in Irrlicht)
- highlighting focus and click-behaviour now like firefox (already in Irrlicht)
- onevent cleanup (already in Irrlicht)
scenecollman_precission.patch: CSceneCollisionManager.cpp
- using higher precission in getRayFromScreenCoordinates (looks fine, but needs a test-case before it's going to get applied)
skin_tab.patch: IGUISkin.h, CGUISkin.h, CGUISkin.cpp
- tabdrawing with alignment and tabheight (not my code, I would probably have used another defaultsize and a single alignment type which could also be used in other places)
eventreceiver_focus_windowsize.patch: IEventReceiver.h
- new events EGET_ELEMENT_FOCUS_GAINED, EGET_MESSAGE_FOCUS_LOST, EGET_MESSAGE_FOCUS_GAINED, EGET_WINDOW_SIZING (sorry, new names suck)
eventreceiver_table.patch: IEventReceiver.h
- new events EGET_TABLE_CHANGED, EGET_TABLE_HEADER_CHANGED, EGET_TABLE_SELECTED_AGAIN
guirectangle.patch (should be followed by table_rectangle_merge.patch) : Extended_IGUIRectangle.h, Extended_CGUIRectangle.h, Extended_CGUIRectangle.cpp
- added guielement for drawing a rectangle. Could be added at runtime by guifactories. Not my code.
table.patch (needs eventreceiver_doubleclick.patch, eventreceiver_table.patch, heapsort.patch) Should be followed by table_rectangle_merge.patch): IGUITable.h, CGUITable.h, CGUITable.cpp
- added guielement. Wasn't needed in engine, but Irrlicht included it by now. But patched over and over, some more patches should probably find the way back into Irrlicht (many already did).
table_rectangle_merge.patch (needs table.patch, guirectangle.patch): EGUIElementTypes.h, IGUIEnvironment.h, irrlicht.h, CDefaultGUIElementFactory.cpp, CGUIEnvironment.cpp, CGUIEnvironment.h
- adding table and rectangle classes from table.patch and guirectangle.patch into Irrlicht.
- should be 2 patches, but those two are hard to split up as they have lots of adjacent code
window_features.patch (needs eventreceiver_focus_windowsize.patch, mousemove_for_hovered.patch, follow by window_merge.patch)
: EWindowFlags.h, IGUIWindows.h, CGUIWindows.h, CGUIWindows.cpp
- window parameters to enable/disable buttons in construction: close, titlebar, minimize, maximize (all that can now be done in Irrlicht, but solved in another way
- add resizing
- more control over moving, borderstyle, background drawing
mousemove_for_hovered.patch: CGUIEnvironment.cpp
- hovered windows can need mousemove events even when not focused.
- Warning: Can cause some parent-elements, including the GuiEnvironment, to get mousemove event twice. Not nice. Still useful.
messagebox_nice.patch (needs windows_features.patch, followed by messagebox_merge.patch): CGUIMessageBox.h, CGUIMessageBox.cpp
- Flags renamed to Boxflags to avoid confusion with new windowflags
- Iconsupport - like MFC Messagebox (looking really nice now!)(might be in Irrlicht... at least I improved messageboxes once)
messagebox_merge.patch (needs messagebox_nice.patch): IGUIEnvironment.h, CGUIEnvironment.cpp, CGUIEnvironment.h
- merge changes from messagebox_nice.patch into irrlicht
tabcontrol_features.patch (needs skin_addicons.patch, skin_tab.patch): IGUITabControl.h, CGUITabControl.h, CGUITabControl.cpp
- Some changes not from me, so I haven't checked all that code yet. Also I don't like the way the skin-changes needed for this were done too much. Also not happy with some names (extrawidth...). Still some nice changes.
- control textcolor, tab text alignment, padding, tabheight (in Irrlicht now)
- removeTab, clearTabs (that's in Irrlicht now, clearTabs is called clear)
editbox.patch (needs eventreceiver_editboxchange.patch): IGUIEditBox.h, CGUIEditBox.cpp, CGUIEditBox.h, IGUIEnvironment.h, CDefaultGUIElementFactory.cpp, CGUIColorSelectDialog.cpp, CGUIEnvironment.cpp, CGUIEnvironment.h, CGUISpinBox.cpp
- transparency (I hope that wasn't my change. It's breaking downward compatibility in a bad way for no good reason, that's why so many files are affected. Should be done by simply adding a function and setting a defaultvalue in the initializer list)
- setPasswordField (better solution now in 1.4.1)
- isVisible handling
- setCursorPosition
- send a text-change event (now in Irrlicht)


Already in Irrlicht:
profiler.patch: profiler.h, profiler.cpp, profile_ids.h, CIrrDeviceStub.cpp, IrrCompileConfig.h, Irrlicht.h
- Gamespecific ingame profiler added. Useful to find peaks in the code (that can't be measured with normal profilers like gprof)
- profiler.cpp needs to be added to irrlicht project files
no_make_lower.patch: CMeshCache.cpp, CSceneManager.cpp, CGUIEnvironment.cpp, ITexture.h
- remove make_lower for names which are used as filenames in some places (mainly in serialization). Solved in a more general way now in Irrlicht.
element_parentclip.patch: IGUIElement.h
- bugfixes for parent clipping (maybe in 1.4.1? Definitely changed in newer Irrlicht)
meshviewer_onevent_cleanup.patch: CGUIMeshViewer.cpp
- OnEvent cleanup (maybe in 1.4.1 or 1.5)
toolbar_onevent_cleanup.patch: CGUIToolBar.cpp
- OnEvent cleanup (maybe in 1.4.1 or 1.5)
guienv_eventfix.patch: CGUIEnvironment.cpp
- prevent some events from beeing send twice (partly fixed in 1.4.1, but probably all fine by now - otherwise needs a new test-case)
more_mouse.patch: IEventReceiver.h, CIrrDeviceLinux.cpp, CIrrDeviceWin32.cpp
- double click events (windows only)
- Shift and Control state for mouseevents
eventreceiver_editboxchange.patch: IEventReceiver.h: - new event EGET_EDITBOX_TEXT_CHANGED (is now called EGET_EDITBOX_CHANGED)
xml_lesswhitespace.patch: CGUIEnvironment.cpp : Too many newlines make editing xml-files even harder.
device_features.patch: IrrlichtDevice.h, CIrrDeviceLinux.h, CIrrDeviceLinux.cpp, CIrrDeviceStub.h, CIrrDeviceWin32.h, CIrrDeviceWin32.cpp
- clearPendingEvents (is by now in Irrlicht)
- minimize, maximize, restore (windows only)
spritebank_features.patch: IGUISpriteBank.h, CGUISpriteBank.h, CGUISpriteBank.cpp: add functions clear, addTextureAsSprite
color_doc.patch: SColor.h - bugfix documentation (backport 1.4.1)
animation_bbox.patch: CXAnimationPlayer.cpp - some fix, but that part is rewritten in 1.4.1
array_element_destruct.patch: irrArray.h - bugfix (already patched in 1.4.1)
math_equals.patch: irrMath.h - bugfix (backport 1.4.1)
particle_backport1_4_1.patch: IParticle* - backport from Irrlicht 1.4.1. Corresponding particle files need to be added to Irrlicht project files.
sprite_leak.patch: CGUIFont.cpp - bugfix (already patched in 1.4.1) (needed also change in CGUIEnvironment.cpp)
spritebank_fix.patch: CGUISpriteBank.cpp (bugfix, patched in 1.4.1)
irrlicht_spritebankinclude.patch: irrlicht.h - add include for spritbank (should be in 1.4.1)
scenecollman_round.patch: CSceneCollisionManager.cpp - fix (patched in 1.4.1)
colorselect_onevent_cleanup.patch: CGUIColorSelectDialog.cpp
- OnEvent cleanup (checking IsEnabled) (patched in trunk)
spinbox_onevent_cleanup.patch: CGUISpinBox.cpp
- OnEvent cleanup (checking IsEnabled) (patched in trunk)
Will not get into Irrlicht:
window_merge.patch (needs windows_features.patch): IGUIEnvironment.h, CDefaultGUIElementFactory.cpp, CGUIEnvironment.cpp, CGUIEnvironment.h
- merge changes from windows_features.patch into irrlicht (has been implemented in another way in Irrlicht)
eventreceiver_pushbuttonchanged.patch: IEventReceiver.h
- new event EGET_PUSHBUTTON_STATE_CHANGED
(not applied, but should no longer be needed as buttons send now always click-events in Irrlicht so users can figure it out) button_features.patch (needs eventreceiver_pushbuttonchanged.patch, more_mouse.patch): IGUIButton.h, CGUIButton.cpp, CGUIButton.h
- send EGET_PUSHBUTTON_STATE_CHANGED (no longer needed as EGET_BUTTON_CLICKED is now send more often)
- add flashing (There should be enough options now in Irrlicht to do that with sprites)
- getCurrentFont (in Irrlicht now, called getActiveFont)
- setDisabledImage (Irrlicht has an improved solution in Irrlicht 1.9)
- getClickShiftState, getClickControlState (added with minor changes in Irrlicht 1.9)
- setOverrideTextColor
(in Irrlicht 1.9, called setOverrideColor) - remove currently unused MouseOverTime and FocusTime (those are now needed by Irrlicht so can't be removed anymore)
eventreceiver_elementclosed.patch: IEventReceiver.h
- new event EGET_ELEMENT_CLOSED (was added in Irrlicht 1.4)
eventreceiver_doubleclick.patch: IEventReceiver.h
- new event EGET_ELEMENT_DOUBLE_CLICKED (Irrlicht 1.6 got double_click and now we got stuff like EMIE_LMOUSE_DOUBLE_CLICK, EMIE_LMOUSE_TRIPLE_CLICK (and same for middle and right button)