1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-22 17:35:29 +00:00

Merge branch 'master' of github.com:GTAmodding/re3

This commit is contained in:
aap 2020-12-02 10:38:39 +01:00
commit f576311814
18 changed files with 434 additions and 38 deletions

Binary file not shown.

View file

@ -353,11 +353,11 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
m_pObject->GetMatrix().UpdateRW();
m_pObject->UpdateRwFrame();
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, 0) && waterLevel >= m_pObject->GetPosition().z)
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, false) && waterLevel >= m_pObject->GetPosition().z)
m_eType = PICKUP_FLOATINGPACKAGE_FLOATING;
break;
case PICKUP_FLOATINGPACKAGE_FLOATING:
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, 0))
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, false))
m_pObject->GetMatrix().GetPosition().z = waterLevel;
m_pObject->GetMatrix().UpdateRW();

View file

@ -1,5 +1,5 @@
#include "common.h"
#ifdef GTA_REPLAY
#include "AnimBlendAssociation.h"
#include "Boat.h"
#include "SpecialFX.h"
@ -1585,3 +1585,4 @@ void CReplay::Display()
if (Mode == MODE_PLAYBACK)
CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
}
#endif

View file

@ -63,6 +63,12 @@ struct CStoredDetailedAnimationState
void PlayReplayFromHD(void);
#ifdef GTA_REPLAY
#define REPLAY_STUB
#else
#define REPLAY_STUB {}
#endif
class CReplay
{
enum {
@ -273,20 +279,24 @@ private:
#endif
public:
static void Init(void);
static void DisableReplays(void);
static void EnableReplays(void);
static void Update(void);
static void FinishPlayback(void);
static void EmptyReplayBuffer(void);
static void Display(void);
static void TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene);
static void StreamAllNecessaryCarsAndPeds(void);
static bool ShouldStandardCameraBeProcessed(void);
static void Init(void) REPLAY_STUB;
static void DisableReplays(void) REPLAY_STUB;
static void EnableReplays(void) REPLAY_STUB;
static void Update(void) REPLAY_STUB;
static void FinishPlayback(void) REPLAY_STUB;
static void EmptyReplayBuffer(void) REPLAY_STUB;
static void Display(void) REPLAY_STUB;
static void TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) REPLAY_STUB;
static void StreamAllNecessaryCarsAndPeds(void) REPLAY_STUB;
#ifndef GTA_REPLAY
static bool ShouldStandardCameraBeProcessed(void) { return true; }
static bool IsPlayingBack() { return false; }
static bool IsPlayingBackFromFile() { return false; }
#else
static bool ShouldStandardCameraBeProcessed(void);
static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; }
static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; }
private:
static void RecordThisFrame(void);
static void StorePedUpdate(CPed *ped, int id);
@ -314,4 +324,5 @@ private:
/* Absolute nonsense, but how could this function end up being outside of class? */
friend void PlayReplayFromHD(void);
#endif
};

View file

@ -1,7 +1,7 @@
#include "common.h"
#include "SceneEdit.h"
#ifdef GTA_SCENE_EDIT
#include "Automobile.h"
#include "Camera.h"
#include "CarCtrl.h"
@ -1096,3 +1096,4 @@ bool CSceneEdit::SelectWeapon(void)
}
return false;
}
#endif

View file

@ -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

View file

@ -263,9 +263,11 @@ CCam::Process(void)
case MODE_FIGHT_CAM_RUNABOUT:
Process_1rstPersonPedOnPC(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
#ifdef GTA_SCENE_EDIT
case MODE_EDITOR:
Process_Editor(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
#endif
default:
Source = CVector(0.0f, 0.0f, 0.0f);
Front = CVector(0.0f, 1.0f, 0.0f);
@ -3919,6 +3921,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
}
#endif
#ifdef GTA_SCENE_EDIT
void
CCam::Process_Editor(const CVector&, float, float, float)
{
@ -3997,6 +4000,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
sprintf(str, "Look@: %f, Look@: %f, Look@: %f ", Front.x + Source.x, Front.y + Source.y, Front.z + Source.z);
}
}
#endif
void
CCam::Process_ModelView(const CVector &CameraTarget, float, float, float)

View file

