Jump to content

Modifying the GemRB demo


m7600

Recommended Posts

Hi,

I'm tinkering with the GemRB demo. I'd like to add more stuff to it. So far, I know how to add new areas, new custom animations for the player character, and a new look for the GUI. But now I'm stuck. I'm trying to add a button to guiw.chu. I'm using DLTCEP for this. The problem is that I get a segmentation fault when I try to run the demo. I've posted a sort of journal with what I've managed to accomplish here.

I'll attach a few images here that show the modifications I've made.

Can you please help me figure out why there is a seg fault? I can attach the GemRB.log if you need it.

EDIT: this is what I get when I use gdb:
 

Thread 1 "gemrb" received signal SIGSEGV, Segmentation fault.
GemRB::Font::GetPalette (this=0x0)
    at /home/travis/build/gemrb/gemrb/gemrb/core/GUI/TextSystem/Font.cpp:674
674     /home/travis/build/gemrb/gemrb/gemrb/core/GUI/TextSystem/Font.cpp: No such file or directory.


 



 

 

Edited by m7600
I removed some images so that the forum allows me to post more (since I need more kB)
Link to post

Sorry for the double post, but here is the longer version of what gdb tells me when I use "where":
 

Thread 1 "gemrb" received signal SIGSEGV, Segmentation fault.
GemRB::Font::GetPalette (this=0x0)
    at /home/travis/build/gemrb/gemrb/gemrb/core/GUI/TextSystem/Font.cpp:674
674     /home/travis/build/gemrb/gemrb/gemrb/core/GUI/TextSystem/Font.cpp: No such file or directory.
(gdb) where
#0  GemRB::Font::GetPalette (this=0x0)
    at /home/travis/build/gemrb/gemrb/gemrb/core/GUI/TextSystem/Font.cpp:674
#1  0x000000000046bfa8 in GemRB::Button::SetFont (this=<optimized out>,
    newfont=<optimized out>)
    at /home/travis/build/gemrb/gemrb/gemrb/core/GUI/Button.cpp:373
#2  GemRB::Button::Button (this=0xa359d0, frame=...)
    at /home/travis/build/gemrb/gemrb/gemrb/core/GUI/Button.cpp:56
#3  0x000000000054f4aa in GemRB::CHUImporter::GetWindow (this=0xac84d0,
    wid=<optimized out>)
    at /home/travis/build/gemrb/gemrb/gemrb/plugins/CHUImporter/CHUImporter.cpp:142
#4  0x00000000004c972b in GemRB::Interface::LoadWindow (this=0x95cba0,
    WindowID=0) at /home/travis/build/gemrb/gemrb/gemrb/core/Interface.cpp:2742
#5  0x000000000057b40b in GemRB_LoadWindow (args=<optimized out>)
    at /home/travis/build/gemrb/gemrb/gemrb/plugins/GUIScript/GUIScript.cpp:934
#6  0x00007ffff74d7780 in PyEval_EvalFrameEx ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#7  0x00007ffff74d82cb in PyEval_EvalFrameEx ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#8  0x00007ffff7614908 in PyEval_EvalCodeEx ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#9  0x00007ffff75af649 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
---Type <return> to continue, or q <return> to quit---
#10 0x00007ffff75a9913 in PyObject_Call ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#11 0x00007ffff7613e37 in PyEval_CallObjectWithKeywords ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#12 0x000000000056e094 in GemRB::GUIScript::RunFunction (this=<optimized out>,
    moduleName=0x5fba05 "MessageWindow", functionName=0x5fa32b "OnLoad",
    pArgs=0x0, report_error=true)
    at /home/travis/build/gemrb/gemrb/gemrb/plugins/GUIScript/GUIScript.cpp:16182
#13 0x000000000056e18d in GemRB::GUIScript::RunFunction (this=0x9d7680,
    moduleName=0x5fba05 "MessageWindow", functionName=0x5fa32b "OnLoad",
    report_error=true, intparam=<optimized out>)
    at /home/travis/build/gemrb/gemrb/gemrb/plugins/GUIScript/GUIScript.cpp:16200
#14 0x00000000004bf3cf in GemRB::Interface::StartGameControl (this=0x95cba0)
    at /home/travis/build/gemrb/gemrb/gemrb/core/Interface.cpp:519
