1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-06 03:25:55 +00:00
This commit is contained in:
Nikolay Korolev 2021-01-26 02:25:47 +03:00
commit 46e63da4d8
96 changed files with 2736 additions and 857 deletions

4
.gitignore vendored
View file

@ -354,3 +354,7 @@ vendor/glfw-3.3.2.bin.WIN32/
vendor/glfw-3.3.2.bin.WIN64/
sdk/
codewarrior/reVC_Data/
codewarrior/Release/
codewarrior/Debug/

View file

View file

BIN
codewarrior/reVC.mcp Normal file

Binary file not shown.

Binary file not shown.

View file

@ -79,6 +79,21 @@ endif()
target_compile_definitions(${EXECUTABLE} PRIVATE )
option(${PROJECT}_WITH_SANITIZERS "Use UB sanitizers (better crash log)" OFF)
option(${PROJECT}_WITH_ASAN "Use Address sanitizer (better crash log)" OFF)
if(${PROJECT}_WITH_SANITIZERS)
target_compile_options(${EXECUTABLE} PUBLIC
-fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability
-g3 -fno-omit-frame-pointer)
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability)
endif()
if(${PROJECT}_WITH_ASAN)
target_compile_options(${EXECUTABLE} PUBLIC -fsanitize=address -g3 -fno-omit-frame-pointer)
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=address)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(${EXECUTABLE}
PRIVATE

View file

@ -1,7 +1,11 @@
#include "common.h"
#if defined _WIN32 && !defined __MINGW32__
#if defined __MWERKS__
#include <wctype.h>
#else
#include "ctype.h"
#endif
#else
#include <cwctype>
#endif
@ -89,18 +93,18 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
if(c1) s1++;
if(c2) s2++;
if(c1 == '\0' && c2 == '\0') return true;
#if defined _WIN32 && !defined __MINGW32__
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#else
#ifndef ASCII_STRCMP
if(iswdigit(c1) && iswdigit(c2))
#else
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#endif
continue;
#if defined _WIN32 && !defined __MINGW32__
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#else
#ifndef ASCII_STRCMP
c1 = toupper(c1);
c2 = toupper(c2);
#else
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#endif
if(c1 && c2 && c1 != c2)

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "AudioManager.h"
#include "audio_enums.h"
@ -43,7 +43,7 @@
#include "Script.h"
#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
const int allChannels = channels + 2;
@ -8115,7 +8115,7 @@ cAudioManager::ProcessWaterCannon(int32)
}
//positon of arcade machines
CVector aVecExtraSoundPosition[] = { {-1042.546f, 88.794f, 11.324f}, {-1004.476f, 181.697f, 11.324f} };
CVector aVecExtraSoundPosition[] = { CVector(-1042.546f, 88.794f, 11.324f), CVector(-1004.476f, 181.697f, 11.324f) };
void
cAudioManager::ProcessExtraSounds()

View file

@ -14,7 +14,7 @@
cAudioManager AudioManager;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
const int allChannels = channels + 2;

View file

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "audio_enums.h"
#include "AudioCollision.h"

View file

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "common.h"

View file

@ -1237,11 +1237,12 @@ cMusicManager::DisplayRadioStationName()
case RADIO_ESPANTOSO: string = TheText.Get("FEA_FM6"); break;
case EMOTION: string = TheText.Get("FEA_FM7"); break;
case WAVE: string = TheText.Get("FEA_FM8"); break;
case USERTRACK:
case 9: string = TheText.Get("FEA_FM9"); break;
case 10:
if (!SampleManager.IsMP3RadioChannelAvailable())
return;
string = TheText.Get("FEA_MP3"); break;
default: return;
default: string = TheText.Get("FEA_NON"); break;
};
if (pCurrentStation != string) {
@ -1255,21 +1256,22 @@ cMusicManager::DisplayRadioStationName()
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetDropShadowPosition(2);
CFont::SetScale(PSP_SCREEN_SCALE_X(0.5f), PSP_SCREEN_SCALE_Y(0.88f));
CFont::SetPropOn();
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetFontStyle(FONT_BANK);
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation);
CFont::SetCentreSize(PSP_SCREEN_SCALE_X(260.0f));
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
if (gNumRetunePresses)
CFont::SetColor(CRGBA(102, 133, 143, 255));
CFont::SetColor(CRGBA(77, 155, 210, 255));
else
CFont::SetColor(CRGBA(147, 196, 211, 255));
CFont::SetColor(CRGBA(77, 155, 210, 255));
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_Y(22.0f), pCurrentStation);
CFont::PrintString(SCREEN_WIDTH / 2, PSP_SCREEN_SCALE_Y(7.0f), pCurrentStation);
CFont::DrawFonts();
CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
}
}
}

View file

@ -15,7 +15,7 @@
#include "sampman.h"
#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
struct tPoliceRadioZone {

View file

@ -1,3 +1,5 @@
#include "common.h"
#ifdef AUDIO_MSS
#include <shlobj.h>
#include <shlguid.h>
@ -8,7 +10,6 @@
#include "eax-util.h"
#include "mss.h"
#include "common.h"
#include "sampman.h"
#include "AudioManager.h"
#include "MusicManager.h"

View file

@ -1,4 +1,4 @@
#pragma once
#pragma once
enum eSound
{

View file

@ -7,6 +7,8 @@
CColModel::CColModel(void)
{
boundingSphere.Set(0.0001f, CVector(0.0f, 0.0f, 0.0f));
boundingBox.Set(CVector(0.0f, 0.0f, 0.0f), CVector(0.0f, 0.0f, 0.0f));
numSpheres = 0;
spheres = nil;
numLines = 0;
@ -18,7 +20,7 @@ CColModel::CColModel(void)
triangles = nil;
trianglePlanes = nil;
level = LEVEL_GENERIC; // generic col slot
ownsCollisionVolumes = true;
// ownsCollisionVolumes = true;
}
CColModel::~CColModel(void)
@ -204,3 +206,10 @@ CColModel::operator=(const CColModel &other)
}
return *this;
}
bool
CColModel::Write(base::cRelocatableChunkWriter &writer, bool allocSpace)
{
assert(0 && "TODO(LCS)");
return 1;
}

View file

@ -36,4 +36,6 @@ struct CColModel
void *operator new(size_t);
void operator delete(void *p, size_t);
CColModel& operator=(const CColModel& other);
bool Write(base::cRelocatableChunkWriter &writer, bool allocSpace);
};

View file

@ -2099,12 +2099,12 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
float dot = DotProduct(*point - *l0, *l1 - *l0);
// Between 0 and len we're above the line.
// if not, calculate distance to endpoint
if(dot <= 0.0f)
return (*point - *l0).Magnitude();
if(dot >= lensq)
return (*point - *l1).Magnitude();
if(dot <= 0.0f) return (*point - *l0).Magnitude();
if(dot >= lensq) return (*point - *l1).Magnitude();
// distance to line
return Sqrt((*point - *l0).MagnitudeSqr() - dot*dot/lensq);
float distSqr = (*point - *l0).MagnitudeSqr() - dot * dot / lensq;
if(distSqr <= 0.f) return 0.f;
return Sqrt(distSqr);
}
// same as above but also return the point on the line

View file

@ -1,11 +1,12 @@
#include "common.h"
#include "main.h"
#include "TempColModels.h"
#include "Game.h"
CColModel CTempColModels::ms_colModelPed1;
// LCS: haven't yet checked the numbers but they probably haven't changed
CColModel CTempColModels::ms_colModelPed2;
CColModel CTempColModels::ms_colModelBBox;
CColModel CTempColModels::ms_colModelBumper1;
CColModel CTempColModels::ms_colModelWheel1;
CColModel CTempColModels::ms_colModelPanel1;
@ -16,7 +17,9 @@ CColModel CTempColModels::ms_colModelPedGroundHit;
CColModel CTempColModels::ms_colModelBoot1;
CColModel CTempColModels::ms_colModelDoor1;
CColModel CTempColModels::ms_colModelBonnet1;
CColModel CTempColModels::ms_colModelWeapon;
CColModel CTempColModels::ms_colModelFerryDocked;
CTempColModels *gpTempColModels;
CColSphere s_aPedSpheres[3];
@ -34,6 +37,7 @@ CColSphere s_aBootSpheres[4];
CColSphere s_aWheelSpheres[2];
CColSphere s_aBodyPartSpheres1[2];
CColSphere s_aBodyPartSpheres2[2];
CColBox S_aFerryDockedBoxes[1];
void
CTempColModels::Initialise(void)
@ -44,12 +48,27 @@ CTempColModels::Initialise(void)
colmodel.level = LEVEL_GENERIC;\
colmodel.ownsCollisionVolumes = false;
int i;
if(gMakeResources){
if(gpTempColModels == nil){
gpTempColModels = new CTempColModels;
gpTempColModels->Initialise();
return;
}
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
ms_colModelBBox.level = LEVEL_GENERIC;
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f));
SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
ms_colModelWeapon.boundingSphere.Set(0.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelWeapon.boundingBox.Set(CVector(-0.25f, -0.25f, -0.25f), CVector(0.25f, 0.25f, 0.25f));
}
int i;
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) {
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
@ -74,10 +93,6 @@ CTempColModels::Initialise(void)
s_aPedSpheres[i].piece = 0;
}
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f));
SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
// Ped 2 Spheres
s_aPed2Spheres[0].radius = 0.3f;
@ -294,13 +309,47 @@ CTempColModels::Initialise(void)
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
ms_colModelWeapon.boundingSphere.radius = 0.25f;
ms_colModelWeapon.boundingBox.min.x = -0.25f;
ms_colModelWeapon.boundingBox.min.y = -0.25f;
ms_colModelWeapon.boundingBox.min.z = -0.25f;
ms_colModelWeapon.boundingBox.max.x = 0.25f;
ms_colModelWeapon.boundingBox.max.y = 0.25f;
ms_colModelWeapon.boundingBox.max.z = 0.25f;
// Ferry Docked
S_aFerryDockedBoxes[0].Set(CVector(-6.3f, -22.78f, -2.0f), CVector(6.3f, 22.78f, 2.8f), SURFACE_THICK_METAL_PLATE, SURFACE_DEFAULT);
ms_colModelFerryDocked.boundingSphere.Set(35.0f, CVector(0.0f, -0.0f, 0.0f));
ms_colModelFerryDocked.boundingBox.Set(S_aFerryDockedBoxes[0].min, S_aFerryDockedBoxes[0].max);
ms_colModelFerryDocked.spheres = nil;
ms_colModelFerryDocked.numSpheres = 0;
ms_colModelFerryDocked.boxes = S_aFerryDockedBoxes;
ms_colModelFerryDocked.numBoxes = ARRAY_SIZE(S_aFerryDockedBoxes);
ms_colModelFerryDocked.level = LEVEL_GENERIC;
#undef SET_COLMODEL_SPHERES
}
void
CTempColModels::Write(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), 0x10, false, true);
ms_colModelBBox.Write(writer, false);
writer.AddPatch(&ms_colModelBBox);
ms_colModelPed1.Write(writer, false);
writer.AddPatch(&ms_colModelPed1);
ms_colModelWeapon.Write(writer, false);
writer.AddPatch(&ms_colModelWeapon);
for(int i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++)
ms_colModelCutObj[i].Write(writer, true);
ms_colModelPed2.Write(writer, true);
ms_colModelPedGroundHit.Write(writer, true);
ms_colModelDoor1.Write(writer, true);
ms_colModelBumper1.Write(writer, true);
ms_colModelPanel1.Write(writer, true);
ms_colModelBonnet1.Write(writer, true);
ms_colModelBoot1.Write(writer, true);
ms_colModelWheel1.Write(writer, true);
ms_colModelBodyPart1.Write(writer, true);
ms_colModelBodyPart2.Write(writer, true);
ms_colModelFerryDocked.Write(writer, true);
}

View file

@ -5,9 +5,11 @@
class CTempColModels
{
public:
static CColModel ms_colModelPed1;
CColModel ms_colModelPed1;
CColModel ms_colModelBBox;
CColModel ms_colModelWeapon;
static CColModel ms_colModelPed2;
static CColModel ms_colModelBBox;
static CColModel ms_colModelBumper1;
static CColModel ms_colModelWheel1;
static CColModel ms_colModelPanel1;
@ -18,7 +20,10 @@ public:
static CColModel ms_colModelBoot1;
static CColModel ms_colModelDoor1;
static CColModel ms_colModelBonnet1;
static CColModel ms_colModelWeapon;
static CColModel ms_colModelFerryDocked;
static void Initialise(void);
void Initialise(void);
void Write(base::cRelocatableChunkWriter &writer);
};
extern CTempColModels *gpTempColModels;

View file

@ -14,7 +14,7 @@ void COnscreenTimer::Init() {
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
m_sCounters[i].m_nCounterOffset = 0;
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText); j++) {
for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) {
m_sCounters[i].m_aCounterText[j] = 0;
}
@ -24,7 +24,7 @@ void COnscreenTimer::Init() {
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
m_sClocks[i].m_nClockOffset = 0;
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenTimerEntry::m_aClockText); j++) {
for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) {
m_sClocks[i].m_aClockText[j] = 0;
}
@ -92,7 +92,7 @@ void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 p
m_sCounters[pos].m_nCounterOffset = offset;
if(text) {
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText));
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText));
} else {
m_sCounters[pos].m_aCounterText[0] = 0;
}
@ -114,7 +114,7 @@ void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
m_sClocks[i].m_nClockOffset = offset;
m_sClocks[i].m_bClockGoingDown = bGoingDown;
if(text) {
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(COnscreenTimerEntry::m_aClockText));
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
} else {
m_sClocks[i].m_aClockText[0] = 0;
}

View file

@ -147,7 +147,7 @@ public:
class CPacManPickups
{
friend CPacManPickup;
friend class CPacManPickup;
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
static CVector LastPickUpCoors;

View file

@ -55,8 +55,8 @@ CRoadBlocks::Init(void)
void
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType)
{
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f},
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
static const CVector vecRoadBlockOffets[6] = { CVector(-1.5, 1.8f, 0.0f), CVector(-1.5f, -1.8f, 0.0f), CVector(1.5f, 1.8f, 0.0f),
CVector(1.5f, -1.8f, 0.0f), CVector(-1.5f, 0.0f, 0.0f), CVector(1.5, 0.0, 0.0) };
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
if (!pEntityToAttack)
pEntityToAttack = (CEntity*)FindPlayerPed();

View file

@ -289,6 +289,173 @@ struct script_corona
int flareType;
};
class CRunningScript
{
enum {
ANDOR_NONE = 0,
ANDS_1 = 1,
ANDS_2,
ANDS_3,
ANDS_4,
ANDS_5,
ANDS_6,
ANDS_7,
ANDS_8,
ORS_1 = 21,
ORS_2,
ORS_3,
ORS_4,
ORS_5,
ORS_6,
ORS_7,
ORS_8
};
enum {
STACKVALUE_IP_BITS = 22,
STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS,
STACKVALUE_IS_FUNCTION_CALL_BIT,
STACKVALUE_IP_PARAMS_OFFSET,
STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1)
};
public:
CRunningScript* next;
CRunningScript* prev;
int32 m_nId;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + 8 + NUM_TIMERS]; // TODO(LCS): figure out why 106
int32 m_nLocalsPointer;
bool m_bIsActive;
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_nAndOrState;
bool m_bNotFlag;
bool m_bDeatharrestEnabled;
bool m_bDeatharrestExecuted;
bool m_bMissionFlag;
public:
void SetIP(uint32 ip) { m_nIp = ip; }
CRunningScript* GetNext() const { return next; }
void Save(uint8*& buf);
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
for (int i = 0; i < NUM_TIMERS; i++)
m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep;
}
void Init();
void Process();
void RemoveScriptFromList(CRunningScript**);
void AddScriptToList(CRunningScript**);
static const uint32 nSaveStructSize;
void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
int8 ProcessOneCommand();
void DoDeatharrestCheck();
void UpdateCompareFlag(bool flag)
{
if (m_bNotFlag)
flag = !flag;
if (m_nAndOrState == ANDOR_NONE) {
m_bCondResult = flag;
return;
}
if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8) {
m_bCondResult &= flag;
if (m_nAndOrState == ANDS_1) {
m_nAndOrState = ANDOR_NONE;
return;
}
}
else {
m_bCondResult |= flag;
if (m_nAndOrState <= ORS_1) {
m_nAndOrState = ANDOR_NONE;
return;
}
}
m_nAndOrState--;
}
int16 GetPadState(uint16, uint16);
int8 ProcessCommands0To99(int32);
int8 ProcessCommands100To199(int32);
int8 ProcessCommands200To299(int32);
int8 ProcessCommands300To399(int32);
int8 ProcessCommands400To499(int32);
int8 ProcessCommands500To599(int32);
int8 ProcessCommands600To699(int32);
int8 ProcessCommands700To799(int32);
int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32);
int8 ProcessCommands1100To1199(int32);
int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32);
int8 ProcessCommands1500To1599(int32);
int8 ProcessCommands1600To1699(int32);
uint32 CollectLocateParameters(uint32*, bool);
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
void LocatePlayerCarCommand(int32, uint32*);
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
void LocateCharObjectCommand(int32, uint32*);
void LocateCarCommand(int32, uint32*);
void LocateSniperBulletCommand(int32, uint32*);
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
void LocateObjectCommand(int32, uint32*);
void ObjectInAreaCheckCommand(int32, uint32*);
#ifdef GTA_SCRIPT_COLLECTIVE
void LocateCollectiveCommand(int32, uint32*);
void LocateCollectiveCharCommand(int32, uint32*);
void LocateCollectiveCarCommand(int32, uint32*);
void LocateCollectivePlayerCommand(int32, uint32*);
void CollectiveInAreaCheckCommand(int32, uint32*);
#endif
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami);
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
bool CheckDamagedWeaponType(int32 actual, int32 type);
void ReturnFromGosubOrFunction();
};
enum {
VAR_LOCAL = 1,
@ -494,173 +661,6 @@ extern int ScriptParams[32];
VALIDATE_SIZE(uStackReturnValue, 4);
class CRunningScript
{
enum {
ANDOR_NONE = 0,
ANDS_1 = 1,
ANDS_2,
ANDS_3,
ANDS_4,
ANDS_5,
ANDS_6,
ANDS_7,
ANDS_8,
ORS_1 = 21,
ORS_2,
ORS_3,
ORS_4,
ORS_5,
ORS_6,
ORS_7,
ORS_8
};
enum {
STACKVALUE_IP_BITS = 22,
STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS,
STACKVALUE_IS_FUNCTION_CALL_BIT,
STACKVALUE_IP_PARAMS_OFFSET,
STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1)
};
public:
CRunningScript* next;
CRunningScript* prev;
int32 m_nId;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + 8 + NUM_TIMERS]; // TODO(LCS): figure out why 106
int32 m_nLocalsPointer;
bool m_bIsActive;
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_nAndOrState;
bool m_bNotFlag;
bool m_bDeatharrestEnabled;
bool m_bDeatharrestExecuted;
bool m_bMissionFlag;
public:
void SetIP(uint32 ip) { m_nIp = ip; }
CRunningScript* GetNext() const { return next; }
void Save(uint8*& buf);
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
for (int i = 0; i < NUM_TIMERS; i++)
m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep;
}
void Init();
void Process();
void RemoveScriptFromList(CRunningScript**);
void AddScriptToList(CRunningScript**);
static const uint32 nSaveStructSize;
void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
int8 ProcessOneCommand();
void DoDeatharrestCheck();
void UpdateCompareFlag(bool flag)
{
if (m_bNotFlag)
flag = !flag;
if (m_nAndOrState == ANDOR_NONE) {
m_bCondResult = flag;
return;
}
if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8) {
m_bCondResult &= flag;
if (m_nAndOrState == ANDS_1) {
m_nAndOrState = ANDOR_NONE;
return;
}
}
else {
m_bCondResult |= flag;
if (m_nAndOrState <= ORS_1) {
m_nAndOrState = ANDOR_NONE;
return;
}
}
m_nAndOrState--;
}
int16 GetPadState(uint16, uint16);
int8 ProcessCommands0To99(int32);
int8 ProcessCommands100To199(int32);
int8 ProcessCommands200To299(int32);
int8 ProcessCommands300To399(int32);
int8 ProcessCommands400To499(int32);
int8 ProcessCommands500To599(int32);
int8 ProcessCommands600To699(int32);
int8 ProcessCommands700To799(int32);
int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32);
int8 ProcessCommands1100To1199(int32);
int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32);
int8 ProcessCommands1500To1599(int32);
int8 ProcessCommands1600To1699(int32);
uint32 CollectLocateParameters(uint32*, bool);
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
void LocatePlayerCarCommand(int32, uint32*);
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
void LocateCharObjectCommand(int32, uint32*);
void LocateCarCommand(int32, uint32*);
void LocateSniperBulletCommand(int32, uint32*);
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
void LocateObjectCommand(int32, uint32*);
void ObjectInAreaCheckCommand(int32, uint32*);
#ifdef GTA_SCRIPT_COLLECTIVE
void LocateCollectiveCommand(int32, uint32*);
void LocateCollectiveCharCommand(int32, uint32*);
void LocateCollectiveCarCommand(int32, uint32*);
void LocateCollectivePlayerCommand(int32, uint32*);
void CollectiveInAreaCheckCommand(int32, uint32*);
#endif
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami);
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
bool CheckDamagedWeaponType(int32 actual, int32 type);
void ReturnFromGosubOrFunction();
};
#ifdef USE_DEBUG_SCRIPT_LOADER
extern int scriptToLoad;
#endif

View file

@ -2665,7 +2665,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
{
if (pPed->InVehicle())
return IsVehicleStopped(pPed->m_pMyVehicle);
return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) &&
return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
}
@ -2679,7 +2679,7 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
return false;
return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) &&
return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
}

View file

@ -81,7 +81,7 @@ CAnimViewer::Initialise(void) {
CCollision::Init();
CWorld::Initialise();
mod_HandlingManager.Initialise();
CTempColModels::Initialise();
gpTempColModels->Initialise();
CAnimManager::Initialise();
CModelInfo::Initialise();
CParticle::Initialise();

View file

@ -951,7 +951,7 @@ CVector
CCam::DoAverageOnVector(const CVector &vec)
{
int i;
CVector Average = { 0.0f, 0.0f, 0.0f };
CVector Average = CVector(0.0f, 0.0f, 0.0f);
if(ResetStatics){
m_iRunningVectorArrayPos = 0;
@ -4033,7 +4033,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
12.0f, 0.0f, 0.0f, -12.0f,
128, 128, 128, 128, 1000.0f, false, 1.0f);
128, 128, 128, 128, 1000.0f, false, 1.0f, nil, 1.0f);
if(CHud::m_Wants_To_Draw_Hud){
char str[256];

View file

@ -7,9 +7,6 @@
#include "RwHelper.h"
#include "MemoryMgr.h"
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
struct CdReadInfo
{
uint32 nSectorOffset;
@ -60,7 +57,7 @@ CdStreamInitThread(void)
if ( gpReadInfo[i].hSemaphore == nil )
{
CDTRACE("failed to create sync semaphore");
printf("%s: failed to create sync semaphore\n", "cdvd_stream");
ASSERT(0);
return;
}
@ -81,7 +78,7 @@ CdStreamInitThread(void)
if ( gCdStreamSema == nil )
{
CDTRACE("failed to create stream semaphore");
printf("%s: failed to create stream semaphore\n", "cdvd_stream");
ASSERT(0);
return;
}
@ -90,7 +87,7 @@ CdStreamInitThread(void)
if ( _gCdStreamThread == nil )
{
CDTRACE("failed to create streaming thread");
printf("%s: failed to create streaming thread\n", "cdvd_stream");
ASSERT(0);
return;
}
@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
ASSERT( gpReadInfo != nil );
CDDEBUG("read info %p", gpReadInfo);
debug("%s: read info %p\n", "cdvd_stream", gpReadInfo);
CdStreamAddImage("MODELS\\GTA3.IMG");

View file

@ -541,7 +541,7 @@ void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown(int32 button, i
break;
case 12:
#ifndef REGISTER_START_BUTTON
if (padNumber == 1)
if (padnumber == 1)
#endif
pad->PCTempJoyState.Start = 255;
break;
@ -2755,9 +2755,10 @@ wchar *CControllerConfigManager::GetButtonComboText(e_ControllerAction action)
void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type)
{
ResetSettingOrder(action);
int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][type].m_Key = key;
m_aSettings[action][type].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
m_aSettings[action][type].m_ContSetOrder = numOfSettings + 1;
}
int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action)
@ -2767,8 +2768,10 @@ int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerA
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
{
int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][MOUSE].m_Key = button;
m_aSettings[action][MOUSE].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
m_aSettings[action][MOUSE].m_ContSetOrder = numOfSettings + 1;
}
void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)

