forked from urxp/dRally
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrace___52ac4h.c
75 lines (57 loc) · 2.09 KB
/
race___52ac4h.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
#include "drally.h"
#include "drally_structs_free.h"
#pragma pack(1)
typedef struct spectator_s {
__DWORD__ x;
__DWORD__ y;
__DWORD__ type;
__DWORD__ z_mov;
__DWORD__ rot;
__DWORD__ frame;
__DWORD__ dead;
__DWORD__ timestamp;
} spectator_t;
#define SPECTATORS ___1df720h
extern spectator_t ___1df720h[];
extern __BYTE__ ___243c60h[];
extern __BYTE__ ___1e6ed0h[];
extern __POINTER__ ___243d74h;
extern __BYTE__ ___1de580h[];
extern __BYTE__ MY_CAR_IDX[];
int rand_watcom106(void);
void dRally_Sound_pushEffect(__BYTE__ channel, __BYTE__ n, __DWORD__ unk, __DWORD__ a0, __DWORD__ a1, __DWORD__ a2);
// run over spectator
void race___52ac4h(void){
__DWORD__ n, a, b, c, d;
struct_35e_t * s_35e;
s_35e = (struct_35e_t *)___1e6ed0h;
n = -1;
while(++n < 0x14){
if(SPECTATORS[n].dead == 0){
c = (int)s_35e[D(___243c60h)].XLocation-(SPECTATORS[n].x+8);
d = (int)s_35e[D(___243c60h)].YLocation-(SPECTATORS[n].y+8);
if((abs(c) < 0x14)&&(abs(d) < 0x14)&&(B(c+0x14+0x28*(d+0x14)+___243d74h+s_35e[D(___243c60h)].ImgOffset) > 3)){
SPECTATORS[n].frame = 0;
SPECTATORS[n].dead = 1;
if(s_35e[D(___243c60h)].Finished == 0){
D(0x94*D(___243c60h)+___1de580h+0x18) -= 3*(0x400-D(0x94*D(___243c60h)+___1de580h+0x1c));
}
if((int)D(0x94*D(___243c60h)+___1de580h+0x18) < 0) D(0x94*D(___243c60h)+___1de580h+0x18) = 0;
s_35e[D(___243c60h)].XLocation += (float)(rand_watcom106()%7-3);
s_35e[D(___243c60h)].YLocation += (float)(rand_watcom106()%7-3);
s_35e[D(___243c60h)].__b0 *= -0.1f;
s_35e[D(___243c60h)].__104 = (float)(rand_watcom106()%0xa-5);
s_35e[D(___243c60h)].__352 = 0x2d;
if(D(___243c60h) != D(MY_CAR_IDX)){
a = (int)((double)s_35e[D(___243c60h)].XLocation-(double)s_35e[D(MY_CAR_IDX)].XLocation);
b = (int)((double)s_35e[D(___243c60h)].YLocation-(double)s_35e[D(MY_CAR_IDX)].YLocation);
c = 0x10000-0x4b*sqrt(a*a+b*b);
if((int)c > 0x1000) dRally_Sound_pushEffect(3, rand_watcom106()%3+7, 0, c, 0x50000, 0x8000);
}
else {
dRally_Sound_pushEffect(3, rand_watcom106()%3+7, 0, 0x9000, 0x50000, 0x8000);
}
}
}
}
}