Moderators: sparcdr, torhu, Tequila
Barto wrote:... find a way to make the voting message clearer instead of the classic "VOTE(time):command value yes:X no:Y".
Barto wrote:... make a simpler display in a simple switch statement.("g_gametype Deathmatch" could be thus changed with "gametype Deathmatch" and "vstr nextmap br_map" in "change map to br_map")
I think it is best to exactly show the command line, which did produce or would have produced the current vote. You may add an explanatory sentence, if you want, but don't get rid of the command line. The real problem is, most people don't get how to vote by command line. On BB however, there are votes you can only call for, if you use the command line, e.g. \callvote weapons knives.VOTE(time):map dm_dry (Deathmatch)
Barto wrote:... found that displaying this message was into cg_draw.c at line 3144. From that, I directly see that the "command value" string corresponds to cgs.voteString. So the best way for me would be to evaluate this char array (declared in cg_local.h, line 1563) and modify/replace if I can.
Barto wrote:I don't know how to manipulate strings and use some functions like contains("text"), equals("text") or split("pattern") that can mostly be found in Java and not in C.
Barto wrote:Also, I can see that I'd break the file logic that only has some display function if I would have recoded those required function.
Barto wrote:So, at the end, I'm wondering how I am supposed to try to make this happen without breaking anything (code logic, file logic, etc.).
TheDoctor wrote:Not sure, this is well-thought-out. I agree, the standard messages are a bit unclear. That's why I've modified voting strings on BB a bit, to make things clearer.
TheDoctor wrote:I think it is best to exactly show the command line, which did produce or would have produced the current vote. You may add an explanatory sentence, if you want, but don't get rid of the command line. The real problem is, most people don't get how to vote by command line.
TheDoctor wrote:Not exactly. Yes, cg_draw.c is responsible for drawing the string (presentation). However, in cg_servercmds.c it is defined (by the game module of the server, see Cmd_CallVote_f in g_cmds.c).
TheDoctor wrote:I would probably introduce another command CS_VOTE_STRING_EXPL in the server as well as the client and modify the client-side such that a small explanation is shown above the voting string such as "Biondo wants to change the map to dm_dry.
VOTE(time): Biondo wants to change map to dm_dry. yes:X no:Y
Barto wrote:I'll think that I'll give up, seeing that I really don't have the ability to edit properly that kind of code without annoying a whole crowd... Maybe I will be enough skilled in a few years, but will SG be here?
Could you specify what kind of failure you were experiencing? Didn't the code compile? Dig the game crash thereafter? Did nothing change?Barto wrote:Anyway, I tried and failed (I'm not even surprised about it) even if I haven't edited that much code.
trap_SetConfigstring( CS_VOTE_STRING_EXPL, level.voteStringExplanation );
TheDoctor wrote:Could you specify what kind of failure you were experiencing? Didn't the code compile? Dig the game crash thereafter? Did nothing change?
/dev/random wrote:If you're using another configstring for the vote description, you'll also have to set it. Otherwise the engine will never send it to the clients.
Barto wrote:I have tried to follow doc's steps and was able to get something decent for me (will it be for you?)
Please provide a screenshot.
Barto wrote:vstr nextmap: (I also show which map it is)
set nextmap "map dm_dry"
set nextmap "vstr nextscript"
set nextscript "vstr next_gametype; set nextmap vstr nextscript"
// etc.
Barto wrote:kick |RP|ElBarto via the UI: (fails anyhow the client id)
Barto wrote:kicknum 0: fails here, I'll have to investigate more about arg_str. (I'd like to display the client name)
} else if ( !Q_stricmp( arg1, "kicknum" ) ) {
clientnum = atoi(arg2);
// TODO: assert that 0 <= clientnum < level.maxclients
// additionally check whether that client is connected, not a localClient (i.e. the game host) etc. though this is done by kicknum as well
// Concat arguments 3 to rest into arg_str
// i.e. with "callvote kicknum 42 you suck" you'd get arg_str "you suck"
// with "callvote kicknum 42" you'd get arg_str "" (empty, so arg_str[0] == 0 or strlen(arg_str) == 0)
arg_str = ConcatArgs(3) ;
Com_sprintf( level.voteString, sizeof( level.voteString ), "kicknum %i %s", clientnum, arg_str );
Com_sprintf( level.voteDisplayString, sizeof( level.voteString ), "kicknum %i %s", clientnum , arg_str );
Com_sprintf( level.voteStringExplanation, sizeof( level.voteStringExplanation ), "%s^7 wants to kick %s^7", ent->client->pers.netname, level.clients[clientnum].pers.netname );
// You might want to put arg_str into voteStringExplanation as well, since it is the optional kick "reason", see "Kicked by vote" for the regular "kick" vote.
// The client will see this as "was kicked: blabla" (e.g. "was kicked: Kicked by vote", or just "was kicked" if no reason is supplied, see Svcmd_KickNum_f()
} else if ( !Q_stricmp( arg1, "mute" ) ) {
/dev/random wrote:Does this work with map rotations scripts which are more complex
PLAYER wants to switch to next map nextscript
/dev/random wrote:I haven't verified this, but it looks like the invocation of ClientNumberFromCleanName() within the "kick" clause should do so with a Q_CleanStr() copy of arg_str (assuming the client ui sends the player name verbatim).
Barto wrote:In your case, it will only display (I haven't tested though):
- Code: Select all
PLAYER wants to switch to next map nextscript
If it not what you want, I can just cancel the changes I made for the nextmap command or I can simply remove the "next map" part of the message.
Barto wrote:Works fine, apart that I don't know how to do a full array copy (my current method doensn't display colors)
char cleanName[MAX_STRING_CHARS]; // this is most likely to large
arg_str = ConcatArgs(2);
Q_strncpyz(cleanName, arg2, sizeof(cleanName));
clientnum = ClientNumberFromCleanName( cleanName );
// you can either print arg_str or cleanName to the players
Barto wrote:I am unable to get running the 64bits build of the game ... Any idea how I messed up this?
/dev/random wrote:I have no preference for either solution, I just wanted to point out that it might not work as intended.
/dev/random wrote:You'll most likely want to use a temporary buffer, copy the original string into it, then call Q_CleanStr() on it.
/dev/random wrote:It seems like ForceUniqueName() sets a level.clients[clientNum].pers.cleanname attribute (not present in Q3), so you might be able to use that one as well instead of creating the cleanName copy.
/dev/random wrote:That error should not happen and neither should the engine segfault. I've seen cases where this was caused by corrupted QVMs, you might try a make clean (or even rm -rf build/).
/dev/random wrote:P.S.: That inline diff is a little difficult to read, any change you could put the whole thing on GitHub or similar, so one can easily browse the code/changes?
Barto wrote:No way (rm -rf build/ did not work). I start to think I either messed up something in the qvm (I don't know how the game exactly handle it). Maybe it comes from eclipse (4.3) or gcc-multilib (4.8.1) on my archlinux... Odd it's also only the 64bits build...
Barto wrote:Yeah, I initially planned to make it in one commit (as you see, I'm trying and failing a lot and I want to put everything in one clean commit and not fork the game 10 times too). Is pastebin something more proper for you? If yes, here it is (valid one month). I'm ready to commit if there are no big fixes to do before. I want to give the minimum of commits to Tequila without any git revert in the mess, I hope you understand because I think I'm quite unclear.
/dev/random wrote:When you say rm didn't work, do you mean rm failed or do you mean it removed the build/ folder correctly, but did not fix the segfault problem?