1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 15:10:01 +00:00

Merge pull request #2 from GTAmodding/master

merge updates
This commit is contained in:
Fire_Head 2019-07-24 21:00:08 +03:00 committed by GitHub
commit 81ee1c509a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 11825 additions and 1596 deletions

View file

@ -1,20 +1,47 @@
image: Visual Studio 2017 version: 1.0.{build}
image: Visual Studio 2019
configuration: configuration:
- DebugCI - Debug
- ReleaseCI - Release
platform: platform: Win32
- Win32
environment: environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true APPVEYOR_SAVE_CACHE_ON_ERROR: true
install: install:
- set PATH=%APPVEYOR_BUILD_FOLDER%/bin;%PATH% - cmd: >-
before_build: git submodule update --init --recursive
- mkdir "%APPVEYOR_BUILD_FOLDER%/build"
- cd "%APPVEYOR_BUILD_FOLDER%"
- premake5.exe vs2015
build:
project: c:\projects\re3\build\re3.sln
verbosity: minimal
artifacts:
path: bin/%CONFIGURATION%/re3.dll
premake-vs2019.cmd
build:
project: build/re3.sln
verbosity: minimal
after_build:
# downloading latest release of UAL to make release with UAL and ASI.
- ps: >-
$releases = "https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases"
$name = "Ultimate-ASI-Loader.zip"
$latestRelease = Invoke-WebRequest $releases/latest -Headers @{"Accept"="application/json"}
$json = $latestRelease.Content | ConvertFrom-Json
$latestVersion = $json.tag_name
$url = "$releases/download/$latestVersion/$name"
Start-FileDownload $url -FileName 'C:\Ultimate-ASI-Loader.zip'
7z e c:\Ultimate-ASI-Loader.zip -oc:\Projects\re3\bin\${env:CONFIGURATION}
cd "bin\${env:CONFIGURATION}"
copy re3.dll re3.asi
7z u "RE3_${env:CONFIGURATION}+UAL.zip" re3.asi dinput8.dll
Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
artifacts:
- path: bin/%CONFIGURATION%/re3.dll
name: re3.dll

350
.gitignore vendored Normal file
View file

@ -0,0 +1,350 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Bb]uild/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

View file

@ -5,8 +5,8 @@ parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus)
such that we have a working game at all times. such that we have a working game at all times.
Apparently you can download a binary of the latest version here: Apparently you can download a binary of the latest version here:
[Debug](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/DebugCI/re3.dll?branch=master&job=Configuration%3A+DebugCI), [Debug](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/Debug/re3.dll?branch=master&job=Configuration%3A+Debug),
[Release](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/ReleaseCI/re3.dll?branch=master&job=Configuration%3A+ReleaseCI). [Release](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/Release/re3.dll?branch=master&job=Configuration%3A+Release).
Build status: Build status:
[![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master) [![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master)

1
premake-vs2019.cmd Normal file
View file

@ -0,0 +1 @@
premake5 vs2019

View file

@ -1,5 +1,5 @@
workspace "re3" workspace "re3"
configurations { "DebugCI", "ReleaseCI", "Release", "ReleaseFH", "Debug" } configurations { "Debug", "Release", "ReleaseFH" }
location "build" location "build"
files { "src/*.*" } files { "src/*.*" }
@ -24,6 +24,7 @@ workspace "re3"
includedirs { "src/control" } includedirs { "src/control" }
includedirs { "src/core" } includedirs { "src/core" }
includedirs { "src/entities" } includedirs { "src/entities" }
includedirs { "src/math" }
includedirs { "src/modelinfo" } includedirs { "src/modelinfo" }
includedirs { "src/objects" } includedirs { "src/objects" }
includedirs { "src/peds" } includedirs { "src/peds" }
@ -38,6 +39,32 @@ workspace "re3"
libdirs { "dxsdk/lib" } libdirs { "dxsdk/lib" }
pbcommands = {
"setlocal EnableDelayedExpansion",
"set file=$(TargetPath)",
"FOR %%i IN (\"%file%\") DO (",
"set filename=%%~ni",
"set fileextension=%%~xi",
"set target=!path!!filename!!fileextension!",
"if exist \"!target!\" copy /y \"!file!\" \"!target!\"",
")" }
function setpaths (gamepath, exepath, scriptspath)
scriptspath = scriptspath or ""
if (gamepath) then
cmdcopy = { "set \"path=" .. gamepath .. scriptspath .. "\"" }
table.insert(cmdcopy, pbcommands)
postbuildcommands (cmdcopy)
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
--targetdir ("bin/%{prj.name}/" .. scriptspath)
end
project "re3" project "re3"
kind "SharedLib" kind "SharedLib"
language "C++" language "C++"
@ -51,31 +78,18 @@ project "re3"
defines { "DEBUG" } defines { "DEBUG" }
staticruntime "on" staticruntime "on"
symbols "On" symbols "On"
debugdir "$(GTA_III_RE_DIR)" setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
debugcommand "$(GTA_III_RE_DIR)/gta3.exe"
postbuildcommands "copy /y \"$(TargetPath)\" \"$(GTA_III_RE_DIR)\\plugins\\re3.dll\""
filter "configurations:Release" filter "configurations:Release"
defines { "NDEBUG" } defines { "NDEBUG" }
optimize "On" optimize "On"
staticruntime "on" staticruntime "on"
debugdir "C:/Users/aap/games/gta3_re" setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
debugcommand "C:/Users/aap/games/gta3_re/gta3.exe"
postbuildcommands "copy /y \"$(TargetPath)\" \"$(GTA_III_RE_DIR)\\plugins\\re3.dll\""
filter "configurations:ReleaseFH" filter "configurations:ReleaseFH"
defines { "NDEBUG" } defines { "NDEBUG" }
symbols "Full" symbols "Full"
optimize "off" optimize "off"
staticruntime "on" staticruntime "on"
debugdir "$(GTA_III_DIR)"
debugcommand "$(GTA_III_DIR)/gta3.exe"
targetextension ".asi" targetextension ".asi"
targetdir "$(GTA_III_DIR)/scripts" setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "scripts/")
filter "configurations:DebugCI"
defines { "DEBUG" }
symbols "On"
staticruntime "on"
filter "configurations:ReleaseCI"
defines { "NDEBUG" }
optimize "On"
staticruntime "on"

View file

@ -116,15 +116,14 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name)
for(i = 0; i < animBlock->numAnims; i++){ for(i = 0; i < animBlock->numAnims; i++){
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i); CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
CBaseModelInfo *model = GetModelFromName(anim->name); CBaseModelInfo *model = GetModelFromName(anim->name);
assert(model);
printf("Associated anim %s with model %s\n", anim->name, model->GetName()); printf("Associated anim %s with model %s\n", anim->name, model->GetName());
if(model){
RpClump *clump = (RpClump*)model->CreateInstance(); RpClump *clump = (RpClump*)model->CreateInstance();
RpAnimBlendClumpInit(clump); RpAnimBlendClumpInit(clump);
assocList[i].Init(clump, anim); assocList[i].Init(clump, anim);
RpClumpDestroy(clump); RpClumpDestroy(clump);
assocList[i].animId = i; assocList[i].animId = i;
} }
}
numAssociations = animBlock->numAnims; numAssociations = animBlock->numAnims;
} }

View file

@ -77,6 +77,8 @@ public:
void UpdateTime(float timeDelta, float relSpeed); void UpdateTime(float timeDelta, float relSpeed);
bool UpdateBlend(float timeDelta); bool UpdateBlend(float timeDelta);
void SetRun(void) { flags |= ASSOC_RUNNING; }
inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; } inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) { static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "math/Quaternion.h" #include "Quaternion.h"
// TODO: put them somewhere else? // TODO: put them somewhere else?
struct KeyFrame { struct KeyFrame {

File diff suppressed because it is too large Load diff

View file

@ -7,48 +7,48 @@
class tActiveSample class tActiveSample
{ {
public: public:
int m_nEntityIndex; int32 m_nEntityIndex;
int field_4; int32 field_4;
int m_nSampleIndex; int32 m_nSampleIndex;
char m_bBankIndex; uint8 m_bBankIndex;
char m_bIsDistant; uint8 m_bIsDistant;
char field_14; uint8 field_14;
char field_15; uint8 field_15;
int field_16; int32 field_16;
int m_nFrequency; int32 m_nFrequency;
uint8 m_bVolume; uint8 m_bVolume;
char field_25; uint8 field_25;
char field_26; uint8 field_26;
char field_27; uint8 field_27;
float m_fDistance; float m_fDistance;
int m_nLoopCount; int32 m_nLoopCount;
int m_nLoopStart; int32 m_nLoopStart;
int m_nLoopEnd; int32 m_nLoopEnd;
uint8 m_bEmittingVolume; uint8 m_bEmittingVolume;
char field_45; uint8 field_45;
char field_46; uint8 field_46;
char field_47; uint8 field_47;
float field_48; float field_48;
float m_fSoundIntensity; float m_fSoundIntensity;
char field_56; uint8 field_56;
char field_57; uint8 field_57;
char field_58; uint8 field_58;
char field_59; uint8 field_59;
CVector m_vecPos; CVector m_vecPos;
char m_bReverbFlag; uint8 m_bReverbFlag;
char m_bLoopsRemaining; uint8 m_bLoopsRemaining;
char m_bRequireReflection; uint8 m_bRequireReflection;
uint8 m_bOffset; uint8 m_bOffset;
int field_76; int32 field_76;
char m_bIsProcessed; uint8 m_bIsProcessed;
char m_bLoopEnded; uint8 m_bLoopEnded;
char field_82; uint8 field_82;
char field_83; uint8 field_83;
int calculatedVolume; int32 calculatedVolume;
char field_88; uint8 field_88;
char field_89; uint8 field_89;
char field_90; uint8 field_90;
char field_91; uint8 field_91;
}; };
static_assert(sizeof(tActiveSample) == 0x5c, "tActiveSample: error"); static_assert(sizeof(tActiveSample) == 0x5c, "tActiveSample: error");
@ -77,14 +77,14 @@ class tAudioEntity
{ {
public: public:
eAudioType m_nType; eAudioType m_nType;
CPhysical *m_pEntity; void *m_pEntity;
bool m_bIsUsed; bool m_bIsUsed;
char m_bStatus; uint8 m_bStatus;
int16 m_awAudioEvent[4]; int16 m_awAudioEvent[4];
char gap_18[2]; uint8 gap_18[2];
float m_afVolume[4]; float m_afVolume[4];
char field_24; uint8 field_24;
char field_25[3]; uint8 field_25[3];
}; };
static_assert(sizeof(tAudioEntity) == 0x28, "tAudioEntity: error"); static_assert(sizeof(tAudioEntity) == 0x28, "tAudioEntity: error");
@ -96,9 +96,9 @@ public:
int field_4; int field_4;
CVector m_vecPos; CVector m_vecPos;
float m_fDistance; float m_fDistance;
char m_bVolume; uint8 m_bVolume;
char field_25; uint8 field_25;
char gap_26[2]; uint8 gap_26[2];
}; };
static_assert(sizeof(tPedComment) == 0x1c, "tPedComment: error"); static_assert(sizeof(tPedComment) == 0x1c, "tPedComment: error");
@ -107,10 +107,10 @@ class cPedComments
{ {
public: public:
tPedComment m_asPedComments[40]; tPedComment m_asPedComments[40];
char field_1120[40]; uint8 field_1120[40];
char field_1160[2]; uint8 field_1160[2];
char field_1162; uint8 field_1162;
char gap_1163[1]; uint8 gap_1163[1];
}; };
static_assert(sizeof(cPedComments) == 0x48c, "cPedComments: error"); static_assert(sizeof(cPedComments) == 0x48c, "cPedComments: error");
@ -122,15 +122,15 @@ class cAudioCollision
public: public:
CEntity *m_pEntity1; CEntity *m_pEntity1;
CEntity *m_pEntity2; CEntity *m_pEntity2;
char m_bSurface1; uint8 m_bSurface1;
char m_bSurface2; uint8 m_bSurface2;
char field_10; uint8 field_10;
char field_11; uint8 field_11;
float m_fIntensity1; float m_fIntensity1;
float m_fIntensity2; float m_fIntensity2;
CVector m_vecPosition; CVector m_vecPosition;
float m_fDistance; float m_fDistance;
int m_nBaseVolume; int32 m_nBaseVolume;
}; };
static_assert(sizeof(cAudioCollision) == 0x28, "cAudioCollision: error"); static_assert(sizeof(cAudioCollision) == 0x28, "cAudioCollision: error");
@ -140,95 +140,137 @@ class cAudioCollisionManager
public: public:
cAudioCollision m_asCollisions1[10]; cAudioCollision m_asCollisions1[10];
cAudioCollision m_asCollisions2[10]; cAudioCollision m_asCollisions2[10];
char m_bIndicesTable[10]; uint8 m_bIndicesTable[10];
char m_bCollisionsInQueue; uint8 m_bCollisionsInQueue;
char gap_811; uint8 gap_811;
cAudioCollision m_sQueue; cAudioCollision m_sQueue;
}; };
static_assert(sizeof(cAudioCollisionManager) == 0x354, static_assert(sizeof(cAudioCollisionManager) == 0x354, "cAudioCollisionManager: error");
"cAudioCollisionManager: error");
class cMissionAudio class cMissionAudio
{ {
public: public:
CVector m_vecPos; CVector m_vecPos;
char field_12; uint8 field_12;
char gap_13[3]; uint8 gap_13[3];
int m_nSampleIndex; int m_nSampleIndex;
char m_bLoadingStatus; uint8 m_bLoadingStatus;
char m_bPlayStatus; uint8 m_bPlayStatus;
char field_22; uint8 field_22;
char field_23; uint8 field_23;
int field_24; int field_24;
bool m_bIsPlayed; bool m_bIsPlayed;
char field_29; uint8 field_29;
char field_30; uint8 field_30;
char field_31; uint8 field_31;
}; };
static_assert(sizeof(cMissionAudio) == 0x20, "cMissionAudio: error"); static_assert(sizeof(cMissionAudio) == 0x20, "cMissionAudio: error");
class cVehicleParams;
class CPlane;
class CVehicle;
class CPed;
struct cAudioScriptObject {
int16 m_wSound;
char gap_2[2];
CVector m_vecPos;
int m_nAudioEntityId;
static void *operator new(size_t);
static void *operator new(size_t, int);
static void operator delete(void*, size_t);
static void operator delete(void*, int);
};
static_assert(sizeof(cAudioScriptObject) == 0x14, "cAudioScriptObject: error");
class cAudioManager class cAudioManager
{ {
public: public:
bool m_bIsInitialised; bool m_bIsInitialised;
char field_1; uint8 field_1;
char field_2; uint8 field_2;
char m_bActiveSamples; uint8 m_bActiveSamples;
char field_4; uint8 field_4;
bool m_bDynamicAcousticModelingStatus; bool m_bDynamicAcousticModelingStatus;
char field_6; uint8 field_6;
char field_7; uint8 field_7;
float field_8; float speedOfSound;
bool m_bTimerJustReset; bool m_bTimerJustReset;
char field_13; uint8 field_13;
char field_14; uint8 field_14;
char field_15; uint8 field_15;
int m_nTimer; int32 m_nTimer;
tActiveSample m_sQueueSample; tActiveSample m_sQueueSample;
uint8 m_bActiveSampleQueue; uint8 m_bActiveSampleQueue;
char gap_109[3]; uint8 gap_109[3];
tActiveSample m_asSamples[54]; tActiveSample m_asSamples[2][27];
char m_abSampleQueueIndexTable[54]; uint8 m_abSampleQueueIndexTable[2][27];
char m_bSampleRequestQueuesStatus[2]; uint8 m_bSampleRequestQueuesStatus[2];
tActiveSample m_asActiveSamples[27]; tActiveSample m_asActiveSamples[27];
tAudioEntity m_asAudioEntities[200]; tAudioEntity m_asAudioEntities[200];
int m_anAudioEntityIndices[200]; int32 m_anAudioEntityIndices[200];
int m_nAudioEntitiesTotal; int32 m_nAudioEntitiesTotal;
CVector m_avecReflectionsPos[5]; CVector m_avecReflectionsPos[5];
float m_afReflectionsDistances[5]; float m_afReflectionsDistances[5];
int m_anScriptObjectEntityIndices[40]; int32 m_anScriptObjectEntityIndices[40];
int m_nScriptObjectEntityTotal; int32 m_nScriptObjectEntityTotal;
cPedComments m_sPedComments; cPedComments m_sPedComments;
int m_nFireAudioEntity; int32 m_nFireAudioEntity;
int m_nWaterCannonEntity; int32 m_nWaterCannonEntity;
int m_nPoliceChannelEntity; int32 m_nPoliceChannelEntity;
char gap45B8[444]; uint8 gap45B8[444];
int m_nFrontEndEntity; int32 m_nFrontEndEntity;
int m_nCollisionEntity; int32 m_nCollisionEntity;
cAudioCollisionManager m_sCollisionManager; cAudioCollisionManager m_sCollisionManager;
int m_nProjectileEntity; int32 m_nProjectileEntity;
int m_nBridgeEntity; int32 m_nBridgeEntity;
cMissionAudio m_sMissionAudio; cMissionAudio m_sMissionAudio;
int m_anRandomTable[5]; int32 m_anRandomTable[5];
char field_19192; uint8 field_19192;
char m_bUserPause; uint8 m_bUserPause;
char m_bPreviousUserPause; uint8 m_bPreviousUserPause;
char field_19195; uint8 field_19195;
int m_nTimeOfRecentCrime; int32 m_nTimeOfRecentCrime;
void AddSampleToRequestedQueue(); void AddDetailsToRequestedOrderList(uint8 sample); /// ok
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
uint8 unk2, bool notLooping); /// ok
void AddReflectionsToRequestedQueue(); /// ok (check value)
void AddReleasingSounds(); // todo (difficult)
void AddSampleToRequestedQueue(); /// ok
void AgeCrimes(); // todo
int8 AutoDetect3DProviders(); /// ok
void AddDetailsToRequestedOrderList(uint8 sample); void CalculateDistance(bool *ptr, float dist); /// ok
void AddReflectionsToRequestedQueue(); bool CheckForAnAudioFileOnCD(); /// ok
void ClearMissionAudio(); /// ok
void ClearRequestedQueue(); /// ok
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
float speedMultiplier); /// ok
int32 ComputePan(float, CVector *); // todo
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance); /// ok
int32 CreateEntity(int32 type, CPhysical *entity); /// ok
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance); void DestroyAllGameCreatedEntities(); /// ok
void DestroyEntity(int32 id); /// ok
void DoPoliceRadioCrackle(); /// ok
void GenerateIntegerRandomNumberTable(); /// ok
float GetDistanceSquared(CVector *v); /// ok
void TranslateEntity(CVector *v1, CVector *v2); /// ok
// done
void Initialise(); void Initialise();
void PostInitialiseGameSpecificSetup(); void PostInitialiseGameSpecificSetup();
void InitialisePoliceRadioZones(); // @todo void InitialisePoliceRadioZones(); // todo
void ResetAudioLogicTimers(int32 timer); // @todo void ResetAudioLogicTimers(int32 timer); // todo
void Terminate(); void Terminate();
@ -236,7 +278,6 @@ public:
bool GetMissionAudioLoadingStatus(); bool GetMissionAudioLoadingStatus();
uint8 GetNum3DProvidersAvailable(); uint8 GetNum3DProvidersAvailable();
int8 AutoDetect3DProviders();
bool IsMP3RadioChannelAvailable(); bool IsMP3RadioChannelAvailable();
uint8 GetCDAudioDriveLetter(); uint8 GetCDAudioDriveLetter();
@ -247,24 +288,21 @@ public:
void SetSpeakerConfig(int32 conf); void SetSpeakerConfig(int32 conf);
void ProcessJumboFlying();
bool SetupJumboEngineSound(uint8, int32); // todo bool SetupJumboEngineSound(uint8, int32); // todo
void PreInitialiseGameSpecificSetup(); void PreInitialiseGameSpecificSetup();
void SetMissionScriptPoliceAudio(int32 sfx); void SetMissionScriptPoliceAudio(int32 sfx);
void CalculateDistance(bool *ptr, float dist);
bool UsesSiren(int32 model); bool UsesSiren(int32 model);
bool UsesSirenSwitching(int32 model); bool UsesSirenSwitching(int32 model);
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission); bool MissionScriptAudioUsesPoliceChannel(int32 soundMission);
uint8 Get3DProviderName(uint8 id); char* Get3DProviderName(uint8 id);
void ProcessJumboTaxi(); bool SetupJumboFlySound(uint8 emittingVol); /// ok
bool SetupJumboFlySound(uint8); // todo bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
bool SetupJumboTaxiSound(uint8); // todo bool SetupJumboTaxiSound(uint8 vol); /// ok
bool SetupJumboWhineSound(uint8, int32); // todo bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
void PlayLoadedMissionAudio(); void PlayLoadedMissionAudio();
@ -274,27 +312,14 @@ public:
void InterrogateAudioEntities(); void InterrogateAudioEntities();
void ClearRequestedQueue();
// void AgeCrimes(); //todo
bool UsesReverseWarning(int32 model); bool UsesReverseWarning(int32 model);
bool HasAirBrakes(int32 model); bool HasAirBrakes(int32 model);
int32 GetJumboTaxiFreq(); int32 GetJumboTaxiFreq();
void ProcessPhysical(int32 id);
void ProcessVehicle(CPhysical *); // todo
void ProcessPed(CPhysical *); // todo
void ProcessPlane(void *); // todo
void ClearMissionAudio();
// void ProcessReverb(); // todo
bool IsMissionAudioSampleFinished(); bool IsMissionAudioSampleFinished();
void ProcessEntity(int32); void InitialisePoliceRadio(); // todo
void InitialisePoliceRadio();
int32 RandomDisplacement(uint32 seed); int32 RandomDisplacement(uint32 seed);
@ -304,21 +329,20 @@ public:
bool IsAudioInitialised() const; bool IsAudioInitialised() const;
int32 CreateEntity(int32 type, CPhysical *entity);
void DestroyEntity(int32 id);
void SetEntityStatus(int32 id, bool status); void SetEntityStatus(int32 id, bool status);
void PreTerminateGameSpecificShutdown(); void PreTerminateGameSpecificShutdown();
void PostTerminateGameSpecificShutdown(); void PostTerminateGameSpecificShutdown();
void GenerateIntegerRandomNumberTable();
void PlayerJustGotInCar(); void PlayerJustGotInCar();
void PlayerJustLeftCar(); void PlayerJustLeftCar();
void Service(); void Service();
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset);
uint32 maxOffset);
void DoJumboVolOffset();
int32 GetPedCommentSfx(CPed *ped, int32 sound);
uint32 GetPlayerTalkSfx(int16 sound); uint32 GetPlayerTalkSfx(int16 sound);
uint32 GetCopTalkSfx(int16 sound); uint32 GetCopTalkSfx(int16 sound);
@ -396,9 +420,74 @@ public:
uint32 GetGenericMaleTalkSfx(int16 sound); uint32 GetGenericMaleTalkSfx(int16 sound);
uint32 GetGenericFemaleTalkSfx(int16 sound); uint32 GetGenericFemaleTalkSfx(int16 sound);
void ProcessActiveQueues(); // todo
bool ProcessAirBrakes(cVehicleParams *params); /// ok
void ProcessAirportScriptObject(uint8 sound); /// ok
bool ProcessBoatEngine(cVehicleParams *params); // todo requires CBoat
bool ProcessBoatMovingOverWater(cVehicleParams *params); // todo requires CBoat
void ProcessBridge(); // todo requires CBridge
void ProcessBridgeMotor(); /// ok
void ProcessBridgeOneShots(); // todo requires CBridge
void ProcessBridgeWarning(); /// ok
bool ProcessCarBombTick(void *); // todo requires CVehicle
void ProcessCesna(void *); // todo requires CPlane
void ProcessCinemaScriptObject(uint8 sound); /// ok
void ProcessCrane(); // todo requires CCrane
void ProcessDocksScriptObject(uint8 sound); /// ok
// bool ProcessEngineDamage(void *); //todo requires CVehicle
void ProcessEntity(int32 sound); /// ok
void ProcessExplosions(int32 explosion); // todo requires CExplosion
void ProcessFireHydrant(); /// ok
void ProcessFires(int32 entity); // todo requires gFireManager
void ProcessFrontEnd(); /// ok
void ProcessGarages(); // todo requires CGarages::aGarages
// bool ProcessHelicopter(void *); // todo requires CVehicle
void ProcessHomeScriptObject(uint8 sound); /// ok
void ProcessJumbo(cVehicleParams *); /// ok
void ProcessJumboAccel(CPlane *plane); /// ok
void ProcessJumboDecel(CPlane *plane); /// ok
void ProcessJumboFlying(); /// ok
void ProcessJumboLanding(CPlane *plane); /// ok
void ProcessJumboTakeOff(CPlane *plane); /// ok
void ProcessJumboTaxi(); /// ok
void ProcessLaunderetteScriptObject(uint8 sound); /// ok
void ProcessLoopingScriptObject(uint8 sound); /// ok
// void ProcessMissionAudio();
// void ProcessModelVehicle(void *);
// void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *p); // todo
// void ProcessPedHeadphones(void *);
// void ProcessPedOneShots(void *);
void ProcessPhysical(int32 id); /// ok
void ProcessPlane(void *); // todo
// void ProcessPlayersVehicleEngine(void *, void *);
void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo
void ProcessPornCinema(uint8 sound); /// ok
void ProcessProjectiles(); // todo
// void ProcessRainOnVehicle(void *);
// void ProcessReverb();
// bool ProcessReverseGear(void *);
void ProcessSawMillScriptObject(uint8 sound); /// ok
void ProcessScriptObject(int32 id); // todo
void ProcessShopScriptObject(uint8 sound); /// ok
void ProcessSpecial(); /// ok
// bool ProcessTrainNoise(void *);
void ProcessVehicle(CVehicle *); // todo
// bool ProcessVehicleDoors(void *);
// bool ProcessVehicleEngine(void *);
// void ProcessVehicleHorn(void *);
// void ProcessVehicleOneShots(void *);
// bool ProcessVehicleReverseWarning(void *);
// bool ProcessVehicleRoadNoise(void *);
// void ProcessVehicleSirenOrAlarm(void *);
// void ProcessVehicleSkidding(void *);
void ProcessWaterCannon(int32); // todo
void ProcessWeather(int32 id); // todo
// bool ProcessWetRoadNoise(void *);
void ProcessWorkShopScriptObject(uint8 sound); /// ok
}; };
static_assert(sizeof(cAudioManager) == 0x4B14, "cAudioManager: error"); static_assert(sizeof(cAudioManager) == 0x4B14, "cAudioManager: error");
extern cAudioManager &AudioManager; extern cAudioManager &AudioManager;
extern cAudioManager &Players;

View file

@ -3038,3 +3038,131 @@ enum eAudioSamples : uint32 {
TOTAL_AUDIO_SAMPLES = 3032, TOTAL_AUDIO_SAMPLES = 3032,
NO_SAMPLE = 3033, NO_SAMPLE = 3033,
}; };
enum eScriptSounds : int16
{
SCRIPT_SOUND_0 = 0,
SCRIPT_SOUND_1 = 1,
SCRIPT_SOUND_2 = 2,
SCRIPT_SOUND_3 = 3,
SCRIPT_SOUND_PARTY_1_LOOP_S = 4,
SCRIPT_SOUND_PARTY_1_LOOP_L = 5,
SCRIPT_SOUND_PARTY_2_LOOP_S = 6,
SCRIPT_SOUND_PARTY_2_LOOP_L = 7,
SCRIPT_SOUND_PARTY_3_LOOP_S = 8,
SCRIPT_SOUND_PARTY_3_LOOP_L = 9,
SCRIPT_SOUND_PARTY_4_LOOP_S = 10,
SCRIPT_SOUND_PARTY_4_LOOP_L = 11,
SCRIPT_SOUND_PARTY_5_LOOP_S = 12,
SCRIPT_SOUND_PARTY_5_LOOP_L = 13,
SCRIPT_SOUND_PARTY_6_LOOP_S = 14,
SCRIPT_SOUND_PARTY_6_LOOP_L = 15,
SCRIPT_SOUND_PARTY_7_LOOP_S = 16,
SCRIPT_SOUND_PARTY_7_LOOP_L = 17,
SCRIPT_SOUND_PARTY_8_LOOP_S = 18,
SCRIPT_SOUND_PARTY_8_LOOP_L = 19,
SCRIPT_SOUND_PARTY_9_LOOP_S = 20,
SCRIPT_SOUND_PARTY_9_LOOP_L = 21,
SCRIPT_SOUND_PARTY_10_LOOP_S = 22,
SCRIPT_SOUND_PARTY_10_LOOP_L = 23,
SCRIPT_SOUND_PARTY_11_LOOP_S = 24,
SCRIPT_SOUND_PARTY_11_LOOP_L = 25,
SCRIPT_SOUND_PARTY_12_LOOP_S = 26,
SCRIPT_SOUND_PARTY_12_LOOP_L = 27,
SCRIPT_SOUND_PARTY_13_LOOP_S = 28,
SCRIPT_SOUND_PARTY_13_LOOP_L = 29,
SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30,
SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31,
SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32,
SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33,
SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34,
SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35,
SCRIPT_SOUND_SAWMILL_LOOP_S = 36,
SCRIPT_SOUND_SAWMILL_LOOP_L = 37,
SCRIPT_SOUND_38 = 38,
SCRIPT_SOUND_39 = 39,
SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40,
SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43,
SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44,
SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45,
SCRIPT_SOUND_46 = 46,
SCRIPT_SOUND_47 = 47,
SCRIPT_SOUND_MARCO_BISTRO_S = 48,
SCRIPT_SOUND_MARCO_BISTRO_L = 49,
SCRIPT_SOUND_AIRPORT_LOOP_S = 50,
SCRIPT_SOUND_AIRPORT_LOOP_L = 51,
SCRIPT_SOUND_SHOP_LOOP_S = 52,
SCRIPT_SOUND_SHOP_LOOP_L = 53,
SCRIPT_SOUND_CINEMA_LOOP_S = 54,
SCRIPT_SOUND_CINEMA_LOOP_L = 55,
SCRIPT_SOUND_DOCKS_LOOP_S = 56,
SCRIPT_SOUND_DOCKS_LOOP_L = 57,
SCRIPT_SOUND_HOME_LOOP_S = 58,
SCRIPT_SOUND_HOME_LOOP_L = 59,
SCRIPT_SOUND_FRANKIE_PIANO = 60,
SCRIPT_SOUND_PARTY_1_LOOP = 61,
SCRIPT_SOUND_PORN_CINEMA_1_S = 62,
SCRIPT_SOUND_PORN_CINEMA_1_L = 63,
SCRIPT_SOUND_PORN_CINEMA_2_S = 64,
SCRIPT_SOUND_PORN_CINEMA_2_L = 65,
SCRIPT_SOUND_PORN_CINEMA_3_S = 66,
SCRIPT_SOUND_PORN_CINEMA_3_L = 67,
SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68,
SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69,
SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70,
SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71,
SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72,
SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73,
SCRIPT_SOUND_74 = 74,
SCRIPT_SOUND_75 = 75,
SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76,
SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77,
SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78,
SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79,
SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80,
SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81,
SCRIPT_SOUND_EVIDENCE_PICKUP = 82,
SCRIPT_SOUND_UNLOAD_GOLD = 83,
SCRIPT_SOUND_RAVE_1_LOOP_S = 84,
SCRIPT_SOUND_RAVE_1_LOOP_L = 85,
SCRIPT_SOUND_RAVE_2_LOOP_S = 86,
SCRIPT_SOUND_RAVE_2_LOOP_L = 87,
SCRIPT_SOUND_RAVE_3_LOOP_S = 88,
SCRIPT_SOUND_RAVE_3_LOOP_L = 89,
SCRIPT_SOUND_MISTY_SEX_S = 90,
SCRIPT_SOUND_MISTY_SEX_L = 91,
SCRIPT_SOUND_GATE_START_CLUNK = 92,
SCRIPT_SOUND_GATE_STOP_CLUNK = 93,
SCRIPT_SOUND_PART_MISSION_COMPLETE = 94,
SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95,
SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96,
SCRIPT_SOUND_RACE_START_3 = 97,
SCRIPT_SOUND_RACE_START_2 = 98,
SCRIPT_SOUND_RACE_START_1 = 99,
SCRIPT_SOUND_RACE_START_GO = 100,
SCRIPT_SOUND_SWAT_PED_SHOUT = 101,
SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102,
SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103,
SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104,
SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105,
SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106,
SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107,
SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108,
SCRIPT_SOUND_109 = 109,
SCRIPT_SOUND_110 = 110,
SCRIPT_SOUND_111 = 111,
SCRIPT_SOUND_PAYPHONE_RINGING = 112,
SCRIPT_SOUND_113 = 113,
SCRIPT_SOUND_GLASS_BREAK_L = 114,
SCRIPT_SOUND_GLASS_BREAK_S = 115,
SCRIPT_SOUND_GLASS_CRACK = 116,
SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117,
SCRIPT_SOUND_BOX_DESTROYED_1 = 118,
SCRIPT_SOUND_BOX_DESTROYED_2 = 119,
SCRIPT_SOUND_METAL_COLLISION = 120,
SCRIPT_SOUND_TIRE_COLLISION = 121,
SCRIPT_SOUND_GUNSHELL_DROP = 122,
SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123,
};

