-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCHASECAM.txt
173 lines (125 loc) · 3.55 KB
/
CHASECAM.txt
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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#library "chasecam"
#include "zcommon.acs"
#define C_TID 1000 //Default camera tid
#define MAX_R 68 //Maximum radius (or distance from the player)
#define ADJUST_R 8 //Amount to adjust the camera by
#define VIEW_HEIGHT 42.0 //The approximate hight of the player's view
bool camera_mode[8]; //Variable for turning the camera on or off.
bool camera_mode2[8]; //Variable for turning the camera on or off.
#define C_TIDX 1000 //Default camera tid
#define MAX_RX 220 //Maximum radius (or distance from the player)
#define VIEW_HEIGHTX 100.0 //The approximate height of the player's view
#define VIEW_HEIGHTXMECH 200.0 //The approximate height of the player's view
#define MAX_RXMECH 300 //Maximum radius (or distance from the player)
Script "BDStartCamera" (VOID)
{
camera_mode[PlayerNumber ()] = ON;
ACS_NamedExecuteAlways ("InitializeChasecam", 0, PlayerNumber ());
}
Script "InitializeChasecam" (int p_num)
{
int r = MAX_R;
while (camera_mode[p_num] == ON)
{
int a = GetActorAngle (0);
int p = GetActorPitch (0);
int x = GetActorX (0);
int y = GetActorY (0);
int momz = GetActorVelz (0);
int momx = GetActorVelX (0);
int momy = GetActorVelY (0);
int z = GetActorZ (0) + VIEW_HEIGHT;
int xyr = r * cos (p) >> 16;
if (!ThingCountName ("ChaseCam2", C_TID+p_num))
{
while (!SpawnForced ("ChaseCam2", x-cos(a)*xyr, y-sin(a)*xyr, z+sin(p)*r, C_TID+p_num, a >> 8) && r > 0)
{
r -= ADJUST_R;
xyr = cos (p) * r >> 16;
}
if (ThingCountName ("ChaseCam2", C_TID + p_num))
ChangeCamera (C_TID + p_num, 0, 0);
else
{
camera_mode[p_num] = OFF;
print (s:"Camera script failed to initialize.");
}
}
else
{
while (!SetActorPosition (C_TID+p_num, x-cos(a)*xyr, y-sin(a)*xyr, z+sin(p)*r, 0) && r > 0)
{
r -= ADJUST_R;
xyr = cos (p) * r >> 16;
}
SetActorAngle (C_TID + p_num, a);
SetActorPitch (C_TID + p_num, p);
if (r < MAX_R)
r += ADJUST_R;
}
delay (1);
}
}
Script "BDStopCamera" (VOID)
{
camera_mode[PlayerNumber ()] = OFF;
Thing_Remove (C_TID + PlayerNumber ());
}
Script "BDDisableCameraDisconnect" (int p_num) DISCONNECT
{
camera_mode[p_num] = OFF;
Thing_Remove (C_TID + p_num);
camera_mode2[p_num] = OFF;
Thing_Remove (C_TIDX + p_num);
}
Script "BDActivateCameraBig" (VOID)
{
camera_mode2[PlayerNumber ()] = ON;
ACS_NamedExecuteAlways ("BDBigCamera", 0, PlayerNumber ());
}
Script "BDBigCamera" (int p_num)
{
int r = MAX_RX;
while (camera_mode2[p_num] == ON)
{
int a = GetActorAngle (0);
int p = GetActorPitch (0);
int x = GetActorX (0);
int y = GetActorY (0);
int z = GetActorZ (0) + VIEW_HEIGHTX;
int xyr = r * cos (p) >> 16;
if (!ThingCountName ("chasecam3", C_TIDX+p_num))
{
while (!SpawnForced ("chasecam3", x-cos(a)*xyr, y-sin(a)*xyr, z+sin(p)*r, C_TIDX+p_num, a >> 8) && r > 0)
{
r -= ADJUST_R;
xyr = cos (p) * r >> 16;
}
if (ThingCountName ("chasecam3", C_TIDX + p_num))
ChangeCamera (C_TIDX + p_num, 0, 0);
else
{
camera_mode2[p_num] = OFF;
print (s:"Camera script failed to initialize.");
}
}
else
{
while (!SetActorPosition (C_TIDX+p_num, x-cos(a)*xyr, y-sin(a)*xyr, z+sin(p)*r, 0) && r > 0)
{
r -= ADJUST_R;
xyr = cos (p) * r >> 16;
}
SetActorAngle (C_TIDX + p_num, a);
SetActorPitch (C_TIDX + p_num, p);
if (r < MAX_RX)
r += ADJUST_R;
}
delay (1);
}
}
Script "BDDisableCameraBig" (VOID)
{
camera_mode2[PlayerNumber ()] = OFF;
Thing_Remove (C_TIDX + PlayerNumber ());
}