Merge pull request #1 from GTAmodding/master

update
This commit is contained in:
Fire_Head
2020-12-29 20:51:37 +03:00
committed by GitHub
77 changed files with 2611 additions and 959 deletions

View File

@ -2986,12 +2986,12 @@ CCamera::LoadTrainCamNodes(char const *name)
char token[16] = { 0 };
char filename[16] = { 0 };
uint8 *buf;
size_t bufpos = 0;
ssize_t bufpos = 0;
int field = 0;
int tokpos = 0;
char c;
int i;
size_t len;
ssize_t len;
strcpy(filename, name);
len = (int)strlen(filename);

View File

@ -73,7 +73,11 @@ CdStreamInitThread(void)
gChannelRequestQ.size = gNumChannels + 1;
ASSERT(gChannelRequestQ.items != nil );
#ifdef FIX_BUGS
gCdStreamSema = CreateSemaphore(nil, 0, 5, nil);
#else
gCdStreamSema = CreateSemaphore(nil, 0, 5, "CdStream");
#endif
if ( gCdStreamSema == nil )
{

View File

@ -132,6 +132,10 @@ void CControllerConfigManager::LoadSettings(int32 file)
{
bool bValid = true;
#ifdef BIND_VEHICLE_FIREWEAPON
bool skipVehicleFireWeapon = false;
#endif
if (file)
{
char buff[29];
@ -139,18 +143,55 @@ void CControllerConfigManager::LoadSettings(int32 file)
if (!strncmp(buff, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1))
bValid = false;
else
else {
CFileMgr::Seek(file, 0, 0);
#ifdef BIND_VEHICLE_FIREWEAPON
// HACK!
// All of this is hacky as fuck.
// We are checking the file size to read the .set file correctly.
// But because .set file is opened in text mode we have to read
// the WHOLE file to get the size we should be working with.
// Joy, ain't it?
char tempBuf[0x1000];
size_t fileSize = 0, blockSize;
do
{
blockSize = CFileMgr::Read(file, tempBuf, sizeof(tempBuf));
fileSize += blockSize;
} while (blockSize == sizeof(tempBuf));
CFileMgr::Seek(file, 0, 0);
if (fileSize == 0x671)
skipVehicleFireWeapon = true;
#endif
}
}
if (bValid)
{
ControlsManager.MakeControllerActionsBlank();
#ifdef BIND_VEHICLE_FIREWEAPON
// Set the default settings of VEHICLE_FIREWEAPON
if (skipVehicleFireWeapon) {
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, rsPADINS, KEYBOARD);
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA);
if (m_bMouseAssociated)
SetMouseButtonAssociatedWithAction(VEHICLE_FIREWEAPON, 1);
}
#endif
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
{
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++)
{
#ifdef BIND_VEHICLE_FIREWEAPON
// Skip file read
if (skipVehicleFireWeapon && j == VEHICLE_FIREWEAPON)
continue;
#endif
CFileMgr::Read(file, (char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind));
}
}
@ -1718,6 +1759,52 @@ void CControllerConfigManager::DeleteMatching1rstPersonControls(e_ControllerActi
#undef CLEAR_ACTION_IF_NEEDED
#ifdef RADIO_SCROLL_TO_PREV_STATION
#define CHECK_ACTION(action) \
if (key == GetControllerKeyAssociatedWithAction(action, type))\
return true;
bool CControllerConfigManager::IsAnyVehicleActionAssignedToMouseKey(int32 key)
{
const eControllerType type = MOUSE;
if (!GetIsKeyBlank(key, type))
{
#ifdef BIND_VEHICLE_FIREWEAPON
CHECK_ACTION(VEHICLE_FIREWEAPON);
#endif
CHECK_ACTION(VEHICLE_LOOKBEHIND);
CHECK_ACTION(VEHICLE_LOOKLEFT);
CHECK_ACTION(VEHICLE_LOOKRIGHT);
CHECK_ACTION(VEHICLE_LOOKBEHIND); // note: duplicate
CHECK_ACTION(VEHICLE_HORN);
CHECK_ACTION(VEHICLE_HANDBRAKE);
CHECK_ACTION(VEHICLE_ACCELERATE);
CHECK_ACTION(VEHICLE_BRAKE);
CHECK_ACTION(VEHICLE_CHANGE_RADIO_STATION);
CHECK_ACTION(TOGGLE_SUBMISSIONS);
CHECK_ACTION(VEHICLE_TURRETLEFT);
CHECK_ACTION(VEHICLE_TURRETRIGHT);
CHECK_ACTION(VEHICLE_TURRETUP);
CHECK_ACTION(VEHICLE_TURRETDOWN);
CHECK_ACTION(VEHICLE_ENTER_EXIT);
CHECK_ACTION(CAMERA_CHANGE_VIEW_ALL_SITUATIONS);
#ifndef BIND_VEHICLE_FIREWEAPON
CHECK_ACTION(PED_FIREWEAPON);
#endif
CHECK_ACTION(GO_LEFT);
CHECK_ACTION(GO_RIGHT);
CHECK_ACTION(NETWORK_TALK);
CHECK_ACTION(SWITCH_DEBUG_CAM_ON);
CHECK_ACTION(TOGGLE_DPAD);
CHECK_ACTION(TAKE_SCREEN_SHOT);
CHECK_ACTION(SHOW_MOUSE_POINTER_TOGGLE);
}
return false;
}
#undef CHECK_ACTION
#endif
void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction action, int32 key, eControllerType type)
{
if (!GetIsKeyBlank(key, type))

View File

@ -188,6 +188,10 @@ public:
void DeleteMatching1rstPersonControls (e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatchingActionInitiators (e_ControllerAction action, int32 key, eControllerType type);
#ifdef RADIO_SCROLL_TO_PREV_STATION
bool IsAnyVehicleActionAssignedToMouseKey(int32 key);
#endif
bool GetIsKeyBlank(int32 key, eControllerType type);
e_ControllerActionType GetActionType(e_ControllerAction action);

View File

@ -120,7 +120,7 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent
}
if(criminal == FindPlayerPed())
ReportCrimeForEvent(type, (uintptr)ent, copsDontCare);
ReportCrimeForEvent(type, (intptr)ent, copsDontCare);
}
void
@ -198,7 +198,7 @@ CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
}
void
CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare)
CEventList::ReportCrimeForEvent(eEventType type, intptr crimeId, bool copsDontCare)
{
eCrimeType crime;
switch(type){

View File

@ -59,7 +59,7 @@ public:
static bool GetEvent(eEventType type, int32 *event);
static void ClearEvent(int32 event);
static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
static void ReportCrimeForEvent(eEventType type, int32, bool);
static void ReportCrimeForEvent(eEventType type, intptr, bool);
};
extern CEvent gaEvent[NUMEVENTS];

View File

@ -72,7 +72,11 @@ CFileLoader::LoadLevel(const char *filename)
if(*line == '#')
continue;
if(strncmp(line, "EXIT", 9) == 0) // BUG: 9?
#ifdef FIX_BUGS
if(strncmp(line, "EXIT", 4) == 0)
#else
if(strncmp(line, "EXIT", 9) == 0)
#endif
break;
if(strncmp(line, "IMAGEPATH", 9) == 0){
@ -191,7 +195,7 @@ CFileLoader::LoadTexDictionary(const char *filename)
struct ColHeader
{
char ident[4];
uint32 ident;
uint32 size;
};
@ -209,7 +213,7 @@ CFileLoader::LoadCollisionFile(const char *filename)
fd = CFileMgr::OpenFile(filename, "rb");
while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){
assert(strncmp(header.ident, "COLL", 4) == 0);
assert(header.ident == 'LLOC');
CFileMgr::Read(fd, (char*)work_buff, header.size);
memcpy(modelname, work_buff, 24);
@ -863,6 +867,9 @@ CFileLoader::AddTexDictionaries(RwTexDictionary *dst, RwTexDictionary *src)
RwTexDictionaryForAllTextures(src, MoveTexturesCB, dst);
}
#define isLine3(l, a, b, c) ((l[0] == a) && (l[1] == b) && (l[2] == c))
#define isLine4(l, a, b, c, d) ((l[0] == a) && (l[1] == b) && (l[2] == c) && (l[3] == d))
void
CFileLoader::LoadObjectTypes(const char *filename)
{
@ -896,18 +903,18 @@ CFileLoader::LoadObjectTypes(const char *filename)
continue;
if(section == NONE){
if(strncmp(line, "objs", 4) == 0) section = OBJS;
else if(strncmp(line, "tobj", 4) == 0) section = TOBJ;
else if(strncmp(line, "hier", 4) == 0) section = HIER;
else if(strncmp(line, "cars", 4) == 0) section = CARS;
else if(strncmp(line, "peds", 4) == 0) section = PEDS;
else if(strncmp(line, "path", 4) == 0) section = PATH;
else if(strncmp(line, "2dfx", 4) == 0) section = TWODFX;
}else if(strncmp(line, "end", 3) == 0){
if(isLine4(line, 'o','b','j','s')) section = OBJS;
else if(isLine4(line, 't','o','b','j')) section = TOBJ;
else if(isLine4(line, 'h','i','e','r')) section = HIER;
else if(isLine4(line, 'c','a','r','s')) section = CARS;
else if(isLine4(line, 'p','e','d','s')) section = PEDS;
else if(isLine4(line, 'p','a','t','h')) section = PATH;
else if(isLine4(line, '2','d','f','x')) section = TWODFX;
}else if(isLine3(line, 'e','n','d')){
section = section == MLO ? OBJS : NONE;
}else switch(section){
case OBJS:
if(strncmp(line, "sta", 3) == 0)
if(isLine3(line, 's','t','a'))
mlo = LoadMLO(line);
else
LoadObject(line);
@ -930,9 +937,9 @@ CFileLoader::LoadObjectTypes(const char *filename)
case PATH:
if(pathIndex == -1){
id = LoadPathHeader(line, pathTypeStr);
if(strncmp(pathTypeStr, "ped", 4) == 0)
if(strcmp(pathTypeStr, "ped") == 0)
pathType = 1;
else if(strncmp(pathTypeStr, "car", 4) == 0)
else if(strcmp(pathTypeStr, "car") == 0)
pathType = 0;
pathIndex = 0;
}else{
@ -1173,21 +1180,21 @@ CFileLoader::LoadVehicleObject(const char *line)
mi->m_level = level;
mi->m_compRules = comprules;
if(strncmp(type, "car", 4) == 0){
if(strcmp(type, "car") == 0){
mi->m_wheelId = misc;
mi->m_wheelScale = wheelScale;
mi->m_vehicleType = VEHICLE_TYPE_CAR;
}else if(strncmp(type, "boat", 5) == 0){
}else if(strcmp(type, "boat") == 0){
mi->m_vehicleType = VEHICLE_TYPE_BOAT;
}else if(strncmp(type, "train", 6) == 0){
}else if(strcmp(type, "train") == 0){
mi->m_vehicleType = VEHICLE_TYPE_TRAIN;
}else if(strncmp(type, "heli", 5) == 0){
}else if(strcmp(type, "heli") == 0){
mi->m_vehicleType = VEHICLE_TYPE_HELI;
}else if(strncmp(type, "plane", 6) == 0){
}else if(strcmp(type, "plane") == 0){
mi->m_planeLodId = misc;
mi->m_wheelScale = 1.0f;
mi->m_vehicleType = VEHICLE_TYPE_PLANE;
}else if(strncmp(type, "bike", 5) == 0){
}else if(strcmp(type, "bike") == 0){
mi->m_bikeSteerAngle = misc;
mi->m_wheelScale = wheelScale;
mi->m_vehicleType = VEHICLE_TYPE_BIKE;
@ -1197,31 +1204,31 @@ CFileLoader::LoadVehicleObject(const char *line)
mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId);
// Well this is kinda dumb....
if(strncmp(vehclass, "poorfamily", 11) == 0){
if(strcmp(vehclass, "poorfamily") == 0){
mi->m_vehicleClass = CCarCtrl::POOR;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::POOR);
}else if(strncmp(vehclass, "richfamily", 11) == 0){
}else if(strcmp(vehclass, "richfamily") == 0){
mi->m_vehicleClass = CCarCtrl::RICH;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::RICH);
}else if(strncmp(vehclass, "executive", 10) == 0){
}else if(strcmp(vehclass, "executive") == 0){
mi->m_vehicleClass = CCarCtrl::EXEC;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC);
}else if(strncmp(vehclass, "worker", 7) == 0){
}else if(strcmp(vehclass, "worker") == 0){
mi->m_vehicleClass = CCarCtrl::WORKER;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER);
}else if(strncmp(vehclass, "special", 8) == 0){
}else if(strcmp(vehclass, "special") == 0){
mi->m_vehicleClass = CCarCtrl::SPECIAL;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::SPECIAL);
}else if(strncmp(vehclass, "big", 4) == 0){
}else if(strcmp(vehclass, "big") == 0){
mi->m_vehicleClass = CCarCtrl::BIG;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::BIG);
}else if(strncmp(vehclass, "taxi", 5) == 0){
}else if(strcmp(vehclass, "taxi") == 0){
mi->m_vehicleClass = CCarCtrl::TAXI;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::TAXI);
@ -1402,12 +1409,12 @@ CFileLoader::LoadScene(const char *filename)
continue;
if(section == NONE){
if(strncmp(line, "inst", 4) == 0) section = INST;
else if(strncmp(line, "zone", 4) == 0) section = ZONE;
else if(strncmp(line, "cull", 4) == 0) section = CULL;
else if(strncmp(line, "pick", 4) == 0) section = PICK;
else if(strncmp(line, "path", 4) == 0) section = PATH;
}else if(strncmp(line, "end", 3) == 0){
if(isLine4(line, 'i','n','s','t')) section = INST;
else if(isLine4(line, 'z','o','n','e')) section = ZONE;
else if(isLine4(line, 'c','u','l','l')) section = CULL;
else if(isLine4(line, 'p','i','c','k')) section = PICK;
else if(isLine4(line, 'p','a','t','h')) section = PATH;
}else if(isLine3(line, 'e','n','d')){
section = NONE;
}else switch(section){
case INST:
@ -1427,6 +1434,7 @@ CFileLoader::LoadScene(const char *filename)
// unfinished in the game
if(pathIndex == -1){
LoadPathHeader(line, pathTypeStr);
strcmp(pathTypeStr, "ped");
// type not set
pathIndex = 0;
}else{
@ -1564,8 +1572,8 @@ CFileLoader::LoadMapZones(const char *filename)
continue;
if(section == NONE){
if(strncmp(line, "zone", 4) == 0) section = ZONE;
}else if(strncmp(line, "end", 3) == 0){
if(isLine4(line, 'z','o','n','e')) section = ZONE;
}else if(isLine3(line, 'e','n','d')){
section = NONE;
}else switch(section){
case ZONE: {
@ -1607,20 +1615,20 @@ CFileLoader::ReloadPaths(const char *filename)
continue;
if (section == NONE) {
if (strncmp(line, "path", 4) == 0) {
if (isLine4(line, 'p','a','t','h')) {
section = PATH;
ThePaths.AllocatePathFindInfoMem(4500);
}
} else if (strncmp(line, "end", 3) == 0) {
} else if (isLine3(line, 'e','n','d')) {
section = NONE;
} else {
switch (section) {
case PATH:
if (pathIndex == -1) {
id = LoadPathHeader(line, pathTypeStr);
if (strncmp(pathTypeStr, "ped", 4) == 0)
if (strcmp(pathTypeStr, "ped") == 0)
pathType = 1;
else if (strncmp(pathTypeStr, "car", 4) == 0)
else if (strcmp(pathTypeStr, "car") == 0)
pathType = 0;
pathIndex = 0;
} else {
@ -1663,10 +1671,10 @@ CFileLoader::ReloadObjectTypes(const char *filename)
continue;
if (section == NONE) {
if (strncmp(line, "objs", 4) == 0) section = OBJS;
else if (strncmp(line, "tobj", 4) == 0) section = TOBJ;
else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX;
} else if (strncmp(line, "end", 3) == 0) {
if (isLine4(line, 'o','b','j','s')) section = OBJS;
else if (isLine4(line, 't','o','b','j')) section = TOBJ;
else if (isLine4(line, '2','d','f','x')) section = TWODFX;
} else if (isLine3(line, 'e','n','d')) {
section = NONE;
} else {
switch (section) {
@ -1738,7 +1746,11 @@ CFileLoader::ReLoadScene(const char *filename)
if (*line == '#')
continue;
if (strncmp(line, "EXIT", 9) == 0) // BUG: 9?
#ifdef FIX_BUGS
if (strncmp(line, "EXIT", 4) == 0)
#else
if (strncmp(line, "EXIT", 9) == 0)
#endif
break;
if (strncmp(line, "IDE", 3) == 0) {

View File

@ -240,20 +240,22 @@ CFileMgr::SetDirMyDocuments(void)
mychdir(_psGetUserFilesFolder());
}
size_t
ssize_t
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
{
int fd;
size_t n, len;
ssize_t n, len;
fd = myfopen(file, mode);
if(fd == 0)
return 0;
return -1;
len = 0;
do{
n = myfread(buf + len, 1, 0x4000, fd);
if(n < 0)
#ifndef FIX_BUGS
if (n < 0)
return -1;
#endif
len += n;
}while(n == 0x4000);
buf[len] = 0;
@ -274,13 +276,13 @@ CFileMgr::OpenFileForWriting(const char *file)
}
size_t
CFileMgr::Read(int fd, const char *buf, int len)
CFileMgr::Read(int fd, const char *buf, ssize_t len)
{
return myfread((void*)buf, 1, len, fd);
}
size_t
CFileMgr::Write(int fd, const char *buf, int len)
CFileMgr::Write(int fd, const char *buf, ssize_t len)
{
return myfwrite((void*)buf, 1, len, fd);
}

View File

@ -9,12 +9,12 @@ public:
static void ChangeDir(const char *dir);
static void SetDir(const char *dir);
static void SetDirMyDocuments(void);
static size_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static int OpenFile(const char *file, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);
static size_t Read(int fd, const char *buf, int len);
static size_t Write(int fd, const char *buf, int len);
static size_t Read(int fd, const char *buf, ssize_t len);
static size_t Write(int fd, const char *buf, ssize_t len);
static bool Seek(int fd, int offset, int whence);
static bool ReadLine(int fd, char *buf, int len);
static int CloseFile(int fd);

View File

@ -43,7 +43,7 @@ CFire::ProcessFire(void)
float fDamagePlayer;
float fDamagePeds;
float fDamageVehicle;
int8 nRandNumber;
int16 nRandNumber;
float fGreen;
float fRed;
CVector lightpos;
@ -135,11 +135,10 @@ CFire::ProcessFire(void)
CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2,
nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
}
fGreen = nRandNumber / 128;
fRed = nRandNumber / 128;
fGreen = nRandNumber / 128.f;
fRed = nRandNumber / 128.f;
CPointLights::AddLight(0, m_vecPos, CVector(0.0f, 0.0f, 0.0f),
12.0f, fRed, fGreen, 0, 0, 0);
CPointLights::AddLight(CPointLights::LIGHT_POINT, m_vecPos, CVector(0.0f, 0.0f, 0.0f), 12.0f, fRed, fGreen, 0, 0, 0);
} else {
Extinguish();
}

View File

@ -174,7 +174,12 @@ bool CMenuManager::m_PrefsAllowNastyGame = true;
bool CMenuManager::m_bStartUpFrontEndRequested;
bool CMenuManager::m_bShutDownFrontEndRequested;
#ifdef ASPECT_RATIO_SCALE
int8 CMenuManager::m_PrefsUseWideScreen = AR_AUTO;
#else
int8 CMenuManager::m_PrefsUseWideScreen;
#endif
int8 CMenuManager::m_PrefsRadioStation;
int32 CMenuManager::m_PrefsBrightness = 256;
float CMenuManager::m_PrefsLOD = CRenderer::ms_lodDistScale;
@ -921,7 +926,11 @@ CMenuManager::CheckSliderMovement(int value)
case MENUACTION_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f);
#ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#else
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl;
#endif
break;
default:
return;
@ -1318,7 +1327,7 @@ CMenuManager::Draw()
#endif
// Hide back button
#ifdef PS2_LIKE_MENU
if ((i == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i+1].m_EntryName[0] == '\0') && strncmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEDS_TB", 8) == 0)
if ((i == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i+1].m_EntryName[0] == '\0') && strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEDS_TB") == 0)
break;
#endif
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') {
@ -1624,7 +1633,7 @@ CMenuManager::Draw()
// Hide back button
#ifdef PS2_LIKE_MENU
if ((rowToCheck == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[rowToCheck+1].m_EntryName[0] == '\0') &&
strncmp(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_EntryName, "FEDS_TB", 8) == 0)
strcmp(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_EntryName, "FEDS_TB") == 0)
break;
#endif
@ -3074,7 +3083,7 @@ CMenuManager::DrawPlayerSetupScreen()
SYSTEMTIME SystemTime;
HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
if (strncmp(FindFileData.cFileName, DEFAULT_SKIN_NAME, 5) != 0) {
if (strcmp(FindFileData.cFileName, DEFAULT_SKIN_NAME) != 0) {
m_pSelectedSkin->nextSkin = new tSkinInfo;
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
m_pSelectedSkin->skinId = nextSkinId;
@ -3748,6 +3757,7 @@ CMenuManager::LoadSettings()
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
}
#ifdef LOAD_INI_SETTINGS
LoadINISettings(); // needs frontend options to be loaded
#endif
@ -4479,13 +4489,21 @@ CMenuManager::ProcessButtonPresses(void)
case HOVEROPTION_INCREASE_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl += (1.0f / 3000);
TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200);
#ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#else
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl;
#endif
SaveSettings();
break;
case HOVEROPTION_DECREASE_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl -= (1.0f / 3000);
TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200);
#ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#else
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl;
#endif
SaveSettings();
break;
}
@ -4658,15 +4676,15 @@ CMenuManager::ProcessButtonPresses(void)
// Hide back button
#ifdef PS2_LIKE_MENU
if ((goUp || goDown) && m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME && strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0)
if ((goUp || goDown) && m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME && strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") == 0)
m_nCurrOption = goUp ? m_nCurrOption - 1 : (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL);
#endif
if (optionSelected) {
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
if ((option == MENUACTION_CHANGEMENU) || (option == MENUACTION_POPULATESLOTS_CHANGEMENU)) {
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) != 0 &&
strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA", 8) != 0) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") != 0 &&
strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA") != 0) {
if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) {
if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY)
@ -4823,7 +4841,7 @@ CMenuManager::ProcessButtonPresses(void)
}
}
if (changeMenu) {
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") == 0) {
#ifndef TIDY_UP_PBP
ResetHelperText();
ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
@ -4982,7 +5000,11 @@ CMenuManager::ProcessButtonPresses(void)
m_PrefsLOD = 1.2f;
m_PrefsVsync = true;
CRenderer::ms_lodDistScale = 1.2f;
#ifdef ASPECT_RATIO_SCALE
m_PrefsUseWideScreen = AR_AUTO;
#else
m_PrefsUseWideScreen = false;
#endif
m_PrefsShowSubtitles = true;
m_nDisplayVideoMode = m_nPrefsVideoMode;
#if GTA_VERSION >= GTA3_PC_11
@ -5023,7 +5045,12 @@ CMenuManager::ProcessButtonPresses(void)
}
#endif
m_ControlMethod = CONTROL_STANDARD;
#ifdef FIX_BUGS
MousePointerStateHelper.bInvertVertically = true;
TheCamera.m_fMouseAccelVertical = 0.003f;
#else
MousePointerStateHelper.bInvertVertically = false;
#endif
TheCamera.m_fMouseAccelHorzntl = 0.0025f;
CVehicle::m_bDisableMouseSteering = true;
TheCamera.m_bHeadBob = false;
@ -6085,7 +6112,7 @@ CMenuManager::PrintMap(void)
CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_MOV")); nextX = MENU_X(30.0f); nextY -= 11.0f;
TEXT_PIECE("FEC_MSR", 2.0f);
TEXT_PIECE("FEC_IBT", 1.0f);
CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_TAR"));
CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEM_TWP"));
#undef TEXT_PIECE
}

View File

@ -32,6 +32,7 @@
#include "Fluff.h"
#include "Font.h"
#include "Frontend.h"
#include "frontendoption.h"
#include "GameLogic.h"
#include "Garages.h"
#include "GenericGameStorage.h"
@ -167,6 +168,11 @@ CGame::InitialiseOnceBeforeRW(void)
ValidateVersion();
#ifdef EXTENDED_COLOURFILTER
CPostFX::InitOnce();
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
// Not needed here but may be needed in future
// if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0)
CustomFrontendOptionsPopulate();
#endif
return true;
}

