Difference between revisions of "Money"
Squall FF8 (talk | contribs) (Created page with "As in reality, money in Final Fantasy V are important resource. The currency in the game is called gil. Although its important resource, pretty much in all documents I have en...") |
Squall FF8 (talk | contribs) (→Items price) |
||
Line 18: | Line 18: | ||
== Items price == | == Items price == | ||
In order to calculate the price of any item, the games uses two tables: | In order to calculate the price of any item, the games uses two tables: | ||
− | $D12A00 - contain price of all items. 256 entries, 2 bytes each | + | $D12A00 - contain price of all items. 256 entries, 2 bytes each ($200) |
+ | $D12C00 - contain price of Magic spells. 128 entries, 2 bytes each ($100) | ||
$C0F517 - Power of 10 table. Contain 7 entries, 4 bytes each | $C0F517 - Power of 10 table. Contain 7 entries, 4 bytes each | ||
Latest revision as of 23:28, 28 July 2022
As in reality, money in Final Fantasy V are important resource. The currency in the game is called gil. Although its important resource, pretty much in all documents I have encountered dedicated on the game, that info is missing (actually I found in only one - algo FAQ). Striving for fullness I decided to add that feature in my Viewer. Initially I thought - that should be easy task, how hard could be storing money-values? But as usual, nothing is simple in FF5.
How money are stored
Before we continue with technical details, first we need to understand how gil are stored in the memory:
two byte value in the form of decimal floating-point number Value = M x (10 power E) = M x 10^E in memory - E M
Lets make an example. A dagger cost 300 gil. 300 = 3 x 10^2. That value will be stored as 02 03.
On top of that the game uses 2 additional bits to store extra information. If we put all together, money in memory will look like:
S0 L0 . . . E2 E1 E0 | M7 M6 M5 M4 M3 M2 M1 M0 S - can we sell the item. 1 - NO L - Low price E - Exponent of price M - Mantissa (significand or coefficient)
Items price
In order to calculate the price of any item, the games uses two tables:
$D12A00 - contain price of all items. 256 entries, 2 bytes each ($200) $D12C00 - contain price of Magic spells. 128 entries, 2 bytes each ($100) $C0F517 - Power of 10 table. Contain 7 entries, 4 bytes each
Buy/Sell values of items
Since we have only one value for each item, I can hear your question: is this buying or selling value?
Buy value = Item price
if item is sell-able (S = 0) if L = 0, Sell Value = Item Price / 2 if L = 1, Sell Value = 5