Jump to content


Photo

Lord Khelben's Bugs and Questions Thread


39 replies to this topic

#31 khelban12

khelban12
  • Members
  • 108 posts

Posted 21 August 2017 - 01:51 AM

Greetings once more.

I tried to start a new playthrough and noticed that during the ability points screen, the recall button didn't work which was weird because in the past it worked fine. After a few seconds rolling and recalling, i noticed that the ability points were being recalled correctly and i just didn't notice it because i was only looking at the "Total" ability score. This happens because the code that updates the total display is only being run in the RollPress function.

I have coded this patch that added the same code to the RecallPress function and now it seems to work fine in showing the recalled result.

Edit: When testing the character generation, i noticed something by accident. I could make Paladin class as a Half-Elf. I thought that maybe some mod messed up my installation but i saw that gemrb uses its own classes.2da instead of game supplied clsrcreq.2da. This is not a major issue but i have found many discrepancies between the two as it shows in this diff which i also include in the spoiler below. Some of these changes may also need to be done for BG1.

Spoiler


Another silly patch i have done is about implementing Ctrl+8 in the Character Generation Screen. During character generation, when you are in the abilities screen and roll dice, the original engine permitted to give everything maxed to 18 if you pressed Ctrl+8 (According to game guides it is supposed to be Ctrl+Shift+8 but in my case it also works with just Ctrl+8 without shift).
 
diff --git a/gemrb/GUIScripts/bg2/GUICG4.py b/gemrb/GUIScripts/bg2/GUICG4.py
index afe53a124..93a735cb7 100644
--- a/gemrb/GUIScripts/bg2/GUICG4.py
+++ b/gemrb/GUIScripts/bg2/GUICG4.py
@@ -78,6 +78,7 @@ def CalcLimits(Abidx):
 
 def RollPress():
 	global Minimum, Maximum, Add, HasStrExtra, PointsLeft
+	global AllPoints18
 
 	GemRB.SetVar("Ability",0)
 	GemRB.SetVar("Ability -1",0)
@@ -87,7 +88,10 @@ def RollPress():
 	SumLabel.SetUseRGB(1)
 
 	if HasStrExtra:
-		e = GemRB.Roll(1,100,0)
+		if AllPoints18:
+			e = 100
+		else:
+			e = GemRB.Roll(1,100,0)
 	else:
 		e = 0
 	GemRB.SetVar("StrExtra", e)
@@ -104,6 +108,8 @@ def RollPress():
 				v = Minimum
 			if v>Maximum:
 				v = Maximum
+			if AllPoints18:
+				v = 18
 			GemRB.SetVar("Ability "+str(i), v )
 			Total += v
 
@@ -117,13 +123,25 @@ def RollPress():
 	# add a counter to the title
 	SumLabel = AbilityWindow.GetControl (0x10000000)
 	SumLabel.SetText(GemRB.GetString(11976) + ": " + str(Total))
+	AllPoints18 = 0
 	return
 
+def GiveAll18(wIdx, key, mod):
+	global AllPoints18
+	if mod == 2 and key == 127:
+		AllPoints18 = 1
+		RollPress()
+		return 1
+	return 0
+
 def OnLoad():
 	global AbilityWindow, TextAreaControl, DoneButton
 	global PointsLeft, HasStrExtra
 	global AbilityTable, Abclasrq, Abclsmod, Abracerq, Abracead
 	global KitIndex, Minimum, Maximum, MyChar
+	global AllPoints18
+
+	AllPoints18 = 0
 	
 	Abracead = GemRB.LoadTable("ABRACEAD")
 	if GemRB.HasResource ("ABCLSMOD", RES_2DA):
@@ -151,6 +169,7 @@ def OnLoad():
 	GemRB.LoadWindowPack("GUICG", 640, 480)
 	AbilityTable = GemRB.LoadTable("ability")
 	AbilityWindow = GemRB.LoadWindow(4)
+	AbilityWindow.SetKeyPressEvent (GiveAll18)
 
 	RerollButton = AbilityWindow.GetControl(2)
 	RerollButton.SetText(11982)