View File

@ -121,6 +121,15 @@ public:
return *str2 != '\0';
}
static bool faststrncmp(const char *str1, const char *str2, uint32 count)
{
for(uint32 i = 0; *str1 && i < count; str1++, str2++, i++) {
if (*str1 != *str2)
return true;
}
return false;
}
static bool faststricmp(const char *str1, const char *str2)
{
for (; *str1; str1++, str2++) {

View File

@ -67,16 +67,6 @@
#define POSTFX_SELECTORS
#endif
#ifdef EXTENDED_PIPELINES
#define PIPELINES_SELECTOR \
MENUACTION_CFO_SELECT, "FED_VPL", { new CCFOSelect((int8*)&CustomPipes::VehiclePipeSwitch, "VehiclePipeline", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), false, nil) }, \
MENUACTION_CFO_SELECT, "FED_PRM", { new CCFOSelect((int8*)&CustomPipes::RimlightEnable, "NeoRimLight", off_on, 2, false, nil) }, \
MENUACTION_CFO_SELECT, "FED_WLM", { new CCFOSelect((int8*)&CustomPipes::LightmapEnable, "NeoLightMaps", off_on, 2, false, nil) }, \
MENUACTION_CFO_SELECT, "FED_RGL", { new CCFOSelect((int8*)&CustomPipes::GlossEnable, "NeoRoadGloss", off_on, 2, false, nil) },
#else
#define PIPELINES_SELECTOR
#endif
#ifdef INVERT_LOOK_FOR_PAD
#define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_IVP", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "InvertPad", off_on, 2, false, nil) },
#else
@ -90,7 +80,6 @@
#endif
const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" };
const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
void RestoreDefGraphics(int8 action) {
@ -420,7 +409,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
CUTSCENE_BORDERS_TOGGLE
FREE_CAM_TOGGLE
POSTFX_SELECTORS
PIPELINES_SELECTOR
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
@ -848,14 +837,14 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MULTISAMPLING_SELECTOR
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
#ifdef EXTENDED_COLOURFILTER
POSTFX_SELECTORS
#else
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#endif
PIPELINES_SELECTOR
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},

View File

@ -21,6 +21,66 @@ CReferences::Init(void)
aRefs[NUMREFERENCES-1].next = nil;
}
void
CEntity::RegisterReference(CEntity **pent)
{
if(IsBuilding())
return;
CReference *ref;
// check if already registered
for(ref = m_pFirstReference; ref; ref = ref->next)
if(ref->pentity == pent)
return;
// have to allocate new reference
ref = CReferences::pEmptyList;
if(ref){
CReferences::pEmptyList = ref->next;
ref->pentity = pent;
ref->next = m_pFirstReference;
m_pFirstReference = ref;
return;
}
return;
}
// Clear all references to this entity
void
CEntity::ResolveReferences(void)
{
CReference *ref;
// clear pointers to this entity
for(ref = m_pFirstReference; ref; ref = ref->next)
if(*ref->pentity == this)
*ref->pentity = nil;
// free list
if(m_pFirstReference){
for(ref = m_pFirstReference; ref->next; ref = ref->next)
;
ref->next = CReferences::pEmptyList;
CReferences::pEmptyList = m_pFirstReference;
m_pFirstReference = nil;
}
}
// Free all references that no longer point to this entity
void
CEntity::PruneReferences(void)
{
CReference *ref, *next, **lastnextp;
lastnextp = &m_pFirstReference;
for(ref = m_pFirstReference; ref; ref = next){
next = ref->next;
if(*ref->pentity == this)
lastnextp = &ref->next;
else{
*lastnextp = ref->next;
ref->next = CReferences::pEmptyList;
CReferences::pEmptyList = ref;
}
}
}
void
CReferences::RemoveReferencesToPlayer(void)
{

View File

@ -140,7 +140,7 @@ public:
static bool RemoveLeastUsedModel(void);
static void RemoveAllUnusedModels(void);
static void RemoveUnusedModelsInLoadedList(void);
static bool RemoveReferencedTxds(size_t mem);
static bool RemoveReferencedTxds(size_t mem); // originally signed
static int32 GetAvailableVehicleSlot(void);
static bool IsTxdUsedByRequestedModels(int32 txdId);
static bool AddToLoadedVehiclesList(int32 modelId);
@ -176,11 +176,11 @@ public:
static void DeleteFarAwayRwObjects(const CVector &pos);
static void DeleteAllRwObjects(void);
static void DeleteRwObjectsAfterDeath(const CVector &pos);
static void DeleteRwObjectsBehindCamera(size_t mem);
static void DeleteRwObjectsBehindCamera(size_t mem); // originally signed
static void DeleteRwObjectsInSectorList(CPtrList &list);
static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y);
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem);
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem);
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem); // originally signed
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem); // originally signed
static void LoadScene(const CVector &pos);