View file

@ -607,11 +607,14 @@ CFileLoader::LoadObjectTypes(const char *filename)
int section;
int pathIndex;
int id, pathType;
int minID, maxID;
//int minID, maxID;
for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
m_sTempIdeData[i].id = -1;
section = NONE;
minID = INT32_MAX;
maxID = -1;
//minID = INT32_MAX;
//maxID = -1;
pathIndex = -1;
debug("Loading object types from %s...\n", filename);
@ -635,13 +638,13 @@ CFileLoader::LoadObjectTypes(const char *filename)
}else switch(section){
case OBJS:
id = LoadObject(line);
if(id > maxID) maxID = id;
if(id < minID) minID = id;
//if(id > maxID) maxID = id;
//if(id < minID) minID = id;
break;
case TOBJ:
id = LoadTimeObject(line);
if(id > maxID) maxID = id;
if(id < minID) minID = id;
//if(id > maxID) maxID = id;
//if(id < minID) minID = id;
break;
case WEAP:
LoadWeaponObject(line);
@ -678,10 +681,10 @@ CFileLoader::LoadObjectTypes(const char *filename)
}
CFileMgr::CloseFile(fd);
for(id = minID; id <= maxID; id++){
for(id = 0; id < MODELINFOSIZE; id++){
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
if(mi && mi->IsBuilding())
mi->SetupBigBuilding(minID, maxID);
mi->SetupBigBuilding();
}
}
@ -714,6 +717,13 @@ CFileLoader::LoadObject(const char *line)
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return 0; // game returns return value
for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
if(m_sTempIdeData[i].id == -1){
m_sTempIdeData[i].id = id;
strcpy(m_sTempIdeData[i].name, model);
break;
}
switch(numObjs){
case 1:
sscanf(line, "%d %s %s %d %f %d",
@ -762,6 +772,13 @@ CFileLoader::LoadTimeObject(const char *line)
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return 0; // game returns return value
for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
if(m_sTempIdeData[i].id < 0){
m_sTempIdeData[i].id = id;
strcpy(m_sTempIdeData[i].name, model);
break;
}
switch(numObjs){
case 1:
sscanf(line, "%d %s %s %d %f %d %d %d",
@ -792,7 +809,7 @@ CFileLoader::LoadTimeObject(const char *line)
mi->m_firstDamaged = damaged;
mi->SetTimes(timeOn, timeOff);
mi->SetTexDictionary(txd);
other = mi->FindOtherTimeModel();
other = mi->FindOtherTimeModel(model);
if(other)
other->SetOtherTimeModel(id);
MatchModelString(model, id);
@ -816,7 +833,7 @@ CFileLoader::LoadWeaponObject(const char *line)
mi->m_lodDistances[0] = dist;
mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile);
mi->SetColModel(&CTempColModels::ms_colModelWeapon);
mi->SetColModel(&gpTempColModels->ms_colModelWeapon);
MatchModelString(model, id);
return id;
}
@ -832,7 +849,7 @@ CFileLoader::LoadClumpObject(const char *line)
mi = CModelInfo::AddClumpModel(id);
mi->SetModelName(model);
mi->SetTexDictionary(txd);
mi->SetColModel(&CTempColModels::ms_colModelBBox);
mi->SetColModel(&gpTempColModels->ms_colModelBBox);
}
}
@ -939,7 +956,7 @@ CFileLoader::LoadPedObject(const char *line)
mi->SetModelName(model);
mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile);
mi->SetColModel(&CTempColModels::ms_colModelPed1);
mi->SetColModel(&gpTempColModels->ms_colModelPed1);
mi->m_pedType = CPedType::FindPedType(pedType);
mi->m_pedStatType = CPedStats::GetPedStatType(pedStats);
for(animGroupId = 0; animGroupId < NUM_ANIM_ASSOC_GROUPS; animGroupId++)

View file

@ -1000,7 +1000,9 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
}
wchar unicodeTemp[64];
#ifdef ASPECT_RATIO_SCALE
char asciiTemp[32];
#endif
bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL;
uint8 section = 0; // 0: highlight trapezoid 1: texts

View file

@ -316,7 +316,7 @@ bool CGame::InitialiseOnceAfterRW(void)
{
TheText.Load();
CTimer::Initialise();
CTempColModels::Initialise();
gpTempColModels->Initialise();
mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise();
@ -366,6 +366,9 @@ bool CGame::Initialise(const char* datFile)
CPools::Initialise();
if(gMakeResources)
CVehicleModelInfo::Load(nil);
#ifndef GTA_PS2
CIniFile::LoadIniFile();
#endif

View file

@ -133,7 +133,7 @@ public:
static bool faststricmp(const char *str1, const char *str2)
{
for (; *str1; str1++, str2++) {
#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__
#ifndef ASCII_STRCMP
if (toupper(*str1) != toupper(*str2))
#else
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))

14
src/core/Leeds.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "common.h"
#include "Leeds.h"
void LoadResource(RpAtomic *atomic) {}
void LoadResource(RpClump *clump) {}
void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer) {}

36
src/core/Leeds.h Normal file
View file

@ -0,0 +1,36 @@
#pragma once
/*
PatchElementModelInfo(RslElement *,void *)
ChunkName(char const*)
DestroyAndFreeResourceImage(void)
WriteOrder(char const*)
UnpatchTextures(void)
IsChunked(int)
SaveResourceImage(void)
LoadResourceImage(void)
SaveResource(RslNode *,base::cRelocatableChunkWriter &)
SaveResource(RslTAnimTree *,base::cRelocatableChunkWriter &)
SaveResource(RslSkin *,base::cRelocatableChunkWriter &)
SaveResource(CAnimBlendTree *,base::cRelocatableChunkWriter &)
PatchElementTextures(RslElement *)
PatchElementGroupTextures(RslElementGroup *)
*/
void LoadResource(RpAtomic *atomic);
void LoadResource(RpClump *clump);
/*
cRelocatableChunkWriterGTA::Save(char const*,uint,uint,bool)
cRelocatableChunkGTA::cRelocatableChunkGTA(char const*,uint,uint,bool)
SaveAnimBlock(int)
SaveModel(int,bool)
*/
void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer);
void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer);
void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer);
void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer);
void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer);
void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer);
void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer);

View file

