[Patch] Clothes change[message #236398]
|
Sat, 31 October 2009 10:47
|
|
mgl |
|
Messages:255
Registered:December 2007 Location: France |
|
|
Another patch for people who can build stracciatella themselves.
In the tactical screen, press:
SHIFT + V to cycle the available vest palettes of the selected merc.
SHIFT + P to cycle the pants palettes.
It works for the civilians you escort too.
I did nothing in this patch, all the code was already there for a "Palette edit" screen. I have never seen it.
And, as a bonus, the 'j' key will let you climb roofs and jump fences, since I didn't bother to remove this part from the patch. 'j' is stolen from 1.13.
clothes_change.diff:
Index: Build/JAScreens.h
===================================================================
--- Build/JAScreens.h (revision 7056)
+++ Build/JAScreens.h (working copy)
@@ -4,7 +4,13 @@
#include "ScreenIDs.h"
#include "Types.h"
+/* mgl: Clothes change
+ * SOLDIERTYPE, resp PaletteRepID defined there
+ */
+#include "Soldier_Control.h"
+#include "Overhead_Types.h"
+
ScreenID ErrorScreenHandle(void);
ScreenID InitScreenHandle(void);
@@ -38,4 +44,10 @@
ScreenID DemoExitScreenHandle(void);
#endif
+/* mgl: Clothes change
+ * Exported function.
+ * It was a local function called by "PalEditScreenHandle()".
+ */
+void CyclePaletteReplacement(SOLDIERTYPE& s, PaletteRepID pal);
+
#endif
Index: Build/JAScreens.cc
===================================================================
--- Build/JAScreens.cc (revision 7056)
+++ Build/JAScreens.cc (working copy)
@@ -285,7 +285,10 @@
}
-static void CyclePaletteReplacement(SOLDIERTYPE& s, PaletteRepID pal)
+/* mgl: Clothes change
+ * Exported function.
+ */
+void CyclePaletteReplacement(SOLDIERTYPE& s, PaletteRepID pal)
{
UINT8 ubPaletteRep = GetPaletteRepIndexFromID(pal);
const UINT8 ubType = gpPalRep[ubPaletteRep].ubType;
Index: Build/Tactical/Turn_Based_Input.cc
===================================================================
--- Build/Tactical/Turn_Based_Input.cc (revision 7056)
+++ Build/Tactical/Turn_Based_Input.cc (working copy)
@@ -1354,6 +1354,39 @@
case 'g': HandlePlayerTogglingLightEffects(TRUE); break;
case 'h': ShouldTheHelpScreenComeUp(HELP_SCREEN_TACTICAL, TRUE); break;
case 'i': ToggleItemGlow(!gGameSettings.fOptions[TOPTION_GLOW_ITEMS]); break;
+ /* mgl: kbd shortcut 'j' = climb roof. From JA2 v1.13 */
+ case 'j':
+ {
+ SOLDIERTYPE* const s = GetSelectedMan();
+ if (!s) { break; }
+
+ // Prevent the robot, Maria, Joey etc from climbing
+ if (!IsValidStance(s, ANIM_CROUCH)) { break; }
+
+ // Make sure the merc is not collapsed!
+ if (s->bCollapsed && s->bBreath < OKBREATH)
+ {
+ // Merc can't change stance message
+ ScreenMsg(FONT_MCOLOR_LTYELLOW,
+ MSG_UI_FEEDBACK,
+ gzLateLocalizedString[3],
+ s->name);
+ break;
+ }
+
+ if (FindHigherLevel(s))
+ { BeginSoldierClimbUpRoof(s);
+ }
+ else if (FindLowerLevel(s))
+ { BeginSoldierClimbDownRoof(s);
+ }
+ else if (FindFenceJumpDirection(s))
+ { BeginSoldierClimbFence(s);
+ }
+
+ break;
+ } /* case 'j' */
+
case 'k': BeginKeyPanelFromKeyShortcut(); break;
case 'l':
@@ -1561,6 +1594,18 @@
}
break;
+ /* mgl: Clothes change */
+ case 'v':
+ {
+ SOLDIERTYPE* const s = GetSelectedMan();
+ if (!s) { break; }
+ // Anyone except the robot can change clothes
+ if (AM_A_ROBOT(s)) { break; }
+ CyclePaletteReplacement(*s, s->VestPal);
+ break;
+ }
+
+
#ifdef JA2BETAVERSION
case 'l':
{
@@ -1573,6 +1618,17 @@
}
#endif
+ /* mgl: Clothes change */
+ case 'p':
+ {
+ SOLDIERTYPE* const s = GetSelectedMan();
+ if (!s) { break; }
+ // Anyone except the robot can change clothes
+ if (AM_A_ROBOT(s)) { break; }
+ CyclePaletteReplacement(*s, s->PantsPal);
+ break;
+ }
+
case SDLK_F1:
case SDLK_F2:
case SDLK_F3:
Enjoy the trendy pink war vest.
Report message to a moderator
|
|
|
|
Re: [Patch] Clothes change[message #249335]
|
Thu, 15 April 2010 00:15
|
|
Centurion |
|
Messages:80
Registered:April 2009 Location: E.U. |
|
|
*don't want to continue the offtopic in that other thread:
I'm doing something wrong but I don't know if it's the *.diff file itself.
ok
1. Created a *.diff file using notepad++
2. pasted your code. resulted in = this file
3. placed file on c:\build
4. executed patch -p0 < clothes_change.diff
he says he can't find the file at input line 5 asks me to locate it
5. placed clothes_change.diff in c:\build\ja2 and executed it
(stripping trailing CRs from patch)
patching file Build/JAScreens.h
hunk#1 FAILED at 4
Hunk #2 failed at 44
2 out of 2 hunks FAILED -- saving rejects to file
"
***************
*** 285,291 ****
}
- static void CyclePaletteReplacement(SOLDIERTYPE& s, PaletteRepID pal)
{
UINT8 ubPaletteRep = GetPaletteRepIndexFromID(pal);
const UINT8 ubType = gpPalRep[ubPaletteRep].ubType;
--- 285,294 ----
}
+ /* mgl: Clothes change
+ * Exported function.
+ */
+ void CyclePaletteReplacement(SOLDIERTYPE& s, PaletteRepID pal)
{
UINT8 ubPaletteRep = GetPaletteRepIndexFromID(pal);
const UINT8 ubType = gpPalRep[ubPaletteRep].ubType;
Report message to a moderator
|
Corporal 1st Class
|
|
|
|
|
|
Re: [Patch] Clothes change[message #249501]
|
Fri, 16 April 2010 20:17
|
|
mgl |
|
Messages:255
Registered:December 2007 Location: France |
|
|
You can do a desperate try with the "--binary" command line option on a CR/LF diff file and CR/LF source code files: patch -p0 --verbose --binary --dry-run < clothes_change.diff
The "--dry-run" option will make the patch program simulate the update without really updating anything and the "verbose" option will show more output. See if it looks better.
Another solution is to have your source code tree in Unix LF text format. The only change is that Windows editors will display source code files on a single line. You can convert them by hand with tools like unix2dos/dos2unix or todos/fromdos but it may not be reasonable to do it on the many (4 ?) source code files that the "change_clothes" patch updates.
You would rather edit your subversion configuration file and change the svn:eol-style property to have this:
### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
###
###
###
###
###
*.c = svn:eol-style=LF
*.cpp = svn:eol-style=LF
*.h = svn:eol-style=LF
# *.dsp = svn:eol-style=CRLF
# *.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=native;svn:executable
*.txt = svn:eol-style=LF
# *.png = svn:mime-type=image/png
# *.jpg = svn:mime-type=image/jpeg
Makefile = svn:eol-style=LF
LF for all the source files: *.h, *.cpp and *.c (I doubt there are still .c files in stracciatella).
If you use TortoiseSVN, it's in the menu TortoiseSVN->Settings, where you have a button "Edit Subversion configuration file". The next time you check out from Mythrell's or Tron's repositories, your source code files will be converted to Unix text file format.
To check that it would work, if you wish, instead of the bigger "Clothes change" patch, try on this content before you update your subversion configuration file:
Jake_sells_CAWS_ammo.diff:
Index: Build/Tactical/Arms_Dealer_Init.cc
===================================================================
--- Build/Tactical/Arms_Dealer_Init.cc (revision 7059)
+++ Build/Tactical/Arms_Dealer_Init.cc (working copy)
@@ -498,6 +498,16 @@
// gas is restocked regularly, unlike most items
GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_JAKE, GAS_CAN, ( UINT8 ) ( 4 + Random( 3 ) ) );
}
+
+ /* mgl: Jake sells CAWS ammo if Maddog was recruited */
+ if (gMercProfiles[MADDOG].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED)
+ {
+ GuaranteeAtLeastXItemsOfIndex(ARMS_DEALER_JAKE,
+ Random(2) ? CLIPCAWS_10_SAP
+ : CLIPCAWS_10_FLECH,
+ 1 + Random(3)
+ );
+ }
//If the player hasn't bought a video camera from Franz yet, make sure Franz has one to sell
if( !( gArmsDealerStatus[ ARMS_DEALER_FRANZ ].ubSpecificDealerFlags & ARMS_DEALER_FLAG__FRANZ_HAS_SOLD_VIDEO_CAMERA_TO_PLAYER ) )
This patch is only two lines of code and updates only one file: 'Build/Tactical/Arms_Dealer_Init.cc'.
It makes Jake start to sell clips for the CAWS if you hire Maddog.
You should copy and paste this content to a file 'Jake_sells_CAWS_ammo.diff' at the root of your straciatella source tree as either a CR/LF or LF only text file.
Convert the source code file 'Build/Tactical/Arms_Dealer_Init.cc' to Unix (LF) format with the tool of your choice. As a tip, it should be smaller than originally when converted to unix text format.
Now that you have the diff file in any format and the source code file in LF format, cd to the root of your straciatella tree and type: patch -p0 --verbose --dry-run < Jake_sells_CAWS_ammo.diff And watch if it would fail or not. Try to change the text format of the diff file if it fails.
Report message to a moderator
|
|
|
|
Re: [Patch] Clothes change[message #249508]
|
Fri, 16 April 2010 21:20
|
|
Centurion |
|
Messages:80
Registered:April 2009 Location: E.U. |
|
|
no *.c files only *.cc
I don't need to mess with the source code in windows so I will try that method of downloading the source like it was linux
I'll setup turtle SVN to download the source with the linux options and then compile with that command
I'll let you know how it works but it probably won't work since your compiling in windows with linux things
Report message to a moderator
|
Corporal 1st Class
|
|
|
|
Re: [Patch] Clothes change[message #249556]
|
Sat, 17 April 2010 18:27
|
|
Centurion |
|
Messages:80
Registered:April 2009 Location: E.U. |
|
|
Mythrelll now I understand why the question irritated you
in my defense I didnt know it was so complicated....
setting SVN to linux files is also a fail
I believe the only, last option, to make this work is for this to be patched in a linux system then have the source code converted to dos then compile the source code in windows :/
I have open solaris cd but don't think im going to install it just for this I think I may have to go without this patch
Report message to a moderator
|
Corporal 1st Class
|
|
|
|
|
|
|
Re: [Patch] Clothes change[message #249609]
|
Sun, 18 April 2010 14:38
|
|
Centurion |
|
Messages:80
Registered:April 2009 Location: E.U. |
|
|
oh wait
it worked even on a mix CR/LF
?
I don't get this... wait -> notepad++ doesn't give me the option to decide in which format to save the *.diff
it just says *.diff *.patch
can you upload your clothes_change.diff file
http://www.megaupload.com/
I'll try to use your file that is clearly LF and see what happens in both source code (one downloaded in lf)
Report message to a moderator
|
Corporal 1st Class
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [Patch] Clothes change[message #251721]
|
Mon, 17 May 2010 00:03
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
mglYou just said the opposite in your previous post
No, I didn't. The two posts refer to two different things: Automatically setting the property using autoprops only happens when adding the file. On the other hand, you see the effect of the property when checking out the file.
Quote:*Edit*
It must be because the files I used came from Linux with their eol property already set to native.
The property svn:eol-style is set to "native", because I set it when adding the files to the repo. This is independent where you check out the files. But the effect of "native" depends on where you check out: If you check out a file, which has svn:eol-tyle set to native, from the repo on a Linux box, then you get line feeds as line endings. If you check out the same file on a Windows box, then you get carriage return+line feed. That's the meaning of native: You get the native line endings for the machine you are doing the checkout on.
Of course, if you do a checkout on a Linux box onto an USB stick and later put that stick into a Windows box, the files will still have line feeds as line endings. Moving the stick does not magically change the line endings. Probably doing operations with SVN on this checkout on the Windows box might change the line endings of the touched files.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
|
Re: [Patch] Clothes change[message #251736]
|
Mon, 17 May 2010 07:16
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
You can change svn:eol-style manually (which, of course, makes your working copy modified), but there is no point. Just leave it at native: You correctly get line feeds on Linux and carriage return + line feed on Windows.
Your problem just stems from the fact that you moved a working copy from one machine to another. Probably just removing a file and checking it out again does the trick (i.e. leave out changing svn:eol-style). The point of the "native" setting is, that there is no need for you to change anything. You simply get The Right Thing(TM) for the machine you are working on.
Report message to a moderator
|
Sergeant 1st Class
|
|
|