forked from lukaszdk/ps2doom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d_command.c
92 lines (72 loc) · 1.79 KB
/
d_command.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <string.h>
#include "s_sound.h"
#include "d_main.h"
#include <sjpcm.h>
/****************************************************************************
** ps2doom cheat support - code typing and command line **
*****************************************************************************/
void ps2_do_cheat(int cheat)
{
event_t event;
char *str;
int i;
// todo: scanf("%d", cheat);
switch (cheat)
{
case 1: // God Mode
str = "iddqd";
break;
case 2: // Good fucking arsenal
str = "idfa";
break;
case 3: // Key Full Ammo
str = "idkfa";
break;
case 4: // No Clipping
str = "idclip";
break;
case 5: // Toggle Map
str = "iddt";
break;
case 6: // Invincible with Chainsaw
str = "idchoppers";
break;
case 7: // Berserker Strength Power-up
str = "idbeholds";
break;
case 8: //Invincibility Power-up
str = "idbeholdv";
break;
case 9: // Invisibility Power-Up
str = "idbeholdi";
break;
case 10: //Automap Power-up
str = "idbeholda";
break;
case 11: //Anti-Radiation Suit Power-up
str = "idbeholdr";
break;
case 12: // Light-Amplification Visor Power-up
str = "idbeholdl";
break;
case 13:
str = "no_sound"; //Deactivates the sound
SjPCM_Pause();
return;
break;
case 14:
str = "no_music";
S_StopMusic();
return;
break;
}
for (i=0; i<strlen(str); i++)
{
event.type = ev_keydown;
event.data1 = str[i];
D_PostEvent (&event);
event.type = ev_keyup;
event.data1 = str[i];
D_PostEvent (&event);
}
}