ChrisOS/Source reference: GAMES/DOOM/I_INPUT.CC
Deterministic source record. The complete textual file is reproduced below; this page does not replace architectural interpretation in the authored chapters.
File identity
| Field |
Value |
| Path |
GAMES/DOOM/I_INPUT.CC |
| Lines |
76 |
| Bytes |
1437 |
| SHA-256 |
25eed4a8c9edafad54dff230c4c18ab9666fdd3ba9f206ccfab2a2d48412067b |
| ChrisOS revision |
da3df29cb397932c43d32373871fb9380e688ade |
Detected syntactic dependencies
| Line |
Include |
| — |
No preprocessor include detected. |
Detected symbols
| Line |
Symbol |
| 14 |
post_key |
| 28 |
poll_key |
| 43 |
I_StartTic |
Complete source
The following block is the complete textual file at the recorded revision. No lines are elided, abbreviated or paraphrased.
| /* Keyboard → D_PostEvent. ENGINE.LST only (needs d_event.c).
* Scancodes map to doomkeys.h values (vanilla AT mapping). */
struct dg_event {
int type;
int data1;
int data2;
int data3;
int data4;
};
void D_PostEvent(struct dg_event *ev);
void post_key(int down, int code) {
struct dg_event ev;
if (down) {
ev.type = 0;
} else {
ev.type = 1;
}
ev.data1 = code;
ev.data2 = code;
ev.data3 = 0;
ev.data4 = 0;
D_PostEvent(&ev);
}
void poll_key(int sc, int code) {
int down;
down = key(sc);
if (down) {
if (key_was[sc] == 0) {
post_key(1, code);
}
} else {
if (key_was[sc]) {
post_key(0, code);
}
}
key_was[sc] = down;
}
void I_StartTic() {
/* Esc / Enter / Tab / Backspace */
poll_key(1, 27);
poll_key(28, 13);
poll_key(15, 9);
poll_key(14, 127);
/* Space = KEY_USE (0xa2), Ctrl = KEY_FIRE (0xa3), Shift = KEY_RSHIFT */
poll_key(57, 162);
poll_key(29, 163);
poll_key(42, 182);
poll_key(54, 182);
/* Arrows */
poll_key(72, 173);
poll_key(80, 175);
poll_key(75, 172);
poll_key(77, 174);
/* WASD + strafe alt */
poll_key(17, 119);
poll_key(31, 115);
poll_key(30, 97);
poll_key(32, 100);
/* Numbers for weapons */
poll_key(2, 49);
poll_key(3, 50);
poll_key(4, 51);
poll_key(5, 52);
poll_key(6, 53);
poll_key(7, 54);
poll_key(8, 55);
/* Y/N for quit confirm */
poll_key(21, 121);
poll_key(49, 110);
}
|
Role of this record
The atlas guarantees file-by-file traceability. Responsibility, invariants, ownership, concurrency, security, performance and subsystem interactions belong in authored chapters and must cite this file when applicable.
Document record
ID: source-25eed4a8c9edafad
Reviewed source: da3df29cb397
Class: generated-source-reference