Skip to content

Commit

Permalink
Merge pull request #49 from OpenDriver2/develop-SoapyMan
Browse files Browse the repository at this point in the history
A lot of code cleaning up, LeadAI refactoring
  • Loading branch information
SoapyMan committed Dec 24, 2020
2 parents f5d9487 + 29aeac3 commit d1a8ba9
Show file tree
Hide file tree
Showing 217 changed files with 20,127 additions and 56,982 deletions.
1 change: 1 addition & 0 deletions .appveyor/AfterBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ set -ex
for config in debug release release_dev
do
cd "${APPVEYOR_BUILD_FOLDER}/src_rebuild/bin/${config^}"
cp -R ${APPVEYOR_BUILD_FOLDER}/data/* ./
tar -czf "REDRIVER2_${config^}.tar.gz" *
done
2 changes: 1 addition & 1 deletion .appveyor/Build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd "$APPVEYOR_BUILD_FOLDER/src_rebuild"

./premake5 gmake2

for config in debug release release_dev
for config in debug_x86 release_x86 release_dev_x86
do
make config=$config -j$(nproc)
done
2 changes: 1 addition & 1 deletion .appveyor/Install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ sudo apt-get install -qq aptitude -y
# fix Ubuntu's broken mess of packages using aptitude
sudo aptitude install --quiet=2 \
g++-multilib libsdl2-2.0-0:i386 libsdl2-dev:i386 \
libopenal1:i386 libopenal-dev:i386 libjpeg-turbo8:i386 \
libopenal-dev:i386 libjpeg-turbo8:i386 \
libjpeg-turbo8-dev:i386 -y

2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 5.4.{build}
version: 5.6.{build}

branches:
only:
Expand Down
85 changes: 85 additions & 0 deletions data/ENGLISH_GAME.LTXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Damage
Felony
Proximity
Best
Cone
Gate
Check
Cones
Gates
Checks
Flags
Lap
Out of tape
DEMO
Fast forward
Auto direct
Please wait...
Are You Sure?
Paused
Mission Successful
Mission Failed
Game Over
High Scores
Enter Name
Quit to system?
Loading configuration...
Loading error
No saved data
Saving configuration...
Saving error
Loading progress...
Saving progress...
OK
YES
NO
Save game
Save replay
Continue
Show Map
Restart
Sfx Volume
Music Volume
Film Director
Quick Replay
Exit
Rotation
Move
Skip cutscene
Retry mission
Play again
View table
Enter score
Please insert controller into Port 1
Please insert controller into Port 2
Incorrect controller in Port 1
Incorrect controller in Port 2
Player 1
Player 2
Name
Time
Sorry, no secrets
Mountain track
Circuit
Invincibility
Immunity
Bonus Gallery
Pause
Play
Auto Director
Fast Forward
Frame Advance
Rewind to beginning
Add Camera
Edit Camera
In Car
Chase Camera
Tripod Camera
Move Camera Start
Delete Camera
Accept
You or Pursuer
Move Camera
Lock to Car
Rotate
Zoom
97 changes: 97 additions & 0 deletions data/ENGLISH_MISSION.LTXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
Chicago
Havana
Las Vegas
Rio De Janeiro
Surveillance tip off
Chase the witness
Train pursuit
Tailing the drop
Escape to the safe house
Chase the intruder
Caine's compound
Leaving Chicago
Follow up the lead
Hijack the truck
Stop the truck
Find the clue
Escape to ferry
To the docks
Back to Jones
Tail Jericho
Pursue Jericho
Escape the Brazilians
Casino getaway
Beat the train
Car bomb
Car bomb getaway
Bank job
Steal the ambulance
Stake Out
Steal the keys
C4 deal
Destroy the yard
Bus crash
Steal the cop car
Caine's cash
Save Jones
Boat jump
Jones in trouble
Chase the Gun Man
Lenny escaping
Lenny gets caught
Red River
The morgue
The Witness
Lenny's apartment
The Cuba Connection
The Intruder
Meeting Caine
Leaving Town
Looking for a lead
Moving out
Watching the truck
Rosanna Soto Clue
The Dockyard
The Hit
Seizing Jericho
Vasquez in Vegas
Trading Jericho
Bank job
The Pool Hall
Caine's Warpath
Caine in Rio
Warning Jones
The Shootout
Lenny's getaway
Lenny gets it
Back in Chicago
Vasquez meets Caine
Credits
Downtown
Wrigleyville
Greektown
Grant Park
Meigs Field
Ukrainian Village
River North
Cabrini Green
Necropolis de Colon
Capitolio
Old Havana
The Docks
Vedado
Plaza
Plaza de la Revolucion
Upper Strip
Lakeside
Mid Strip
North Vegas
Lakes
Ghost Town
Centro
Copacabana
Santa Tereza
Lagoa Rodrigo de Freitas
Praca da Bandeira
Leblon
Flamengo
8 changes: 5 additions & 3 deletions data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ up=up
down=down
left=left
right=right
start=e
select=r
start=w
select=H

[render]
windowWidth=1280
Expand All @@ -41,8 +41,10 @@ bilinearFiltering=0 # "smooth" textures
pgxpZbuffer=0 # full Z-buffer on PSX polygons

[game]
languageId=0 # 0 = ENGLISH; 1 = ITALIAN; 2 = GERMAN; 3 = FRENCH; 4 = SPANISH;
drawDistance=1800 # 441..1800
freeCamera=1 # Press F7 in game to enable
fastLoadingScreens=1
widescreenOverlays=1 # set 1 to see map, bars and stats aligned to screen corners
driver1music=0 # put Driver 1's MUSIC.BIN as D1MUSIC.BIN to DRIVER2\SOUNDS folder
driver1music=0 # put Driver 1's MUSIC.BIN as D1MUSIC.BIN to DRIVER2\SOUNDS folder
userChases=RacingFreak,Snoopi,Olanov,Vortex,Fireboyd78
100 changes: 90 additions & 10 deletions src_rebuild/DebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "C/PRES.H"
#include "C/SPOOL.H"
#include "C/CARS.H"
#include "C/COP_AI.H"
#include "C/DR2ROADS.H"
#include "C/PLAYERS.H"
#include "C/GLAUNCH.H"

Expand Down Expand Up @@ -76,11 +78,11 @@ void DrawDebugOverlays()
gDebug_numLines = 0;

DR_TPAGE* tp = (DR_TPAGE*)current->primptr;
setDrawTPage(tp, 0, 0, 0);
setDrawTPage(tp, 1, 1, 0);
addPrim(current->ot + 2, tp);
current->primptr += sizeof(DR_TPAGE);

char tempBuf[128];
char tempBuf[1024];

int primTabLeft = current->primptr - current->primtab;

Expand All @@ -105,18 +107,94 @@ void DrawDebugOverlays()
sprintf(tempBuf, "Civs: %d - %d parked - max %d", numCivCars, numParkedCars, maxCivCars);
PrintString(tempBuf, 10, 40);

sprintf(tempBuf, "Cops: %d - %d active - max %d", numCopCars, numActiveCops, maxCopCars);
sprintf(tempBuf, "Cops: %d - %d active - max %d - seen: %d", numCopCars, numActiveCops, maxCopCars, CopsCanSeePlayer);
PrintString(tempBuf, 10, 50);


int playerCar = player[0].playerCarId;
int speed = car_data[playerCar].hd.speed;

sprintf(tempBuf, "Car speed: %d", speed);
sprintf(tempBuf, "Mission %d Chase: %d", gCurrentMissionNumber, gRandomChase);
PrintString(tempBuf, 10, 60);

sprintf(tempBuf, "Mission %d Chase: %d", gCurrentMissionNumber, gRandomChase);
PrintString(tempBuf, 10, 70);
int playerCar = player[0].playerCarId;
if(playerCar >= 0)
{

int speed = car_data[playerCar].hd.speed;

sprintf(tempBuf, "Car speed: %d direction: %d", speed, car_data[playerCar].hd.direction);
PrintString(tempBuf, 10, 80);

VECTOR* carPos = (VECTOR*)car_data[playerCar].hd.where.t;

DRIVER2_ROAD_INFO roadInfo;
roadInfo.surfId = GetSurfaceIndex(carPos);


if (GetSurfaceRoadInfo(&roadInfo, roadInfo.surfId))
{
int dx, dz;
int segLen, distAlongSegment;
int theta;

if (roadInfo.straight)
{
dx = carPos->vx - roadInfo.straight->Midx;
dz = carPos->vz - roadInfo.straight->Midz;

segLen = roadInfo.straight->length;
theta = (roadInfo.straight->angle - ratan2(dx, dz) & 0xfffU);
distAlongSegment = (segLen / 2) + FIXEDH(rcossin_tbl[theta * 2 + 1] * SquareRoot0(dx * dx + dz * dz));
}
else
{
dx = carPos->vx - roadInfo.curve->Midx;
dz = carPos->vz - roadInfo.curve->Midz;

theta = ratan2(dx,dz);
segLen = (roadInfo.curve->end - roadInfo.curve->start & 0xfffU); // *roadInfo.curve->inside * 11 / 7; // don't use physical length

if (roadInfo.curve->inside < 10)
distAlongSegment = (theta & 0xfffU) - roadInfo.curve->start & 0xf80;
else if (roadInfo.curve->inside < 20)
distAlongSegment = (theta & 0xfffU) - roadInfo.curve->start & 0xfc0;
else
distAlongSegment = (theta & 0xfffU) - roadInfo.curve->start & 0xfe0;
}

int lane = GetLaneByPositionOnRoad(&roadInfo, carPos);

sprintf(tempBuf, "%s %d flg %d%d%d spd %d len %d",
roadInfo.straight ? "STR" : "CRV",
roadInfo.surfId,
(roadInfo.NumLanes & 0x20) > 0, // flag 0 - first lane?
(roadInfo.NumLanes & 0x40) > 0, // flag 1 - leftmost park
(roadInfo.NumLanes & 0x80) > 0, // flag 2 - rightmost park
ROAD_SPEED_LIMIT(&roadInfo), // speed limit id
segLen
);

PrintString(tempBuf, 10, 180);

sprintf(tempBuf, "dir %d lane %d/%d AI %d dist: %d",
ROAD_LANE_DIR(&roadInfo, lane), // direction bit
lane + 1,
ROAD_WIDTH_IN_LANES(&roadInfo), // lane count. * 2 for both sides as roads are symmetric
ROAD_IS_AI_LANE(&roadInfo, lane), // lane AI driveable flag
distAlongSegment
);

PrintString(tempBuf, 10, 195);
}
else if(IS_JUNCTION_SURFACE(roadInfo.surfId))
{
DRIVER2_JUNCTION* junc = GET_JUNCTION(roadInfo.surfId);

sprintf(tempBuf, "JUN %d flg %d",roadInfo.surfId, junc->flags);

PrintString(tempBuf, 10, 180);
}


}

}
}

Expand Down Expand Up @@ -155,7 +233,9 @@ void Debug_Line2D(SXYPAIR& pointA, SXYPAIR& pointB, CVECTOR& color)
line->g0 = color.g;
line->b0 = color.b;

#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS)
line->pgxp_index = 0xFFFF;
#endif

addPrim(current->ot, line);

Expand Down
16 changes: 8 additions & 8 deletions src_rebuild/GAME/ASM/RNC_2.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

struct RNCheader
{
unsigned long identifier; //must contain 'R', 'N', 'C', method
unsigned long unpackSize; //unpacked data size
unsigned long packSize; //packed data size (excludes this header)
unsigned short unpackChecksum; //unpacked data checksum
unsigned short packChecksum; //packed data checksum
unsigned char leeway; //not used
unsigned char blocks; //number of sections
//unsigned char start; //first byte of data
u_int identifier; //must contain 'R', 'N', 'C', method
u_int unpackSize; //unpacked data size
u_int packSize; //packed data size (excludes this header)
u_short unpackChecksum; //unpacked data checksum
u_short packChecksum; //packed data checksum
u_char leeway; //not used
u_char blocks; //number of sections
//u_char start; //first byte of data
};

#define RNC_HEADER_LENGTH 18
Expand Down

0 comments on commit d1a8ba9

Please sign in to comment.