HAM5.5b2 merged in!

Notes:
-There may still be bugs!! (In fact, I almost guarantee it -- there's
-Ammo box code added to HR's crate code
-Splitting a crate/box also automatically refills half empty magazines
-new pathing arrows for map screen not included
-code for scouts to know where enemies are going doesn't appear to work... but i'm not sure it was completed.
-lots of gobledy gook (chinese?) comments turned back to english
-also added Bob's popups
-other languages besides english still need to have there language.cpp files updated with array changes
-AI enhancements by Warmsteel (reloading, suppression, roaming, avoiding gas, and other fixes)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5181 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2012-04-10 23:45:46 +00:00
parent ab3412e5ed
commit c845f9f117
72 changed files with 10737 additions and 2362 deletions
+1 -1
View File
@@ -345,7 +345,7 @@ bool Loc::ExportStrings()
ExportSection(props, L"TooltipStrings", Loc::gzTooltipStrings, 0, TEXT_NUM_STR_TT);
ExportSection(props, L"New113Message", Loc::New113Message, 0, TEXT_NUM_MSG113);
ExportSection(props, L"New113HAMMessage", Loc::New113HAMMessage, 0, 22);
ExportSection(props, L"New113HAMMessage", Loc::New113HAMMessage, 0, 25);
ExportSection(props, L"New113MERCMercMail", Loc::New113MERCMercMailTexts, 0, 4);
ExportSection(props, L"New113AIMMercMail", Loc::New113AIMMercMailTexts, 0, 16);
ExportSection(props, L"MissingIMPSkills", Loc::MissingIMPSkillsDescriptions, 0, 2);
+2 -2
View File
@@ -7,8 +7,8 @@
#include "WCheck.h"
#include "Render Dirty.h"
#define MAX_POPUP_BOX_COUNT 20
#define MAX_POPUP_BOX_STRING_COUNT 50 // worst case = 45: move menu with 20 soldiers, each on different squad + overhead
#define MAX_POPUP_BOX_COUNT 32
#define MAX_POPUP_BOX_STRING_COUNT 128 // worst case = 45: move menu with 20 soldiers, each on different squad + overhead
// PopUpBox Flags
#define POPUP_BOX_FLAG_CLIP_TEXT 1
+10 -4
View File
@@ -322,6 +322,10 @@ extern STR16 gzFacilityRiskResultStrings[];
// HEADROCK HAM 4: Text for the new CTH indicator.
extern STR16 gzNCTHlabels[];
// HEADROCK HAM 5: Messages for automatic sector inventory sorting.
extern STR16 gzMapInventorySortingMessage[];
extern STR16 gzMapInventoryFilterOptions[];
enum
{
ANTIHACKERSTR_EXITGAME,
@@ -624,14 +628,14 @@ extern STR16 gzUDBButtonTooltipText[ 3 ];
extern STR16 gzUDBHeaderTooltipText[ 4 ];
extern STR16 gzUDBGenIndexTooltipText[ 4 ];
extern STR16 gzUDBAdvIndexTooltipText[ 5 ];
extern STR16 szUDBGenWeaponsStatsTooltipText[ 22 ];
extern STR16 szUDBGenWeaponsStatsExplanationsTooltipText[ 22 ];
extern STR16 szUDBGenWeaponsStatsTooltipText[ 23 ];
extern STR16 szUDBGenWeaponsStatsExplanationsTooltipText[ 23 ];
extern STR16 szUDBGenArmorStatsTooltipText[ 3 ];
extern STR16 szUDBGenArmorStatsExplanationsTooltipText[ 3 ];
extern STR16 szUDBGenAmmoStatsTooltipText[ 4 ]; // Flugente Overheating Weapons: 3->4
extern STR16 szUDBGenAmmoStatsExplanationsTooltipText[ 4 ];
extern STR16 szUDBGenExplosiveStatsTooltipText[ 18 ];
extern STR16 szUDBGenExplosiveStatsExplanationsTooltipText[ 18 ];
extern STR16 szUDBGenExplosiveStatsTooltipText[ 22 ];
extern STR16 szUDBGenExplosiveStatsExplanationsTooltipText[ 22 ];
extern STR16 szUDBGenSecondaryStatsTooltipText[ 26 ];
extern STR16 szUDBGenSecondaryStatsExplanationsTooltipText[ 26 ];
extern STR16 szUDBAdvStatsTooltipText[ 56 ]; // Flugente Overheating Weapons: 48->56
@@ -2101,6 +2105,8 @@ enum
TEXT_NUM_MSG113,
};
extern STR16 gzTransformationMessage[];
//CHRISL: NewInv messages
extern STR16 NewInvMessage[];
+2
View File
@@ -48,6 +48,7 @@
<ClInclude Include="PopUpBox.h" />
<ClInclude Include="popup_callback.h" />
<ClInclude Include="popup_class.h" />
<ClInclude Include="popup_definition.h" />
<ClInclude Include="Quantize Wrap.h" />
<ClInclude Include="Quantize.h" />
<ClInclude Include="Slider.h" />
@@ -98,6 +99,7 @@
<ClCompile Include="Music Control.cpp" />
<ClCompile Include="PopUpBox.cpp" />
<ClCompile Include="popup_class.cpp" />
<ClCompile Include="popup_definition.cpp" />
<ClCompile Include="Quantize Wrap.cpp" />
<ClCompile Include="Quantize.cpp" />
<ClCompile Include="Slider.cpp" />
+6
View File
@@ -159,6 +159,9 @@
<ClInclude Include="KeyMap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="popup_definition.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="_ChineseText.cpp">
@@ -338,5 +341,8 @@
<ClCompile Include="KeyMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="popup_definition.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+97 -24
View File
@@ -870,7 +870,7 @@ STR16 pPasteMercPlacementText[] =
{
L"Placement not pasted as no placement is saved in buffer.",
L"Placement pasted.",
L"Placement not pasted as the maximum number of placements for this team is reached.",
L"Placement not pasted as the maximum number of placements for this team has been reached.",
};
//editscreen.cpp
@@ -2471,11 +2471,13 @@ CHAR16 gWeaponStatsDesc[][ 17 ] =
// HEADROCK: Several arrays of tooltip text for new Extended Description Box
// Please note, several of these are artificially inflated to 19 entries to help fix a complication with
// changing item type while watching its description box
// HEADROCK HAM 5: Apparently this isn't used anymore... see the next array.
STR16 gzWeaponStatsFasthelp[ 32 ] =
{
L"Accuracy",
L"Damage",
L"Range",
L"", //3
L"Aiming Levels",
L"Aiming Modifier",
L"Average Best Laser Range",
@@ -2485,7 +2487,6 @@ STR16 gzWeaponStatsFasthelp[ 32 ] =
L"Repair Ease",
L"Min. Range for Aiming Bonus",
L"To-Hit Modifier",
L"", //12
L"APs to ready",
L"APs to fire Single",
L"APs to fire Burst",
@@ -2509,18 +2510,18 @@ STR16 gzWeaponStatsFasthelp[ 32 ] =
STR16 gzWeaponStatsFasthelpTactical[ 32 ] =
{
L"Accuracy",
L"Damage",
L"Range",
L"Aiming Levels",
L"Aiming Modifier",
L"Average Best Laser Range",
L"Flash Suppression",
L"Loudness (lower is better)",
L"Reliability",
L"Repair Ease",
L"Min. Range for Aiming Bonus",
L"To-Hit Modifier",
L"|R|a|n|g|e\n \nThe effective range of this weapon. Attacking from\nbeyond this range will lead to massive penalties.\n \nHigher is better.",
L"|D|a|m|a|g|e\n \nThis is the damage potential of the weapon.\nIt will usually deliver this much damage\n(or close to it) to any unprotected target.\n \nHigher is better.",
L"|A|c|c|u|r|a|c|y\n \nThis is an innate Chance-to-Hit Bonus (or\npenalty!) given by this gun due to its\nparticular good (or bad) design.\n \nHigher is better.",
L"|A|i|m|i|n|g |L|e|v|e|l|s\n \nThis is the maximum number of aiming clicks allowed\nwhen using this gun.\n \nEach aiming-click will make an attack more\naccurate.\n \nHigher is better.",
L"|A|i|m|i|n|g |M|o|d|i|f|i|e|r\n \nA flat modifier, which alters the effectiveness\nof each aiming click you make while using this\nweapon.\n \nHigher is better.",
L"|M|i|n|. |R|a|n|g|e |f|o|r |A|i|m|i|n|g |B|o|n|u|s\n \nThe minimum range-to-target required before this\nweapon can make use of its Aiming Modifier.\n \nIf the target is closer than this many tiles,\naiming clicks will stay at their default\neffectiveness.\n \nLower is better.",
L"|T|o|-|H|i|t |M|o|d|i|f|i|e|r\n \nA flat modifier to Chance-to-Hit with any\nattack made using this weapon.\n \nHigher is better.",
L"|B|e|s|t |L|a|s|e|r |R|a|n|g|e\n \nThe range (in tiles) at which the laser installed\non this weapon will be at its full effectiveness.\n \nWhen attacking a target beyond this range, the\nlaser will provide a smaller bonus or none at all.\n \nHigher is better.",
L"|F|l|a|s|h |S|u|p|p|r|e|s|s|i|o|n\n \nWhen this icon appears, it means that the gun\ndoes not make a flash when it fires. This helps the\nshooter remain concealed.",
L"|L|o|u|d|n|e|s|s\n \nAttacks made with this weapon can be heard up to\nthe listed distance (in tiles).\n \nLower is better.\n(unless deliberately trying to draw in enemies...)",
L"|R|e|l|i|a|b|i|l|i|t|y\n \nThis value indicates (in general) how quickly\nthis weapon will degrade when used in combat.\n \nHigher is better.",
L"|R|e|p|a|i|r |E|a|s|e\n \nThis value indicates how quickly this weapon can\nbe repaired (by a mercenary set to Repair duty).\n \nHigher is better.",
L"", //12
L"APs to ready",
L"APs to fire Single",
@@ -3188,6 +3189,23 @@ STR16 pMapScreenInvenButtonHelpText[] =
L"Next (|.)", // next page
L"Previous (|,)", // previous page
L"Exit Sector Inventory (|E|s|c)", // exit sector inventory
L"Zoom Inventory", // HEAROCK HAM 5: Inventory Zoom Button
L"Stack and merge items", // HEADROCK HAM 5: Stack and Merge
L"|L|e|f|t |C|l|i|c|k: Sort ammo into crates; |R|i|g|h|t |C|l|i|c|k: Sort ammo into boxes", // HEADROCK HAM 5: Sort ammo
// 6 - 10
L"Remove all item attachments", // HEADROCK HAM 5: Separate Attachments
L"Eject ammo from all weapons", //HEADROCK HAM 5: Eject Ammo
L"|L|e|f|t |C|l|i|c|k: Show all items; |R|i|g|h|t |C|l|i|c|k: Hide all items", // HEADROCK HAM 5: Filter Button
L"|L|e|f|t |C|l|i|c|k: Toggle Guns; |R|i|g|h|t |C|l|i|c|k|: Show only Guns", // HEADROCK HAM 5: Filter Button
L"|L|e|f|t |C|l|i|c|k: Toggle Ammunition; |R|i|g|h|t |C|l|i|c|k: Show only Ammunition", // HEADROCK HAM 5: Filter Button
// 11 - 15
L"|L|e|f|t |C|l|i|c|k: Toggle Explosives; |R|i|g|h|t |C|l|i|c|k: Show only Explosives", // HEADROCK HAM 5: Filter Button
L"|L|e|f|t |C|l|i|c|k: Toggle Melee Weapons; |R|i|g|h|t |C|l|i|c|k: Show only Melee Weapons", // HEADROCK HAM 5: Filter Button
L"|L|e|f|t |C|l|i|c|k: Toggle Armor; |R|i|g|h|t |C|l|i|c|k: Show only Armor", // HEADROCK HAM 5: Filter Button
L"|L|e|f|t |C|l|i|c|k: Toggle LBEs; |R|i|g|h|t |C|l|i|c|k: Show only LBEs", // HEADROCK HAM 5: Filter Button
L"|L|e|f|t |C|l|i|c|k: Toggle Kits; |R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button
// 16 - 20
L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items; |R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button
};
STR16 pMapScreenBottomFastHelp[] =
@@ -6121,7 +6139,26 @@ STR16 New113HAMMessage[] =
L"Daily Expenses",
// 21 - 25
L"Insufficient funds to pay all enlisted militia! %d militia have disbanded and returned home.",
L"To examine an item's stats during combat, you must pick it up manually first.", // HAM 5
L"To attach an item to another item during combat, you must pick them both up first.", // HAM 5
L"To merge two items during combat, you must pick them both up first.", // HAM 5
};
// HEADROCK HAM 5: Text dealing exclusively with Item Transformations.
STR16 gzTransformationMessage[] =
{
L"No available adjustments",
L"%s was split into several parts.",
L"%s was split into several parts. Check %s's inventory for the resulting items.",
L"Due to lack of inventory space after transformation, some of %s's items have been dropped to the ground.",
L"%s was split into several parts. Due to a lack of inventory space, %s has had to drop a few items to the ground.",
L"Do you wish to adjust all %d items in this stack? (To transform only one item, remove it from the stack first)",
// 6 - 10
L"Split Crate into Inventory",
L"Split into %d-rd Mags",
L"%s was split into %d Magazines containing %d rounds each.",
L"%s was split into %s's inventory.",
L"There is insufficient room in %s's inventory to fit any magazines of this caliber!",
};
// WANNE: This hardcoded text should not be used anymore in the game, because we now have those texts externalized in the "TableData\Email\EmailMercLevelUp.xml" file!
@@ -6790,6 +6827,7 @@ STR16 szUDBGenWeaponsStatsTooltipText[]=
L"|A|c|c|u|r|a|c|y",
L"|D|a|m|a|g|e",
L"|R|a|n|g|e",
L"|H|a|n|d|l|i|n|g |D|i|f|f|i|c|u|l|t|y",
L"|A|l|l|o|w|e|d |A|i|m|i|n|g |L|e|v|e|l|s",
L"|S|c|o|p|e |M|a|g|n|i|f|i|c|a|t|i|o|n |F|a|c|t|o|r",
L"|P|r|o|j|e|c|t|i|o|n |F|a|c|t|o|r",
@@ -6799,15 +6837,14 @@ STR16 szUDBGenWeaponsStatsTooltipText[]=
L"|R|e|p|a|i|r |E|a|s|e",
L"|M|i|n|. |R|a|n|g|e |f|o|r |A|i|m|i|n|g |B|o|n|u|s",
L"|T|o|-|H|i|t |M|o|d|i|f|i|e|r",
L"", // (12)
L"|A|P|s |t|o |R|e|a|d|y",
L"|A|P|s |t|o |A|t|t|a|c|k",
L"|A|P|s |t|o |B|u|r|s|t",
L"|A|P|s |t|o |A|u|t|o|f|i|r|e",
L"|A|P|s |t|o |R|e|l|o|a|d",
L"|A|P|s |t|o |R|e|c|h|a|m|b|e|r",
L"|L|a|t|e|r|a|l |R|e|c|o|i|l",
L"|V|e|r|t|i|c|a|l |R|e|c|o|i|l",
L"|L|a|t|e|r|a|l |R|e|c|o|i|l", // No longer used
L"|T|o|t|a|l |R|e|c|o|i|l",
L"|A|u|t|o|f|i|r|e |B|u|l|l|e|t|s |p|e|r |5 |A|P|s",
};
@@ -6816,6 +6853,7 @@ STR16 szUDBGenWeaponsStatsExplanationsTooltipText[]=
L"\n \nDetermines whether bullets fired by\nthis gun will stray far from where\nit is pointed.\n \nScale: 0-100.\nHigher is better.",
L"\n \nDetermines the average amount of damage done\nby bullets fired from this weapon, before\ntaking into account armor or armor-penetration.\n \nHigher is better.",
L"\n \nThe maximum distance (in tiles) that\nbullets fired from this gun will travel\nbefore they begin dropping towards the\nground.\n \nHigher is better.",
L"\n \nDetermines the difficulty of holding and firing\nthis gun.\n \nHigher Handling Difficulty results in lower\nchance-to-hit - when aimed and especially when\nunaimed.\n \nLower is better.",
L"\n \nThis is the number of Extra Aiming\nLevels you can add when aiming this gun.\n \nThe FEWER aiming levels are allowed, the MORE\nbonus each aiming level gives you. Therefore,\nhaving FEWER levels makes the gun faster to aim,\nwithout making it any less accurate.\n \nLower is better.",
L"\n \nWhen greater than 1.0, will proportionally reduce\naiming errors at a distance.\n \nRemember that high scope magnification is detrimental\nwhen the target is too close!\n \nA value of 1.0 means no scope is installed.",
L"\n \nProportionally reduces aiming errors at a distance.\n \nThis effect works up to a given distance,\nthen begins to dissipate and eventually\ndisappears at sufficient range.\n \nHigher is better.",
@@ -6825,15 +6863,14 @@ STR16 szUDBGenWeaponsStatsExplanationsTooltipText[]=
L"\n \nDetermines how difficult it is to repair this weapon.\n \nHigher is better.",
L"\n \nThe minimum range at which a scope can provide it's aimBonus.",
L"\n \nTo hit modifier granted by laser sights.",
L"", // (12)
L"\n \nThe number of APs required to bring this\nweapon up to firing stance.\n \nOnce the weapon is raised, you may fire repeatedly\nwithout paying this cost again.\n \nA weapon is automatically 'Unreadied' if its\nwielder performs any action other than\nfiring or turning.\n \nLower is better.",
L"\n \nThe number of APs required to perform\na single attack with this weapon.\n \nFor guns, this is the cost of firing\na single shot without extra aiming.\n \nIf this icon is greyed-out, single-shots\n are not possible with this weapon.\n \nLower is better.",
L"\n \nThe number of APs required to fire\na burst.\n \nThe number of bullets fired in each burst is\ndetermined by the weapon itself, and indicated\nby the number of bullets shown on this icon.\n \nIf this icon is greyed-out, burst fire\nis not possible with this weapon.\n \nLower is better.",
L"\n \nThe number of APs required to fire\nan Autofire Volley of three bullets.\n \nIf you wish to fire more than 3 bullets,\nyou will need to pay extra APs.\n \nIf this icon is greyed-out, autofire\nis not possible with this weapon.\n \nLower is better.",
L"\n \nThe number of APs required to reload\nthis weapon.\n \nLower is better.",
L"\n \nThe number of APs required to rechamber this weapon\nbetween each and every shot fired.\n \nLower is better.",
L"\n \nThe distance this weapon's muzzle will shift\nhorizontally between each and every bullet in a\nburst or autofire volley.\n \nPositive numbers indicate shifting to the right.\nNegative numbers indicate shifting to the left.\n \nCloser to 0 is better.",
L"\n \nThe distance this weapon's muzzle will shift\nvertically between each and every bullet in a\nburst or autofire volley.\n \nPositive numbers indicate shifting upwards.\nNegative numbers indicate shifting downwards.\n \nCloser to 0 is better.",
L"\n \nThe distance this weapon's muzzle will shift\nhorizontally between each and every bullet in a\nburst or autofire volley.\n \nPositive numbers indicate shifting to the right.\nNegative numbers indicate shifting to the left.\n \nCloser to 0 is better.", // No longer used
L"\n \nThe total distance this weapon's muzzle will shift\nbetween each and every bullet in a burst or\nautofire volley, if no Counter Force is applied.\n \nLower is better.", // HEADROCK HAM 5: Altered to reflect unified number.
L"\n \nIndicates the number of bullets that will be added\nto an autofire volley for every extra 5 APs\nyou spend.\n \nHigher is better.",
};
@@ -6871,6 +6908,7 @@ STR16 szUDBGenExplosiveStatsTooltipText[]=
{
L"|D|a|m|a|g|e",
L"|S|t|u|n |D|a|m|a|g|e",
L"|E|x|p|l|o|d|e|s |o|n| |I|m|p|a|c|t", // HEADROCK HAM 5
L"|B|l|a|s|t |R|a|d|i|u|s",
L"|S|t|u|n |B|l|a|s|t |R|a|d|i|u|s",
L"|N|o|i|s|e |B|l|a|s|t |R|a|d|i|u|s",
@@ -6885,6 +6923,11 @@ STR16 szUDBGenExplosiveStatsTooltipText[]=
L"|S|m|o|k|e |E|n|d |R|a|d|i|u|s",
L"|I|n|c|e|n|d|i|a|r|y |E|n|d |R|a|d|i|u|s",
L"|E|f|f|e|c|t |D|u|r|a|t|i|o|n",
// HEADROCK HAM 5: Fragmentation
L"|N|u|m|b|e|r |o|f |F|r|a|g|m|e|n|t|s",
L"|D|a|m|a|g|e |p|e|r |F|r|a|g|m|e|n|t",
L"|F|r|a|g|m|e|n|t |R|a|n|g|e",
// HEADROCK HAM 5: End Fragmentations
L"|L|o|u|d|n|e|s|s",
L"|V|o|l|a|t|i|l|i|t|y",
};
@@ -6893,6 +6936,7 @@ STR16 szUDBGenExplosiveStatsExplanationsTooltipText[]=
{
L"\n \nThe amount of damage caused by this explosive.\n \nNote that blast-type explosives deliver this damage\nonly once (when they go off), while prolonged effect\nexplosives deliver this amount of damage every turn until the\neffect dissipates.\n \nHigher is better.",
L"\n \nThe amount of non-lethal (stun) damage caused\nby this explosive.\n \nNote that blast-type explosives deliver their damage\nonly once (when they go off), while prolonged effect\nexplosives deliver this amount of stun damage every\nturn until the effect dissipates.\n \nHigher is better.",
L"\n \nThis explosive will not bounce around -\nit will explode as soon as it hits any obstacle.", // HEADROCK HAM 5
L"\n \nThis is the radius of the explosive blast caused by\nthis explosive item.\n \nTargets will suffer less damage the further they are\nfrom the center of the explosion.\n \nHigher is better.",
L"\n \nThis is the radius of the stun-blast caused by\nthis explosive item.\n \nTargets will suffer less damage the further they are\nfrom the center of the blast.\n \nHigher is better.",
L"\n \nThis is the distance that the noise from this\ntrap will travel. Soldiers within this distance\nare likely to hear the noise and be alerted.\n \nHigher is better.",
@@ -6907,8 +6951,14 @@ STR16 szUDBGenExplosiveStatsExplanationsTooltipText[]=
L"\n \nThis is the final radius of the smoke released\nby this explosive item before it dissipates.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn\n(if any), unless wearing a gas mask. More importantly,\nanyone inside the cloud becomes extremely difficult to spot,\nand also loses a large chunk of sight-range themselves.\n \nAlso note the start radius and duration\nof the effect.\n \nHigher is better.",
L"\n \nThis is the final radius of the flames caused\nby this explosive item before they dissipate.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn.\n \nAlso note the start radius and duration of the effect.\n \nHigher is better.",
L"\n \nThis is the duration of the explosive effect.\n \nEach turn, the radius of the effect will grow by\none tile in every direction, until reaching\nthe listed End Radius.\n \nOnce the duration has been reached, the effect\ndissipates completely.\n \nNote that light-type explosives become SMALLER\nover time, unlike other effects.\n \nHigher is better.",
// HEADROCK HAM 5: Fragmentation
L"\n \nThis is the number of fragments that will\nbe ejected from the explosion.\n \nFragments are similar to bullets, and may hit\nanyone who's close enough to the explosion.\n \nHigher is better.",
L"\n \nThe potential amount of damage caused by each\nfragment ejected from the explosion.\n \nHigher is better.",
L"\n \nThis is the average range to which fragments\nfrom this explosion will fly.\n \nSome fragments may end up further away, or fail\nto cover the distance altogether.\n \nHigher is better.",
// HEADROCK HAM 5: End Fragmentations
L"\n \nThis is the distance (in Tiles) within which\nsoldiers and mercs will hear the explosion when\nit goes off.\n \nEnemies hearing the explosion will be alerted to your\npresence.\n \nLower is better.",
L"\n \nThis value represents a chance (out of 100) for this\nexplosive to spontaneously explode whenever it is damaged\n(for instance, when other explosions go off nearby).\n \nCarrying highly-volatile explosives into combat\nis therefore extremely risky and should be avoided.\n \nScale: 0-100.\nLower is better.",
};
STR16 szUDBGenSecondaryStatsTooltipText[]=
@@ -7025,10 +7075,10 @@ STR16 szUDBAdvStatsTooltipText[]=
L"|C|o|o|l|d|o|w|n |F|a|c|t|o|r",
L"|J|a|m |T|r|e|s|h|o|l|d",
L"|D|a|m|a|g|e |T|r|e|s|h|o|l|d",
L"|T|e|m|p|e|r|a|t|u|r|e |M|o|d|i|f|i|c|a|t|o|r",
L"|C|o|o|l|d|o|w|n |M|o|d|i|f|i|c|a|t|o|r",
L"|J|a|m |T|r|e|s|h|o|l|d |M|o|d|i|f|i|c|a|t|o|r",
L"|D|a|m|a|g|e |T|r|e|s|h|o|l|d |M|o|d|i|f|i|c|a|t|o|r",
L"|T|e|m|p|e|r|a|t|u|r|e |M|o|d|i|f|i|e|r",
L"|C|o|o|l|d|o|w|n |M|o|d|i|f|i|e|r",
L"|J|a|m |T|h|r|e|s|h|o|l|d |M|o|d|i|f|i|e|r",
L"|D|a|m|a|g|e |T|h|r|e|s|h|o|l|d |M|o|d|i|f|i|e|r",
};
// Alternate tooltip text for weapon Advanced Stats. Just different wording, nothing spectacular.
@@ -7158,6 +7208,29 @@ STR16 gzNCTHlabels[]=
// HEADROCK HAM 4: End new UDB texts and tooltips
//////////////////////////////////////////////////////
// HEADROCK HAM 5: Screen messages for sector inventory sorting reports.
STR16 gzMapInventorySortingMessage[] =
{
L"Finished sorting ammo into crates in sector %c%d.",
L"Finished removing attachments from items in sector %c%d.",
L"Finished ejecting ammo from weapons in sector %c%d.",
L"Finished stacking and merging all items in sector %c%d.",
};
STR16 gzMapInventoryFilterOptions[] =
{
L"Show all",
L"Guns",
L"Ammo",
L"Explosives",
L"Melee Weapons",
L"Armor",
L"LBE",
L"Kits",
L"Misc. Items",
L"Hide all",
};
// Flugente FTW 1: Temperature-based text similar to HAM 4's condition-based text.
STR16 gTemperatureDesc[] =
{
+169
View File
@@ -1,9 +1,12 @@
#ifndef POPUP_CALLBACK_CLASS
#define POPUP_CALLBACK_CLASS
#include "sgp.h"
class popupCallback;
template <typename R, typename P1> class popupCallbackFunction;
template <typename R, typename P1, typename P2> class popupCallbackFunction2;
class popupCallback{
public:
@@ -14,6 +17,172 @@
virtual bool call(void) = 0;
};
// returns something, takes three parameters
template<typename R,typename P1,typename P2,typename P3>
class popupCallbackFunction3: public popupCallback{
protected:
R (*fun)(P1,P2,P3);
P1 param_1;
P2 param_2;
P3 param_3;
public:
popupCallbackFunction3(void);
popupCallbackFunction3(void * newFun, P1 param, P2 param2, P3 param3);
virtual void bind(void * newFun);
virtual bool call(void);
};
template<typename R,typename P1,typename P2,typename P3>
popupCallbackFunction3<R,P1,P2,P3>::popupCallbackFunction3(void){
this->fun = 0;
this->param_1 = P1();
this->param_2 = P2();
this->param_3 = P3();
};
template<typename R,typename P1,typename P2,typename P3>
popupCallbackFunction3<R,P1,P2,P3>::popupCallbackFunction3(void * newFun, P1 param, P2 param2, P3 param3){
this->fun = static_cast< R(*)(P1,P2,P3)>(newFun);
this->param_1 = param;
this->param_2 = param2;
this->param_3 = param3;
};
template<typename R,typename P1,typename P2,typename P3>
void popupCallbackFunction3<R,P1,P2,P3>::bind(void * newFun){
this->fun = static_cast< R(*)(P1,P2,P3)>(newFun);
};
template<typename R,typename P1,typename P2,typename P3>
bool popupCallbackFunction3<R,P1,P2,P3>::call(void){
return (bool)(this->fun)(this->param_1,this->param_2,this->param_3);
};
// three params, no return val
template<typename P1,typename P2,typename P3>
class popupCallbackFunction3<void,typename P1,typename P2,typename P3>: public popupCallback{
protected:
void (*fun)(P1,P2,P3);
P1 param_1;
P2 param_2;
P3 param_3;
public:
popupCallbackFunction3(void);
popupCallbackFunction3(void * newFun, P1 param, P2 param2, P3 param3);
virtual void bind(void * newFun);
virtual bool call(void);
};
template<typename P1,typename P2,typename P3>
popupCallbackFunction3<void,P1,P2,P3>::popupCallbackFunction3(void){
this->fun = 0;
this->param_1 = P1();
this->param_2 = P2();
this->param_3 = P3();
};
template<typename P1,typename P2,typename P3>
popupCallbackFunction3<void,P1,P2,P3>::popupCallbackFunction3(void * newFun, P1 param, P2 param2, P3 param3){
this->fun = static_cast< void(*)(P1,P2,P3)>(newFun);
this->param_1 = param;
this->param_2 = param2;
this->param_3 = param3;
};
template<typename P1,typename P2,typename P3>
void popupCallbackFunction3<void,P1,P2,P3>::bind(void * newFun){
this->fun = static_cast< void(*)(P1,P2,P3)>(newFun);
};
template<typename P1,typename P2,typename P3>
bool popupCallbackFunction3<void,P1,P2,P3>::call(void){
(this->fun)(this->param_1,this->param_2,this->param_3);
return 1;
};
// returns something, takes two parameters
template<typename R,typename P1,typename P2>
class popupCallbackFunction2: public popupCallback{
protected:
R (*fun)(P1,P2);
P1 param_1;
P2 param_2;
public:
popupCallbackFunction2(void);
popupCallbackFunction2(void * newFun, P1 param, P2 param2);
virtual void bind(void * newFun);
virtual bool call(void);
};
template<typename R,typename P1,typename P2>
popupCallbackFunction2<R,P1,P2>::popupCallbackFunction2(void){
this->fun = 0;
this->param_1 = P1();
this->param_2 = P2();
};
template<typename R,typename P1,typename P2>
popupCallbackFunction2<R,P1,P2>::popupCallbackFunction2(void * newFun, P1 param, P2 param2){
this->fun = static_cast< R(*)(P1,P2)>(newFun);
this->param_1 = param;
this->param_2 = param2;
};
template<typename R,typename P1,typename P2>
void popupCallbackFunction2<R,P1,P2>::bind(void * newFun){
this->fun = static_cast< R(*)(P1,P2)>(newFun);
};
template<typename R,typename P1,typename P2>
bool popupCallbackFunction2<R,P1,P2>::call(void){
return (bool)(this->fun)(this->param_1,this->param_2);
};
// two params, no return val
template<typename P1,typename P2>
class popupCallbackFunction2<void, typename P1,typename P2>: public popupCallback{
protected:
void (*fun)(P1,P2);
P1 param_1;
P2 param_2;
public:
popupCallbackFunction2(void);
popupCallbackFunction2(void * newFun, P1 param, P2 param2);
virtual void bind(void * newFun);
virtual bool call(void);
};
template<typename P1,typename P2>
popupCallbackFunction2<void,P1,P2>::popupCallbackFunction2(void){
this->fun = 0;
this->param_1 = P1();
this->param_2 = P2();
};
template<typename P1,typename P2>
popupCallbackFunction2<void,P1,P2>::popupCallbackFunction2(void * newFun, P1 param, P2 param2){
this->fun = static_cast< void(*)(P1,P2)>(newFun);
this->param_1 = param;
this->param_2 = param2;
};
template<typename P1,typename P2>
void popupCallbackFunction2<void,P1,P2>::bind(void * newFun){
this->fun = static_cast< void(*)(P1,P2)>(newFun);
};
template<typename P1,typename P2>
bool popupCallbackFunction2<void,P1,P2>::call(void){
(this->fun)(this->param_1,this->param_2);
return 1;
};
// returns something, takes one parameter
template <typename R, typename P1>
class popupCallbackFunction : public popupCallback{
protected:
+222 -23
View File
@@ -119,6 +119,18 @@ POPUP_OPTION::POPUP_OPTION(void)
this->action = 0;
this->avail = 0;
this->hover = 0;
// set highlight color
this->color_highlight = FONT_WHITE;
// unhighlighted color
this->color_foreground = FONT_LTGREEN;
// background color
this->color_background = FONT_BLACK;
// shaded color..for darkened text
this->color_shade = FONT_GRAY7 ;
}
POPUP_OPTION::~POPUP_OPTION(void)
@@ -136,11 +148,23 @@ POPUP_OPTION::POPUP_OPTION(std::wstring *newName, popupCallback * newFunction)
this->action = newFunction;
this->avail = 0;
this->hover = 0;
// set highlight color
this->color_highlight = FONT_WHITE;
// unhighlighted color
this->color_foreground = FONT_LTGREEN;
// background color
this->color_background = FONT_BLACK;
// shaded color..for darkened text
this->color_shade = FONT_GRAY7 ;
}
BOOLEAN POPUP_OPTION::setName( WCHAR* newName )
BOOLEAN POPUP_OPTION::setName( std::wstring * newName )
{
this->name = newName;
this->name = *newName;
return TRUE;
}
@@ -170,6 +194,8 @@ BOOLEAN POPUP_OPTION::checkAvailability()
{
if (this->avail != 0)
return ( this->avail->call() == true );
else if ( this->action == 0 ) // options with no action are always shaded
return false;
else
return true;
}
@@ -211,12 +237,19 @@ BOOLEAN POPUP_OPTION::forceRun()
//////////////////////////////////////////////////////////////////
// constructor
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION()
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(new wstring(L"Unnamed subPopup"),NULL) //TODO: possible memmory leak!
{
this->parent = NULL;
this->initSubPopup();
}
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* newName, const POPUP * parent) : POPUP_OPTION(newName, 0)
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* name) : POPUP_OPTION(name, NULL)
{
this->parent = NULL;
this->initSubPopup();
}
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* newName, const POPUP * parent) : POPUP_OPTION(newName, NULL)
{
this->parent = parent;
this->initSubPopup();
@@ -230,10 +263,13 @@ POPUP_SUB_POPUP_OPTION::~POPUP_SUB_POPUP_OPTION(void)
void POPUP_SUB_POPUP_OPTION::showPopup()
{
// check if it's available at this time
if ( this->checkAvailability() )
// check if it's available at this time, if there is an avail function set
if ( !this->AvailabilityFunctionSet() || this->checkAvailability() )
{
if (!this->customPositionSet) this->positionSubPopup();
if (!this->customPositionSet || this->customRule == POPUP_POSITION_RELATIVE) {
this->positionSubPopup();
}
this->subPopup->show();
}
}
@@ -247,10 +283,14 @@ void POPUP_SUB_POPUP_OPTION::positionSubPopup()
{
INT16 x,y;
// x = this->parent->Position.iX + this->parent->Dimensions.iLeft + this->parent->Dimensions.iRight + 10;
x = this->parent->X + this->parent->Dimensions.iLeft + this->parent->Dimensions.iRight + 10;
// y = this->parent->Position.iY + 10;
y = this->parent->Y + 10;
if( this->customPositionSet )
{
x = this->parent->X + this->parent->Dimensions.iLeft + this->parent->Dimensions.iRight + this->customX;
y = this->parent->Y + this->customY;
} else {
x = this->parent->X + this->parent->Dimensions.iLeft + this->parent->Dimensions.iRight + 10;
y = this->parent->Y + 10;
}
this->subPopup->setPosition(x,y);
}
@@ -263,20 +303,62 @@ BOOLEAN POPUP_SUB_POPUP_OPTION::run()
return TRUE;
}
BOOLEAN POPUP_SUB_POPUP_OPTION::setPopupPosition(UINT16 x, UINT16 y, UINT8 positioningRule){
BOOLEAN POPUP_SUB_POPUP_OPTION::setPopupPosition(UINT16 x, UINT16 y, INT8 positioningRule){
this->customPositionSet = true;
if (positioningRule != POPUP_POSITION_RELATIVE){
return this->subPopup->setPosition(x,y,positioningRule);
} else {
return this->subPopup->setPosition(this->parent->X + x, this->parent->Y + y,POPUP_POSITION_TOP_LEFT);
this->customX = x;
this->customY = y;
this->customRule = positioningRule;
return this->subPopup->setPosition(this->parent->X + this->parent->Dimensions.iRight + x, this->parent->Y + y,POPUP_POSITION_TOP_LEFT);
}
}
static void shadeOpenSubPopup( POPUP_SUB_POPUP_OPTION * opt ){
// make the option yellow while its open
SetCurrentBox( opt->parent->getBoxId() );
SetStringForeground( opt->stringHandle, FONT_YELLOW);
}
extern void RenderTeamRegionBackground();
static void unShadeOpenSubPopup( POPUP_SUB_POPUP_OPTION * opt ){
// restore the option's color
SetCurrentBox( opt->parent->getBoxId() );
SetStringForeground( opt->stringHandle, FONT_LTGREEN);
// if in mapscreen, redraw the UI
if( guiCurrentScreen == MAP_SCREEN ){
fTeamPanelDirty = TRUE;
fMapPanelDirty = TRUE;
RenderTeamRegionBackground();
}
}
void POPUP_SUB_POPUP_OPTION::initSubPopup()
{
this->subPopup = new POPUP( (CHAR*) wstring(this->name).c_str() );
this->subPopup->setCallback(POPUP_CALLBACK_SHOW,new popupCallbackFunction<void,POPUP_SUB_POPUP_OPTION*>( &shadeOpenSubPopup, this ));
this->subPopup->setCallback(POPUP_CALLBACK_HIDE,new popupCallbackFunction<void,POPUP_SUB_POPUP_OPTION*>( &unShadeOpenSubPopup, this ));
this->customPositionSet = false;
// set highlight color
this->color_highlight = FONT_WHITE;
// unhighlighted color
this->color_foreground = FONT_LTGREEN;
// background color
this->color_background = FONT_BLACK;
// shaded color..for darkened text
this->color_shade = FONT_GRAY7 ;
}
void POPUP_SUB_POPUP_OPTION::destroySubPopup()
@@ -508,7 +590,7 @@ BOOLEAN POPUP::addOption(POPUP_OPTION &option)
if (this->optionCount < POPUP_MAX_OPTIONS)
{
this->options.push_back( &option );
optionCount++;
this->optionCount++;
return TRUE;
}
else
@@ -536,6 +618,19 @@ POPUP * POPUP::addSubMenuOption(wstring * name)
return NULL;
}
BOOL POPUP::addSubMenuOption( POPUP_SUB_POPUP_OPTION* sub )
{
if (this->subPopupOptionCount < POPUP_MAX_SUB_POPUPS)
{
sub->parent = this;
this->subPopupOptions.push_back( sub );
this->subPopupOptionCount++;
return TRUE;
}
else
return FALSE;
}
POPUP_SUB_POPUP_OPTION * POPUP::getSubPopupOption(UINT8 n)
{
if (n < this->subPopupOptions.size() && this->subPopupOptions[n])
@@ -544,6 +639,59 @@ POPUP_SUB_POPUP_OPTION * POPUP::getSubPopupOption(UINT8 n)
return NULL;
}
void POPUP::recalculateWidth(void){
this->Dimensions.iRight = this->getCurrentWidth();
}
INT16 POPUP::getCurrentWidth(void){
INT16 longestString = 0, longestStringTmp;
CHAR16 sString[ 128 ];
if (this->subPopupOptionCount > 0)
for(std::vector<POPUP_SUB_POPUP_OPTION*>::iterator cOption=this->subPopupOptions.begin(); cOption != this->subPopupOptions.end(); ++cOption)
{
swprintf( sString, (*cOption)->name.c_str() );
longestStringTmp = StringPixLength( sString, MAP_SCREEN_FONT);
if( longestString < longestStringTmp ) longestString = longestStringTmp;
}
if (this->optionCount > 0)
for(std::vector<POPUP_OPTION*>::iterator cOption=this->options.begin(); cOption != this->options.end(); ++cOption)
{
swprintf( sString, (*cOption)->name.c_str() );
longestStringTmp = StringPixLength( sString, MAP_SCREEN_FONT);
if( longestString < longestStringTmp ) longestString = longestStringTmp;
}
return longestString + 10; // 10+ marginLeft(6) + marginRight(4)
}
INT16 POPUP::getCurrentHeight(void){
// linespace = 2; margin = 6+4
return ( this->optionCount + this->subPopupOptionCount ) * ( GetFontHeight(MAP_SCREEN_FONT) + 2 ) +10;
}
SGPRect POPUP::getBoxDimensions(){
SGPRect tmp;
GetBoxSize( this->boxId, &tmp );
return tmp;
}
SGPPoint POPUP::getBoxPosition(){
SGPPoint tmp;
GetBoxPosition( this->boxId, &tmp );
return tmp;
}
BOOLEAN POPUP::setPosition(UINT16 x, UINT16 y, UINT8 positioningRule )
{
@@ -616,6 +764,10 @@ BOOLEAN POPUP::show()
return TRUE;
}
void POPUP::hideAfter(){
this->hideAfterRun = TRUE;
}
BOOLEAN POPUP::hide()
{
if (!this->PopupVisible) {
@@ -659,12 +811,22 @@ BOOLEAN POPUP::hide()
BOOLEAN POPUP::callOption(int optIndex)
{
this->hideAfterRun = FALSE;
if ( this->optionCount > 0
&& optIndex < 32
&& optIndex < POPUP_MAX_OPTIONS
&& optIndex < optionCount
&& optIndex >= 0)
{
return this->options[optIndex]->run();
BOOLEAN callbackStatus = this->options[optIndex]->run();
if(!this->hideAfterRun)
{
return callbackStatus;
} else
{
return this->hide();
}
}
else
return FALSE;
@@ -857,6 +1019,8 @@ void POPUP::AddSubPopupStrings()
// make sure it is unhighlighted
UnHighLightLine(hStringHandle);
// update options string handle for setting colors
(*cOption)->stringHandle = hStringHandle;
}
}
@@ -874,12 +1038,15 @@ void POPUP::AddOptionStrings()
// make sure it is unhighlighted
UnHighLightLine(hStringHandle);
// update options string handle for setting colors
(*cOption)->stringHandle = hStringHandle;
}
}
void POPUP::UpdateTextProperties()
{
// set font type
SetBoxFont(this->boxId, MAP_SCREEN_FONT);
@@ -895,9 +1062,30 @@ void POPUP::UpdateTextProperties()
// shaded color..for darkened text
SetBoxShade( this->boxId, FONT_GRAY7 );
// is this for the second row ?
// alt shaded color
SetBoxSecondaryShade( this->boxId, FONT_YELLOW );
if (this->subPopupOptionCount > 0)
for(std::vector<POPUP_SUB_POPUP_OPTION*>::iterator cOption=this->subPopupOptions.begin(); cOption != this->subPopupOptions.end(); ++cOption)
{
SetStringForeground( (*cOption)->stringHandle, (*cOption)->color_foreground);
SetStringBackground( (*cOption)->stringHandle, (*cOption)->color_background);
SetStringHighLight( (*cOption)->stringHandle, (*cOption)->color_highlight);
SetStringShade( (*cOption)->stringHandle, (*cOption)->color_shade);
}
if (this->optionCount > 0)
for(std::vector<POPUP_OPTION*>::iterator cOption=this->options.begin(); cOption != this->options.end(); ++cOption)
{
SetStringForeground( (*cOption)->stringHandle, (*cOption)->color_foreground);
SetStringBackground( (*cOption)->stringHandle, (*cOption)->color_background);
SetStringHighLight( (*cOption)->stringHandle, (*cOption)->color_highlight);
SetStringShade( (*cOption)->stringHandle, (*cOption)->color_shade);
}
// resize box to text
ResizeBoxToText( this->boxId );
}
@@ -1294,6 +1482,7 @@ void POPUP::MenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason )
&& iValue >= 0
&& this->subPopupOptions[iValue] != NULL)
{
this->recalculateWidth();
this->subPopupOptions[iValue]->run();
}
}
@@ -1349,24 +1538,34 @@ void POPUP::MenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
void POPUP::HandleShadingOfLines( void )
{
UINT8 i = 0;
// check if valid
if( ( this->PopupVisible == FALSE ) || ( this->boxId == - 1 ) )
{
return;
}
//for (i=0; i < this->optionCount; i++)
UINT8 i = 0;
// subPopups with no options are shaded
for(std::vector<POPUP_SUB_POPUP_OPTION*>::iterator cOption=this->subPopupOptions.begin(); cOption != this->subPopupOptions.end(); ++cOption)
{
if ( (*cOption)->subPopup->optionCount + (*cOption)->subPopup->subPopupOptionCount > 0 )
UnShadeStringInBox( this->boxId, i);
else
ShadeStringInBox( this->boxId, i);
i++;
}
i = 0;
// shade strings past the this->subPopupOptionCount offset
for(std::vector<POPUP_OPTION*>::iterator cOption=this->options.begin(); cOption != this->options.end(); ++cOption)
{
if ( (*cOption)->checkAvailability() )
UnShadeStringInBox( this->boxId, i+this->subPopupOptionCount); // workaround - sub-popups don't check
else // for availability
UnShadeStringInBox( this->boxId, i+this->subPopupOptionCount);
else
ShadeStringInBox( this->boxId, i+this->subPopupOptionCount);
i++;
}
return;
}
+31 -12
View File
@@ -1,12 +1,13 @@
#ifndef POPUP_CLASS
#define POPUP_CLASS
#include <vector>
#include "popup_callback.h"
#include "types.h"
#include "sgp.h"
#define MAX_POPUPS 8
#define POPUP_MAX_SUB_POPUPS 2
#define POPUP_MAX_OPTIONS 32
#define MAX_POPUPS 32
#define POPUP_MAX_SUB_POPUPS 24
#define POPUP_MAX_OPTIONS 96
#define MAX_REGIONS_IN_INDEX MAX_POPUPS*POPUP_MAX_OPTIONS*POPUP_MAX_SUB_POPUPS
#define REGION_SUB_POPUP 1
@@ -30,7 +31,7 @@
#define POPUP_POSITION_BOTTOM_RIGHT 3 // user defined point (position) is the bottom right corner of the popup
#define POPUP_POSITION_BOTTOM_LEFT 4 // user defined point (position) is the bottom left corner of the popup
#define POPUP_POSITION_RELATIVE 0 // only used for sub-popups, left corner is relative to parent popup's point of origin
#define POPUP_POSITION_RELATIVE -1 // only used for sub-popups, left corner is relative to parent popup's point of origin
class POPUP_OPTION;
class POPUP_SUB_POPUP_OPTION;
@@ -69,7 +70,7 @@
POPUP_OPTION(std::wstring* name, popupCallback* newFunction); // constructor
~POPUP_OPTION(); // destructor
// setup
BOOLEAN setName(WCHAR* name);
BOOLEAN setName(std::wstring * name);
BOOLEAN setAction(popupCallback*fun);
BOOLEAN setAvail(popupCallback *fun);
BOOLEAN setHover(popupCallback *fun);
@@ -89,6 +90,13 @@
popupCallback * action;
popupCallback * avail;
popupCallback * hover;
UINT8 color_foreground;
UINT8 color_background;
UINT8 color_highlight;
UINT8 color_shade;
UINT32 stringHandle;
};
@@ -110,12 +118,12 @@
void destroySubPopup();
void positionSubPopup();
BOOLEAN setPopupPosition(UINT16 x, UINT16 y, UINT8 positioningRule = POPUP_POSITION_RELATIVE );
BOOLEAN setPopupPosition(UINT16 x, UINT16 y, INT8 positioningRule = POPUP_POSITION_RELATIVE );
BOOLEAN customPositionSet;
INT32 customX;
INT32 customY;
UINT8 customRule;
UINT32 customX;
UINT32 customY;
INT8 customRule;
POPUP * subPopup;
const POPUP * parent;
@@ -140,6 +148,7 @@
BOOLEAN delOption(UINT8 optIndex);
POPUP* addSubMenuOption(std::wstring * name);
BOOL addSubMenuOption(POPUP_SUB_POPUP_OPTION* sub);
/*INT16 findFreeSubMenuOptionIndex();*/
POPUP_SUB_POPUP_OPTION * getSubPopupOption(UINT8 n);
@@ -148,18 +157,26 @@
// usage
BOOLEAN show(void);
BOOLEAN hide(void);
void hideAfter(void); // called by options, closes popup after running callback
BOOLEAN toggle(void);
BOOLEAN refresh(void);
BOOLEAN forceDraw(void);
BOOLEAN callOption(int optIndex);
INT32 getBoxId(){
INT32 getBoxId() const {
return this->boxId;
}
// gets the final dimensions/position of the box, works only after it has been displayed
SGPRect getBoxDimensions();
SGPPoint getBoxPosition();
BOOLEAN setCallback(UINT8 type, popupCallback * callback);
BOOLEAN isCallbackSet(UINT8 type);
void recalculateWidth(void);
INT16 getCurrentWidth(void); // calculated the width based on the longest option name
INT16 getCurrentHeight(void);
/////////////////////////
// public variables
public:
@@ -178,6 +195,7 @@
void setInitialValues(void);
BOOLEAN addToIndex( void );
BOOLEAN removeFromIndex( void );
BOOLEAN hideAfterRun;
// Box init functions
BOOLEAN CreateDestroyPopUpBoxes(void);
@@ -202,6 +220,7 @@
void AdjustMouseRegions( void );
void RepositionMouseRegions( void );
public:
// MSYS Callbacks
void MenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason );
@@ -258,7 +277,7 @@
INT32 boxId;
// which corner of the popup should be aligned with the supplied coordinates ?
UINT8 positioningRule;
INT8 positioningRule;
// the x,y position of the pop up in tactical
+235
View File
@@ -0,0 +1,235 @@
#include "popup_class.h"
#include "popup_callback.h"
#include "sgp.h"
#include "popup_definition.h"
#include "Interface Items.h"
// for getting psoldier
#include "Map Screen Interface.h"
#include "Map Screen Interface Map.h"
#include "Overhead.h"
//////////////////////////////////////
// popupDef
//////////////////////////////////////
popupDef::popupDef(){}
popupDef::~popupDef(){
for(std::vector<popupDefContent*>::iterator content=this->content.begin(); content != this->content.end(); ++content)
{
delete *content;
}
}
BOOL popupDef::applyToBox(POPUP* popup){
for(std::vector<popupDefContent*>::iterator content=this->content.begin(); content != this->content.end(); ++content)
{
if ( (*content)->addToBox( popup ) != TRUE ) return FALSE;
}
return TRUE;
}
BOOL popupDef::addOption(std::wstring* name, UINT16 callbackId, UINT16 availId){
// TODO: check for vaid callbacl/avail ID
this->content.push_back( new popupDefOption(name,callbackId,availId) );
return TRUE;
}
popupDef * popupDef::addSubPopup(std::wstring* name){
popupDefSubPopupOption * sub = new popupDefSubPopupOption(name);
this->content.push_back( sub );
return sub->getSubDef();
}
BOOL popupDef::addSubPopup(popupDefSubPopupOption* sub){
// TODO: add check for max options
this->content.push_back( sub );
return TRUE;
};
BOOL popupDef::addGenerator(UINT16 id){
// TODO: check for valid generator id
this->content.push_back( new popupDefContentGenerator(id) );
return TRUE;
}
//////////////////////////////////////
// popupDefContent
//////////////////////////////////////
popupDefContent::popupDefContent(){}
popupDefContent::~popupDefContent(){}
//////////////////////////////////////
// popupDefOption helpers
//////////////////////////////////////
static BOOL setPopupDefCallback( POPUP_OPTION * opt, UINT16 callbackId ){
// TODO
opt->setAction(NULL);
return TRUE;
}
static BOOL setPopupDefAvail( POPUP_OPTION * opt, UINT16 callbackId ){
// TODO
opt->setAvail(NULL);
return TRUE;
}
//////////////////////////////////////
// popupDefOption
//////////////////////////////////////
/* defined in header file
popupDefOption::popupDefOption(){}
popupDefOption::popupDefOption( std::wstring* name, UINT16 callbackId, UINT16 availId ){}
~popupDefOption::popupDefOption(){}
*/
BOOL popupDefOption::addToBox(POPUP * popup){
POPUP_OPTION * opt = new POPUP_OPTION();
opt->setName( this->name );
if ( !setPopupDefCallback(opt, this->callbackId)
|| !setPopupDefAvail(opt, this->availId) )
{
delete opt;
return false;
}
return popup->addOption(*opt);
}
//////////////////////////////////////
// popupDefSubPopupOption
//////////////////////////////////////
/* defined in header file
popupDefSubPopupOption::popupDefSubPopupOption(){}
popupDefSubPopupOption::popupDefSubPopupOption( std::wstring* name ){}
popupDefSubPopupOption::~popupDefSubPopupOption(){}
*/
BOOL popupDefSubPopupOption::addToBox(POPUP * popup){
POPUP_SUB_POPUP_OPTION * sub = new POPUP_SUB_POPUP_OPTION( this->name );
if( !this->content->applyToBox( sub->subPopup ) ){
delete sub;
return false;
}
return popup->addSubMenuOption(sub);
}
//////////////////////////////////////
// popupDefContentGenerator helpers
//////////////////////////////////////
/*
void addArmorToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addLBEToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addWeaponsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addWeaponGroupsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addGrenadesToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addBombsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addFaceGearToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addRifleGrenadesToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addRocketAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
void addDrugsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup );
*/
static BOOL applyPopupContentGenerator( POPUP * popup, UINT16 generatorId ){
SOLDIERTYPE *pSoldier;
GetSoldier( &pSoldier, gCharactersList[ bSelectedInfoChar ].usSolID );
switch(generatorId){
case popupGenerators::dummy:
popup->addOption(new std::wstring( L"Dummy generator" ),NULL);
break;
case popupGenerators::addArmor:
addArmorToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addLBE:
addLBEToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addWeapons:
addWeaponsToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addWeaponGroups:
addWeaponGroupsToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addGrenades:
addGrenadesToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addBombs:
addBombsToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addFaceGear:
addFaceGearToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addAmmo:
addAmmoToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addRifleGrenades:
addRifleGrenadesToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addRocketAmmo:
addRocketAmmoToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addMisc:
addMiscToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
case popupGenerators::addKits:
addKitsToPocketPopup( pSoldier, gsPocketUnderCursor, popup );
break;
default:
return FALSE;
}
return TRUE;
}
//////////////////////////////////////
// popupDefContentGenerator
//////////////////////////////////////
/* defined in header file
popupDefContentGenerator::popupDefContentGenerator(){}
popupDefContentGenerator::popupDefContentGenerator( UINT16 generatorId ){}
popupDefContentGenerator::~popupDefContentGenerator(){}
*/
BOOL popupDefContentGenerator::addToBox(POPUP * popup){
return applyPopupContentGenerator( popup, this->generatorId );
}
+109
View File
@@ -0,0 +1,109 @@
#ifndef POPUP_DEFINITION
#define POPUP_DEFINITION
#include "sgp.h"
#include "popup_class.h"
#include "popup_callback.h"
namespace popupGenerators{
enum{
dummy = 1,
addArmor,
addLBE,
addWeapons,
addWeaponGroups,
addGrenades,
addBombs,
addFaceGear,
addAmmo,
addRifleGrenades,
addRocketAmmo,
addMisc,
addKits
};
};
class popupDef;
class popupDefContent;
class popupDefOption;
class popupDefSubPopupOption;
class popupDefContentGenerator;
class popupDef{
public:
popupDef();
~popupDef();
BOOL applyToBox(POPUP* popup);
BOOL addOption(std::wstring* name, UINT16 callbackId, UINT16 availId);
popupDef * addSubPopup(std::wstring* name);
BOOL addSubPopup(popupDefSubPopupOption* sub);
BOOL addGenerator(UINT16 id);
protected:
std::vector<popupDefContent*> content;
};
class popupDefContent{
public:
popupDefContent();
~popupDefContent();
virtual BOOL addToBox(POPUP * popup) = 0;
};
class popupDefOption : public popupDefContent{
public:
popupDefOption() : name( new std::wstring(L"Unnamed Option") ), callbackId(0), availId(0){};
popupDefOption( std::wstring* name, UINT16 callbackId, UINT16 availId ) : name( name ), callbackId(callbackId), availId(availId){};
~popupDefOption(){ delete this->name; };
BOOL addToBox(POPUP * popup);
protected:
std::wstring* name;
UINT16 callbackId;
UINT16 availId;
};
class popupDefSubPopupOption : public popupDefContent{
public:
popupDefSubPopupOption() : name( new std::wstring(L"Unnamed Submenu") ){ this->content = new popupDef(); };
popupDefSubPopupOption( std::wstring* name ) : name( name ){ this->content = new popupDef(); };
~popupDefSubPopupOption(){ delete this->name; delete this->content; };
BOOL addToBox(POPUP * popup);
void rename( std::wstring* name ){
delete this->name; // lets just hope nothing else was using this string. TODO: use smart pointer
this->name = name;
};
popupDef * getSubDef(){ return this->content; };
protected:
std::wstring* name;
popupDef * content;
};
class popupDefContentGenerator: public popupDefContent{
public:
popupDefContentGenerator() : generatorId(0){};
popupDefContentGenerator( UINT16 generatorId ) : generatorId( generatorId ){};
~popupDefContentGenerator();
BOOL addToBox(POPUP * popup);
protected:
UINT16 generatorId;
};
#endif