- new <usItemClass>: IC_RANDOMITEM (0x40000000 or 1073741824) is used for random items exclusively.

- increased ma number of Random Items to 1000
- fix: A certain key combination no longer spawns random NATO ARs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5618 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2012-10-10 20:10:49 +00:00
parent 902cd02298
commit e762c6b0f4
21 changed files with 74 additions and 28 deletions
+1
View File
@@ -70,6 +70,7 @@ enum
ITEMS_EQUIPMENT3,
ITEMS_TRIGGERS,
ITEMS_KEYS,
ITEMS_RANDOMITEM,
ITEMS_LEFTSCROLL,
ITEMS_RIGHTSCROLL, LAST_ITEMS_BUTTON = ITEMS_RIGHTSCROLL,
//MapInfo menu
+1
View File
@@ -104,6 +104,7 @@ void ItemsEquipment3Callback(GUI_BUTTON *btn,INT32 reason);
void ItemsTriggersCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsKeysCallback(GUI_BUTTON *btn, INT32 reason);
void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason);
void ItemsRandomItemCallback(GUI_BUTTON *btn, INT32 reason);
void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason);
void MouseMovedInItemsRegion(MOUSE_REGION *reg, INT32 reason);
void MouseClickedInItemsRegion(MOUSE_REGION *reg, INT32 reason);
+6
View File
@@ -787,6 +787,12 @@ void ItemsKeysCallback(GUI_BUTTON *btn,INT32 reason)
SetEditorItemsTaskbarMode( ITEMS_KEYS );
}
void ItemsRandomItemCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
SetEditorItemsTaskbarMode( ITEMS_RANDOMITEM );
}
void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
+4
View File
@@ -72,6 +72,10 @@ void SetEditorItemsTaskbarMode( UINT16 usNewMode )
ClickEditorButton( ITEMS_KEYS );
iEditorToolbarState = TBAR_MODE_ITEM_KEYS;
break;
case ITEMS_RANDOMITEM:
ClickEditorButton( ITEMS_RANDOMITEM );
iEditorToolbarState = TBAR_MODE_ITEM_RANDOMITEM;
break;
}
}
+14 -10
View File
@@ -550,44 +550,48 @@ void InitEditorItemsToolbar()
SetFontForeground( FONT_MCOLOR_LTRED );
iEditorButton[ITEMS_WEAPONS] =
CreateTextButton(iEditorItemsToolbarText[0],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 440, 39, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsWeaponsCallback);
iEditorButton[ITEMS_AMMO] =
CreateTextButton(iEditorItemsToolbarText[1],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 159, 2 * iScreenHeightOffset + 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 139, 2 * iScreenHeightOffset + 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsAmmoCallback);
iEditorButton[ITEMS_ARMOUR] =
CreateTextButton(iEditorItemsToolbarText[2],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 199, 2 * iScreenHeightOffset + 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 179, 2 * iScreenHeightOffset + 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsArmourCallback);
iEditorButton[ITEMS_LBEGEAR] =
CreateTextButton(iEditorItemsToolbarText[3],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 251, 2 * iScreenHeightOffset + 440, 30, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 231, 2 * iScreenHeightOffset + 440, 30, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsLBECallback);
iEditorButton[ITEMS_EXPLOSIVES] =
CreateTextButton(iEditorItemsToolbarText[4],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 281, 2 * iScreenHeightOffset + 440, 39, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 261, 2 * iScreenHeightOffset + 440, 30, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsExplosivesCallback);
iEditorButton[ITEMS_EQUIPMENT1] =
CreateTextButton(iEditorItemsToolbarText[5],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 291, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsEquipment1Callback);
iEditorButton[ITEMS_EQUIPMENT2] =
CreateTextButton(iEditorItemsToolbarText[6],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 341, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 312, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsEquipment2Callback);
iEditorButton[ITEMS_EQUIPMENT3] =
CreateTextButton(iEditorItemsToolbarText[7],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 362, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 333, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsEquipment3Callback);
iEditorButton[ITEMS_TRIGGERS] =
CreateTextButton(iEditorItemsToolbarText[8],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 383, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 354, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsTriggersCallback );
iEditorButton[ITEMS_KEYS] =
CreateTextButton(iEditorItemsToolbarText[9],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 442, 2 * iScreenHeightOffset + 440, 38, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 413, 2 * iScreenHeightOffset + 440, 38, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsKeysCallback );
iEditorButton[ITEMS_RANDOMITEM] =
CreateTextButton(iEditorItemsToolbarText[10],(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 451, 2 * iScreenHeightOffset + 440, 29, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsRandomItemCallback);
iEditorButton[ITEMS_LEFTSCROLL] =
CreateEasyNoToggleButton( iScreenWidthOffset + 1, 2 * iScreenHeightOffset + 361,"EDITOR//leftscroll.sti", ItemsLeftScrollCallback);
+1
View File
@@ -82,6 +82,7 @@ enum
TBAR_MODE_ITEM_EQUIPMENT3,
TBAR_MODE_ITEM_TRIGGERS,
TBAR_MODE_ITEM_KEYS,
TBAR_MODE_ITEM_RANDOMITEM,
TBAR_MODE_RADAR_MAP,//dnl ch9 071009
};
+15
View File
@@ -207,6 +207,9 @@ void EntryInitEditorItemsInfo()
else
eInfo.sNumEquipment3++;
break;
case IC_RANDOMITEM:
eInfo.sNumRandomItems++;
break;
//case IC_KEY:
// eInfo.sNumKeys++;
// break;
@@ -310,6 +313,11 @@ void InitEditorItemsInfo(UINT32 uiItemType)
eInfo.sScrollIndex = eInfo.sSaveKeysScrollIndex;
eInfo.sSelItemIndex = eInfo.sSaveSelKeysIndex;
break;
case TBAR_MODE_ITEM_RANDOMITEM:
eInfo.sNumItems = eInfo.sNumRandomItems;
eInfo.sScrollIndex = eInfo.sSaveRandomItemScrollIndex;
eInfo.sSelItemIndex = eInfo.sSaveSelRandomItemIndex;
break;
default:
//error
return;
@@ -473,6 +481,9 @@ void InitEditorItemsInfo(UINT32 uiItemType)
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT3;
iEquipCount++;
break;
case IC_RANDOMITEM:
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_RANDOMITEM;
break;
}
if( fTypeMatch )
{
@@ -747,6 +758,10 @@ void ClearEditorItemsInfo()
eInfo.sSaveSelKeysIndex = eInfo.sSelItemIndex;
eInfo.sSaveKeysScrollIndex = eInfo.sScrollIndex;
break;
case TBAR_MODE_ITEM_RANDOMITEM:
eInfo.sSaveSelRandomItemIndex = eInfo.sSelItemIndex;
eInfo.sSaveRandomItemScrollIndex = eInfo.sScrollIndex;
break;
}
}
+3 -3
View File
@@ -20,12 +20,12 @@ typedef struct{
INT16 sScrollIndex; //current scroll index (0 is far left, 1 is next tile to the right, ...)
INT16 sSaveSelWeaponsIndex, sSaveSelAmmoIndex, sSaveSelArmourIndex, sSaveSelLBEIndex, sSaveSelExplosivesIndex,
sSaveSelEquipment1Index, sSaveSelEquipment2Index, sSaveSelEquipment3Index,
sSaveSelTriggersIndex, sSaveSelKeysIndex;
sSaveSelTriggersIndex, sSaveSelKeysIndex, sSaveSelRandomItemIndex;
INT16 sSaveWeaponsScrollIndex, sSaveAmmoScrollIndex, sSaveArmourScrollIndex, sSaveLBEScrollIndex,
sSaveExplosivesScrollIndex, sSaveEquipment1ScrollIndex, sSaveEquipment2ScrollIndex,
sSaveEquipment3ScrollIndex, sSaveTriggersScrollIndex, sSaveKeysScrollIndex;
sSaveEquipment3ScrollIndex, sSaveTriggersScrollIndex, sSaveKeysScrollIndex, sSaveRandomItemScrollIndex;
INT16 sNumWeapons, sNumAmmo, sNumArmour, sLBEGear, sNumExplosives, sNumEquipment1, sNumEquipment2, sNumEquipment3,
sNumTriggers, sNumKeys;
sNumTriggers, sNumKeys, sNumRandomItems;
}EditorItemsInfo;
extern EditorItemsInfo eInfo;
+1
View File
@@ -1341,6 +1341,7 @@ void HandleJA2ToolbarSelection( void )
case TBAR_MODE_ITEM_EQUIPMENT3:
case TBAR_MODE_ITEM_TRIGGERS:
case TBAR_MODE_ITEM_KEYS:
case TBAR_MODE_ITEM_RANDOMITEM:
//Set up the items by type.
InitEditorItemsInfo(iEditorToolbarState);
if( gubCurrMercMode != MERC_GETITEMMODE )
+1
View File
@@ -619,6 +619,7 @@ extern OBJECTTYPE gTempObject;
#define IC_MISC 0x10000000
#define IC_MONEY 0x20000000
#define IC_RANDOMITEM 0x40000000 // added by Flugente for random items
// PARENT TYPES
#define IC_WEAPON ( IC_GUN | IC_BLADE | IC_THROWING_KNIFE | IC_LAUNCHER | IC_TENTACLES )
+8 -5
View File
@@ -7661,10 +7661,13 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
return( FALSE );
}
// Flugente: random items
UINT16 newitemfromrandom = 0;
if ( GetItemFromRandomItem(usItem, &newitemfromrandom) )
usItem = newitemfromrandom;
// Flugente: random items - not while editing!
if ( guiCurrentScreen != EDIT_SCREEN )
{
UINT16 newitemfromrandom = 0;
if ( GetItemFromRandomItem(usItem, &newitemfromrandom) )
usItem = newitemfromrandom;
}
if (usItem == 0)
{
@@ -14735,7 +14738,7 @@ BOOLEAN GetFirstClothesItemWithSpecificData( UINT16* pusItem, PaletteRepID aPalV
return( FALSE );
}
#define RANDOM_ITEM_MAX_NUMBER 200
#define RANDOM_ITEM_MAX_NUMBER 1000
#define RANDOM_TABOO_MAX 50
#define RANDOM_XML_LENGTH 10
+2 -2
View File
@@ -4447,7 +4447,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
else if ( fAlt )
{
// Flugente: spawn items while debugging
if ( gusSelectedSoldier != NOBODY )
/*if ( gusSelectedSoldier != NOBODY )
{
static UINT16 usitem = 1623;
static INT16 status = 100;
@@ -4465,7 +4465,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( !AutoPlaceObject( MercPtrs[ gusSelectedSoldier ], &newobj, FALSE ) )
AddItemToPool( MercPtrs[ gusSelectedSoldier ]->sGridNo, &newobj, 1, 0, 0, -1 );
}
}*/
}
else
{
+2 -1
View File
@@ -453,7 +453,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -463,6 +463,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd",
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -454,7 +454,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -464,6 +464,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd",
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -453,7 +453,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -463,6 +463,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd",
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -453,7 +453,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Armes", //0
L"Arm.", //0
L"Munitions",
L"Armures",
L"LBE",
@@ -463,6 +463,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Détentes",
L"Clés",
L"Rnd", // TODO.Translate
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -477,7 +477,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -487,6 +487,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd", // TODO.Translate
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -452,7 +452,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -462,6 +462,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd", // TODO.Translate
};
STR16 iEditorMapInfoToolbarText[] =
+1
View File
@@ -469,6 +469,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Włączniki",
L"Klucze",
L"Rnd", // TODO.Translate
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -454,7 +454,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -464,6 +464,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd", // TODO.Translate
};
STR16 iEditorMapInfoToolbarText[] =
+2 -1
View File
@@ -452,7 +452,7 @@ STR16 iEditorBuildingsToolbarText[] =
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Wpns", //0
L"Ammo",
L"Armour",
L"LBE",
@@ -462,6 +462,7 @@ STR16 iEditorItemsToolbarText[] =
L"E3",
L"Triggers",
L"Keys",
L"Rnd", // TODO.Translate
};
STR16 iEditorMapInfoToolbarText[] =