Esempio n. 1
0
void hud_sourced_print(int source, const char *msg)
{
    if ( !strlen(msg) ) {
        nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
        return;
    }

    // add message to the scrollback log first
    hud_add_msg_to_scrollback(msg, source, Missiontime);

    HUD_message_data new_msg;

    new_msg.text = SCP_string(msg);
    new_msg.source = source;
    new_msg.x = 0;

    HUD_msg_buffer.push_back(new_msg);

    // Invoke the scripting hook
    Script_system.SetHookVar("Text", 's', const_cast<char*>(msg));
    Script_system.SetHookVar("SourceType", 'i', &source);

    Script_system.RunCondition(CHA_HUDMSGRECEIVED);

    Script_system.RemHookVars(2, "Text", "SourceType");

}
Esempio n. 2
0
void hud_sourced_print(int source, char *msg)
{
	char *ptr, *str;
	//char *src_str, *msg_str;
	int sw, t, x, offset = 0;
	//int fudge = (gr_screen.res == GR_640) ? 15 : 50;		// prevents string from running off screen

	if ( !strlen(msg) ) {
		nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
		return;
	}

	// add message to the scrollback log first
	hud_add_msg_to_scrollback(msg, source, timestamp());

	ptr = strstr(msg, NOX(": ")) + 2;
	if (ptr) {
		gr_get_string_size(&sw, NULL, msg, ptr - msg);			// get width of the speaker field
		//if (sw < MSG_WINDOW_WIDTH - 20)
		offset = sw;
	}

	x = 0;
	t = timestamp();
	str = msg;
	while ((ptr = split_str_once(str, MSG_WINDOW_WIDTH - x - 7)) != NULL) {		// the 7 is a fudge hack
		HUD_printf_line(str, source, t, x);
		str = ptr;
		x = offset;
		t = 0;
	}

	HUD_printf_line(str, source, t, x);
}
Esempio n. 3
0
// add text directly to the hud scrollback log, without displaying on the hud
void HUD_add_to_scrollback(const char *text, int source)
{
    if (!strlen(text)) {
        nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
        return;
    }

    hud_add_msg_to_scrollback(text, source, Missiontime);
}
Esempio n. 4
0
void hud_sourced_print(int source, char *msg)
{
	if ( !strlen(msg) ) {
		nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
		return;
	}

	// add message to the scrollback log first
	hud_add_msg_to_scrollback(msg, source, Missiontime);

	HUD_message_data new_msg;

	new_msg.text = SCP_string(msg);
	new_msg.source = source;
	new_msg.x = 0;

	HUD_msg_buffer.push_back(new_msg);
}