Merge pull request #147 from OpenDriver2/develop-SoapyMan

RC1 fixes
This commit is contained in:
Ilya 2022-02-04 21:27:56 +03:00 committed by GitHub
commit acca6b1393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
155 changed files with 2598 additions and 24966 deletions

View File

@ -9,7 +9,7 @@ curl "$linux_premake_url" -Lo premake5.tar.gz
tar xvf premake5.tar.gz
sudo apt-get update -qq -y
sudo apt-get install --no-install-recommends -y g++-7-multilib gcc-7-multilib
sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib
sudo apt-get install -qq aptitude -y
# fix Ubuntu's broken mess of packages using aptitude

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src_rebuild/PsyCross"]
path = src_rebuild/PsyCross
url = https://github.com/OpenDriver2/PsyCross.git

Binary file not shown.

View File

@ -0,0 +1,2 @@
mkpsxiso.exe redriver2_cd.xml -y
pause

View File

@ -1,128 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- MKPSXISO example XML script -->
<iso_project image_name="REDRIVER2.bin" cue_sheet="REDRIVER2.cue">
<!-- <track>
Specifies a track to the ISO project. This example element creates a data
track for storing data files and CD-XA/STR streams.
Only one data track is allowed and data tracks must only be specified as the
first track in the ISO image and cannot be specified after an audio track.
Attributes:
type - Track type (either data or audio).
source - For audio tracks only, specifies the file name of a wav audio
file to use for the audio track.
-->
<track type = "data" >
<identifiers
system = "PLAYSTATION"
application = "PLAYSTATION"
volume = "DRIVER2"
volumeset = "DRIVER2"
publisher = "INFOGRAMES"
datapreparer = "INFOGRAMES"
/>
<license file = "licensea.dat"/>
<directory_tree>
<file name = "SYSTEM.CNF" type = "data" source="SYSTEM.CNF"/>
<file name = "DRIVER2.EXE" type = "data" source="0_CD_DATA\DRIVER2.ps-exe"/>
<dir name = "DRIVER2">
<file name = "FRONTEND.BIN" type = "data" source="0_CD_DATA\Overlay.frnt"/>
<file name = "LEAD.BIN" type = "data" source="0_CD_DATA\Overlay.lead"/>
<file name = "PATH.BIN" type = "data" source="0_CD_DATA\Overlay.path"/>
<dir name = "DATA">
<file name = "SKY0.RAW" type = "data" source="0_CD_DATA\DATA\SKY0.RAW"/>
<file name = "SKY1.RAW" type = "data" source="0_CD_DATA\DATA\SKY1.RAW"/>
<file name = "SKY2.RAW" type = "data" source="0_CD_DATA\DATA\SKY2.RAW"/>
<file name = "SKY3.RAW" type = "data" source="0_CD_DATA\DATA\SKY3.RAW"/>
<file name = "SCRS.BIN" type = "data" source="0_CD_DATA\DATA\SCRS.BIN"/>
<file name = "FEFONT.BNK" type = "data" source="0_CD_DATA\DATA\FEFONT.BNK"/>
<file name = "GFX.RAW" type = "data" source="0_CD_DATA\DATA\GFX.RAW"/>
<file name = "CITY.RAW" type = "data" source="0_CD_DATA\DATA\CITY.RAW"/>
<file name = "CITYBACK.RAW" type = "data" source="0_CD_DATA\DATA\CITYBACK.RAW"/>
<file name = "VOL.RAW" type = "data" source="0_CD_DATA\DATA\VOL.RAW"/>
<file name = "CARCONT.RAW" type = "data" source="0_CD_DATA\DATA\CARCONT.RAW"/>
<file name = "TANCONT.RAW" type = "data" source="0_CD_DATA\DATA\TANCONT.RAW"/>
<dir name = "CARS">
<file name = "CARBACK.RAW" type = "data" source="0_CD_DATA\DATA\CARS\CARBACK.RAW"/>
<file name = "CCARS.RAW" type = "data" source="0_CD_DATA\DATA\CARS\CCARS.RAW"/>
<file name = "HCARS.RAW" type = "data" source="0_CD_DATA\DATA\CARS\HCARS.RAW"/>
<file name = "VCARS.RAW" type = "data" source="0_CD_DATA\DATA\CARS\VCARS.RAW"/>
<file name = "RCARS.RAW" type = "data" source="0_CD_DATA\DATA\CARS\RCARS.RAW"/>
</dir>
<dir name = "CUTS">
<file name = "CUTBACK.RAW" type = "data" source="0_CD_DATA\DATA\CUTS\CUTBACK.RAW"/>
<file name = "CCUTS.RAW" type = "data" source="0_CD_DATA\DATA\CUTS\CCUTS.RAW"/>
<file name = "HCUTS.RAW" type = "data" source="0_CD_DATA\DATA\CUTS\HCUTS.RAW"/>
<file name = "VCUTS.RAW" type = "data" source="0_CD_DATA\DATA\CUTS\VCUTS.RAW"/>
<file name = "RCUTS.RAW" type = "data" source="0_CD_DATA\DATA\CUTS\RCUTS.RAW"/>
</dir>
</dir>
<dir name = "GFX">
<file name = "FONT2.FNT" type = "data" source="0_CD_DATA\GFX\FONT2.FNT"/>
<file name = "SPLASH1N.TIM" type = "data" source="0_CD_DATA\GFX\SPLASH1N.TIM"/>
<file name = "LOADCHIC.TIM" type = "data" source="0_CD_DATA\GFX\LOADCHIC.TIM"/>
<file name = "LOADHAVA.TIM" type = "data" source="0_CD_DATA\GFX\LOADHAVA.TIM"/>
<file name = "LOADVEGA.TIM" type = "data" source="0_CD_DATA\GFX\LOADVEGA.TIM"/>
<file name = "LOADRIO.TIM" type = "data" source="0_CD_DATA\GFX\LOADRIO.TIM"/>
<file name = "FELOAD.TIM" type = "data" source="0_CD_DATA\GFX\FELOAD.TIM"/>
</dir>
<dir name = "LEVELS">
<file name = "CHICAGO.LEV" type = "data" source="0_CD_DATA\LEVELS\CHICAGO.LEV"/>
<file name = "CHICAGO.LCF" type = "data" source="0_CD_DATA\LEVELS\CHICAGO.LCF"/>
<file name = "CHICAGO.DEN" type = "data" source="0_CD_DATA\LEVELS\CHICAGO.DEN"/>
<file name = "HAVANA.LEV" type = "data" source="0_CD_DATA\LEVELS\HAVANA.LEV"/>
<file name = "HAVANA.LCF" type = "data" source="0_CD_DATA\LEVELS\HAVANA.LCF"/>
<file name = "HAVANA.DEN" type = "data" source="0_CD_DATA\LEVELS\HAVANA.DEN"/>
<file name = "VEGAS.LEV" type = "data" source="0_CD_DATA\LEVELS\VEGAS.LEV"/>
<file name = "VEGAS.LCF" type = "data" source="0_CD_DATA\LEVELS\VEGAS.LCF"/>
<file name = "VEGAS.DEN" type = "data" source="0_CD_DATA\LEVELS\VEGAS.DEN"/>
<file name = "RIO.LEV" type = "data" source="0_CD_DATA\LEVELS\RIO.LEV"/>
<file name = "RIO.DEN" type = "data" source="0_CD_DATA\LEVELS\RIO.DEN"/>
<file name = "RIO.LCF" type = "data" source="0_CD_DATA\LEVELS\RIO.LCF"/>
</dir>
<dir name = "MISSIONS">
<file name = "MISSIONS.BLK" type = "data" source="0_CD_DATA\MISSIONS\MISSIONS.BLK"/>
<file name = "PATH40.0" type = "data" source="0_CD_DATA\MISSIONS\PATH40.0"/>
</dir>
<dir name = "SOUND">
<file name = "MUSIC.BIN" type = "data" source="0_CD_DATA\SOUND\MUSIC.BIN"/>
<file name = "VOICES2.BLK" type = "data" source="0_CD_DATA\SOUND\VOICES2.BLK"/>
</dir>
<dir name = "REPLAYS">
<file name = "ATTRACT.400" type = "data" source="0_CD_DATA\REPLAYS\ATTRACT.400"/>
</dir>
</dir>
</directory_tree>
</track>
</iso_project>
<track type="data">
<identifiers system="PLAYSTATION" application="PLAYSTATION" volume="SLUS_01318" publisher="INFOGRAMES" data_preparer="REFLECTIONS" creation_date="0000112123590200+0"/>
<license file="license_data.dat"/>
<directory_tree gmt_offs="0">
<dir name="DRIVER2" source="./0_CD_DATA" gmt_offs="36">
<dir name="DATA" source="./0_CD_DATA/DATA" gmt_offs="36">
<dir name="CARS" source="./0_CD_DATA/DATA/CARS" gmt_offs="36"/>
<dir name="CUTS" source="./0_CD_DATA/DATA/CUTS" gmt_offs="36"/>
<dir name="MCTEXT" source="./0_CD_DATA/DATA/MCTEXT" gmt_offs="36"/>
</dir>
<dir name="GFX" source="./0_CD_DATA/GFX" gmt_offs="36"/>
<dir name="LEVELS" source="./0_CD_DATA/LEVELS" gmt_offs="36"/>
<dir name="MAPS" source="./0_CD_DATA/MAPS" gmt_offs="36"/>
<dir name="MISSIONS" source="./0_CD_DATA/MISSIONS" gmt_offs="36"/>
<dir name="MLEVELS" source="./0_CD_DATA/MLEVELS" gmt_offs="36"/>
<dir name="MNLEVELS" source="./0_CD_DATA/MNLEVELS" gmt_offs="36"/>
<dir name="NLEVELS" source="./0_CD_DATA/NLEVELS" gmt_offs="36"/>
<dir name="REPLAYS" source="./0_CD_DATA/REPLAYS" gmt_offs="36">
<dir name="A" source="./0_CD_DATA/REPLAYS/A" gmt_offs="36"/>
</dir>
<dir name="SOUND" source="./0_CD_DATA/SOUND" gmt_offs="36"/>
<dir name="TRAILS" source="./0_CD_DATA/TRAILS" gmt_offs="36"/>
<dir name="XA" source="./0_CD_DATA/XA" gmt_offs="36"/>
</dir>
<file name="SYSTEM.CNF" source="./0_CD_DATA/SYSTEM.CNF" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<dir name="DRIVER2">
<file name="FRONTEND.BIN" source="./0_CD_DATA/Overlay.frnt" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<dir name="GFX">
<file name="FELOAD.TIM" source="./0_CD_DATA/GFX/FELOAD.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="DATA">
<file name="SCRS.BIN" source="./0_CD_DATA/DATA/SCRS.BIN" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="GFX.RAW" source="./0_CD_DATA/DATA/GFX.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="FEFONT.BNK" source="./0_CD_DATA/DATA/FEFONT.BNK" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CARCONT.RAW" source="./0_CD_DATA/DATA/CARCONT.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TANCONT.RAW" source="./0_CD_DATA/DATA/TANCONT.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CITY.RAW" source="./0_CD_DATA/DATA/CITY.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CITYBACK.RAW" source="./0_CD_DATA/DATA/CITYBACK.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="VOL.RAW" source="./0_CD_DATA/DATA/VOL.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<dir name="CARS">
<file name="CARBACK.RAW" source="./0_CD_DATA/DATA/CARS/CARBACK.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CCARS.RAW" source="./0_CD_DATA/DATA/CARS/CCARS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="HCARS.RAW" source="./0_CD_DATA/DATA/CARS/HCARS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="RCARS.RAW" source="./0_CD_DATA/DATA/CARS/RCARS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="VCARS.RAW" source="./0_CD_DATA/DATA/CARS/VCARS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="CUTS">
<file name="CUTBACK.RAW" source="./0_CD_DATA/DATA/CUTS/CUTBACK.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CCUTS.RAW" source="./0_CD_DATA/DATA/CUTS/CCUTS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="HCUTS.RAW" source="./0_CD_DATA/DATA/CUTS/HCUTS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="RCUTS.RAW" source="./0_CD_DATA/DATA/CUTS/RCUTS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="VCUTS.RAW" source="./0_CD_DATA/DATA/CUTS/VCUTS.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
</dir>
<dir name="MISSIONS">
<file name="MISSIONS.BLK" source="./0_CD_DATA/MISSIONS/MISSIONS.BLK" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<file name="PATH.BIN" source="./0_CD_DATA/Overlay.path" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="LEAD.BIN" source="./0_CD_DATA/Overlay.lead" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<dir name="MISSIONS">
<file name="PATH40.0" source="./0_CD_DATA/MISSIONS/PATH40.0" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="REPLAYS">
<file name="CUT1.R" source="./0_CD_DATA/REPLAYS/CUT1.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT2.R" source="./0_CD_DATA/REPLAYS/CUT2.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT3.R" source="./0_CD_DATA/REPLAYS/CUT3.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT4.R" source="./0_CD_DATA/REPLAYS/CUT4.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT5.R" source="./0_CD_DATA/REPLAYS/CUT5.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT6.R" source="./0_CD_DATA/REPLAYS/CUT6.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT7.R" source="./0_CD_DATA/REPLAYS/CUT7.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT9.R" source="./0_CD_DATA/REPLAYS/CUT9.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT10.R" source="./0_CD_DATA/REPLAYS/CUT10.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT11.R" source="./0_CD_DATA/REPLAYS/CUT11.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT13.R" source="./0_CD_DATA/REPLAYS/CUT13.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT14.R" source="./0_CD_DATA/REPLAYS/CUT14.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT16.R" source="./0_CD_DATA/REPLAYS/CUT16.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT17.R" source="./0_CD_DATA/REPLAYS/CUT17.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT18.R" source="./0_CD_DATA/REPLAYS/CUT18.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT19.R" source="./0_CD_DATA/REPLAYS/CUT19.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<dir name="A">
<file name="CUT21.R" source="./0_CD_DATA/REPLAYS/A/CUT21.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT22.R" source="./0_CD_DATA/REPLAYS/A/CUT22.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT23.R" source="./0_CD_DATA/REPLAYS/A/CUT23.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT25.R" source="./0_CD_DATA/REPLAYS/A/CUT25.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT26.R" source="./0_CD_DATA/REPLAYS/A/CUT26.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT27.R" source="./0_CD_DATA/REPLAYS/A/CUT27.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT29.R" source="./0_CD_DATA/REPLAYS/A/CUT29.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT31.R" source="./0_CD_DATA/REPLAYS/A/CUT31.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT33.R" source="./0_CD_DATA/REPLAYS/A/CUT33.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT34.R" source="./0_CD_DATA/REPLAYS/A/CUT34.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT38.R" source="./0_CD_DATA/REPLAYS/A/CUT38.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT70.R" source="./0_CD_DATA/REPLAYS/A/CUT70.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT78.R" source="./0_CD_DATA/REPLAYS/A/CUT78.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT86.R" source="./0_CD_DATA/REPLAYS/A/CUT86.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT94.R" source="./0_CD_DATA/REPLAYS/A/CUT94.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT28.R" source="./0_CD_DATA/REPLAYS/A/CUT28.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT30.R" source="./0_CD_DATA/REPLAYS/A/CUT30.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT32.R" source="./0_CD_DATA/REPLAYS/A/CUT32.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT35.R" source="./0_CD_DATA/REPLAYS/A/CUT35.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT37.R" source="./0_CD_DATA/REPLAYS/A/CUT37.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CUT39.R" source="./0_CD_DATA/REPLAYS/A/CUT39.R" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<file name="ATTRACT.400" source="./0_CD_DATA/REPLAYS/ATTRACT.400" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="ATTRACT.401" source="./0_CD_DATA/REPLAYS/ATTRACT.401" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="ATTRACT.402" source="./0_CD_DATA/REPLAYS/ATTRACT.402" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="ATTRACT.403" source="./0_CD_DATA/REPLAYS/ATTRACT.403" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="GFX">
<file name="LOADCHIC.TIM" source="./0_CD_DATA/GFX/LOADCHIC.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="LOADHAVA.TIM" source="./0_CD_DATA/GFX/LOADHAVA.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="LOADRIO.TIM" source="./0_CD_DATA/GFX/LOADRIO.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="LOADVEGA.TIM" source="./0_CD_DATA/GFX/LOADVEGA.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="SOUND">
<file name="VOICES2.BLK" source="./0_CD_DATA/SOUND/VOICES2.BLK" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="MUSIC.BIN" source="./0_CD_DATA/SOUND/MUSIC.BIN" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="LEVELS">
<file name="CHICAGO.LEV" source="./0_CD_DATA/LEVELS/CHICAGO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CHICAGO.LCF" source="./0_CD_DATA/LEVELS/CHICAGO.LCF" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="CHICAGO.DEN" source="./0_CD_DATA/LEVELS/CHICAGO.DEN" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="NLEVELS">
<file name="CHICAGO.LEV" source="./0_CD_DATA/NLEVELS/CHICAGO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="LEVELS">
<file name="HAVANA.LEV" source="./0_CD_DATA/LEVELS/HAVANA.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="HAVANA.LCF" source="./0_CD_DATA/LEVELS/HAVANA.LCF" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="HAVANA.DEN" source="./0_CD_DATA/LEVELS/HAVANA.DEN" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="NLEVELS">
<file name="HAVANA.LEV" source="./0_CD_DATA/NLEVELS/HAVANA.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="LEVELS">
<file name="VEGAS.LEV" source="./0_CD_DATA/LEVELS/VEGAS.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="VEGAS.LCF" source="./0_CD_DATA/LEVELS/VEGAS.LCF" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="VEGAS.DEN" source="./0_CD_DATA/LEVELS/VEGAS.DEN" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="NLEVELS">
<file name="VEGAS.LEV" source="./0_CD_DATA/NLEVELS/VEGAS.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="LEVELS">
<file name="RIO.LEV" source="./0_CD_DATA/LEVELS/RIO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="RIO.LCF" source="./0_CD_DATA/LEVELS/RIO.LCF" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="RIO.DEN" source="./0_CD_DATA/LEVELS/RIO.DEN" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="NLEVELS">
<file name="RIO.LEV" source="./0_CD_DATA/NLEVELS/RIO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MLEVELS">
<file name="CHICAGO.LEV" source="./0_CD_DATA/MLEVELS/CHICAGO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MAPS">
<file name="REG104.0" source="./0_CD_DATA/MAPS/REG104.0" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG165.0" source="./0_CD_DATA/MAPS/REG165.0" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG198.0" source="./0_CD_DATA/MAPS/REG198.0" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MNLEVELS">
<file name="CHICAGO.LEV" source="./0_CD_DATA/MNLEVELS/CHICAGO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MLEVELS">
<file name="HAVANA.LEV" source="./0_CD_DATA/MLEVELS/HAVANA.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MAPS">
<file name="REG55.1" source="./0_CD_DATA/MAPS/REG55.1" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG108.1" source="./0_CD_DATA/MAPS/REG108.1" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MNLEVELS">
<file name="HAVANA.LEV" source="./0_CD_DATA/MNLEVELS/HAVANA.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MLEVELS">
<file name="VEGAS.LEV" source="./0_CD_DATA/MLEVELS/VEGAS.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MAPS">
<file name="REG845.2" source="./0_CD_DATA/MAPS/REG845.2" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG882.2" source="./0_CD_DATA/MAPS/REG882.2" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG942.2" source="./0_CD_DATA/MAPS/REG942.2" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG977.2" source="./0_CD_DATA/MAPS/REG977.2" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MNLEVELS">
<file name="VEGAS.LEV" source="./0_CD_DATA/MNLEVELS/VEGAS.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MLEVELS">
<file name="RIO.LEV" source="./0_CD_DATA/MLEVELS/RIO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MAPS">
<file name="REG58.3" source="./0_CD_DATA/MAPS/REG58.3" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG135.3" source="./0_CD_DATA/MAPS/REG135.3" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG156.3" source="./0_CD_DATA/MAPS/REG156.3" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="REG203.3" source="./0_CD_DATA/MAPS/REG203.3" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="MNLEVELS">
<file name="RIO.LEV" source="./0_CD_DATA/MNLEVELS/RIO.LEV" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="DATA">
<file name="SKY0.RAW" source="./0_CD_DATA/DATA/SKY0.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="SKY1.RAW" source="./0_CD_DATA/DATA/SKY1.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="SKY2.RAW" source="./0_CD_DATA/DATA/SKY2.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="SKY3.RAW" source="./0_CD_DATA/DATA/SKY3.RAW" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="GFX">
<file name="FONT2.FNT" source="./0_CD_DATA/GFX/FONT2.FNT" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="TRAILS">
<file name="TRAIL.134" source="./0_CD_DATA/TRAILS/TRAIL.134" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.135" source="./0_CD_DATA/TRAILS/TRAIL.135" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.142" source="./0_CD_DATA/TRAILS/TRAIL.142" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.143" source="./0_CD_DATA/TRAILS/TRAIL.143" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.150" source="./0_CD_DATA/TRAILS/TRAIL.150" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.151" source="./0_CD_DATA/TRAILS/TRAIL.151" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.158" source="./0_CD_DATA/TRAILS/TRAIL.158" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.159" source="./0_CD_DATA/TRAILS/TRAIL.159" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.260" source="./0_CD_DATA/TRAILS/TRAIL.260" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.261" source="./0_CD_DATA/TRAILS/TRAIL.261" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.268" source="./0_CD_DATA/TRAILS/TRAIL.268" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.269" source="./0_CD_DATA/TRAILS/TRAIL.269" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.276" source="./0_CD_DATA/TRAILS/TRAIL.276" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.277" source="./0_CD_DATA/TRAILS/TRAIL.277" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.284" source="./0_CD_DATA/TRAILS/TRAIL.284" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="TRAIL.285" source="./0_CD_DATA/TRAILS/TRAIL.285" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
<dir name="XA">
<file name="XABNK01.XA" source="./0_CD_DATA/XA/XABNK01.XA" type="mixed" gmt_offs="36" xa_attrib="56" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="XABNK02.XA" source="./0_CD_DATA/XA/XABNK02.XA" type="mixed" gmt_offs="36" xa_attrib="56" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="XABNK03.XA" source="./0_CD_DATA/XA/XABNK03.XA" type="mixed" gmt_offs="36" xa_attrib="56" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="XABNK04.XA" source="./0_CD_DATA/XA/XABNK04.XA" type="mixed" gmt_offs="36" xa_attrib="56" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
</dir>
<file name="DRIVER2.EXE" source="./0_CD_DATA/DRIVER2.ps-exe" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<dir name="DRIVER2">
<dir name="GFX">
<file name="SPLASH2.TIM" source="./0_CD_DATA/GFX/SPLASH2.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="SPLASH3.TIM" source="./0_CD_DATA/GFX/SPLASH3.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
<file name="SPLASH1N.TIM" source="./0_CD_DATA/GFX/SPLASH1N.TIM" type="data" gmt_offs="36" xa_perm="1365" xa_gid="0" xa_uid="0"/>
</dir>
</dir>
</directory_tree>
</track>
</iso_project>

View File

@ -0,0 +1,2 @@
dumpsxiso.exe Driver2CD2.bin -s CD.xml
pause

View File

@ -1,3 +1,5 @@
echo off
cls
set REDRIVER_FOLDER=%cd%\..
rem Make a symlink

View File

@ -1,4 +0,0 @@
cd CDSrc
mkpsxiso.exe -lba2 redriver2.txt -lba redriver2_.txt redriver2_cd.xml
pause

View File

@ -16,18 +16,20 @@ environment:
project_folder: '%APPVEYOR_BUILD_FOLDER%\\src_rebuild'
dependency_folder: '%APPVEYOR_BUILD_FOLDER%\dependencies'
# Dependency URLs
windows_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-windows.zip'
windows_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-windows.zip'
windows_jpeg_url: 'http://www.ijg.org/files/jpegsr9d.zip'
windows_openal_url: 'https://openal-soft.org/openal-binaries/openal-soft-1.21.1-bin.zip'
windows_sdl2_url: 'https://www.libsdl.org/release/SDL2-devel-2.0.14-VC.zip'
linux_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-linux.tar.gz'
windows_sdl2_url: 'https://www.libsdl.org/release/SDL2-devel-2.0.20-VC.zip'
linux_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-linux.tar.gz'
# Dependency Directories
windows_jpeg_dir: '%dependency_folder%\jpeg-9d'
windows_openal_dir: '%dependency_folder%\openal-soft-1.21.1-bin'
windows_sdl2_dir: '%dependency_folder%\SDL2-2.0.14'
windows_sdl2_dir: '%dependency_folder%\SDL2-2.0.20'
install:
- git submodule init
- git submodule update
- cmd: '%APPVEYOR_BUILD_FOLDER%\.appveyor\Install.bat'
- sh: '${APPVEYOR_BUILD_FOLDER}/.appveyor/Install.sh'

View File

@ -97,7 +97,7 @@ start=w
select=H
[cdfs]
image=install/Driver2CD1.bin
#image=install/Driver2CD1.bin
mode=1,2,2352 # track, mode, sector size. DO NOT MODIFY
[pad]
@ -107,7 +107,10 @@ pad2device=-1 # player 2 controller device; -1 for automatic assignment
[render]
windowWidth=1280
windowHeight=720
fullscreen=0 # enable full screen mode; it takes screen resolution
fullscreen=0 # enable full screen mode
screenWidth=1280 # screen resolution when fullscreen is on
screenHeight=720
vsync=1 # Prevents screen tearing in Full screen. Turn it off if you have framerate problems.
pgxpTextureMapping=1
bilinearFiltering=1 # "smooth" textures
pgxpZbuffer=1 # full Z-buffer on PSX polygons
@ -121,5 +124,4 @@ 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
overrideContent=0 # this enables texture and car model modding
userChases=RacingFreak,Snoopi,Olanov,Vortex,Fireboyd78
overrideContent=0 # this enables texture and car model modding

View File

@ -40,13 +40,8 @@ void DrawDebugOverlays()
gte_SetRotMatrix(&inv_camera_matrix);
SVECTOR a, b;
a.vx = ld.posA.vx - camera_position.vx;
a.vy = ld.posA.vy - camera_position.vy;
a.vz = ld.posA.vz - camera_position.vz;
b.vx = ld.posB.vx - camera_position.vx;
b.vy = ld.posB.vy - camera_position.vy;
b.vz = ld.posB.vz - camera_position.vz;
VecSubtract(&a, &ld.posA, &camera_position);
VecSubtract(&b, &ld.posB, &camera_position);
gte_ldv3(&a, &b, &b);

View File

