Coder Social home page Coder Social logo

Comments (1)

Baker7 avatar Baker7 commented on August 11, 2024

If you are wanting to do this:

con_logcenterprint is the cvar in FitzQuake/Quakespasm engines including Ironwail ...

cvar_t con_logcenterprint = {CF_CLIENT | CF_ARCHIVE, "con_logcenterprint","1", "centerprint messages will be logged to the console in singleplayer. If 2, they will also be logged in deathmatch"}; // Baker r1421: centerprint logging to console

void Con_LogCenterPrint (const char *str)
{
	if (String_Does_Match(str, cl.lastcenterstring))
		return; //ignore duplicates

	if (cl.gametype == GAME_DEATHMATCH && con_logcenterprint.value < 2) // default 1
		return; //don't log in deathmatch

	strlcpy (cl.lastcenterstring, str, sizeof(cl.lastcenterstring));

	if (con_logcenterprint.value) {
		Con_HidenotifyPrintLinef ("\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37");
		Con_HidenotifyPrintLinef ("%s", str);
		Con_HidenotifyPrintLinef ("\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37");
	}

}

client_t struct needs:

`char		lastcenterstring[1024];`

This function is needed

// Baker r1421: centerprint logging to console
void Con_HidenotifyPrintLinef(const char *fmt, ...)
{
	va_list argptr;
	char msg[MAX_INPUTLINE_16384];

	va_start(argptr,fmt);
	dpvsnprintf(msg,sizeof(msg),fmt,argptr);
	va_end(argptr);

	int s_len = (int)strlen(msg);
	if (s_len >= MAX_INPUTLINE_16384 - 1) {
		msg[s_len - 1] = 10; // trunc
	} else {
		msg[s_len] = 10; // was 0
		msg[s_len+1] = 0; // extra
	}
	Con_MaskPrint (CON_MASK_HIDENOTIFY, msg);
}

Modified:

void SCR_CenterPrint(const char *str)
{
	Con_LogCenterPrint (str); // Baker r1421: centerprint logging to console
	c_strlcpy (scr_centerstring, str);
	scr_centertime_off = scr_centertime.value;
	scr_centertime_start = cl.time;

// count the number of lines for centering
	scr_center_lines = 1;
	while (*str)
	{
		if (*str == '\n')
			scr_center_lines++;
		str++;
	}
}

from darkplaces.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.