Comments (7)
This is broken with original engine too, starting with 2.70. The verb interface is unusable on >= 2.70 but you can bring up an alternate inventory with the TAB key to reproduce the bug.
from ags.
When a character passes an inventory object the game first adds the inventory item to the new character. This is not done with a function call but with directly writing to game.chars[x].inv[y]. This works fine, but the new engine also has an option to sort the inventory window which is handled in the charextras struct. Apparently the old game.chars.inv indicates whether a character has an item but charextras handles whether the item is shown in the inventory. Because it is never updated in this game, it doesn't show the new item.
I don't know how to fix this in a general way. Due to the way this game is written a call to update_invorder() in Character_LoseInventory() seems to help here but in general this doesn't work.
from ags.
This is not done with a function call but with directly writing to game.chars[x].inv[y]
After I rewrote script interpreter there's now a way to catch direct reads/writes to object members from script and remap them, or even call a function instead. We may experiment with this and see if this will help here.
from ags.
The general idea is this. You override ReadInt16 and WriteInt16 virtual functions in CCCharacter class ("CharacterInfo::inv" array is type short), and put there something like:
void CCCharacter::WriteInt16(const char *address, intptr_t offset, int16_t val)
{
if (offset >= A && offset < B )
{
SetInventoryItemCount ( (CharacterInfo*)address, (offset - A) >> 1 /* item id */, val /* new quantity*/ );
}
else
{
*(int16_t*)(address + offset) = val;
}
}
from ags.
Wow, very nice! This works for me. Calling Character_SetInventoryItemCount() does not update the inventory display and UpdateInventory() has to be called too.
void WriteInt16(const char *address, intptr_t offset, int16_t val)
{
*(int16_t*)(address + offset) = val;
const int invoffset = 112;//offsetof(CharacterInfo, inv);
if (offset >= invoffset && offset < (invoffset + MAX_INV * sizeof(short)))
{
update_invorder();
}
}
from ags.
Should be fixed in commit 3e16b55.
from ags.
This was fixed, alright, so - closing.
from ags.
Related Issues (20)
- Engine: Log file location hould consider platform app output directory as base path HOT 16
- PreProcess Script before caching it for AutoComplete HOT 1
- AGS 4: Watch Variables feature potential improvements HOT 6
- Editor: In GUI editor make suitable operations apply to all selected controls HOT 2
- Editor: in Room Editor, protect locked areas from being repainted
- Editor: View Editor resets horizontal scroll position to unexpected location
- Debugger: support step-over and step-out commands HOT 3
- Engine: Rendering graphical glitch HOT 9
- AGS 4: Script API: add "split options" for String.Split method HOT 6
- Deprecate 'function' keyword HOT 4
- Expand on_mouse_click callback parameters with click position
- Editor: having multiple project folders which names are different only in letter case breaks the item drag-n-drop HOT 1
- Editor: an option that disables panel dragging and un-docking
- Editor: restore document panes when resetting a layout
- Preprocessor gets infinite loop meeting a non-latin unicode char in script HOT 3
- Typos in DistanceBetween routine cause wrong calculation HOT 3
- Engine: Windows freezes on Alt+Tab for a specific player HOT 17
- Script API: add "startIndex" parameter to String.IndexOf HOT 26
- Editor: Ctrl+C / Ctrl+V key shortcuts do not work in GUI editor HOT 1
- Editor and Engine: Make it easier to use the project prerequisites (SDL, Ogg, etc) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ags.