@ -34,15 +34,13 @@ int Apply_InvCameraMatrixSetTrans(VECTOR_NOPAD* pos)
{
VECTOR vfc;
VECTOR vec;
VECTOR local;
SVECTOR local;
gte_stfc(&vfc);
local.vx = (pos->vx - vfc.vx) << 0x10 >> 0x10;
local.vy = (pos->vy - vfc.vy) << 0x10 >> 0x10;
local.vz = (pos->vz - vfc.vz) << 0x10 >> 0x10;
VecSubtract(&local, pos, &vfc);
#ifdef PSX
gte_ldlvl(&local);
gte_ldsv(&local);
gte_lcir();
gte_stlvl(&vec);
#else
@ -67,15 +65,13 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
{
VECTOR vfc;
VECTOR vec;
VECTOR local;
SVECTOR local;
gte_stfc(&vfc);
local.vx = (pos->vx - vfc.vx) << 0x10 >> 0x10;
local.vy = (pos->vy - vfc.vy) << 0x10 >> 0x10;
local.vz = (pos->vz - vfc.vz) << 0x10 >> 0x10;
VecSubtract(&local, pos, &vfc);
#ifdef PSX
gte_ldlvl(&local);
gte_ldsv(&local);
gte_lcir();
gte_stlvl(&vec);
#else
@ -92,8 +88,6 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
gte_SetRotMatrix(mtx);
gte_SetTransVector(&vec);
if (vec.vx >> 1 < 0)
return vec.vz - vec.vx;
@ -103,19 +97,16 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
// [D] [T]
int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere)
{
VECTOR local;
local.vx = (pcop->pos.vx - camera_position.vx) << 0x10 >> 0x11;
local.vy = (pcop->pos.vy - camera_position.vy) << 0x10 >> 0x11;
local.vz = (pcop->pos.vz - camera_position.vz) << 0x10 >> 0x11;
gte_ldlvl(&local);
VECTOR result;
SVECTOR local;
VecSubtract(&local, &pcop->pos, &camera_position);
gte_ldsv(&local);
gte_llir();
VECTOR result;
gte_stlvnl(&result);
int ang = frustrum_matrix.t[0] - (bounding_sphere >> 1);
int ang = frustrum_matrix.t[0] - bounding_sphere;
if (ang <= result.vx && ang <= result.vy && ang <= result.vz)
return 0;
@ -126,19 +117,16 @@ int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere)
// [D] [T]
int FrustrumCheck(VECTOR* pos, int bounding_sphere)
{
VECTOR local;
local.vx = (pos->vx - camera_position.vx) << 0x10 >> 0x11;
local.vy = (pos->vy - camera_position.vy) << 0x10 >> 0x11;
local.vz = (pos->vz - camera_position.vz) << 0x10 >> 0x11;
gte_ldlvl(&local);
VECTOR result;
SVECTOR local;
VecSubtract(&local, pos, &camera_position);
gte_ldsv(&local);
gte_llir();
VECTOR result;
gte_stlvnl(&result);
int ang = frustrum_matrix.t[0] - (bounding_sphere >> 1);
int ang = frustrum_matrix.t[0] - bounding_sphere;
if (ang <= result.vx && ang <= result.vy && ang <= result.vz)
return 0;

View File

@ -387,8 +387,6 @@ void FadeOutHiresScreen(void)
PutDispEnv(&disp);
PutDrawEnv(&draw);
//g_wireframeMode = 1;
DrawSync(0);
SetDispMask(1);
@ -524,8 +522,6 @@ void SetPleaseWait(char *buffer)
ResetCityType();
#else
ResetCityType();
PsyX_EndScene();
#endif // PSX

View File

@ -1,7 +1,6 @@
#ifndef AI_H
#define AI_H
extern void StoreGameFlags(); // 0x0001BBB8
extern int TannerCanEnterCar(CAR_DATA *cp, int distToCarSq); // 0x0001BBE8
extern int TannerStuckInCar(int doSpeedCheck, int player_id); // 0x0001BA90

View File

@ -365,6 +365,10 @@ int CameraCollisionCheck(void)
// [D] [T]
void TurnHead(PLAYER *lp)
{
LPPEDESTRIAN pPlayerPed;
pPlayerPed = lp->pPed;
// [A] handle REDRIVER2 dedicated look back button
if ((paddCamera & CAMERA_PAD_LOOK_BACK) == CAMERA_PAD_LOOK_BACK || (paddCamera & CAMERA_PAD_LOOK_BACK_DED))
{
@ -444,10 +448,15 @@ void PlaceCameraFollowCar(PLAYER *lp)
if(car_cos)
{
int addDist;
carheight = car_cos->colBox.vy * -3 + 85;
// [A] default just adds 248, but it's too close for big vehicles
addDist = MAX(248, car_cos->colBox.vy * 3);
if (gCameraMaxDistance == 0)
maxCameraDist = car_cos->colBox.vz * 2 + car_cos->colBox.vy + 248;
maxCameraDist = car_cos->colBox.vz * 2 + car_cos->colBox.vy + addDist;
else
maxCameraDist = gCameraMaxDistance;

View File

@ -20,6 +20,20 @@
#include "glaunch.h"
#include "ASM/rndrasm.h"
struct plotCarGlobals
{
u_char* primptr;
OTTYPE* ot;
u_int intensity;
u_short* pciv_clut;
u_int ShineyTPageASL16;
u_int ShineyClutASL16;
u_char* damageLevel;
u_char* shineyTable;
int ghost;
};
#ifndef PSX
#define CAR_LOD_SWITCH_DISTANCE switch_detail_distance
#else
@ -46,7 +60,6 @@ MODEL* gDamWheelModelPtr;
CAR_DATA* active_car_list[MAX_CARS];
BOUND_BOX bbox[MAX_CARS];
u_char lightsOnDelay[MAX_CARS];
u_short civ_clut[8][32][6];
short FrontWheelRotation[MAX_CARS]; // offset 0x0
short BackWheelRotation[MAX_CARS]; // offset 0x30
@ -63,6 +76,10 @@ MODEL* gCarLowModelPtr[MAX_CAR_MODELS];
MODEL* gCarDamModelPtr[MAX_CAR_MODELS];
MODEL* gCarCleanModelPtr[MAX_CAR_MODELS];
// pedestrian palette at 0 and next are cars
// model_id, texture_number, palette
u_short civ_clut[8][32][6];
int whichCP = 0;
int baseSpecCP = 0;
CAR_POLY carPolyBuffer[2001];
@ -327,11 +344,12 @@ void setupLightingMatrices(void)
if (gTimeOfDay == 3)
{
gte_ldbkdir(0x400, 0x400, 0x400);
return;
gte_SetBackColor(64, 64, 64);
}
else
{
gte_SetBackColor(140, 140, 140);
}
gte_ldbkdir(0x8c0, 0x8c0, 0x8c0);
}
// [D] [T]
@ -564,7 +582,7 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip)
MODEL *WheelModelBack;
MODEL *WheelModelFront;
#ifdef PSX
#if 0 //def PSX
MATRIX& FrontMatrix = *(MATRIX*)(u_char*)getScratchAddr(0);
MATRIX& SteerMatrix = *(MATRIX*)((u_char*)getScratchAddr(0) + sizeof(MATRIX));
VECTOR& WheelPos = *(VECTOR*)((u_char*)getScratchAddr(0) + sizeof(MATRIX) * 2);
@ -785,7 +803,7 @@ void PlayerCarFX(CAR_DATA *cp)
// [D] [T]
void plotNewCarModel(CAR_MODEL* car, int palette)
{
#ifdef PSX
#if 0 //def PSX
plotCarGlobals& _pg = *(plotCarGlobals*)(u_char*)getScratchAddr(0);
#else
plotCarGlobals _pg;
@ -874,8 +892,7 @@ void buildNewCars(void)
// [D] [T]
void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
{
u_char ptype;
u_char clut;
u_char ptype, clut;
u_char *polyList;
CAR_POLY *cp;
@ -908,10 +925,9 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
else if (pass == 2)
car->pB3 = carPolyBuffer + whichCP;
i = 0;
newNumPolys = whichCP;
while (newNumPolys < 2000 && i < model->num_polys)
for (i = 0; newNumPolys < 2000 && i < model->num_polys; i++)
{
ptype = *polyList;
@ -936,7 +952,7 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
cp->vindices = M_INT_4R(polyList[4], polyList[5], polyList[6], 0);
cp->originalindex = i;
cp = carPolyBuffer + newNumPolys + 1;
cp++;
cp->vindices = M_INT_4R(polyList[4], polyList[6], polyList[7], 0);
cp->originalindex = i;
@ -969,7 +985,7 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
cp->uv3_uv2 = *(ushort*)&pft4->uv2;
cp->originalindex = i;
cp = carPolyBuffer + newNumPolys + 1;
cp++;
cp->vindices = M_INT_4R(pft4->v0, pft4->v2, pft4->v3, 0);
cp->clut_uv0 = M_INT_2(texture_cluts[polyList[1]][polyList[2]], *(ushort*)&pft4->uv0);
@ -1013,7 +1029,7 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
cp->uv3_uv2 = *(ushort*)&pgt4->uv2;
cp->originalindex = i;
cp = carPolyBuffer + newNumPolys + 1;
cp++;
cp->vindices = M_INT_4R(pgt4->v0, pgt4->v2, pgt4->v3, 0);
cp->nindices = M_INT_4R(pgt4->n0, pgt4->n2, pgt4->n3, 0);
@ -1027,7 +1043,6 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
}
polyList += PolySizes[ptype & 0x1f];
i++;
}
if (pass == 1)
@ -1047,13 +1062,10 @@ void MangleWheelModels(void)
{
UV_INFO tmpUV2;
u_char tmpUV;
int i;
u_int v0;
u_int v1;
u_int v2;
u_int v0, v1, v2;
POLYFT4*src;
MODEL *m;
int j;
int i, j;
for (i = 0; i < 3; i++)
{

View File

@ -181,8 +181,6 @@ CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near)
// [D] [T]
void QuickUnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near, CELL_OBJECT* pco)
{
cell_object_index = cell_object_index + 1 & 0x3ff;
pco->pos.vx = near->x + (((ppco->pos.vx - near->x) << 0x10) >> 0x10);
pco->pos.vz = near->z + (((ppco->pos.vz - near->z) << 0x10) >> 0x10);

View File

@ -152,7 +152,6 @@ int InitCar(CAR_DATA* cp, int direction, LONGVECTOR4* startPos, unsigned char co
case CONTROL_TYPE_LEAD_AI:
// free roamer lead car
InitLead(cp);
leadCarId = cp->id;
cp->hndType = 5;
break;
}
@ -2173,8 +2172,8 @@ int PingInCivCar(int minPingInDist)
}
else
{
i = 0;
while (i < numLanes)
for (i = 0; i < numLanes; i++)
{
// collect the lanes.
allowedToPark = ROAD_IS_PARKING_ALLOWED_AT(&roadInfo, i);
@ -2187,8 +2186,6 @@ int PingInCivCar(int minPingInDist)
// pick only non-parkable driveable lanes if parked cars not requested
if (tryPingInParkedCars && allowedToPark || ROAD_IS_AI_LANE(&roadInfo, i) && !allowedToPark)
possibleLanes[numPossibleLanes++] = i;
i++;
}
if (numPossibleLanes == 0)
@ -3674,8 +3671,7 @@ int CivControl(CAR_DATA* cp)
if (cp->ai.c.thrustState != 3)
steer = CivSteerAngle(cp);
// reduce acceleration when steering is applied
thrust = CivAccel(cp) - MAX(ABS(steer), 4) * 3;
thrust = CivAccel(cp) - MAX(ABS(steer), 4) * 3; // [A] reduce acceleration when steering is applied
if (thrust < 0 && cp->hd.wheel_speed < 5)
thrust = 0;

View File

@ -1,6 +1,17 @@
#ifndef CIV_AI_H
#define CIV_AI_H
typedef struct _EXTRA_CIV_DATA
{
int surfInd;
int distAlongSegment;
short angle;
u_short ctrlState;
int thrustState;
u_char palette;
u_char controlFlags;
} EXTRA_CIV_DATA;
extern const u_char speedLimits[3];
extern unsigned char reservedSlots[MAX_CARS];
extern int frameStart;

View File

@ -19,6 +19,14 @@
#include "pedest.h"
#include "pres.h"
enum AIZone
{
zoneFrnt = 0,
zoneBack = 1,
zoneLeft = 2,
zoneRght = 3,
};
struct iVectNT
{
int n;
@ -846,7 +854,7 @@ void ControlCopDetection(void)
}
// [A] also check player elevation from cops (block cops vision from bridges, tunnels etc)
if (spotted && ABS(cp->hd.where.t[1] - vec.vy) < 1500)
if (spotted && ABS(cp->hd.where.t[1] - vec.vy) < 1000)
{
CopsCanSeePlayer = 1;
break;

View File

@ -1,6 +1,13 @@
#ifndef COP_AI_H
#define COP_AI_H
struct COP_SIGHT_DATA
{
short surroundViewDistance;
short frontViewDistance;
short frontViewAngle;
};
extern COP_DATA gCopData;
extern COP_SIGHT_DATA copSightData;
extern VECTOR roadblockLoc;

View File

@ -42,6 +42,7 @@ int gChaseStuckTimer = 0;
int gCutsceneAsReplay_ReChaseLoaded = 0;
int gCutsceneAsReplay = 0;
int gCutsceneAsReplay_NumReplayStreams = 0;
int gCutsceneAsReplay_PlayerId = 0;
int gCutsceneAsReplay_PlayerChanged = 0;
int gCutsceneAsReplay_ReserveSlots = 2;
@ -251,10 +252,10 @@ void CutRec_NextPlayer(int dir)
else if (dir < 0)
gCutsceneAsReplay_PlayerId--;
if (gCutsceneAsReplay_PlayerId >= NumReplayStreams)
gCutsceneAsReplay_PlayerId -= NumReplayStreams;
if (gCutsceneAsReplay_PlayerId >= gCutsceneAsReplay_NumReplayStreams)
gCutsceneAsReplay_PlayerId -= gCutsceneAsReplay_NumReplayStreams;
else if (gCutsceneAsReplay_PlayerId < 0)
gCutsceneAsReplay_PlayerId += NumReplayStreams;
gCutsceneAsReplay_PlayerId += gCutsceneAsReplay_NumReplayStreams;
if (old_player != gCutsceneAsReplay_PlayerId)
gCutsceneAsReplay_PlayerChanged = 1;
@ -364,6 +365,8 @@ void InitCutsceneRecorder(char* configFilename)
return;
}
gCutsceneAsReplay_NumReplayStreams = NumReplayStreams;
gLoadedReplay = 1;
CurrentGameMode = GAMEMODE_REPLAY;
}
@ -375,10 +378,10 @@ void InitCutsceneRecorder(char* configFilename)
InitPadRecording();
ini_sget(config, "settings", "streams", "%d", &NumReplayStreams);
ini_sget(config, "settings", "streams", "%d", &gCutsceneAsReplay_NumReplayStreams);
// initialize all streams
for (i = 0; i < NumReplayStreams; i++)
for (i = 0; i < gCutsceneAsReplay_NumReplayStreams; i++)
{
stream = &ReplayStreams[i].SourceType;
sprintf(curStreamName, "stream%d", i);
@ -470,15 +473,22 @@ void CutRec_CheckInvalidatePing(int carId, int howHard)
int CutRec_InitPlayers()
{
STREAM_SOURCE* temp;
if (gCutsceneAsReplay == 0)
return 0;
for (int i = 0; i < NumReplayStreams; i++)
for (int i = 0; i < gCutsceneAsReplay_NumReplayStreams; i++)
{
PlayerStartInfo[i] = &ReplayStreams[i].SourceType;
PlayerStartInfo[i]->controlType = CONTROL_TYPE_CUTSCENE;
}
numPlayersToCreate = NumReplayStreams;
temp = PlayerStartInfo[0];
PlayerStartInfo[0] = PlayerStartInfo[gCutsceneAsReplay_PlayerId];
PlayerStartInfo[gCutsceneAsReplay_PlayerId] = temp;
NumReplayStreams = gCutsceneAsReplay_NumReplayStreams;
numPlayersToCreate = gCutsceneAsReplay_NumReplayStreams;
return 1;
}
@ -765,9 +775,9 @@ int CutRec_SaveChase()
return 0;
}
int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
int CutRec_RecordCarPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
{
if (gCutsceneAsReplay == 0 || NoPlayerControl || cp->id != gCutsceneAsReplay_PlayerId)
if (gCutsceneAsReplay == 0 || NoPlayerControl || (-*cp->ai.padid) != gCutsceneAsReplay_PlayerId)
return 0;
*t0 = Pads[0].mapped; // [A] padid might be wrong
@ -790,6 +800,27 @@ int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
return 1;
}
int CutRec_RecordPad(PLAYER* pl, uint* t0, char* t1, char* t2)
{
if (gCutsceneAsReplay == 0 || NoPlayerControl || (-pl->padid) != gCutsceneAsReplay_PlayerId)
return 0;
*t0 = Pads[0].mapped;
*t1 = Pads[0].mapanalog[2];
*t2 = Pads[0].type & 4;
// [A] handle REDRIVER2 dedicated car entry button
if (*t0 & TANNER_PAD_ACTION_DED)
{
*t0 &= ~TANNER_PAD_ACTION_DED;
*t0 |= TANNER_PAD_ACTION;
}
cjpRecord(-pl->padid, t0, t1, t2);
return 1;
}
int CutRec_IsRecording()
{
if (gCutsceneAsReplay == 0)

View File

@ -25,7 +25,8 @@ extern void CutRec_ReserveSlots();
extern void CutRec_HandleCarRequest();
extern int CutRec_InitPlayers();
extern int CutRec_InitMission(char* filename);
extern int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2);
extern int CutRec_RecordCarPad(CAR_DATA* cp, uint* t0, char* t1, char* t2);
extern int CutRec_RecordPad(PLAYER* pl, uint* t0, char* t1, char* t2);
extern int CutRec_SaveChase();
#ifdef CUTSCENE_RECORDER
@ -40,10 +41,11 @@ extern int CutRec_SaveChase();
#define _CutRec_StorePingInfo(a,b) CutRec_StorePingInfo(a,b)
#define _CutRec_CheckInvalidatePing(a,b) CutRec_CheckInvalidatePing(a, b)
#define _CutRec_NextChase(a) CutRec_NextChase(a)
#define _CutRec_ReserveSlots() CutRec_ReserveSlots
#define _CutRec_ReserveSlots() CutRec_ReserveSlots()
#define _CutRec_HandleCarRequest() CutRec_HandleCarRequest()
#define _CutRec_InitPlayers() CutRec_InitPlayers()
#define _CutRec_InitMission(a) CutRec_InitMission(a)
#define _CutRec_RecordCarPad(a, b, c, d) CutRec_RecordCarPad(a, b, c, d)
#define _CutRec_RecordPad(a, b, c, d) CutRec_RecordPad(a, b, c, d)
#else
@ -62,6 +64,7 @@ extern int CutRec_SaveChase();
#define _CutRec_HandleCarRequest() (0)
#define _CutRec_InitPlayers() (0)
#define _CutRec_InitMission(a) (0)
#define _CutRec_RecordCarPad(a, b, c, d) (0)
#define _CutRec_RecordPad(a, b, c, d) (0)
#endif

View File

@ -23,6 +23,20 @@
#include "xaplay.h"
#include "overlay.h"
struct CUTSCENE_BUFFER
{
int numResident;
u_char residentCutscenes[4];
char(*residentPointers[4]);
char* buffer;
char* currentPointer;
int bytesFree;
int reservedSize;
// char buffer[32*1024]; // was 8192, but we have some free mem now even for PSX. Using malloc.
};
int gSkipInGameCutscene = 0;
int gInGameCutsceneActive = 0;
@ -270,7 +284,7 @@ void DrawInGameCutscene(void)
tile->w = 1200;
#endif
tile->y0 = 256 - BlackBorderHeight;
tile->y0 = SCREEN_H - BlackBorderHeight;
tile->h = BlackBorderHeight;
addPrim(current->ot, tile);

View File

@ -1,6 +1,18 @@
#ifndef CUTSCENE_H
#define CUTSCENE_H
struct CUTSCENE_INFO
{
u_short offset;
u_short size;
};
struct CUTSCENE_HEADER
{
int maxsize;
CUTSCENE_INFO data[15];
};
#ifndef PSX
#define MAX_USER_REPLAYS 16
@ -9,9 +21,7 @@ extern int gNumUserChases;
extern void InitUserReplays(const char* str);
#endif
extern CUTSCENE_BUFFER CutsceneBuffer;
#endif // PSX
extern int NumCutsceneStreams;
extern int gSkipInGameCutscene;

View File

@ -17,6 +17,7 @@
#include "pres.h"
#include "sound.h"
#include "system.h"
#include "pad.h"
struct REPLAY_ICON
{
@ -1053,27 +1054,27 @@ void ControlReplay(void)
}
// register pads
if ((padd & 0x8000) && debounce == 0)
if ((padd & MPAD_D_LEFT) && debounce == 0)
{
move = 2;
debounce = 1;
}
if ((padd & 0x2000) && debounce == 0)
if ((padd & MPAD_D_RIGHT) && debounce == 0)
{
move = 1;
debounce = 1;
}
if ((padd & 0x1000) && debounce == 0)
if ((padd & MPAD_D_UP) && debounce == 0)
{
move = 3;
debounce = 1;
}
if ((padd & 0x4000) && debounce == 0)
if ((padd & MPAD_D_DOWN) && debounce == 0)
{
move = 4;
debounce = 1;
}
if ((padd & 0x40) && debounce == 0)
if ((padd & MPAD_CROSS) && debounce == 0)
{
if (DirectorMenuActive == 0)
pauseflag = 1;
@ -1085,14 +1086,14 @@ void ControlReplay(void)
debounce = 1;
}
if ((padd & 0x100) && debounce == 0)
if ((padd & MPAD_SELECT) && debounce == 0) // [A]
{
// Retro: Press Select to toggle overlays
gDoOverlays ^= 1;
debounce = 1;
}
if ((padd & 0x8000) == 0 && (padd & 0x7140) == 0)
if ((padd & (MPAD_D_LEFT | MPAD_CROSS | MPAD_SELECT | MPAD_D_DOWN | MPAD_D_RIGHT | MPAD_D_UP)) == 0)
{
debounce = 0;
}
@ -1103,7 +1104,7 @@ void ControlReplay(void)
move = 0;
speed = 1;
if (padd & 8)
if (padd & MPAD_R1)
speed = 8;
// control camera position and rotation
@ -1111,12 +1112,12 @@ void ControlReplay(void)
if (EditMode == 1)
{
// edit start time
if ((padd & 0x2000U) != 0 && LastChange->FrameCnt < CameraCnt)
if ((padd & MPAD_D_RIGHT) != 0 && LastChange->FrameCnt < CameraCnt)
{
LastChange->FrameCnt++;
}
if ((padd & 0x8000U) != 0 && PlaybackCamera[LastChange->prev].FrameCnt < LastChange->FrameCnt)
if ((padd & MPAD_D_LEFT) != 0 && PlaybackCamera[LastChange->prev].FrameCnt < LastChange->FrameCnt)
{
LastChange->FrameCnt--;
}
@ -1124,30 +1125,30 @@ void ControlReplay(void)
else if (EditMode == 2)
{
// Chase camera angle
if ((padd & 0x1000) != 0 && gCameraDistance > 500)
if ((padd & MPAD_D_UP) != 0 && gCameraDistance > 500)
{
gCameraDistance -= speed * 16; // [A] restore
gCameraMaxDistance -= speed * 16;
player[0].cameraDist = gCameraDistance;
}
if ((padd & 0x4000) != 0 && gCameraDistance < 2750)
if ((padd & MPAD_D_DOWN) != 0 && gCameraDistance < 2750)
{
gCameraDistance += speed * 16; // [A] restore
gCameraMaxDistance += speed * 16;
player[0].cameraDist = gCameraDistance;
}
if ((padd & 0x8000) != 0)
if ((padd & MPAD_D_LEFT) != 0)
gCameraAngle = gCameraAngle + speed * 16;
if ((padd & 0x2000) != 0)
if ((padd & MPAD_D_RIGHT) != 0)
gCameraAngle = gCameraAngle - speed * 16;
if ((padd & 4) && gCameraOffset.vy > -840)
if ((padd & MPAD_L1) && gCameraOffset.vy > -840)
gCameraOffset.vy -= speed * 16;
if ((padd & 1) && gCameraOffset.vy < 50)
if ((padd & MPAD_L2) && gCameraOffset.vy < 50)
gCameraOffset.vy += speed * 16;
// OBSOLETE DRIVER 1 CODE
@ -1217,28 +1218,28 @@ void ControlReplay(void)
else
dir = ratan2(dz, dx);
if (padd & 2)
if (padd & MPAD_R2) // [A] use R2 as a modifier hor camera Y offset
{
if ((padd & 0x1000U) && gCameraOffset.vy > -150)
if ((padd & MPAD_D_UP) && gCameraOffset.vy > -150)
gCameraOffset.vy -= speed * 16;
if ((padd & 0x4000) && gCameraOffset.vy < 150)
if ((padd & MPAD_D_DOWN) && gCameraOffset.vy < 150)
gCameraOffset.vy += speed * 16;
}
else
{
if ((padd & 0x1000) != 0 && (tracking_car == 0 || d > 500))
if ((padd & MPAD_D_UP) != 0 && (tracking_car == 0 || d > 500))
x = speed * -16;
if ((padd & 0x4000) != 0)
if ((padd & MPAD_D_DOWN) != 0)
x = speed * 16;
}
if ((padd & 0x8000) != 0 && (tracking_car == 0 || d > 500))
if ((padd & MPAD_D_LEFT) != 0 && (tracking_car == 0 || d > 500))
z = speed * -16;
if ((padd & 0x2000) != 0)
if ((padd & MPAD_D_RIGHT) != 0)
z = speed * 16;
if (tracking_car == 0)
@ -1271,10 +1272,10 @@ void ControlReplay(void)
player[0].cameraPos.vz = old_camera.vz;
}
if (padd & 4)
if (padd & MPAD_L1)
player[0].cameraPos.vy -= speed * 16;
if (padd & 1)
if (padd & MPAD_L2)
player[0].cameraPos.vy += speed * 16;
height = -MapHeight(&tmpPos);
@ -1303,7 +1304,7 @@ void ControlReplay(void)
{
// Tripod camera angle
if(padd & 0x1000)
if(padd & MPAD_D_UP)
{
camera_angle.vx += speed * 4;
@ -1311,7 +1312,7 @@ void ControlReplay(void)
camera_angle.vx = 300;
}
if (padd & 0x4000)
if (padd & MPAD_D_DOWN)
{
camera_angle.vx -= speed * 4;
@ -1319,10 +1320,10 @@ void ControlReplay(void)
camera_angle.vx = 3900;
}
if (padd & 0x8000)
if (padd & MPAD_D_LEFT)
camera_angle.vy += speed * 4;
if (padd & 0x2000)
if (padd & MPAD_D_RIGHT)
camera_angle.vy -= speed * 4;
camera_angle.vx = camera_angle.vx & 0xfff;
@ -1331,7 +1332,7 @@ void ControlReplay(void)
}
else if (EditMode == 5)
{
if(padd & 0x1000)
if(padd & MPAD_D_UP)
{
scr_z += speed * 4;
@ -1339,7 +1340,7 @@ void ControlReplay(void)
scr_z = 1000;
}
if (padd & 0x4000)
if (padd & MPAD_D_DOWN)
{
scr_z -= speed * 4;
@ -1558,7 +1559,7 @@ void ControlReplay(void)
break;
}
if ((padd & 0x40U) == 0)
if ((padd & MPAD_CROSS) == 0)
{
first_time = 0;
CursorY = 0;

View File

@ -11,9 +11,9 @@
#include "main.h"
#include "ASM/d2mapasm.h"
sdPlane default_plane = { 0, 0, 0, 0, 2048 };
sdPlane default_plane = { SURF_CONCRETE, 0, 0, 0, 2048 };
sdPlane sea_plane = { 9, 0, 16384, 0, 2048 }; // a default surface if FindSurfaceD2 fails
sdPlane sea_plane = { SURF_DEEPWATER, 0, 16384, 0, 2048 }; // a default surface if FindSurfaceD2 fails
sdPlane* GetSeaPlane()
{

View File

@ -116,6 +116,11 @@ int gDrawDistance = 441;
_pct& plotContext = *(_pct*)((u_char*)getScratchAddr(0) + 1024 - sizeof(_pct)); // orig offset: 0x1f800020
#endif
struct MVERTEX5x5
{
MVERTEX verts[5][5];
};
// [D] [T] [A]
void addSubdivSpriteShadow(POLYFT4* src, SVECTOR* verts, int z)
{
@ -123,7 +128,7 @@ void addSubdivSpriteShadow(POLYFT4* src, SVECTOR* verts, int z)
m = 4;
#ifdef PSX
#if 0 //def PSX
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
#else
MVERTEX5x5 subdiVerts;
@ -165,16 +170,14 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
{
int i;
int z;
u_int spriteColour;
u_int lightdd;
u_int spriteColour, lightdd;
u_char lightLevel;
MODEL* model;
PACKED_CELL_OBJECT* pco;
PACKED_CELL_OBJECT** list;
int numShadows;
int count;
#ifdef PSX
#if 0 //def PSX
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
#else
MVERTEX5x5 subdiVerts;
@ -214,8 +217,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
shadowMatrix.m[i][0] = inv_camera_matrix.m[i][2];
shadowMatrix.m[i][1] = -inv_camera_matrix.m[i][0];
shadowMatrix.m[i][2] = inv_camera_matrix.m[i][0];
i--;
} while (i >= 0);
} while (i--);
plotContext.primptr = current->primptr;
@ -230,9 +232,8 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
plotContext.current = current;
numShadows = 0;
count = numFound - 1;
while (count != -1)
while (numFound--)
{
pco = *list;
list++;
@ -298,8 +299,6 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
plotContext.ot += 133;
}
count--;
#ifdef PSX
#define MAX_TREE_SHADOW_DISTANCE 7000
#else
@ -329,9 +328,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
// [D] [T]
void SetupPlaneColours(u_int ambient)
{
u_int r;
u_int g;
u_int b;
u_int r, g, b;
if ((gWeather - 1U > 1) && gTimeOfDay != 0 && gTimeOfDay != 2)
{
@ -580,10 +577,7 @@ void DrawAllTheCars(int view)
// [D] [T]
u_int normalIndex(SVECTOR* verts, u_int vidx)
{
SVECTOR* v0;
SVECTOR* v1;
SVECTOR* v2;
SVECTOR* v0, *v1, *v2;
int x, y;
int th23;
@ -645,31 +639,32 @@ u_int normalIndex(SVECTOR* verts, u_int vidx)
return th23 | 0x80;
}
void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
// [A]
void ConvertPolygonTypes(MODEL* model, _pct* pc)
{
int opz;
int Z;
PL_POLYFT4* polys;
int i;
int r;
u_char temp;
u_char ptype;
POLY_FT4* prims;
SVECTOR* srcVerts;
int combo;
PL_POLYFT4* polys;
u_char temp, ptype;
int i;
// [A] we are storing the processing flag here
if (model->tri_verts & 0x8000)
{
return;
}
model->tri_verts |= 0x8000;
srcVerts = (SVECTOR*)model->vertices;
polys = (PL_POLYFT4*)model->poly_block;
combo = combointensity;
i = model->num_polys;
while (i > 0)
// pre-process vertices
while (i-- > 0)
{
// iterate through polygons
// with skipping
ptype = polys->id & 0x1f;
// convert poly types
if ((ptype & 0x1) == 0 && ptype != 8) // is FT3 triangle?
{
temp = polys->uv2.v;
@ -685,7 +680,44 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
if (ptype != 11 && ptype != 21 && ptype != 23)
{
polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]);
i--;
continue;
}
// also precalculate normal index
if (ptype != 21 && (polys->th & 0x80) == 0)
{
polys->th = normalIndex(srcVerts, *(u_int*)&polys->v0);
}
polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]);
}
}
void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
{
int opz, Z, r;
PL_POLYFT4* polys;
int i;
u_char ptype;
POLY_FT4* prims;
SVECTOR* srcVerts;
int combo;
srcVerts = (SVECTOR*)model->vertices;
polys = (PL_POLYFT4*)model->poly_block;
combo = combointensity;
ConvertPolygonTypes(model, pc);
i = model->num_polys;
while (i-- > 0)
{
ptype = polys->id & 0x1f;
// skip certain polygons
if (ptype != 11 && ptype != 21 && ptype != 23)
{
polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]);
continue;
}
@ -705,12 +737,7 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
}
else
{
temp = polys->th;
if ((polys->th & 0x80) == 0) // cache normal index if it were not
temp = polys->th = normalIndex(srcVerts, *(u_int*)&polys->v0);
pc->colour = pc->f4colourTable[(r >> 3) * 4 - temp & 31];
pc->colour = pc->f4colourTable[(r >> 3) * 4 - polys->th & 31];
}
if (opz > 0)
@ -718,13 +745,6 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
pc->tpage = (*pc->ptexture_pages)[polys->texture_set];
pc->clut = (*pc->ptexture_cluts)[polys->texture_set][polys->texture_id];
ushort uv0, uv1, uv2, uv3;
uv0 = *(ushort*)&polys->uv0;
uv1 = *(ushort*)&polys->uv1;
uv2 = *(ushort*)&polys->uv2;
uv3 = *(ushort*)&polys->uv3;
prims = (POLY_FT4*)pc->primptr;
setPolyFT4(prims);
@ -745,10 +765,10 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
prims->tpage = pc->tpage;
prims->clut = pc->clut;
*(ushort*)&prims->u0 = uv0;
*(ushort*)&prims->u1 = uv1;
*(ushort*)&prims->u2 = uv3;
*(ushort*)&prims->u3 = uv2;
*(ushort*)&prims->u0 = *(ushort*)&polys->uv0;
*(ushort*)&prims->u1 = *(ushort*)&polys->uv1;
*(ushort*)&prims->u2 = *(ushort*)&polys->uv3;
*(ushort*)&prims->u3 = *(ushort*)&polys->uv2;
addPrim(pc->ot + (Z >> 1), prims);
@ -756,26 +776,22 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc)
}
polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]);
i--;
}
}
// [D] [T] [A] custom
void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
{
int opz;
int opz, Z, r;
int diff, minZ, maxZ;
int Z;
PL_POLYFT4* polys;
int i;
int r;
u_char temp;
u_char ptype;
POLY_FT4* prims;
SVECTOR* srcVerts;
int combo;
#ifdef PSX
#if 0//def PSX
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
#else
MVERTEX5x5 subdiVerts;
@ -786,29 +802,18 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
combo = combointensity;
ConvertPolygonTypes(model, pc);
i = model->num_polys;
while (i > 0)
while (i-- > 0)
{
// iterate through polygons
// with skipping
ptype = polys->id & 0x1f;
if ((ptype & 0x1) == 0 && ptype != 8) // is FT3 triangle?
{
temp = polys->uv2.v;
polys->uv3.u = polys->uv2.u;
polys->uv3.v = temp;
polys->v3 = polys->v2;
polys->id |= 1;
ptype |= 1;
}
if (ptype != 11 && ptype != 21 && ptype != 23)
{
polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]);
i--;
continue;
}
@ -828,12 +833,7 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
}
else
{
temp = polys->th;
if ((polys->th & 0x80) == 0) // cache normal index if it were not
temp = polys->th = normalIndex(srcVerts, *(u_int*)&polys->v0);
pc->colour = pc->f4colourTable[(r >> 3) * 4 - temp & 31];
pc->colour = pc->f4colourTable[(r >> 3) * 4 - polys->th & 31];
}
if (opz > 0)
@ -937,7 +937,6 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
}
polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]);
i--;
}
}
@ -945,15 +944,12 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
// [D] [T]
int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings)
{
int mat;
int zbias;
int i, mat, prev_mat;
int Z, zbias;
int drawlimit;
MODEL* model;
OTTYPE* ot;
CELL_OBJECT* cop;
int i;
int Z;
int prev_mat;
prev_mat = -1;
@ -974,9 +970,7 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings)
ot = plotContext.current->ot + 8;
i = 0;
while (i < num_buildings)
while (num_buildings--)
{
cop = (CELL_OBJECT*)*objects;
mat = cop->yang;
@ -987,8 +981,7 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings)
}
else
{
Z = Apply_InvCameraMatrixAndSetMatrix(&cop->pos, &CompoundMatrix[mat]);
prev_mat = mat;
Z = Apply_InvCameraMatrixAndSetMatrix(&cop->pos, &CompoundMatrix[prev_mat = mat]);
}
model = Z > DRAW_LOD_DIST_LOW ? pLodModels[cop->type] : modelpointers[cop->type];
@ -1009,8 +1002,6 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings)
if (PRIMTAB_SIZE - drawlimit < 60000)
break;
i++;
objects++;
}
@ -1036,7 +1027,7 @@ void PlotModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
SVECTOR* srcVerts;
int combo;
#ifdef PSX
#if 0//def PSX
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
#else
MVERTEX5x5 subdiVerts;
@ -1382,10 +1373,10 @@ void DrawMapPSX(int* comp_val)
else
distScale = goFaster & 31;
i = (gDrawDistance >> distScale) - 1; // [A]
i = (gDrawDistance >> distScale); // [A]
// walk through all cells
while (i >= 0)
do
{
if (ABS(hloop) + ABS(vloop) < 21)
{
@ -1511,49 +1502,32 @@ void DrawMapPSX(int* comp_val)
drawData.leftPlane += drawData.leftcos;
drawData.backPlane += drawData.backcos;
drawData.rightPlane += drawData.rightcos;
hloop++;
if (hloop + vloop == 1)
dir = 1;
dir = (++hloop + vloop == 1) ? 1 : dir;
}
else if (dir == 1)
{
drawData.leftPlane += drawData.leftsin;
drawData.backPlane += drawData.backsin;
drawData.rightPlane += drawData.rightsin;
vloop++;
//PVS_ptr += pvs_square;
if (hloop == vloop)
dir = 2;
dir = (hloop == ++vloop) ? 2 : dir;
}
else if (dir == 2)
{
hloop--;
drawData.leftPlane -= drawData.leftcos;
drawData.backPlane -= drawData.backcos;
drawData.rightPlane -= drawData.rightcos;
if (hloop + vloop == 0)
dir = 3;
dir = (--hloop + vloop == 0) ? 3 : dir;
}
else
{
drawData.leftPlane -= drawData.leftsin;
drawData.backPlane -= drawData.backsin;
drawData.rightPlane -= drawData.rightsin;
vloop--;
//PVS_ptr -= pvs_square;
if (hloop == vloop)
dir = 0;
dir = (hloop == --vloop) ? 0 : dir;
}
i--;
}
}while (i-- > 0);
#if 0
char tempBuf[512];

View File

@ -1,6 +1,26 @@
#ifndef DRAW_H
#define DRAW_H
// Primitive plot context used in scratchpad
struct _pct
{
struct DB* current;
u_short(*ptexture_pages)[128];
u_short(*ptexture_cluts)[128][32];
int f4colourTable[32];
int* polySizes;
char* primptr;
OTTYPE* ot;
u_int clut;
u_int tpage;
u_int colour;
int flags;
SVECTOR* verts;
u_int lastTexInfo;
int scribble[8];
int model;
};
extern SVECTOR day_vectors[4];
extern SVECTOR night_vectors[4];
extern SVECTOR day_colours[4];

View File

@ -11,67 +11,67 @@ void AddEnvSounds(int level, int time)
switch (level)
{
case 0:
AddEnvSnd(1, 0, 4, 2, 0, -225275, 674800, -207350, 657910);
AddEnvSnd(1, 0, 4, 2, 0, 73730, -359430, 88070, -387080);
AddEnvSnd(1, 0x10, 4, 3, 0, 177700, 77500, 222200, 61700);
AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 2, 0, -225275, 674800, -207350, 657910);
AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 2, 0, 73730, -359430, 88070, -387080);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, 0, 177700, 77500, 222200, 61700);
case 4:
AddEnvSnd(1, 0x10, 4, 0, -5000, 36250, -167050, 70250, -275700);
AddEnvSnd(1, 0x10, 4, 0, -5000, 36250, -157500, 70250, -126900);
AddEnvSnd(1, 0x10, 4, 0, -5000, 36250, -79500, 70250, -113500);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 0, -5000, 36250, -167050, 70250, -275700);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 0, -5000, 36250, -157500, 70250, -126900);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 0, -5000, 36250, -79500, 70250, -113500);
break;
case 1:
AddEnvSnd(3, 0, 4, 2, 2000, -232360, -266390, -232360, -266390);
AddEnvSnd(3, 0, 4, 2, 2000, 252200, -119500, 252200, -119500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 2, 2000, -232360, -266390, -232360, -266390);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 2, 2000, 252200, -119500, 252200, -119500);
case 5:
AddEnvSnd(1, 0, 4, 4, -3500, 324150, -363950, 339500, -323200);
AddEnvSnd(1, 0, 4, 4, -3500, 339500, -326600, 354100, -332600);
AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 4, -3500, 324150, -363950, 339500, -323200);
AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 4, -3500, 339500, -326600, 354100, -332600);
if (level == 5)
{
AddEnvSnd(1, 0x10, 4, 3, -4500, -113900, -181000, -82500, -2424832);
AddEnvSnd(1, 0x10, 4, 3, -4500, -100700, -258250, -89500, -292600);
AddEnvSnd(1, 0x10, 4, 3, -4500, -186100, -321800, -89500, -292600);
AddEnvSnd(1, 0x10, 4, 3, -4500, -282100, -302500, -191100, -321800);
AddEnvSnd(1, 0x10, 4, 3, -4500, -273000, -301500, -294000, -247500);
AddEnvSnd(1, 0x10, 4, 3, -4500, -3145728, -208600, -282500, -246500);
AddEnvSnd(1, 0x10, 4, 3, -4500, -142500, -128100, -90300, -163500);
AddEnvSnd(1, 0x10, 4, 3, -4500, -272700, -114500, -157500, -151900);
AddEnvSnd(1, 0x10, 4, 3, -4500, -154200, -126300, -134700, -65950);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -113900, -181000, -82500, -2424832);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -100700, -258250, -89500, -292600);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -186100, -321800, -89500, -292600);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -282100, -302500, -191100, -321800);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -273000, -301500, -294000, -247500);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -3145728, -208600, -282500, -246500);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -142500, -128100, -90300, -163500);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -272700, -114500, -157500, -151900);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -154200, -126300, -134700, -65950);
}
break;
case 2:
case 6:
AddEnvSnd(1, 0x10, 4, 1, -6000, 177100, 918100, 207600, 874100);
AddEnvSnd(1, 0x10, 4, 1, -6000, 17000, 785500, -598016, 985750);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 1, -6000, 177100, 918100, 207600, 874100);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 1, -6000, 17000, 785500, -598016, 985750);
break;
case 3:
case 7:
AddEnvSnd(1, 0x10, 4, 3, -5000, -330600, 156700, -199100, 73750);
AddEnvSnd(1, 0x10, 4, 3, -5000, -84500, 406700, 256500, 378400);
AddEnvSnd(1, 0x10, 4, 3, -5000, -226200, -520600, 32300, -533400);
AddEnvSnd(1, 0x10, 4, 3, -5000, 37250, -402500, 561152, -533400);
AddEnvSnd(4, 0x18, 4, 3, -5000, 38000, -397500, 165000, -305000);
AddEnvSnd(1, 0x10, 4, 3, -5000, 162300, -1245184, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, 176400, -196000, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, 162500, -195400, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -479232, -370100, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -602112, -370700, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -110800, -371700, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -124300, -385000, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -143900, -385000, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -163600, -383700, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -187100, -384100, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -192600, -381300, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -199000, -364700, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -210700, -363500, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -212700, -313800, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -211800, -266500, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -117450, -279600, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -130100, -300200, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -141300, -329500, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -109850, -331800, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -87350, -332450, 265250, -192500);
AddEnvSnd(3, 0, 4, 0, -1000, -76150, -336150, 265250, -192500);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, -330600, 156700, -199100, 73750);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, -84500, 406700, 256500, 378400);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, -226200, -520600, 32300, -533400);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, 37250, -402500, 561152, -533400);
AddEnvSnd(4, 0x18, SOUND_BANK_ENVIRONMENT, 3, -5000, 38000, -397500, 165000, -305000);
AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, 162300, -1245184, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, 176400, -196000, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, 162500, -195400, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -479232, -370100, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -602112, -370700, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -110800, -371700, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -124300, -385000, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -143900, -385000, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -163600, -383700, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -187100, -384100, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -192600, -381300, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -199000, -364700, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -210700, -363500, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -212700, -313800, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -211800, -266500, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -117450, -279600, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -130100, -300200, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -141300, -329500, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -109850, -331800, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -87350, -332450, 265250, -192500);
AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -76150, -336150, 265250, -192500);
break;
}
}

View File

