Tutorial *88*
This is a real quicky tutorial. I was playtesting a mod the other day in Normal Quake, and was just so totally annoyed that Normal Quake doesn't have the Windows clipboard paste (CTRL-V) that QuakeWorld does. It is much easier to copy an ip in Windows, then paste it onto your connect command, rather than have to remember the ip and retype it.

Anywho, all modifications take place in keys.c, so open it up and near the top you'll see:



#include "quakedef.h"

After it add:


// 01-22-2000 FrikaC Begin PASTE

#ifdef _WIN32

#include <windows.h>

#endif

// 01-22-2000 FrikaC End PASTE

Now scroll down to the function Key_Console, near the top of this function you'll note:


	char *cmd;

Immediately after that line, stick these variable definitions in:


// 01-22-2000 FrikaC Begin PASTE

#ifdef _WIN32

	char	*s;

	int		i;

	HANDLE	th;

	char	*clipText, *textCopied;

#endif

// 01-22-2000 FrikaC End PASTE

Last step, scoll further down in the function till you found these lines:


	if (key < 32 || key > 127)

		return;	// non printable

*Above* them, add this mess of stuff directly from the QuakeWorld client code:


// 01-22-2000 FrikaC Begin PASTE

#ifdef _WIN32

	if ((key=='V' || key=='v') && GetKeyState(VK_CONTROL)<0) {

		if (OpenClipboard(NULL)) {

			th = GetClipboardData(CF_TEXT);

			if (th) {

				clipText = GlobalLock(th);

				if (clipText) {

					textCopied = malloc(GlobalSize(th)+1);

					strcpy(textCopied, clipText);

	/* Substitutes a NULL for every token */strtok(textCopied, "\n\r\b");

					i = strlen(textCopied);

					if (i+key_linepos>=MAXCMDLINE)

						i=MAXCMDLINE-key_linepos;

					if (i>0) {

						textCopied[i]=0;

						strcat(key_lines[edit_line], textCopied);

						key_linepos+=i;;

					}

					free(textCopied);

				}

				GlobalUnlock(th);

			}

			CloseClipboard();

		return;

		}

	}

#endif

// 01-22-2000 FrikaC End PASTE

There, much better!


 
Sign up
Login:
Passwd:
[Remember Me]