Skip to content

Commit f0be40d

Browse files
authored
Merge pull request #139 from OpenDriver2/develop-SoapyMan
Beta 3 bug fixes
2 parents b756488 + 90002e4 commit f0be40d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+846
-517
lines changed

.emscripten/notes.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 7.2.{build}
1+
version: 7.4.{build}
22

33
branches:
44
only:

src_rebuild/DebugOverlay.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,19 @@ void DrawDebugOverlays()
9494
PrintString(tempBuf, 10, 20);
9595

9696
extern volatile int spoolactive;
97-
sprintf(tempBuf, "Spooling: %d spec: %d, active: %d", doSpooling, allowSpecSpooling, spoolactive);
98-
PrintString(tempBuf, 10, 30);
99-
10097
extern int numActiveCops;
10198
extern int numCopCars;
10299
extern int numCivCars;
103100
extern int numParkedCars;
104101
extern int maxCopCars;
105102
extern int maxCivCars;
103+
extern int current_region;
104+
extern int LoadedArea;
105+
106+
Spool* spoolptr = (Spool*)(RegionSpoolInfo + spoolinfo_offsets[current_region]);
107+
108+
sprintf(tempBuf, "Spooling: %d spec: %d, active: %d, Reg: %d, Ar: %d, Cn: %d %d", doSpooling, allowSpecSpooling, spoolactive, current_region, LoadedArea, spoolptr->connected_areas[0] & 0x3f, spoolptr->connected_areas[1] & 0x3f);
109+
PrintString(tempBuf, 10, 30);
106110

107111
sprintf(tempBuf, "Civs: %d - %d parked - max %d", numCivCars, numParkedCars, maxCivCars);
108112
PrintString(tempBuf, 10, 40);
@@ -182,12 +186,18 @@ void DrawDebugOverlays()
182186
);
183187

184188
PrintString(tempBuf, 10, 195);
189+
190+
sprintf(tempBuf, "c %d %d %d %d",
191+
(int)(*roadInfo.ConnectIdx)[0], (int)(*roadInfo.ConnectIdx)[1], (int)(*roadInfo.ConnectIdx)[2], (int)(*roadInfo.ConnectIdx)[3]);
192+
193+
PrintString(tempBuf, 10, 205);
185194
}
186195
else if(IS_JUNCTION_SURFACE(roadInfo.surfId))
187196
{
188197
DRIVER2_JUNCTION* junc = GET_JUNCTION(roadInfo.surfId);
189198

190-
sprintf(tempBuf, "JUN %d flg %d",roadInfo.surfId, junc->flags);
199+
sprintf(tempBuf, "JUN %d flg %d - c %d %d %d %d",roadInfo.surfId, junc->flags,
200+
(int)(*roadInfo.ConnectIdx)[0], (int)(*roadInfo.ConnectIdx)[1], (int)(*roadInfo.ConnectIdx)[2], (int)(*roadInfo.ConnectIdx)[3]);
191201

192202
PrintString(tempBuf, 10, 180);
193203
}

src_rebuild/Game/C/ai.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int TannerStuckInCar(int doSpeedCheck, int player_id)
7070
playerFelony = &cp->felonyRating;
7171
}
7272

73-
if ((*playerFelony <= FELONY_MIN_VALUE || player_position_known < 1) &&
73+
if ((*playerFelony <= FELONY_PURSUIT_MIN_VALUE || player_position_known < 1) &&
7474
cp &&
7575
(cp->hd.wheel[1].surface & 7) != 1 &&
7676
(cp->hd.wheel[3].surface & 7) != 1)

src_rebuild/Game/C/bcollide.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ int bcollided2d(CDATA2D *body, int* boxOverlap)
4545
}
4646

4747
// hmmm, why?
48-
as = rcossin_tbl[(dtheta & 0x7ff) * 2];
49-
ac = rcossin_tbl[(dtheta + 1024 & 0x7ff) * 2];
48+
as = RSIN(dtheta & 0x7ff); // rcossin_tbl[(dtheta & 0x7ff) * 2];
49+
ac = RSIN(dtheta + 1024 & 0x7ff); // rcossin_tbl[(dtheta + 1024 & 0x7ff) * 2];
5050