@ -23,6 +23,102 @@
#include "ASM/rndrasm.h"
#include "cutrecorder.h"
struct FixedEvent // same as EVENT but different fields
{
VECTOR position;
short rotation;
short active;
u_short initialRotation;
u_short finalRotation;
u_short minSpeed;
u_short maxSpeed;
short flags;
short radius;
int model;
EVENT* next;
char* modelName;
};
struct MissionTrain
{
EVENT* engine;
int* node;
int cornerSpeed;
int initialStraightSpeed;
int finalStraightSpeed;
int start;
int startDir;
};
struct Foam
{
MODEL* model;
int rotate;
};
struct EventCarriage
{
short rotation;
short vel;
};
struct MultiCar
{
EVENT* event;
int count;
};
struct Helicopter
{
int speed;
short pitch;
short dp;
short roll;
short dr;
int lastX;
int lastZ;
TEXTURE_DETAILS rotorTexture;
short rotorrot;
short rotorvel;
int cleanModel;
int deadModel;
};
struct Detonator
{
int timer;
int count;
};
struct CameraDelay
{
int delay;
int type;
};
enum VisType
{
VIS_INIT = 0,
VIS_SORT = 1,
VIS_ADD = 2,
VIS_NEXT = 3,
};
struct EventCamera
{
VECTOR position;
short yAng;
MATRIX matrix;
int rotate;
};
enum Station
{
EVENT_NO_STATION = 0,
EVENT_APPROACHING = 1,
EVENT_LEAVING = 2,
};
#define PATH_NODE_WRAP 0x80000000 // go back to first node without interpolation
#define PATH_NODE_CYCLE 0x80000001 // cycle nodes with interpolation
#define PATH_NODE_STATION 0x80000002 // stop point
@ -458,6 +554,8 @@ EVENT* event;
static EventCamera eventCamera;
void MakeEventTrackable(EVENT* ev);
// [D] [T]
int GetVisValue(int index, int zDir)
{

View File

@ -1,6 +1,37 @@
#ifndef EVENT_H
#define EVENT_H
enum SpecialCamera
{
SPECIAL_CAMERA_SET = 0,
SPECIAL_CAMERA_SET2 = 1,
SPECIAL_CAMERA_RESET = 2,
SPECIAL_CAMERA_WAIT = 3,
};
typedef struct _EVENT EVENT;
struct _EVENT
{
VECTOR position;
short rotation;
short timer;
int* data;
int* node;
short flags;
short radius;
int model;
EVENT* next;
};
struct EventGlobal
{
int camera;
int draw;
EVENT** track;
EVENT* cameraEvent;
};
extern EventGlobal events;
extern CELL_OBJECT *EventCop;
@ -12,11 +43,6 @@ extern void InitEvents(); // 0x0004BBD4
extern void SetUpEvents(int full); // 0x00046258
extern VECTOR* TriggerEvent(int i);
extern void InitEventCamera(); // 0x0004BF54
extern void ResetEventCamera(); // 0x0004C014
extern void SetCamera(EVENT *ev); // 0x00047538
extern void EventCollisions(CAR_DATA *cp, int type); // 0x0004BC50
extern void StepEvents(); // 0x00048A60
@ -27,14 +53,10 @@ extern void EventCameraOffset(SVECTOR* offset);
extern sdPlane* EventSurface(VECTOR *pos, sdPlane *plane); // 0x0004A688
extern void MakeEventTrackable(EVENT *ev); // 0x0004BD6C
extern void OffsetTarget(VECTOR *target); // 0x0004BD2C
extern void SetSpecialCamera(SpecialCamera type, int change); // 0x0004B29C
extern void ScreenShake(int count, SVECTOR *ang); // 0x0004C280
extern int DetonatorTimer(); // 0x0004B5FC
extern void MultiCarEvent(MS_TARGET *target); // 0x0004BAB0

View File

@ -1,6 +1,22 @@
#ifndef FMVPLAY_H
#define FMVPLAY_H
struct RENDER_ARG
{
u_char render;
u_char credits;
u_short recap;
};
struct RENDER_ARGS
{
u_char nRenders;
u_char subtitle;
char screenx;
char screeny;
RENDER_ARG Args[4];
};
extern int gSubtitles;
extern int gNoFMV;

View File

@ -24,6 +24,51 @@
#include "debris.h"
#include "felony.h"
typedef struct __othercarsound
{
int car;
int chan;
char in_use;
char stopped;
char idle;
} othercarsound;
typedef struct __bitfield64
{
int h;
int l;
} bitfield64;
typedef struct __envsound
{
u_char type;
u_char flags;
VECTOR pos;
VECTOR pos2;
int bank;
int sample;
int vol;
} envsound;
typedef struct __envsoundtags
{
int frame_cnt;
int func_cnt;
int num_envsnds;
int envsnd_cnt;
} envsoundtags;
typedef struct __envsoundinfo
{
VECTOR eff_pos[4];
VECTOR cam_pos;
float g[4];
int thisS[4];
int playing_sound[4];
int chan[4];
u_int flags;
} envsoundinfo;
typedef void(*envsoundfunc)(envsound* ep /*$s1*/, envsoundinfo* E /*$a1*/, int pl /*$a2*/);
void IdentifyZone(envsound* ep, envsoundinfo* E, int pl);
@ -250,7 +295,7 @@ int MapCarIndexToBank(int index)
}
static char cop_model = 0;
int gDoCopSpeech = 1;
int gDoCopSpeech = 1; // [A]
// [D] [T]
void LoadLevelSFX(int missionNum)
@ -457,14 +502,11 @@ void LoadLevelSFX(int missionNum)
{
gDoCopSpeech = 0;
i = 0;
do {
for (i = 0; i < 3; i++)
{
if (MissionHeader->residentModels[i] == MissionHeader->residentModels[3])
cop_model = i;
i++;
} while (i < 3);
}
}
else
{
@ -532,10 +574,7 @@ void StartGameSounds(void)
TimeSinceLastSpeech = 0;
lcp = player;
i = 0;
while (i < NumPlayers)
for (i = 0; i < NumPlayers; i++)
{
if (lcp->playerType == 1)
{
@ -548,7 +587,6 @@ void StartGameSounds(void)
lcp->revsvol = -10000;
lcp->idlevol = -8000;
lcp++;
i++;
}
if (NumPlayers == 1)
@ -894,22 +932,20 @@ void InitDopplerSFX(void)
{
int i;
i = 0;
do {
for (i = 0; i < MAX_SIREN_NOISES; i++)
{
siren_noise[i].chan = -1;
siren_noise[i].car = 20;
siren_noise[i].in_use = 0;
i++;
} while (i < MAX_SIREN_NOISES);
}
i = 0;
do {
for (i = 0; i < MAX_CAR_NOISES; i++)
{
car_noise[i].chan = -1;
car_noise[i].chan = -1;
car_noise[i].car = 20;
car_noise[i].in_use = 0;
i++;
} while (i < MAX_CAR_NOISES);
}
if (GameType == GAME_GETAWAY)
loudhail_time = 245;
@ -970,11 +1006,9 @@ void DoDopplerSFX(void)
}
// sort cars by distance distance
i = 0;
while (i < num_noisy_cars - 1)
for (i = 0; i < num_noisy_cars - 1; i++)
{
j = i + 1;
while (j < num_noisy_cars)
for (j = i + 1; j < num_noisy_cars; j++)
{
int tmpi;
tmpi = indexlist[i];
@ -984,11 +1018,7 @@ void DoDopplerSFX(void)
indexlist[i] = indexlist[j];
indexlist[j] = tmpi;
}
j++;
}
i++;
}
car_flags = 0;
@ -1323,9 +1353,7 @@ void DoPoliceLoudhailer(int cars, ushort* indexlist, u_int* dist)
else
time = 275;
i = 0;
while (i < cars)
for (i = 0; i < cars; i++)
{
CAR_DATA* car_ptr;
@ -1346,8 +1374,6 @@ void DoPoliceLoudhailer(int cars, ushort* indexlist, u_int* dist)
loudhail_time = 0;
break;
}
i++;
}
if (loudhail_time <= time)
@ -2033,7 +2059,7 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl)
int tmp[4];
float _g[4];
__bitfield64 zones;
bitfield64 zones;
int snd;
// [A] does it really needed? we don't have that much sounds to be played
@ -2097,9 +2123,9 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl)
if (dist < vol)
{
if (i < 32)
zones.l |= 1 << (i & 0x1f);
zones.l |= 1 << (i & 31);
else
zones.h |= 1 << (i & 0x1f);
zones.h |= 1 << (i & 31);
tmp[j] = i;
@ -2111,9 +2137,9 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl)
else
{
if (i < 32)
zones.l |= 1 << (i & 0x1f);
zones.l |= 1 << (i & 31);
else
zones.h |= 1 << (i & 0x1f);
zones.h |= 1 << (i & 31);
tmp[j] = i;
j++;

View File

@ -58,6 +58,16 @@ enum SoundBankIds
SBK_COP_SIREN_START = 69,
};
struct SPEECH_QUEUE
{
char allowed;
char chan;
char is_playing;
int count;
char reverb;
int slot[7];
};
extern int gDriver1Music;
extern int TimeSinceLastSpeech;

View File

@ -18,6 +18,14 @@
#include "Frontend/FEmain.h"
struct MISSION_STEP
{
u_char flags : 3;
u_char recap : 5;
u_char data : 7;
u_char disc : 1;
};
MISSION_STEP MissionLadder[68] =
{
{ 1, 0, 1, 0 },

View File

@ -840,22 +840,22 @@ void initOBox(CAR_DATA* cp)
gte_stlvnl(&cp->hd.oBox.location);
VECTOR svx = { length, 0 ,0 };
VECTOR svy = { 0, car_cos->colBox.vy ,0 };
VECTOR svz = { 0, 0 ,car_cos->colBox.vz };
SVECTOR svx = { length, 0 ,0 };
SVECTOR svy = { 0, car_cos->colBox.vy ,0 };
SVECTOR svz = { 0, 0 ,car_cos->colBox.vz };
gte_ldlvl(&svx);
gte_ldsv(&svx);
gte_rtir();
cp->hd.oBox.length[1] = car_cos->colBox.vy;
gte_stsv(&cp->hd.oBox.radii[0]);
gte_ldlvl(&svy);
gte_ldsv(&svy);
gte_rtir();
cp->hd.oBox.length[2] = car_cos->colBox.vz;
gte_stsv(&cp->hd.oBox.radii[1]);
gte_ldlvl(&svz);
gte_ldsv(&svz);
gte_rtir();
gte_stsv(&cp->hd.oBox.radii[2]);
}
@ -1420,10 +1420,6 @@ void TerminateSkidding(int player_id)
}
}
char rear_only = 0;
char continuous_track = 0;
int last_track_state = -1;
char DebrisTimer = 0;
// [D] [T]
@ -1486,19 +1482,13 @@ void jump_debris(CAR_DATA* cp)
// [D] [T]
void CheckCarEffects(CAR_DATA* cp, int player_id)
{
int channel;
static char last_track_state[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS] = { -1 };
int skidsound, cnt;
int skidsound;
int cnt;
int wheels_on_ground;
char wheels_on_ground;
char lay_down_tracks;
char tracks_and_smoke;
char desired_skid;
char desired_wheel;
wheels_on_ground = 0;
lay_down_tracks = 0;
tracks_and_smoke = 0;
char channel, desired_skid, desired_wheel;
if (cp->controlType != CONTROL_TYPE_PLAYER &&
cp->controlType != CONTROL_TYPE_LEAD_AI &&
@ -1514,10 +1504,14 @@ void CheckCarEffects(CAR_DATA* cp, int player_id)
// [A] do hubcaps here
HandlePlayerHubcaps(player_id);
wheels_on_ground = 0;
lay_down_tracks = 0;
tracks_and_smoke = 0;
for (cnt = 0; cnt < 4; cnt++)
{
if (cp->hd.wheel[cnt].susCompression != 0)
wheels_on_ground = 1;
wheels_on_ground |= 1 << cnt;
}
skidsound = 0;
@ -1529,10 +1523,9 @@ void CheckCarEffects(CAR_DATA* cp, int player_id)
rear_vel = ABS(cp->hd.rear_vel);
front_vel = ABS(cp->hd.front_vel);
if (rear_vel > 22000 || cp->wheelspin)
if ((wheels_on_ground & 5) && (rear_vel > 15000 || cp->wheelspin))
{
rear_only = 1;
lay_down_tracks = true;
lay_down_tracks |= 1;
if (cp->wheelspin == 0)
skidsound = (rear_vel - 11100) / 2 + 1;
@ -1542,13 +1535,13 @@ void CheckCarEffects(CAR_DATA* cp, int player_id)
if (skidsound > 13000)
skidsound = 13000;
}
else if (front_vel > 50000)
if ((wheels_on_ground & 10) && front_vel > 15000)
{
rear_only = 0;
lay_down_tracks = true;
lay_down_tracks |= 2;
}
tracks_and_smoke = (player_id < 2) && !(cp->hd.wheel[1].surface & 0x8) && !(cp->hd.wheel[3].surface & 0x8);
tracks_and_smoke = (player_id < MAX_TYRE_TRACK_PLAYERS) && !(cp->hd.wheel[1].surface & 0x8) && !(cp->hd.wheel[3].surface & 0x8);
}
desired_skid = -1;
@ -1671,23 +1664,52 @@ void CheckCarEffects(CAR_DATA* cp, int player_id)
player[player_id].onGrass = 0;
// make tyre tracks
GetTyreTrackPositions(cp, player_id);
// make tyre tracks
if (lay_down_tracks)
#define ADD_WHEEL_TYRE_TRACK(wheelNum, trackIdx) \
if (wheels_on_ground & (1 << wheelNum)) { \
AddTyreTrack(trackIdx, tracks_and_smoke, player_id, last_track_state[player_id][trackIdx] != -1); \
last_track_state[player_id][trackIdx] = 1; \
} else \
last_track_state[player_id][trackIdx] = -1;
if (lay_down_tracks & 1) // rear
{
continuous_track = (last_track_state == rear_only);
AddTyreTrack(player_id * 2, tracks_and_smoke, player_id);
AddTyreTrack(player_id * 2 + 1, tracks_and_smoke, player_id);
last_track_state = rear_only;
#if MAX_TYRE_TRACK_WHEELS == 4
ADD_WHEEL_TYRE_TRACK(0, 0)
ADD_WHEEL_TYRE_TRACK(2, 2)
#else
ADD_WHEEL_TYRE_TRACK(0, 0)
ADD_WHEEL_TYRE_TRACK(2, 1)
#endif
}
else
{
last_track_state = -1;
#if MAX_TYRE_TRACK_WHEELS == 4
last_track_state[player_id][0] = -1;
last_track_state[player_id][2] = -1;
#else
last_track_state[player_id][0] = -1;
last_track_state[player_id][1] = -1;
#endif
}
#if MAX_TYRE_TRACK_WHEELS == 4
if (lay_down_tracks & 2) // front
{
ADD_WHEEL_TYRE_TRACK(1, 1)
ADD_WHEEL_TYRE_TRACK(3, 3)
}
else
{
last_track_state[player_id][1] = -1;
last_track_state[player_id][3] = -1;
}
#endif
#undef ADD_WHEEL_TYRE_TRACK
SetTyreTrackOldPositions(player_id);
}

View File

@ -4,7 +4,6 @@
extern int ghost_mode;
extern int playerghost;
extern int playerhitcopsanyway;
extern char continuous_track;
extern void InitCarPhysics(CAR_DATA *cp, LONGVECTOR4* startpos, int direction); // 0x0005381C
extern void TempBuildHandlingMatrix(CAR_DATA *cp, int init); // 0x000539E8

View File

@ -33,6 +33,37 @@ static int pathParams[5] = {
int road_s = 0;
int road_c = 0;
struct MAP_DATA
{
CAR_DATA* cp;
VECTOR* base;
VECTOR* pos;
VECTOR* vel;
VECTOR* size;
int intention;
int* map;
int* local;
};
enum LeadDriveState
{
LeadDrive_Handbrake = 0,
LeadDrive_DropPedals = 1,
LeadDrive_CorrectOversteer = 2,
LeadDrive_NormalDrive = 3,
LeadDrive_Unstuck = 4,
LeadDrive_Panic = 5,
LeadDrive_EmergencyBrake = 6,
LeadDrive_Wheelspin = 7,
LeadDrive_FakeMotion = 8,
};
void CheckCurrentRoad(CAR_DATA* cp);
void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention);
void FakeMotion(CAR_DATA* cp);
void SelectExit(CAR_DATA* cp, DRIVER2_JUNCTION* junction);
void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction);
// [D] [T]
int leadRand(void)
{
@ -50,7 +81,7 @@ void InitLead(CAR_DATA* cp)
cp->hndType = 5;
cp->controlType = CONTROL_TYPE_LEAD_AI;
cp->ai.l.roadPosition = 512;
cp->ai.l.dstate = 3;
cp->ai.l.dstate = LeadDrive_NormalDrive;
cp->ai.l.recoverTime = 40;
cp->ai.l.nextExit = 2;
cp->ai.l.roadForward = 5120;
@ -151,11 +182,11 @@ void LeadUpdateState(CAR_DATA* cp)
|| ABS(z - player[0].pos[2]) > 15900)
{
// request that we spool him in
cp->ai.l.dstate = 8;
cp->ai.l.dstate = LeadDrive_FakeMotion;
return;
}
if (cp->ai.l.dstate == 8)
if (cp->ai.l.dstate == LeadDrive_FakeMotion)
{
// don't spool him in until everything is loaded
if (spoolactive)
@ -168,23 +199,23 @@ void LeadUpdateState(CAR_DATA* cp)
InitCarPhysics(cp, (LONGVECTOR4*)&tmpStart, cp->ai.l.targetDir);
// start him up
cp->ai.l.dstate = 3;
cp->ai.l.dstate = LeadDrive_NormalDrive;
ResetTyreTracks(cp, GetPlayerId(cp));
}
if (ABS(cp->ai.l.panicCount) > 0)
cp->ai.l.dstate = 5;
cp->ai.l.dstate = LeadDrive_Panic;
if (cp->ai.l.dstate == 6)
cp->ai.l.dstate = 3;
if (cp->ai.l.dstate == LeadDrive_EmergencyBrake)
cp->ai.l.dstate = LeadDrive_NormalDrive;
if (cp->hd.speed < 10)
++cp->ai.l.stuckCount;
else
cp->ai.l.stuckCount = 0;
if (cp->ai.l.dstate == 4)
if (cp->ai.l.dstate == LeadDrive_Unstuck)
{
if (cp->ai.l.stuckCount > 20)
{
@ -199,7 +230,7 @@ void LeadUpdateState(CAR_DATA* cp)
{
cp->ai.l.stuckCount = 0;
cp->ai.l.recoverTime = 0;
cp->ai.l.dstate = 4;
cp->ai.l.dstate = LeadDrive_Unstuck;
}
}
@ -208,22 +239,22 @@ void LeadUpdateState(CAR_DATA* cp)
switch (cp->ai.l.dstate)
{
case 0:
case LeadDrive_Handbrake:
{
CheckCurrentRoad(cp);
if (cp->hd.speed < 20)
cp->ai.l.dstate = 3;
cp->ai.l.dstate = LeadDrive_NormalDrive;
if (ABS(end) < LeadValues.hEnd)
{
if (ABS(avel) > 150)
cp->ai.l.dstate = 1;
cp->ai.l.dstate = LeadDrive_DropPedals;
}
break;
}
case 1:
case LeadDrive_DropPedals:
{
CheckCurrentRoad(cp);
@ -231,26 +262,26 @@ void LeadUpdateState(CAR_DATA* cp)
{
if (ABS(avel) < 24)
{
cp->ai.l.dstate = 3;
cp->ai.l.dstate = LeadDrive_NormalDrive;
}
else
{
cp->ai.l.dstate = 2;
cp->ai.l.dstate = LeadDrive_CorrectOversteer;
}
}
break;
}
case 2:
case LeadDrive_CorrectOversteer:
{
CheckCurrentRoad(cp);
if (ABS(avel) < 24)
cp->ai.l.dstate = 3;
cp->ai.l.dstate = LeadDrive_NormalDrive;
break;
}
case 3:
case LeadDrive_NormalDrive:
{
volatile int dist;
@ -273,9 +304,9 @@ void LeadUpdateState(CAR_DATA* cp)
int hDist = LeadValues.hDist + (cp->hd.speed - 100) * LeadValues.hDistMul;
if (dist < hDist)
cp->ai.l.dstate = 3; // [A] was 6
cp->ai.l.dstate = LeadDrive_NormalDrive; // [A] was LeadDrive_OversteerBrake
else
cp->ai.l.dstate = 0;
cp->ai.l.dstate = LeadDrive_Handbrake;
break;
}
@ -285,7 +316,7 @@ void LeadUpdateState(CAR_DATA* cp)
if (dist < tDist)
{
cp->ai.l.dstate = 0;
cp->ai.l.dstate = LeadDrive_Handbrake;
break;
}
}
@ -302,14 +333,14 @@ void LeadUpdateState(CAR_DATA* cp)
lDist = LeadValues.tDist + cp->hd.speed * LeadValues.tDistMul;
if (dist < lDist && cp->ai.l.roadForward > 0)
cp->ai.l.dstate = 7;
cp->ai.l.dstate = LeadDrive_Wheelspin;
else
cp->ai.l.dstate = 6;
cp->ai.l.dstate = LeadDrive_EmergencyBrake;
}
break;
}
case 4:
case LeadDrive_Unstuck:
{
pos.vx = cp->hd.where.t[0];
pos.vy = cp->hd.where.t[1];
@ -321,30 +352,30 @@ void LeadUpdateState(CAR_DATA* cp)
if (cp->ai.l.roadForward == 0)
{
cp->ai.l.dstate = 3;
cp->ai.l.dstate = LeadDrive_NormalDrive;
cp->ai.l.stuckCount = 0;
}
break;
}
case 5:
case LeadDrive_Panic:
{
CheckCurrentRoad(cp);
if (cp->ai.l.panicCount == 0)
{
if (ABS(end) < 200)
cp->ai.l.dstate = 2;
cp->ai.l.dstate = LeadDrive_CorrectOversteer;
}
break;
}
case 7:
case LeadDrive_Wheelspin:
{
CheckCurrentRoad(cp);
if (ABS(end) < cp->hd.speed + LeadValues.tEnd)
cp->ai.l.dstate = 2;
cp->ai.l.dstate = LeadDrive_CorrectOversteer;
break;
}
@ -416,7 +447,7 @@ u_int LeadPadResponse(CAR_DATA* cp)
switch (cp->ai.l.dstate)
{
case 0:
case LeadDrive_Handbrake:
{
int deltaAVel;
@ -436,7 +467,7 @@ u_int LeadPadResponse(CAR_DATA* cp)
break;
}
case 3:
case LeadDrive_NormalDrive:
{
volatile int dx, dz;
volatile int deltaPos;
@ -474,18 +505,15 @@ u_int LeadPadResponse(CAR_DATA* cp)
if (ABS(steerDelta) > 64)
t0 |= CAR_PAD_FASTSTEER;
if (steerDelta + 31U <= 62)
if (steerDelta + 31U <= 62 && ABS(avel) <= 5)
{
if (ABS(avel) <= 5)
{
if (t0 & CAR_PAD_ACCEL)
t0 |= CAR_PAD_WHEELSPIN;
}
if (t0 & CAR_PAD_ACCEL)
t0 |= CAR_PAD_WHEELSPIN;
}
break;
}
case 4:
case LeadDrive_Unstuck:
{
volatile int deltaPos;
@ -508,7 +536,7 @@ u_int LeadPadResponse(CAR_DATA* cp)
break;
}
case 5:
case LeadDrive_Panic:
{
volatile int deltaAVel;
@ -560,7 +588,7 @@ u_int LeadPadResponse(CAR_DATA* cp)
break;
}
case 6:
case LeadDrive_EmergencyBrake:
{
t0 = (avel < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT;
//t0 |= ((deltaTh < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT);
@ -572,7 +600,7 @@ u_int LeadPadResponse(CAR_DATA* cp)
break;
}
case 7:
case LeadDrive_Wheelspin:
{
if (ABS(avel) > LeadValues.tAvelLimit)
{
@ -583,7 +611,7 @@ u_int LeadPadResponse(CAR_DATA* cp)
t0 |= CAR_PAD_WHEELSPIN;
break;
}
case 8:
case LeadDrive_FakeMotion:
{
FakeMotion(cp);
break;
@ -939,7 +967,7 @@ void BlockToMap(MAP_DATA* data)
someVar = FIXEDH(ABS(data->size->vx * road_s) + ABS(data->size->vz * road_c));
if (data->intention == 0 || data->cp->ai.l.dstate == 3)
if (data->intention == 0 || data->cp->ai.l.dstate == LeadDrive_NormalDrive)
{
v = (data->cp->hd.speed + 100) * 10;
@ -1383,8 +1411,8 @@ int IsOnMap(int x, int z, VECTOR* basePos, int intention, CAR_DATA* cp)
dx = x - curve->Midx;
dz = z - curve->Midz;
tangent = DIFF_ANGLES(cp->ai.l.base_Angle, ratan2(dx, dz)); // (((ratan2(dx, dz) - cp->ai.l.base_Angle) + 2048U & 0xfff) - 2048) *
cp->ai.l.base_Dir * ((curve->inside * 45056) / 28672);
tangent = DIFF_ANGLES(cp->ai.l.base_Angle, ratan2(dx, dz)) // (((ratan2(dx, dz) - cp->ai.l.base_Angle) + 2048U & 0xfff) - 2048) *
* cp->ai.l.base_Dir * ((curve->inside * 45056) / 28672);
normal = (cp->ai.l.base_Normal - hypot(dx, dz)) * cp->ai.l.base_Dir;
@ -1634,8 +1662,8 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention)
BlockToMap(&data);
num_cb = num_cb + -1;
collide = collide + 1;
num_cb--;
collide++;
}
}
ppco = GetNextPackedCop(&ci);
@ -1687,7 +1715,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention)
}
// update panic
if (cp->ai.l.dstate != 4)
if (cp->ai.l.dstate != LeadDrive_Unstuck)
{
int left, right;
int spd;
@ -2208,7 +2236,7 @@ void CheckCurrentRoad(CAR_DATA* cp)
else
fixedThresh = LeadValues.tDist + cp->hd.speed * LeadValues.tDistMul;
if (toGo < fixedThresh && cp->ai.l.offRoad == 0 && cp->ai.l.dstate != 5)
if (toGo < fixedThresh && cp->ai.l.offRoad == 0 && cp->ai.l.dstate != LeadDrive_Panic)
{
checkNext = 1;
cp->ai.l.direction = 0;
@ -2743,7 +2771,7 @@ u_int FreeRoamer(CAR_DATA* cp)
DamageBar.position = cp->totalDamage;
if (cp->ai.l.dstate != 8)
if (cp->ai.l.dstate != LeadDrive_FakeMotion)
{
// flipped? Or sinking in water?
if (cp->hd.where.m[1][1] < 100 || (cp->hd.wheel[1].surface & 7) == 1 && (cp->hd.wheel[3].surface & 7) == 1)

View File

@ -1,42 +1,7 @@
#ifndef LEADAI_H
#define LEADAI_H
extern int leadRand(); // 0x000E70A0
extern void InitLead(CAR_DATA *cp); // 0x000E7128
extern void LeadUpdateState(CAR_DATA *cp); // 0x000E73E8
extern u_int LeadPadResponse(CAR_DATA *cp); // 0x000E7994
extern void FakeMotion(CAR_DATA *cp); // 0x000E7DE8
extern void PosToIndex(int *normal, int *tangent, int intention, CAR_DATA *cp); // 0x000E834C
extern void BlockToMap(MAP_DATA *data); // 0x000E86BC
extern int IsOnMap(int x, int z, VECTOR *basePos, int intention, CAR_DATA *cp); // 0x000E98A4
extern void UpdateRoadPosition(CAR_DATA *cp, VECTOR *basePos, int intention); // 0x000E9BB8
extern void slowWallTests() ; // 0x000E913C
extern void asf() ; // 0x000E9158
extern void DoExtraWorkForNFrames() ; // 0x000E99AC
extern void searchTarget() ; // 0x000E9AB8
extern void CheckCurrentRoad(CAR_DATA *cp); // 0x000EB1FC
extern void SetTarget(CAR_DATA *cp, int cr, int heading, int *nextJunction); // 0x000EC1C4
extern void SelectExit(CAR_DATA *cp, DRIVER2_JUNCTION *junction); // 0x000EC5E4
extern u_int FreeRoamer(CAR_DATA *cp); // 0x000EC99C
extern u_int hypot(int x, int y); // 0x000ECB28
extern void InitLead(CAR_DATA *cp);
extern u_int FreeRoamer(CAR_DATA *cp);
#endif

View File

@ -17,6 +17,37 @@
#include <stdlib.h> // getenv
#endif // PSX
struct GAME_SAVE_HEADER
{
u_int magic;
u_char gMissionLadderPos;
u_char pad1;
u_char pad2;
u_char pad3;
MISSION_DATA SavedData;
int reserved[8];
};
struct CONFIG_SAVE_HEADER
{
u_int magic;
int gMasterVolume;
int gMusicVolume;
int gSoundMode;
int gVibration;
int gCopDifficultyLevel;
int gFurthestMission;
MAPPING PadMapping[2];
SCORE_TABLES ScoreTables;
int PALAdjustX;
int PALAdjustY;
int NTSCAdjustX;
int NTSCAdjustY;
int gSubtitles;
ACTIVE_CHEATS AvailableCheats;
int reserved[6];
};
// [A]
void ShowSavingWaitMessage(char *message, int height)
{
@ -146,7 +177,7 @@ void LoadCurrentProfile(int init)
}
// [A] saves config to file
void SaveCurrentProfile()
void SaveCurrentProfile(int showMessage)
{
#ifndef PSX
int dataSize;
@ -157,8 +188,11 @@ void SaveCurrentProfile()
strcat(filePath, "/config.dat");
SetTextColour(128, 128, 64);
ShowSavingWaitMessage(G_LTXT(GTXT_SavingConfiguration), 0);
if (showMessage)
{
SetTextColour(128, 128, 64);
ShowSavingWaitMessage(G_LTXT(GTXT_SavingConfiguration), 0);
}
dataSize = 0;
if (SaveConfigData((char*)_other_buffer))
@ -176,7 +210,7 @@ void SaveCurrentProfile()
error = 0;
}
if (error)
if (error && showMessage)
{
SetTextColour(128, 0, 0);
ShowSavingWaitMessage(G_LTXT(GTXT_SavingError), 0);

View File

@ -4,7 +4,7 @@
extern char gCurrentReplayFilename[64];
extern void LoadCurrentProfile(int init);
extern void SaveCurrentProfile();
extern void SaveCurrentProfile(int showMessage);
extern int LoadCurrentGame();
extern void SaveCurrentGame();

View File

@ -406,12 +406,7 @@ void LoadGameLevel(void)
sector = citylumps[GameLevel][CITYLUMP_DATA1].x / CDSECTOR_SIZE;
nsectors = citylumps[GameLevel][CITYLUMP_DATA1].y / CDSECTOR_SIZE;
#ifdef PSX
loadsectors((char*)_primTab1, sector, nsectors);
#else
extern char g_CurrentLevelFileName[64];
loadsectorsPC(g_CurrentLevelFileName, (char*)_primTab1, sector, nsectors);
#endif // PSX
sector += nsectors;
@ -428,12 +423,8 @@ void LoadGameLevel(void)
malloc_lump = D_MALLOC(nsectors * CDSECTOR_SIZE);
D_MALLOC_END();
#ifdef PSX
loadsectors(malloc_lump, sector, nsectors);
#else
extern char g_CurrentLevelFileName[64];
loadsectorsPC(g_CurrentLevelFileName, malloc_lump, sector, nsectors);
#endif // PSX
sector += nsectors;
// CITYLUMP_DATA2 - in-memory lump
@ -647,11 +638,10 @@ void State_GameInit(void* param)
plStart = PlayerStartInfo[i];
padid = -i;
gStartOnFoot = (plStart->type == 2);
if (i < NumPlayers)
{
gStartOnFoot = (plStart->type == 2);
padid = i;
}
InitPlayer(&player[i], &car_data[i], plStart->controlType, plStart->rotation, (LONGVECTOR4 *)&plStart->position, plStart->model, plStart->palette, &padid);
@ -841,7 +831,6 @@ int num_active_cars = 0;
u_int lead_pad = 0;
int numInactiveCars = 0;
int leadCarId = 0;
VECTOR leadcar_pos;
@ -882,7 +871,7 @@ void StepSim(void)
pauseflag = 1;
}
oldsp = SetSp((u_long)((u_char*)getScratchAddr(0) + 0x3e8)); // i don't know what this does
//oldsp = SetSp((u_long)((u_char*)getScratchAddr(0) + 0x3e8)); // i don't know what this does
lead_pad = (u_int)controller_bits;
@ -1062,7 +1051,7 @@ void StepSim(void)
break;
case CONTROL_TYPE_CUTSCENE:
if (!_CutRec_RecordPad(cp, &t0, &t1, &t2))
if (!_CutRec_RecordCarPad(cp, &t0, &t1, &t2))
cjpPlay(-*cp->ai.padid, &t0, &t1, &t2);
ProcessCarPad(cp, t0, t1, t2);
@ -1073,7 +1062,7 @@ void StepSim(void)
}
// Update players
for (i = 0; i < 8; i++)
for (i = 0; i < MAX_PLAYERS; i++)
{
pl = &player[i];
@ -1082,64 +1071,62 @@ void StepSim(void)
stream = pl->padid;
if (stream < 0)
if (stream < 0) // Is cutscene stream?
{
if (cjpPlay(-stream, &t0, &t1, &t2) != 0)
if (!_CutRec_RecordPad(pl, &t0, &t1, &t2) && cjpPlay(-stream, &t0, &t1, &t2) != 0)
ProcessTannerPad(pl->pPed, t0, t1, t2);
continue;
}
if (Pads[stream].type == 4)
{
padAcc = Pads[stream].mapanalog[3];
// walk back
if (padAcc < -64)
{
if(padAcc < -100)
Pads[stream].mapped |= 0x1000;
else
Pads[stream].mapped |= 0x1008;
}
else if (padAcc > 32)
{
stream = pl->padid;
Pads[stream].mapped |= 0x4000;
}
}
t0 = Pads[stream].mapped;
t1 = Pads[stream].mapanalog[2];
t2 = Pads[stream].type & 4;
// [A] handle REDRIVER2 dedicated car entry button
if (t0 & TANNER_PAD_ACTION_DED)
{
t0 &= ~TANNER_PAD_ACTION_DED;
t0 |= TANNER_PAD_ACTION;
}
if (NoPlayerControl == 0)
{
if (gStopPadReads)
{
t2 = 0;
t1 = 0;
t0 = 0;
}
cjpRecord(stream, &t0, &t1, &t2);
}
else
{
if (Pads[stream].type == 4)
{
padAcc = Pads[stream].mapanalog[3];
// walk back
if (padAcc < -64)
{
if(padAcc < -100)
Pads[stream].mapped |= 0x1000;
else
Pads[stream].mapped |= 0x1008;
}
else if (padAcc > 32)
{
stream = pl->padid;
Pads[stream].mapped |= 0x4000;
}
}
stream = pl->padid;
t0 = Pads[stream].mapped;
t1 = Pads[stream].mapanalog[2];
t2 = Pads[stream].type & 4;
// [A] handle REDRIVER2 dedicated car entry button
if (t0 & TANNER_PAD_ACTION_DED)
{
t0 &= ~TANNER_PAD_ACTION_DED;
t0 |= TANNER_PAD_ACTION;
}
if (NoPlayerControl == 0)
{
if (gStopPadReads)
{
t2 = 0;
t1 = 0;
t0 = 0;
}
cjpRecord(stream, &t0, &t1, &t2);
}
else
{
if (cjpPlay(stream, &t0, &t1, &t2) == 0)
continue;
}
ProcessTannerPad(pl->pPed, t0, t1, t2);
if (cjpPlay(stream, &t0, &t1, &t2) == 0)
continue;
}
ProcessTannerPad(pl->pPed, t0, t1, t2);
}
if (requestStationaryCivCar == 1 && (numCivCars < maxCivCars || (PingOutCar(&car_data[furthestCivID]), numCivCars < maxCivCars)))
@ -1161,7 +1148,7 @@ void StepSim(void)
DoScenaryCollisions();
CheckPlayerMiscFelonies();
SetSp(oldsp);
//SetSp(oldsp);
CameraCnt++;
@ -1212,15 +1199,27 @@ void StepSim(void)
static int stupid_logic[4];
// "Car Bomb"?
if (gInGameCutsceneActive != 0 && gCurrentMissionNumber == 23 && gInGameCutsceneID == 0)
stupid_logic[0] = 2;
#if MAX_TYRE_TRACK_PLAYERS > 2
if (gInGameCutsceneActive != 0)
{
for (i = 0; i < 4; i++)
{
stupid_logic[i] = player[i + NumPlayers].playerCarId;
}
}
else
stupid_logic[0] = player[0].playerCarId;
#endif
{
// "Car Bomb"?
if (gInGameCutsceneActive != 0 && gCurrentMissionNumber == 23 && gInGameCutsceneID == 0)
stupid_logic[0] = 2;
else
stupid_logic[0] = player[0].playerCarId;
stupid_logic[1] = player[1].playerCarId;
stupid_logic[2] = gThePlayerCar;
stupid_logic[3] = leadCarId;
stupid_logic[1] = player[1].playerCarId;
stupid_logic[2] = gThePlayerCar;
stupid_logic[3] = player[0].targetCarId; // [A]
}
for (i = 0; i < 3; i++)
{
@ -1231,7 +1230,7 @@ void StepSim(void)
}
}
for (car = 0, i = 0; car < 4 && i < 2; car++)
for (car = 0, i = 0; car < 4; car++)
{
if (stupid_logic[car] != -1 && SilenceThisCar(car) == 0)
{
@ -1306,19 +1305,15 @@ void StepGame(void)
if ((padd & 0x2000U) && (padd & 0x8000U))
padd &= ~0xA000;
i = NumPlayers;
controller_bits = padd;
pl = player;
while (i >= 0)
for (i = 0; i < NumPlayers; i++)
{
pl = &player[i];
if (pl->horn.time == 0 || pl->horn.on == 0)
pl->horn.time = 0;
else
pl->horn.time--;
i--;
pl++;
}
ModifyCamera();
@ -1493,12 +1488,12 @@ void CheckForPause(void)
{
if (NumPlayers == 1)
{
if (paddp == 0x800 && bMissionTitleFade == 0) // [A] && gInGameCutsceneActive == 0) // allow pausing during cutscene
if (paddp == MPAD_START && bMissionTitleFade == 0) // [A] && gInGameCutsceneActive == 0) // allow pausing during cutscene
{
EnablePause(PAUSEMODE_PAUSE);
}
}
else if (paddp == 0x800)
else if (paddp == MPAD_START)
{
EnablePause(PAUSEMODE_PAUSEP1);
}
@ -2121,7 +2116,7 @@ int redriver2_main(int argc, char** argv)
DoStateLoop();
#ifndef PSX
SaveCurrentProfile();
SaveCurrentProfile(1);
#endif
return 1;
@ -2323,7 +2318,7 @@ void RenderGame2(int view)
colour = 32 - colour;
SetTextColour((colour & 0x1f) << 3, 0, 0);
PrintString(G_LTXT(GTXT_DEMO), 32, 15);
PrintString(G_LTXT(GTXT_DEMO), gOverlayXPos, 15);
}
for (i = 0; i < 2; i++)

View File

@ -18,7 +18,6 @@ extern int numInactiveCars;
extern int gLightsOn;
extern int NightAmbient;
extern int wetness;
extern int leadCarId;
extern int scr_z;

View File

@ -230,10 +230,8 @@ int CheckUnpackNewRegions(void)
int x, z;
int i, j;
int sortcount;
int leftright_unpack;
int topbottom_unpack;
int target_region;
int region_to_unpack;
int leftright_unpack, topbottom_unpack;
int target_region, region_to_unpack;
int num_regions_to_unpack;
int force_load_boundary;
AREA_LOAD_INFO regions_to_unpack[3];
@ -318,11 +316,8 @@ int CheckUnpackNewRegions(void)
num_regions_to_unpack = 3;
}
i = 0;
sortcount = 0;
// get next region a space
while (i < num_regions_to_unpack)
for (i = 0, sortcount = 0; i < num_regions_to_unpack; i++)
{
x = regions_to_unpack[i].xoffset;
z = regions_to_unpack[i].zoffset;
@ -353,11 +348,9 @@ int CheckUnpackNewRegions(void)
sortcount++;
}
}
i++;
}
i = 0;
while (i < sortcount)
for (i = 0; i < sortcount; i++)
{
if (sortcount > (i + 1))
{
@ -380,8 +373,6 @@ int CheckUnpackNewRegions(void)
}
UnpackRegion(sortregions[sortorder[i]].vx, sortregions[sortorder[i]].vy);
i++;
}
return 1;
@ -406,7 +397,7 @@ void ControlMap(void)
region_to_unpack = region_x + region_z * regions_across;
if (current_region == -1)
UnpackRegion(region_to_unpack, region_x & 1U | (region_z & 1U) * 2); // is that ever valid for 'target_barrel_region'?
UnpackRegion(region_to_unpack, region_x & 1U | (region_z & 1U) * 2);
current_region = region_to_unpack;

View File

@ -394,7 +394,7 @@ void InitializeMissionSound(void)
{
es_mobile[0] = AddEnvSnd(3, 0x20, SOUND_BANK_MISSION, GetMissionSound(14), 0, -10000, 0, 0, 0);
}
else if (gCurrentMissionNumber == 0x14)
else if (gCurrentMissionNumber == 20)
{
jericho_in_back = 1;
}

View File

