Jump to content

GemRB BG2 Weapon Slots and other questions


khelban12

Recommended Posts

Ok. I believe you. :) I wonder which paperdoll is displayed then? Are they too big and cut off, with equipment not even being carried?

 

Can you try stepping through GemRB_Button_SetPLT in gdb? You can enable the breakpoint just before opening the inventory and the first call will be for the paperdoll itself.

 

 

For uploads it says this to me below the text area (haven't uploaded much yet):

You can upload up to 19.28MB of files (Max. single file size: 19.28MB)
Link to comment

Ok. I believe you. :) I wonder which paperdoll is displayed then? Are they too big and cut off, with equipment not even being carried?

 

Can you try stepping through GemRB_Button_SetPLT in gdb? You can enable the breakpoint just before opening the inventory and the first call will be for the paperdoll itself.

paperdoll.png

 

Left is vanilla engine (with 1pp's "corrupt" plt files) and right is gemrb.

 

I tried to step with gdb but couldn't find out what it does. It tries to load resref chft1inv but then it runs some loops to create resources and stuff which i didn't understand. strace also shows no attempt to load any bams. After not being able to use the plt file, it opens paperdoll.bif and uses some file from there. I extracted the contents of the bif to override (to see in strace what file from the bif it uses) but it still only opens the bif.

 

When i moved the bif away, only then it opened the bam (after not using the plt of course) and the result is the following:

paperdoll2.png

 

Edit: Now that i think of it, i remembered something. When i first used gemrb with 1pp some time ago, i noticed that gemrb showed the new 1pp paperdoll (albeit with this pink shadow) only when biffed. If i had them in override, it ignored them and shows the "original" paperdolls as my first picture shows. I didn't have time to investigate it and because the pink shadow was annoying, i chose to use the original ugly paperdolls, so i modified generalized_biffing not to "biff" plt files.

// Biffing of PLT files breaks gemrb
// OUTER_TEXT_SPRINT ext ~\(bmp\|mve\|wav\|wfx\|plt\|bam\|wed\|chu\|tis\|mos\|itm\|spl\|bcs\|ids\|cre\|are\|dlg\|2da\|gam\|sto\|wmp\|eff\|chr\|vvc\|vef\|pro\|wbm\|fnt\|gui\|sql\|pvrz\|glsl\|ini\)~
OUTER_TEXT_SPRINT ext ~\(bmp\|mve\|wav\|wfx\|bam\|wed\|chu\|tis\|mos\|itm\|spl\|bcs\|ids\|cre\|are\|dlg\|2da\|gam\|sto\|wmp\|eff\|chr\|vvc\|vef\|pro\|wbm\|fnt\|gui\|sql\|pvrz\|glsl\|ini\)~
Is it possible that there is an oversight that makes gemrb not use certain files from the override folder but only from bif files ?
Link to comment

First, the backup looking for a BAM is in GemRB_Button_SetPLT itself (im == NULL), not in our resource manager.

 

The pink there is pretty obviously the shadow color, though it's not obvious why it is not displayed properly. Funky palette index? Needs a deeper look.

 

Where was the bif? If it was in override, perhaps it just came up first when looking the file up (not sure in what way lookup is ordered or if it is deterministic at all). And by having the paperdoll in override, do you mean the plt, bam or both?

Link to comment

Where was the bif? If it was in override, perhaps it just came up first when looking the file up (not sure in what way lookup is ordered or if it is deterministic at all). And by having the paperdoll in override, do you mean the plt, bam or both?

If you mean the paperdol.bif then it is original game data and resides in the data/ directory.

 

The behavior is the following:

 

a) modded installation up until before generalized_biffing (so with everything in the override directory -> gemrb shows the original ugly paperdolls.

 

b) installation after original generalized_biffing runs (so with almost nothing in the override directory) -> gemrb correctly opens the bam files and shows the new 1pp paperdolls (with the pink shadow)

 

c) after my modified generalized_biffing runs (everything in biffs and only plt files in the override directory) -> same behavior as a) gemrb correctly opens the plt files from override/, cannot use them because they are "invalid", then opens original paperdol.bif ignoring the bam files, and shows the original ugly paperdols.

 

So, there is indeed for loading bam if plt fails. It just seems that it only does it if both plt and bam files are contained in a bif.

 

Maybe i messed something up when testing. Tomorrow i will copy the tree and remove bgt and rest modifications and try only 1pp so that we have a better picture.

Link to comment

I removed all mods and tested only 1PP to have a more clear picture.

 

TobEX + Bg2Fixpack gives this log. Inventory paperdoll is the original one.

 

Installing 1PP gives this log. Inventory paperdoll still the original one.

 

The relevant differences between the two logs are:

 

 

--- gemrb-01-bg2fixpack.log	2016-08-31 15:58:40.122416254 +0300
+++ gemrb-02-1pp.log	2016-08-31 15:58:43.193371090 +0300
@@ -546,6 +546,7 @@
 [ResourceManager]: Found 'pictures.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Found 'COLGRAD.bam' in 'chitin.key'.
 [ResourceManager]: Searching for 'CHMF1INV'...