@ -1576,8 +1576,10 @@ CCamera::CamControl(void)
switchByJumpCut = true;
}
}
#ifdef GTA_SCENE_EDIT
if(CSceneEdit::m_bEditOn)
ReqMode = CCam::MODE_EDITOR;
#endif
if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){
if(switchByJumpCut){

View file

@ -213,7 +213,9 @@ public:
void PrintMode(void);
void Process_Debug(const CVector&, float, float, float);
#ifdef GTA_SCENE_EDIT
void Process_Editor(const CVector&, float, float, float);
#endif
void Process_ModelView(const CVector &CameraTarget, float, float, float);
void Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float);

View file

@ -91,6 +91,9 @@
#include "screendroplets.h"
#include "crossplatform.h"
#include "MemoryHeap.h"
#ifdef USE_TEXTURE_POOL
#include "TexturePools.h"
#endif
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@ -522,7 +525,7 @@ bool CGame::Initialise(const char* datFile)
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
#ifndef GTA_PS2 // TODO: define for this
#ifdef GTA_SCENE_EDIT
CSceneEdit::Initialise();
#endif
@ -578,9 +581,7 @@ bool CGame::Initialise(const char* datFile)
CPlane::InitPlanes();
CCredits::Init();
CRecordDataForChase::Init();
#ifndef GTA_PS2 // TODO: define for that
CReplay::Init();
#endif
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
@ -770,10 +771,8 @@ void CGame::ReloadIPLs(void)
void CGame::ShutDownForRestart(void)
{
#ifndef GTA_PS2 // TODO: right define
CReplay::FinishPlayback();
CReplay::EmptyReplayBuffer();
#endif
DMAudio.DestroyAllGameCreatedEntities();
for (int i = 0; i < NUMPLAYERS; i++)
@ -977,7 +976,7 @@ void CGame::Process(void)
CSkidmarks::Update();
CAntennas::Update();
CGlass::Update();
#ifndef GTA_PS2 // TODO: define
#ifdef GTA_SCENE_EDIT
CSceneEdit::Update();
#endif
CEventList::Update();
@ -993,9 +992,7 @@ void CGame::Process(void)
CMovingThings::Update();
CWaterCannons::Update();
CUserDisplay::Process();
#ifndef GTA_PS2 // TODO: define
CReplay::Update();
#endif
PUSH_MEMID(MEMID_WORLD);
CWorld::Process();
@ -1008,14 +1005,10 @@ void CGame::Process(void)
CRubbish::Update();
CSpecialFX::Update();
CTimeCycle::Update();
#ifndef GTA_PS2 // TODO: define
if (CReplay::ShouldStandardCameraBeProcessed())
#endif
TheCamera.Process();
CCullZones::Update();
#ifndef GTA_PS2 // TODO: define
if (!CReplay::IsPlayingBack())
#endif
CGameLogic::Update();
CBridge::Update();
CCoronas::DoSunAndMoon();
@ -1023,9 +1016,7 @@ void CGame::Process(void)
CShadows::UpdateStaticShadows();
CShadows::UpdatePermanentShadows();
gPhoneInfo.Update();
#ifndef GTA_PS2 // TODO: define
if (!CReplay::IsPlayingBack())
#endif
{
PUSH_MEMID(MEMID_CARS);
CCarCtrl::GenerateRandomCars();

View file

@ -196,6 +196,8 @@ enum Config {
# define RANDOMSPLASH // use random splash as on PS2
# define PS2_MATFX
# endif
# define GTA_REPLAY
# define GTA_SCENE_EDIT
#elif defined GTA_XBOX
#endif

View file

@ -1160,9 +1160,11 @@ Render2dStuff(void)
MusicManager.DisplayRadioStationName();
TheConsole.Display();
#ifdef GTA_SCENE_EDIT
if(CSceneEdit::m_bEditOn)
CSceneEdit::Draw();
else
#endif
CHud::Draw();
CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display();

View file

@ -580,7 +580,9 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Disable zone cull", &gbDisableZoneCull, nil);
DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
#ifdef GTA_SCENE_EDIT
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
#endif
#ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif

View file

@ -605,11 +605,6 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
return (nil);
}
#ifdef USE_TEXTURE_POOL
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
#endif
#ifdef LIBRW
#include <rpmatfx.h>
#include "VehicleModelInfo.h"

View file

@ -50,8 +50,6 @@ RwCamera *CameraCreate(RwInt32 width,
RwBool zBuffer);
void _TexturePoolsInitialise();
void _TexturePoolsShutdown();
RpAtomic *ConvertPlatformAtomic(RpAtomic *atomic, void *data);

221
src/rw/TexturePools.cpp Normal file
View file

@ -0,0 +1,221 @@
#ifndef LIBRW
#include <d3d8.h>
#define WITHD3D
#include "common.h"
#include "TexturePools.h"
// TODO: this needs to be integrated into RW
extern "C" LPDIRECT3DDEVICE8 _RwD3DDevice;
CTexturePool aTexturePools[12];
CPaletteList PaletteList;
int numTexturePools;
int MaxPaletteIndex;
bool bUsePaletteIndex = true;
void
CTexturePool::Create(D3DFORMAT _Format, int _size, uint32 mipmapLevels, int32 numTextures)
{
Format = _Format;
size = _size;
levels = mipmapLevels;
pTextures = new IDirect3DTexture8 *[numTextures];
texturesMax = numTextures;
texturesNum = 0;
texturesUsed = 0;
}
void
CTexturePool::Release()
{
int i = 0;
while (i < texturesNum) {
pTextures[i]->Release();
i++;
}
delete[] pTextures;
pTextures = nil;
texturesNum = 0;
texturesUsed = 0;
}
IDirect3DTexture8 *
CTexturePool::FindTexture()
{
if (texturesNum == 0)
return nil;
texturesUsed--;
return pTextures[--texturesNum];
}
bool
CTexturePool::AddTexture(IDirect3DTexture8 *texture)
{
++texturesUsed;
if (texturesNum >= texturesMax)
return false;
pTextures[texturesNum] = texture;
++texturesNum;
return true;
}
void
CTexturePool::Resize(int numTextures)
{
if (numTextures == texturesMax)
return;
IDirect3DTexture8 **newTextures = new IDirect3DTexture8 *[numTextures];
for (int i = 0; i < texturesNum && i < numTextures; i++)
newTextures[i] = pTextures[i];
if (numTextures < texturesNum) {
for (int i = numTextures; i < texturesNum; i++)
pTextures[i]->Release();
}
delete[] pTextures;
pTextures = newTextures;
texturesMax = numTextures;
}
void
CPaletteList::Alloc(int max)
{
Data = new int[max];
Max = max;
Num = 0;
}
void
CPaletteList::Free()
{
delete[] Data;
Data = nil;
Num = 0;
}
int
CPaletteList::Find()
{
if (Num == 0)
return -1;
return Data[--Num];
}
void
CPaletteList::Add(int item)
{
if (Num < Max)
Data[Num++] = item;
else {
Resize(2 * Max);
Add(item);
}
}
void
CPaletteList::Resize(int max)
{
if (max == Max)
return;
int *newData = new int[4 * max];
for (int i = 0; i < Num && i < max; i++)
newData[i] = Data[i];
delete[] Data;
Data = newData;
Max = max;
}
HRESULT
CreateTexture(int width, int height, int levels, D3DFORMAT Format, IDirect3DTexture8 **texture)
{
if (width == height) {
for (int i = 0; i < numTexturePools; i++) {
if (width != aTexturePools[i].GetSize() && levels == aTexturePools[i].levels && Format == aTexturePools[i].Format)
*texture = aTexturePools[i].FindTexture();
}
}
if (*texture)
return D3D_OK;
else
return _RwD3DDevice->CreateTexture(width, height, levels, 0, Format, D3DPOOL_MANAGED, texture);
}
void
ReleaseTexture(IDirect3DTexture8 *texture)
{
int levels = 1;
if (texture->GetLevelCount() > 1)
levels = 0;
D3DSURFACE_DESC SURFACE_DESC;
texture->GetLevelDesc(0, &SURFACE_DESC);
if (SURFACE_DESC.Width == SURFACE_DESC.Height) {
for (int i = 0; i < numTexturePools; i++) {
if (SURFACE_DESC.Width == aTexturePools[i].GetSize() && SURFACE_DESC.Format == aTexturePools[i].Format && levels == aTexturePools[i].levels) {
if (!aTexturePools[i].AddTexture(texture)) {
if (aTexturePools[i].texturesUsed > 3 * aTexturePools[i].texturesMax / 2) {
aTexturePools[i].Resize(2 * aTexturePools[i].texturesMax);
aTexturePools[i].texturesUsed--;
aTexturePools[i].AddTexture(texture);
} else {
texture->Release();
}
}
return;
}
}
}
if (numTexturePools < 12 && bUsePaletteIndex && levels != 0 && SURFACE_DESC.Width == SURFACE_DESC.Height &&
(SURFACE_DESC.Width == 64 || SURFACE_DESC.Width == 128 || SURFACE_DESC.Width == 256)) {
aTexturePools[numTexturePools].Create(SURFACE_DESC.Format, SURFACE_DESC.Width, 1, 16);
aTexturePools[numTexturePools].AddTexture(texture);
numTexturePools++;
} else
texture->Release();
}
int
FindAvailablePaletteIndex()
{
int index = PaletteList.Find();
if (index == -1)
index = MaxPaletteIndex++;
return index;
}
void
AddAvailablePaletteIndex(int index)
{
if (bUsePaletteIndex)
PaletteList.Add(index);
}
void
_TexturePoolsInitialise()
{
PaletteList.Alloc(100);
MaxPaletteIndex = 0;
}
void
_TexturePoolsShutdown()
{
for (int i = 0; i < numTexturePools; i++)
aTexturePools[i].Release();
numTexturePools = 0;
bUsePaletteIndex = false;
PaletteList.Free();
}
#endif // !LIBRW

42
src/rw/TexturePools.h Normal file
View file

@ -0,0 +1,42 @@
#pragma once
class CTexturePool
{
public:
D3DFORMAT Format;
int size;
uint32 levels;
int32 texturesMax;
int32 texturesUsed;
int32 texturesNum;
IDirect3DTexture8 **pTextures;
public:
CTexturePool() {}
void Create(D3DFORMAT _Format, int size, uint32 mipmapLevels, int32 numTextures);
void Release();
IDirect3DTexture8 *FindTexture();
bool AddTexture(IDirect3DTexture8 *texture);
void Resize(int numTextures);
#ifdef FIX_BUGS
int GetSize() { return size; }
#else
float GetSize() { return size; }
#endif
};
class CPaletteList
{
int Max;
int Num;
int *Data;
public:
void Alloc(int max);
void Free();
int Find();
void Add(int item);
void Resize(int max);
};
void _TexturePoolsInitialise();
void _TexturePoolsShutdown();

View file

@ -8021,11 +8021,132 @@ Error al cargar el juego. El juego se reiniciará.
RESTAURADO AJUSTE ORIGINAL
[FET_RSC]
HARDAWARE NO DISPONIBLE. RESTAURADO AJUSTE ORIGINAL HARDWARE NOT AVAILABLE - ORIGINAL SETTING RESTORED
HARDAWARE NO DISPONIBLE. RESTAURADO AJUSTE ORIGINAL
[CRED270]
MIKE HONG
{ re3 updates }
{ new languages }
[FEL_JAP]
JAPONÉS
[FEL_POL]
POLACO
[FEL_RUS]
RUSO
{ new display menus }
[FET_GRA]
AJUSTES GRÁFICOS
[FED_MIP]
MIPMAPPING
[FED_AAS]
SUAVIZADO DE BORDES
[FED_FIL]
FILTRO DE TEXTURAS
[FED_BIL]
BILINEAL
[FED_TRL]
TRILINEAL
[FED_WND]
VENTANA
[FED_FLS]
PANTALLA COMPLETA
[FEM_CSB]
BORDES EN CINEMÁTICAS
[FEM_SCF]
FORMATO DE IMAGEN
[FEM_ISL]
USO DE MEMORIA
[FEM_LOW]
BAJO
[FEM_MED]
MEDIO
[FEM_HIG]
ALTO
[FEM_2PR]
ALPHA TEST TIPO PS2
[FEC_FRC]
CÁMARA LIBRE
{ Linux joy detection }
[FEC_JOD]
DETECTAR JOYSTICK
[FEC_JPR]
Pulsa cualquier botón del joystick que quieras usar con el juego para seleccionarlo.
[FEC_JDE]
Joystick detectado
{ mission restart }
[FET_RMS]
REPETIR MISIÓN
[FESZ_RM]
¿REINTENTAR?
[FED_VPL]
FLUJO DE VEHÍCULOS
[FED_PRM]
LUCES EN PEATONES
[FED_RGL]
BRILLO DE CARRETERAS
[FED_CLF]
FILTRO DE COLOR
[FED_WLM]
MAPAS DE LUZ DEL MUNDO
[FED_MBL]
DESENFOQ. MOVIMIENTO
[FEM_SIM]
SIMPLE
[FEM_NRM]
NORMAL
[FEM_MOB]
MÓVIL
[FED_MFX]
MATFX
[FED_NEO]
NEO
[FEM_PS2]
PS2
[FEM_XBX]
XBOX
[FEC_IVP]
INVERTIR VERTICALIDAD MANDO
{ end of file }
[DUMMY]
THIS LABEL NEEDS TO BE HERE !!!
AS THE LAST LABEL DOES NOT GET COMPILED