@ -14,6 +14,7 @@
#include "dr2roads.h"
#include "cars.h"
#include "targets.h"
#include "system.h"
int gDisplayPosition = 0;
@ -98,8 +99,8 @@ void DrawMission(void)
}
else
{
PrintScaledString(64, string, 32 - (g321GoDelay & 0x1f));
PrintScaledString(192, string, 32 - (g321GoDelay & 0x1f));
PrintScaledString(SCREEN_H / 4, string, 32 - (g321GoDelay & 0x1f));
PrintScaledString(SCREEN_H / 2 + SCREEN_H / 4, string, 32 - (g321GoDelay & 0x1f));
}
}
else if (!pauseflag)
@ -109,11 +110,11 @@ void DrawMission(void)
if (NumPlayers == 1)
DrawMessage(96, Mission.message_string[0]);
else
DrawMessage(64, Mission.message_string[0]);
DrawMessage(SCREEN_H / 4, Mission.message_string[0]);
}
if (Mission.message_timer[1] != 0)
DrawMessage(192, Mission.message_string[1]);
DrawMessage(SCREEN_H / 2 + SCREEN_H / 4, Mission.message_string[1]);
}
if (Mission.active && !NoPlayerControl)
@ -130,7 +131,7 @@ void DrawMission(void)
if (gOutOfTape)
{
SetTextColour(128, 128, 64);
PrintString(G_LTXT(GTXT_OutOfTape), gOverlayXPos, 236);
PrintString(G_LTXT(GTXT_OutOfTape), gOverlayXPos, SCREEN_H - 20);
}
}
}

View File

@ -536,7 +536,7 @@ void LoadMission(int missionnum)
Mission.timer[0].x = Mission.timer[1].x = 124;
Mission.timer[0].y = 16;
Mission.timer[1].y = 136;
Mission.timer[1].y = SCREEN_H / 2 + 8;
if (MissionHeader->timer || (MissionHeader->timerFlags & MISSIONTIMER_FLAG_COUNTER))
{
@ -1170,8 +1170,7 @@ void SetMissionMessage(char *message, int priority, int seconds)
if (message == MissionStrings - 1 || message == NULL || NumPlayers == 0)
return;
i = 0;
while (i < NumPlayers)
for (i = 0; i < NumPlayers; i++)
{
if (Mission.message_timer[i] == 0 || Mission.message_priority[i] <= priority)
{
@ -1187,8 +1186,6 @@ void SetMissionMessage(char *message, int priority, int seconds)
Mission.message_timer[i] = seconds * 30;
}
}
i++;
}
}
@ -1664,6 +1661,10 @@ int MRCommand(MR_THREAD *thread, u_int cmd)
AvailableCheats.cheat4 = 1;
}
#ifndef PSX
SaveCurrentProfile(0);
#endif
return 1;
}
else if (cmd == 0x1000090) // SetRaining

View File

