Jump to content

Home

Voice Chat Menu


ensiform

Recommended Posts

Basically I'm working on a little hack that uses the weapon cmds (0-9) for having a menu show up on screen and so that one does not need to stop actually moving, etc just to pull up the voice menu. Basically one just hijacks CG_Weapon_f and checks for if a bool is enabled, and if so skip the rest of the weapon stuff and run the number found through a function that will interpret it as what "menu" you are on and execute the proper cmd.

Link to comment
Share on other sites

I don't understand what you mean by that? Besides the fact of not being able to use rest of keys/still move, it takes up too much space by drawing all the extra background and crap and the large text, not so gud. Plus there's the fact that I don't use the HUD menu file anymore except when in vehicles. Also: how would it detect which menu they are on, and what numbers do what, etc.

Link to comment
Share on other sites

Having difficulties forcing some data into my structs:

 

Item struct:

 

typedef struct itemVoice_s {
int number;
const char	*text;						// display text
const char	*command;					// command script
vec4_t color;
} itemVoice_t;

 

Menu struct:

 

typedef struct menuInfo_s {
int itemCount;							// number of items;
const char *name;
itemVoice_t *items[10];		// items this menu contains 
} menuInfo_t;

 

Menu array:

 

menuInfo_t VoiceMenus[64];

 

Function trying to set the data:

 

Vector4Set is just a separate macro that is exactly like VectorSet only it works on vec4_t instead of vec3_t.

void SetMenus(void) {
memset(&VoiceMenus, 0, sizeof(VoiceMenus));
// main
VoiceMenus[0].name = "main";

// attack button
VoiceMenus[0].items[0]->number = 1;
VoiceMenus[0].items[0]->text = "VC_ATT";
Vector4Set(VoiceMenus[0].items[0]->color, 1, 1, 1, 1);
VoiceMenus[0].items[0]->command = "menu att";
VoiceMenus[0].itemCount++;

// defend button
VoiceMenus[0].items[1]->number = 2;
VoiceMenus[0].items[1]->text = "VC_DEF";
Vector4Set(VoiceMenus[0].items[1]->color, 1, 1, 1, 1);
VoiceMenus[0].items[1]->command = "menu def";
VoiceMenus[0].itemCount++;

// request button
VoiceMenus[0].items[2]->number = 3;
VoiceMenus[0].items[2]->text = "VC_REQ";
Vector4Set(VoiceMenus[0].items[2]->color, 1, 1, 1, 1);
VoiceMenus[0].items[2]->command = "menu req";
VoiceMenus[0].itemCount++;

// reply button
VoiceMenus[0].items[3]->number = 4;
VoiceMenus[0].items[3]->text = "VC_REPLY";
Vector4Set(VoiceMenus[0].items[3]->color, 1, 1, 1, 1);
VoiceMenus[0].items[3]->command = "menu rep";
VoiceMenus[0].itemCount++;

// spot button
VoiceMenus[0].items[4]->number = 5;
VoiceMenus[0].items[4]->text = "VC_SPOT";
Vector4Set(VoiceMenus[0].items[4]->color, 1, 1, 1, 1);
VoiceMenus[0].items[4]->command = "menu spot";
VoiceMenus[0].itemCount++;

// tactic button
VoiceMenus[0].items[5]->number = 6;
VoiceMenus[0].items[5]->text = "VC_TACTIC";
Vector4Set(VoiceMenus[0].items[5]->color, 1, 1, 1, 1);
VoiceMenus[0].items[5]->command = "menu tac";
VoiceMenus[0].itemCount++;

// cancel button
VoiceMenus[0].items[6]->number = 3;
VoiceMenus[0].items[6]->text = "VC_CANCEL";
Vector4Set(VoiceMenus[0].items[6]->color, 1, 1, 1, 1);
VoiceMenus[0].items[6]->command = "close";
VoiceMenus[0].itemCount++;
}

 

This basically compiles and all but when the function calls and I debug it, it I get access violation @ the line of setting number of first item, and if I try to move it down to the next line it still does it. Any ideas?

 

I know this is an ugly way to add data to the array but it will suffice for now as I'm wanting to hardcode to test, then I will probably make it customizable and read a file or two.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...