+[PLTImporter/WARNING]: Not a valid PLT File.
 [ResourceManager]: Found 'CHMF1INV.plt' in 'chitin.key'.
 [GUIScript]: Loading Script GUICG19.
 [ResourceManager]: Found 'GUICG.chu' in 'Override'.
@@ -613,8 +614,8 @@
 [ResourceManager]: Searching for 'gprogbar'...
 [ResourceManager]: Found 'gprogbar.mos' in 'Override'.
 [ResourceManager]: Found 'coadbar.bam' in 'chitin.key'.
-[ResourceManager]: Searching for 'GTRSK002'...
-[ResourceManager]: Found 'GTRSK002.mos' in 'chitin.key'.
+[ResourceManager]: Searching for 'GTRSK003'...
+[ResourceManager]: Found 'GTRSK003.mos' in 'chitin.key'.
 [ResourceManager]: Found 'loadh25.2da' in 'Override'.
 [ResourceManager]: Found 'ar0602.are' in 'Override'.
 [ResourceManager]: Found 'pathfind.2da' in 'GemRB Unhardcoded data'.
@@ -778,7 +779,7 @@
 [ResourceManager]: Found 'wqLBWg1.bam' in 'chitin.key'.
 [ResourceManager]: Found 'cdmb2g17.bam' in 'chitin.key'.
 [ResourceManager]: Found 'wqSAXg1.bam' in 'chitin.key'.
-[ResourceManager]: Found 'wqSD3g1.bam' in 'chitin.key'.
+[ResourceManager]: Found 'wqSC1g1.bam' in 'Override'.
 [ResourceManager]: Found 'wqSCBg1.bam' in 'chitin.key'.
 [ResourceManager]: Found 'mdjig12.bam' in 'chitin.key'.
 [ResourceManager]: Found 'cdmw1g17.bam' in 'chitin.key'.
@@ -987,10 +988,12 @@
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Searching for 'CHFT1INV'...
+[PLTImporter/WARNING]: Not a valid PLT File.
 [ResourceManager]: Found 'CHFT1INV.plt' in 'chitin.key'.
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Searching for 'CHFT1INV'...
+[PLTImporter/WARNING]: Not a valid PLT File.
 [ResourceManager]: Found 'CHFT1INV.plt' in 'chitin.key'.
 [ResourceManager]: Found 'stonhelm.bam' in 'chitin.key'.
 [ResourceManager]: Found 'stonarm.bam' in 'chitin.key'.

 

 

Installing generalized-biffing and biff-ing everything gives this log. At last, 1pp inventory paperdolls are used (with the pink shadow). Relevant differences between logs below:

 

 

--- gemrb-02-1pp.log	2016-08-31 15:58:43.193371090 +0300
+++ gemrb-03-generalized-biffing.log	2016-08-31 15:58:46.068328810 +0300
@@ -547,29 +547,30 @@
 [ResourceManager]: Found 'COLGRAD.bam' in 'chitin.key'.
 [ResourceManager]: Searching for 'CHMF1INV'...
 [PLTImporter/WARNING]: Not a valid PLT File.
-[ResourceManager]: Found 'CHMF1INV.plt' in 'chitin.key'.
+[ResourceManager/WARNING]: Couldn't find 'CHMF1INV'... Tried CHMF1INV.plt 
+[ResourceManager]: Found 'CHMF1INV.bam' in 'chitin.key'.
 [GUIScript]: Loading Script GUICG19.
@@ -989,12 +998,13 @@
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Searching for 'CHFT1INV'...
 [PLTImporter/WARNING]: Not a valid PLT File.
-[ResourceManager]: Found 'CHFT1INV.plt' in 'chitin.key'.
+[ResourceManager/WARNING]: Couldn't find 'CHFT1INV'... Tried CHFT1INV.plt 
+[ResourceManager]: Found 'CHFT1INV.bam' in 'chitin.key'.
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Found 'magesch.2da' in 'GemRB Unhardcoded data'.
 [ResourceManager]: Searching for 'CHFT1INV'...
 [PLTImporter/WARNING]: Not a valid PLT File.
-[ResourceManager]: Found 'CHFT1INV.plt' in 'chitin.key'.
+[ResourceManager/WARNING]: Couldn't find 'CHFT1INV'... Tried CHFT1INV.plt 
 [ResourceManager]: Found 'stonhelm.bam' in 'chitin.key'.
 [ResourceManager]: Found 'stonarm.bam' in 'chitin.key'.

 

 

So unless my testing is wrong, there is indeed plt->bam fallback but it seems to work if-and-only-if both plt and bam files are contained in biff files. This is for inventory paperdolls.

 

Avatars are always the original ones that are shown below.

gemrb_avatar.png

 

The "hooded" thief avatar from 1pp shown below seems to always be ignored.

gemrb_avatar2.png

 

If you want me to test something else, please tell me.

Link to comment

This is very helpful. It'll be easier if I dig in myself though.

 