@ -464,14 +464,14 @@ void ProcessMotionLump(char* lump_ptr, int lump_size)
}
// [D] [T]
void SetupPedMotionData(PEDESTRIAN* pPed)
void SetupPedMotionData(LPPEDESTRIAN pPed)
{
pPed->motion = MotionCaptureData[pPed->type];
}
// [D] [T]
void SetupPedestrian(PEDESTRIAN* pedptr)
void SetupPedestrian(LPPEDESTRIAN pedptr)
{
pedptr->velocity.vy = 10;
pedptr->speed = 10;
@ -487,7 +487,7 @@ int bDoingShadow = 0;
int gCurrentZ;
// [D] [T] [A]
void DrawBodySprite(PEDESTRIAN* pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYPE v2[2], int sz, int sy)
void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYPE v2[2], int sz, int sy)
{
#if 0
// debug code
@ -788,11 +788,7 @@ void DrawBodySprite(PEDESTRIAN* pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYP
if (bDoingShadow != 0)
{
addPrim(current->ot + 0x107f, prims);
#ifdef PGXP
prims->pgxp_index = 0xffff;
#endif
addPrim(current->ot + OTSIZE - 1, prims);
}
else
{
@ -894,7 +890,7 @@ int bodyShiftValue = BODY_OFFSET;
int torsoShiftValue = TORSO_OFFSET;
// [D] [T]
void SetupTannerSkeleton(PEDESTRIAN* pDrawingPed)
void SetupTannerSkeleton(LPPEDESTRIAN pDrawingPed)
{
int i;
BONE* pBone;
@ -1007,7 +1003,7 @@ void SetupTannerSkeleton(PEDESTRIAN* pDrawingPed)
}
// [A] - was inlined in newShowTanner
void DrawSprite(PEDESTRIAN* pDrawingPed, BONE* pBone, VECTOR* vJPos)
void DrawSprite(LPPEDESTRIAN pDrawingPed, BONE* pBone, VECTOR* vJPos)
{
VERTTYPE t0[2], t1[2]; // [A] was two longs
int z, z1, z2;
@ -1044,7 +1040,7 @@ void DrawSprite(PEDESTRIAN* pDrawingPed, BONE* pBone, VECTOR* vJPos)
int bAllreadyRotated = 0;
// [D] [T]
void newShowTanner(PEDESTRIAN* pDrawingPed)
void newShowTanner(LPPEDESTRIAN pDrawingPed)
{
int i, j;
int draw;
@ -1257,7 +1253,7 @@ void newShowTanner(PEDESTRIAN* pDrawingPed)
}
// [D] [T]
SVECTOR* GetModelVertPtr(PEDESTRIAN* pDrawingPed, int boneId, int modelType)
SVECTOR* GetModelVertPtr(LPPEDESTRIAN pDrawingPed, int boneId, int modelType)
{
int startVertex;
@ -1297,7 +1293,7 @@ SVECTOR* GetModelVertPtr(PEDESTRIAN* pDrawingPed, int boneId, int modelType)
}
// [D] [T]
void newRotateBones(PEDESTRIAN* pDrawingPed, BONE* poBone)
void newRotateBones(LPPEDESTRIAN pDrawingPed, BONE* poBone)
{
SVECTOR* pVerts;
MODEL* pModel;
@ -1424,7 +1420,7 @@ void newRotateBones(PEDESTRIAN* pDrawingPed, BONE* poBone)
// [D] [T]
void DrawCiv(PEDESTRIAN* pPed)
void DrawCiv(LPPEDESTRIAN pPed)
{
SVECTOR* vert2;
SVECTOR* vert1;
@ -1433,7 +1429,7 @@ void DrawCiv(PEDESTRIAN* pPed)
int boneId;
int frame;
int i, j;
u_int phase;
int phase;
SVECTOR pos;
VECTOR pos1;
SVECTOR rot;
@ -1563,7 +1559,7 @@ void DrawCiv(PEDESTRIAN* pPed)
ppos.vy = pPed->position.vy;
ppos.vz = pPed->position.vz;
phase = (pPed->frame1 & 0xf) * 2;
phase = (pPed->frame1 & 15) * 2;
cv.b = 40;
cv.g = 40;
@ -1616,7 +1612,7 @@ void SetSkelModelPointers(int type)
int iCurrBone = 0;
// [D] [T]
void DrawTanner(PEDESTRIAN* pPed)
void DrawTanner(LPPEDESTRIAN pPed)
{
int iVar1;
VECTOR v;
@ -1668,7 +1664,7 @@ void DrawTanner(PEDESTRIAN* pPed)
}
// [D] [T]
int DrawCharacter(PEDESTRIAN* pPed)
int DrawCharacter(LPPEDESTRIAN pPed)
{
int fr;
short size;
@ -1804,7 +1800,7 @@ void InitTannerShadow(void)
}
// [D] [T]
void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, CVECTOR* col, short angle)
void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, CVECTOR* col, short angle)
{
DR_ENV* dr_env;
SVECTOR vert[4];
@ -1842,7 +1838,7 @@ void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos,
dr_env = (DR_ENV*)current->primptr;
SetDrawEnv(dr_env, &drEnv);
addPrim(current->ot + 0x107f, dr_env);
addPrim(current->ot + OTSIZE - 1, dr_env);
current->primptr += sizeof(DR_ENV);
Tangle = ratan2(-pLightPos->vx, pLightPos->vz);
@ -1935,7 +1931,7 @@ void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos,
// clear to black and draw Tanner sprites
newShowTanner(pDrawingPed);
addPrim(current->ot + 0x107f, &tileTannerClear[current->id]);
addPrim(current->ot + OTSIZE - 1, &tileTannerClear[current->id]);
// restore vectors
camera_position = cp;
@ -1955,12 +1951,12 @@ void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos,
dr_env = (DR_ENV*)current->primptr;
SetDrawEnv(dr_env, &drEnv);
addPrim(current->ot + 0x107f, dr_env);
addPrim(current->ot + OTSIZE - 1, dr_env);
current->primptr += sizeof(DR_ENV);
}
// [A] - totally custom function but it works pretty much same as original
void DoCivHead(PEDESTRIAN* pPed, SVECTOR* vert1, SVECTOR* vert2)
void DoCivHead(LPPEDESTRIAN pPed, SVECTOR* vert1, SVECTOR* vert2)
{
SVECTOR spos;
VECTOR pos;

View File

@ -16,21 +16,21 @@ extern int ThisMotion;
extern void ProcessMotionLump(char *lump_ptr, int lump_size); // 0x00069A38
extern void SetupPedMotionData(PEDESTRIAN *pPed); // 0x00069AB8
extern void SetupPedestrian(PEDESTRIAN *pedptr); // 0x00069B6C
extern void SetupPedMotionData(LPPEDESTRIAN pPed); // 0x00069AB8
extern void SetupPedestrian(LPPEDESTRIAN pedptr); // 0x00069B6C
extern void StoreVertexLists(); // 0x0006594C
extern void DrawCiv(PEDESTRIAN *pPed); // 0x000670CC
extern void DrawCiv(LPPEDESTRIAN pPed); // 0x000670CC
extern void SetSkelModelPointers(int type); // 0x00069AD8
extern void DrawTanner(PEDESTRIAN *pPed); // 0x000678D0
extern int DrawCharacter(PEDESTRIAN *pPed); // 0x00067D44
extern void DrawTanner(LPPEDESTRIAN pPed); // 0x000678D0
extern int DrawCharacter(LPPEDESTRIAN pPed); // 0x00067D44
extern void InitTannerShadow(); // 0x000681EC
extern void TannerShadow(PEDESTRIAN *pDrawingPed, VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle); // 0x00068358
extern void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle); // 0x00068358
extern void DoCivHead(PEDESTRIAN *pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C
extern void DoCivHead(LPPEDESTRIAN pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C
#endif

View File

@ -32,6 +32,13 @@ struct GARAGE_DOOR
char yang;
};
struct CYCLE_OBJECT
{
char* name;
short vx, vy;
short start1, stop1, speed1;
short start2, stop2, speed2;
};
CYCLE_OBJECT Lev0[2] =
{
@ -410,21 +417,6 @@ void DrawAllAnimatingObjects(CELL_OBJECT** objects, int num_animated)
// [A] optimized
animate_object(cop, aop[model->normals].internal_id);
#if 0
type = model->instance_number == -1 ? type : model->instance_number;
for (j = 0; j < num_anim_objects; j++)
{
if (type == aop->model_num)
{
animate_object(cop, aop->internal_id);
aop -= j;
break;
}
aop++;
}
#endif
}
}

View File

@ -336,7 +336,7 @@ char lineClear(VECTOR *v1, VECTOR *v2)
int xd; // $a0
int zd; // $v1
#ifdef PSX
#if 0 //def PSX
CELL_ITERATOR& ci = *(CELL_ITERATOR*)((u_char*)getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
#else
CELL_ITERATOR ci;

View File

@ -87,7 +87,7 @@ void InitOverlays(void)
{
InitPercentageBar(&Player2DamageBar, MaxPlayerDamage[1], playerDamageColour, G_LTXT(GTXT_Damage));
Player2DamageBar.xpos = gOverlayXPos;
Player2DamageBar.ypos = 140;
Player2DamageBar.ypos = SCREEN_H / 2 + 12;
Player2DamageBar.active = 1;
}
else
@ -555,19 +555,7 @@ void DrawDrivingGameOverlays(void)
break;
case GAME_CHECKPOINT:
if (NumPlayers > 1)
{
x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, 36);
sprintf(string, "%d/5", gPlayerScore.items);
PrintString(string, x + 3, 36);
x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, 150);
sprintf(string, "%d/5", gPlayerScore.P2items);
PrintString(string, x + 3, 150);
}
else
if (NumPlayers == 1)
{
table = &ScoreTables.CheckpointTable[GameLevel][gSubGameNumber][0];
x = PrintStringRightAligned(G_LTXT(GTXT_Checks), gOverlayXOppPos + 70, 16);
@ -578,6 +566,18 @@ void DrawDrivingGameOverlays(void)
x = PrintString(G_LTXT(GTXT_Best), gOverlayXPos, 36);
PrintScoreTableTime(x + 3, 36, table->time);
}
else
{
x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, 36);
sprintf(string, "%d/5", gPlayerScore.items);
PrintString(string, x + 3, 36);
x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, SCREEN_H / 2 + 22);
sprintf(string, "%d/5", gPlayerScore.P2items);
PrintString(string, x + 3, SCREEN_H / 2 + 22);
}
break;
case GAME_GATERACE:
@ -602,10 +602,10 @@ void DrawDrivingGameOverlays(void)
sprintf(string, "%d / %d", gPlayerScore.items, 100);
PrintString(string, x + 3, 36);
x = PrintString(G_LTXT(GTXT_Gate), gOverlayXPos, 150);
x = PrintString(G_LTXT(GTXT_Gate), gOverlayXPos, SCREEN_H / 2 + 22);
sprintf(string, "%d / %d", gPlayerScore.P2items, 100);
PrintString(string, x + 3, 150);
PrintString(string, x + 3, SCREEN_H / 2 + 22);
}
break;
case GAME_TRAILBLAZER:
@ -635,13 +635,12 @@ void DrawDrivingGameOverlays(void)
x = PrintString(G_LTXT(GTXT_Flags), gOverlayXPos, 132);
sprintf(string, "%d", gPlayerScore.P2items);
PrintString(string, x + 3, 132);
PrintString(string, x + 3, SCREEN_H / 2 + 4);
break;
case GAME_SECRET:
y = 36;
i = 0;
do
for (i = 0; i < gNumRaceTrackLaps; i++)
{
sprintf(string, "%s %d:", G_LTXT(GTXT_Lap), i+1);
@ -649,16 +648,14 @@ void DrawDrivingGameOverlays(void)
PrintScoreTableTime(x + 3, y, gLapTimes[0][i]);
y += 16;
i++;
} while (i < gNumRaceTrackLaps);
}
if (NumPlayers > 1)
{
y = 150;
y = SCREEN_H / 2 + 22;
i = 0;
do
for(i = 0; i < gNumRaceTrackLaps; i++)
{
sprintf(string, "%s %d:", G_LTXT(GTXT_Lap), i+1);
@ -666,8 +663,7 @@ void DrawDrivingGameOverlays(void)
PrintScoreTableTime(x + 3, y, gLapTimes[1][i]);
y += 16;
i++;
} while (i < gNumRaceTrackLaps);
}
}
break;
}
@ -679,6 +675,27 @@ void DisplayOverlays(void)
{
short* felony;
#ifndef PSX
if (gWidescreenOverlayAlign)
{
// align to PSX-mapped screen coordinates
RECT16 emuViewport;
PsyX_GetPSXWidescreenMappedViewport(&emuViewport);
// recalc pos
gOverlayXPos = 16 + emuViewport.x;
gOverlayXOppPos = emuViewport.w - 16 - PERCENTAGE_BAR_WIDTH;
gMapXOffset = emuViewport.w - 16 - MAP_SIZE_W;
// set up
PlayerDamageBar.xpos = gOverlayXPos;
Player2DamageBar.xpos = gOverlayXPos;
FelonyBar.xpos = gOverlayXPos;
DamageBar.xpos = gOverlayXOppPos;
ProxyBar.xpos = gOverlayXPos;
}
#endif
if (NoPlayerControl || gInGameCutsceneActive || gInGameCutsceneDelay)
return;
@ -699,27 +716,6 @@ void DisplayOverlays(void)
if (!gDoOverlays)
return;
#ifndef PSX
if (gWidescreenOverlayAlign)
{
// align to PSX-mapped screen coordinates
RECT16 emuViewport;
PsyX_GetPSXWidescreenMappedViewport(&emuViewport);
// recalc pos
gOverlayXPos = 16 + emuViewport.x;
gOverlayXOppPos = emuViewport.w - 16 - PERCENTAGE_BAR_WIDTH;
gMapXOffset = emuViewport.w - 16 - MAP_SIZE_W;
// set up
PlayerDamageBar.xpos = gOverlayXPos;
Player2DamageBar.xpos = gOverlayXPos;
FelonyBar.xpos = gOverlayXPos;
DamageBar.xpos = gOverlayXOppPos;
ProxyBar.xpos = gOverlayXPos;
}
#endif
if(!gInvincibleCar || ActiveCheats.cheat3)
{
DrawPercentageBar(&PlayerDamageBar);

View File

@ -1,6 +1,24 @@
#ifndef OVERLAY_H
#define OVERLAY_H
struct COLOUR_BAND
{
CVECTOR colour;
int value;
int flags;
};
typedef struct _PERCENTAGE_BAR
{
char* tag;
short xpos, ypos;
short width, height;
u_short position;
u_short max;
COLOUR_BAND* pColourBand;
int flags, active;
} PERCENTAGE_BAR, * LPPERCENTAGE_BAR;
extern PERCENTAGE_BAR PlayerDamageBar;
extern PERCENTAGE_BAR Player2DamageBar;
extern PERCENTAGE_BAR DamageBar;

View File

@ -17,6 +17,20 @@
#include "pad.h"
#include "ASM/rnc_2.h"
struct MAPTEX
{
short u, w, v, h;
};
struct OVERMAP
{
int x_offset, y_offset;
int width, height;
u_char toptile;
u_char dummy;
int scale;
};
OVERMAP overlaidmaps[4] =
{
{ 197, 318, 384, 672, 252, 0x99, 2145 },
@ -101,8 +115,8 @@ void DrawTargetBlip(VECTOR *pos, u_char r, u_char g, u_char b, int flags)
{
WorldToMultiplayerMap(pos, &vec);
vec.vx += gMapXOffset;
vec.vz += 96;
vec.vx += map_minX;
vec.vz += map_minY;
}
else if (flags & 0x8)
{
@ -286,7 +300,7 @@ void DrawPlayerDot(VECTOR *pos, short rot, u_char r, u_char g, u_char b, int fla
WorldToMultiplayerMap(pos, &vec);
vec.vx += gMapXOffset;
vec.vz += 96;
vec.vz += gMapYOffset;
}
else
{
@ -682,9 +696,13 @@ void DrawBigCompass(VECTOR *root, int angle)
// [D] [T]
void CopIndicator(int xpos, int strength)
{
int startH, endH;
int str2;
POLY_F3 *poly;
startH = SCREEN_H;
endH = SCREEN_H - 30;
if (strength > 255)
strength = 255;
@ -700,11 +718,11 @@ void CopIndicator(int xpos, int strength)
poly->g0 = str2;
poly->b0 = str2;
poly->x0 = xpos - 12;
poly->y0 = 256;
poly->y0 = startH;
poly->x1 = xpos;
poly->y1 = 226;
poly->y1 = endH;
poly->x2 = xpos + 12;
poly->y2 = 256;
poly->y2 = startH;
addPrim(current->ot + 1, poly);
current->primptr += sizeof(POLY_F3);
@ -723,10 +741,10 @@ void CopIndicator(int xpos, int strength)
poly->b0 = str2;
poly->x0 = xpos - 12;
poly->y0 = 256;
poly->y1 = 226;
poly->y0 = startH;
poly->y1 = endH;
poly->x2 = xpos + 12;
poly->y2 = 256;
poly->y2 = startH;
poly->x1 = xpos;
addPrim(current->ot + 1, poly);
@ -890,14 +908,13 @@ void InitMultiplayerMap(void)
// [D] [T]
void InitOverheadMap(void)
{
int d;
int c;
int c, d;
int tpage;
if (NumPlayers > 1)
gMapYOffset = 96;
gMapYOffset = (SCREEN_H - MAP_SIZE_H) / 2 - 2;
else
gMapYOffset = 181;
gMapYOffset = SCREEN_H - MAP_SIZE_H - 15;
if (gMultiplayerLevels)
{
@ -977,26 +994,25 @@ void DrawMultiplayerMap(void)
int i;
u_char g;
u_char r;
int yPos;
int xPos, yPos;
VECTOR target;
int px, py;
map_x_offset = 0;
map_z_offset = 0;
if (NumPlayers == 1)
yPos = gMapYOffset;
else
yPos = 96;
xPos = gMapXOffset;
yPos = gMapYOffset;
DrawMultiplayerTargets();
pl = player;
r = 255;
g = 0;
i = 0;
do {
for (i = 0; i < NumPlayers; i++)
{
pl = &player[i];
target.vx = pl->pos[0];
target.vz = pl->pos[2];
@ -1004,18 +1020,14 @@ void DrawMultiplayerMap(void)
WorldToMultiplayerMap(&target, &target);
target.vx += gMapXOffset;
target.vx += xPos;
target.vz += yPos;
DrawPlayerDot(&target, -pl->dir, r, g, 0, 0x8);
pl++;
r++;
g--;
i++;
} while (i < NumPlayers);
}
draw_box(yPos, 64);
@ -1024,12 +1036,12 @@ void DrawMultiplayerMap(void)
setPolyFT4(poly);
setSemiTrans(poly, 1);
poly->x0 = gMapXOffset;
poly->x0 = xPos;
poly->y0 = yPos;
poly->x1 = gMapXOffset + MAP_SIZE_W;
poly->x1 = xPos + MAP_SIZE_W;
poly->y1 = yPos;
poly->x2 = gMapXOffset;
poly->x3 = gMapXOffset + MAP_SIZE_W;
poly->x2 = xPos;
poly->x3 = xPos + MAP_SIZE_W;
poly->y2 = yPos + 64;
poly->y3 = yPos + 64;
@ -1346,7 +1358,7 @@ void DrawOverheadMap(void)
th = MapTex[i].h - 1;
#ifndef PSX
// make map fully detailed when filtering is not available
if (!g_bilinearFiltering)
if (!g_cfg_bilinearFiltering)
{
tw += 1;
th += 1;
@ -1503,7 +1515,7 @@ void DrawFullscreenMap(void)
#ifndef PSX
/* It will look funny when enabled
// make map fully detailed when filtering is not available
if (!g_bilinearFiltering)
if (!g_cfg_bilinearFiltering)
{
tw += 1;
th += 1;
@ -1799,7 +1811,7 @@ void DrawFullscreenMap(void)
// print string with special characters representing some images inserted into it
sprintf(str, "\x80 %s \x81 %s \x8a %s", G_LTXT(GTXT_Exit), G_LTXT(GTXT_Rotation), G_LTXT(GTXT_Move));
PrintStringCentred(str, 226);
PrintStringCentred(str, SCREEN_H - 30); // 226
}
// [D] [T]

View File

@ -74,7 +74,7 @@ void InitControllers(void)
for (j = 0; j < 16; j++)
{
pad->mappings.button_lookup[j] = 1 << (j & 0x1f);
pad->mappings.button_lookup[j] = 1 << j;
}
pad->mappings.swap_analog = 0;
@ -186,36 +186,36 @@ void MapPad(int pad, PADRAW *pData)
Pads[pad].diranalog[2] = pData->analog[2] - 128;
Pads[pad].diranalog[3] = pData->analog[3] - 128;
if (Pads[pad].active)
if (!Pads[pad].active)
return;
mapped = 0;
for (i = 0; i < 16; i++)
{
mapped = 0;
for (i = 0; i < 16; i++)
if (((buttons >> i) & 1) != 0)
{
if (((buttons >> i) & 1) != 0)
{
mapped |= Pads[pad].mappings.button_lookup[i];
}
mapped |= Pads[pad].mappings.button_lookup[i];
}
}
Pads[pad].mapnew = mapped & ~Pads[pad].mapped;
Pads[pad].mapped = mapped;
Pads[pad].mapnew = mapped & ~Pads[pad].mapped;
Pads[pad].mapped = mapped;
if (Pads[pad].mappings.swap_analog == 0)
{
Pads[pad].mapanalog[1] = Pads[pad].diranalog[1];
Pads[pad].mapanalog[2] = Pads[pad].diranalog[2];
Pads[pad].mapanalog[3] = Pads[pad].diranalog[3];
Pads[pad].mapanalog[0] = Pads[pad].diranalog[0];
}
else
{
Pads[pad].mapanalog[1] = Pads[pad].diranalog[3];
Pads[pad].mapanalog[2] = Pads[pad].diranalog[0];
Pads[pad].mapanalog[3] = Pads[pad].diranalog[1];
Pads[pad].mapanalog[0] = Pads[pad].diranalog[2];
}
if (Pads[pad].mappings.swap_analog == 0)
{
Pads[pad].mapanalog[1] = Pads[pad].diranalog[1];
Pads[pad].mapanalog[2] = Pads[pad].diranalog[2];
Pads[pad].mapanalog[3] = Pads[pad].diranalog[3];
Pads[pad].mapanalog[0] = Pads[pad].diranalog[0];
}
else
{
Pads[pad].mapanalog[1] = Pads[pad].diranalog[3];
Pads[pad].mapanalog[2] = Pads[pad].diranalog[0];
Pads[pad].mapanalog[3] = Pads[pad].diranalog[1];
Pads[pad].mapanalog[0] = Pads[pad].diranalog[2];
}
}

View File

@ -3,43 +3,104 @@
#define PADBUFFER_SIZE 34
// mapped pad identifiers
#define MPAD_L2 0x1
#define MPAD_R2 0x2
#define MPAD_L1 0x4
#define MPAD_R1 0x8
#define MPAD_TRIANGLE 0x10
#define MPAD_CIRCLE 0x20
#define MPAD_CROSS 0x40
#define MPAD_SQUARE 0x80
#define MPAD_SELECT 0x100
#define MPAD_L3 0x200
#define MPAD_R3 0x400
#define MPAD_START 0x800
#define MPAD_D_UP 0x1000
#define MPAD_D_RIGHT 0x2000
#define MPAD_D_DOWN 0x4000
#define MPAD_D_LEFT 0x8000
enum ECameraPad
{
CAMERA_PAD_LOOK_LEFT = 0x1,
CAMERA_PAD_LOOK_RIGHT = 0x2,
CAMERA_PAD_LOOK_LEFT = MPAD_L2,
CAMERA_PAD_LOOK_RIGHT = MPAD_R2,
CAMERA_PAD_LOOK_BACK = CAMERA_PAD_LOOK_LEFT | CAMERA_PAD_LOOK_RIGHT,
CAMERA_PAD_LOOK_BACK_DED = 0x200
CAMERA_PAD_LOOK_BACK = MPAD_L2 | MPAD_R2,
CAMERA_PAD_LOOK_BACK_DED = MPAD_L3
};
enum ETannerPad
{
TANNER_PAD_ACTION = 0x10,
TANNER_PAD_POWER = 0x20,
TANNER_PAD_GOFORWARD = 0x40 | 0x1000,
TANNER_PAD_GOBACK = 0x80 | 0x4000,
TANNER_PAD_TURNLEFT = 0x8000,
TANNER_PAD_TURNRIGHT = 0x2000,
TANNER_PAD_ACTION = MPAD_TRIANGLE,
TANNER_PAD_POWER = MPAD_CIRCLE,
TANNER_PAD_GOFORWARD = MPAD_CROSS | MPAD_D_UP,
TANNER_PAD_GOBACK = MPAD_SQUARE | MPAD_D_DOWN,
TANNER_PAD_TURNLEFT = MPAD_D_LEFT,
TANNER_PAD_TURNRIGHT = MPAD_D_RIGHT,
TANNER_PAD_ACTION_DED = 0x400, // R3 mapped for car entrance
TANNER_PAD_ACTION_DED = MPAD_R3, // R3 mapped for car entrance
};
enum ECarPads
{
CAR_PAD_FASTSTEER = 0x4,
CAR_PAD_HANDBRAKE = 0x10,
CAR_PAD_WHEELSPIN = 0x20,
CAR_PAD_ACCEL = 0x40,
CAR_PAD_BRAKE = 0x80,
CAR_PAD_UP = 0x1000,
CAR_PAD_LEFT = 0x8000,
CAR_PAD_RIGHT = 0x2000,
CAR_PAD_FASTSTEER = MPAD_L1,
CAR_PAD_HANDBRAKE = MPAD_TRIANGLE,
CAR_PAD_WHEELSPIN = MPAD_CIRCLE,
CAR_PAD_ACCEL = MPAD_CROSS,
CAR_PAD_BRAKE = MPAD_SQUARE,
CAR_PAD_UP = MPAD_D_UP,
CAR_PAD_LEFT = MPAD_D_LEFT,
CAR_PAD_RIGHT = MPAD_D_RIGHT,
CAR_PAD_LEAVECAR_DED = 0x400, // R3 mapped
CAR_PAD_LEAVECAR_DED = MPAD_R3, // R3 mapped
CAR_PAD_LEAVECAR = (CAR_PAD_UP | CAR_PAD_HANDBRAKE), // fixme: combinations?
CAR_PAD_LEAVECAR = (MPAD_D_UP | MPAD_TRIANGLE),
};
struct DUPLICATION
{
char* buffer;
int size;
};
typedef struct MAPPING
{
u_short button_lookup[16];
u_short swap_analog;
u_short reserved1;
} *LPMAPPING;
typedef struct PAD
{
u_char active;
u_char type;
u_char dualshock;
u_char reserved1;
u_short direct;
u_short dirnew;
char diranalog[4];
u_short mapped;
u_short mapnew;
char mapanalog[4];
MAPPING mappings;
u_char alarmShakeCounter;
u_char asd;
u_char sdf;
u_char dfg;
u_char delay;
u_char port;
u_char state;
u_char dsactive;
u_char* shakeptr;
u_char motors[2];
u_char shake_type;
u_char vibrate;
} *LPPAD;
extern int pad_connected;
extern int numPadsConnected;
extern int gVibration;

View File

@ -514,9 +514,12 @@ void setDistance(tNode* n, ushort dist)
{
n->dist = dist | 1; // valid bit for this frame
distanceCache[(n->vx >> 2 & 0x3f80U | n->vz >> 9 & 0x7fU) ^ (n->vy & 1U) * 0x2040 ^ (n->vy & 2U) << 0xc] = dist | 1;
DISTMAP_V(n->vx, n->vy, n->vz) = dist | 1;
}
// [A]
void SetNodeDistanceWithParents(tNode* startNode, ushort dist);
// [D] [T]
void iterate(void)
{
@ -626,29 +629,7 @@ void iterate(void)
}
}
dist &= 0xffff;
// store distance and get to the next lesser node
if (numHeapEntries != 198)
{
setDistance(&pathNodes[dir + 1], dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = pathNodes[dir + 1];
numHeapEntries++;
}
SetNodeDistanceWithParents(&pathNodes[dir + 1], dist);
}
}
@ -683,13 +664,10 @@ extern int sdLevel; // D2ROADS
// [D] [T]
int getInterpolatedDistance(VECTOR* pos)
{
int res;
int x;
int dist;
int min;
int x, res;
int dist, min;
int a,b,c;
int fx;
int fz;
int fx, fz;
tNode n;
VECTOR sp;
@ -700,8 +678,8 @@ int getInterpolatedDistance(VECTOR* pos)
if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0)
{
res = MapHeight((VECTOR*)&n);
n.vy = res ^ (res ^ sdLevel) & 3;
n.vy = MapHeight((VECTOR*)&n);
n.vy = n.vy ^ (n.vy ^ sdLevel) & 3;
}
else
{
@ -714,7 +692,7 @@ int getInterpolatedDistance(VECTOR* pos)
sp.vx = n.vx + 256;
sp.vz = n.vz + 512;
n.dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (n.vy & 1U) * 0x2040 ^ (n.vy & 2U) << 0xc];
n.dist = DISTMAP_V(n.vx, n.vy, n.vz);
a = n.dist;
n.vx = sp.vx;
@ -722,15 +700,15 @@ int getInterpolatedDistance(VECTOR* pos)
if (OMAP_GETVALUE(sp.vx >> 8, sp.vz >> 8) != 0)
{
res = MapHeight((VECTOR*)&n);
n.vy = res ^ (res ^ sdLevel) & 3;
n.vy = MapHeight((VECTOR*)&n);
n.vy = n.vy ^ (n.vy ^ sdLevel) & 3;
}
else
{
n.vy = 0;
}
n.dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (n.vy & 1U) * 0x2040 ^ (n.vy & 2U) << 0xc];
n.dist = DISTMAP_V(n.vx, n.vy, n.vz);
b = n.dist;
if (a < b)
@ -745,15 +723,15 @@ int getInterpolatedDistance(VECTOR* pos)
if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0)
{
res = MapHeight((VECTOR*)&n);
res = res ^ (res ^ sdLevel) & 3;
n.vy = MapHeight((VECTOR*)&n);
n.vy = n.vy ^ (n.vy ^ sdLevel) & 3;
}
else
{
res = 0;
n.vy = 0;
}
dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (res & 1) * 0x2040 ^ (res & 2) << 0xc];
dist = DISTMAP_V(n.vx, n.vy, n.vz);
if (min < dist)
c = min;
@ -788,15 +766,15 @@ int getInterpolatedDistance(VECTOR* pos)
if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0)
{
res = MapHeight((VECTOR*)&n);
res = res ^ (res ^ sdLevel) & 3;
n.vy = MapHeight((VECTOR*)&n);
n.vy = n.vy ^ (n.vy ^ sdLevel) & 3;
}
else
{
res = 0;
n.vy = 0;
}
dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (res & 1) * 0x2040 ^ (res & 2) << 0xc];
dist = DISTMAP_V(n.vx, n.vy, n.vz);
if (min < dist)
c = min;
@ -876,17 +854,58 @@ void addCivs(void)
} while (cp < &car_data[MAX_CARS - 1]);
}
// [A]
void SetNodeDistanceWithParents(tNode* startNode, ushort dist)
{
int i;
u_int pnode, parent;
if (numHeapEntries == 198)
return;
setDistance(startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = *startNode;
numHeapEntries++;
}
// [A]
void ComputeDistanceFromSearchTarget(tNode* startNode)
{
u_short dist;
int i, dx, dz;
if (numHeapEntries == 198)
return;
dx = startNode->vx - searchTarget.vx;
dz = startNode->vz - searchTarget.vz;
dist = SquareRoot0( dx * dx + dz * dz ) >> 1;
SetNodeDistanceWithParents(startNode, dist);
}
// [D] [T]
void UpdateCopMap(void)
{
int d;
int dist;
int i, d;
int dx, dy, dz;
int i, maxret;
int res;
int maxret, res;
tNode startNode;
u_int pnode;
u_int parent;
BloodyHell();
@ -941,7 +960,7 @@ void UpdateCopMap(void)
searchTarget.vy = cp->hd.where.t[1] + FIXEDH(cp->st.n.linearVelocity[1]) * 4;
searchTarget.vz = cp->hd.where.t[2] + FIXEDH(cp->st.n.linearVelocity[2]) * 8;
}
else if (searchTarget.vy == -0x304f)
else if (searchTarget.vy == -12367)
{
searchTarget.vx = player[0].pos[0];
searchTarget.vy = player[0].pos[1];
@ -984,168 +1003,30 @@ void UpdateCopMap(void)
if (dz < dx + dz / 2)
{
dx = startNode.vx - searchTarget.vx;
dz = startNode.vz - searchTarget.vz;
dist = SquareRoot0(dx * dx + (dz) * (dz));
dist = dist / 2 & 0xffff;
if (numHeapEntries != 198)
{
setDistance(&startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = startNode;
numHeapEntries++;
}
ComputeDistanceFromSearchTarget(&startNode);
startNode.vx += 256;
startNode.vz += 512;
dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz));
dist = dist / 2 & 0xffff;
if (numHeapEntries != 198)
{
setDistance(&startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = startNode;
numHeapEntries++;
}
ComputeDistanceFromSearchTarget(&startNode);
startNode.vx += 256;
startNode.vz -= 512;
dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz));
dist = dist / 2 & 0xffff;
if (numHeapEntries != 198)
{
setDistance(&startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = startNode;
numHeapEntries++;
}
ComputeDistanceFromSearchTarget(&startNode);
}
else
{
dx = startNode.vx - searchTarget.vx;
dz = startNode.vz - searchTarget.vz;
dist = SquareRoot0(dx * dx + dz * dz);
dist = dist / 2 & 0xffff;
if (numHeapEntries != 198)
{
setDistance(&startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = startNode;
numHeapEntries++;
}
ComputeDistanceFromSearchTarget(&startNode);
startNode.vx += 256;
startNode.vz += 512;
dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz));
dist = dist / 2 & 0xffff;
if (numHeapEntries != 198)
{
setDistance(&startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = startNode;
numHeapEntries++;
}
ComputeDistanceFromSearchTarget(&startNode);
startNode.vx -= 512;
dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz));
dist = dist / 2 & 0xffff;
if (numHeapEntries != 198)
{
setDistance(&startNode, dist);
i = numHeapEntries + 1;
pnode = i;
parent = i >> 1;
while (parent != 0 && dist < heap[parent].dist)
{
heap[i] = heap[parent];
pnode = parent;
parent >>= 1;
}
heap[pnode] = startNode;
numHeapEntries++;
}
ComputeDistanceFromSearchTarget(&startNode);
}
}

View File

@ -43,6 +43,29 @@ struct MENU_MESSAGE
int show;
} gDisplayedMessage = { NULL, NULL, 0 };
typedef void(*pauseFunc)(int dir);
struct MENU_ITEM;
struct MENU_HEADER;
struct MENU_ITEM
{
char* Text;
u_char Type;
u_char Justify;
pauseFunc func;
EXIT_VALUE ExitValue;
MENU_HEADER* SubMenu;
};
struct MENU_HEADER
{
char* Title;
XYWH Bound;
u_char NumItems;
MENU_ITEM* MenuItems;
};
static MENU_ITEM* ActiveItem[PAUSE_MENU_LEVELS];
static MENU_HEADER* VisibleMenus[PAUSE_MENU_LEVELS];
static MENU_HEADER* ActiveMenu;
@ -497,7 +520,7 @@ char* WaitForTextEntry(char* textBufPtr, int maxLength)
#if !USE_PAD_INPUT
// PsyX input handler
gameOnTextInput = ScoreNameInputHandler;
g_cfg_gameOnTextInput = ScoreNameInputHandler;
gCurrentTextChar = 0;
#endif
@ -667,7 +690,7 @@ char* WaitForTextEntry(char* textBufPtr, int maxLength)
} while (true);
#if !USE_PAD_INPUT
gameOnTextInput = NULL;
g_cfg_gameOnTextInput = NULL;
#endif
return username;
@ -831,7 +854,7 @@ void SetupMenu(MENU_HEADER *menu, int back)
ActiveMenu->Bound.x = ((304 - len) / 2) - 4;
ActiveMenu->Bound.w = len + 24;
ActiveMenu->Bound.y = MAX(48, ((numItems + 1) * -15 + 256) / 2);
ActiveMenu->Bound.y = MAX(48, (SCREEN_H - (numItems + 1) * 15) / 2);
ActiveMenu->Bound.h = (numItems + 1) * 15 + 10;
ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem];
@ -1178,7 +1201,7 @@ void ControlMenu(void)
// toggle map off
if (gShowMap)
{
if (paddata & 0x50)
if (paddata & (MPAD_CROSS | MPAD_TRIANGLE))
PauseMap(0);
return;
@ -1219,13 +1242,13 @@ void ControlMenu(void)
#ifndef PSX
// Pause fix for PC mapping
if ((paddata & 0x10) && paddata & (0x1000 | 0x4000))
if ((paddata & MPAD_TRIANGLE) && paddata & (MPAD_D_UP | MPAD_D_DOWN))
{
paddata = 0;
}
#endif
if (paddata & 0x1000)
if (paddata & MPAD_D_UP)
{
// go up
ActiveMenuItem--;
@ -1235,7 +1258,7 @@ void ControlMenu(void)
ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem];
}
else if (paddata & 0x4000)
else if (paddata & MPAD_D_DOWN)
{
// go down
ActiveMenuItem++;
@ -1245,7 +1268,7 @@ void ControlMenu(void)
ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem];
}
else if (paddata & 0x40)
else if (paddata & MPAD_CROSS)
{
// Enter submenu
if (pItem->Type & PAUSE_TYPE_SUBMENU)
@ -1274,7 +1297,7 @@ void ControlMenu(void)
else
PauseReturnValue = pItem->ExitValue;
}
else if ((paddata & 0x10) || (paddata & 0x800)) // Triangle or Start
else if ((paddata & MPAD_TRIANGLE) || (paddata & MPAD_START)) // Triangle or Start
{
// continue game if needed
@ -1282,7 +1305,7 @@ void ControlMenu(void)
{
#ifndef PSX
// hack for keyboard swap
if(!(paddata & 0x800))
if(!(paddata & MPAD_START))
return;
#endif
for (i = 0; i < ActiveMenu->NumItems; i++)

View File

@ -1,6 +1,18 @@
#ifndef PAUSE_H
#define PAUSE_H
enum EXIT_VALUE
{
MENU_QUIT_NONE = 0,
MENU_QUIT_CONTINUE = 1,
MENU_QUIT_QUIT = 2,
MENU_QUIT_RESTART = 3,
MENU_QUIT_DIRECTOR = 4,
MENU_QUIT_QUICKREPLAY = 5,
MENU_QUIT_BACKMENU = 6,
MENU_QUIT_NEXTMISSION = 7,
};
extern int gShowMap;
extern int gDrawPauseMenus;
extern int pauseflag;

View File

@ -27,23 +27,38 @@
#include "ASM/rndrasm.h"
struct CAR_COLLISION_BOX
{
int min_x, max_x;
int min_z, max_z;
};
typedef struct SEATED_PEDESTRIANS
{
int x;
int z;
short rotation;
char index;
char pad;
} *SEATEDPTR;
MODEL* pmTannerModels[17] = { 0 };
MODEL* pmJerichoModels[6] = { 0 };
void PedDoNothing(PEDESTRIAN* pPed);
void PedUserWalker(PEDESTRIAN* pPed);
void PedUserRunner(PEDESTRIAN* pPed);
void PedGetInCar(PEDESTRIAN* pPed);
void PedGetOutCar(PEDESTRIAN* pPed);
void PedCarryOutAnimation(PEDESTRIAN* pPed);
void CivPedDoNothing(PEDESTRIAN* pPed);
void CivPedWalk(PEDESTRIAN* pPed);
void CivPedSit(PEDESTRIAN* pPed);
void CivPedJump(PEDESTRIAN* pPed);
void PedPressButton(PEDESTRIAN* pPed);
void TannerSitDown(PEDESTRIAN* pPed);
void CopStand(PEDESTRIAN* pPed);
void CivGetIn(PEDESTRIAN* pPed);
void PedDoNothing(LPPEDESTRIAN pPed);
void PedUserWalker(LPPEDESTRIAN pPed);
void PedUserRunner(LPPEDESTRIAN pPed);
void PedGetInCar(LPPEDESTRIAN pPed);
void PedGetOutCar(LPPEDESTRIAN pPed);
void PedCarryOutAnimation(LPPEDESTRIAN pPed);
void CivPedDoNothing(LPPEDESTRIAN pPed);
void CivPedWalk(LPPEDESTRIAN pPed);
void CivPedSit(LPPEDESTRIAN pPed);
void CivPedJump(LPPEDESTRIAN pPed);
void PedPressButton(LPPEDESTRIAN pPed);
void TannerSitDown(LPPEDESTRIAN pPed);
void CopStand(LPPEDESTRIAN pPed);
void CivGetIn(LPPEDESTRIAN pPed);
pedFunc fpPedPersonalityFunctions[] = {
PedDoNothing,
@ -72,7 +87,7 @@ const int tannerTurnStep = 4;
int bKillTanner = 0;
SEATED_PEDESTRIANS* seated_pedestrian; // lump
SEATEDPTR seated_pedestrian; // lump
int seated_count;
int maxSeated;
static int numTannerPeds = 0;
@ -81,9 +96,9 @@ int pinginPedAngle = 0;
PEDESTRIAN pedestrians[MAX_PEDESTRIANS];
PEDESTRIAN* pUsedPeds = NULL; // linked list of pedestrians
PEDESTRIAN* pFreePeds = NULL;
PEDESTRIAN* pHold = NULL;
LPPEDESTRIAN pUsedPeds = NULL; // linked list of pedestrians
LPPEDESTRIAN pFreePeds = NULL;
LPPEDESTRIAN pHold = NULL;
int max_pedestrians;
int num_pedestrians;
@ -103,6 +118,11 @@ int bPower = 0;
int oldWeather = 0;
int powerCounter = 0;
extern int CheckForPlayerCar(LPPEDESTRIAN pedestrian, CAR_COLLISION_BOX* collision_box); // 0x000732C0
extern SEATEDPTR FindSeated(); // 0x00072644
extern SEATEDPTR FindTannerASeat(LPPEDESTRIAN pPed); // 0x000717AC
extern void add_seated(SEATEDPTR seatedptr, int seat_index); // 0x000718C8
// [D] [T]
void InitTanner(void)
{
@ -142,7 +162,7 @@ void InitTanner(void)
// [D] [T]
void SetTannerPosition(VECTOR* pVec)
{
PEDESTRIAN* pPed;
LPPEDESTRIAN pPed;
pPed = pUsedPeds;
while (pPed)
@ -166,18 +186,18 @@ void SetTannerPosition(VECTOR* pVec)
void InitPedestrians(void)
{
int loop;
SEATED_PEDESTRIANS* seatedptr;
SEATEDPTR seatedptr;
memset((u_char*)pedestrians, 0, sizeof(pedestrians));
DestroyPedestrians();
PEDESTRIAN* lastPed = &pedestrians[0];
LPPEDESTRIAN lastPed = &pedestrians[0];
lastPed->pPrev = NULL;
for (loop = 1; loop < MAX_PEDESTRIANS; loop++)
{
PEDESTRIAN* currPed = &pedestrians[loop];
LPPEDESTRIAN currPed = &pedestrians[loop];
lastPed->pNext = currPed;
currPed->pPrev = lastPed++;
@ -205,7 +225,6 @@ void InitPedestrians(void)
maxSeated = seated_count;
numTannerPeds = 0;
pinginPedAngle = 0;
pPlayerPed = NULL;
seated_count = 0;
ping_in_pedestrians = 1;
numCopPeds = 0;
@ -228,8 +247,8 @@ void DestroyPedestrians(void)
// [D] [T]
void DestroyCivPedestrians(void)
{
PEDESTRIAN* pPed;
PEDESTRIAN* pHPed;
LPPEDESTRIAN pPed;
LPPEDESTRIAN pHPed;
pPed = pUsedPeds;
while (pPed != NULL)
@ -248,7 +267,7 @@ void DestroyCivPedestrians(void)
// [D] [T]
void DestroyPedestrian(PEDESTRIAN* pPed)
void DestroyPedestrian(LPPEDESTRIAN pPed)
{
if (pPed->flags & 8)
numCopPeds--; // or road block pedestrians
@ -307,9 +326,9 @@ int PedSurfaceType(VECTOR* ped_pos)
}
// [D] [T]
PEDESTRIAN* CreatePedestrian(void)
LPPEDESTRIAN CreatePedestrian(void)
{
PEDESTRIAN* pNewPed;
LPPEDESTRIAN pNewPed;
pNewPed = pFreePeds;
if (pFreePeds != NULL)
@ -401,7 +420,7 @@ void PlaceRoadBlockCops(void)
// [D] [T]
int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType)
{
PEDESTRIAN* pPed;
LPPEDESTRIAN pPed;
if (num_pedestrians >= MAX_PLACED_PEDS)
return 0;
@ -457,7 +476,7 @@ int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType)
// [D] [T]
void DrawAllPedestrians(void)
{
PEDESTRIAN* pPed;
LPPEDESTRIAN pPed;
pPed = pUsedPeds;
while (pPed != NULL)
@ -505,7 +524,7 @@ void DrawAllPedestrians(void)
// [D] [T]
int TannerActionHappening(void)
{
PEDESTRIAN* pPed = player[0].pPed;
LPPEDESTRIAN pPed = player[0].pPed;
if (pPed && pPed->type == PED_ACTION_PRESSBUTTON)
return pPed->frame1 == 14;
@ -520,8 +539,8 @@ int bAvoidBomb = -1;
void ControlPedestrians(void)
{
CAR_DATA* pCar;
PEDESTRIAN* pPed;
PEDESTRIAN* pPedNext;
LPPEDESTRIAN pPed;
LPPEDESTRIAN pPedNext;
pPed = pUsedPeds;
@ -584,7 +603,7 @@ void ControlPedestrians(void)
// [D] [T]
void AnimatePed(PEDESTRIAN* pPed)
void AnimatePed(LPPEDESTRIAN pPed)
{
int dir;
VECTOR vec;
@ -648,10 +667,13 @@ void AnimatePed(PEDESTRIAN* pPed)
if ((pPed->pedType == TANNER_MODEL || (ActiveCheats.cheat12 && pPed->pedType == OTHER_MODEL)) && pPed->type < PED_ACTION_BACK)
{
int surfId;
surfId = PedSurfaceType((VECTOR*)&pPed->position);
surfId = PedSurfaceType(&vec);
// play footstep sounds
if (surfId != 4 && surfId != 6 && surfId != 11 && surfId != 9)
if (surfId != SURF_GRASS &&
surfId != SURF_WATER &&
surfId != SURF_SAND &&
surfId != SURF_DEEPWATER)
{
if (pPed->frame1 == 3)
Start3DSoundVolPitch(-1, SOUND_BANK_TANNER, 0, pPed->position.vx, -pPed->position.vy, pPed->position.vz, -5000, 0x1000);
@ -674,7 +696,7 @@ void AnimatePed(PEDESTRIAN* pPed)
// [D] [T]
void SetupDoNowt(PEDESTRIAN* pPed)
void SetupDoNowt(LPPEDESTRIAN pPed)
{
pPed->speed = 0;
pPed->dir.vz = 0;
@ -686,7 +708,7 @@ void SetupDoNowt(PEDESTRIAN* pPed)
}
// [D] [T]
void SetupWalker(PEDESTRIAN* pPed)
void SetupWalker(LPPEDESTRIAN pPed)
{
pPed->type = PED_ACTION_WALK;
pPed->speed = 14;
@ -696,7 +718,7 @@ void SetupWalker(PEDESTRIAN* pPed)
}
// [D] [T]
void SetupRunner(PEDESTRIAN* pPed)
void SetupRunner(LPPEDESTRIAN pPed)
{
pPed->type = PED_ACTION_RUN;
pPed->frame1 = 0;
@ -707,7 +729,7 @@ void SetupRunner(PEDESTRIAN* pPed)
}
// [D] [T]
void SetupBack(PEDESTRIAN* pPed)
void SetupBack(LPPEDESTRIAN pPed)
{
pPed->type = PED_ACTION_WALK;
pPed->frame1 = 0;
@ -720,7 +742,7 @@ void SetupBack(PEDESTRIAN* pPed)
CAR_DATA* pCivCarToGetIn = NULL;
// [D] [T]
void CivGetIn(PEDESTRIAN* pPed) // [A] UNUSED
void CivGetIn(LPPEDESTRIAN pPed) // [A] UNUSED
{
u_int padid;
DRIVER2_CURVE* curve;
@ -742,7 +764,7 @@ void CivGetIn(PEDESTRIAN* pPed) // [A] UNUSED
}
// [D] [T]
void CopStand(PEDESTRIAN* pPed)
void CopStand(LPPEDESTRIAN pPed)
{
VECTOR v;
v.vx = pPed->position.vx - player[0].pos[0];
@ -755,7 +777,7 @@ void CopStand(PEDESTRIAN* pPed)
int iAllowWatch = 0;
// [D] [T]
void PedDoNothing(PEDESTRIAN* pPed)
void PedDoNothing(LPPEDESTRIAN pPed)
{
pPed->speed = 0;
@ -869,7 +891,7 @@ void PedDoNothing(PEDESTRIAN* pPed)
}
// [D] [T]
void PedUserRunner(PEDESTRIAN* pPed)
void PedUserRunner(LPPEDESTRIAN pPed)
{
if ((pPed->flags & 0x10U) == 0)
{
@ -947,7 +969,7 @@ void PedUserRunner(PEDESTRIAN* pPed)
}
// [D] [T]
void PedUserWalker(PEDESTRIAN* pPed)
void PedUserWalker(LPPEDESTRIAN pPed)
{
if ((pPed->flags & 0x10) == 0)
{
@ -987,7 +1009,7 @@ int bFreezeAnimation = 0;
int allreadydone = 0;
// [D] [T]
void PedCarryOutAnimation(PEDESTRIAN* pPed)
void PedCarryOutAnimation(LPPEDESTRIAN pPed)
{
pPed->speed = 0;
@ -1051,7 +1073,7 @@ CAR_DATA* carToGetIn;
int bReverseYRotation = 0;
// [D] [T]
void PedGetOutCar(PEDESTRIAN* pPed)
void PedGetOutCar(LPPEDESTRIAN pPed)
{
int playerId;
@ -1081,7 +1103,7 @@ void PedGetOutCar(PEDESTRIAN* pPed)
int lastCarCameraView = 0;
// [D] [T]
void SetupGetOutCar(PEDESTRIAN* pPed, CAR_DATA* pCar, int side)
void SetupGetOutCar(LPPEDESTRIAN pPed, CAR_DATA* pCar, int side)
{
bool entrySide;
int sn, cs;
@ -1128,7 +1150,7 @@ void SetupGetOutCar(PEDESTRIAN* pPed, CAR_DATA* pCar, int side)
// [D] [T]
void SetupGetInCar(PEDESTRIAN* pPed)
void SetupGetInCar(LPPEDESTRIAN pPed)
{
int sn, cs;
int carDir;
@ -1191,7 +1213,7 @@ void SetupGetInCar(PEDESTRIAN* pPed)
}
// [D] [T]
void PedGetInCar(PEDESTRIAN* pPed)
void PedGetInCar(LPPEDESTRIAN pPed)
{
int playerID;
@ -1213,13 +1235,12 @@ void PedGetInCar(PEDESTRIAN* pPed)
ChangePedPlayerToCar(playerID, carToGetIn);
DestroyPedestrian(pPed);
pPlayerPed = NULL;
numTannerPeds--;
}
}
// [D] [T]
void SetupPressButton(PEDESTRIAN* pPed)
void SetupPressButton(LPPEDESTRIAN pPed)
{
pPed->type = PED_ACTION_PRESSBUTTON;
SetupPedMotionData(pPed);
@ -1231,7 +1252,7 @@ void SetupPressButton(PEDESTRIAN* pPed)
}
// [D] [T]
void PedPressButton(PEDESTRIAN* pPed)
void PedPressButton(LPPEDESTRIAN pPed)
{
if (pPed->frame1 < 15)
{
@ -1249,7 +1270,7 @@ void PedPressButton(PEDESTRIAN* pPed)
// [D] [T]
void SetupTannerSitDown(PEDESTRIAN* pPed)
void SetupTannerSitDown(LPPEDESTRIAN pPed)
{
pPed->type = PED_ACTION_SIT;
SetupPedMotionData(pPed);
@ -1261,7 +1282,7 @@ void SetupTannerSitDown(PEDESTRIAN* pPed)
}
// [D] [T]
void TannerCameraHandler(PEDESTRIAN* pPed)
void TannerCameraHandler(LPPEDESTRIAN pPed)
{
int value;
int padSteer;
@ -1310,7 +1331,7 @@ void TannerCameraHandler(PEDESTRIAN* pPed)
// [D] [T]
void TannerSitDown(PEDESTRIAN* pPed)
void TannerSitDown(LPPEDESTRIAN pPed)
{
if (oldCamView != 2 && player[pPed->padId].cameraView == 2)
{
@ -1364,7 +1385,7 @@ void TannerSitDown(PEDESTRIAN* pPed)
}
// [D] [T]
void CivPedDoNothing(PEDESTRIAN* pPed)
void CivPedDoNothing(LPPEDESTRIAN pPed)
{
}
@ -1397,7 +1418,7 @@ void SetupCivPedRouteData(VECTOR* pPos)
void PingInPedestrians(void)
{
int bFound;
PEDESTRIAN* pPed;
LPPEDESTRIAN pPed;
int rnd;
int pingInDist;
int i;
@ -1517,7 +1538,7 @@ void PingInPedestrians(void)
}
// [D] [T]
void TannerCollision(PEDESTRIAN* pPed)
void TannerCollision(LPPEDESTRIAN pPed)
{
CAR_DATA* pcdTanner;
@ -1554,7 +1575,7 @@ void TannerCollision(PEDESTRIAN* pPed)
}
// [D] [T]
int FindPointOfCollision(CAR_DATA* pCar, PEDESTRIAN* pPed)
int FindPointOfCollision(CAR_DATA* pCar, LPPEDESTRIAN pPed)
{
int dx, dz;
int minZ;
@ -1746,7 +1767,7 @@ int TannerCarCollisionCheck(VECTOR* pPos, int dir, int bQuick)
}
// [D] [T]
int PingOutPed(PEDESTRIAN* pPed)
int PingOutPed(LPPEDESTRIAN pPed)
{
int pz;
int px;
@ -1764,7 +1785,7 @@ int PingOutPed(PEDESTRIAN* pPed)
}
// [D] [T]
void SetupCivJump(PEDESTRIAN* pPed, CAR_DATA* cp)
void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA* cp)
{
int dz;
short scale;
@ -1844,7 +1865,7 @@ void SetupCivJump(PEDESTRIAN* pPed, CAR_DATA* cp)
}
// [D] [T]
void CivPedJump(PEDESTRIAN* pPed)
void CivPedJump(LPPEDESTRIAN pPed)
{
if (pPed->frame1 == 2)
pPed->speed *= 2;
@ -1867,7 +1888,7 @@ void CivPedJump(PEDESTRIAN* pPed)
}
// [D] [T]
void SetupCivPedWalk(PEDESTRIAN* pPed)
void SetupCivPedWalk(LPPEDESTRIAN pPed)
{
pPed->flags |= 0x10;
@ -1882,7 +1903,7 @@ void SetupCivPedWalk(PEDESTRIAN* pPed)
}
// [D] [T]
void CivPedWalk(PEDESTRIAN* pPed)
void CivPedWalk(LPPEDESTRIAN pPed)
{
int dir;
int turn;
@ -1962,7 +1983,7 @@ void CivPedWalk(PEDESTRIAN* pPed)
}
// [D] [T]
void CivPedSit(PEDESTRIAN* pPed)
void CivPedSit(LPPEDESTRIAN pPed)
{
pPed->frame1 = 0;
}
@ -1979,7 +2000,7 @@ void HandlePedestrians(void)
}
// [D] [T]
void PedestrianActionInit_WalkToTarget(PEDESTRIAN* pPed)
void PedestrianActionInit_WalkToTarget(LPPEDESTRIAN pPed)
{
int dir;
dir = CalcPedestrianDirection(0, (pPed->position).vx, (pPed->position).vz, &pPed->target);
@ -2002,7 +2023,7 @@ void PedestrianActionInit_WalkToTarget(PEDESTRIAN* pPed)
}
// [D] [T]
void CorrectPathPosition(PEDESTRIAN* pedestrian, VECTOR* position)
void CorrectPathPosition(LPPEDESTRIAN pedestrian, VECTOR* position)
{
}
@ -2094,7 +2115,7 @@ int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR* target)
}
// [D] [T]
int IsPavement(int x, int y, int z, PEDESTRIAN* pPed)
int IsPavement(int x, int y, int z, LPPEDESTRIAN pPed)
{
int r;
VECTOR v;
@ -2119,7 +2140,7 @@ int IsPavement(int x, int y, int z, PEDESTRIAN* pPed)
}
// [D] [T]
void SetPedestrianTurn(PEDESTRIAN* pedestrian, int turn)
void SetPedestrianTurn(LPPEDESTRIAN pedestrian, int turn)
{
int speed;
int dir;
@ -2140,12 +2161,12 @@ void SetPedestrianTurn(PEDESTRIAN* pedestrian, int turn)
}
// [D] [T]
SEATED_PEDESTRIANS* FindSeated(void)
SEATEDPTR FindSeated(void)
{
int dz;
int dx;
int count1;
SEATED_PEDESTRIANS* seatedptr;
SEATEDPTR seatedptr;
if (!seated_pedestrian)
return NULL;
@ -2186,13 +2207,13 @@ SEATED_PEDESTRIANS* FindSeated(void)
}
// [D] [T]
SEATED_PEDESTRIANS* FindTannerASeat(PEDESTRIAN* pPed)
SEATEDPTR FindTannerASeat(LPPEDESTRIAN pPed)
{
int dx, dz;
int distSqr;
int bestSqr;
SEATED_PEDESTRIANS* seatedptr;
SEATED_PEDESTRIANS* theOne;
SEATEDPTR seatedptr;
SEATEDPTR theOne;
theOne = NULL;
bestSqr = 4096;
@ -2238,9 +2259,9 @@ SEATED_PEDESTRIANS* FindTannerASeat(PEDESTRIAN* pPed)
}
// [D] [T]
void add_seated(SEATED_PEDESTRIANS* seatedptr, int seat_index)
void add_seated(SEATEDPTR seatedptr, int seat_index)
{
PEDESTRIAN* pedptr;
LPPEDESTRIAN pedptr;
int rnd;
if (num_pedestrians < MAX_SEATED_PEDS)
@ -2395,7 +2416,7 @@ void BuildCarCollisionBox(void)
}
// [D] [T]
CAR_DATA* CheckForCar(PEDESTRIAN* pedestrian)
CAR_DATA* CheckForCar(LPPEDESTRIAN pedestrian)
{
int count;
@ -2429,7 +2450,7 @@ CAR_DATA* CheckForCar(PEDESTRIAN* pedestrian)
}
// [D] [T]
int CheckForPlayerCar(PEDESTRIAN* pedestrian, CAR_COLLISION_BOX* collision_box)
int CheckForPlayerCar(LPPEDESTRIAN pedestrian, CAR_COLLISION_BOX* collision_box)
{
if (pedestrian->position.vx >= collision_box->min_x &&
pedestrian->position.vx <= collision_box->max_x &&
@ -2445,7 +2466,7 @@ int CheckForPlayerCar(PEDESTRIAN* pedestrian, CAR_COLLISION_BOX* collision_box)
int basic_car_interest;
// [D] [T]
void CalculatePedestrianInterest(PEDESTRIAN* pPed)
void CalculatePedestrianInterest(LPPEDESTRIAN pPed)
{
CAR_DATA* pCar;
int carId;
@ -2499,7 +2520,7 @@ void CalculatePedestrianInterest(PEDESTRIAN* pPed)
// [D] [T]
void ProcessChairLump(char* lump_file, int lump_size)
{
seated_pedestrian = (SEATED_PEDESTRIANS*)lump_file;
seated_pedestrian = (SEATEDPTR)lump_file;
}
// [D] [T]
@ -2564,7 +2585,7 @@ void IHaveThePower(void)
}
// [D] [T]
void ProcessTannerPad(PEDESTRIAN* pPed, u_int pad, char PadSteer, char use_analogue)
void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_analogue)
{
sdPlane* SurfacePtr;
int direction;
@ -2759,7 +2780,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC
int wbody;
int side;
int dir;
PEDESTRIAN* pedptr;
LPPEDESTRIAN pedptr;
int playerId;
VECTOR* pos;
VECTOR v;
@ -2886,8 +2907,6 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC
pedptr->dir.vx = 0;
pedptr->dir.vy = dir;
pedptr->head_rot = 0;
pPlayerPed = pedptr;
lp->headTimer = 0;
pedptr->pedType = playerType;
SetupPedestrian(pedptr);
@ -2962,7 +2981,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC
}
// [D] [T]
void DeActivatePlayerPedestrian(PEDESTRIAN* pPed)
void DeActivatePlayerPedestrian(LPPEDESTRIAN pPed)
{
CAR_DATA* cp;
int playerId;

View File

@ -3,33 +3,35 @@
#define TANNER_COLLIDER_CARID (MAX_CARS)
typedef struct SEATED_PEDESTRIANS* SEATEDPTR;
extern SVECTOR tannerLookAngle;
extern MODEL* pmTannerModels[17];
extern MODEL* pmJerichoModels[6];
extern SEATED_PEDESTRIANS *seated_pedestrian;
extern SEATEDPTR seated_pedestrian;
extern int bKillTanner;
extern int bReverseYRotation;
extern PEDESTRIAN *pUsedPeds;
extern LPPEDESTRIAN pUsedPeds;
extern void ProcessChairLump(char *lump_file, int lump_size); // 0x00073328
extern void InitTanner(); // 0x0006E408
extern void SetTannerPosition(VECTOR *pVec); // 0x00072478
extern void ProcessTannerPad(PEDESTRIAN *pPed, u_int pad, char PadSteer, char use_analogue); // 0x0006DF54
extern void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_analogue); // 0x0006DF54
extern void InitPedestrians(); // 0x0006E5C4
extern void DestroyPedestrians(); // 0x00071F54
extern void DestroyCivPedestrians(); // 0x00072FD0
extern void DestroyPedestrian(PEDESTRIAN *pPed); // 0x00071FB4
extern void DestroyPedestrian(LPPEDESTRIAN pPed); // 0x00071FB4
extern int ActivatePlayerPedestrian(CAR_DATA *pCar, char *padId, int direction, LONGVECTOR4* position, PED_MODEL_TYPES playerType); // 0x0006E6C4
extern PEDESTRIAN * CreatePedestrian(); // 0x000720AC
extern LPPEDESTRIAN CreatePedestrian(); // 0x000720AC
extern void PlaceRoadBlockCops(); // 0x0006EC88
extern int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType); // 0x0006F00C
@ -39,50 +41,42 @@ extern int TannerActionHappening(); // 0x00072430
extern void ControlPedestrians(); // 0x0006F16C
extern void DeActivatePlayerPedestrian(PEDESTRIAN *pPed); // 0x0007216C
extern void DeActivatePlayerPedestrian(LPPEDESTRIAN pPed); // 0x0007216C
extern void SetupCivPedRouteData(VECTOR *pPos); // 0x0007313C
extern void PingInPedestrians(); // 0x0007047C
extern void TannerCollision(PEDESTRIAN *pPed); // 0x00072EE4
extern void TannerCollision(LPPEDESTRIAN pPed); // 0x00072EE4
extern int FindPointOfCollision(CAR_DATA *pCar, PEDESTRIAN* pPed); // 0x00070878
extern int FindPointOfCollision(CAR_DATA *pCar, LPPEDESTRIAN pPed); // 0x00070878
extern int TannerCarCollisionCheck(VECTOR *pPos, int dir, int bQuick); // 0x00070A9C
extern int PingOutPed(PEDESTRIAN *pPed); // 0x000731F8
extern int PingOutPed(LPPEDESTRIAN pPed); // 0x000731F8
extern void SetupCivJump(PEDESTRIAN *pPed, CAR_DATA *cp); // 0x00071054
extern void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA *cp); // 0x00071054
extern void SetupCivPedWalk(PEDESTRIAN *pPed); // 0x00073270
extern void SetupCivPedWalk(LPPEDESTRIAN pPed); // 0x00073270
extern void HandlePedestrians(); // 0x0007211C
extern void PedestrianActionInit_WalkToTarget(PEDESTRIAN *pPed); // 0x0007283C
extern void PedestrianActionInit_WalkToTarget(LPPEDESTRIAN pPed); // 0x0007283C
extern void CorrectPathPosition(PEDESTRIAN *pedestrian, VECTOR *position); // 0x000715FC
extern void CorrectPathPosition(LPPEDESTRIAN pedestrian, VECTOR *position); // 0x000715FC
extern int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR *target); // 0x00071608
extern int IsPavement(int x, int y, int z, PEDESTRIAN *pPed); // 0x000725B8
extern int IsPavement(int x, int y, int z, LPPEDESTRIAN pPed); // 0x000725B8
extern void SetPedestrianTurn(PEDESTRIAN *pedestrian, int turn); // 0x00072500
extern SEATED_PEDESTRIANS * FindSeated(); // 0x00072644
extern SEATED_PEDESTRIANS * FindTannerASeat(PEDESTRIAN *pPed); // 0x000717AC
extern void add_seated(SEATED_PEDESTRIANS *seatedptr, int seat_index); // 0x000718C8
extern void SetPedestrianTurn(LPPEDESTRIAN pedestrian, int turn); // 0x00072500
extern void set_coll_box(int index, CAR_DATA *cp, int offset); // 0x00071A5C
extern void BuildCarCollisionBox(); // 0x00071B7C
extern CAR_DATA * CheckForCar(PEDESTRIAN *pedestrian); // 0x00072738
extern CAR_DATA* CheckForCar(LPPEDESTRIAN pedestrian); // 0x00072738
extern int CheckForPlayerCar(PEDESTRIAN *pedestrian, CAR_COLLISION_BOX *collision_box); // 0x000732C0
extern void CalculatePedestrianInterest(PEDESTRIAN *pPed); // 0x00071E0C
extern void CalculatePedestrianInterest(LPPEDESTRIAN pPed); // 0x00071E0C
#endif

View File

@ -14,8 +14,7 @@
#include "felony.h"
#include "shadow.h"
PEDESTRIAN *pPlayerPed = NULL;
PLAYER player[8];
PLAYER player[MAX_PLAYERS];
// [D] [T]
void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid)
@ -62,8 +61,11 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction
}
else
{
LPPEDESTRIAN pPlayerPed;
ActivatePlayerPedestrian(NULL, padid, direction, startPos, (PED_MODEL_TYPES)playerType);
pPlayerPed = locPlayer->pPed;
locPlayer->playerType = 2;
locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position;
locPlayer->playerCarId = -1;
@ -113,6 +115,9 @@ void ChangeCarPlayerToPed(int playerID)
if (gInGameCutsceneActive == 0 && gInGameChaseActive == 0)
{
LPPEDESTRIAN pPlayerPed;
pPlayerPed = locPlayer->pPed;
locPlayer->worldCentreCarId = -1;
locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position;
}
@ -241,17 +246,18 @@ void ChangePedPlayerToCar(int playerID, CAR_DATA *newCar)
// [D] [T]
void UpdatePlayers(void)
{
int carId;
PEDESTRIAN *ped;
PLAYER *locPlayer;
int i, carId;
LPPEDESTRIAN ped;
PLAYER* locPlayer;
CAR_DATA* cp;
if(CopsAllowed == 0)
if (CopsAllowed == 0)
pedestrianFelony = 0;
locPlayer = player;
for (i = 0; i < MAX_PLAYERS; i++)
{
locPlayer = &player[i];
do {
if (gInGameCutsceneActive == 0)
locPlayer->playerType = (locPlayer->pPed != NULL) ? 2 : 1;
@ -259,31 +265,29 @@ void UpdatePlayers(void)
{
carId = locPlayer->playerCarId;
if(locPlayer->worldCentreCarId >= 0)
locPlayer->spoolXZ = (VECTOR *)car_data[locPlayer->worldCentreCarId].hd.where.t;
if (locPlayer->worldCentreCarId >= 0)
locPlayer->spoolXZ = (VECTOR*)car_data[locPlayer->worldCentreCarId].hd.where.t;
if (carId >= 0)
{
cp = &car_data[carId];
locPlayer->pos[0] = cp->hd.where.t[0];
locPlayer->pos[1] = cp->hd.where.t[1];
locPlayer->pos[2] = cp->hd.where.t[2];
locPlayer->dir = cp->hd.direction;
}
}
else if (locPlayer->playerType == 2)
else if (locPlayer->playerType == 2)
{
ped = locPlayer->pPed;
locPlayer->pos[0] = ped->position.vx;
locPlayer->pos[1] = -ped->position.vy;
locPlayer->pos[2] = ped->position.vz;
locPlayer->dir = ped->dir.vy + -0x800;
locPlayer->dir = ped->dir.vy - 2048;
}
locPlayer++;
} while (locPlayer <= &player[7]);
}
}
// [D] [T]

View File

@ -1,8 +1,7 @@
#ifndef PLAYERS_H
#define PLAYERS_H
extern PLAYER player[8];
extern PEDESTRIAN *pPlayerPed;
extern PLAYER player[MAX_PLAYERS];
extern void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid); // 0x000739D8

View File

@ -5,6 +5,12 @@
extern TEXTURE_DETAILS digit_texture;
struct FONT_DIGIT
{
char xOffset;
char width;
};
FONT_DIGIT fontDigit[] = {
{ 2, 14 },
{ 17, 14},
@ -117,7 +123,7 @@ void PrintStringCentred(char *pString, short y)
void LoadFont(char *buffer)
{
int i;
ushort *clut;
ushort *clut, *pclut;
int nchars;
char *file;
RECT16 dest;
@ -148,9 +154,10 @@ void LoadFont(char *buffer)
fontclutid = GetClut(fontclutpos.x,fontclutpos.y);
clut = (ushort*)file;
pclut = clut;
for (i = 0; i < 16; i++)
*clut++ &= 0x7fff;
*pclut++ &= ~0x8000;
clut[1] |= 0x8000;
clut[2] |= 0x8000;
@ -159,7 +166,7 @@ void LoadFont(char *buffer)
fonttpage = GetTPage(0,0, dest.x, dest.y);
LoadImage(&fontclutpos, (u_long *)file); // upload clut
LoadImage(&fontclutpos, (u_long *)clut); // upload clut
LoadImage(&dest, (u_long *)(file + 32)); // upload font image
DrawSync(0);
@ -186,20 +193,20 @@ void SetCLUT16Flags(ushort clutID, ushort mask, char transparent)
int x, y;
ushort buffer[16];
x = (clutID & 0x3f) << 4;
x = (clutID & 63) * 16;
y = (clutID >> 6);
StoreClut2((ulong *)buffer,x,y);
StoreClut2((ulong *)buffer, x, y);
pCurrent = buffer;
ctr = 1;
while (pCurrent < &buffer[16])
{
if (mask >> (ctr & 1U) == 0)
*pCurrent &= 0x7fff;
else
if ((mask >> ctr) & 1 != 0)
*pCurrent |= 0x8000;
else
*pCurrent &= ~0x8000;
buffer[transparent] = 0;
@ -231,28 +238,25 @@ int PrintString(char *string, int x, int y)
if (showMap != 0)
font = (SPRT *)SetFontTPage(font);
chr = *string++;
width = x;
while (chr)
while ((chr = *string++) != 0)
{
if (chr == 32)
{
width += 4;
continue;
}
else if (chr < 32 || chr > 138 || chr < 128)
if (chr < 32 || chr > 138 || chr < 128)
{
if (AsciiTable[chr] == -1)
index = AsciiTable[63]; // place a question mark
else
index = AsciiTable[chr];
chr = fontinfo[index].width;
setSprt(font);
#ifdef PSX
setSemiTrans(font, 1);
#endif
font->r0 = gFontColour.r;
font->g0 = gFontColour.g;
@ -263,7 +267,7 @@ int PrintString(char *string, int x, int y)
font->u0 = fontinfo[index].x;
font->v0 = fontinfo[index].y - 46;
font->w = chr;
font->w = fontinfo[index].width;
font->h = fontinfo[index].height;
font->clut = fontclutid;
@ -278,7 +282,7 @@ int PrintString(char *string, int x, int y)
}
font++;
width += chr;
width += fontinfo[index].width;
}
else
{
@ -291,8 +295,6 @@ int PrintString(char *string, int x, int y)
if (showMap != 0)
font = (SPRT *)SetFontTPage(font);
}
chr = *string++;
}
if (showMap == 0)
@ -315,11 +317,9 @@ short PrintDigit(int x, int y, char *string)
char vOff, h;
width = x;
chr = *string++;
font = (SPRT *)current->primptr;
while (chr != 0)
while ((chr = *string++) != 0)
{
if (chr == 58)
index = 11;
@ -347,9 +347,7 @@ short PrintDigit(int x, int y, char *string)
}
setSprt(font);
#ifdef PSX
setSemiTrans(font, 1);
#endif
font->r0 = gFontColour.r;
font->g0 = gFontColour.g;
@ -371,17 +369,13 @@ short PrintDigit(int x, int y, char *string)
width += fixedWidth;
font++;
chr = *string++;
}
current->primptr = (char*)font;
POLY_FT3* null = (POLY_FT3*)current->primptr;
setPolyFT3(null);
#ifdef PSX
setSemiTrans(null, 1);
#endif
null->x0 = -1;
null->y0 = -1;
@ -440,29 +434,28 @@ void PrintStringBoxed(char *string, int ix, int iy)
if (c == ' ')
{
x += 4;
continue;
}
else
index = AsciiTable[c];
if (index != -1)
{
index = AsciiTable[c];
OUT_FONTINFO *pFontInfo = &fontinfo[index];
if (index != -1)
{
OUT_FONTINFO *pFontInfo = &fontinfo[index];
setSprt(font);
setSprt(font);
setRGB0(font, gFontColour.r, gFontColour.g, gFontColour.b);
setXY0(font, x, y + pFontInfo->offy);
setUV0(font, pFontInfo->x, pFontInfo->y - 46);
setWH(font, pFontInfo->width, pFontInfo->height);
setRGB0(font, gFontColour.r, gFontColour.g, gFontColour.b);
setXY0(font, x, y + pFontInfo->offy);
setUV0(font, pFontInfo->x, pFontInfo->y - 46);
setWH(font, pFontInfo->width, pFontInfo->height);
font->clut = fontclutid;
font->clut = fontclutid;
addPrim(current->ot, font);
font++;
addPrim(current->ot, font);
font++;
x += pFontInfo->width;
}
x += pFontInfo->width;
}
}
@ -472,9 +465,7 @@ void PrintStringBoxed(char *string, int ix, int iy)
POLY_FT3* null = (POLY_FT3*)font;
setPolyFT3(null);
#ifdef PSX
setSemiTrans(null, 1);
#endif
null->x0 = -1;
null->y0 = -1;
@ -494,11 +485,10 @@ void PrintStringBoxed(char *string, int ix, int iy)
void InitButtonTextures(void)
{
int i;
i = 0;
while (i < 11)
for (i = 0; i < 11; i++)
{
GetTextureDetails(button_names[i], &button_textures[i]);
i++;
}
}
@ -558,7 +548,6 @@ int PrintScaledString(int y, char *string, int scale)
x1 = x + width;
setPolyFT4(font);
setRGB0(font, gFontColour.r, gFontColour.g, gFontColour.b);
font->x0 = x; // [A] no suitable macro in libgpu
@ -664,9 +653,7 @@ void* SetFontTPage(void *prim)
POLY_FT3* null = (POLY_FT3*)prim;
setPolyFT3(null);
#ifdef PSX
setSemiTrans(null, 1);
#endif
null->x0 = -1;
null->y0 = -1;

View File

@ -1,6 +1,17 @@
#ifndef PRES_H
#define PRES_H
struct OUT_FONTINFO
{
u_char x;
u_char y;
char offx;
char offy;
u_char width;
u_char height;
u_short pad;
};
extern short fonttpage;
extern void InitButtonTextures(); // 0x00074E54

View File

@ -21,7 +21,7 @@ int gOutOfTape = 0;
REPLAY_PARAMETER_BLOCK *ReplayParameterPtr = NULL;
REPLAY_STREAM ReplayStreams[8];
REPLAY_STREAM ReplayStreams[MAX_REPLAY_STREAMS];
int NumReplayStreams = 1;
char *ReplayStart;

View File

@ -4,7 +4,7 @@
extern int gOutOfTape;
extern REPLAY_PARAMETER_BLOCK *ReplayParameterPtr;
extern REPLAY_STREAM ReplayStreams[8];
extern REPLAY_STREAM ReplayStreams[MAX_REPLAY_STREAMS];
extern int NumReplayStreams;
extern char *ReplayStart;

View File

@ -2,6 +2,7 @@
#include "scores.h"
#include "glaunch.h"
#include "mission.h"
#include "loadsave.h"
SCORE_TABLES ScoreTables;
PLAYER_SCORE gPlayerScore;
@ -55,6 +56,10 @@ void AddScoreToTable(SCORE_ENTRY *table, int entry)
table->items = gPlayerScore.items;
strcpy(table->name, gPlayerScore.name);
#ifndef PSX
SaveCurrentProfile(1);
#endif
}
// [D] [T]

View File

@ -14,32 +14,41 @@
#include "mission.h"
#include "tile.h"
struct TYRE_TRACK
{
u_char type;
u_char shade;
u_char shade_type;
u_char surface;
SVECTOR_NOPAD p1;
SVECTOR_NOPAD p2;
SVECTOR_NOPAD p3;
SVECTOR_NOPAD p4;
};
int gShadowTexturePage;
int gShadowTextureNum;
UV shadowuv;
POLYFT4 shadowpoly;
VECTOR tyre_new_positions[4];
VECTOR tyre_save_positions[4];
VECTOR tyre_new_positions[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS];
VECTOR tyre_save_positions[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS];
int smoke_count[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS];
int tyre_track_offset[4];
int num_tyre_tracks[4];
int tyre_track_offset[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS];
int num_tyre_tracks[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS];
TYRE_TRACK track_buffer[4][64];
int smoke_count[4];
TYRE_TRACK track_buffer[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS][64];
// [D] [T]
void InitTyreTracks(void)
{
int i;
i = 0;
while (i < 4)
for (i = 0; i < MAX_TYRE_TRACK_PLAYERS; i++)
{
num_tyre_tracks[i] = 0;
tyre_track_offset[i] = 0;
i++;
ClearMem((char*)num_tyre_tracks[i], sizeof(num_tyre_tracks[0]));
ClearMem((char*)tyre_track_offset[i], sizeof(tyre_track_offset[0]));
}
}
@ -47,7 +56,7 @@ void InitTyreTracks(void)
void ResetTyreTracks(CAR_DATA* cp, int player_id)
{
// [A] reset tyre tracks
if (player_id >= 0 && player_id < 2 && cp->controlType != CONTROL_TYPE_NONE)
if (player_id >= 0 && player_id < MAX_TYRE_TRACK_PLAYERS && cp->controlType != CONTROL_TYPE_NONE)
{
GetTyreTrackPositions(cp, player_id);
SetTyreTrackOldPositions(player_id);
@ -57,8 +66,7 @@ void ResetTyreTracks(CAR_DATA* cp, int player_id)
// [D] [T]
void GetTyreTrackPositions(CAR_DATA *cp, int player_id)
{
int track;
u_int loop;
int loop, track, steps;
CAR_COSMETICS *car_cos;
VECTOR WheelPos;
VECTOR CarPos;
@ -68,18 +76,20 @@ void GetTyreTrackPositions(CAR_DATA *cp, int player_id)
CarPos.vz = cp->hd.where.t[2];
car_cos = cp->ap.carCos;
SetRotMatrix(&cp->hd.drawCarMat);
SetRotMatrix(&cp->hd.where);
loop = 0;
steps = 4 / MAX_TYRE_TRACK_WHEELS;
do {
for (loop = 0; loop < 4; loop += steps)
{
WheelPos.vx = car_cos->wheelDisp[loop].vx;
if (loop & 2)
WheelPos.vx = car_cos->wheelDisp[loop].vx + 17;
WheelPos.vx += 17;
else
WheelPos.vx = car_cos->wheelDisp[loop].vx - 17;
WheelPos.vx -= 17;
WheelPos.vy = 0;
WheelPos.vz = -car_cos->wheelDisp[loop + 1 & 3].vz;
WheelPos.vz = car_cos->wheelDisp[loop + 1 & 3].vz;
_MatrixRotate(&WheelPos);
@ -87,52 +97,39 @@ void GetTyreTrackPositions(CAR_DATA *cp, int player_id)
WheelPos.vy = CarPos.vy;
WheelPos.vz += CarPos.vz;
track = player_id * 2 + (loop / 2);
track = loop / steps;
tyre_new_positions[track].vx = WheelPos.vx;
tyre_new_positions[track].vz = WheelPos.vz;
tyre_new_positions[track].vy = MapHeight(&WheelPos);
loop += 2;
} while (loop < 4);
tyre_new_positions[player_id][track].vx = WheelPos.vx;
tyre_new_positions[player_id][track].vz = WheelPos.vz;
tyre_new_positions[player_id][track].vy = MapHeight(&WheelPos);
}
}
// [D] [T]
void SetTyreTrackOldPositions(int player_id)
{
int idx = player_id * 2;
tyre_save_positions[idx].vx = tyre_new_positions[idx].vx;
tyre_save_positions[idx].vy = tyre_new_positions[idx].vy;
tyre_save_positions[idx].vz = tyre_new_positions[idx].vz;
tyre_save_positions[idx + 1].vx = tyre_new_positions[idx + 1].vx;
tyre_save_positions[idx + 1].vy = tyre_new_positions[idx + 1].vy;
tyre_save_positions[idx + 1].vz = tyre_new_positions[idx + 1].vz;
tyre_save_positions[player_id][0] = tyre_new_positions[player_id][0];
tyre_save_positions[player_id][1] = tyre_new_positions[player_id][1];
tyre_save_positions[player_id][2] = tyre_new_positions[player_id][2];
tyre_save_positions[player_id][3] = tyre_new_positions[player_id][3];
}
// [D] [T]
void AddTyreTrack(int wheel, int tracksAndSmoke, int padid)
void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_track)
{
static int Cont[4] = { 0, 0, 0, 0 };
short x;
short z;
short x, z;
sdPlane *SurfaceDataPtr;
char trackSurface;
TYRE_TRACK *tt_p;
VECTOR *newtp;
VECTOR *oldtp;
VECTOR New1;
VECTOR New2;
VECTOR New3;
VECTOR New4;
VECTOR SmokeDrift;
VECTOR SmokePosition;
VECTOR grass_vector;
VECTOR New1, New2, New3, New4;
VECTOR SmokeDrift, SmokePosition, grass_vector;
newtp = &tyre_new_positions[wheel];
newtp = &tyre_new_positions[player_id][wheel];
// [A] disabled due to MP and SP bugs
/*
@ -142,35 +139,24 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int padid)
if (newtp->vz - camera_position.vz + 20480 > 40960)
return;*/
if (tracksAndSmoke == 0)
if (tracksAndSmoke != 0)
{
SurfaceDataPtr = sdGetCell(newtp);
trackSurface = 1;
oldtp = &tyre_save_positions[player_id][wheel];
if (SurfaceDataPtr->surface == 6)
return;
if (SurfaceDataPtr->surface == 4)
trackSurface = 2;
}
else
{
oldtp = &tyre_save_positions[wheel];
tt_p = track_buffer[wheel] + (tyre_track_offset[wheel] + num_tyre_tracks[wheel] & 0x3f);
tt_p = track_buffer[player_id][wheel] + (tyre_track_offset[player_id][wheel] + num_tyre_tracks[player_id][wheel] & 0x3f);
SurfaceDataPtr = sdGetCell(newtp);
// check surface type
if (SurfaceDataPtr != NULL)
{
if (SurfaceDataPtr->surface == 6)
if (SurfaceDataPtr->surface == SURF_WATER)
return;
if (SurfaceDataPtr->surface == 4)
if (SurfaceDataPtr->surface == SURF_GRASS)
{
tt_p->surface = 2;
player[padid].onGrass = 1;
player[player_id].onGrass = 1;
}
else
{
@ -184,13 +170,24 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int padid)
trackSurface = tt_p->surface;
}
else
{
SurfaceDataPtr = sdGetCell(newtp);
trackSurface = 1;
if (SurfaceDataPtr->surface == SURF_WATER)
return;
if (SurfaceDataPtr->surface == SURF_GRASS)
trackSurface = 2;
}
SmokePosition.vx = newtp->vx;
SmokePosition.vz = newtp->vz;
SmokePosition.vy = -50 - newtp->vy;
// make smoke
if ((smoke_count[wheel]++ & 3) == 1)
if ((smoke_count[player_id][wheel]++ & 3) == 1)
{
GetSmokeDrift(&SmokeDrift);
@ -234,14 +231,14 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int padid)
New4.vx = New4.vx - x;
New4.vz = New4.vz - z;
if (num_tyre_tracks[wheel] == 64)
if (num_tyre_tracks[player_id][wheel] == 64)
{
tyre_track_offset[wheel]++;
tyre_track_offset[wheel] &= 63;
tyre_track_offset[player_id][wheel]++;
tyre_track_offset[player_id][wheel] &= 63;
}
else
{
num_tyre_tracks[wheel]++;
num_tyre_tracks[player_id][wheel]++;
}
if (Cont[wheel] == 1 && continuous_track == 1)
@ -275,9 +272,8 @@ void DrawTyreTracks(void)
char last_duff;
POLY_FT4 *poly;
TYRE_TRACK *tt_p;
int index;
int loop;
int wheel_loop;
int index, loop;
int player_id, wheel_loop;
POLY_FT4 *lasttyre;
SVECTOR ps[4];
int z;
@ -285,124 +281,123 @@ void DrawTyreTracks(void)
gte_SetRotMatrix(&inv_camera_matrix);
gte_SetTransVector(&dummy);
wheel_loop = 0;
do {
lasttyre = NULL;
last_duff = 1;
index = tyre_track_offset[wheel_loop];
for (loop = 0; loop < num_tyre_tracks[wheel_loop]; loop++)
for (player_id = 0; player_id < MAX_TYRE_TRACK_PLAYERS; player_id++)
{
for (wheel_loop = 0; wheel_loop < MAX_TYRE_TRACK_WHEELS; wheel_loop++)
{
tt_p = track_buffer[wheel_loop] + index;
lasttyre = NULL;
last_duff = 1;
index = tyre_track_offset[player_id][wheel_loop];
index++;
if (index == 64)
index = 0;
if (tt_p->type == 2)
continue;
ps[0].vx = tt_p->p1.vx - camera_position.vx;
ps[0].vy = -camera_position.vy - tt_p->p1.vy;
ps[0].vz = tt_p->p1.vz - camera_position.vz;
ps[1].vx = tt_p->p2.vx - camera_position.vx;
ps[1].vy = -camera_position.vy - tt_p->p2.vy;
ps[1].vz = tt_p->p2.vz - camera_position.vz;
ps[2].vx = tt_p->p3.vx - camera_position.vx;
ps[2].vy = -camera_position.vy - tt_p->p3.vy;
ps[2].vz = tt_p->p3.vz - camera_position.vz;
ps[3].vx = tt_p->p4.vx - camera_position.vx;
ps[3].vy = -camera_position.vy - tt_p->p4.vy;
ps[3].vz = tt_p->p4.vz - camera_position.vz;
poly = (POLY_FT4 *)current->primptr;
z = 0;
if (lasttyre != NULL && tt_p->type != 0 && !last_duff)
for (loop = 0; loop < num_tyre_tracks[player_id][wheel_loop]; loop++)
{
last_duff = 1;
tt_p = track_buffer[player_id][wheel_loop] + index;
if (ps[2].vx + 9000 <= 18000 && ps[2].vz + 9000 <= 18000)
index++;
index &= 63;
if (tt_p->type == 2)
continue;
ps[0].vx = tt_p->p1.vx - camera_position.vx;
ps[0].vy = -camera_position.vy - tt_p->p1.vy;
ps[0].vz = tt_p->p1.vz - camera_position.vz;
ps[1].vx = tt_p->p2.vx - camera_position.vx;
ps[1].vy = -camera_position.vy - tt_p->p2.vy;
ps[1].vz = tt_p->p2.vz - camera_position.vz;
ps[2].vx = tt_p->p3.vx - camera_position.vx;
ps[2].vy = -camera_position.vy - tt_p->p3.vy;
ps[2].vz = tt_p->p3.vz - camera_position.vz;
ps[3].vx = tt_p->p4.vx - camera_position.vx;
ps[3].vy = -camera_position.vy - tt_p->p4.vy;
ps[3].vz = tt_p->p4.vz - camera_position.vz;
poly = (POLY_FT4*)current->primptr;
z = 0;
if (lasttyre != NULL && tt_p->type != 0 && !last_duff)
{
gte_ldv0(&ps[2]);
gte_rtps();
last_duff = 1;
gte_stsxy(&poly->x2);
if (ps[2].vx + 9000 <= 18000 && ps[2].vz + 9000 <= 18000)
{
gte_ldv0(&ps[2]);
gte_rtps();
gte_stsz(&z);
gte_stsxy(&poly->x2);
gte_ldv0(&ps[3]);
gte_rtps();
gte_stsz(&z);
*(u_int *)&poly->x0 = *(u_int *)&lasttyre->x2;
*(u_int *)&poly->x1 = *(u_int *)&lasttyre->x3;
gte_ldv0(&ps[3]);
gte_rtps();
gte_stsxy(&poly->x3);
}
}
else
{
last_duff = 1;
*(u_int*)&poly->x0 = *(u_int*)&lasttyre->x2;
*(u_int*)&poly->x1 = *(u_int*)&lasttyre->x3;
if (ps[0].vx + 0x5000 <= 0xa000 && ps[0].vz + 0x5000 <= 0xa000)
{
gte_ldv3(&ps[0], &ps[1], &ps[2]);
gte_rtpt();
gte_stsxy3(&poly->x0, &poly->x1, &poly->x2);
gte_stsz(&z);
gte_ldv0(&ps[3]);
gte_rtps();
gte_stsxy(&poly->x3);
gte_stsxy(&poly->x3);
}
}
else
{
tt_p->type = 2;
last_duff = 1;
if (ps[0].vx + 0x5000 <= 0xa000 && ps[0].vz + 0x5000 <= 0xa000)
{
gte_ldv3(&ps[0], &ps[1], &ps[2]);
gte_rtpt();
gte_stsxy3(&poly->x0, &poly->x1, &poly->x2);
gte_stsz(&z);
gte_ldv0(&ps[3]);
gte_rtps();
gte_stsxy(&poly->x3);
}
else
{
tt_p->type = 2;
}
}
}
if (z > 50)
{
setPolyFT4(poly);
setSemiTrans(poly, 1);
if (tt_p->surface == 1)
if (z > 50)
{
poly->r0 = poly->g0 = poly->b0 = 26;
setPolyFT4(poly);
setSemiTrans(poly, 1);
if (tt_p->surface == 1)
{
poly->r0 = poly->g0 = poly->b0 = 26;
}
else
{
poly->r0 = 17;
poly->g0 = poly->b0 = 35;
}
*(ushort*)&poly->u0 = *(ushort*)&gTyreTexture.coords.u0;
*(ushort*)&poly->u1 = *(ushort*)&gTyreTexture.coords.u1;
*(ushort*)&poly->u2 = *(ushort*)&gTyreTexture.coords.u2;
*(ushort*)&poly->u3 = *(ushort*)&gTyreTexture.coords.u3;
poly->tpage = gTyreTexture.tpageid | 0x40;
poly->clut = gTyreTexture.clutid;
addPrim(current->ot + (z >> 3), poly);
current->primptr += sizeof(POLY_FT4);
lasttyre = poly;
last_duff = 0;
}
else
{
poly->r0 = 17;
poly->g0 = poly->b0 = 35;
}
*(ushort *)&poly->u0 = *(ushort *)&gTyreTexture.coords.u0;
*(ushort *)&poly->u1 = *(ushort *)&gTyreTexture.coords.u1;
*(ushort *)&poly->u2 = *(ushort *)&gTyreTexture.coords.u2;
*(ushort *)&poly->u3 = *(ushort *)&gTyreTexture.coords.u3;
poly->tpage = gTyreTexture.tpageid | 0x40;
poly->clut = gTyreTexture.clutid;
addPrim(current->ot + (z >> 3), poly);
current->primptr += sizeof(POLY_FT4);
lasttyre = poly;
last_duff = 0;
}
}
}
wheel_loop++;
} while (wheel_loop < 4);
}
// [D] [T] [A] now better shadow code

View File

@ -12,7 +12,7 @@ extern void ResetTyreTracks(CAR_DATA* cp, int player_id);
extern void GetTyreTrackPositions(CAR_DATA *cp, int player_id); // 0x00075408
extern void SetTyreTrackOldPositions(int player_id); // 0x00077558
extern void AddTyreTrack(int wheel, int tracksAndSmoke, int padid); // 0x00075540
extern void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_track); // 0x00075540
extern void DrawTyreTracks(); // 0x000759E0

View File

@ -24,7 +24,7 @@ struct FLAREREC
short gapmod;
};
int sky_y_offset[4] = { 17, 17, 17, 17 };
int sky_y_offset[4] = { -17, -17, -17, -17 };
unsigned char HorizonLookup[4][4] = {
{0, 0, 20, 20},
@ -824,10 +824,8 @@ DVECTORF scratchPad_skyVertices[35]; // 1f800044
#define scratchPad_skyVertices ((DVECTOR*)getScratchAddr(0x11)) // 1f800044
#endif
short scratchPad_zbuff[256];
// [D] [T]
void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g, unsigned char b, int offset)
void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g, unsigned char b)
{
POLYFT4* src;
POLY_FT4* poly;
@ -866,7 +864,7 @@ void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g
poly->clut = skyclut[skytexnum];
poly->tpage = skytpage[skytexnum];
addPrim(current->ot + 0x107f, poly);
addPrim(current->ot + OTSIZE - 1, poly);
#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS)
poly->pgxp_index = outpoints[src->v0].pgxp_index;
@ -882,57 +880,30 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset)
SVECTOR* verts;
#ifdef USE_PGXP
DVECTORF* dv0;
DVECTORF* dv1;
DVECTORF* dv2;
DVECTORF* dv;
#else
DVECTOR* dv0;
DVECTOR* dv1;
DVECTOR* dv2;
DVECTOR* dv;
#endif
SVECTOR* v0;
SVECTOR* v1;
SVECTOR* v2;
int count;
unsigned char* polys;
int green;
int red;
int blue;
int red, green, blue;
int z;
z = -1;
verts = (SVECTOR*)model->vertices;
count = 0;
dv0 = scratchPad_skyVertices;
dv1 = scratchPad_skyVertices + 1;
dv2 = scratchPad_skyVertices + 2;
v0 = verts;
v1 = verts + 1;
v2 = verts + 2;
dv = scratchPad_skyVertices;
count = model->num_vertices;
#ifdef USE_PGXP
PGXP_SetZOffsetScale(0.0f, 256.0f);
#endif
while (count < model->num_vertices)
do
{
SVECTOR sv0 = *v0;
SVECTOR sv1 = *v1;
SVECTOR sv2 = *v2;
sv0.vy -= sky_y_offset[GameLevel];
sv1.vy -= sky_y_offset[GameLevel];
sv2.vy -= sky_y_offset[GameLevel];
gte_ldv3(&sv0, &sv1, &sv2);
gte_ldv3(verts, verts+1, verts+2);
gte_rtpt();
gte_stsxy3(dv0, dv1, dv2);
gte_stsxy3(dv, dv+1, dv+2);
if(count == 15)
gte_stszotz(&z);
@ -940,19 +911,12 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset)
#ifdef USE_PGXP
// store PGXP index
// HACK: -1 is needed here for some reason
dv0->pgxp_index = dv1->pgxp_index = dv2->pgxp_index = PGXP_GetIndex() - 1;
dv[0].pgxp_index = dv[1].pgxp_index = dv[2].pgxp_index = PGXP_GetIndex() - 1;
#endif
dv2 += 3;
dv1 += 3;
dv0 += 3;
v2 += 3;
v1 += 3;
v0 += 3;
count += 3;
}
dv += 3;
verts += 3;
count -= 3;
} while (count);
#ifdef USE_PGXP
PGXP_SetZOffsetScale(0.0f, 1.0f);
@ -960,51 +924,59 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset)
if (z > 0)
{
int polySize;
u_char* horizonTex = &HorizonTextures[horizontaboffset];
polys = (unsigned char*)model->poly_block;
polySize = PolySizes[*polys];
red = skycolor.r;
green = skycolor.g;
blue = skycolor.b;
count = 0;
while (count < model->num_polys)
// draw sky
count = model->num_polys;
do
{
if (count == 12)
{
red /= 2;
green /= 2;
blue /= 2;
}
PlotSkyPoly((POLYFT4*)polys, *horizonTex++, red, green, blue);
polys += polySize;
} while (--count > 8);
PlotSkyPoly((POLYFT4*)polys, HorizonTextures[horizontaboffset + count], red, green, blue, 0);
red /= 2;
green /= 2;
blue /= 2;
polys += PolySizes[*polys];
count++;
}
// draw it's reflection
do
{
PlotSkyPoly((POLYFT4*)polys, *horizonTex++, red, green, blue);
polys += polySize;
} while (--count);
}
}
// [D] [T]
void DrawSkyDome(void)
{
VECTOR skyOfs = dummy;
skyOfs.vy = sky_y_offset[GameLevel];
gte_SetRotMatrix(&inv_camera_matrix);
gte_SetTransVector(&dummy);
gte_SetTransVector(&skyOfs);
calc_sky_brightness();
#ifdef PSX
// FIXME: use frustrum angle instead?
if (((camera_angle.vy - 1450U) & 0xFFF) > 2250)
if (((camera_angle.vy - 1450U) & 4095) > 2250)
PlotHorizonMDL(modelpointers[0], HorizonLookup[GameLevel][0]);
if (((camera_angle.vy - 651U) & 0xFFF) < 1799)
if (((camera_angle.vy - 651U) & 4095) < 1799)
PlotHorizonMDL(modelpointers[2], HorizonLookup[GameLevel][1]);
if (((camera_angle.vy - 1701U) & 0xFFF) < 1749)
if (((camera_angle.vy - 1701U) & 4095) < 1749)
PlotHorizonMDL(modelpointers[3], HorizonLookup[GameLevel][2]);
if (((camera_angle.vy - 400U) & 0xFFF) > 2300)
if (((camera_angle.vy - 400U) & 4095) > 2300)
PlotHorizonMDL(modelpointers[1], HorizonLookup[GameLevel][3]);
#else
// draw full sky - no need in frustrum culling

View File

@ -24,6 +24,45 @@
#include "camera.h"
#include "dr2roads.h"
struct SPOOLQ
{
u_char type;
u_char data;
u_short nsectors;
u_int sector;
char* addr;
void (*func)();
#ifdef _DEBUG
const char* requestby;
int requestbyline;
#endif
};
struct SPL_REGIONINFO
{
u_short region_to_unpack;
u_short target_barrel_region;
int nsectors;
char* cell_addr;
char* roadm_addr;
};
struct AreaDataStr
{
u_short gfx_offset;
u_short model_offset;
u_short music_offset;
u_short ambient_offset;
u_char model_size;
u_char pad;
u_char num_tpages;
u_char ambient_size;
u_char music_size;
u_char music_samples_size;
u_char music_id;
u_char ambient_id;
};
int date_date = 0xA11;
int date_time = 0x27220B;
@ -118,10 +157,7 @@ SPOOLQ spooldata[48];
#if USE_PC_FILESYSTEM
#define SIMPLE_SPOOL
extern int gContentOverride;
extern char g_CurrentLevelFileName[64];
#endif
#if defined(_DEBUG) || defined(PSX)
@ -357,7 +393,7 @@ void RequestSpool(int type, int data, int offset, int loadsize, char *address, s
next->type = type;
next->data = data;
next->sector = (SpoolLumpOffset / 2048) + offset;
next->sector = (SpoolLumpOffset / CDSECTOR_SIZE) + offset;
next->nsectors = loadsize;
next->addr = address;
next->func = func;
@ -744,7 +780,6 @@ void CheckLoadAreaData(int cellx, int cellz)
else if (/*spoolptr->super_region == 0xFF ||*/ nAreas == 0)
return;
// [A] Rev 1.1 patch
#define BOUNDARY_MIN 15
#define BOUNDARY_MAX 17
@ -806,14 +841,14 @@ void ClearRegion(int target_region)
ushort *cell_ptrs_s;
int loop;
loop = 1024;
cell_ptrs_s = cell_ptrs + target_region * 1024;
pvsptr = (int *)PVS_Buffers[target_region];
do {
for (loop = 0; loop < 1024; loop++)
{
*cell_ptrs_s++ = 0xffff;
*pvsptr++ = 0;
} while (--loop != 0);
}
ClearMem(PVS_Buffers[target_region]-4, pvsSize[target_region]);
@ -1016,7 +1051,7 @@ void ready_cb_textures(unsigned char intr, unsigned char *result)
{
CdGetSector(target_address, SECTOR_SIZE);
target_address += 2048;
target_address += CDSECTOR_SIZE;
sectors_this_chunk--;
current_sector++;
sectors_to_read--;
@ -1067,7 +1102,7 @@ void ready_cb_regions(unsigned char intr, unsigned char *result)
{
CdGetSector(target_address, SECTOR_SIZE);
target_address += 2048;
target_address += CDSECTOR_SIZE;
sectors_this_chunk--;
current_sector++;
sectors_to_read--;
@ -1182,7 +1217,7 @@ void ready_cb_misc(unsigned char intr, unsigned char *result)
{
CdGetSector(target_address, SECTOR_SIZE);
target_address += 2048;
target_address += CDSECTOR_SIZE;
sectors_to_read--;
current_sector++;
@ -1403,149 +1438,159 @@ void GotRegion(void)
}
}
// [D] [T]
void UpdateSpool(void)
{
#if USE_PC_FILESYSTEM && defined(SIMPLE_SPOOL)
if(strlen(g_CurrentLevelFileName) > 0)
{
FILE* fp = fopen(g_CurrentLevelFileName, "rb");
#if defined(SIMPLE_SPOOL)
extern char g_CurrentLevelFileName[64];
extern char* g_CurrentLevelSpoolData;
if (!fp)
{
#if !defined(__EMSCRIPTEN__)
char errPrint[1024];
sprintf(errPrint, "Cannot open '%s'\n", g_CurrentLevelFileName);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
#endif
return;
int UpdateSpoolPC(void)
{
if (g_CurrentLevelFileName[0] == 0)
return 0;
// read entire spool data
if (g_CurrentLevelSpoolData == NULL)
{
int SpoolLumpSize;
SpoolLumpSize = 16 * 1024 * 1024; // allocate 16 MB of RAM for spoolable data
g_CurrentLevelSpoolData = (char*)malloc(16 * 1024 * 1024);
loadsectors(g_CurrentLevelSpoolData, SpoolLumpOffset / CDSECTOR_SIZE, SpoolLumpSize);
}
for (; spoolpos_reading < spoolcounter; spoolpos_reading++)
{
char* spoolDataPtr;
SPOOLQ* current;
current = &spooldata[spoolpos_reading];
#define SPL_READ(dest, nsectors) \
{ \
int readSize = (nsectors)*CDSECTOR_SIZE; \
memcpy(dest, spoolDataPtr, readSize); \
spoolDataPtr += readSize; \
}
for (; spoolpos_reading < spoolcounter; spoolpos_reading++)
{
SPOOLQ* current = &spooldata[spoolpos_reading];
#ifdef _DEBUG
char* nameType;
switch (current->type)
{
case 0: // regions
nameType = "REGION";
break;
case 1: // textures
nameType = "TPAGE";
break;
case 2: // sbk
nameType = "SBK";
break;
case 3: // misc
nameType = "MISC";
break;
}
char* nameType;
switch (current->type)
{
case 0: // regions
nameType = "REGION";
break;
case 1: // textures
nameType = "TPAGE";
break;
case 2: // sbk
nameType = "SBK";
break;
case 3: // misc
nameType = "MISC";
break;
}
SPOOL_WARNING("spool type=%s cb=%d sec=%d cnt=%d id=%d\n", nameType, current->func ? 1 : 0, current->sector, current->nsectors, spoolpos_reading);
SPOOL_WARNING("spool type=%s cb=%d sec=%d cnt=%d id=%d\n", nameType, current->func ? 1 : 0, current->sector, current->nsectors, spoolpos_reading);
#endif // _DEBUG
// seek to required sector
fseek(fp, current->sector * 2048, SEEK_SET);
// seek to required sector
spoolDataPtr = g_CurrentLevelSpoolData - SpoolLumpOffset + current->sector * CDSECTOR_SIZE;
switch (current->type)
switch (current->type)
{
case 0: // regions
case 3: // misc
SPL_READ(current->addr, current->nsectors);
if (current->func)
current->func();
break;
case 1: // textures
// read cluts
nTPchunks = 0;
SPL_READ(current->addr + CDSECTOR_SIZE * 2 * 4, 1);
SendTPage();
nTPchunks++;
// read tpage (4 sectors 4 times = 16)
for (int i = 0; i < 4; i++)
{
case 0: // regions
fread(current->addr, 2048, current->nsectors, fp);
if (current->func)
current->func();
break;
case 1: // textures
// read cluts
nTPchunks = 0;
fread(current->addr + 0x4000, 2048, 1, fp);
SPL_READ(current->addr + (loadbank_write & 1U) * 256 * 32, 4);
SendTPage();
nTPchunks++;
// read tpage (4 sectors 4 times = 16)
for (int i = 0; i < 4; i++)
{
fread(current->addr + (loadbank_write & 1U) * 256 * 32, 2048, 4, fp);
SendTPage();
nTPchunks++;
}
break;
case 2: // sbk
// nothing to do with this
break;
case 3: // misc
fread(current->addr, 2048, current->nsectors, fp);
if (current->func)
current->func();
break;
}
break;
default:
break;
}
spoolcounter = 0;
spoolpos_reading = 0;
spoolactive = 0;
fclose(fp);
return;
#undef SPL_READ
}
spoolcounter = 0;
spoolpos_reading = 0;
spoolactive = 0;
return 1;
}
#endif
// [D] [T]
void UpdateSpool(void)
{
CdlLOC pos;
SPOOLQ* current;
SPOOLQ *current = &spooldata[spoolpos_reading];
#if defined(SIMPLE_SPOOL)
if (UpdateSpoolPC())
return;
#endif
if (!XAPrepared())
if (XAPrepared())
return;
current = &spooldata[spoolpos_reading];
target_address = current->addr;
if (current->type == 0) // SPOOLTYPE_REGIONS
{
target_address = current->addr;
sectors_this_chunk = current->nsectors;
sectors_to_read = spool_regioninfo[spool_regionpos].nsectors;
if (current->type == 0) // SPOOLTYPE_REGIONS
{
sectors_this_chunk = current->nsectors;
sectors_to_read = spool_regioninfo[spool_regionpos].nsectors;
CdDataCallback(data_cb_regions);
CdReadyCallback(ready_cb_regions);
}
else if (current->type == 1) // SPOOLTYPE_TEXTURES
{
nTPchunks_reading = 0;
nTPchunks_writing = 0;
sectors_to_read = 17;
ntpages = tsetcounter;
sectors_this_chunk = 1;
CdDataCallback(data_cb_textures);
CdReadyCallback(ready_cb_textures);
target_address += 0x4000;
}
else if (current->type == 3) // SPOOLTYPE_MISC
{
sectors_to_read = (current->nsectors);
CdDataCallback(data_cb_misc);
CdReadyCallback(ready_cb_misc);
}
current_sector = current->sector;
endchunk = 0;
switch_spooltype = 0;
// run sector reading
CdIntToPos(current_sector, &pos);
CdControlF(CdlReadS, (u_char*)&pos);
CdDataCallback(data_cb_regions);
CdReadyCallback(ready_cb_regions);
}
else if (current->type == 1) // SPOOLTYPE_TEXTURES
{
nTPchunks_reading = 0;
nTPchunks_writing = 0;
sectors_to_read = 17;
ntpages = tsetcounter;
sectors_this_chunk = 1;
CdDataCallback(data_cb_textures);
CdReadyCallback(ready_cb_textures);
target_address += 0x4000;
}
else if (current->type == 3) // SPOOLTYPE_MISC
{
sectors_to_read = (current->nsectors);
CdDataCallback(data_cb_misc);
CdReadyCallback(ready_cb_misc);
}
current_sector = current->sector;
endchunk = 0;
switch_spooltype = 0;
// run sector reading
CdIntToPos(current_sector, &pos);
CdControlF(CdlReadS, (u_char*)&pos);
}
// [D] [T]
@ -1616,14 +1661,16 @@ int RoadMapRegions[4];
// [D] [T]
void UnpackRegion(int region_to_unpack, int target_barrel_region)
{
if (loading_region[target_barrel_region] == -1)
if (loading_region[target_barrel_region] != -1)
{
if (LoadRegionData(region_to_unpack, target_barrel_region))
spool_regioncounter++;
regions_unpacked[target_barrel_region] = region_to_unpack;
RoadMapRegions[target_barrel_region] = region_to_unpack;
return;
}
if (LoadRegionData(region_to_unpack, target_barrel_region))
spool_regioncounter++;
regions_unpacked[target_barrel_region] = region_to_unpack;
RoadMapRegions[target_barrel_region] = region_to_unpack;
}
@ -1710,7 +1757,7 @@ void CleanModelSpooled(void)
}
// memcpy
while (loadaddr < (int*)(specLoadBuffer + 2048))
while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE))
*modelMemory++ = *loadaddr++;
mem = (int*)((int)gCarCleanModelPtr[4] + gCarCleanModelPtr[4]->poly_block); // [A] pls check, might be invalid
@ -1759,7 +1806,7 @@ void DamagedModelSpooled(void)
}
// memcpy
while (loadaddr < (int*)(specLoadBuffer + 2048))
while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE))
*modelMemory++ = *loadaddr++;
mem = (int*)((int)gCarDamModelPtr[4] + gCarDamModelPtr[4]->poly_block); // [A] pls check, might be invalid
@ -1771,7 +1818,7 @@ void DamagedModelSpooled(void)
{
// [A] vertices
LoadCarModelFromFile((char*)gCarDamModelPtr[4], MissionHeader->residentModels[4], CAR_MODEL_DAMAGED);
}
}
#endif
specBlocksToLoad = 0;
@ -1806,7 +1853,7 @@ void LowModelSpooled(void)
}
// memcpy
while (loadaddr < (int*)(specLoadBuffer + 2048))
while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE))
*modelMemory++ = *loadaddr++;
mem = (int*)((int)gCarLowModelPtr[4] + gCarLowModelPtr[4]->poly_block); // [A] pls check, might be invalid
@ -1850,7 +1897,7 @@ void CleanSpooled(void)
int size_2 = ((int *)specmallocptr)[1];
int size_3 = ((int *)specmallocptr)[2];
lastCleanBlock = size_1 + 2048 + 11;
lastCleanBlock = size_1 + CDSECTOR_SIZE + 11;
lastCleanBlock >>= 11;
firstDamBlock = size_1 + 12;
@ -1859,17 +1906,17 @@ void CleanSpooled(void)
firstLowBlock = size_1 + size_2 + 12;
firstLowBlock >>= 11;
int lastDamBlock = size_1 + size_2 + 2048 + 11;
int lastDamBlock = size_1 + size_2 + CDSECTOR_SIZE + 11;
lastDamBlock >>= 11;
lengthDamBlock = lastDamBlock - firstDamBlock;
damOffset = size_1 - (firstDamBlock * 2048 - 12);
damOffset = size_1 - (firstDamBlock * CDSECTOR_SIZE - 12);
int lastLowBlock = size_1 + size_2 + size_3 + 2048 + 11;
int lastLowBlock = size_1 + size_2 + size_3 + CDSECTOR_SIZE + 11;
lastLowBlock >>= 11;
lengthLowBlock = lastLowBlock - firstLowBlock;
lowOffset = size_1 + size_2 - (firstLowBlock * 2048 - 12);
lowOffset = size_1 + size_2 - (firstLowBlock * CDSECTOR_SIZE - 12);
}
model = (MODEL *)(specmallocptr + 12);
@ -2030,7 +2077,7 @@ void SpecialStartNextBlock(void)
specialState++;
}
fileSector = 0x1400 + (citystart[GameLevel] - SpoolLumpOffset / 2048) + (specspooldata[2]-1) * 42;
fileSector = 0x1400 + (citystart[GameLevel] - SpoolLumpOffset / CDSECTOR_SIZE) + (specspooldata[2]-1) * 42;
switch (specialState)
{
@ -2052,12 +2099,12 @@ void SpecialStartNextBlock(void)
case 5:
spoolFunc = CleanSpooled;
fileSector += (41 - specBlocksToLoad);
loadaddr = specmallocptr + (7 - specBlocksToLoad) * 2048;
loadaddr = specmallocptr + (7 - specBlocksToLoad) * CDSECTOR_SIZE;
break;
case 6:
spoolFunc = LowSpooled;
fileSector += ((firstLowBlock + lengthLowBlock) - specBlocksToLoad) + 34;
loadaddr = specmallocptr + (lengthLowBlock - specBlocksToLoad) * 2048;
loadaddr = specmallocptr + (lengthLowBlock - specBlocksToLoad) * CDSECTOR_SIZE;
break;
case 7:
spoolFunc = CleanModelSpooled;

View File

@ -1,6 +1,18 @@
#ifndef SPOOL_H
#define SPOOL_H
struct Spool
{
u_short offset;
u_char connected_areas[2];
u_char pvs_size;
u_char cell_data_size[3];
u_char super_region;
u_char num_connected_areas;
u_char roadm_size;
u_char roadh_size;
};
extern int cell_objects_add[5];
extern int cell_slots_add[5];

View File

@ -170,6 +170,7 @@ XYPAIR citylumps[8][4];
#ifndef PSX
int gContentOverride = 1; // use unpacked filesystem?
char g_CurrentLevelFileName[64];
char* g_CurrentLevelSpoolData = NULL;
#endif // !PSX
// TODO: to game vars
@ -373,7 +374,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize)
int remainingOffset;
int sector;
u_char result[8];
char sectorbuffer[2048];
char sectorbuffer[CDSECTOR_SIZE];
CdlLOC pos;
sprintf(namebuffer, "\\%s%s;1", gDataFolder, name);
@ -395,7 +396,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize)
remainingBytes = loadsize;
// seek to the sector
sector = offset / 2048 + CdPosToInt(&currentfileinfo.pos);
sector = offset / CDSECTOR_SIZE + CdPosToInt(&currentfileinfo.pos);
// start reading sectors from CD
while(remainingBytes > 0)
@ -405,7 +406,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize)
// if we don't have offset or we have more than 2048 bytes
// - we can read into buffer directly (which is faster)
if (remainingBytes >= 2048 && remainingOffset == 0)
if (remainingBytes >= CDSECTOR_SIZE && remainingOffset == 0)
sectorPtr = addr;
else
sectorPtr = sectorbuffer;
@ -428,7 +429,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize)
// copy bytes
while (remainingBytes > 0 &&
readPtr - sectorbuffer < 2048) // don't leave boundary
readPtr - sectorbuffer < CDSECTOR_SIZE) // don't leave boundary
{
*addr++ = *readPtr++;
remainingBytes--;
@ -438,8 +439,8 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize)
}
else
{
addr += 2048;
remainingBytes -= 2048;
addr += CDSECTOR_SIZE;
remainingBytes -= CDSECTOR_SIZE;
}
// go to next sector
@ -499,7 +500,7 @@ void sector_ready(u_char intr, u_char* result)
// read sector data
CdGetSector(current_address, SECTOR_SIZE);
current_address += 2048;
current_address += CDSECTOR_SIZE;
current_sector++;
sectors_left--;
@ -528,6 +529,48 @@ void sector_ready(u_char intr, u_char* result)
}
}
#if USE_PC_FILESYSTEM
// It has to be this way
int loadsectorsPC(char* addr, int sector, int nsectors)
{
char namebuffer[64];
if (g_CurrentLevelFileName[0] == 0)
return 0;
strcpy(namebuffer, g_CurrentLevelFileName);
FS_FixPathSlashes(namebuffer);
FILE* fp = fopen(namebuffer, "rb");
if (fp)
{
// constrain nsectors to the maximum that can be read from the file
int maxSectors;
fseek(fp, 0, SEEK_END);
maxSectors = (ftell(fp) - (sector * CDSECTOR_SIZE)) / CDSECTOR_SIZE;
nsectors = MIN(nsectors, maxSectors);
fseek(fp, sector * CDSECTOR_SIZE, SEEK_SET);
fread(addr, CDSECTOR_SIZE, nsectors, fp);
fclose(fp);
ShowLoading();
return 1;
}
#if USE_PC_FILESYSTEM && !defined(__EMSCRIPTEN__)
char errPrint[512];
sprintf(errPrint, "loadsectorsPC: failed to open '%s'\n", namebuffer);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
#endif // USE_PC_FILESYSTEM && !PSX
return 0;
}
#endif // USE_PC_FILESYSTEM
// [D] [T]
void loadsectors(char* addr, int sector, int nsectors)
{
@ -537,6 +580,11 @@ void loadsectors(char* addr, int sector, int nsectors)
if (nsectors == 0)
return;
#if USE_PC_FILESYSTEM
if (loadsectorsPC(addr, sector, nsectors))
return;
#endif
load_complete = 0;
endread = 0;
@ -561,39 +609,6 @@ void loadsectors(char* addr, int sector, int nsectors)
ShowLoading();
}
#if USE_PC_FILESYSTEM
// It has to be this way
void loadsectorsPC(char* filename, char* addr, int sector, int nsectors)
{
char namebuffer[64];
strcpy(namebuffer, filename);
FS_FixPathSlashes(namebuffer);
FILE* fp = fopen(namebuffer, "rb");
if (fp)
{
fseek(fp, sector * CDSECTOR_SIZE, SEEK_SET);
fread(addr, CDSECTOR_SIZE, nsectors, fp);
fclose(fp);
ShowLoading();
return;
}
#if USE_CD_FILESYSTEM
// try using CD
loadsectors(addr, sector, nsectors);
#elif !defined(__EMSCRIPTEN__)
char errPrint[512];
sprintf(errPrint, "loadsectorsPC: failed to open '%s'\n", namebuffer);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
#endif // USE_CD_FILESYSTEM
}
#endif // USE_PC_FILESYSTEM
// [D] [T]
void EnableDisplay(void)
{
@ -638,16 +653,16 @@ void SwapDrawBuffers(void)
PutDrawEnv(&current->draw);
DrawOTag((u_long*)(current->ot + OTSIZE-1));
if ((FrameCnt & 1U) == 0)
{
current = &MPBuff[0][1];
last = &MPBuff[0][0];
}
else
if ((FrameCnt & 1) != 0)
{
current = &MPBuff[0][0];
last = &MPBuff[0][1];
}
else
{
current = &MPBuff[0][1];
last = &MPBuff[0][0];
}
ClearCurrentDrawBuffers();
}
@ -709,15 +724,16 @@ void SetupDrawBuffers(void)
int i;
RECT16 rect;
SetDefDispEnv(&MPBuff[0][0].disp, 0, 256, 320, 256);
SetDefDispEnv(&MPBuff[0][1].disp, 0, 0, 320, 256);
// PAL: 256
// NTSC: 240
MPBuff[0][0].disp.screen.h = 256;
MPBuff[0][1].disp.screen.h = 256;
SetDefDispEnv(&MPBuff[0][0].disp, 0, 256, 320, SCREEN_H);
SetDefDispEnv(&MPBuff[0][1].disp, 0, 0, 320, SCREEN_H);
MPBuff[0][0].disp.screen.h = SCREEN_H;
MPBuff[0][1].disp.screen.h = SCREEN_H;
MPBuff[0][0].disp.screen.x = draw_mode.framex;
MPBuff[0][1].disp.screen.x = draw_mode.framex;
MPBuff[0][0].disp.screen.y = draw_mode.framey;
MPBuff[0][1].disp.screen.y = draw_mode.framey;
if (NoPlayerControl == 0)
SetupDrawBufferData(NumPlayers);
@ -745,17 +761,14 @@ void SetupDrawBuffers(void)
// [D] [T]
void SetupDrawBufferData(int num_players)
{
int i;
int j;
int x[2];
int y[2];
int width, height;
int i, j;
int x[2], y[2];
int height;
int toggle;
if (num_players == 1)
{
width = 320;
height = 256;
height = SCREEN_H; // 240 on NTSC
x[0] = 0;
y[0] = 0;
x[1] = 0;
@ -763,19 +776,18 @@ void SetupDrawBufferData(int num_players)
}
else if (num_players == 2)
{
width = 320;
height = 127;
height = (SCREEN_H / 2 - 1); // 127; // 119 on NTSC
x[0] = 0;
y[0] = 0;
x[1] = 0;
y[1] = 128;
y[1] = SCREEN_H / 2; // 120 on NTSC
}
else
{
D_CHECK_ERROR(true, "Erm... too many players selected. FATAL!");
}
SetGeomOffset(width / 2, height / 2);
SetGeomOffset(320 / 2, height / 2);
toggle = 0;
@ -785,46 +797,50 @@ void SetupDrawBufferData(int num_players)
{
u_long* otpt;
u_char* primpt;
u_char* PRIMpt;
if (toggle)
{
otpt = (u_long*)_OT2;
primpt = PRIMpt = (u_char*)_primTab2;
primpt = (u_char*)_primTab2; // _primTab1 + PRIMTAB_SIZE
}
else
{
otpt = (u_long*)_OT1;
primpt = PRIMpt = (u_char*)_primTab1;
primpt = (u_char*)_primTab1;
}
toggle ^= 1;
InitaliseDrawEnv(MPBuff[j], x[j], y[j], width, height);
InitaliseDrawEnv(MPBuff[j], x[j], y[j], 320, height);
MPBuff[j][i].primtab = (char*)primpt;
MPBuff[j][i].primptr = (char*)PRIMpt;
MPBuff[j][i].ot = (OTTYPE*)otpt;
MPBuff[i][j].primtab = (char*)primpt;
MPBuff[i][j].primptr = (char*)primpt;
MPBuff[i][j].ot = (OTTYPE*)otpt;
}
}
aspect.m[0][0] = 4096;
aspect.m[0][1] = 0;
aspect.m[0][2] = 0;
aspect.m[1][0] = 0;
aspect.m[1][1] = 4710;
aspect.m[1][2] = 0;
aspect.m[2][0] = 0;
aspect.m[2][1] = 0;
aspect.m[2][2] = 4096;
#ifdef PAL_VERSION
InitMatrix(aspect);
aspect.m[1][1] = 4300;
#else
InitMatrix(aspect);
aspect.m[1][1] = 4096;
#endif
}
// [D] [T]
void InitaliseDrawEnv(DB* pBuff, int x, int y, int w, int h)
{
SetDefDrawEnv(&pBuff[0].draw, x, y + 256, w, h);
SetDefDrawEnv(&pBuff[1].draw, x, y, w, h);
#ifdef PSX
#define DB1 pBuff[0]
#define DB2 pBuff[1]
#else
// on PsyX we have to prevent flicker
#define DB1 pBuff[1]
#define DB2 pBuff[0]
#endif
SetDefDrawEnv(&DB1.draw, x, y, w, h);
SetDefDrawEnv(&DB2.draw, x, y + 256, w, h);
pBuff[0].id = 0;
pBuff[0].draw.dfe = 1;
@ -849,6 +865,11 @@ void ResetCityType(void)
{
lasttype = (CITYTYPE)-1;
lastcity = -1;
#ifndef PSX
free(g_CurrentLevelSpoolData);
g_CurrentLevelSpoolData = NULL;
#endif // PSX
}
// [A]
@ -867,6 +888,8 @@ void SetCityType(CITYTYPE type)
if (type == lasttype && GameLevel == lastcity)
return;
ResetCityType();
lastcity = GameLevel;
lasttype = type;
@ -898,11 +921,11 @@ void SetCityType(CITYTYPE type)
// store level name as it's required by loadsectorsPC
strcpy(g_CurrentLevelFileName, filename);
// spool position is forced to 0
citystart[GameLevel] = 0;
// skip LUMP type (37) and size, it's already hardcoded
fseek(levFp, 8, SEEK_CUR);
fread(citylumps[GameLevel], 1, sizeof(citylumps[GameLevel]), levFp);
fclose(levFp);
@ -937,7 +960,16 @@ void SetCityType(CITYTYPE type)
while (CdSearchFile(&cdfile, filename) == NULL)
{
#if USE_PC_FILESYSTEM
#ifndef __EMSCRIPTEN__
char errPrint[512];
sprintf(errPrint, "SetCityType: failed to open '%s'\n", filename);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
exit(0);
#endif // !__EMSCRIPTEN__
#else
DoCDRetry();
#endif // USE_PC_FILESYSTEM
}
sector = CdPosToInt((CdlLOC*)&cdfile);
@ -958,18 +990,16 @@ void SetCityType(CITYTYPE type)
for (i = 0; i < 4; i++)
{
citylumps[GameLevel][i].x = data[0] + sector * 2048;
citylumps[GameLevel][i].x = data[0] + sector * CDSECTOR_SIZE;
citylumps[GameLevel][i].y = data[1];
data += 2;
}
#elif USE_PC_FILESYSTEM && !defined(__EMSCRIPTEN__)
char errPrint[1024];
sprintf(errPrint, "SetCityType: cannot open level '%s'\n", filename);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
#endif // PSX
}