View file

@ -20,9 +20,9 @@ WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); }
WRAPPER void cDMAudio::PlayFrontEndTrack(uint32, uint32) { EAXJMP(0x57CC80); } WRAPPER void cDMAudio::PlayFrontEndTrack(uint32, uint32) { EAXJMP(0x57CC80); }
WRAPPER void cDMAudio::StopFrontEndTrack() { EAXJMP(0x57CCB0); } WRAPPER void cDMAudio::StopFrontEndTrack() { EAXJMP(0x57CCB0); }
WRAPPER void cDMAudio::PlayOneShot(int32 audioentity, uint16 sound/*eSound*/, float) { EAXJMP(0x57C840); } WRAPPER void cDMAudio::PlayOneShot(int32 audioentity, uint16 sound/*eSound*/, float) { EAXJMP(0x57C840); }
WRAPPER void cDMAudio::SetMusicMasterVolume(int8) { EAXJMP(0x57C8C0); } WRAPPER void cDMAudio::SetMusicMasterVolume(uint8) { EAXJMP(0x57C8C0); }
WRAPPER void cDMAudio::SetEffectsMasterVolume(int8) { EAXJMP(0x57C890); } WRAPPER void cDMAudio::SetEffectsMasterVolume(uint8) { EAXJMP(0x57C890); }
WRAPPER int8 cDMAudio::SetCurrent3DProvider(int8) { EAXJMP(0x57C9B0); } WRAPPER uint8 cDMAudio::SetCurrent3DProvider(uint8) { EAXJMP(0x57C9B0); }
WRAPPER int32 cDMAudio::SetSpeakerConfig(int32) { EAXJMP(0x57C9D0); } WRAPPER int32 cDMAudio::SetSpeakerConfig(int32) { EAXJMP(0x57C9D0); }
WRAPPER int32 cDMAudio::GetRadioInCar() { EAXJMP(0x57CE40); } WRAPPER int32 cDMAudio::GetRadioInCar() { EAXJMP(0x57CE40); }
@ -34,3 +34,4 @@ WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); } WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); } WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); }
WRAPPER void cDMAudio::ClearMissionAudio(void) { EAXJMP(0x57CE20); } WRAPPER void cDMAudio::ClearMissionAudio(void) { EAXJMP(0x57CE20); }
WRAPPER void cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) { EAXJMP(0x57CAD0); }

View file

@ -96,8 +96,8 @@ enum eSound : int16
SOUND_RAMPAGE_FAILED = 91, SOUND_RAMPAGE_FAILED = 91,
SOUND_RAMPAGE_KILL = 92, SOUND_RAMPAGE_KILL = 92,
SOUND_RAMPAGE_CAR_BLOWN = 93, SOUND_RAMPAGE_CAR_BLOWN = 93,
_SOUND_EVIDENCE_PICKUP = 94, SOUND_EVIDENCE_PICKUP = 94,
_SOUND_UNLOAD_GOLD = 95, SOUND_UNLOAD_GOLD = 95,
SOUND_PAGER = 96, SOUND_PAGER = 96,
SOUND_PED_DEATH = 97, SOUND_PED_DEATH = 97,
SOUND_PED_DAMAGE = 98, SOUND_PED_DAMAGE = 98,
@ -141,16 +141,16 @@ enum eSound : int16
SOUND_INJURED_PED_MALE_OUCH = 136, SOUND_INJURED_PED_MALE_OUCH = 136,
SOUND_INJURED_PED_FEMALE = 137, SOUND_INJURED_PED_FEMALE = 137,
SOUND_8A = 138, SOUND_8A = 138,
_SOUND_RACE_START_3 = 139, SOUND_RACE_START_3 = 139,
_SOUND_RACE_START_2 = 140, SOUND_RACE_START_2 = 140,
_SOUND_RACE_START_1 = 141, SOUND_RACE_START_1 = 141,
_SOUND_RACE_START_GO = 142, SOUND_RACE_START_GO = 142,
SOUND_SPLASH = 143, SOUND_SPLASH = 143,
SOUND_WATER_FALL = 144, SOUND_WATER_FALL = 144,
SOUND_SPLATTER = 145, SOUND_SPLATTER = 145,
SOUND_CAR_PED_COLLISION = 146, SOUND_CAR_PED_COLLISION = 146,
SOUND_CLOCK_TICK = 147, SOUND_CLOCK_TICK = 147,
_SOUND_PART_MISSION_COMPLETE = 148, SOUND_PART_MISSION_COMPLETE = 148,
SOUND_FRONTEND_MENU_STARTING = 149, SOUND_FRONTEND_MENU_STARTING = 149,
SOUND_FRONTEND_MENU_COMPLETED = 150, SOUND_FRONTEND_MENU_COMPLETED = 150,
SOUND_FRONTEND_MENU_DENIED = 151, SOUND_FRONTEND_MENU_DENIED = 151,
@ -173,6 +173,7 @@ enum eSound : int16
}; };
class CEntity; class CEntity;
enum eCrimeType;
class cDMAudio class cDMAudio
{ {
@ -191,9 +192,9 @@ public:
void PlayFrontEndTrack(uint32, uint32); void PlayFrontEndTrack(uint32, uint32);
void StopFrontEndTrack(); void StopFrontEndTrack();
void PlayOneShot(int32 audioentity, uint16 sound/*eSound*/, float); void PlayOneShot(int32 audioentity, uint16 sound/*eSound*/, float);
void SetMusicMasterVolume(int8); void SetMusicMasterVolume(uint8);
void SetEffectsMasterVolume(int8); void SetEffectsMasterVolume(uint8);
int8 SetCurrent3DProvider(int8); uint8 SetCurrent3DProvider(uint8);
int32 SetSpeakerConfig(int32); int32 SetSpeakerConfig(int32);
int32 GetRadioInCar(void); int32 GetRadioInCar(void);
void SetEffectsFadeVol(uint8); void SetEffectsFadeVol(uint8);
@ -204,5 +205,6 @@ public:
uint8 IsMP3RadioChannelAvailable(); uint8 IsMP3RadioChannelAvailable();
void DestroyEntity(int32); void DestroyEntity(int32);
void ClearMissionAudio(void); void ClearMissionAudio(void);
void ReportCrime(eCrimeType crime, const CVector &pos);
}; };
extern cDMAudio &DMAudio; extern cDMAudio &DMAudio;

View file

@ -188,3 +188,17 @@ cMusicManager::Terminate()
{ {
EAXJMP(0x57D140); EAXJMP(0x57D140);
} }
WRAPPER
void
cMusicManager::ChangeMusicMode(int32 mode)
{
EAXJMP(0x57D310);
}
WRAPPER
void
cMusicManager::StopFrontEndTrack()
{
EAXJMP(0x57E3D0);
}

View file

@ -267,6 +267,9 @@ public:
void Initialise(); void Initialise();
void Terminate(); void Terminate();
void ChangeMusicMode(int32 mode);
void StopFrontEndTrack();
char *Get3DProviderName(char); char *Get3DProviderName(char);
bool PlayerInCar(); bool PlayerInCar();
void DisplayRadioStationName(); void DisplayRadioStationName();

View file

@ -1,17 +1,66 @@
#include "SampleManager.h"
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "SampleManager.h"
CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0; CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
uint32 &nNumOfMp3Files = *(uint32 *)0x95CC00; uint32 &nNumOfMp3Files = *(uint32 *)0x95CC00;
uint8 &num3DProvidersAvailable = *(uint8 *)0x734237; uint8 &num3DProvidersAvailable = *(uint8 *)0x734237;
uint32 *asName3DProviders = (uint32 *)0x734238; char **asName3DProviders = (char **)0x734238;
bool CSampleManager::IsMP3RadioChannelAvailable() { bool
CSampleManager::IsMP3RadioChannelAvailable()
{
return nNumOfMp3Files != 0; return nNumOfMp3Files != 0;
} }
WRAPPER
void CSampleManager::SetChannelFrequency(int32, int32) { EAXJMP(0x5679D0); }
WRAPPER
void CSampleManager::SetChannelEmittingVolume(int32, uint32) { EAXJMP(0x567820); }
WRAPPER
void
CSampleManager::SetChannel3DPosition(int32, float, float, float)
{
EAXJMP(0x567890);
}
WRAPPER
void CSampleManager::SetChannelLoopCount(int32, int32) { EAXJMP(0x567AA0); }
WRAPPER
void CSampleManager::SetChannel3DDistances(int32, int32, int32) { EAXJMP(0x5678D0); }
WRAPPER
void CSampleManager::SetChannelReverbFlag(int32, uint8) { EAXJMP(0x567630); }
WRAPPER
int32 CSampleManager::GetSampleLength(int32) { EAXJMP(0x567300); }
WRAPPER
bool CSampleManager::InitialiseChannel(int32, int32, uint32, uint32) { EAXJMP(0x5676A0); }
WRAPPER
void CSampleManager::SetChannelLoopPoints(int32, int32, int32) { EAXJMP(0x567A30); }
WRAPPER
bool
CSampleManager::CheckForAnAudioFileOnCD()
{
EAXJMP(0x566EA0);
}
WRAPPER
int32 CSampleManager::GetSampleBaseFrequency(int32) { EAXJMP(0x5672A0); }
WRAPPER
int32 CSampleManager::GetSampleLoopStartOffset(int32) { EAXJMP(0x5672C0); }
WRAPPER
int32 CSampleManager::GetSampleLoopEndOffset(int32) { EAXJMP(0x5672E0); }
WRAPPER WRAPPER
bool CSampleManager::IsSampleBankLoaded(uint8) { EAXJMP(0x567130); } bool CSampleManager::IsSampleBankLoaded(uint8) { EAXJMP(0x567130); }
@ -108,6 +157,13 @@ CSampleManager::GetChannelUsedFlag(int32 id)
EAXJMP(0x567B00); EAXJMP(0x567B00);
} }
WRAPPER
void
CSampleManager::StartChannel(int32 id)
{
EAXJMP(0x567B80);
}
WRAPPER WRAPPER
void void
CSampleManager::StopChannel(int32 id) CSampleManager::StopChannel(int32 id)

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "common.h"
struct tSample { struct tSample {
int m_nOffset; int m_nOffset;
unsigned int m_nSize; unsigned int m_nSize;
@ -11,6 +13,26 @@ struct tSample {
class CSampleManager class CSampleManager
{ {
public: public:
void SetChannelFrequency(int32, int32);
void SetChannelEmittingVolume(int32, uint32);
void SetChannel3DPosition(int32, float, float, float);
void SetChannelLoopCount(int32, int32);
void SetChannel3DDistances(int32, int32, int32);
void SetChannelReverbFlag(int32, uint8);
int32 GetSampleLength(int32);
bool InitialiseChannel(int32, int32, uint32, uint32 something = 0);
void SetChannelLoopPoints(int32, int32, int32);
bool CheckForAnAudioFileOnCD();
int32 GetSampleBaseFrequency(int32);
int32 GetSampleLoopStartOffset(int32);
int32 GetSampleLoopEndOffset(int32);
bool IsSampleBankLoaded(uint8); bool IsSampleBankLoaded(uint8);
void UnloadSampleBank(uint8); void UnloadSampleBank(uint8);
void Terminate(); void Terminate();
@ -32,6 +54,8 @@ public:
void SetSpeakerConfig(uint32 config); void SetSpeakerConfig(uint32 config);
bool GetChannelUsedFlag(int32 id); bool GetChannelUsedFlag(int32 id);
void StartChannel(int32 id);
void StopChannel(int32 id); void StopChannel(int32 id);
static bool IsMP3RadioChannelAvailable(); static bool IsMP3RadioChannelAvailable();
@ -39,6 +63,6 @@ public:
extern uint32 &nNumOfMp3Files; extern uint32 &nNumOfMp3Files;
extern uint8 &num3DProvidersAvailable; extern uint8 &num3DProvidersAvailable;
extern uint32* asName3DProviders; extern char **asName3DProviders;
extern CSampleManager &cSampleManager; extern CSampleManager &cSampleManager;

View file

@ -72,8 +72,8 @@ public:
int8 m_nPreviousDirection; int8 m_nPreviousDirection;
int8 m_nCurrentDirecton; int8 m_nCurrentDirecton;
int8 m_nNextDirection; int8 m_nNextDirection;
int8 m_nPreviousPathDirection; int8 m_nPreviousLane;
int8 m_nCurrentPathDirection; int8 m_nCurrentLane;
eCarDrivingStyle m_nDrivingStyle; eCarDrivingStyle m_nDrivingStyle;
eCarMission m_nCarMission; eCarMission m_nCarMission;
eCarTempAction m_nAnimationId; eCarTempAction m_nAnimationId;
@ -101,8 +101,7 @@ public:
m_nCurrentPathNodeInfo = m_nNextPathNodeInfo; m_nCurrentPathNodeInfo = m_nNextPathNodeInfo;
m_nNextDirection = 1; m_nNextDirection = 1;
m_nCurrentDirecton = m_nNextDirection; m_nCurrentDirecton = m_nNextDirection;
m_nCurrentPathDirection = 0; m_nPreviousLane = m_nCurrentLane = 0;
m_nPreviousPathDirection = m_nCurrentPathDirection;
m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS; m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
m_nCarMission = MISSION_NONE; m_nCarMission = MISSION_NONE;
m_nAnimationId = TEMPACT_NONE; m_nAnimationId = TEMPACT_NONE;

View file

@ -46,6 +46,7 @@ void CBridge::Update()
float liftHeight; float liftHeight;
// Set bridge height and state
if (CStats::CommercialPassed) if (CStats::CommercialPassed)
{ {
if (TimeOfBridgeBecomingOperational == 0) if (TimeOfBridgeBecomingOperational == 0)
@ -81,6 +82,13 @@ void CBridge::Update()
liftHeight = 25.0; liftHeight = 25.0;
State = STATE_LIFT_PART_IS_UP; State = STATE_LIFT_PART_IS_UP;
} }
}
else
{
liftHeight = 25.0;
TimeOfBridgeBecomingOperational = 0;
State = STATE_BRIDGE_LOCKED;
}
// Move bridge part // Move bridge part
if (liftHeight != OldLift) if (liftHeight != OldLift)
@ -105,13 +113,6 @@ void CBridge::Update()
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN) else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
}
else
{
liftHeight = 25.0;
TimeOfBridgeBecomingOperational = 0;
State = STATE_BRIDGE_LOCKED;
}
} }
bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; } bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; }

6
src/control/CarAI.cpp Normal file
View file

@ -0,0 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "CarAI.h"
WRAPPER void CCarAI::UpdateCarAI(CVehicle*) { EAXJMP(0x413E50); }
WRAPPER void CCarAI::MakeWayForCarWithSiren(CVehicle *veh) { EAXJMP(0x416280); }

10
src/control/CarAI.h Normal file
View file

@ -0,0 +1,10 @@
#pragma once
class CVehicle;
class CCarAI
{
public:
static void UpdateCarAI(CVehicle*);
static void MakeWayForCarWithSiren(CVehicle *veh);
};

View file

@ -12,3 +12,16 @@ WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0);
WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); } WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }
WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); } WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); }
WRAPPER int32 CCarCtrl::ChooseCarModel(int32 vehclass) { EAXJMP(0x418110); } WRAPPER int32 CCarCtrl::ChooseCarModel(int32 vehclass) { EAXJMP(0x418110); }
WRAPPER bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool) { EAXJMP(0x41FA00); }
WRAPPER void CCarCtrl::JoinCarWithRoadSystem(CVehicle*) { EAXJMP(0x41F820); }
WRAPPER void CCarCtrl::SteerAICarWithPhysics(CVehicle*) { EAXJMP(0x41DA60); }
WRAPPER void CCarCtrl::UpdateCarOnRails(CVehicle*) { EAXJMP(0x418880); }
WRAPPER void CCarCtrl::ScanForPedDanger(CVehicle *veh) { EAXJMP(0x418F40); }
bool
CCarCtrl::MapCouldMoveInThisArea(float x, float y)
{
// bridge moves up and down
return x > -342.0f && x < -219.0f &&
y > -677.0f && y < -580.0f;
}

View file

@ -9,6 +9,12 @@ public:
static void AddToCarArray(int32 id, int32 vehclass); static void AddToCarArray(int32 id, int32 vehclass);
static void UpdateCarCount(CVehicle*, bool); static void UpdateCarCount(CVehicle*, bool);
static int32 ChooseCarModel(int32 vehclass); static int32 ChooseCarModel(int32 vehclass);
static bool JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool);
static void JoinCarWithRoadSystem(CVehicle*);
static void SteerAICarWithPhysics(CVehicle*);
static void UpdateCarOnRails(CVehicle*);
static bool MapCouldMoveInThisArea(float x, float y);
static void ScanForPedDanger(CVehicle *veh);
static int32 &NumLawEnforcerCars; static int32 &NumLawEnforcerCars;
static int32 &NumAmbulancesOnDuty; static int32 &NumAmbulancesOnDuty;

View file

@ -141,7 +141,7 @@ void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool he
} }
#endif #endif
void CDarkel::RegisterKillNotByPlayer() void CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
{ {
++CStats::NumberKillFrenziesPassed; ++CStats::NumberKillFrenziesPassed;
} }
@ -300,7 +300,7 @@ void CDarkel::Update()
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds(); TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
FindPlayerPed()->m_pWanted->SetWantedLevel(NOTWANTED); FindPlayerPed()->m_pWanted->SetWantedLevel(0);
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY) if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
WeaponType = WEAPONTYPE_UZI; WeaponType = WEAPONTYPE_UZI;

View file

@ -42,7 +42,7 @@ public:
static eKillFrenzyStatus ReadStatus(); static eKillFrenzyStatus ReadStatus();
static void RegisterCarBlownUpByPlayer(CVehicle *vehicle); static void RegisterCarBlownUpByPlayer(CVehicle *vehicle);
static void RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot = false); static void RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot = false);
static void RegisterKillNotByPlayer(); static void RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype);
static void ResetModelsKilledByPlayer(); static void ResetModelsKilledByPlayer();
static void ResetOnPlayerDeath(); static void ResetOnPlayerDeath();
static void StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot); static void StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot);

View file

@ -63,6 +63,8 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_CRUSHERLID; id == MI_CRUSHERLID;
} }
WRAPPER void CGarages::TriggerMessage(char *text, int16, uint16 time, int16) { EAXJMP(0x426B20); }
#if 0 #if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
#else #else

View file

@ -22,5 +22,6 @@ public:
public: public:
static bool IsModelIndexADoor(uint32 id); static bool IsModelIndexADoor(uint32 id);
static void TriggerMessage(char *text, int16, uint16 time, int16);
static void PrintMessages(void); static void PrintMessages(void);
}; };

View file

@ -5,7 +5,7 @@
CPathFind &ThePaths = *(CPathFind*)0x8F6754; CPathFind &ThePaths = *(CPathFind*)0x8F6754;
WRAPPER int32 CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool disabled, bool betweenLevels) { EAXJMP(0x42CC30); } WRAPPER int32 CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool disabled, bool betweenLevels) { EAXJMP(0x42CC30); }
WRAPPER CPathNode** CPathFind::FindNextNodeWandering(uint8, CVector, CPathNode**, CPathNode**, uint8, uint8*) { EAXJMP(0x42B9F0); }
int TempListLength; int TempListLength;
enum enum

View file

@ -129,6 +129,7 @@ public:
void StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, int8 numLeft, int8 numRight); void StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, int16 width, int8 numLeft, int8 numRight);
void RegisterMapObject(CTreadable *mapObject); void RegisterMapObject(CTreadable *mapObject);
int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool disabled, bool betweenLevels); int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool disabled, bool betweenLevels);
CPathNode** FindNextNodeWandering(uint8, CVector, CPathNode**, CPathNode**, uint8, uint8*);
bool IsPathObject(int id) { return id < PATHNODESIZE && (InfoForTileCars[id*12].type != 0 || InfoForTilePeds[id*12].type != 0); } bool IsPathObject(int id) { return id < PATHNODESIZE && (InfoForTileCars[id*12].type != 0 || InfoForTilePeds[id*12].type != 0); }

View file

@ -2,12 +2,18 @@
#include "patcher.h" #include "patcher.h"
#include "Phones.h" #include "Phones.h"
#include "Pools.h" #include "Pools.h"
#include "ModelIndices.h"
#include "Ped.h"
#include "Pad.h"
#include "Messages.h"
CPhoneInfo &gPhoneInfo = *(CPhoneInfo*)0x732A20; CPhoneInfo &gPhoneInfo = *(CPhoneInfo*)0x732A20;
bool &CPhoneInfo::isPhonePickedUp = *(bool*)0x6283AC; bool &CPhoneInfo::isPhonePickedUp = *(bool*)0x6283AC;
bool &CPhoneInfo::isPhoneBeingPickedUp = *(bool*)0x6283B4; uint32 &CPhoneInfo::phoneMessagesTimer = *(uint32*)0x6283A8;
CPhone *&CPhoneInfo::pickedUpPhone = *(CPhone**)0x6283B0; CPhone *&CPhoneInfo::pickedUpPhone = *(CPhone**)0x6283B0;
bool &CPhoneInfo::isPhoneBeingPickedUp = *(bool*)0x6283B4;
CPed *&CPhoneInfo::pedWhoPickingUpPhone = *(CPed**)0x6283B8;
int int
CPhoneInfo::FindNearestFreePhone(CVector *pos) CPhoneInfo::FindNearestFreePhone(CVector *pos)
@ -69,21 +75,20 @@ CPhoneInfo::Load(CPhoneInfo *source, uint8 buffer)
CPhone *phone = &source->m_aPhones[phoneId]; CPhone *phone = &source->m_aPhones[phoneId];
m_aPhones[phoneId].m_vecPos = phone->m_vecPos; m_aPhones[phoneId].m_vecPos = phone->m_vecPos;
memcpy(m_aPhones[phoneId].m_apMessages, phone->m_apMessages, sizeof(uint16*) * 6); memcpy(m_aPhones[phoneId].m_apMessages, phone->m_apMessages, sizeof(wchar*) * 6);
m_aPhones[phoneId].m_pEntity = phone->m_pEntity; m_aPhones[phoneId].m_pEntity = phone->m_pEntity;
m_aPhones[phoneId].m_nState = phone->m_nState; m_aPhones[phoneId].m_nState = phone->m_nState;
m_aPhones[phoneId].field_30 = phone->field_30; m_aPhones[phoneId].field_30 = phone->field_30;
if (phone->m_pEntity) {
// It's saved as building pool index in save file, convert it to true entity // It's saved as building pool index in save file, convert it to true entity
CBuilding *actualEntity = CPools::GetBuildingPool()->GetSlot((int)phone->m_pEntity - 1); if (phone->m_pEntity) {
m_aPhones[phoneId].m_pEntity = actualEntity; m_aPhones[phoneId].m_pEntity = CPools::GetBuildingPool()->GetSlot((int)phone->m_pEntity - 1);
} }
} }
} }
void void
CPhoneInfo::SetPhoneMessage_JustOnce(int phoneId, uint16 *msg1, uint16 *msg2, uint16 *msg3, uint16 *msg4, uint16 *msg5, uint16 *msg6) CPhoneInfo::SetPhoneMessage_JustOnce(int phoneId, wchar *msg1, wchar *msg2, wchar *msg3, wchar *msg4, wchar *msg5, wchar *msg6)
{ {
// If there is at least one message, it should be msg1. // If there is at least one message, it should be msg1.
if (msg1) { if (msg1) {
@ -100,7 +105,7 @@ CPhoneInfo::SetPhoneMessage_JustOnce(int phoneId, uint16 *msg1, uint16 *msg2, ui
} }
void void
CPhoneInfo::SetPhoneMessage_Repeatedly(int phoneId, uint16 *msg1, uint16 *msg2, uint16 *msg3, uint16 *msg4, uint16 *msg5, uint16 *msg6) CPhoneInfo::SetPhoneMessage_Repeatedly(int phoneId, wchar *msg1, wchar *msg2, wchar *msg3, wchar *msg4, wchar *msg5, wchar *msg6)
{ {
// If there is at least one message, it should be msg1. // If there is at least one message, it should be msg1.
if (msg1) { if (msg1) {
@ -116,6 +121,137 @@ CPhoneInfo::SetPhoneMessage_Repeatedly(int phoneId, uint16 *msg1, uint16 *msg2,
} }
} }
int
CPhoneInfo::GrabPhone(float xPos, float yPos)
{
// "Grab" doesn't mean picking up the phone, it means allocating some particular phone to
// whoever called the 024A opcode first with the position parameters closest to phone.
// Same phone won't be available on next run of this function.
int nearestPhoneId = -1;
CVector pos(xPos, yPos, 0.0f);
float nearestPhoneDist = 100.0f;
for (int phoneId = m_nNum; phoneId < m_nMax; phoneId++) {
float phoneDistance = (m_aPhones[phoneId].m_vecPos - pos).Magnitude2D();
if (phoneDistance < nearestPhoneDist) {
nearestPhoneDist = phoneDistance;
nearestPhoneId = phoneId;
}
}
m_aPhones[nearestPhoneId].m_nState = PHONE_STATE_MESSAGE_REMOVED;
CPhone oldFirstPhone = m_aPhones[m_nNum];
m_aPhones[m_nNum] = m_aPhones[nearestPhoneId];
m_aPhones[nearestPhoneId] = oldFirstPhone;
m_nNum++;
return m_nNum - 1;
}
void
CPhoneInfo::Initialise(void)
{
CBuildingPool *pool = CPools::GetBuildingPool();
pedWhoPickingUpPhone = nil;
isPhonePickedUp = false;
isPhoneBeingPickedUp = false;
pickedUpPhone = nil;
m_nMax = 0;
m_nNum = 0;
for (int v5 = pool->GetSize() - 1; v5 >= 0; v5--) {
CBuilding *building = pool->GetSlot(v5);
if (building) {
if (building->m_modelIndex == MI_PHONEBOOTH1) {
CPhone *maxPhone = &m_aPhones[m_nMax];
maxPhone->m_nState = PHONE_STATE_FREE;
maxPhone->m_vecPos = *(building->GetPosition());
maxPhone->m_pEntity = building;
m_nMax++;
}
}
}
}
void
CPhoneInfo::Save(CPhoneInfo *destination, uint32 *size)
{
*size = sizeof(CPhoneInfo);
destination->m_nMax = this->m_nMax;
destination->m_nNum = m_nNum;
for(int phoneId = 0; phoneId < 50; phoneId++) {
CPhone* phone = &destination->m_aPhones[phoneId];
phone->m_vecPos = m_aPhones[phoneId].m_vecPos;
memcpy(phone->m_apMessages, m_aPhones[phoneId].m_apMessages, sizeof(wchar*) * 6);
phone->m_pEntity = m_aPhones[phoneId].m_pEntity;
phone->m_nState = m_aPhones[phoneId].m_nState;
phone->field_30 = m_aPhones[phoneId].field_30;
// Convert entity pointer to building pool index while saving
if (phone->m_pEntity) {
phone->m_pEntity = (CEntity*) CPools::GetBuildingPool()->GetJustIndex((CBuilding*)phone->m_pEntity) + 1;
}
}
}
void
CPhoneInfo::Shutdown(void)
{
m_nMax = 0;
m_nNum = 0;
}
void
PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg)
{
assoc->flags |= ASSOC_DELETEFADEDOUT;
assoc->blendDelta = -1000.0f;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40;
CPed *ped = (CPed*)arg;
if (assoc->blendAmount > 0.5f)
ped->m_ped_flagC10 = true;
if (ped->m_nPedState == PED_MAKE_CALL)
ped->m_nPedState = PED_IDLE;
}
void
PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg)
{
CPhone *phone = (CPhone*)arg;
int messagesDisplayTime = 0;
for(int i=0; i < 6; i++) {
wchar *msg = phone->m_apMessages[i];
if (msg) {
CMessages::AddMessage(msg, 3000, 0);
messagesDisplayTime += 3000;
}
}
CPhoneInfo::isPhoneBeingPickedUp = false;
CPhoneInfo::isPhonePickedUp = true;
CPhoneInfo::pickedUpPhone = phone;
CPhoneInfo::phoneMessagesTimer = CTimer::GetTimeInMilliseconds() + messagesDisplayTime;
if (phone->m_nState == PHONE_STATE_ONETIME_MESSAGE_SET) {
phone->m_nState = PHONE_STATE_ONETIME_MESSAGE_SHOWN;
} else {
phone->m_nState = PHONE_STATE_REPEATED_MESSAGE_SHOWN;
phone->m_lastTimeRepeatedMsgShown = CTimer::GetTimeInMilliseconds();
}
CPed *ped = CPhoneInfo::pedWhoPickingUpPhone;
ped->m_nMoveState = PEDMOVE_STILL;
CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
if (assoc->blendAmount > 0.5f && ped)
CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
CPhoneInfo::pedWhoPickingUpPhone = nil;
}
STARTPATCHES STARTPATCHES
InjectHook(0x42F720, &CPhoneInfo::FindNearestFreePhone, PATCH_JUMP); InjectHook(0x42F720, &CPhoneInfo::FindNearestFreePhone, PATCH_JUMP);
InjectHook(0x42FD50, &CPhoneInfo::PhoneAtThisPosition, PATCH_JUMP); InjectHook(0x42FD50, &CPhoneInfo::PhoneAtThisPosition, PATCH_JUMP);
@ -124,7 +260,10 @@ STARTPATCHES
InjectHook(0x430120, &CPhoneInfo::Load, PATCH_JUMP); InjectHook(0x430120, &CPhoneInfo::Load, PATCH_JUMP);
InjectHook(0x42FF90, &CPhoneInfo::SetPhoneMessage_JustOnce, PATCH_JUMP); InjectHook(0x42FF90, &CPhoneInfo::SetPhoneMessage_JustOnce, PATCH_JUMP);
InjectHook(0x42FF30, &CPhoneInfo::SetPhoneMessage_Repeatedly, PATCH_JUMP); InjectHook(0x42FF30, &CPhoneInfo::SetPhoneMessage_Repeatedly, PATCH_JUMP);
InjectHook(0x430060, &CPhoneInfo::Save, PATCH_JUMP);
InjectHook(0x42F710, &CPhoneInfo::Shutdown, PATCH_JUMP);
InjectHook(0x42F640, &CPhoneInfo::Initialise, PATCH_JUMP);
InjectHook(0x42FDB0, &CPhoneInfo::GrabPhone, PATCH_JUMP);
InjectHook(0x42F570, &PhonePutDownCB, PATCH_JUMP);
InjectHook(0x42F470, &PhonePickUpCB, PATCH_JUMP);
ENDPATCHES ENDPATCHES
WRAPPER void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F570); }
WRAPPER void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F470); }

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include "Physical.h" #include "Physical.h"
#include "AnimBlendAssociation.h"
class CPed;
class CAnimBlendAssociation;
enum { enum {
PHONE_STATE_FREE, PHONE_STATE_FREE,
@ -19,7 +21,7 @@ enum {
struct CPhone struct CPhone
{ {
CVector m_vecPos; CVector m_vecPos;
uint16 *m_apMessages[6]; wchar *m_apMessages[6];
uint32 m_lastTimeRepeatedMsgShown; uint32 m_lastTimeRepeatedMsgShown;
CEntity *m_pEntity; // it's building pool index in save files CEntity *m_pEntity; // it's building pool index in save files
int32 m_nState; int32 m_nState;
@ -29,10 +31,13 @@ struct CPhone
static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); static_assert(sizeof(CPhone) == 0x34, "CPhone: error");
class CPhoneInfo { class CPhoneInfo {
static bool &isPhonePickedUp;
static bool &isPhoneBeingPickedUp;
static CPhone *&pickedUpPhone;
public: public:
static bool &isPhonePickedUp;
static uint32 &phoneMessagesTimer;
static CPhone *&pickedUpPhone;
static bool &isPhoneBeingPickedUp;
static CPed *&pedWhoPickingUpPhone;
int32 m_nMax; int32 m_nMax;
int32 m_nNum; int32 m_nNum;
CPhone m_aPhones[50]; CPhone m_aPhones[50];
@ -45,8 +50,12 @@ public:
bool HasMessageBeenDisplayed(int); bool HasMessageBeenDisplayed(int);
bool IsMessageBeingDisplayed(int); bool IsMessageBeingDisplayed(int);
void Load(CPhoneInfo *source, uint8 buffer); void Load(CPhoneInfo *source, uint8 buffer);
void SetPhoneMessage_JustOnce(int phoneId, uint16 *msg1, uint16 *msg2, uint16 *msg3, uint16 *msg4, uint16 *msg5, uint16 *msg6); void SetPhoneMessage_JustOnce(int phoneId, wchar *msg1, wchar *msg2, wchar *msg3, wchar *msg4, wchar *msg5, wchar *msg6);
void SetPhoneMessage_Repeatedly(int phoneId, uint16 *msg1, uint16 *msg2, uint16 *msg3, uint16 *msg4, uint16 *msg5, uint16 *msg6); void SetPhoneMessage_Repeatedly(int phoneId, wchar *msg1, wchar *msg2, wchar *msg3, wchar *msg4, wchar *msg5, wchar *msg6);
int GrabPhone(float, float);
void Initialise(void);
void Save(CPhoneInfo*, uint32*);
void Shutdown(void);
}; };
extern CPhoneInfo &gPhoneInfo; extern CPhoneInfo &gPhoneInfo;

View file

@ -7,7 +7,9 @@ PedGroup *CPopulation::ms_pPedGroups = (PedGroup*)0x6E9248;
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6; bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570; int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C; float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70;
WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); } WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); }
WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); } WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); }
WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); } WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); }
WRAPPER bool CPopulation::IsPointInSafeZone(CVector *coors) { EAXJMP(0x4F60C0); }

