Post new topic    
Page «  1, 2
Red Slime
Send private message
 
 PostFri Jul 26, 2019 9:27 am
Send private message Reply with quote
Praise the developers, the creators of the great, that they keep improving. But one thing seems to have gotten worse since QuickBasic! If you wanted to edit the icon of custom.exe or game.exe, you changed the icon file, compiled everything, and voilĂ : There was a customised icon. But this time it still uses the standard icon, even if the standard icons were changed and the old custom.exe and game.exe were deleted, so that it can build new ones! Where does it get the old icons from?
Liquid Metal King Slime
Send private message
 
 PostFri Jul 26, 2019 9:53 am
Send private message Reply with quote
If I remember correctly, FreeBasic cannot handle icons at all
I also don't remember QuickBasic having any kind of icon support either.

The icons are inserted after the fact by an external program (Resource Hacker, I think?)

I'll admit it has been so long since I did it, I don't remember exactly what we did ;)
Metal King Slime
Send private message
 
 PostFri Jul 26, 2019 11:20 am
Send private message Reply with quote
Actually, FB does support setting the icon, using an .rc file, and fbgfx also will icon at the top-left of the window while running to the same icon.

When you compile game.exe yourself, game.ico is embedded. When you use Distribute Game, the icon compiled into game.exe is replaced using support/rcedit.exe.

But (unless you use "scons linkgcc=0"), game.ico is first compiled to build/gicon.obj using windres, which is then embedded.

I see that SConscript doesn't ensure that gicon.obj is rebuilt if game.ico changes. I'm fixing that now, thanks.
As a workaround, delete gicon.obj and re-run scons.
Red Slime
Send private message
 
 PostFri Jul 26, 2019 3:39 pm
Send private message Reply with quote
TMC wrote:
As a workaround, delete gicon.obj and re-run scons.

Success! And don't forget cicon.obj for the icon of custom.exe!
Red Slime
Send private message
 
 PostTue Jul 30, 2019 4:16 pm
Send private message Reply with quote
This thread should be the place for all the questions about the source code. Can one of the developers tell me something about the "buffer()" command?

Like here, in this specific part of savegame.rbas:
Code:
DIM z as integer = 3305
 FOR i as integer = 0 TO 3
  FOR j as integer = 0 TO statLast
   pv.hero(i).stat.cur.sta(j) = buffer(z): z += 1
  NEXT j


In the part before this, there are some of big numbers, which seem to make this script point at some data at an exact location. Is there a logic behind it?

When playing with buffer(), like letting game.exe print the result of buffer(0), buffer(1), buffer(2)... there are just some numbers, nearly all zero, but there are results again for buffer(34000), buffer(34001), etc. What is happening there?

Is it possible to access the heros HP stat, which is stored in the savegame (.rsav) file with this?
Liquid Metal King Slime
Send private message
 
 PostTue Jul 30, 2019 5:08 pm
Send private message Reply with quote
Buffer() is just a big array of integers. It is filled with data from the old .sav file. The part of savegame.rbas you were reading was only about the old .sav format. A separate part of that file loads the newer .rsav format
Metal King Slime
Send private message
 
 PostTue Jul 30, 2019 10:03 pm
Send private message Reply with quote
Hero stats are already loaded into SaveSlotPreview! E.g. the HP for hero slot 0 is pv.hero(0).stat.cur.hp. Slot 0 might be blank, you have to search pv.hero_id() to find the leader.
Red Slime
Send private message
 
 PostWed Jul 31, 2019 10:40 am
Send private message Reply with quote
TMC wrote:
Hero stats are already loaded into SaveSlotPreview!

I wasn't able to proceed with pv.hero stuff, as there was an error when compiling
Code:
hp1(i) = pv.hero(0).stat.cur.hp
: Array access, index expected, before '.'

But it is written like that elsewhere in the other scripts! What could have been missed?
Metal King Slime
Send private message
 
 PostWed Jul 31, 2019 11:34 am
Send private message Reply with quote
Sadly FB's error messages do not say where on the line of code the error is...

But was this inside one of the picksave_* functions? Then pv is an array (one SaveSlotPreview for each save slot), so you should write pv(i) or pv(st.pt) as appropriate instead of pv.
Red Slime
Send private message
 
 PostWed Jul 31, 2019 3:47 pm
Send private message Reply with quote
Yes! That was it! Indeed, this code came from the picksave function. Thank you!

While playing with the source, a stupid mistake came up while compiling.

Invalid assignment/conversion in
Code:
hp1(i) = pv(i).hero(0).stat.cur.hp


However adding an empty string behind that did compile, like that
Code:
hp1(i) = pv(i).hero(0).stat.cur.hp & " "


Does that make sense? Did I change the type through making a number marry a string?
Metal King Slime
Send private message
 
 PostThu Aug 01, 2019 1:51 am
Send private message Reply with quote
Yes, that makes sense. You could also have written & "" instead of & " ".The & operator converts its arguments to strings, so is pretty convenient for conversions. The more explicit way to convert to string is
Code:
STR(pv(i).hero(0).stat.cur.hp)
Display posts from previous:
Page «  1, 2