#15 0x00000000004bfd09 in GemRB::Interface::HandleFlags (this=0x95cba0)
    at /home/travis/build/gemrb/gemrb/gemrb/core/Interface.cpp:661
#16 0x00000000004c18d8 in GemRB::Interface::Main (this=0x95cba0)
    at /home/travis/build/gemrb/gemrb/gemrb/core/Interface.cpp:1017
#17 0x0000000000459ec2 in main (argc=<optimized out>, argv=0x7fffffffde58)
    at /home/travis/build/gemrb/gemrb/gemrb/GemRB.cpp:101
(gdb) quit

 

Link to post

The button font doesn't exist. You either need to add a new line to demo/data/fonts.2da or change ButtonFont in demo/data/gemrb.ini to point to an existing entry.

Link to post

@lynx Thanks, that fixed it! I copied fonts.2d to demo/override and then I copy pasted some stuff from the fonts.2da of unhardcoded/bg2

This is how it looks like now:
 

Spoiler

 



2DA V1.0
NORMAL
    RESREF        NEED_PALETTE    FONT_NAME    PX_SIZE        STYLE    COLOR
0    NORMAL        1                DejaVuSans    14            0        0xffffffff
1    FLOATTXT    1                DejaVuSans    12            0        0xffffffff
#these are the same font so list the larger one first and gemrb only needs to create one font
2    INITIALS    0                Eadui        36            0        0xffffffff
3    NUMBER        0                Eadui        14            0        0xffffffff
4    INFOFONT    1                DejaVuSans    12            0        0xffffffff
4    NUMBER2        0                DejaVuSans    12            0        0xffffffff
5    NUMBER3        0                DejaVuSans    12            0        0xffffffff
6    REALMS        0                DejaVuSans    12            0        0xffffffff
7    STONEBIG    0                DejaVuSans    12            1        0xffffffff
8    STONESML    0                DejaVuSans    12            1        0xffffffff
9    TOOLFONT    1                DejaVuSans    12            0        0xf0b08000
#10    STONESM2    0                DejaVuSans    12            1        0xffffffff
11    TOOLTIP        1                DejaVuSans    12            0        0xf0b08000
12    STONSML        0                DejaVuSans    12            1        0xffffffff

 

 

 


By the way, GemRB is awesome, I'm really grateful to you for all the work you've done with it.

EDIT: Another question, if you don't mind. The button works when I set it as a control for the window that already exists in the demo. I'm trying to add a new window now, with more buttons. But the new window does not appear when I run the demo. I don't get any error messages about this either. Can you please help me by telling me what I'm doing wrong?

Edited by m7600
Question about new window
Link to post

Err, the demo ships with its own fonts.2da — edit that, I even gave you the path.

Window: do you load the window? Show me your code diff ...

Link to post
25 minutes ago, lynx said:

Err, the demo ships with its own fonts.2da — edit that, I even gave you the path.

Yes, yes, and I thank you for it! : )
That is what I did... well, almost. I copied that file and I pasted it in a new directory: demo/override
Then I opened the file and I pasted the contents of the bg2 fonts.2da, but using DejaVuSans for almost all of the fonts. It worked, but do you think that is bad practice? I made an override directory because if I mess up something, I can delete the contents and start again.
 

25 minutes ago, lynx said:

Window: do you load the window? Show me your code diff ...

Do you mean in GUIScripts/demo/MessageWindow.py? I didn't make any changes to that Python file. I only added a window to guiw.chu with DLTCEP. Do I have to edit the Python file?

Thank you once again

BTW what do you think of the style for the new area that I made? I can make more images for new areas, custom animations for the monsters, and GUI.

Edited by m7600
Spelling
Link to post

Override: for that purpose it is fine, but you'll eventually have to move it back if you want the changes to be included upstream.

Yes, we don't load windows automatically — that would be silly, there's too many.

Area bg: I prefer the current one, since it doesn't look so plastic. There's also a nice image for the interior of the cave, which you can't get into yet. The window styling is much better than what we currently have. The actor looks ok, but it probably shouldn't be pre-shaded (or not so much, now it's clear the direction doesn't match the global light).