@ -4,7 +4,7 @@ class CPlaceable
{
public:
// disable allocation
static void *operator new(size_t) = delete;
static void *operator new(size_t);
CMatrix m_matrix;

View file

@ -1,3 +1,6 @@
#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
#define WITHD3D
#endif
#include "config.h"
#include "common.h"
@ -387,10 +390,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{
CVector2D corners[4] = {
{ 1.0f, -1.0f }, // top right
{ 1.0f, 1.0f }, // bottom right
{ -1.0f, 1.0f }, // bottom left
{ -1.0f, -1.0f }, // top left
CVector2D( 1.0f, -1.0f ), // top right
CVector2D( 1.0f, 1.0f ), // bottom right
CVector2D( -1.0f, 1.0f ), // bottom left
CVector2D( -1.0f, -1.0f ), // top left
};
CVector2D tmp;
int i, j, n;

View file

@ -116,7 +116,7 @@ CRopes::RegisterRope(uintptr id, CVector pos, bool setUpdateTimer)
aRopes[i].m_unk = false;
aRopes[i].m_bWasRegistered = true;
aRopes[i].m_updateTimer = setUpdateTimer ? CTimer::GetTimeInMilliseconds() + 20000 : 0;
for(j = 1; j < ARRAY_SIZE(CRope::m_pos); j++){
for(j = 1; j < ARRAY_SIZE(aRopes[0].m_pos); j++){
if(j & 1)
aRopes[i].m_pos[j] = aRopes[i].m_pos[j-1] + CVector(0.0f, 0.0f, 0.625f);
else
@ -147,7 +147,7 @@ CRopes::FindCoorsAlongRope(uintptr id, float t, CVector *coors)
float f;
for(i = 0; i < ARRAY_SIZE(aRopes); i++)
if(aRopes[i].m_bActive && aRopes[i].m_id == id){
t = (ARRAY_SIZE(CRope::m_pos)-1)*clamp(t, 0.0f, 0.999f);
t = (ARRAY_SIZE(aRopes[0].m_pos)-1)*clamp(t, 0.0f, 0.999f);
j = t;
f = t - j;
*coors = (1.0f-f)*aRopes[i].m_pos[j] + f*aRopes[i].m_pos[j+1];

View file

@ -21,7 +21,7 @@ public:
static int32 NumberKillFrenziesPassed;
static int32 PeopleKilledByOthers;
static int32 HelisDestroyed;
static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES];
static int32 PedsKilledOfThisType[NUM_PEDTYPES];
static int32 TimesDied;
static int32 TimesArrested;
static int32 KillsSinceLastCheckpoint;

View file

@ -7,10 +7,19 @@
#pragma warning(disable: 4838) // narrowing conversion
#pragma warning(disable: 4996) // POSIX names
#ifdef __MWERKS__
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
#endif
#include <stdint.h>
#include <string.h>
#include <math.h>
#ifdef __MWERKS__
#define AUDIO_MSS
#define RWLIBS // codewarrior doesn't support project level defines - so not even this is enough, but still catches most ifdefs
#endif
#if !defined RW_D3D9 && defined LIBRW
#undef WITHD3D
#undef WITHDINPUT
@ -29,9 +38,9 @@
#define WITH_D3D // librw includes d3d9 itself via this right now
#else
#ifndef USE_D3D9
#include <d3d8types.h>
#include <d3d8.h>
#else
#include <d3d9types.h>
#include <d3d9.h>
#endif
#endif
#endif
@ -79,8 +88,13 @@ typedef uint8_t uint8;
typedef int8_t int8;
typedef uint16_t uint16;
typedef int16_t int16;
#ifndef __MWERKS__
typedef uint32_t uint32;
typedef int32_t int32;
#else
typedef unsigned int uint32;
typedef int int32;
#endif
typedef uintptr_t uintptr;
typedef intptr_t intptr;
typedef uint64_t uint64;
@ -92,7 +106,7 @@ typedef uint8 bool8;
typedef uint16 bool16;
typedef uint32 bool32;
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined (__MWERKS__)
typedef ptrdiff_t ssize_t;
#endif
@ -204,11 +218,11 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define PSP_DEFAULT_SCREEN_WIDTH (480)
#define PSP_DEFAULT_SCREEN_HEIGHT (272)
#define PSP_SCALE_TO_PS2_X(a) (a * ((float)DEFAULT_SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH))
#define PSP_SCALE_TO_PS2_Y(a) (a * ((float)DEFAULT_SCREEN_HEIGHT / PSP_DEFAULT_SCREEN_HEIGHT))
#define PSP_SCALE_TO_PS2_X(a) ((float)a * ((float)DEFAULT_SCREEN_WIDTH / (float)PSP_DEFAULT_SCREEN_WIDTH))
#define PSP_SCALE_TO_PS2_Y(a) ((float)a * ((float)DEFAULT_SCREEN_HEIGHT / (float)PSP_DEFAULT_SCREEN_HEIGHT))
#define PSP_SCREEN_SCALE_X(a) SCREEN_STRETCH_X(PSP_SCALE_TO_PS2_X(a))
#define PSP_SCREEN_SCALE_Y(a) SCREEN_STRETCH_Y(PSP_SCALE_TO_PS2_Y(a))
#define PSP_SCREEN_SCALE_X(a) ((a) * (float) SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH)
#define PSP_SCREEN_SCALE_Y(a) ((a) * (float) SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH)
#define PSP_SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - PSP_SCREEN_SCALE_X(a))
#define PSP_SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - PSP_SCREEN_SCALE_Y(a))
@ -290,6 +304,22 @@ extern wchar *AllocUnicode(const char*src);
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))
#ifdef __MWERKS__
#define M_E 2.71828182845904523536 // e
#define M_LOG2E 1.44269504088896340736 // log2(e)
#define M_LOG10E 0.434294481903251827651 // log10(e)
#define M_LN2 0.693147180559945309417 // ln(2)
#define M_LN10 2.30258509299404568402 // ln(10)
#define M_PI 3.14159265358979323846 // pi
#define M_PI_2 1.57079632679489661923 // pi/2
#define M_PI_4 0.785398163397448309616 // pi/4
#define M_1_PI 0.318309886183790671538 // 1/pi
#define M_2_PI 0.636619772367581343076 // 2/pi
#define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
#define M_SQRT2 1.41421356237309504880 // sqrt(2)
#define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
#endif
#define PI (float)M_PI
#define TWOPI (PI*2)
#define HALFPI (PI/2)
@ -319,14 +349,34 @@ void re3_usererror(const char *format, ...);
#define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
#endif
#ifdef __MWERKS__
void debug(char *f, ...);
void Error(char *f, ...);
__inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function needs to be inline - this way no call actually gets placed
// USERERROR only gets used in oal builds ... once
#else
#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__)
#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
#define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__)
#ifndef MASTER
#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
#define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__)
#else
#define TRACE(f, ...)
#define USERERROR(f, ...)
#endif
#endif
#ifndef MASTER
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
#else
#define assert(_Expression)
#endif
#define ASSERT assert
#ifdef __MWERKS__
#define static_assert(bool_constexpr, message)
#endif
#define _TODO(x)
#define _TODOCONST(x) (x)
@ -350,6 +400,7 @@ void re3_usererror(const char *format, ...);
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#ifdef DEBUGMENU
// Tweaking stuff for debugmenu
#define TWEAKPATH ___tw___TWEAKPATH
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
@ -463,6 +514,7 @@ _TWEEKCLASS(CTweakUInt32, uint32);
_TWEEKCLASS(CTweakFloat, float);
#undef _TWEEKCLASS
#endif
#ifdef VALIDATE_SAVE_SIZE
extern int32 _saveBufCount;

View file

@ -1,5 +1,8 @@
#pragma once
// disables (most) stuff that wasn't in original gta-vc.exe - check section at the bottom of this file
//#define VANILLA_DEFINES
enum Config {
NUMPLAYERS = 1,
@ -404,3 +407,87 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING
#endif
#if defined __MWERKS__ || defined VANILLA_DEFINES
#define FINAL
#undef CHATTYSPLASH
#undef TIMEBARS
#define MASTER
#undef VALIDATE_SAVE_SIZE
#undef NO_MOVIES
#undef DEBUGMENU
#undef DRAW_GAME_VERSION_TEXT
//#undef NASTY_GAME
//#undef NO_CDCHECK
#undef GTA_PS2_STUFF
#undef USE_PS2_RAND
#undef RANDOMSPLASH
#undef PS2_MATFX
#undef FIX_BUGS
#define THIS_IS_STUPID
#undef MORE_LANGUAGES
#undef COMPATIBLE_SAVES
#undef LOAD_INI_SETTINGS
#undef FIX_HIGH_FPS_BUGS_ON_FRONTEND
#undef ASPECT_RATIO_SCALE
#undef PROPER_SCALING
//#undef DEFAULT_NATIVE_RESOLUTION
#undef PS2_ALPHA_TEST
#undef IMPROVED_VIDEOMODE
#undef DISABLE_LOADING_SCREEN
#undef DISABLE_VSYNC_ON_TEXTURE_CONVERSION
#undef FIX_SPRITES
#define PC_WATER
#undef WATER_CHEATS
#undef USE_CUTSCENE_SHADOW_FOR_PED
#undef DISABLE_CUTSCENE_SHADOWS
#undef XINPUT
#undef DETECT_PAD_INPUT_SWITCH
#undef KANGAROO_CHEAT
#undef RESTORE_ALLCARSHELI_CHEAT
#undef BETTER_ALLCARSAREDODO_CHEAT
#undef WALLCLIMB_CHEAT
#undef REGISTER_START_BUTTON
#undef BIND_VEHICLE_FIREWEAPON
#undef BUTTON_ICONS
#undef FIX_RADAR
#undef MAP_ENHANCEMENTS
#undef MUCH_SHORTER_OUTRO_SCREEN
#undef CUSTOM_FRONTEND_OPTIONS
#undef GRAPHICS_MENU_OPTIONS
#undef NO_ISLAND_LOADING
#undef CUTSCENE_BORDERS_SWITCH
#undef MULTISAMPLING
#undef INVERT_LOOK_FOR_PAD
#undef USE_DEBUG_SCRIPT_LOADER
#undef USE_MEASUREMENTS_IN_METERS
#undef USE_PRECISE_MEASUREMENT_CONVERTION
#undef SUPPORT_JAPANESE_SCRIPT
#undef MISSION_REPLAY
#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT
#define DONT_FIX_REPLAY_BUGS
#undef EXPLODING_AIRTRAIN
#undef CPLANE_ROTORS
#undef CAMERA_PICKUP
#undef CANCELLABLE_CAR_ENTER
#undef IMPROVED_CAMERA
#undef FREE_CAM
#undef BIG_IMG
#endif

View file

@ -85,6 +85,9 @@ wchar gUString2[256];
// leeds
bool gMakeResources = true;
bool gUseChunkFiles = false;
bool gSecondExportPass;
bool gUseModelResources;
bool gUseResources;
float FramesPerSecond = 30.0f;
@ -141,6 +144,24 @@ bool gbNewRenderer = true;
bool bDisplayNumOfAtomicsRendered = false;
bool bDisplayPosn = false;
#ifdef __MWERKS__
void
debug(char *fmt, ...)
{
#ifndef MASTER
// TODO put something here
#endif
}
void
Error(char *fmt, ...)
{
#ifndef MASTER
// TODO put something here
#endif
}
#endif
void
ValidateVersion()
{
@ -810,6 +831,7 @@ ProcessSlowMode(void)
float FramesPerSecondCounter;
int32 FrameSamples;
#ifndef MASTER
struct tZonePrint
{
char name[11];
@ -840,8 +862,6 @@ tZonePrint ZonePrint[] =
{ "WASHINBTM", "AC", CRect(-255.0f, -1200.0f, 500.0f, -1690.0f)}
};
#ifndef MASTER
void
PrintMemoryUsage(void)
{

View file

@ -27,6 +27,9 @@ extern bool gbPrintMemoryUsage;
// leeds
extern bool gMakeResources;
extern bool gUseChunkFiles;
extern bool gSecondExportPass;
extern bool gUseModelResources;
extern bool gUseResources;
class CSprite2d;

View file

@ -95,14 +95,14 @@ CustomFrontendOptionsPopulate(void)
if (fd) {
#ifdef GRAPHICS_MENU_OPTIONS
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "Graphics", "WorldPipeline");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
#else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "Graphics", "WorldPipeline");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
#endif
@ -1025,9 +1025,13 @@ extern bool gbRenderDebugEnvMap;
}
#endif
#ifndef __MWERKS__
#ifndef MASTER
const int re3_buffsize = 1024;
static char re3_buff[re3_buffsize];
#endif
#ifndef MASTER
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
{
#ifdef _WIN32
@ -1081,9 +1085,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
assert(false);
#endif
}
#endif
void re3_debug(const char *format, ...)
{
#ifndef MASTER
va_list va;
va_start(va, format);
#ifdef _WIN32
@ -1095,8 +1101,10 @@ void re3_debug(const char *format, ...)
printf("%s", re3_buff);
CDebug::DebugAddText(re3_buff);
#endif
}
#ifndef MASTER
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
{
char buff[re3_buffsize *2];
@ -1136,6 +1144,8 @@ void re3_usererror(const char *format, ...)
assert(false);
#endif
}
#endif
#endif
#ifdef VALIDATE_SAVE_SIZE
int32 _saveBufCount;

View file

@ -1288,7 +1288,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
int numCollisions;
int mostColliding;
CColPoint colpoints[MAX_COLLISION_POINTS];
CVector shift = { 0.0f, 0.0f, 0.0f };
CVector shift = CVector(0.0f, 0.0f, 0.0f);
bool doShift = false;
CEntity *boat = nil;
@ -1747,8 +1747,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(numCollisions <= 0)
continue;
CVector moveSpeed = { 0.0f, 0.0f, 0.0f };
CVector turnSpeed = { 0.0f, 0.0f, 0.0f };
CVector moveSpeed = CVector(0.0f, 0.0f, 0.0f);
CVector turnSpeed = CVector(0.0f, 0.0f, 0.0f);
float maxImpulseA = 0.0f;
numResponses = 0;
if(A->bHasContacted){
@ -2232,8 +2232,8 @@ CPhysical::ProcessCollision(void)
}else if(IsObject() && ((CObject*)this)->ObjectCreatedBy != TEMP_OBJECT){
int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases;
if(responsecase == COLLRESPONSE_LAMPOST){
CVector speedUp = { 0.0f, 0.0f, 0.0f };
CVector speedDown = { 0.0f, 0.0f, 0.0f };
CVector speedUp = CVector(0.0f, 0.0f, 0.0f);
CVector speedDown = CVector(0.0f, 0.0f, 0.0f);
CColModel *colModel = GetColModel();
speedUp.z = colModel->boundingBox.max.z;
speedDown.z = colModel->boundingBox.min.z;

View file

@ -370,7 +370,7 @@ AttachVehiclePipe(rw::Clump *clump)
* Neo World pipe
*/
int32 WorldPipeSwitch = 0;
int32 WorldPipeSwitch = WORLDPIPE_PS2;
bool LightmapEnable;
float LightmapMult = 1.0f;
InterpolatedFloat WorldLightmapBlend(1.0f);

View file

@ -22,7 +22,8 @@
#error "Need librw for EXTENDED_PIPELINES"
#endif
extern RwTexture *gpWhiteTexture; // from vehicle model info
//extern RwTexture *gpWhiteTexture; // from vehicle model info
static RwTexture *gpWhiteTexture; // nil works as white in librw currently
namespace CustomPipes {

View file

@ -13,6 +13,7 @@
//struct RpMaterial;
typedef rw::Material RpMaterial;
typedef rw::MaterialList RpMaterialList;
typedef RpMaterial *(*RpMaterialCallBack)(RpMaterial *material, void *data);

View file

@ -19,6 +19,8 @@ namespace base
void* Shrink(void* data);
};
#define VTABLE_ADDR(obj) ((void*)obj) // TODO: make this portable
class cRelocatableChunkClassInfo
{
public:

View file

@ -7,6 +7,9 @@
#include "BaseModelInfo.h"
#include "ModelInfo.h"
#include "KeyGen.h"
#include "Streaming.h"
#include "smallHeap.h"
#include "TempColModels.h"
CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
{
@ -18,7 +21,11 @@ CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
m_type = type;
m_num2dEffects = 0;
m_bOwnsColModel = false;
m_nameKey = 0;
m_unk1 = 0;
m_unk2 = 0;
m_name = new char[MAX_MODEL_NAME];
*(int32*)m_name = 0;
}
void
@ -26,6 +33,7 @@ CBaseModelInfo::Shutdown(void)
{
DeleteCollisionModel();
DeleteRwObject();
DeleteChunk();
m_2dEffectsID = -1;
m_num2dEffects = 0;
m_txdSlot = -1;
@ -34,11 +42,11 @@ CBaseModelInfo::Shutdown(void)
void
CBaseModelInfo::DeleteCollisionModel(void)
{
if(m_colModel && m_bOwnsColModel){
if(!gUseChunkFiles && m_colModel && m_bOwnsColModel){
if(m_colModel)
delete m_colModel;
m_colModel = nil;
}
m_colModel = nil;
}
void
@ -51,15 +59,17 @@ CBaseModelInfo::AddRef(void)
void
CBaseModelInfo::RemoveRef(void)
{
if(m_refCount > 0){
m_refCount--;
RemoveTexDictionaryRef();
}
}
void
CBaseModelInfo::SetTexDictionary(const char *name)
{
int slot = CTxdStore::FindTxdSlot(name);
if(slot < 0)
if(slot == -1)
slot = CTxdStore::AddTxdSlot(name);
m_txdSlot = slot;
}
@ -70,12 +80,24 @@ CBaseModelInfo::AddTexDictionaryRef(void)
CTxdStore::AddRef(m_txdSlot);
}
void
CBaseModelInfo::AddTexDictionaryRefGu(void)
{
CTxdStore::AddRefGu(m_txdSlot);
}
void
CBaseModelInfo::RemoveTexDictionaryRef(void)
{
CTxdStore::RemoveRef(m_txdSlot);
}
void
CBaseModelInfo::RemoveTexDictionaryRefGu(void)
{
CTxdStore::RemoveRefGu(m_txdSlot);
}
void
CBaseModelInfo::Init2dEffects(void)
{
@ -111,3 +133,51 @@ CBaseModelInfo::SetModelName(const char *name)
if (!gUseChunkFiles)
strcpy(m_name, name);
}
void
CBaseModelInfo::DeleteChunk(void)
{
// BUG? what if we're not using chunks?
if(m_chunk){
CStreaming::UnregisterPointer(&m_chunk, 2);
cSmallHeap::msInstance.Free(m_chunk);
m_chunk = nil;
}
}
inline int
GetColmodelID(CColModel *model)
{
int colModelid = 0;
if(model == &gpTempColModels->ms_colModelBBox) colModelid = 1;
if(model == &gpTempColModels->ms_colModelPed1) colModelid = 2;
if(model == &gpTempColModels->ms_colModelWeapon) colModelid = 3;
if(model == &CTempColModels::ms_colModelPed2) colModelid = 4;
if(model == &CTempColModels::ms_colModelPedGroundHit) colModelid = 5;
if(model == &CTempColModels::ms_colModelDoor1) colModelid = 6;
if(model == &CTempColModels::ms_colModelBumper1) colModelid = 7;
if(model == &CTempColModels::ms_colModelPanel1) colModelid = 8;
if(model == &CTempColModels::ms_colModelBonnet1) colModelid = 9;
if(model == &CTempColModels::ms_colModelBoot1) colModelid = 10;
if(model == &CTempColModels::ms_colModelWheel1) colModelid = 11;
if(model == &CTempColModels::ms_colModelBodyPart1) colModelid = 12;
if(model == &CTempColModels::ms_colModelBodyPart2) colModelid = 13;
if(model == &CTempColModels::ms_colModelCutObj[0]) colModelid = 14;
if(model == &CTempColModels::ms_colModelCutObj[1]) colModelid = 15;
if(model == &CTempColModels::ms_colModelCutObj[2]) colModelid = 16;
if(model == &CTempColModels::ms_colModelCutObj[3]) colModelid = 17;
if(model == &CTempColModels::ms_colModelCutObj[4]) colModelid = 18;
return colModelid;
}
void
CBaseModelInfo::Write(base::cRelocatableChunkWriter &writer)
{
m_chunk = nil;
RcWriteThis(writer);
if(m_colModel){
if(m_bOwnsColModel || GetColmodelID(m_colModel) != 0)
m_colModel->Write(writer, true);
writer.AddPatch(&m_colModel);
}
}

View file

@ -2,7 +2,7 @@
struct CColModel;
#define MAX_MODEL_NAME (21)
#define MAX_MODEL_NAME (24)
enum ModelInfoType
{
@ -23,9 +23,13 @@ class C2dEffect;
class CBaseModelInfo
{
protected:
char *m_name;
uint32 m_unk1;
uint32 m_unk2;
uint32 m_nameKey;
RwObject *m_object;
union {
char *m_name; // if not using chunks
void *m_chunk; // else
};
uint8 m_type;
uint8 m_num2dEffects;
bool m_bOwnsColModel;
@ -53,6 +57,16 @@ public:
virtual void ConvertAnimFileIndex(void) {}
virtual int GetAnimFileIndex(void) { return -1; }
virtual void LoadModel(void *model, const void *chunk) = 0;
virtual void DeleteChunk(void);
// this writes the modelinfo struct, possibly including actual RW models
virtual void Write(base::cRelocatableChunkWriter &writer);
// this writes the RW models
virtual void *WriteModel(base::cRelocatableChunkWriter &writer) { return nil; } // = 0; // this is not in the vtable for some reason???
// these allocate the space for a modelinfo struct and patch the vtable pointer
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer) = 0;
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer) = 0;
// one day it becomes virtual
uint8 GetModelType() const { return m_type; }
bool IsBuilding(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
@ -74,7 +88,9 @@ public:
void RemoveRef(void);
void SetTexDictionary(const char *name);
void AddTexDictionaryRef(void);
void AddTexDictionaryRefGu(void);
void RemoveTexDictionaryRef(void);
void RemoveTexDictionaryRefGu(void);
void Init2dEffects(void);
void Add2dEffect(C2dEffect *fx);
C2dEffect *Get2dEffect(int n);

View file

@ -1,17 +1,30 @@
#include "common.h"
#include "main.h"
#include "RwHelper.h"
#include "General.h"
#include "NodeName.h"
#include "VisibilityPlugins.h"
#include "ModelInfo.h"
#include "AnimManager.h"
#include "Streaming.h"
#include "Leeds.h"
base::cRelocatableChunkClassInfo CClumpModelInfo::msClassInfo("CElementGroupModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance)); // the real name
CClumpModelInfo CClumpModelInfo::msClassInstance;
void
CClumpModelInfo::DeleteRwObject(void)
{
if(m_clump){
if(!gUseChunkFiles)
RpClumpDestroy(m_clump);
else{
CStreaming::UnregisterClump(m_clump);
CStreaming::UnregisterPointer(&m_clump, 2);
DeleteChunk();
}
m_clump = nil;
RemoveTexDictionaryRef();
if(GetAnimFileIndex() != -1)
@ -52,6 +65,7 @@ CClumpModelInfo::CreateInstance(RwMatrix *m)
if(m_clump){
RpClump *clump = (RpClump*)CreateInstance();
*RwFrameGetMatrix(RpClumpGetFrame(clump)) = *m;
CStreaming::RegisterInstance(clump);
return (RwObject*)clump;
}
return nil;
@ -73,14 +87,15 @@ CClumpModelInfo::SetClump(RpClump *clump)
if(GetAnimFileIndex() != -1)
CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
if(IsClumpSkinned(clump)){
int i;
//int i;
RpHAnimHierarchy *hier;
RpAtomic *skinAtomic;
RpSkin *skin;
//RpAtomic *skinAtomic;
//RpSkin *skin;
hier = GetAnimHierarchyFromClump(clump);
assert(hier);
RpClumpForAllAtomics(clump, SetHierarchyForSkinAtomic, hier);
/*
skinAtomic = GetFirstAtomic(clump);
assert(skinAtomic);
@ -94,6 +109,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
weights->w2 /= sum;
weights->w3 /= sum;
}
*/
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
}
}
@ -203,3 +219,47 @@ CClumpModelInfo::GetFrameFromId(RpClump *clump, int32 id)
RwFrameForAllChildren(RpClumpGetFrame(clump), FindFrameFromIdCB, &assoc);
return assoc.frame;
}
void
CClumpModelInfo::LoadModel(void *clump, const void *chunk)
{
m_chunk = (void*)chunk;
m_clump = (RpClump*)clump;
LoadResource(m_clump);
CStreaming::RegisterPointer(&m_chunk, 2, true);
CStreaming::RegisterClump(m_clump);
CStreaming::RegisterPointer(&m_clump, 2, true);
}
void
CClumpModelInfo::Write(base::cRelocatableChunkWriter &writer)
{
CBaseModelInfo::Write(writer);
if(m_clump){
writer.AddPatch(&m_clump);
SaveResource(m_clump, writer);
}
}
void*
CClumpModelInfo::WriteModel(base::cRelocatableChunkWriter &writer)
{
if(m_clump)
SaveResource(m_clump, writer);
return m_clump;
}
void
CClumpModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}
void
CClumpModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}

View file

@ -35,6 +35,9 @@ public:
char *m_animFileName;
};
static base::cRelocatableChunkClassInfo msClassInfo;
static CClumpModelInfo msClassInstance;
CClumpModelInfo(void) : CBaseModelInfo(MITYPE_CLUMP) { m_animFileIndex = -1; }
CClumpModelInfo(ModelInfoType id) : CBaseModelInfo(id) { m_animFileIndex = -1; }
~CClumpModelInfo() {}
@ -48,6 +51,12 @@ public:
virtual void ConvertAnimFileIndex(void);
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
virtual void LoadModel(void *model, const void *chunk);
virtual void Write(base::cRelocatableChunkWriter &writer);
virtual void *WriteModel(base::cRelocatableChunkWriter &writer);
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
void SetFrameIds(RwObjectNameIdAssocation *assocs);
static RwFrame *FindFrameFromNameCB(RwFrame *frame, void *data);

View file

@ -1,5 +1,6 @@
#include "common.h"
#include "main.h"
#include "RwHelper.h"
#include "General.h"
#include "Bones.h"
@ -9,12 +10,19 @@
#include "VisibilityPlugins.h"
#include "ModelInfo.h"
#include "custompipes.h"
#include "Streaming.h"
#include "Leeds.h"
#include "TempColModels.h"
base::cRelocatableChunkClassInfo CPedModelInfo::msClassInfo("CPedModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CPedModelInfo CPedModelInfo::msClassInstance;
void
CPedModelInfo::DeleteRwObject(void)
{
CStreaming::UnregisterPointer(&m_hitColModel, 2);
CClumpModelInfo::DeleteRwObject();
if(m_hitColModel)
if(!gUseChunkFiles && m_hitColModel)
delete m_hitColModel;
m_hitColModel = nil;
}
@ -41,13 +49,15 @@ CPedModelInfo::SetClump(RpClump *clump)
#ifdef EXTENDED_PIPELINES
CustomPipes::AttachRimPipe(clump);
#endif
if(!IsClumpSkinned(clump))
return;
CClumpModelInfo::SetClump(clump);
SetFrameIds(m_pPedIds); // not needed in VC actually
if(m_hitColModel == nil)
CreateHitColModelSkinned(clump);
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPedCB);
if(strcmp(GetModelName(), "player") == 0)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
//if(strcmp(GetModelName(), "player") == 0)
// RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
}
struct ColNodeInfo
@ -73,40 +83,27 @@ ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = {
{ nil, PED_FOOTR, PEDPIECE_RIGHTLEG, 0.0f, 0.15f, 0.15f },
};
void
bool
CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
{
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump);
CColModel *colmodel = new CColModel;
CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere));
RwFrame *root = RpClumpGetFrame(m_clump);
RwMatrix *invmat = RwMatrixCreate();
RwMatrix *mat = RwMatrixCreate();
RwMatrixInvert(invmat, RwFrameGetMatrix(RpClumpGetFrame(clump)));
for(int i = 0; i < NUMPEDINFONODES; i++){
*mat = *invmat;
int id = ConvertPedNode2BoneTag(m_pColNodeInfos[i].pedNode); // this is wrong, wtf R* ???
int idx = RpHAnimIDGetIndex(hier, id);
// This doesn't really work as the positions are not initialized yet
RwMatrixTransform(mat, &RpHAnimHierarchyGetMatrixArray(hier)[idx], rwCOMBINEPRECONCAT);
RwV3d pos = { 0.0f, 0.0f, 0.0f };
RwV3dTransformPoints(&pos, &pos, 1, mat);
spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
spheres[i].center.x = 0.0f;
spheres[i].center.y = 0.0f;
spheres[i].center.z = 0.0f;
spheres[i].radius = m_pColNodeInfos[i].radius;
spheres[i].surface = SURFACE_PED;
spheres[i].piece = m_pColNodeInfos[i].pieceType;
}
RwMatrixDestroy(invmat);
RwMatrixDestroy(mat);
colmodel->spheres = spheres;
colmodel->numSpheres = NUMPEDINFONODES;
colmodel->boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
colmodel->boundingBox.Set(CVector(-0.5f, -0.5f, -1.2f), CVector(0.5f, 0.5f, 1.2f));
colmodel->level = LEVEL_GENERIC;
m_hitColModel = colmodel;
return true;
}
CColModel*
@ -114,28 +111,27 @@ CPedModelInfo::AnimatePedColModelSkinned(RpClump *clump)
{
if(m_hitColModel == nil){
CreateHitColModelSkinned(clump);
#ifndef FIX_BUGS
return m_hitColModel;
#endif
// we should really animate this now
}
RwMatrix *invmat, *mat;
RwMatrix invmat, mat;
CColSphere *spheres = m_hitColModel->spheres;
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump);
invmat = RwMatrixCreate();
mat = RwMatrixCreate();
RwMatrixInvert(invmat, RwFrameGetMatrix(RpClumpGetFrame(clump)));
RwMatrixInvert(&invmat, RwFrameGetMatrix(RpClumpGetFrame(clump)));
for(int i = 0; i < NUMPEDINFONODES; i++){
*mat = *invmat;
mat = invmat;
int id = ConvertPedNode2BoneTag(m_pColNodeInfos[i].pedNode);
int idx = RpHAnimIDGetIndex(hier, id);
RwMatrixTransform(mat, &RpHAnimHierarchyGetMatrixArray(hier)[idx], rwCOMBINEPRECONCAT);
RwV3d pos = { 0.0f, 0.0f, 0.0f };
RwV3dTransformPoints(&pos, &pos, 1, mat);
RwMatrixTransform(&mat, &RpHAnimHierarchyGetMatrixArray(hier)[idx], rwCOMBINEPRECONCAT);
RwV3d pos = { 0.0f, 0.0f, 0.0f }; // actually CVector
RwV3dTransformPoints(&pos, &pos, 1, &mat);
spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
}
RwMatrixDestroy(invmat);
RwMatrixDestroy(mat);
return m_hitColModel;
}
@ -153,10 +149,71 @@ CPedModelInfo::AnimatePedColModelSkinnedWorld(RpClump *clump)
int idx = RpHAnimIDGetIndex(hier, id);
mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
RwV3d pos = { 0.0f, 0.0f, 0.0f };
RwV3d pos = { 0.0f, 0.0f, 0.0f }; // actually CVector
RwV3dTransformPoints(&pos, &pos, 1, mat);
spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
}
return m_hitColModel;
}
struct PedChunk
{
CColModel *colmodel;
RpClump *clump;
};
void
CPedModelInfo::LoadModel(void *data, const void *chunk)
{
PedChunk *chk = (PedChunk*)data;
m_hitColModel = chk->colmodel;
CStreaming::RegisterPointer(&m_hitColModel, 2, true);
CClumpModelInfo::LoadModel(chk->clump, chunk);
}
void
CPedModelInfo::Write(base::cRelocatableChunkWriter &writer)
{
SetColModel(&gpTempColModels->ms_colModelPed1);
CClumpModelInfo::Write(writer);
if(m_hitColModel){
writer.AddPatch(&m_hitColModel);
m_hitColModel->Write(writer, true);
}
}
void*
CPedModelInfo::WriteModel(base::cRelocatableChunkWriter &writer)
{
PedChunk *chunk = new PedChunk; // LEAK
chunk->colmodel = nil;
chunk->clump = nil;
writer.AllocateRaw(chunk, sizeof(*chunk), sizeof(void*), false, true);
chunk->clump = (RpClump*)CClumpModelInfo::WriteModel(writer);
if(chunk->clump)
writer.AddPatch(&chunk->clump);
chunk->colmodel = m_hitColModel;
if(chunk->colmodel){
writer.AddPatch(&chunk->colmodel);
chunk->colmodel->Write(writer, true);
}
return nil;
}
void
CPedModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}
void
CPedModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}

View file

@ -38,6 +38,8 @@ public:
CColModel *m_hitColModel;
int8 radio1, radio2;
static base::cRelocatableChunkClassInfo msClassInfo;
static CPedModelInfo msClassInstance;
static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX];
CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; }
@ -45,7 +47,13 @@ public:
void DeleteRwObject(void);
void SetClump(RpClump *);
void CreateHitColModelSkinned(RpClump *clump);
virtual void LoadModel(void *model, const void *chunk);
virtual void Write(base::cRelocatableChunkWriter &writer);
virtual void *WriteModel(base::cRelocatableChunkWriter &writer);
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
bool CreateHitColModelSkinned(RpClump *clump);
CColModel *GetHitColModel(void) { return m_hitColModel; }
CColModel *AnimatePedColModelSkinned(RpClump *clump);
CColModel *AnimatePedColModelSkinnedWorld(RpClump *clump);

View file

@ -1,18 +1,30 @@
#include "common.h"
#include "main.h"
#include "General.h"
#include "Renderer.h"
#include "Camera.h"
#include "Renderer.h"
#include "ModelInfo.h"
#include "AnimManager.h"
#include "custompipes.h"
#include "Streaming.h"
#include "smallHeap.h"
#include "Leeds.h"
#define LOD_DISTANCE (300.0f)
TempIdeData m_sTempIdeData[800];
base::cRelocatableChunkClassInfo CSimpleModelInfo::msClassInfo("CSimpleModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CSimpleModelInfo CSimpleModelInfo::msClassInstance;
void
CSimpleModelInfo::DeleteRwObject(void)
{
int i;
RwFrame *f;
if(m_atomics == nil)
return;
if(!gUseChunkFiles){
for(i = 0; i < m_numAtomics; i++)
if(m_atomics[i]){
f = RpAtomicGetFrame(m_atomics[i]);
@ -23,16 +35,27 @@ CSimpleModelInfo::DeleteRwObject(void)
if(GetAnimFileIndex() != -1)
CAnimManager::RemoveAnimBlockRef(GetAnimFileIndex());
}
}else if(m_chunk){
CStreaming::UnregisterPointer(&m_atomics, 2);
for(i = 0; i < m_numAtomics; i++)
CStreaming::UnregisterAtomic(m_atomics[i], nil);
DeleteChunk();
RemoveTexDictionaryRef();
if(GetAnimFileIndex() != -1)
CAnimManager::RemoveAnimBlockRef(GetAnimFileIndex());
}
m_atomics = nil;
}
RwObject*
CSimpleModelInfo::CreateInstance(void)
{
RpAtomic *atomic;
if(m_atomics[0] == nil)
if(m_atomics == nil || m_atomics[0] == nil)
return nil;
atomic = RpAtomicClone(m_atomics[0]);
RpAtomicSetFrame(atomic, RwFrameCreate());
CStreaming::RegisterInstance(atomic, nil);
return (RwObject*)atomic;
}
@ -42,21 +65,20 @@ CSimpleModelInfo::CreateInstance(RwMatrix *matrix)
RpAtomic *atomic;
RwFrame *frame;
if(m_atomics[0] == nil)
if(m_atomics == nil || m_atomics[0] == nil)
return nil;
atomic = RpAtomicClone(m_atomics[0]);
frame = RwFrameCreate();
*RwFrameGetMatrix(frame) = *matrix;
RpAtomicSetFrame(atomic, frame);
CStreaming::RegisterInstance(atomic, nil);
return (RwObject*)atomic;
}
void
CSimpleModelInfo::Init(void)
{
m_atomics[0] = nil;
m_atomics[1] = nil;
m_atomics[2] = nil;
m_atomics = new RpAtomic*[3];
m_numAtomics = 0;
m_firstDamaged = 0;
m_wetRoadReflection = 0;
@ -72,21 +94,30 @@ CSimpleModelInfo::Init(void)
m_ignoreDrawDist = 0;
m_isCodeGlass = 0;
m_isArtistGlass = 0;
m_relatedModel = nil;
}
void
CSimpleModelInfo::SetAtomic(int n, RpAtomic *atomic)
{
AddTexDictionaryRef();
if(m_atomics == nil){
m_atomics = new RpAtomic*[3];
m_atomics[0] = nil;
m_atomics[1] = nil;
m_atomics[2] = nil;
}
m_atomics[n] = atomic;
AddTexDictionaryRef();
if(GetAnimFileIndex() != -1)
CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
RpGeometry *geo = RpAtomicGetGeometry(atomic);
if(m_ignoreLight)
RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) & ~rpGEOMETRYLIGHT);
/*
if(RpGeometryGetFlags(geo) & rpGEOMETRYNORMALS &&
RpGeometryGetNumTriangles(geo) > 200)
debug("%s has %d polys\n", m_name, RpGeometryGetNumTriangles(geo));
*/
#ifdef EXTENDED_PIPELINES
if(m_wetRoadReflection)
@ -136,11 +167,47 @@ CSimpleModelInfo::GetLargestLodDistance(void)
return d * TheCamera.LODDistMultiplier;
}
RpAtomic*
CSimpleModelInfo::GetLodAtomic(int n)
{
if(m_atomics == nil || n >= m_numAtomics)
return nil;
return m_atomics[n];
}
RpAtomic*
CSimpleModelInfo::GetLastAtomic(void)
{
if(m_atomics == nil)
return nil;
if(m_firstDamaged == 0 || m_isDamaged)
return m_atomics[m_numAtomics-1];
else
return m_atomics[m_firstDamaged-1];
}
RpAtomic*
CSimpleModelInfo::GetLastAtomic(float dist)
{
int n;
if(m_atomics == nil)
return nil;
if(m_firstDamaged == 0 || m_isDamaged)
n = m_numAtomics-1;
else
n = m_firstDamaged-1;
if(dist < m_lodDistances[n] * TheCamera.LODDistMultiplier)
return m_atomics[n];
return nil;
}
RpAtomic*
CSimpleModelInfo::GetAtomicFromDistance(float dist)
{
int i;
i = 0;
// HACk until we figure out what's going on
if(m_atomics == nil) return nil;
if(m_isDamaged)
i = m_firstDamaged;
for(; i < m_numAtomics; i++)
@ -152,20 +219,40 @@ CSimpleModelInfo::GetAtomicFromDistance(float dist)
RpAtomic*
CSimpleModelInfo::GetFirstAtomicFromDistance(float dist)
{
// HACk until we figure out what's going on
if(m_atomics == nil) return nil;
if(dist < m_lodDistances[0] * TheCamera.LODDistMultiplier)
return m_atomics[0];
return nil;
}
void
CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID)
CSimpleModelInfo::FindRelatedModel(void)
{
int i;
CBaseModelInfo *mi;
for(i = minID; i <= maxID; i++){
mi = CModelInfo::GetModelInfo(i);
int thisIndex, otherIndex;
// find our own index in temp data
for(thisIndex = 0; thisIndex < ARRAY_SIZE(m_sTempIdeData); thisIndex++){
if(m_sTempIdeData[thisIndex].id == -1)
break;
if(this == CModelInfo::GetModelInfo(m_sTempIdeData[thisIndex].id))
goto found;
}
thisIndex = -1;
found:
#ifdef FIX_BUGS
if(thisIndex == -1)
return;
#endif
for(otherIndex = 0; otherIndex < ARRAY_SIZE(m_sTempIdeData); otherIndex++){
if(m_sTempIdeData[otherIndex].id == -1)
break;
mi = CModelInfo::GetModelInfo(m_sTempIdeData[otherIndex].id);
if(mi && mi != this &&
!CGeneral::faststrcmp(GetModelName()+3, mi->GetModelName()+3)){
!CGeneral::faststrcmp(m_sTempIdeData[thisIndex].name+3, m_sTempIdeData[otherIndex].name+3)){
assert(mi->IsSimple());
this->SetRelatedModel((CSimpleModelInfo*)mi);
return;
@ -176,12 +263,14 @@ CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID)
#define NEAR_DRAW_DIST 100.0f // 0.0f in vice city
void
CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID)
CSimpleModelInfo::SetupBigBuilding(void)
{
CSimpleModelInfo *related;
if(m_lodDistances[0] > LOD_DISTANCE && GetRelatedModel() == nil){
if(m_lodDistances[0] < 0.0f)
m_lodDistances[0] = -m_lodDistances[0]; // what?
else if(m_lodDistances[0] > LOD_DISTANCE && GetRelatedModel() == nil){
m_isBigBuilding = 1;
FindRelatedModel(minID, maxID);
FindRelatedModel();
related = GetRelatedModel();
if(related){
m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier;
@ -193,3 +282,79 @@ CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID)
m_lodDistances[2] = NEAR_DRAW_DIST;
}
}
void
CSimpleModelInfo::LoadModel(void *atomics, const void *chunk)
{
int i;
m_chunk = (void*)chunk;
m_atomics = (RpAtomic**)atomics;
CStreaming::RegisterPointer(m_chunk, 2, true);
CStreaming::RegisterPointer(m_atomics, 2, true);
for(i = 0; i < m_numAtomics; i++){
LoadResource(m_atomics[i]);
CStreaming::RegisterAtomic(m_atomics[i], nil);
}
}
void
CSimpleModelInfo::Write(base::cRelocatableChunkWriter &writer)
{
CBaseModelInfo::Write(writer);
if(WriteModel(writer))
writer.AddPatch(&m_atomics);
else
m_atomics = nil;
if(m_isBigBuilding)
writer.AddPatch(&m_relatedModel);
}
void*
CSimpleModelInfo::WriteModel(base::cRelocatableChunkWriter &writer)
{
int i;
if(m_atomics == nil || m_atomics[0] == nil)
return nil;
// remove empty atomics
int numAtomics = 0;
for(i = 0; i < m_numAtomics; i++)
if(m_atomics[i]){
m_atomics[numAtomics] = m_atomics[i];
#ifdef FIX_BUGS
m_lodDistances[numAtomics] = m_lodDistances[i];
#endif
numAtomics++;
}
if(m_firstDamaged){
int firstDam = m_firstDamaged - m_numAtomics + numAtomics;
if(firstDam < numAtomics)
m_firstDamaged = firstDam;
else
m_firstDamaged = 0;
}
m_numAtomics = numAtomics;
// write the actual models
writer.AllocateRaw(m_atomics, m_numAtomics*sizeof(void*), sizeof(void*), false, true);
for(i = 0; m_numAtomics; i++){
writer.AddPatch(&m_atomics[i]);
SaveResource(m_atomics[i], writer);
}
return m_atomics;
}
void
CSimpleModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), 0x10, false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}
void
CSimpleModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), 0x10, false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}