View File

@ -1,6 +1,32 @@
#ifndef SYSTEM_H
#define SYSTEM_H
struct DRAW_MODE
{
short x1, y1;
short x2, y2;
short width, height;
short framex, framey;
};
enum CDTYPE
{
CDTYPE_NODISC = 0,
CDTYPE_SHELLOPEN = 1,
CDTYPE_DISCERROR = 2,
CDTYPE_WRONGDISC = 3,
CDTYPE_CORRECTDISC = 4,
};
enum CITYTYPE
{
CITYTYPE_DAY = 0,
CITYTYPE_NIGHT = 1,
CITYTYPE_MULTI_DAY = 2,
CITYTYPE_MULTI_NIGHT = 3,
};
extern volatile char* _overlay_buffer; // 0x1C0000
extern volatile char* _frontend_buffer; // 0xFB400
extern volatile char* _other_buffer; // 0xF3000
@ -40,7 +66,7 @@ extern void sys_freeall();
#endif
#else
#define D_MALLOC(size) (char*)mallocptr; mallocptr += (size);// (char*)((int)mallocptr + size + 3 & 0xfffffffc);
#define D_MALLOC(size) (char*)mallocptr; mallocptr += (((size) + 3) & -4);
#define D_TEMPALLOC(size) (char*)mallocptr
#define D_TEMPFREE()
#endif
@ -86,13 +112,26 @@ struct DB
DISPENV disp;
};
extern DRAW_MODE draw_mode_pal;
extern DRAW_MODE draw_mode_ntsc;
extern DB MPBuff[2][2];
extern DB* last;
extern DB* current;
extern DRAW_MODE draw_mode_pal;
extern DRAW_MODE draw_mode_ntsc;
#define SCREEN_FB 512
#define SCREEN_FB_H 256
#ifdef PAL_VERSION
#define SCREEN_H 256
#define draw_mode draw_mode_pal
#define video_mode MODE_PAL
#else
#define SCREEN_H 240
#define draw_mode draw_mode_ntsc
#define video_mode MODE_NTSC
#endif // PAL
// ordering table size
#ifdef PSX
#define OTSIZE 0x1080
@ -114,14 +153,6 @@ extern DB* current;
extern int citystart[8];
extern XYPAIR citylumps[8][4];
#ifdef PAL_VERSION
#define draw_mode draw_mode_pal
#define video_mode MODE_PAL
#else
#define draw_mode draw_mode_ntsc
#define video_mode MODE_NTSC
#endif // PAL
#define CDSECTOR_SIZE 2048
extern void ClearMem(char *mem, int size); // 0x0007F3E8
@ -136,11 +167,7 @@ extern int LoadfileSeg(char *name, char *addr, int offset, int loadsize); // 0x0
extern void ReportMode(int on); // 0x0007F8B8
#ifdef PSX
extern void loadsectors(char *addr, int sector, int nsectors); // 0x0007F904
#else
extern void loadsectorsPC(char* filename, char *addr, int sector, int nsectors);
#endif // PSX
extern void EnableDisplay(); // 0x0007F984
extern void DisableDisplay(); // 0x0007F9F0