I'd appreciate if you could share a bigger picture like the second one, so I can include it in a presentation.

Link to post

The forum software is telling me that I've reached the max total size of kB, so I had to delete the previous images to get some space. But it turns out that it was not enough for the .zip file I wanted to attach. Oh well.

I've changed the wooden background window because someone told me that the fonts were hard to read, so I made a new one with a different style. What do you think? I can use this style for the buttons, other windows, etc.

Screenshot%20from%202020-11-08%2013-08-4

 

10 hours ago, lynx said:

There's also a nice image for the interior of the cave,

Where is that? I'm looking here but I can't find it, I only see ar0100

EDIT: The icons for OptionsWindow could look like this:

 

guilsop_book.png

Edited by m7600
Link to post

Thanks for the pic! Yeah, the the contrast was a bit too low on the wooden one, since it was so dark and the main text color is black (can easily be changed though!). It also made the green colouring look less bad. I also like its simpler trimming a bit more, but it's up to you to pick a gui style

cave: do you want to use it? It's not in the repo yet indeed, just because it's not wired to anything yet.

Options: well, you first need an options window, only then does the button become useful. Since it's a book, it could be used for the spellbook, but the same thing applies.

 

Link to post

Here is an update, I gave it a simpler trimming like you suggested.

Do you want me to make a pull request on github? (If yes, what name should I give it? Right now it's called "purple.mos")

Cave: sure, I'd like to see it. I can use the console to move to the new area. I can also try to connect it to ar0100 if you want.

Screenshot%20from%202020-11-08%2016-51-0

Edited by m7600
Forgot the link
Link to post

Nice, much better now with the smaller frame. Also now there's no need to move the textarea to prevent overlap with text.

The same filename is fine, it was just a placeholder. If you can change the scrollbar images to match the style, that would be even better. The originals for the bam are in demo/data/source/.

edit: I've now pushed a font swap that will make the text a bit less horrible.

Edited by lynx
Link to post

Ok, I forked the repo and I made a pull request for demo/data/purple.mos and demo/data/source/purple.bmp

In a few hours I'll make the scrollbar with the new style.

I haven't checked out the new font but I will do it now and post a screenshot in my next post.

EDIT: @lynx I made the new scrollbar, but I don't know what number to put in the transparency index (therefore, it has a white background that I would like to remove). BTW I like the new font that you uploaded, it reads better than the other one.

Screenshot%20from%202020-11-08%2020-17-1



EDIT 2: Lynx, I added a window with DLTCEP to guiw.chu, and I uncommented every line in GUIScripts/demo/MessageWindow.py that refers to OptionsWindow. When I run GemRB, I get the following Python errors:
 

[Python/ERROR]: Traceback (most recent call last):
[Python/ERROR]:   File "./GUIScripts/demo/MessageWindow.py", line 44, in OnLoad
[Python/ERROR]:     GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 1, None)
[Python/ERROR]:   File "./GUIScripts/GUICommonWindows.py", line 167, in SetupMenuWindowControls
[Python/ERROR]:     Button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
[Python/ERROR]:   File "./GUIScripts/MetaClasses.py", line 60, in <lambda>
[Python/ERROR]:     return lambda self, *args: M(self.WinID, self.ID, *args)
[Python/ERROR]: SystemError: error return without exception set

I don't understand what the problem is. I want to add the left window (what NearInfinity calls "panel") that is on the left side of the screen in BG1/BG2, with the buttons for journal, inventory, character sheet, mage book, priest scroll, rest, etc. But I don't know how to fix the errors that I transcribed above.

Edited by m7600
scrollbar with a transparency problem
Link to post

transparency: make the white pure green (0 255 0) and it should work out of the box.

window: if you want to reuse all that code, you'll have to add all the same buttons and make sure they have the same ID. It will be easier if you add the buttons to the existing window though (pst/iwd2-style).

Link to post

Couldn't fix the transparency problem, as you can see in the image. I know I'm doing something wrong, but I don't know what it is.

Window: OK, I followed your suggestion and I added three buttons to the existing window. I think they are too big, I'll have to make them smaller, and maybe remove the blue gems (too many blue gems).

BTW did you see the pull request that I made?



Screenshot%20from%202020-11-09%2013-16-1

Link to post
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...