mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-05 09:25:54 +00:00
Merge branch 'miami' of github.com:GTAmodding/re3 into miami
This commit is contained in:
commit
2a51e1da04
44
CMakeLists.txt
Normal file
44
CMakeLists.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(reVC C CXX)
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
if(WIN32)
|
||||
set(REVC_AUDIOS "NULL" "OAL" "MSS")
|
||||
else()
|
||||
set(REVC_AUDIOS "NULL" "OAL")
|
||||
endif()
|
||||
|
||||
set(REVC_AUDIO "OAL" CACHE STRING "Audio")
|
||||
|
||||
set_property(CACHE REVC_AUDIO PROPERTY STRINGS ${REVC_AUDIOS})
|
||||
message(STATUS "REVC_AUDIO = ${REVC_AUDIO} (choices=${REVC_AUDIOS})")
|
||||
set("REVC_AUDIO_${REVC_AUDIO}" ON)
|
||||
if(NOT REVC_AUDIO IN_LIST REVC_AUDIOS)
|
||||
message(FATAL_ERROR "Illegal REVC_AUDIO=${REVC_AUDIO}")
|
||||
endif()
|
||||
|
||||
if(REVC_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
set(REVC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/reVC")
|
||||
endif()
|
||||
|
||||
add_subdirectory("vendor/librw")
|
||||
add_subdirectory(src)
|
||||
|
||||
if(REVC_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(reVC-config.cmake.in reVC-config.cmake
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/reVC-config.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
install(
|
||||
EXPORT reVC-targets
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
include(CMakeCPack.cmake)
|
||||
endif()
|
28
cmake/FindMPG123.cmake
Normal file
28
cmake/FindMPG123.cmake
Normal file
|
@ -0,0 +1,28 @@
|
|||
# - Find mpg123
|
||||
# Find the native mpg123 includes and library
|
||||
#
|
||||
# MPG123_INCLUDE_DIR - where to find mpg123.h
|
||||
# MPG123_LIBRARIES - List of libraries when using mpg123.
|
||||
# MPG123_FOUND - True if mpg123 found.
|
||||
|
||||
IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(MPG123_FIND_QUIETLY TRUE)
|
||||
ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
|
||||
|
||||
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
|
||||
PATHS "${MPG123_DIR}"
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0
|
||||
PATHS "${MPG123_DIR}"
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)
|
67
cmake/FindSndFile.cmake
Normal file
67
cmake/FindSndFile.cmake
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Found on http://hg.kvats.net
|
||||
#
|
||||
# - Try to find libsndfile
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# SNDFILE_FOUND - system has libsndfile
|
||||
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
|
||||
# SNDFILE_LIBRARIES - Link these to use libsndfile
|
||||
#
|
||||
# Copyright (C) 2006 Wengo
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
set(SNDFILE_FOUND TRUE)
|
||||
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
||||
|
||||
find_path(SNDFILE_INCLUDE_DIR
|
||||
NAMES
|
||||
sndfile.h
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
)
|
||||
|
||||
find_library(SNDFILE_LIBRARY
|
||||
NAMES
|
||||
sndfile
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
|
||||
set(SNDFILE_INCLUDE_DIRS
|
||||
${SNDFILE_INCLUDE_DIR}
|
||||
)
|
||||
set(SNDFILE_LIBRARIES
|
||||
${SNDFILE_LIBRARY}
|
||||
)
|
||||
|
||||
if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
||||
set(SNDFILE_FOUND TRUE)
|
||||
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
||||
|
||||
if (SNDFILE_FOUND)
|
||||
if (NOT SndFile_FIND_QUIETLY)
|
||||
message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}")
|
||||
endif (NOT SndFile_FIND_QUIETLY)
|
||||
else (SNDFILE_FOUND)
|
||||
if (SndFile_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find libsndfile")
|
||||
endif (SndFile_FIND_REQUIRED)
|
||||
endif (SNDFILE_FOUND)
|
||||
|
||||
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
|
||||
|
||||
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
BIN
gamefiles/models/x360btns.txd
Normal file
BIN
gamefiles/models/x360btns.txd
Normal file
Binary file not shown.
113
src/CMakeLists.txt
Normal file
113
src/CMakeLists.txt
Normal file
|
@ -0,0 +1,113 @@
|
|||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(${REVC_AUDIO} STREQUAL "OAL")
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(MPG123 REQUIRED)
|
||||
find_package(SndFile REQUIRED)
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE Sources "*.cpp" "*.h")
|
||||
|
||||
MACRO(HEADER_DIRECTORIES return_list)
|
||||
FILE(GLOB_RECURSE new_list *.cpp)
|
||||
SET(dir_list "animation"
|
||||
"audio"
|
||||
"collision"
|
||||
"control"
|
||||
"core"
|
||||
"entities"
|
||||
"extras"
|
||||
"fakerw"
|
||||
"math"
|
||||
"modelinfo"
|
||||
"objects"
|
||||
"peds"
|
||||
"render"
|
||||
"rw"
|
||||
"save"
|
||||
"skel"
|
||||
"text"
|
||||
"vehicles"
|
||||
"weapons")
|
||||
FOREACH(file_path ${new_list})
|
||||
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
|
||||
SET(dir_list ${dir_list} ${dir_path})
|
||||
ENDFOREACH()
|
||||
LIST(REMOVE_DUPLICATES dir_list)
|
||||
SET(${return_list} ${dir_list})
|
||||
ENDMACRO()
|
||||
|
||||
HEADER_DIRECTORIES(header_list)
|
||||
include_directories(${header_list})
|
||||
|
||||
|
||||
add_executable(reVC ${Sources})
|
||||
target_link_libraries(reVC librw)
|
||||
target_link_libraries(reVC Threads::Threads)
|
||||
|
||||
if(${REVC_AUDIO} STREQUAL "OAL")
|
||||
target_link_libraries(reVC ${OPENAL_LIBRARY})
|
||||
target_link_libraries(reVC ${MPG123_LIBRARIES})
|
||||
target_link_libraries(reVC ${SNDFILE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_include_directories(reVC
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
)
|
||||
|
||||
target_compile_definitions(reVC
|
||||
PRIVATE
|
||||
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
|
||||
PUBLIC
|
||||
"RW_${REVC_PLATFORM}"
|
||||
)
|
||||
|
||||
target_compile_definitions(reVC PRIVATE LIBRW=1 AUDIO_OAL=1)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
target_compile_options(reVC
|
||||
PRIVATE
|
||||
"-Wall"
|
||||
)
|
||||
if (NOT REVC_PLATFORM_PS2)
|
||||
target_compile_options(reVC
|
||||
PRIVATE
|
||||
"-Wextra"
|
||||
"-Wdouble-promotion"
|
||||
"-Wpedantic"
|
||||
)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(reVC
|
||||
PUBLIC
|
||||
/wd4996 /wd4244
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(reVC
|
||||
PROPERTIES
|
||||
C_STANDARD 11
|
||||
C_EXTENSIONS OFF
|
||||
C_STANDARD_REQUIRED ON
|
||||
CXX_STANDARD 11
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
PREFIX ""
|
||||
)
|
||||
|
||||
if(REVC_INSTALL)
|
||||
target_include_directories(reVC
|
||||
INTERFACE
|
||||
$<INSTALL_INTERFACE:${REVC_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS reVC
|
||||
EXPORT reVC-targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endif()
|
|
@ -118,3 +118,14 @@ CAnimBlendHierarchy::RemoveUncompressedData(void)
|
|||
#endif
|
||||
compressed = 1;
|
||||
}
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
void
|
||||
CAnimBlendHierarchy::MoveMemory(bool onlyone)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < numSequences; i++)
|
||||
if(sequences[i].MoveMemory() && onlyone)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
#include "templates.h"
|
||||
|
||||
#ifdef MoveMemory
|
||||
#undef MoveMemory // windows shit
|
||||
#endif
|
||||
|
||||
class CAnimBlendSequence;
|
||||
|
||||
// A collection of sequences
|
||||
|
@ -25,6 +29,7 @@ public:
|
|||
void RemoveAnimSequences(void);
|
||||
void Uncompress(void);
|
||||
void RemoveUncompressedData(void);
|
||||
void MoveMemory(bool onlyone = false);
|
||||
bool IsCompressed() { return !!compressed; };
|
||||
};
|
||||
|
||||
|
|
|
@ -179,3 +179,24 @@ CAnimBlendSequence::RemoveUncompressedData(void)
|
|||
RwFree(keyFrames);
|
||||
keyFrames = nil;
|
||||
}
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
bool
|
||||
CAnimBlendSequence::MoveMemory(void)
|
||||
{
|
||||
if(keyFrames){
|
||||
void *newaddr = gMainHeap.MoveMemory(keyFrames);
|
||||
if(newaddr != keyFrames){
|
||||
keyFrames = newaddr;
|
||||
return true;
|
||||
}
|
||||
}else if(keyFramesCompressed){
|
||||
void *newaddr = gMainHeap.MoveMemory(keyFramesCompressed);
|
||||
if(newaddr != keyFramesCompressed){
|
||||
keyFramesCompressed = newaddr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
#include "Quaternion.h"
|
||||
|
||||
#ifdef MoveMemory
|
||||
#undef MoveMemory // windows shit
|
||||
#endif
|
||||
|
||||
// TODO: put them somewhere else?
|
||||
struct KeyFrame {
|
||||
CQuaternion rotation;
|
||||
|
@ -84,6 +88,7 @@ public:
|
|||
void Uncompress(void);
|
||||
void CompressKeyframes(void);
|
||||
void RemoveUncompressedData(void);
|
||||
bool MoveMemory(void);
|
||||
|
||||
void SetBoneTag(int tag) { boneTag = tag; }
|
||||
};
|
||||
|
|
|
@ -3193,7 +3193,7 @@ AddSample:
|
|||
|
||||
#ifdef GTA_TRAIN
|
||||
bool
|
||||
cAudioManager::ProcessTrainNoise(cVehicleParams *params)
|
||||
cAudioManager::ProcessTrainNoise(cVehicleParams& params)
|
||||
{
|
||||
const float SOUND_INTENSITY = 300.0f;
|
||||
|
||||
|
@ -3201,12 +3201,12 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
|
|||
uint8 emittingVol;
|
||||
float speedMultipler;
|
||||
|
||||
if (params->m_fDistance >= SQR(SOUND_INTENSITY))
|
||||
if (params.m_fDistance >= SQR(SOUND_INTENSITY))
|
||||
return false;
|
||||
|
||||
if (params->m_fVelocityChange > 0.0f) {
|
||||
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
||||
train = (CTrain *)params->m_pVehicle;
|
||||
if (params.m_fVelocityChange > 0.0f) {
|
||||
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
|
||||
train = (CTrain *)params.m_pVehicle;
|
||||
speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
|
||||
emittingVol = (75.f * speedMultipler);
|
||||
if (train->m_fWagonPosition == 0.0f) {
|
||||
|
@ -3232,7 +3232,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
|
|||
}
|
||||
}
|
||||
const float SOUND_INTENSITY = 70.0f;
|
||||
if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
|
||||
if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
|
||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
|
||||
if (m_sQueueSample.m_nVolume != 0) {
|
||||
m_sQueueSample.m_nCounter = 33;
|
||||
|
@ -8229,14 +8229,14 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
|
|||
male.m_pPed = nil;
|
||||
male.m_bDistanceCalculated = false;
|
||||
male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||
SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH);
|
||||
SetupPedComments(male, SOUND_INJURED_PED_MALE_OUCH);
|
||||
return;
|
||||
case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S:
|
||||
case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L:
|
||||
female.m_pPed = nil;
|
||||
female.m_bDistanceCalculated = false;
|
||||
female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||
SetupPedComments(&female, SOUND_INJURED_PED_FEMALE);
|
||||
SetupPedComments(female, SOUND_INJURED_PED_FEMALE);
|
||||
return;
|
||||
case SCRIPT_SOUND_GATE_START_CLUNK:
|
||||
case SCRIPT_SOUND_GATE_STOP_CLUNK:
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
enum eSfxSample {
|
||||
enum eSfxSample
|
||||
{
|
||||
SFX_CAR_HORN_JEEP = 0,
|
||||
SFX_CAR_HORN_BMW328,
|
||||
SFX_CAR_HORN_BUS,
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
|
||||
#ifdef AUDIO_OAL
|
||||
|
||||
/*
|
||||
* When linking to a static openal-soft library,
|
||||
* the extension function inside the openal library conflict with the variables here.
|
||||
* Therefore declare these re3 owned symbols in a private namespace.
|
||||
*/
|
||||
|
||||
namespace re3_openal {
|
||||
|
||||
LPALGENEFFECTS alGenEffects;
|
||||
LPALDELETEEFFECTS alDeleteEffects;
|
||||
LPALISEFFECT alIsEffect;
|
||||
|
@ -37,6 +45,9 @@ LPALGETFILTERIV alGetFilteriv;
|
|||
LPALGETFILTERF alGetFilterf;
|
||||
LPALGETFILTERFV alGetFilterfv;
|
||||
|
||||
}
|
||||
|
||||
using namespace re3_openal;
|
||||
|
||||
void EFXInit()
|
||||
{
|
||||
|
|
|
@ -11,6 +11,8 @@ void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props);
|
|||
void EAX3_SetReverbMix(ALuint filter, float mix);
|
||||
void SetEffectsLevel(ALuint uiFilter, float level);
|
||||
|
||||
namespace re3_openal {
|
||||
|
||||
extern LPALGENEFFECTS alGenEffects;
|
||||
extern LPALDELETEEFFECTS alDeleteEffects;
|
||||
extern LPALISEFFECT alIsEffect;
|
||||
|
@ -44,4 +46,9 @@ extern LPALGETFILTERI alGetFilteri;
|
|||
extern LPALGETFILTERIV alGetFilteriv;
|
||||
extern LPALGETFILTERF alGetFilterf;
|
||||
extern LPALGETFILTERFV alGetFilterfv;
|
||||
|
||||
}
|
||||
|
||||
using namespace re3_openal;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,13 +10,15 @@
|
|||
#ifdef _WIN32
|
||||
#pragma comment( lib, "libsndfile-1.lib" )
|
||||
#pragma comment( lib, "libmpg123-0.lib" )
|
||||
#else
|
||||
#include "crossplatform.h"
|
||||
#endif
|
||||
#include <sndfile.h>
|
||||
#include <mpg123.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "crossplatform.h"
|
||||
#endif
|
||||
|
||||
#ifndef AUDIO_OPUS
|
||||
class CSndFile : public IDecoder
|
||||
{
|
||||
|
|
|
@ -1380,7 +1380,7 @@ cSampleManager::Terminate(void)
|
|||
bool
|
||||
cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||
{
|
||||
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
||||
#if !defined(NO_CDCHECK) // TODO: check steam, probably GTAVC_STEAM_PATCH needs to be added
|
||||
char filepath[MAX_PATH];
|
||||
|
||||
strcpy(filepath, m_MiscomPath);
|
||||
|
@ -1406,7 +1406,7 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
|
|||
|
||||
#else
|
||||
return true;
|
||||
#endif // #if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
||||
#endif // #if !defined(NO_CDCHECK)
|
||||
}
|
||||
|
||||
char
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "ColModel.h"
|
||||
#include "Collision.h"
|
||||
#include "Game.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "Pools.h"
|
||||
|
||||
CColModel::CColModel(void)
|
||||
|
@ -65,10 +66,15 @@ CColModel::RemoveCollisionVolumes(void)
|
|||
void
|
||||
CColModel::CalculateTrianglePlanes(void)
|
||||
{
|
||||
PUSH_MEMID(MEMID_COLLISION);
|
||||
|
||||
// HACK: allocate space for one more element to stuff the link pointer into
|
||||
trianglePlanes = (CColTrianglePlane*)RwMalloc(sizeof(CColTrianglePlane) * (numTriangles+1));
|
||||
REGISTER_MEMPTR(&trianglePlanes);
|
||||
for(int i = 0; i < numTriangles; i++)
|
||||
trianglePlanes[i].Set(vertices, triangles[i]);
|
||||
|
||||
POP_MEMID();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -41,7 +41,7 @@ CTempColModels::Initialise(void)
|
|||
colmodel.numSpheres = ARRAY_SIZE(sphrs);\
|
||||
colmodel.spheres = sphrs;\
|
||||
colmodel.level = LEVEL_GENERIC;\
|
||||
colmodel.ownsCollisionVolumes = false;\
|
||||
colmodel.ownsCollisionVolumes = false;
|
||||
|
||||
int i;
|
||||
|
||||
|
|
|
@ -457,7 +457,6 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
float directionNextLinkX;
|
||||
float directionNextLinkY;
|
||||
if (positionBetweenNodes < 0.5f) {
|
||||
|
||||
pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
|
||||
positionOnCurrentLinkIncludingLane = CVector(
|
||||
|
@ -506,10 +505,6 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
|
||||
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirX();
|
||||
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirY();
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirX();
|
||||
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirY();
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurrentLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
|
@ -3204,7 +3199,7 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
|
|||
float distance = 30.0f;
|
||||
CFire* pNearestFire = gFireManager.FindNearestFire(FindPlayerCoors(), &distance);
|
||||
if (pNearestFire) {
|
||||
if (CountCarsOfType(MI_FIRETRUCK) < 2 && CTimer::GetTimeInMilliseconds() > LastTimeFireTruckCreated + 30000){
|
||||
if (CountCarsOfType(MI_FIRETRUCK) < 2 && CTimer::GetTimeInMilliseconds() > LastTimeFireTruckCreated + 35000){
|
||||
CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY);
|
||||
CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE);
|
||||
if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){
|
||||
|
|
|
@ -125,7 +125,7 @@ uint32 CGarages::NumGarages;
|
|||
bool CGarages::PlayerInGarage;
|
||||
int32 CGarages::PoliceCarsCollected;
|
||||
CStoredCar CGarages::aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][NUM_GARAGE_STORED_CARS];
|
||||
int32 hHandle = AEHANDLE_NONE;
|
||||
int32 hGarages = AEHANDLE_NONE;
|
||||
CGarage CGarages::aGarages[NUM_GARAGES];
|
||||
bool CGarages::bCamShouldBeOutisde;
|
||||
|
||||
|
@ -150,27 +150,25 @@ void CGarages::Init(void)
|
|||
for (int j = 0; j < TOTAL_HIDEOUT_GARAGES; j++)
|
||||
aCarsInSafeHouses[j][i].Init();
|
||||
}
|
||||
hHandle = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
|
||||
if (hHandle >= 0)
|
||||
DMAudio.SetEntityStatus(hHandle, 1);
|
||||
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
|
||||
if (hGarages >= 0)
|
||||
DMAudio.SetEntityStatus(hGarages, 1);
|
||||
}
|
||||
|
||||
void CGarages::Shutdown(void)
|
||||
{
|
||||
NumGarages = 0;
|
||||
if (hHandle < 0)
|
||||
if (hGarages < 0)
|
||||
return;
|
||||
DMAudio.DestroyEntity(hHandle);
|
||||
hHandle = AEHANDLE_NONE;
|
||||
DMAudio.DestroyEntity(hGarages);
|
||||
hGarages = AEHANDLE_NONE;
|
||||
}
|
||||
|
||||
void CGarages::Update(void)
|
||||
{
|
||||
static uint32 GarageToBeTidied = 0;
|
||||
#ifndef PS2
|
||||
if (CReplay::IsPlayingBack())
|
||||
return;
|
||||
#endif
|
||||
bCamShouldBeOutisde = false;
|
||||
TheCamera.pToGarageWeAreIn = nil;
|
||||
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil;
|
||||
|
@ -421,7 +419,7 @@ void CGarage::Update()
|
|||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_RESPRAY;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
CStats::CheckPointReachedSuccessfully();
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
|
@ -525,7 +523,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -569,7 +567,7 @@ void CGarage::Update()
|
|||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_SETUP_BOMB;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
if (m_eGarageType == GARAGE_BOMBSHOP3)
|
||||
|
@ -644,7 +642,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -684,7 +682,7 @@ void CGarage::Update()
|
|||
ThrowCarsNearDoorOutOfGarage(m_pTarget);
|
||||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
if (m_bClosingWithoutTargetCar)
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
else {
|
||||
|
@ -714,7 +712,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -767,7 +765,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
if (m_pTarget) {
|
||||
MarkThisCarAsCollectedForCraig(m_pTarget->GetModelIndex());
|
||||
DestroyVehicleAndDriverAndPassengers(m_pTarget);
|
||||
|
@ -807,7 +805,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -828,7 +826,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
}
|
||||
if (!IsGarageEmpty())
|
||||
m_eGarageState = GS_OPENING;
|
||||
|
@ -839,7 +837,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -873,7 +871,7 @@ void CGarage::Update()
|
|||
ThrowCarsNearDoorOutOfGarage(m_pTarget);
|
||||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
if (m_bClosingWithoutTargetCar)
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
else {
|
||||
|
@ -902,7 +900,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -922,7 +920,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -942,7 +940,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -950,7 +948,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -1001,7 +999,7 @@ void CGarage::Update()
|
|||
if (!IsPlayerOutsideGarage())
|
||||
m_eGarageState = GS_OPENING;
|
||||
else if (m_fDoorPos == 0.0f) {
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
StoreAndRemoveCarsForThisHideout(CGarages::aCarsInSafeHouses[CGarages::FindSafeHouseIndexForGarageType(m_eGarageType)], NUM_GARAGE_STORED_CARS);
|
||||
}
|
||||
|
@ -1032,7 +1030,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + HIDEOUT_DOOR_SPEED_COEFFICIENT * (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -1059,7 +1057,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -1075,7 +1073,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
@ -1100,7 +1098,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == 0.0f) {
|
||||
m_eGarageState = GS_FULLYCLOSED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
|
||||
}
|
||||
case GS_FULLYCLOSED:
|
||||
|
@ -1109,7 +1107,7 @@ void CGarage::Update()
|
|||
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||
if (m_fDoorPos == m_fDoorHeight) {
|
||||
m_eGarageState = GS_OPENED;
|
||||
DMAudio.PlayOneShot(hHandle, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||
}
|
||||
UpdateDoorsHeight();
|
||||
break;
|
||||
|
|
87
src/control/NameGrid.cpp
Normal file
87
src/control/NameGrid.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include "common.h"
|
||||
#include "NameGrid.h"
|
||||
|
||||
// TODO: reverse mobile code
|
||||
|
||||
CPlayerName::CPlayerName()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerName::DisplayName(int)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
CRow::CRow()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CRow::SetLetter(int, wchar *)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
CGrid::CGrid()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::ProcessAnyLeftJustDown()
|
||||
{
|
||||
unk_int2--;
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::ProcessAnyRightJustDown()
|
||||
{
|
||||
unk_int2++;
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::ProcessAnyUpJustDown()
|
||||
{
|
||||
unk_int1--;
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::ProcessAnyDownJustDown()
|
||||
{
|
||||
unk_int1++;
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::AllDoneMakePlayerName()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::ProcessDPadCrossJustDown()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::DisplayGrid()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::ProcessControllerInput()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
CGrid::Process()
|
||||
{
|
||||
ProcessControllerInput();
|
||||
DisplayGrid();
|
||||
playerName.DisplayName(2 * playerName.unk_4c);
|
||||
}
|
53
src/control/NameGrid.h
Normal file
53
src/control/NameGrid.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
#pragma once
|
||||
|
||||
// TODO: reverse mobile code
|
||||
|
||||
class CPlayerName
|
||||
{
|
||||
friend class CGrid;
|
||||
|
||||
float x;
|
||||
float y;
|
||||
wchar unk_8[34];
|
||||
int unk_4c;
|
||||
public:
|
||||
CPlayerName();
|
||||
void DisplayName(int);
|
||||
};
|
||||
|
||||
class CRow
|
||||
{
|
||||
friend class CGrid;
|
||||
|
||||
int unk_0;
|
||||
int unk_4;
|
||||
wchar unk_8[20];
|
||||
int unk_30;
|
||||
public:
|
||||
CRow();
|
||||
void SetLetter(int, wchar *);
|
||||
};
|
||||
|
||||
class CGrid
|
||||
{
|
||||
CRow rows[5];
|
||||
int unk_int1;
|
||||
int unk_int2;
|
||||
int unk_int3;
|
||||
float unk_float1;
|
||||
float unk_float2;
|
||||
CPlayerName playerName;
|
||||
char unk2[4];
|
||||
char unk3[4];
|
||||
public:
|
||||
CGrid();
|
||||
void ProcessAnyLeftJustDown();
|
||||
void ProcessAnyRightJustDown();
|
||||
void ProcessAnyUpJustDown();
|
||||
void ProcessAnyDownJustDown();
|
||||
void AllDoneMakePlayerName();
|
||||
void ProcessDPadCrossJustDown();
|
||||
void DisplayGrid();
|
||||
void ProcessControllerInput();
|
||||
void Process();
|
||||
};
|
|
@ -596,7 +596,10 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
|||
bool explode = false;
|
||||
if (CTimer::GetTimeInMilliseconds() > m_nTimer)
|
||||
explode = true;
|
||||
else {// added else here since vehicle lookup is useless
|
||||
#ifdef FIX_BUGS
|
||||
else// added else here since vehicle lookup is useless
|
||||
#endif
|
||||
{
|
||||
for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
||||
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
||||
|
|
|
@ -69,12 +69,10 @@ void CRecordDataForChase::ProcessControlCars(void)
|
|||
{
|
||||
}
|
||||
|
||||
#if (defined(GTA_PS2) || defined(FIX_BUGS))
|
||||
bool CRecordDataForChase::ShouldThisPadBeLeftAlone(uint8 pad)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomobile** ppCar, uint8 colour1, uint8 colour2)
|
||||
{
|
||||
|
|
|
@ -1447,7 +1447,7 @@ void CReplay::RestoreStuffFromMem(void)
|
|||
ped->m_rwObject = nil;
|
||||
ped->m_modelIndex = -1;
|
||||
ped->SetModelIndex(mi);
|
||||
ped->m_pVehicleAnim = 0;
|
||||
ped->m_pVehicleAnim = nil;
|
||||
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
|
||||
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
|
||||
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef GTA_SCENE_EDIT
|
||||
class CPed;
|
||||
class CVehicle;
|
||||
|
||||
|
@ -93,3 +93,4 @@ public:
|
|||
static void SelectVehicle(void);
|
||||
static bool SelectWeapon(void);
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -262,12 +262,12 @@ const tScriptCommandData commands[] = {
|
|||
REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
|
||||
REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
|
||||
REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +=@"),
|
||||
REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +=@"),
|
||||
REGISTER_COMMAND(COMMAND_SUB_TIMED_VAL_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
|
||||
|
@ -3071,8 +3071,10 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|||
#ifdef MISSION_REPLAY
|
||||
if (m_bMissionFlag) {
|
||||
CPlayerInfo* pPlayerInfo = &CWorld::Players[CWorld::PlayerInFocus];
|
||||
#if 0 // makeing autosave is pointless and is a bit buggy
|
||||
if (pPlayerInfo->m_pPed->GetPedState() != PED_DEAD && pPlayerInfo->m_WBState == WBSTATE_PLAYING && !m_bDeatharrestExecuted)
|
||||
SaveGameForPause(1);
|
||||
#endif
|
||||
oldTargetX = oldTargetY = 0.0f;
|
||||
if (AllowMissionReplay == 1)
|
||||
AllowMissionReplay = 2;
|
||||
|
|
|
@ -47,7 +47,6 @@ CEntity *CAnimViewer::pTarget = nil;
|
|||
void
|
||||
CAnimViewer::Render(void) {
|
||||
if (pTarget) {
|
||||
// pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
|
||||
if (pTarget) {
|
||||
#ifdef FIX_BUGS
|
||||
if(pTarget->IsPed())
|
||||
|
@ -113,7 +112,7 @@ CAnimViewer::Initialise(void) {
|
|||
CTimeCycle::Initialise();
|
||||
CCarCtrl::Init();
|
||||
CPlayerPed *player = new CPlayerPed();
|
||||
player->SetPosition(0.0f, 0.0f, 0.0f);
|
||||
player->SetPosition(1000.0f, 1000.0f, 1000.0f);
|
||||
CWorld::Players[0].m_pPed = player;
|
||||
CDraw::SetFOV(120.0f);
|
||||
CDraw::ms_fLODDistance = 500.0f;
|
||||
|
|
|
@ -2746,7 +2746,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
|
|||
Source = HeadPos;
|
||||
|
||||
// unused:
|
||||
// ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&MidPos, PED_MID);
|
||||
// ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(MidPos, PED_MID);
|
||||
// Source - MidPos;
|
||||
|
||||
// Look around
|
||||
|
@ -5053,7 +5053,6 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||
float stickX = -(pad->GetCarGunLeftRight());
|
||||
float stickY = pad->GetCarGunUpDown();
|
||||
|
||||
// In SA this checks for m_bUseMouse3rdPerson so num2/num8 do not move camera when Keyboard & Mouse controls are used.
|
||||
if (CCamera::m_bUseMouse3rdPerson)
|
||||
stickY = 0.0f;
|
||||
|
||||
|
|
|
@ -244,7 +244,14 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
|||
return STREAM_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef BIG_IMG
|
||||
LARGE_INTEGER liDistanceToMove;
|
||||
liDistanceToMove.QuadPart = _GET_OFFSET(offset);
|
||||
liDistanceToMove.QuadPart *= CDSTREAM_SECTOR_SIZE;
|
||||
SetFilePointerEx(hImage, liDistanceToMove, nil, FILE_BEGIN);
|
||||
#else
|
||||
SetFilePointer(hImage, _GET_OFFSET(offset) * CDSTREAM_SECTOR_SIZE, nil, FILE_BEGIN);
|
||||
#endif
|
||||
|
||||
DWORD NumberOfBytesRead;
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@ void *CdStreamThread(void *param)
|
|||
ASSERT(pChannel->hFile >= 0);
|
||||
ASSERT(pChannel->pBuffer != nil );
|
||||
|
||||
lseek(pChannel->hFile, pChannel->nSectorOffset * CDSTREAM_SECTOR_SIZE, SEEK_SET);
|
||||
lseek(pChannel->hFile, (size_t)pChannel->nSectorOffset * (size_t)CDSTREAM_SECTOR_SIZE, SEEK_SET);
|
||||
if (read(pChannel->hFile, pChannel->pBuffer, pChannel->nSectorsToRead * CDSTREAM_SECTOR_SIZE) == -1) {
|
||||
// pChannel->nSectorsToRead == 0 at this point means we wanted to flush channel
|
||||
// STREAM_WAITING is a little hack to make CStreaming not process this data
|
||||
|
|
|
@ -2348,8 +2348,252 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
|
|||
return num;
|
||||
}
|
||||
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
#define VFB(b) b,
|
||||
#else
|
||||
#define VFB(b)
|
||||
#endif
|
||||
|
||||
#define CONTROLLER_BUTTONS(T, O, X, Q, L1, L2, L3, R1, R2, R3, SELECT) \
|
||||
{{ \
|
||||
O, /* PED_FIREWEAPON */ \
|
||||
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
|
||||
L2, /* PED_CYCLE_WEAPON_LEFT */ \
|
||||
nil, /* GO_FORWARD */ \
|
||||
nil, /* GO_BACK */ \
|
||||
nil, /* GO_LEFT */ \
|
||||
nil, /* GO_RIGHT */ \
|
||||
Q, /* PED_SNIPER_ZOOM_IN */ \
|
||||
X, /* PED_SNIPER_ZOOM_OUT */ \
|
||||
T, /* VEHICLE_ENTER_EXIT */ \
|
||||
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
|
||||
Q, /* PED_JUMPING */ \
|
||||
X, /* PED_SPRINT */ \
|
||||
R3, /* PED_LOOKBEHIND */ \
|
||||
VFB(O) /* VEHICLE_FIREWEAPON */ \
|
||||
X, /* VEHICLE_ACCELERATE */ \
|
||||
Q, /* VEHICLE_BRAKE */ \
|
||||
L1, /* VEHICLE_CHANGE_RADIO_STATION */ \
|
||||
L3, /* VEHICLE_HORN */ \
|
||||
R3, /* TOGGLE_SUBMISSIONS */ \
|
||||
R1, /* VEHICLE_HANDBRAKE */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
|
||||
L2, /* VEHICLE_LOOKLEFT */ \
|
||||
R2, /* VEHICLE_LOOKRIGHT */ \
|
||||
nil, /* VEHICLE_LOOKBEHIND */ \
|
||||
nil, /* VEHICLE_TURRETLEFT */ \
|
||||
nil, /* VEHICLE_TURRETRIGHT */ \
|
||||
nil, /* VEHICLE_TURRETUP */ \
|
||||
nil, /* VEHICLE_TURRETDOWN */ \
|
||||
L2, /* PED_CYCLE_TARGET_LEFT */ \
|
||||
R2, /* PED_CYCLE_TARGET_RIGHT */ \
|
||||
L1, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
|
||||
R1, /* PED_LOCK_TARGET */ \
|
||||
nil, /* NETWORK_TALK */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_UP */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
|
||||
nil, /* _CONTROLLERACTION_36 */ \
|
||||
nil, /* TOGGLE_DPAD */ \
|
||||
nil, /* SWITCH_DEBUG_CAM_ON */ \
|
||||
nil, /* TAKE_SCREEN_SHOT */ \
|
||||
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
|
||||
}, \
|
||||
{ \
|
||||
O, /* PED_FIREWEAPON */ \
|
||||
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
|
||||
L2, /* PED_CYCLE_WEAPON_LEFT */ \
|
||||
nil, /* GO_FORWARD */ \
|
||||
nil, /* GO_BACK */ \
|
||||
nil, /* GO_LEFT */ \
|
||||
nil, /* GO_RIGHT */ \
|
||||
Q, /* PED_SNIPER_ZOOM_IN */ \
|
||||
X, /* PED_SNIPER_ZOOM_OUT */ \
|
||||
T, /* VEHICLE_ENTER_EXIT */ \
|
||||
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
|
||||
Q, /* PED_JUMPING */ \
|
||||
X, /* PED_SPRINT */ \
|
||||
R3, /* PED_LOOKBEHIND */ \
|
||||
VFB(O) /* VEHICLE_FIREWEAPON */ \
|
||||
X, /* VEHICLE_ACCELERATE */ \
|
||||
Q, /* VEHICLE_BRAKE */ \
|
||||
SELECT, /* VEHICLE_CHANGE_RADIO_STATION */ \
|
||||
L1, /* VEHICLE_HORN */ \
|
||||
R3, /* TOGGLE_SUBMISSIONS */ \
|
||||
R1, /* VEHICLE_HANDBRAKE */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
|
||||
L2, /* VEHICLE_LOOKLEFT */ \
|
||||
R2, /* VEHICLE_LOOKRIGHT */ \
|
||||
nil, /* VEHICLE_LOOKBEHIND */ \
|
||||
nil, /* VEHICLE_TURRETLEFT */ \
|
||||
nil, /* VEHICLE_TURRETRIGHT */ \
|
||||
nil, /* VEHICLE_TURRETUP */ \
|
||||
nil, /* VEHICLE_TURRETDOWN */ \
|
||||
L2, /* PED_CYCLE_TARGET_LEFT */ \
|
||||
R2, /* PED_CYCLE_TARGET_RIGHT */ \
|
||||
L1, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
|
||||
R1, /* PED_LOCK_TARGET */ \
|
||||
nil, /* NETWORK_TALK */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_UP */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
|
||||
nil, /* _CONTROLLERACTION_36 */ \
|
||||
nil, /* TOGGLE_DPAD */ \
|
||||
nil, /* SWITCH_DEBUG_CAM_ON */ \
|
||||
nil, /* TAKE_SCREEN_SHOT */ \
|
||||
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
|
||||
}, \
|
||||
{ \
|
||||
X, /* PED_FIREWEAPON */ \
|
||||
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
|
||||
L2, /* PED_CYCLE_WEAPON_LEFT */ \
|
||||
nil, /* GO_FORWARD */ \
|
||||
nil, /* GO_BACK */ \
|
||||
nil, /* GO_LEFT */ \
|
||||
nil, /* GO_RIGHT */ \
|
||||
T, /* PED_SNIPER_ZOOM_IN */ \
|
||||
Q, /* PED_SNIPER_ZOOM_OUT */ \
|
||||
L1, /* VEHICLE_ENTER_EXIT */ \
|
||||
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
|
||||
Q, /* PED_JUMPING */ \
|
||||
O, /* PED_SPRINT */ \
|
||||
R3, /* PED_LOOKBEHIND */ \
|
||||
VFB(O) /* VEHICLE_FIREWEAPON */ \
|
||||
X, /* VEHICLE_ACCELERATE */ \
|
||||
Q, /* VEHICLE_BRAKE */ \
|
||||
L3, /* VEHICLE_CHANGE_RADIO_STATION */ \
|
||||
R1, /* VEHICLE_HORN */ \
|
||||
R3, /* TOGGLE_SUBMISSIONS */ \
|
||||
T, /* VEHICLE_HANDBRAKE */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
|
||||
L2, /* VEHICLE_LOOKLEFT */ \
|
||||
R2, /* VEHICLE_LOOKRIGHT */ \
|
||||
nil, /* VEHICLE_LOOKBEHIND */ \
|
||||
nil, /* VEHICLE_TURRETLEFT */ \
|
||||
nil, /* VEHICLE_TURRETRIGHT */ \
|
||||
nil, /* VEHICLE_TURRETUP */ \
|
||||
nil, /* VEHICLE_TURRETDOWN */ \
|
||||
L2, /* PED_CYCLE_TARGET_LEFT */ \
|
||||
R2, /* PED_CYCLE_TARGET_RIGHT */ \
|
||||
T, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
|
||||
R1, /* PED_LOCK_TARGET */ \
|
||||
nil, /* NETWORK_TALK */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_UP */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
|
||||
nil, /* _CONTROLLERACTION_36 */ \
|
||||
nil, /* TOGGLE_DPAD */ \
|
||||
nil, /* SWITCH_DEBUG_CAM_ON */ \
|
||||
nil, /* TAKE_SCREEN_SHOT */ \
|
||||
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
|
||||
}, \
|
||||
{ \
|
||||
R1, /* PED_FIREWEAPON */ \
|
||||
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
|
||||
L2, /* PED_CYCLE_WEAPON_LEFT */ \
|
||||
nil, /* GO_FORWARD */ \
|
||||
nil, /* GO_BACK */ \
|
||||
nil, /* GO_LEFT */ \
|
||||
nil, /* GO_RIGHT */ \
|
||||
Q, /* PED_SNIPER_ZOOM_IN */ \
|
||||
X, /* PED_SNIPER_ZOOM_OUT */ \
|
||||
T, /* VEHICLE_ENTER_EXIT */ \
|
||||
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
|
||||
Q, /* PED_JUMPING */ \
|
||||
X, /* PED_SPRINT */ \
|
||||
R3, /* PED_LOOKBEHIND */ \
|
||||
VFB(R1) /* VEHICLE_FIREWEAPON */ \
|
||||
nil, /* VEHICLE_ACCELERATE */ \
|
||||
nil, /* VEHICLE_BRAKE */ \
|
||||
O, /* VEHICLE_CHANGE_RADIO_STATION */ \
|
||||
L3, /* VEHICLE_HORN */ \
|
||||
Q, /* TOGGLE_SUBMISSIONS */ \
|
||||
L1, /* VEHICLE_HANDBRAKE */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
|
||||
L2, /* VEHICLE_LOOKLEFT */ \
|
||||
R2, /* VEHICLE_LOOKRIGHT */ \
|
||||
nil, /* VEHICLE_LOOKBEHIND */ \
|
||||
nil, /* VEHICLE_TURRETLEFT */ \
|
||||
nil, /* VEHICLE_TURRETRIGHT */ \
|
||||
nil, /* VEHICLE_TURRETUP */ \
|
||||
nil, /* VEHICLE_TURRETDOWN */ \
|
||||
L2, /* PED_CYCLE_TARGET_LEFT */ \
|
||||
R2, /* PED_CYCLE_TARGET_RIGHT */ \
|
||||
O, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
|
||||
L1, /* PED_LOCK_TARGET */ \
|
||||
nil, /* NETWORK_TALK */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_UP */ \
|
||||
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
|
||||
nil, /* _CONTROLLERACTION_36 */ \
|
||||
nil, /* TOGGLE_DPAD */ \
|
||||
nil, /* SWITCH_DEBUG_CAM_ON */ \
|
||||
nil, /* TAKE_SCREEN_SHOT */ \
|
||||
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
|
||||
}}
|
||||
|
||||
|
||||
const char *XboxButtons_noIcons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("Y", "B", "A", "X", "LB", "LT", "LS", "RB", "RT", "RS", "BACK");
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK");
|
||||
#endif
|
||||
|
||||
|
||||
#if 0 // set 1 for ps2 fonts
|
||||
#define PS2_TRIANGLE "\""
|
||||
#define PS2_CIRCLE "|"
|
||||
#define PS2_CROSS "/"
|
||||
#define PS2_SQUARE "^"
|
||||
#elif defined(BUTTON_ICONS)
|
||||
#define PS2_TRIANGLE "~T~"
|
||||
#define PS2_CIRCLE "~O~"
|
||||
#define PS2_CROSS "~X~"
|
||||
#define PS2_SQUARE "~Q~"
|
||||
#else
|
||||
#define PS2_TRIANGLE "TRIANGLE"
|
||||
#define PS2_CIRCLE "CIRCLE"
|
||||
#define PS2_CROSS "CROSS"
|
||||
#define PS2_SQUARE "SQUARE"
|
||||
#endif
|
||||
|
||||
const char *PlayStationButtons_noIcons[][MAX_CONTROLLERACTIONS] =
|
||||
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "L1", "L2", "L3", "R1", "R2", "R3", "SELECT");
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
|
||||
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT");
|
||||
#endif
|
||||
|
||||
#undef PS2_TRIANGLE
|
||||
#undef PS2_CIRCLE
|
||||
#undef PS2_CROSS
|
||||
#undef PS2_SQUARE
|
||||
|
||||
#undef CONTROLLER_BUTTONS
|
||||
#undef VFB
|
||||
|
||||
void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight)
|
||||
{
|
||||
#ifdef DETECT_PAD_INPUT_SWITCH
|
||||
if (CPad::GetPad(0)->IsAffectedByController) {
|
||||
wchar wstr[16];
|
||||
|
||||
// TODO: INI and/or menu setting for Xbox/PS switch
|
||||
#ifdef BUTTON_ICONS
|
||||
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
|
||||
#else
|
||||
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons_noIcons;
|
||||
#endif
|
||||
|
||||
assert(Buttons[CPad::GetPad(0)->Mode][action] != nil); // we cannot use these
|
||||
AsciiToUnicode(Buttons[CPad::GetPad(0)->Mode][action], wstr);
|
||||
|
||||
CMessages::WideStringCopy(text, wstr, leight);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32 nums = GetNumOfSettingsForAction((e_ControllerAction)action);
|
||||
|
||||
int32 sets = 0;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <ctype.h>
|
||||
#include "main.h"
|
||||
|
||||
#include "General.h"
|
||||
#include "Quaternion.h"
|
||||
#include "ModelInfo.h"
|
||||
#include "ModelIndices.h"
|
||||
|
@ -24,6 +25,7 @@
|
|||
#include "ZoneCull.h"
|
||||
#include "CdStream.h"
|
||||
#include "FileLoader.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "Streaming.h"
|
||||
#include "ColStore.h"
|
||||
#include "Occlusion.h"
|
||||
|
@ -74,11 +76,13 @@ CFileLoader::LoadLevel(const char *filename)
|
|||
if(strncmp(line, "IMAGEPATH", 9) == 0){
|
||||
RwImageSetPath(line + 10);
|
||||
}else if(strncmp(line, "TEXDICTION", 10) == 0){
|
||||
PUSH_MEMID(MEMID_TEXTURES);
|
||||
strcpy(txdname, line+11);
|
||||
LoadingScreenLoadingFile(txdname);
|
||||
RwTexDictionary *txd = LoadTexDictionary(txdname);
|
||||
AddTexDictionaries(savedTxd, txd);
|
||||
RwTexDictionaryDestroy(txd);
|
||||
POP_MEMID();
|
||||
}else if(strncmp(line, "COLFILE", 7) == 0){
|
||||
LoadingScreenLoadingFile(line+10);
|
||||
LoadCollisionFile(line+10, 0);
|
||||
|
@ -94,6 +98,7 @@ CFileLoader::LoadLevel(const char *filename)
|
|||
}else if(strncmp(line, "IPL", 3) == 0){
|
||||
if(!objectsLoaded){
|
||||
LoadingScreenLoadingFile("Collision");
|
||||
POP_MEMID();
|
||||
CObjectData::Initialise("DATA\\OBJECT.DAT");
|
||||
CStreaming::Init();
|
||||
CColStore::LoadAllCollision();
|
||||
|
@ -102,6 +107,7 @@ CFileLoader::LoadLevel(const char *filename)
|
|||
CModelInfo::GetModelInfo(i)->ConvertAnimFileIndex();
|
||||
objectsLoaded = true;
|
||||
}
|
||||
PUSH_MEMID(MEMID_WORLD);
|
||||
LoadingScreenLoadingFile(line + 4);
|
||||
LoadScene(line + 4);
|
||||
}else if(strncmp(line, "SPLASH", 6) == 0){
|
||||
|
@ -172,6 +178,8 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
|
|||
CBaseModelInfo *mi;
|
||||
ColHeader header;
|
||||
|
||||
PUSH_MEMID(MEMID_COLLISION);
|
||||
|
||||
debug("Loading collision file %s\n", filename);
|
||||
fd = CFileMgr::OpenFile(filename, "rb");
|
||||
assert(fd > 0);
|
||||
|
@ -197,6 +205,8 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
|
|||
}
|
||||
|
||||
CFileMgr::CloseFile(fd);
|
||||
|
||||
POP_MEMID();
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,6 +301,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
|
|||
buf += 44;
|
||||
if(model.numSpheres > 0){
|
||||
model.spheres = (CColSphere*)RwMalloc(model.numSpheres*sizeof(CColSphere));
|
||||
REGISTER_MEMPTR(&model.spheres);
|
||||
for(i = 0; i < model.numSpheres; i++){
|
||||
model.spheres[i].Set(*(float*)buf, *(CVector*)(buf+4), buf[16], buf[17]);
|
||||
buf += 20;
|
||||
|
@ -315,6 +326,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
|
|||
buf += 4;
|
||||
if(model.numBoxes > 0){
|
||||
model.boxes = (CColBox*)RwMalloc(model.numBoxes*sizeof(CColBox));
|
||||
REGISTER_MEMPTR(&model.boxes);
|
||||
for(i = 0; i < model.numBoxes; i++){
|
||||
model.boxes[i].Set(*(CVector*)buf, *(CVector*)(buf+12), buf[24], buf[25]);
|
||||
buf += 28;
|
||||
|
@ -326,6 +338,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
|
|||
buf += 4;
|
||||
if(numVertices > 0){
|
||||
model.vertices = (CompressedVector*)RwMalloc(numVertices*sizeof(CompressedVector));
|
||||
REGISTER_MEMPTR(&model.vertices);
|
||||
for(i = 0; i < numVertices; i++){
|
||||
model.vertices[i].Set(*(float*)buf, *(float*)(buf+4), *(float*)(buf+8));
|
||||
#if 0
|
||||
|
@ -343,6 +356,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
|
|||
buf += 4;
|
||||
if(model.numTriangles > 0){
|
||||
model.triangles = (CColTriangle*)RwMalloc(model.numTriangles*sizeof(CColTriangle));
|
||||
REGISTER_MEMPTR(&model.triangles);
|
||||
for(i = 0; i < model.numTriangles; i++){
|
||||
model.triangles[i].Set(*(int32*)buf, *(int32*)(buf+4), *(int32*)(buf+8), buf[12]);
|
||||
buf += 16;
|
||||
|
|
|
@ -53,6 +53,7 @@ const CRGBA DARKMENUOPTION_COLOR(195, 90, 165, 255);
|
|||
const CRGBA SLIDERON_COLOR(97, 194, 247, 255);
|
||||
const CRGBA SLIDEROFF_COLOR(27, 89, 130, 255);
|
||||
const CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 130);
|
||||
const CRGBA LIST_OPTION_COLOR(155, 155, 155, 255);
|
||||
const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR;
|
||||
const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100);
|
||||
const CRGBA SCROLLBAR_COLOR = LABEL_COLOR;
|
||||
|
@ -969,6 +970,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
|
|||
uint8 section = 0; // 0: highlight trapezoid 1: texts
|
||||
|
||||
while (section < 2) {
|
||||
#endif
|
||||
|
||||
#ifdef SCROLLABLE_PAGES
|
||||
int firstOption = SCREEN_HAS_AUTO_SCROLLBAR ? m_nFirstVisibleRowOnList : 0;
|
||||
|
@ -2572,7 +2574,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
|
|||
} else if (!strcmp(m_PrefsSkinFile, m_pSelectedSkin->skinNameOriginal)) {
|
||||
CFont::SetColor(CRGBA(255, 255, 155, FadeIn(255)));
|
||||
} else {
|
||||
CFont::SetColor(CRGBA(155, 155, 155, FadeIn(255)));
|
||||
CFont::SetColor(CRGBA(LIST_OPTION_COLOR.r, LIST_OPTION_COLOR.g, LIST_OPTION_COLOR.b, FadeIn(LIST_OPTION_COLOR.a)));
|
||||
}
|
||||
wchar unicodeTemp[80];
|
||||
AsciiToUnicode(m_pSelectedSkin->skinNameDisplayed, unicodeTemp);
|
||||
|
@ -2598,14 +2600,13 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
|
|||
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP),
|
||||
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBAR_WIDTH), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)), CRGBA(100, 100, 66, FadeIn(205)));
|
||||
|
||||
// Scrollbar
|
||||
float scrollbarHeight = SCROLLBAR_MAX_HEIGHT / m_nSkinsTotal * (float) MAX_VISIBLE_LIST_ROW;
|
||||
float scrollbarHeight = SCROLLBAR_MAX_HEIGHT / (m_nSkinsTotal / (float) MAX_VISIBLE_LIST_ROW);
|
||||
float scrollbarBottom, scrollbarTop;
|
||||
if (m_nSkinsTotal <= MAX_VISIBLE_LIST_ROW) {
|
||||
scrollbarBottom = SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 4.0f);
|
||||
scrollbarTop = MENU_Y(PLAYERSETUP_LIST_BODY_TOP);
|
||||
|
||||
// Shadow
|
||||
// Scrollbar shadow
|
||||
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4), scrollbarTop,
|
||||
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 1 - PLAYERSETUP_SCROLLBAR_WIDTH), scrollbarBottom + MENU_Y(1.0f)), CRGBA(50, 50, 50, FadeIn(255)));
|
||||
} else {
|
||||
|
@ -2616,12 +2617,13 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
|
|||
scrollbarBottom = MENU_Y(PLAYERSETUP_LIST_BODY_TOP - 4 + m_nScrollbarTopMargin + scrollbarHeight - SCROLLBAR_MAX_HEIGHT / m_nSkinsTotal);
|
||||
scrollbarTop = MENU_Y(SCROLLBAR_MAX_HEIGHT / m_nSkinsTotal + PLAYERSETUP_LIST_BODY_TOP - 3 + m_nScrollbarTopMargin);
|
||||
#endif
|
||||
// Shadow
|
||||
// Scrollbar shadow
|
||||
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4), scrollbarTop,
|
||||
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 1 - PLAYERSETUP_SCROLLBAR_WIDTH), scrollbarBottom + MENU_Y(1.0f)),
|
||||
CRGBA(50, 50, 50, FadeIn(255)));
|
||||
|
||||
}
|
||||
// Scrollbar
|
||||
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 4), scrollbarTop,
|
||||
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - PLAYERSETUP_SCROLLBAR_WIDTH), scrollbarBottom),
|
||||
CRGBA(SCROLLBAR_COLOR.r, SCROLLBAR_COLOR.g, SCROLLBAR_COLOR.b, FadeIn(255)));
|
||||
|
@ -5690,5 +5692,3 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
|
|||
|
||||
#undef GetBackJustUp
|
||||
#undef GetBackJustDown
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "Game.h"
|
||||
#include "World.h"
|
||||
#include "PlayerInfo.h"
|
||||
#include "FrontendControls.h"
|
||||
#include "FrontEndControls.h"
|
||||
#include "MemoryCard.h"
|
||||
|
||||
#define CRect_SZ(x, y, w, h) CRect(x, y, x+w, y+h)
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "MBlur.h"
|
||||
#include "Messages.h"
|
||||
#include "MemoryCard.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "Pad.h"
|
||||
#include "Particle.h"
|
||||
#include "ParticleObject.h"
|
||||
|
@ -190,6 +191,18 @@ CGame::InitialiseRenderWare(void)
|
|||
CTxdStore::Initialise();
|
||||
CVisibilityPlugins::Initialise();
|
||||
|
||||
//InitialiseScene(Scene); // PS2 only, only clears Scene.camera
|
||||
|
||||
#ifdef GTA_PS2
|
||||
RpSkySelectTrueTSClipper(TRUE);
|
||||
RpSkySelectTrueTLClipper(TRUE);
|
||||
|
||||
// PS2ManagerApplyDirectionalLightingCB() uploads the GTA lights
|
||||
// directly without going through RpWorld and all that
|
||||
SetupPS2ManagerDefaultLightingCallback();
|
||||
PreAllocateRwObjects();
|
||||
#endif
|
||||
|
||||
/* Create camera */
|
||||
Scene.camera = CameraCreate(SCREEN_WIDTH, SCREEN_HEIGHT, TRUE);
|
||||
ASSERT(Scene.camera != nil);
|
||||
|
@ -198,7 +211,7 @@ CGame::InitialiseRenderWare(void)
|
|||
return (false);
|
||||
}
|
||||
|
||||
RwCameraSetFarClipPlane(Scene.camera, 2000.0f);
|
||||
RwCameraSetFarClipPlane(Scene.camera, 2000.0f); // 250.0f on PS2 but who cares
|
||||
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
|
||||
|
||||
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
|
@ -239,13 +252,17 @@ CGame::InitialiseRenderWare(void)
|
|||
#endif // PS2_ALPHA_TEST
|
||||
#endif // LIBRW
|
||||
|
||||
PUSH_MEMID(MEMID_TEXTURES);
|
||||
CFont::Initialise();
|
||||
CHud::Initialise();
|
||||
POP_MEMID();
|
||||
|
||||
CPlayerSkin::Initialise();
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
// missing altogether on PS2
|
||||
void CGame::ShutdownRenderWare(void)
|
||||
{
|
||||
DestroySplashScreen();
|
||||
|
@ -255,6 +272,7 @@ void CGame::ShutdownRenderWare(void)
|
|||
for ( int32 i = 0; i < NUMPLAYERS; i++ )
|
||||
CWorld::Players[i].DeletePlayerSkin();
|
||||
|
||||
// TODO: define
|
||||
CPlayerSkin::Shutdown();
|
||||
|
||||
DestroyDebugFont();
|
||||
|
@ -277,6 +295,7 @@ void CGame::ShutdownRenderWare(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
// missing altogether on PS2
|
||||
bool CGame::InitialiseOnceAfterRW(void)
|
||||
{
|
||||
TheText.Load();
|
||||
|
@ -306,6 +325,7 @@ bool CGame::InitialiseOnceAfterRW(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
// missing altogether on PS2
|
||||
void
|
||||
CGame::FinalShutdown(void)
|
||||
{
|
||||
|
@ -316,25 +336,41 @@ CGame::FinalShutdown(void)
|
|||
|
||||
bool CGame::Initialise(const char* datFile)
|
||||
{
|
||||
#ifdef GTA_PS2
|
||||
// TODO: upload VU0 collision code here
|
||||
#endif
|
||||
|
||||
ResetLoadingScreenBar();
|
||||
strcpy(aDatFile, datFile);
|
||||
CPools::Initialise();
|
||||
|
||||
#ifndef GTA_PS2
|
||||
CIniFile::LoadIniFile();
|
||||
#endif
|
||||
#ifdef USE_TEXTURE_POOL
|
||||
_TexturePoolsUnknown(false);
|
||||
#endif
|
||||
currLevel = LEVEL_BEACH;
|
||||
currArea = AREA_MAIN_MAP;
|
||||
|
||||
PUSH_MEMID(MEMID_TEXTURES);
|
||||
LoadingScreen("Loading the Game", "Loading generic textures", GetRandomSplashScreen());
|
||||
gameTxdSlot = CTxdStore::AddTxdSlot("generic");
|
||||
CTxdStore::Create(gameTxdSlot);
|
||||
CTxdStore::AddRef(gameTxdSlot);
|
||||
|
||||
LoadingScreen("Loading the Game", "Loading particles", nil);
|
||||
int particleTxdSlot = CTxdStore::AddTxdSlot("particle");
|
||||
CTxdStore::LoadTxd(particleTxdSlot, "MODELS/PARTICLE.TXD");
|
||||
CTxdStore::AddRef(particleTxdSlot);
|
||||
CTxdStore::SetCurrentTxd(gameTxdSlot);
|
||||
LoadingScreen("Loading the Game", "Setup game variables", nil);
|
||||
POP_MEMID();
|
||||
|
||||
#ifdef GTA_PS2
|
||||
CDma::SyncChannel(0, true);
|
||||
#endif
|
||||
|
||||
CGameLogic::InitAtStartOfGame();
|
||||
CReferences::Init();
|
||||
TheCamera.Init();
|
||||
|
@ -354,21 +390,33 @@ bool CGame::Initialise(const char* datFile)
|
|||
CMessages::ClearAllMessagesDisplayedByGame();
|
||||
CRecordDataForGame::Init();
|
||||
CRestart::Initialise();
|
||||
|
||||
PUSH_MEMID(MEMID_WORLD);
|
||||
CWorld::Initialise();
|
||||
POP_MEMID();
|
||||
|
||||
PUSH_MEMID(MEMID_TEXTURES);
|
||||
CParticle::Initialise();
|
||||
#ifdef PS2
|
||||
gStartX = -180.0f;
|
||||
gStartY = 180.0f;
|
||||
gStartZ = 14.0f;
|
||||
#endif
|
||||
POP_MEMID();
|
||||
|
||||
PUSH_MEMID(MEMID_ANIMATION);
|
||||
CAnimManager::Initialise();
|
||||
CCutsceneMgr::Initialise();
|
||||
POP_MEMID();
|
||||
|
||||
PUSH_MEMID(MEMID_CARS);
|
||||
CCarCtrl::Init();
|
||||
POP_MEMID();
|
||||
|
||||
InitModelIndices();
|
||||
|
||||
PUSH_MEMID(MEMID_DEF_MODELS);
|
||||
CModelInfo::Initialise();
|
||||
CPickups::Init();
|
||||
CTheCarGenerators::Init();
|
||||
|
||||
CdStreamAddImage("MODELS\\GTA3.IMG");
|
||||
|
||||
CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
|
||||
CFileLoader::LoadLevel(datFile);
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
@ -399,6 +447,8 @@ bool CGame::Initialise(const char* datFile)
|
|||
CStreaming::RemoveIslandsNotUsed(currLevel);
|
||||
printf("Streaming uses %zuK of its memory", CStreaming::ms_memoryUsed / 1024); // original modifier was %d
|
||||
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
|
||||
|
||||
PUSH_MEMID(MEMID_ANIMATION);
|
||||
CAnimManager::LoadAnimFiles();
|
||||
CStreaming::LoadInitialWeapons();
|
||||
CStreaming::LoadAllRequestedModels(0);
|
||||
|
@ -410,13 +460,16 @@ bool CGame::Initialise(const char* datFile)
|
|||
#endif
|
||||
LoadingScreen("Loading the Game", "Find big buildings", nil);
|
||||
CRenderer::Init();
|
||||
|
||||
LoadingScreen("Loading the Game", "Setup game variables", nil);
|
||||
CRadar::Initialise();
|
||||
CRadar::LoadTextures();
|
||||
CWeapon::InitialiseWeapons();
|
||||
|
||||
LoadingScreen("Loading the Game", "Setup traffic lights", nil);
|
||||
CTrafficLights::ScanForLightsOnMap();
|
||||
CRoadBlocks::Init();
|
||||
|
||||
LoadingScreen("Loading the Game", "Setup game variables", nil);
|
||||
CPopulation::Initialise();
|
||||
CWorld::PlayerInFocus = 0;
|
||||
|
@ -431,8 +484,11 @@ bool CGame::Initialise(const char* datFile)
|
|||
CSceneEdit::Initialise();
|
||||
#endif
|
||||
LoadingScreen("Loading the Game", "Load scripts", nil);
|
||||
PUSH_MEMID(MEMID_SCRIPT);
|
||||
CTheScripts::Init();
|
||||
CGangs::Initialise();
|
||||
POP_MEMID();
|
||||
|
||||
LoadingScreen("Loading the Game", "Setup game variables", nil);
|
||||
CClock::Initialise(1000);
|
||||
CHeli::InitHelis();
|
||||
|
@ -448,24 +504,26 @@ bool CGame::Initialise(const char* datFile)
|
|||
CWaterCannons::Init();
|
||||
CBridge::Init();
|
||||
CGarages::Init();
|
||||
|
||||
LoadingScreen("Loading the Game", "Position dynamic objects", nil);
|
||||
LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
|
||||
|
||||
CTrain::InitTrains();
|
||||
CPlane::InitPlanes();
|
||||
CCredits::Init();
|
||||
CRecordDataForChase::Init();
|
||||
CReplay::Init();
|
||||
|
||||
#ifdef PS2_MENU
|
||||
if ( !TheMemoryCard.m_bWantToLoad )
|
||||
{
|
||||
#endif
|
||||
{
|
||||
LoadingScreen("Loading the Game", "Start script", nil);
|
||||
CTheScripts::StartTestScript();
|
||||
CTheScripts::Process();
|
||||
TheCamera.Process();
|
||||
#ifdef PS2_MENU
|
||||
}
|
||||
#endif
|
||||
|
||||
LoadingScreen("Loading the Game", "Load scene", nil);
|
||||
CCollision::ms_collisionInMemory = currLevel;
|
||||
for (int i = 0; i < MAX_PADS; i++)
|
||||
|
@ -490,9 +548,7 @@ bool CGame::ShutDown(void)
|
|||
CScriptPaths::Shutdown();
|
||||
CWaterCreatures::RemoveAll();
|
||||
CSpecialFX::Shutdown();
|
||||
#ifndef PS2
|
||||
CGarages::Shutdown();
|
||||
#endif
|
||||
CMovingThings::Shutdown();
|
||||
gPhoneInfo.Shutdown();
|
||||
CWeapon::ShutdownWeapons();
|
||||
|
@ -546,13 +602,11 @@ void CGame::ReInitGameObjectVariables(void)
|
|||
CGameLogic::InitAtStartOfGame();
|
||||
#ifdef PS2_MENU
|
||||
if ( !TheMemoryCard.m_bWantToLoad )
|
||||
{
|
||||
#endif
|
||||
{
|
||||
TheCamera.Init();
|
||||
TheCamera.SetRwCamera(Scene.camera);
|
||||
#ifdef PS2_MENU
|
||||
}
|
||||
#endif
|
||||
CDebug::DebugInitTextBuffer();
|
||||
CWeather::Init();
|
||||
CUserDisplay::Init();
|
||||
|
@ -561,11 +615,6 @@ void CGame::ReInitGameObjectVariables(void)
|
|||
CWorld::bDoingCarCollisions = false;
|
||||
CHud::ReInitialise();
|
||||
CRadar::Initialise();
|
||||
#ifdef PS2
|
||||
gStartX = -180.0f;
|
||||
gStartY = 180.0f;
|
||||
gStartZ = 14.0f;
|
||||
#endif
|
||||
CCarCtrl::ReInit();
|
||||
CTimeCycle::Initialise();
|
||||
CDraw::SetFOV(120.0f);
|
||||
|
@ -587,15 +636,15 @@ void CGame::ReInitGameObjectVariables(void)
|
|||
CWorld::Players[i].Clear();
|
||||
|
||||
CWorld::PlayerInFocus = 0;
|
||||
#ifdef PS2
|
||||
CWeaponEffects::Init();
|
||||
CSkidmarks::Init();
|
||||
#endif
|
||||
CAntennas::Init();
|
||||
CGlass::Init();
|
||||
gPhoneInfo.Initialise();
|
||||
|
||||
PUSH_MEMID(MEMID_SCRIPT);
|
||||
CTheScripts::Init();
|
||||
CGangs::Initialise();
|
||||
POP_MEMID();
|
||||
|
||||
CTimer::Initialise();
|
||||
CClock::Initialise(1000);
|
||||
CTheCarGenerators::Init();
|
||||
|
@ -606,10 +655,6 @@ void CGame::ReInitGameObjectVariables(void)
|
|||
CPickups::Init();
|
||||
CPacManPickups::Init();
|
||||
CGarages::Init();
|
||||
#ifdef PS2
|
||||
CClouds::Init();
|
||||
CRemote::Init();
|
||||
#endif
|
||||
CSpecialFX::Init();
|
||||
CRopes::Init();
|
||||
CWaterCannons::Init();
|
||||
|
@ -748,13 +793,15 @@ void CGame::InitialiseWhenRestarting(void)
|
|||
void CGame::Process(void)
|
||||
{
|
||||
CPad::UpdatePads();
|
||||
#ifdef GTA_PS2
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
ProcessTidyUpMemory();
|
||||
#endif
|
||||
#ifdef DEBUGMENU
|
||||
DebugMenuProcess();
|
||||
#endif
|
||||
CCutsceneMgr::Update();
|
||||
|
||||
PUSH_MEMID(MEMID_FRONTEND);
|
||||
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
|
||||
FrontEndMenuManager.Process();
|
||||
CTheZones::Update();
|
||||
|
@ -773,7 +820,11 @@ void CGame::Process(void)
|
|||
CPad::DoCheats();
|
||||
CClock::Update();
|
||||
CWeather::Update();
|
||||
|
||||
PUSH_MEMID(MEMID_SCRIPT);
|
||||
CTheScripts::Process();
|
||||
POP_MEMID();
|
||||
|
||||
CCollision::Update();
|
||||
CScriptPaths::Update();
|
||||
CTrain::UpdateTrains();
|
||||
|
@ -807,7 +858,11 @@ void CGame::Process(void)
|
|||
CWaterCannons::Update();
|
||||
CUserDisplay::Process();
|
||||
CReplay::Update();
|
||||
|
||||
PUSH_MEMID(MEMID_WORLD);
|
||||
CWorld::Process();
|
||||
POP_MEMID();
|
||||
|
||||
gAccidentManager.Update();
|
||||
CPacManPickups::Update();
|
||||
CPickups::Update();
|
||||
|
@ -836,6 +891,366 @@ void CGame::Process(void)
|
|||
CCarCtrl::RemoveCarsIfThePoolGetsFull();
|
||||
}
|
||||
}
|
||||
#ifdef GTA_PS2
|
||||
CMemCheck::DoTest();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
|
||||
int32 gNumMemMoved;
|
||||
|
||||
bool
|
||||
MoveMem(void** ptr)
|
||||
{
|
||||
if (*ptr) {
|
||||
gNumMemMoved++;
|
||||
void* newPtr = gMainHeap.MoveMemory(*ptr);
|
||||
if (*ptr != newPtr) {
|
||||
*ptr = newPtr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some convenience structs
|
||||
struct SkyDataPrefix
|
||||
{
|
||||
uint32 pktSize1;
|
||||
uint32 data; // pointer to data as read from TXD
|
||||
uint32 pktSize2;
|
||||
uint32 unused;
|
||||
};
|
||||
|
||||
struct DMAGIFUpload
|
||||
{
|
||||
uint32 tag1_qwc, tag1_addr; // dmaref
|
||||
uint32 nop1, vif_direct1;
|
||||
|
||||
uint32 giftag[4];
|
||||
uint32 gs_bitbltbuf[4];
|
||||
|
||||
uint32 tag2_qwc, tag2_addr; // dmaref
|
||||
uint32 nop2, vif_direct2;
|
||||
};
|
||||
|
||||
// This is very scary. it depends on the exact memory layout of the DMA chains and whatnot
|
||||
RwTexture*
|
||||
MoveTextureMemoryCB(RwTexture* texture, void* pData)
|
||||
{
|
||||
#ifdef GTA_PS2
|
||||
bool* pRet = (bool*)pData;
|
||||
RwRaster* raster = RwTextureGetRaster(texture);
|
||||
_SkyRasterExt* rasterExt = RASTEREXTFROMRASTER(raster);
|
||||
if (raster->originalPixels == nil || // the raw data
|
||||
raster->cpPixels == raster->originalPixels || // old format, can't handle it
|
||||
rasterExt->dmaRefCount != 0 && rasterExt->dmaClrCount != 0)
|
||||
return texture;
|
||||
|
||||
// this is the allocated pointer we will move
|
||||
SkyDataPrefix* prefix = (SkyDataPrefix*)raster->originalPixels;
|
||||
DMAGIFUpload* uploads = (DMAGIFUpload*)(prefix + 1);
|
||||
|
||||
// We have 4qw for each upload,
|
||||
// i.e. for each buffer width of mip levels,
|
||||
// and the palette if there is one.
|
||||
// NB: this code does NOT support mipmaps!
|
||||
// so we assume two uploads (pixels and palette)
|
||||
//
|
||||
// each upload looks like this:
|
||||
// (DMAcnt; NOP; VIF DIRECT(2))
|
||||
// giftag (1, A+D)
|
||||
// GS_BITBLTBUF
|
||||
// (DMAref->pixel data; NOP; VIF DIRECT(5))
|
||||
// the DMArefs are what we have to adjust
|
||||
uintptr dataDiff, upload1Diff, upload2Diff, pixelDiff, paletteDiff;
|
||||
dataDiff = prefix->data - (uintptr)raster->originalPixels;
|
||||
upload1Diff = uploads[0].tag2_addr - (uintptr)raster->originalPixels;
|
||||
if (raster->palette)
|
||||
upload2Diff = uploads[1].tag2_addr - (uintptr)raster->originalPixels;
|
||||
pixelDiff = (uintptr)raster->cpPixels - (uintptr)raster->originalPixels;
|
||||
if (raster->palette)
|
||||
paletteDiff = (uintptr)raster->palette - (uintptr)raster->originalPixels;
|
||||
uint8* newptr = (uint8*)gMainHeap.MoveMemory(raster->originalPixels);
|
||||
if (newptr != raster->originalPixels) {
|
||||
// adjust everything
|
||||
prefix->data = (uintptr)newptr + dataDiff;
|
||||
uploads[0].tag2_addr = (uintptr)newptr + upload1Diff;
|
||||
if (raster->palette)
|
||||
uploads[1].tag2_addr = (uintptr)newptr + upload2Diff;
|
||||
raster->originalPixels = newptr;
|
||||
raster->cpPixels = newptr + pixelDiff;
|
||||
if (raster->palette)
|
||||
raster->palette = newptr + paletteDiff;
|
||||
|
||||
if (pRet) {
|
||||
*pRet = true;
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// nothing to do here really, everything should be in videomemory
|
||||
#endif
|
||||
return texture;
|
||||
}
|
||||
|
||||
bool
|
||||
MoveAtomicMemory(RpAtomic* atomic, bool onlyOne)
|
||||
{
|
||||
RpGeometry* geo = RpAtomicGetGeometry(atomic);
|
||||
|
||||
#if THIS_IS_COMPATIBLE_WITH_GTA3_RW31
|
||||
if (MoveMem((void**)&geo->triangles) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&geo->matList.materials) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&geo->preLitLum) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&geo->texCoords[0]) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&geo->texCoords[1]) && onlyOne)
|
||||
return true;
|
||||
|
||||
// verts and normals of morph target are allocated together
|
||||
int vertDiff;
|
||||
if (geo->morphTarget->normals)
|
||||
vertDiff = geo->morphTarget->normals - geo->morphTarget->verts;
|
||||
if (MoveMem((void**)&geo->morphTarget->verts)) {
|
||||
if (geo->morphTarget->normals)
|
||||
geo->morphTarget->normals = geo->morphTarget->verts + vertDiff;
|
||||
if (onlyOne)
|
||||
return true;
|
||||
}
|
||||
|
||||
RpMeshHeader* oldmesh = geo->mesh;
|
||||
if (MoveMem((void**)&geo->mesh)) {
|
||||
// index pointers are allocated together with meshes,
|
||||
// have to relocate those too
|
||||
RpMesh* mesh = (RpMesh*)(geo->mesh + 1);
|
||||
uintptr reloc = (uintptr)geo->mesh - (uintptr)oldmesh;
|
||||
for (int i = 0; i < geo->mesh->numMeshes; i++)
|
||||
mesh[i].indices = (RxVertexIndex*)((uintptr)mesh[i].indices + reloc);
|
||||
if (onlyOne)
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
// we could do something in librw here
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
MoveColModelMemory(CColModel& colModel, bool onlyOne)
|
||||
{
|
||||
#if GTA_VERSION >= GTA3_PS2_160
|
||||
// hm...should probably only do this if ownsCollisionVolumes
|
||||
// but it doesn't exist on PS2...
|
||||
if (!colModel.ownsCollisionVolumes)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (MoveMem((void**)&colModel.spheres) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&colModel.lines) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&colModel.boxes) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&colModel.vertices) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&colModel.triangles) && onlyOne)
|
||||
return true;
|
||||
if (MoveMem((void**)&colModel.trianglePlanes) && onlyOne)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
RpAtomic*
|
||||
MoveAtomicMemoryCB(RpAtomic* atomic, void* pData)
|
||||
{
|
||||
bool* pRet = (bool*)pData;
|
||||
if (pRet == nil)
|
||||
MoveAtomicMemory(atomic, false);
|
||||
else if (MoveAtomicMemory(atomic, true)) {
|
||||
*pRet = true;
|
||||
return nil;
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
|
||||
bool
|
||||
TidyUpModelInfo(CBaseModelInfo* modelInfo, bool onlyone)
|
||||
{
|
||||
if (modelInfo->GetColModel() && modelInfo->DoesOwnColModel())
|
||||
if (MoveColModelMemory(*modelInfo->GetColModel(), onlyone))
|
||||
return true;
|
||||
|
||||
RwObject* rwobj = modelInfo->GetRwObject();
|
||||
if (RwObjectGetType(rwobj) == rpATOMIC)
|
||||
if (MoveAtomicMemory((RpAtomic*)rwobj, onlyone))
|
||||
return true;
|
||||
if (RwObjectGetType(rwobj) == rpCLUMP) {
|
||||
bool ret = false;
|
||||
if (onlyone)
|
||||
RpClumpForAllAtomics((RpClump*)rwobj, MoveAtomicMemoryCB, &ret);
|
||||
else
|
||||
RpClumpForAllAtomics((RpClump*)rwobj, MoveAtomicMemoryCB, nil);
|
||||
if (ret)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (modelInfo->GetModelType() == MITYPE_PED && ((CPedModelInfo*)modelInfo)->m_hitColModel)
|
||||
if (MoveColModelMemory(*((CPedModelInfo*)modelInfo)->m_hitColModel, onlyone))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void CGame::DrasticTidyUpMemory(bool flushDraw)
|
||||
{
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
bool removedCol = false;
|
||||
|
||||
TidyUpMemory(true, flushDraw);
|
||||
|
||||
if (gMainHeap.GetLargestFreeBlock() < 200000 && !playingIntro) {
|
||||
CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL);
|
||||
CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL);
|
||||
CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN);
|
||||
TidyUpMemory(true, flushDraw);
|
||||
}
|
||||
|
||||
if (gMainHeap.GetLargestFreeBlock() < 200000 && !playingIntro) {
|
||||
CModelInfo::RemoveColModelsFromOtherLevels(LEVEL_GENERIC);
|
||||
TidyUpMemory(true, flushDraw);
|
||||
removedCol = true;
|
||||
}
|
||||
|
||||
if (gMainHeap.GetLargestFreeBlock() < 200000 && !playingIntro) {
|
||||
CStreaming::RemoveBigBuildings(LEVEL_INDUSTRIAL);
|
||||
CStreaming::RemoveBigBuildings(LEVEL_COMMERCIAL);
|
||||
CStreaming::RemoveBigBuildings(LEVEL_SUBURBAN);
|
||||
TidyUpMemory(true, flushDraw);
|
||||
}
|
||||
|
||||
if (removedCol) {
|
||||
// different on PS2
|
||||
CFileLoader::LoadCollisionFromDatFile(CCollision::ms_collisionInMemory);
|
||||
}
|
||||
|
||||
if (!playingIntro)
|
||||
CStreaming::RequestBigBuildings(currLevel);
|
||||
|
||||
CStreaming::LoadAllRequestedModels(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CGame::TidyUpMemory(bool moveTextures, bool flushDraw)
|
||||
{
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
printf("Largest free block before tidy %d\n", gMainHeap.GetLargestFreeBlock());
|
||||
|
||||
if (moveTextures) {
|
||||
if (flushDraw) {
|
||||
#ifdef GTA_PS2
|
||||
for (int i = 0; i < sweMaxFlips + 1; i++) {
|
||||
#else
|
||||
for (int i = 0; i < 5; i++) { // probably more than needed
|
||||
#endif
|
||||
RwCameraBeginUpdate(Scene.camera);
|
||||
RwCameraEndUpdate(Scene.camera);
|
||||
RwCameraShowRaster(Scene.camera, nil, 0);
|
||||
}
|
||||
}
|
||||
int fontSlot = CTxdStore::FindTxdSlot("fonts");
|
||||
|
||||
for (int i = 0; i < TXDSTORESIZE; i++) {
|
||||
if (i == fontSlot ||
|
||||
CTxdStore::GetSlot(i) == nil)
|
||||
continue;
|
||||
RwTexDictionary* txd = CTxdStore::GetSlot(i)->texDict;
|
||||
if (txd)
|
||||
RwTexDictionaryForAllTextures(txd, MoveTextureMemoryCB, nil);
|
||||
}
|
||||
}
|
||||
|
||||
// animations
|
||||
for (int i = 0; i < NUMANIMATIONS; i++) {
|
||||
CAnimBlendHierarchy* anim = CAnimManager::GetAnimation(i);
|
||||
if (anim == nil)
|
||||
continue; // cannot happen
|
||||
anim->MoveMemory();
|
||||
}
|
||||
|
||||
// model info
|
||||
for (int i = 0; i < MODELINFOSIZE; i++) {
|
||||
CBaseModelInfo* mi = CModelInfo::GetModelInfo(i);
|
||||
if (mi == nil)
|
||||
continue;
|
||||
TidyUpModelInfo(mi, false);
|
||||
}
|
||||
|
||||
printf("Largest free block after tidy %d\n", gMainHeap.GetLargestFreeBlock());
|
||||
#endif
|
||||
}
|
||||
|
||||
void CGame::ProcessTidyUpMemory(void)
|
||||
{
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
static int32 modelIndex = 0;
|
||||
static int32 animIndex = 0;
|
||||
static int32 txdIndex = 0;
|
||||
bool txdReturn = false;
|
||||
RwTexDictionary* txd = nil;
|
||||
gNumMemMoved = 0;
|
||||
|
||||
// model infos
|
||||
for (int numCleanedUp = 0; numCleanedUp < 10; numCleanedUp++) {
|
||||
CBaseModelInfo* mi;
|
||||
do {
|
||||
mi = CModelInfo::GetModelInfo(modelIndex);
|
||||
modelIndex++;
|
||||
if (modelIndex >= MODELINFOSIZE)
|
||||
modelIndex = 0;
|
||||
} while (mi == nil);
|
||||
|
||||
if (TidyUpModelInfo(mi, true))
|
||||
return;
|
||||
}
|
||||
|
||||
// tex dicts
|
||||
for (int numCleanedUp = 0; numCleanedUp < 3; numCleanedUp++) {
|
||||
if (gNumMemMoved > 80)
|
||||
break;
|
||||
|
||||
do {
|
||||
#ifdef FIX_BUGS
|
||||
txd = nil;
|
||||
#endif
|
||||
if (CTxdStore::GetSlot(txdIndex))
|
||||
txd = CTxdStore::GetSlot(txdIndex)->texDict;
|
||||
txdIndex++;
|
||||
if (txdIndex >= TXDSTORESIZE)
|
||||
txdIndex = 0;
|
||||
} while (txd == nil);
|
||||
|
||||
RwTexDictionaryForAllTextures(txd, MoveTextureMemoryCB, &txdReturn);
|
||||
if (txdReturn)
|
||||
return;
|
||||
}
|
||||
|
||||
// animations
|
||||
CAnimBlendHierarchy* anim;
|
||||
do {
|
||||
anim = CAnimManager::GetAnimation(animIndex);
|
||||
animIndex++;
|
||||
if (animIndex >= NUMANIMATIONS)
|
||||
animIndex = 0;
|
||||
} while (anim == nil); // always != nil
|
||||
anim->MoveMemory(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -861,30 +1276,3 @@ CGame::CanSeeOutSideFromCurrArea(void)
|
|||
return currArea == AREA_MAIN_MAP || currArea == AREA_MALL ||
|
||||
currArea == AREA_MANSION || currArea == AREA_HOTEL;
|
||||
}
|
||||
|
||||
void CGame::DrasticTidyUpMemory(bool)
|
||||
{
|
||||
#ifdef USE_TEXTURE_POOL
|
||||
// TODO
|
||||
#endif
|
||||
#ifdef PS2
|
||||
// meow
|
||||
#endif
|
||||
}
|
||||
|
||||
void CGame::TidyUpMemory(bool unk1, bool unk2)
|
||||
{
|
||||
#ifdef PS2
|
||||
// meow
|
||||
#endif
|
||||
if (unk2) {
|
||||
DrasticTidyUpMemory(true); // parameter is unknown too
|
||||
}
|
||||
}
|
||||
|
||||
void CGame::ProcessTidyUpMemory(void)
|
||||
{
|
||||
#ifdef PS2
|
||||
// meow
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -405,13 +405,13 @@ CPlayerInfo::Process(void)
|
|||
uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar;
|
||||
if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING && field_D6) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 0);
|
||||
TheCamera.Fade(1.0f, FADE_OUT);
|
||||
}
|
||||
if (timeWithoutRemoteCar > 2000) {
|
||||
if (m_WBState == WBSTATE_PLAYING && field_D6) {
|
||||
TheCamera.RestoreWithJumpCut();
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 1);
|
||||
TheCamera.Fade(1.0f, FADE_IN);
|
||||
TheCamera.Process();
|
||||
CTimer::Stop();
|
||||
CCullZones::ForceCullZoneCoors(TheCamera.GetPosition());
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "Streaming.h"
|
||||
#include "Wanted.h"
|
||||
#include "World.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
|
@ -27,19 +28,38 @@ CDummyPool *CPools::ms_pDummyPool;
|
|||
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
||||
CColModelPool *CPools::ms_pColModelPool;
|
||||
|
||||
#if defined GTA_PS2 && !defined MASTER // or USE_CUSTOM_ALLOCATOR
|
||||
#define CHECKMEM(msg) CMemCheck::AllocateMemCheckBlock(msg)
|
||||
#else
|
||||
#define CHECKMEM(msg)
|
||||
#endif
|
||||
|
||||
void
|
||||
CPools::Initialise(void)
|
||||
{
|
||||
PUSH_MEMID(MEMID_POOLS);
|
||||
CHECKMEM("before pools");
|
||||
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES, "PtrNode");
|
||||
CHECKMEM("after CPtrNodePool");
|
||||
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS, "EntryInfoNode");
|
||||
CHECKMEM("after CEntryInfoNodePool");
|
||||
ms_pPedPool = new CPedPool(NUMPEDS, "Peds");
|
||||
CHECKMEM("after CPedPool");
|
||||
ms_pVehiclePool = new CVehiclePool(NUMVEHICLES, "Vehicles");
|
||||
CHECKMEM("after CVehiclePool");
|
||||
ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS, "Buildings");
|
||||
CHECKMEM("after CBuildingPool");
|
||||
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES, "Treadables");
|
||||
CHECKMEM("after CTreadablePool");
|
||||
ms_pObjectPool = new CObjectPool(NUMOBJECTS, "Objects");
|
||||
CHECKMEM("after CObjectPool");
|
||||
ms_pDummyPool = new CDummyPool(NUMDUMMIES, "Dummys");
|
||||
CHECKMEM("after CDummyPool");
|
||||
ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS, "AudioScriptObj");
|
||||
CHECKMEM("after cAudioScriptObjectPool");
|
||||
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
||||
CHECKMEM("after pools");
|
||||
POP_MEMID();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "Script.h"
|
||||
#include "MemoryMgr.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "Font.h"
|
||||
|
||||
//--MIAMI: file done (possibly bugs)
|
||||
|
||||
|
@ -291,12 +292,22 @@ CStreaming::Shutdown(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef MASTER
|
||||
uint64 timeProcessingTXD;
|
||||
uint64 timeProcessingDFF;
|
||||
#endif
|
||||
|
||||
void
|
||||
CStreaming::Update(void)
|
||||
{
|
||||
CStreamingInfo *si, *prev;
|
||||
bool requestedSubway = false;
|
||||
|
||||
#ifndef MASTER
|
||||
timeProcessingTXD = 0;
|
||||
timeProcessingDFF = 0;
|
||||
#endif
|
||||
|
||||
UpdateMemoryUsed();
|
||||
|
||||
if(ms_channelError != -1){
|
||||
|
@ -334,6 +345,10 @@ CStreaming::Update(void)
|
|||
CColStore::EnsureCollisionIsInMemory(FindPlayerCoors());
|
||||
}
|
||||
|
||||
// TODO: PrintRequestList
|
||||
//if (CPad::GetPad(1)->GetLeftShoulder2JustDown() && CPad::GetPad(1)->GetRightShoulder1() && CPad::GetPad(1)->GetRightShoulder2())
|
||||
// PrintRequestList();
|
||||
|
||||
for(si = ms_endRequestedList.m_prev; si != &ms_startRequestedList; si = prev){
|
||||
prev = si->m_prev;
|
||||
if((si->m_flags & (STREAMFLAGS_KEEP_IN_MEMORY|STREAMFLAGS_PRIORITY)) == 0)
|
||||
|
@ -503,6 +518,8 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||
CAnimManager::AddAnimBlockRef(animId);
|
||||
CTxdStore::SetCurrentTxd(mi->GetTxdSlot());
|
||||
|
||||
PUSH_MEMID(MEMID_STREAM_MODELS);
|
||||
CTxdStore::SetCurrentTxd(mi->GetTxdSlot());
|
||||
if(mi->IsSimple()){
|
||||
success = CFileLoader::LoadAtomicFile(stream, streamId);
|
||||
// TODO(MIAMI)? complain if file is not pre-instanced. we hardly are interested in that
|
||||
|
@ -514,7 +531,12 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_STARTED;
|
||||
}else{
|
||||
success = CFileLoader::LoadClumpFile(stream, streamId);
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
if(success)
|
||||
RpClumpForAllAtomics((RpClump*)mi->GetRwObject(), RegisterAtomicMemPtrsCB, nil);
|
||||
#endif
|
||||
}
|
||||
POP_MEMID();
|
||||
UpdateMemoryUsed();
|
||||
|
||||
// Txd and anims no longer needed unless we only read part of the file
|
||||
|
@ -540,12 +562,14 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||
return false;
|
||||
}
|
||||
|
||||
PUSH_MEMID(MEMID_STREAM_TEXUTRES);
|
||||
if(ms_bLoadingBigModel || cdsize > 200){
|
||||
success = CTxdStore::StartLoadTxd(streamId - STREAM_OFFSET_TXD, stream);
|
||||
if(success)
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_STARTED;
|
||||
}else
|
||||
success = CTxdStore::LoadTxd(streamId - STREAM_OFFSET_TXD, stream);
|
||||
POP_MEMID();
|
||||
UpdateMemoryUsed();
|
||||
|
||||
if(!success){
|
||||
|
@ -605,7 +629,9 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||
// Mark objects as loaded
|
||||
if(ms_aInfoForModel[streamId].m_loadState != STREAMSTATE_STARTED){
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
#ifndef USE_CUSTOM_ALLOCATOR
|
||||
ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE;
|
||||
#endif
|
||||
}
|
||||
|
||||
endTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
|
||||
|
@ -640,10 +666,16 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
|
|||
if(streamId < STREAM_OFFSET_TXD){
|
||||
// Model
|
||||
mi = CModelInfo::GetModelInfo(streamId);
|
||||
PUSH_MEMID(MEMID_STREAM_MODELS);
|
||||
CTxdStore::SetCurrentTxd(mi->GetTxdSlot());
|
||||
success = CFileLoader::FinishLoadClumpFile(stream, streamId);
|
||||
if(success)
|
||||
if(success){
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
RpClumpForAllAtomics((RpClump*)mi->GetRwObject(), RegisterAtomicMemPtrsCB, nil);
|
||||
#endif
|
||||
success = AddToLoadedVehiclesList(streamId);
|
||||
}
|
||||
POP_MEMID();
|
||||
mi->RemoveRef();
|
||||
CTxdStore::RemoveRefWithoutDelete(mi->GetTxdSlot());
|
||||
if(mi->GetAnimFileIndex() != -1)
|
||||
|
@ -651,24 +683,29 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
|
|||
}else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL){
|
||||
// Txd
|
||||
CTxdStore::AddRef(streamId - STREAM_OFFSET_TXD);
|
||||
PUSH_MEMID(MEMID_STREAM_TEXUTRES);
|
||||
success = CTxdStore::FinishLoadTxd(streamId - STREAM_OFFSET_TXD, stream);
|
||||
POP_MEMID();
|
||||
CTxdStore::RemoveRefWithoutDelete(streamId - STREAM_OFFSET_TXD);
|
||||
}else{
|
||||
assert(0 && "invalid streamId");
|
||||
}
|
||||
|
||||
RwStreamClose(stream, &mem);
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED; // only done if success on PS2
|
||||
#ifndef USE_CUSTOM_ALLOCATOR
|
||||
ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE;
|
||||
#endif
|
||||
|
||||
if(!success){
|
||||
RemoveModel(streamId);
|
||||
ReRequestModel(streamId);
|
||||
UpdateMemoryUsed();
|
||||
UpdateMemoryUsed(); // directly after pop on PS2
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateMemoryUsed();
|
||||
UpdateMemoryUsed(); // directly after pop on PS2
|
||||
|
||||
endTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
|
||||
timeDiff = endTime - startTime;
|
||||
|
@ -2417,19 +2454,25 @@ CStreaming::FlushRequestList(void)
|
|||
void
|
||||
CStreaming::ImGonnaUseStreamingMemory(void)
|
||||
{
|
||||
// empty
|
||||
PUSH_MEMID(MEMID_STREAM);
|
||||
}
|
||||
|
||||
void
|
||||
CStreaming::IHaveUsedStreamingMemory(void)
|
||||
{
|
||||
POP_MEMID();
|
||||
UpdateMemoryUsed();
|
||||
}
|
||||
|
||||
void
|
||||
CStreaming::UpdateMemoryUsed(void)
|
||||
{
|
||||
// empty
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
ms_memoryUsed =
|
||||
gMainHeap.GetMemoryUsed(MEMID_STREAM) +
|
||||
gMainHeap.GetMemoryUsed(MEMID_STREAM_MODELS) +
|
||||
gMainHeap.GetMemoryUsed(MEMID_STREAM_TEXUTRES);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define STREAM_DIST 80.0f
|
||||
|
@ -3043,3 +3086,71 @@ CStreaming::UpdateForAnimViewer(void)
|
|||
CStreaming::RetryLoadFile(CStreaming::ms_channelError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CStreaming::PrintStreamingBufferState()
|
||||
{
|
||||
char str[128];
|
||||
wchar wstr[128];
|
||||
uint32 offset, size;
|
||||
|
||||
CTimer::Stop();
|
||||
int i = 0;
|
||||
while (i < NUMSTREAMINFO) {
|
||||
while (true) {
|
||||
int j = 0;
|
||||
DoRWStuffStartOfFrame(50, 50, 50, 0, 0, 0, 255);
|
||||
CPad::UpdatePads();
|
||||
CSprite2d::InitPerFrame();
|
||||
CFont::InitPerFrame();
|
||||
DefinedState();
|
||||
|
||||
CRect unusedRect(0, 0, RsGlobal.maximumWidth, RsGlobal.maximumHeight);
|
||||
CRGBA unusedColor(255, 255, 255, 255);
|
||||
CFont::SetFontStyle(FONT_BANK);
|
||||
CFont::SetBackgroundOff();
|
||||
CFont::SetWrapx(DEFAULT_SCREEN_WIDTH);
|
||||
CFont::SetScale(0.5f, 0.75f);
|
||||
CFont::SetCentreOff();
|
||||
CFont::SetCentreSize(DEFAULT_SCREEN_WIDTH);
|
||||
CFont::SetJustifyOff();
|
||||
CFont::SetColor(CRGBA(200, 200, 200, 200));
|
||||
CFont::SetBackGroundOnlyTextOff();
|
||||
int modelIndex = i;
|
||||
if (modelIndex < NUMSTREAMINFO) {
|
||||
int y = 24;
|
||||
for ( ; j < 34 && modelIndex < NUMSTREAMINFO; modelIndex++) {
|
||||
CStreamingInfo *streamingInfo = &ms_aInfoForModel[modelIndex];
|
||||
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelIndex);
|
||||
if (streamingInfo->m_loadState != STREAMSTATE_LOADED || !streamingInfo->GetCdPosnAndSize(offset, size))
|
||||
continue;
|
||||
|
||||
if (modelIndex >= STREAM_OFFSET_TXD)
|
||||
sprintf(str, "txd %s, refs %d, size %dK, flags 0x%x", CTxdStore::GetTxdName(modelIndex - STREAM_OFFSET_TXD),
|
||||
CTxdStore::GetNumRefs(modelIndex - STREAM_OFFSET_TXD), 2 * size, streamingInfo->m_flags);
|
||||
else
|
||||
sprintf(str, "model %d,%s, refs%d, size%dK, flags%x", modelIndex, modelInfo->GetName(), modelInfo->GetNumRefs(), 2 * size,
|
||||
streamingInfo->m_flags);
|
||||
AsciiToUnicode(str, wstr);
|
||||
CFont::PrintString(24.0f, y, wstr);
|
||||
y += 12;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (CPad::GetPad(1)->GetCrossJustDown())
|
||||
i = modelIndex;
|
||||
|
||||
if (!CPad::GetPad(1)->GetTriangleJustDown())
|
||||
break;
|
||||
|
||||
i = 0;
|
||||
CFont::DrawFonts();
|
||||
DoRWStuffEndOfFrame();
|
||||
}
|
||||
CFont::DrawFonts();
|
||||
DoRWStuffEndOfFrame();
|
||||
}
|
||||
CTimer::Update();
|
||||
}
|
|
@ -210,4 +210,6 @@ public:
|
|||
static void MemoryCardLoad(uint8 *buffer, uint32 length);
|
||||
|
||||
static void UpdateForAnimViewer(void);
|
||||
|
||||
static void PrintStreamingBufferState();
|
||||
};
|
||||
|
|
|
@ -200,6 +200,7 @@ enum Config {
|
|||
#if defined GTA_PS2
|
||||
# define GTA_PS2_STUFF
|
||||
# define RANDOMSPLASH
|
||||
//# define USE_CUSTOM_ALLOCATOR
|
||||
# define VU_COLLISION
|
||||
#elif defined GTA_PC
|
||||
# ifdef GTA_PS2_STUFF
|
||||
|
@ -213,7 +214,7 @@ enum Config {
|
|||
#endif
|
||||
|
||||
#ifdef VU_COLLISION
|
||||
#define COMPRESSED_COL_VECTORS // current need compressed vectors in this code
|
||||
#define COMPRESSED_COL_VECTORS // currently need compressed vectors in this code
|
||||
#endif
|
||||
|
||||
#ifdef MASTER
|
||||
|
@ -292,6 +293,7 @@ enum Config {
|
|||
#define WALLCLIMB_CHEAT
|
||||
#define REGISTER_START_BUTTON
|
||||
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
|
||||
#define BUTTON_ICONS // use textures to show controller buttons
|
||||
|
||||
// Hud, frontend and radar
|
||||
#define PC_MENU
|
||||
|
@ -332,7 +334,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
|||
#endif
|
||||
//#define SIMPLIER_MISSIONS // apply simplifications from mobile
|
||||
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log
|
||||
#define SCRIPT_LOG_FILE_LEVEL 0 // 0 == no log, 1 == overwrite every frame, 2 == full log
|
||||
|
||||
#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||
|
@ -366,6 +368,8 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
|||
// these are not supported with librw yet
|
||||
# undef MULTISAMPLING
|
||||
#endif
|
||||
// IMG
|
||||
#define BIG_IMG // allows to read larger img files
|
||||
|
||||
//#define SQUEEZE_PERFORMANCE
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "timebars.h"
|
||||
#include "GenericGameStorage.h"
|
||||
#include "MemoryCard.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "SceneEdit.h"
|
||||
#include "debugmenu.h"
|
||||
#include "Clock.h"
|
||||
|
@ -110,6 +111,18 @@ void TheGame(void);
|
|||
void DebugMenuPopulate(void);
|
||||
#endif
|
||||
|
||||
#ifndef FINAL
|
||||
bool gbPrintMemoryUsage;
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PS2
|
||||
#define WANT_TO_LOAD TheMemoryCard.m_bWantToLoad
|
||||
#define FOUND_GAME_TO_LOAD TheMemoryCard.b_FoundRecentSavedGameWantToLoad
|
||||
#else
|
||||
#define WANT_TO_LOAD FrontEndMenuManager.m_bWantToLoad
|
||||
#define FOUND_GAME_TO_LOAD b_FoundRecentSavedGameWantToLoad
|
||||
#endif
|
||||
|
||||
#ifdef NEW_RENDERER
|
||||
bool gbNewRenderer;
|
||||
#define CLEARMODE (rwCAMERACLEARZ | rwCAMERACLEARSTENCIL)
|
||||
|
@ -392,6 +405,63 @@ PluginAttach(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef GTA_PS2
|
||||
#define NUM_PREALLOC_ATOMICS 3245
|
||||
#define NUM_PREALLOC_CLUMPS 101
|
||||
#define NUM_PREALLOC_FRAMES 2821
|
||||
#define NUM_PREALLOC_GEOMETRIES 1404
|
||||
#define NUM_PREALLOC_TEXDICTS 106
|
||||
#define NUM_PREALLOC_TEXTURES 1900
|
||||
#define NUM_PREALLOC_MATERIALS 3300
|
||||
bool preAlloc;
|
||||
|
||||
void
|
||||
PreAllocateRwObjects(void)
|
||||
{
|
||||
int i;
|
||||
void **tmp = new void*[0x8000];
|
||||
preAlloc = true;
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_ATOMICS; i++)
|
||||
tmp[i] = RpAtomicCreate();
|
||||
for(i = 0; i < NUM_PREALLOC_ATOMICS; i++)
|
||||
RpAtomicDestroy((RpAtomic*)tmp[i]);
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_CLUMPS; i++)
|
||||
tmp[i] = RpClumpCreate();
|
||||
for(i = 0; i < NUM_PREALLOC_CLUMPS; i++)
|
||||
RpClumpDestroy((RpClump*)tmp[i]);
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_FRAMES; i++)
|
||||
tmp[i] = RwFrameCreate();
|
||||
for(i = 0; i < NUM_PREALLOC_FRAMES; i++)
|
||||
RwFrameDestroy((RwFrame*)tmp[i]);
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_GEOMETRIES; i++)
|
||||
tmp[i] = RpGeometryCreate(0, 0, 0);
|
||||
for(i = 0; i < NUM_PREALLOC_GEOMETRIES; i++)
|
||||
RpGeometryDestroy((RpGeometry*)tmp[i]);
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
|
||||
tmp[i] = RwTexDictionaryCreate();
|
||||
for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
|
||||
RwTexDictionaryDestroy((RwTexDictionary*)tmp[i]);
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_TEXTURES; i++)
|
||||
tmp[i] = RwTextureCreate(RwRasterCreate(0, 0, 0, 0));
|
||||
for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
|
||||
RwTextureDestroy((RwTexture*)tmp[i]);
|
||||
|
||||
for(i = 0; i < NUM_PREALLOC_MATERIALS; i++)
|
||||
tmp[i] = RpMaterialCreate();
|
||||
for(i = 0; i < NUM_PREALLOC_MATERIALS; i++)
|
||||
RpMaterialDestroy((RpMaterial*)tmp[i]);
|
||||
|
||||
delete[] tmp;
|
||||
preAlloc = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static RwBool
|
||||
Initialise3D(void *param)
|
||||
{
|
||||
|
@ -765,6 +835,170 @@ tZonePrint ZonePrint[] =
|
|||
};
|
||||
|
||||
#ifndef MASTER
|
||||
|
||||
void
|
||||
PrintMemoryUsage(void)
|
||||
{
|
||||
// little hack
|
||||
if(CPools::GetPtrNodePool() == nil)
|
||||
return;
|
||||
|
||||
// Style taken from LCS, modified for III
|
||||
// CFont::SetFontStyle(FONT_PAGER);
|
||||
CFont::SetFontStyle(FONT_BANK);
|
||||
CFont::SetBackgroundOff();
|
||||
CFont::SetWrapx(640.0f);
|
||||
// CFont::SetScale(0.5f, 0.75f);
|
||||
CFont::SetScale(0.4f, 0.75f);
|
||||
CFont::SetCentreOff();
|
||||
CFont::SetCentreSize(640.0f);
|
||||
CFont::SetJustifyOff();
|
||||
CFont::SetPropOn();
|
||||
CFont::SetColor(CRGBA(200, 200, 200, 200));
|
||||
CFont::SetBackGroundOnlyTextOff();
|
||||
CFont::SetDropShadowPosition(0);
|
||||
|
||||
float y;
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
y = 24.0f;
|
||||
sprintf(gString, "Total: %d blocks, %d bytes", gMainHeap.m_totalBlocksUsed, gMainHeap.m_totalMemUsed);
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Game: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_GAME), gMainHeap.GetMemoryUsed(MEMID_GAME));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "World: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_WORLD), gMainHeap.GetMemoryUsed(MEMID_WORLD));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Render: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_RENDER), gMainHeap.GetMemoryUsed(MEMID_RENDER));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Render List: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_RENDERLIST), gMainHeap.GetMemoryUsed(MEMID_RENDERLIST));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Default Models: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_DEF_MODELS), gMainHeap.GetMemoryUsed(MEMID_DEF_MODELS));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Textures: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_TEXTURES), gMainHeap.GetMemoryUsed(MEMID_TEXTURES));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Streaming: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_STREAM), gMainHeap.GetMemoryUsed(MEMID_STREAM));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Streamed Models: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_STREAM_MODELS), gMainHeap.GetMemoryUsed(MEMID_STREAM_MODELS));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Streamed Textures: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_STREAM_TEXUTRES), gMainHeap.GetMemoryUsed(MEMID_STREAM_TEXUTRES));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Animation: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_ANIMATION), gMainHeap.GetMemoryUsed(MEMID_ANIMATION));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Pools: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_POOLS), gMainHeap.GetMemoryUsed(MEMID_POOLS));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Collision: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_COLLISION), gMainHeap.GetMemoryUsed(MEMID_COLLISION));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Game Process: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_GAME_PROCESS), gMainHeap.GetMemoryUsed(MEMID_GAME_PROCESS));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Script: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_SCRIPT), gMainHeap.GetMemoryUsed(MEMID_SCRIPT));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Cars: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_CARS), gMainHeap.GetMemoryUsed(MEMID_CARS));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Frontend: %d blocks, %d bytes", gMainHeap.GetBlocksUsed(MEMID_FRONTEND), gMainHeap.GetMemoryUsed(MEMID_FRONTEND));
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(24.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
#endif
|
||||
|
||||
y = 132.0f;
|
||||
AsciiToUnicode("Pools usage:", gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "PtrNode: %d/%d", CPools::GetPtrNodePool()->GetNoOfUsedSpaces(), CPools::GetPtrNodePool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "EntryInfoNode: %d/%d", CPools::GetEntryInfoNodePool()->GetNoOfUsedSpaces(), CPools::GetEntryInfoNodePool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Ped: %d/%d", CPools::GetPedPool()->GetNoOfUsedSpaces(), CPools::GetPedPool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Vehicle: %d/%d", CPools::GetVehiclePool()->GetNoOfUsedSpaces(), CPools::GetVehiclePool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Building: %d/%d", CPools::GetBuildingPool()->GetNoOfUsedSpaces(), CPools::GetBuildingPool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Treadable: %d/%d", CPools::GetTreadablePool()->GetNoOfUsedSpaces(), CPools::GetTreadablePool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Object: %d/%d", CPools::GetObjectPool()->GetNoOfUsedSpaces(), CPools::GetObjectPool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "Dummy: %d/%d", CPools::GetDummyPool()->GetNoOfUsedSpaces(), CPools::GetDummyPool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
|
||||
sprintf(gString, "AudioScriptObjects: %d/%d", CPools::GetAudioScriptObjectPool()->GetNoOfUsedSpaces(), CPools::GetAudioScriptObjectPool()->GetSize());
|
||||
AsciiToUnicode(gString, gUString);
|
||||
CFont::PrintString(400.0f, y, gUString);
|
||||
y += 12.0f;
|
||||
}
|
||||
|
||||
void
|
||||
DisplayGameDebugText()
|
||||
{
|
||||
|
@ -777,8 +1011,10 @@ DisplayGameDebugText()
|
|||
TWEAKBOOL(bDisplayPosn);
|
||||
TWEAKBOOL(bDisplayCheatStr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(gbPrintMemoryUsage)
|
||||
PrintMemoryUsage();
|
||||
#endif
|
||||
|
||||
char str[200];
|
||||
wchar ustr[200];
|
||||
|
@ -1136,13 +1372,9 @@ RenderMenus(void)
|
|||
{
|
||||
if (FrontEndMenuManager.m_bMenuActive)
|
||||
{
|
||||
#ifdef PS2
|
||||
gMainHeap.PushMemId(_TODOCONST(17));
|
||||
#endif
|
||||
PUSH_MEMID(MEMID_FRONTEND);
|
||||
FrontEndMenuManager.DrawFrontEnd();
|
||||
#ifdef PS2
|
||||
gMainHeap.PopMemId();
|
||||
#endif
|
||||
POP_MEMID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1182,21 +1414,12 @@ Idle(void *arg)
|
|||
tbEndTimer("DMAudio.Service");
|
||||
|
||||
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
|
||||
#ifdef PS2_MENU
|
||||
TheMemoryCard.m_bWantToLoad = false;
|
||||
WANT_TO_LOAD = false;
|
||||
FrontEndMenuManager.m_bWantToRestart = true;
|
||||
#else
|
||||
FrontEndMenuManager.m_bWantToRestart = true;
|
||||
FrontEndMenuManager.m_bWantToLoad = false;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PS2_MENU
|
||||
if ( FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad )
|
||||
#else
|
||||
if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
|
||||
#endif
|
||||
if(FrontEndMenuManager.m_bWantToRestart || FOUND_GAME_TO_LOAD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1242,12 +1465,12 @@ Idle(void *arg)
|
|||
|
||||
if(CWeather::LightningFlash && !CCullZones::CamNoRain()){
|
||||
if(!DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255))
|
||||
return;
|
||||
goto popret;
|
||||
}else{
|
||||
if(!DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
|
||||
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
|
||||
255))
|
||||
return;
|
||||
goto popret;
|
||||
}
|
||||
|
||||
DefinedState();
|
||||
|
@ -1295,7 +1518,7 @@ Idle(void *arg)
|
|||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||
if(!RsCameraBeginUpdate(Scene.camera))
|
||||
return;
|
||||
goto popret;
|
||||
}
|
||||
|
||||
tbStartTimer(0, "RenderMenus");
|
||||
|
@ -1304,7 +1527,7 @@ Idle(void *arg)
|
|||
|
||||
#ifdef PS2_MENU
|
||||
if ( TheMemoryCard.m_bWantToLoad )
|
||||
return;
|
||||
goto popret;
|
||||
#endif
|
||||
|
||||
tbStartTimer(0, "DoFade");
|
||||
|
@ -1324,8 +1547,13 @@ Idle(void *arg)
|
|||
|
||||
DoRWStuffEndOfFrame();
|
||||
|
||||
POP_MEMID(); // MEMID_RENDER
|
||||
|
||||
if(g_SlowMode)
|
||||
ProcessSlowMode();
|
||||
return;
|
||||
|
||||
popret: POP_MEMID(); // MEMID_RENDER
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1478,14 +1706,13 @@ TheModelViewer(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PS2
|
||||
|
||||
#ifdef GTA_PS2
|
||||
void TheGame(void)
|
||||
{
|
||||
printf("Into TheGame!!!\n");
|
||||
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PushMemId(_TODOCONST(1));
|
||||
#endif
|
||||
PUSH_MEMID(MEMID_GAME); // NB: not popped
|
||||
|
||||
CTimer::Initialise();
|
||||
|
||||
|
@ -1523,78 +1750,50 @@ void TheGame(void)
|
|||
|
||||
while (true)
|
||||
{
|
||||
#ifdef PS2
|
||||
if (TheMemoryCard.m_bWantToLoad)
|
||||
#else
|
||||
if (FrontEndMenuManager.m_bWantToLoad)
|
||||
#endif
|
||||
if (WANT_TO_LOAD)
|
||||
{
|
||||
Const char *splash1 = GetLevelSplashScreen(CGame::currLevel);
|
||||
LoadSplash(splash1);
|
||||
}
|
||||
|
||||
#ifdef PS2
|
||||
TheMemoryCard.m_bWantToLoad = false;
|
||||
#else
|
||||
FrontEndMenuManager.m_bWantToLoad = false;
|
||||
#endif
|
||||
WANT_TO_LOAD = false;
|
||||
|
||||
CTimer::Update();
|
||||
|
||||
#ifdef PS2
|
||||
while (!(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
|
||||
#else
|
||||
while (!(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad))
|
||||
#endif
|
||||
while (!(FrontEndMenuManager.m_bWantToRestart || FOUND_GAME_TO_LOAD))
|
||||
{
|
||||
CSprite2d::InitPerFrame();
|
||||
CFont::InitPerFrame();
|
||||
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PushMemId(_TODOCONST(12));
|
||||
#endif
|
||||
CPointLights::NumLights = 0;
|
||||
PUSH_MEMID(MEMID_GAME_PROCESS)
|
||||
CPointLights::InitPerFrame();
|
||||
CGame::Process();
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PopMemId();
|
||||
#endif
|
||||
POP_MEMID();
|
||||
|
||||
DMAudio.Service();
|
||||
|
||||
if (CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing())
|
||||
{
|
||||
#ifdef PS2
|
||||
TheMemoryCard.m_bWantToLoad = false;
|
||||
#else
|
||||
FrontEndMenuManager.m_bWantToLoad = false;
|
||||
#endif
|
||||
WANT_TO_LOAD = false;
|
||||
FrontEndMenuManager.m_bWantToRestart = true;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PS2
|
||||
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
|
||||
#else
|
||||
if (FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
|
||||
#endif
|
||||
if (FrontEndMenuManager.m_bWantToRestart || FOUND_GAME_TO_LOAD)
|
||||
break;
|
||||
|
||||
SetLightsWithTimeOfDayColour(Scene.world);
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PushMemId(_TODOCONST(15));
|
||||
#endif
|
||||
|
||||
PUSH_MEMID(MEMID_RENDER);
|
||||
|
||||
// m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
|
||||
if (!FrontEndMenuManager.m_bMenuActive || /*FrontEndMenuManager.m_bRenderGameInMenu == true && */TheCamera.GetScreenFadeStatus() != FADE_2 )
|
||||
{
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PushMemId(_TODOCONST(11));
|
||||
#endif
|
||||
|
||||
PUSH_MEMID(MEMID_RENDERLIST);
|
||||
CRenderer::ConstructRenderList();
|
||||
CRenderer::PreRender();
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PopMemId();
|
||||
#endif
|
||||
POP_MEMID();
|
||||
|
||||
if (CWeather::LightningFlash && !CCullZones::CamNoRain())
|
||||
DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255);
|
||||
|
@ -1626,15 +1825,9 @@ void TheGame(void)
|
|||
|
||||
RenderMenus();
|
||||
|
||||
#ifdef PS2
|
||||
if (TheMemoryCard.m_bWantToLoad)
|
||||
#else
|
||||
if (FrontEndMenuManager.m_bWantToLoad)
|
||||
#endif
|
||||
if (WANT_TO_LOAD)
|
||||
{
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PopMemId();
|
||||
#endif
|
||||
POP_MEMID(); // MEMID_RENDER
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1651,9 +1844,7 @@ void TheGame(void)
|
|||
|
||||
CTimer::Update();
|
||||
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PopMemId();
|
||||
#endif
|
||||
POP_MEMID(): // MEMID_RENDER
|
||||
|
||||
if (g_SlowMode)
|
||||
ProcessSlowMode();
|
||||
|
@ -1665,24 +1856,12 @@ void TheGame(void)
|
|||
CGame::ShutDownForRestart();
|
||||
CTimer::Stop();
|
||||
|
||||
#ifdef PS2
|
||||
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
|
||||
#else
|
||||
if (FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
|
||||
#endif
|
||||
if (FrontEndMenuManager.m_bWantToRestart || FOUND_GAME_TO_LOAD)
|
||||
{
|
||||
#ifdef PS2
|
||||
if (TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
|
||||
#else
|
||||
if (b_FoundRecentSavedGameWantToLoad)
|
||||
#endif
|
||||
if (FOUND_GAME_TO_LOAD)
|
||||
{
|
||||
FrontEndMenuManager.m_bWantToRestart = true;
|
||||
#ifdef PS2
|
||||
TheMemoryCard.m_bWantToLoad = true;
|
||||
#else
|
||||
FrontEndMenuManager.m_bWantToLoad = true;
|
||||
#endif
|
||||
WANT_TO_LOAD = true;
|
||||
}
|
||||
|
||||
CGame::InitialiseWhenRestarting();
|
||||
|
@ -1705,7 +1884,7 @@ void SystemInit()
|
|||
mwInit();
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PS2
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
InitMemoryMgr();
|
||||
#endif
|
||||
|
||||
|
@ -1735,7 +1914,7 @@ void SystemInit()
|
|||
#ifdef GTA_PS2
|
||||
CFileMgr::InitCd();
|
||||
|
||||
Char modulepath[256];
|
||||
char modulepath[256];
|
||||
|
||||
strcpy(modulepath, "cdrom0:\\");
|
||||
strcat(modulepath, "SYSTEM\\");
|
||||
|
@ -1822,7 +2001,7 @@ void SystemInit()
|
|||
//
|
||||
#endif
|
||||
|
||||
#ifdef PS2
|
||||
#ifdef GTA_PS2
|
||||
TheMemoryCard.Init();
|
||||
#endif
|
||||
}
|
||||
|
@ -1851,7 +2030,7 @@ void GameInit()
|
|||
#endif
|
||||
CdStreamInit(MAX_CDCHANNELS);
|
||||
|
||||
#ifdef PS2
|
||||
#ifdef GTA_PS2
|
||||
Initialise3D(); //no params
|
||||
#else
|
||||
//TODO
|
||||
|
@ -1958,21 +2137,18 @@ void GameInit()
|
|||
CreateDebugFont();
|
||||
|
||||
#ifdef GTA_PS2
|
||||
AddIntcHandler(_TODOCONST(2), VBlankCounter, 0);
|
||||
AddIntcHandler(INTC_VBLANK_S, VBlankCounter, 0);
|
||||
#endif
|
||||
|
||||
CameraSize(Scene.camera, NULL, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
|
||||
CSprite2d::SetRecipNearClip();
|
||||
CTxdStore::Initialise();
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PushMemId(_TODOCONST(9));
|
||||
#endif
|
||||
|
||||
PUSH_MEMID(MEMID_TEXTURES);
|
||||
CFont::Initialise();
|
||||
CHud::Initialise();
|
||||
#ifdef GTA_PS2
|
||||
gMainHeap.PopMemId();
|
||||
#endif
|
||||
POP_MEMID();
|
||||
|
||||
ValidateVersion();
|
||||
|
||||
|
@ -2000,11 +2176,10 @@ main(int argc, char *argv[])
|
|||
|
||||
SystemInit();
|
||||
|
||||
#ifdef PS2
|
||||
#ifdef GTA_PS2
|
||||
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
|
||||
|
||||
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
|
||||
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
|
||||
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT )
|
||||
{
|
||||
GameInit();
|
||||
|
||||
|
@ -2014,6 +2189,8 @@ main(int argc, char *argv[])
|
|||
CFont::Initialise();
|
||||
|
||||
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
|
||||
}else if(r == CMemoryCard::ERR_OPENNOENTRY || r == CMemoryCard::ERR_NONE){
|
||||
// eh?
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2024,12 +2201,18 @@ main(int argc, char *argv[])
|
|||
|
||||
InitMPEGPlayer();
|
||||
|
||||
#ifdef GTA_PAL
|
||||
PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
|
||||
|
||||
if (CGame::frenchGame || CGame::germanGame)
|
||||
PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
|
||||
else
|
||||
PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
|
||||
#else
|
||||
PlayMPEG("cdrom0:\\MOVIES\\DMANTSC.PSS;1", false);
|
||||
|
||||
PlayMPEG("cdrom0:\\MOVIES\\INTRNTSC.PSS;1", true);
|
||||
#endif
|
||||
|
||||
ShutdownMPEGPlayer();
|
||||
|
||||
|
|
|
@ -20,11 +20,16 @@ extern bool gbShowTimebars;
|
|||
#define gbShowTimebars false
|
||||
#endif
|
||||
|
||||
#ifndef FINAL
|
||||
extern bool gbPrintMemoryUsage;
|
||||
#endif
|
||||
|
||||
class CSprite2d;
|
||||
|
||||
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||
bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||
void DoRWStuffEndOfFrame(void);
|
||||
void PreAllocateRwObjects(void);
|
||||
void InitialiseGame(void);
|
||||
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
|
||||
void LoadingIslandScreen(const char *levelName);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "MBlur.h"
|
||||
#include "postfx.h"
|
||||
#include "custompipes.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#include "FileMgr.h"
|
||||
|
@ -648,6 +649,13 @@ extern bool gbRenderWorld2;
|
|||
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
|
||||
|
||||
#ifndef FINAL
|
||||
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
DebugMenuAddCmd("Debug", "Parse Heap", ParseHeap);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
|
||||
#ifdef GTA_SCENE_EDIT
|
||||
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
template<typename T, int n>
|
||||
template<typename T, int32 n>
|
||||
class CStore
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "Dummy.h"
|
||||
#include "WindModifiers.h"
|
||||
#include "Occlusion.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
|
@ -301,7 +302,11 @@ CEntity::CreateRwObject(void)
|
|||
CBaseModelInfo *mi;
|
||||
|
||||
mi = CModelInfo::GetModelInfo(m_modelIndex);
|
||||
|
||||
PUSH_MEMID(MEMID_WORLD);
|
||||
m_rwObject = mi->CreateInstance();
|
||||
POP_MEMID();
|
||||
|
||||
if(m_rwObject){
|
||||
if(IsBuilding())
|
||||
gBuildings++;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "ControllerConfig.h"
|
||||
#include "Timer.h"
|
||||
#include "rtcharse.h"
|
||||
#include "inttypes.h"
|
||||
#include "re3_inttypes.h"
|
||||
#include "debugmenu.h"
|
||||
#include <new>
|
||||
|
||||
|
|
|
@ -16,9 +16,14 @@ using namespace rw;
|
|||
RwUInt8 RwObjectGetType(const RwObject *obj) { return obj->type; }
|
||||
|
||||
|
||||
void *RwMalloc(size_t size) { return malloc(size); }
|
||||
void *RwCalloc(size_t numObj, size_t sizeObj) { return calloc(numObj, sizeObj); }
|
||||
void RwFree(void *mem) { free(mem); }
|
||||
void *RwMalloc(size_t size) { return engine->memfuncs.rwmalloc(size, 0); }
|
||||
void *RwCalloc(size_t numObj, size_t sizeObj) {
|
||||
void *mem = RwMalloc(numObj*sizeObj);
|
||||
if(mem)
|
||||
memset(mem, 0, numObj*sizeObj);
|
||||
return mem;
|
||||
}
|
||||
void RwFree(void *mem) { engine->memfuncs.rwfree(mem); }
|
||||
|
||||
|
||||
//RwReal RwV3dNormalize(RwV3d * out, const RwV3d * in);
|
||||
|
@ -537,8 +542,27 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
|
|||
}
|
||||
}
|
||||
|
||||
static rw::MemoryFunctions gMemfuncs;
|
||||
static void *(*real_malloc)(size_t size);
|
||||
static void *(*real_realloc)(void *mem, size_t newSize);
|
||||
static void *mallocWrap(size_t sz, uint32 hint) { if(sz == 0) return nil; return real_malloc(sz); }
|
||||
static void *reallocWrap(void *p, size_t sz, uint32 hint) { return real_realloc(p, sz); }
|
||||
|
||||
|
||||
// WARNING: unused parameters
|
||||
RwBool RwEngineInit(RwMemoryFunctions *memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize) { Engine::init(); return true; }
|
||||
RwBool RwEngineInit(RwMemoryFunctions *memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize) {
|
||||
if(memFuncs){
|
||||
real_malloc = memFuncs->rwmalloc;
|
||||
real_realloc = memFuncs->rwrealloc;
|
||||
gMemfuncs.rwmalloc = mallocWrap;
|
||||
gMemfuncs.rwrealloc = reallocWrap;
|
||||
gMemfuncs.rwfree = memFuncs->rwfree;
|
||||
Engine::init(&gMemfuncs);
|
||||
}else{
|
||||
Engine::init(nil);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// TODO: this is platform dependent
|
||||
RwBool RwEngineOpen(RwEngineOpenParams *initParams) {
|
||||
static EngineOpenParams openParams;
|
||||
|
|
|
@ -58,9 +58,9 @@ public:
|
|||
bool DoesOwnColModel(void) { return m_bOwnsColModel; }
|
||||
void DeleteCollisionModel(void);
|
||||
void ClearTexDictionary(void) { m_txdSlot = -1; }
|
||||
short GetObjectID(void) { return m_objectId; }
|
||||
int16 GetObjectID(void) { return m_objectId; }
|
||||
void SetObjectID(int16 id) { m_objectId = id; }
|
||||
short GetTxdSlot(void) { return m_txdSlot; }
|
||||
int16 GetTxdSlot(void) { return m_txdSlot; }
|
||||
void AddRef(void);
|
||||
void RemoveRef(void);
|
||||
void SetTexDictionary(const char *name);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "General.h"
|
||||
#include "ModelIndices.h"
|
||||
|
||||
#define X(name, var) int16 var;
|
||||
#define X(name, var) int16 var = -1;
|
||||
MODELINDICES
|
||||
#undef X
|
||||
|
||||
|
|
|
@ -2664,19 +2664,19 @@ CPed::ProcessControl(void)
|
|||
Flee();
|
||||
break;
|
||||
case PED_FOLLOW_PATH:
|
||||
CPed::FollowPath();
|
||||
FollowPath();
|
||||
break;
|
||||
case PED_PAUSE:
|
||||
CPed::Pause();
|
||||
Pause();
|
||||
break;
|
||||
case PED_ATTACK:
|
||||
CPed::Attack();
|
||||
Attack();
|
||||
break;
|
||||
case PED_FIGHT:
|
||||
CPed::Fight();
|
||||
Fight();
|
||||
break;
|
||||
case PED_CHAT:
|
||||
CPed::Chat();
|
||||
Chat();
|
||||
break;
|
||||
case PED_AIM_GUN:
|
||||
if (m_pPointGunAt && m_pPointGunAt->IsPed()
|
||||
|
@ -9697,17 +9697,6 @@ CPed::Say(uint16 audio, int32 time)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CPed::SetWeaponLockOnTarget(CEntity *target)
|
||||
{
|
||||
if (m_pPointGunAt)
|
||||
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
|
||||
m_pPointGunAt = (CPed*)target;
|
||||
if (target)
|
||||
((CEntity*)target)->RegisterReference(&m_pPointGunAt);
|
||||
}
|
||||
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
|
|
|
@ -866,7 +866,6 @@ public:
|
|||
void PositionAttachedPed();
|
||||
bool CanUseTorsoWhenLooking();
|
||||
void ScanForDelayedResponseThreats();
|
||||
void SetWeaponLockOnTarget(CEntity*);
|
||||
|
||||
// Static methods
|
||||
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
|
||||
|
@ -1104,6 +1103,16 @@ public:
|
|||
}
|
||||
// --
|
||||
|
||||
inline void SetWeaponLockOnTarget(CEntity *target)
|
||||
{
|
||||
if (m_pPointGunAt)
|
||||
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
|
||||
m_pPointGunAt = (CPed*)target;
|
||||
if (target)
|
||||
((CEntity*)target)->RegisterReference(&m_pPointGunAt);
|
||||
}
|
||||
|
||||
// Using this to abstract nodes of skinned and non-skinned meshes
|
||||
CVector GetNodePosition(int32 node)
|
||||
{
|
||||
|
|
|
@ -1496,8 +1496,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed)
|
|||
|
||||
if (m_nPedState == PED_JUMP) {
|
||||
if (bIsInTheAir) {
|
||||
if (bUsesCollision && !bHitSteepSlope &&
|
||||
(!bHitSomethingLastFrame || m_vecDamageNormal.z > 0.6f)
|
||||
if (bUsesCollision && !bHitSteepSlope && (!bHitSomethingLastFrame || m_vecDamageNormal.z > 0.6f)
|
||||
&& m_fDistanceTravelled < CTimer::GetTimeStep() * 0.02 && m_vecMoveSpeed.MagnitudeSqr() < 0.01f) {
|
||||
|
||||
float angleSin = Sin(m_fRotationCur); // originally sin(DEGTORAD(RADTODEG(m_fRotationCur))) o_O
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include "Sprite2d.h"
|
||||
#include "TxdStore.h"
|
||||
#include "Font.h"
|
||||
#ifdef BUTTON_ICONS
|
||||
#include "FileMgr.h"
|
||||
#endif
|
||||
#include "Timer.h"
|
||||
|
||||
void
|
||||
|
@ -224,6 +227,12 @@ union tFontRenderStatePointer
|
|||
tFontRenderStatePointer FontRenderStatePointer;
|
||||
uint8 FontRenderStateBuf[1024];
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
CSprite2d CFont::ButtonSprite[MAX_BUTTON_ICONS];
|
||||
int CFont::PS2Symbol = BUTTON_NONE;
|
||||
int CFont::ButtonsSlot = -1;
|
||||
#endif // BUTTON_ICONS
|
||||
|
||||
void
|
||||
CFont::Initialise(void)
|
||||
{
|
||||
|
@ -279,6 +288,34 @@ CFont::Initialise(void)
|
|||
SetAlphaFade(255.0f);
|
||||
SetDropShadowPosition(0);
|
||||
CTxdStore::PopCurrentTxd();
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
if (int file = CFileMgr::OpenFile("MODELS/X360BTNS.TXD")) {
|
||||
CFileMgr::CloseFile(file);
|
||||
ButtonsSlot = CTxdStore::AddTxdSlot("buttons");
|
||||
CTxdStore::LoadTxd(ButtonsSlot, "MODELS/X360BTNS.TXD");
|
||||
CTxdStore::AddRef(ButtonsSlot);
|
||||
CTxdStore::PushCurrentTxd();
|
||||
CTxdStore::SetCurrentTxd(ButtonsSlot);
|
||||
#if 0 // unused
|
||||
ButtonSprite[BUTTON_UP].SetTexture("up");
|
||||
ButtonSprite[BUTTON_DOWN].SetTexture("down");
|
||||
ButtonSprite[BUTTON_LEFT].SetTexture("left");
|
||||
ButtonSprite[BUTTON_RIGHT].SetTexture("right");
|
||||
#endif
|
||||
ButtonSprite[BUTTON_CROSS].SetTexture("cross");
|
||||
ButtonSprite[BUTTON_CIRCLE].SetTexture("circle");
|
||||
ButtonSprite[BUTTON_SQUARE].SetTexture("square");
|
||||
ButtonSprite[BUTTON_TRIANGLE].SetTexture("triangle");
|
||||
ButtonSprite[BUTTON_L1].SetTexture("l1");
|
||||
ButtonSprite[BUTTON_L2].SetTexture("l2");
|
||||
ButtonSprite[BUTTON_L3].SetTexture("l3");
|
||||
ButtonSprite[BUTTON_R1].SetTexture("r1");
|
||||
ButtonSprite[BUTTON_R2].SetTexture("r2");
|
||||
ButtonSprite[BUTTON_R3].SetTexture("r3");
|
||||
CTxdStore::PopCurrentTxd();
|
||||
}
|
||||
#endif // BUTTON_ICONS
|
||||
}
|
||||
|
||||
#ifdef MORE_LANGUAGES
|
||||
|
@ -327,6 +364,13 @@ CFont::ReloadFonts(uint8 set)
|
|||
void
|
||||
CFont::Shutdown(void)
|
||||
{
|
||||
#ifdef BUTTON_ICONS
|
||||
if (ButtonsSlot != -1) {
|
||||
for (int i = 0; i < MAX_BUTTON_ICONS; i++)
|
||||
ButtonSprite[i].Delete();
|
||||
CTxdStore::RemoveTxdSlot(ButtonsSlot);
|
||||
}
|
||||
#endif
|
||||
Sprite[0].Delete();
|
||||
Sprite[1].Delete();
|
||||
#ifdef MORE_LANGUAGES
|
||||
|
@ -347,8 +391,34 @@ CFont::InitPerFrame(void)
|
|||
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
|
||||
SetDropShadowPosition(0);
|
||||
NewLine = 0;
|
||||
#ifdef BUTTON_ICONS
|
||||
PS2Symbol = BUTTON_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
void
|
||||
CFont::DrawButton(float x, float y)
|
||||
{
|
||||
if (x <= 0.0f || x > SCREEN_WIDTH || y <= 0.0f || y > SCREEN_HEIGHT)
|
||||
return;
|
||||
|
||||
if (PS2Symbol != BUTTON_NONE) {
|
||||
CRect rect;
|
||||
rect.left = x;
|
||||
rect.top = Details.scaleY + Details.scaleY + y;
|
||||
rect.right = Details.scaleY * 17.0f + x;
|
||||
rect.bottom = Details.scaleY * 19.0f + y;
|
||||
|
||||
int vertexAlphaState;
|
||||
RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &vertexAlphaState);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
|
||||
ButtonSprite[PS2Symbol].Draw(rect, CRGBA(255, 255, 255, Details.color.a));
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)vertexAlphaState);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CFont::PrintChar(float x, float y, wchar c)
|
||||
{
|
||||
|
@ -855,6 +925,15 @@ CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, f
|
|||
c = *s - ' ';
|
||||
if (Details.slant != 0.0f && !IsJapanese())
|
||||
y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
if (PS2Symbol != BUTTON_NONE) {
|
||||
DrawButton(x, y);
|
||||
x += Details.scaleY * 17.0f;
|
||||
PS2Symbol = BUTTON_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
PrintChar(x, y, c);
|
||||
x += GetCharacterSize(c);
|
||||
if (c == 0 && (!NewLine || !IsJapanese())) // space
|
||||
|
@ -1045,6 +1124,30 @@ CFont::GetStringWidth(wchar *s, bool spaces)
|
|||
do {
|
||||
while (*s == '~' || *s == JAP_TERMINATION) {
|
||||
s++;
|
||||
#ifdef BUTTON_ICONS
|
||||
switch (*s) {
|
||||
#if 0 // unused
|
||||
case 'U':
|
||||
case 'D':
|
||||
case '<':
|
||||
case '>':
|
||||
#endif
|
||||
case 'X':
|
||||
case 'O':
|
||||
case 'Q':
|
||||
case 'T':
|
||||
case 'K':
|
||||
case 'M':
|
||||
case 'A':
|
||||
case 'J':
|
||||
case 'V':
|
||||
case 'C':
|
||||
w += 17.0f * Details.scaleY;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
while (!(*s == '~' || *s == JAP_TERMINATION)) s++;
|
||||
s++;
|
||||
}
|
||||
|
@ -1059,6 +1162,30 @@ CFont::GetStringWidth(wchar *s, bool spaces)
|
|||
for (wchar c = *s; (c != ' ' || spaces) && c != '\0'; c = *(++s)) {
|
||||
if (c == '~') {
|
||||
s++;
|
||||
#ifdef BUTTON_ICONS
|
||||
switch (*s) {
|
||||
#if 0 // unused
|
||||
case 'U':
|
||||
case 'D':
|
||||
case '<':
|
||||
case '>':
|
||||
#endif
|
||||
case 'X':
|
||||
case 'O':
|
||||
case 'Q':
|
||||
case 'T':
|
||||
case 'K':
|
||||
case 'M':
|
||||
case 'A':
|
||||
case 'J':
|
||||
case 'V':
|
||||
case 'C':
|
||||
w += 17.0f * Details.scaleY;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
while (*s != '~') {
|
||||
s++;
|
||||
}
|
||||
|
@ -1146,6 +1273,24 @@ CFont::ParseToken(wchar *s, bool japShit)
|
|||
case 'r': SetColor(CRGBA(113, 43, 73, 255)); break;
|
||||
case 'w': SetColor(CRGBA(175, 175, 175, 255)); break;
|
||||
case 'y': SetColor(CRGBA(210, 196, 106, 255)); break;
|
||||
#ifdef BUTTON_ICONS
|
||||
#if 0 // unused
|
||||
case 'U': PS2Symbol = BUTTON_UP; break;
|
||||
case 'D': PS2Symbol = BUTTON_DOWN; break;
|
||||
case '<': PS2Symbol = BUTTON_LEFT; break;
|
||||
case '>': PS2Symbol = BUTTON_RIGHT; break;
|
||||
#endif
|
||||
case 'X': PS2Symbol = BUTTON_CROSS; break;
|
||||
case 'O': PS2Symbol = BUTTON_CIRCLE; break;
|
||||
case 'Q': PS2Symbol = BUTTON_SQUARE; break;
|
||||
case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
|
||||
case 'K': PS2Symbol = BUTTON_L1; break;
|
||||
case 'M': PS2Symbol = BUTTON_L2; break;
|
||||
case 'A': PS2Symbol = BUTTON_L3; break;
|
||||
case 'J': PS2Symbol = BUTTON_R1; break;
|
||||
case 'V': PS2Symbol = BUTTON_R2; break;
|
||||
case 'C': PS2Symbol = BUTTON_R3; break;
|
||||
#endif
|
||||
}
|
||||
} else if (IsJapanese()) {
|
||||
if ((*s & 0x7FFF) == 'N' || (*s & 0x7FFF) == 'n')
|
||||
|
@ -1190,6 +1335,24 @@ CFont::ParseToken(wchar *s)
|
|||
case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break;
|
||||
#endif
|
||||
case 'y': SetColor(CRGBA(255, 227, 79, 255)); Details.anonymous_23 = true; break;
|
||||
#ifdef BUTTON_ICONS
|
||||
#if 0 // unused
|
||||
case 'U': PS2Symbol = BUTTON_UP; break;
|
||||
case 'D': PS2Symbol = BUTTON_DOWN; break;
|
||||
case '<': PS2Symbol = BUTTON_LEFT; break;
|
||||
case '>': PS2Symbol = BUTTON_RIGHT; break;
|
||||
#endif
|
||||
case 'X': PS2Symbol = BUTTON_CROSS; break;
|
||||
case 'O': PS2Symbol = BUTTON_CIRCLE; break;
|
||||
case 'Q': PS2Symbol = BUTTON_SQUARE; break;
|
||||
case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
|
||||
case 'K': PS2Symbol = BUTTON_L1; break;
|
||||
case 'M': PS2Symbol = BUTTON_L2; break;
|
||||
case 'A': PS2Symbol = BUTTON_L3; break;
|
||||
case 'J': PS2Symbol = BUTTON_R1; break;
|
||||
case 'V': PS2Symbol = BUTTON_R2; break;
|
||||
case 'C': PS2Symbol = BUTTON_R3; break;
|
||||
#endif
|
||||
}
|
||||
while(*s != '~') s++;
|
||||
if (*(++s) == '~')
|
||||
|
|
|
@ -91,6 +91,31 @@ enum
|
|||
#define FONT_LOCALE(style) (style)
|
||||
#endif
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
enum
|
||||
{
|
||||
BUTTON_NONE = -1,
|
||||
#if 0 // unused
|
||||
BUTTON_UP,
|
||||
BUTTON_DOWN,
|
||||
BUTTON_LEFT,
|
||||
BUTTON_RIGHT,
|
||||
#endif
|
||||
BUTTON_CROSS,
|
||||
BUTTON_CIRCLE,
|
||||
BUTTON_SQUARE,
|
||||
BUTTON_TRIANGLE,
|
||||
BUTTON_L1,
|
||||
BUTTON_L2,
|
||||
BUTTON_L3,
|
||||
BUTTON_R1,
|
||||
BUTTON_R2,
|
||||
BUTTON_R3,
|
||||
MAX_BUTTON_ICONS
|
||||
};
|
||||
#endif // BUTTON_ICONS
|
||||
|
||||
|
||||
class CFont
|
||||
{
|
||||
#ifdef MORE_LANGUAGES
|
||||
|
@ -106,11 +131,24 @@ public:
|
|||
static CFontDetails Details;
|
||||
static CFontRenderState RenderState;
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
static int32 ButtonsSlot;
|
||||
static CSprite2d ButtonSprite[MAX_BUTTON_ICONS];
|
||||
static int PS2Symbol;
|
||||
|
||||
static void DrawButton(float x, float y);
|
||||
#endif // BUTTON_ICONS
|
||||
|
||||
|
||||
static void Initialise(void);
|
||||
static void Shutdown(void);
|
||||
static void InitPerFrame(void);
|
||||
static void PrintChar(float x, float y, wchar c);
|
||||
static void PrintString(float x, float y, wchar *s);
|
||||
#ifdef XBOX_SUBTITLES
|
||||
static void PrintStringFromBottom(float x, float y, wchar *str);
|
||||
static void PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor);
|
||||
#endif
|
||||
static int GetNumberLines(float xstart, float ystart, wchar *s);
|
||||
static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s);
|
||||
#ifdef MORE_LANGUAGES
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "common.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "Glass.h"
|
||||
#include "Timer.h"
|
||||
|
@ -150,7 +150,11 @@ CFallingGlassPane::Render(void)
|
|||
fwdNorm.Normalise();
|
||||
uint8 alpha = CGlass::CalcAlphaWithNormal(&fwdNorm);
|
||||
|
||||
int32 time = clamp(CTimer::GetTimeInMilliseconds() - m_nTimer, 0, 500);
|
||||
#ifdef FIX_BUGS
|
||||
uint16 time = clamp(CTimer::GetTimeInMilliseconds() > m_nTimer ? CTimer::GetTimeInMilliseconds() - m_nTimer : 0u, 0u, 500u);
|
||||
#else
|
||||
uint16 time = clamp(CTimer::GetTimeInMilliseconds() - m_nTimer, 0, 500);
|
||||
#endif
|
||||
|
||||
uint8 color = int32( float(alpha) * (float(time) / 500) );
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
//--MIAMI: file done
|
||||
|
||||
bool gbShowPedRoadGroups;
|
||||
bool gbShowCarRoadGroups;
|
||||
bool gbShowCollisionPolys;
|
||||
bool gbShowCollisionLines;
|
||||
bool gbBigWhiteDebugLightSwitchedOn;
|
||||
|
@ -37,6 +39,10 @@ bool gbDontRenderPeds;
|
|||
bool gbDontRenderObjects;
|
||||
bool gbDontRenderVehicles;
|
||||
|
||||
// unused
|
||||
int16 TestCloseThings;
|
||||
int16 TestBigThings;
|
||||
|
||||
struct EntityInfo
|
||||
{
|
||||
CEntity *ent;
|
||||
|
@ -61,6 +67,10 @@ CVehicle *CRenderer::m_pFirstPersonVehicle;
|
|||
bool CRenderer::m_loadingPriority;
|
||||
float CRenderer::ms_lodDistScale = 1.2f;
|
||||
|
||||
// unused
|
||||
BlockedRange CRenderer::aBlockedRanges[16];
|
||||
BlockedRange* CRenderer::pFullBlockedRanges;
|
||||
BlockedRange* CRenderer::pEmptyBlockedRanges;
|
||||
|
||||
void
|
||||
CRenderer::Init(void)
|
||||
|
@ -1222,7 +1232,21 @@ CRenderer::ConstructRenderList(void)
|
|||
ms_nNoOfInVisibleEntities = 0;
|
||||
}
|
||||
ms_vecCameraPosition = TheCamera.GetPosition();
|
||||
// TODO: blocked ranges, but unused
|
||||
|
||||
// unused
|
||||
pFullBlockedRanges = nil;
|
||||
pEmptyBlockedRanges = aBlockedRanges;
|
||||
for(int i = 0; i < 16; i++){
|
||||
aBlockedRanges[i].prev = &aBlockedRanges[i-1];
|
||||
aBlockedRanges[i].next = &aBlockedRanges[i+1];
|
||||
}
|
||||
aBlockedRanges[0].prev = nil;
|
||||
aBlockedRanges[15].next = nil;
|
||||
|
||||
// unused
|
||||
TestCloseThings = 0;
|
||||
TestBigThings = 0;
|
||||
|
||||
ScanWorld();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ class CEntity;
|
|||
#define FADE_DISTANCE 20.0f
|
||||
#define STREAM_DISTANCE 30.0f
|
||||
|
||||
extern bool gbShowPedRoadGroups;
|
||||
extern bool gbShowCarRoadGroups;
|
||||
extern bool gbShowCollisionPolys;
|
||||
extern bool gbShowCollisionLines;
|
||||
extern bool gbBigWhiteDebugLightSwitchedOn;
|
||||
|
@ -23,6 +25,13 @@ extern bool gbDontRenderVehicles;
|
|||
class CVehicle;
|
||||
class CPtrList;
|
||||
|
||||
// unused
|
||||
struct BlockedRange
|
||||
{
|
||||
float a, b; // unknown
|
||||
BlockedRange *prev, *next;
|
||||
};
|
||||
|
||||
class CRenderer
|
||||
{
|
||||
static int32 ms_nNoOfVisibleEntities;
|
||||
|
@ -40,6 +49,10 @@ class CRenderer
|
|||
static CVector ms_vecCameraPosition;
|
||||
static CVehicle *m_pFirstPersonVehicle;
|
||||
|
||||
// unused
|
||||
static BlockedRange aBlockedRanges[16];
|
||||
static BlockedRange *pFullBlockedRanges;
|
||||
static BlockedRange *pEmptyBlockedRanges;
|
||||
public:
|
||||
static float ms_lodDistScale;
|
||||
static bool m_loadingPriority;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#include "RwHelper.h"
|
||||
#include "templates.h"
|
||||
#include "main.h"
|
||||
#include "Entity.h"
|
||||
|
@ -11,6 +12,7 @@
|
|||
#include "VisibilityPlugins.h"
|
||||
#include "World.h"
|
||||
#include "custompipes.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
|
@ -837,7 +839,6 @@ CVisibilityPlugins::GetAtomicId(RpAtomic *atomic)
|
|||
return ATOMICEXT(atomic)->flags;
|
||||
}
|
||||
|
||||
// This is rather useless, but whatever
|
||||
void
|
||||
CVisibilityPlugins::SetAtomicRenderCallback(RpAtomic *atomic, RpAtomicCallBackRender cb)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "Clock.h"
|
||||
#include "MBlur.h"
|
||||
#include "Date.h"
|
||||
#include "Font.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Game.h"
|
||||
#include "GameLogic.h"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "Sprite2d.h"
|
||||
#include "AnimViewer.h"
|
||||
#include "Font.h"
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
#define MAX_SUBSYSTEMS (16)
|
||||
|
||||
|
@ -279,7 +280,11 @@ psMouseSetPos(RwV2d *pos)
|
|||
RwMemoryFunctions*
|
||||
psGetMemoryFunctions(void)
|
||||
{
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
return &memFuncs;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1521,6 +1526,10 @@ main(int argc, char *argv[])
|
|||
RwV2d pos;
|
||||
RwInt32 i;
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
InitMemoryMgr();
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
struct sigaction act;
|
||||
act.sa_sigaction = terminateHandler;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "skeleton.h"
|
||||
#include "platform.h"
|
||||
#include "main.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
// --MIAMI: file done
|
||||
|
||||
|
@ -306,6 +307,8 @@ RsRwInitialize(void *displayID)
|
|||
{
|
||||
RwEngineOpenParams openParams;
|
||||
|
||||
PUSH_MEMID(MEMID_RENDER); // NB: not popped on failed return
|
||||
|
||||
/*
|
||||
* Start RenderWare...
|
||||
*/
|
||||
|
@ -373,6 +376,8 @@ RsRwInitialize(void *displayID)
|
|||
RwTextureSetAutoMipmapping(TRUE);
|
||||
RwTextureSetMipmapping(FALSE);
|
||||
|
||||
POP_MEMID();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ static psGlobalType PsGlobal;
|
|||
#include "Sprite2d.h"
|
||||
#include "AnimViewer.h"
|
||||
#include "Font.h"
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
VALIDATE_SIZE(psGlobalType, 0x28);
|
||||
|
||||
|
@ -309,7 +310,11 @@ psMouseSetPos(RwV2d *pos)
|
|||
RwMemoryFunctions*
|
||||
psGetMemoryFunctions(void)
|
||||
{
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
return &memFuncs;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2009,6 +2014,10 @@ WinMain(HINSTANCE instance,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
InitMemoryMgr();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the platform independent data.
|
||||
* This will in turn initialize the platform specific data...
|
||||
|
|
|
@ -5249,7 +5249,6 @@ CPed::MakeTyresMuddySectorList(CPtrList &list)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CAutomobile::SetBusDoorTimer(uint32 timer, uint8 type)
|
||||
{
|
||||
|
|
|
@ -120,6 +120,11 @@ enum tVehicleType
|
|||
NUMBOATHANDLINGS = HANDLING_SEAPLANE+1 - HANDLING_PREDATOR,
|
||||
};
|
||||
|
||||
enum tField // most likely a handling field enum, never used so :shrug:
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HANDLING_1G_BOOST = 1,
|
||||
|
@ -239,6 +244,8 @@ struct tFlyingHandlingData
|
|||
CVector vecSpeedRes;
|
||||
};
|
||||
|
||||
class CVehicle;
|
||||
|
||||
class cHandlingDataMgr
|
||||
{
|
||||
float field_0; // unused it seems
|
||||
|
@ -258,6 +265,7 @@ public:
|
|||
void Initialise(void);
|
||||
void LoadHandlingData(void);
|
||||
int FindExactWord(const char *word, const char *words, int wordLen, int numWords);
|
||||
void ConvertDataToWorldUnits(tHandlingData *handling);
|
||||
void ConvertDataToGameUnits(tHandlingData *handling);
|
||||
void ConvertBikeDataToGameUnits(tBikeHandlingData *handling);
|
||||
int32 GetHandlingId(const char *name);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "HandlingMgr.h"
|
||||
#include "Heli.h"
|
||||
#include "Plane.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
|
@ -564,7 +565,9 @@ CPlane::ProcessControl(void)
|
|||
if(m_rwObject && RwObjectGetType(m_rwObject) == rpCLUMP){
|
||||
DeleteRwObject();
|
||||
if(mi->m_planeLodId != -1){
|
||||
PUSH_MEMID(MEMID_WORLD);
|
||||
m_rwObject = CModelInfo::GetModelInfo(mi->m_planeLodId)->CreateInstance();
|
||||
POP_MEMID();
|
||||
if(m_rwObject)
|
||||
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue