Cube  Diff

Differences From Artifact [e55e1dd6f3]:

To Artifact [dd3dab2434]:


1
2
3

4

5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
11
12
13



+

+







// console.cpp: the console buffer, its display, and command line control

#include "cube.h"

#include <ctype.h>
#include <memory>

struct cline {
	char *cref;
	int outtime;
};
vector<cline> conlines;

90
91
92
93
94
95
96
97

98

99
100
101




102
103
104
105
106

107


108
109
110
111
112
113






114
115



116
117
118
119
120
121
122
123
124
125
126
127
128
129



130
131

132

133
134
135



136
137

138
139
140
141
142
143
144
92
93
94
95
96
97
98

99
100
101



102
103
104
105
106
107
108
109

110
111
112
113






114
115
116
117
118
119


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134


135
136
137
138

139
140
141



142
143
144


145
146
147
148
149
150
151
152







-
+

+
-
-
-
+
+
+
+




-
+

+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+












-
-
+
+
+

-
+

+
-
-
-
+
+
+
-
-
+







	int code;
	char *name;
	char *action;
} keyms[256];
int numkm = 0;

void
keymap(char *code, char *key, char *action)
keymap(OFString *code, OFString *key, OFString *action)
{
	@autoreleasepool {
	keyms[numkm].code = atoi(code);
	keyms[numkm].name = newstring(key);
	keyms[numkm++].action = newstringbuf(action);
		keyms[numkm].code = (int)code.longLongValue;
		keyms[numkm].name = newstring(key.UTF8String);
		keyms[numkm++].action = newstringbuf(action.UTF8String);
	}
}
COMMAND(keymap, ARG_3STR)

void
bindkey(char *key, char *action)
bindkey(OFString *key_, OFString *action)
{
	@autoreleasepool {
		std::unique_ptr<char> key(strdup(key_.UTF8String));
	for (char *x = key; *x; x++)
		*x = toupper(*x);
	loopi(numkm) if (strcmp(keyms[i].name, key) == 0)
	{
		strcpy_s(keyms[i].action, action);
		return;
		for (char *x = key.get(); *x; x++)
			*x = toupper(*x);
		loopi(numkm) if (strcmp(keyms[i].name, key.get()) == 0)
		{
			strcpy_s(keyms[i].action, action.UTF8String);
			return;
	};
	conoutf(@"unknown key \"%s\"", key);
		}
		conoutf(@"unknown key \"%s\"", key.get());
	}
}
COMMANDN(bind, bindkey, ARG_2STR)

void
saycommand(char *init) // turns input to the command line on or off
{
	SDL_EnableUNICODE(saycommandon = (init != NULL));
	if (!editmode)
		keyrepeat(saycommandon);
	if (!init)
		init = "";
	strcpy_s(commandbuf, init);
};

}
COMMAND(saycommand, ARG_VARI)

void
mapmsg(char *s)
mapmsg(OFString *s)
{
	@autoreleasepool {
	strn0cpy(hdr.maptitle, s, 128);
}

		strn0cpy(hdr.maptitle, s.UTF8String, 128);
	}
}
COMMAND(saycommand, ARG_VARI)
COMMAND(mapmsg, ARG_1CSTR)
COMMAND(mapmsg, ARG_1STR)

#ifndef _WIN32
# include <SDL_syswm.h>
# include <X11/Xlib.h>
#endif

void