View file

@ -2,11 +2,18 @@
#include "BaseModelInfo.h"
// For linking up models by name
struct TempIdeData
{
char name[24];
int16 id;
};
extern TempIdeData m_sTempIdeData[800];
class CSimpleModelInfo : public CBaseModelInfo
{
public:
// atomics[2] is often a pointer to the non-LOD modelinfo
RpAtomic *m_atomics[3];
RpAtomic **m_atomics;
// m_lodDistances[2] holds the near distance for LODs
float m_lodDistances[3];
uint8 m_numAtomics;
@ -31,15 +38,26 @@ public:
uint16 m_isCodeGlass : 1;
uint16 m_isArtistGlass : 1;
CSimpleModelInfo *m_relatedModel;
static base::cRelocatableChunkClassInfo msClassInfo;
static CSimpleModelInfo msClassInstance;
CSimpleModelInfo(void) : CBaseModelInfo(MITYPE_SIMPLE) {}
CSimpleModelInfo(ModelInfoType id) : CBaseModelInfo(id) {}
~CSimpleModelInfo() {}
void DeleteRwObject(void);
RwObject *CreateInstance(void);
RwObject *CreateInstance(RwMatrix *);
RwObject *GetRwObject(void) { return (RwObject*)m_atomics[0]; }
RwObject *GetRwObject(void) { return m_atomics ? (RwObject*)m_atomics[0] : nil; }
virtual void SetAtomic(int n, RpAtomic *atomic);
virtual void LoadModel(void *atomics, const void *chunk);
virtual void Write(base::cRelocatableChunkWriter &writer);
virtual void *WriteModel(base::cRelocatableChunkWriter &writer);
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
/*virtual*/ void SetAtomic(int n, RpAtomic *atomic);
void Init(void);
void IncreaseAlpha(void);
@ -47,15 +65,18 @@ public:
float GetLodDistance(int i);
float GetNearDistance(void);
float GetLargestLodDistance(void);
RpAtomic *GetLodAtomic(int n);
RpAtomic *GetLastAtomic(void);
RpAtomic *GetLastAtomic(float dist);
RpAtomic *GetAtomicFromDistance(float dist);
RpAtomic *GetFirstAtomicFromDistance(float dist);
void FindRelatedModel(int32 minID, int32 maxID);
void SetupBigBuilding(int32 minID, int32 maxID);
void FindRelatedModel(void);
void SetupBigBuilding(void);
void SetNumAtomics(int n) { m_numAtomics = n; }
CSimpleModelInfo *GetRelatedModel(void){
return (CSimpleModelInfo*)m_atomics[2]; }
return m_relatedModel; }
void SetRelatedModel(CSimpleModelInfo *m){
m_atomics[2] = (RpAtomic*)m; }
m_relatedModel = m; }
};
//static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");

View file

@ -3,15 +3,20 @@
#include "Camera.h"
#include "ModelInfo.h"
#include "General.h"
#include "KeyGen.h"
base::cRelocatableChunkClassInfo CTimeModelInfo::msClassInfo("CTimeModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CTimeModelInfo CTimeModelInfo::msClassInstance;
CTimeModelInfo*
CTimeModelInfo::FindOtherTimeModel(void)
CTimeModelInfo::FindOtherTimeModel(const char *modelname)
{
char name[40];
char *p;
int i;
strcpy(name, GetModelName());
strcpy(name, modelname);
// change _nt to _dy
if(p = strstr(name, "_nt"))
strncpy(p, "_dy", 4);
@ -21,13 +26,29 @@ CTimeModelInfo::FindOtherTimeModel(void)
else
return nil;
uint32 nameKey = CKeyGen::GetUppercaseKey(name);
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
if (mi && mi->GetModelType() == MITYPE_TIME &&
!CGeneral::faststrncmp(name, mi->GetModelName(), MAX_MODEL_NAME)){
if (mi && mi->GetModelType() == MITYPE_TIME && nameKey == mi->GetNameHashKey()){
m_otherTimeModelID = i;
return (CTimeModelInfo*)mi;
}
}
return nil;
}
void
CTimeModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}
void
CTimeModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}

View file

@ -7,14 +7,21 @@ class CTimeModelInfo : public CSimpleModelInfo
int32 m_timeOn;
int32 m_timeOff;
int32 m_otherTimeModelID;
static base::cRelocatableChunkClassInfo msClassInfo;
static CTimeModelInfo msClassInstance;
public:
CTimeModelInfo(void) : CSimpleModelInfo(MITYPE_TIME) { m_otherTimeModelID = -1; }
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
int32 GetTimeOn(void) { return m_timeOn; }
int32 GetTimeOff(void) { return m_timeOff; }
void SetTimes(int32 on, int32 off) { m_timeOn = on; m_timeOff = off; }
int32 GetOtherTimeModel(void) { return m_otherTimeModelID; }
void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; }
CTimeModelInfo *FindOtherTimeModel(void);
CTimeModelInfo *FindOtherTimeModel(const char *name);
};
//static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");

View file

@ -1,6 +1,7 @@
#include "common.h"
#include <rpmatfx.h>
#include "main.h"
#include "RwHelper.h"
#include "General.h"
#include "NodeName.h"
@ -20,14 +21,21 @@
#include "ModelIndices.h"
#include "ModelInfo.h"
#include "custompipes.h"
#include "Streaming.h"
#include "Leeds.h"
int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 };
int8 CVehicleModelInfo::ms_compsUsed[2];
RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256];
RwTexture *CVehicleModelInfo::ms_colourTextureTable[256];
base::cRelocatableChunkClassInfo CVehicleModelInfo::msClassInfo("CVehicleModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CVehicleModelInfo CVehicleModelInfo::msClassInstance;
RwTexture *gpWhiteTexture;
RwFrame *pMatFxIdentityFrame;
//int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 };
//int8 CVehicleModelInfo::ms_compsUsed[2];
//RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256];
CVehicleModelInfo::Statics *CVehicleModelInfo::mspInfo;
//RwTexture *CVehicleModelInfo::ms_colourTextureTable[256];
//RwTexture *gpWhiteTexture;
//RwFrame *pMatFxIdentityFrame;
enum {
VEHICLE_FLAG_COLLAPSE = 0x2,
@ -168,6 +176,29 @@ RwObjectNameIdAssocation *CVehicleModelInfo::ms_vehicleDescs[] = {
bool gbBlackCars;
bool gbPinkCars;
void
CVehicleModelInfo::Load(void *inst)
{
if(inst)
mspInfo = (CVehicleModelInfo::Statics*)inst;
else{
mspInfo = new CVehicleModelInfo::Statics;
memset(mspInfo, 0, sizeof(*mspInfo));
mspInfo->ms_compsToUse[0] = -2;
mspInfo->ms_compsToUse[1] = -2;
}
}
void*
CVehicleModelInfo::WriteStaticInfo(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(mspInfo, sizeof(*mspInfo), sizeof(void*), false, true);
if(mspInfo->unknown)
writer.AddPatch(&mspInfo->unknown);
return mspInfo;
}
CVehicleModelInfo::CVehicleModelInfo(void)
: CClumpModelInfo(MITYPE_VEHICLE)
{
@ -178,7 +209,12 @@ CVehicleModelInfo::CVehicleModelInfo(void)
m_positions[i].z = 0.0f;
}
m_numColours = 0;
CClumpModelInfo::m_animFileIndex = -1;
memset(m_materials1, 0, sizeof(m_materials1));
memset(m_materials2, 0, sizeof(m_materials2));
m_animFileIndex = -1;
m_normalSplay = 0.3f;
}
void
@ -187,15 +223,77 @@ CVehicleModelInfo::DeleteRwObject(void)
int32 i;
RwFrame *f;
if(!gUseChunkFiles){
for(i = 0; i < m_numComps; i++){
f = RpAtomicGetFrame(m_comps[i]);
RpAtomicDestroy(m_comps[i]);
RwFrameDestroy(f);
}
#ifdef FIX_BUGS
delete[] m_comps;
m_comps = nil;
#endif
m_numComps = 0;
}
RemoveWheels();
for(i = 0; i < ARRAY_SIZE(m_materials1); i++)
CStreaming::UnregisterPointer(&m_materials1[i], 2);
for(i = 0; i < ARRAY_SIZE(m_materials2); i++)
CStreaming::UnregisterPointer(&m_materials2[i], 2);
if(m_numComps > 0){
CStreaming::UnregisterPointer(&m_comps, 2);
for(i = 0; i < m_numComps; i++)
CStreaming::UnregisterAtomic(m_comps[i], nil);
m_comps = nil;
}
CClumpModelInfo::DeleteRwObject();
}
RwObject*
RemoveWheelCB(RwObject *object, void *arg)
{
RpAtomic *atomic = (RpAtomic*)object;
if(RwObjectGetType(object) == rpATOMIC){
RpClumpRemoveAtomic((RpClump*)arg, atomic);
#ifdef LIBRW
CStreaming::UnregisterPointer(&atomic->inClump.next, 2);
CStreaming::UnregisterPointer(&atomic->inClump.prev, 2);
CStreaming::UnregisterPointer(&atomic->object.object.parent, 2);
CStreaming::UnregisterPointer(&atomic->object.inFrame.next, 2);
CStreaming::UnregisterPointer(&atomic->object.inFrame.prev, 2);
CStreaming::UnregisterPointer(&atomic->clump, 2);
#endif
RpAtomicDestroy(atomic);
}
return object;
}
void
CVehicleModelInfo::RemoveWheels(void)
{
#ifdef FIX_BUGS
if(m_clump == nil)
return;
#endif
RwObjectNameIdAssocation *desc = ms_vehicleDescs[m_vehicleType];
for(int i = 0; desc[i].name; i++){
RwObjectIdAssociation assoc;
if(desc[i].flags & (VEHICLE_FLAG_COMP|VEHICLE_FLAG_POS))
continue;
assoc.frame = nil;
assoc.id = desc[i].hierId;
RwFrameForAllChildren(RpClumpGetFrame(m_clump),
FindFrameFromIdCB, &assoc);
if(assoc.frame && desc[i].flags & VEHICLE_FLAG_ADD_WHEEL && m_wheelId != -1)
RwFrameForAllObjects(assoc.frame, RemoveWheelCB, m_clump);
}
}
RwObject*
CVehicleModelInfo::CreateInstance(void)
{
@ -205,7 +303,7 @@ CVehicleModelInfo::CreateInstance(void)
int32 comp1, comp2;
clump = (RpClump*)CClumpModelInfo::CreateInstance();
if(m_numComps != 0){
if(clump && m_numComps != 0 && strcmp(m_gameName, "POLICAR") != 0){
clumpframe = RpClumpGetFrame(clump);
comp1 = ChooseComponent();
@ -219,7 +317,7 @@ CVehicleModelInfo::CreateInstance(void)
RpClumpAddAtomic(clump, atomic);
RwFrameAddChild(clumpframe, f);
}
ms_compsUsed[0] = comp1;
mspInfo->ms_compsUsed[0] = comp1;
comp2 = ChooseSecondComponent();
if(comp2 != -1 && m_comps[comp2]){
@ -232,18 +330,27 @@ CVehicleModelInfo::CreateInstance(void)
RpClumpAddAtomic(clump, atomic);
RwFrameAddChild(clumpframe, f);
}
ms_compsUsed[1] = comp2;
mspInfo->ms_compsUsed[1] = comp2;
}else{
ms_compsUsed[0] = -1;
ms_compsUsed[1] = -1;
mspInfo->ms_compsUsed[0] = -1;
mspInfo->ms_compsUsed[1] = -1;
}
CStreaming::RegisterInstance(clump);
return (RwObject*)clump;
}
RpAtomic*
SplayNormals(RpAtomic *atomic, void *arg)
{
// PSP only?
return atomic;
}
void
CVehicleModelInfo::SetClump(RpClump *clump)
{
CClumpModelInfo::SetClump(clump);
RpClumpForAllAtomics((RpClump*)GetRwObject(), SplayNormals, this);
SetAtomicRenderCallbacks();
SetFrameIds(ms_vehicleDescs[m_vehicleType]);
PreprocessHierarchy();
@ -339,7 +446,7 @@ CVehicleModelInfo::SetAtomicRendererCB(RpAtomic *atomic, void *data)
}else if(strstr(name, "_lo")){
RpClumpRemoveAtomic(clump, atomic);
RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta
return atomic; // BUG: nil in gta
}else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB);
else
@ -397,6 +504,33 @@ CVehicleModelInfo::SetAtomicRendererCB_Train(RpAtomic *atomic, void *data)
return atomic;
}
RpAtomic*
CVehicleModelInfo::SetAtomicRendererCB_Ferry(RpAtomic *atomic, void *data)
{
char *name;
bool alpha;
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
alpha = false;
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha);
if(strstr(name, "_hi")){
if(alpha)
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderTrainHiDetailAlphaCB);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderTrainHiDetailCB);
}else if(strstr(name, "_lo")){
if(alpha)
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleLowDetailAlphaCB_BigVehicle);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleLowDetailCB_BigVehicle);
}else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB_BigVehicle);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
HideDamagedAtomicCB(atomic, nil);
return atomic;
}
RpAtomic*
CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data)
{
@ -414,7 +548,31 @@ CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data)
RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta
}else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB_BigVehicle);
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleLoDetailCB_Boat);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
HideDamagedAtomicCB(atomic, nil);
return atomic;
}
RpAtomic*
CVehicleModelInfo::SetAtomicRendererCB_Boat_Far(RpAtomic *atomic, void *data)
{
RpClump *clump;
char *name;
clump = (RpClump*)data;
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
if(strcmp(name, "boat_hi") == 0 || !CGeneral::faststrncmp(name, "extra", 5))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat_Far);
else if(strstr(name, "_hi"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB);
else if(strstr(name, "_lo")){
RpClumpRemoveAtomic(clump, atomic);
RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta
}else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleLoDetailCB_Boat_Far);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
HideDamagedAtomicCB(atomic, nil);
@ -424,6 +582,7 @@ CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data)
RpAtomic*
CVehicleModelInfo::SetAtomicRendererCB_Heli(RpAtomic *atomic, void *data)
{
/* // LCS: gone, may be better to keep it though
char *name;
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
@ -432,6 +591,7 @@ CVehicleModelInfo::SetAtomicRendererCB_Heli(RpAtomic *atomic, void *data)
else if(strncmp(name, "rearrotor", 9) == 0)
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleTailRotorAlphaCB);
else
*/
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
return atomic;
}
@ -459,7 +619,7 @@ CVehicleModelInfo::SetAtomicRendererCB_RealHeli(RpAtomic *atomic, void *data)
}else if(strstr(name, "_lo")){
RpClumpRemoveAtomic(clump, atomic);
RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta
return atomic; // BUG: nil in gta
}else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB);
else
@ -476,13 +636,18 @@ CVehicleModelInfo::SetAtomicRenderCallbacks(void)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_Train, nil);
else
#endif
if(m_vehicleType == VEHICLE_TYPE_HELI)
if(m_vehicleType == VEHICLE_TYPE_FERRY)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_Ferry, nil);
else if(m_vehicleType == VEHICLE_TYPE_HELI)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_Heli, nil);
else if(m_vehicleType == VEHICLE_TYPE_PLANE)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_BigVehicle, nil);
else if(m_vehicleType == VEHICLE_TYPE_BOAT)
else if(m_vehicleType == VEHICLE_TYPE_BOAT){
if(strcmp(m_gameName, "REEFER") == 0)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_Boat_Far, m_clump);
else
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_Boat, m_clump);
else if(mod_HandlingManager.GetHandlingData((tVehicleType)m_handlingId)->Flags & HANDLING_IS_HELI)
}else if(mod_HandlingManager.GetHandlingData((tVehicleType)m_handlingId)->Flags & HANDLING_IS_HELI)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB_RealHeli, m_clump);
else
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, m_clump);
@ -530,6 +695,8 @@ CVehicleModelInfo::PreprocessHierarchy(void)
m_numDoors = 0;
m_numComps = 0;
m_comps = new RpAtomic*[7];
for(i = 0; desc[i].name; i++){
RwObjectNameAssociation assoc;
@ -587,6 +754,7 @@ CVehicleModelInfo::PreprocessHierarchy(void)
SetVehicleComponentFlags(assoc.frame, desc[i].flags);
if(!(gMakeResources && gUseResources)){
if(desc[i].flags & VEHICLE_FLAG_ADD_WHEEL){
if(m_wheelId == -1)
RwFrameDestroy(assoc.frame);
@ -606,6 +774,7 @@ CVehicleModelInfo::PreprocessHierarchy(void)
}
}
}
}
void
CVehicleModelInfo::SetVehicleComponentFlags(RwFrame *frame, uint32 flags)
@ -629,9 +798,9 @@ CVehicleModelInfo::SetVehicleComponentFlags(RwFrame *frame, uint32 flags)
SETFLAGS(ATOMIC_FLAG_FRONT);
else if(flags & VEHICLE_FLAG_REAR && (handling->Flags & HANDLING_IS_VAN || (flags & (VEHICLE_FLAG_LEFT|VEHICLE_FLAG_RIGHT)) == 0))
SETFLAGS(ATOMIC_FLAG_REAR);
if(flags & VEHICLE_FLAG_LEFT)
else if(flags & VEHICLE_FLAG_LEFT)
SETFLAGS(ATOMIC_FLAG_LEFT);
if(flags & VEHICLE_FLAG_RIGHT)
else if(flags & VEHICLE_FLAG_RIGHT)
SETFLAGS(ATOMIC_FLAG_RIGHT);
if(flags & VEHICLE_FLAG_REARDOOR)
@ -746,7 +915,7 @@ CVehicleModelInfo::ChooseComponent(void)
int32 n;
comp = -1;
if(ms_compsToUse[0] == -2){
if(mspInfo->ms_compsToUse[0] == -2){
if(COMPRULE_RULE(m_compRules) && IsValidCompRule(COMPRULE_RULE(m_compRules)))
comp = ::ChooseComponent(COMPRULE_RULE(m_compRules), COMPRULE_COMPS(m_compRules));
else if(CGeneral::GetRandomNumberInRange(0, 3) < 2){
@ -755,8 +924,8 @@ CVehicleModelInfo::ChooseComponent(void)
comp = comps[(int)CGeneral::GetRandomNumberInRange(0, n)];
}
}else{
comp = ms_compsToUse[0];
ms_compsToUse[0] = -2;
comp = mspInfo->ms_compsToUse[0];
mspInfo->ms_compsToUse[0] = -2;
}
return comp;
}
@ -769,7 +938,7 @@ CVehicleModelInfo::ChooseSecondComponent(void)
int32 n;
comp = -1;
if(ms_compsToUse[1] == -2){
if(mspInfo->ms_compsToUse[1] == -2){
if(COMPRULE2_RULE(m_compRules) && IsValidCompRule(COMPRULE2_RULE(m_compRules)))
comp = ::ChooseComponent(COMPRULE2_RULE(m_compRules), COMPRULE2_COMPS(m_compRules));
else if(COMPRULE_RULE(m_compRules) && IsValidCompRule(COMPRULE_RULE(m_compRules)) &&
@ -780,8 +949,8 @@ CVehicleModelInfo::ChooseSecondComponent(void)
comp = comps[(int)CGeneral::GetRandomNumberInRange(0, n)];
}
}else{
comp = ms_compsToUse[1];
ms_compsToUse[1] = -2;
comp = mspInfo->ms_compsToUse[1];
mspInfo->ms_compsToUse[1] = -2;
}
return comp;
}
@ -796,7 +965,7 @@ struct editableMatCBData
RpMaterial*
CVehicleModelInfo::GetEditableMaterialListCB(RpMaterial *material, void *data)
{
static RwRGBA white = { 255, 255, 255, 255 };
RwRGBA white = { 255, 255, 255, 255 };
const RwRGBA *col;
editableMatCBData *cbdata;
@ -849,7 +1018,7 @@ CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2)
RpMaterial **matp;
if(c1 != m_currentColour1){
col = ms_vehicleColourTable[c1];
col = mspInfo->ms_vehicleColourTable[c1];
for(matp = m_materials1; *matp; matp++){
colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const
colp->red = col.red;
@ -860,7 +1029,7 @@ CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2)
}
if(c2 != m_currentColour2){
col = ms_vehicleColourTable[c2];
col = mspInfo->ms_vehicleColourTable[c2];
for(matp = m_materials2; *matp; matp++){
colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const
colp->red = col.red;
@ -985,8 +1154,8 @@ CVehicleModelInfo::LoadVehicleColours(void)
fd = CFileMgr::OpenFile("CARCOLS.DAT", "r");
CFileMgr::ChangeDir("\\");
for(i = 0; i < 256; i++)
ms_colourTextureTable[i] = nil;
//for(i = 0; i < 256; i++)
// ms_colourTextureTable[i] = nil;
section = 0;
numCols = 0;
@ -1018,10 +1187,10 @@ CVehicleModelInfo::LoadVehicleColours(void)
}else if(section == COLOURS){
sscanf(&line[start], // BUG: games doesn't add start
"%d %d %d", &r, &g, &b);
ms_vehicleColourTable[numCols].red = r;
ms_vehicleColourTable[numCols].green = g;
ms_vehicleColourTable[numCols].blue = b;
ms_vehicleColourTable[numCols].alpha = 0xFF;
mspInfo->ms_vehicleColourTable[numCols].red = r;
mspInfo->ms_vehicleColourTable[numCols].green = g;
mspInfo->ms_vehicleColourTable[numCols].blue = b;
mspInfo->ms_vehicleColourTable[numCols].alpha = 0xFF;
numCols++;
}else if(section == CARS){
n = sscanf(&line[start], // BUG: games doesn't add start
@ -1051,6 +1220,7 @@ CVehicleModelInfo::LoadVehicleColours(void)
void
CVehicleModelInfo::DeleteVehicleColourTextures(void)
{
/*
int i;
for(i = 0; i < 256; i++){
@ -1059,6 +1229,7 @@ CVehicleModelInfo::DeleteVehicleColourTextures(void)
ms_colourTextureTable[i] = nil;
}
}
*/
}
RpMaterial*
@ -1070,6 +1241,7 @@ CVehicleModelInfo::GetMatFXEffectMaterialCB(RpMaterial *material, void *data)
return nil;
}
/*
RpMaterial*
CVehicleModelInfo::SetDefaultEnvironmentMapCB(RpMaterial *material, void *data)
{
@ -1086,7 +1258,9 @@ CVehicleModelInfo::SetDefaultEnvironmentMapCB(RpMaterial *material, void *data)
}
return material;
}
*/
/*
RpAtomic*
CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
{
@ -1102,6 +1276,7 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
}
return atomic;
}
*/
void
CVehicleModelInfo::SetEnvironmentMap(void)
@ -1178,10 +1353,162 @@ CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(int id)
}
if(n == 0)
return id == MI_RCBANDIT || id == MI_PIZZABOY || id == MI_BAGGAGE ? 0 : 1;
return id == MI_RCBANDIT /*|| id == MI_PIZZABOY || id == MI_BAGGAGE*/ ? 0 : 1;
if(id == MI_COACH)
return 8;
return n - 1;
}
struct VehicleChunk
{
RpClump *clump;
int32 numComps;
RpAtomic **comp;
RpMaterial *materials1[NUM_FIRST_MATERIALS];
RpMaterial *materials2[NUM_SECOND_MATERIALS];
};
void
CVehicleModelInfo::LoadModel(void *data, const void *chunk)
{
int i;
VehicleChunk *chk = (VehicleChunk*)data;
CClumpModelInfo::LoadModel(chk->clump, chunk);
// editable materials
for(i = 0; i < NUM_FIRST_MATERIALS; i++){
m_materials1[i] = chk->materials1[i];
if(m_materials1[i])
CStreaming::RegisterPointer(&m_materials1[i], 2, true);
}
for(i = 0; i < NUM_SECOND_MATERIALS; i++){
m_materials2[i] = chk->materials2[i];
if(m_materials2[i])
CStreaming::RegisterPointer(&m_materials2[i], 2, true);
}
// extra components
m_numComps = chk->numComps;
if(m_numComps > 0){
m_comps = chk->comp;
CStreaming::RegisterPointer(&m_comps, 2, true);
for(i = 0; i < m_numComps; i++){
LoadResource(m_comps[i]);
CStreaming::RegisterAtomic(m_comps[i], nil);
}
}else
m_comps = nil;
m_currentColour1 = -1;
m_currentColour2 = -1;
// add wheels
RwObjectNameIdAssocation *desc = ms_vehicleDescs[m_vehicleType];
for(i = 0; desc[i].name; i++){
RwObjectIdAssociation assoc;
if(desc[i].flags & (VEHICLE_FLAG_COMP|VEHICLE_FLAG_POS))
continue;
assoc.frame = nil;
assoc.id = desc[i].hierId;
RwFrameForAllChildren(RpClumpGetFrame(m_clump),
FindFrameFromIdCB, &assoc);
if(assoc.frame && desc[i].flags & VEHICLE_FLAG_ADD_WHEEL && m_wheelId != -1){
RwV3d scale;
RpAtomic *atomic = (RpAtomic*)CModelInfo::GetModelInfo(m_wheelId)->CreateInstance();
RwFrameDestroy(RpAtomicGetFrame(atomic));
RpAtomicSetFrame(atomic, assoc.frame);
RpClumpAddAtomic(m_clump, atomic);
CVisibilityPlugins::SetAtomicRenderCallback(atomic,
CVisibilityPlugins::RenderWheelAtomicCB);
scale.x = m_wheelScale;
scale.y = m_wheelScale;
scale.z = m_wheelScale;
RwFrameScale(assoc.frame, &scale, rwCOMBINEPRECONCAT);
#ifdef LIBRW
CStreaming::RegisterPointer(&atomic->inClump.next, 2, true);
CStreaming::RegisterPointer(&atomic->inClump.prev, 2, true);
CStreaming::RegisterPointer(&atomic->object.object.parent, 2, true);
CStreaming::RegisterPointer(&atomic->object.inFrame.next, 2, true);
CStreaming::RegisterPointer(&atomic->object.inFrame.prev, 2, true);
CStreaming::RegisterPointer(&atomic->clump, 2, true);
#endif
}
}
}
void
CVehicleModelInfo::Write(base::cRelocatableChunkWriter &writer)
{
CClumpModelInfo::Write(writer);
}
void*
CVehicleModelInfo::WriteModel(base::cRelocatableChunkWriter &writer)
{
if(GetRwObject() == nil)
return nil;
int i;
VehicleChunk *chk = new VehicleChunk;
memset(chk, 0, sizeof(*chk));
writer.AllocateRaw(chk, sizeof(*chk), sizeof(void*), false, true);
// clump
chk->clump = (RpClump*)CClumpModelInfo::WriteModel(writer);
if(chk->clump)
writer.AddPatch(&chk->clump);
// materials
for(i = 0; i < NUM_FIRST_MATERIALS; i++){
if(m_materials1[i] == nil || m_vehicleType == VEHICLE_TYPE_FERRY)
chk->materials1[i] = nil;
else{
SaveResource(m_materials1[i], writer);
chk->materials1[i] = m_materials1[i];
writer.AddPatch(&chk->materials1[i]);
}
}
for(i = 0; i < NUM_SECOND_MATERIALS; i++){
if(m_materials2[i] == nil || m_vehicleType == VEHICLE_TYPE_FERRY)
chk->materials2[i] = nil;
else{
SaveResource(m_materials2[i], writer);
chk->materials2[i] = m_materials2[i];
writer.AddPatch(&chk->materials2[i]);
}
}
// extra components
chk->numComps = m_numComps;
chk->comp = nil;
if(m_numComps > 0){
chk->comp = m_comps;
writer.AddPatch(&chk->comp);
writer.AllocateRaw(m_comps, m_numComps*sizeof(void*), sizeof(void*), false, true);
for(i = 0; i < m_numComps; i++)
if(m_comps[i]){
SaveResource(m_comps[i], writer);
writer.AddPatch(&m_comps[i]);
}
}
return chk;
}
void
CVehicleModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}
void
CVehicleModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}