View File

@ -484,11 +484,7 @@ void LoadPermanentTPages(int *sector)
for (i = 0; i < nperms; i++)
nsectors += (permlist[i].y + 2047) / CDSECTOR_SIZE;
#ifdef PSX
loadsectors(tpagebuffer, *sector, nsectors);
#else
loadsectorsPC(g_CurrentLevelFileName, tpagebuffer, *sector, nsectors);
#endif // PSX
*sector += nsectors;
@ -532,12 +528,7 @@ void LoadPermanentTPages(int *sector)
for (i = 0; i < nspecpages; i++)
nsectors += (speclist[i].y + 2047) / CDSECTOR_SIZE;
#ifdef PSX
loadsectors(tpagebuffer, *sector, nsectors);
#else
loadsectorsPC(g_CurrentLevelFileName, tpagebuffer, *sector, nsectors);
#endif // PSX
*sector += nsectors;

View File

@ -1,18 +1,17 @@
#include "driver2.h"
#include "tile.h"
#include "models.h"
#include "system.h"
#include "mission.h"
#include "draw.h"
#include "texture.h"
#include "tile.h"
#include "ASM/rndrasm.h"
// [D] [T] [A]
void Tile1x1(MODEL *model)
{
int opz;
int Z;
int opz, Z;
int ofse;
PL_POLYFT4* polys;
int i;
@ -24,7 +23,7 @@ void Tile1x1(MODEL *model)
polys = (PL_POLYFT4*)model->poly_block;
// grass should be under pavements and other things
if ((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & 0x4000))
if ((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & MODEL_FLAG_GRASS))
ofse = 229;
else
ofse = 133;
@ -34,7 +33,7 @@ void Tile1x1(MODEL *model)
#endif
i = model->num_polys;
while (i > 0)
while (i-- > 0)
{
// iterate through polygons
// with skipping
@ -81,7 +80,6 @@ void Tile1x1(MODEL *model)
}
polys = (PL_POLYFT4*)((char*)polys + plotContext.polySizes[ptype]);
i--;
}
#ifdef USE_PGXP
@ -97,21 +95,19 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
{
MODEL* pModel;
PACKED_CELL_OBJECT *ppco;
int yang, dofse;
PACKED_CELL_OBJECT** tilePointers;
int previous_matrix, yang, dofse, Z;
int model_number;
PACKED_CELL_OBJECT **tilePointers;
int previous_matrix;
int Z;
if (gTimeOfDay > -1)
{
if (gTimeOfDay < 3)
{
plotContext.colour = combointensity & 0xffffffU | 0x2c000000;
plotContext.colour = combointensity & 0xffffffU | 0x2C000000;
}
else if (gTimeOfDay == 3)
{
plotContext.colour = ((combointensity >> 16 & 0xFF) / 3) << 16 | ((combointensity >> 8 & 0xFF) / 3) << 8 | (combointensity & 0xFF) / 3 | 0x2c000000U;
plotContext.colour = ((combointensity >> 16 & 255) / 3) << 16 | ((combointensity >> 8 & 255) / 3) << 8 | (combointensity & 255) / 3 | 0x2C000000U;
}
}
@ -121,11 +117,9 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
{
u_int col;
col = plotContext.colour >> 2 & 0x3f;
plotContext.colour = col * 0x30000 | col * 0x300 | col * 3 | 0x2c000000;
plotContext.colour = col * 0x30000 | col * 0x300 | col * 3 | 0x2C000000;
}
tile_amount--;
plotContext.ot = current->ot;
plotContext.current = current;
plotContext.primptr = current->primptr;
@ -137,16 +131,14 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
tilePointers = (PACKED_CELL_OBJECT **)tiles;
while (tile_amount != -1)
while (tile_amount--)
{
ppco = *tilePointers;
ppco = *tilePointers++;
plotContext.f4colourTable[6] = ppco->pos.vx;
plotContext.f4colourTable[7] = (ppco->pos.vy << 0x10) >> 0x11;
plotContext.f4colourTable[8] = ppco->pos.vz;
tilePointers++;
yang = ppco->value & 0x3f;
model_number = (ppco->value >> 6) | (ppco->pos.vy & 1) << 10;
@ -156,8 +148,7 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
}
else
{
Z = Apply_InvCameraMatrixAndSetMatrix((VECTOR_NOPAD *)(plotContext.f4colourTable + 6), &CompoundMatrix[yang]);
previous_matrix = yang;
Z = Apply_InvCameraMatrixAndSetMatrix((VECTOR_NOPAD *)(plotContext.f4colourTable + 6), &CompoundMatrix[previous_matrix = yang]);
}
if (Z <= DRAW_LOD_DIST_HIGH)
@ -165,10 +156,12 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
if (Low2HighDetailTable[model_number] != 0xffff)
model_number = Low2HighDetailTable[model_number];
pModel = modelpointers[model_number];
if (Z < 2000)
TileNxN(modelpointers[model_number], 4, 75);
TileNxN(pModel, 4, 75);
else
TileNxN(modelpointers[model_number], 2, 35);
TileNxN(pModel, 2, 35);
}
else
{
@ -176,8 +169,6 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
Tile1x1(pModel);
}
tile_amount--;
}
current->primptr = plotContext.primptr;
}
@ -300,8 +291,7 @@ void makeMesh(MVERTEX(*VSP)[5][5], int m, int n)
void drawMesh(MVERTEX(*VSP)[5][5], int m, int n, _pct *pc)
{
POLY_FT4* prim;
int z;
int opz;
int z, opz;
prim = (POLY_FT4*)pc->primptr;
@ -401,58 +391,56 @@ void SubdivNxM(char *polys, int n, int m, int ofse)
// [D] [T]
void TileNxN(MODEL *model, int levels, int Dofse)
{
u_int ttype;
u_int ttype, tileTypes;
u_char *polys;
u_int tileTypes;
int i;
int ofse;
ttype = 0;
polys = (u_char *)model->poly_block;
plotContext.verts = (SVECTOR *)model->vertices;
// tile types comes right after model header it seems
// WEIRD: tile types comes right after model header it seems
tileTypes = *(u_int *)(model + 1) >> 2;
// grass should be under pavements and other things
if((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & 0x4000))
if((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & MODEL_FLAG_GRASS))
ofse = 229;
else
ofse = 133;
i = 0;
int _m[5] = {
levels, levels, 0, 1, levels
};
int _ofse[5] = {
ofse, ofse, 0, Dofse, 133
};
while (i < model->num_polys)
i = model->num_polys;
ttype = 0;
while (i--)
{
switch (ttype)
#ifdef USE_PGXP
switch (ttype)
{
case 0:
case 1:
#ifdef USE_PGXP
PGXP_SetZOffsetScale(0.0f, ofse > 200 ? 1.008f : 0.995f);
#endif
SubdivNxM((char *)polys, levels, levels, ofse);
break;
case 3:
#ifdef USE_PGXP
PGXP_SetZOffsetScale(0.0f, ofse < 40 ? 1.0f : 0.991f);
#endif
SubdivNxM((char *)polys, levels, 1, Dofse);
break;
case 4:
#ifdef USE_PGXP
PGXP_SetZOffsetScale(0.0f, 1.0f);
#endif
SubdivNxM((char *)polys, levels, levels, 133);
break;
case 0:
case 1:
PGXP_SetZOffsetScale(0.0f, ofse > 200 ? 1.008f : 0.995f);
break;
case 3:
PGXP_SetZOffsetScale(0.0f, ofse < 40 ? 1.0f : 0.991f);
break;
case 4:
PGXP_SetZOffsetScale(0.0f, 1.0f);
break;
}
#endif
SubdivNxM((char*)polys, levels, _m[ttype], _ofse[ttype]);
ttype = tileTypes & 7;
tileTypes >>= 3;
polys += plotContext.polySizes[*polys];
i++;
}
#ifdef USE_PGXP

View File

@ -1,6 +1,27 @@
#ifndef TILE_H
#define TILE_H
struct MVERTEX
{
short vx;
short vy;
short vz;
union {
short val;
struct {
u_char u0;
u_char v0;
}s;
}uv;
};
struct VERTEX
{
DVECTOR coord;
UV_INFO uv_coord;
u_char pad[2];
};
extern void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount); // 0x00041D7C
extern void Tile1x1(MODEL *model); // 0x00041B10

View File

@ -253,7 +253,7 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl)
friction_coef = (newCompression * (32400 - wetness) >> 15) + 500;
if (SurfacePtr != NULL)
wheel->onGrass = SurfacePtr->surface == 4;
wheel->onGrass = SurfacePtr->surface == SURF_GRASS;
else
wheel->onGrass = 0;
@ -261,10 +261,10 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl)
{
switch (SurfacePtr->surface)
{
case 4:
case 6:
case 9:
case 11:
case SURF_GRASS:
case SURF_WATER:
case SURF_DEEPWATER:
case SURF_SAND:
wheel->surface = 0x80;
break;
default:
@ -277,14 +277,14 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl)
switch (SurfacePtr->surface)
{
case 8:
case SURF_ALLEY:
wheel->surface |= 0x2;
break;
case 6:
case 9:
case SURF_WATER:
case SURF_DEEPWATER:
wheel->surface |= 0x1;
break;
case 11:
case SURF_SAND:
wheel->surface |= 0x3;
break;
}
@ -697,7 +697,7 @@ void StepOneCar(CAR_DATA* cp)
Setup_Debris((VECTOR*)&deepestPoint, &direction, 10, 0);
}
if (SurfacePtr && (SurfacePtr->surface != 9) && (SurfacePtr->surface != 6))
if (SurfacePtr && (SurfacePtr->surface != SURF_DEEPWATER) && (SurfacePtr->surface != SURF_WATER))
{
CollisionSound(GetPlayerId(cp), cp, (impulse / 6 + (impulse >> 0x1f) >> 3) - (impulse >> 0x1f), 0);
}

View File