View File

@ -1600,14 +1600,24 @@ CWorld::ExtinguishAllCarFiresInArea(CVector point, float range)
}
}
inline void
AddSteamsFromGround(CPtrList& list)
{
CPtrNode *pNode = list.first;
while (pNode) {
((CEntity*)pNode->item)->AddSteamsFromGround(nil);
pNode = pNode->next;
}
}
void
CWorld::AddParticles(void)
{
for(int32 y = 0; y < NUMSECTORS_Y; y++) {
for(int32 x = 0; x < NUMSECTORS_X; x++) {
CSector *pSector = GetSector(x, y);
CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
}
}
}

View File

@ -73,11 +73,16 @@ typedef int16_t int16;
typedef uint32_t uint32;
typedef int32_t int32;
typedef uintptr_t uintptr;
typedef intptr_t intptr;
typedef uint64_t uint64;
typedef int64_t int64;
// hardcode ucs-2
typedef uint16_t wchar;
#if defined(_MSC_VER)
typedef ptrdiff_t ssize_t;
#endif
#ifndef nil
#define nil NULL
#endif

View File

@ -249,17 +249,14 @@ enum Config {
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
//#define USE_TEXTURE_POOL
#ifdef LIBRW
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
//#define SCREEN_DROPLETS // neo water droplets
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
#define SCREEN_DROPLETS // neo water droplets
#endif
#ifndef EXTENDED_COLOURFILTER
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
#endif
#ifndef EXTENDED_PIPELINES
#undef SCREEN_DROPLETS // we need neo.txd
#endif
// Particle
//#define PC_PARTICLE
@ -277,7 +274,7 @@ enum Config {
#define ALLCARSHELI_CHEAT
#define ALT_DODO_CHEAT
#define REGISTER_START_BUTTON
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
#define BUTTON_ICONS // use textures to show controller buttons
// Hud, frontend and radar
@ -286,6 +283,7 @@ enum Config {
// #define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
// #define XBOX_SUBTITLES // the infamous outlines
#define RADIO_OFF_TEXT
#define PC_MENU
#ifndef PC_MENU
@ -350,6 +348,7 @@ enum Config {
#define FREE_CAM // Rotating cam
// Audio
#define RADIO_SCROLL_TO_PREV_STATION
#ifndef AUDIO_OAL // is not working yet for openal
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
#endif

View File

@ -66,7 +66,6 @@
#include "postfx.h"
#include "custompipes.h"
#include "screendroplets.h"
#include "frontendoption.h"
#include "MemoryHeap.h"
GlobalScene Scene;
@ -481,13 +480,6 @@ Initialise3D(void *param)
DebugMenuInit();
DebugMenuPopulate();
#endif // !DEBUGMENU
#ifdef CUSTOM_FRONTEND_OPTIONS
// Apparently this func. can be run multiple times at the start.
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
// needs stored language and TheText to be loaded, and last TheText reload is at the start of here
CustomFrontendOptionsPopulate();
}
#endif
bool ret = CGame::InitialiseRenderWare();
#ifdef EXTENDED_PIPELINES
CustomPipes::CustomPipeInit(); // need Scene.world for this

View File

@ -30,9 +30,9 @@
#include "postfx.h"
#include "custompipes.h"
#include "MemoryHeap.h"
#include "FileMgr.h"
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#include "FileMgr.h"
#include "ControllerConfig.h"
#endif
@ -79,6 +79,30 @@ void
CustomFrontendOptionsPopulate(void)
{
// Moved to an array in MenuScreensCustom.cpp, but APIs are still available. see frontendoption.h
// These work only if we have neo folder, so they're dynamically added
#ifdef EXTENDED_PIPELINES
const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
int fd = CFileMgr::OpenFile("neo/neo.txd","r");
if (fd) {
#ifdef GRAPHICS_MENU_OPTIONS
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#endif
CFileMgr::CloseFile(fd);
}
#endif
}
#endif