View file

@ -2,6 +2,7 @@
class CPed; class CPed;
class CVehicle; class CVehicle;
enum eLevelName;
struct PedGroup struct PedGroup
{ {
@ -15,8 +16,10 @@ public:
static bool &ms_bGivePedsWeapons; static bool &ms_bGivePedsWeapons;
static int32 &m_AllRandomPedsThisType; static int32 &m_AllRandomPedsThisType;
static float &PedDensityMultiplier; static float &PedDensityMultiplier;
static uint32 &ms_nTotalMissionPeds;
static void UpdatePedCount(uint32, bool); static void UpdatePedCount(uint32, bool);
static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool); static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);
static CPed *AddPedInCar(CVehicle *vehicle); static CPed *AddPedInCar(CVehicle *vehicle);
static bool IsPointInSafeZone(CVector *coors);
}; };

5
src/control/Remote.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Remote.h"
WRAPPER void CRemote::TakeRemoteControlledCarFromPlayer(void) { EAXJMP(0x435DA0); }

7
src/control/Remote.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CRemote
{
public:
static void TakeRemoteControlledCarFromPlayer(void);
};

View file

@ -11,7 +11,7 @@
#include "FileMgr.h" #include "FileMgr.h"
#include "Heli.h" #include "Heli.h"
#include "main.h" #include "main.h"
#include "math/Matrix.h" #include "Matrix.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "Object.h" #include "Object.h"
@ -25,7 +25,7 @@
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
#include "RwHelper.h" #include "RwHelper.h"
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "render/Skidmarks.h" #include "Skidmarks.h"
#include "Streaming.h" #include "Streaming.h"
#include "Timer.h" #include "Timer.h"
#include "Train.h" #include "Train.h"
@ -625,9 +625,9 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */ vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
vp->acceleration = vehicle->m_fGasPedal * 100.0f; vp->acceleration = vehicle->m_fGasPedal * 100.0f;
vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0; vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0;
vp->velocityX = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetSpeed().x)); /* 8000!? */ vp->velocityX = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().x)); /* 8000!? */
vp->velocityY = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetSpeed().y)); vp->velocityY = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().y));
vp->velocityZ = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetSpeed().z)); vp->velocityZ = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().z));
vp->mi = vehicle->GetModelIndex(); vp->mi = vehicle->GetModelIndex();
vp->primary_color = vehicle->m_currentColour1; vp->primary_color = vehicle->m_currentColour1;
vp->secondary_color = vehicle->m_currentColour2; vp->secondary_color = vehicle->m_currentColour2;
@ -718,7 +718,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
} }
vehicle->bEngineOn = true; vehicle->bEngineOn = true;
if (vehicle->IsCar()) if (vehicle->IsCar())
((CAutomobile*)vehicle)->m_nWheelsOnGround = 4; ((CAutomobile*)vehicle)->m_nDriveWheelsOnGround = 4;
CWorld::Remove(vehicle); CWorld::Remove(vehicle);
CWorld::Add(vehicle); CWorld::Add(vehicle);
if (vehicle->IsBoat()) if (vehicle->IsBoat())
@ -850,10 +850,10 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
TheCamera.GetMatrix().GetPosition() *= split; TheCamera.GetMatrix().GetPosition() *= split;
TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos; TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos;
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
pm->pos = *(RwV3d*)TheCamera.GetMatrix().GetPosition(); pm->pos = *(RwV3d*)TheCamera.GetPosition();
pm->at = *(RwV3d*)TheCamera.GetMatrix().GetForward(); pm->at = *(RwV3d*)TheCamera.GetForward();
pm->up = *(RwV3d*)TheCamera.GetMatrix().GetUp(); pm->up = *(RwV3d*)TheCamera.GetUp();
pm->right = *(RwV3d*)TheCamera.GetMatrix().GetRight(); pm->right = *(RwV3d*)TheCamera.GetRight();
CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x; CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x;
CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y; CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y;
CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z; CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z;
@ -979,15 +979,15 @@ void CReplay::ProcessReplayCamera(void)
switch (CameraMode) { switch (CameraMode) {
case REPLAYCAMMODE_TOPDOWN: case REPLAYCAMMODE_TOPDOWN:
{ {
TheCamera.GetMatrix().GetPosition() = CVector(CameraFocusX, CameraFocusY, CameraFocusZ + 15.0f); TheCamera.GetPosition() = CVector(CameraFocusX, CameraFocusY, CameraFocusZ + 15.0f);
TheCamera.GetMatrix().GetForward() = CVector(0.0f, 0.0f, -1.0f); TheCamera.GetForward() = CVector(0.0f, 0.0f, -1.0f);
TheCamera.GetMatrix().GetUp() = CVector(0.0f, 1.0f, 0.0f); TheCamera.GetUp() = CVector(0.0f, 1.0f, 0.0f);
TheCamera.GetMatrix().GetRight() = CVector(1.0f, 0.0f, 0.0f); TheCamera.GetRight() = CVector(1.0f, 0.0f, 0.0f);
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
pm->pos = *(RwV3d*)&TheCamera.GetMatrix().GetPosition(); pm->pos = *(RwV3d*)&TheCamera.GetPosition();
pm->at = *(RwV3d*)&TheCamera.GetMatrix().GetForward(); pm->at = *(RwV3d*)&TheCamera.GetForward();
pm->up = *(RwV3d*)&TheCamera.GetMatrix().GetUp(); pm->up = *(RwV3d*)&TheCamera.GetUp();
pm->right = *(RwV3d*)&TheCamera.GetMatrix().GetRight(); pm->right = *(RwV3d*)&TheCamera.GetRight();
break; break;
} }
case REPLAYCAMMODE_FIXED: case REPLAYCAMMODE_FIXED:
@ -1113,7 +1113,7 @@ void CReplay::StoreStuffInMem(void)
TimeStep = CTimer::GetTimeStep(); TimeStep = CTimer::GetTimeStep();
TimeScale = CTimer::GetTimeScale(); TimeScale = CTimer::GetTimeScale();
int size = CPools::GetPedPool()->GetSize(); int size = CPools::GetPedPool()->GetSize();
pPedAnims = (CStoredDetailedAnimationState*)malloc(size * sizeof(CStoredDetailedAnimationState)); pPedAnims = new CStoredDetailedAnimationState[size];
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
CPed* ped = CPools::GetPedPool()->GetSlot(i); CPed* ped = CPools::GetPedPool()->GetSlot(i);
if (ped) if (ped)
@ -1279,7 +1279,7 @@ void CReplay::RestoreStuffFromMem(void)
continue; continue;
RetrieveDetailedPedAnimation(ped, &pPedAnims[i]); RetrieveDetailedPedAnimation(ped, &pPedAnims[i]);
} }
free(pPedAnims); delete[] pPedAnims;
pPedAnims = nil; pPedAnims = nil;
DMAudio.ChangeMusicMode(0); DMAudio.ChangeMusicMode(0);
DMAudio.SetRadioInCar(OldRadioStation); DMAudio.SetRadioInCar(OldRadioStation);
@ -1525,15 +1525,15 @@ void CReplay::ProcessLookAroundCam(void)
right.Normalise(); right.Normalise();
CVector up = CrossProduct(forward, right); CVector up = CrossProduct(forward, right);
up.Normalise(); up.Normalise();
TheCamera.GetMatrix().GetForward() = forward; TheCamera.GetForward() = forward;
TheCamera.GetMatrix().GetUp() = up; TheCamera.GetUp() = up;
TheCamera.GetMatrix().GetRight() = right; TheCamera.GetRight() = right;
TheCamera.GetMatrix().GetPosition() = camera_pt; TheCamera.GetPosition() = camera_pt;
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
pm->pos = *(RwV3d*)&TheCamera.GetMatrix().GetPosition(); pm->pos = *(RwV3d*)&TheCamera.GetPosition();
pm->at = *(RwV3d*)&TheCamera.GetMatrix().GetForward(); pm->at = *(RwV3d*)&TheCamera.GetForward();
pm->up = *(RwV3d*)&TheCamera.GetMatrix().GetUp(); pm->up = *(RwV3d*)&TheCamera.GetUp();
pm->right = *(RwV3d*)&TheCamera.GetMatrix().GetRight(); pm->right = *(RwV3d*)&TheCamera.GetRight();
TheCamera.CalculateDerivedValues(); TheCamera.CalculateDerivedValues();
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera))); RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));

View file

@ -176,7 +176,7 @@ class CReplay
int8 velocityZ; int8 velocityZ;
union{ union{
int8 car_gun; int8 car_gun;
uint8 wheel_state; int8 wheel_state;
}; };
uint8 wheel_susp_dist[4]; uint8 wheel_susp_dist[4];
uint8 wheel_rotation[4]; uint8 wheel_rotation[4];

View file

@ -4,10 +4,17 @@
#include "Script.h" #include "Script.h"
#include "ScriptCommands.h" #include "ScriptCommands.h"
#include "Boat.h"
#include "Camera.h" #include "Camera.h"
#include "CarCtrl.h" #include "CarCtrl.h"
#include "CivilianPed.h"
#include "Clock.h"
#include "CopPed.h"
#include "DMAudio.h" #include "DMAudio.h"
#include "EmergencyPed.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "General.h"
#include "HandlingMgr.h"
#include "Hud.h" #include "Hud.h"
#include "Messages.h" #include "Messages.h"
#include "ModelIndices.h" #include "ModelIndices.h"
@ -18,9 +25,11 @@
#include "Population.h" #include "Population.h"
#include "Replay.h" #include "Replay.h"
#include "Streaming.h" #include "Streaming.h"
#include "Text.h"
#include "User.h" #include "User.h"
#include "Weather.h" #include "Weather.h"
#include "World.h" #include "World.h"
#include "Zones.h"
uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SPACE])*(uintptr*)0x74B248; uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SPACE])*(uintptr*)0x74B248;
CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08; CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08;
@ -70,6 +79,7 @@ CMissionCleanup::CMissionCleanup()
void CMissionCleanup::Init() void CMissionCleanup::Init()
{ {
m_nCount = 0;
for (int i = 0; i < MAX_CLEANUP; i++){ for (int i = 0; i < MAX_CLEANUP; i++){
m_sEntities[i].type = CLEANUP_UNUSED; m_sEntities[i].type = CLEANUP_UNUSED;
m_sEntities[i].id = 0; m_sEntities[i].id = 0;
@ -93,7 +103,7 @@ void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
return; return;
pNew->id = id; pNew->id = id;
pNew->type = type; pNew->type = type;
m_bCount++; m_nCount++;
} }
void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type) void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type)
@ -102,6 +112,7 @@ void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type)
if (m_sEntities[i].type == type && m_sEntities[i].id == id){ if (m_sEntities[i].type == type && m_sEntities[i].id == id){
m_sEntities[i].id = 0; m_sEntities[i].id = 0;
m_sEntities[i].type = CLEANUP_UNUSED; m_sEntities[i].type = CLEANUP_UNUSED;
m_nCount--;
} }
} }
} }
@ -124,8 +135,8 @@ void CMissionCleanup::Process()
CHud::m_ItemToFlash = -1; CHud::m_ItemToFlash = -1;
CHud::SetHelpMessage(nil, false); CHud::SetHelpMessage(nil, false);
CUserDisplay::OnscnTimer.m_bDisabled = false; CUserDisplay::OnscnTimer.m_bDisabled = false;
CWorld::Players[0].m_pPed->m_pWanted->m_IsIgnoredByCops = false; CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false;
CWorld::Players[0].m_pPed->m_pWanted->m_IsIgnoredByEveryOne = false; CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
CWorld::Players[0].MakePlayerSafe(false); CWorld::Players[0].MakePlayerSafe(false);
CTheScripts::StoreVehicleIndex = -1; CTheScripts::StoreVehicleIndex = -1;
CTheScripts::StoreVehicleWasRandom = true; CTheScripts::StoreVehicleWasRandom = true;
@ -594,7 +605,7 @@ void CTheScripts::Process()
if (UseTextCommands){ if (UseTextCommands){
for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++) for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++)
IntroTextLines[i].Reset(); IntroTextLines[i].Reset();
NumberOfIntroRectanglesThisFrame = 0; NumberOfIntroTextLinesThisFrame = 0;
for (int i = 0; i < MAX_NUM_INTRO_RECTANGLES; i++){ for (int i = 0; i < MAX_NUM_INTRO_RECTANGLES; i++){
IntroRectangles[i].m_bIsUsed = false; IntroRectangles[i].m_bIsUsed = false;
IntroRectangles[i].m_bBeforeFade = false; IntroRectangles[i].m_bBeforeFade = false;
@ -701,7 +712,7 @@ int8 CRunningScript::ProcessCommandsFrom0To99(int32 command)
return 0; return 0;
case COMMAND_SHAKE_CAM: case COMMAND_SHAKE_CAM:
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
TheCamera.CamShake(ScriptParams[0] / 1000.0f); CamShakeNoPos(&TheCamera, ScriptParams[0] / 1000.0f);
return 0; return 0;
case COMMAND_SET_VAR_INT: case COMMAND_SET_VAR_INT:
{ {
@ -1342,6 +1353,7 @@ int8 CRunningScript::ProcessCommandsFrom0To99(int32 command)
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0; return 0;
default: default:
assert(0);
break; break;
} }
return -1; return -1;
@ -1374,7 +1386,814 @@ void CRunningScript::UpdateCompareFlag(bool flag)
} }
WRAPPER int8 CRunningScript::ProcessCommandsFrom100To199(int32 command) { EAXJMP(0x43AEA0); } int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
{
switch (command) {
case COMMAND_SUB_INT_LVAR_FROM_INT_VAR:
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_SUB_INT_VAR_FROM_INT_LVAR:
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_MULT_INT_VAR_BY_INT_VAR:
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_MULT_INT_LVAR_BY_INT_LVAR:
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_DIV_INT_VAR_BY_INT_VAR:
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_DIV_INT_LVAR_BY_INT_LVAR:
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_ADD_TIMED_VAL_TO_FLOAT_VAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
*(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
return 0;
}
case COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
*(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
return 0;
}
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_SUB_TIMED_VAL_FROM_FLOAT_VAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
*(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
return 0;
}
case COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
*(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
return 0;
}
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR:
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
case COMMAND_SET_VAR_INT_TO_VAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_SET_LVAR_INT_TO_VAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_SET_VAR_INT_TO_LVAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_SET_LVAR_INT_TO_LVAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_SET_VAR_FLOAT_TO_VAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_SET_LVAR_FLOAT_TO_LVAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_CSET_VAR_INT_TO_VAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_CSET_VAR_FLOAT_TO_VAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
case COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
case COMMAND_ABS_VAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = ABS(*ptr);
return 0;
}
case COMMAND_ABS_LVAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = ABS(*ptr);
return 0;
}
case COMMAND_ABS_VAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = ABS(*ptr);
return 0;
}
case COMMAND_ABS_LVAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = ABS(*ptr);
return 0;
}
case COMMAND_GENERATE_RANDOM_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CGeneral::GetRandomNumber();
CGeneral::GetRandomNumber();
CGeneral::GetRandomNumber(); /* To make it EXTRA random! */
*ptr = CGeneral::GetRandomNumber() / 65536.0f;
/* Between 0 and 0.5 on PC (oh well...), never used in original script. */
return 0;
}
case COMMAND_GENERATE_RANDOM_INT:
/* On PC between 0 and 32767, even though script expects values between 0 and 65536 */
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = CGeneral::GetRandomNumber();
return 0;
case COMMAND_CREATE_CHAR:
{
CollectParameters(&m_nIp, 5);
switch (ScriptParams[1]) {
case MI_COP:
if (ScriptParams[0] == PEDTYPE_COP)
ScriptParams[1] = COP_STREET;
break;
case MI_SWAT:
if (ScriptParams[0] == PEDTYPE_COP)
ScriptParams[1] = COP_SWAT;
break;
case MI_FBI:
if (ScriptParams[0] == PEDTYPE_COP)
ScriptParams[1] = COP_FBI;
break;
case MI_ARMY:
if (ScriptParams[0] == PEDTYPE_COP)
ScriptParams[1] = COP_ARMY;
break;
case MI_MEDIC:
if (ScriptParams[0] == PEDTYPE_EMERGENCY)
ScriptParams[1] = PEDTYPE_EMERGENCY;
break;
case MI_FIREMAN:
if (ScriptParams[0] == PEDTYPE_FIREMAN)
ScriptParams[1] = PEDTYPE_FIREMAN;
break;
default:
break;
}
CPed* ped;
if (ScriptParams[0] == PEDTYPE_COP)
ped = new CCopPed((eCopType)ScriptParams[1]);
else if (ScriptParams[0] == PEDTYPE_EMERGENCY || ScriptParams[0] == PEDTYPE_FIREMAN)
ped = new CEmergencyPed(ScriptParams[1]);
else
ped = new CCivilianPed(ScriptParams[0], ScriptParams[1]);
ped->CharCreatedBy = MISSION_CHAR;
ped->bRespondsToThreats = false;
ped->m_ped_flagG2 = false;
CVector pos = *(CVector*)&ScriptParams[2];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += 1.0f;
ped->GetPosition() = pos;
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
CWorld::Add(ped);
ped->m_level = CTheZones::GetLevelFromPosition(pos);
CPopulation::ms_nTotalMissionPeds++;
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_DELETE_CHAR:
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
if (ped) {
if (ped->bInVehicle && ped->m_pMyVehicle) {
if (ped->m_pMyVehicle->pDriver == ped) {
ped->m_pMyVehicle->RemoveDriver();
ped->m_pMyVehicle->m_status = STATUS_ABANDONED;
if (ped->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
ped->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && ped->m_pMyVehicle->IsLawEnforcementVehicle())
ped->m_pMyVehicle->ChangeLawEnforcerState(0);
}
else {
ped->m_pMyVehicle->RemovePassenger(ped);
}
}
CWorld::RemoveReferencesToDeletedObject(ped);
delete ped;
--CPopulation::ms_nTotalMissionPeds;
}
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_CHAR_WANDER_DIR:
{
CollectParameters(&m_nIp, 2);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
ped->ClearAll();
int8 path = ScriptParams[1];
if (ScriptParams[1] < 0 || ScriptParams[1] > 7)
path = CGeneral::GetRandomNumberInRange(0, 7);
ped->SetWanderPath(path);
return 0;
}
case COMMAND_CHAR_FOLLOW_PATH:
{
CollectParameters(&m_nIp, 4);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
ped->ClearAll();
ped->SetFollowPath(pos);
return 0;
}
case COMMAND_CHAR_SET_IDLE:
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
ped->m_bScriptObjectiveCompleted = false;
ped->SetObjective(OBJECTIVE_IDLE);
return 0;
}
case COMMAND_GET_CHAR_COORDINATES:
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
CVehicle* vehicle;
CVector pos;
/* Seems a bit clumsy but I'll leave original flow */
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
if (vehicle)
pos = vehicle->GetPosition();
else
pos = ped->GetPosition();
*(CVector*)&ScriptParams[0] = pos;
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_CHAR_COORDINATES:
{
CollectParameters(&m_nIp, 4);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
/* The following block was once again written
* by someone not familiar with virtual functions.
* It doesn't require any ifs at all.
* To keep as close to original as possible, I'll keep it.
* Maybe there was more commented out/debug
* stuff, but I doubt it.
*/
if (!vehicle) {
pos.z += ped->GetDistanceFromCentreOfMassToBaseOfModel();
ped->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
}
else if (vehicle->IsBoat()) {
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
vehicle->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
}
else {
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
vehicle->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
}
/* Short version of this command.
*
* CollectParameters(&m_nIp, 4);
* CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
* assert(ped);
* CEntity* entityToMove = ped->bInVehicle ? ped->m_pMyVehicle : ped;
* CVector pos = *(CVector*)&ScriptParams[1];
* if (pos.z <= -100.0f)
* pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
* pos.z += entityToMove->GetDistanceFromCentreOfMassToBaseOfModel();
* entityToMove->Teleport(pos);
* CTheScripts::ClearSpaceForMissionEntity(pos, entityToMove);
*
*/
return 0;
}
case COMMAND_IS_CHAR_STILL_ALIVE:
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
UpdateCompareFlag(ped && ped->m_status != PED_DEAD && ped->m_status != PED_DIE);
return 0;
}
case COMMAND_IS_CHAR_IN_AREA_2D:
{
CollectParameters(&m_nIp, 6);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
float x1, y1, x2, y2;
x1 = *(float*)&ScriptParams[1];
y1 = *(float*)&ScriptParams[2];
x2 = *(float*)&ScriptParams[3];
y2 = *(float*)&ScriptParams[4];
if (vehicle)
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2));
else
UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2));
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;
}
case COMMAND_IS_CHAR_IN_AREA_3D:
{
CollectParameters(&m_nIp, 8);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
float x1, y1, z1, x2, y2, z2;
x1 = *(float*)&ScriptParams[1];
y1 = *(float*)&ScriptParams[2];
z1 = *(float*)&ScriptParams[3];
x2 = *(float*)&ScriptParams[4];
y2 = *(float*)&ScriptParams[5];
z2 = *(float*)&ScriptParams[6];
if (vehicle)
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
else
UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2));
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
return 0;
}
case COMMAND_CREATE_CAR:
{
CollectParameters(&m_nIp, 4);
int32 handle;
if (CModelInfo::IsBoatModel(ScriptParams[0])) {
CBoat* boat = new CBoat(ScriptParams[0], MISSION_VEHICLE);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel();
boat->GetPosition() = pos;
CTheScripts::ClearSpaceForMissionEntity(pos, boat);
boat->m_status = STATUS_ABANDONED;
boat->bIsLocked = true;
boat->AutoPilot.m_nCarMission = MISSION_NONE;
boat->AutoPilot.m_nAnimationId = TEMPACT_NONE; /* Animation ID? */
boat->AutoPilot.m_nCruiseSpeed = boat->AutoPilot.m_fMaxTrafficSpeed = 20.0f;
CWorld::Add(boat);
handle = CPools::GetVehiclePool()->GetIndex(boat);
}
else {
CVehicle* car;
if (!CModelInfo::IsBikeModel(ScriptParams[0]))
car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->GetPosition() = pos;
CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->m_status = STATUS_ABANDONED;
car->bIsLocked = true;
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_NONE;
car->AutoPilot.m_nAnimationId = TEMPACT_NONE; /* Animation ID? */
car->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
car->AutoPilot.m_nCruiseSpeed = car->AutoPilot.m_fMaxTrafficSpeed = 9.0f;
car->AutoPilot.m_nPreviousLane = car->AutoPilot.m_nCurrentLane = 0;
car->bEngineOn = false;
car->m_level = CTheZones::GetLevelFromPosition(pos);
car->bHasBeenOwnedByPlayer = true;
CWorld::Add(car);
handle = CPools::GetVehiclePool()->GetIndex(car);
}
ScriptParams[0] = handle;
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
return 0;
}
case COMMAND_DELETE_CAR:
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
if (car) {
CWorld::Remove(car);
CWorld::RemoveReferencesToDeletedObject(car);
delete car;
}
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
return 0;
}
case COMMAND_CAR_GOTO_COORDINATES:
{
CollectParameters(&m_nIp, 4);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, pos, false))
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
else
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
car->m_status = STATUS_PHYSICS;
car->bEngineOn = true;
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
return 0;
}
case COMMAND_CAR_WANDER_RANDOMLY:
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
car->bEngineOn = true;
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
return 0;
}
case COMMAND_CAR_SET_IDLE:
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
car->AutoPilot.m_nCarMission = MISSION_NONE;
return 0;
}
case COMMAND_GET_CAR_COORDINATES:
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
*(CVector*)&ScriptParams[0] = car->GetPosition();
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_CAR_COORDINATES:
{
CollectParameters(&m_nIp, 4);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->bIsStatic = false;
/* Again weird usage of virtual functions. */
if (car->IsBoat()) {
car->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, car);
}
else {
car->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, car);
/* May the following be inlined CCarCtrl function? */
switch (car->AutoPilot.m_nCarMission) {
case MISSION_CRUISE:
CCarCtrl::JoinCarWithRoadSystem(car);
break;
case MISSION_RAMPLAYER_FARAWAY:
case MISSION_RAMPLAYER_CLOSE:
case MISSION_BLOCKPLAYER_FARAWAY:
case MISSION_BLOCKPLAYER_CLOSE:
case MISSION_BLOCKPLAYER_HANDBRAKESTOP:
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, FindPlayerCoors(), false);
break;
case MISSION_GOTOCOORDS:
case MISSION_GOTOCOORDS_STRAIGHT:
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, car->AutoPilot.m_vecDestinationCoors, false);
break;
case MISSION_GOTOCOORDS_ACCURATE:
case MISSION_GOTO_COORDS_STRAIGHT_ACCURATE:
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, car->AutoPilot.m_vecDestinationCoors, false);
break;
case MISSION_RAMCAR_FARAWAY:
case MISSION_RAMCAR_CLOSE:
case MISSION_BLOCKCAR_FARAWAY:
case MISSION_BLOCKCAR_CLOSE:
case MISSION_BLOCKCAR_HANDBRAKESTOP:
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, car->AutoPilot.m_pTargetCar->GetPosition(), false);
break;
default:
break;
}
}
return 0;
}
case COMMAND_IS_CAR_STILL_ALIVE:
{
CollectParameters(&m_nIp, 4);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
UpdateCompareFlag(car && car->m_status != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater));
return 0;
}
case COMMAND_SET_CAR_CRUISE_SPEED:
{
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
car->AutoPilot.m_nCruiseSpeed = min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
return 0;
}
case COMMAND_SET_CAR_DRIVING_STYLE:
{
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
car->AutoPilot.m_nDrivingStyle = (eCarDrivingStyle)ScriptParams[1];
return 0;
}
case COMMAND_SET_CAR_MISSION:
{
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
car->AutoPilot.m_nCarMission = (eCarMission)ScriptParams[1];
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
car->bEngineOn = true;
return 0;
}
case COMMAND_IS_CAR_IN_AREA_2D:
{
CollectParameters(&m_nIp, 6);
CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(vehicle);
float x1, y1, x2, y2;
x1 = *(float*)&ScriptParams[1];
y1 = *(float*)&ScriptParams[2];
x2 = *(float*)&ScriptParams[3];
y2 = *(float*)&ScriptParams[4];
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, x2, y2));
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;
}
case COMMAND_IS_CAR_IN_AREA_3D:
{
CollectParameters(&m_nIp, 8);
CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(vehicle);
float x1, y1, z1, x2, y2, z2;
x1 = *(float*)&ScriptParams[1];
y1 = *(float*)&ScriptParams[2];
z1 = *(float*)&ScriptParams[3];
x2 = *(float*)&ScriptParams[4];
y2 = *(float*)&ScriptParams[5];
z2 = *(float*)&ScriptParams[6];
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
return 0;
}
case COMMAND_SPECIAL_0:
case COMMAND_SPECIAL_1:
case COMMAND_SPECIAL_2:
case COMMAND_SPECIAL_3:
case COMMAND_SPECIAL_4:
case COMMAND_SPECIAL_5:
case COMMAND_SPECIAL_6:
case COMMAND_SPECIAL_7:
assert(0);
return 0;
case COMMAND_PRINT_BIG:
{
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
m_nIp += 8;
CollectParameters(&m_nIp, 2);
CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1);
return 0;
}
case COMMAND_PRINT:
{
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
m_nIp += 8;
CollectParameters(&m_nIp, 2);
CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
return 0;
}
case COMMAND_PRINT_NOW:
{
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
m_nIp += 8;
CollectParameters(&m_nIp, 2);
CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]);
return 0;
}
case COMMAND_PRINT_SOON:
{
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
m_nIp += 8;
CollectParameters(&m_nIp, 2);
CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
return 0;
}
case COMMAND_CLEAR_PRINTS:
CMessages::ClearMessages();
return 0;
case COMMAND_GET_TIME_OF_DAY:
ScriptParams[0] = CClock::GetHours();
ScriptParams[1] = CClock::GetMinutes();
StoreParameters(&m_nIp, 2);
return 0;
case COMMAND_SET_TIME_OF_DAY:
CollectParameters(&m_nIp, 2);
CClock::SetGameClock(ScriptParams[0], ScriptParams[1]);
return 0;
case COMMAND_GET_MINUTES_TO_TIME_OF_DAY:
CollectParameters(&m_nIp, 2);
ScriptParams[0] = CClock::GetGameClockMinutesUntil(ScriptParams[0], ScriptParams[1]);
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_IS_POINT_ON_SCREEN:
{
CollectParameters(&m_nIp, 4);
CVector pos = *(CVector*)&ScriptParams[0];
if (pos.z <= -100)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
UpdateCompareFlag(TheCamera.IsSphereVisible(pos, *(float*)&ScriptParams[3]));
}
case COMMAND_DEBUG_ON:
CTheScripts::DbgFlag = true;
return 0;
case COMMAND_DEBUG_OFF:
CTheScripts::DbgFlag = false;
return 0;
case COMMAND_RETURN_TRUE:
UpdateCompareFlag(true);
return 0;
case COMMAND_RETURN_FALSE:
UpdateCompareFlag(false);
return 0;
default:
assert(0);
break;
}
return -1;
}
WRAPPER int8 CRunningScript::ProcessCommandsFrom200To299(int32 command) { EAXJMP(0x43D530); } WRAPPER int8 CRunningScript::ProcessCommandsFrom200To299(int32 command) { EAXJMP(0x43D530); }
WRAPPER int8 CRunningScript::ProcessCommandsFrom300To399(int32 command) { EAXJMP(0x43ED30); } WRAPPER int8 CRunningScript::ProcessCommandsFrom300To399(int32 command) { EAXJMP(0x43ED30); }
WRAPPER int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { EAXJMP(0x440CB0); } WRAPPER int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { EAXJMP(0x440CB0); }