@ -530,7 +530,7 @@ void SetVariable(int var)
if (value == 0)
{
// [A] save configuration
SaveCurrentProfile();
SaveCurrentProfile(1);
}
else
{
@ -1227,19 +1227,19 @@ void NewSelection(short dir)
addPrim(current->ot + 9, &In);
#endif
if ((dir & 0x1000) != 0)
if ((dir & MPAD_D_UP) != 0)
{
btn = pCurrButton->u;
}
else if ((dir & 0x4000) != 0)
else if ((dir & MPAD_D_DOWN) != 0)
{
btn = pCurrButton->d;
}
else if ((dir & 0x8000) != 0)
else if ((dir & MPAD_D_LEFT) != 0)
{
btn = pCurrButton->l;
}
else if ((dir & 0x2000) != 0)
else if ((dir & MPAD_D_RIGHT) != 0)
{
btn = pCurrButton->r;
}
@ -1293,7 +1293,7 @@ int HandleKeyPress(void)
}
}
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
int action = pCurrButton->action >> 8;
@ -1347,7 +1347,7 @@ int HandleKeyPress(void)
}
}
}
else if (feNewPad & 0x10)
else if (feNewPad & MPAD_TRIANGLE)
{
if (ScreenDepth > 0)
{
@ -1370,7 +1370,7 @@ int HandleKeyPress(void)
else
{
// any d-pad buttons pressed?
if ((feNewPad & (0x8000 | 0x4000 | 0x2000 | 0x1000)) != 0)
if ((feNewPad & (MPAD_D_UP | MPAD_D_RIGHT | MPAD_D_DOWN | MPAD_D_LEFT)) != 0)
{
NewSelection(feNewPad);
}
@ -1416,7 +1416,7 @@ void PadChecks(void)
#ifndef PSX
// [A] quit to system
if(feNewPad & 0x10)
if(feNewPad & MPAD_TRIANGLE)
{
if(ScreenDepth == 0)
{
@ -1427,7 +1427,7 @@ void PadChecks(void)
if(bQuitToSystem)
{
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
if(bQuitToSystemSel == 1)
bQuitToSystem = 2;
@ -1436,7 +1436,7 @@ void PadChecks(void)
FESound(2);
}
else if ((feNewPad & 0x8000) || (feNewPad & 0x2000))
else if ((feNewPad & MPAD_D_LEFT) || (feNewPad & MPAD_D_RIGHT))
{
bQuitToSystemSel += 1;
bQuitToSystemSel &= 1;
@ -1607,7 +1607,7 @@ void State_FrontEnd(void* param)
{
if (Pads[1].type < 2)
{
feNewPad = ((feNewPad & 0x10) != 0) ? 0x10 : 0;
feNewPad = ((feNewPad & MPAD_TRIANGLE) != 0) ? MPAD_TRIANGLE : 0;
}
else
{
@ -1761,9 +1761,7 @@ int FEPrintString(char *string, int x, int y, int justification, int r, int g, i
pFontInfo = &feFont.CharInfo[let];
setSprt(font);
#ifdef PSX
setSemiTrans(font, 1);
#endif
setRGB0(font, r, g, b);
setXY0(font, x, y);
@ -1833,9 +1831,7 @@ int FEPrintStringSized(char *string, int x, int y, int scale, int transparent, i
h = (pFontInfo->h * scale) / 4096;
setPolyFT4(font);
#ifdef PSX
setSemiTrans(font, transparent);
#endif
setSemiTrans(font, transparent);
setRGB0(font, 128, 128, 128);
setUVWH(font, pFontInfo->u, pFontInfo->v, pFontInfo->w - 1, pFontInfo->h - 1);
@ -1883,14 +1879,14 @@ int CentreScreen(int bSetup)
FEPrintStringSized(text, 25, 75, 0xC00, 0, 128, 0, 0);
#endif
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
draw_mode_pal.framex = current->disp.screen.x / 2;
draw_mode_pal.framey = current->disp.screen.y;
draw_mode_ntsc.framex = current->disp.screen.x / 2;
draw_mode_ntsc.framey = current->disp.screen.y;
}
else if (feNewPad & 0x10)
else if (feNewPad & MPAD_TRIANGLE)
{
current->disp.screen.x = draw_mode.framex * 2;
current->disp.screen.y = draw_mode.framey;
@ -1901,7 +1897,7 @@ int CentreScreen(int bSetup)
{
bool done = false;
if (feNewPad & 0x1000)
if (feNewPad & MPAD_D_UP)
{
if (current->disp.screen.y >= screen_limits[video_mode].miny)
{
@ -1910,7 +1906,7 @@ int CentreScreen(int bSetup)
done = true;
}
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
if (current->disp.screen.y <= screen_limits[video_mode].maxy)
{
@ -1919,7 +1915,7 @@ int CentreScreen(int bSetup)
done = true;
}
}
else if (feNewPad & 0x8000)
else if (feNewPad & MPAD_D_LEFT)
{
if (current->disp.screen.x >= screen_limits[video_mode].minx)
{
@ -1928,7 +1924,7 @@ int CentreScreen(int bSetup)
done = true;
}
}
else if (feNewPad & 0x2000)
else if (feNewPad & MPAD_D_RIGHT)
{
if (current->disp.screen.x <= screen_limits[video_mode].maxx)
{
@ -1966,17 +1962,10 @@ int CarSelectScreen(int bSetup)
// setup secret cars
if (NumPlayers == 1)
{
#if defined(DEBUG_OPTIONS) || defined(_DEBUG)
CarAvailability[0][9] = 1;
CarAvailability[1][9] = 1;
CarAvailability[2][9] = 1;
CarAvailability[3][9] = 1;
#else
CarAvailability[0][9] = AvailableCheats.cheat5;
CarAvailability[1][9] = AvailableCheats.cheat6;
CarAvailability[2][9] = AvailableCheats.cheat7;
CarAvailability[3][9] = AvailableCheats.cheat8;
#endif
}
// setup unlockable cars
@ -2049,7 +2038,7 @@ int CarSelectScreen(int bSetup)
return 1;
}
if (feNewPad & 0x10)
if (feNewPad & MPAD_TRIANGLE)
{
FESound(0);
bDoneAllready = 1;
@ -2076,7 +2065,7 @@ int CarSelectScreen(int bSetup)
iScreenSelect = SCREEN_NONE;
}
else if (feNewPad & 0x40)
else if (feNewPad & MPAD_CROSS)
{
if (currSelIndex == 0)
{
@ -2136,11 +2125,11 @@ int CarSelectScreen(int bSetup)
EndFrame();
#endif
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currSelIndex = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currSelIndex = pCurrButton->d - 1;
}
@ -2157,15 +2146,15 @@ int CopDiffLevelScreen(int bSetup)
return 1;
}
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
gCopDifficultyLevel = currSelIndex;
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currSelIndex = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currSelIndex = pCurrButton->d - 1;
}
@ -2183,15 +2172,15 @@ int VibroOnOffScreen(int bSetup)
return 1;
}
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
gVibration = (currSelIndex ^ 1);
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currSelIndex = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currSelIndex = pCurrButton->d - 1;
}
@ -2376,7 +2365,7 @@ int MissionSelectScreen(int bSetup)
return 1;
}
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
i = currMission;
@ -2413,16 +2402,16 @@ int MissionSelectScreen(int bSetup)
return 1;
}
else if (feNewPad & 0x10)
else if (feNewPad & MPAD_TRIANGLE)
{
missionSetup = 0;
iScreenSelect = SCREEN_NONE;
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currSelIndex = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currSelIndex = pCurrButton->d - 1;
}
@ -2489,7 +2478,7 @@ int MissionCityScreen(int bSetup)
return 0;
}
if (feNewPad & 0x10)
if (feNewPad & MPAD_TRIANGLE)
{
// BUGFIX: unload city image
loaded[0] = -1;
@ -2501,11 +2490,11 @@ int MissionCityScreen(int bSetup)
}
else
{
if (feNewPad & 0x1000)
if (feNewPad & MPAD_D_UP)
{
currCity = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currCity = pCurrButton->d - 1;
}
@ -2578,12 +2567,12 @@ int CutSceneSelectScreen(int bSetup)
return 1;
}
if (feNewPad & 0x10)
if (feNewPad & MPAD_TRIANGLE)
{
bDrawExtra = 0;
iScreenSelect = SCREEN_NONE;
}
else if (feNewPad & 0x40)
else if (feNewPad & MPAD_CROSS)
{
if (currSelIndex == 0)
{
@ -2642,11 +2631,11 @@ int CutSceneSelectScreen(int bSetup)
return 0;
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currSelIndex = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currSelIndex = pCurrButton->d - 1;
}
@ -2746,7 +2735,7 @@ int CutSceneCitySelectScreen(int bSetup)
return 0;
}
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
lastCity = -1;
lastCutCity = GameLevel;
@ -2772,7 +2761,7 @@ int CutSceneCitySelectScreen(int bSetup)
return 0;
}
else if (feNewPad & 0x10)
else if (feNewPad & MPAD_TRIANGLE)
{
FESound(0);
bDoneAllready = 1;
@ -2782,11 +2771,11 @@ int CutSceneCitySelectScreen(int bSetup)
return 0;
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currCity = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currCity = pCurrButton->d - 1;
}
@ -2860,7 +2849,7 @@ int SetVolumeScreen(int bSetup)
currSelIndex = (pCurrButton->u & 3);
if (feNewPad & 0x10)
if (feNewPad & MPAD_TRIANGLE)
{
FESound(0);
bDoneAllready = 1;
@ -2875,7 +2864,7 @@ int SetVolumeScreen(int bSetup)
return 0;
}
else if (feNewPad & 0x40)
else if (feNewPad & MPAD_CROSS)
{
if (currSelIndex == 2)
LoadBackgroundFile("DATA\\GFX.RAW");
@ -2886,7 +2875,7 @@ int SetVolumeScreen(int bSetup)
{
int dir = -1; // -1: no action, 0: limit reached, 1: OK
if (fePad & 0x8000)
if (fePad & MPAD_D_LEFT)
{
switch (currSelIndex)
{
@ -2922,7 +2911,7 @@ int SetVolumeScreen(int bSetup)
break;
}
}
else if (fePad & 0x2000)
else if (fePad & MPAD_D_RIGHT)
{
switch (currSelIndex)
{
@ -3080,7 +3069,7 @@ int ScoreScreen(int bSetup)
return 0;
}
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
if (currSelIndex == 0)
{
@ -3128,12 +3117,12 @@ int ScoreScreen(int bSetup)
bRedrawFrontend = 1;
#endif
}
else if (feNewPad & 0x10)
else if (feNewPad & MPAD_TRIANGLE)
{
iScreenSelect = SCREEN_NONE;
return 0;
}
else if ((feNewPad & 0x1000) || (feNewPad & 0x4000))
else if ((feNewPad & MPAD_D_UP) || (feNewPad & MPAD_D_DOWN))
{
currSelIndex ^= 1;
}
@ -3202,7 +3191,7 @@ int CityCutOffScreen(int bSetup)
#ifndef PSX
/*
if ((fePad & 0x40U) != 0)
if ((fePad & MPAD_CROSS) != 0)
{
lastCity = currCity;
@ -3214,7 +3203,7 @@ int CityCutOffScreen(int bSetup)
return 0;
}*/
if (feNewPad & 0x10)
if (feNewPad & MPAD_TRIANGLE)
{
lastCity = -1;
@ -3227,11 +3216,11 @@ int CityCutOffScreen(int bSetup)
return 0;
}
else if (feNewPad & 0x1000)
else if (feNewPad & MPAD_D_UP)
{
currCity = pCurrButton->u - 1;
}
else if (feNewPad & 0x4000)
else if (feNewPad & MPAD_D_DOWN)
{
currCity = pCurrButton->d - 1;
}
@ -3267,14 +3256,14 @@ int ControllerScreen(int bSetup)
}
else
{
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
currSelIndex = currSelIndex ^ 1;
LoadBackgroundFile(contNames[currSelIndex]);
bRedrawFrontend = 1;
}
else if (feNewPad & 0x10)
else if (feNewPad & MPAD_TRIANGLE)
{
iScreenSelect = SCREEN_SCORES;
LoadBackgroundFile("DATA\\GFX.RAW");
@ -3725,7 +3714,7 @@ int UserReplaySelectScreen(int bSetup)
if (gFEReplayCount)
{
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
char filename[64];
int selectedReplay = pCurrButton->var;
@ -3810,7 +3799,7 @@ int TimeOfDaySelectScreen(int bSetup)
FEPrintString(GET_GAME_TXT(TimeOfDayNames[wantedTimeOfDay]), 590, ypos[0], 4, 128, 128, 128);
FEPrintString(GET_GAME_TXT(WeatherNames[wantedWeather]), 590, ypos[1], 4, 128, 128, 128);
if (feNewPad & 0x10)
if (feNewPad & MPAD_TRIANGLE)
{
// reset back
wantedWeather = -1;
@ -3821,11 +3810,11 @@ int TimeOfDaySelectScreen(int bSetup)
dir = 0;
if (feNewPad & 0x8000)
if (feNewPad & MPAD_D_LEFT)
{
dir = -1;
}
else if (feNewPad & 0x2000)
else if (feNewPad & MPAD_D_RIGHT)
{
dir = 1;
}
@ -3861,7 +3850,7 @@ int DemoScreen(int bSetup)
if (bSetup)
return 0;
if (feNewPad & 0x40)
if (feNewPad & MPAD_CROSS)
{
pScreenStack[ScreenDepth] = pCurrScreen;
pButtonStack[ScreenDepth] = pCurrButton;
@ -3880,7 +3869,7 @@ int DemoScreen(int bSetup)
if(mainScreenLoaded)
{
if (feNewPad & 0x20)
if (feNewPad & MPAD_CIRCLE)
{
LoadBackgroundFile(contNames[0]);
FESound(2);

View File

@ -4,6 +4,12 @@
// DRIVER 2 game engine limits
// please populate this file only with engine limits during refactoring
#ifndef PSX
#define MAX_PLAYERS 16 // used for replay streams mostly
#else
#define MAX_PLAYERS 8 // used for replay streams mostly
#endif
#define MAX_MODEL_SLOTS 1536 // DO NOT CHANGE. No effect in upping it - limited by cell types
#define MAX_CARS 20
@ -30,6 +36,16 @@
#define MAX_DENTING_LOD_UVS 134
#endif
// Tyre track visuals
#define MAX_TYRE_PLAYERS 4
#ifndef PSX
#define MAX_TYRE_TRACK_WHEELS 4
#define MAX_TYRE_TRACK_PLAYERS 4
#else
#define MAX_TYRE_TRACK_WHEELS 2
#define MAX_TYRE_TRACK_PLAYERS 2
#endif
// Mission limits
// DO NOT EDIT, breaks compatibility!
#define MAX_MISSION_THREADS 16
@ -37,6 +53,7 @@
// replay definitions.
// DO NOT EDIT, breaks compatibility!
#define MAX_REPLAY_STREAMS MAX_PLAYERS
#define MAX_REPLAY_CAMERAS 60
#define MAX_REPLAY_WAYPOINTS 150
#define MAX_REPLAY_PINGS 400

View File

@ -1,5 +1,6 @@
#include "driver2.h"
#include "C/system.h"
#include "C/pres.h"
#include "platform.h"
#ifndef PSX
@ -7,6 +8,7 @@
#include <malloc.h>
#endif
int gUserLanguage = 0;
char* gMisssionLanguageBuffer = NULL;

View File

@ -3,6 +3,13 @@
#include <abs.h>
struct MATRIX2
{
short m[3][3];
short computed;
char null[12];
};
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
@ -40,6 +47,20 @@ extern short rcossin_tbl[8192];
#define RemapVal( val, A, B, C, D) \
(C + (D - C) * (val - A) / (B - A))
#define VecCopy(_v, _xyz) \
{ \
(_v)->vx = (_xyz)->vx; \
(_v)->vy = (_xyz)->vy; \
(_v)->vz = (_xyz)->vz; \
}
#define VecNegate(_v) \
{ \
(_v)->vx = -(_v)->vx; \
(_v)->vy = -(_v)->vy; \
(_v)->vz = -(_v)->vz; \
}
#define SetVec(_v, _x, _y, _z) \
{ \
(_v)->vx = _x; \

View File

@ -152,12 +152,20 @@ struct DRIVER2_JUNCTION
u_int flags;
};
enum SurfaceType
{
SURF_CONCRETE = 0, // concrete/paved tiles
SURF_GRASS = 4,
SURF_WATER = 6,
SURF_ALLEY = 8,
SURF_DEEPWATER = 9,
SURF_SAND = 11,
};
typedef struct _sdPlane
{
short surface;
short a;
short b;
short c;
short surface; // also one of SurfaceTypes
short a, b, c;
int d;
} sdPlane;
@ -252,19 +260,6 @@ struct CAR_MODEL
SVECTOR* nlist;
};
struct plotCarGlobals
{
u_char* primptr;
OTTYPE* ot;
u_int intensity;
u_short* pciv_clut;
u_int ShineyTPageASL16;
u_int ShineyClutASL16;
u_char* damageLevel;
u_char* shineyTable;
int ghost;
};
// UNUSED
struct TEX_INFO
{
@ -556,136 +551,6 @@ struct LEAD_PARAMETERS
int hWidth80Mul;
};
//---------------------------------------------------------------------------------------
// TODO: DR2EVENTS.H
typedef struct _EVENT EVENT;
struct _EVENT
{
VECTOR position;
short rotation;
short timer;
int* data;
int* node;
short flags;
short radius;
int model;
EVENT* next;
};
struct FixedEvent // same as EVENT but different fields
{
VECTOR position;
short rotation;
short active;
u_short initialRotation;
u_short finalRotation;
u_short minSpeed;
u_short maxSpeed;
short flags;
short radius;
int model;
EVENT* next;
char* modelName;
};
struct EventGlobal
{
int camera;
int draw;
EVENT** track;
EVENT* cameraEvent;
};
enum SpecialCamera
{
SPECIAL_CAMERA_SET = 0,
SPECIAL_CAMERA_SET2 = 1,
SPECIAL_CAMERA_RESET = 2,
SPECIAL_CAMERA_WAIT = 3,
};
struct MissionTrain
{
EVENT* engine;
int* node;
int cornerSpeed;
int initialStraightSpeed;
int finalStraightSpeed;
int start;
int startDir;
};
struct Foam
{
MODEL* model;
int rotate;
};
struct EventCarriage
{
short rotation;
short vel;
};
struct MultiCar
{
EVENT* event;
int count;
};
struct Helicopter
{
int speed;
short pitch;
short dp;
short roll;
short dr;
int lastX;
int lastZ;
TEXTURE_DETAILS rotorTexture;
short rotorrot;
short rotorvel;
int cleanModel;
int deadModel;
};
struct Detonator
{
int timer;
int count;
};
struct CameraDelay
{
int delay;
int type;
};
enum VisType
{
VIS_INIT = 0,
VIS_SORT = 1,
VIS_ADD = 2,
VIS_NEXT = 3,
};
struct EventCamera
{
VECTOR position;
short yAng;
MATRIX matrix;
int rotate;
};
enum Station
{
EVENT_NO_STATION = 0,
EVENT_APPROACHING = 1,
EVENT_LEAVING = 2,
};
//---------------------------------------------------------------------------------------
// TODO: MISSION.H
@ -949,12 +814,9 @@ enum MissionTimerFlags
struct MR_TIMER
{
short x;
short y;
short x, y;
u_char flags;
u_char min;
u_char sec;
u_char frac;
u_char min, sec, frac;
int count;
};
@ -1065,12 +927,14 @@ enum PED_MODEL_TYPES //: char
CIVILIAN = 3,
};
typedef void(*pedFunc)(struct PEDESTRIAN* pPed);
typedef struct PEDESTRIAN *LPPEDESTRIAN;
typedef void(*pedFunc)(LPPEDESTRIAN pPed);
typedef struct PEDESTRIAN
{
PEDESTRIAN* pNext;
PEDESTRIAN* pPrev;
LPPEDESTRIAN pNext;
LPPEDESTRIAN pPrev;
pedFunc fpRestState;
pedFunc fpAgitatedState;
char padId;
@ -1095,23 +959,6 @@ typedef struct PEDESTRIAN
char type;
} *LPPEDESTRIAN;
struct CAR_COLLISION_BOX
{
int min_x;
int max_x;
int min_z;
int max_z;
};
typedef struct SEATED_PEDESTRIANS
{
int x;
int z;
short rotation;
char index;
char pad;
} *SEATEDPTR;
typedef struct PEDESTRIAN_ROADS
{
short pos;
@ -1124,61 +971,6 @@ typedef struct PEDESTRIAN_ROADS
//---------------------------------------------------------------------------------------
// TODO: GAMESND.H
typedef struct __envsound
{
u_char type;
u_char flags;
VECTOR pos;
VECTOR pos2;
int bank;
int sample;
int vol;
} envsound;
typedef struct __envsoundtags
{
int frame_cnt;
int func_cnt;
int num_envsnds;
int envsnd_cnt;
} envsoundtags;
typedef struct __envsoundinfo
{
VECTOR eff_pos[4];
VECTOR cam_pos;
float g[4];
int thisS[4];
int playing_sound[4];
int chan[4];
u_int flags;
} envsoundinfo;
struct SPEECH_QUEUE
{
char allowed;
char chan;
char is_playing;
int count;
char reverb;
int slot[7];
};
typedef struct __othercarsound
{
int car;
int chan;
char in_use;
char stopped;
char idle;
} othercarsound;
typedef struct __bitfield64
{
int h;
int l;
} bitfield64;
typedef struct __skidinfo
{
char chan;
@ -1192,75 +984,6 @@ typedef struct __horninfo
char request;
} horninfo;
//---------------------------------------------------------------------------------------
// TODO: ANIMOBJ.H
struct CYCLE_OBJECT
{
char* name;
short vx;
short vy;
short start1;
short stop1;
short speed1;
short start2;
short stop2;
short speed2;
};
//---------------------------------------------------------------------------------------
// TODO: OVERLAY.H
struct COLOUR_BAND
{
CVECTOR colour;
int value;
int flags;
};
typedef struct _PERCENTAGE_BAR
{
char* tag;
short xpos;
short ypos;
short width;
short height;
u_short position;
u_short max;
COLOUR_BAND* pColourBand;
int flags;
int active;
} PERCENTAGE_BAR, *LPPERCENTAGE_BAR;
//---------------------------------------------------------------------------------------
// TODO: OVERMAP.H
struct COP_SIGHT_DATA
{
short surroundViewDistance;
short frontViewDistance;
short frontViewAngle;
};
struct MAPTEX
{
short u;
short w;
short v;
short h;
};
struct OVERMAP
{
int x_offset;
int y_offset;
int width;
int height;
u_char toptile;
u_char dummy;
int scale;
};
//---------------------------------------------------------------------------------------
// TODO: CHEATS.H
@ -1391,35 +1114,6 @@ struct PLAYBACKCAMERA
u_char idx;
};
//---------------------------------------------------------------------------------------
// TODO: CUTSCENE.H
struct CUTSCENE_BUFFER
{
int numResident;
u_char residentCutscenes[4];
char(*residentPointers[4]);
char* buffer;
char* currentPointer;
int bytesFree;
int reservedSize;
// char buffer[32*1024]; // was 8192, but we have some free mem now even for PSX. Using malloc.
};
struct CUTSCENE_INFO
{
u_short offset;
u_short size;
};
struct CUTSCENE_HEADER
{
int maxsize;
CUTSCENE_INFO data[15];
};
//---------------------------------------------------------------------------------------
// TODO: COP_AI.H
@ -1442,7 +1136,7 @@ struct ADJACENT_ROAD_INFO
};
// only "status" is used
struct ROADBLOCK // [A] causes undefined behaviour
struct ROADBLOCK
{
VECTOR position;
ADJACENT_ROAD_INFO adjacentRoadInfo;
@ -1605,17 +1299,6 @@ typedef struct _PLAYER
//---------------------------------------------------------------------------------------
// TODO: AI.H
typedef struct _EXTRA_CIV_DATA
{
int surfInd;
int distAlongSegment;
short angle;
u_short ctrlState;
int thrustState;
u_char palette;
u_char controlFlags;
} EXTRA_CIV_DATA;
struct COP_DATA
{
int autoMaxPowerScaleLimit;
@ -1629,143 +1312,6 @@ struct COP_DATA
short trigger[5];
};
enum AIZone
{
zoneFrnt = 0,
zoneBack = 1,
zoneLeft = 2,
zoneRght = 3,
};
//---------------------------------------------------------------------------------------
// TODO: DRAW.H
// Primitive plot context used in scratchpad
struct _pct
{
struct DB* current;
u_short(*ptexture_pages)[128];
u_short(*ptexture_cluts)[128][32];
int f4colourTable[32];
int* polySizes;
char* primptr;
OTTYPE* ot;
u_int clut;
u_int tpage;
u_int colour;
int flags;
SVECTOR* verts;
u_int lastTexInfo;
int scribble[8];
int model;
};
struct MATRIX2
{
short m[3][3];
short computed;
char null[12];
};
struct MVERTEX
{
short vx;
short vy;
short vz;
union {
short val;
struct {
u_char u0;
u_char v0;
}s;
}uv;
};
struct MVERTEX5x5
{
MVERTEX verts[5][5];
};
struct VERTEX
{
DVECTOR coord;
UV_INFO uv_coord;
u_char pad[2];
};
//---------------------------------------------------------------------------------------
// TODO: SPOOL.H
struct Spool
{
u_short offset;
u_char connected_areas[2];
u_char pvs_size;
u_char cell_data_size[3];
u_char super_region;
u_char num_connected_areas;
u_char roadm_size;
u_char roadh_size;
};
struct SPOOLQ
{
u_char type;
u_char data;
u_short nsectors;
u_int sector;
char* addr;
void (*func)();
#ifdef _DEBUG
const char* requestby;
int requestbyline;
#endif
};
struct SPL_REGIONINFO
{
u_short region_to_unpack;
u_short target_barrel_region;
int nsectors;
char* cell_addr;
char* roadm_addr;
};
struct AreaDataStr
{
u_short gfx_offset;
u_short model_offset;
u_short music_offset;
u_short ambient_offset;
u_char model_size;
u_char pad;
u_char num_tpages;
u_char ambient_size;
u_char music_size;
u_char music_samples_size;
u_char music_id;
u_char ambient_id;
};
//---------------------------------------------------------------------------------------
// TODO: FMV.H
struct RENDER_ARG
{
u_char render;
u_char credits;
u_short recap;
};
struct RENDER_ARGS
{
u_char nRenders;
u_char subtitle;
char screenx;
char screeny;
RENDER_ARG Args[4];
};
//---------------------------------------------------------------------------------------
// TODO: GLAUNCH.H
@ -1800,221 +1346,4 @@ enum GAMEMODE
GAMEMODE_DEMO = 6,
};
struct MISSION_STEP
{
u_char flags : 3;
u_char recap : 5;
u_char data : 7;
u_char disc : 1;
};
//---------------------------------------------------------------------------------------
// TODO: LEADAI.H
struct MAP_DATA
{
CAR_DATA* cp;
VECTOR* base;
VECTOR* pos;
VECTOR* vel;
VECTOR* size;
int intention;
int* map;
int* local;
};
//---------------------------------------------------------------------------------------
// TODO: PAUSE.H
enum EXIT_VALUE
{
MENU_QUIT_NONE = 0,
MENU_QUIT_CONTINUE = 1,
MENU_QUIT_QUIT = 2,
MENU_QUIT_RESTART = 3,
MENU_QUIT_DIRECTOR = 4,
MENU_QUIT_QUICKREPLAY = 5,
MENU_QUIT_BACKMENU = 6,
MENU_QUIT_NEXTMISSION = 7,
};
typedef void(*pauseFunc)(int dir);
struct MENU_ITEM;
struct MENU_HEADER;
struct MENU_ITEM
{
char* Text;
u_char Type;
u_char Justify;
pauseFunc func;
EXIT_VALUE ExitValue;
MENU_HEADER* SubMenu;
};
struct MENU_HEADER
{
char* Title;
XYWH Bound;
u_char NumItems;
MENU_ITEM* MenuItems;
};
//---------------------------------------------------------------------------------------
// TODO: PRES.H
struct OUT_FONTINFO
{
u_char x;
u_char y;
char offx;
char offy;
u_char width;
u_char height;
u_short pad;
};
struct FONT_DIGIT
{
char xOffset;
char width;
};
struct SHADOWHDR
{
u_int num_common_verts;
u_short num_verts_total;
u_short num_polys_total;
u_short vert_offsets[4];
u_short nverts[4];
u_short npolys[4];
u_int(*poly_block[4]);
SVECTOR* vertices;
};
//---------------------------------------------------------------------------------------
// TODO: SHADOW.H
struct TYRE_TRACK
{
u_char type;
u_char shade;
u_char shade_type;
u_char surface;
SVECTOR_NOPAD p1;
SVECTOR_NOPAD p2;
SVECTOR_NOPAD p3;
SVECTOR_NOPAD p4;
};
//---------------------------------------------------------------------------------------
// TODO: SYSTEM.H
struct DRAW_MODE
{
short x1;
short y1;
short x2;
short y2;
short width;
short height;
short framex;
short framey;
};
enum CDTYPE
{
CDTYPE_NODISC = 0,
CDTYPE_SHELLOPEN = 1,
CDTYPE_DISCERROR = 2,
CDTYPE_WRONGDISC = 3,
CDTYPE_CORRECTDISC = 4,
};
enum CITYTYPE
{
CITYTYPE_DAY = 0,
CITYTYPE_NIGHT = 1,
CITYTYPE_MULTI_DAY = 2,
CITYTYPE_MULTI_NIGHT = 3,
};
//---------------------------------------------------------------------------------------
// TODO: PAD.H
struct DUPLICATION
{
char* buffer;
int size;
};
typedef struct MAPPING
{
u_short button_lookup[16];
u_short swap_analog;
u_short reserved1;
} *LPMAPPING;
typedef struct PAD
{
u_char active;
u_char type;
u_char dualshock;
u_char reserved1;
u_short direct;
u_short dirnew;
char diranalog[4];
u_short mapped;
u_short mapnew;
char mapanalog[4];
MAPPING mappings;
u_char alarmShakeCounter;
u_char asd;
u_char sdf;
u_char dfg;
u_char delay;
u_char port;
u_char state;
u_char dsactive;
u_char* shakeptr;
u_char motors[2];
u_char shake_type;
u_char vibrate;
} *LPPAD;
//---------------------------------------------------------------------------------------
// TODO: LOADSAVE.H
struct GAME_SAVE_HEADER
{
u_int magic;
u_char gMissionLadderPos;
u_char pad1;
u_char pad2;
u_char pad3;
MISSION_DATA SavedData;
int reserved[8];
};
struct CONFIG_SAVE_HEADER
{
u_int magic;
int gMasterVolume;
int gMusicVolume;
int gSoundMode;
int gVibration;
int gCopDifficultyLevel;
int gFurthestMission;
MAPPING PadMapping[2];
SCORE_TABLES ScoreTables;
int PALAdjustX;
int PALAdjustY;
int NTSCAdjustX;
int NTSCAdjustY;
int gSubtitles;
ACTIVE_CHEATS AvailableCheats;
int reserved[6];
};
#endif // DR2TYPES_H

View File

@ -62,6 +62,18 @@ struct COLLISION_PACKET
short xsize, ysize, zsize;
};
struct SHADOWHDR
{
u_int num_common_verts;
u_short num_verts_total;
u_short num_polys_total;
u_short vert_offsets[4];
u_short nverts[4];
u_short npolys[4];
u_int(*poly_block[4]);
SVECTOR* vertices;
};
struct RGB // almost same as CVECTOR
{
u_char r;

View File

@ -1,9 +1,9 @@
#ifndef GAME_VERSION_N
#define GAME_VERSION_N "7.3"
#define GAME_VERSION_N "7.4"
#endif
#ifndef GAME_VERSION_RES
#define GAME_VERSION_RES 7,3
#define GAME_VERSION_RES 7,4
#endif
#define GAME_TITLE "REDRIVER2"

1
src_rebuild/PsyCross Submodule

@ -0,0 +1 @@
Subproject commit 502f700c5ba88b1ee0f7bca5cdd8ea66b833417a

View File

@ -1,24 +0,0 @@
# Psy-Cross (Psy-X)
![](https://i.ibb.co/PFNnw4G/PsyCross.jpg)
Framework aiming to build and run originally targeted **Playstation** applications on other platforms based on Psy-Q SDK.
### Implementation details
- High-level *Playstation API* reimplementation which translates it's calls into modern/compatible APIs
- Psy-Q - compatible headers
- Implements Geometry Transformation Engine (GTE) in software and adapts it's macros and calls
- **PGXP-Z** - PGXP support with optimized vertex cache lookup and extended with *modern 3D hardware perspective transform* and *Z-buffer* support **PGXP-Z**, with additional API to help improve rendering
- *LibSPU* with ADPCM decoding on OpenAL (SPU-AL)
- *LibGPU* with Playstation-style polygon and image handling
- ISO 9660 BIN/CUE image support with Playstation CD API
- Already proven to be *95% compatible* with the Psy-Q Playstation SDK - Psy-X game look identical to the Playstation game
## TODO
- Add some missing **LibGTE** functions
- MDEC implementation in **LibPress**
- CD Audio/XA decoding and playback
- SPU Attack-Decay-Sustain-Release (ADSR) support, *maybe through own mixer?*
### Credits
- SoapyMan - more GTE functions, SPU-AL, PGXP-Z
- Gh0stBlade - original source/base [(link)](https://github.com/TOMB5/TOMB5/tree/master/EMULATOR)

View File

@ -1,11 +0,0 @@
#ifndef PSYX_CONFIG_H
#define PSYX_CONFIG_H
// Required. Uses 32 bit pointers on P_TAG and other primitives
#define USE_EXTENDED_PRIM_POINTERS
// PGXP-Z: Precise GTE transform pipeline with Z-depth and widescreen fixes. Recommended
#define USE_PGXP
#endif // PSYX_CONFIG_H

View File

@ -1,38 +0,0 @@
#ifndef EMULATOR_GLOBALS_H
#define EMULATOR_GLOBALS_H
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int g_windowWidth;
extern int g_windowHeight;
extern int g_wireframeMode;
extern int g_texturelessMode;
extern int g_enableSwapInterval;
extern int g_pgxpZBuffer;
extern int g_bilinearFiltering;
extern int g_swapInterval;
extern float g_pgxpZNear;
extern float g_pgxpZFar;
extern int g_emulatorPaused;
extern int g_polygonSelected;
extern int g_pgxpTextureCorrection;
extern int g_controllerToSlotMapping[2];
extern void PsyX_Pad_InternalPadUpdates();
// logging functions
extern void PsyX_Log(const char* fmt, ...);
extern void PsyX_Log_Info(const char* fmt, ...);
extern void PsyX_Log_Warning(const char* fmt, ...);
extern void PsyX_Log_Error(const char* fmt, ...);
extern void PsyX_Log_Success(const char* fmt, ...);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,101 +0,0 @@
#ifndef EMULATOR_PUBLIC_H
#define EMULATOR_PUBLIC_H
#define CONTROLLER_MAP_FLAG_AXIS 0x4000
#define CONTROLLER_MAP_FLAG_INVERSE 0x8000
typedef struct
{
int id;
int kc_square, kc_circle, kc_triangle, kc_cross;
int kc_l1, kc_l2, kc_l3;
int kc_r1, kc_r2, kc_r3;
int kc_start, kc_select;
int kc_dpad_left, kc_dpad_right, kc_dpad_up, kc_dpad_down;
} PsyXKeyboardMapping;
typedef struct
{
int id;
// you can bind axis by adding CONTROLLER_MAP_AXIS_FLAG
int gc_square, gc_circle, gc_triangle, gc_cross;
int gc_l1, gc_l2, gc_l3;
int gc_r1, gc_r2, gc_r3;
int gc_start, gc_select;
int gc_dpad_left, gc_dpad_right, gc_dpad_up, gc_dpad_down;
int gc_axis_left_x, gc_axis_left_y;
int gc_axis_right_x, gc_axis_right_y;
} PsyXControllerMapping;
typedef void(*GameDebugKeysHandlerFunc)(int nKey, char down);
typedef void(*GameDebugMouseHandlerFunc)(int x, int y);
typedef void(*GameOnTextInputHandler)(const char* buf);
//------------------------------------------------------------------------
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* Mapped inputs */
extern PsyXControllerMapping g_controller_mapping;
extern PsyXKeyboardMapping g_keyboard_mapping;
/* Game and debug inputs */
extern GameDebugKeysHandlerFunc gameDebugKeys;
extern GameDebugMouseHandlerFunc gameDebugMouse;
extern GameOnTextInputHandler gameOnTextInput;
/* Usually called at the beginning of main function */
extern void PsyX_Initialise(char* windowName, int screenWidth, int screenHeight, int fullscreen);
/* Cleans all resources and closes open instances */
extern void PsyX_Shutdown(void);
/* Returns the screen size dimensions */
extern void PsyX_GetScreenSize(int* screenWidth, int* screenHeight);
/* Sets mouse cursor position */
extern void PsyX_SetCursorPosition(int x, int y);
/* Usually called after ClearOTag/ClearOTagR */
extern char PsyX_BeginScene(void);
/* Usually called after DrawOTag/DrawOTagEnv */
extern void PsyX_EndScene(void);
/* Explicitly updates emulator input loop */
extern void PsyX_UpdateInput(void);
/* Returns keyboard mapping index */
extern int PsyX_LookupKeyboardMapping(const char* str, int default_value);
/* Returns controller mapping index */
extern int PsyX_LookupGameControllerMapping(const char* str, int default_value);
/* Screen size of emulated PSX viewport with widescreen offsets */
extern void PsyX_GetPSXWidescreenMappedViewport(struct _RECT16* rect);
/* Waits for timer */
extern void PsyX_WaitForTimestep(int count);
/* Changes swap interval state */
extern void PsyX_EnableSwapInterval(int enable);
/* Changes swap interval interval interval */
extern void PsyX_SetSwapInterval(int interval);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,202 +0,0 @@
#ifndef EMULATOR_H
#define EMULATOR_H
/*
* Platform specific emulator setup
*/
#if (defined(_WIN32) || defined(__APPLE__) || defined(__linux__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__RPI__)
# define RENDERER_OGL
# define USE_GLAD
#elif defined(__RPI__)
# define RENDERER_OGLES
# define OGLES_VERSION (3)
#elif defined(__EMSCRIPTEN__)
# define RENDERER_OGLES
# define OGLES_VERSION (2)
#elif defined(__ANDROID__)
# define RENDERER_OGLES
# define OGLES_VERSION (3)
#endif
#if defined(RENDERER_OGL) || defined(RENDERER_OGLES)
# define USE_OPENGL 1
#endif
#if OGLES_VERSION == 2
# define ES2_SHADERS
#elif OGLES_VERSION == 3
# define ES3_SHADERS
#endif
/*
* OpenGL
*/
#if defined (RENDERER_OGL)
# define GL_GLEXT_PROTOTYPES
# include "common/glad.h"
#elif defined (RENDERER_OGLES)
# define GL_GLEXT_PROTOTYPES
# ifdef __EMSCRIPTEN__
# include <GL/gl.h>
# else
# if OGLES_VERSION == 2
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# elif OGLES_VERSION == 3
# include <GLES3/gl3.h>
# endif
# endif
# include <EGL/egl.h>
#endif
// setup renderer texture formats
#if defined(RENDERER_OGL)
# define TEXTURE_FORMAT GL_UNSIGNED_SHORT_1_5_5_5_REV
#elif defined(RENDERER_OGLES)
# define TEXTURE_FORMAT GL_UNSIGNED_SHORT_5_5_5_1
#endif
#include "psx/types.h"
#include "common/pgxp_defs.h"
#include "psx/libgte.h"
#include "psx/libgpu.h"
#include <stdio.h>
#include <stddef.h>
#ifndef NULL
#define NULL 0
#endif
/*
// FIXME: enable when needed
#if defined(RENDERER_OGLES)
# define glGenVertexArrays glGenVertexArraysOES
# define glBindVertexArray glBindVertexArrayOES
# define glDeleteVertexArrays glDeleteVertexArraysOES
#endif
*/
#if defined(RENDERER_OGL)
# define VRAM_FORMAT GL_RG
# define VRAM_INTERNAL_FORMAT GL_RG32F
#elif defined(RENDERER_OGLES)
# define VRAM_FORMAT GL_LUMINANCE_ALPHA
# define VRAM_INTERNAL_FORMAT GL_LUMINANCE_ALPHA
#endif
#define VRAM_WIDTH (1024)
#define VRAM_HEIGHT (512)
#define TPAGE_WIDTH (256)
#define TPAGE_HEIGHT (256)
#pragma pack(push,1)
typedef struct
{
#if defined(USE_PGXP)
float x, y, page, clut;
float z, scr_h, ofsX, ofsY;
#else
short x, y, page, clut;
#endif
u_char u, v, bright, dither;
u_char r, g, b, a;
char tcx, tcy, _p0, _p1;
} GrVertex;
#pragma pack(pop)
typedef enum
{
a_position,
a_zw,
a_texcoord,
a_color,
a_extra,
} ShaderAttrib;
typedef enum
{
BM_NONE,
BM_AVERAGE,
BM_ADD,
BM_SUBTRACT,
BM_ADD_QUATER_SOURCE
} BlendMode;
typedef enum
{
TF_4_BIT,
TF_8_BIT,
TF_16_BIT
} TexFormat;
#define MAX_NUM_POLY_BUFFER_VERTICES (32768)
#define MAX_NUM_INDEX_BUFFERS (4096)
#if defined(RENDERER_OGLES) || defined(RENDERER_OGL)
typedef uint TextureID;
typedef uint ShaderID;
#else
#error
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern TextureID g_whiteTexture;
extern TextureID g_vramTexture;
extern void GR_SwapWindow();
// PSX VRAM operations
extern void GR_SaveVRAM(const char* outputFileName, int x, int y, int width, int height, int bReadFromFrameBuffer);
extern void GR_CopyVRAM(unsigned short* src, int x, int y, int w, int h, int dst_x, int dst_y);
extern void GR_ReadVRAM(unsigned short* dst, int x, int y, int dst_w, int dst_h);
extern void GR_StoreFrameBuffer(int x, int y, int w, int h);
extern void GR_UpdateVRAM();
extern void GR_ReadFramebufferDataToVRAM();
extern TextureID GR_CreateRGBATexture(int width, int height, u_char* data /*= nullptr*/);
extern ShaderID GR_Shader_Compile(const char* source);
extern void GR_SetShader(const ShaderID shader);
extern void GR_Perspective3D(const float fov, const float width, const float height, const float zNear, const float zFar);
extern void GR_Ortho2D(float left, float right, float bottom, float top, float znear, float zfar);
extern void GR_SetBlendMode(BlendMode blendMode);
extern void GR_SetPolygonOffset(float ofs);
extern void GR_SetStencilMode(int drawPrim);
extern void GR_EnableDepth(int enable);
extern void GR_SetScissorState(int enable);
extern void GR_SetOffscreenState(const RECT16* offscreenRect, int enable);
extern void GR_SetupClipMode(const RECT16* clipRect, int enable);
extern void GR_SetViewPort(int x, int y, int width, int height);
extern void GR_SetTexture(TextureID texture, TexFormat texFormat);
extern void GR_SetWireframe(int enable);
extern void GR_DestroyTexture(TextureID texture);
extern void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
extern void GR_ClearVRAM(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
extern void GR_UpdateVertexBuffer(const GrVertex* vertices, int count);
extern void GR_DrawTriangles(int start_vertex, int triangles);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,16 +0,0 @@
#ifndef PSYX_VERSION_H
#define PSYX_VERSION_H
/* Emulator version */
#define PSYX_MAJOR_VERSION (2)
#define PSYX_MINOR_VERSION (8)
/* Compile date and time */
#define PSYX_COMPILE_DATE (__DATE__)
#define PSYX_COMPILE_TIME (__TIME__)
/* Psy-Q version */
#define PSYQ_MAJOR_VERSION (4)
#define PSYQ_MINOR_VERSION (7)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
#ifndef HALF_FLOAT
#define HALF_FLOAT
typedef struct half
{
unsigned short sh;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
half() {};
half(const float x);
half(const half& other);
operator float() const;
half& operator=(const half& other)
{
sh = other.sh;
return *this;
}
#endif
} half;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern short to_half_float(const float x);
extern float from_half_float(const short x);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif // HALF_FLOAT

View File

@ -1,77 +0,0 @@
#ifndef PGXP_DEFS_H
#define PGXP_DEFS_H
#ifdef USE_PGXP
#include "PsyX/common/half_float.h"
// Helpful macro
#define PGXP_LOOKUP_VALUE(x, y) (*(u_short*)&(x) | (*(u_short*)&(y) << 16))
//-------------------------------------
// in C++, VERTTYPE can be declared as half
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
typedef half VERTTYPE;
#else
typedef short VERTTYPE;
#endif
typedef struct
{
float px, py, pz; // 32 bit values
VERTTYPE x, y, z; // 16 bit values (for lookup and backwards compat if not found in cache)
} PGXPVector3D;
typedef struct
{
uint lookup;
float px;
float py;
float pz;
float scr_h;
float ofx;
float ofy;
} PGXPVData;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern PGXPVector3D g_FP_SXYZ0; // direct access PGXP without table lookup
extern PGXPVector3D g_FP_SXYZ1;
extern PGXPVector3D g_FP_SXYZ2;
extern int g_pgxpVertexIndex;
/* clears PGXP vertex buffer */
void PGXP_ClearCache();
/* emits new PGXP vertex */
ushort PGXP_EmitCacheData(PGXPVData* newData);
/* sets Z offset (works like Z bias) */
void PGXP_SetZOffsetScale(float offset, float scale);
/* searches for vertex with given lookup value */
int PGXP_GetCacheData(PGXPVData* out, uint lookup, ushort indexhint /* = 0xFFFF */);
/* used by primitive setup */
ushort PGXP_GetIndex();
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
// special PGXP type
typedef struct { /* 2D short vector */
half vx, vy;
ushort pgxp_index;
} DVECTORF;
#else
typedef short VERTTYPE;
#endif
#endif // PGXP_DEFS

View File

@ -1,30 +0,0 @@
#ifndef UTIL_TIMER_H
#define UTIL_TIMER_H
#ifdef _WIN32
#include <stdint.h>
#else
#include <sys/time.h>
#endif
typedef struct
{
#ifdef _WIN32
uint64_t clockStart;
#else
struct timeval timeStart;
#endif // _WIN32
} timerCtx_t;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void Util_InitHPCTimer(timerCtx_t* timer);
extern double Util_GetHPCTime(timerCtx_t* timer, int reset /*= 0*/);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,18 +0,0 @@
#ifndef ABS_H
#define ABS_H
#ifndef ABS
#define ABS(x) fst_abs(x)
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int fst_abs(int x);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,12 +0,0 @@
#ifndef ASM_H
#define ASM_H
/*
This header must be empty
*/
#define NREGS 40
#endif

Some files were not shown because too many files have changed in this diff Show More