forked from urxp/dRally
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrace___40864h.c
192 lines (149 loc) · 4.2 KB
/
race___40864h.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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#include "drally.h"
#include "drmath.h"
#include "sfx.h"
#include "drally_structs_free.h"
extern __POINTER__ BACKBUFFER;
extern __BYTE__ ___1d8110h[];
extern __BYTE__ MY_CAR_IDX[];
extern __BYTE__ ___1de580h[];
extern __POINTER__ SIDEBOM1_BPK;
extern __BYTE__ ___243cdch[];
extern __BYTE__ ___243cb8h[];
extern __BYTE__ ___1d7810h[];
extern __BYTE__ ___243334h[];
extern __BYTE__ ___243ca0h[];
extern __BYTE__ ___1de210h[];
extern __BYTE__ ___1de530h[];
extern __BYTE__ ___196de8h[];
extern __BYTE__ ___196dech[];
extern __BYTE__ ___1de7d0h[];
extern __BYTE__ ___196df4h[];
void dRally_Sound_pushEffect(__BYTE__ channel, __BYTE__ n, __DWORD__ unk, __DWORD__ a0, __DWORD__ a1, __DWORD__ a2);
__DWORD__ ___4256ch_cdecl(__POINTER__ A1, __DWORD__ A2, __DWORD__ A3, __DWORD__ A4, __DWORD__ A5, __DWORD__ A6, __DWORD__ A7, __DWORD__ A8);
void DamageWarning(void){
struct_54_t * s_54;
s_54 = (struct_54_t *)___1de7d0h;
if((int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x18) < 0x5000){
if(D(___196de8h) == 0) dRally_Sound_pushEffect(2, SFX_LOOK_OUT, 0, 0x10000, 0x50000, 0x8000);
D(___196de8h) = 1;
}
if((int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x18) < 0x2800){
if(D(___196dech) == 0) dRally_Sound_pushEffect(2, SFX_LOOK_OUT, 0, 0x10000, 0x50000, 0x8000);
D(___196dech) = 1;
}
if((int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x18) == 0){
if(strcmp(s_54[D(MY_CAR_IDX)].__0, "DUKE NUKEM") == 0){
if(D(___196df4h) == 0) dRally_Sound_pushEffect(2, SFX_THIS_SUCKS, 0, 0x10000, 0x50000, 0x8000);
D(___196df4h) = 1;
}
}
}
// WIDESCREEN TOPLEFT CORNER BOX
void race___40864h(void){
__DWORD__ eax, ebx, ecx, edx, edi, esi, ebp, p5, p6, p7, p8;
__BYTE__ esp[0x10];
int i, j, n;
__BYTE__ px;
struct_54_t * s_54;
s_54 = (struct_54_t *)___1de7d0h;
__BYTE__* s = ___1d8110h;
__BYTE__* d = BACKBUFFER + 0x60;
j = 32;
do {
i = 64;
do {
//if ((px = *s++) != 0) *d = px;
//d++;
// no transparency
*d++ = *s++;
} while (--i);
d += 0x200 - 64;
} while (--j);
D(esp+0x8) = (int)((57.0/1024.0/100.0)*(double)(int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x34));
if((int)D(esp+8) < 0) D(esp+0x8) = 0;
edx = 0x3a-B(esp+8);
if(edx != 0){
__BYTE__* d = BACKBUFFER + 0xe64 + B(esp + 8);
int stride = 0x200 - edx;
j = 7;
do {
i = edx;
do {
if ((signed char)*d >= 0x40) *d = 0;
d++;
} while (--i);
d += stride;
} while (--j);
}
if(D(___1de580h+0x94*D(MY_CAR_IDX)+0x2c) == 0){
if((int)D(___243cdch) <= 0){
int n, A0;
A0 = D(___243ca0h);
n = A0 / 70;
eax = n / 60;
___4256ch_cdecl(___1d7810h, 0x6, 0x6, eax, 0x10, 0x207b, -6, 0);
edx = n % 60;
___4256ch_cdecl(___1d7810h, 0x6, 0x6, edx, 0x10, 0x2089, 6, 0);
edx = A0 % 70;
___4256ch_cdecl(___1d7810h, 0x6, 0x6, (int)(1.42*(double)(int)edx), 0x10, 0x2097, 6, 0);
}
else {
int n, A0;
A0 = D(___243cb8h);
n = A0 / 70;
eax = n / 60;
___4256ch_cdecl(___1d7810h, 0x6, 0x6, eax, 0x10, 0x207b, -6, 0);
edx = n % 60;
___4256ch_cdecl(___1d7810h, 0x6, 0x6, edx, 0x10, 0x2089, 6, 0);
edx = A0 % 70;
___4256ch_cdecl(___1d7810h, 0x6, 0x6, (int)(1.42*(double)(int)edx), 0x10, 0x2097, 6, 0);
D(___243cdch) -= D(___243334h);
if((int)D(___243cdch) < 0) D(___243cdch) = 0;
}
}
else {
D(esp+0x4) = (int)((11.0/2048.0/10.0)*(double)(int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x30));
if((int)D(esp+4) < 0) D(esp+0x4) = 0;
edx = 0x37-B(esp+4);
if(edx != 0){
__BYTE__* d = BACKBUFFER + 0x2664 + B(esp + 4);
int stride = 0x200 - edx;
j = 3;
do {
i = edx;
do {
*d++ = 0;
} while (--i);
d += stride;
} while (--j);
}
n = -1;
while(++n < (int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x28)){
__BYTE__* s = SIDEBOM1_BPK;
__BYTE__* d = BACKBUFFER + 0x1a00 + 8 * n + 0x60 ;
j = 6;
do {
i = 8;
do {
if ((px = *s++) != 0) *d = px;
d++;
} while (--i);
d += 0x200 - 8;
} while (--j);
}
}
D(esp) = (int)(100.0-dRMath_ceil((1.0/1024.0)*(double)(int)D(___1de580h+0x94*D(MY_CAR_IDX)+0x18)));
n = ___4256ch_cdecl(___1de210h, 0x8, 0xa, D(esp), 0, 0x2c90, -8, -16);
s = ___1de530h;
d = BACKBUFFER + n;
j = 10;
do {
i = 8;
do {
if ((px = *s++) != 0) *d = px;
d++;
} while (--i);
d += 0x200 - 8;
} while (--j);
DamageWarning();
}