View file

@ -98,19 +98,30 @@ public:
uint8 m_lastColorVariation;
uint8 m_currentColour1;
uint8 m_currentColour2;
RpAtomic *m_comps[6]; // LCS(TODO): pointer
RpAtomic **m_comps;
float m_normalSplay;
// This is stupid, CClumpModelInfo already has it!
union {
int32 m_animFileIndex;
char *m_animFileName;
};
static int8 ms_compsToUse[2];
static int8 ms_compsUsed[2];
static RwRGBA ms_vehicleColourTable[256];
static RwTexture *ms_colourTextureTable[256];
static base::cRelocatableChunkClassInfo msClassInfo;
static CVehicleModelInfo msClassInstance;
struct Statics {
void *unknown; // unused too it seems
RwRGBA ms_vehicleColourTable[256];
int8 ms_compsUsed[2];
int8 ms_compsToUse[2];
};
//static RwTexture *ms_colourTextureTable[256];
static Statics *mspInfo;
static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES];
static void Load(void *inst);
static void *WriteStaticInfo(base::cRelocatableChunkWriter &writer);
CVehicleModelInfo(void);
void DeleteRwObject(void);
RwObject *CreateInstance(void);
@ -119,6 +130,12 @@ public:
void ConvertAnimFileIndex(void);
int GetAnimFileIndex(void) { return m_animFileIndex; }
virtual void LoadModel(void *model, const void *chunk);
virtual void Write(base::cRelocatableChunkWriter &writer);
virtual void *WriteModel(base::cRelocatableChunkWriter &writer);
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
static RwFrame *CollapseFramesCB(RwFrame *frame, void *data);
static RwObject *MoveObjectsCB(RwObject *object, void *data);
static RpAtomic *HideDamagedAtomicCB(RpAtomic *atomic, void *data);
@ -128,13 +145,16 @@ public:
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_BigVehicle(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_Train(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_Ferry(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_Boat_Far(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_Heli(RpAtomic *atomic, void *data);
static RpAtomic *SetAtomicRendererCB_RealHeli(RpAtomic *atomic, void *data);
void SetAtomicRenderCallbacks(void);
static RwObject *SetAtomicFlagCB(RwObject *object, void *data);
static RwObject *ClearAtomicFlagCB(RwObject *atomic, void *data);
void RemoveWheels(void);
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
void PreprocessHierarchy(void);
void GetWheelPosn(int32 n, CVector &pos);
@ -160,7 +180,7 @@ public:
static void ShutdownEnvironmentMaps(void);
static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id);
static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; }
static void SetComponentsToUse(int8 c1, int8 c2) { mspInfo->ms_compsToUse[0] = c1; mspInfo->ms_compsToUse[1] = c2; }
};
extern bool gbBlackCars;

View file

@ -4,6 +4,9 @@
#include "AnimManager.h"
#include "VisibilityPlugins.h"
base::cRelocatableChunkClassInfo CWeaponModelInfo::msClassInfo("CWeaponModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CWeaponModelInfo CWeaponModelInfo::msClassInstance;
void
CWeaponModelInfo::SetAnimFile(const char *file)
{
@ -35,19 +38,34 @@ CWeaponModelInfo::Init(void)
void
CWeaponModelInfo::SetWeaponInfo(int32 weaponId)
{
m_atomics[2] = (RpAtomic*)weaponId;
m_relatedModel = (CSimpleModelInfo*)weaponId;
}
eWeaponType
CWeaponModelInfo::GetWeaponInfo(void)
{
return (eWeaponType)(uintptr)m_atomics[2];
return (eWeaponType)(uintptr)m_relatedModel;
}
/*
void
CWeaponModelInfo::SetAtomic(int n, RpAtomic *atomic)
{
CSimpleModelInfo::SetAtomic(n, atomic);
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderWeaponCB);
}
*/
void
CWeaponModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}
void
CWeaponModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
writer.Class(VTABLE_ADDR(this), msClassInfo);
}

View file

@ -9,13 +9,21 @@ class CWeaponModelInfo : public CSimpleModelInfo
int32 m_animFileIndex;
char *m_animFileName;
};
static base::cRelocatableChunkClassInfo msClassInfo;
static CWeaponModelInfo msClassInstance;
public:
CWeaponModelInfo(void) : CSimpleModelInfo(MITYPE_WEAPON) { m_animFileIndex = -1; }
virtual void SetAnimFile(const char *file);
virtual void ConvertAnimFileIndex(void);
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
virtual void SetAtomic(int n, RpAtomic *atomic);
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
//virtual void SetAtomic(int n, RpAtomic *atomic);
void Init(void);
void SetWeaponInfo(int32 weaponId);

View file

