mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
New feature: random items allow spawn not themselves, but an item from a brad selection
- specify random items in RandomItems.xml - when the game creates a random item, it searches all vialbe items according to random item class and picks one randomly - this allows mappers to place items in maps that are more independent of the xml-set used, however the random items themselves msut be the same in map&mod - can also be used to broaden the enemy gun/item choices selection - for more reference, see http://www.bears-pit.com/board/ubbthreads.php/topics/310793.html#Post310793 FIX: sector curfew value was interpreted wrong git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5594 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+21
-3
@@ -278,7 +278,9 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
|
||||
strcmp(name, "DisarmModifier") == 0 ||
|
||||
strcmp(name, "RepairModifier") == 0 ||
|
||||
strcmp(name, "usActionItemFlag") == 0 ||
|
||||
strcmp(name, "clothestype") == 0 ))
|
||||
strcmp(name, "clothestype") == 0 ||
|
||||
strcmp(name, "randomitem") == 0 ||
|
||||
strcmp(name, "randomitemcoolnessmodificator") == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
|
||||
@@ -1399,7 +1401,21 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.clothestype = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
|
||||
else if(strcmp(name, "randomitem") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.randomitem = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "randomitemcoolnessmodificator") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.randomitemcoolnessmodificator = (INT8) atol(pData->szCharData);
|
||||
|
||||
// no nonsense, only values between -20 and + 20
|
||||
pData->curItem.randomitemcoolnessmodificator = min(20, max(-20, pData->curItem.randomitemcoolnessmodificator) );
|
||||
}
|
||||
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
@@ -2034,7 +2050,9 @@ BOOLEAN WriteItemStats()
|
||||
|
||||
FilePrintf(hFile,"\t\t<usActionItemFlag>%d</usActionItemFlag>\r\n", Item[cnt].usActionItemFlag );
|
||||
FilePrintf(hFile,"\t\t<clothestype>%d</clothestype>\r\n", Item[cnt].clothestype );
|
||||
|
||||
FilePrintf(hFile,"\t\t<randomitem>%d</randomitem>\r\n", Item[cnt].randomitem );
|
||||
FilePrintf(hFile,"\t\t<randomitemcoolnessmodificator>%d</randomitemcoolnessmodificator>\r\n", Item[cnt].randomitemcoolnessmodificator );
|
||||
|
||||
FilePrintf(hFile,"\t</ITEM>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</ITEMLIST>\r\n");
|
||||
|
||||
Reference in New Issue
Block a user