View file

@ -137,7 +137,7 @@ enum {
class CMissionCleanup class CMissionCleanup
{ {
CMissionCleanupEntity m_sEntities[MAX_CLEANUP]; CMissionCleanupEntity m_sEntities[MAX_CLEANUP];
uint8 m_bCount; uint8 m_nCount;
public: public:
CMissionCleanup(); CMissionCleanup();

View file

@ -23,7 +23,7 @@ WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); } WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); } WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); } WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
WRAPPER void CCamera::CamShake(float) { EAXJMP(0x46B100); } WRAPPER void CamShakeNoPos(CCamera*, float) { EAXJMP(0x46B100); }
bool bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat) CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
@ -95,6 +95,14 @@ CCamera::GetLookDirection(void)
return LOOKING_FORWARD;; return LOOKING_FORWARD;;
} }
bool
CCamera::GetLookingForwardFirstPerson()
{
return Cams[ActiveCam].Mode == CCam::MODE_FIRSTPERSON &&
Cams[ActiveCam].DirectionWasLooking == LOOKING_FORWARD;
}
WRAPPER void CCamera::Fade(float timeout, int16 direction) { EAXJMP(0x46B3A0); } WRAPPER void CCamera::Fade(float timeout, int16 direction) { EAXJMP(0x46B3A0); }
WRAPPER void CCamera::ProcessFade(void) { EAXJMP(0x46F080); } WRAPPER void CCamera::ProcessFade(void) { EAXJMP(0x46F080); }
WRAPPER void CCamera::ProcessMusicFade(void) { EAXJMP(0x46F1E0); } WRAPPER void CCamera::ProcessMusicFade(void) { EAXJMP(0x46F1E0); }

View file

@ -441,6 +441,7 @@ int m_iModeObbeCamIsInForCar;
static bool &m_bUseMouse3rdPerson; static bool &m_bUseMouse3rdPerson;
bool Get_Just_Switched_Status() { return m_bJust_Switched; }
inline const CMatrix GetCameraMatrix(void) { return m_cameraMatrix; } inline const CMatrix GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; } CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
bool IsPointVisible(const CVector &center, const CMatrix *mat); bool IsPointVisible(const CVector &center, const CMatrix *mat);
@ -448,6 +449,7 @@ int m_iModeObbeCamIsInForCar;
bool IsSphereVisible(const CVector &center, float radius); bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat); bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
int GetLookDirection(void); int GetLookDirection(void);
bool GetLookingForwardFirstPerson(void);
void Fade(float timeout, int16 direction); void Fade(float timeout, int16 direction);
int GetScreenFadeStatus(void); int GetScreenFadeStatus(void);
@ -466,7 +468,6 @@ int m_iModeObbeCamIsInForCar;
void DrawBordersForWideScreen(void); void DrawBordersForWideScreen(void);
void Restore(void); void Restore(void);
void SetWidescreenOff(void); void SetWidescreenOff(void);
void CamShake(float);
void dtor(void) { this->CCamera::~CCamera(); } void dtor(void) { this->CCamera::~CCamera(); }
}; };
@ -479,3 +480,5 @@ static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error"); static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error");
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
extern CCamera &TheCamera; extern CCamera &TheCamera;
void CamShakeNoPos(CCamera*, float);

View file

@ -15,7 +15,7 @@ uint8 &CClock::ms_Stored_nGameClockHours = *(uint8*)0x95CD7B;
uint8 &CClock::ms_Stored_nGameClockMinutes = *(uint8*)0x95CD9B; uint8 &CClock::ms_Stored_nGameClockMinutes = *(uint8*)0x95CD9B;
uint16 &CClock::ms_Stored_nGameClockSeconds = *(uint16*)0x95CC9C; uint16 &CClock::ms_Stored_nGameClockSeconds = *(uint16*)0x95CC9C;
uint32 &CClock::ms_nMillisecondsPerGameMinute = *(uint32*)0x8F2C64; uint32 &CClock::ms_nMillisecondsPerGameMinute = *(uint32*)0x8F2C64;
int32 &CClock::ms_nLastClockTick = *(int32*)0x9430E4; uint32 &CClock::ms_nLastClockTick = *(uint32*)0x9430E4;
bool &CClock::ms_bClockHasBeenStored = *(bool*)0x95CD82; bool &CClock::ms_bClockHasBeenStored = *(bool*)0x95CD82;
void void
@ -67,10 +67,7 @@ CClock::Update(void)
} }
} }
} }
ms_nGameClockSeconds += ms_nGameClockSeconds = 60 * (CTimer::GetTimeInMilliseconds() - ms_nLastClockTick) / ms_nMillisecondsPerGameMinute;
60
* (CTimer::GetTimeInMilliseconds() - ms_nLastClockTick)
/ ms_nMillisecondsPerGameMinute;
} }
void void

View file

@ -9,7 +9,7 @@ class CClock
static uint8 &ms_Stored_nGameClockMinutes; static uint8 &ms_Stored_nGameClockMinutes;
static uint16 &ms_Stored_nGameClockSeconds; static uint16 &ms_Stored_nGameClockSeconds;
static uint32 &ms_nMillisecondsPerGameMinute; static uint32 &ms_nMillisecondsPerGameMinute;
static int32 &ms_nLastClockTick; static uint32 &ms_nLastClockTick;
static bool &ms_bClockHasBeenStored; static bool &ms_bClockHasBeenStored;
public: public:

View file

@ -18,6 +18,7 @@
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "RenderBuffer.h" #include "RenderBuffer.h"
#include "SurfaceTable.h" #include "SurfaceTable.h"
#include "Lines.h"
#include "Collision.h" #include "Collision.h"
enum Direction enum Direction
@ -1356,6 +1357,7 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
void void
CCollision::CalculateTrianglePlanes(CColModel *model) CCollision::CalculateTrianglePlanes(CColModel *model)
{ {
assert(model);
if(model->numTriangles == 0) if(model->numTriangles == 0)
return; return;
@ -1366,7 +1368,6 @@ CCollision::CalculateTrianglePlanes(CColModel *model)
lptr->Remove(); lptr->Remove();
ms_colModelCache.head.Insert(lptr); ms_colModelCache.head.Insert(lptr);
}else{ }else{
assert(model);
lptr = ms_colModelCache.Insert(model); lptr = ms_colModelCache.Insert(model);
if(lptr == nil){ if(lptr == nil){
// make room if we have to, remove last in list // make room if we have to, remove last in list
@ -1387,6 +1388,223 @@ CCollision::CalculateTrianglePlanes(CColModel *model)
void void
CCollision::DrawColModel(const CMatrix &mat, const CColModel &colModel) CCollision::DrawColModel(const CMatrix &mat, const CColModel &colModel)
{ {
int i;
CVector min, max;
CVector verts[8];
CVector c;
float r;
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
min = colModel.boundingBox.min;
max = colModel.boundingBox.max;
verts[0] = mat * CVector(min.x, min.y, min.z);
verts[1] = mat * CVector(min.x, min.y, max.z);
verts[2] = mat * CVector(min.x, max.y, min.z);
verts[3] = mat * CVector(min.x, max.y, max.z);
verts[4] = mat * CVector(max.x, min.y, min.z);
verts[5] = mat * CVector(max.x, min.y, max.z);
verts[6] = mat * CVector(max.x, max.y, min.z);
verts[7] = mat * CVector(max.x, max.y, max.z);
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[1].x, verts[1].y, verts[1].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[1].x, verts[1].y, verts[1].z,
verts[3].x, verts[3].y, verts[3].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[3].x, verts[3].y, verts[3].z,
verts[2].x, verts[2].y, verts[2].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[2].x, verts[2].y, verts[2].z,
verts[0].x, verts[0].y, verts[0].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[4].x, verts[4].y, verts[4].z,
verts[5].x, verts[5].y, verts[5].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[5].x, verts[5].y, verts[5].z,
verts[7].x, verts[7].y, verts[7].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[7].x, verts[7].y, verts[7].z,
verts[6].x, verts[6].y, verts[6].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[6].x, verts[6].y, verts[6].z,
verts[4].x, verts[4].y, verts[4].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[4].x, verts[4].y, verts[4].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[1].x, verts[1].y, verts[1].z,
verts[5].x, verts[5].y, verts[5].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[2].x, verts[2].y, verts[2].z,
verts[6].x, verts[6].y, verts[6].z,
0xFF0000FF, 0xFF0000FF);
CLines::RenderLineWithClipping(
verts[3].x, verts[3].y, verts[3].z,
verts[7].x, verts[7].y, verts[7].z,
0xFF0000FF, 0xFF0000FF);
for(i = 0; i < colModel.numSpheres; i++){
c = mat * colModel.spheres[i].center;
r = colModel.spheres[i].radius;
CLines::RenderLineWithClipping(
c.x, c.y, c.z-r,
c.x-r, c.y-r, c.z,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x, c.y, c.z-r,
c.x-r, c.y+r, c.z,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x, c.y, c.z-r,
c.x+r, c.y-r, c.z,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x, c.y, c.z-r,
c.x+r, c.y+r, c.z,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x-r, c.y-r, c.z,
c.x, c.y, c.z+r,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x-r, c.y+r, c.z,
c.x, c.y, c.z+r,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x+r, c.y-r, c.z,
c.x, c.y, c.z+r,
0xFF00FFFF, 0xFF00FFFF);
CLines::RenderLineWithClipping(
c.x+r, c.y+r, c.z,
c.x, c.y, c.z+r,
0xFF00FFFF, 0xFF00FFFF);
}
for(i = 0; i < colModel.numLines; i++){
verts[0] = colModel.lines[i].p0;
verts[1] = colModel.lines[i].p1;
verts[0] = mat * verts[0];
verts[1] = mat * verts[1];
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[1].x, verts[1].y, verts[1].z,
0x00FFFFFF, 0x00FFFFFF);
}
for(i = 0; i < colModel.numBoxes; i++){
min = colModel.boxes[i].min;
max = colModel.boxes[i].max;
verts[0] = mat * CVector(min.x, min.y, min.z);
verts[1] = mat * CVector(min.x, min.y, max.z);
verts[2] = mat * CVector(min.x, max.y, min.z);
verts[3] = mat * CVector(min.x, max.y, max.z);
verts[4] = mat * CVector(max.x, min.y, min.z);
verts[5] = mat * CVector(max.x, min.y, max.z);
verts[6] = mat * CVector(max.x, max.y, min.z);
verts[7] = mat * CVector(max.x, max.y, max.z);
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[1].x, verts[1].y, verts[1].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[1].x, verts[1].y, verts[1].z,
verts[3].x, verts[3].y, verts[3].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[3].x, verts[3].y, verts[3].z,
verts[2].x, verts[2].y, verts[2].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[2].x, verts[2].y, verts[2].z,
verts[0].x, verts[0].y, verts[0].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[4].x, verts[4].y, verts[4].z,
verts[5].x, verts[5].y, verts[5].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[5].x, verts[5].y, verts[5].z,
verts[7].x, verts[7].y, verts[7].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[7].x, verts[7].y, verts[7].z,
verts[6].x, verts[6].y, verts[6].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[6].x, verts[6].y, verts[6].z,
verts[4].x, verts[4].y, verts[4].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[4].x, verts[4].y, verts[4].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[1].x, verts[1].y, verts[1].z,
verts[5].x, verts[5].y, verts[5].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[2].x, verts[2].y, verts[2].z,
verts[6].x, verts[6].y, verts[6].z,
0xFFFFFFFF, 0xFFFFFFFF);
CLines::RenderLineWithClipping(
verts[3].x, verts[3].y, verts[3].z,
verts[7].x, verts[7].y, verts[7].z,
0xFFFFFFFF, 0xFFFFFFFF);
}
for(i = 0; i < colModel.numTriangles; i++){
colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a);
colModel.GetTrianglePoint(verts[1], colModel.triangles[i].b);
colModel.GetTrianglePoint(verts[2], colModel.triangles[i].c);
verts[0] = mat * verts[0];
verts[1] = mat * verts[1];
verts[2] = mat * verts[2];
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[1].x, verts[1].y, verts[1].z,
0x00FF00FF, 0x00FF00FF);
CLines::RenderLineWithClipping(
verts[0].x, verts[0].y, verts[0].z,
verts[2].x, verts[2].y, verts[2].z,
0x00FF00FF, 0x00FF00FF);
CLines::RenderLineWithClipping(
verts[1].x, verts[1].y, verts[1].z,
verts[2].x, verts[2].y, verts[2].z,
0x00FF00FF, 0x00FF00FF);
}
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
} }
void void
@ -1407,7 +1625,6 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
extern int gDbgSurf;
for(i = 0; i < colModel.numTriangles; i++){ for(i = 0; i < colModel.numTriangles; i++){
colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a); colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a);
@ -1417,7 +1634,7 @@ extern int gDbgSurf;
verts[1] = mat * verts[1]; verts[1] = mat * verts[1];
verts[2] = mat * verts[2]; verts[2] = mat * verts[2];
// TODO: surface // game doesn't do this
r = 255; r = 255;
g = 128; g = 128;
b = 0; b = 0;
@ -1457,10 +1674,15 @@ extern int gDbgSurf;
b *= f; b *= f;
} }
// TODO: make some surface types flicker? if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
//if(s != gDbgSurf) continue; s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
b = 0;
}
if(s > SURFACE_32){ if(s > SURFACE_GATE){
r = CGeneral::GetRandomNumber(); r = CGeneral::GetRandomNumber();
g = CGeneral::GetRandomNumber(); g = CGeneral::GetRandomNumber();
b = CGeneral::GetRandomNumber(); b = CGeneral::GetRandomNumber();
@ -1533,8 +1755,13 @@ extern int gDbgSurf;
b *= f; b *= f;
} }
// TODO: make some surface types flicker? if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
//if(s != gDbgSurf) continue; s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
b = 0;
}
RenderBuffer::StartStoring(36, 8, &iptr, &vptr); RenderBuffer::StartStoring(36, 8, &iptr, &vptr);
RwIm3DVertexSetRGBA(&vptr[0], r, g, b, 255); RwIm3DVertexSetRGBA(&vptr[0], r, g, b, 255);

238
src/core/EventList.cpp Normal file
View file

@ -0,0 +1,238 @@
#include "common.h"
#include "patcher.h"
#include "Pools.h"
#include "ModelIndices.h"
#include "World.h"
#include "Wanted.h"
#include "Eventlist.h"
int32 CEventList::ms_nFirstFreeSlotIndex;
//CEvent gaEvent[NUMEVENTS];
CEvent *gaEvent = (CEvent*)0x6EF830;
enum
{
EVENT_STATE_0,
EVENT_STATE_CANDELETE,
EVENT_STATE_CLEAR,
};
void
CEventList::Initialise(void)
{
int i;
debug("Initialising CEventList...");
for(i = 0; i < NUMEVENTS; i++){
gaEvent[i].type = EVENT_NULL;
gaEvent[i].entityType = EVENT_ENTITY_NONE;
gaEvent[i].entityRef = 0;
gaEvent[i].posn.x = 0.0f;
gaEvent[i].posn.y = 0.0f;
gaEvent[i].posn.z = 0.0f;
gaEvent[i].timeout = 0;
gaEvent[i].state = EVENT_STATE_0;
}
ms_nFirstFreeSlotIndex = 0;
}
void
CEventList::Update(void)
{
int i;
ms_nFirstFreeSlotIndex = 0;
for(i = 0; i < NUMEVENTS; i++){
if(gaEvent[i].type == EVENT_NULL)
continue;
if(CTimer::GetTimeInMilliseconds() > gaEvent[i].timeout || gaEvent[i].state == EVENT_STATE_CANDELETE){
gaEvent[i].type = EVENT_NULL;
gaEvent[i].state = EVENT_STATE_0;
}
if(gaEvent[i].state == EVENT_STATE_CLEAR)
gaEvent[i].state = EVENT_STATE_CANDELETE;
}
}
void
CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent, CPed *criminal, int32 timeout)
{
int i;
int ref;
bool copsDontCare;
copsDontCare = false;
switch(entityType){
case EVENT_ENTITY_PED:
ref = CPools::GetPedRef((CPed*)ent);
if(ent->GetModelIndex() >= MI_GANG01 && ent->GetModelIndex() <= MI_CRIMINAL02)
copsDontCare = true;
break;
case EVENT_ENTITY_VEHICLE:
ref = CPools::GetVehicleRef((CVehicle*)ent);
break;
case EVENT_ENTITY_OBJECT:
ref = CPools::GetObjectRef((CObject*)ent);
break;
default:
Error("Undefined entity type, RegisterEvent, EventList.cpp");
ref = 0;
break;
}
// only update time if event exists already
for(i = 0; i < NUMEVENTS; i++)
if(gaEvent[i].type == type &&
gaEvent[i].entityType == entityType &&
gaEvent[i].entityRef == ref){
gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
return;
}
for(i = ms_nFirstFreeSlotIndex; i < NUMEVENTS; i++)
if(gaEvent[i].type == EVENT_NULL){
ms_nFirstFreeSlotIndex = i;
break;
}
if(i < NUMEVENTS){
gaEvent[i].type = type;
gaEvent[i].entityType = entityType;
gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
gaEvent[i].entityRef = ref;
gaEvent[i].posn = ent->GetPosition();
gaEvent[i].criminal = criminal;
if(gaEvent[i].criminal)
gaEvent[i].criminal->RegisterReference((CEntity**)&gaEvent[i].criminal);
if(type == EVENT_GUNSHOT)
gaEvent[i].state = EVENT_STATE_CLEAR;
else
gaEvent[i].state = EVENT_STATE_0;
}
if(criminal == FindPlayerPed())
ReportCrimeForEvent(type, (uintptr)ent, copsDontCare);
}
void
CEventList::RegisterEvent(eEventType type, CVector posn, int32 timeout)
{
int i;
// only update time if event exists already
for(i = 0; i < NUMEVENTS; i++)
if(gaEvent[i].type == type &&
gaEvent[i].posn.x == posn.x &&
gaEvent[i].posn.y == posn.y &&
gaEvent[i].posn.z == posn.z &&
gaEvent[i].entityType == EVENT_ENTITY_NONE){
gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
return;
}
for(i = ms_nFirstFreeSlotIndex; i < NUMEVENTS; i++)
if(gaEvent[i].type == EVENT_NULL){
ms_nFirstFreeSlotIndex = i;
break;
}
if(i < NUMEVENTS){
gaEvent[i].type = type;
gaEvent[i].entityType = EVENT_ENTITY_NONE;
gaEvent[i].timeout = CTimer::GetTimeInMilliseconds() + timeout;
gaEvent[i].posn = posn;
gaEvent[i].entityRef = 0;
if(type == EVENT_GUNSHOT)
gaEvent[i].state = EVENT_STATE_CLEAR;
else
gaEvent[i].state = EVENT_STATE_0;
}
}
bool
CEventList::GetEvent(eEventType type, int32 *event)
{
int i;
for(i = 0; i < NUMEVENTS; i++)
if(gaEvent[i].type == type){
*event = i;
return true;
}
return false;
}
void
CEventList::ClearEvent(int32 event)
{
if(gaEvent[event].state != EVENT_STATE_CANDELETE)
gaEvent[event].state = EVENT_STATE_CLEAR;
}
bool
CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
{
int i;
float dist;
bool found = false;
float mindist = 60.0f;
for(i = 0; i < NUMEVENTS; i++){
if(gaEvent[i].type != type)
continue;
dist = (posn - gaEvent[i].posn).Magnitude();
if(dist < mindist){
mindist = dist;
found = true;
*event = i;
}
}
return found;
}
void
CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare)
{
eCrimeType crime;
switch(type){
case EVENT_ASSAULT: crime = CRIME_HIT_PED; break;
case EVENT_RUN_REDLIGHT: crime = CRIME_RUN_REDLIGHT; break;
case EVENT_ASSAULT_POLICE: crime = CRIME_HIT_COP; break;
case EVENT_GUNSHOT: crime = CRIME_POSSESSION_GUN; break;
case EVENT_STEAL_CAR: crime = CRIME_STEAL_CAR; break;
case EVENT_HIT_AND_RUN: crime = CRIME_RUNOVER_PED; break;
case EVENT_HIT_AND_RUN_COP: crime = CRIME_RUNOVER_COP; break;
case EVENT_SHOOT_PED: crime = CRIME_SHOOT_PED; break;
case EVENT_SHOOT_COP: crime = CRIME_SHOOT_COP; break;
case EVENT_PED_SET_ON_FIRE: crime = CRIME_PED_BURNED; break;
case EVENT_COP_SET_ON_FIRE: crime = CRIME_COP_BURNED; break;
case EVENT_CAR_SET_ON_FIRE: crime = CRIME_VEHICLE_BURNED; break;
default: crime = CRIME_NONE; break;
}
if(crime == CRIME_NONE)
return;
CVector playerPedCoors = FindPlayerPed()->GetPosition();
CVector playerCoors = FindPlayerCoors();
if(CWanted::WorkOutPolicePresence(playerCoors, 14.0f) != 0){
FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(crime, playerPedCoors, crimeId, copsDontCare);
FindPlayerPed()->m_pWanted->SetWantedLevelNoDrop(1);
}else
FindPlayerPed()->m_pWanted->RegisterCrime(crime, playerPedCoors, crimeId, copsDontCare);
if(type == EVENT_ASSAULT_POLICE)
FindPlayerPed()->SetWantedLevelNoDrop(1);
if(type == EVENT_SHOOT_COP)
FindPlayerPed()->SetWantedLevelNoDrop(2);
}
STARTPATCHES
InjectHook(0x475B60, CEventList::Initialise, PATCH_JUMP);
InjectHook(0x475BE0, CEventList::Update, PATCH_JUMP);
InjectHook(0x475C50, (void (*)(eEventType,eEventEntity,CEntity *,CPed *,int32))CEventList::RegisterEvent, PATCH_JUMP);
InjectHook(0x475E10, (void (*)(eEventType,CVector,int32))CEventList::RegisterEvent, PATCH_JUMP);
InjectHook(0x475F40, CEventList::GetEvent, PATCH_JUMP);
InjectHook(0x475F70, CEventList::ClearEvent, PATCH_JUMP);
InjectHook(0x475F90, CEventList::FindClosestEvent, PATCH_JUMP);
InjectHook(0x476070, CEventList::ReportCrimeForEvent, PATCH_JUMP);
ENDPATCHES

67
src/core/EventList.h Normal file
View file

@ -0,0 +1,67 @@
#pragma once
class CEntity;
class CPed;
enum eEventType
{
EVENT_NULL,
EVENT_ASSAULT,
EVENT_RUN_REDLIGHT,
EVENT_ASSAULT_POLICE,
EVENT_GUNSHOT,
EVENT_INJURED_PED,
EVENT_DEAD_PED,
EVENT_FIRE,
EVENT_STEAL_CAR,
EVENT_HIT_AND_RUN,
EVENT_HIT_AND_RUN_COP,
EVENT_SHOOT_PED,
EVENT_SHOOT_COP,
EVENT_EXPLOSION,
EVENT_PED_SET_ON_FIRE,
EVENT_COP_SET_ON_FIRE,
EVENT_CAR_SET_ON_FIRE,
EVENT_ASSAULT_NASTYWEAPON,
EVENT_ASSAULT_NASTYWEAPON_POLICE,
EVENT_ICECREAM,
EVENT_ATM,
EVENT_SHOPSTALL,
EVENT_SHOPWINDOW,
EVENT_LAST_EVENT
};
enum eEventEntity
{
EVENT_ENTITY_NONE,
EVENT_ENTITY_PED,
EVENT_ENTITY_VEHICLE,
EVENT_ENTITY_OBJECT
};
struct CEvent
{
eEventType type;
eEventEntity entityType;
int32 entityRef;
CPed *criminal;
CVector posn;
uint32 timeout;
int32 state;
};
class CEventList
{
static int32 ms_nFirstFreeSlotIndex;
public:
static void Initialise(void);
static void Update(void);
static void RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent, CPed *criminal, int32 timeout);
static void RegisterEvent(eEventType type, CVector posn, int32 timeout);
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);
};
extern CEvent *gaEvent;

View file

@ -1,7 +1,7 @@
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"
#include "patcher.h" #include "patcher.h"
#include "math/Quaternion.h" #include "Quaternion.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "TempColModels.h" #include "TempColModels.h"
@ -361,10 +361,10 @@ CFileLoader::LoadClumpFile(const char *filename)
nodename = GetFrameNodeName(RpClumpGetFrame(clump)); nodename = GetFrameNodeName(RpClumpGetFrame(clump));
GetNameAndLOD(nodename, name, &n); GetNameAndLOD(nodename, name, &n);
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil); mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil);
if(mi){
assert(mi->IsClump()); assert(mi->IsClump());
if(mi)
mi->SetClump(clump); mi->SetClump(clump);
else }else
RpClumpDestroy(clump); RpClumpDestroy(clump);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -43,8 +43,6 @@
#define MENUSLIDER_X 306.0f #define MENUSLIDER_X 306.0f
#define buf(a) (char*)(a)
enum eLanguages enum eLanguages
{ {
LANGUAGE_AMERICAN, LANGUAGE_AMERICAN,
@ -328,7 +326,7 @@ enum eCheckHover
HOVEROPTION_19, HOVEROPTION_19,
HOVEROPTION_20, HOVEROPTION_20,
HOVEROPTION_CHANGESKIN, HOVEROPTION_CHANGESKIN,
HOVEROPTION_NULL = 42, HOVEROPTION_42 = 42,
}; };
enum eMenuColumns enum eMenuColumns
@ -339,28 +337,9 @@ enum eMenuColumns
MENUCOLUMNS, MENUCOLUMNS,
}; };
enum eMenuRow enum
{ {
MENUROW_NONE = -1, NUM_MENUROWS = 18,
MENUROW_0,
MENUROW_1,
MENUROW_2,
MENUROW_3,
MENUROW_4,
MENUROW_5,
MENUROW_6,
MENUROW_7,
MENUROW_8,
MENUROW_9,
MENUROW_10,
MENUROW_11,
MENUROW_12,
MENUROW_13,
MENUROW_14,
MENUROW_15,
MENUROW_16,
MENUROW_17,
MENUROWS,
}; };
struct tSkinInfo struct tSkinInfo
@ -377,7 +356,7 @@ struct CMenuScreen
char m_ScreenName[8]; char m_ScreenName[8];
int32 unk; int32 unk;
int32 m_PreviousPage[2]; // eMenuScreen int32 m_PreviousPage[2]; // eMenuScreen
int32 m_ParentEntry[2]; // eMenuRow int32 m_ParentEntry[2]; // row
struct CMenuEntry struct CMenuEntry
{ {
@ -385,7 +364,7 @@ struct CMenuScreen
char m_EntryName[8]; char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen int32 m_TargetMenu; // eMenuScreen
} m_aEntries[MENUROWS]; } m_aEntries[NUM_MENUROWS];
}; };
class CMenuManager class CMenuManager
@ -413,10 +392,10 @@ public:
tSkinInfo *m_pSelectedSkin; tSkinInfo *m_pSelectedSkin;
tSkinInfo *field_438; tSkinInfo *field_438;
float field_43C; float field_43C;
int field_440; int m_nCurrExSize;
int m_nSkinsTotal; int m_nSkinsTotal;
char _unk0[4]; char _unk0[4];
int field_44C; int m_nCurrExOption;
bool m_bSkinsFound; bool m_bSkinsFound;
bool m_bQuitGameNoCD; bool m_bQuitGameNoCD;
char field_452; char field_452;
@ -439,7 +418,7 @@ public:
int field_530; int field_530;
char field_534; char field_534;
char field_535; char field_535;
int8 field_536; int8 m_nCurrExLayer;
int m_nHelperTextAlpha; int m_nHelperTextAlpha;
int m_nMouseOldPosX; int m_nMouseOldPosX;
int m_nMouseOldPosY; int m_nMouseOldPosY;
@ -452,6 +431,7 @@ public:
int m_nCurrSaveSlot; int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer; int m_nScreenChangeDelayTimer;
public:
static int32 &OS_Language; static int32 &OS_Language;
static int8 &m_PrefsUseVibration; static int8 &m_PrefsUseVibration;
static int8 &m_DisplayControllerOnFoot; static int8 &m_DisplayControllerOnFoot;
@ -462,9 +442,9 @@ public:
static int8 &m_PrefsFrameLimiter; static int8 &m_PrefsFrameLimiter;
static int8 &m_PrefsShowSubtitles; static int8 &m_PrefsShowSubtitles;
static int8 &m_PrefsSpeakers; static int8 &m_PrefsSpeakers;
static int8 &m_ControlMethod; static int32 &m_ControlMethod;
static int8 &m_PrefsDMA; static int8 &m_PrefsDMA;
static int8 &m_PrefsLanguage; static int32 &m_PrefsLanguage;
static int8 &m_bDisableMouseSteering; static int8 &m_bDisableMouseSteering;
static int32 &m_PrefsBrightness; static int32 &m_PrefsBrightness;
static float &m_PrefsLOD; static float &m_PrefsLOD;
@ -516,17 +496,16 @@ public:
void SaveSettings(); void SaveSettings();
void SetHelperText(int text); void SetHelperText(int text);
void ShutdownJustMenu(); void ShutdownJustMenu();
static float StretchX(float); float StretchX(float);
static float StretchY(float); float StretchY(float);
void SwitchMenuOnAndOff(); void SwitchMenuOnAndOff();
void UnloadTextures(); void UnloadTextures();
void WaitForUserCD(); void WaitForUserCD();
// New content: // New content:
uint8 GetNumberOfMenuOptions(); uint8 GetNumberOfMenuOptions();
void SwitchToNewScreen(int8 screen); void SwitchToNewScreen(int32 screen);
void SetDefaultPreferences(int8 screen); void SetDefaultPreferences(int32 screen);
}; };
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");

