Irrlicht stuff
Patches for Starsonata
Last edit: 2008/09/09
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. They compile with VS and GCC, couldn't test on Mac (but no real problems expected for that). I will probably update those which I need in my next project to a newer Irrlicht version in the next time. I had hoped to do that for all useful patches here, but creating them took so long that I miss the time for that now. Also many patches are certainly already in Irrlicht and some stuff is even implemented in a better way in the engine. The general rule for patches is certainly always - don't install them unless you really have to.
To create them I used:
Defaultdiff:
diff -abBdpuNPr --exclude="*.svn" irrlicht-svn-ss/trunk Irrlicht_starsonata > svn_808_all.patch
Sometimes I resolved troubles with:
diff -abBpNPwrU2 --exclude="*.svn" irrlicht-svn-ss/trunk Irrlicht_starsonata > svn_808_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.
spritebank_features.patch: IGUISpriteBank.h, CGUISpriteBank.h, CGUISpriteBank.cpp
- add functions clear, addTextureAsSprite
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
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
- Focus changes
- Serialization added (status in 1.4.1?, 1.5?)
font_factory.patch: IGUIFontFactory.h, IGUIFont.h, IGUIEnvironment.h, CGUIEnvironment.h, CGUIEnvironment.cpp, irrlicht.h
- fontfactory added
element_bringtotop.patch: IGUIElement.h
- added function bringToTop (needed by CGUIContextMenu::popupAt)
element_moveinside.patch: IGUIElement.h
- added function moveInside (needed by CGUIContextMenu::popupAt)
element_nameid.patch: IGUIElement.h
- Name
- 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 (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
- moved IAttribute from CAttributes.h to IAttributes.h
- adding isEqualTo to IAttribute and CStringWArrayAttribute
- optimize CStringWArrayAttribute a little bit using const refs
- 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
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
- shrinkClippingArea
- 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')
combobox_features.patch (needs skin_addicons.patch, listbox_features.patch): IGUIComboBox.h, CGUIComboBox.h, CGUIComboBox.cpp
- add data pointer for items
- new icons
- bugfix(?)
- OnEvent cleanup
- IsEnabled in drawing
- bkcolor for listbox
- serialization
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
more_mouse.patch: IEventReceiver.h, CIrrDeviceLinux.cpp, CIrrDeviceWin32.cpp
- double click events (windows only)
- Shift and Control state for mouseevents
device_features.patch: IrrlichtDevice.h, CIrrDeviceLinux.h, CIrrDeviceLinux.cpp, CIrrDeviceStub.h, CIrrDeviceWin32.h, CIrrDeviceWin32.cpp
- clearPendingEvents
- minimize, maximize, restore (windows only)
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
menu_features.patch (needs element_moveinside.patch): IGUIContextMenu.h, CGUIContextMenu.h, CGUIContextMenu.cpp, CGUIMenu.h, CGUIMenu.cpp
- close behaviour,
- autochecking
- stringtable id's
- findItemWithCommandId
- popupAt
- setEventParent now public
- 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
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_doubleclick.patch: IEventReceiver.h
- new event EGET_ELEMENT_DOUBLE_CLICKED
eventreceiver_editboxchange.patch: IEventReceiver.h
- new event EGET_EDITBOX_TEXT_CHANGED
eventreceiver_elementclosed.patch: IEventReceiver.h
- new event EGET_ELEMENT_CLOSED
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_pushbuttonchanged.patch: IEventReceiver.h
- new event EGET_PUSHBUTTON_STATE_CHANGED
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
- add resizing
- more control over moving, borderstyle, background drawing
window_merge.patch (needs windows_features.patch): IGUIEnvironment.h, CDefaultGUIElementFactory.cpp, CGUIEnvironment.cpp, CGUIEnvironment.h
- merge changes from windows_features.patch into irrlicht
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.
button_features.patch (needs eventreceiver_pushbuttonchanged.patch, more_mouse.patch): IGUIButton.h, CGUIButton.cpp, CGUIButton.h
- send EGET_PUSHBUTTON_STATE_CHANGED
- add flashing
- getCurrentFont
- setDisabledImage
- getClickShiftState, getClickControlState
- setOverrideTextColor
- remove currently unused MouseOverTime and FocusTime
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!)
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, tabheight, tab text alignment, padding
- removeTab, clearTabs
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
guienv_eventfix.patch: CGUIEnvironment.cpp
- prevent some events from beeing send twice (partly fixed in 1.4.1, rest mentioned in bugtracker)
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)
- That's by now been discussed ad absurdum with the Irrlicht team. This solution is not perfect and leads to minor problems for programers which fail working with filenames. But as I still don't know how to work without that patch installed and think the bug is rather dangerous (it messed my files and I had to fix them by hand) and as I have no better solution yet I just include it here.
xml_lesswhitespace.patch: CGUIEnvironment.cpp
- too many newlines make editing xml-files even harder.
Maybe already in Irrlicht:
toolbar_onevent_cleanup.patch: CGUIToolBar.cpp
- OnEvent cleanup (maybe in 1.4.1 or 1.5)
meshviewer_onevent_cleanup.patch: CGUIMeshViewer.cpp
- OnEvent cleanup (maybe in 1.4.1 or 1.5)
element_parentclip.patch: IGUIElement.h
- bugfixes for parent clipping (status in 1.4.1? could be fixed already)
Already in Irrlicht:
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)