diff options
author | Fire_Head <Fire-Head@users.noreply.github.com> | 2020-12-29 18:51:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 18:51:37 +0100 |
commit | 89e27093040067ca80ce2e174c19427222167e8e (patch) | |
tree | bf4183a78beb0c3e747fbc1f6a8c4f3c1e114d5c | |
parent | master gxt (diff) | |
parent | Reorder CEntity functions into their original order (diff) | |
download | re3-89e27093040067ca80ce2e174c19427222167e8e.tar re3-89e27093040067ca80ce2e174c19427222167e8e.tar.gz re3-89e27093040067ca80ce2e174c19427222167e8e.tar.bz2 re3-89e27093040067ca80ce2e174c19427222167e8e.tar.lz re3-89e27093040067ca80ce2e174c19427222167e8e.tar.xz re3-89e27093040067ca80ce2e174c19427222167e8e.tar.zst re3-89e27093040067ca80ce2e174c19427222167e8e.zip |
77 files changed, 2592 insertions, 940 deletions
@@ -1,4 +1,5 @@ -# re3 +<img src="https://github.com/GTAmodding/re3/blob/master/logo.png?raw=true" alt="re3 logo" width="200"> + [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=master) <a href="https://discord.gg/aKYAwCx92H"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a> @@ -40,15 +41,16 @@ Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/COD ### Unreversed / incomplete classes (at least the ones we know) The following classes have only unused or practically unused code left: ``` -CMemoryHeap - only on PS2 NameGrid.cpp - only on mobile (a player name grid, either a very early player name code ala GTA1 or a multiplayer leftover) PedDebug.cpp - only on mobile (debug code) HandlingMgr.cpp - debug functions from mobile +CFormationInfo - unused PedAI class that could be found on mobile CVehicle::ProcessBikeWheel - early bike code (only on mobile) CAutomobile::DebugCode - debug function from mobile CBoat::DebugCode - debug function from mobile CBoat::ModifyHandlingValue - debug function from mobile CBoat::DisplayHandlingData - debug function from mobile -TexturePools - only on PC (slight RW modification that we don't actually need) +CStreaming::PrintRequestList - debug function from mobile +d3d8raster.c - only on PC (slight RW modification that we don't actually need) ``` diff --git a/gamefiles/TEXT/spanish.gxt b/gamefiles/TEXT/spanish.gxt Binary files differindex 384c79a0..6b188fc6 100644 --- a/gamefiles/TEXT/spanish.gxt +++ b/gamefiles/TEXT/spanish.gxt diff --git a/gamefiles/neo/carTweakingTable.dat b/gamefiles/neo/carTweakingTable.dat new file mode 100644 index 00000000..5e707ae2 --- /dev/null +++ b/gamefiles/neo/carTweakingTable.dat @@ -0,0 +1,104 @@ +# Fresnal RO Table +# SUNNY CLOUDY RAINY, FOGGY +0.400000 0.400000 0.400000 0.150000 # Midnight +0.400000 0.400000 0.400000 0.150000 # 1am +0.400000 0.400000 0.400000 0.150000 # 2am +0.400000 0.400000 0.400000 0.150000 # 3am +0.400000 0.400000 0.400000 0.150000 # 4am +0.400000 0.400000 0.400000 0.150000 # 5am +0.400000 0.400000 0.400000 0.150000 # 6am +0.400000 0.400000 0.400000 0.150000 # 7am +0.400000 0.400000 0.400000 0.150000 # 8am +0.400000 0.400000 0.400000 0.150000 # 9am +0.400000 0.400000 0.400000 0.150000 # 10am +0.400000 0.400000 0.400000 0.150000 # 11am +0.400000 0.400000 0.400000 0.150000 # Midday +0.400000 0.400000 0.400000 0.150000 # 1pm +0.400000 0.400000 0.400000 0.150000 # 2pm +0.400000 0.400000 0.400000 0.150000 # 3pm +0.400000 0.400000 0.400000 0.150000 # 4pm +0.400000 0.400000 0.400000 0.150000 # 5pm +0.400000 0.400000 0.400000 0.150000 # 6pm +0.400000 0.400000 0.400000 0.150000 # 7pm +0.400000 0.400000 0.400000 0.150000 # 8pm +0.400000 0.400000 0.400000 0.150000 # 9pm +0.400000 0.400000 0.400000 0.150000 # 10pm +0.400000 0.400000 0.400000 0.150000 # 11pm +# Specular Power Table +# SUNNY CLOUDY RAINY, FOGGY +128.000000 80.000000 30.000000 128.000000 # Midnight +128.000000 80.000000 30.000000 128.000000 # 1am +128.000000 80.000000 30.000000 128.000000 # 2am +128.000000 80.000000 30.000000 128.000000 # 3am +128.000000 80.000000 30.000000 128.000000 # 4am +80.000000 60.000000 30.000000 128.000000 # 5am +80.000000 60.000000 30.000000 128.000000 # 6am +80.000000 60.000000 30.000000 128.000000 # 7am +80.000000 60.000000 30.000000 128.000000 # 8am +80.000000 60.000000 30.000000 128.000000 # 9am +80.000000 60.000000 30.000000 128.000000 # 10am +80.000000 60.000000 30.000000 128.000000 # 11am +80.000000 60.000000 30.000000 128.000000 # Midday +80.000000 60.000000 30.000000 128.000000 # 1pm +80.000000 60.000000 30.000000 128.000000 # 2pm +80.000000 60.000000 30.000000 128.000000 # 3pm +80.000000 60.000000 30.000000 128.000000 # 4pm +128.000000 80.000000 30.000000 128.000000 # 5pm +128.000000 80.000000 30.000000 128.000000 # 6pm +128.000000 80.000000 30.000000 128.000000 # 7pm +128.000000 80.000000 30.000000 128.000000 # 8pm +128.000000 80.000000 30.000000 128.000000 # 9pm +128.000000 80.000000 30.000000 128.000000 # 10pm +128.000000 80.000000 30.000000 128.000000 # 11pm +# Diffuse Colour Modifier Table (Red,Green,Blue,Amount) +# SUNNY CLOUDY RAINY, FOGGY +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # Midnight +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 1am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 2am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 3am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 4am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 5am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 6am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 7am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 8am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 9am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 10am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 11am +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # Midday +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 1pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 2pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 3pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 4pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 5pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 6pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 7pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 8pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 9pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 10pm +0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 # 11pm +# Specular Colour Table (Red,Green,Blue,Amount) +# SUNNY CLOUDY RAINY, FOGGY + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # Midnight + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 1am + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 2am + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 3am + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 4am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 5am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 6am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 7am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 8am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 9am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 10am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 11am +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # Midday +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 1pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 2pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 3pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 4pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 5pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 6pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 7pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 8pm +178, 178, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 9pm + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 10pm + 81, 150, 178, 100 178, 178, 178, 50 178, 178, 178, 75 178, 178, 178, 20 # 11pm diff --git a/gamefiles/neo/neo.txd b/gamefiles/neo/neo.txd Binary files differnew file mode 100644 index 00000000..d20215e0 --- /dev/null +++ b/gamefiles/neo/neo.txd diff --git a/gamefiles/neo/rimTweakingTable.dat b/gamefiles/neo/rimTweakingTable.dat new file mode 100644 index 00000000..058d55eb --- /dev/null +++ b/gamefiles/neo/rimTweakingTable.dat @@ -0,0 +1,130 @@ +# Ramp Start Table +# SUNNY CLOUDY RAINY, FOGGY +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # Midnight +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 1am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 2am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 3am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 4am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 5am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 6am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 7am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 8am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 9am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 10am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 11am +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # Midday +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 1pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 2pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 3pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 4pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 5pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 6pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 7pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 8pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 9pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 10pm +60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 60, 55, 53, 100 # 11pm +# Ramp End Table +# SUNNY CLOUDY RAINY, FOGGY +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # Midnight +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 1am +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 2am +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 3am +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 4am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 5am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 6am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 7am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 8am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 9am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 10am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 11am +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # Midday +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 1pm +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 2pm +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 3pm +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 4pm +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 5pm +255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 255, 230, 224, 100 # 6pm +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 7pm +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 8pm +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 9pm +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 10pm +190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 190, 171, 167, 100 # 11pm +# Offset Table +# SUNNY CLOUDY RAINY, FOGGY +0 0 0 0 # Midnight +0 0 0 0 # 1am +0 0 0 0 # 2am +0 0 0 0 # 3am +0 0 0 0 # 4am +0 0 0 0 # 5am +0 0 0 0 # 6am +0 0 0 0 # 7am +0 0 0 0 # 8am +0 0 0 0 # 9am +0 0 0 0 # 10am +0 0 0 0 # 11am +0 0 0 0 # Midday +0 0 0 0 # 1pm +0 0 0 0 # 2pm +0 0 0 0 # 3pm +0 0 0 0 # 4pm +0 0 0 0 # 5pm +0 0 0 0 # 6pm +0 0 0 0 # 7pm +0 0 0 0 # 8pm +0 0 0 0 # 9pm +0 0 0 0 # 10pm +0 0 0 0 # 11pm +# Scale Table +# SUNNY CLOUDY RAINY, FOGGY +1.5 1.5 1.0 1.0 # Midnight +1.5 1.5 1.0 1.0 # 1am +1.5 1.5 1.0 1.0 # 2am +1.5 1.5 1.5 1.5 # 3am +2.0 2.0 2.0 2.0 # 4am +2.0 2.0 2.0 2.0 # 5am +2.0 2.0 2.0 2.0 # 6am +2.5 2.5 2.0 2.0 # 7am +2.5 2.5 2.0 2.0 # 8am +2.5 2.5 2.0 2.0 # 9am +2.5 2.5 2.0 2.0 # 10am +2.5 2.5 2.0 2.0 # 11am +2.5 2.5 2.0 2.0 # Midday +2.5 2.5 2.0 2.0 # 1pm +2.5 2.5 2.0 2.0 # 2pm +2.5 2.5 2.0 2.0 # 3pm +2.5 2.5 2.0 2.0 # 4pm +2.0 2.0 2.0 2.0 # 5pm +2.0 2.0 2.0 2.0 # 6pm +2.0 2.0 2.0 2.0 # 7pm +1.5 1.5 1.5 1.5 # 8pm +1.5 1.5 1.0 1.0 # 9pm +1.5 1.5 1.0 1.0 # 10pm +1.5 1.5 1.0 1.0 # 11pm +# Scaling Table +# SUNNY CLOUDY RAINY, FOGGY +0.2 0.2 0.1 0.1 # Midnight +0.2 0.2 0.1 0.1 # 1am +0.7 0.7 0.2 0.2 # 6am +0.7 0.7 0.2 0.2 # 3am +0.7 0.7 0.2 0.2 # 4am +2.0 2.0 0.3 0.3 # 5am +3.0 3.0 0.3 0.3 # 6am +4.0 4.0 0.3 0.3 # 7am +5.0 5.0 0.3 0.3 # 8am +6.0 6.0 1.3 1.3 # 9am +6.0 6.0 2.0 2.0 # 10am +6.0 6.0 2.0 2.0 # 11am +6.0 6.0 2.0 2.0 # Midday +6.0 6.0 2.0 2.0 # 1pm +6.0 6.0 1.3 1.3 # 6pm +5.0 5.0 0.3 0.3 # 3pm +4.0 4.0 0.3 0.3 # 4pm +3.0 3.0 0.3 0.3 # 5pm +2.0 2.0 0.3 0.3 # 6pm +0.7 0.7 0.2 0.2 # 7pm +0.7 0.7 0.2 0.2 # 8pm +0.7 0.7 0.2 0.2 # 9pm +0.2 0.2 0.1 0.1 # 10pm +0.2 0.2 0.1 0.1 # 11pm diff --git a/gamefiles/neo/worldTweakingTable.dat b/gamefiles/neo/worldTweakingTable.dat new file mode 100644 index 00000000..b054fa38 --- /dev/null +++ b/gamefiles/neo/worldTweakingTable.dat @@ -0,0 +1,26 @@ +# LM blend Table +# SUNNY CLOUDY RAINY FOGGY +0.700000 0.700000 0.700000 0.550000 # Midnight +0.700000 0.700000 0.700000 0.550000 # 1am +0.700000 0.700000 0.700000 0.550000 # 2am +0.700000 0.700000 0.700000 0.550000 # 3am +0.700000 0.700000 0.700000 0.550000 # 4am +0.750000 0.750000 0.700000 0.600000 # 5am +0.800000 0.800000 0.750000 0.600000 # 6am +0.850000 0.850000 0.800000 0.650000 # 7am +0.900000 0.900000 0.800000 0.700000 # 8am +0.950000 0.900000 0.800000 0.700000 # 9am +1.000000 0.900000 0.800000 0.700000 # 10am +1.000000 0.900000 0.800000 0.700000 # 11am +1.000000 0.900000 0.800000 0.700000 # Midday +1.000000 0.900000 0.800000 0.700000 # 1pm +1.000000 0.900000 0.800000 0.700000 # 2pm +0.950000 0.900000 0.800000 0.700000 # 3pm +0.900000 0.900000 0.800000 0.700000 # 4pm +0.850000 0.850000 0.800000 0.650000 # 5pm +0.800000 0.800000 0.750000 0.600000 # 6pm +0.750000 0.750000 0.700000 0.600000 # 7pm +0.700000 0.700000 0.700000 0.550000 # 8pm +0.700000 0.700000 0.700000 0.550000 # 9pm +0.700000 0.700000 0.700000 0.550000 # 10pm +0.700000 0.700000 0.700000 0.550000 # 11pm diff --git a/logo.png b/logo.png Binary files differnew file mode 100644 index 00000000..50ae8690 --- /dev/null +++ b/logo.png diff --git a/logo.svg b/logo.svg new file mode 100644 index 00000000..9db8447c --- /dev/null +++ b/logo.svg @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + sodipodi:docname="re3_final.svg" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" + id="svg8" + version="1.1" + viewBox="0 0 270.93331 270.93334" + height="1024" + width="1024" + inkscape:export-filename="/home/hazelnot/Design/re3_red.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> + <defs + id="defs2" /> + <sodipodi:namedview + inkscape:window-maximized="1" + inkscape:window-y="0" + inkscape:window-x="0" + inkscape:window-height="1359" + inkscape:window-width="2560" + inkscape:snap-page="true" + inkscape:showpageshadow="false" + inkscape:pagecheckerboard="false" + showgrid="false" + inkscape:document-rotation="0" + inkscape:current-layer="g837" + inkscape:document-units="mm" + inkscape:cy="544.84615" + inkscape:cx="415.73725" + inkscape:zoom="0.7" + inkscape:pageshadow="2" + inkscape:pageopacity="0" + borderopacity="1" + bordercolor="#000000" + pagecolor="#606060" + id="base" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + lock-margins="false" + units="px" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="g837" + transform="matrix(2.1130708,0,0,2.1130708,14.956432,63.50059)"> + <path + id="path1450" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.836;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" + d="M 0.91799998,0.91799998 V 54.101316 H 17.960888 v 2.33009 c 0,2.95453 1.347497,6.384348 3.911905,8.332308 2.564408,1.947971 5.514112,2.433445 8.500257,2.433445 h 46.367194 v -14.5464 c 2.171993,1.134845 4.548071,1.450557 6.948413,1.450557 h 17.042893 c 2.98614,0 5.93584,-0.485482 8.50025,-2.433442 2.5644,-1.94796 3.91191,-5.377273 3.91191,-8.331793 V 30.964744 c 0,-1.094128 -0.25094,-2.296243 -0.70487,-3.457153 0.45593,-1.16196 0.70487,-2.363609 0.70487,-3.453019 V 11.81656 c 0,-2.9682265 -1.29681,-6.3966108 -3.85713,-8.3907028 -2.56031,-1.9940909 -5.55104,-2.50785722 -8.55503,-2.50785722 H 83.819398 c -3.003989,0 -5.99213,0.51376632 -8.55245,2.50785722 C 74.832145,3.7645045 74.436551,4.1470248 74.074773,4.5591214 73.713016,4.1470532 73.317379,3.7644843 72.8826,3.4258572 70.322288,1.4317663 67.332073,0.91799998 64.328081,0.91799998 H 47.285195 c -2.976748,0 -5.937909,0.51342982 -8.482687,2.46289872 C 36.275393,1.4370808 33.325985,0.91799998 30.37305,0.91799998 Z" + inkscape:label="Border" /> + <g + id="g1475" + inkscape:label="Text" + style="display:inline" + transform="translate(-51.547657,-77.439255)"> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:11.136;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" + d="m 84.566726,139.06892 c -4.562445,0 -6.843668,-1.73285 -6.843668,-5.19856 v -24.61088 c 0,-0.0877 -0.04387,-0.13161 -0.131609,-0.13161 h -3.22442 v 16.84595 H 60.679694 V 83.92475 h 23.887032 c 4.518575,0 6.777863,1.776721 6.777863,5.330164 v 12.239636 c 0,2.01801 -1.118676,3.15862 -3.356029,3.42183 2.281223,0.30709 3.421834,1.46964 3.421834,3.48764 v 20.07037 c 0,0.0877 0.04387,0.13161 0.131609,0.13161 h 33.823507 v 10.46292 z M 77.723058,94.585079 c 0,-0.08774 -0.04387,-0.131609 -0.131609,-0.131609 h -3.22442 v 6.31723 h 3.22442 c 0.08774,0 0.131609,-0.0439 0.131609,-0.13161 z m 33.955122,0 c 0,-0.08774 -0.0439,-0.131609 -0.13161,-0.131609 h -3.09281 c -0.0877,0 -0.13161,0.04387 -0.13161,0.131609 v 5.856601 h 3.35603 z m -10.1997,31.388741 c -4.562444,0 -6.843666,-1.73285 -6.843666,-5.19855 V 89.254914 c 0,-3.553443 2.281222,-5.330164 6.843666,-5.330164 h 17.04337 c 4.56244,0 6.84366,1.776721 6.84366,5.330164 v 20.991636 h -17.04336 v 5.13275 c 0,0.0877 0.0439,0.13161 0.13161,0.13161 h 3.09281 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -2.50057 h 13.68733 v 7.89654 c 0,3.4657 -2.28122,5.19855 -6.84366,5.19855 z" + id="path1452" + transform="translate(-2.6458322)" + inkscape:label="re" /> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:Pricedown;-inkscape-font-specification:Pricedown;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#c60000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:11.136;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" + d="m 135.23613,125.97382 c -4.56245,0 -6.84367,-1.73285 -6.84367,-5.19855 v -7.89654 h 13.68733 v 2.50057 c 0,0.0877 0.0439,0.13161 0.13161,0.13161 h 3.09281 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -6.11982 c 0,-0.0877 -0.0439,-0.13161 -0.13161,-0.13161 h -16.71434 v -8.35717 h 16.71434 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -6.054011 c 0,-0.08774 -0.0439,-0.131609 -0.13161,-0.131609 h -3.09281 c -0.0877,0 -0.13161,0.04387 -0.13161,0.131609 v 2.434766 h -13.55572 v -7.764931 c 0,-3.553443 2.28122,-5.330164 6.84366,-5.330164 h 16.91176 c 4.56245,0 6.84367,1.776721 6.84367,5.330164 v 12.239636 c 0,2.01801 -1.14061,3.15862 -3.42184,3.42183 2.28123,0.30709 3.42184,1.46964 3.42184,3.48764 v 12.37125 c 0,3.4657 -2.28122,5.19855 -6.84367,5.19855 z" + id="path1458" + inkscape:label="3" /> + </g> + </g> +</svg> diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp index 8d442b72..557bd842 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -810,11 +810,11 @@ CAnimManager::LoadAnimFile(int fd, bool compress) float *fbuf = (float*)buf; CFileMgr::Read(fd, (char*)&anpk, sizeof(IfpHeader)); - if(strncmp(anpk.ident, "ANLF", 4) == 0){ + if(!CGeneral::faststrncmp(anpk.ident, "ANLF", 4)) { ROUNDSIZE(anpk.size); CFileMgr::Read(fd, buf, anpk.size); numANPK = *(int*)buf; - }else if(strncmp(anpk.ident, "ANPK", 4) == 0){ + } else if(!CGeneral::faststrncmp(anpk.ident, "ANPK", 4)) { CFileMgr::Seek(fd, -8, 1); numANPK = 1; } @@ -870,13 +870,13 @@ CAnimManager::LoadAnimFile(int fd, bool compress) bool hasScale = false; bool hasTranslation = false; CFileMgr::Read(fd, (char*)&info, sizeof(info)); - if(strncmp(info.ident, "KRTS", 4) == 0){ + if(!CGeneral::faststrncmp(info.ident, "KRTS", 4)) { hasScale = true; seq->SetNumFrames(numFrames, true); - }else if(strncmp(info.ident, "KRT0", 4) == 0){ + }else if(!CGeneral::faststrncmp(info.ident, "KRT0", 4)) { hasTranslation = true; seq->SetNumFrames(numFrames, true); - }else if(strncmp(info.ident, "KR00", 4) == 0){ + }else if(!CGeneral::faststrncmp(info.ident, "KR00", 4)){ seq->SetNumFrames(numFrames, false); } diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index ca395136..94ca67de 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -128,31 +128,31 @@ cAudioManager::PostInitialiseGameSpecificSetup() { m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager); if (m_nFireAudioEntity >= 0) - SetEntityStatus(m_nFireAudioEntity, 1); + SetEntityStatus(m_nFireAudioEntity, true); m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1); if (m_nCollisionEntity >= 0) - SetEntityStatus(m_nCollisionEntity, 1); + SetEntityStatus(m_nCollisionEntity, true); m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1); if (m_nFrontEndEntity >= 0) - SetEntityStatus(m_nFrontEndEntity, 1); + SetEntityStatus(m_nFrontEndEntity, true); m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1); if (m_nProjectileEntity >= 0) - SetEntityStatus(m_nProjectileEntity, 1); + SetEntityStatus(m_nProjectileEntity, true); m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1); if (m_nWaterCannonEntity >= 0) - SetEntityStatus(m_nWaterCannonEntity, 1); + SetEntityStatus(m_nWaterCannonEntity, true); m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1); if (m_nPoliceChannelEntity >= 0) - SetEntityStatus(m_nPoliceChannelEntity, 1); + SetEntityStatus(m_nPoliceChannelEntity, true); m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1); if (m_nBridgeEntity >= 0) - SetEntityStatus(m_nBridgeEntity, 1); + SetEntityStatus(m_nBridgeEntity, true); m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; @@ -240,7 +240,7 @@ cAudioManager::ProcessReverb() const ; i++) { if (m_asActiveSamples[i].m_bReverbFlag) - SampleManager.SetChannelReverbFlag(i, 1); + SampleManager.SetChannelReverbFlag(i, true); } } } @@ -277,8 +277,7 @@ cAudioManager::ProcessSpecial() } CPlayerPed *playerPed = FindPlayerPed(); if (playerPed) { - const PedState &state = playerPed->m_nPedState; - if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle) + if(playerPed->EnteringCar() && !playerPed->bInVehicle) SampleManager.StopChannel(m_nActiveSamples); } } @@ -287,7 +286,7 @@ cAudioManager::ProcessSpecial() void cAudioManager::ProcessEntity(int32 id) { - if (m_asAudioEntities[id].m_nStatus) { + if (m_asAudioEntities[id].m_bStatus) { m_sQueueSample.m_nEntityIndex = id; switch (m_asAudioEntities[id].m_nType) { case AUDIOTYPE_PHYSICAL: @@ -580,14 +579,13 @@ cAudioManager::ProcessVehicle(CVehicle *veh) m_sQueueSample.m_vecPos = veh->GetPosition(); params.m_bDistanceCalculated = false; - params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); params.m_pVehicle = veh; - params.m_pTransmission = nil; - params.m_nIndex = 0; - params.m_fVelocityChange = 0.0f; + params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); if (handling != nil) params.m_pTransmission = &handling->Transmission; + else + params.m_pTransmission = nil; params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE; if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) @@ -1904,7 +1902,6 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) float vol; bool noReflections; float maxDist; - cPedParams pedParams; static uint8 WaveIndex = 41; static uint8 GunIndex = 53; @@ -2243,21 +2240,21 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) break; } case SOUND_PED_HELI_PLAYER_FOUND: - pedParams.m_pPed = nil; - pedParams.m_bDistanceCalculated = false; - pedParams.m_fDistance = 0.0f; + { + cPedParams pedParams; pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated; pedParams.m_fDistance = params.m_fDistance; SetupPedComments(pedParams, SOUND_PED_HELI_PLAYER_FOUND); continue; + } case SOUND_PED_BODYCAST_HIT: - pedParams.m_pPed = nil; - pedParams.m_bDistanceCalculated = false; - pedParams.m_fDistance = 0.0f; + { + cPedParams pedParams; pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated; pedParams.m_fDistance = params.m_fDistance; SetupPedComments(pedParams, SOUND_PED_BODYCAST_HIT); continue; + } case SOUND_WATER_FALL: { const float SOUND_INTENSITY = 40.0f; m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1; @@ -2402,20 +2399,20 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) CBoat *boat; float padRelativeAccerate; float gasPedal; - int32 padAccelerate; + float padAccelerate; uint8 emittingVol; float oneShotVol; static uint16 LastAccel = 0; static uint8 LastVol = 0; - static const int intensity = 50; + static const float intensity = 50.0f; if (params.m_fDistance < SQR(intensity)) { boat = (CBoat *)params.m_pVehicle; if (params.m_nIndex == REEFER) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(80, intensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 39; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; @@ -2438,10 +2435,10 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) } if (FindPlayerVehicle() == params.m_pVehicle) { padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake()); - padRelativeAccerate = padAccelerate / 255; + padRelativeAccerate = padAccelerate / 255.0f; emittingVol = (100.f * padRelativeAccerate) + 15; m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000; - if (!boat->m_bIsAnchored) + if (!boat->bPropellerInWater) m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; } else { gasPedal = Abs(boat->m_fGasPedal); @@ -2451,11 +2448,11 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) } else { emittingVol = (100.f * gasPedal) + 15; m_sQueueSample.m_nFrequency = (3000.f * gasPedal) + 6000; - if (!boat->m_bIsAnchored) + if (!boat->bPropellerInWater) m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; } } - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, intensity, m_sQueueSample.m_fDistance); if (!m_sQueueSample.m_nVolume) return true; m_sQueueSample.m_nCounter = 40; @@ -2513,7 +2510,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) } } CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, intensity, m_sQueueSample.m_fDistance); if (!m_sQueueSample.m_nVolume) return true; m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; @@ -2955,13 +2952,9 @@ cAudioManager::ProcessPed(CPhysical *ped) { cPedParams params; - params.m_pPed = nil; - params.m_bDistanceCalculated = false; - params.m_fDistance = 0.0f; - m_sQueueSample.m_vecPos = ped->GetPosition(); - // params.m_bDistanceCalculated = false; + params.m_bDistanceCalculated = false; params.m_pPed = (CPed *)ped; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); if (ped->GetModelIndex() == MI_FATMALE02) @@ -6363,26 +6356,25 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) uint8 emittingVolume; float distSquared; - cPedParams male; - cPedParams female; - static uint8 iSound = 0; switch (sound) { case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S: case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L: - male.m_pPed = nil; - male.m_bDistanceCalculated = false; - male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); - SetupPedComments(male, SOUND_INJURED_PED_MALE_OUCH); + { + cPedParams pedParams; + pedParams.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); + SetupPedComments(pedParams, SOUND_INJURED_PED_MALE_OUCH); return; + } case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S: case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L: - female.m_pPed = nil; - female.m_bDistanceCalculated = false; - female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); - SetupPedComments(female, SOUND_INJURED_PED_FEMALE); + { + cPedParams pedParams; + pedParams.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); + SetupPedComments(pedParams, SOUND_INJURED_PED_FEMALE); return; + } case SCRIPT_SOUND_GATE_START_CLUNK: case SCRIPT_SOUND_GATE_STOP_CLUNK: m_sQueueSample.m_fSoundIntensity = 40.0f; @@ -6537,36 +6529,20 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; m_sQueueSample.m_nReleasingVolumeModificator = 18; - m_sQueueSample.m_fSoundIntensity = 20.0f; - m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - emittingVolume = m_anRandomTable[2] % 20 + 30; - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = iSound++; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - AddSampleToRequestedQueue(); - } - } - return; + break; case SURFACE_WATER: return; default: + m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1; + m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; + m_sQueueSample.m_nReleasingVolumeModificator = 15; break; } + } else { + m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1; + m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; + m_sQueueSample.m_nReleasingVolumeModificator = 15; } - m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1; - m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; - m_sQueueSample.m_nReleasingVolumeModificator = 15; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -7715,7 +7691,6 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) int32 sampleIndex; uint8 emittingVol; float distSquared; - cPedParams params; static uint8 iSound = 0; @@ -7756,9 +7731,9 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); + cPedParams params; params.m_bDistanceCalculated = true; params.m_fDistance = distSquared; - params.m_pPed = nil; SetupPedComments(params, SOUND_INJURED_PED_MALE_PRISON); } gCellNextTime = time + 500 + m_anRandomTable[3] % 1500; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 947bda40..868f1b65 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -128,7 +128,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity) for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { if (!m_asAudioEntities[i].m_bIsUsed) { m_asAudioEntities[i].m_bIsUsed = true; - m_asAudioEntities[i].m_nStatus = 0; + m_asAudioEntities[i].m_bStatus = false; m_asAudioEntities[i].m_nType = type; m_asAudioEntities[i].m_pEntity = entity; m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; @@ -163,7 +163,7 @@ void cAudioManager::SetEntityStatus(int32 id, uint8 status) { if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) - m_asAudioEntities[id].m_nStatus = status; + m_asAudioEntities[id].m_bStatus = status; } void diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index d781ad71..9fe2f4ef 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -46,7 +46,7 @@ public: eAudioType m_nType; void *m_pEntity; bool m_bIsUsed; - uint8 m_nStatus; + uint8 m_bStatus; int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; float m_afVolume[NUM_AUDIOENTITY_EVENTS]; uint8 m_AudioEvents; @@ -132,6 +132,13 @@ public: bool m_bDistanceCalculated; float m_fDistance; CPed *m_pPed; + + cPedParams() + { + m_bDistanceCalculated = false; + m_fDistance = 0.0f; + m_pPed = nil; + } }; class cVehicleParams @@ -143,6 +150,16 @@ public: cTransmission *m_pTransmission; int32 m_nIndex; float m_fVelocityChange; + + cVehicleParams() + { + m_bDistanceCalculated = false; + m_fDistance = 0.0f; + m_pVehicle = nil; + m_pTransmission = nil; + m_nIndex = 0; + m_fVelocityChange = 0.0f; + } }; VALIDATE_SIZE(cVehicleParams, 0x18); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index cb4642b3..54c1b0bc 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -83,18 +83,40 @@ cMusicManager::DisplayRadioStationName() if(m_bPlayerInCar && !m_bPreviousPlayerInCar) pCurrentStation = nil; - if(SampleManager.IsMP3RadioChannelAvailable()) { +#ifdef RADIO_SCROLL_TO_PREV_STATION + if(gNumRetunePresses < 0) { gStreamedSound = m_nCurrentStreamedSound; if(gStreamedSound == STREAMED_SOUND_CITY_AMBIENT || gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) { - gStreamedSound = STREAMED_SOUND_RADIO_POLICE; - } else { + gStreamedSound = POLICE_RADIO; // which means OFF + + } else if(gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER) + return; + + gRetuneCounter = gNumRetunePresses; + pRetune = gStreamedSound; - if(gStreamedSound > - STREAMED_SOUND_RADIO_MP3_PLAYER) - return; + while(gRetuneCounter < 0) { + if(pRetune == HEAD_RADIO) { + pRetune = RADIO_OFF; + } else if(pRetune == RADIO_OFF || pRetune == POLICE_RADIO) { + pRetune = SampleManager.IsMP3RadioChannelAvailable() ? USERTRACK : USERTRACK - 1; + } else + pRetune--; + + ++gRetuneCounter; } + } else +#endif + if(SampleManager.IsMP3RadioChannelAvailable()) { + gStreamedSound = m_nCurrentStreamedSound; + + if(gStreamedSound == STREAMED_SOUND_CITY_AMBIENT || + gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) { + gStreamedSound = POLICE_RADIO; // which means OFF + } else if(gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER) + return; pRetune = gNumRetunePresses + gStreamedSound; @@ -140,10 +162,17 @@ cMusicManager::DisplayRadioStationName() case FLASHBACK: string = TheText.Get("FEA_FM7"); break; case CHATTERBOX: string = TheText.Get("FEA_FM8"); break; case USERTRACK: string = TheText.Get("FEA_FM9"); break; +#ifdef RADIO_OFF_TEXT + case RADIO_OFF: case POLICE_RADIO: string = TheText.Get("FEM_OFF"); break; +#endif default: return; }; +#ifdef RADIO_OFF_TEXT + if(pRetune == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable()) { string = TheText.Get("FEM_OFF"); } +#else if(pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { return; } +#endif if(string && pCurrentStation != string || m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER && @@ -448,17 +477,31 @@ cMusicManager::ServiceGameMode() if (m_bPlayerInCar) { if (FindPlayerPed() != nil && !FindPlayerPed()->DyingOrDead() - && CPad::GetPad(0)->ChangeStationJustDown() && !CReplay::IsPlayingBack() && FindPlayerVehicle() != nil && !UsesPoliceRadio(FindPlayerVehicle())) { - gRetuneCounter = 30; - gNumRetunePresses++; - AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f); - if (SampleManager.IsMP3RadioChannelAvailable()) { - if (gNumRetunePresses > RADIO_OFF) - gNumRetunePresses -= RADIO_OFF; + + if (CPad::GetPad(0)->ChangeStationJustDown()) { + gRetuneCounter = 30; + gNumRetunePresses++; + AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f); + if (SampleManager.IsMP3RadioChannelAvailable()) { + if (gNumRetunePresses > RADIO_OFF) + gNumRetunePresses -= RADIO_OFF; + } + } +#ifdef RADIO_SCROLL_TO_PREV_STATION + else if(CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown()) { + int scrollNext = ControlsManager.GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, MOUSE); + int scrollPrev = scrollNext == rsMOUSEWHEELUPBUTTON ? rsMOUSEWHEELDOWNBUTTON : scrollNext == rsMOUSEWHEELDOWNBUTTON ? rsMOUSEWHEELUPBUTTON : -1; + + if (scrollPrev != -1 && !ControlsManager.IsAnyVehicleActionAssignedToMouseKey(scrollPrev)) { + gRetuneCounter = 30; + gNumRetunePresses--; + AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f); + } } +#endif } } else { nFramesSinceCutsceneEnded = -1; @@ -500,10 +543,22 @@ cMusicManager::ServiceGameMode() gNumRetunePresses = 0; m_bSetNextStation = false; } + // Because when you switch radio back and forth, gNumRetunePresses will be 0 but gRetuneCounter won't. +#ifdef RADIO_SCROLL_TO_PREV_STATION + if (gRetuneCounter != 0) { + if (gRetuneCounter > 1) gRetuneCounter--; + else if (gRetuneCounter == 1) gRetuneCounter = -1; + else if (gRetuneCounter == -1) { + m_bSetNextStation = true; + gRetuneCounter = 0; + } + } +#else if (gNumRetunePresses) { if (gRetuneCounter != 0) gRetuneCounter--; else m_bSetNextStation = true; } +#endif if (gRetuneCounter) AudioManager.DoPoliceRadioCrackle(); if (m_bSetNextStation) { @@ -869,6 +924,20 @@ cMusicManager::GetNextCarTuning() if (veh == nil) return RADIO_OFF; if (UsesPoliceRadio(veh)) return POLICE_RADIO; if (gNumRetunePresses != 0) { +#ifdef RADIO_SCROLL_TO_PREV_STATION + if (gNumRetunePresses < 0) { + while (gNumRetunePresses < 0) { + if(veh->m_nRadioStation == HEAD_RADIO) { + veh->m_nRadioStation = RADIO_OFF; + } else if(veh->m_nRadioStation == RADIO_OFF || veh->m_nRadioStation == POLICE_RADIO) { + veh->m_nRadioStation = SampleManager.IsMP3RadioChannelAvailable() ? USERTRACK : USERTRACK - 1; + } else + veh->m_nRadioStation--; + + ++gNumRetunePresses; + } + } else +#endif if (SampleManager.IsMP3RadioChannelAvailable()) { if (veh->m_nRadioStation == RADIO_OFF) veh->m_nRadioStation = POLICE_RADIO; diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index 665494a3..37421904 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -93,7 +93,7 @@ cAudioManager::InitialisePoliceRadio() for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; - SampleManager.SetChannelReverbFlag(policeChannel, 0); + SampleManager.SetChannelReverbFlag(policeChannel, false); gSpecialSuspectLastSeenReport = false; for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++) gMinTimeToNextReport[i] = m_FrameCounter; diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 418195c7..2b79b338 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -158,7 +158,7 @@ void CGarages::Init(void) aCarsInSafeHouse3[i].Init(); hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1); if (hGarages >= 0) - DMAudio.SetEntityStatus(hGarages, 1); + DMAudio.SetEntityStatus(hGarages, true); AddOne( CVector(CRUSHER_GARAGE_X1, CRUSHER_GARAGE_Y1, CRUSHER_GARAGE_Z1), CVector(CRUSHER_GARAGE_X2, CRUSHER_GARAGE_Y2, CRUSHER_GARAGE_Z2), diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 67d2e618..6aa48d81 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -58,7 +58,7 @@ int32 CTheScripts::StoreVehicleIndex; bool CTheScripts::StoreVehicleWasRandom; CRunningScript *CTheScripts::pIdleScripts; CRunningScript *CTheScripts::pActiveScripts; -uint32 CTheScripts::NextFreeCollectiveIndex; +int32 CTheScripts::NextFreeCollectiveIndex; int32 CTheScripts::LastRandomPedId; uint16 CTheScripts::NumberOfUsedObjects; bool CTheScripts::bAlreadyRunningAMissionScript; @@ -1810,8 +1810,8 @@ void CTheScripts::Init() OnAMissionForContactFlag[i] = 0; } for (int i = 0; i < MAX_NUM_COLLECTIVES; i++){ - CollectiveArray[i].index = -1; - CollectiveArray[i].unk_data = 0; + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; } NextFreeCollectiveIndex = 0; LastRandomPedId = -1; diff --git a/src/control/Script.h b/src/control/Script.h index 7fc18727..1c4663ce 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -1,5 +1,6 @@ #pragma once #include "common.h" +#include "Ped.h" #include "PedType.h" #include "Text.h" #include "Sprite2d.h" @@ -38,6 +39,10 @@ void FlushLog(); #define KEY_LENGTH_IN_SCRIPT 8 +#if GTA_VERSION <= GTA_PS2_160 +#define GTA_SCRIPT_COLLECTIVE +#endif + struct intro_script_rectangle { bool m_bIsUsed; @@ -213,8 +218,8 @@ enum { struct tCollectiveData { - int32 index; - uint32 unk_data; + int32 colIndex; + int32 pedIndex; }; enum { @@ -286,7 +291,7 @@ class CTheScripts static bool StoreVehicleWasRandom; static CRunningScript *pIdleScripts; static CRunningScript *pActiveScripts; - static uint32 NextFreeCollectiveIndex; + static int32 NextFreeCollectiveIndex; static int32 LastRandomPedId; static uint16 NumberOfUsedObjects; static bool bAlreadyRunningAMissionScript; @@ -393,6 +398,25 @@ private: static int32 GetNewUniqueScriptSphereIndex(int32 index); static void RemoveScriptSphere(int32 index); +#ifdef GTA_SCRIPT_COLLECTIVE + static void AdvanceCollectiveIndex() + { + if (NextFreeCollectiveIndex == INT32_MAX) + NextFreeCollectiveIndex = 0; + else + NextFreeCollectiveIndex++; + } + + static int AddPedsInVehicleToCollective(int); + static int AddPedsInAreaToCollective(float, float, float, float); + static int FindFreeSlotInCollectiveArray(); + static void SetObjectiveForAllPedsInCollective(int, eObjective, int16, int16); + static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector, float); + static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector); + static void SetObjectiveForAllPedsInCollective(int, eObjective, void*); + static void SetObjectiveForAllPedsInCollective(int, eObjective); +#endif + friend class CRunningScript; friend class CHud; friend void CMissionCleanup::Process(); @@ -511,6 +535,14 @@ private: void CharInAreaCheckCommand(int32, uint32*); void CarInAreaCheckCommand(int32, uint32*); +#ifdef GTA_SCRIPT_COLLECTIVE + void LocateCollectiveCommand(int32, uint32*); + void LocateCollectiveCharCommand(int32, uint32*); + void LocateCollectiveCarCommand(int32, uint32*); + void LocateCollectivePlayerCommand(int32, uint32*); + void CollectiveInAreaCheckCommand(int32, uint32*); +#endif + #ifdef MISSION_REPLAY bool CanAllowMissionReplay(); #endif diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index 1f1ed537..9a37cb6c 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -853,7 +853,12 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING); return 0; } - //case COMMAND_SET_COLL_OBJ_NO_OBJ: +#ifdef GTA_SCRIPT_COLLECTIVE + case COMMAND_SET_COLL_OBJ_NO_OBJ: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_NONE); + return 0; +#endif default: script_assert(0); } @@ -863,65 +868,314 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) int8 CRunningScript::ProcessCommands600To699(int32 command) { switch (command){ - /* Collective commands are not implemented until LCS. +#ifdef GTA_SCRIPT_COLLECTIVE case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_ON_FOOT); + return 0; case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE); + return 0; case COMMAND_SET_COLL_OBJ_GUARD_SPOT: + { + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[1]; + if (pos.z <= MAP_Z_LOW_LIMIT) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos); + return 0; + } case COMMAND_SET_COLL_OBJ_GUARD_AREA: + { + CollectParameters(&m_nIp, 5); + float infX = *(float*)&ScriptParams[1]; + float supX = *(float*)&ScriptParams[3]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[1]; + } + float infY = *(float*)&ScriptParams[2]; + float supY = *(float*)&ScriptParams[4]; + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[2]; + } + CVector pos; + pos.x = (infX + supX) / 2; + pos.y = (infY + supY) / 2; + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + float radius = Max(pos.x - infX, pos.y - infY); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos, radius); + return 0; + } case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_IN_CAR); + return 0; case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed); + return 0; + } case COMMAND_SET_COLL_OBJ_LEAVE_CAR: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_LEAVE_CAR); + return 0; case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle); + return 0; + } case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); + return 0; + } + /* case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_IN_CAR: case COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE: case COMMAND_SET_COLL_OBJ_DESTROY_OBJECT: + */ case COMMAND_SET_COLL_OBJ_DESTROY_CAR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_DESTROY_CAR, pVehicle); + return 0; + } case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT: + { + CollectParameters(&m_nIp, 5); + float infX = *(float*)&ScriptParams[1]; + float supX = *(float*)&ScriptParams[3]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[1]; + } + float infY = *(float*)&ScriptParams[2]; + float supY = *(float*)&ScriptParams[4]; + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[2]; + } + CVector pos; + pos.x = (infX + supX) / 2; + pos.y = (infY + supY) / 2; + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + float radius = Max(pos.x - infX, pos.y - infY); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius); + return 0; + } + /* case COMMAND_SET_COLL_OBJ_GOTO_AREA_IN_CAR: case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: case COMMAND_SET_COLL_OBJ_GUARD_ATTACK: + */ case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE: + CollectParameters(&m_nIp, 3); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]); + return 0; case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT: - case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR: + { + CollectParameters(&m_nIp, 3); + CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2])); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos); + return 0; + } + //case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR: case COMMAND_SET_COLL_OBJ_RUN_TO_AREA: + { + CollectParameters(&m_nIp, 5); + float infX = *(float*)&ScriptParams[1]; + float supX = *(float*)&ScriptParams[3]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[1]; + } + float infY = *(float*)&ScriptParams[2]; + float supY = *(float*)&ScriptParams[4]; + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[2]; + } + CVector pos; + pos.x = (infX + supX) / 2; + pos.y = (infY + supY) / 2; + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + float radius = Max(pos.x - infX, pos.y - infY); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos, radius); + return 0; + } case COMMAND_SET_COLL_OBJ_RUN_TO_COORD: + { + CollectParameters(&m_nIp, 3); + CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2])); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos); + return 0; + } case COMMAND_ADD_PEDS_IN_AREA_TO_COLL: + { + CollectParameters(&m_nIp, 3); + float X = *(float*)&ScriptParams[0]; + float Y = *(float*)&ScriptParams[1]; + float Z = CWorld::FindGroundZForCoord(X, Y); + float radius = *(float*)&ScriptParams[2]; + ScriptParams[0] = CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius); + StoreParameters(&m_nIp, 1); + return 0; + } case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL: + CollectParameters(&m_nIp, 1); + ScriptParams[0] = CTheScripts::AddPedsInVehicleToCollective(ScriptParams[0]); + StoreParameters(&m_nIp, 1); + return 0; case COMMAND_CLEAR_COLL: + CollectParameters(&m_nIp, 1); + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CTheScripts::CollectiveArray[i].colIndex == ScriptParams[0]) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + } + } + return 0; case COMMAND_IS_COLL_IN_CARS: + { + CollectParameters(&m_nIp, 1); + bool result = true; + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + } + else { + result = false; + break; + } + } + UpdateCompareFlag(result); + return 0; + } case COMMAND_LOCATE_COLL_ANY_MEANS_2D: case COMMAND_LOCATE_COLL_ON_FOOT_2D: case COMMAND_LOCATE_COLL_IN_CAR_2D: case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D: case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D: case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D: + LocateCollectiveCommand(command, &m_nIp); + return 0; case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D: case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D: case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D: + LocateCollectiveCharCommand(command, &m_nIp); + return 0; case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D: case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D: case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D: + LocateCollectiveCarCommand(command, &m_nIp); + return 0; case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D: case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D: case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D: + LocateCollectivePlayerCommand(command, &m_nIp); + return 0; case COMMAND_IS_COLL_IN_AREA_2D: case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D: case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D: case COMMAND_IS_COLL_STOPPED_IN_AREA_2D: case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D: case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D: + CollectiveInAreaCheckCommand(command, &m_nIp); + return 0; case COMMAND_GET_NUMBER_OF_PEDS_IN_COLL: - */ + { + CollectParameters(&m_nIp, 1); + int total = 0; + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + } + else { + total++; + } + } + ScriptParams[0] = total; + StoreParameters(&m_nIp, 1); + return 0; + } +#endif case COMMAND_SET_CHAR_HEED_THREATS: { CollectParameters(&m_nIp, 2); @@ -1046,7 +1300,31 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); return 0; } - //case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS: +#ifdef GTA_SCRIPT_COLLECTIVE + case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS: + { + CollectParameters(&m_nIp, 5); + float infX = *(float*)&ScriptParams[1]; + float supX = *(float*)&ScriptParams[3]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[1]; + } + float infY = *(float*)&ScriptParams[2]; + float supY = *(float*)&ScriptParams[4]; + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[2]; + } + CVector pos; + pos.x = (infX + supX) / 2; + pos.y = (infY + supY) / 2; + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + float radius = Max(pos.x - infX, pos.y - infY); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); + return 0; + } +#endif case COMMAND_IS_PLAYER_STOPPED: { CollectParameters(&m_nIp, 1); diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index afd6eba4..3c794859 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -244,7 +244,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->SetObjective(OBJECTIVE_CATCH_TRAIN); return 0; } - //case COMMAND_SET_COLL_OBJ_CATCH_TRAIN: +#ifdef GTA_SCRIPT_COLLECTIVE + case COMMAND_SET_COLL_OBJ_CATCH_TRAIN: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_CATCH_TRAIN); + return 0; +#endif case COMMAND_SET_PLAYER_NEVER_GETS_TIRED: { CollectParameters(&m_nIp, 2); @@ -1090,7 +1095,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) case COMMAND_GIVE_PLAYER_DETONATOR: CGarages::GivePlayerDetonator(); return 0; - //case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR: +#ifdef GTA_SCRIPT_COLLECTIVE + case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR: + CollectParameters(&m_nIp, 1); + CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_STEAL_ANY_CAR); + return 0; +#endif case COMMAND_SET_OBJECT_VELOCITY: { CollectParameters(&m_nIp, 4); @@ -2002,10 +2012,10 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case COMMAND_PRINT_HELP: { if (CCamera::m_bUseMouse3rdPerson && ( - strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "HELP15", 7) == 0 || - strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2A", 7) == 0 || - strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_3A", 7) == 0 || - strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_4A", 7) == 0)) { + strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "HELP15") == 0 || + strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2A") == 0 || + strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_3A") == 0 || + strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_4A") == 0)) { m_nIp += KEY_LENGTH_IN_SCRIPT; return 0; } diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 153f2393..c7e190ac 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -1304,6 +1304,487 @@ int16 CRunningScript::GetPadState(uint16 pad, uint16 button) return 0; } +#ifdef GTA_SCRIPT_COLLECTIVE +void CRunningScript::LocateCollectiveCommand(int32 command, uint32* pIp) +{ + bool b3D, result, debug, decided = false; + float X, Y, Z, dX, dY, dZ; + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_2D: + case COMMAND_LOCATE_COLL_IN_CAR_2D: + case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D: + case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D: + case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D: + b3D = false; + break; + default: + b3D = true; + break; + } + CollectParameters(pIp, b3D ? 8 : 6); + X = *(float*)&ScriptParams[1]; + Y = *(float*)&ScriptParams[2]; + if (b3D) { + Z = *(float*)&ScriptParams[3]; + dX = *(float*)&ScriptParams[4]; + dY = *(float*)&ScriptParams[5]; + dZ = *(float*)&ScriptParams[6]; + debug = ScriptParams[7]; + } + else { + dX = *(float*)&ScriptParams[3]; + dY = *(float*)&ScriptParams[4]; + debug = ScriptParams[5]; + } + result = true; + for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) { + if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex) + continue; + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + continue; + } + CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + switch (command) { + case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D: + case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D: + case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D: + if (!CTheScripts::IsPedStopped(pPed)) { + result = false; + decided = true; + } + break; + default: + break; + } + if (!decided) { + bool in_area; + if (b3D) { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y && + Z - dZ <= pos.z && + Z + dZ >= pos.z; + } + else { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y; + } + result = false; + if (in_area) { + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_2D: + case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D: + result = true; + break; + case COMMAND_LOCATE_COLL_ON_FOOT_2D: + case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D: + result = !pPed->bInVehicle; + break; + case COMMAND_LOCATE_COLL_IN_CAR_2D: + case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D: + result = pPed->bInVehicle; + break; + default: + script_assert(false); + break; + } + } + } + } + UpdateCompareFlag(result); + if (debug) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT); + if (CTheScripts::DbgFlag) { + if (b3D) + CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ); + else + CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY); + } +} + +void CRunningScript::LocateCollectiveCharCommand(int32 command, uint32* pIp) +{ + bool b3D, result, debug; + float X, Y, Z, dX, dY, dZ; + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D: + case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D: + b3D = false; + break; + default: + b3D = true; + break; + } + CollectParameters(pIp, b3D ? 6 : 5); + CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + script_assert(pTarget); + if (pTarget->bInVehicle) { + X = pTarget->m_pMyVehicle->GetPosition().x; + Y = pTarget->m_pMyVehicle->GetPosition().y; + Z = pTarget->m_pMyVehicle->GetPosition().z; + } + else { + X = pTarget->GetPosition().x; + Y = pTarget->GetPosition().y; + Z = pTarget->GetPosition().z; + } + dX = *(float*)&ScriptParams[2]; + dY = *(float*)&ScriptParams[3]; + if (b3D) { + dZ = *(float*)&ScriptParams[4]; + debug = ScriptParams[5]; + } + else { + debug = ScriptParams[4]; + } + result = true; + for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) { + if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex) + continue; + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + continue; + } + CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + bool in_area; + if (b3D) { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y && + Z - dZ <= pos.z && + Z + dZ >= pos.z; + } + else { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y; + } + result = false; + if (in_area) { + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D: + result = true; + break; + case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D: + result = !pPed->bInVehicle; + break; + case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D: + result = pPed->bInVehicle; + break; + default: + script_assert(false); + break; + } + } + } + UpdateCompareFlag(result); + if (debug) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT); + if (CTheScripts::DbgFlag) { + if (b3D) + CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ); + else + CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY); + } +} + +void CRunningScript::LocateCollectiveCarCommand(int32 command, uint32* pIp) +{ + bool b3D, result, debug; + float X, Y, Z, dX, dY, dZ; + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D: + case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D: + b3D = false; + break; + default: + b3D = true; + break; + } + CollectParameters(pIp, b3D ? 6 : 5); + CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + script_assert(pTarget); + X = pTarget->GetPosition().x; + Y = pTarget->GetPosition().y; + Z = pTarget->GetPosition().z; + dX = *(float*)&ScriptParams[2]; + dY = *(float*)&ScriptParams[3]; + if (b3D) { + dZ = *(float*)&ScriptParams[4]; + debug = ScriptParams[5]; + } + else { + debug = ScriptParams[4]; + } + result = true; + for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) { + if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex) + continue; + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + continue; + } + CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + bool in_area; + if (b3D) { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y && + Z - dZ <= pos.z && + Z + dZ >= pos.z; + } + else { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y; + } + result = false; + if (in_area) { + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D: + result = true; + break; + case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D: + result = !pPed->bInVehicle; + break; + case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D: + result = pPed->bInVehicle; + break; + default: + script_assert(false); + break; + } + } + } + UpdateCompareFlag(result); + if (debug) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT); + if (CTheScripts::DbgFlag) { + if (b3D) + CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ); + else + CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY); + } +} + +void CRunningScript::LocateCollectivePlayerCommand(int32 command, uint32* pIp) +{ + bool b3D, result, debug; + float X, Y, Z, dX, dY, dZ; + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D: + case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D: + b3D = false; + break; + default: + b3D = true; + break; + } + CollectParameters(pIp, b3D ? 6 : 5); + CVector pos = CWorld::Players[ScriptParams[1]].GetPos(); + X = pos.x; + Y = pos.y; + Z = pos.z; + dX = *(float*)&ScriptParams[2]; + dY = *(float*)&ScriptParams[3]; + if (b3D) { + dZ = *(float*)&ScriptParams[4]; + debug = ScriptParams[5]; + } + else { + debug = ScriptParams[4]; + } + result = true; + for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) { + if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex) + continue; + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + continue; + } + CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + bool in_area; + if (b3D) { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y && + Z - dZ <= pos.z && + Z + dZ >= pos.z; + } + else { + in_area = X - dX <= pos.x && + X + dX >= pos.x && + Y - dY <= pos.y && + Y + dY >= pos.y; + } + result = false; + if (in_area) { + switch (command) { + case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D: + result = true; + break; + case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D: + result = !pPed->bInVehicle; + break; + case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D: + result = pPed->bInVehicle; + break; + default: + script_assert(false); + break; + } + } + } + UpdateCompareFlag(result); + if (debug) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT); + if (CTheScripts::DbgFlag) { + if (b3D) + CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ); + else + CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY); + } +} + +void CRunningScript::CollectiveInAreaCheckCommand(int32 command, uint32* pIp) +{ + bool b3D, result, debug, decided = false; + float infX, infY, infZ, supX, supY, supZ; + switch (command) { + case COMMAND_IS_COLL_IN_AREA_2D: + case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D: + case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D: + b3D = false; + break; + default: + b3D = true; + break; + } + CollectParameters(pIp, b3D ? 8 : 6); + infX = *(float*)&ScriptParams[1]; + infY = *(float*)&ScriptParams[2]; + if (b3D) { + infZ = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[5]; + supZ = *(float*)&ScriptParams[6]; + if (infZ > supZ) { + infZ = *(float*)&ScriptParams[6]; + supZ = *(float*)&ScriptParams[3]; + } + debug = ScriptParams[7]; + } + else { + supX = *(float*)&ScriptParams[3]; + supY = *(float*)&ScriptParams[4]; + debug = ScriptParams[5]; + } + if (infX > supX) { + float tmp = infX; + infX = supX; + supX = tmp; + } + if (infY > supY) { + float tmp = infY; + infY = supY; + supY = tmp; + } + result = true; + for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) { + if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex) + continue; + CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex); + if (!pPed) { + CTheScripts::CollectiveArray[i].colIndex = -1; + CTheScripts::CollectiveArray[i].pedIndex = 0; + continue; + } + CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + switch (command) { + case COMMAND_IS_COLL_STOPPED_IN_AREA_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D: + if (!CTheScripts::IsPedStopped(pPed)) { + result = false; + decided = true; + } + break; + default: + break; + } + if (!decided) { + bool in_area; + if (b3D) { + in_area = infX <= pos.x && + supX >= pos.x && + infY <= pos.y && + supY >= pos.y && + infZ <= pos.z && + supZ >= pos.z; + } + else { + in_area = infX <= pos.x && + supX >= pos.x && + infY <= pos.y && + supY >= pos.y; + } + result = false; + if (in_area) { + switch (command) { + case COMMAND_IS_COLL_IN_AREA_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_2D: + result = true; + break; + case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D: + result = !pPed->bInVehicle; + break; + case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D: + result = pPed->bInVehicle; + break; + default: + script_assert(false); + break; + } + } + } + } + UpdateCompareFlag(result); + if (debug) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, infX, infY, supX, supY, b3D ? (infZ + supZ) / 2 : MAP_Z_LOW_LIMIT); + if (CTheScripts::DbgFlag) { + if (b3D) + CTheScripts::DrawDebugCube(infX, infY, infZ, supX, supY, supZ); + else + CTheScripts::DrawDebugSquare(infX, infY, supX, supY); + } +} +#endif void CTheScripts::PrintListSizes() { @@ -1717,6 +2198,172 @@ void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, fl CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, ¢er, supX - center.x, 0.0f, 0.0f, center.y - supY, 0); } +#ifdef GTA_SCRIPT_COLLECTIVE +int CTheScripts::AddPedsInVehicleToCollective(int index) +{ + int colIndex = NextFreeCollectiveIndex; + AdvanceCollectiveIndex(); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(index); + script_assert(pVehicle); + CPed* pDriver = pVehicle->pDriver; + if (pDriver && !pDriver->IsPlayer() && pDriver->CharCreatedBy != MISSION_CHAR && pDriver->m_nPedType != PEDTYPE_COP) { + int index = FindFreeSlotInCollectiveArray(); + if (index > -1) { + CollectiveArray[index].colIndex = colIndex; + CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pDriver); + } + } + for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) { + CPed* pPassenger = pVehicle->pPassengers[i]; + if (pPassenger && !pPassenger->IsPlayer() && pPassenger->CharCreatedBy != MISSION_CHAR && pPassenger->m_nPedType != PEDTYPE_COP) { + int index = FindFreeSlotInCollectiveArray(); + if (index > -1) { + CollectiveArray[index].colIndex = colIndex; + CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPassenger); + } + } + } + return colIndex; +} + +int CTheScripts::AddPedsInAreaToCollective(float x, float y, float z, float radius) +{ + int16 numFound; + CEntity* pEntities[64]; + int colIndex = NextFreeCollectiveIndex; + AdvanceCollectiveIndex(); + CWorld::FindObjectsInRange(CVector(x, y, z), radius, true, &numFound, 64, pEntities, false, true, true, false, false); + for (int16 i = 0; i < numFound; i++) { + if (pEntities[i]->GetType() == ENTITY_TYPE_PED) { + CPed* pPed = (CPed*)pEntities[i]; + if (pPed && !pPed->IsPlayer() && pPed->CharCreatedBy != MISSION_CHAR && pPed->m_nPedType != PEDTYPE_COP) { + int index = FindFreeSlotInCollectiveArray(); + if (index > -1) { + CollectiveArray[index].colIndex = colIndex; + CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPed); + } + } + } + else if (pEntities[i]->GetType() == ENTITY_TYPE_VEHICLE) { + CVehicle* pVehicle = (CVehicle*)pEntities[i]; + CPed* pDriver = pVehicle->pDriver; + if (pDriver && !pDriver->IsPlayer() && pDriver->CharCreatedBy != MISSION_CHAR && pDriver->m_nPedType != PEDTYPE_COP) { + int index = FindFreeSlotInCollectiveArray(); + if (index > -1) { + CollectiveArray[index].colIndex = colIndex; + CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pDriver); + } + } + for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) { + CPed* pPassenger = pVehicle->pPassengers[i]; + if (pPassenger && !pPassenger->IsPlayer() && pPassenger->CharCreatedBy != MISSION_CHAR && pPassenger->m_nPedType != PEDTYPE_COP) { + int index = FindFreeSlotInCollectiveArray(); + if (index > -1) { + CollectiveArray[index].colIndex = colIndex; + CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPassenger); + } + } + } + } + } + return colIndex; +} + +int CTheScripts::FindFreeSlotInCollectiveArray() +{ + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CollectiveArray[i].colIndex == -1) + return i; + } + return -1; +} + +void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2) +{ + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CollectiveArray[i].colIndex = colIndex) { + CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); + if (pPed == nil) { + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; + } + else { + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(objective, p1, p2); + } + } + } +} + +void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2) +{ + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CollectiveArray[i].colIndex = colIndex) { + CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); + if (pPed == nil) { + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; + } + else { + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(objective, p1, p2); + } + } + } +} + +void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1) +{ + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CollectiveArray[i].colIndex = colIndex) { + CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); + if (pPed == nil) { + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; + } + else { + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(objective, p1); + } + } + } +} + +void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1) +{ + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CollectiveArray[i].colIndex = colIndex) { + CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); + if (pPed == nil) { + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; + } + else { + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(objective, p1); + } + } + } +} + +void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective) +{ + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + if (CollectiveArray[i].colIndex = colIndex) { + CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); + if (pPed == nil) { + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; + } + else { + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(objective); + } + } + } +} +#endif //GTA_SCRIPT_COLLECTIVE + bool CTheScripts::IsPedStopped(CPed* pPed) { if (pPed->bInVehicle) diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index c2937e1d..77dae53a 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -3,6 +3,7 @@ #include "Script.h" #include "ScriptCommands.h" +#include "Bike.h" #include "CarCtrl.h" #include "Cranes.h" #include "Credits.h" @@ -415,8 +416,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) ((CAutomobile*)pVehicle)->m_fTraction = fTraction; else // this is certainly not a boat, trane, heli or plane field - //((CBike*)pVehicle)->m_fTraction = fTraction; - *(float*)(((char*)pVehicle) + 1088) = fTraction; + ((CBike*)pVehicle)->m_fTraction = fTraction; return 0; } case COMMAND_ARE_MEASUREMENTS_IN_METRES: diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 1f498102..b46bd2da 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -2986,12 +2986,12 @@ CCamera::LoadTrainCamNodes(char const *name) char token[16] = { 0 }; char filename[16] = { 0 }; uint8 *buf; - size_t bufpos = 0; + ssize_t bufpos = 0; int field = 0; int tokpos = 0; char c; int i; - size_t len; + ssize_t len; strcpy(filename, name); len = (int)strlen(filename); diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp index f987dea5..4bb31ea4 100644 --- a/src/core/CdStream.cpp +++ b/src/core/CdStream.cpp @@ -73,7 +73,11 @@ CdStreamInitThread(void) gChannelRequestQ.size = gNumChannels + 1; ASSERT(gChannelRequestQ.items != nil ); +#ifdef FIX_BUGS + gCdStreamSema = CreateSemaphore(nil, 0, 5, nil); +#else gCdStreamSema = CreateSemaphore(nil, 0, 5, "CdStream"); +#endif if ( gCdStreamSema == nil ) { diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index cadba7f2..bf4893ea 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -132,6 +132,10 @@ void CControllerConfigManager::LoadSettings(int32 file) { bool bValid = true; +#ifdef BIND_VEHICLE_FIREWEAPON + bool skipVehicleFireWeapon = false; +#endif + if (file) { char buff[29]; @@ -139,18 +143,55 @@ void CControllerConfigManager::LoadSettings(int32 file) if (!strncmp(buff, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1)) bValid = false; - else + else { CFileMgr::Seek(file, 0, 0); + +#ifdef BIND_VEHICLE_FIREWEAPON + // HACK! + // All of this is hacky as fuck. + // We are checking the file size to read the .set file correctly. + // But because .set file is opened in text mode we have to read + // the WHOLE file to get the size we should be working with. + // Joy, ain't it? + char tempBuf[0x1000]; + size_t fileSize = 0, blockSize; + do + { + blockSize = CFileMgr::Read(file, tempBuf, sizeof(tempBuf)); + fileSize += blockSize; + } while (blockSize == sizeof(tempBuf)); + + CFileMgr::Seek(file, 0, 0); + + if (fileSize == 0x671) + skipVehicleFireWeapon = true; +#endif + } } if (bValid) { ControlsManager.MakeControllerActionsBlank(); +#ifdef BIND_VEHICLE_FIREWEAPON + // Set the default settings of VEHICLE_FIREWEAPON + if (skipVehicleFireWeapon) { + SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, rsPADINS, KEYBOARD); + SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA); + if (m_bMouseAssociated) + SetMouseButtonAssociatedWithAction(VEHICLE_FIREWEAPON, 1); + } +#endif + for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++) { for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++) { +#ifdef BIND_VEHICLE_FIREWEAPON + // Skip file read + if (skipVehicleFireWeapon && j == VEHICLE_FIREWEAPON) + continue; +#endif CFileMgr::Read(file, (char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind)); } } @@ -1718,6 +1759,52 @@ void CControllerConfigManager::DeleteMatching1rstPersonControls(e_ControllerActi #undef CLEAR_ACTION_IF_NEEDED +#ifdef RADIO_SCROLL_TO_PREV_STATION +#define CHECK_ACTION(action) \ +if (key == GetControllerKeyAssociatedWithAction(action, type))\ + return true; + +bool CControllerConfigManager::IsAnyVehicleActionAssignedToMouseKey(int32 key) +{ + const eControllerType type = MOUSE; + if (!GetIsKeyBlank(key, type)) + { +#ifdef BIND_VEHICLE_FIREWEAPON + CHECK_ACTION(VEHICLE_FIREWEAPON); +#endif + CHECK_ACTION(VEHICLE_LOOKBEHIND); + CHECK_ACTION(VEHICLE_LOOKLEFT); + CHECK_ACTION(VEHICLE_LOOKRIGHT); + CHECK_ACTION(VEHICLE_LOOKBEHIND); // note: duplicate + CHECK_ACTION(VEHICLE_HORN); + CHECK_ACTION(VEHICLE_HANDBRAKE); + CHECK_ACTION(VEHICLE_ACCELERATE); + CHECK_ACTION(VEHICLE_BRAKE); + CHECK_ACTION(VEHICLE_CHANGE_RADIO_STATION); + CHECK_ACTION(TOGGLE_SUBMISSIONS); + CHECK_ACTION(VEHICLE_TURRETLEFT); + CHECK_ACTION(VEHICLE_TURRETRIGHT); + CHECK_ACTION(VEHICLE_TURRETUP); + CHECK_ACTION(VEHICLE_TURRETDOWN); + CHECK_ACTION(VEHICLE_ENTER_EXIT); + CHECK_ACTION(CAMERA_CHANGE_VIEW_ALL_SITUATIONS); +#ifndef BIND_VEHICLE_FIREWEAPON + CHECK_ACTION(PED_FIREWEAPON); +#endif + CHECK_ACTION(GO_LEFT); + CHECK_ACTION(GO_RIGHT); + CHECK_ACTION(NETWORK_TALK); + CHECK_ACTION(SWITCH_DEBUG_CAM_ON); + CHECK_ACTION(TOGGLE_DPAD); + CHECK_ACTION(TAKE_SCREEN_SHOT); + CHECK_ACTION(SHOW_MOUSE_POINTER_TOGGLE); + } + return false; +} + +#undef CHECK_ACTION +#endif + void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction action, int32 key, eControllerType type) { if (!GetIsKeyBlank(key, type)) diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h index 92017a93..d3c2293d 100644 --- a/src/core/ControllerConfig.h +++ b/src/core/ControllerConfig.h @@ -188,6 +188,10 @@ public: void DeleteMatching1rstPersonControls (e_ControllerAction action, int32 key, eControllerType type); void DeleteMatchingActionInitiators (e_ControllerAction action, int32 key, eControllerType type); +#ifdef RADIO_SCROLL_TO_PREV_STATION + bool IsAnyVehicleActionAssignedToMouseKey(int32 key); +#endif + bool GetIsKeyBlank(int32 key, eControllerType type); e_ControllerActionType GetActionType(e_ControllerAction action); diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp index 8d69ba78..93f72d4e 100644 --- a/src/core/EventList.cpp +++ b/src/core/EventList.cpp @@ -120,7 +120,7 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent } if(criminal == FindPlayerPed()) - ReportCrimeForEvent(type, (uintptr)ent, copsDontCare); + ReportCrimeForEvent(type, (intptr)ent, copsDontCare); } void @@ -198,7 +198,7 @@ CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event) } void -CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare) +CEventList::ReportCrimeForEvent(eEventType type, intptr crimeId, bool copsDontCare) { eCrimeType crime; switch(type){ diff --git a/src/core/EventList.h b/src/core/EventList.h index 8840afc4..4ced3a83 100644 --- a/src/core/EventList.h +++ b/src/core/EventList.h @@ -59,7 +59,7 @@ public: static bool GetEvent(eEventType type, int32 *event); static void ClearEvent(int32 event); static bool FindClosestEvent(eEventType type, CVector posn, int32 *event); - static void ReportCrimeForEvent(eEventType type, int32, bool); + static void ReportCrimeForEvent(eEventType type, intptr, bool); }; extern CEvent gaEvent[NUMEVENTS];
\ No newline at end of file diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index ac488dc9..926512b9 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -72,7 +72,11 @@ CFileLoader::LoadLevel(const char *filename) if(*line == '#') continue; - if(strncmp(line, "EXIT", 9) == 0) // BUG: 9? +#ifdef FIX_BUGS + if(strncmp(line, "EXIT", 4) == 0) +#else + if(strncmp(line, "EXIT", 9) == 0) +#endif break; if(strncmp(line, "IMAGEPATH", 9) == 0){ @@ -191,7 +195,7 @@ CFileLoader::LoadTexDictionary(const char *filename) struct ColHeader { - char ident[4]; + uint32 ident; uint32 size; }; @@ -209,7 +213,7 @@ CFileLoader::LoadCollisionFile(const char *filename) fd = CFileMgr::OpenFile(filename, "rb"); while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){ - assert(strncmp(header.ident, "COLL", 4) == 0); + assert(header.ident == 'LLOC'); CFileMgr::Read(fd, (char*)work_buff, header.size); memcpy(modelname, work_buff, 24); @@ -863,6 +867,9 @@ CFileLoader::AddTexDictionaries(RwTexDictionary *dst, RwTexDictionary *src) RwTexDictionaryForAllTextures(src, MoveTexturesCB, dst); } +#define isLine3(l, a, b, c) ((l[0] == a) && (l[1] == b) && (l[2] == c)) +#define isLine4(l, a, b, c, d) ((l[0] == a) && (l[1] == b) && (l[2] == c) && (l[3] == d)) + void CFileLoader::LoadObjectTypes(const char *filename) { @@ -896,18 +903,18 @@ CFileLoader::LoadObjectTypes(const char *filename) continue; if(section == NONE){ - if(strncmp(line, "objs", 4) == 0) section = OBJS; - else if(strncmp(line, "tobj", 4) == 0) section = TOBJ; - else if(strncmp(line, "hier", 4) == 0) section = HIER; - else if(strncmp(line, "cars", 4) == 0) section = CARS; - else if(strncmp(line, "peds", 4) == 0) section = PEDS; - else if(strncmp(line, "path", 4) == 0) section = PATH; - else if(strncmp(line, "2dfx", 4) == 0) section = TWODFX; - }else if(strncmp(line, "end", 3) == 0){ + if(isLine4(line, 'o','b','j','s')) section = OBJS; + else if(isLine4(line, 't','o','b','j')) section = TOBJ; + else if(isLine4(line, 'h','i','e','r')) section = HIER; + else if(isLine4(line, 'c','a','r','s')) section = CARS; + else if(isLine4(line, 'p','e','d','s')) section = PEDS; + else if(isLine4(line, 'p','a','t','h')) section = PATH; + else if(isLine4(line, '2','d','f','x')) section = TWODFX; + }else if(isLine3(line, 'e','n','d')){ section = section == MLO ? OBJS : NONE; }else switch(section){ case OBJS: - if(strncmp(line, "sta", 3) == 0) + if(isLine3(line, 's','t','a')) mlo = LoadMLO(line); else LoadObject(line); @@ -930,9 +937,9 @@ CFileLoader::LoadObjectTypes(const char *filename) case PATH: if(pathIndex == -1){ id = LoadPathHeader(line, pathTypeStr); - if(strncmp(pathTypeStr, "ped", 4) == 0) + if(strcmp(pathTypeStr, "ped") == 0) pathType = 1; - else if(strncmp(pathTypeStr, "car", 4) == 0) + else if(strcmp(pathTypeStr, "car") == 0) pathType = 0; pathIndex = 0; }else{ @@ -1173,21 +1180,21 @@ CFileLoader::LoadVehicleObject(const char *line) mi->m_level = level; mi->m_compRules = comprules; - if(strncmp(type, "car", 4) == 0){ + if(strcmp(type, "car") == 0){ mi->m_wheelId = misc; mi->m_wheelScale = wheelScale; mi->m_vehicleType = VEHICLE_TYPE_CAR; - }else if(strncmp(type, "boat", 5) == 0){ + }else if(strcmp(type, "boat") == 0){ mi->m_vehicleType = VEHICLE_TYPE_BOAT; - }else if(strncmp(type, "train", 6) == 0){ + }else if(strcmp(type, "train") == 0){ mi->m_vehicleType = VEHICLE_TYPE_TRAIN; - }else if(strncmp(type, "heli", 5) == 0){ + }else if(strcmp(type, "heli") == 0){ mi->m_vehicleType = VEHICLE_TYPE_HELI; - }else if(strncmp(type, "plane", 6) == 0){ + }else if(strcmp(type, "plane") == 0){ mi->m_planeLodId = misc; mi->m_wheelScale = 1.0f; mi->m_vehicleType = VEHICLE_TYPE_PLANE; - }else if(strncmp(type, "bike", 5) == 0){ + }else if(strcmp(type, "bike") == 0){ mi->m_bikeSteerAngle = misc; mi->m_wheelScale = wheelScale; mi->m_vehicleType = VEHICLE_TYPE_BIKE; @@ -1197,31 +1204,31 @@ CFileLoader::LoadVehicleObject(const char *line) mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId); // Well this is kinda dumb.... - if(strncmp(vehclass, "poorfamily", 11) == 0){ + if(strcmp(vehclass, "poorfamily") == 0){ mi->m_vehicleClass = CCarCtrl::POOR; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::POOR); - }else if(strncmp(vehclass, "richfamily", 11) == 0){ + }else if(strcmp(vehclass, "richfamily") == 0){ mi->m_vehicleClass = CCarCtrl::RICH; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::RICH); - }else if(strncmp(vehclass, "executive", 10) == 0){ + }else if(strcmp(vehclass, "executive") == 0){ mi->m_vehicleClass = CCarCtrl::EXEC; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC); - }else if(strncmp(vehclass, "worker", 7) == 0){ + }else if(strcmp(vehclass, "worker") == 0){ mi->m_vehicleClass = CCarCtrl::WORKER; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER); - }else if(strncmp(vehclass, "special", 8) == 0){ + }else if(strcmp(vehclass, "special") == 0){ mi->m_vehicleClass = CCarCtrl::SPECIAL; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::SPECIAL); - }else if(strncmp(vehclass, "big", 4) == 0){ + }else if(strcmp(vehclass, "big") == 0){ mi->m_vehicleClass = CCarCtrl::BIG; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::BIG); - }else if(strncmp(vehclass, "taxi", 5) == 0){ + }else if(strcmp(vehclass, "taxi") == 0){ mi->m_vehicleClass = CCarCtrl::TAXI; while(frequency-- > 0) CCarCtrl::AddToCarArray(id, CCarCtrl::TAXI); @@ -1402,12 +1409,12 @@ CFileLoader::LoadScene(const char *filename) continue; if(section == NONE){ - if(strncmp(line, "inst", 4) == 0) section = INST; - else if(strncmp(line, "zone", 4) == 0) section = ZONE; - else if(strncmp(line, "cull", 4) == 0) section = CULL; - else if(strncmp(line, "pick", 4) == 0) section = PICK; - else if(strncmp(line, "path", 4) == 0) section = PATH; - }else if(strncmp(line, "end", 3) == 0){ + if(isLine4(line, 'i','n','s','t')) section = INST; + else if(isLine4(line, 'z','o','n','e')) section = ZONE; + else if(isLine4(line, 'c','u','l','l')) section = CULL; + else if(isLine4(line, 'p','i','c','k')) section = PICK; + else if(isLine4(line, 'p','a','t','h')) section = PATH; + }else if(isLine3(line, 'e','n','d')){ section = NONE; }else switch(section){ case INST: @@ -1427,6 +1434,7 @@ CFileLoader::LoadScene(const char *filename) // unfinished in the game if(pathIndex == -1){ LoadPathHeader(line, pathTypeStr); + strcmp(pathTypeStr, "ped"); // type not set pathIndex = 0; }else{ @@ -1564,8 +1572,8 @@ CFileLoader::LoadMapZones(const char *filename) continue; if(section == NONE){ - if(strncmp(line, "zone", 4) == 0) section = ZONE; - }else if(strncmp(line, "end", 3) == 0){ + if(isLine4(line, 'z','o','n','e')) section = ZONE; + }else if(isLine3(line, 'e','n','d')){ section = NONE; }else switch(section){ case ZONE: { @@ -1607,20 +1615,20 @@ CFileLoader::ReloadPaths(const char *filename) continue; if (section == NONE) { - if (strncmp(line, "path", 4) == 0) { + if (isLine4(line, 'p','a','t','h')) { section = PATH; ThePaths.AllocatePathFindInfoMem(4500); } - } else if (strncmp(line, "end", 3) == 0) { + } else if (isLine3(line, 'e','n','d')) { section = NONE; } else { switch (section) { case PATH: if (pathIndex == -1) { id = LoadPathHeader(line, pathTypeStr); - if (strncmp(pathTypeStr, "ped", 4) == 0) + if (strcmp(pathTypeStr, "ped") == 0) pathType = 1; - else if (strncmp(pathTypeStr, "car", 4) == 0) + else if (strcmp(pathTypeStr, "car") == 0) pathType = 0; pathIndex = 0; } else { @@ -1663,10 +1671,10 @@ CFileLoader::ReloadObjectTypes(const char *filename) continue; if (section == NONE) { - if (strncmp(line, "objs", 4) == 0) section = OBJS; - else if (strncmp(line, "tobj", 4) == 0) section = TOBJ; - else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX; - } else if (strncmp(line, "end", 3) == 0) { + if (isLine4(line, 'o','b','j','s')) section = OBJS; + else if (isLine4(line, 't','o','b','j')) section = TOBJ; + else if (isLine4(line, '2','d','f','x')) section = TWODFX; + } else if (isLine3(line, 'e','n','d')) { section = NONE; } else { switch (section) { @@ -1738,7 +1746,11 @@ CFileLoader::ReLoadScene(const char *filename) if (*line == '#') continue; - if (strncmp(line, "EXIT", 9) == 0) // BUG: 9? +#ifdef FIX_BUGS + if (strncmp(line, "EXIT", 4) == 0) +#else + if (strncmp(line, "EXIT", 9) == 0) +#endif break; if (strncmp(line, "IDE", 3) == 0) { diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp index 6e6a8efc..99923ddf 100644 --- a/src/core/FileMgr.cpp +++ b/src/core/FileMgr.cpp @@ -240,20 +240,22 @@ CFileMgr::SetDirMyDocuments(void) mychdir(_psGetUserFilesFolder()); } -size_t +ssize_t CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode) { int fd; - size_t n, len; + ssize_t n, len; fd = myfopen(file, mode); if(fd == 0) - return 0; + return -1; len = 0; do{ n = myfread(buf + len, 1, 0x4000, fd); - if(n < 0) +#ifndef FIX_BUGS + if (n < 0) return -1; +#endif len += n; }while(n == 0x4000); buf[len] = 0; @@ -274,13 +276,13 @@ CFileMgr::OpenFileForWriting(const char *file) } size_t -CFileMgr::Read(int fd, const char *buf, int len) +CFileMgr::Read(int fd, const char *buf, ssize_t len) { return myfread((void*)buf, 1, len, fd); } size_t -CFileMgr::Write(int fd, const char *buf, int len) +CFileMgr::Write(int fd, const char *buf, ssize_t len) { return myfwrite((void*)buf, 1, len, fd); } diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h index 4734720e..98a78360 100644 --- a/src/core/FileMgr.h +++ b/src/core/FileMgr.h @@ -9,12 +9,12 @@ public: static void ChangeDir(const char *dir); static void SetDir(const char *dir); static void SetDirMyDocuments(void); - static size_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode); + static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode); static int OpenFile(const char *file, const char *mode); static int OpenFile(const char *file) { return OpenFile(file, "rb"); } static int OpenFileForWriting(const char *file); - static size_t Read(int fd, const char *buf, int len); - static size_t Write(int fd, const char *buf, int len); + static size_t Read(int fd, const char *buf, ssize_t len); + static size_t Write(int fd, const char *buf, ssize_t len); static bool Seek(int fd, int offset, int whence); static bool ReadLine(int fd, char *buf, int len); static int CloseFile(int fd); diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp index 2c57c066..984b21bb 100644 --- a/src/core/Fire.cpp +++ b/src/core/Fire.cpp @@ -43,7 +43,7 @@ CFire::ProcessFire(void) float fDamagePlayer; float fDamagePeds; float fDamageVehicle; - int8 nRandNumber; + int16 nRandNumber; float fGreen; float fRed; CVector lightpos; @@ -135,11 +135,10 @@ CFire::ProcessFire(void) CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2, nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f); } - fGreen = nRandNumber / 128; - fRed = nRandNumber / 128; + fGreen = nRandNumber / 128.f; + fRed = nRandNumber / 128.f; - CPointLights::AddLight(0, m_vecPos, CVector(0.0f, 0.0f, 0.0f), - 12.0f, fRed, fGreen, 0, 0, 0); + CPointLights::AddLight(CPointLights::LIGHT_POINT, m_vecPos, CVector(0.0f, 0.0f, 0.0f), 12.0f, fRed, fGreen, 0, 0, 0); } else { Extinguish(); } diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index e8cc43f1..a6edd444 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -174,7 +174,12 @@ bool CMenuManager::m_PrefsAllowNastyGame = true; bool CMenuManager::m_bStartUpFrontEndRequested; bool CMenuManager::m_bShutDownFrontEndRequested; +#ifdef ASPECT_RATIO_SCALE +int8 CMenuManager::m_PrefsUseWideScreen = AR_AUTO; +#else int8 CMenuManager::m_PrefsUseWideScreen; +#endif + int8 CMenuManager::m_PrefsRadioStation; int32 CMenuManager::m_PrefsBrightness = 256; float CMenuManager::m_PrefsLOD = CRenderer::ms_lodDistScale; @@ -921,7 +926,11 @@ CMenuManager::CheckSliderMovement(int value) case MENUACTION_MOUSESENS: TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ??? TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f); +#ifdef FIX_BUGS + TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; +#else TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl; +#endif break; default: return; @@ -1318,7 +1327,7 @@ CMenuManager::Draw() #endif // Hide back button #ifdef PS2_LIKE_MENU - if ((i == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i+1].m_EntryName[0] == '\0') && strncmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEDS_TB", 8) == 0) + if ((i == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i+1].m_EntryName[0] == '\0') && strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEDS_TB") == 0) break; #endif if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') { @@ -1624,7 +1633,7 @@ CMenuManager::Draw() // Hide back button #ifdef PS2_LIKE_MENU if ((rowToCheck == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[rowToCheck+1].m_EntryName[0] == '\0') && - strncmp(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_EntryName, "FEDS_TB", 8) == 0) + strcmp(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_EntryName, "FEDS_TB") == 0) break; #endif @@ -3074,7 +3083,7 @@ CMenuManager::DrawPlayerSetupScreen() SYSTEMTIME SystemTime; HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData); for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) { - if (strncmp(FindFileData.cFileName, DEFAULT_SKIN_NAME, 5) != 0) { + if (strcmp(FindFileData.cFileName, DEFAULT_SKIN_NAME) != 0) { m_pSelectedSkin->nextSkin = new tSkinInfo; m_pSelectedSkin = m_pSelectedSkin->nextSkin; m_pSelectedSkin->skinId = nextSkinId; @@ -3748,6 +3757,7 @@ CMenuManager::LoadSettings() strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME); strcpy(m_aSkinName, DEFAULT_SKIN_NAME); } + #ifdef LOAD_INI_SETTINGS LoadINISettings(); // needs frontend options to be loaded #endif @@ -4479,13 +4489,21 @@ CMenuManager::ProcessButtonPresses(void) case HOVEROPTION_INCREASE_MOUSESENS: TheCamera.m_fMouseAccelHorzntl += (1.0f / 3000); TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); +#ifdef FIX_BUGS + TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; +#else TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl; +#endif SaveSettings(); break; case HOVEROPTION_DECREASE_MOUSESENS: TheCamera.m_fMouseAccelHorzntl -= (1.0f / 3000); TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); +#ifdef FIX_BUGS + TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; +#else TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl; +#endif SaveSettings(); break; } @@ -4658,15 +4676,15 @@ CMenuManager::ProcessButtonPresses(void) // Hide back button #ifdef PS2_LIKE_MENU - if ((goUp || goDown) && m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME && strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) + if ((goUp || goDown) && m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME && strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") == 0) m_nCurrOption = goUp ? m_nCurrOption - 1 : (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL); #endif if (optionSelected) { int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; if ((option == MENUACTION_CHANGEMENU) || (option == MENUACTION_POPULATESLOTS_CHANGEMENU)) { - if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) != 0 && - strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA", 8) != 0) { + if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") != 0 && + strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA") != 0) { if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) { if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY) @@ -4823,7 +4841,7 @@ CMenuManager::ProcessButtonPresses(void) } } if (changeMenu) { - if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) { + if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") == 0) { #ifndef TIDY_UP_PBP ResetHelperText(); ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0], @@ -4982,7 +5000,11 @@ CMenuManager::ProcessButtonPresses(void) m_PrefsLOD = 1.2f; m_PrefsVsync = true; CRenderer::ms_lodDistScale = 1.2f; +#ifdef ASPECT_RATIO_SCALE + m_PrefsUseWideScreen = AR_AUTO; +#else m_PrefsUseWideScreen = false; +#endif m_PrefsShowSubtitles = true; m_nDisplayVideoMode = m_nPrefsVideoMode; #if GTA_VERSION >= GTA3_PC_11 @@ -5023,7 +5045,12 @@ CMenuManager::ProcessButtonPresses(void) } #endif m_ControlMethod = CONTROL_STANDARD; +#ifdef FIX_BUGS + MousePointerStateHelper.bInvertVertically = true; + TheCamera.m_fMouseAccelVertical = 0.003f; +#else MousePointerStateHelper.bInvertVertically = false; +#endif TheCamera.m_fMouseAccelHorzntl = 0.0025f; CVehicle::m_bDisableMouseSteering = true; TheCamera.m_bHeadBob = false; @@ -6085,7 +6112,7 @@ CMenuManager::PrintMap(void) CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_MOV")); nextX = MENU_X(30.0f); nextY -= 11.0f; TEXT_PIECE("FEC_MSR", 2.0f); TEXT_PIECE("FEC_IBT", 1.0f); - CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_TAR")); + CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEM_TWP")); #undef TEXT_PIECE } diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 126f0341..ff87b95a 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -32,6 +32,7 @@ #include "Fluff.h" #include "Font.h" #include "Frontend.h" +#include "frontendoption.h" #include "GameLogic.h" #include "Garages.h" #include "GenericGameStorage.h" @@ -168,6 +169,11 @@ CGame::InitialiseOnceBeforeRW(void) #ifdef EXTENDED_COLOURFILTER CPostFX::InitOnce(); #endif +#ifdef CUSTOM_FRONTEND_OPTIONS + // Not needed here but may be needed in future + // if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) + CustomFrontendOptionsPopulate(); +#endif return true; } diff --git a/src/core/General.h b/src/core/General.h index dde43c0f..de803558 100644 --- a/src/core/General.h +++ b/src/core/General.h @@ -121,6 +121,15 @@ public: return *str2 != '\0'; } + static bool faststrncmp(const char *str1, const char *str2, uint32 count) + { + for(uint32 i = 0; *str1 && i < count; str1++, str2++, i++) { + if (*str1 != *str2) + return true; + } + return false; + } + static bool faststricmp(const char *str1, const char *str2) { for (; *str1; str1++, str2++) { diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index a81a76c3..9f090e39 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -67,16 +67,6 @@ #define POSTFX_SELECTORS #endif -#ifdef EXTENDED_PIPELINES - #define PIPELINES_SELECTOR \ - MENUACTION_CFO_SELECT, "FED_VPL", { new CCFOSelect((int8*)&CustomPipes::VehiclePipeSwitch, "VehiclePipeline", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), false, nil) }, \ - MENUACTION_CFO_SELECT, "FED_PRM", { new CCFOSelect((int8*)&CustomPipes::RimlightEnable, "NeoRimLight", off_on, 2, false, nil) }, \ - MENUACTION_CFO_SELECT, "FED_WLM", { new CCFOSelect((int8*)&CustomPipes::LightmapEnable, "NeoLightMaps", off_on, 2, false, nil) }, \ - MENUACTION_CFO_SELECT, "FED_RGL", { new CCFOSelect((int8*)&CustomPipes::GlossEnable, "NeoRoadGloss", off_on, 2, false, nil) }, -#else - #define PIPELINES_SELECTOR -#endif - #ifdef INVERT_LOOK_FOR_PAD #define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_IVP", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "InvertPad", off_on, 2, false, nil) }, #else @@ -90,7 +80,6 @@ #endif const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" }; -const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" }; const char *off_on[] = { "FEM_OFF", "FEM_ON" }; void RestoreDefGraphics(int8 action) { @@ -420,7 +409,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = { CUTSCENE_BORDERS_TOGGLE FREE_CAM_TOGGLE POSTFX_SELECTORS - PIPELINES_SELECTOR + // re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, }, @@ -848,14 +837,14 @@ CMenuScreenCustom aScreens[MENUPAGES] = { MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, MULTISAMPLING_SELECTOR + ISLAND_LOADING_SELECTOR + DUALPASS_SELECTOR #ifdef EXTENDED_COLOURFILTER POSTFX_SELECTORS #else MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, #endif - PIPELINES_SELECTOR - ISLAND_LOADING_SELECTOR - DUALPASS_SELECTOR + // re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) }, MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, }, diff --git a/src/core/References.cpp b/src/core/References.cpp index 52abbc3e..6b0c868c 100644 --- a/src/core/References.cpp +++ b/src/core/References.cpp @@ -22,6 +22,66 @@ CReferences::Init(void) } void +CEntity::RegisterReference(CEntity **pent) +{ + if(IsBuilding()) + return; + CReference *ref; + // check if already registered + for(ref = m_pFirstReference; ref; ref = ref->next) + if(ref->pentity == pent) + return; + // have to allocate new reference + ref = CReferences::pEmptyList; + if(ref){ + CReferences::pEmptyList = ref->next; + + ref->pentity = pent; + ref->next = m_pFirstReference; + m_pFirstReference = ref; + return; + } + return; +} + +// Clear all references to this entity +void +CEntity::ResolveReferences(void) +{ + CReference *ref; + // clear pointers to this entity + for(ref = m_pFirstReference; ref; ref = ref->next) + if(*ref->pentity == this) + *ref->pentity = nil; + // free list + if(m_pFirstReference){ + for(ref = m_pFirstReference; ref->next; ref = ref->next) + ; + ref->next = CReferences::pEmptyList; + CReferences::pEmptyList = m_pFirstReference; + m_pFirstReference = nil; + } +} + +// Free all references that no longer point to this entity +void +CEntity::PruneReferences(void) +{ + CReference *ref, *next, **lastnextp; + lastnextp = &m_pFirstReference; + for(ref = m_pFirstReference; ref; ref = next){ + next = ref->next; + if(*ref->pentity == this) + lastnextp = &ref->next; + else{ + *lastnextp = ref->next; + ref->next = CReferences::pEmptyList; + CReferences::pEmptyList = ref; + } + } +} + +void CReferences::RemoveReferencesToPlayer(void) { if(FindPlayerVehicle()) diff --git a/src/core/Streaming.h b/src/core/Streaming.h index ee9183a5..0e2e89be 100644 --- a/src/core/Streaming.h +++ b/src/core/Streaming.h @@ -140,7 +140,7 @@ public: static bool RemoveLeastUsedModel(void); static void RemoveAllUnusedModels(void); static void RemoveUnusedModelsInLoadedList(void); - static bool RemoveReferencedTxds(size_t mem); + static bool RemoveReferencedTxds(size_t mem); // originally signed static int32 GetAvailableVehicleSlot(void); static bool IsTxdUsedByRequestedModels(int32 txdId); static bool AddToLoadedVehiclesList(int32 modelId); @@ -176,11 +176,11 @@ public: static void DeleteFarAwayRwObjects(const CVector &pos); static void DeleteAllRwObjects(void); static void DeleteRwObjectsAfterDeath(const CVector &pos); - static void DeleteRwObjectsBehindCamera(size_t mem); + static void DeleteRwObjectsBehindCamera(size_t mem); // originally signed static void DeleteRwObjectsInSectorList(CPtrList &list); static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y); - static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem); - static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem); + static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem); // originally signed + static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem); // originally signed static void LoadScene(const CVector &pos); diff --git a/src/core/World.cpp b/src/core/World.cpp index b2c1696c..dc99f015 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1600,14 +1600,24 @@ CWorld::ExtinguishAllCarFiresInArea(CVector point, float range) } } +inline void +AddSteamsFromGround(CPtrList& list) +{ + CPtrNode *pNode = list.first; + while (pNode) { + ((CEntity*)pNode->item)->AddSteamsFromGround(nil); + pNode = pNode->next; + } +} + void CWorld::AddParticles(void) { for(int32 y = 0; y < NUMSECTORS_Y; y++) { for(int32 x = 0; x < NUMSECTORS_X; x++) { CSector *pSector = GetSector(x, y); - CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]); - CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]); + AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]); + AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]); } } } diff --git a/src/core/common.h b/src/core/common.h index ebde3a65..44d94370 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -73,11 +73,16 @@ typedef int16_t int16; typedef uint32_t uint32; typedef int32_t int32; typedef uintptr_t uintptr; +typedef intptr_t intptr; typedef uint64_t uint64; typedef int64_t int64; // hardcode ucs-2 typedef uint16_t wchar; +#if defined(_MSC_VER) +typedef ptrdiff_t ssize_t; +#endif + #ifndef nil #define nil NULL #endif diff --git a/src/core/config.h b/src/core/config.h index d1043c72..a9bb1a17 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -249,17 +249,14 @@ enum Config { #define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync //#define USE_TEXTURE_POOL #ifdef LIBRW -//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) -//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo) -//#define SCREEN_DROPLETS // neo water droplets +#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) +#define EXTENDED_PIPELINES // custom render pipelines (includes Neo) +#define SCREEN_DROPLETS // neo water droplets #endif #ifndef EXTENDED_COLOURFILTER #undef SCREEN_DROPLETS // we need the backbuffer for this effect #endif -#ifndef EXTENDED_PIPELINES -#undef SCREEN_DROPLETS // we need neo.txd -#endif // Particle //#define PC_PARTICLE @@ -277,7 +274,7 @@ enum Config { #define ALLCARSHELI_CHEAT #define ALT_DODO_CHEAT #define REGISTER_START_BUTTON -//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls +#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls #define BUTTON_ICONS // use textures to show controller buttons // Hud, frontend and radar @@ -286,6 +283,7 @@ enum Config { // #define BETA_SLIDING_TEXT #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC // #define XBOX_SUBTITLES // the infamous outlines +#define RADIO_OFF_TEXT #define PC_MENU #ifndef PC_MENU @@ -350,6 +348,7 @@ enum Config { #define FREE_CAM // Rotating cam // Audio +#define RADIO_SCROLL_TO_PREV_STATION #ifndef AUDIO_OAL // is not working yet for openal #define AUDIO_CACHE // cache sound lengths to speed up the cold boot #endif diff --git a/src/core/main.cpp b/src/core/main.cpp index 3a855e20..4b70a153 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -66,7 +66,6 @@ #include "postfx.h" #include "custompipes.h" #include "screendroplets.h" -#include "frontendoption.h" #include "MemoryHeap.h" GlobalScene Scene; @@ -481,13 +480,6 @@ Initialise3D(void *param) DebugMenuInit(); DebugMenuPopulate(); #endif // !DEBUGMENU -#ifdef CUSTOM_FRONTEND_OPTIONS - // Apparently this func. can be run multiple times at the start. - if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) { - // needs stored language and TheText to be loaded, and last TheText reload is at the start of here - CustomFrontendOptionsPopulate(); - } -#endif bool ret = CGame::InitialiseRenderWare(); #ifdef EXTENDED_PIPELINES CustomPipes::CustomPipeInit(); // need Scene.world for this diff --git a/src/core/re3.cpp b/src/core/re3.cpp index acb6caa2..87244e2a 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -30,9 +30,9 @@ #include "postfx.h" #include "custompipes.h" #include "MemoryHeap.h" +#include "FileMgr.h" #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS -#include "FileMgr.h" #include "ControllerConfig.h" #endif @@ -79,6 +79,30 @@ void CustomFrontendOptionsPopulate(void) { // Moved to an array in MenuScreensCustom.cpp, but APIs are still available. see frontendoption.h + + // These work only if we have neo folder, so they're dynamically added +#ifdef EXTENDED_PIPELINES + const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" }; + const char *off_on[] = { "FEM_OFF", "FEM_ON" }; + int fd = CFileMgr::OpenFile("neo/neo.txd","r"); + if (fd) { +#ifdef GRAPHICS_MENU_OPTIONS + FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false); + FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline"); + FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight"); + FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps"); + FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss"); +#else + FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false); + FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline"); + FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight"); + FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps"); + FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss"); +#endif + CFileMgr::CloseFile(fd); + } +#endif + } #endif diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 476439fa..db004af3 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -4,31 +4,24 @@ #include "RwHelper.h" #include "ModelIndices.h" #include "Timer.h" -#include "Placeable.h" #include "Entity.h" #include "Object.h" -#include "ParticleObject.h" -#include "Lights.h" #include "World.h" #include "Camera.h" #include "Glass.h" -#include "Clock.h" #include "Weather.h" #include "Timecycle.h" -#include "Bridge.h" #include "TrafficLights.h" #include "Coronas.h" #include "PointLights.h" #include "Shadows.h" #include "Pickups.h" #include "SpecialFX.h" -#include "References.h" #include "TxdStore.h" #include "Zones.h" +#include "MemoryHeap.h" #include "Bones.h" #include "Debug.h" -#include "Renderer.h" -#include "MemoryHeap.h" int gBuildings; @@ -90,183 +83,16 @@ CEntity::~CEntity(void) } void -CEntity::GetBoundCentre(CVector &out) -{ - out = m_matrix * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center; -}; - -bool -CEntity::GetIsTouching(CVector const ¢er, float radius) +CEntity::SetModelIndex(uint32 id) { - return sq(GetBoundRadius()+radius) > (GetBoundCentre()-center).MagnitudeSqr(); -} - -bool -CEntity::GetIsOnScreen(void) -{ - return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius(), - &TheCamera.GetCameraMatrix()); -} - -bool -CEntity::GetIsOnScreenComplex(void) -{ - RwV3d boundBox[8]; - - if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix())) - return true; - - CRect rect = GetBoundRect(); - CColModel *colmodel = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); - float z = GetPosition().z; - float minz = z + colmodel->boundingBox.min.z; - float maxz = z + colmodel->boundingBox.max.z; - boundBox[0].x = rect.left; - boundBox[0].y = rect.bottom; - boundBox[0].z = minz; - boundBox[1].x = rect.left; - boundBox[1].y = rect.top; - boundBox[1].z = minz; - boundBox[2].x = rect.right; - boundBox[2].y = rect.bottom; - boundBox[2].z = minz; - boundBox[3].x = rect.right; - boundBox[3].y = rect.top; - boundBox[3].z = minz; - boundBox[4].x = rect.left; - boundBox[4].y = rect.bottom; - boundBox[4].z = maxz; - boundBox[5].x = rect.left; - boundBox[5].y = rect.top; - boundBox[5].z = maxz; - boundBox[6].x = rect.right; - boundBox[6].y = rect.bottom; - boundBox[6].z = maxz; - boundBox[7].x = rect.right; - boundBox[7].y = rect.top; - boundBox[7].z = maxz; - - return TheCamera.IsBoxVisible(boundBox, &TheCamera.GetCameraMatrix()); + m_modelIndex = id; + CreateRwObject(); } void -CEntity::Add(void) +CEntity::SetModelIndexNoCreate(uint32 id) { - int x, xstart, xmid, xend; - int y, ystart, ymid, yend; - CSector *s; - CPtrList *list; - - CRect bounds = GetBoundRect(); - xstart = CWorld::GetSectorIndexX(bounds.left); - xend = CWorld::GetSectorIndexX(bounds.right); - xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f); - ystart = CWorld::GetSectorIndexY(bounds.top); - yend = CWorld::GetSectorIndexY(bounds.bottom); - ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f); - assert(xstart >= 0); - assert(xend < NUMSECTORS_X); - assert(ystart >= 0); - assert(yend < NUMSECTORS_Y); - - for(y = ystart; y <= yend; y++) - for(x = xstart; x <= xend; x++){ - s = CWorld::GetSector(x, y); - if(x == xmid && y == ymid) switch(m_type){ - case ENTITY_TYPE_BUILDING: - list = &s->m_lists[ENTITYLIST_BUILDINGS]; - break; - case ENTITY_TYPE_VEHICLE: - list = &s->m_lists[ENTITYLIST_VEHICLES]; - break; - case ENTITY_TYPE_PED: - list = &s->m_lists[ENTITYLIST_PEDS]; - break; - case ENTITY_TYPE_OBJECT: - list = &s->m_lists[ENTITYLIST_OBJECTS]; - break; - case ENTITY_TYPE_DUMMY: - list = &s->m_lists[ENTITYLIST_DUMMIES]; - break; - }else switch(m_type){ - case ENTITY_TYPE_BUILDING: - list = &s->m_lists[ENTITYLIST_BUILDINGS_OVERLAP]; - break; - case ENTITY_TYPE_VEHICLE: - list = &s->m_lists[ENTITYLIST_VEHICLES_OVERLAP]; - break; - case ENTITY_TYPE_PED: - list = &s->m_lists[ENTITYLIST_PEDS_OVERLAP]; - break; - case ENTITY_TYPE_OBJECT: - list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP]; - break; - case ENTITY_TYPE_DUMMY: - list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; - break; - } - list->InsertItem(this); - } -} - -void -CEntity::Remove(void) -{ - int x, xstart, xmid, xend; - int y, ystart, ymid, yend; - CSector *s; - CPtrList *list; - - CRect bounds = GetBoundRect(); - xstart = CWorld::GetSectorIndexX(bounds.left); - xend = CWorld::GetSectorIndexX(bounds.right); - xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f); - ystart = CWorld::GetSectorIndexY(bounds.top); - yend = CWorld::GetSectorIndexY(bounds.bottom); - ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f); - assert(xstart >= 0); - assert(xend < NUMSECTORS_X); - assert(ystart >= 0); - assert(yend < NUMSECTORS_Y); - - for(y = ystart; y <= yend; y++) - for(x = xstart; x <= xend; x++){ - s = CWorld::GetSector(x, y); - if(x == xmid && y == ymid) switch(m_type){ - case ENTITY_TYPE_BUILDING: - list = &s->m_lists[ENTITYLIST_BUILDINGS]; - break; - case ENTITY_TYPE_VEHICLE: - list = &s->m_lists[ENTITYLIST_VEHICLES]; - break; - case ENTITY_TYPE_PED: - list = &s->m_lists[ENTITYLIST_PEDS]; - break; - case ENTITY_TYPE_OBJECT: - list = &s->m_lists[ENTITYLIST_OBJECTS]; - break; - case ENTITY_TYPE_DUMMY: - list = &s->m_lists[ENTITYLIST_DUMMIES]; - break; - }else switch(m_type){ - case ENTITY_TYPE_BUILDING: - list = &s->m_lists[ENTITYLIST_BUILDINGS_OVERLAP]; - break; - case ENTITY_TYPE_VEHICLE: - list = &s->m_lists[ENTITYLIST_VEHICLES_OVERLAP]; - break; - case ENTITY_TYPE_PED: - list = &s->m_lists[ENTITYLIST_PEDS_OVERLAP]; - break; - case ENTITY_TYPE_OBJECT: - list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP]; - break; - case ENTITY_TYPE_DUMMY: - list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; - break; - } - list->RemoveItem(this); - } + m_modelIndex = id; } void @@ -292,6 +118,48 @@ CEntity::CreateRwObject(void) } void +CEntity::AttachToRwObject(RwObject *obj) +{ + m_rwObject = obj; + if(m_rwObject){ + if(RwObjectGetType(m_rwObject) == rpATOMIC) + m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false); + else if(RwObjectGetType(m_rwObject) == rpCLUMP) + m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false); + CModelInfo::GetModelInfo(m_modelIndex)->AddRef(); + } +} + +void +CEntity::DetachFromRwObject(void) +{ + if(m_rwObject) + CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef(); + m_rwObject = nil; + m_matrix.Detach(); +} + +RpAtomic* +AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data) +{ + if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))){ + RpHAnimHierarchy *hier = RpSkinAtomicGetHAnimHierarchy(atomic); +#ifdef LIBRW + if(hier && hier->interpolator->currentAnim){ + RpHAnimAnimationDestroy(hier->interpolator->currentAnim); + hier->interpolator->currentAnim = nil; + } +#else + if(hier && hier->pCurrentAnim){ + RpHAnimAnimationDestroy(hier->pCurrentAnim); + hier->pCurrentAnim = nil; + } +#endif + } + return atomic; +} + +void CEntity::DeleteRwObject(void) { RwFrame *f; @@ -316,37 +184,6 @@ CEntity::DeleteRwObject(void) } } -void -CEntity::UpdateRwFrame(void) -{ - if(m_rwObject){ - if(RwObjectGetType(m_rwObject) == rpATOMIC) - RwFrameUpdateObjects(RpAtomicGetFrame((RpAtomic*)m_rwObject)); - else if(RwObjectGetType(m_rwObject) == rpCLUMP) - RwFrameUpdateObjects(RpClumpGetFrame((RpClump*)m_rwObject)); - } -} - -void -CEntity::SetupBigBuilding(void) -{ - CSimpleModelInfo *mi; - - mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); - bIsBIGBuilding = true; - bStreamingDontDelete = true; - bUsesCollision = false; - m_level = CTheZones::GetLevelFromPosition(&GetPosition()); - if(m_level == LEVEL_GENERIC){ - if(mi->GetTxdSlot() != CTxdStore::FindTxdSlot("generic")){ - mi->SetTexDictionary("generic"); - printf("%d:%s txd has been set to generic\n", m_modelIndex, mi->GetName()); - } - } - if(mi->m_lodDistances[0] > 2000.0f) - m_level = LEVEL_GENERIC; -} - CRect CEntity::GetBoundRect(void) { @@ -368,6 +205,75 @@ CEntity::GetBoundRect(void) return rect; } +CVector +CEntity::GetBoundCentre(void) +{ + CVector v; + GetBoundCentre(v); + return v; +} + +void +CEntity::GetBoundCentre(CVector &out) +{ + out = m_matrix * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center; +} + +float +CEntity::GetBoundRadius(void) +{ + return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius; +} + +void +CEntity::UpdateRwFrame(void) +{ + if(m_rwObject){ + if(RwObjectGetType(m_rwObject) == rpATOMIC) + RwFrameUpdateObjects(RpAtomicGetFrame((RpAtomic*)m_rwObject)); + else if(RwObjectGetType(m_rwObject) == rpCLUMP) + RwFrameUpdateObjects(RpClumpGetFrame((RpClump*)m_rwObject)); + } +} + +#ifdef PED_SKIN +void +CEntity::UpdateRpHAnim(void) +{ + RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump()); + RpHAnimHierarchyUpdateMatrices(hier); + +#if 0 + int i; + char buf[256]; + if(this == (CEntity*)FindPlayerPed()) + for(i = 0; i < hier->numNodes; i++){ + RpHAnimStdInterpFrame *kf = (RpHAnimStdInterpFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i); + sprintf(buf, "%6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %d %s", + kf->q.imag.x, kf->q.imag.y, kf->q.imag.z, kf->q.real, + kf->t.x, kf->t.y, kf->t.z, + HIERNODEID(hier, i), + ConvertBoneTag2BoneName(HIERNODEID(hier, i))); + CDebug::PrintAt(buf, 10, 1+i*3); + + RwMatrix *m = &RpHAnimHierarchyGetMatrixArray(hier)[i]; + sprintf(buf, "%6.3f %6.3f %6.3f %6.3f", + m->right.x, m->up.x, m->at.x, m->pos.x); + CDebug::PrintAt(buf, 80, 1+i*3+0); + sprintf(buf, "%6.3f %6.3f %6.3f %6.3f", + m->right.y, m->up.y, m->at.y, m->pos.y); + CDebug::PrintAt(buf, 80, 1+i*3+1); + sprintf(buf, "%6.3f %6.3f %6.3f %6.3f", + m->right.z, m->up.z, m->at.z, m->pos.z); + CDebug::PrintAt(buf, 80, 1+i*3+2); + } + + void RenderSkeleton(RpHAnimHierarchy *hier); + RenderSkeleton(hier); +#endif +} +#endif + void CEntity::PreRender(void) { @@ -463,13 +369,6 @@ CEntity::PreRender(void) } void -CEntity::PreRenderForGlassWindow(void) -{ - CGlass::AskForObjectToBeRenderedInGlass(this); - bIsVisible = false; -} - -void CEntity::Render(void) { if(m_rwObject){ @@ -483,352 +382,215 @@ CEntity::Render(void) } bool -CEntity::SetupLighting(void) +CEntity::GetIsTouching(CVector const ¢er, float radius) { - DeActivateDirectional(); - SetAmbientColours(); - return false; + return sq(GetBoundRadius()+radius) > (GetBoundCentre()-center).MagnitudeSqr(); } -void -CEntity::AttachToRwObject(RwObject *obj) +bool +CEntity::IsVisible(void) { - m_rwObject = obj; - if(m_rwObject){ - if(RwObjectGetType(m_rwObject) == rpATOMIC) - m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false); - else if(RwObjectGetType(m_rwObject) == rpCLUMP) - m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false); - CModelInfo::GetModelInfo(m_modelIndex)->AddRef(); - } + return m_rwObject && bIsVisible && GetIsOnScreen(); } -void -CEntity::DetachFromRwObject(void) +bool +CEntity::IsVisibleComplex(void) { - if(m_rwObject) - CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef(); - m_rwObject = nil; - m_matrix.Detach(); + return m_rwObject && bIsVisible && GetIsOnScreenComplex(); } -void -CEntity::RegisterReference(CEntity **pent) +bool +CEntity::GetIsOnScreen(void) { - if(IsBuilding()) - return; - CReference *ref; - // check if already registered - for(ref = m_pFirstReference; ref; ref = ref->next) - if(ref->pentity == pent) - return; - // have to allocate new reference - ref = CReferences::pEmptyList; - if(ref){ - CReferences::pEmptyList = ref->next; - - ref->pentity = pent; - ref->next = m_pFirstReference; - m_pFirstReference = ref; - return; - } - return; + return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius(), + &TheCamera.GetCameraMatrix()); } -// Clear all references to this entity -void -CEntity::ResolveReferences(void) +bool +CEntity::GetIsOnScreenComplex(void) { - CReference *ref; - // clear pointers to this entity - for(ref = m_pFirstReference; ref; ref = ref->next) - if(*ref->pentity == this) - *ref->pentity = nil; - // free list - if(m_pFirstReference){ - for(ref = m_pFirstReference; ref->next; ref = ref->next) - ; - ref->next = CReferences::pEmptyList; - CReferences::pEmptyList = m_pFirstReference; - m_pFirstReference = nil; - } + RwV3d boundBox[8]; + + if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix())) + return true; + + CRect rect = GetBoundRect(); + CColModel *colmodel = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); + float z = GetPosition().z; + float minz = z + colmodel->boundingBox.min.z; + float maxz = z + colmodel->boundingBox.max.z; + boundBox[0].x = rect.left; + boundBox[0].y = rect.bottom; + boundBox[0].z = minz; + boundBox[1].x = rect.left; + boundBox[1].y = rect.top; + boundBox[1].z = minz; + boundBox[2].x = rect.right; + boundBox[2].y = rect.bottom; + boundBox[2].z = minz; + boundBox[3].x = rect.right; + boundBox[3].y = rect.top; + boundBox[3].z = minz; + boundBox[4].x = rect.left; + boundBox[4].y = rect.bottom; + boundBox[4].z = maxz; + boundBox[5].x = rect.left; + boundBox[5].y = rect.top; + boundBox[5].z = maxz; + boundBox[6].x = rect.right; + boundBox[6].y = rect.bottom; + boundBox[6].z = maxz; + boundBox[7].x = rect.right; + boundBox[7].y = rect.top; + boundBox[7].z = maxz; + + return TheCamera.IsBoxVisible(boundBox, &TheCamera.GetCameraMatrix()); } -// Free all references that no longer point to this entity void -CEntity::PruneReferences(void) +CEntity::Add(void) { - CReference *ref, *next, **lastnextp; - lastnextp = &m_pFirstReference; - for(ref = m_pFirstReference; ref; ref = next){ - next = ref->next; - if(*ref->pentity == this) - lastnextp = &ref->next; - else{ - *lastnextp = ref->next; - ref->next = CReferences::pEmptyList; - CReferences::pEmptyList = ref; + int x, xstart, xmid, xend; + int y, ystart, ymid, yend; + CSector *s; + CPtrList *list; + + CRect bounds = GetBoundRect(); + xstart = CWorld::GetSectorIndexX(bounds.left); + xend = CWorld::GetSectorIndexX(bounds.right); + xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f); + ystart = CWorld::GetSectorIndexY(bounds.top); + yend = CWorld::GetSectorIndexY(bounds.bottom); + ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f); + assert(xstart >= 0); + assert(xend < NUMSECTORS_X); + assert(ystart >= 0); + assert(yend < NUMSECTORS_Y); + + for(y = ystart; y <= yend; y++) + for(x = xstart; x <= xend; x++){ + s = CWorld::GetSector(x, y); + if(x == xmid && y == ymid) switch(m_type){ + case ENTITY_TYPE_BUILDING: + list = &s->m_lists[ENTITYLIST_BUILDINGS]; + break; + case ENTITY_TYPE_VEHICLE: + list = &s->m_lists[ENTITYLIST_VEHICLES]; + break; + case ENTITY_TYPE_PED: + list = &s->m_lists[ENTITYLIST_PEDS]; + break; + case ENTITY_TYPE_OBJECT: + list = &s->m_lists[ENTITYLIST_OBJECTS]; + break; + case ENTITY_TYPE_DUMMY: + list = &s->m_lists[ENTITYLIST_DUMMIES]; + break; + }else switch(m_type){ + case ENTITY_TYPE_BUILDING: + list = &s->m_lists[ENTITYLIST_BUILDINGS_OVERLAP]; + break; + case ENTITY_TYPE_VEHICLE: + list = &s->m_lists[ENTITYLIST_VEHICLES_OVERLAP]; + break; + case ENTITY_TYPE_PED: + list = &s->m_lists[ENTITYLIST_PEDS_OVERLAP]; + break; + case ENTITY_TYPE_OBJECT: + list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP]; + break; + case ENTITY_TYPE_DUMMY: + list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; + break; + } + list->InsertItem(this); } - } } -#ifdef PED_SKIN void -CEntity::UpdateRpHAnim(void) +CEntity::Remove(void) { - RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump()); - RpHAnimHierarchyUpdateMatrices(hier); - -#if 0 - int i; - char buf[256]; - if(this == (CEntity*)FindPlayerPed()) - for(i = 0; i < hier->numNodes; i++){ - RpHAnimStdInterpFrame *kf = (RpHAnimStdInterpFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i); - sprintf(buf, "%6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %d %s", - kf->q.imag.x, kf->q.imag.y, kf->q.imag.z, kf->q.real, - kf->t.x, kf->t.y, kf->t.z, - HIERNODEID(hier, i), - ConvertBoneTag2BoneName(HIERNODEID(hier, i))); - CDebug::PrintAt(buf, 10, 1+i*3); + int x, xstart, xmid, xend; + int y, ystart, ymid, yend; + CSector *s; + CPtrList *list; - RwMatrix *m = &RpHAnimHierarchyGetMatrixArray(hier)[i]; - sprintf(buf, "%6.3f %6.3f %6.3f %6.3f", - m->right.x, m->up.x, m->at.x, m->pos.x); - CDebug::PrintAt(buf, 80, 1+i*3+0); - sprintf(buf, "%6.3f %6.3f %6.3f %6.3f", - m->right.y, m->up.y, m->at.y, m->pos.y); - CDebug::PrintAt(buf, 80, 1+i*3+1); - sprintf(buf, "%6.3f %6.3f %6.3f %6.3f", - m->right.z, m->up.z, m->at.z, m->pos.z); - CDebug::PrintAt(buf, 80, 1+i*3+2); - } + CRect bounds = GetBoundRect(); + xstart = CWorld::GetSectorIndexX(bounds.left); + xend = CWorld::GetSectorIndexX(bounds.right); + xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f); + ystart = CWorld::GetSectorIndexY(bounds.top); + yend = CWorld::GetSectorIndexY(bounds.bottom); + ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f); + assert(xstart >= 0); + assert(xend < NUMSECTORS_X); + assert(ystart >= 0); + assert(yend < NUMSECTORS_Y); - void RenderSkeleton(RpHAnimHierarchy *hier); - RenderSkeleton(hier); -#endif + for(y = ystart; y <= yend; y++) + for(x = xstart; x <= xend; x++){ + s = CWorld::GetSector(x, y); + if(x == xmid && y == ymid) switch(m_type){ + case ENTITY_TYPE_BUILDING: + list = &s->m_lists[ENTITYLIST_BUILDINGS]; + break; + case ENTITY_TYPE_VEHICLE: + list = &s->m_lists[ENTITYLIST_VEHICLES]; + break; + case ENTITY_TYPE_PED: + list = &s->m_lists[ENTITYLIST_PEDS]; + break; + case ENTITY_TYPE_OBJECT: + list = &s->m_lists[ENTITYLIST_OBJECTS]; + break; + case ENTITY_TYPE_DUMMY: + list = &s->m_lists[ENTITYLIST_DUMMIES]; + break; + }else switch(m_type){ + case ENTITY_TYPE_BUILDING: + list = &s->m_lists[ENTITYLIST_BUILDINGS_OVERLAP]; + break; + case ENTITY_TYPE_VEHICLE: + list = &s->m_lists[ENTITYLIST_VEHICLES_OVERLAP]; + break; + case ENTITY_TYPE_PED: + list = &s->m_lists[ENTITYLIST_PEDS_OVERLAP]; + break; + case ENTITY_TYPE_OBJECT: + list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP]; + break; + case ENTITY_TYPE_DUMMY: + list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; + break; + } + list->RemoveItem(this); + } } -#endif -void -CEntity::AddSteamsFromGround(CVector *unused) +float +CEntity::GetDistanceFromCentreOfMassToBaseOfModel(void) { - int i, n; - C2dEffect *effect; - CVector pos; - - n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects(); - for(i = 0; i < n; i++){ - effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); - if(effect->type != EFFECT_PARTICLE) - continue; - - pos = GetMatrix() * effect->pos; - switch(effect->particle.particleType){ - case 0: - CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, effect->particle.dir, effect->particle.scale, false); - break; - case 1: - CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, effect->particle.dir, effect->particle.scale, false); - break; - case 2: - CParticleObject::AddObject(POBJECT_DRY_ICE, pos, effect->particle.scale, false); - break; - case 3: - CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, effect->particle.dir, effect->particle.scale, false); - break; - case 4: - CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false); - break; - } - } + return -CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingBox.min.z; } void -CEntity::ProcessLightsForEntity(void) +CEntity::SetupBigBuilding(void) { - int i, n; - C2dEffect *effect; - CVector pos; - bool lightOn, lightFlickering; - uint32 flashTimer1, flashTimer2, flashTimer3; - - if(bRenderDamaged || !bIsVisible || GetUp().z < 0.96f) - return; - - flashTimer1 = 0; - flashTimer2 = 0; - flashTimer3 = 0; - - n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects(); - for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){ - effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); - - if(effect->type != EFFECT_LIGHT) - continue; - - pos = GetMatrix() * effect->pos; - - lightOn = false; - lightFlickering = false; - switch(effect->light.lightType){ - case LIGHT_ON: - lightOn = true; - break; - case LIGHT_ON_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) - lightOn = true; - break; - case LIGHT_FLICKER: - if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) - lightOn = true; - else - lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) - lightOn = true; - break; - case LIGHT_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){ - if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) - lightOn = true; - else - lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) - lightOn = true; - } - break; - case LIGHT_FLASH1: - if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) - lightOn = true; - break; - case LIGHT_FLASH1_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) - if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) - lightOn = true; - break; - case LIGHT_FLASH2: - if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) - lightOn = true; - break; - case LIGHT_FLASH2_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) - if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) - lightOn = true; - break; - case LIGHT_FLASH3: - if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) - lightOn = true; - break; - case LIGHT_FLASH3_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7) - if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) - lightOn = true; - break; - case LIGHT_RANDOM_FLICKER: - if(m_randomSeed > 16) - lightOn = true; - else{ - if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60) - lightOn = true; - else - lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) - lightOn = true; - } - break; - case LIGHT_RANDOM_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ - if(m_randomSeed > 16) - lightOn = true; - else{ - if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60) - lightOn = true; - else - lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) - lightOn = true; - } - } - break; - case LIGHT_BRIDGE_FLASH1: - if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200) - lightOn = true; - break; - case LIGHT_BRIDGE_FLASH2: - if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60) - lightOn = true; - break; - } - - // Corona - if(lightOn) - CCoronas::RegisterCorona((uintptr)this + i, - effect->col.r, effect->col.g, effect->col.b, 255, - pos, effect->light.size, effect->light.dist, - effect->light.corona, effect->light.flareType, effect->light.roadReflection, - effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f); - else if(lightFlickering) - CCoronas::RegisterCorona((uintptr)this + i, - 0, 0, 0, 255, - pos, effect->light.size, effect->light.dist, - effect->light.corona, effect->light.flareType, effect->light.roadReflection, - effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f); - - // Pointlight - if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){ - CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, - CPointLights::FOG_ALWAYS, true); - }else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){ - CPointLights::AddLight(CPointLights::LIGHT_FOGONLY, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, - CPointLights::FOG_NORMAL, true); - }else if(lightOn && effect->light.range != 0.0f){ - if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){ - CPointLights::AddLight(CPointLights::LIGHT_POINT, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - 0.0f, 0.0f, 0.0f, - CPointLights::FOG_NONE, true); - }else{ - CPointLights::AddLight(CPointLights::LIGHT_POINT, - pos, CVector(0.0f, 0.0f, 0.0f), - effect->light.range, - effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f, - effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f, - effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f, - // half-useless because LIGHTFLAG_FOG_ALWAYS can't be on - (effect->light.flags & LIGHTFLAG_FOG) >> 1, - true); - } - } + CSimpleModelInfo *mi; - // Light shadow - if(effect->light.shadowSize != 0.0f){ - if(lightOn){ - CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, - effect->light.shadow, &pos, - effect->light.shadowSize, 0.0f, - 0.0f, -effect->light.shadowSize, - 128, - effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, - effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, - effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, - 15.0f, 1.0f, 40.0f, false, 0.0f); - }else if(lightFlickering){ - CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, - effect->light.shadow, &pos, - effect->light.shadowSize, 0.0f, - 0.0f, -effect->light.shadowSize, - 0, 0.0f, 0.0f, 0.0f, - 15.0f, 1.0f, 40.0f, false, 0.0f); - } + mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); + bIsBIGBuilding = true; + bStreamingDontDelete = true; + bUsesCollision = false; + m_level = CTheZones::GetLevelFromPosition(&GetPosition()); + if(m_level == LEVEL_GENERIC){ + if(mi->GetTxdSlot() != CTxdStore::FindTxdSlot("generic")){ + mi->SetTexDictionary("generic"); + printf("%d:%s txd has been set to generic\n", m_modelIndex, mi->GetName()); } } + if(mi->m_lodDistances[0] > 2000.0f) + m_level = LEVEL_GENERIC; } float WindTabel[] = { @@ -917,14 +679,11 @@ CEntity::ModifyMatrixForBannerInWind(void) UpdateRwFrame(); } -void -CEntity::AddSteamsFromGround(CPtrList& list) +void +CEntity::PreRenderForGlassWindow(void) { - CPtrNode *pNode = list.first; - while (pNode) { - ((CEntity*)pNode->item)->AddSteamsFromGround(nil); - pNode = pNode->next; - } + CGlass::AskForObjectToBeRenderedInGlass(this); + bIsVisible = false; } #ifdef COMPATIBLE_SAVES diff --git a/src/entities/Entity.h b/src/entities/Entity.h index 9372c85d..7ee638d7 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -111,8 +111,8 @@ public: virtual void Add(void); virtual void Remove(void); - virtual void SetModelIndex(uint32 id) { m_modelIndex = id; CreateRwObject(); } - virtual void SetModelIndexNoCreate(uint32 id) { m_modelIndex = id; } + virtual void SetModelIndex(uint32 id); + virtual void SetModelIndexNoCreate(uint32 id); virtual void CreateRwObject(void); virtual void DeleteRwObject(void); virtual CRect GetBoundRect(void); @@ -123,7 +123,7 @@ public: virtual void PreRender(void); virtual void Render(void); virtual bool SetupLighting(void); - virtual void RemoveLighting(bool) {} + virtual void RemoveLighting(bool); virtual void FlagToDestroyWhenNextProcessed(void) {} bool IsBuilding(void) { return m_type == ENTITY_TYPE_BUILDING; } @@ -142,14 +142,14 @@ public: } void GetBoundCentre(CVector &out); - CVector GetBoundCentre(void) { CVector v; GetBoundCentre(v); return v; } - float GetBoundRadius(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius; } - float GetDistanceFromCentreOfMassToBaseOfModel(void) { return -CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingBox.min.z; } + CVector GetBoundCentre(void); + float GetBoundRadius(void); + float GetDistanceFromCentreOfMassToBaseOfModel(void); bool GetIsTouching(CVector const ¢er, float r); bool GetIsOnScreen(void); bool GetIsOnScreenComplex(void); - bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); } - bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); } + bool IsVisible(void); + bool IsVisibleComplex(void); int16 GetModelIndex(void) const { return m_modelIndex; } void UpdateRwFrame(void); void SetupBigBuilding(void); @@ -170,8 +170,6 @@ public: void ModifyMatrixForTreeInWind(void); void ModifyMatrixForBannerInWind(void); void ProcessLightsForEntity(void); - - static void AddSteamsFromGround(CPtrList& list); }; VALIDATE_SIZE(CEntity, 0x64); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 04cec96b..4fc53039 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -16,6 +16,7 @@ #include "DMAudio.h" #include "Automobile.h" #include "Physical.h" +#include "Bike.h" CPhysical::CPhysical(void) { @@ -1917,7 +1918,11 @@ CPhysical::ProcessCollision(void) car->m_aSuspensionSpringRatio[2] = 1.0f; car->m_aSuspensionSpringRatio[3] = 1.0f; }else if(veh->m_vehType == VEHICLE_TYPE_BIKE){ - assert(0 && "TODO - but unused"); + CBike* bike = (CBike*)this; + bike->m_aSuspensionSpringRatio[0] = 1.0f; + bike->m_aSuspensionSpringRatio[1] = 1.0f; + bike->m_aSuspensionSpringRatio[2] = 1.0f; + bike->m_aSuspensionSpringRatio[3] = 1.0f; } } } diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp index bb3ebd2e..e6dff12a 100644 --- a/src/extras/custompipes.cpp +++ b/src/extras/custompipes.cpp @@ -133,7 +133,11 @@ EnvMapRender(void) EnvMapCam->getFrame()->matrix.pos = camPos; EnvMapCam->getFrame()->transform(&EnvMapCam->getFrame()->matrix, rw::COMBINEREPLACE); - rw::RGBA skycol = { CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255 }; + rw::RGBA skycol; + skycol.red = CTimeCycle::GetSkyBottomRed(); + skycol.green = CTimeCycle::GetSkyBottomGreen(); + skycol.blue = CTimeCycle::GetSkyBottomBlue(); + skycol.alpha = 255; EnvMapCam->clear(&skycol, rwCAMERACLEARZ|rwCAMERACLEARIMAGE); RwCameraBeginUpdate(EnvMapCam); bRenderingEnvMap = true; diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index b39efd47..27006c6a 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -245,6 +245,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) drawInst(header, inst); inst++; } + d3d::setTexture(1, nil); } void diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h index eb56c8f9..c2198aca 100644 --- a/src/extras/debugmenu.h +++ b/src/extras/debugmenu.h @@ -15,7 +15,7 @@ struct MenuEntry Menu *menu; MenuEntry(const char *name); - virtual ~MenuEntry(void) {} + virtual ~MenuEntry(void) { free((void*)name); } }; typedef MenuEntry DebugMenuEntry; diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp index 3f91a754..6ea72f09 100644 --- a/src/extras/screendroplets.cpp +++ b/src/extras/screendroplets.cpp @@ -8,11 +8,11 @@ #endif #include "General.h" -#include "Main.h" +#include "main.h" #include "RwHelper.h" -#include "Main.h" #include "Timer.h" #include "Camera.h" +#include "World.h" #include "ZoneCull.h" #include "Weather.h" #include "ParticleObject.h" @@ -76,11 +76,36 @@ ScreenDroplets::Initialise(void) ms_splashObject = nil; } +// Create white circle mask for rain drops +static RwTexture* +CreateDropMask(int32 size) +{ + RwImage *img = RwImageCreate(size, size, 32); + RwImageAllocatePixels(img); + + uint8 *pixels = RwImageGetPixels(img); + int32 stride = RwImageGetStride(img); + + for(int y = 0; y < size; y++){ + float yf = ((y + 0.5f)/size - 0.5f)*2.0f; + for(int x = 0; x < size; x++){ + float xf = ((x + 0.5f)/size - 0.5f)*2.0f; + memset(&pixels[y*stride + x*4], xf*xf + yf*yf < 1.0f ? 0xFF : 0x00, 4); + } + } + + int32 width, height, depth, format; + RwImageFindRasterFormat(img, rwRASTERTYPETEXTURE, &width, &height, &depth, &format); + RwRaster *ras = RwRasterCreate(width, height, depth, format); + RwRasterSetFromImage(ras, img); + RwImageDestroy(img); + return RwTextureCreate(ras); +} + void ScreenDroplets::InitDraw(void) { - if(CustomPipes::neoTxd) - ms_maskTex = CustomPipes::neoTxd->find("dropmask"); + ms_maskTex = CreateDropMask(64); ms_screenTex = RwTextureCreate(nil); RwTextureSetFilterMode(ms_screenTex, rwFILTERLINEAR); @@ -392,7 +417,8 @@ ScreenDroplets::ProcessCameraMovement(void) uint16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; bool isTopDown = mode == CCam::MODE_TOPDOWN || mode == CCam::MODE_GTACLASSIC || mode == CCam::MODE_TOP_DOWN_PED; - bool isLookingInDirection = CPad::GetPad(0)->GetLookBehindForCar() || CPad::GetPad(0)->GetLookLeft() || CPad::GetPad(0)->GetLookRight(); + bool isLookingInDirection = FindPlayerVehicle() && mode == CCam::MODE_1STPERSON && + (CPad::GetPad(0)->GetLookBehindForCar() || CPad::GetPad(0)->GetLookLeft() || CPad::GetPad(0)->GetLookRight()); ms_enabled = !isTopDown && !isLookingInDirection; ms_movingEnabled = !isTopDown && !isLookingInDirection; diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 2e04aed2..a3b9258b 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -171,8 +171,8 @@ RwFrame *RwCameraGetFrame(const RwCamera *camera) { return camera->getFrame( RwImage *RwImageCreate(RwInt32 width, RwInt32 height, RwInt32 depth) { return Image::create(width, height, depth); } RwBool RwImageDestroy(RwImage * image) { image->destroy(); return true; } -RwImage *RwImageAllocatePixels(RwImage * image); -RwImage *RwImageFreePixels(RwImage * image); +RwImage *RwImageAllocatePixels(RwImage * image) { image->allocate(); return image; } +RwImage *RwImageFreePixels(RwImage * image) { image->free(); return image; } RwImage *RwImageCopy(RwImage * destImage, const RwImage * sourceImage); RwImage *RwImageResize(RwImage * image, RwInt32 width, RwInt32 height); RwImage *RwImageApplyMask(RwImage * image, const RwImage * mask); @@ -187,10 +187,10 @@ RwImage *RwImageSetPixels(RwImage * image, RwUInt8 * pixels) { image->pixels RwImage *RwImageSetPalette(RwImage * image, RwRGBA * palette) { image->palette = (uint8*)palette; return image; } RwInt32 RwImageGetWidth(const RwImage * image) { return image->width; } RwInt32 RwImageGetHeight(const RwImage * image) { return image->height; } -RwInt32 RwImageGetDepth(const RwImage * image); -RwInt32 RwImageGetStride(const RwImage * image); -RwUInt8 *RwImageGetPixels(const RwImage * image); -RwRGBA *RwImageGetPalette(const RwImage * image); +RwInt32 RwImageGetDepth(const RwImage * image) { return image->depth; } +RwInt32 RwImageGetStride(const RwImage * image) { return image->stride; } +RwUInt8 *RwImageGetPixels(const RwImage * image) { return image->pixels; } +RwRGBA *RwImageGetPalette(const RwImage * image) { return (RwRGBA*)image->palette; } RwUInt32 RwRGBAToPixel(RwRGBA * rgbIn, RwInt32 rasterFormat); RwRGBA *RwRGBASetFromPixel(RwRGBA * rgbOut, RwUInt32 pixelValue, RwInt32 rasterFormat); RwBool RwImageSetGamma(RwReal gammaValue); diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index 1ae936a7..64bb5ed5 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -112,7 +112,7 @@ CClumpModelInfo::SetClump(RpClump *clump) } RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); } - if(strncmp(GetName(), "playerh", 8) == 0){ + if(strcmp(GetName(), "playerh") == 0){ // playerh is incompatible with the xbox player skin // so check if player model is skinned and only apply skin to head if it isn't CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER); @@ -120,7 +120,7 @@ CClumpModelInfo::SetClump(RpClump *clump) RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); } #else - if(strncmp(GetName(), "playerh", 8) == 0){ + if(strcmp(GetName(), "playerh") == 0){ RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); #endif } diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index b77cccda..38ce6d38 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -97,7 +97,7 @@ CPedModelInfo::SetClump(RpClump *clump) #endif #ifdef PED_SKIN // CB has to be set here before atomics are detached from clump - if(strncmp(GetName(), "player", 7) == 0) + if(strcmp(GetName(), "player") == 0) RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); if(IsClumpSkinned(clump)){ LimbCBarg limbs = { this, clump, { 0, 0, 0 } }; @@ -108,7 +108,7 @@ CPedModelInfo::SetClump(RpClump *clump) if(m_hitColModel == nil && !IsClumpSkinned(clump)) CreateHitColModel(); // And again because CClumpModelInfo resets it - if(strncmp(GetName(), "player", 7) == 0) + if(strcmp(GetName(), "player") == 0) RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); else if(IsClumpSkinned(clump)) // skinned peds have no low detail version, so they don't have the right render Cb @@ -118,7 +118,7 @@ CPedModelInfo::SetClump(RpClump *clump) SetFrameIds(m_pPedIds); if(m_hitColModel == nil) CreateHitColModel(); - if(strncmp(GetName(), "player", 7) == 0) + if(strcmp(GetName(), "player") == 0) RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); #endif } diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp index d4f92293..c1c18dac 100644 --- a/src/modelinfo/TimeModelInfo.cpp +++ b/src/modelinfo/TimeModelInfo.cpp @@ -2,6 +2,7 @@ #include "Camera.h" #include "ModelInfo.h" +#include "General.h" CTimeModelInfo* CTimeModelInfo::FindOtherTimeModel(void) @@ -23,7 +24,7 @@ CTimeModelInfo::FindOtherTimeModel(void) for(i = 0; i < MODELINFOSIZE; i++){ CBaseModelInfo *mi = CModelInfo::GetModelInfo(i); if (mi && mi->GetModelType() == MITYPE_TIME && - strncmp(name, mi->GetName(), 24) == 0){ + !CGeneral::faststrncmp(name, mi->GetName(), MAX_MODEL_NAME)){ m_otherTimeModelID = i; return (CTimeModelInfo*)mi; } diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index cc2a7e34..c0daaead 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -293,7 +293,7 @@ CVehicleModelInfo::SetAtomicRendererCB(RpAtomic *atomic, void *data) name = GetFrameNodeName(RpAtomicGetFrame(atomic)); alpha = false; RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha); - if(strstr(name, "_hi") || strncmp(name, "extra", 5) == 0){ + if(strstr(name, "_hi") || !CGeneral::faststrncmp(name, "extra", 5)) { if(alpha || strncmp(name, "windscreen", 10) == 0) CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB); else @@ -319,7 +319,7 @@ CVehicleModelInfo::SetAtomicRendererCB_BigVehicle(RpAtomic *atomic, void *data) name = GetFrameNodeName(RpAtomicGetFrame(atomic)); alpha = false; RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha); - if(strstr(name, "_hi") || strncmp(name, "extra", 5) == 0){ + if(strstr(name, "_hi") || !CGeneral::faststrncmp(name, "extra", 5)) { if(alpha) CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle); else @@ -367,7 +367,7 @@ CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data) clump = (RpClump*)data; name = GetFrameNodeName(RpAtomicGetFrame(atomic)); - if(strcmp(name, "boat_hi") == 0 || strncmp(name, "extra", 5) == 0) + if(strcmp(name, "boat_hi") == 0 || !CGeneral::faststrncmp(name, "extra", 5)) CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat); else if(strstr(name, "_hi")) CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB); @@ -914,11 +914,11 @@ CVehicleModelInfo::LoadVehicleColours(void) continue; if(section == NONE){ - if(strncmp(&line[start], "col", 3) == 0) + if(line[start] == 'c' && line[start + 1] == 'o' && line[start + 2] == 'l') section = COLOURS; - else if(strncmp(&line[start], "car", 3) == 0) + else if(line[start] == 'c' && line[start + 1] == 'a' && line[start + 2] == 'r') section = CARS; - }else if(strncmp(&line[start], "end", 3) == 0){ + }else if(line[start] == 'e' && line[start + 1] == 'n' && line[start + 2] == 'd'){ section = NONE; }else if(section == COLOURS){ sscanf(&line[start], // BUG: games doesn't add start diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index ec56861e..4b55e5ce 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -243,7 +243,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bHasACamera = true; m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); - DMAudio.SetEntityStatus(m_audioEntityId, 1); + DMAudio.SetEntityStatus(m_audioEntityId, true); m_fearFlags = CPedType::GetThreats(m_nPedType); m_threatEntity = nil; m_eventOrThreat = CVector2D(0.0f, 0.0f); @@ -707,14 +707,18 @@ CPed::ScanForThreats(void) } } - CPed *deadPed = nil; + CPed *deadPed; if (fearFlags & PED_FLAG_DEADPEDS && CharCreatedBy != MISSION_CHAR - && (deadPed = CheckForDeadPeds()) != nil && (deadPed->GetPosition() - ourPos).MagnitudeSqr() < sq(20.0f)) { + && (deadPed = CheckForDeadPeds()) != nil && (deadPed->GetPosition() - ourPos).MagnitudeSqr() < sq(20.0f) +#ifdef FIX_BUGS + && !deadPed->bIsInWater +#endif + ) { m_pEventEntity = deadPed; m_pEventEntity->RegisterReference((CEntity **) &m_pEventEntity); return PED_FLAG_DEADPEDS; } else { - uint32 flagsOfSomePed = 0; + uint32 flagsOfNearPed = 0; CPed *pedToFearFrom = nil; #ifndef VC_PED_PORTS @@ -724,9 +728,9 @@ CPed::ScanForThreats(void) // BUG: WTF Rockstar?! Putting this here will result in returning the flags of farthest ped to us, since m_nearPeds is sorted by distance. // Fixed at the bottom of the function. - flagsOfSomePed = CPedType::GetFlag(nearPed->m_nPedType); + flagsOfNearPed = CPedType::GetFlag(nearPed->m_nPedType); - if (CPedType::GetFlag(nearPed->m_nPedType) & fearFlags) { + if (flagsOfNearPed & fearFlags) { if (nearPed->m_fHealth > 0.0f && OurPedCanSeeThisOne(m_nearPeds[i])) { // FIX: Taken from VC #ifdef FIX_BUGS @@ -754,9 +758,9 @@ CPed::ScanForThreats(void) } // BUG: Explained at the same occurence of this bug above. Fixed at the bottom of the function. - flagsOfSomePed = CPedType::GetFlag(m_nearPeds[i]->m_nPedType); + flagsOfNearPed = CPedType::GetFlag(m_nearPeds[i]->m_nPedType); - if (flagsOfSomePed & fearFlags) { + if (flagsOfNearPed & fearFlags) { if (m_nearPeds[i]->m_fHealth > 0.0f) { // VC also has ability to include objects to line of sight check here (via last bit of flagsL) @@ -827,8 +831,8 @@ CPed::ScanForThreats(void) if (driver) { // BUG: Same bug as above. Fixed at the bottom of function. - flagsOfSomePed = CPedType::GetFlag(driver->m_nPedType); - if (CPedType::GetFlag(driver->m_nPedType) & fearFlags) { + flagsOfNearPed = CPedType::GetFlag(driver->m_nPedType); + if (flagsOfNearPed & fearFlags) { if (driver->m_fHealth > 0.0f && OurPedCanSeeThisOne(nearVeh->pDriver)) { // FIX: Taken from VC #ifdef FIX_BUGS @@ -850,12 +854,12 @@ CPed::ScanForThreats(void) #ifdef FIX_BUGS if (pedToFearFrom) - flagsOfSomePed = CPedType::GetFlag(((CPed*)m_threatEntity)->m_nPedType); + flagsOfNearPed = CPedType::GetFlag(((CPed*)m_threatEntity)->m_nPedType); else - flagsOfSomePed = 0; + flagsOfNearPed = 0; #endif - return flagsOfSomePed; + return flagsOfNearPed; } } @@ -1046,7 +1050,7 @@ CPed::SetAimFlag(float angle) m_lookTimer = 0; m_pLookTarget = nil; m_pSeekTarget = nil; - if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) + if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; @@ -4246,7 +4250,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); if (veh->pDriver == ped) { veh->RemoveDriver(); +#ifndef FIX_BUGS // RemoveDriver does it anyway veh->SetStatus(STATUS_ABANDONED); +#endif if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY) veh->m_nDoorLock = CARLOCK_UNLOCKED; if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle()) diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index b57364d8..ca720479 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -201,7 +201,7 @@ CPed::PointGunAt(void) weaponAssoc->SetCurrentTime(weaponInfo->m_fAnimLoopStart); weaponAssoc->flags &= ~ASSOC_RUNNING; - if (weaponInfo->m_bCanAimWithArm) + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; @@ -300,7 +300,7 @@ CPed::SetAttack(CEntity *victim) if (m_pSeekTarget) m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); - if (curWeapon->m_bCanAim) { + if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM)) { CVector aimPos = GetRight() * 0.1f + GetForward() * 0.2f + GetPosition(); CEntity *obstacle = CWorld::TestSphereAgainstWorld(aimPos, 0.2f, nil, true, false, false, true, false, false); if (obstacle) @@ -342,7 +342,7 @@ CPed::SetAttack(CEntity *victim) if (pointBlankStatus == POINT_BLANK_FOR_WANTED_PED || !victimPed) StartFightAttack(200); } else { - if (!curWeapon->m_bCanAim) + if (!curWeapon->IsFlagSet(WEAPONFLAG_CANAIM)) m_pSeekTarget = nil; if (m_nPedState != PED_AIM_GUN) @@ -417,7 +417,7 @@ CPed::ClearAttackByRemovingAnim(void) if (!weaponAssoc) { weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), weapon->m_Anim2ToPlay); - if (!weaponAssoc && weapon->m_bThrow) + if (!weaponAssoc && weapon->IsFlagSet(WEAPONFLAG_THROW)) weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_THROWU); if (!weaponAssoc) { @@ -569,7 +569,7 @@ CPed::Attack(void) delayBetweenAnimAndFire = ourWeapon->m_fAnim2FrameFire; // Long throw granade, molotov - if (!weaponAnimAssoc && ourWeapon->m_bThrow) { + if (!weaponAnimAssoc && ourWeapon->IsFlagSet(WEAPONFLAG_THROW)) { weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_THROWU); delayBetweenAnimAndFire = 0.2f; } @@ -605,7 +605,7 @@ CPed::Attack(void) animStart = ourWeapon->m_fAnimLoopStart; weaponAnimTime = weaponAnimAssoc->currentTime; if (weaponAnimTime > animStart && weaponAnimTime - weaponAnimAssoc->timeStep <= animStart) { - if (ourWeapon->m_bCanAimWithArm) + if (ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; @@ -1778,7 +1778,7 @@ CPed::LoadFightData(void) break; } - if (strncmp(animName, "null", 4) != 0) { + if (strcmp(animName, "null") != 0) { animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animName); tFightMoves[moveId].animId = (AnimationId)animAssoc->animId; } else { diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp index 6e745bd7..bacb1a78 100644 --- a/src/peds/PedType.cpp +++ b/src/peds/PedType.cpp @@ -45,7 +45,7 @@ CPedType::LoadPedData(void) char *buf; char line[256]; char word[32]; - size_t bp, buflen; + ssize_t bp, buflen; int lp, linelen; int type; uint32 flags; @@ -54,9 +54,9 @@ CPedType::LoadPedData(void) type = NUM_PEDTYPES; buf = new char[16 * 1024]; - CFileMgr::SetDir("DATA"); - buflen = CFileMgr::LoadFile("PED.DAT", (uint8*)buf, 16 * 1024, "r"); - CFileMgr::SetDir(""); + CFileMgr::SetDir("DATA"); + buflen = CFileMgr::LoadFile("PED.DAT", (uint8*)buf, 16 * 1024, "r"); + CFileMgr::SetDir(""); for(bp = 0; bp < buflen; ){ // read file line by line @@ -79,7 +79,7 @@ CPedType::LoadPedData(void) // Game uses just "line" here since sscanf already trims whitespace, but this is safer sscanf(&line[lp], "%s", word); - if(strncmp(word, "Threat", 7) == 0){ + if(strcmp(word, "Threat") == 0){ flags = 0; lp += 7; while(sscanf(&line[lp], "%s", word) == 1 && lp <= linelen){ @@ -92,7 +92,7 @@ CPedType::LoadPedData(void) lp++; } ms_apPedType[type]->m_threats = flags; - }else if(strncmp(word, "Avoid", 6) == 0){ + }else if(strcmp(word, "Avoid") == 0){ flags = 0; lp += 6; while(sscanf(&line[lp], "%s", word) == 1 && lp <= linelen){ @@ -246,19 +246,18 @@ CPedStats::LoadPedStats(void) char *buf; char line[256]; char name[32]; - size_t bp, buflen; + ssize_t bp, buflen; int lp, linelen; int type; float fleeDist, headingChangeRate, attackStrength, defendWeakness; int fear, temper, lawfullness, sexiness, flags; - type = 0; buf = new char[16 * 1024]; - CFileMgr::SetDir("DATA"); - buflen = CFileMgr::LoadFile("PEDSTATS.DAT", (uint8*)buf, 16 * 1024, "r"); - CFileMgr::SetDir(""); + CFileMgr::SetDir("DATA"); + buflen = CFileMgr::LoadFile("PEDSTATS.DAT", (uint8*)buf, 16 * 1024, "r"); + CFileMgr::SetDir(""); for(bp = 0; bp < buflen; ){ // read file line by line diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 330d209b..1b5e007a 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -192,7 +192,7 @@ CPlayerPed::MakeChangesForNewWeapon(int8 weapon) GetWeapon()->m_nAmmoInClip = Min(GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition); - if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAim)) + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM)) ClearWeaponTarget(); CAnimBlendAssociation *weaponAnim = RpAnimBlendClumpGetAssociation(GetClump(), CWeaponInfo::GetWeaponInfo(WEAPONTYPE_SNIPERRIFLE)->m_AnimToPlay); @@ -299,7 +299,7 @@ CPlayerPed::SetRealMoveAnim(void) RestoreHeadingRate(); if (!curIdleAssoc) { - if (m_fCurrentStamina < 0.0f && !CWorld::TestSphereAgainstWorld(GetPosition(), 0.0f, + if (m_fCurrentStamina < 0.0f && !CWorld::TestSphereAgainstWorld(GetPosition(), 0.5f, nil, true, false, false, false, false, false)) { curIdleAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 8.0f); @@ -313,7 +313,7 @@ CPlayerPed::SetRealMoveAnim(void) } else if (m_fMoveSpeed == 0.0f && !curSprintAssoc) { if (!curIdleAssoc) { - if (m_fCurrentStamina < 0.0f && !CWorld::TestSphereAgainstWorld(GetPosition(), 0.0f, + if (m_fCurrentStamina < 0.0f && !CWorld::TestSphereAgainstWorld(GetPosition(), 0.5f, nil, true, false, false, false, false, false)) { curIdleAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); @@ -329,7 +329,7 @@ CPlayerPed::SetRealMoveAnim(void) } else if (m_nPedState != PED_FIGHT) { if (m_fCurrentStamina < 0.0f && curIdleAssoc->animId != ANIM_IDLE_TIRED - && !CWorld::TestSphereAgainstWorld(GetPosition(), 0.0f, nil, true, false, false, false, false, false)) { + && !CWorld::TestSphereAgainstWorld(GetPosition(), 0.5f, nil, true, false, false, false, false, false)) { CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); } else if (curIdleAssoc->animId != ANIM_IDLE_STANCE) { @@ -685,7 +685,7 @@ CPlayerPed::PlayerControlFighter(CPad *padUsed) bIsAttacking = false; } - if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy && padUsed->JumpJustDown()) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->JumpJustDown()) { if (m_nEvadeAmount != 0 && m_pEvadingFrom) { SetEvasiveDive((CPhysical*)m_pEvadingFrom, 1); m_nEvadeAmount = 0; @@ -723,13 +723,13 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed) m_fMoveSpeed = 0.0f; } } - if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) && padUsed->GetSprint()) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->GetSprint()) { m_nMoveState = PEDMOVE_SPRINT; } if (m_nPedState != PED_FIGHT) SetRealMoveAnim(); - if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) + if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY)) && padUsed->JumpJustDown() && m_nPedState != PED_JUMP) { ClearAttack(); ClearWeaponTarget(); @@ -1061,12 +1061,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { // Weapons except throwable and melee ones - if (weaponInfo->m_bCanAim || weaponInfo->m_b1stPerson || weaponInfo->m_bExpands) { - if ((padUsed->GetTarget() && weaponInfo->m_bCanAimWithArm) || padUsed->GetWeapon()) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) || weaponInfo->IsFlagSet(WEAPONFLAG_1ST_PERSON) || weaponInfo->IsFlagSet(WEAPONFLAG_EXPANDS)) { + if ((padUsed->GetTarget() && weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) || padUsed->GetWeapon()) { float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation); // On this one we can rotate arm. - if (weaponInfo->m_bCanAimWithArm) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) { if (!padUsed->GetWeapon()) { // making this State != ATTACK still stops it after attack. Re-start it immediately! SetPointGunAt(nil); bIsPointingGunAt = false; // to not stop after attack @@ -1083,7 +1083,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_headingRate = 50.0f; // Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly) - if (weaponInfo->m_bCanAim && padUsed->WeaponJustDown()) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && padUsed->WeaponJustDown()) { m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur); float limitedRotDest = m_fRotationDest; @@ -1096,7 +1096,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2; } } - } else if (weaponInfo->m_bCanAimWithArm && m_nPedState != PED_ATTACK) + } else if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) && m_nPedState != PED_ATTACK) ClearPointGunAt(); } } @@ -1133,7 +1133,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) TheCamera.UpdateAimingCoors(m_pPointGunAt->GetPosition()); } #ifdef FREE_CAM - else if ((CCamera::bFreeCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson)) { + else if ((CCamera::bFreeCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && !CCamera::m_bUseMouse3rdPerson)) { #else else if (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson) { #endif @@ -1215,13 +1215,13 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed) } } - if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) && padUsed->GetSprint()) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->GetSprint()) { m_nMoveState = PEDMOVE_SPRINT; } if (m_nPedState != PED_FIGHT) SetRealMoveAnim(); - if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) + if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY)) && padUsed->JumpJustDown() && m_nPedState != PED_JUMP) { ClearAttack(); ClearWeaponTarget(); diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 5dbde649..35443cb8 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -22,6 +22,7 @@ #include "DummyObject.h" #include "Script.h" #include "Shadows.h" +#include "Bike.h" #define MIN_CREATION_DIST 40.0f // not for start of the game (look at the GeneratePedsAtStartOfGame) #define CREATION_RANGE 10.0f // added over the MIN_CREATION_DIST. @@ -833,11 +834,11 @@ CPopulation::AddPedInCar(CVehicle* car) newPed->SetCurrentWeapon(WEAPONTYPE_COLT45); newPed->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(newPed->GetWeapon()->m_eWeaponType)->m_nModelId); } - /* + // Miami leftover if (car->m_vehType == VEHICLE_TYPE_BIKE) { - newPed->m_pVehicleAnim = CAnimManager::BlendAnimation(newPed->GetClump(), ASSOCGRP_STD, *((CBike*)car + 308h), 100.0f); - } else */ + newPed->m_pVehicleAnim = CAnimManager::BlendAnimation(newPed->GetClump(), ASSOCGRP_STD, ((CBike*)car)->m_bikeSitAnimation, 100.0f); + } else // FIX: Make peds comfortable while driving car/boat #ifdef FIX_BUGS diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index 48f0f6b9..32957259 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -2,6 +2,7 @@ #include "main.h" #include "General.h" +#include "Entity.h" #include "TxdStore.h" #include "Camera.h" #include "Sprite.h" @@ -11,6 +12,10 @@ #include "Collision.h" #include "Timecycle.h" #include "Coronas.h" +#include "PointLights.h" +#include "Shadows.h" +#include "Clock.h" +#include "Bridge.h" struct FlareDef { @@ -577,3 +582,190 @@ CRegisteredCorona::Update(void) firstUpdate = false; registeredThisFrame = false; } + +void +CEntity::ProcessLightsForEntity(void) +{ + int i, n; + C2dEffect *effect; + CVector pos; + bool lightOn, lightFlickering; + uint32 flashTimer1, flashTimer2, flashTimer3; + + if(bRenderDamaged || !bIsVisible || GetUp().z < 0.96f) + return; + + flashTimer1 = 0; + flashTimer2 = 0; + flashTimer3 = 0; + + n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects(); + for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){ + effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); + + if(effect->type != EFFECT_LIGHT) + continue; + + pos = GetMatrix() * effect->pos; + + lightOn = false; + lightFlickering = false; + switch(effect->light.lightType){ + case LIGHT_ON: + lightOn = true; + break; + case LIGHT_ON_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + lightOn = true; + break; + case LIGHT_FLICKER: + if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) + lightOn = true; + else + lightFlickering = true; + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) + lightOn = true; + break; + case LIGHT_FLICKER_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){ + if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) + lightOn = true; + else + lightFlickering = true; + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) + lightOn = true; + } + break; + case LIGHT_FLASH1: + if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) + lightOn = true; + break; + case LIGHT_FLASH1_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200) + lightOn = true; + break; + case LIGHT_FLASH2: + if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) + lightOn = true; + break; + case LIGHT_FLASH2_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400) + lightOn = true; + break; + case LIGHT_FLASH3: + if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) + lightOn = true; + break; + case LIGHT_FLASH3_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7) + if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800) + lightOn = true; + break; + case LIGHT_RANDOM_FLICKER: + if(m_randomSeed > 16) + lightOn = true; + else{ + if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60) + lightOn = true; + else + lightFlickering = true; + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) + lightOn = true; + } + break; + case LIGHT_RANDOM_FLICKER_NIGHT: + if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ + if(m_randomSeed > 16) + lightOn = true; + else{ + if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60) + lightOn = true; + else + lightFlickering = true; + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) + lightOn = true; + } + } + break; + case LIGHT_BRIDGE_FLASH1: + if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200) + lightOn = true; + break; + case LIGHT_BRIDGE_FLASH2: + if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60) + lightOn = true; + break; + } + + // Corona + if(lightOn) + CCoronas::RegisterCorona((uintptr)this + i, + effect->col.r, effect->col.g, effect->col.b, 255, + pos, effect->light.size, effect->light.dist, + effect->light.corona, effect->light.flareType, effect->light.roadReflection, + effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f); + else if(lightFlickering) + CCoronas::RegisterCorona((uintptr)this + i, + 0, 0, 0, 255, + pos, effect->light.size, effect->light.dist, + effect->light.corona, effect->light.flareType, effect->light.roadReflection, + effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f); + + // Pointlight + if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){ + CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS, + pos, CVector(0.0f, 0.0f, 0.0f), + effect->light.range, + effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, + CPointLights::FOG_ALWAYS, true); + }else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){ + CPointLights::AddLight(CPointLights::LIGHT_FOGONLY, + pos, CVector(0.0f, 0.0f, 0.0f), + effect->light.range, + effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f, + CPointLights::FOG_NORMAL, true); + }else if(lightOn && effect->light.range != 0.0f){ + if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){ + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos, CVector(0.0f, 0.0f, 0.0f), + effect->light.range, + 0.0f, 0.0f, 0.0f, + CPointLights::FOG_NONE, true); + }else{ + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos, CVector(0.0f, 0.0f, 0.0f), + effect->light.range, + effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f, + effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f, + effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f, + // half-useless because LIGHTFLAG_FOG_ALWAYS can't be on + (effect->light.flags & LIGHTFLAG_FOG) >> 1, + true); + } + } + + // Light shadow + if(effect->light.shadowSize != 0.0f){ + if(lightOn){ + CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, + effect->light.shadow, &pos, + effect->light.shadowSize, 0.0f, + 0.0f, -effect->light.shadowSize, + 128, + effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, + effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, + effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, + 15.0f, 1.0f, 40.0f, false, 0.0f); + }else if(lightFlickering){ + CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, + effect->light.shadow, &pos, + effect->light.shadowSize, 0.0f, + 0.0f, -effect->light.shadowSize, + 0, 0.0f, 0.0f, 0.0f, + 15.0f, 1.0f, 40.0f, false, 0.0f); + } + } + } +} diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index f175c264..08137d0c 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -3,6 +3,7 @@ #include "General.h" #include "Timer.h" #include "TxdStore.h" +#include "Entity.h" #include "Sprite.h" #include "Camera.h" #include "Collision.h" @@ -388,9 +389,11 @@ void CParticle::Initialise() gpFlame5Tex = RwTextureRead("flame5", nil); -#ifdef FIX_BUGS +//#ifdef FIX_BUGS +#if 0 gpFlame5Raster = RwTextureGetRaster(gpFlame5Tex); #else + // this seems to have become more of a design choice gpFlame5Raster = RwTextureGetRaster(gpFlame1Tex); // copy-paste bug ? #endif @@ -583,6 +586,40 @@ void CParticle::Initialise() debug("CParticle ready"); } +void +CEntity::AddSteamsFromGround(CVector *unused) +{ + int i, n; + C2dEffect *effect; + CVector pos; + + n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects(); + for(i = 0; i < n; i++){ + effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); + if(effect->type != EFFECT_PARTICLE) + continue; + + pos = GetMatrix() * effect->pos; + switch(effect->particle.particleType){ + case 0: + CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, effect->particle.dir, effect->particle.scale, false); + break; + case 1: + CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, effect->particle.dir, effect->particle.scale, false); + break; + case 2: + CParticleObject::AddObject(POBJECT_DRY_ICE, pos, effect->particle.scale, false); + break; + case 3: + CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, effect->particle.dir, effect->particle.scale, false); + break; + case 4: + CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false); + break; + } + } +} + void CParticle::Shutdown() { debug("Shutting down CParticle..."); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index d47cac31..2559b743 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -921,6 +921,19 @@ CRenderer::RequestObjectsInFrustum(void) } bool +CEntity::SetupLighting(void) +{ + DeActivateDirectional(); + SetAmbientColours(); + return false; +} + +void +CEntity::RemoveLighting(bool) +{ +} + +bool CPed::SetupLighting(void) { ActivateDirectional(); diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index e765f306..bf3e51b4 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -114,7 +114,7 @@ void CWeather::Init(void) ForcedWeatherType = WEATHER_RANDOM; SoundHandle = DMAudio.CreateEntity(AUDIOTYPE_WEATHER, (void*)1); if (SoundHandle >= 0) - DMAudio.SetEntityStatus(SoundHandle, 1); + DMAudio.SetEntityStatus(SoundHandle, true); } void CWeather::Update(void) diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index e0133985..4ee3a0b3 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -324,26 +324,6 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) return anim; } -RpAtomic* -AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data) -{ - if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))){ - RpHAnimHierarchy *hier = RpSkinAtomicGetHAnimHierarchy(atomic); -#ifdef LIBRW - if(hier && hier->interpolator->currentAnim){ - RpHAnimAnimationDestroy(hier->interpolator->currentAnim); - hier->interpolator->currentAnim = nil; - } -#else - if(hier && hier->pCurrentAnim){ - RpHAnimAnimationDestroy(hier->pCurrentAnim); - hier->pCurrentAnim = nil; - } -#endif - } - return atomic; -} - void RenderSkeleton(RpHAnimHierarchy *hier) { diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 21e00725..916696de 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -936,12 +936,12 @@ CVisibilityPlugins::FrameCopyConstructor(void *dst, const void *src, int32, int3 } void -CVisibilityPlugins::SetFrameHierarchyId(RwFrame *frame, uintptr id) +CVisibilityPlugins::SetFrameHierarchyId(RwFrame *frame, intptr id) { FRAMEEXT(frame)->id = id; } -uintptr +intptr CVisibilityPlugins::GetFrameHierarchyId(RwFrame *frame) { return FRAMEEXT(frame)->id; @@ -978,7 +978,7 @@ void CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo) { CVehicleModelInfo *vmi; - SetFrameHierarchyId(RpClumpGetFrame(clump), (uintptr)modelInfo); + SetFrameHierarchyId(RpClumpGetFrame(clump), (intptr)modelInfo); // Unused switch (modelInfo->GetModelType()) { diff --git a/src/rw/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h index dd02f2e1..0721dfcc 100644 --- a/src/rw/VisibilityPlugins.h +++ b/src/rw/VisibilityPlugins.h @@ -103,10 +103,10 @@ public: struct FrameExt { // BUG: this is abused to hold a pointer by SetClumpModelInfo - uintptr id; + intptr id; }; - static void SetFrameHierarchyId(RwFrame *frame, uintptr id); - static uintptr GetFrameHierarchyId(RwFrame *frame); + static void SetFrameHierarchyId(RwFrame *frame, intptr id); + static intptr GetFrameHierarchyId(RwFrame *frame); static void *FrameConstructor(void *object, int32 offset, int32 len); static void *FrameDestructor(void *object, int32 offset, int32 len); diff --git a/src/text/Text.cpp b/src/text/Text.cpp index f3324fd7..0c63ced7 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -23,7 +23,7 @@ CText::Load(void) { uint8 *filedata; char filename[32], type[4]; - intptr_t offset, length; + ssize_t offset, length; size_t sectlen; Unload(); @@ -176,7 +176,7 @@ CText::UpperCase(wchar *s) void -CKeyArray::Load(size_t length, uint8 *data, intptr_t *offset) +CKeyArray::Load(size_t length, uint8 *data, ssize_t *offset) { size_t i; uint8 *rawbytes; @@ -256,7 +256,7 @@ CKeyArray::Search(const char *key) void -CData::Load(size_t length, uint8 *data, intptr_t *offset) +CData::Load(size_t length, uint8 *data, ssize_t *offset) { size_t i; uint8 *rawbytes; diff --git a/src/text/Text.h b/src/text/Text.h index 52c17e27..ed978a8b 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -26,7 +26,7 @@ public: CKeyArray(void) : entries(nil), numEntries(0) {} ~CKeyArray(void) { Unload(); } - void Load(size_t length, uint8 *data, intptr_t *offset); + void Load(size_t length, uint8 *data, ssize_t *offset); void Unload(void); void Update(wchar *chars); CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high); @@ -45,7 +45,7 @@ public: CData(void) : chars(nil), numChars(0) {} ~CData(void) { Unload(); } - void Load(size_t length, uint8 *data, intptr_t *offset); + void Load(size_t length, uint8 *data, ssize_t *offset); void Unload(void); }; diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h index 4e7e5a0e..85ff211b 100644 --- a/src/vehicles/Bike.h +++ b/src/vehicles/Bike.h @@ -1,5 +1,7 @@ #pragma once +#include "Vehicle.h" + // some miami bike leftovers enum eBikeNodes { @@ -12,4 +14,32 @@ enum eBikeNodes { BIKE_MUDGUARD, BIKE_HANDLEBARS, BIKE_NUM_NODES +}; + +class CBike : public CVehicle +{ +public: + RwFrame *m_aBikeNodes[BIKE_NUM_NODES]; // assuming + uint8 unk1[96]; + AnimationId m_bikeSitAnimation; + uint8 unk2[180]; + float m_aSuspensionSpringRatio[4]; + + /* copied from VC, one of the floats here is gone, assuming m_bike_unused1 */ + float m_aSuspensionSpringRatioPrev[4]; + float m_aWheelTimer[4]; + //float m_bike_unused1; + int m_aWheelSkidmarkType[2]; + bool m_aWheelSkidmarkBloody[2]; + bool m_aWheelSkidmarkUnk[2]; + float m_aWheelRotation[2]; + float m_aWheelSpeed[2]; + float m_aWheelPosition[2]; + float m_aWheelBasePosition[2]; + float m_aSuspensionSpringLength[4]; + float m_aSuspensionLineLength[4]; + float m_fHeightAboveRoad; + /**/ + + float m_fTraction; };
\ No newline at end of file diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 564f493d..1191465a 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -85,7 +85,7 @@ void CCranes::AddThisOneCrane(CEntity* pEntity) pCrane->m_bWasMilitaryCrane = false; pCrane->m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[NumCranes]); if (pCrane->m_nAudioEntity >= 0) - DMAudio.SetEntityStatus(pCrane->m_nAudioEntity, 1); + DMAudio.SetEntityStatus(pCrane->m_nAudioEntity, true); pCrane->m_bIsTop = (MODELID_CRANE_1 != pEntity->GetModelIndex()); // Is this used to avoid military crane? if (pCrane->m_bIsTop || pEntity->GetPosition().y > 0.0f) { @@ -669,7 +669,7 @@ void CCranes::Load(uint8* buf, uint32 size) for (int i = 0; i < NUM_CRANES; i++) { aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[i]); if (aCranes[i].m_nAudioEntity != 0) - DMAudio.SetEntityStatus(aCranes[i].m_nAudioEntity, 1); + DMAudio.SetEntityStatus(aCranes[i].m_nAudioEntity, true); } VALIDATESAVEBUF(size); diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 18a2481e..3ac6f057 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -2,6 +2,7 @@ #include "main.h" #include "FileMgr.h" +#include "Physical.h" #include "HandlingMgr.h" cHandlingDataMgr mod_HandlingManager; @@ -115,7 +116,7 @@ cHandlingDataMgr::LoadHandlingData(void) end = start+1; // yeah, this is kinda crappy - if(strncmp(line, ";the end", 9) == 0) + if(strcmp(line, ";the end") == 0) keepGoing = 0; else if(line[0] != ';'){ field = 0; @@ -189,17 +190,17 @@ cHandlingDataMgr::FindExactWord(const char *word, const char *words, int wordLen void cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling) { - // TODO: figure out what exactly is being converted here + // acceleration is in ms^-2, but we need mf^-2 where f is one frame time (50fps) float velocity, a, b, specificVolume; - handling->Transmission.fEngineAcceleration /= 2500.0f; - handling->Transmission.fMaxVelocity /= 180.0f; - handling->fBrakeDeceleration /= 2500.0f; + handling->Transmission.fEngineAcceleration *= 1.0f/(50.0f*50.0f); + handling->Transmission.fMaxVelocity *= 1000.0f/(60.0f*60.0f * 50.0f); + handling->fBrakeDeceleration *= 1.0f/(50.0f*50.0f); handling->fTurnMass = (sq(handling->Dimension.x) + sq(handling->Dimension.y)) * handling->fMass / 12.0f; if(handling->fTurnMass < 10.0f) handling->fTurnMass *= 5.0f; handling->fInvMass = 1.0f/handling->fMass; - handling->fBuoyancy = 100.0f/handling->nPercentSubmerged * 0.008f*handling->fMass; + handling->fBuoyancy = 100.0f/handling->nPercentSubmerged * GRAVITY*handling->fMass; // What the hell is going on here? specificVolume = handling->Dimension.x*handling->Dimension.z*0.5f / handling->fMass; // ? diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 23bd9681..05876201 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -108,7 +108,7 @@ struct tHandlingData float fSteeringLock; float fTractionLoss; float fTractionBias; - float fABS; // should be VC leftover + float fUnused; float fSuspensionForceLevel; float fSuspensionDampingLevel; float fSuspensionUpperLimit; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 9adcf148..ba9348f0 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1171,7 +1171,10 @@ CVehicle::AddPassenger(CPed *passenger, uint8 n) void CVehicle::RemoveDriver(void) { - SetStatus(STATUS_ABANDONED); +#ifdef FIX_BUGS + if (GetStatus() != STATUS_WRECKED) +#endif + SetStatus(STATUS_ABANDONED); pDriver = nil; } diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp index c0ab9ac1..e604093c 100644 --- a/src/weapons/ShotInfo.cpp +++ b/src/weapons/ShotInfo.cpp @@ -76,7 +76,7 @@ CShotInfo::AddShot(CEntity *sourceEntity, eWeaponType weapon, CVector startPos, gaShotInfo[slot].m_areaAffected.z += CShotInfo::ms_afRandTable[CGeneral::GetRandomNumber() % ARRAY_SIZE(ms_afRandTable)]; } gaShotInfo[slot].m_areaAffected.Normalise(); - if (weaponInfo->m_bRandSpeed) + if (weaponInfo->IsFlagSet(WEAPONFLAG_RAND_SPEED)) gaShotInfo[slot].m_areaAffected *= CShotInfo::ms_afRandTable[CGeneral::GetRandomNumber() % ARRAY_SIZE(ms_afRandTable)] + weaponInfo->m_fSpeed; else gaShotInfo[slot].m_areaAffected *= weaponInfo->m_fSpeed; @@ -117,10 +117,10 @@ CShotInfo::Update() shot.m_inUse = false; } - if (weaponInfo->m_bSlowsDown) + if (weaponInfo->IsFlagSet(WEAPONFLAG_SLOWS_DOWN)) shot.m_areaAffected *= pow(0.96, CTimer::GetTimeStep()); // FRAMERATE - if (weaponInfo->m_bExpands) + if (weaponInfo->IsFlagSet(WEAPONFLAG_EXPANDS)) shot.m_radius += 0.075f * CTimer::GetTimeStep(); shot.m_startPos += CTimer::GetTimeStep() * shot.m_areaAffected; diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp index 284a0c20..b40329c8 100644 --- a/src/weapons/WeaponInfo.cpp +++ b/src/weapons/WeaponInfo.cpp @@ -39,11 +39,7 @@ CWeaponInfo::Initialise(void) ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT; ms_apWeaponInfos[i].m_AnimToPlay = ANIM_PUNCH_R; ms_apWeaponInfos[i].m_Anim2ToPlay = NUM_ANIMS; - ms_apWeaponInfos[i].m_bUseGravity = 1; - ms_apWeaponInfos[i].m_bSlowsDown = 1; - ms_apWeaponInfos[i].m_bRandSpeed = 1; - ms_apWeaponInfos[i].m_bExpands = 1; - ms_apWeaponInfos[i].m_bExplodes = 1; + ms_apWeaponInfos[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES; } debug("Loading weapon data...\n"); LoadWeaponData(); @@ -80,10 +76,9 @@ CWeaponInfo::LoadWeaponData(void) line[linelen] = '\0'; // skip white space - for (lp = 0; line[lp] <= ' '; lp++); + for (lp = 0; line[lp] <= ' ' && line[lp] != '\0'; lp++); - if (lp >= linelen || // FIX: game uses == here, but this is safer if we have empty lines - line[lp] == '#') + if (line[lp] == '\0' || line[lp] == '#') continue; spread = 0.0f; @@ -136,7 +131,7 @@ CWeaponInfo::LoadWeaponData(void) animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animToPlay); animId = static_cast<AnimationId>(animAssoc->animId); - if (strncmp(anim2ToPlay, "null", 4) != 0) { + if (strcmp(anim2ToPlay, "null") != 0) { animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay); ms_apWeaponInfos[weaponType].m_Anim2ToPlay = (AnimationId) animAssoc->animId; } @@ -160,17 +155,7 @@ CWeaponInfo::LoadWeaponData(void) ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f; ms_apWeaponInfos[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f; ms_apWeaponInfos[weaponType].m_nModelId = modelId; - ms_apWeaponInfos[weaponType].m_bUseGravity = flags & 1; - ms_apWeaponInfos[weaponType].m_bSlowsDown = (flags >> 1) & 1; - ms_apWeaponInfos[weaponType].m_bDissipates = (flags >> 2) & 1; - ms_apWeaponInfos[weaponType].m_bRandSpeed = (flags >> 3) & 1; - ms_apWeaponInfos[weaponType].m_bExpands = (flags >> 4) & 1; - ms_apWeaponInfos[weaponType].m_bExplodes = (flags >> 5) & 1; - ms_apWeaponInfos[weaponType].m_bCanAim = (flags >> 6) & 1; - ms_apWeaponInfos[weaponType].m_bCanAimWithArm = (flags >> 7) & 1; - ms_apWeaponInfos[weaponType].m_b1stPerson = (flags >> 8) & 1; - ms_apWeaponInfos[weaponType].m_bHeavy = (flags >> 9) & 1; - ms_apWeaponInfos[weaponType].m_bThrow = (flags >> 10) & 1; + ms_apWeaponInfos[weaponType].m_Flags = flags; } } diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h index c89dd482..69ad1f39 100644 --- a/src/weapons/WeaponInfo.h +++ b/src/weapons/WeaponInfo.h @@ -3,8 +3,22 @@ #include "AnimationId.h" #include "WeaponType.h" +enum +{ + WEAPONFLAG_USE_GRAVITY = 1, + WEAPONFLAG_SLOWS_DOWN = 1 << 1, + WEAPONFLAG_DISSIPATES = 1 << 2, + WEAPONFLAG_RAND_SPEED = 1 << 3, + WEAPONFLAG_EXPANDS = 1 << 4, + WEAPONFLAG_EXPLODES = 1 << 5, + WEAPONFLAG_CANAIM = 1 << 6, + WEAPONFLAG_CANAIM_WITHARM = 1 << 7, + WEAPONFLAG_1ST_PERSON = 1 << 8, + WEAPONFLAG_HEAVY = 1 << 9, + WEAPONFLAG_THROW = 1 << 10, +}; + class CWeaponInfo { -// static CWeaponInfo(&ms_apWeaponInfos)[14]; static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE]; public: eWeaponFire m_eWeaponFire; @@ -25,18 +39,7 @@ public: float m_fAnimFrameFire; float m_fAnim2FrameFire; int32 m_nModelId; - // flags - uint8 m_bUseGravity : 1; - uint8 m_bSlowsDown : 1; - uint8 m_bDissipates : 1; - uint8 m_bRandSpeed : 1; - uint8 m_bExpands : 1; - uint8 m_bExplodes : 1; - uint8 m_bCanAim : 1; - uint8 m_bCanAimWithArm : 1; - uint8 m_b1stPerson : 1; - uint8 m_bHeavy : 1; - uint8 m_bThrow : 1; + uint32 m_Flags; static void Initialise(void); static void LoadWeaponData(void); @@ -44,6 +47,7 @@ public: static eWeaponFire FindWeaponFireType(char *name); static eWeaponType FindWeaponType(char *name); static void Shutdown(void); + bool IsFlagSet(uint32 flag) const { return (m_Flags & flag) != 0; } }; VALIDATE_SIZE(CWeaponInfo, 0x54);
\ No newline at end of file diff --git a/utils/gxt/spanish.txt b/utils/gxt/spanish.txt index 425899e4..e57ade67 100644 --- a/utils/gxt/spanish.txt +++ b/utils/gxt/spanish.txt @@ -2283,7 +2283,7 @@ Esta mano de pintura es gratuita. No nos interesa ese modelo. [GA_20] -Tenemos de esos más de los que necesitamos. Lo siento, tío, no hay trato. +De ese modelo tenemos más de los que podemos colocar. Lo siento, tío, no hay trato. [CR_1] La grúa no puede levantar este vehículo. @@ -2554,10 +2554,10 @@ CTheScripts::DbgFlag Cambiar luz blanca grande de depuración [FED_SPR] -Mostrar grupos de peatones en carretera +Mostrar rutas de aceras [FED_SCR] -Mostrar grupos de vehículos en carretera +Mostrar rutas de carreteras [FED_SCZ] Mostrar zonas de máscara selectiva @@ -3499,7 +3499,7 @@ Pulsa ~h~~k~~TOGGLE_SUBMISSIONS~~w~ para activar o desactivar las misiones de ju ~r~¡Tu falta de rapidez ha sido fatal para el paciente! [A_FAIL3] -~r~¡El paciente está muerto! +~r~¡Tu paciente ha muerto! [A_PASS] ¡Paciente a salvo! @@ -4009,7 +4009,7 @@ Distancia recorrida en coche (metros) ''Caos en el aparcamiento'' en segundos [FEST_LS] -Gente salvada con una ambulancia +Personas salvadas con una ambulancia [FEST_CC] Criminales asesinados en misiones de justiciero @@ -4033,7 +4033,7 @@ Misiones superadas ''Corre a por la pasta'': [FEST_H0] -Máximo de puntos de control +Puntos de control alcanzados [FEST_GC] Coches de bandas destruidos: @@ -5934,7 +5934,7 @@ ALLAN WALKER LAZLOW [CRED227] -GUIÓN DE LOCUTORES Y ANUNCIOS +GUIÓN DE LOCUTORES Y CUÑAS [CRED228] DAN HOUSER @@ -6060,7 +6060,7 @@ STEVE K. GREG LAU [CINCAM] -Vista cinematográfica +Cámara cinematográfica [KM1_13] ¡Mete el vehículo en el garaje! @@ -7333,7 +7333,7 @@ ELEGIR MAPA TIPO DE JUEGO [FET_CTL] -AJUSTES DEL MANDO +AJUSTES DE CONTROL [FET_OPT] OPCIONES @@ -7495,7 +7495,7 @@ Espacios de partida disponibles: ¿Guardar la partida actual? [FES_LCG] -¿Cargar partida y seguir jugando? +¿Cargar la partida y seguir jugando? [FEC_FIR] Disparar @@ -7819,7 +7819,7 @@ ESTELAS DISTANCIA DE DIBUJADO [FEM_VSC] -SINCRONÍA DE IMAGEN +SINCRONIZAR IMAGEN [FEM_FRM] LIMITADOR DE FOTOGRAMAS @@ -8046,7 +8046,7 @@ BORDES EN CINEMÁTICAS FORMATO DE IMAGEN [FEM_ISL] -USO DE MEMORIA +USO DE MEMORIA DEL MAPA [FEM_LOW] BAJO |