@ -3342,6 +3342,7 @@ void
CPed::LineUpPedWithCar(PedLineUpPhase phase)
{
bool vehIsUpsideDown = false;
bool stillGettingInOut = false;
int vehAnim;
float seatPosMult = 0.0f;
float currentZ;
@ -3594,8 +3595,8 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
if (m_pVehicleAnim && vehAnim != ANIM_VAN_GETIN_L && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE && vehAnim != ANIM_VAN_GETIN) {
neededPos.z = autoZPos.z;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
} else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
} else if (neededPos.z < currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
adjustedTimeStep = Max(m_pVehicleAnim->timeStep, 0.1f);
// Smoothly change ped position
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
@ -3613,7 +3614,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
if (m_pVehicleAnim &&
(vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS
|| vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) {
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
adjustedTimeStep = Max(m_pVehicleAnim->timeStep, 0.1f);
// Smoothly change ped position
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
@ -3625,7 +3626,6 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
}
}
bool stillGettingInOut = false;
if (CTimer::GetTimeInMilliseconds() < m_nPedStateTimer)
stillGettingInOut = veh->m_vehType != VEHICLE_TYPE_BOAT || bOnBoat;
@ -4138,7 +4138,7 @@ CPed::SetExitBoat(CVehicle *boat)
RemoveInCarAnims();
CColModel* boatCol = boat->GetColModel();
if (boat->IsUpsideDown()) {
newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z };
newPos = CVector(0.0f, 0.0f, boatCol->boundingBox.min.z);
newPos = boat->GetMatrix() * newPos;
newPos.z += 1.0f;
m_vehDoor = CAR_DOOR_RF;

View file

@ -104,7 +104,7 @@ bool CVehicleToEffect::HasThisEffect(C2dEffect* pEffect) const
const C2dEffect* CPedAttractorManager::GetEffectForIceCreamVan(CVehicle* pVehicle, const CVector& pos)
{
if (!vVehicleToEffect.empty()) {
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend(); ++assoc) {
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.begin(); assoc != vVehicleToEffect.end(); ++assoc) {
if (assoc->GetVehicle() == pVehicle)
return assoc->ChooseEffect(pos);
}
@ -120,7 +120,7 @@ CVehicle* CPedAttractorManager::GetIceCreamVanForEffect(C2dEffect* pEffect)
{
if (vVehicleToEffect.empty())
return nil;
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend(); ++assoc) {
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.begin(); assoc != vVehicleToEffect.end(); ++assoc) {
if (assoc->HasThisEffect(pEffect))
return assoc->GetVehicle();
}
@ -131,7 +131,7 @@ const CPedAttractor* CPedAttractorManager::FindAssociatedAttractor(const C2dEffe
{
if (vecAttractors.empty())
return nil;
for (std::vector<CPedAttractor*>::const_iterator attractor = vecAttractors.cbegin(); attractor != vecAttractors.cend(); ++attractor) {
for (std::vector<CPedAttractor*>::const_iterator attractor = vecAttractors.begin(); attractor != vecAttractors.end(); ++attractor) {
if ((*attractor)->GetEffect() == pEffect)
return *attractor;
}
@ -145,7 +145,7 @@ void CPedAttractorManager::RemoveIceCreamVanEffects(C2dEffect* pEffect)
return;
if (vVehicleToEffect.empty())
return;
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend();) {
for (std::vector<CVehicleToEffect>::iterator assoc = vVehicleToEffect.begin(); assoc != vVehicleToEffect.end();) {
if (assoc->GetVehicle() != pVehicle) {
++assoc;
continue;
@ -229,7 +229,7 @@ CVector CPedShelterAttractor::GetDisplacement(int32 qid) const
float fRandomOffset = CGeneral::GetRandomNumberInRange(0.0f, 2.0f);
CVector vecDisplacement(fRandomOffset * Sin(fRandomAngle), fRandomOffset * Cos(fRandomAngle), 0.0f);
bool close = false;
for (std::vector<CVector>::const_iterator v = ms_displacements.cbegin(); v != ms_displacements.cend(); ++v) {
for (std::vector<CVector>::const_iterator v = ms_displacements.begin(); v != ms_displacements.end(); ++v) {
if ((*v - vecDisplacement).Magnitude() < 1.0f) {
close = true;
break;
@ -265,7 +265,7 @@ void CPedShelterAttractor::ComputeAttractHeading(int32 qid, float& heading) cons
bool CPedAttractor::RegisterPed(CPed* pPed)
{
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) {
vApproachingQueue.erase(pPedIt);
return false;
@ -318,7 +318,7 @@ static bool IsPedUsingAttractorOfThisType(int8 type, CPed* pPed)
bool CPedAttractor::DeRegisterPed(CPed* pPed)
{
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt != pPed)
continue;
pPed->m_attractor = nil;
@ -340,12 +340,12 @@ bool CPedAttractor::DeRegisterPed(CPed* pPed)
bool CPedAttractor::BroadcastArrival(CPed* pPed)
{
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.cbegin(); pPedIt != vWaitingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.begin(); pPedIt != vWaitingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed)
return false;
}
vWaitingQueue.push_back(pPed);
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) {
vApproachingQueue.erase(pPedIt);
break;
@ -400,7 +400,7 @@ bool CPedAttractor::BroadcastDeparture(CPed* pPed)
pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x));
UpdatePedStateOnDeparture(pPed);
}
vWaitingQueue.erase(vWaitingQueue.cbegin() + qid);
vWaitingQueue.erase(vWaitingQueue.begin() + qid);
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
CPed* pPed = *pPedIt;
CVector pos;
@ -441,7 +441,7 @@ bool CPedShelterAttractor::BroadcastDeparture(CPed* pPed)
pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x));
UpdatePedStateOnDeparture(pPed);
}
vWaitingQueue.erase(vWaitingQueue.cbegin() + qid);
vWaitingQueue.erase(vWaitingQueue.begin() + qid);
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
CPed* pPed = *pPedIt;
CVector pos;
@ -458,11 +458,11 @@ bool CPedShelterAttractor::BroadcastDeparture(CPed* pPed)
bool CPedAttractor::IsRegisteredWithPed(CPed* pPed) const
{
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.cbegin(); pPedIt != vWaitingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.begin(); pPedIt != vWaitingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed)
return true;
}
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) {
return true;
}
@ -472,7 +472,7 @@ bool CPedAttractor::IsRegisteredWithPed(CPed* pPed) const
bool CPedAttractor::IsInQueue(CPed* pPed) const
{
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.cbegin(); pPedIt != vWaitingQueue.cend(); ++pPedIt) {
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.begin(); pPedIt != vWaitingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed)
return true;
}
@ -640,7 +640,7 @@ void CPedAttractorManager::ComputeEffectUseDir(const C2dEffect* pEffect, const C
CPedAttractor* CPedAttractorManager::RegisterPed(CPed* pPed, C2dEffect* pEffect, const CMatrix& matrix, std::vector<CPedAttractor*>& vecAttractors)
{
CPedAttractor* pRegisteredAttractor = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
CPedAttractor* pAttractor = *pAttractorIt;
CVector vEffectPos;
ComputeEffectPos(pAttractor->GetEffect(), matrix, vEffectPos);
@ -676,7 +676,7 @@ bool CPedAttractorManager::DeRegisterPed(CPed* pPed, CPedAttractor* pAttractor,
if (!pAttractor)
return false;
CPedAttractor* pFound = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
pFound = *pAttractorIt;
break;
@ -687,7 +687,7 @@ bool CPedAttractorManager::DeRegisterPed(CPed* pPed, CPedAttractor* pAttractor,
pFound->DeRegisterPed(pPed);
if (pFound->GetNoOfRegisteredPeds() != 0)
return true;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
vecAttractors.erase(pAttractorIt);
break;
@ -702,7 +702,7 @@ bool CPedAttractorManager::BroadcastArrival(CPed* pPed, CPedAttractor* pAttracto
if (!pAttractor)
return false;
CPedAttractor* pFound = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
pFound = *pAttractorIt;
break;
@ -719,7 +719,7 @@ bool CPedAttractorManager::BroadcastDeparture(CPed* pPed, CPedAttractor* pAttrac
if (!pAttractor)
return false;
CPedAttractor* pFound = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
pFound = *pAttractorIt;
break;
@ -730,7 +730,7 @@ bool CPedAttractorManager::BroadcastDeparture(CPed* pPed, CPedAttractor* pAttrac
pFound->DeRegisterPed(pPed);
if (pFound->GetNoOfRegisteredPeds() != 0)
return true;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
vecAttractors.erase(pAttractorIt);
break;
@ -744,7 +744,7 @@ bool CPedAttractorManager::IsInQueue(CPed* pPed, CPedAttractor* pAttractor, std:
{
if (!pAttractor)
return false;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
return (*pAttractorIt)->IsInQueue(pPed);
}
@ -756,7 +756,7 @@ bool CPedAttractorManager::IsAtHeadOfQueue(CPed* pPed, CPedAttractor* pAttractor
{
if (!pAttractor)
return false;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) {
return (*pAttractorIt)->IsAtHeadOfQueue(pPed);
}
@ -766,7 +766,7 @@ bool CPedAttractorManager::IsAtHeadOfQueue(CPed* pPed, CPedAttractor* pAttractor
bool CPedAttractorManager::IsPedRegistered(CPed* pPed, std::vector<CPedAttractor*>& vecAttractors)
{
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if ((*pAttractorIt)->IsRegisteredWithPed(pPed))
return true;
}

View file

@ -126,8 +126,8 @@ public:
class CPedAtmAttractor : public CPedAttractor
{
public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_ATM; };
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override;
virtual ePedAttractorType GetType() const { return ATTRACTOR_ATM; };
virtual void UpdatePedStateOnDeparture(CPed* pPed) const;
CPedAtmAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{};
@ -136,9 +136,9 @@ public:
class CPedIceCreamAttractor : public CPedAttractor
{
public:
virtual ~CPedIceCreamAttractor() override { GetPedAttractorManager()->RemoveIceCreamVanEffects(p2dEffect); }
virtual ePedAttractorType GetType() const override { return ATTRACTOR_ICECREAM; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
virtual ~CPedIceCreamAttractor() { GetPedAttractorManager()->RemoveIceCreamVanEffects(p2dEffect); }
virtual ePedAttractorType GetType() const { return ATTRACTOR_ICECREAM; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
CPedIceCreamAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{};
@ -147,9 +147,9 @@ public:
class CPedPizzaAttractor : public CPedAttractor
{
public:
virtual float GetHeadOfQueueWaitTime() override { return 2000.0f; }
virtual ePedAttractorType GetType() const override { return ATTRACTOR_PIZZA; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override;
virtual float GetHeadOfQueueWaitTime() { return 2000.0f; }
virtual ePedAttractorType GetType() const { return ATTRACTOR_PIZZA; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const;
CPedPizzaAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{};
@ -158,8 +158,8 @@ public:
class CPedSeatAttractor : public CPedAttractor
{
public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_SEAT; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
virtual ePedAttractorType GetType() const { return ATTRACTOR_SEAT; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
CPedSeatAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{};
@ -169,12 +169,12 @@ class CPedShelterAttractor : public CPedAttractor
{
static std::vector<CVector> ms_displacements;
public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_SHELTER; }
virtual bool BroadcastDeparture(CPed*) override;
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
virtual bool IsAtHeadOfQueue(CPed* pPed) const override { return true; }
virtual void ComputeAttractPos(int qid, CVector& pos) const override;
virtual void ComputeAttractHeading(int qid, float& heading) const override;
virtual ePedAttractorType GetType() const { return ATTRACTOR_SHELTER; }
virtual bool BroadcastDeparture(CPed*);
virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
virtual bool IsAtHeadOfQueue(CPed* pPed) const { return true; }
virtual void ComputeAttractPos(int qid, CVector& pos) const;
virtual void ComputeAttractHeading(int qid, float& heading) const;
CPedShelterAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
@ -187,8 +187,8 @@ public:
class CPedStopAttractor : public CPedAttractor
{
public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_STOP; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
virtual ePedAttractorType GetType() const { return ATTRACTOR_STOP; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
CPedStopAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)

View file

@ -5,8 +5,8 @@
#include "Camera.h"
#include "CutsceneMgr.h"
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fScaledFOV = 45.0f;
#endif

View file

@ -16,10 +16,10 @@ private:
static float ms_fNearClipZ;
static float ms_fFarClipZ;
static float ms_fFOV;
#ifdef ASPECT_RATIO_SCALE
// we use this variable to scale a lot of 2D elements
// so better cache it
static float ms_fAspectRatio;
#ifdef ASPECT_RATIO_SCALE
// similar thing for 3D rendering
static float ms_fScaledFOV;
#endif

View file

@ -1,5 +1,7 @@
#pragma once
#include "Sprite2d.h"
void AsciiToUnicode(const char *src, wchar *dst);
void UnicodeStrcpy(wchar *dst, const wchar *src);
void UnicodeStrcat(wchar *dst, wchar *append);

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "Glass.h"
#include "Timer.h"

View file

@ -39,7 +39,7 @@
// Game has colors inlined in code.
// For easier modification we collect them here:
CRGBA MONEY_COLOR(0, 207, 133, 255);
CRGBA AMMO_COLOR(255, 150, 225, 255);
CRGBA AMMO_COLOR(255, 255, 255, 255);
CRGBA HEALTH_COLOR(255, 150, 225, 255);
CRGBA ARMOUR_COLOR(185, 185, 185, 255);
CRGBA NOTWANTED_COLOR(27, 89, 130, 255);
@ -130,6 +130,8 @@ CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
wchar* CHud::gLastPrintForeverString;
uint8 CHud::m_HudAlpha = 209;
struct
{
const char *name;
@ -213,6 +215,7 @@ RwTexture *gpLaserSightTex;
RwTexture *gpLaserDotTex;
RwTexture *gpViewFinderTex;
// TODO(LCS): some things were reversed from LCS but not all
void CHud::Draw()
{
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
@ -405,6 +408,8 @@ void CHud::Draw()
DrawMoneyCounter
*/
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); // TODO(LCS): temp filtering fix for money counter, remove later
wchar sPrint[16];
wchar sPrintIcon[16];
char sTemp[16];
@ -417,25 +422,8 @@ void CHud::Draw()
m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney;
}
if (m_DisplayScoreState != FADED_OUT) {
sprintf(sTemp, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
AsciiToUnicode(sTemp, sPrint);
CFont::SetPropOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetPropOff();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, alpha));
MONEY_COLOR.a = alpha;
CFont::SetColor(MONEY_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud) {
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint);
DrawCash();
}
}
@ -448,46 +436,23 @@ void CHud::Draw()
alpha = CHud::DrawFadeState(HUD_WEAPON_FADING, 1);
m_LastWeapon = playerPed->GetWeapon()->m_eWeaponType;
}
alpha = Min(alpha, m_HudAlpha);
if (m_WeaponState != FADED_OUT) {
CWeapon *weapon = playerPed->GetWeapon();
int32 AmmoAmount = CWeaponInfo::GetWeaponInfo((eWeaponType)WeaponType)->m_nAmountofAmmunition;
int32 AmmoInClip = weapon->m_nAmmoInClip;
int32 TotalAmmo = weapon->m_nAmmoTotal;
int32 Ammo, Clip;
if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo);
else {
if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
Clip = AmmoInClip / 10;
Ammo = Min((TotalAmmo - AmmoInClip) / 10, 9999);
} else {
Clip = AmmoInClip;
Ammo = Min(TotalAmmo - AmmoInClip, 9999);
}
sprintf(sTemp, "%d-%d", Ammo, Clip);
}
AsciiToUnicode(sTemp, sPrint);
CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo((eWeaponType)WeaponType);
/*
DrawWeaponIcon
*/
if (FrontEndMenuManager.m_PrefsShowHud) {
float right = FrontEndMenuManager.m_PrefsUseWideScreen ? 468.6f : 470.0f;
float left = right - (FrontEndMenuManager.m_PrefsUseWideScreen ? 48.6f : 54.0f);
if (weaponInfo->m_nModelId <= 0) {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
if (FrontEndMenuManager.m_PrefsShowHud)
Sprites[WeaponType].Draw(
CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)),
CRGBA(255, 255, 255, alpha),
0.015f, 0.015f,
1.0f, 0.0f,
0.015f, 1.0f,
1.0f, 1.0f);
CRect(PSP_SCREEN_SCALE_X(left), PSP_SCREEN_SCALE_Y(16.0f), PSP_SCREEN_SCALE_X(right), PSP_SCREEN_SCALE_Y(60.0f)),
CRGBA(255, 255, 255, alpha));
} else {
CBaseModelInfo *weaponModel = CModelInfo::GetModelInfo(weaponInfo->m_nModelId);
RwTexDictionary *weaponTxd = CTxdStore::GetSlot(weaponModel->GetTxdSlot())->texDict;
@ -507,12 +472,8 @@ void CHud::Draw()
static CSprite2d sprite;
sprite.m_pTexture = weaponIcon;
sprite.Draw(
CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)),
CRGBA(255, 255, 255, alpha),
0.015f, 0.015f,
1.0f, 0.0f,
0.015f, 1.0f,
1.0f, 1.0f);
CRect(PSP_SCREEN_SCALE_X(left), PSP_SCREEN_SCALE_Y(16.0f), PSP_SCREEN_SCALE_X(right), PSP_SCREEN_SCALE_Y(60.0f)),
CRGBA(255, 255, 255, alpha));
sprite.m_pTexture = nil;
#endif
}
@ -520,7 +481,7 @@ void CHud::Draw()
}
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.8f));
CFont::SetScale(PSP_SCREEN_SCALE_X(FrontEndMenuManager.m_PrefsUseWideScreen ? 0.18f : 0.2f), PSP_SCREEN_SCALE_Y(0.44f));
CFont::SetJustifyOff();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
@ -528,13 +489,65 @@ void CHud::Draw()
CFont::SetDropShadowPosition(0);
CFont::SetFontStyle(FONT_STANDARD);
int32 AmmoAmount = CWeaponInfo::GetWeaponInfo((eWeaponType)WeaponType)->m_nAmountofAmmunition;
int32 AmmoInClip = weapon->m_nAmmoInClip;
int32 TotalAmmo = weapon->m_nAmmoTotal;
int32 Ammo, Clip;
if (Min(9999, TotalAmmo - AmmoInClip) != 9999 && !CDarkel::FrenzyOnGoing() && weaponInfo->m_nWeaponSlot > 1 && weapon->m_eWeaponType != WEAPONTYPE_DETONATOR) {
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, alpha));
AMMO_COLOR.a = alpha;
CFont::SetColor(AMMO_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud)
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(90.0f), sPrint);
if (FrontEndMenuManager.m_PrefsShowHud) {
if (AmmoAmount <= 1 || AmmoAmount >= 1000)
{
sprintf(sTemp, "%d", TotalAmmo);
AsciiToUnicode(sTemp, sPrint);
float pos = 435.0f;
#ifdef FIX_BUGS
if (FrontEndMenuManager.m_PrefsUseWideScreen)
pos = 438.0f;
#endif
CFont::PrintString(PSP_SCREEN_SCALE_FROM_RIGHT(PSP_DEFAULT_SCREEN_WIDTH - pos), PSP_SCREEN_SCALE_Y(42.0f), sPrint);
}
else {
if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
Clip = AmmoInClip / 10;
Ammo = Min((TotalAmmo - AmmoInClip) / 10, 9999);
}
else {
Clip = AmmoInClip;
Ammo = Min(TotalAmmo - AmmoInClip, 9999);
}
char sMinus[10];
char sAmmo[20];
char sClip[20];
sprintf(sMinus, "-");
sprintf(sAmmo, "%d", Ammo);
sprintf(sClip, "%d", Clip);
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
AsciiToUnicode(sAmmo, sPrint);
CFont::PrintString(PSP_SCREEN_SCALE_FROM_RIGHT(PSP_DEFAULT_SCREEN_WIDTH - (FrontEndMenuManager.m_PrefsUseWideScreen ? 438.0f : 435.0f)), PSP_SCREEN_SCALE_Y(42.0f), sPrint);
CFont::SetRightJustifyOff();
AsciiToUnicode(sMinus, sPrint);
CFont::PrintString(PSP_SCREEN_SCALE_FROM_RIGHT(PSP_DEFAULT_SCREEN_WIDTH - (FrontEndMenuManager.m_PrefsUseWideScreen ? 439.0f : 436.0f)), PSP_SCREEN_SCALE_Y(42.0f), sPrint);
AsciiToUnicode(sClip, sPrint);
CFont::PrintString(PSP_SCREEN_SCALE_FROM_RIGHT(PSP_DEFAULT_SCREEN_WIDTH - (FrontEndMenuManager.m_PrefsUseWideScreen ? 441.0f : 439.0f)), PSP_SCREEN_SCALE_Y(42.0f), sPrint);
}
}
CFont::SetDropShadowPosition(0);
}
}
@ -568,23 +581,8 @@ void CHud::Draw()
&& CTimer::GetFrameCounter() & 8) {
if (playerPed->m_fHealth >= 10
|| playerPed->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) {
AsciiToUnicode("{", sPrintIcon);
#ifdef FIX_BUGS
sprintf(sTemp, "%03d", int32(playerPed->m_fHealth + 0.5f));
#else
sprintf(sTemp, "%03d", (int32)playerPed->m_fHealth);
#endif
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(HEALTH_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud) {
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint);
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) {
// CFont::SetColor(HEALTH_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 54.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
}
DrawHealthBar(playerPed->m_fHealth);
}
}
}
@ -605,13 +603,7 @@ void CHud::Draw()
CFont::SetColor(ARMOUR_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud) {
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) {
// CFont::SetColor(ARMOUR_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f + 52.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
}
DrawArmourBar(playerPed->m_fArmour);
}
}
}
@ -628,36 +620,23 @@ void CHud::Draw()
}
if (m_WantedState != FADED_OUT) {
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_STANDARD);
AsciiToUnicode(">", sPrintIcon);
char wantedStar[] = "\x16";
float starX = 441.0f;
for (int i = 0; i < 6; i++) {
if (FrontEndMenuManager.m_PrefsShowHud) {
if (playerPed->m_pWanted->GetWantedLevel() > i
&& (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange
+ 2000 || CTimer::GetFrameCounter() & 4)) {
WANTED_COLOR.a = alpha;
CFont::SetColor(WANTED_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
DrawTimeAndCashNumbers(wantedStar, starX, 63.0f, false);
} else if (playerPed->m_pWanted->m_nMinWantedLevel > i && CTimer::GetFrameCounter() & 4) {
WANTED_COLOR_FLASH.a = alpha;
CFont::SetColor(WANTED_COLOR_FLASH);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
} else if (playerPed->m_pWanted->GetWantedLevel() <= i) {
NOTWANTED_COLOR.a = alpha;
CFont::SetColor(NOTWANTED_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
DrawTimeAndCashNumbers(wantedStar, starX, 63.0f, true);
}
if (FrontEndMenuManager.m_PrefsUseWideScreen)
starX -= 11.0f;
else
starX -= 13.5f;
}
}
}
@ -919,24 +898,8 @@ void CHud::Draw()
DrawClock
*/
if (m_ClockState) {
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CLOCK_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud)
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
DrawTime();
}
/*
@ -1142,20 +1105,20 @@ void CHud::Draw()
// Yeah, top and bottom changed place. R* vision
if (IntroRect.m_bIsUsed && IntroRect.m_bBeforeFade) {
if (IntroRect.m_nTextureId >= 0) {
CRect rect = {
CRect rect (
IntroRect.m_sRect.left,
IntroRect.m_sRect.top,
IntroRect.m_sRect.right,
IntroRect.m_sRect.bottom };
IntroRect.m_sRect.bottom );
CTheScripts::ScriptSprites[IntroRect.m_nTextureId].Draw(rect, IntroRect.m_sColor);
}
else {
CRect rect = {
CRect rect (
IntroRect.m_sRect.left,
IntroRect.m_sRect.top,
IntroRect.m_sRect.right,
IntroRect.m_sRect.bottom };
IntroRect.m_sRect.bottom );
CSprite2d::DrawRect(rect, IntroRect.m_sColor);
}
@ -1188,7 +1151,7 @@ void CHud::Draw()
if (FrontEndMenuManager.m_PrefsShowSubtitles || !CCutsceneMgr::IsRunning()) {
#ifdef CUTSCENE_BORDERS_SWITCH
if (!FrontEndMenuManager.m_PrefsCutsceneBorders)
CFont::SetDropShadowPosition(2);
CFont::SetDropShadowPosition(0);
#endif
CFont::SetCentreSize(SCREEN_WIDTH - SCREEN_SCALE_X(60.0f));
CFont::SetScale(SCREEN_SCALE_X(0.58f), SCREEN_SCALE_Y(1.2f));
@ -1200,7 +1163,7 @@ void CHud::Draw()
onceItWasWidescreen = false;
CFont::DrawFonts();
CFont::SetDropShadowPosition(2);
CFont::SetDropShadowPosition(0);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetScale(SCREEN_SCALE_X(0.58f), SCREEN_SCALE_Y(1.22f));
@ -1426,6 +1389,221 @@ void CHud::Draw()
}
}
int HealthFlashTimer = 50;
void
CHud::DrawHealthBar(int16 value)
{
if (m_ItemToFlash == ITEM_HEALTH) {
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth > 10.0f) {
if (HealthFlashTimer-- == 0) {
m_ItemToFlash = -1;
HealthFlashTimer = 50;
}
}
}
float fHealth = value;
float fMaxHealth = CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth;
fHealth = clamp(fHealth, 0.0f, fMaxHealth);
float fWidth = (fHealth / fMaxHealth) * 40.0f + 16.0f + 4.0f;
float u = fWidth / 64.0f;
if (value == 0) {
fWidth = 0.0f;
u = 0.0f;
} else if (value == fMaxHealth) {
fWidth = 64.0f;
u = 1.0f;
}
if (FrontEndMenuManager.m_PrefsUseWideScreen)
fWidth *= 0.68f;
else
fWidth *= 0.85f;
float fX1 = FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f;
float fX2 = fWidth + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
CRect rect1(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(40.0f), PSP_SCREEN_SCALE_X(fX2), PSP_SCREEN_SCALE_Y(50.0f));
CRGBA color1(255, 255, 255, m_HudAlpha);
Sprites[HUD_BAR_INSIDE2].Draw(rect1, color1, 0.0f, 0.0f, u, 0.0f, 0.0f, 1.0f, u, 1.0f);
fX1 = fWidth + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
fX2 = (FrontEndMenuManager.m_PrefsUseWideScreen ? 43.52f : 54.4f) + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
CRect rect2(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(40.0f), PSP_SCREEN_SCALE_X(fX2), PSP_SCREEN_SCALE_Y(50.0f));
CRGBA color2(255, 255, 255, m_HudAlpha);
Sprites[HUD_BAR_INSIDE2DARK].Draw(rect2, color2, u, 0.0f, 1.0f, 0.0f, u, 1.0f, 1.0f, 1.0f);
fX1 = FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f;
fX2 = (FrontEndMenuManager.m_PrefsUseWideScreen ? 43.52f : 54.4f) + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
CRect rect3(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(40.0f), PSP_SCREEN_SCALE_X(fX2), PSP_SCREEN_SCALE_Y(50.0f));
CRGBA color3(255, 255, 255, m_HudAlpha);
Sprites[HUD_BAR_OUTLINE].Draw(rect3, color3, 0.01f, 0.0f, 1.0f, 0.0f, 0.01f, 1.0f, 1.0f, 1.0f);
if (fMaxHealth > 100.0f)
{
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetDropShadowPosition(0);
CFont::SetDropColor(CRGBA(0, 0, 0, m_HudAlpha));
CFont::SetColor(CRGBA(255, 255, 255, m_HudAlpha));
CFont::SetCentreOn();
if (fMaxHealth > 125.0f)
CFont::SetScale(FrontEndMenuManager.StretchX(PSP_SCALE_TO_PS2_X(FrontEndMenuManager.m_PrefsUseWideScreen ? 0.3375f : 0.45f)), FrontEndMenuManager.StretchY(PSP_SCALE_TO_PS2_Y(0.75f)));
else
CFont::SetScale(FrontEndMenuManager.StretchX(PSP_SCALE_TO_PS2_X(FrontEndMenuManager.m_PrefsUseWideScreen ? 0.2625f : 0.35f)), FrontEndMenuManager.StretchY(PSP_SCALE_TO_PS2_Y(0.6f)));
if (FrontEndMenuManager.m_PrefsUseWideScreen)
fX1 = 375.0f + 12.0f;
else
fX1 = 360.0f + 15.0f;
CFont::PrintString(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(36.0f), (wchar*)L"+");
}
}
int ArmourFlashTimer = 50;
void
CHud::DrawArmourBar(int16 value)
{
if (m_ItemToFlash == ITEM_ARMOUR) {
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 10.0f) {
if (ArmourFlashTimer-- == 0) {
m_ItemToFlash = -1;
ArmourFlashTimer = 50;
}
}
}
float fArmour = value;
float fMaxArmour = CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour;
fArmour = clamp(fArmour, 0.0f, fMaxArmour);
float fWidth = (fArmour / fMaxArmour) * 40.0f + 16.0f + 4.0f;
float u = fWidth / 64.0f;
if (value == 0) {
fWidth = 0.0f;
u = 0.0f;
} else if (value == fMaxArmour) {
fWidth = 64.0f;
u = 1.0f;
}
if (FrontEndMenuManager.m_PrefsUseWideScreen)
fWidth *= 0.68f;
else
fWidth *= 0.85f;
float fX1 = FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f;
float fX2 = fWidth + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
CRect rect1(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(28.0f), PSP_SCREEN_SCALE_X(fX2), PSP_SCREEN_SCALE_Y(38.0f));
CRGBA color1(255, 255, 255, m_HudAlpha);
Sprites[HUD_BAR_INSIDE1].Draw(rect1, color1, 0.0f, 0.0f, u, 0.0f, 0.0f, 1.0f, u, 1.0f);
fX1 = fWidth + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
fX2 = (FrontEndMenuManager.m_PrefsUseWideScreen ? 43.52f : 54.4f) + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
CRect rect2(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(28.0f), PSP_SCREEN_SCALE_X(fX2), PSP_SCREEN_SCALE_Y(38.0f));
CRGBA color2(255, 255, 255, m_HudAlpha);
Sprites[HUD_BAR_INSIDE1DARK].Draw(rect2, color2, u, 0.0f, 1.0f, 0.0f, u, 1.0f, 1.0f, 1.0f);
fX1 = FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f;
fX2 = (FrontEndMenuManager.m_PrefsUseWideScreen ? 43.52f : 54.4f) + (FrontEndMenuManager.m_PrefsUseWideScreen ? 375.0f : 360.0f);
CRect rect3(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(28.0f), PSP_SCREEN_SCALE_X(fX2), PSP_SCREEN_SCALE_Y(38.0f));
CRGBA color3(255, 255, 255, m_HudAlpha);
Sprites[HUD_BAR_OUTLINE].Draw(rect3, color3, 0.01f, 0.0f, 1.0f, 0.0f, 0.01f, 1.0f, 1.0f, 1.0f);
if (fMaxArmour > 100.0f) {
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetDropShadowPosition(0);
CFont::SetDropColor(CRGBA(0, 0, 0, m_HudAlpha));
CFont::SetColor(CRGBA(255, 255, 255, m_HudAlpha));
CFont::SetCentreOn();
if (fMaxArmour > 125.0f)
CFont::SetScale(FrontEndMenuManager.StretchX(PSP_SCALE_TO_PS2_X(FrontEndMenuManager.m_PrefsUseWideScreen ? 0.3375f : 0.45f)), FrontEndMenuManager.StretchY(PSP_SCALE_TO_PS2_Y(0.75f)));
else
CFont::SetScale(FrontEndMenuManager.StretchX(PSP_SCALE_TO_PS2_X(FrontEndMenuManager.m_PrefsUseWideScreen ? 0.2625f : 0.35f)), FrontEndMenuManager.StretchY(PSP_SCALE_TO_PS2_Y(0.6f)));
if (FrontEndMenuManager.m_PrefsUseWideScreen)
fX1 = 375.0f + 12.0f;
else
fX1 = 360.0f + 15.0f;
CFont::PrintString(PSP_SCREEN_SCALE_X(fX1), PSP_SCREEN_SCALE_Y(24.0f), (wchar*)L"+");
}
}
void
CHud::DrawTimeAndCashNumbers(char *str, float x, float y, bool secondSet)
{
CRGBA color(255, 255, 255, m_HudAlpha);
float width = 11.0f;
if (FrontEndMenuManager.m_PrefsUseWideScreen)
width = 9.0f;
float height = 10.0f;
while (*str) {
uint8 c = *str;
if (c >= '0' && c <= ':')
{
if (secondSet) c -= '%';
else c -= '0';
} else {
if (c == 22) {
if (secondSet)
color = CRGBA(62, 141, 188, m_HudAlpha);
else
color = CRGBA(192, 155, 54, m_HudAlpha);
} else if (!secondSet)
c = 10;
else
c = 21;
}
int row = c / 8;
int col = c - row * 8;
float width2 = width;
if (c == 22)
width2 += 3.0f;
CRect rect(PSP_SCREEN_SCALE_X(x), PSP_SCREEN_SCALE_Y(y), PSP_SCREEN_SCALE_X(x+ width2), PSP_SCREEN_SCALE_Y(y) + PSP_SCREEN_SCALE_Y(height));
float u = col * 0.125f;
// TODO(LCS): some odd calculation with u going on in here if it's < 0, it might be fabs, but maybe not
float v = row * 0.265625f;
// TODO(LCS): same odd calculation with v as above
str++;
Sprites[HUD_HUDNUMBERS].Draw(rect, color, u, v, u + 0.125f, v, u, v + 0.265625f, u + 0.125f, v + 0.265625f);
x += (width - 2.0f);
if (c == 10)
x -= 4.0f;
#ifdef GTA_PSP
x = Ceil(PSP_SCREEN_SCALE_X(x)) * ((float)PSP_DEFAULT_SCREEN_WIDTH / (float)SCREEN_WIDTH);
#else
// BUG: actually above wasn't PSP only but on higher resolutions things don't look like they were meant to, so we stick with PS2 version here
x = Ceil(PSP_SCALE_TO_PS2_X(x)) * ((float)PSP_DEFAULT_SCREEN_WIDTH / (float)DEFAULT_SCREEN_WIDTH);
#endif
}
}
void
CHud::DrawCash()
{
char str[200];
sprintf(str, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
DrawTimeAndCashNumbers(str, FrontEndMenuManager.m_PrefsUseWideScreen ? 386.0f : 373.0f, 53.0f, true);
}
void
CHud::DrawTime()
{
// TODO(LCS): a lot more code should be here
char str[24];
sprintf(str, "%02d:%02d", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
DrawTimeAndCashNumbers(str, FrontEndMenuManager.m_PrefsUseWideScreen ? 386.0f : 373.0f, 17.0f, false);
}
void CHud::DrawAfterFade()
{
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);

View file

@ -38,7 +38,13 @@ enum eSprites
HUD_FIST,
HUD_SITEROCKET = 41,
HUD_RADARDISC = 50,
HUD_SITESNIPER = 63,
HUD_BAR_INSIDE1DARK = 57,
HUD_BAR_INSIDE2DARK,
HUD_HUDNUMBERS,
HUD_BAR_INSIDE1,
HUD_BAR_INSIDE2,
HUD_BAR_OUTLINE,
HUD_SITESNIPER,
HUD_SITEM16,
HUD_SITELASER,
HUD_LASERDOT,
@ -119,6 +125,7 @@ public:
static uint32 m_LastTimeEnergyLost;
static wchar* gLastPrintForeverString;
static uint8 m_HudAlpha;
public:
static void Draw();
@ -139,4 +146,9 @@ public:
static void Shutdown();
static float DrawFadeState(DRAW_FADE_STATE, int);
static void ResetWastedText(void);
static void DrawHealthBar(int16 value);
static void DrawArmourBar(int16 value);
static void DrawTimeAndCashNumbers(char *str, float x, float y, bool secondSet);
static void DrawCash();
static void DrawTime();
};

View file

@ -9,6 +9,6 @@ class CInstance : public CPlaceable
public:
int m_modelIndex;
public:
~CInstance() = default;
~CInstance() { }
void Shutdown();
};

View file

@ -1419,7 +1419,7 @@ CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8
}
CRGBA FoamColour(255, 255, 255, 255);
unsigned int CSpecialParticleStuff::BoatFromStart;
uint32 CSpecialParticleStuff::BoatFromStart;
void
CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles)

View file

@ -454,6 +454,14 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic)
RpAtomic*
CVisibilityPlugins::RenderVehicleHiDetailCB_Boat(RpAtomic *atomic)
{
if(DistToCameraSq < ms_vehicleLod0Dist)
RENDERCALLBACK(atomic);
return atomic;
}
RpAtomic*
CVisibilityPlugins::RenderVehicleHiDetailCB_Boat_Far(RpAtomic *atomic)
{
if(DistToCameraSq < ms_bigVehicleLod1Dist)
RENDERCALLBACK(atomic);
@ -473,6 +481,40 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic)
return atomic;
}
RpAtomic*
CVisibilityPlugins::RenderVehicleLoDetailCB_Boat(RpAtomic *atomic)
{
RpClump *clump;
int32 alpha;
clump = RpAtomicGetClump(atomic);
if(DistToCameraSq >= ms_vehicleLod0Dist){
alpha = GetClumpAlpha(clump);
if(alpha == 255)
RENDERCALLBACK(atomic);
else
RenderAlphaAtomic(atomic, alpha);
}
return atomic;
}
RpAtomic*
CVisibilityPlugins::RenderVehicleLoDetailCB_Boat_Far(RpAtomic *atomic)
{
RpClump *clump;
int32 alpha;
clump = RpAtomicGetClump(atomic);
if(DistToCameraSq >= ms_bigVehicleLod1Dist){
alpha = GetClumpAlpha(clump);
if(alpha == 255)
RENDERCALLBACK(atomic);
else
RenderAlphaAtomic(atomic, alpha);
}
return atomic;
}
RpAtomic*
CVisibilityPlugins::RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic)
{

View file

@ -61,6 +61,9 @@ public:
static RpAtomic *RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic);
static RpAtomic *RenderVehicleHiDetailCB_Boat(RpAtomic *atomic);
static RpAtomic *RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic);
static RpAtomic *RenderVehicleHiDetailCB_Boat_Far(RpAtomic *atomic);
static RpAtomic *RenderVehicleLoDetailCB_Boat(RpAtomic *atomic);
static RpAtomic *RenderVehicleLoDetailCB_Boat_Far(RpAtomic *atomic);
static RpAtomic *RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic);
static RpAtomic *RenderVehicleLowDetailAlphaCB_BigVehicle(RpAtomic *atomic);
static RpAtomic *RenderVehicleReallyLowDetailCB(RpAtomic *atomic);

View file

@ -21,7 +21,11 @@ char *_strdate(char *buf);
// As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, we only need type definitions so let's include <IntSafe.h>.
// NOTE: It's perfectly fine to include <Windows.h> here, but it can increase build size and time in *some* conditions, and maybe substantially in future if we'll use crossplatform.h more.
#ifndef _INC_WINDOWS
#ifndef __MWERKS__
#include <IntSafe.h>
#else
#include <Windows.h>
#endif
#endif
#if defined RW_D3D9 || defined RWLIBS
#include "win.h"

View file

@ -2099,22 +2099,30 @@ void CapturePad(RwInt32 padID)
const float *axes = glfwGetJoystickAxes(glfwPad, &numAxes);
GLFWgamepadstate gamepadState;
if (ControlsManager.m_bFirstCapture == false)
{
if (ControlsManager.m_bFirstCapture == false) {
memcpy(&ControlsManager.m_OldState, &ControlsManager.m_NewState, sizeof(ControlsManager.m_NewState));
} else {
// In case connected gamepad doesn't have L-R trigger axes.
ControlsManager.m_NewState.mappedButtons[15] = ControlsManager.m_NewState.mappedButtons[16] = 0;
}
ControlsManager.m_NewState.buttons = (uint8*)buttons;
ControlsManager.m_NewState.numButtons = numButtons;
ControlsManager.m_NewState.id = glfwPad;
ControlsManager.m_NewState.isGamepad = glfwJoystickIsGamepad(glfwPad);
ControlsManager.m_NewState.isGamepad = glfwGetGamepadState(glfwPad, &gamepadState);
if (ControlsManager.m_NewState.isGamepad) {
glfwGetGamepadState(glfwPad, &gamepadState);
memcpy(&ControlsManager.m_NewState.mappedButtons, gamepadState.buttons, sizeof(gamepadState.buttons));
ControlsManager.m_NewState.mappedButtons[15] = gamepadState.axes[4] > -0.8f;
ControlsManager.m_NewState.mappedButtons[16] = gamepadState.axes[5] > -0.8f;
float lt = gamepadState.axes[GLFW_GAMEPAD_AXIS_LEFT_TRIGGER], rt = gamepadState.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER];
// glfw returns 0.0 for non-existent axises(which is bullocks) so we treat it as deadzone, and keep value of previous frame.
// otherwise if this axis is present, -1 = released, 1 = pressed
if (lt != 0.0f)
ControlsManager.m_NewState.mappedButtons[15] = lt > -0.8f;
if (rt != 0.0f)
ControlsManager.m_NewState.mappedButtons[16] = rt > -0.8f;
}
// TODO I'm not sure how to find/what to do with L2-R2, if joystick isn't registered in SDL database.
// TODO? L2-R2 axes(not buttons-that's fine) on joysticks that don't have SDL gamepad mapping AREN'T handled, and I think it's impossible to do without mapping.
if (ControlsManager.m_bFirstCapture == true) {
memcpy(&ControlsManager.m_OldState, &ControlsManager.m_NewState, sizeof(ControlsManager.m_NewState));
@ -2128,12 +2136,13 @@ void CapturePad(RwInt32 padID)
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
// Gamepad axes are guaranteed to return 0.0f if that particular gamepad doesn't have that axis.
// And that's really good for sticks, because gamepads return 0.0 for them when sticks are in released state.
if ( glfwPad != -1 ) {
leftStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[0] : numAxes >= 1 ? axes[0] : 0.0f;
leftStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[1] : numAxes >= 2 ? axes[1] : 0.0f;
leftStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[GLFW_GAMEPAD_AXIS_LEFT_X] : numAxes >= 1 ? axes[0] : 0.0f;
leftStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[GLFW_GAMEPAD_AXIS_LEFT_Y] : numAxes >= 2 ? axes[1] : 0.0f;
rightStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[2] : numAxes >= 3 ? axes[2] : 0.0f;
rightStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[3] : numAxes >= 4 ? axes[3] : 0.0f;
rightStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[GLFW_GAMEPAD_AXIS_RIGHT_X] : numAxes >= 3 ? axes[2] : 0.0f;
rightStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[GLFW_GAMEPAD_AXIS_RIGHT_Y] : numAxes >= 4 ? axes[3] : 0.0f;
}
{

View file

@ -1,4 +1,4 @@
#if defined RW_D3D9 || defined RWLIBS
#if defined RW_D3D9 || defined RWLIBS || defined __MWERKS__
#define _WIN32_WINDOWS 0x0500
#define WINVER 0x0500
@ -19,6 +19,10 @@
#pragma warning( push )
#pragma warning( disable : 4005)
#ifdef __MWERKS__
#define MAPVK_VK_TO_CHAR (2) // this is missing from codewarrior win32 headers - but it gets used ... how?
#endif
#include <ddraw.h>
#include <DShow.h>
#pragma warning( pop )
@ -573,6 +577,9 @@ _RETEX:
}
}
#ifdef __MWERKS__
#pragma dont_inline on
#endif
void _psPrintCpuInfo()
{
RwUInt32 features = _psGetCpuFeatures();
@ -587,6 +594,9 @@ void _psPrintCpuInfo()
if ( FeaturesEx & 0x80000000 )
debug("with 3DNow");
}
#ifdef __MWERKS__
#pragma dont_inline off
#endif
#endif
/*

View file

@ -205,7 +205,7 @@ CText::GetNameOfLoadedMissionText(char *outName)
void
CText::ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *offset)
{
#if THIS_IS_STUPID
#ifdef THIS_IS_STUPID
char *_buf = (char*)buf;
for (int i = 0; i < sizeof(ChunkHeader); i++) {
CFileMgr::Read(file, &_buf[i], 1);
@ -323,7 +323,7 @@ CKeyArray::Load(size_t length, int file, size_t* offset)
entries = new CKeyEntry[numEntries];
rawbytes = (char*)entries;
#if THIS_IS_STUPID
#ifdef THIS_IS_STUPID
for (uint32 i = 0; i < length; i++) {
CFileMgr::Read(file, &rawbytes[i], 1);
(*offset)++;
@ -398,7 +398,7 @@ CKeyArray::Search(const char *key, uint8 *result)
#endif
*result = false;
#ifdef MASTER
sprintf(errstr, "%");
sprintf(errstr, "");
#else
sprintf(errstr, "%s missing", key);
#endif // MASTER
@ -417,7 +417,7 @@ CData::Load(size_t length, int file, size_t * offset)
chars = new wchar[numChars];
rawbytes = (char*)chars;
#if THIS_IS_STUPID
#ifdef THIS_IS_STUPID
for(uint32 i = 0; i < length; i++){
CFileMgr::Read(file, &rawbytes[i], 1);
(*offset)++;
@ -439,7 +439,7 @@ CData::Unload(void)
void
CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
{
#if THIS_IS_STUPID
#ifdef THIS_IS_STUPID
size_t num_of_entries = table_size / sizeof(CMissionTextOffsets::Entry);
for (size_t mi = 0; mi < num_of_entries; mi++) {
for (uint32 i = 0; i < sizeof(data[mi].szMissionName); i++) {

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "main.h"
#include "General.h"
@ -4174,7 +4174,7 @@ CAutomobile::dmgDrawCarCollidingParticles(const CVector &pos, float amount)
CGeneral::GetRandomNumberInRange(0.1f, 0.25f)),
nil,
CGeneral::GetRandomNumberInRange(0.02f, 0.08f),
CVehicleModelInfo::ms_vehicleColourTable[m_currentColour1],
CVehicleModelInfo::mspInfo->ms_vehicleColourTable[m_currentColour1],
CGeneral::GetRandomNumberInRange(-40.0f, 40.0f),
0,
CGeneral::GetRandomNumberInRange(0.0f, 4.0f));

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "main.h"
#include "General.h"

View file

@ -756,7 +756,7 @@ CHeli::InitHelis(void)
for(i = 0; i < NUM_HELIS; i++)
pHelis[i] = nil;
((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_CHOPPER))->SetColModel(&CTempColModels::ms_colModelPed1);
((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_CHOPPER))->SetColModel(&gpTempColModels->ms_colModelPed1);
}
CHeli*

View file

@ -218,8 +218,8 @@ void
CVehicle::SetModelIndex(uint32 id)
{
CEntity::SetModelIndex(id);
m_aExtras[0] = CVehicleModelInfo::ms_compsUsed[0];
m_aExtras[1] = CVehicleModelInfo::ms_compsUsed[1];
m_aExtras[0] = CVehicleModelInfo::mspInfo->ms_compsUsed[0];
m_aExtras[1] = CVehicleModelInfo::mspInfo->ms_compsUsed[1];
m_nNumMaxPassengers = CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(id);
}
@ -331,7 +331,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
case FLIGHT_MODEL_PLANE:
{
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
float fSteerUD = CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
float fGunUD = Abs(CPad::GetPad(0)->GetCarGunUpDown());
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))

View file

@ -513,7 +513,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
if ( SQR(victimPedRadius) > (victimPedPos-fireSource).MagnitudeSqr() )
{
CVector collisionDist;
CColModel* victimPedCol = &CTempColModels::ms_colModelPed1;
CColModel* victimPedCol = &gpTempColModels->ms_colModelPed1;
bool useLocalPos = false;
if (victimPed->m_nPedState == PED_FALL
|| victimPed->m_nPedState == PED_DIE && victimPed->bIsPedDieAnimPlaying

View file

@ -57,7 +57,7 @@ int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] =
-1, -1, -1, -1, -1, -1, -1, -1, -1
};
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
CWeaponInfo aWeaponInfo[WEAPONTYPE_TOTALWEAPONS];
char CWeaponInfo::ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32] =
{
"Unarmed",
@ -102,7 +102,7 @@ char CWeaponInfo::ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32] =
CWeaponInfo*
CWeaponInfo::GetWeaponInfo(eWeaponType weaponType)
{
return &ms_apWeaponInfos[weaponType];
return &aWeaponInfo[weaponType];
}
void
@ -110,27 +110,27 @@ CWeaponInfo::Initialise(void)
{
debug("Initialising CWeaponInfo...\n");
for (int i = 0; i < WEAPONTYPE_TOTALWEAPONS; i++) {
ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT;
ms_apWeaponInfos[i].m_fRange = 0.0f;
ms_apWeaponInfos[i].m_nFiringRate = 0;
ms_apWeaponInfos[i].m_nReload = 0;
ms_apWeaponInfos[i].m_nAmountofAmmunition = 0;
ms_apWeaponInfos[i].m_nDamage = 0;
ms_apWeaponInfos[i].m_fSpeed = 0.0f;
ms_apWeaponInfos[i].m_fRadius = 0.0f;
ms_apWeaponInfos[i].m_fLifespan = 0.0f;
ms_apWeaponInfos[i].m_fSpread = 0.0f;
ms_apWeaponInfos[i].m_vecFireOffset = CVector(0.0f, 0.0f, 0.0f);
ms_apWeaponInfos[i].m_AnimToPlay = ASSOCGRP_UNARMED;
ms_apWeaponInfos[i].m_fAnimLoopStart = 0.0f;
ms_apWeaponInfos[i].m_fAnimLoopEnd = 0.0f;
ms_apWeaponInfos[i].m_fAnimFrameFire = 0.0f;
ms_apWeaponInfos[i].m_fAnim2LoopStart = 0.0f;
ms_apWeaponInfos[i].m_fAnim2LoopEnd = 0.0f;
ms_apWeaponInfos[i].m_fAnim2FrameFire = 0.0f;
ms_apWeaponInfos[i].m_fAnimBreakout = 0.0f;
ms_apWeaponInfos[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES;
ms_apWeaponInfos[i].m_nWeaponSlot = WEAPONSLOT_UNARMED;
aWeaponInfo[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT;
aWeaponInfo[i].m_fRange = 0.0f;
aWeaponInfo[i].m_nFiringRate = 0;
aWeaponInfo[i].m_nReload = 0;
aWeaponInfo[i].m_nAmountofAmmunition = 0;
aWeaponInfo[i].m_nDamage = 0;
aWeaponInfo[i].m_fSpeed = 0.0f;
aWeaponInfo[i].m_fRadius = 0.0f;
aWeaponInfo[i].m_fLifespan = 0.0f;
aWeaponInfo[i].m_fSpread = 0.0f;
aWeaponInfo[i].m_vecFireOffset = CVector(0.0f, 0.0f, 0.0f);
aWeaponInfo[i].m_AnimToPlay = ASSOCGRP_UNARMED;
aWeaponInfo[i].m_fAnimLoopStart = 0.0f;
aWeaponInfo[i].m_fAnimLoopEnd = 0.0f;
aWeaponInfo[i].m_fAnimFrameFire = 0.0f;
aWeaponInfo[i].m_fAnim2LoopStart = 0.0f;
aWeaponInfo[i].m_fAnim2LoopEnd = 0.0f;
aWeaponInfo[i].m_fAnim2FrameFire = 0.0f;
aWeaponInfo[i].m_fAnimBreakout = 0.0f;
aWeaponInfo[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES;
aWeaponInfo[i].m_nWeaponSlot = WEAPONSLOT_UNARMED;
}
debug("Loading weapon data...\n");
LoadWeaponData();
@ -221,31 +221,31 @@ CWeaponInfo::LoadWeaponData(void)
CVector vecFireOffset(fireOffsetX, fireOffsetY, fireOffsetZ);
ms_apWeaponInfos[weaponType].m_eWeaponFire = FindWeaponFireType(fireType);
ms_apWeaponInfos[weaponType].m_fRange = range;
ms_apWeaponInfos[weaponType].m_nFiringRate = firingRate;
ms_apWeaponInfos[weaponType].m_nReload = reload;
ms_apWeaponInfos[weaponType].m_nAmountofAmmunition = ammoAmount;
ms_apWeaponInfos[weaponType].m_nDamage = damage;
ms_apWeaponInfos[weaponType].m_fSpeed = speed;
ms_apWeaponInfos[weaponType].m_fRadius = radius;
ms_apWeaponInfos[weaponType].m_fLifespan = lifeSpan;
ms_apWeaponInfos[weaponType].m_fSpread = spread;
ms_apWeaponInfos[weaponType].m_vecFireOffset = vecFireOffset;
ms_apWeaponInfos[weaponType].m_fAnimLoopStart = animLoopStart / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnimLoopEnd = animLoopEnd / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnim2LoopStart = anim2LoopStart / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnim2LoopEnd = anim2LoopEnd / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnimBreakout = animBreakout / 30.0f;
ms_apWeaponInfos[weaponType].m_nModelId = modelId;
ms_apWeaponInfos[weaponType].m_nModel2Id = modelId2;
ms_apWeaponInfos[weaponType].m_Flags = flags;
ms_apWeaponInfos[weaponType].m_nWeaponSlot = weaponSlot;
aWeaponInfo[weaponType].m_eWeaponFire = FindWeaponFireType(fireType);
aWeaponInfo[weaponType].m_fRange = range;
aWeaponInfo[weaponType].m_nFiringRate = firingRate;
aWeaponInfo[weaponType].m_nReload = reload;
aWeaponInfo[weaponType].m_nAmountofAmmunition = ammoAmount;
aWeaponInfo[weaponType].m_nDamage = damage;
aWeaponInfo[weaponType].m_fSpeed = speed;
aWeaponInfo[weaponType].m_fRadius = radius;
aWeaponInfo[weaponType].m_fLifespan = lifeSpan;
aWeaponInfo[weaponType].m_fSpread = spread;
aWeaponInfo[weaponType].m_vecFireOffset = vecFireOffset;
aWeaponInfo[weaponType].m_fAnimLoopStart = animLoopStart / 30.0f;
aWeaponInfo[weaponType].m_fAnimLoopEnd = animLoopEnd / 30.0f;
aWeaponInfo[weaponType].m_fAnim2LoopStart = anim2LoopStart / 30.0f;
aWeaponInfo[weaponType].m_fAnim2LoopEnd = anim2LoopEnd / 30.0f;
aWeaponInfo[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f;
aWeaponInfo[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f;
aWeaponInfo[weaponType].m_fAnimBreakout = animBreakout / 30.0f;
aWeaponInfo[weaponType].m_nModelId = modelId;
aWeaponInfo[weaponType].m_nModel2Id = modelId2;
aWeaponInfo[weaponType].m_Flags = flags;
aWeaponInfo[weaponType].m_nWeaponSlot = weaponSlot;
if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && !CWeapon::IsShotgun(weaponType))
ms_apWeaponInfos[weaponType].m_nFiringRate = ((ms_apWeaponInfos[weaponType].m_fAnimLoopEnd - ms_apWeaponInfos[weaponType].m_fAnimLoopStart) * 900.0f);
aWeaponInfo[weaponType].m_nFiringRate = ((aWeaponInfo[weaponType].m_fAnimLoopEnd - aWeaponInfo[weaponType].m_fAnimLoopStart) * 900.0f);
if (weaponType == WEAPONTYPE_DETONATOR || weaponType == WEAPONTYPE_HELICANNON)
modelId = -1;
@ -257,7 +257,7 @@ CWeaponInfo::LoadWeaponData(void)
for (int i = 0; i < NUM_ANIM_ASSOC_GROUPS; i++) {
if (!strcmp(animToPlay, CAnimManager::GetAnimGroupName((AssocGroupId)i))) {
ms_apWeaponInfos[weaponType].m_AnimToPlay = (AssocGroupId)i;
aWeaponInfo[weaponType].m_AnimToPlay = (AssocGroupId)i;
break;
}
}

View file

@ -31,7 +31,6 @@ enum
};
class CWeaponInfo {
static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
static char ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32];
public:
static uint16 ms_aReloadSampleTime[WEAPONTYPE_TOTALWEAPONS];

View file

@ -397,9 +397,6 @@ Valor del eje Z: ~1~
[DEAD]
¡ELIMINADO!
[BUSTED]
¡TRINCADO!
[GOODBOY]
~w~¡Bonificación de 50 $ por buen ciudadano!
@ -1228,9 +1225,6 @@ Instrucc.
[FEB_CON]
Controles
[FEB_AUD]
Sonido
[FEB_DIS]
Pantalla
@ -1249,9 +1243,6 @@ INSTRUCCIONES
[FEP_CON]
CONTROLES
[FEP_AUD]
SONIDO
[FEP_DIS]
PANTALLA
@ -1354,15 +1345,9 @@ ESTADÍSTICAS
[FEH_CON]
CONTROLES
[FEH_AUD]
SONIDO
[FEH_LAN]
IDIOMA
[FEH_SGA]
INICIAR NUEVA PARTIDA
[FET_SG]
GUARDAR PARTIDA
@ -1492,21 +1477,6 @@ Objeto
[LG_54]
Objetivo del jugador
[FEO_CON]
Config. de controles
[FEO_AUD]
Config. del sonido
[FEO_DIS]
Config. de la pantalla
[FEO_LAN]
Config. del idioma
[FEO_PLA]
Config. del jugador
[FEB_PMB]
Instrucciones de misiones previas:
@ -1630,9 +1600,6 @@ pad analógico
[FEC_DP]
botones de dirección
[FEA_SFX]
VOLUMEN EFECTOS:
[FEA_OUT]
Salida:
@ -1663,15 +1630,6 @@ RASTROS:
[FED_RDR]
MODO RADAR:
[FED_HUD]
MODO VISOR:
[FED_RDM]
MAPA Y PUNTOS
[FED_RDB]
SOLO PUNTOS
[FEL_ENG]
INGLÉS
@ -1774,27 +1732,6 @@ Test Delete:
[FEM_SL0]
Ranura0
[FEM_SL1]
No hay archivo guardado 1
[FEM_SL2]
No hay archivo guardado 2
[FEM_SL3]
No hay archivo guardado 3
[FEM_SL4]
No hay archivo guardado 4
[FEM_SL5]
No hay archivo guardado 5
[FEM_SL6]
No hay archivo guardado 6
[FEM_SL7]
No hay archivo guardado 7
[FES_LOA]
CARGAR PARTIDA
@ -2356,9 +2293,6 @@ Config. 4
[GOBACK]
Volver
[SOUND]
SONIDO
[MUSVOL]
Volumen música
@ -5071,9 +5005,6 @@ Por favor, espera...
[FEC_LOF]
Mirar hacia delante
[FEC_LFA]
Mirar\precisión
[MPHELP]
AYUDA
@ -5272,9 +5203,6 @@ Vuelve al coche de bomberos siempre que quieras e intenta batir tu mejor tiempo.
[PCJTIT]
GO GO Faggio
[FEA_MUS]
VOLUMEN DE LA RADIO:
[FEST_GO]
Mejor tiempo en "Go Go Faggio"
@ -6361,9 +6289,6 @@ Selecciona partida guardada para cargar:
[FES_DSC]
Éxito al borrar. Selecciona ACEPTAR para continuar.
[FES_DEL]
Borrar partida
[FES_DGM]
BORRAR PARTIDA
@ -6481,9 +6406,6 @@ joystick analógico izquierdo o botones de dirección
[FEC_ACB]
Acelerar/Frenar
[FEM_SL8]
No hay archivo guardado 8
[FES_SAV]
GUARDAR PARTIDA
@ -17455,6 +17377,475 @@ This track contains a sample of "Next Level" as performed by Showbiz & AG. Court
[CR19_20:CRED01]
~n~ ~n~Donna Young, Richie Zito
{ reLCS - new strings }
{ main menu }
[FEM_MM]
INICIO
[FEP_STG]
INICIAR JUEGO
[FEP_OPT]
OPCIONES
[FEP_QUI]
SALIR
[FET_QG]
SALIR
[FEQ_SRW]
¿Seguro que quieres salir?
{ options }
[FET_OPT]
OPCIONES
[FET_GRA]
Config. Gráficos
[FET_PS]
Config. Jugador
[FET_MIG]
IZQUIERDA, DERECHA o RUEDA DEL MOUSE: ajustar.
[FET_HRD]
Ajustes reiniciados.
[FET_APP]
CLICK IZQ. o ENTER para aplicar cambios.
{ controls }
[FET_CTL]
CONTROLES
[FET_CTI]
CONTROLES CLÁSICOS
[FET_STI]
CONTROLES ESTÁNDAR
[FEC_RED]
REDEFINIR CONTROLES
[FEC_MOUSE]
CONFIG. MOUSE
[FET_DEF]
Reiniciar Ajustes
{ mouse settings }
[FEC_MSH]
SENSIBILIDAD:
[FEC_IVV]
INVERTIR VERTICALMENTE:
[FET_MST]
CONDUCC. CON MOUSE:
{ audio }
[FEA_NM3]
NO HAY ARCHIVOS
[FEA_3DH]
HARDWARE:
[FEA_2SP]
2 Altavoces
[FET_DAM]
MODELADO ACÚSTICO DINÁMICO:
[FEA_4SP]
Más de 2 Altavoces
[FEA_EAR]
Auriculares
[FEA_MPB]
VOL. ARCHIVOS MP3:
[FEA_SPK]
CONFIG. ALTAVOCES:
[FEA_ADP]
AUTO-DETECTAR HARDWARE
[FET_RSC]
Hardware no disponible. Ajustes reiniciados.
{ display }
[FEM_LOD]
DISTANCIA VISIBLE:
[FEM_CSB]
BORDES EN CINEMÁTICAS:
[FEC_FRC]
CÁMARA LIBRE:
{ graphics }
[FED_RES]
RESOLUCIÓN:
[FED_FLS]
COMPLETA
[FED_WND]
VENTANA
[FEM_VSC]
SINC. AUDIO/VIDEO:
[FEM_FRM]
LIMITADOR DE FOTOGRAMAS:
[FED_AAS]
ANTI-ALIASING:
[FEM_2PR]
PS2 ALPHA TEST:
[FEM_MOB]
MÓVIL
[FED_MBL]
DESENFOQ. MOVIMIENTO:
[FEM_NRM]
NORMAL
[FEM_SIM]
SIMPLE
[FEM_SCF]
FORMATO DE PANTALLA:
[FED_CLF]
FILTRO DE COLOR:
{ skin }
[FES_SKN]
NOMBRE
[FES_DAT]
FECHA
[FES_SET]
USAR
[FET_DSN]
Predeterminado.bmp
{ pause menu }
[FET_PAU]
PAUSA
[FEP_RES]
CONTINUAR
[FEQ_SRE]
¿Seguro que quieres salir? Se perderá todo el progreso que hiciste. ¿Continuar?
{ map }
[MAP_YAH]
ESTÁS AQUÍ
[FEH_MPH]
MOUSE o FLECHAS: mover. REPÁG, AVPÁG o RUEDA DEL MOUSE: acercar/alejar. L: referencias. CLICK DCHO: fijar destino.
{ control keys }
[FET_CFT]
A PIE
[FET_CCR]
EN VEHÍCULO
[FEC_NMN]
NUM. ~1~
[FEC_ETR]
ENT
[FEC_DOT]
NUM.
[FEC_UPA]
ARRIBA
[FEC_DWA]
ABAJO
[FEC_RFA]
DERECHA
[FEC_PGU]
RE PÁG
[FEC_PGD]
AV PÁG
[FEC_RTN]
ENTER
[FEC_NUS]
NO USADO
[FEC_HME]
INICIO
[FEC_RCT]
CTRL DCHO
[FEC_LSF]
SHIFT IZQ
[FEC_DLL]
SUPR
[FEC_TAB]
TAB
[FEC_IBT]
-
[FEC_LCT]
CTRL IZQ
[FEC_MSL]
CLICK IZQ
[FEC_MWB]
RUEDA ABAJO
[FEC_MWF]
RUEDA ARRIBA
[FEC_SPC]
ESPACIO
[FEC_RSF]
SHIFT DCHO
[FEC_MSR]
CLICK DCHO
[FEC_CLK]
BLOQ MAYÚS
[FEC_MSM]
CLICK RUEDA
[FET_CIG]
RETROCESO: limpiar acción. CLICK IZQ. o ENTER: asignar/agregar.
[FET_EIG]
No se puede asignar un botón para ésta acción.
[FEC_CMP]
COMBO: MIRAR I+D
[FEC_LOR]
Mirar Derecha
[FEC_LOL]
Mirar Izquierda
[FEC_LBA]
Mirar Atrás
[FEC_IRT]
INSERTAR
[FEC_PLS]
NUM +
[FEC_QUE]
?????
[FEC_UNB]
SIN ASIGNAR
[FEC_ERI]
¡Error! Una o más acciones no están vinculadas a una tecla o botón. Verifica que todas las acciones estén configuradas.
[FEC_TFD]
Torreta+Inclinar Abajo
[FET_RIG]
Aprieta el botón/tecla que quieras para ésta acción.
[FEC_TFU]
Torreta+Inclinar Arriba
[FEC_TFR]
Mirar+Torreta (Dcha.)
[FEC_TFL]
Mirar+Torreta (Izqda.)
[FEC_ANS]
Acción
[FEC_HND]
Freno de Mano
[FEC_SPN]
Esprintar
[FEC_JMP]
Saltar
[FEC_CMR]
Cámara
[FEC_SUB]
Misión Secundaria
[FEC_HRN]
Claxon
[FEC_RAD]
Cambiar Emisora
[FEC_EEX]
Entrar+Salir
[FEC_ZOT]
Alejar Zoom
[FEC_ZIN]
Aumentar Zoom
[FEC_RIG]
Derecha
[FEC_LEF]
Izquierda
[FEC_CEN]
Centrar Cámara
[FEC_BAC]
Retroceder
[FEC_PTT]
Objetivo Anterior
[FEC_FOR]
Avanzar/Acelerar
[FEC_PWE]
Arma Anterior
[FEC_NWE]
Arma Siguiente
[FEC_FIR]
Atacar/Disparar
[FEC_NTR]
Objetivo Siguiente
[FEC_LDU]
Mirar Abajo
[FEC_LUD]
Mirar Arriba
{ improvements & fixes }
[FED_HUD]
MODO INTERFAZ:
[FED_RDM]
MAPA E ÍCONOS
[FED_RDB]
SOLO ÍCONOS
[FEA_MUS]
VOL. DE RADIO:
[FEA_SFX]
VOL. DE EFECTOS:
[BUSTED]
¡ARRESTADO!
[FEM_SL1]
Espacio Libre 1
[FEM_SL2]
Espacio Libre 2
[FEM_SL3]
Espacio Libre 3
[FEM_SL4]
Espacio Libre 4
[FEM_SL5]
Espacio Libre 5
[FEM_SL6]
Espacio Libre 6
[FEM_SL7]
Espacio Libre 7
[FEM_SL8]
Espacio Libre 8
[FES_DEL]
BORRAR PARTIDA
[FEO_CON]
Config. Controles
[FEO_AUD]
Config. Audio
[FEO_DIS]
Config. Pantalla
[FEO_LAN]
Config. Idioma
[FEO_PLA]
Config. Jugador
[FEB_AUD]
Audio
[FEP_AUD]
AUDIO
[FEH_AUD]
AUDIO
[SOUND]
AUDIO
[FEC_LFA]
IZQUIERDA
[FEH_SGA]
NUEVO JUEGO
[DUMMY]
THIS LABEL NEEDS TO BE HERE !!!
AS THE LAST LABEL DOES NOT GET COMPILED

Binary file not shown.

Binary file not shown.

View file

@ -22,7 +22,7 @@ extern "C" {
#endif
/** Deprecated macro. */
/* Deprecated macros. */
#define OPENAL
#define ALAPI AL_API
#define ALAPIENTRY AL_APIENTRY
@ -30,7 +30,7 @@ extern "C" {
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
/** Supported AL version. */
/* Supported AL versions. */
#define AL_VERSION_1_0
#define AL_VERSION_1_1
@ -234,7 +234,7 @@ typedef void ALvoid;
*/
#define AL_SOURCE_STATE 0x1010
/** Source state value. */
/* Source state values. */
#define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013
@ -300,7 +300,7 @@ typedef void ALvoid;
* Source maximum distance.
* Type: ALfloat
* Range: [0.0 - ]
* Default: +inf
* Default: FLT_MAX
*
* The distance above which the source is not attenuated any further with a
* clamped distance model, or where attenuation reaches 0.0 gain for linear
@ -330,15 +330,18 @@ typedef void ALvoid;
*/
#define AL_SOURCE_TYPE 0x1027
/** Source type value. */
/* Source type values. */
#define AL_STATIC 0x1028
#define AL_STREAMING 0x1029
#define AL_UNDETERMINED 0x1030
/** Buffer format specifier. */
/** Unsigned 8-bit mono buffer format. */
#define AL_FORMAT_MONO8 0x1100
/** Signed 16-bit mono buffer format. */
#define AL_FORMAT_MONO16 0x1101
/** Unsigned 8-bit stereo buffer format. */
#define AL_FORMAT_STEREO8 0x1102
/** Signed 16-bit stereo buffer format. */
#define AL_FORMAT_STEREO16 0x1103
/** Buffer frequency (query only). */
@ -350,11 +353,7 @@ typedef void ALvoid;
/** Buffer data size (query only). */
#define AL_SIZE 0x2004
/**
* Buffer state.
*
* Not for public use.
*/
/* Buffer state. Not for public use. */
#define AL_UNUSED 0x2010
#define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012
@ -441,7 +440,7 @@ AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value);
#define AL_DISTANCE_MODEL 0xD000
AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
/** Distance model value. */
/* Distance model values. */
#define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
#define AL_LINEAR_DISTANCE 0xD003
@ -449,12 +448,12 @@ AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
#define AL_EXPONENT_DISTANCE 0xD005
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
/** Renderer State management. */
/* Renderer State management. */
AL_API void AL_APIENTRY alEnable(ALenum capability);
AL_API void AL_APIENTRY alDisable(ALenum capability);
AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability);
/** State retrieval. */
/* State retrieval. */
AL_API const ALchar* AL_APIENTRY alGetString(ALenum param);
AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values);
AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values);
@ -465,25 +464,25 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum param);
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param);
AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param);
/**
* Error retrieval.
*
* Obtain the first error generated in the AL context since the last check.
*/
/* Error retrieval. */
/** Obtain the first error generated in the AL context since the last check. */
AL_API ALenum AL_APIENTRY alGetError(void);
/**
* Extension support.
*
* Query for the presence of an extension, and obtain any appropriate function
* pointers and enum values.
*/
/** Query for the presence of an extension on the AL context. */
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname);
/**
* Retrieve the address of a function. The returned function may be context-
* specific.
*/
AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname);
/**
* Retrieve the value of an enum. The returned value may be context-specific.
*/
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename);
/** Set Listener parameters */
/* Set Listener parameters */
AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value);
AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values);
@ -491,7 +490,7 @@ AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value);
AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3);
AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values);
/** Get Listener parameters */
/* Get Listener parameters */
AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value);
AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values);
@ -507,7 +506,7 @@ AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources);
/** Verify a handle is a valid Source. */
AL_API ALboolean AL_APIENTRY alIsSource(ALuint source);
/** Set Source parameters. */
/* Set Source parameters. */
AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value);
AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values);
@ -515,7 +514,7 @@ AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value);
AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values);
/** Get Source parameters. */
/* Get Source parameters. */
AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value);
AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values);
@ -558,7 +557,7 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer);
/** Specifies the data to be copied into a buffer */
AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
/** Set Buffer parameters, */
/* Set Buffer parameters, */
AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value);
AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values);
@ -566,7 +565,7 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value);
AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values);
/** Get Buffer parameters. */
/* Get Buffer parameters. */
AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value);
AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values);
@ -574,7 +573,7 @@ AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value);
AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values);
/** Pointer-to-function type, useful for dynamically getting AL entry points. */
/* Pointer-to-function type, useful for dynamically getting AL entry points. */
typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability);
typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability);
typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability);

