Home » MODDING HQ 1.13 » v1.13 General Development Talk » 100AP Project - open Beta
|
|
|
|
|
|
|
|
|
|
Re: 100AP Project - open Beta[message #203310]
|
Thu, 04 December 2008 18:48
|
|
ctiberious |
|
Messages:605
Registered:March 2007 |
|
|
Tais, it's not a bug. The player_ap_bonus (as well as the other ap_bonus values) at signed, 8bit values. Meaning they can take a value of -128 - 127. These ab_bonus values aren't meant to be used with such large numbers, hence why they were created as INT8 variables. So this isn't a bug. It's simply you, the user, using a value that is out of range. Yes, we could probably change this variable to an INT16 or something, but that wouldn't change the fact that you're using a value that's larger then what the variable was intended for.
If you tried to set MAX_IMP_CHARACTERS to 7, you'll encounter problems in the code. We don't see that as a bug, though, as that value shouldn't be anything but 1-6. About the only thing that could be considered a bug is that the code isn't built with any checking to make sure that a value set in the INI file is set within a valid range. That's probably something we need to correct, but as there are hundreds of INI settings, that's alot of error checking that would need to be added. Meaning it would take someone alot of time. Time that most of the coders are already using on other things. I'm sure someone will eventually get around to this, though.
Report message to a moderator
|
|
|
|
Re: 100AP Project - open Beta[message #203314]
|
Thu, 04 December 2008 19:04
|
|
SpaceViking |
|
Messages:751
Registered:January 2004 Location: Rochester, Minnesota, USA |
|
|
You can set MAX_IMP_CHARACTERS to more than 6 but you also have to set the other values around there to point to whatever slots you have set up for a 7th or more IMP. The problem is there is only voice work for 6 (3 males, 3 females).
I've played some using otherwise unused slots (there's a list in the .ini) as IMPs without the voice files and it works, sort of. The IMPs are mostly quiet and sometimes their protraits pop up as if they are going to say something but then don't. I never played too far into the game so there may be things that break later on.
For the "too large" value read in from the INI we should probably change where the values for AP bonuses are read to exclude values that are too large. There is a version of CIniReader::ReadInteger that takes a minimum and maximum value. That could be used and set the minimum to 0 and the maximum to 127. Maybe like this:
// Enemy AP settings
gGameExternalOptions.iEasyAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","NOVICE_AP_BONUS",0,0,127-baseAPs);
gGameExternalOptions.iExperiencedAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERIENCED_AP_BONUS",0,0,127-baseAPs);
gGameExternalOptions.iExpertAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERT_AP_BONUS",0,0,127-baseAPs);
gGameExternalOptions.iInsaneAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","INSANE_AP_BONUS",0,0,127-baseAPs);
gGameExternalOptions.iPlayerAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","PLAYER_AP_BONUS",0,0,127-baseAPs);
where baseAPs is whatever the base APs are (100 or 25 or whatever)
[Updated on: Thu, 04 December 2008 19:05] by Moderator Report message to a moderator
|
|
|
|
Re: 100AP Project - open Beta[message #203317]
|
Thu, 04 December 2008 19:14
|
|
ctiberious |
|
Messages:605
Registered:March 2007 |
|
|
I wouldn't use "127-baseAPs" because baseAPs could be set to 32000 if you wanted. I'm pretty sure it won't display properly, but you could set them. And I wouldn't set the minimum value to 0. I'm assuming that the reason this was created with a signed interger was so you could create an ap penalty by coding a negative value. That being said, coding maximum and minimum values that fit what the interger can hold isn't a bad idea. I'll play around with that.
EDIT: I've made the following changes based on SpaceVikings suggestions:
// Enemy AP settings
gGameExternalOptions.iEasyAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","NOVICE_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127);
gGameExternalOptions.iExperiencedAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERIENCED_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127);
gGameExternalOptions.iExpertAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERT_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127);
gGameExternalOptions.iInsaneAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","INSANE_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127);
gGameExternalOptions.iPlayerAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","PLAYER_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127);
The max bonus is 127 instead of being based on AP_MAXIMUM. The minimum "bonus" is a bit trickier. You can't have negative possible APs. If you do, you can't move while in strategic. So if AP_MAXIMUM = 100 but you set a PLAYER_AP_BONUS = -128, you wouldn't be able to move. So, as you can see from the code above, I'm using the maximum of -APBPConstants[AP_MINIMUM] (so -40 by default) or -128. So if you put in a huge negative value, the code will use either -128 or the reverse of whatever you set for AP_MINIMUM. This still won't stop players from putting in values that won't work, but it should make it harder to mess things up.
[Updated on: Thu, 04 December 2008 19:33] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Apr 20 08:39:44 GMT+3 2024
Total time taken to generate the page: 0.01903 seconds
|