Home » MODDING HQ 1.13 » v1.13 Coding Talk » Code Snippets
() 1 Vote
|
|
|
|
Re: Code Snippets[message #330812]
|
Sun, 23 February 2014 19:14
|
|
Deleted. |
|
Messages:2657
Registered:December 2012 Location: Russian Federation |
|
|
New option:
SET_DEFAULT_AUTOFIRE_BULLETS = 0
Set default number of autofire bullets:
0 = Default - 1 bullet
1 = Max bullets allowed with max aiming
2 = Set bullet number based on weapon class:
MP, SMG - 3 bullets
AR - 2 bullets
MG - 5 bullets
Toggle SpoilerSimilar functionality was already implemented but didn't work due to error in 'while' condition.
Also, autofire with this feature is completely different from regular 'bursts', before anyone asks :nono:
[Updated on: Mon, 24 February 2014 18:57] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: Code Snippets[message #330826]
|
Sun, 23 February 2014 22:18
|
|
Deleted. |
|
Messages:2657
Registered:December 2012 Location: Russian Federation |
|
|
Updated version - now 3 different options:
Set default number of autofire bullets:
0 = Max bullets allowed with max aiming
1..10 = Set default number of bullets
1. For MPs and SMGs
SET_DEFAULT_AUTOFIRE_BULLETS_SMG = 1
2. For ARs, Rifles and Shotguns
SET_DEFAULT_AUTOFIRE_BULLETS_AR = 1
3. For MGs
SET_DEFAULT_AUTOFIRE_BULLETS_MG = 1
[Updated on: Mon, 24 February 2014 18:57] by Moderator Report message to a moderator
|
|
|
|
|
|
|
Re: Code Snippets[message #330841]
|
Tue, 25 February 2014 08:23
|
|
Deleted. |
|
Messages:2657
Registered:December 2012 Location: Russian Federation |
|
|
@smeagol
Also noticed that it's not convenient to press current combination.
I will probably change it to ctrl+'v'. (it will also move this hotkey from cheat codes)
Or maybe it's good idea to change this hotkey to simple 'v', and move version info to Ctrl+'v'.
Any thoughts?
@all What other actions should be added to these new menus?
What do you think about other new features (sandbags, autofire)?
[Updated on: Tue, 25 February 2014 09:31] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Code Snippets[message #331452]
|
Fri, 21 March 2014 20:08
|
|
Deleted. |
|
Messages:2657
Registered:December 2012 Location: Russian Federation |
|
|
1. Added grenade throwing range modifier to item_settings.ini:
RANGE_GRENADE_MODIFIER = 1.0
This modifier is applied to grenades and regular thrown items.
2. Changed 100 to bBreathMax in throwing range penalty calculation. This should make grenades more useful.
3. Minor visual fixes (alt healthbar placement, 'roof' text placement when SHOW_ENEMY_WEAPON is true )
4. Added xml tags for merge type <13>: you can use u.knife on tripwire roll to get 2 tripwires. Status of tripwire roll will be reduced by 2 points.
Also lookup table for merges is updated for xml editor to work correctly.
5. Added several new loadscreenhints.
6. Press 'y' in tactical for quick transformation of item in hand - useful for switching flashlights on and off.
r7105 patch
gamedir1997 patch
[Updated on: Mon, 24 March 2014 01:20] by Moderator Report message to a moderator
|
|
|
|
|
Re: Code Snippets[message #331562]
|
Sun, 30 March 2014 13:16
|
|
Deleted. |
|
Messages:2657
Registered:December 2012 Location: Russian Federation |
|
|
1. Quick inventory items:
Press [ALT] + [1..0] for quick access to predefined items:
Toggle Spoiler[ja2_options.ini]
;------------------------------------------------------------------------------------------------------------------------------
; Quick items: press ALT+[1..0]
; Possible Values:
; [0] - nothing
; [-1] - HTH (punch)
; [-2] - Melee (knives)
; [-3] - Taser (Stun gun)
; [-4] - Handcuffs
; [-5] - Sidearm (pistols, machine pistols, small SMGs)
; [-6] - First Aid kit
; [-7] - Binoculars
; [-8] - X-Ray detector
; [-9] - Metal Detector
; Positive values: item id from items.xml
;------------------------------------------------------------------------------------------------------------------------------
QUICK_ITEM_1 = -1
QUICK_ITEM_2 = -2
QUICK_ITEM_3 = -3
QUICK_ITEM_4 = -4
QUICK_ITEM_5 = -5
QUICK_ITEM_6 = -6
QUICK_ITEM_7 = -7
QUICK_ITEM_8 = -8
QUICK_ITEM_9 = -9
QUICK_ITEM_0 = 1636
Press [ALT] + [`] (tilde key left to [1]) to put item back to inventory and switch hands.
The item will be put in the same slot it was taken from (unless it was stacked or game was reloaded).
2. Also a few quick hotkeys:
[ALT] + [q] - switch to sling (same as [SHIFT] + [k])
[CTRL] + [q] - switch hands
[SHIFT] + [q] - drop item from main hand to the ground
Additional info:
-some hotkeys do not work in cheat mode
-only NIV
-only one-handed items supported
-stacked items currently not supported
-remembered item slot is lost when you reload game
3. A few small fixes for dynamic tooltips and other things
Report message to a moderator
|
|
|
|
|
Re: Code Snippets[message #331708]
|
Thu, 10 April 2014 12:31
|
|
JMich |
|
Messages:546
Registered:January 2011 Location: Greece |
|
|
Allow different rules for climbing (and jumping) with backpacks.
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.
.patchIndex: GameSettings.cpp
===================================================================
--- GameSettings.cpp (revision 7145)
+++ GameSettings.cpp (working copy)
@@ -1343,6 +1343,10 @@
gGameExternalOptions.fCanJumpThroughWindows = iniReader.ReadBoolean("Tactical Gameplay Settings","CAN_JUMP_THROUGH_WINDOWS", FALSE);
gGameExternalOptions.fCanJumpThroughClosedWindows = iniReader.ReadBoolean("Tactical Gameplay Settings","CAN_JUMP_THROUGH_CLOSED_WINDOWS", TRUE);
gGameExternalOptions.fCanClimbOnWalls = iniReader.ReadBoolean("Tactical Gameplay Settings","CAN_CLIMB_ON_WALLS", FALSE);
+
+ //JMich.BackpackClimb
+ gGameExternalOptions.sBackpackWeightToClimb = iniReader.ReadInteger("Tactical Gameplay Settings", "MAX_BACKPACK_WEIGHT_TO_CLIMB", -1);
+ gGameExternalOptions.fUseGlobalBackpackSettings = iniReader.ReadBoolean("Tactical Gameplay Settings", "USE_GLOBAL_BACKPACK_SETTINGS", TRUE);
// sevenfm
gGameExternalOptions.fShowEnemyWeapon = iniReader.ReadBoolean("Tactical Gameplay Settings","SHOW_ENEMY_WEAPON", FALSE);
Index: GameSettings.h
===================================================================
--- GameSettings.h (revision 7145)
+++ GameSettings.h (working copy)
@@ -1199,6 +1199,10 @@
BOOLEAN fCanJumpThroughClosedWindows;
BOOLEAN fCanClimbOnWalls;
+ //JMich.BackpackClimb
+ INT16 sBackpackWeightToClimb;
+ BOOLEAN fUseGlobalBackpackSettings;
+
// sevenfm: show enemy weapon above soldier in tactical
BOOLEAN fShowEnemyWeapon;
BOOLEAN fShowEnemyExtendedInfo;
Index: Tactical/Item Types.h
===================================================================
--- Tactical/Item Types.h (revision 7145)
+++ Tactical/Item Types.h (working copy)
@@ -1168,6 +1168,10 @@
// Flugente: spoting effectiveness
INT16 usSpotting;
+ //JMich.BackpackClimb
+ INT16 sBackpackWeightModifier; //modifier to weight calculation to climb.
+ BOOLEAN fAllowClimbing; //does item allow climbing while wearing it
+
} INVTYPE;
Index: Tactical/Overhead.cpp
===================================================================
--- Tactical/Overhead.cpp (revision 7145)
+++ Tactical/Overhead.cpp (working copy)
@@ -2021,7 +2021,11 @@
// CHRISL: Added penalty for jumping a fence while wearing a backpack
// Do we have APs?
// SANDRO - changed the static values to precise calculation here
- if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
{
sAPCost = GetAPsToJumpFence( pSoldier, TRUE );
sBPCost = GetBPsToJumpFence( pSoldier, TRUE );
Index: Tactical/Real Time Input.cpp
===================================================================
--- Tactical/Real Time Input.cpp (revision 7145)
+++ Tactical/Real Time Input.cpp (working copy)
@@ -2104,7 +2104,11 @@
BOOLEAN fNearLowerLevel;
INT8 bDirection;
// CHRISL: Turn off manual jumping while wearing a backpack
- if(UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if (UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
// Make sure the merc is not collapsed!
@@ -2197,7 +2201,11 @@
BOOLEAN fNearLowerLevel;
INT8 bDirection;
// CHRISL: Turn off manual jumping while wearing a backpack
- if(UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if (UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
// Make sure the merc is not collapsed!
Index: Tactical/Soldier Control.cpp
===================================================================
--- Tactical/Soldier Control.cpp (revision 7145)
+++ Tactical/Soldier Control.cpp (working copy)
@@ -9125,7 +9125,11 @@
{
//CHRISL: Disable climbing up to a roof while wearing a backpack
- if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true) {
+ if ((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[this->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+ {
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB] );
return;
}
Index: Tactical/Turn Based Input.cpp
===================================================================
--- Tactical/Turn Based Input.cpp (revision 7145)
+++ Tactical/Turn Based Input.cpp (working copy)
@@ -2846,7 +2846,11 @@
if ( FindWindowJumpDirection( lSoldier, lSoldier->sGridNo, lSoldier->ubDirection, &bDirection ) )
{
- if((UsingNewInventorySystem() == true) && lSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && lSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)lSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[lSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[lSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
{
//Moa: no jumping with backpack
//sAPCost = GetAPsToJumpThroughWindows( lSoldier, TRUE );
@@ -2916,7 +2920,11 @@
if ( fNearLowerLevel )
{
// No climbing when wearing a backpack!
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
if ( EnoughPoints( pjSoldier, GetAPsToClimbRoof( pjSoldier, TRUE ), GetBPsToClimbRoof( pjSoldier, TRUE ), FALSE ) )
@@ -2927,7 +2935,11 @@
if ( fNearHeigherLevel )
{
// No climbing when wearing a backpack!
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
if ( EnoughPoints( pjSoldier, GetAPsToClimbRoof( pjSoldier, FALSE ), GetBPsToClimbRoof( pjSoldier, FALSE ), FALSE ) )
@@ -2939,7 +2951,11 @@
// Jump over fence
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
{
//Moa: no jumping whith backpack
//sAPCost = GetAPsToJumpFence( pjSoldier, TRUE );
@@ -2963,7 +2979,11 @@
if (gGameExternalOptions.fCanClimbOnWalls == TRUE)
{
// No climbing when wearing a backpack!
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
if ( FindWallJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
@@ -6991,7 +7011,11 @@
if ( fNearLowerLevel )
{
// CHRISL: Turn off manual jumping while wearing a backpack
- if(UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if (UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
if ( EnoughPoints( pjSoldier, GetAPsToClimbRoof( pjSoldier, TRUE ), GetBPsToClimbRoof( pjSoldier, TRUE ), FALSE ) )
@@ -7003,7 +7027,11 @@
if ( fNearHeigherLevel )
{
// No climbing when wearing a backpack!
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
if ( EnoughPoints( pjSoldier, GetAPsToClimbRoof( pjSoldier, FALSE ), GetBPsToClimbRoof( pjSoldier, FALSE ), FALSE ) )
@@ -7015,7 +7043,11 @@
// Jump over fence
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
{
sAPCost = GetAPsToJumpFence( pjSoldier, TRUE );
sBPCost = GetBPsToJumpFence( pjSoldier, TRUE );
@@ -7038,7 +7070,11 @@
if ( FindWallJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
// No climbing when wearing a backpack!
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
return;
if ( EnoughPoints( pjSoldier, GetAPsToJumpWall( pjSoldier, FALSE ), GetBPsToJumpWall( pjSoldier, FALSE ), FALSE ) )
@@ -7062,7 +7098,11 @@
{
if ( FindWindowJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
- if((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
+
{
sAPCost = GetAPsToJumpThroughWindows( pjSoldier, TRUE );
sBPCost = GetBPsToJumpThroughWindows( pjSoldier, TRUE );
Index: TacticalAI/AIUtils.cpp
===================================================================
--- TacticalAI/AIUtils.cpp (revision 7145)
+++ TacticalAI/AIUtils.cpp (working copy)
@@ -579,7 +579,10 @@
break;
case AI_ACTION_JUMP_WINDOW:
- if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb )
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
bMinPointsNeeded = GetAPsToJumpThroughWindows( pSoldier, TRUE );
else
bMinPointsNeeded = GetAPsToJumpFence( pSoldier, FALSE );
Index: TacticalAI/FindLocations.cpp
===================================================================
--- TacticalAI/FindLocations.cpp (revision 7145)
+++ TacticalAI/FindLocations.cpp (working copy)
@@ -2886,7 +2886,10 @@
else if (bLevel == 1)
{
//CHRISL: If NewInv and wearing a backpack, don't allow climbing
- if(UsingNewInventorySystem() == true && pSoldier->inv[BPACKPOCKPOS].exists() == true)
+ if (UsingNewInventorySystem() == true && pSoldier->inv[BPACKPOCKPOS].exists() == true
+ //JMich.BackpackClimb
+ && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
+ && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
return DIRECTION_IRRELEVANT;
if (gpWorldLevelData[ sGridNo].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT)
{
Index: Utils/XML_Items.cpp
===================================================================
--- Utils/XML_Items.cpp (revision 7145)
+++ Utils/XML_Items.cpp (working copy)
@@ -279,7 +279,9 @@
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 @@
// 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 @@
FilePrintf(hFile,"\t\t%d\r
", Item[cnt].usBuddyItem );
FilePrintf(hFile,"\t\t%d\r
", Item[cnt].ubSleepModifier );
FilePrintf(hFile,"\t\t%d\r
", Item[cnt].usSpotting );
-
+ FilePrintf(hFile, "\t\t%d\r
", Item[cnt].sBackpackWeightModifier);
+ FilePrintf(hFile, "\t\t%d\r
", Item[cnt].fAllowClimbing);
FilePrintf(hFile,"\t\r
");
}
FilePrintf(hFile,"\r
");
backpack.patch
Haven't tested it that methodically, but it should be bug free.
Report message to a moderator
|
First Sergeant
|
|
|
|
Re: Code Snippets[message #331726]
|
Sat, 12 April 2014 19:55
|
|
anv |
|
Messages:258
Registered:March 2013 |
|
|
Custom sounds for non-guns
- knives, throwing knives, blunt weapons can use attack sounds specified with tag - previously their sound was chosen depending on animation used and hardcoded - it should open space for exotic weapons like chainsaws, lawn mowers, jackhammers, etc. If is left unspecified, default hardcoded sound will be used normally.
- knives, throwing knives, blunt weapons, launchers on attack can cause noise specified with , previously it was ignored for anything but guns,
- small fix for knife/wire cutters combo where using it on empty grid would cause deadlock during battle.
Patch:
Toggle SpoilerIndex: Handle Items.cpp
===================================================================
--- Handle Items.cpp (revision 7146)
+++ Handle Items.cpp (working copy)
@@ -893,7 +893,7 @@
{
// See if we can get there to stab
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
- if ( sActionGridNo != -1 )
+ if ( sActionGridNo != -1 && IsCuttableWireFenceAtGridNo( sGridNo ) )
{
// Calculate AP costs...
sAPCost = GetAPsToCutFence( pSoldier );
@@ -939,7 +939,7 @@
return( ITEM_HANDLE_NOAPS );
}
}
- else
+ else if( sActionGridNo == -1 )
{
return( ITEM_HANDLE_CANNOT_GETTO_LOCATION );
}
Index: Soldier Ani.cpp
===================================================================
--- Soldier Ani.cpp (revision 7146)
+++ Soldier Ani.cpp (working copy)
@@ -2714,7 +2714,18 @@
case 709:
// Knife throw sound...
- PlayJA2Sample( Weapon[ THROWING_KNIFE ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
+ // anv: possiblity to use custom sounds for throwing knives
+ {
+ UINT16 usedWeapon = pSoldier->GetUsedWeaponNumber( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
+ if ( Weapon[ usedWeapon ].sSound != 0 )
+ {
+ PlayJA2Sample( Weapon[ usedWeapon ].sSound, 44100-Random(5000)-Random(5000)-Random(5000), SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
+ }
+ else
+ {
+ PlayJA2Sample( Weapon[ THROWING_KNIFE ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
+ }
+ }
break;
case 710:
@@ -2909,7 +2920,18 @@
case 727:
// Swoosh
- PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( SWOOSH_1 + Random( 6 ) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE );
+ // anv: possiblity to use custom sounds for melee weapons
+ {
+ UINT16 usedWeapon = pSoldier->GetUsedWeaponNumber( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
+ if ( Weapon[ usedWeapon ].sSound != 0 )
+ {
+ PlayJA2Sample( Weapon[ usedWeapon ].sSound, 44100-Random(5000)-Random(5000)-Random(5000), SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
+ }
+ else
+ {
+ PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( SWOOSH_1 + Random( 6 ) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE );
+ }
+ }
break;
case 728:
Index: Weapons.cpp
===================================================================
--- Weapons.cpp (revision 7146)
+++ Weapons.cpp (working copy)
@@ -3199,6 +3199,11 @@
// FreeUpAttacker( (UINT8) pSoldier->ubID );
// }
+ // anv: melee attack noise
+ UINT16 usUBItem = pSoldier->GetUsedWeaponNumber( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
+ UINT8 ubVolume = Weapon[ usUBItem ].ubAttackVolume;
+ MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_UNKNOWN );
+
// possibly reduce monster smell
if ( pSoldier->aiData.bMonsterSmell > 0 && Random( 5 ) == 0 )
{
@@ -3880,6 +3885,11 @@
}
}
+ // anv: hth (inluding blunt weapons) attack noise
+ UINT16 usUBItem = pSoldier->GetUsedWeaponNumber( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
+ UINT8 ubVolume = Weapon[ usUBItem ].ubAttackVolume;
+ MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_UNKNOWN );
+
// possibly reduce monster smell (gunpowder smell)
if ( pSoldier->aiData.bMonsterSmell > 0 && Random( 5 ) == 0 )
{
@@ -4022,6 +4032,12 @@
DeductPoints( pSoldier, sAPCost, 0 );
RemoveObjs( &(pSoldier->inv[ HANDPOS ] ), 1 );
*/
+
+ // anv: knife throw attack noise
+ UINT16 usUBItem = pSoldier->GetUsedWeaponNumber( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
+ UINT8 ubVolume = Weapon[ usUBItem ].ubAttackVolume;
+ MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_UNKNOWN );
+
return( TRUE );
}
@@ -4234,6 +4250,11 @@
pSoldier->bDoBurst++;
}
+ // anv: launcher attack noise
+ UINT16 usUBItem = pSoldier->GetUsedWeaponNumber( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
+ UINT8 ubVolume = Weapon[ usUBItem ].ubAttackVolume;
+ MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_UNKNOWN );
+
return( TRUE );
}
For presentation purposes: Reuban's hedge trimmer using its original DG attack sound effect and making a lot of noise.
Hedge Trimmer
Report message to a moderator
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Oct 25 12:15:00 GMT+3 2024
Total time taken to generate the page: 0.03251 seconds
|