Post new topic    
Page «  1, 2
Slime Knight
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.
Slime Knight
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!
Slime Knight
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.
Slime Knight
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.
Slime Knight
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)
Slime Knight
Send private message
 
 PostFri Nov 08, 2019 8:18 am
Send private message Reply with quote
I'm playing around with the old 2013 source code again. But maybe this is wasn't changed until today.

In menustuf.rbas, there is the line:
Code:
slot = first_slot_in_active_party()

Why not use this instead?
Code:
slot = first_slot_in_party()


And in addition to that:
Code:
buyst.room_to_hire = herocount(3) < 4 ANDALSO free_slots_in_party() > 0

Why not dump these conditions? There is always enough room in the party! Put new heros in the reserve party, if there isn't any room in the first four slots.

I adress that, because I noticed people not knowing the OHRRPGCE and not knowing this game mechanic don't get it, why hireable heros can't be put in the reserve. Any thoughts?

Edit:
In 2013, there was a party limit of 41, which has been overcome by now according to the wiki. I found out, that the line
Code:
 buyst.room_to_hire = first_free_slot_in_party < 37

would prevent the player to hire too many heros. Are there any other concerns with the hero party size?
(Edit2: Disable HTML, code now fine)
Metal King Slime
Send private message
 
 PostFri Nov 08, 2019 10:00 am
Send private message Reply with quote
Actually all the code you're referring to has been changed since so I couldn't find it. Can you at least tell the function names in future? Also, you need to tick "Disable HTML in this post" otherwise text between < and > will be removed. It mangled some of the code you posted.

But I did find the condition for checking for space in the party before hiring:
Code:
  IF active_party_size() = active_party_slots() ORELSE free_slots_in_party() <= 0 THEN

(This doesn't make much sense, since if the last part is true then the first part always is too.)

I agree that this limit isn't necessary. But I would add a Preference Bit to control it. You don't necessarily want to allow hiring into the reserve party.

The party size limit hasn't been increased, it's still 41. Where did you read that it has? But James and I were working on lifting that limit. It's quite tricky because of interactions with script commands like "swap out hero".
Liquid Metal King Slime
Send private message
 
 PostFri Nov 08, 2019 10:58 am
Send private message Reply with quote
Right, the max number of her definitions was raised, but the size of the reserve part was not raised.

I agree it is a good idea to add a bitset to allow hiring into the reserve, allthough I suggest implementing it in the current source code Bird, not in the 2013 source code ;)
Slime Knight
Send private message
 
 PostFri Nov 08, 2019 2:50 pm
Send private message Reply with quote
My imagination got out of control, after seeing a 512 on the wiki page called "What are the limits on various things?", subcategory "Heroes", that was a 60 on the 6-year-old revision of that wiki article. How embarrassing!

Maybe it would be a good step indeed to leave the playing ground and try some tweaks on the current version. But Freebasic isn't Hspeak. Messing up something of people, who know what they are doing, should be avoided. In the future, I will surely be able to contribute on the programming side.

By the way, the suggestion in my post above was bad. It's about
Code:
buyst.room_to_hire = first_free_slot_in_party < 37

which was originally in the subfunction buystuff_buildmenu in menustuf.rbas
Code:
buyst.room_to_hire = herocount(3) < 4 ANDALSO free_slots_in_party() > 0


That suggetion doesn't stop the player from hiring heroes. Because if the player puts heroes from the active in the reserve, there are always free spaces in the active party, meaining that the first_free_slot_in_party is always lower than the given limit.
What worked was some counter to get the total number of heroes, active or reserve, and compare that again:
Code:
DIM partysize as integer = 0
FOR o as integer = 0 TO 60
 IF hero(o) > 0 THEN
 partysize += 1
 NEXT i
END IF
buyst.room_to_hire = partysize < 37


That's probably all about the old source code. My project is finished. No more questions. Thank you, James and Ralph, for answering everything!
Display posts from previous:
Page «  1, 2