Here is a short patch I made for SG. Actually it was supposed to be much bigger but I just don't have time to code right now :(
So I decided to release this one now and release any further as soon as I'll done them. If I will ever done them :)
Purpose of the patch:
I just want to make current SG code more flexible (configurable by server admins) by adding a few variables to money system (actually it is almost replacing current defenitions with CVars).
I didn't invent anything and didn't change a thing in current money system logic. Only a possibility to configure some values.
So, the patch should be easy to read and understand.
The patch is adding a few CVar values for money system to SG:
To general money system:
g_moneyMax - Maximum of money a player may have. (200)
g_moneyMin - Minimum of money a player may have. (20)
g_moneyDUMin - Minimum of money a player may have in DUEL mode. (20)
g_moneySocialHelp - social help money a player will get after dying 3 times in a row. (28)
g_moneyLose - money a player will lose in case of Team Kill (TK). (7)
g_moneyForRobber - money a robber will get when grab a money bag in BR mode. (10)
To team money system:
g_moneyMaxReward (renamed m_maxreward) - max reward a win team may get. (20)
g_moneyTeamWin (renamed m_teamwin) - money a win team will get. (16)
g_moneyTeamLose (renamed m_teamlose) - money a lose team will get. (10)
And few money system related values:
g_moneyRespawn is renamed to g_moneyRespawnMode - will make money lose mode for TK to work. (0)
g_countSocialHelp - count of dies to get social help. (3)
My implementation notes:
All general money system values are declared in the following way:
{ &g_moneyMax, "g_moneyMax", "200", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 1, qtrue }
I'm not sure if it is proper way to declare them, so feel free to change/fix it before perform merge.
I was trying to accomplish the following things by such declaration: they are all server info variables, so server should change client copies of these. And there should be notice for players when any of these are changed.
And I've added the new input variable MaxMoney (int) to BG_CanItemBeGrabbed function in bg_misc.c to keep the ability to check if player is able to take money when he has maximum of allowed money.
Seems there should be some restrictions to these new variables (like upper and lower boundaries). But they are absent now :(
And the changes in misc/win32/cleanvm.bat are not related to money system at all. I just didn't like its behaviour when it removes my whole build directory when it should remove only build/vm and build/asm directories if they are present.
How to apply the patch:
1. Download the patch file from [url=http://www.mediafire.com/?sharekey=2b325e4bf05ded0907258ee67c679e4ae04e75f6e8ebb871[/url]. "Now with mediashare!" :))
2. Using any SVN client apply the patch to 1.1 branch.
How to check the patch:
1. Compile VMs from code with the patch applied.
2. Put new VMs to new pk3 file under vm directory. (pk3 is a zip file with zero compression)
3. Rename this new pk3 file to something like sg_pak1.pk3.
4. Put the file to smokinguns subdirectory of the game.
5. Launch the game.
6. Check that new CVars are present.
P.S. The patch could be easily adapted to 1.0 code. But I think it is just not required.