View file

@ -36,6 +36,22 @@ public:
} }
} }
static float LimitAngle(float angle)
{
float result = angle;
while (result >= 180.0f) {
result -= 2 * 180.0f;
}
while (result < -180.0f) {
result += 2 * 180.0f;
}
return result;
}
static float LimitRadianAngle(float angle) static float LimitRadianAngle(float angle)
{ {
float result; float result;

View file

@ -2,15 +2,15 @@
const CMenuScreen aScreens[] = { const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0 // MENUPAGE_NONE = 0
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, }, { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1 // MENUPAGE_STATS = 1
{ "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_5, MENUROW_2, { "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_NEW_GAME = 2 // MENUPAGE_NEW_GAME = 2
{ "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_0, MENUROW_1, { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD, MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, MENUACTION_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, MENUACTION_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
@ -18,17 +18,17 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_BRIEFS = 3 // MENUPAGE_BRIEFS = 3
{ "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_6, MENUROW_3, { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENU_CONTROLLER_SETTINGS = 4 // MENU_CONTROLLER_SETTINGS = 4
{ "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_0, MENUROW_0, { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
}, },
// MENUPAGE_SOUND_SETTINGS = 5 // MENUPAGE_SOUND_SETTINGS = 5
{ "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_1, MENUROW_1, { "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
@ -40,7 +40,7 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_GRAPHICS_SETTINGS = 6 // MENUPAGE_GRAPHICS_SETTINGS = 6
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_2, MENUROW_2, { "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@ -54,7 +54,7 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_LANGUAGE_SETTINGS = 7 // MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_3, MENUROW_3, { "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
@ -64,7 +64,7 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_CHOOSE_LOAD_SLOT = 8 // MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_1, MENUROW_1, { "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
@ -77,7 +77,7 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_CHOOSE_DELETE_SLOT = 9 // MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_2, MENUROW_2, { "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
@ -90,96 +90,96 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_NEW_GAME_RELOAD = 10 // MENUPAGE_NEW_GAME_RELOAD = 10
{ "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_0, MENUROW_0, { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_LOAD_SLOT_CONFIRM = 11 // MENUPAGE_LOAD_SLOT_CONFIRM = 11
{ "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUROW_0, MENUROW_0, { "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS, MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
}, },
// MENUPAGE_DELETE_SLOT_CONFIRM = 12 // MENUPAGE_DELETE_SLOT_CONFIRM = 12
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0, { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING, MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING,
}, },
// MENUPAGE_13 = 13 // MENUPAGE_13 = 13
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_LOADING_IN_PROGRESS = 14 // MENUPAGE_LOADING_IN_PROGRESS = 14
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM,
}, },
// MENUPAGE_DELETING_IN_PROGRESS = 15 // MENUPAGE_DELETING_IN_PROGRESS = 15
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_16 = 16 // MENUPAGE_16 = 16
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_DELETE_FAILED = 17 // MENUPAGE_DELETE_FAILED = 17
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
}, },
// MENUPAGE_DEBUG_MENU = 18 // MENUPAGE_DEBUG_MENU = 18
{ "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MEMORY_CARD_1 = 19 // MENUPAGE_MEMORY_CARD_1 = 19
{ "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MEMORY_CARD_2 = 20 // MENUPAGE_MEMORY_CARD_2 = 20
{ "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MULTIPLAYER_MAIN = 21 // MENUPAGE_MULTIPLAYER_MAIN = 21
{ "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_SAVE_FAILED_1 = 22 // MENUPAGE_SAVE_FAILED_1 = 22
{ "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_SAVE_FAILED_2 = 23 // MENUPAGE_SAVE_FAILED_2 = 23
{ "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_SAVE = 24 // MENUPAGE_SAVE = 24
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_UPDATESAVE, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_NO_MEMORY_CARD = 25 // MENUPAGE_NO_MEMORY_CARD = 25
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_CHOOSE_SAVE_SLOT = 26 // MENUPAGE_CHOOSE_SAVE_SLOT = 26
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_UPDATESAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_UPDATESAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
@ -192,49 +192,49 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27 // MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0, { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS, MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
}, },
// MENUPAGE_MULTIPLAYER_MAP = 28 // MENUPAGE_MULTIPLAYER_MAP = 28
{ "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MULTIPLAYER_CONNECTION = 29 // MENUPAGE_MULTIPLAYER_CONNECTION = 29
{ "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30 // MENUPAGE_MULTIPLAYER_FIND_GAME = 30
{ "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MULTIPLAYER_MODE = 31 // MENUPAGE_MULTIPLAYER_MODE = 31
{ "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MULTIPLAYER_CREATE = 32 // MENUPAGE_MULTIPLAYER_CREATE = 32
{ "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_MULTIPLAYER_START = 33 // MENUPAGE_MULTIPLAYER_START = 33
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_SKIN_SELECT_OLD = 34 // MENUPAGE_SKIN_SELECT_OLD = 34
{ "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_CONTROLLER_PC = 35 // MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_0, MENUROW_0, { "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS, MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
@ -243,32 +243,32 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_CONTROLLER_PC_OLD1 = 36 // MENUPAGE_CONTROLLER_PC_OLD1 = 36
{ "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_0, MENUROW_0, { "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
}, },
// MENUPAGE_CONTROLLER_PC_OLD2 = 37 // MENUPAGE_CONTROLLER_PC_OLD2 = 37
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_CONTROLLER_PC_OLD3 = 38 // MENUPAGE_CONTROLLER_PC_OLD3 = 38
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_CONTROLLER_PC_OLD4 = 39 // MENUPAGE_CONTROLLER_PC_OLD4 = 39
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_CONTROLLER_DEBUG = 40 // MENUPAGE_CONTROLLER_DEBUG = 40
{ "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_OPTIONS = 41 // MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_1, MENUROW_4, { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@ -278,65 +278,65 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_EXIT = 42 // MENUPAGE_EXIT = 42
{ "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_2, MENUROW_5, { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCLEGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CANCLEGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_SAVING_IN_PROGRESS = 43 // MENUPAGE_SAVING_IN_PROGRESS = 43
{ "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0, { "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_SAVE_SUCCESSFUL = 44 // MENUPAGE_SAVE_SUCCESSFUL = 44
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0, { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE, MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
MENUACTION_UPDATEMEMCARDSAVE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_UPDATEMEMCARDSAVE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
}, },
// MENUPAGE_DELETING = 45 // MENUPAGE_DELETING = 45
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0, { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_DELETE_SUCCESS = 46 // MENUPAGE_DELETE_SUCCESS = 46
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0, { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
}, },
// MENUPAGE_SAVE_FAILED = 47 // MENUPAGE_SAVE_FAILED = 47
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0, { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
}, },
// MENUPAGE_LOAD_FAILED = 48 // MENUPAGE_LOAD_FAILED = 48
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0, { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_LOAD_FAILED_2 = 49 // MENUPAGE_LOAD_FAILED_2 = 49
{ "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0, { "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
}, },
// MENUPAGE_FILTER_GAME = 50 // MENUPAGE_FILTER_GAME = 50
{ "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_START_MENU = 51 // MENUPAGE_START_MENU = 51
{ "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS, MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT, MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT,
}, },
// MENUPAGE_PAUSE_MENU = 52 // MENUPAGE_PAUSE_MENU = 52
{ "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS, MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
@ -346,22 +346,22 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_CHOOSE_MODE = 53 // MENUPAGE_CHOOSE_MODE = 53
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_SKIN_SELECT = 54 // MENUPAGE_SKIN_SELECT = 54
{ "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_4, MENUROW_4, { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN, //MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
}, },
// MENUPAGE_KEYBOARD_CONTROLS = 55 // MENUPAGE_KEYBOARD_CONTROLS = 55
{ "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_1, MENUROW_1, { "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, //MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
}, },
// MENUPAGE_MOUSE_CONTROLS = 56 // MENUPAGE_MOUSE_CONTROLS = 56
{ "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_2, MENUROW_2, { "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
@ -369,12 +369,12 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_57 = 57 // MENUPAGE_57 = 57
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
// MENUPAGE_58 = 58 // MENUPAGE_58 = 58
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
}, },
}; };

View file

@ -9,6 +9,11 @@ WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned sho
WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); } WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); }
WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); } WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); }
WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); } WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); }
WRAPPER void CMessages::AddBigMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529EB0); }
WRAPPER void CMessages::AddMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529900); }
WRAPPER void CMessages::AddMessageJumpQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529A10); }
WRAPPER void CMessages::AddMessageSoon(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529AF0); }
WRAPPER void CMessages::ClearMessages() { EAXJMP(0x529CE0); }
tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08; tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08;
tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0; tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0;

View file

@ -41,4 +41,9 @@ public:
static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst); static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst);
static void InsertPlayerControlKeysInString(wchar* src); static void InsertPlayerControlKeysInString(wchar* src);
static int GetWideStringLength(wchar *src); static int GetWideStringLength(wchar *src);
static void AddBigMessage(wchar* key, uint32 time, uint16 pos);
static void AddMessage(wchar* key, uint32 time, uint16 pos);
static void AddMessageJumpQ(wchar* key, uint32 time, uint16 pos);
static void AddMessageSoon(wchar* key, uint32 time, uint16 pos);
static void ClearMessages();
}; };

View file

@ -155,7 +155,7 @@ void CPad::Clear(bool bResetPlayerControls)
ShakeDur = 0; ShakeDur = 0;
if ( bResetPlayerControls ) if ( bResetPlayerControls )
DisablePlayerControls = false; DisablePlayerControls = PLAYERCONTROL_ENABLED;
bApplyBrakes = false; bApplyBrakes = false;
@ -659,7 +659,7 @@ CPad *CPad::GetPad(int32 pad)
int16 CPad::GetSteeringLeftRight(void) int16 CPad::GetSteeringLeftRight(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -692,7 +692,7 @@ int16 CPad::GetSteeringLeftRight(void)
int16 CPad::GetSteeringUpDown(void) int16 CPad::GetSteeringUpDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -725,7 +725,7 @@ int16 CPad::GetSteeringUpDown(void)
int16 CPad::GetCarGunUpDown(void) int16 CPad::GetCarGunUpDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -752,7 +752,7 @@ int16 CPad::GetCarGunUpDown(void)
int16 CPad::GetCarGunLeftRight(void) int16 CPad::GetCarGunLeftRight(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -779,7 +779,7 @@ int16 CPad::GetCarGunLeftRight(void)
int16 CPad::GetPedWalkLeftRight(void) int16 CPad::GetPedWalkLeftRight(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -813,7 +813,7 @@ int16 CPad::GetPedWalkLeftRight(void)
int16 CPad::GetPedWalkUpDown(void) int16 CPad::GetPedWalkUpDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -876,7 +876,7 @@ int16 CPad::GetAnalogueUpDown(void)
bool CPad::GetLookLeft(void) bool CPad::GetLookLeft(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2); return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2);
@ -884,7 +884,7 @@ bool CPad::GetLookLeft(void)
bool CPad::GetLookRight(void) bool CPad::GetLookRight(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.RightShoulder2 && !NewState.LeftShoulder2); return !!(NewState.RightShoulder2 && !NewState.LeftShoulder2);
@ -893,7 +893,7 @@ bool CPad::GetLookRight(void)
bool CPad::GetLookBehindForCar(void) bool CPad::GetLookBehindForCar(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.RightShoulder2 && NewState.LeftShoulder2); return !!(NewState.RightShoulder2 && NewState.LeftShoulder2);
@ -901,7 +901,7 @@ bool CPad::GetLookBehindForCar(void)
bool CPad::GetLookBehindForPed(void) bool CPad::GetLookBehindForPed(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!NewState.RightShock; return !!NewState.RightShock;
@ -909,7 +909,7 @@ bool CPad::GetLookBehindForPed(void)
bool CPad::GetHorn(void) bool CPad::GetHorn(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -948,7 +948,7 @@ bool CPad::GetHorn(void)
bool CPad::HornJustDown(void) bool CPad::HornJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -988,7 +988,7 @@ bool CPad::HornJustDown(void)
bool CPad::GetCarGunFired(void) bool CPad::GetCarGunFired(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1015,7 +1015,7 @@ bool CPad::GetCarGunFired(void)
bool CPad::CarGunJustDown(void) bool CPad::CarGunJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1042,7 +1042,7 @@ bool CPad::CarGunJustDown(void)
int16 CPad::GetHandBrake(void) int16 CPad::GetHandBrake(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -1075,7 +1075,7 @@ int16 CPad::GetHandBrake(void)
int16 CPad::GetBrake(void) int16 CPad::GetBrake(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -1113,7 +1113,7 @@ int16 CPad::GetBrake(void)
bool CPad::GetExitVehicle(void) bool CPad::GetExitVehicle(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1140,7 +1140,7 @@ bool CPad::GetExitVehicle(void)
bool CPad::ExitVehicleJustDown(void) bool CPad::ExitVehicleJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1167,7 +1167,7 @@ bool CPad::ExitVehicleJustDown(void)
int32 CPad::GetWeapon(void) int32 CPad::GetWeapon(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1200,7 +1200,7 @@ int32 CPad::GetWeapon(void)
bool CPad::WeaponJustDown(void) bool CPad::WeaponJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1233,7 +1233,7 @@ bool CPad::WeaponJustDown(void)
int16 CPad::GetAccelerate(void) int16 CPad::GetAccelerate(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
switch ( Mode ) switch ( Mode )
@ -1319,7 +1319,7 @@ bool CPad::CycleCameraModeDownJustDown(void)
bool CPad::ChangeStationJustDown(void) bool CPad::ChangeStationJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1359,7 +1359,7 @@ bool CPad::ChangeStationJustDown(void)
bool CPad::CycleWeaponLeftJustDown(void) bool CPad::CycleWeaponLeftJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
@ -1367,7 +1367,7 @@ bool CPad::CycleWeaponLeftJustDown(void)
bool CPad::CycleWeaponRightJustDown(void) bool CPad::CycleWeaponRightJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
@ -1375,7 +1375,7 @@ bool CPad::CycleWeaponRightJustDown(void)
bool CPad::GetTarget(void) bool CPad::GetTarget(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1402,7 +1402,7 @@ bool CPad::GetTarget(void)
bool CPad::TargetJustDown(void) bool CPad::TargetJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1429,7 +1429,7 @@ bool CPad::TargetJustDown(void)
bool CPad::JumpJustDown(void) bool CPad::JumpJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.Square && !OldState.Square); return !!(NewState.Square && !OldState.Square);
@ -1437,7 +1437,7 @@ bool CPad::JumpJustDown(void)
bool CPad::GetSprint(void) bool CPad::GetSprint(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1464,7 +1464,7 @@ bool CPad::GetSprint(void)
bool CPad::ShiftTargetLeftJustDown(void) bool CPad::ShiftTargetLeftJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
@ -1472,7 +1472,7 @@ bool CPad::ShiftTargetLeftJustDown(void)
bool CPad::ShiftTargetRightJustDown(void) bool CPad::ShiftTargetRightJustDown(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
@ -1592,7 +1592,7 @@ bool CPad::GetAnaloguePadRightJustUp(void)
bool CPad::ForceCameraBehindPlayer(void) bool CPad::ForceCameraBehindPlayer(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1625,7 +1625,7 @@ bool CPad::ForceCameraBehindPlayer(void)
bool CPad::SniperZoomIn(void) bool CPad::SniperZoomIn(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1652,7 +1652,7 @@ bool CPad::SniperZoomIn(void)
bool CPad::SniperZoomOut(void) bool CPad::SniperZoomOut(void)
{ {
if ( DisablePlayerControls ) if ( ArePlayerControlsDisabled() )
return false; return false;
switch ( Mode ) switch ( Mode )
@ -1824,7 +1824,7 @@ char *CPad::EditString(char *pStr, int32 nSize)
} }
// numbers // numbers
for ( int32 i = 0; i < ('0' - '9' + 1); i++ ) for ( int32 i = 0; i < ('9' - '0' + 1); i++ )
{ {
if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 ) if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 )
{ {

View file

@ -51,6 +51,17 @@ enum Key
}; };
*/ */
enum {
PLAYERCONTROL_ENABLED = 0,
PLAYERCONTROL_DISABLED_1 = 1,
PLAYERCONTROL_DISABLED_2 = 2,
PLAYERCONTROL_DISABLED_4 = 4,
PLAYERCONTROL_DISABLED_8 = 8,
PLAYERCONTROL_DISABLED_10 = 16,
PLAYERCONTROL_DISABLED_20 = 32,
PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
PLAYERCONTROL_DISABLED_80 = 128,
};
class CControllerState class CControllerState
{ {
@ -186,9 +197,9 @@ public:
int16 Mode; int16 Mode;
int16 ShakeDur; int16 ShakeDur;
uint8 ShakeFreq; uint8 ShakeFreq;
int8 bHornHistory[5]; bool bHornHistory[5];
uint8 iCurrHornHistory; uint8 iCurrHornHistory;
bool DisablePlayerControls; uint8 DisablePlayerControls;
int8 bApplyBrakes; int8 bApplyBrakes;
char _unk[12]; //int32 unk[3]; char _unk[12]; //int32 unk[3];
char _pad0[3]; char _pad0[3];
@ -289,6 +300,10 @@ public:
// mouse // mouse
bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); }
bool GetMiddleMouseJustDown() { return !!(NewMouseControllerState.MMB && !OldMouseControllerState.MMB); }
float GetMouseX() { return NewMouseControllerState.x; }
float GetMouseY() { return NewMouseControllerState.y; }
// keyboard // keyboard
@ -354,6 +369,13 @@ public:
bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
/*
int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; }
int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
*/
bool GetTriangle() { return !!NewState.Triangle; } bool GetTriangle() { return !!NewState.Triangle; }
bool GetCircle() { return !!NewState.Circle; } bool GetCircle() { return !!NewState.Circle; }
bool GetCross() { return !!NewState.Cross; } bool GetCross() { return !!NewState.Cross; }
@ -366,10 +388,11 @@ public:
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; } bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; } bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
}; };
VALIDATE_SIZE(CPad, 0xFC); VALIDATE_SIZE(CPad, 0xFC);
extern CPad *Pads; //[2]
#define IsButtonJustDown(pad, btn) \ #define IsButtonJustDown(pad, btn) \
(!(pad)->OldState.btn && (pad)->NewState.btn) (!(pad)->OldState.btn && (pad)->NewState.btn)
void LittleTest(void);

View file

@ -9,11 +9,13 @@ CBuildingPool *&CPools::ms_pBuildingPool = *(CBuildingPool**)0x8F2C04;
CTreadablePool *&CPools::ms_pTreadablePool = *(CTreadablePool**)0x8F2568; CTreadablePool *&CPools::ms_pTreadablePool = *(CTreadablePool**)0x8F2568;
CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28; CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28;
CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18; CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18;
CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C;
void void
CPools::Initialise(void) CPools::Initialise(void)
{ {
// TODO: unused right now // TODO: unused right now
assert(0);
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES); ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES);
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS); ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS);
ms_pPedPool = new CPedPool(NUMPEDS); ms_pPedPool = new CPedPool(NUMPEDS);
@ -22,4 +24,12 @@ CPools::Initialise(void)
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES); ms_pTreadablePool = new CTreadablePool(NUMTREADABLES);
ms_pObjectPool = new CObjectPool(NUMOBJECTS); ms_pObjectPool = new CObjectPool(NUMOBJECTS);
ms_pDummyPool = new CDummyPool(NUMDUMMIES); ms_pDummyPool = new CDummyPool(NUMDUMMIES);
ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS);
} }
int32 CPools::GetPedRef(CPed *ped) { return ms_pPedPool->GetIndex(ped); }
CPed *CPools::GetPed(int32 handle) { return ms_pPedPool->GetAt(handle); }
int32 CPools::GetVehicleRef(CVehicle *vehicle) { return ms_pVehiclePool->GetIndex(vehicle); }
CVehicle *CPools::GetVehicle(int32 handle) { return ms_pVehiclePool->GetAt(handle); }
int32 CPools::GetObjectRef(CObject *object) { return ms_pObjectPool->GetIndex(object); }
CObject *CPools::GetObject(int32 handle) { return ms_pObjectPool->GetAt(handle); }

View file

@ -8,6 +8,7 @@
#include "PlayerPed.h" #include "PlayerPed.h"
#include "Automobile.h" #include "Automobile.h"
#include "DummyPed.h" #include "DummyPed.h"
#include "AudioManager.h"
typedef CPool<CPtrNode> CCPtrNodePool; typedef CPool<CPtrNode> CCPtrNodePool;
typedef CPool<CEntryInfoNode> CEntryInfoNodePool; typedef CPool<CEntryInfoNode> CEntryInfoNodePool;
@ -17,6 +18,7 @@ typedef CPool<CBuilding> CBuildingPool;
typedef CPool<CTreadable> CTreadablePool; typedef CPool<CTreadable> CTreadablePool;
typedef CPool<CObject, CCutsceneHead> CObjectPool; typedef CPool<CObject, CCutsceneHead> CObjectPool;
typedef CPool<CDummy, CDummyPed> CDummyPool; typedef CPool<CDummy, CDummyPed> CDummyPool;
typedef CPool<cAudioScriptObject, cAudioScriptObject> CAudioScriptObjectPool;
class CPools class CPools
{ {
@ -28,7 +30,7 @@ class CPools
static CTreadablePool *&ms_pTreadablePool; static CTreadablePool *&ms_pTreadablePool;
static CObjectPool *&ms_pObjectPool; static CObjectPool *&ms_pObjectPool;
static CDummyPool *&ms_pDummyPool; static CDummyPool *&ms_pDummyPool;
// ms_pAudioScriptObjectPool static CAudioScriptObjectPool *&ms_pAudioScriptObjectPool;
public: public:
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; } static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; } static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
@ -38,6 +40,13 @@ public:
static CTreadablePool *GetTreadablePool(void) { return ms_pTreadablePool; } static CTreadablePool *GetTreadablePool(void) { return ms_pTreadablePool; }
static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; } static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; }
static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; } static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; }
static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; }
static void Initialise(void); static void Initialise(void);
static int32 GetPedRef(CPed *ped);
static CPed *GetPed(int32 handle);
static int32 GetVehicleRef(CVehicle *vehicle);
static CVehicle *GetVehicle(int32 handle);
static int32 GetObjectRef(CObject *object);
static CObject *GetObject(int32 handle);
}; };

View file

@ -4,6 +4,7 @@
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8; int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
int32 &CStats::HeadShots = *(int32*)0x8F647C; int32 &CStats::HeadShots = *(int32*)0x8F647C;
bool& CStats::CommercialPassed = *(bool*)0x8F4334; bool& CStats::CommercialPassed = *(bool*)0x8F4334;
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C; int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50; int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;

View file

@ -6,6 +6,7 @@ public:
static int32 &DaysPassed; static int32 &DaysPassed;
static int32 &HeadShots; static int32 &HeadShots;
static bool& CommercialPassed; static bool& CommercialPassed;
static bool& IndustrialPassed;
static int32 &NumberKillFrenziesPassed; static int32 &NumberKillFrenziesPassed;
static int32 &PeopleKilledByOthers; static int32 &PeopleKilledByOthers;

View file

@ -1048,8 +1048,6 @@ CStreaming::RemoveReferencedTxds(int32 mem)
return false; return false;
} }
// TODO: RemoveCurrentZonesModels
void void
CStreaming::RemoveUnusedModelsInLoadedList(void) CStreaming::RemoveUnusedModelsInLoadedList(void)
{ {

View file

@ -77,6 +77,8 @@ enum eSurfaceType
SURFACE_LOOSE30, SURFACE_LOOSE30,
SURFACE_BOLLARD, SURFACE_BOLLARD,
SURFACE_GATE, SURFACE_GATE,
// These are illegal
SURFACE_SAND33, SURFACE_SAND33,
SURFACE_ROAD34, SURFACE_ROAD34,
}; };

View file