One question, where do the hoods come into play anew? I loaded tobthief and she has a hood — both in game and in the inventory.

 

edit: ah, it's pretty simple. The plt sanity check doesn't bail out high enough for the other check to notice it, since we just continue searching in other paths, finding the original file. In other words, invalid overrides get skipped, they don't really pollute.

Link to comment

 

I've added a hack for this (I find the current approach saner) and a fix for the pink palette. I never saw any non-inventory shadows, so that wasn't tested.

gemrb_before_after.png

 

It seems to work fine.

 

Edit: I also made the hoodied thief avatar work. The ids file copied by infinity animations contains for example the following:

0x6310 CHFB     CGAMEANIMATIONTYPE_THIEF_FEMALE_HUMAN
so i modified avatars.2da as follows:

           AT_1       AT_2       AT_3       AT_4       TYPE       SPACE      PALETTE    SIZE
0x6310     CHFB1      CHFB2      CHFB3      CHFF4      0          2          0          N
Although the HFB code didn't make any sense to me (i pressume H=Human F=Female B=what ?), i tried to replicate what anisnd.ids said.

 

I now tried changing AT_1 and AT_2 to CHFT1 and the hoodied thief avatar suddenly works fine :) BTW, what are these AT_X ? I noticed that AT_4 (and AT_3 in some cases) is different than the other three in some cases.

 

Edit 2: I forgot to thank you. Thanks once more for your hard work.

Link to comment

3) Using the stealth button on a thief results in immediate hiding in shadows in the original game while in gemrb it takes a round before the thief hides. Is this normal ?

3. Modal actions are checked and applied each round (Actor::UpdateActorState) and the missing arbitrary start time is an oversight.

I forgot to mention that this seems to have been resolved. Unless i got lucky in all my tries, i hide immediately now.

 

 

 

diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp
index 8673993..a901ae9 100644
--- a/gemrb/core/Scriptable/Actor.cpp
+++ b/gemrb/core/Scriptable/Actor.cpp
@@ -514,6 +514,7 @@ Actor::Actor()
 	}
 	//this one is saved only for PC's
 	ModalState = 0;
+	IsHidden = 0;
 	//set it to a neutral value
 	ModalSpell[0] = '*';
 	LingeringModalSpell[0] = '*';
@@ -5603,6 +5604,7 @@ void Actor::SetModal(ieDword newstate, bool force)
 		case MS_DETECTTRAPS:
 			break;
 		case MS_STEALTH:
+			IsHidden ^= IsHidden;
 			break;
 		case MS_TURNUNDEAD:
 			break;
@@ -6805,7 +6807,7 @@ void Actor::UpdateActorState(ieDword gameTime) {
 	}
 
 	//apply the modal effect on the beginning of each round
-	if (roundFraction == 0) {
+	if ((roundFraction == 0) || (!IsHidden)) {
 		// handle lingering modal spells like bardsong in iwd2
 		if (modalSpellLingering && LingeringModalSpell[0]) {
 			modalSpellLingering--;
@@ -9269,6 +9271,7 @@ bool Actor::ModalSpellSkillCheck()
 		if (Modified[IE_TURNUNDEADLEVEL]<=0) return false;
 			return true;
 	case MS_STEALTH:
+			IsHidden = 1;
 			return TryToHide();
 	case MS_NONE:
 		default:
@@ -9284,6 +9287,7 @@ inline void HideFailed(Actor* actor, int reason = -1, int skill = 0, int roll =
 	core->ApplyEffect(newfx, actor, actor);
 	delete newfx;
 
+	actor->IsHidden = 0;
 	if (!third) {
 		return;
 	}
diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h
index ed1ce4f..4d10934 100644
--- a/gemrb/core/Scriptable/Actor.h
+++ b/gemrb/core/Scriptable/Actor.h
@@ -314,6 +314,7 @@ public:
 	ieDword InteractCount; //this is accessible in iwd2, probably exists in other games too
 	ieDword appearance;
 	ieDword ModalState;
+	ieDword IsHidden;
 	int PathTries; //the # of previous tries to pick up a new walkpath
 	ArmorClass AC;
 	ToHitStats ToHit;

 

The above code is how i had fixed it locally using a IsHidden flag and setting/unsetting it in various places. The following is how lynx did it correctly :)

diff --git a/gemrb/plugins/GUIScript/GUIScript.cpp b/gemrb/plugins/GUIScript/GUIScript.cpp
index 9341650..4b8ecdd 100644
--- a/gemrb/plugins/GUIScript/GUIScript.cpp
+++ b/gemrb/plugins/GUIScript/GUIScript.cpp
@@ -13547,6 +13547,7 @@ static PyObject* GemRB_SetModalState(PyObject * /*self*/, PyObject* args)
 
 	actor->SetModal( (ieDword) state, 0);
 	actor->SetModalSpell(state, spell);
+	actor->ApplyModal(actor->ModalSpell); // force immediate effect
 
 	Py_RETURN_NONE;
 }
lynx :respect:
Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...