author | alfadur |
Wed, 21 Sep 2022 06:36:05 +0300 | |
branch | 1.0.0 |
changeset 15895 | f8a3f204242d |
parent 14865 | 9e8c201eae9d |
permissions | -rw-r--r-- |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
1 |
(* |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2004-2019 Andrey Korotaev <unC0Rr@gmail.com> |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
4 |
* |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
8 |
* |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
13 |
* |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
17 |
*) |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
18 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
19 |
unit uKeyNames; |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
20 |
interface |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
21 |
uses uConsts; |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
22 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
23 |
type TKeyNames = array [0..cKeyMaxIndex] of string[15]; |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
24 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
25 |
procedure populateKeyNames(var KeyArray: TKeyNames); |
14864
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
26 |
// procedure generateKeyNames(); // DEBUG (see below) |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
27 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
28 |
implementation |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
29 |
|
14865
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
30 |
uses uPhysFSLayer, uUtils, uVariables, uTypes, uConsole; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
31 |
|
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
32 |
procedure populateKeyNames(var KeyArray: TKeyNames); |
14865
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
33 |
var f: PfsFile; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
34 |
l, keyname, tmp: shortstring; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
35 |
i, scancode: LongInt; |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
36 |
begin |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
37 |
(* |
14865
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
38 |
KeyArray is a mapping from SDL scancodes to Hedgewars key identifiers. |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
39 |
Hedgewars key identifiers are strings with a maximum length of 15 |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
40 |
and are used internally to identify keys in the engine and in settings.ini. |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
41 |
*) |
14865
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
42 |
|
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
43 |
(* Key identifiers are read from an RFC 4180-compliant CSV file. |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
44 |
- 1st column: SDL scancode |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
45 |
- 2nd column: Hedgewars key ID *) |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
46 |
if pfsExists(cPathz[ptMisc]+'/keys.csv') then |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
47 |
begin |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
48 |
f:= pfsOpenRead(cPathz[ptMisc]+'/keys.csv'); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
49 |
l:= ''; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
50 |
pfsReadLn(f, l); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
51 |
while (not pfsEOF(f)) and (l <> '') do |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
52 |
begin |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
53 |
tmp:= ''; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
54 |
i:= 1; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
55 |
while (i <= length(l)) and (l[i] <> ',') do |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
56 |
begin |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
57 |
tmp:= tmp + l[i]; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
58 |
inc(i) |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
59 |
end; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
60 |
scancode:= StrToInt(tmp); |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
61 |
|
14865
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
62 |
if i < length(l) then |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
63 |
begin |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
64 |
keyname:= copy(l, i + 1, length(l) - i); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
65 |
if (keyname[1] = '"') and (keyname[length(keyname)] = '"') then |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
66 |
keyname:= copy(keyname, 2, length(keyname) - 2) |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
67 |
else |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
68 |
keyname:= copy(keyname, 1, length(keyname) - 1); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
69 |
end; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
70 |
|
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
71 |
pfsReadLn(f, l); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
72 |
KeyArray[scancode]:= keyname; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
73 |
end; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
74 |
|
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
75 |
pfsClose(f) |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
76 |
end |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
77 |
else |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
78 |
begin |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
79 |
WriteLnToConsole('misc/keys.csv file not found'); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
80 |
AddFileLog('misc/keys.csv file not found'); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
81 |
halt(haltStartupError); |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
82 |
end; |
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
83 |
|
9e8c201eae9d
Move Hedgewars key IDs to CSV file
Wuzzy <Wuzzy2@mail.ru>
parents:
14864
diff
changeset
|
84 |
// generateKeyNames(); // DEBUG (see below) |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
85 |
end; |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
86 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
87 |
(* |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
88 |
The Hedgewars key identifiers were obtained with the following algorithm: |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
89 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
90 |
Basically: |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
91 |
- For each SDL scancode, do: |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
92 |
- Take the printable SDL scancode key name (with SDL_GetScancodeName) |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
93 |
- Replace spaces with underscores |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
94 |
- Lowercase it |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
95 |
- Cap string length to 15 characters |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
96 |
- Manually fix duplicates |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
97 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
98 |
See also: |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
99 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
100 |
https://wiki.libsdl.org/SDLScancodeLookup |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
101 |
https://wiki.libsdl.org/SDL_Scancode |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
102 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
103 |
NOTE: For compability reasons, existing identifiers should not be renamed. |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
104 |
|
14864
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
105 |
*) |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
106 |
|
14864
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
107 |
(* DEBUG |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
108 |
Uncomment this to generate a list of key names in |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
109 |
CSV format (RFC 4180) and print it out on console. |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
110 |
Don't forget to fix duplicates! *) |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
111 |
(* |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
112 |
procedure generateKeyNames(); |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
113 |
var i, t: LongInt; |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
114 |
s, s2: shortstring; |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
115 |
begin |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
116 |
for i := 0 to cKeyMaxIndex - 5 do |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
117 |
begin |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
118 |
s := shortstring(SDL_GetScancodeName(TSDL_Scancode(i))); |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
119 |
for t := 1 to Length(s) do |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
120 |
if s[t] = ' ' then |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
121 |
s[t] := '_'; |
14864
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
122 |
s2:= copy(s, 1, 15); |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
123 |
if s2 = '"' then |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
124 |
WriteLnToConsole(IntToStr(i)+',"\""') |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
125 |
else if s2 <> '' then |
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
126 |
WriteLnToConsole(IntToStr(i)+',"'+LowerCase(s2)+'"'); |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
127 |
end; |
14864
9f6b650a6812
Make key ID generation algorithm more useful
Wuzzy <Wuzzy2@mail.ru>
parents:
14853
diff
changeset
|
128 |
end; |
14853
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
129 |
*) |
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
130 |
|
769189675b6c
Add lookup table for Hedgewars key IDs instead of generating IDs on the fly
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
131 |
end. |