@ -1,65 +1,102 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "Pools.h"
#include "ModelIndices.h"
#include "Timer.h"
#include "World.h"
#include "ZoneCull.h"
#include "Darkel.h"
#include "DMAudio.h"
#include "Wanted.h" #include "Wanted.h"
int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; // 6
int32 &CWanted::nMaximumWantedLevel = *(int32*)0x5F7718; // 6400
bool CWanted::AreSwatRequired() void
CWanted::Initialise()
{
int i;
m_nChaos = 0;
m_nLastUpdateTime = 0;
m_nLastWantedLevelChange = 0;
m_CurrentCops = 0;
m_MaxCops = 0;
m_MaximumLawEnforcerVehicles = 0;
m_RoadblockDensity = 0;
m_bIgnoredByCops = false;
m_bIgnoredByEveryone = false;
m_bSwatRequired = false;
m_bFbiRequired = false;
m_bArmyRequired = false;
m_fCrimeSensitivity = 1.0f;
m_nWantedLevel = 0;
m_CopsBeatingSuspect = 0;
for(i = 0; i < 10; i++)
m_pCops[i] = nil;
ClearQdCrimes();
}
bool
CWanted::AreSwatRequired()
{ {
return m_nWantedLevel >= 4; return m_nWantedLevel >= 4;
} }
bool CWanted::AreFbiRequired() bool
CWanted::AreFbiRequired()
{ {
return m_nWantedLevel >= 5; return m_nWantedLevel >= 5;
} }
bool CWanted::AreArmyRequired() bool
CWanted::AreArmyRequired()
{ {
return m_nWantedLevel >= 6; return m_nWantedLevel >= 6;
} }
int CWanted::NumOfHelisRequired() int32
CWanted::NumOfHelisRequired()
{ {
if (m_IsIgnoredByCops) if (m_bIgnoredByCops)
return 0; return 0;
// Return value is number of helicopters, no need to name them.
switch (m_nWantedLevel) { switch (m_nWantedLevel) {
case WANTEDLEVEL_3: case 3:
case WANTEDLEVEL_4: case 4:
return 1; return 1;
case WANTEDLEVEL_5: case 5:
case WANTEDLEVEL_6: case 6:
return 2; return 2;
default: default:
return 0; return 0;
} }
} }
void CWanted::SetWantedLevel(int32 level) void
CWanted::SetWantedLevel(int32 level)
{ {
ClearQdCrimes(); ClearQdCrimes();
switch (level) { switch (level) {
case NOTWANTED: case 0:
m_nChaos = 0; m_nChaos = 0;
break; break;
case WANTEDLEVEL_1: case 1:
m_nChaos = 60; m_nChaos = 60;
break; break;
case WANTEDLEVEL_2: case 2:
m_nChaos = 220; m_nChaos = 220;
break; break;
case WANTEDLEVEL_3: case 3:
m_nChaos = 420; m_nChaos = 420;
break; break;
case WANTEDLEVEL_4: case 4:
m_nChaos = 820; m_nChaos = 820;
break; break;
case WANTEDLEVEL_5: case 5:
m_nChaos = 1620; m_nChaos = 1620;
break; break;
case WANTEDLEVEL_6: case 6:
m_nChaos = 3220; m_nChaos = 3220;
break; break;
default: default:
@ -70,61 +107,212 @@ void CWanted::SetWantedLevel(int32 level)
UpdateWantedLevel(); UpdateWantedLevel();
} }
void CWanted::SetWantedLevelNoDrop(int32 level) void
CWanted::SetWantedLevelNoDrop(int32 level)
{ {
if (level > m_nWantedLevel) if (level > m_nWantedLevel)
SetWantedLevel(level); SetWantedLevel(level);
} }
void CWanted::ClearQdCrimes() void
CWanted::SetMaximumWantedLevel(int32 level)
{ {
for (int i = 0; i < 16; i++) { switch(level){
m_sCrimes[i].m_eCrimeType = CRIME_NONE; case 0:
nMaximumWantedLevel = 0;
MaximumWantedLevel = 0;
break;
case 1:
nMaximumWantedLevel = 120;
MaximumWantedLevel = 1;
break;
case 2:
nMaximumWantedLevel = 300;
MaximumWantedLevel = 2;
break;
case 3:
nMaximumWantedLevel = 600;
MaximumWantedLevel = 3;
break;
case 4:
nMaximumWantedLevel = 1200;
MaximumWantedLevel = 4;
break;
case 5:
nMaximumWantedLevel = 2400;
MaximumWantedLevel = 5;
break;
case 6:
nMaximumWantedLevel = 4800;
MaximumWantedLevel = 6;
break;
} }
} }
void CWanted::UpdateWantedLevel() void
CWanted::RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
{
AddCrimeToQ(type, id, coors, false, policeDoesntCare);
}
void
CWanted::RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
{
if(!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
ReportCrimeNow(type, coors, policeDoesntCare);
}
void
CWanted::ClearQdCrimes()
{
for (int i = 0; i < 16; i++)
m_aCrimes[i].m_nType = CRIME_NONE;
}
// returns whether the crime had been reported already
bool
CWanted::AddCrimeToQ(eCrimeType type, int32 id, const CVector &coors, bool reported, bool policeDoesntCare)
{
int i;
for(i = 0; i < 16; i++)
if(m_aCrimes[i].m_nType == type && m_aCrimes[i].m_nId == id){
if(m_aCrimes[i].m_bReported)
return true;
if(reported)
m_aCrimes[i].m_bReported = reported;
return false;
}
for(i = 0; i < 16; i++)
if(m_aCrimes[i].m_nType == CRIME_NONE)
break;
if(i < 16){
m_aCrimes[i].m_nType = type;
m_aCrimes[i].m_nId = id;
m_aCrimes[i].m_vecPosn = coors;
m_aCrimes[i].m_nTime = CTimer::GetTimeInMilliseconds();
m_aCrimes[i].m_bReported = reported;
m_aCrimes[i].m_bPoliceDoesntCare = policeDoesntCare;
}
return false;
}
void
CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare)
{
float sensitivity, chaos;
int wantedLevelDrop;
if(CDarkel::FrenzyOnGoing())
sensitivity = m_fCrimeSensitivity*0.3f;
else
sensitivity = m_fCrimeSensitivity;
wantedLevelDrop = min(CCullZones::GetWantedLevelDrop(), 100);
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
if (policeDoesntCare)
chaos *= 0.333f;
switch(type){
case CRIME_POSSESSION_GUN:
break;
case CRIME_HIT_PED:
m_nChaos += 5.0f*chaos;
break;
case CRIME_HIT_COP:
m_nChaos += 45.0f*chaos;
break;
case CRIME_SHOOT_PED:
m_nChaos += 30.0f*chaos;
break;
case CRIME_SHOOT_COP:
m_nChaos += 80.0f*chaos;
break;
case CRIME_STEAL_CAR:
m_nChaos += 15.0f*chaos;
break;
case CRIME_RUN_REDLIGHT:
m_nChaos += 10.0f*chaos;
break;
case CRIME_RECKLESS_DRIVING:
m_nChaos += 5.0f*chaos;
break;
case CRIME_SPEEDING:
m_nChaos += 5.0f*chaos;
break;
case CRIME_RUNOVER_PED:
m_nChaos += 18.0f*chaos;
break;
case CRIME_RUNOVER_COP:
m_nChaos += 80.0f*chaos;
break;
case CRIME_SHOOT_HELI:
m_nChaos += 400.0f*chaos;
break;
case CRIME_PED_BURNED:
m_nChaos += 20.0f*chaos;
break;
case CRIME_COP_BURNED:
m_nChaos += 80.0f*chaos;
break;
case CRIME_VEHICLE_BURNED:
m_nChaos += 20.0f*chaos;
break;
case CRIME_DESTROYED_CESSNA:
m_nChaos += 500.0f*chaos;
break;
default:
// Error("Undefined crime type, RegisterCrime, Crime.cpp"); // different file for some reason
Error("Undefined crime type, RegisterCrime, Wanted.cpp");
}
DMAudio.ReportCrime(type, coors);
UpdateWantedLevel();
}
void
CWanted::UpdateWantedLevel()
{ {
int32 CurrWantedLevel = m_nWantedLevel; int32 CurrWantedLevel = m_nWantedLevel;
if (m_nChaos >= 0 && m_nChaos < 40) { if (m_nChaos >= 0 && m_nChaos < 40) {
m_nWantedLevel = NOTWANTED; m_nWantedLevel = 0;
m_MaximumLawEnforcerVehicles = 0; m_MaximumLawEnforcerVehicles = 0;
m_MaxCops = 0; m_MaxCops = 0;
m_RoadblockDensity = 0; m_RoadblockDensity = 0;
} }
else if (m_nChaos >= 40 && m_nChaos < 200) { else if (m_nChaos >= 40 && m_nChaos < 200) {
m_nWantedLevel = WANTEDLEVEL_1; m_nWantedLevel = 1;
m_MaximumLawEnforcerVehicles = 1; m_MaximumLawEnforcerVehicles = 1;
m_MaxCops = 1; m_MaxCops = 1;
m_RoadblockDensity = 0; m_RoadblockDensity = 0;
} }
else if (m_nChaos >= 200 && m_nChaos < 400) { else if (m_nChaos >= 200 && m_nChaos < 400) {
m_nWantedLevel = WANTEDLEVEL_2; m_nWantedLevel = 2;
m_MaximumLawEnforcerVehicles = 2; m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 3; m_MaxCops = 3;
m_RoadblockDensity = 0; m_RoadblockDensity = 0;
} }
else if (m_nChaos >= 400 && m_nChaos < 800) { else if (m_nChaos >= 400 && m_nChaos < 800) {
m_nWantedLevel = WANTEDLEVEL_3; m_nWantedLevel = 3;
m_MaximumLawEnforcerVehicles = 2; m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 4; m_MaxCops = 4;
m_RoadblockDensity = 4; m_RoadblockDensity = 4;
} }
else if (m_nChaos >= 800 && m_nChaos < 1600) { else if (m_nChaos >= 800 && m_nChaos < 1600) {
m_nWantedLevel = WANTEDLEVEL_4; m_nWantedLevel = 4;
m_MaximumLawEnforcerVehicles = 2; m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 6; m_MaxCops = 6;
m_RoadblockDensity = 8; m_RoadblockDensity = 8;
} }
else if (m_nChaos >= 1600 && m_nChaos < 3200) { else if (m_nChaos >= 1600 && m_nChaos < 3200) {
m_nWantedLevel = WANTEDLEVEL_5; m_nWantedLevel = 5;
m_MaximumLawEnforcerVehicles = 3; m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 8; m_MaxCops = 8;
m_RoadblockDensity = 10; m_RoadblockDensity = 10;
} }
else if (m_nChaos >= 3200) { else if (m_nChaos >= 3200) {
m_nWantedLevel = WANTEDLEVEL_6; m_nWantedLevel = 6;
m_MaximumLawEnforcerVehicles = 3; m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 10; m_MaxCops = 10;
m_RoadblockDensity = 12; m_RoadblockDensity = 12;
@ -133,3 +321,57 @@ void CWanted::UpdateWantedLevel()
if (CurrWantedLevel != m_nWantedLevel) if (CurrWantedLevel != m_nWantedLevel)
m_nLastWantedLevelChange = CTimer::GetTimeInMilliseconds(); m_nLastWantedLevelChange = CTimer::GetTimeInMilliseconds();
} }
int32
CWanted::WorkOutPolicePresence(CVector posn, float radius)
{
int i;
CPed *ped;
CVehicle *vehicle;
int numPolice = 0;
i = CPools::GetPedPool()->GetSize();
while(--i >= 0){
ped = CPools::GetPedPool()->GetSlot(i);
if(ped &&
IsPolicePedModel(ped->GetModelIndex()) &&
(posn - ped->GetPosition()).Magnitude() < radius)
numPolice++;
}
i = CPools::GetVehiclePool()->GetSize();
while(--i >= 0){
vehicle = CPools::GetVehiclePool()->GetSlot(i);
if(vehicle &&
vehicle->bIsLawEnforcer &&
IsPoliceVehicleModel(vehicle->GetModelIndex()) &&
vehicle != FindPlayerVehicle() &&
vehicle->m_status != STATUS_ABANDONED && vehicle->m_status != STATUS_WRECKED &&
(posn - vehicle->GetPosition()).Magnitude() < radius)
numPolice++;
}
return numPolice;
}
STARTPATCHES
InjectHook(0x4AD6E0, &CWanted::Initialise, PATCH_JUMP);
// InjectHook(0x4AD790, &CWanted::Reset, PATCH_JUMP);
// InjectHook(0x4AD7B0, &CWanted::Update, PATCH_JUMP);
InjectHook(0x4AD900, &CWanted::UpdateWantedLevel, PATCH_JUMP);
InjectHook(0x4AD9F0, &CWanted::RegisterCrime, PATCH_JUMP);
InjectHook(0x4ADA10, &CWanted::RegisterCrime_Immediately, PATCH_JUMP);
InjectHook(0x4ADA50, &CWanted::SetWantedLevel, PATCH_JUMP);
InjectHook(0x4ADAC0, &CWanted::SetWantedLevelNoDrop, PATCH_JUMP);
InjectHook(0x4ADAE0, &CWanted::SetMaximumWantedLevel, PATCH_JUMP);
InjectHook(0x4ADBA0, &CWanted::AreSwatRequired, PATCH_JUMP);
InjectHook(0x4ADBC0, &CWanted::AreFbiRequired, PATCH_JUMP);
InjectHook(0x4ADBE0, &CWanted::AreArmyRequired, PATCH_JUMP);
InjectHook(0x4ADC00, &CWanted::NumOfHelisRequired, PATCH_JUMP);
// InjectHook(0x4ADC40, &CWanted::ResetPolicePursuit, PATCH_JUMP);
InjectHook(0x4ADD00, &CWanted::WorkOutPolicePresence, PATCH_JUMP);
InjectHook(0x4ADF20, &CWanted::ClearQdCrimes, PATCH_JUMP);
InjectHook(0x4ADFD0, &CWanted::AddCrimeToQ, PATCH_JUMP);
// InjectHook(0x4AE090, &CWanted::UpdateCrimesQ, PATCH_JUMP);
InjectHook(0x4AE110, &CWanted::ReportCrimeNow, PATCH_JUMP);
ENDPATCHES

View file

@ -1,16 +1,38 @@
#pragma once #pragma once
#include "Entity.h"
#include "math/Vector.h"
#include "CopPed.h"
enum eWantedLevel { class CEntity;
NOTWANTED, class CCopPed;
WANTEDLEVEL_1,
WANTEDLEVEL_2, enum eCrimeType
WANTEDLEVEL_3, {
WANTEDLEVEL_4, CRIME_NONE,
WANTEDLEVEL_5, CRIME_POSSESSION_GUN,
WANTEDLEVEL_6, CRIME_HIT_PED,
CRIME_HIT_COP,
CRIME_SHOOT_PED,
CRIME_SHOOT_COP,
CRIME_STEAL_CAR,
CRIME_RUN_REDLIGHT,
CRIME_RECKLESS_DRIVING,
CRIME_SPEEDING,
CRIME_RUNOVER_PED,
CRIME_RUNOVER_COP,
CRIME_SHOOT_HELI,
CRIME_PED_BURNED,
CRIME_COP_BURNED,
CRIME_VEHICLE_BURNED,
CRIME_DESTROYED_CESSNA,
};
class CCrimeBeingQd
{
public:
eCrimeType m_nType;
uint32 m_nId;
int32 m_nTime;
CVector m_vecPosn;
bool m_bReported;
bool m_bPoliceDoesntCare;
}; };
class CWanted class CWanted
@ -23,28 +45,37 @@ public:
uint8 m_CurrentCops; uint8 m_CurrentCops;
uint8 m_MaxCops; uint8 m_MaxCops;
uint8 m_MaximumLawEnforcerVehicles; uint8 m_MaximumLawEnforcerVehicles;
int8 field_19; uint8 m_CopsBeatingSuspect;
int16 m_RoadblockDensity; int16 m_RoadblockDensity;
uint8 m_IsIgnoredByCops : 1; uint8 m_bIgnoredByCops : 1;
uint8 m_IsIgnoredByEveryOne : 1; uint8 m_bIgnoredByEveryone : 1;
uint8 m_IsSwatRequired : 1; uint8 m_bSwatRequired : 1;
uint8 m_IsFbiRequired : 1; uint8 m_bFbiRequired : 1;
uint8 m_IdArmyRequired : 1; uint8 m_bArmyRequired : 1;
int8 field_23;
int32 m_nWantedLevel; int32 m_nWantedLevel;
CCrime m_sCrimes[16]; CCrimeBeingQd m_aCrimes[16];
CCopPed *m_pCops[10]; CCopPed *m_pCops[10];
static int32 &MaximumWantedLevel; static int32 &MaximumWantedLevel;
static int32 &nMaximumWantedLevel;
public: public:
void Initialise();
bool AreSwatRequired(); bool AreSwatRequired();
bool AreFbiRequired(); bool AreFbiRequired();
bool AreArmyRequired(); bool AreArmyRequired();
int NumOfHelisRequired(); int32 NumOfHelisRequired();
void SetWantedLevel(int32); void SetWantedLevel(int32);
void SetWantedLevelNoDrop(int32 level); void SetWantedLevelNoDrop(int32 level);
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
void ClearQdCrimes(); void ClearQdCrimes();
bool AddCrimeToQ(eCrimeType type, int32 id, const CVector &pos, bool reported, bool policeDoesntCare);
void ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare);
void UpdateWantedLevel(); void UpdateWantedLevel();
static int32 WorkOutPolicePresence(CVector posn, float radius);
static void SetMaximumWantedLevel(int32 level);
}; };
static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); static_assert(sizeof(CWanted) == 0x204, "CWanted: error");

View file

@ -11,11 +11,13 @@
#include "Garages.h" #include "Garages.h"
#include "TempColModels.h" #include "TempColModels.h"
#include "World.h" #include "World.h"
#include "ModelIndices.h"
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60; CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C; CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608; CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64; uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
CColPoint &CWorld::ms_testSpherePoint = *(CColPoint*)0x6E64C0;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61; uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0; CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0;
@ -26,6 +28,8 @@ bool &CWorld::bSecondShift = *(bool*)0x95CD54;
bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C; bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B; bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
void void
CWorld::Add(CEntity *ent) CWorld::Add(CEntity *ent)
{ {
@ -603,12 +607,12 @@ CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short
minY = 0; minY = 0;
int maxX = GetSectorIndexX(centre.x + distance); int maxX = GetSectorIndexX(centre.x + distance);
if (maxX >= 100) if (maxX >= NUMSECTORS_X)
maxX = 100; maxX = NUMSECTORS_X;
int maxY = GetSectorIndexY(centre.y + distance); int maxY = GetSectorIndexY(centre.y + distance);
if (maxY >= 100) if (maxY >= NUMSECTORS_Y)
maxY = 100; maxY = NUMSECTORS_Y;
AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
@ -617,29 +621,158 @@ CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short
for(int curX = minX; curX <= maxX; curX++) { for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY); CSector *sector = GetSector(curX, curY);
if (checkBuildings) { if (checkBuildings) {
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects);
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
} }
if (checkVehicles) { if (checkVehicles) {
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects);
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
} }
if (checkPeds) { if (checkPeds) {
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects);
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
} }
if (checkObjects) { if (checkObjects) {
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects);
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
} }
if (checkDummies) { if (checkDummies) {
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects);
CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
} }
} }
} }
} }
CEntity*
CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity* entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
{
CEntity* foundE = nil;
int minX = GetSectorIndexX(centre.x - distance);
if (minX <= 0)
minX = 0;
int minY = GetSectorIndexY(centre.y - distance);
if (minY <= 0)
minY = 0;
int maxX = GetSectorIndexX(centre.x + distance);
if (maxX >= NUMSECTORS_X)
maxX = NUMSECTORS_X;
int maxY = GetSectorIndexY(centre.y + distance);
if (maxY >= NUMSECTORS_Y)
maxY = NUMSECTORS_Y;
AdvanceCurrentScanCode();
for (int curY = minY; curY <= maxY; curY++) {
for (int curX = minX; curX <= maxX; curX++) {
CSector* sector = GetSector(curX, curY);
if (checkBuildings) {
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
}
if (checkVehicles) {
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
}
if (checkPeds) {
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
}
if (checkObjects) {
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, entityToIgnore, ignoreSomeObjects);
if (foundE)
return foundE;
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, entityToIgnore, ignoreSomeObjects);
if (foundE)
return foundE;
}
if (checkDummies) {
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, entityToIgnore, false);
if (foundE)
return foundE;
}
}
}
return foundE;
}
CEntity*
CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore, bool ignoreSomeObjects)
{
static CColModel sphereCol;
sphereCol.boundingSphere.center.x = 0.0f;
sphereCol.boundingSphere.center.y = 0.0f;
sphereCol.boundingSphere.center.z = 0.0f;
sphereCol.boundingSphere.radius = radius;
sphereCol.boundingBox.min.x = -radius;
sphereCol.boundingBox.min.y = -radius;
sphereCol.boundingBox.min.z = -radius;
sphereCol.boundingBox.max.x = radius;
sphereCol.boundingBox.max.y = radius;
sphereCol.boundingBox.max.z = radius;
sphereCol.numSpheres = 1;
sphereCol.spheres = &sphereCol.boundingSphere;
sphereCol.numLines = 0;
sphereCol.numBoxes = 0;
sphereCol.numTriangles = 0;
sphereCol.ownsCollisionVolumes = false;
CMatrix sphereMat;
sphereMat.SetTranslate(spherePos);
for(CPtrNode *node=list.first; node; node = node->next) {
CEntity *e = (CEntity*)node->item;
if (e->m_scanCode != GetCurrentScanCode()) {
e->m_scanCode = GetCurrentScanCode();
if (e != entityToIgnore && e->bUsesCollision && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
CVector diff = spherePos - e->GetPosition();
float distance = diff.Magnitude();
if (e->GetBoundRadius() + radius > distance) {
CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel();
int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(),
*eCol, &ms_testSpherePoint, nil, nil);
if (collidedSpheres != 0 ||
(e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR &&
e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) {
return e;
}
}
}
}
}
return nil;
}
float float
CWorld::FindGroundZForCoord(float x, float y) CWorld::FindGroundZForCoord(float x, float y)
{ {
@ -790,6 +923,8 @@ STARTPATCHES
InjectHook(0x4B2200, CWorld::FindObjectsInRange, PATCH_JUMP); InjectHook(0x4B2200, CWorld::FindObjectsInRange, PATCH_JUMP);
InjectHook(0x4B2540, CWorld::FindObjectsInRangeSectorList, PATCH_JUMP); InjectHook(0x4B2540, CWorld::FindObjectsInRangeSectorList, PATCH_JUMP);
InjectHook(0x4B4AC0, CWorld::TestSphereAgainstSectorList, PATCH_JUMP);
InjectHook(0x4B4710, CWorld::TestSphereAgainstWorld, PATCH_JUMP);
InjectHook(0x4B3A80, CWorld::FindGroundZForCoord, PATCH_JUMP); InjectHook(0x4B3A80, CWorld::FindGroundZForCoord, PATCH_JUMP);
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP); InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP); InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);

View file

@ -56,6 +56,7 @@ class CWorld
static CPtrList &ms_listMovingEntityPtrs; static CPtrList &ms_listMovingEntityPtrs;
static CSector (*ms_aSectors)[NUMSECTORS_X]; // [NUMSECTORS_Y][NUMSECTORS_X]; static CSector (*ms_aSectors)[NUMSECTORS_X]; // [NUMSECTORS_Y][NUMSECTORS_X];
static uint16 &ms_nCurrentScanCode; static uint16 &ms_nCurrentScanCode;
static CColPoint &ms_testSpherePoint;
public: public:
static uint8 &PlayerInFocus; static uint8 &PlayerInFocus;
@ -94,11 +95,14 @@ public:
static bool GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false); static bool GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
static bool GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects = false); static bool GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
static CEntity* TestSphereAgainstWorld(CVector, float, CEntity*, bool, bool, bool, bool, bool, bool);
static CEntity* TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**); static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
static float FindGroundZForCoord(float x, float y); static float FindGroundZForCoord(float x, float y);
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found); static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found); static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
static void RemoveReferencesToDeletedObject(CEntity*);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); } static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); } static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }

View file

@ -97,11 +97,11 @@ extern void **rwengine;
#define SCREEN_SCALE_AR(a) (a) #define SCREEN_SCALE_AR(a) (a)
#endif #endif
#include "math/maths.h" #include "maths.h"
#include "math/Vector.h" #include "Vector.h"
#include "math/Vector2D.h" #include "Vector2D.h"
#include "math/Matrix.h" #include "Matrix.h"
#include "math/Rect.h" #include "Rect.h"
class CRGBA class CRGBA
{ {
@ -139,7 +139,8 @@ inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x)) #define SQR(x) ((x) * (x))
#define PI M_PI #define PI M_PI
#define TWOPI PI*2 #define TWOPI (PI*2)
#define HALFPI (PI/2)
#define DEGTORAD(x) ((x) * PI / 180.0f) #define DEGTORAD(x) ((x) * PI / 180.0f)
#define RADTODEG(x) ((x) * 180.0f / PI) #define RADTODEG(x) ((x) * 180.0f / PI)
@ -178,6 +179,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define max(a, b) (((a) > (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b))
#define ABS(a) (((a) < 0) ? (-a) : (a))
#define STRINGIFY(x) #x #define STRINGIFY(x) #x

View file

@ -63,6 +63,7 @@ enum Config {
NUMONSCREENTIMERENTRIES = 1, NUMONSCREENTIMERENTRIES = 1,
NUMRADARBLIPS = 32, NUMRADARBLIPS = 32,
NUMPICKUPS = 336, NUMPICKUPS = 336,
NUMEVENTS = 64,
}; };
// We'll use this once we're ready to become independent of the game // We'll use this once we're ready to become independent of the game

View file

@ -295,6 +295,8 @@ void
RenderDebugShit(void) RenderDebugShit(void)
{ {
// CTheScripts::RenderTheScriptDebugLines() // CTheScripts::RenderTheScriptDebugLines()
if(gbShowCollisionLines)
CRenderer::RenderCollisionLines();
} }
void void

View file

@ -27,4 +27,5 @@ void LoadingIslandScreen(const char *levelName);
CSprite2d *LoadSplash(const char *name); CSprite2d *LoadSplash(const char *name);
char *GetLevelSplashScreen(int level); char *GetLevelSplashScreen(int level);
char *GetRandomSplashScreen(void); char *GetRandomSplashScreen(void);
void LittleTest(void);
void ValidateVersion(); void ValidateVersion();

View file

@ -10,6 +10,7 @@
#include "Clock.h" #include "Clock.h"
#include "World.h" #include "World.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "ModelIndices.h"
#include "Streaming.h" #include "Streaming.h"
#include "PathFind.h" #include "PathFind.h"
#include "Boat.h" #include "Boat.h"
@ -58,8 +59,6 @@ mysrand(unsigned int seed)
myrand_seed = seed; myrand_seed = seed;
} }
int gDbgSurf;
void (*DebugMenuProcess)(void); void (*DebugMenuProcess)(void);
void (*DebugMenuRender)(void); void (*DebugMenuRender)(void);
static void stub(void) { } static void stub(void) { }
@ -102,60 +101,43 @@ void ChittyChittyBangBangCheat();
void StrongGripCheat(); void StrongGripCheat();
void NastyLimbsCheat(); void NastyLimbsCheat();
// needs too much stuff for now DebugMenuEntry *carCol1;
#if 0 DebugMenuEntry *carCol2;
void void
spawnCar(int id) SpawnCar(int id)
{ {
CVector playerpos; CVector playerpos;
CStreaming::RequestModel(id, 0); CStreaming::RequestModel(id, 0);
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
if(CStreaming::HasModelLoaded(id)){ if(CStreaming::HasModelLoaded(id)){
FindPlayerCoors(playerpos); playerpos = FindPlayerCoors();
int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false); int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
if(node < 0) if(node < 0)
return; return;
CVehicle *v; CVehicle *v;
if(CModelInfo::IsBoatModel(id)){ if(CModelInfo::IsBoatModel(id))
// CBoat* boat = (CBoat*)CVehicle__new(0x484); return;
// boat = boat->ctor(id, 1); else
// v = (CVehicle*)(boat); v = new CAutomobile(id, RANDOM_VEHICLE);
}else{
// CAutomobile *au = (CAutomobile*)CVehicle__new(0x5A8);
// au = au->ctor(id, 1);
// v = (CVehicle*)au;
}
/*
// unlock doors
FIELD(int, v, 0x224) = 1;
// set player owned
FIELD(uint8, v, 0x1F7) |= 4;
DebugMenuEntrySetAddress(carCol1, &FIELD(uchar, v, 0x19C)); v->bHasBeenOwnedByPlayer = true;
DebugMenuEntrySetAddress(carCol2, &FIELD(uchar, v, 0x19D)); if(carCol1)
//if(id == MODELID_ESPERANTO) DebugMenuEntrySetAddress(carCol1, &v->m_currentColour1);
// FIELD(uchar, v, 0x19C) = 54; if(carCol2)
DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2);
v->matrix.matrix.pos.x = ThePaths.nodes[node].x; v->GetPosition() = ThePaths.m_pathNodes[node].pos;
v->matrix.matrix.pos.y = ThePaths.nodes[node].y; v->GetPosition().z += 4.0f;
v->matrix.matrix.pos.z = ThePaths.nodes[node].z + 4.0f; v->SetOrientation(0.0f, 0.0f, 3.49f);
float x = v->matrix.matrix.pos.x; v->m_status = STATUS_ABANDONED;
float y = v->matrix.matrix.pos.y; v->m_nDoorLock = CARLOCK_UNLOCKED;
float z = v->matrix.matrix.pos.z;
v->matrix.SetRotate(0.0f, 0.0f, 3.49f);
v->matrix.matrix.pos.x += x;
v->matrix.matrix.pos.y += y;
v->matrix.matrix.pos.z += z;
v->bfTypeStatus = v->bfTypeStatus & 7 | 0x20;
FIELD(int, v, 0x224) = 1;
*/
CWorld::Add(v); CWorld::Add(v);
} }
} }
#endif
void static void
FixCar(void) FixCar(void)
{ {
CVehicle *veh = FindPlayerVehicle(); CVehicle *veh = FindPlayerVehicle();
@ -168,6 +150,34 @@ FixCar(void)
((CAutomobile*)veh)->Fix(); ((CAutomobile*)veh)->Fix();
} }
static void
ToggleComedy(void)
{
CVehicle *veh = FindPlayerVehicle();
if(veh == nil)
return;
veh->bComedyControls = !veh->bComedyControls;
}
static void
PlaceOnRoad(void)
{
CVehicle *veh = FindPlayerVehicle();
if(veh == nil)
return;
if(veh->IsCar())
((CAutomobile*)veh)->PlaceOnRoadProperly();
}
static const char *carnames[] = {
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony",
"mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer",
"securica", "banshee", "predator", "bus", "rhino", "barracks", "train", "chopper", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit",
"bellyup", "mrwongs", "mafia", "yardie", "yakuza", "diablos", "columb", "hoods", "airtrain", "deaddodo", "speeder", "reefer", "panlant", "flatbed",
"yankee", "escape", "borgnine", "toyz", "ghost",
};
static std::list<CTweakVar *> TweakVarsList; static std::list<CTweakVar *> TweakVarsList;
static bool bAddTweakVarsNow = false; static bool bAddTweakVarsNow = false;
static const char *pTweakVarsDefaultPath = NULL; static const char *pTweakVarsDefaultPath = NULL;
@ -259,15 +269,48 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat); DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat);
DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat); DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat);
static int spawnCarId = MI_LANDSTAL;
e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_GHOST, carnames);
DebugMenuEntrySetWrap(e, true);
DebugMenuAddCmd("Spawn", "Spawn Car", [](){
if(spawnCarId == MI_TRAIN ||
spawnCarId == MI_CHOPPER ||
spawnCarId == MI_AIRTRAIN ||
spawnCarId == MI_DEADDODO ||
spawnCarId == MI_ESCAPE)
return;
SpawnCar(spawnCarId);
});
static uint8 dummy;
carCol1 = DebugMenuAddVar("Spawn", "First colour", &dummy, nil, 1, 0, 255, nil);
carCol2 = DebugMenuAddVar("Spawn", "Second colour", &dummy, nil, 1, 0, 255, nil);
DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); });
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
DebugMenuAddCmd("Debug", "Fix Car", FixCar); DebugMenuAddCmd("Debug", "Fix Car", FixCar);
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil); DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil); DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil); DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil); DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil); DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil); DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil); DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
DebugMenuAddVar("Debug", "Dbg Surface", &gDbgSurf, nil, 1, 0, 34, nil);
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);

View file

@ -13,11 +13,11 @@
#include "Glass.h" #include "Glass.h"
#include "Clock.h" #include "Clock.h"
#include "Weather.h" #include "Weather.h"
#include "TimeCycle.h" #include "Timecycle.h"
#include "Bridge.h" #include "Bridge.h"
#include "TrafficLights.h" #include "TrafficLights.h"
#include "Coronas.h" #include "Coronas.h"
#include "Pointlights.h" #include "PointLights.h"
#include "Shadows.h" #include "Shadows.h"
#include "Pickups.h" #include "Pickups.h"
#include "SpecialFX.h" #include "SpecialFX.h"
@ -42,7 +42,7 @@ CEntity::CEntity(void)
bUseCollisionRecords = false; bUseCollisionRecords = false;
bWasPostponed = false; bWasPostponed = false;
m_flagB2 = false; bExplosionProof = false;
bIsVisible = true; bIsVisible = true;
bHasCollided = false; bHasCollided = false;
bRenderScorched = false; bRenderScorched = false;
@ -535,7 +535,7 @@ CEntity::ResolveReferences(void)
for(ref = m_pFirstReference; ref->next; ref = ref->next) for(ref = m_pFirstReference; ref->next; ref = ref->next)
; ;
ref->next = CReferences::pEmptyList; ref->next = CReferences::pEmptyList;
CReferences::pEmptyList = ref; CReferences::pEmptyList = m_pFirstReference;
m_pFirstReference = nil; m_pFirstReference = nil;
} }
} }

View file

@ -13,14 +13,11 @@ enum eEntityType
ENTITY_TYPE_PED, ENTITY_TYPE_PED,
ENTITY_TYPE_OBJECT, ENTITY_TYPE_OBJECT,
ENTITY_TYPE_DUMMY, ENTITY_TYPE_DUMMY,
ENTITY_TYPE_6,
ENTITY_TYPE_7,
}; };
enum eEntityStatus enum eEntityStatus
{ {
// from SA MTA! let's hope they didn't change from III STATUS_PLAYER,
STATUS_PLAYER = 0,
STATUS_PLAYER_PLAYBACKFROMBUFFER, STATUS_PLAYER_PLAYBACKFROMBUFFER,
STATUS_SIMPLE, STATUS_SIMPLE,
STATUS_PHYSICS, STATUS_PHYSICS,
@ -32,8 +29,6 @@ enum eEntityStatus
STATUS_PLANE, STATUS_PLANE,
STATUS_PLAYER_REMOTE, STATUS_PLAYER_REMOTE,
STATUS_PLAYER_DISABLED, STATUS_PLAYER_DISABLED,
//STATUS_TRAILER,
//STATUS_SIMPLE_TRAILER
}; };
class CEntity : public CPlaceable class CEntity : public CPlaceable
@ -55,7 +50,7 @@ public:
// flagsB // flagsB
uint32 bWasPostponed : 1; uint32 bWasPostponed : 1;
uint32 m_flagB2 : 1; // explosion proof? uint32 bExplosionProof : 1;
uint32 bIsVisible : 1; uint32 bIsVisible : 1;
uint32 bHasCollided : 1; // uint32 bHasCollided : 1; //
uint32 bRenderScorched : 1; uint32 bRenderScorched : 1;
@ -78,7 +73,7 @@ public:
uint32 bRemoveFromWorld : 1; uint32 bRemoveFromWorld : 1;
uint32 bHasHitWall : 1; uint32 bHasHitWall : 1;
uint32 bImBeingRendered : 1; uint32 bImBeingRendered : 1;
uint32 m_flagD8 : 1; uint32 m_flagD8 : 1; // used by cBuoyancy::ProcessBuoyancy
uint32 bIsSubway : 1; // set when subway, but maybe different meaning? uint32 bIsSubway : 1; // set when subway, but maybe different meaning?
uint32 bDrawLast : 1; uint32 bDrawLast : 1;
uint32 m_flagD40 : 1; uint32 m_flagD40 : 1;
@ -122,6 +117,15 @@ public:
bool IsObject(void) { return m_type == ENTITY_TYPE_OBJECT; } bool IsObject(void) { return m_type == ENTITY_TYPE_OBJECT; }
bool IsDummy(void) { return m_type == ENTITY_TYPE_DUMMY; } bool IsDummy(void) { return m_type == ENTITY_TYPE_DUMMY; }
RpAtomic *GetAtomic(void) {
assert(RwObjectGetType(m_rwObject) == rpATOMIC);
return (RpAtomic*)m_rwObject;
}
RpClump *GetClump(void) {
assert(RwObjectGetType(m_rwObject) == rpCLUMP);
return (RpClump*)m_rwObject;
}
void GetBoundCentre(CVector &out); void GetBoundCentre(CVector &out);
CVector GetBoundCentre(void) { CVector v; GetBoundCentre(v); return v; } CVector GetBoundCentre(void) { CVector v; GetBoundCentre(v); return v; }
float GetBoundRadius(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius; } float GetBoundRadius(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius; }

