mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Allow different rules for climbing (and jumping) with backpacks (by JMich)
- ja2_options.ini: MAX_BACKPACK_WEIGHT_TO_CLIMB, USE_GLOBAL_BACKPACK_SETTINGS - First setting is sBackpackWeightToClimb which is the maximum weight a backpack can weigh and still allow you to climb with. The sBackpackWeightModifier in items.xml can modify that number by either making it harder (positive number modifier) or easier (negative number modifier). If the sBackpackWeightToClimb is -1 (default) then the option is unused. Second setting is fUseGlobalBackpackSettings which if true (default) uses the same rules for all backpacks, while if false it checks for the fAllowClimbing tag in items.xml, and if that is true you can climb with said backpack. Both options can be used at the same time, so you may climb with (for example) a malice backpack that weighs less than 5kg (or 50 hg) but not climb with a radio set. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7146 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+15
-2
@@ -279,7 +279,9 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
|
||||
strcmp(name, "ItemChoiceTimeSetting") == 0 ||
|
||||
strcmp(name, "buddyitem") == 0 ||
|
||||
strcmp(name, "SleepModifier") == 0 ||
|
||||
strcmp(name, "usSpotting") == 0))
|
||||
strcmp(name, "usSpotting") == 0 ||
|
||||
strcmp(name, "sBackpackWeightModifier") == 0 ||
|
||||
strcmp(name, "fAllowClimbing") == 0))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
|
||||
@@ -1445,6 +1447,16 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
||||
// values between 0 and 100 only
|
||||
pData->curItem.usSpotting = min(100, max(0, (INT16) atol(pData->szCharData) ) );
|
||||
}
|
||||
else if (strcmp(name, "sBackpackWeightModifier") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.sBackpackWeightModifier = (INT16)atol(pData->szCharData);
|
||||
}
|
||||
else if (strcmp(name, "fAllowClimbing") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.fAllowClimbing = (BOOLEAN)atol(pData->szCharData);
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
@@ -2088,7 +2100,8 @@ BOOLEAN WriteItemStats()
|
||||
FilePrintf(hFile,"\t\t<buddyitem>%d</buddyitem>\r\n", Item[cnt].usBuddyItem );
|
||||
FilePrintf(hFile,"\t\t<SleepModifier>%d</SleepModifier>\r\n", Item[cnt].ubSleepModifier );
|
||||
FilePrintf(hFile,"\t\t<usSpotting>%d</usSpotting>\r\n", Item[cnt].usSpotting );
|
||||
|
||||
FilePrintf(hFile, "\t\t<sBackpackWeightModifier>%d</sBackpackWeightModifier>\r\n", Item[cnt].sBackpackWeightModifier);
|
||||
FilePrintf(hFile, "\t\t<fAllowClimbing>%d</fAllowClimbing>\r\n", Item[cnt].fAllowClimbing);
|
||||
FilePrintf(hFile,"\t</ITEM>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</ITEMLIST>\r\n");
|
||||
|
||||
Reference in New Issue
Block a user