As always, i am blindly messing with the code here and there so there may be a way better way to implement this. I added a keypress handler to the window which checks for Ctrl+8 and sets a global variable to 1. This is checked in the RollPress function and if it is 1 then everything is set to 18.

The "if mod == 2 and key == 127" check i did is horrible and definitely needs changing. I wanted to use a mask (something like mod & GEM_CTRL) so that it is better (and also works with ctrl+shift) but i couldn't find the modifiers behavior. Some keys (like 1) had no difference with ctrl or shift. Some other keys (like 3, 4, etc) had some bits shifted by ctrl and by shift and 8 changed completely (i think from 53 without ctrl to 127 with ctrl).

Edited by khelban12, 21 August 2017 - 04:38 AM.


#32 lynx

lynx
  • Modders
  • 3098 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 21 August 2017 - 04:36 AM

Thanks, it's in!


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#33 khelban12

khelban12
  • Members
  • 108 posts

Posted 21 August 2017 - 04:43 AM

Thanks, it's in!


:) Thanks for the quick response. I also did an edit after your posted in case you didn't get a notification.

#34 lynx

lynx
  • Modders
  • 3098 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 21 August 2017 - 05:41 AM

clsrcreq.2da came later than classes.2da, as it's from ee. So it doesn't tell us what was the default in the originals. I'm pretty sure we're less strict though, at least for kits.

 

GiveAll18 is necessarily ugly, but the interface changed in the subviews branch, so it may look better there. Maybe the whole thing would be better without a global (and a parameter instead), but it's such a small and shortlived file that it doesn't really matter.


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#35 khelban12

khelban12
  • Members
  • 108 posts

Posted 21 August 2017 - 10:25 AM

clsrcreq.2da came later than classes.2da, as it's from ee. So it doesn't tell us what was the default in the originals. I'm pretty sure we're less strict though, at least for kits.

I do not have EE installed. The file i compared with classes was from a normal BG2 installation. By very briefly browsing the 2e player's handbook, clsrcreq seem to coincide with proper PnP class restrictions (not that this says something since the game deviates from PnP in many aspects).

Edit: It resides in tobex/tobex_redist/override/clsrcreq.2da so you are right it doesn't come with the original engine. I have years (if ever) to play without tobex so it didn't occur to me. I will try a default ToB installation without any mods at all and edit the post if the class behavior is different.

GiveAll18 is necessarily ugly, but the interface changed in the subviews branch, so it may look better there. Maybe the whole thing would be better without a global (and a parameter instead), but it's such a small and shortlived file that it doesn't really matter.


Yeah it is. Even the names of the function and variable are ugly but it was a test to see if it works. As always, feel free to do any modifications you like. Do you have any ideas about the keys behavior and what a better implementation would be ?

#36 lynx

lynx
  • Modders
  • 3098 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 21 August 2017 - 11:02 AM

A preliminary merge suggests it will only be uglier in the other branch.


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#37 khelban12

khelban12
  • Members
  • 108 posts

Posted 22 August 2017 - 02:36 AM

A preliminary merge suggests it will only be uglier in the other branch.


Forget i sent it then. It is not a major issue anyway to be able to roll 18s. Maybe when subviews are finished, we can implement it in a better way.

#38 lynx

lynx
  • Modders
  • 3098 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 23 August 2017 - 03:13 AM

It's in. I had to create an extra button, but on the other hand, the callback is much simpler, In total, I'd say it's cleaner.


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#39 khelban12

khelban12
  • Members
  • 108 posts

Posted 23 August 2017 - 05:45 AM

It's in. I had to create an extra button, but on the other hand, the callback is much simpler, In total, I'd say it's cleaner.


I still don't like the crap if clause. Also it now came to me, is it possible that mod and key have different values on other platforms ?

#40 lynx

lynx
  • Modders
  • 3098 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 23 August 2017 - 06:26 AM

If you mean the one in the callback, it's gone in the subviews version.


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users