View file

@ -240,7 +240,6 @@ public:
m_matrix.at.y = 0.0f; m_matrix.at.y = 0.0f;
m_matrix.at.z = 1.0f; m_matrix.at.z = 1.0f;
m_matrix.pos.x = 0.0f; m_matrix.pos.x = 0.0f;
m_matrix.pos.x = 0.0f;
m_matrix.pos.y = 0.0f; m_matrix.pos.y = 0.0f;
m_matrix.pos.z = 0.0f; m_matrix.pos.z = 0.0f;
} }

View file

@ -22,6 +22,7 @@ public:
return *((RwV3d*)this); return *((RwV3d*)this);
} }
#endif #endif
// (0,1,0) means no rotation. So get right vector and its atan
float Heading(void) const { return Atan2(-x, y); } float Heading(void) const { return Atan2(-x, y); }
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); } float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); }
float MagnitudeSqr(void) const { return x*x + y*y + z*z; } float MagnitudeSqr(void) const { return x*x + y*y + z*z; }

View file

@ -315,6 +315,11 @@ enum
MI_TOYZ, MI_TOYZ,
MI_GHOST, MI_GHOST,
// leftovers on PC
MI_MIAMI_RCBARON = 154,
MI_MIAMI_RCRAIDER = 155,
MI_MIAMI_SPARROW = 159,
MI_GRENADE = 170, MI_GRENADE = 170,
MI_AK47, MI_AK47,
MI_BASEBALL_BAT, MI_BASEBALL_BAT,
@ -465,3 +470,21 @@ IsPickupModel(int16 id)
id == MI_PICKUP_KILLFRENZY || id == MI_PICKUP_KILLFRENZY ||
id == MI_PICKUP_CAMERA; id == MI_PICKUP_CAMERA;
} }
inline bool
IsPolicePedModel(int16 id)
{
return id == MI_COP ||
id == MI_SWAT ||
id == MI_FBI ||
id == MI_ARMY;
}
inline bool
IsPoliceVehicleModel(int16 id)
{
return id == MI_CHOPPER ||
id == MI_PREDATOR ||
id == MI_POLICE ||
id == MI_ENFORCER;
}

View file

@ -175,6 +175,13 @@ CModelInfo::IsBoatModel(int32 id)
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT; ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT;
} }
bool
CModelInfo::IsBikeModel(int32 id)
{
return GetModelInfo(id)->m_type == MITYPE_VEHICLE &&
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE;
}
void void
CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level) CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
{ {

View file

@ -36,5 +36,6 @@ public:
} }
static bool IsBoatModel(int32 id); static bool IsBoatModel(int32 id);
static bool IsBikeModel(int32 id);
static void RemoveColModelsFromOtherLevels(eLevelName level); static void RemoveColModelsFromOtherLevels(eLevelName level);
}; };

View file

@ -1,5 +1,6 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "Ped.h"
#include "NodeName.h" #include "NodeName.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "ModelInfo.h" #include "ModelInfo.h"
@ -14,7 +15,7 @@ CPedModelInfo::DeleteRwObject(void)
} }
RwObjectNameIdAssocation CPedModelInfo::m_pPedIds[12] = { RwObjectNameIdAssocation CPedModelInfo::m_pPedIds[12] = {
{ "Smid", PED_TORSO, 0, }, // that is strange... { "Smid", PED_MID, 0, }, // that is strange...
{ "Shead", PED_HEAD, 0, }, { "Shead", PED_HEAD, 0, },
{ "Supperarml", PED_UPPERARML, 0, }, { "Supperarml", PED_UPPERARML, 0, },
{ "Supperarmr", PED_UPPERARMR, 0, }, { "Supperarmr", PED_UPPERARMR, 0, },
@ -109,17 +110,16 @@ struct ColNodeInfo
float radius; float radius;
}; };
// TODO: find out piece types
#define NUMPEDINFONODES 8 #define NUMPEDINFONODES 8
ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = { ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = {
{ nil, PED_HEAD, 6, 0.0f, 0.05f, 0.2f }, { nil, PED_HEAD, PEDPIECE_HEAD, 0.0f, 0.05f, 0.2f },
{ "Storso", 0, 0, 0.0f, 0.15f, 0.2f }, { "Storso", 0, PEDPIECE_TORSO, 0.0f, 0.15f, 0.2f },
{ "Storso", 0, 0, 0.0f, -0.05f, 0.3f }, { "Storso", 0, PEDPIECE_TORSO, 0.0f, -0.05f, 0.3f },
{ nil, PED_TORSO, 1, 0.0f, -0.07f, 0.3f }, { nil, PED_MID, PEDPIECE_MID, 0.0f, -0.07f, 0.3f },
{ nil, PED_UPPERARML, 2, 0.07f, -0.1f, 0.2f }, { nil, PED_UPPERARML, PEDPIECE_LEFTARM, 0.07f, -0.1f, 0.2f },
{ nil, PED_UPPERARMR, 3, -0.07f, -0.1f, 0.2f }, { nil, PED_UPPERARMR, PEDPIECE_RIGHTARM, -0.07f, -0.1f, 0.2f },
{ "Slowerlegl", 0, 4, 0.0f, 0.07f, 0.25f }, { "Slowerlegl", 0, PEDPIECE_LEFTLEG, 0.0f, 0.07f, 0.25f },
{ nil, PED_LOWERLEGR, 5, 0.0f, 0.07f, 0.25f }, { nil, PED_LOWERLEGR, PEDPIECE_RIGHTLEG, 0.0f, 0.07f, 0.25f },
}; };
RwObject* RwObject*

View file

@ -3,8 +3,8 @@
#include "ClumpModelInfo.h" #include "ClumpModelInfo.h"
enum PedNode { enum PedNode {
PED_WAIST, PED_TORSO,
PED_TORSO, // Smid on PS2/PC, Storso on mobile/xbox PED_MID, // Smid on PS2/PC, Storso on mobile/xbox
PED_HEAD, PED_HEAD,
PED_UPPERARML, PED_UPPERARML,
PED_UPPERARMR, PED_UPPERARMR,

View file

@ -93,7 +93,7 @@ CObjectData::SetObjectData(int32 modelId, CObject &object)
if(object.m_fMass >= 99998.0){ if(object.m_fMass >= 99998.0){
object.bInfiniteMass = true; object.bInfiniteMass = true;
object.bAffectedByGravity = false; object.bAffectedByGravity = false;
object.m_flagB2 = true; object.bExplosionProof = true;
} }
} }

View file

@ -1,18 +1,41 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "CivilianPed.h" #include "CivilianPed.h"
#include "Phones.h"
WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); } WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); }
CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype) CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
{ {
CPed::SetModelIndex(mi); SetModelIndex(mi);
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
m_nearPeds[i] = nil; m_nearPeds[i] = nil;
} }
} }
bool
CCivilianPed::ProcessNearestFreePhone(int unused)
{
if (m_nPedState == PED_SEEK_POS)
return false;
int phoneId = gPhoneInfo.FindNearestFreePhone(&GetPosition());
if (phoneId == -1)
return false;
if (gPhoneInfo.m_aPhones[phoneId].m_nState != PHONE_STATE_FREE)
return false;
field_31C = 1;
SetMoveState(PEDMOVE_RUN);
SetSeek(gPhoneInfo.m_aPhones[phoneId].m_vecPos, 0.3f);
m_phoneId = phoneId;
m_lookingForPhone = unused;
return true;
}
class CCivilianPed_ : public CCivilianPed class CCivilianPed_ : public CCivilianPed
{ {
public: public:
@ -23,4 +46,5 @@ public:
STARTPATCHES STARTPATCHES
InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP); InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP);
InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP); InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP);
InjectHook(0x4C10C0, &CCivilianPed::ProcessNearestFreePhone, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -9,5 +9,6 @@ public:
~CCivilianPed(void) { } ~CCivilianPed(void) { }
void ProcessControl(void); void ProcessControl(void);
bool ProcessNearestFreePhone(int);
}; };
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error"); static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error");

View file

@ -1,6 +1,64 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "CopPed.h" #include "CopPed.h"
#include "ModelIndices.h"
WRAPPER void CCopPed::ProcessControl() { EAXJMP(0x4C1400); }
CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
{
m_nCopType = copType;
switch (copType) {
case COP_STREET:
SetModelIndex(MI_COP);
GiveWeapon(WEAPONTYPE_COLT45, 1000);
m_currentWeapon = WEAPONTYPE_UNARMED;
m_fArmour = 0.0f;
m_wepSkills = 208; /* TODO: what is this? seems unused */
m_wepAccuracy = 60;
break;
case COP_FBI:
SetModelIndex(MI_FBI);
GiveWeapon(WEAPONTYPE_COLT45, 1000);
GiveWeapon(WEAPONTYPE_AK47, 1000);
SetCurrentWeapon(WEAPONTYPE_AK47);
m_fArmour = 100.0f;
m_wepSkills = 176; /* TODO: what is this? seems unused */
m_wepAccuracy = 76;
break;
case COP_SWAT:
SetModelIndex(MI_SWAT);
GiveWeapon(WEAPONTYPE_COLT45, 1000);
GiveWeapon(WEAPONTYPE_UZI, 1000);
SetCurrentWeapon(WEAPONTYPE_UZI);
m_fArmour = 50.0f;
m_wepSkills = 32; /* TODO: what is this? seems unused */
m_wepAccuracy = 64;
break;
case COP_ARMY:
SetModelIndex(MI_ARMY);
GiveWeapon(WEAPONTYPE_COLT45, 1000);
GiveWeapon(WEAPONTYPE_M16, 1000);
GiveWeapon(WEAPONTYPE_GRENADE, 10);
SetCurrentWeapon(WEAPONTYPE_M16);
m_fArmour = 100.0f;
m_wepSkills = 32; /* TODO: what is this? seems unused */
m_wepAccuracy = 84;
break;
default:
break;
}
m_bIsInPursuit = false;
field_1350 = 1;
m_bIsDisabledCop = false;
field_1356 = 0;
m_attackTimer = 0;
field_1351 = 0;
m_bZoneDisabledButClose = false;
m_bZoneDisabled = false;
field_1364 = -1;
m_pPointGunAt = nil;
}
CCopPed::~CCopPed() CCopPed::~CCopPed()
{ {
@ -12,9 +70,11 @@ WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
class CCopPed_ : public CCopPed class CCopPed_ : public CCopPed
{ {
public: public:
CCopPed *ctor(eCopType type) { return ::new (this) CCopPed(type); };
void dtor(void) { CCopPed::~CCopPed(); } void dtor(void) { CCopPed::~CCopPed(); }
}; };
STARTPATCHES STARTPATCHES
InjectHook(0x4C11B0, &CCopPed_::ctor, PATCH_JUMP);
InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP); InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -1,27 +1,6 @@
#pragma once #pragma once
#include "Ped.h" #include "Ped.h"
enum eCrimeType
{
CRIME_NONE,
CRIME_POSSESSION_GUN,
CRIME_HIT_PED,
CRIME_HIT_COP,
CRIME_SHOOT_PED,
CRIME_SHOOT_COP,
CRIME_STEAL_CAR,
CRIME_RUN_REDLIGHT,
CRIME_RECKLESS_DRIVING,
CRIME_SPEEDING,
CRIME_RUNOVER_PED,
CRIME_RUNOVER_COP,
CRIME_SHOOT_HELI,
CRIME_PED_BURNED,
CRIME_COP_BURNED,
CRIME_VEHICLE_BURNED,
CRIME_DESTROYED_CESSNA,
};
enum eCopType enum eCopType
{ {
COP_STREET = 0, COP_STREET = 0,
@ -30,18 +9,6 @@ enum eCopType
COP_ARMY = 3, COP_ARMY = 3,
}; };
class CCrime
{
public:
eCrimeType m_eCrimeType;
CEntity *m_pVictim;
int32 m_nCrimeTime;
CVector m_vecCrimePos;
int8 m_bReported;
int8 m_bMultiplier;
int8 pad_20[2];
};
class CCopPed : public CPed class CCopPed : public CPed
{ {
public: public:
@ -64,9 +31,11 @@ public:
int8 field_1366; int8 field_1366;
int8 field_1367; int8 field_1367;
CCopPed(eCopType);
~CCopPed(); ~CCopPed();
void ClearPursuit(void); void ClearPursuit(void);
void ProcessControl(void);
}; };
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error"); static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");

View file

@ -1,13 +1,38 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "EmergencyPed.h" #include "EmergencyPed.h"
#include "ModelIndices.h"
class CEmergencyPed_ : public CEmergencyPed class CEmergencyPed_ : public CEmergencyPed
{ {
public: public:
CEmergencyPed *ctor(int pedtype) { return ::new (this) CEmergencyPed(pedtype); };
void dtor(void) { CEmergencyPed::~CEmergencyPed(); } void dtor(void) { CEmergencyPed::~CEmergencyPed(); }
}; };
WRAPPER void CEmergencyPed::ProcessControl(void) { EAXJMP(0x4C2F10); }
CEmergencyPed::CEmergencyPed(uint32 type) : CPed(type)
{
switch (type){
case PEDTYPE_EMERGENCY:
SetModelIndex(MI_MEDIC);
m_pRevivedPed = nil;
field_1360 = 0;
break;
case PEDTYPE_FIREMAN:
SetModelIndex(MI_FIREMAN);
m_pRevivedPed = nil;
break;
default:
break;
}
m_nEmergencyPedState = 0;
m_pAttendedAccident = nil;
field_1356 = 0;
}
STARTPATCHES STARTPATCHES
InjectHook(0x4C2E40, &CEmergencyPed_::ctor, PATCH_JUMP);
InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP); InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -1,11 +1,20 @@
#pragma once #pragma once
#include "Fire.h"
#include "Ped.h" #include "Ped.h"
class CEmergencyPed : public CPed class CEmergencyPed : public CPed
{ {
public: public:
// 0x53C // 0x53C
uint8 stuff[24]; CPed* m_pRevivedPed;
int32 m_nEmergencyPedState; // looks like flags
void* m_pAttendedAccident; //TODO: CAccident*
CFire* m_pAttendedFire;
int8 field_1356;
int32 field_1360;
CEmergencyPed(uint32);
void ProcessControl(void);
}; };
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error"); static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");

File diff suppressed because it is too large Load diff

View file

@ -13,6 +13,17 @@
struct CPathNode; struct CPathNode;
enum ePedPieceTypes
{
PEDPIECE_TORSO,
PEDPIECE_MID,
PEDPIECE_LEFTARM,
PEDPIECE_RIGHTARM,
PEDPIECE_LEFTLEG,
PEDPIECE_RIGHTLEG,
PEDPIECE_HEAD,
};
enum eWaitState { enum eWaitState {
WAITSTATE_FALSE, WAITSTATE_FALSE,
WAITSTATE_TRAFFIC_LIGHTS, WAITSTATE_TRAFFIC_LIGHTS,
@ -196,28 +207,28 @@ public:
uint8 m_ped_flagC1 : 1; uint8 m_ped_flagC1 : 1;
uint8 bRespondsToThreats : 1; uint8 bRespondsToThreats : 1;
uint8 m_ped_flagC4 : 1; // false when in bus, bRenderPedInCar? uint8 bRenderPedInCar : 1;
uint8 m_ped_flagC8 : 1; uint8 bChangedSeat : 1;
uint8 m_ped_flagC10 : 1; uint8 m_ped_flagC10 : 1; // related with phone
uint8 m_ped_flagC20 : 1; // just left some body part? uint8 bBodyPartJustCameOff : 1;
uint8 m_ped_flagC40 : 1; uint8 m_ped_flagC40 : 1;
uint8 m_ped_flagC80 : 1; uint8 m_ped_flagC80 : 1;
uint8 m_ped_flagD1 : 1; uint8 m_ped_flagD1 : 1;
uint8 m_ped_flagD2 : 1; uint8 m_ped_flagD2 : 1; // seen an event
uint8 m_ped_flagD4 : 1; uint8 m_ped_flagD4 : 1;
uint8 m_ped_flagD8 : 1; uint8 m_ped_flagD8 : 1;
uint8 m_ped_flagD10 : 1; uint8 bIsPedDieAnimPlaying : 1;
uint8 m_ped_flagD20 : 1; uint8 m_ped_flagD20 : 1;
uint8 m_ped_flagD40 : 1; // reset when objective changes uint8 m_ped_flagD40 : 1; // reset when objective changes
uint8 m_ped_flagD80 : 1; uint8 m_bScriptObjectiveCompleted : 1;
uint8 m_ped_flagE1 : 1; uint8 m_ped_flagE1 : 1;
uint8 m_ped_flagE2 : 1; uint8 m_ped_flagE2 : 1;
uint8 bNotAllowedToDuck : 1; uint8 bNotAllowedToDuck : 1;
uint8 bCrouchWhenShooting : 1; uint8 bCrouchWhenShooting : 1;
uint8 bIsDucking : 1; // set if you don't want ped to attack uint8 bIsDucking : 1; // set if you don't want ped to attack
uint8 m_ped_flagE20 : 1; uint8 m_ped_flagE20 : 1; // getup complete?
uint8 bDoBloodyFootprints : 1; uint8 bDoBloodyFootprints : 1;
uint8 m_ped_flagE80 : 1; uint8 m_ped_flagE80 : 1;
@ -225,7 +236,7 @@ public:
uint8 m_ped_flagF2 : 1; uint8 m_ped_flagF2 : 1;
uint8 m_ped_flagF4 : 1; uint8 m_ped_flagF4 : 1;
uint8 m_ped_flagF8 : 1; uint8 m_ped_flagF8 : 1;
uint8 m_ped_flagF10 : 1; uint8 m_ped_flagF10 : 1; // set before "quickjack"
uint8 m_ped_flagF20 : 1; uint8 m_ped_flagF20 : 1;
uint8 m_ped_flagF40 : 1; uint8 m_ped_flagF40 : 1;
uint8 m_ped_flagF80 : 1; uint8 m_ped_flagF80 : 1;
@ -249,7 +260,7 @@ public:
uint8 m_ped_flagH80 : 1; uint8 m_ped_flagH80 : 1;
uint8 m_ped_flagI1 : 1; uint8 m_ped_flagI1 : 1;
uint8 m_ped_flagI2 : 1; uint8 m_ped_flagI2 : 1; // if set, limbs won't came off
uint8 m_ped_flagI4 : 1; uint8 m_ped_flagI4 : 1;
uint8 bHasAlreadyBeenRecorded : 1; uint8 bHasAlreadyBeenRecorded : 1;
uint8 m_ped_flagI10 : 1; uint8 m_ped_flagI10 : 1;
@ -325,10 +336,10 @@ public:
bool bInVehicle; bool bInVehicle;
uint8 pad_315[3]; uint8 pad_315[3];
float field_318; float field_318;
uint8 field_31C; uint8 field_31C; // may be cutscene or phone cutscene status
uint8 field_31D; uint8 field_31D;
int16 m_phoneId; int16 m_phoneId;
uint32 m_lookingForPhone; uint32 m_lookingForPhone; // unused
uint32 m_phoneTalkTimer; uint32 m_phoneTalkTimer;
void *m_lastAccident; void *m_lastAccident;
int32 m_nPedType; int32 m_nPedType;
@ -416,8 +427,8 @@ public:
void SetDie(AnimationId anim, float arg1, float arg2); void SetDie(AnimationId anim, float arg1, float arg2);
void SetDead(void); void SetDead(void);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, int8 unknown); void RemoveBodyPart(PedNode nodeId, int8 direction);
void SpawnFlyingComponent(int, int8 unknown); void SpawnFlyingComponent(int, int8);
bool OurPedCanSeeThisOne(CEntity *target); bool OurPedCanSeeThisOne(CEntity *target);
void Avoid(void); void Avoid(void);
void Attack(void); void Attack(void);
@ -459,7 +470,39 @@ public:
void Chat(void); void Chat(void);
void MakeChangesForNewWeapon(int8); void MakeChangesForNewWeapon(int8);
void CheckAroundForPossibleCollisions(void); void CheckAroundForPossibleCollisions(void);
void SetSeek(CVector, float);
bool MakePhonecall(void);
bool FacePhone(void);
CPed *CheckForDeadPeds(void);
bool CheckForExplosions(CVector2D &area);
CPed *CheckForGunShots(void);
uint8 CheckForPointBlankPeds(CPed*);
bool CheckIfInTheAir(void);
void ClearAll(void);
void SetPointGunAt(CEntity*);
bool Seek(void); bool Seek(void);
bool SetWanderPath(int8);
void SetFollowPath(CVector);
void ClearAttackByRemovingAnim(void);
void SetStoredState(void);
void StopNonPartialAnims(void);
bool InflictDamage(CEntity*, eWeaponType, float, ePedPieceTypes, uint8);
void ClearFlee(void);
void ClearFall(void);
void SetGetUp(void);
void ClearInvestigateEvent(void);
void ClearLeader(void);
void ClearLook(void);
void ClearObjective(void);
void ClearPause(void);
void ClearSeek(void);
void ClearWeapons(void);
void RestoreGunPosition(void);
void RestoreHeadingRate(void);
void SetAimFlag(CEntity* to);
void SetAimFlag(float angle);
void SetAmmo(eWeaponType weaponType, uint32 ammo);
void SetEvasiveStep(CEntity*, uint8);
// Static methods // Static methods
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset); static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
@ -533,6 +576,7 @@ public:
static bool &bNastyLimbsCheat; static bool &bNastyLimbsCheat;
static bool &bPedCheat2; static bool &bPedCheat2;
static bool &bPedCheat3; static bool &bPedCheat3;
static CColPoint &ms_tempColPoint;
}; };
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg); void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);

View file

@ -8,6 +8,8 @@ WRAPPER bool CPedIK::PointGunAtPosition(CVector *position) { EAXJMP(0x4ED920); }
WRAPPER void CPedIK::ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED2C0); } WRAPPER void CPedIK::ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED2C0); }
WRAPPER void CPedIK::ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED140); } WRAPPER void CPedIK::ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED140); }
LimbMovementInfo &CPedIK::ms_torsoInfo = *(LimbMovementInfo*)0x5F9F8C;
CPedIK::CPedIK(CPed *ped) CPedIK::CPedIK(CPed *ped)
{ {
m_ped = ped; m_ped = ped;
@ -102,8 +104,61 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination)
return destination; return destination;
} }
// A helper function that adjusts "limb" parameter according to limitations. Doesn't move the limb.
int8
CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo)
{
int result = 1;
// phi
if (limb.phi > approxPhi) {
limb.phi -= moveInfo.yawD;
} else if (limb.phi < approxPhi) {
limb.phi += moveInfo.yawD;
}
if (Abs(limb.phi - approxPhi) < moveInfo.yawD) {
limb.phi = approxPhi;
result = 2;
}
if (limb.phi > moveInfo.maxYaw || limb.phi < moveInfo.minYaw) {
limb.phi = clamp(limb.phi, moveInfo.minYaw, moveInfo.maxYaw);
result = 0;
}
// theta
if (limb.theta > approxTheta) {
limb.theta -= moveInfo.pitchD;
} else if (limb.theta < approxTheta) {
limb.theta += moveInfo.pitchD;
}
if (Abs(limb.theta - approxTheta) < moveInfo.pitchD)
limb.theta = approxTheta;
else
result = 1;
if (limb.theta > moveInfo.maxPitch || limb.theta < moveInfo.minPitch) {
limb.theta = clamp(limb.theta, moveInfo.minPitch, moveInfo.maxPitch);
result = 0;
}
return result;
}
bool
CPedIK::RestoreGunPosn(void)
{
int limbStatus = MoveLimb(m_torsoOrient, 0.0f, 0.0f, ms_torsoInfo);
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, false);
return limbStatus == 2;
}
STARTPATCHES STARTPATCHES
InjectHook(0x4ED0F0, &CPedIK::GetComponentPosition, PATCH_JUMP); InjectHook(0x4ED0F0, &CPedIK::GetComponentPosition, PATCH_JUMP);
InjectHook(0x4ED060, &CPedIK::GetWorldMatrix, PATCH_JUMP); InjectHook(0x4ED060, &CPedIK::GetWorldMatrix, PATCH_JUMP);
InjectHook(0x4EDDB0, &CPedIK::RotateTorso, PATCH_JUMP); InjectHook(0x4EDDB0, &CPedIK::RotateTorso, PATCH_JUMP);
InjectHook(0x4ED440, &CPedIK::MoveLimb, PATCH_JUMP);
InjectHook(0x4EDD70, &CPedIK::RestoreGunPosn, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -9,6 +9,15 @@ struct LimbOrientation
float theta; float theta;
}; };
struct LimbMovementInfo {
float maxYaw;
float minYaw;
float yawD;
float maxPitch;
float minPitch;
float pitchD;
};
class CPed; class CPed;
class CPedIK class CPedIK
@ -28,6 +37,8 @@ public:
LimbOrientation m_lowerArmOrient; LimbOrientation m_lowerArmOrient;
int32 m_flags; int32 m_flags;
static LimbMovementInfo &ms_torsoInfo;
CPedIK(CPed *ped); CPedIK(CPed *ped);
bool PointGunInDirection(float phi, float theta); bool PointGunInDirection(float phi, float theta);
bool PointGunAtPosition(CVector *position); bool PointGunAtPosition(CVector *position);
@ -36,5 +47,7 @@ public:
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll); void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
void ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*); void ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*);
void ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*); void ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*);
int8 MoveLimb(LimbOrientation &a1, float a2, float a3, LimbMovementInfo &a4);
bool RestoreGunPosn(void);
}; };
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error"); static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");

View file

@ -35,6 +35,13 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
pos->z = 1.04f + zForPed; pos->z = 1.04f + zForPed;
} }
CEntity*
CPedPlacement::IsPositionClearOfCars(CVector* pos)
{
return CWorld::TestSphereAgainstWorld(*pos, 0.25f, false, true, true, false, false, false, false);
}
STARTPATCHES STARTPATCHES
InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP); InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP);
InjectHook(0x4EE310, &CPedPlacement::IsPositionClearOfCars, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
class CVector; class CVector;
class CEntity;
class CPedPlacement { class CPedPlacement {
public: public:
static void FindZCoorForPed(CVector* pos); static void FindZCoorForPed(CVector* pos);
static CEntity* IsPositionClearOfCars(CVector*);
}; };

View file

@ -13,6 +13,8 @@ WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
WRAPPER void CPlayerPed::SetupPlayerPed(int32) { EAXJMP(0x4EFB60); } WRAPPER void CPlayerPed::SetupPlayerPed(int32) { EAXJMP(0x4EFB60); }
WRAPPER void CPlayerPed::DeactivatePlayerPed(int32) { EAXJMP(0x4EFC00); } WRAPPER void CPlayerPed::DeactivatePlayerPed(int32) { EAXJMP(0x4EFC00); }
WRAPPER void CPlayerPed::ReactivatePlayerPed(int32) { EAXJMP(0x4EFC20); } WRAPPER void CPlayerPed::ReactivatePlayerPed(int32) { EAXJMP(0x4EFC20); }
WRAPPER void CPlayerPed::KeepAreaAroundPlayerClear(void) { EAXJMP(0x4F3460); }
void CPlayerPed::ClearWeaponTarget() void CPlayerPed::ClearWeaponTarget()
{ {
@ -36,6 +38,22 @@ CPlayerPed::SetWantedLevelNoDrop(int32 level)
m_pWanted->SetWantedLevelNoDrop(level); m_pWanted->SetWantedLevelNoDrop(level);
} }
// I don't know the actual purpose of parameter
void
CPlayerPed::AnnoyPlayerPed(bool itsPolice)
{
if (m_pedStats->m_temper < 52) {
m_pedStats->m_temper++;
} else {
if (itsPolice) {
if (m_pedStats->m_temper < 55) {
m_pedStats->m_temper++;
} else {
m_pedStats->m_temper = 46;
}
}
}
}
class CPlayerPed_ : public CPlayerPed class CPlayerPed_ : public CPlayerPed
{ {
@ -46,4 +64,5 @@ public:
STARTPATCHES STARTPATCHES
InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP); InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP); InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -29,7 +29,7 @@ public:
bool m_bHasLockOnTarget; bool m_bHasLockOnTarget;
int8 field_1406; int8 field_1406;
int8 field_1407; int8 field_1407;
bool m_bAdrenalineTime; uint32 m_bAdrenalineTime;
bool m_bCanBeDamaged; bool m_bCanBeDamaged;
int8 field_1413; int8 field_1413;
int8 field_1414; int8 field_1414;
@ -45,6 +45,8 @@ public:
void ClearWeaponTarget(); void ClearWeaponTarget();
void SetWantedLevel(int32 level); void SetWantedLevel(int32 level);
void SetWantedLevelNoDrop(int32 level); void SetWantedLevelNoDrop(int32 level);
void KeepAreaAroundPlayerClear(void);
void AnnoyPlayerPed(bool);
static void SetupPlayerPed(int32); static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32); static void DeactivatePlayerPed(int32);

View file

@ -2,9 +2,12 @@
enum eAspectRatio enum eAspectRatio
{ {
AR_AUTO, // Make sure these work the same as FrontEndMenuManager.m_PrefsUseWideScreen
// without widescreen support
AR_4_3, AR_4_3,
AR_16_9, AR_16_9,
AR_AUTO,
}; };
class CDraw class CDraw

View file