View file

@ -22,7 +22,7 @@ extern "C" {
#endif
/** Deprecated macro. */
/* Deprecated macros. */
#define ALCAPI ALC_API
#define ALCAPIENTRY ALC_APIENTRY
#define ALC_INVALID 0
@ -89,7 +89,7 @@ typedef void ALCvoid;
/** Context attribute: <int> Hz. */
#define ALC_REFRESH 0x1008
/** Context attribute: AL_TRUE or AL_FALSE. */
/** Context attribute: AL_TRUE or AL_FALSE synchronous context? */
#define ALC_SYNC 0x1009
/** Context attribute: <int> requested Mono (3D) Sources. */
@ -117,12 +117,14 @@ typedef void ALCvoid;
#define ALC_OUT_OF_MEMORY 0xA005
/** Runtime ALC version. */
/** Runtime ALC major version. */
#define ALC_MAJOR_VERSION 0x1000
/** Runtime ALC minor version. */
#define ALC_MINOR_VERSION 0x1001
/** Context attribute list properties. */
/** Context attribute list size. */
#define ALC_ATTRIBUTES_SIZE 0x1002
/** Context attribute list properties. */
#define ALC_ALL_ATTRIBUTES 0x1003
/** String for the default device specifier. */
@ -166,49 +168,80 @@ typedef void ALCvoid;
#define ALC_ALL_DEVICES_SPECIFIER 0x1013
/** Context management. */
/* Context management. */
/** Create and attach a context to the given device. */
ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrlist);
/**
* Makes the given context the active process-wide context. Passing NULL clears
* the active context.
*/
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context);
/** Resumes processing updates for the given context. */
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context);
/** Suspends updates for the given context. */
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context);
/** Remove a context from its device and destroys it. */
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context);
/** Returns the currently active context. */
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void);
/** Returns the device that a particular context is attached to. */
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context);
/** Device management. */
/* Device management. */
/** Opens the named playback device. */
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename);
/** Closes the given playback device. */
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device);
/* Error support. */
/**
* Error support.
*
* Obtain the most recent Device error.
*/
/** Obtain the most recent Device error. */
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device);
/* Extension support. */
/**
* Extension support.
*
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
* Query for the presence of an extension on the device. Pass a NULL device to
* query a device-inspecific extension.
*/
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname);
ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
/**
* Retrieve the address of a function. Given a non-NULL device, the returned
* function may be device-specific.
*/
ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
/**
* Retrieve the value of an enum. Given a non-NULL device, the returned value
* may be device-specific.
*/
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname);
/** Query function. */
/* Query functions. */
/** Returns information about the device, and error strings. */
ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param);
/** Returns information about the device and the version of OpenAL. */
ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
/** Capture function. */
/* Capture functions. */
/**
* Opens the named capture device with the given frequency, format, and buffer
* size.
*/
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
/** Closes the given capture device. */
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device);
/** Starts capturing samples into the device buffer. */
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device);
/** Stops capturing samples. Samples in the device buffer remain available. */
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device);
/** Reads samples from the device buffer. */
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
/** Pointer-to-function type, useful for dynamically getting ALC entry points. */
/* Pointer-to-function type, useful for dynamically getting ALC entry points. */
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context);
@ -220,7 +253,7 @@ typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device);
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device);
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
typedef void* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param);
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);