5151
delta.vx = body[0].x.vx - body[1].x.vx;
5252
delta.vz = body[0].x.vz - body[1].x.vz;

src_rebuild/Game/C/civ_ai.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist
535535
exitCnt++;
536536
} while (exitCnt < 3);
537537

538-
if (leftLane != rightLane && numExits != 1)
538+
if (leftLane != rightLane && numExits != 1 && ROAD_LANES_COUNT(&currentRoadInfo) > 1)
539539
{
540540
if (cp->ai.c.currentLane == leftLane)
541541
{

src_rebuild/Game/C/cop_ai.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void UpdateCopSightData(void)
216216
else
217217
playerFelony = &car_data[player[0].playerCarId].felonyRating;
218218

219-
if (*playerFelony > FELONY_MIN_VALUE)
219+
if (*playerFelony > FELONY_PURSUIT_MIN_VALUE)
220220
{
221221
copSightData.surroundViewDistance = 5440;
222222
copSightData.frontViewDistance = 16320;
@@ -858,7 +858,7 @@ void ControlCopDetection(void)
858858
}
859859

860860
// [A] if Tanner is outside car, cops can arrest him if they are too close
861-
if(player[0].playerType == 2 && minDistanceToPlayer < 2048 && !player[0].dying && pedestrianFelony > FELONY_MIN_VALUE)
861+
if(player[0].playerType == 2 && minDistanceToPlayer < 2048 && !player[0].dying && pedestrianFelony > FELONY_PURSUIT_MIN_VALUE)
862862
{
863863
player[0].dying = 1;
864864

@@ -963,7 +963,7 @@ void PassiveCopTasks(CAR_DATA *cp)
963963
else
964964
playerFelony = &car_data[player[0].playerCarId].felonyRating;
965965

966-
if (*playerFelony <= FELONY_MIN_VALUE)
966+
if (*playerFelony <= FELONY_PURSUIT_MIN_VALUE)
967967
return;
968968

969969
// [A] make an ambush on player in Destroy the yard
@@ -1136,7 +1136,9 @@ void ControlCops(void)
11361136
// play the phrases about direction
11371137
if (first_offence == 0 && CopsCanSeePlayer && numActiveCops != 0)
11381138
{
1139-
if (*playerFelony > 658 && TimeSinceLastSpeech > 720 && targetVehicle->hd.speed > 20)
1139+
if (*playerFelony > FELONY_PURSUIT_MIN_VALUE &&
1140+
TimeSinceLastSpeech > 720 &&
1141+
targetVehicle->hd.speed > 20)
11401142
{
11411143
int rnd;
11421144
heading = GetCarDirectionOfTravel(targetVehicle);
@@ -1182,7 +1184,7 @@ void ControlCops(void)
11821184
if (CopsCanSeePlayer && OutOfSightCount < 256 || // [A] was player_position_known. Resolves speech in some missions
11831185
player_position_known > 1 && GameType == GAME_GETAWAY)
11841186
{
1185-
if (*playerFelony > FELONY_MIN_VALUE)
1187+
if (*playerFelony > FELONY_PURSUIT_MIN_VALUE)
11861188
copsWereInPursuit = 1;
11871189
}
11881190

src_rebuild/Game/C/cutrecorder.c

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifdef CUTSCENE_RECORDER
66

77
#include "driver2.h"
8+
#include "cutrecorder.h"
89

910
#include "main.h"
1011
#include "pad.h"
@@ -118,53 +119,53 @@ int CutRec_GotoChase(int number)
118119

119120
void CutRec_Step()
120121
{
121-
// goto previous chase
122-
if (Pads[0].dirnew & CAR_PAD_LEFT)
122+
if (gCutsceneChaseAutoTest != 0 && CutRec_IsPlaying())
123123
{
124-
CutRec_GotoChase(gCutsceneChaseAutoTest - 1);
125-
return;
126-
}
124+
// goto previous chase
125+
if (Pads[0].dirnew & CAR_PAD_LEFT)
126+
{
127+
CutRec_GotoChase(gCutsceneChaseAutoTest - 1);
128+
return;
129+
}
127130

128-
// goto next chase
129-
if (Pads[0].dirnew & CAR_PAD_RIGHT)
130-
{
131-
CutRec_GotoChase(gCutsceneChaseAutoTest + 1);
132-
return;
133-
}
134-
135-
if (!pauseflag)
136-
{
137-
if(gCutsceneChaseAutoTest != 0)
131+
// goto next chase
132+
if (Pads[0].dirnew & CAR_PAD_RIGHT)
133+
{
134+
CutRec_GotoChase(gCutsceneChaseAutoTest + 1);
135+
return;
136+
}
137+
138+
if (!pauseflag)
138139
{
139140
int carId = player[gCutsceneAsReplay_PlayerId].playerCarId;
140-
141+
141142
if (car_data[carId].hd.speed < 5)
142143
gChaseStuckTimer++;
143144
else
144145
gChaseStuckTimer = 0;
145146

146-
if(gChaseStuckTimer > 45)
147+
if (gChaseStuckTimer > 45)
147148
{
148149
gAutoTestStats[gCutsceneChaseAutoTest].stuck = 1;
149150
gChaseStuckTimer = 0;
150151
}
151-
}
152-
153-
return;
154-
}
155152

156-
if(gCutsceneChaseAutoTest != 0 && gCutsceneChaseAutoTest < 15 &&
157-
NoPlayerControl && ReplayParameterPtr->RecordingEnd - 2 < CameraCnt || gDieWithFade)
158-
{
159-
gCutsceneChaseAutoTest++;
153+
return;
154+
}
160155

161-
// load next replay and restart
162-
if (!CutRec_GotoChase(gCutsceneChaseAutoTest))
156+
if (gCutsceneChaseAutoTest < 15 &&
157+
(NoPlayerControl && ReplayParameterPtr->RecordingEnd - 2 < CameraCnt || gDieWithFade))
163158
{
164-
printInfo("------- AUTOTEST RESULTS -------\n");
165-
for(int i = 0; i < 15; i++)
166-
printInfo(" chase %d - hit cars: %d, stuck: %d\n", i, gAutoTestStats[i].numHitCars, gAutoTestStats[i].stuck);
167-
printInfo("------- ---------------- -------\n");
159+
gCutsceneChaseAutoTest++;
160+
161+
// load next replay and restart
162+
if (!CutRec_GotoChase(gCutsceneChaseAutoTest))
163+
{
164+
printInfo("------- AUTOTEST RESULTS -------\n");
165+
for (int i = 0; i < 15; i++)
166+
printInfo(" chase %d - hit cars: %d, stuck: %d\n", i, gAutoTestStats[i].numHitCars, gAutoTestStats[i].stuck);
167+
printInfo("------- ---------------- -------\n");
168+
}
168169
}
169170
}
170171
}
@@ -200,12 +201,20 @@ void CutRec_Draw()
200201
PrintString(text, 5, 215);
201202
}
202203

203-
if (gAutoTestStats[gCutsceneChaseAutoTest].numHitCars > 0)
204+
if(PingBufferPos >= MAX_REPLAY_PINGS-1)
204205
SetTextColour(128, 0, 0);
205206

206-
sprintf(text, "Hit cars: %d", gAutoTestStats[gCutsceneChaseAutoTest].numHitCars);
207+
sprintf(text, "Pings: %d", PingBufferPos);
207208
PrintString(text, 5, 205);
208209

210+
SetTextColour(128, 128, 128);
211+
212+
if (gAutoTestStats[gCutsceneChaseAutoTest].numHitCars > 0)
213+
SetTextColour(128, 0, 0);
214+
215+
sprintf(text, "Hit cars: %d", gAutoTestStats[gCutsceneChaseAutoTest].numHitCars);
216+
PrintString(text, 120, 205);
217+
209218
if(gAutoTestStats[gCutsceneChaseAutoTest].stuck)
210219
{
211220
SetTextColour(128, 0, 0);
@@ -403,10 +412,7 @@ int CutRec_StorePingInfo(int cookieCount, int carId)
403412
PING_PACKET* buffer;
404413
PING_PACKET* packet;
405414

406-
if (gCutsceneAsReplay == 0)
407-
return 0;
408-
409-
if (CurrentGameMode == GAMEMODE_REPLAY || gInGameChaseActive != 0)
415+
if (!CutRec_IsRecording())
410416
return 0;
411417

412418
if (PingBufferPos < MAX_REPLAY_PINGS-1)
@@ -417,12 +423,16 @@ int CutRec_StorePingInfo(int cookieCount, int carId)
417423

418424
packet->cookieCount = cookieCount;
419425

426+
PingBuffer[PingBufferPos - 1] = *packet;
427+
420428
// always finalize last ping
421429
packet = &NewPingBuffer[PingBufferPos];
422430
packet->frame = 0xffff;
423431
packet->carId = -1;
424432
packet->cookieCount = -1;
425433

434+
435+
426436
return 1;
427437
}
428438

@@ -780,4 +790,20 @@ int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
780790
return 1;
781791
}
782792

793+
int CutRec_IsRecording()
794+
{
795+
if (gCutsceneAsReplay == 0)
796+
return 0;
797+
798+
return CurrentGameMode != GAMEMODE_REPLAY;
799+
}
800+
801+
int CutRec_IsPlaying()
802+
{
803+
if (gCutsceneAsReplay == 0)
804+
return 0;
805+
806+
return CurrentGameMode == GAMEMODE_REPLAY;
807+
}
808+
783809
#endif // CUTSCENE_RECORDER

src_rebuild/Game/C/cutrecorder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ extern char gCurrentChasePauseText[64];
1212
extern void InitChaseAutoTest(char* configFilename);
1313
extern void InitCutsceneRecorder(char* configFilename);
1414

15+
extern int CutRec_IsRecording();
16+
extern int CutRec_IsPlaying();
17+
1518
extern void CutRec_Reset();
1619
extern void CutRec_Step();
1720
extern void CutRec_Draw();
@@ -29,6 +32,8 @@ extern int CutRec_SaveChase();
2932

3033
#define _CutRec_IsAutoTestOn() (gCutsceneChaseAutoTest != 0)
3134
#define _CutRec_IsOn() (gCutsceneAsReplay != 0)
35+
#define _CutRec_IsRecording() CutRec_IsRecording()
36+
#define _CutRec_IsPlaying() CutRec_IsPlaying()
3237
#define _CutRec_Step() CutRec_Step()
3338
#define _CutRec_Draw() CutRec_Draw()
3439
#define _CutRec_Reset() CutRec_Reset()
@@ -45,6 +50,8 @@ extern int CutRec_SaveChase();
4550

4651
#define _CutRec_IsAutoTestOn() (0)
4752
#define _CutRec_IsOn() (0)
53+
#define _CutRec_IsRecording() (0)
54+
#define _CutRec_IsPlaying() (0)
4855
#define _CutRec_Step() (0)
4956
#define _CutRec_Draw() (0)
5057
#define _CutRec_Reset() (0)

src_rebuild/Game/C/debris.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ void AddGroundDebris(void)
10231023

10241024
seed = rand();
10251025

1026-
Position.vy = -cop->pos.vy - 45;
1026+
Position.vy = cop->pos.vy - 45;
10271027
Position.vx = cop->pos.vx + ((seed & 0x3ff) - 512);
10281028
Position.vz = cop->pos.vz + ((rand() & 0x3ff) - 512);
10291029

0 commit comments

Comments
 (0)