@ -1,5 +1,830 @@
#include "common.h" #include "common.h"
#include "main.h"
#include "patcher.h" #include "patcher.h"
#include "Fluff.h" #include "Fluff.h"
#include "Camera.h"
#include "Sprite.h"
#include "Coronas.h"
#include "General.h"
#include "Timer.h"
#include "Clock.h"
#include "Weather.h"
#include "Stats.h"
#include "math/maths.h"
#include "Frontend.h"
WRAPPER void CMovingThings::Render(void) { EAXJMP(0x4FF210); } uint8 ScrollCharSet[59][5] = {
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // ' '
{ 0x00, 0x00, 0x1D, 0x00, 0x00 }, // '!'
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // '"'
{ 0x0A, 0x1F, 0x0A, 0x1F, 0x0A }, // '#'
{ 0x00, 0x09, 0x1F, 0x12, 0x00 }, // '$'
{ 0x18, 0x18, 0x00, 0x03, 0x03 }, // '%'
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // '&'
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // '''
{ 0x01, 0x02, 0x04, 0x08, 0x10 }, // '('
{ 0x00, 0x00, 0x18, 0x00, 0x00 }, // ')'
{ 0x15, 0x04, 0x1F, 0x04, 0x15 }, // '*'
{ 0x00, 0x04, 0x0E, 0x04, 0x00 }, // '+'
{ 0x00, 0x00, 0x03, 0x00, 0x00 }, // ','
{ 0x00, 0x04, 0x04, 0x04, 0x00 }, // '-'
{ 0x00, 0x00, 0x01, 0x00, 0x00 }, // '.'
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // '/'
{ 0x0E, 0x11, 0x11, 0x11, 0x0E }, // '0'
{ 0x01, 0x09, 0x1F, 0x01, 0x01 }, // '1'
{ 0x03, 0x15, 0x15, 0x15, 0x09 }, // '2'
{ 0x11, 0x11, 0x15, 0x15, 0x0A }, // '3'
{ 0x02, 0x06, 0x0A, 0x1F, 0x02 }, // '4'
{ 0x1D, 0x15, 0x15, 0x15, 0x12 }, // '5'
{ 0x0E, 0x15, 0x15, 0x15, 0x12 }, // '6'
{ 0x18, 0x10, 0x13, 0x14, 0x18 }, // '7'
{ 0x0A, 0x15, 0x15, 0x15, 0x0A }, // '8'
{ 0x08, 0x15, 0x15, 0x15, 0x0E }, // '9'
{ 0x00, 0x00, 0x0A, 0x00, 0x00 }, // ':'
{ 0x18, 0x18, 0x00, 0x03, 0x03 }, // ';'
{ 0x04, 0x08, 0x1F, 0x08, 0x04 }, // '<'
{ 0x00, 0x0A, 0x0A, 0x0A, 0x00 }, // '='
{ 0x04, 0x02, 0x1F, 0x02, 0x04 }, // '>'
{ 0x10, 0x10, 0x15, 0x14, 0x1D }, // '?'
{ 0x00, 0x1C, 0x14, 0x1C, 0x00 }, // '@'
{ 0x0F, 0x12, 0x12, 0x12, 0x0F }, // 'A'
{ 0x1F, 0x15, 0x15, 0x15, 0x0A }, // 'B'
{ 0x0E, 0x11, 0x11, 0x11, 0x0A }, // 'C'
{ 0x1F, 0x11, 0x11, 0x11, 0x0E }, // 'D'
{ 0x1F, 0x15, 0x15, 0x11, 0x11 }, // 'E'
{ 0x1F, 0x14, 0x14, 0x10, 0x10 }, // 'F'
{ 0x0E, 0x11, 0x15, 0x15, 0x06 }, // 'G'
{ 0x1F, 0x04, 0x04, 0x04, 0x1F }, // 'H'
{ 0x11, 0x11, 0x1F, 0x11, 0x11 }, // 'I'
{ 0x02, 0x01, 0x01, 0x01, 0x1E }, // 'J'
{ 0x1F, 0x04, 0x0C, 0x12, 0x01 }, // 'K'
{ 0x1F, 0x01, 0x01, 0x01, 0x01 }, // 'L'
{ 0x1F, 0x08, 0x06, 0x08, 0x1F }, // 'M'
{ 0x1F, 0x08, 0x04, 0x02, 0x1F }, // 'N'
{ 0x0E, 0x11, 0x11, 0x11, 0x0E }, // 'O'
{ 0x1F, 0x12, 0x12, 0x12, 0x0C }, // 'P'
{ 0x0C, 0x12, 0x12, 0x13, 0x0D }, // 'Q'
{ 0x1F, 0x14, 0x14, 0x16, 0x09 }, // 'R'
{ 0x09, 0x15, 0x15, 0x15, 0x02 }, // 'S'
{ 0x10, 0x10, 0x1F, 0x10, 0x10 }, // 'T'
{ 0x1E, 0x01, 0x01, 0x01, 0x1E }, // 'U'
{ 0x1C, 0x02, 0x01, 0x02, 0x1C }, // 'V'
{ 0x1E, 0x01, 0x06, 0x01, 0x1E }, // 'W'
{ 0x11, 0x0A, 0x04, 0x0A, 0x11 }, // 'X'
{ 0x18, 0x04, 0x03, 0x04, 0x18 }, // 'Y'
{ 0x11, 0x13, 0x15, 0x19, 0x11 } // 'Z'
};
// ---------- CMovingThings ----------
enum eScrollBarTypes
{
SCROLL_BUSINESS,
SCROLL_TRAFFIC,
SCROLL_ENTERTAINMENT,
SCROLL_AIRPORT_DOORS,
SCROLL_AIRPORT_FRONT,
SCROLL_STORE,
SCROLL_USED_CARS
};
CScrollBar aScrollBars[11];
CTowerClock aTowerClocks[2];
CDigitalClock aDigitalClocks[3];
void CMovingThings::Init()
{
/*
* Some unused code about CMovingThing was here...
*/
// Initialize scroll bars
aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0, 0.5, 0.5, 255, 128, 0, 0.3);
aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0, 0.5, 0.25, 128, 255, 0, 0.3);
aScrollBars[2].Init(CVector(-1089.61f, -584.224f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 0, 0, 0.11);
aScrollBars[3].Init(CVector(-1089.61f, -602.04602f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 0, 255, 0, 0.11);
aScrollBars[4].Init(CVector(-1089.61f, -619.81702f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 128, 0, 0.11);
aScrollBars[5].Init(CVector(-754.578f, -633.50897f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3);
aScrollBars[6].Init(CVector( -754.578f, -586.672f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3);
aScrollBars[7].Init(CVector( 85.473f, -1069.512f, 30.5f ), SCROLL_STORE, 0.625, -0.3125, 0.727, 100, 100, 255, 0.5);
aScrollBars[8].Init(CVector( 74.823f, -1086.879f, 31.495f), SCROLL_ENTERTAINMENT, -0.2083, 0.1041, 0.5, 255, 255, 128, 0.3);
aScrollBars[9].Init(CVector( -36.459f, -1031.2371f, 32.534f), SCROLL_ENTERTAINMENT, -0.1442, 0.0721, 0.229, 150, 255, 50, 0.3);
aScrollBars[10].Init(CVector( 1208.0f, -62.208f, 19.157f), SCROLL_USED_CARS, 0.0642, -0.20365, 0.229, 255, 128, 0, 0.3);
// Initialize tower clocks
aTowerClocks[0].Init(CVector(59.4f, -1081.3f, 54.15f), -1.0f, 0.0f, 0, 0, 0, 80.0f, 2.0f);
aTowerClocks[1].Init(CVector(55.4f, -1083.6f, 54.15f), 0.0f, -1.0f, 0, 0, 0, 80.0f, 2.0f);
// Initialize digital clocks
CVector2D sz(3.7f, 2.144f);
sz.Normalise();
aDigitalClocks[0].Init(
CVector(54.485f - sz.x * 0.05f + sz.y * 0.3f, -1081.679f - sz.y * 0.05f - sz.x * 0.3f, 32.803f),
sz.y, -sz.x, 255, 0, 0, 100.0f, 0.8f
);
aDigitalClocks[1].Init(
CVector(60.564f + sz.x * 0.05f - sz.y * 0.3f, -1083.089f + sz.y * 0.05f + sz.x * 0.3f, 32.803f),
-sz.y, sz.x, 0, 0, 255, 100.0f, 0.8f
);
aDigitalClocks[2].Init(
CVector(58.145f - sz.y * 0.05f - sz.x * 0.3f, -1079.268f + sz.x * 0.05f - sz.y * 0.3f, 32.803f),
-sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f
);
}
void CMovingThings::Shutdown()
{
int i;
for (i = 0; i < 11; ++i)
aScrollBars[i].SetVisibility(false);
for (i = 0; i < 2; ++i)
aTowerClocks[i].SetVisibility(false);
for (i = 0; i < 3; ++i)
aDigitalClocks[i].SetVisibility(false);
}
void CMovingThings::Update()
{
/*
* Some unused code about CMovingThing was here...
*/
int i;
for (i = 0; i < 11; ++i)
{
if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aScrollBars[i].Update();
}
for (i = 0; i < 2; ++i)
{
if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aTowerClocks[i].Update();
}
for (i = 0; i < 3; ++i)
{
if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aDigitalClocks[i].Update();
}
}
void CMovingThings::Render()
{
int i;
for (i = 0; i < 11; ++i)
{
if (aScrollBars[i].IsVisible())
aScrollBars[i].Render();
}
for (i = 0; i < 2; ++i)
{
if (aTowerClocks[i].IsVisible())
aTowerClocks[i].Render();
}
for (i = 0; i < 3; ++i)
{
if (aDigitalClocks[i].IsVisible())
aDigitalClocks[i].Render();
}
}
// ---------- CMovingThing ----------
WRAPPER void CMovingThing::Update() { EAXJMP(0x4FF290); }
WRAPPER void CMovingThing::AddToList() { EAXJMP(0x4FF320); }
WRAPPER void CMovingThing::RemoveFromList() { EAXJMP(0x4FF340); }
// ---------- Find message functions ----------
const char* FindTunnelMessage()
{
if (CStats::CommercialPassed)
return "LIBERTY TUNNEL HAS BEEN OPENED TO ALL TRAFFIC . . . ";
if (CStats::IndustrialPassed)
return "FIRST PHASE LIBERTY TUNNEL HAS BEEN COMPLETED . . . ";
return "FIRST PHASE LIBERTY TUNNEL ABOUT TO BE COMPLETED . . . ";
}
const char* FindBridgeMessage()
{
if (CStats::CommercialPassed)
return "STAUNTON LIFT BRIDGE IS OPERATIONAL AGAIN ";
if (CStats::IndustrialPassed)
return "LONG DELAYS BEHIND US AS CALLAHAN BRIDGE IS FIXED . . . STAUNTON LIFT BRIDGE STUCK OPEN ";
return "CHAOS AS CALLAHAN BRIDGE IS UNDER REPAIR. . . ";
}
char String_Time[] = "THE TIME IS 12:34 ";
const char* FindTimeMessage()
{
String_Time[12] = '0' + CClock::GetHours() / 10;
String_Time[13] = '0' + CClock::GetHours() % 10;
String_Time[15] = '0' + CClock::GetMinutes() / 10;
String_Time[16] = '0' + CClock::GetMinutes() % 10;
return String_Time;
}
char String_DigitalClock[] = "12:34";
const char* FindDigitalClockMessage()
{
if (((CTimer::GetTimeInMilliseconds() >> 10) & 7) < 6)
{
String_DigitalClock[0] = '0' + CClock::GetHours() / 10;
String_DigitalClock[1] = '0' + CClock::GetHours() % 10;
String_DigitalClock[2] = CTimer::GetTimeInMilliseconds() & 0x200 ? ':' : ' ';
String_DigitalClock[3] = '0' + CClock::GetMinutes() / 10;
String_DigitalClock[4] = '0' + CClock::GetMinutes() % 10;
}
else
{
int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) * 0.0043611112f - 1.0f);
String_DigitalClock[0] = '0' + temperature / 10;
if (String_DigitalClock[0] == '0')
String_DigitalClock[0] = ' ';
String_DigitalClock[1] = '0' + temperature % 10;
String_DigitalClock[2] = ' ';
String_DigitalClock[3] = '@';
String_DigitalClock[4] = 'C';
}
return String_DigitalClock;
}
// ---------- CScrollBar ----------
void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale)
{
for (int i = 0; i < 40; ++i)
m_MessageBar[i] = 0;
m_pMessage = ". ";
m_MessageCurrentChar = 0;
m_MessageLength = 2;
m_Counter = 0;
m_bVisible = false;
m_Position = position;
m_Type = type;
m_Size.x = sizeX;
m_Size.y = sizeY;
m_Size.z = sizeZ;
m_uRed = red;
m_uGreen = green;
m_uBlue = blue;
m_fScale = scale;
}
void CScrollBar::Update()
{
float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
if (distanceFromCamera > 100.0f)
{
m_bVisible = false;
return;
}
m_bVisible = true;
if (distanceFromCamera < 75.0f)
m_fIntensity = 1.0f;
else
m_fIntensity = 1.0f - 4.0f * (distanceFromCamera - 75.0f) / 100.0f;
m_Counter = (m_Counter + 1) % 8;
// if message is fully printed, load up the next one
if (m_Counter == 0 && ++m_MessageCurrentChar >= m_MessageLength)
{
const char* previousMessage = m_pMessage;
switch (m_Type)
{
case SCROLL_BUSINESS:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 7)
{
case 0:
m_pMessage = "SHARES UYE<10% DWD<20% NDWE>22% . . . ";
break;
case 1:
m_pMessage = "CRIME WAVE HITS LIBERTY CITY . . . ";
break;
case 2:
m_pMessage = "SHARES OBR>29% MADD<76% LEZ<11% ADAMSKI>53% AAG>110%. . . ";
break;
case 3:
m_pMessage = FindTunnelMessage();
break;
case 4:
m_pMessage = FindBridgeMessage();
break;
case 5:
m_pMessage = FindTimeMessage();
break;
case 6:
if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN)
m_pMessage = FindTimeMessage();
else
m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
break;
}
}
break;
case SCROLL_TRAFFIC:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 8)
{
case 0:
m_pMessage = "DRIVE CAREFULLY . . . ";
break;
case 1:
m_pMessage = "RECENT WAVE OF CARJACKINGS. KEEP YOUR DOORS LOCKED !!! ";
break;
case 2:
m_pMessage = "CHECK YOUR SPEED . . . ";
break;
case 3:
m_pMessage = "KEEP YOUR EYES ON THE ROAD AND NOT ON THIS SIGN ";
break;
case 4:
if (CWeather::Foggyness > 0.5)
m_pMessage = "POOR VISIBILITY ! ";
else if (CWeather::WetRoads > 0.5)
m_pMessage = "ROADS ARE SLIPPERY ! ";
else
m_pMessage = "ENJOY YOUR TRIP ";
break;
case 5:
m_pMessage = FindTunnelMessage();
break;
case 6:
m_pMessage = FindBridgeMessage();
break;
case 7:
m_pMessage = FindTimeMessage();
break;
}
}
break;
case SCROLL_ENTERTAINMENT:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 12)
{
case 0:
m_pMessage = " )69TH STREET) STILL HOLDS TOP POSITION THIS MONTH AT THE BOX-OFFICE WITH )MY FAIR LADYBOY) JUST CREEPING UP BEHIND. ";
break;
case 1:
m_pMessage = " TALKING OF )FANNIE). THERE IS STILL TIME TO CATCH THIS LOVELY FAMILY MUSICAL, ABOUT THE ORPHAN WHO IS SO EASILY TAKEN IN BY ANY MAN WITH LOADS OF MONEY. ";
break;
case 2:
m_pMessage = " DO NOT MISS )GTA3, THE MUSICAL) . . . ";
break;
case 3:
m_pMessage =
" STILL RUNNING ARE )RATS) AND )GUYS AND DOGS), BETWEEN THEN THEY SHOULD HAVE THE LEGS TO LAST TILL THE AND OF THE YEAR. . . "
" ALSO FOR FOUR LEGGED FANS, THE STAGE VERSION OF THE GRITTY REALISTIC )SATERDAY NIGHT BEAVER) OPENED LAST WEEKEND,"
" AND I FOR ONE CERTAINLY ENJOYED THAT. ";
break;
case 4:
m_pMessage =
" NOW SHOWING STATE-WIDE, ARNOLD STEELONE, HOLLYWOODS BEST LIVING SPECIAL EFFECT, APPEARS AGAIN AS A HALF_MAN,"
" HALF ANDROID IN THE HALF-BAKED ROMP, )TOP DOWN CITY). AN HOMAGE TO HIS EARLIER TWO MULTI_MILLION MAKING MOVIES,"
" IN WHICH HE PLAYED TWO-DEE, AN OUT OF CONTROL MONSTER, INTENT ON CORRUPTING CIVILISATION! ";
break;
case 5:
m_pMessage =
" ALSO APPEARING THIS WEEK )HALF-COCKED) SEES CHUCK SCHWARTZ UP TO HIS USUAL NONSENSE AS HE TAKES ON HALF OF LIBERTY CITY"
" IN AN ATTEMPT TO SAVE HIS CROSS-DRESSING LADY-BOY SIDEKICK, )MISS PING-PONG), FROM A GANG OF RUTHLESS COSMETIC SURGEONS. ";
break;
case 6:
m_pMessage =
" STILL SHOWING: )SOLDIERS OF MISFORTUNE), ATTROCIOUS ACTING WHICH SEES BOYZ 2 GIRLZ) TRANSITION FROM THE CHARTS TO THE BIG SCREEN,"
" AT LEAST THEY ALL DIE AT THE END. . . ";
break;
case 7:
m_pMessage =
" )BADFELLAS) IS STILL GOING STRONG WITH CROWDS ALMOST BEING PUSHED INTO CINEMAS TO SEE THIS ONE."
" ANOTHER ONE WORTH LOOKING INTO IS )THE TUNNEL). ";
break;
case 8:
m_pMessage = FindTunnelMessage();
break;
case 9:
m_pMessage = FindBridgeMessage();
break;
case 10:
m_pMessage = FindTimeMessage();
break;
case 11:
m_pMessage = "WWW.ROCKSTARGAMES.COM ";
break;
}
}
break;
case SCROLL_AIRPORT_DOORS:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 4)
{
case 0:
m_pMessage = "WELCOME TO LIBERTY CITY . . . ";
break;
case 1:
m_pMessage = "PLEASE HAVE YOUR PASSPORT READY . . . ";
break;
case 2:
m_pMessage = "PLACE KEYS, FIREARMS, CHANGE AND OTHER METAL OBJECTS ON THE TRAY PLEASE . . . ";
break;
case 3:
m_pMessage = FindTimeMessage();
break;
}
}
break;
case SCROLL_AIRPORT_FRONT:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 4)
{
case 0:
m_pMessage = "WELCOME TO FRANCIS INTERNATIONAL AIRPORT . . . ";
break;
case 1:
m_pMessage = "PLEASE DO NOT LEAVE LUGGAGE UNATTENDED . . . ";
break;
case 2:
m_pMessage = "FOLLOW 1 FOR LONG AND SHORT TERM PARKING ";
break;
case 3:
m_pMessage = FindTimeMessage();
break;
}
}
break;
case SCROLL_STORE:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 10)
{
case 0:
m_pMessage = "WWW.ROCKSTARGAMES.COM ";
break;
case 1:
m_pMessage = "GTA3 OUT NOW . . . ";
break;
case 2:
m_pMessage = "OUR STUFF IS CHEAP CHEAP CHEAP ";
break;
case 3:
m_pMessage = "BUY 12 CDS GET ONE FREE . . . ";
break;
case 4:
m_pMessage = "APPEARING IN SHOP SOON, )THE BLOODY CHOPPERS), WITH THEIR NEW ALBUM, )IS THAT MY DAUGHTER?) ";
break;
case 5:
m_pMessage = "THIS MONTH IS OUR CRAZY CLEAROUT MONTH, EVERYTHING MUST GO, CDS, DVDS, STAFF, EVEN OUR CARPETS! ";
break;
case 6:
m_pMessage =
"OUT THIS WEEK: THE THEME TUNE TO )BOYS TO GIRLS) FIRST MOVIE )SOLDIERS OF MISFORTUNE), "
"THE SINGLE )LET ME IN YOU)RE BODY-BAG) IS TAKEN FROM THE SOUNDTRACK ALBUM, )BOOT CAMP BOYS). "
"ALSO INCLUDES THE SMASH SINGLE, )PRAY IT GOES OK). ";
break;
case 7:
m_pMessage =
"ALBUMS OUT THIS WEEK: MARYDANCING, )MUTHA O) CHRIST), FEATURING THE SINGLE )WASH HIM OFF), "
"ALSO CRAIG GRAYS) DEBUT, )FADE AWAY), INCLUDES THE SINGLE OF THE SAME NAME. . . ";
break;
case 8:
m_pMessage =
"ON THE FILM FRONT, A NELY COMPILED COMPILATION OF ARNOLD STEELONES GREATEST MOVIES ON DVD. "
"THE PACK INCLUDES THE EARLY )BY-CEP), THE CULT CLASSIC )FUTURE ANNHILATOR), AND THE HILARIOUS CROSS-DRESSING COMEDY )SISTERS). "
"ONE FOR ALL THE FAMILY. . . ";
break;
case 9:
m_pMessage = (char*)FindTimeMessage();
break;
}
}
break;
case SCROLL_USED_CARS:
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 11)
{
case 0:
m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
break;
case 1:
m_pMessage = "THAT)S RIGHT, HERE AT )CAPITAL AUTO SALES) OUR VEHICLES ARE SO GOOD THAT THEY PRACTICALLY DRIVE THEMSELVES OFF OUR LOT . . . ";
break;
case 2:
m_pMessage = "EASY CREDIT ON ALL CARS . . . ";
break;
case 3:
m_pMessage = "FEEL LIKE A STUD IN ONE OF OUR STALLIONS OR TEST-DRIVE OUR BANSHEE, IT)S A REAL STEAL!!! ";
break;
case 4:
m_pMessage = "TRY OUR HARDY PERENNIAL, IT)LL LAST YOU THE WHOLE YEAR. OUR BOBCATS AIN)T NO PUSSIES EITHER!!! ";
break;
case 5:
m_pMessage = "IF IT)S A GUARANTEE YOU'RE AFTER, GO SOMEWHERE ELSE, )CAPITAL) CARS ARE THAT GOOD THEY DON)T NEED GUARANTEES!!! ";
break;
case 6:
m_pMessage = "TOP DOLLAR OFFERED FOR YOUR OLD WHEELS, NOT YOUR CAR, JUST IT)S WHEELS. . . ";
break;
case 7:
m_pMessage = "THAT)S RIGHT WE)RE CAR SILLY. TEST DRIVE ANY CAR, YOU WON)T WANT TO BRING IT BACK!!! ";
break;
case 8:
m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . .";
break;
case 9:
if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN)
m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
else
m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS ";
break;
case 10:
m_pMessage = FindTimeMessage();
break;
}
}
break;
}
m_MessageLength = strlen(m_pMessage);
m_MessageCurrentChar = 0;
}
// Scroll
for (int i = 0; i < 39; i++)
m_MessageBar[i] = m_MessageBar[i + 1];
m_MessageBar[39] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
// Introduce some random displaying glitches; signs aren't supposed to be perfect :P
switch (CGeneral::GetRandomNumber() & 0xFF)
{
case 0x0D: m_MessageBar[39] = 0; break;
case 0xE3: m_MessageBar[39] = 0xE3; break;
case 0x64: m_MessageBar[39] = ~m_MessageBar[39]; break;
}
}
void CScrollBar::Render()
{
if (!TheCamera.IsSphereVisible(m_Position, 2.0f * 20.0f * (ABS(m_Size.x) + ABS(m_Size.y))))
return;
CSprite::InitSpriteBuffer();
// Calculate intensity of colours
uint8 r = m_fIntensity * m_uRed;
uint8 g = m_fIntensity * m_uGreen;
uint8 b = m_fIntensity * m_uBlue;
// Set render states
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
CVector coronaCoord, screenCoord;
float screenW, screenH;
for (int i = 1; i < 40; ++i)
{
for (int j = 0; j < 5; ++j)
{
coronaCoord.x = m_Position.x + m_Size.x * i;
coronaCoord.y = m_Position.y + m_Size.y * i;
coronaCoord.z = m_Position.z + m_Size.z * j;
// Render main coronas
if (m_MessageBar[i] & (1 << j))
{
if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
screenW * m_fScale, screenH * m_fScale,
r, g, b,
255, 1.0f / screenCoord.z, 255);
}
}
// Render smaller and faded coronas for a trailing effect
else if (m_MessageBar[i - 1] & (1 << j))
{
if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
screenW * m_fScale * 0.8f,
screenH * m_fScale * 0.8f,
r / 2,
g / 2,
b / 2,
255, 1.0 / screenCoord.z, 255);
}
}
}
}
CSprite::FlushSpriteBuffer();
}
// ---------- CTowerClock ----------
void CTowerClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
{
m_bVisible = false;
m_Position = position;
m_Size.x = sizeX;
m_Size.y = sizeY;
m_Size.z = 0.0f;
m_uRed = red;
m_uGreen = green;
m_uBlue = blue;
m_fDrawDistance = drawDistance;
m_fScale = scale;
}
void CTowerClock::Update()
{
float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
if (distanceFromCamera < m_fDrawDistance)
{
m_bVisible = true;
if (distanceFromCamera < 0.75f * m_fDrawDistance)
m_fIntensity = 1.0f;
else
m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
}
else
m_bVisible = false;
}
RwIm3DVertex TempV[4];
void CTowerClock::Render()
{
if (TheCamera.IsSphereVisible(m_Position, m_fScale))
{
// Calculate angle for each clock index
float angleHour = 2.0f * (float)PI * (CClock::GetMinutes() + 60.0f * CClock::GetHours()) / 720.0f;
float angleMinute = 2.0f * (float)PI * (CClock::GetSeconds() + 60.0f * CClock::GetMinutes()) / 3600.0f;
// Prepare render states
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
// Set vertices colors
RwIm3DVertexSetRGBA(&TempV[0], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
RwIm3DVertexSetRGBA(&TempV[1], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
RwIm3DVertexSetRGBA(&TempV[2], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
RwIm3DVertexSetRGBA(&TempV[3], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
// Set vertices position
RwIm3DVertexSetPos(&TempV[0], m_Position.x, m_Position.y, m_Position.z);
RwIm3DVertexSetPos(
&TempV[1],
m_Position.x + Sin(angleMinute) * m_fScale * m_Size.x,
m_Position.y + Sin(angleMinute) * m_fScale * m_Size.y,
m_Position.z + Cos(angleMinute) * m_fScale;
);
RwIm3DVertexSetPos(&TempV[2], m_Position.x, m_Position.y, m_Position.z);
RwIm3DVertexSetPos(
&TempV[3],
m_Position.x + Sin(angleHour) * 0.75f * m_fScale * m_Size.x,
m_Position.y + Sin(angleHour) * 0.75f * m_fScale * m_Size.y,
m_Position.z + Cos(angleHour) * 0.75f * m_fScale;
);
LittleTest();
// Draw lines
if (RwIm3DTransform(TempV, 4, nil, 0))
{
RwIm3DRenderLine(0, 1);
RwIm3DRenderLine(2, 3);
RwIm3DEnd();
}
}
}
// ---------- CDigitalClock ----------
void CDigitalClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
{
m_bVisible = false;
m_Position = position;
m_Size.x = sizeX;
m_Size.y = sizeY;
m_Size.z = 0.0f;
m_uRed = red;
m_uGreen = green;
m_uBlue = blue;
m_fDrawDistance = drawDistance;
m_fScale = scale;
}
void CDigitalClock::Update()
{
float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
if (distanceFromCamera < m_fDrawDistance)
{
m_bVisible = true;
if (distanceFromCamera < 0.75f * m_fDrawDistance)
m_fIntensity = 1.0f;
else
m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
}
else
m_bVisible = false;
}
void CDigitalClock::Render()
{
if (TheCamera.IsSphereVisible(m_Position, 5.0f * m_fScale))
{
CSprite::InitSpriteBuffer();
// Simulate flicker
float currentIntensity = m_fIntensity * CGeneral::GetRandomNumberInRange(0x300, 0x400) / 1024.0f;
uint8 r = currentIntensity * m_uRed;
uint8 g = currentIntensity * m_uGreen;
uint8 b = currentIntensity * m_uBlue;
// Set render states
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
const char* clockMessage = FindDigitalClockMessage();
CVector coronaCoord, screenCoord;
float screenW, screenH;
for (int c = 0; c < 5; ++c) // for each char to be displayed
{
for (int i = 0; i < 5; ++i) // for each column of coronas
{
for (int j = 0; j < 5; ++j) // for each row of coronas
{
if (ScrollCharSet[clockMessage[c] - ' '][i] & (1 << j))
{
coronaCoord.x = m_Position.x + (8 * c + i) * m_Size.x * m_fScale / 8.0f;
coronaCoord.y = m_Position.y + (8 * c + i) * m_Size.y * m_fScale / 8.0f;
coronaCoord.z = m_Position.z + j * m_fScale / 8.0f;
if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
screenW * m_fScale * 0.12,
screenW * m_fScale * 0.12,
r, g, b,
255,
1.0 / screenCoord.z,
255);
}
}
}
}
}
CSprite::FlushSpriteBuffer();
}
}
STARTPATCHES
InjectHook(0x4FE7C0, &CMovingThings::Init, PATCH_JUMP);
InjectHook(0x4FF020, &CMovingThings::Shutdown, PATCH_JUMP);
InjectHook(0x4FF0D0, &CMovingThings::Update, PATCH_JUMP);
InjectHook(0x4FF210, &CMovingThings::Render, PATCH_JUMP);
InjectHook(0x4FF360, &FindTunnelMessage, PATCH_JUMP);
InjectHook(0x4FF390, &FindBridgeMessage, PATCH_JUMP);
InjectHook(0x4FF3C0, &FindTimeMessage, PATCH_JUMP);
InjectHook(0x4FF450, &FindDigitalClockMessage, PATCH_JUMP);
InjectHook(0x4FF610, &CScrollBar::Init, PATCH_JUMP);
InjectHook(0x4FF6E0, &CScrollBar::Update, PATCH_JUMP);
InjectHook(0x4FFCE0, &CScrollBar::Render, PATCH_JUMP);
InjectHook(0x5000D0, &CTowerClock::Init, PATCH_JUMP);
InjectHook(0x500130, &CTowerClock::Update, PATCH_JUMP);
InjectHook(0x5001D0, &CTowerClock::Render, PATCH_JUMP);
InjectHook(0x5004F0, &CDigitalClock::Init, PATCH_JUMP);
InjectHook(0x500550, &CDigitalClock::Update, PATCH_JUMP);
InjectHook(0x5005F0, &CDigitalClock::Render, PATCH_JUMP);
ENDPATCHES

View file

@ -1,7 +1,91 @@
#pragma once #pragma once
#include "common.h"
#include "math/Vector.h"
class CMovingThings class CMovingThings
{ {
public: public:
static void Render(void); static void Init();
static void Shutdown();
static void Update();
static void Render();
};
class CMovingThing
{
public:
void Update();
void AddToList();
void RemoveFromList();
};
class CScrollBar
{
private:
uint8 m_Counter;
const char* m_pMessage;
CVector m_Position;
uint32 m_MessageCurrentChar;
uint32 m_MessageLength;
CVector m_Size;
float m_fIntensity;
uint8 m_MessageBar[40];
uint8 m_Type;
bool m_bVisible;
uint8 m_uRed;
uint8 m_uGreen;
uint8 m_uBlue;
float m_fScale;
public:
void SetVisibility(bool visible) { m_bVisible = visible; }
bool IsVisible() { return m_bVisible; }
void Init(CVector, uint8, float, float, float, uint8, uint8, uint8, float);
void Update();
void Render();
};
class CTowerClock
{
private:
CVector m_Position;
CVector m_Size;
float m_fDrawDistance;
float m_fScale;
uint8 m_uRed;
uint8 m_uGreen;
uint8 m_uBlue;
bool m_bVisible;
float m_fIntensity;
public:
void SetVisibility(bool visible) { m_bVisible = visible; }
bool IsVisible() { return m_bVisible; }
void Init(CVector, float, float, uint8, uint8, uint8, float, float);
void Update();
void Render();
};
class CDigitalClock
{
private:
CVector m_Position;
CVector m_Size;
float m_fDrawDistance;
float m_fScale;
uint8 m_uRed;
uint8 m_uGreen;
uint8 m_uBlue;
bool m_bVisible;
float m_fIntensity;
public:
void SetVisibility(bool visible) { m_bVisible = visible; }
bool IsVisible() { return m_bVisible; }
void Init(CVector, float, float, uint8, uint8, uint8, float, float);
void Update();
void Render();
}; };

View file

@ -325,7 +325,7 @@ void CHud::Draw()
else { else {
Clip = AmmoInClip; Clip = AmmoInClip;
if (TotalAmmo - AmmoInClip > 9999) if ((TotalAmmo - AmmoInClip) > 9999)
Ammo = 9999; Ammo = 9999;
else else
Ammo = TotalAmmo - AmmoInClip; Ammo = TotalAmmo - AmmoInClip;

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