View file

@ -25,6 +25,8 @@
/* Define int64_t and uint64_t types */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__cplusplus) && __cplusplus >= 201103L
#include <cinttypes>
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
@ -158,9 +160,9 @@ extern "C" {
#ifndef AL_EXT_STATIC_BUFFER
#define AL_EXT_STATIC_BUFFER 1
typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
typedef void (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
AL_API void AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
#endif
#endif
@ -193,9 +195,9 @@ ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
#define AL_SOFT_buffer_sub_data 1
#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
typedef void (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
AL_API void AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
#endif
#endif
@ -381,11 +383,11 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64
#ifndef AL_SOFT_deferred_updates
#define AL_SOFT_deferred_updates 1
#define AL_DEFERRED_UPDATES_SOFT 0xC002
typedef ALvoid (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void);
typedef ALvoid (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void);
typedef void (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void);
typedef void (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void);
AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void);
AL_API void AL_APIENTRY alDeferUpdatesSOFT(void);
AL_API void AL_APIENTRY alProcessUpdatesSOFT(void);
#endif
#endif
@ -530,6 +532,52 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname,
#define AL_N3D_SOFT 0x0002
#endif
#ifndef ALC_SOFT_loopback_bformat
#define ALC_SOFT_loopback_bformat 1
#define ALC_AMBISONIC_LAYOUT_SOFT 0x1997
#define ALC_AMBISONIC_SCALING_SOFT 0x1998
#define ALC_AMBISONIC_ORDER_SOFT 0x1999
#define ALC_MAX_AMBISONIC_ORDER_SOFT 0x199B
#define ALC_BFORMAT3D_SOFT 0x1507
/* Ambisonic layouts */
#define ALC_FUMA_SOFT 0x0000
#define ALC_ACN_SOFT 0x0001
/* Ambisonic scalings (normalization) */
/*#define ALC_FUMA_SOFT*/
#define ALC_SN3D_SOFT 0x0001
#define ALC_N3D_SOFT 0x0002
#endif
#ifndef AL_SOFT_effect_target
#define AL_SOFT_effect_target
#define AL_EFFECTSLOT_TARGET_SOFT 0x199C
#endif
#ifndef AL_SOFT_events
#define AL_SOFT_events 1
#define AL_EVENT_CALLBACK_FUNCTION_SOFT 0x19A2
#define AL_EVENT_CALLBACK_USER_PARAM_SOFT 0x19A3
#define AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT 0x19A4
#define AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT 0x19A5
#define AL_EVENT_TYPE_DISCONNECTED_SOFT 0x19A6
typedef void (AL_APIENTRY*ALEVENTPROCSOFT)(ALenum eventType, ALuint object, ALuint param,
ALsizei length, const ALchar *message,
void *userParam);
typedef void (AL_APIENTRY*LPALEVENTCONTROLSOFT)(ALsizei count, const ALenum *types, ALboolean enable);
typedef void (AL_APIENTRY*LPALEVENTCALLBACKSOFT)(ALEVENTPROCSOFT callback, void *userParam);
typedef void* (AL_APIENTRY*LPALGETPOINTERSOFT)(ALenum pname);
typedef void (AL_APIENTRY*LPALGETPOINTERVSOFT)(ALenum pname, void **values);
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable);
AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam);
AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname);
AL_API void AL_APIENTRY alGetPointervSOFT(ALenum pname, void **values);
#endif
#endif
#ifdef __cplusplus
}
#endif

View file

@ -243,41 +243,41 @@ typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects);
AL_API void AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
AL_API void AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects);
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues);
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
AL_API void AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
AL_API void AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues);
AL_API void AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
AL_API void AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues);
AL_API void AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
AL_API void AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API void AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
AL_API void AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters);
AL_API void AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
AL_API void AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters);
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues);
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
AL_API void AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
AL_API void AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues);
AL_API void AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
AL_API void AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues);
AL_API void AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
AL_API void AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API void AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
AL_API void AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots);
AL_API void AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API void AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots);
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
AL_API void AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
AL_API void AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues);
AL_API void AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
AL_API void AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
#endif
/* Filter ranges and defaults. */

Binary file not shown.

Binary file not shown.