mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-25 03:42:34 +01:00
- support content override for SetupSpecDenting and SetupSpecCosmetics
This commit is contained in:
parent
062879d2d4
commit
dab138ac49
@ -25,7 +25,9 @@ CAR_COSMETICS car_cosmetics[MAX_CAR_MODELS];
|
||||
CAR_COSMETICS levelSpecCosmetics[5];
|
||||
#endif
|
||||
|
||||
#ifndef PSX
|
||||
#if USE_PC_FILESYSTEM
|
||||
extern int gContentOverride;
|
||||
|
||||
// [A] loads car cosmetics from file
|
||||
void LoadCustomCarCosmetics(CAR_COSMETICS* dest, int modelNumber)
|
||||
{
|
||||
@ -67,8 +69,7 @@ void ProcessCosmeticsLump(char *lump_ptr, int lump_size)
|
||||
offset = *(int*)(lump_ptr + model * sizeof(int));
|
||||
car_cosmetics[i] = *(CAR_COSMETICS*)((u_char*)lump_ptr + offset);
|
||||
|
||||
#ifndef PSX
|
||||
extern int gContentOverride;
|
||||
#if USE_PC_FILESYSTEM
|
||||
if(gContentOverride)
|
||||
LoadCustomCarCosmetics(&car_cosmetics[i], model);
|
||||
#endif
|
||||
@ -145,6 +146,11 @@ void SetupSpecCosmetics(char *loadbuffer)
|
||||
car_cosmetics[4] = *(CAR_COSMETICS*)loadbuffer;
|
||||
#endif
|
||||
|
||||
#if USE_PC_FILESYSTEM
|
||||
if (gContentOverride)
|
||||
LoadCustomCarCosmetics(&car_cosmetics[4], model);
|
||||
#endif
|
||||
|
||||
// [A] don't forget
|
||||
FixCarCos(&car_cosmetics[4], model);
|
||||
}
|
||||
|
@ -12,6 +12,29 @@
|
||||
#include "players.h"
|
||||
#include "main.h"
|
||||
|
||||
#if USE_PC_FILESYSTEM
|
||||
extern int gContentOverride;
|
||||
|
||||
// [A] loads car model from file
|
||||
char* LoadCustomCarDentingFromFile(char* dest, int modelNumber)
|
||||
{
|
||||
char* mem;
|
||||
char filename[64];
|
||||
|
||||
sprintf(filename, "LEVELS\\%s\\CARMODEL_%d.DEN", LevelNames[GameLevel], modelNumber);
|
||||
if (FileExists(filename))
|
||||
{
|
||||
mem = dest ? dest : ((char*)_other_buffer + modelNumber * 4096);
|
||||
|
||||
// get model from file
|
||||
Loadfile(filename, mem);
|
||||
return mem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
char* DentingFiles[] =
|
||||
{
|
||||
"LEVELS\\CHICAGO.DEN",
|
||||
@ -377,27 +400,6 @@ void MoveHubcap()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PSX
|
||||
// [A] loads car model from file
|
||||
char* LoadCarDentingFromFile(char* dest, int modelNumber)
|
||||
{
|
||||
char* mem;
|
||||
char filename[64];
|
||||
|
||||
sprintf(filename, "LEVELS\\%s\\CARMODEL_%d.DEN", LevelNames[GameLevel], modelNumber);
|
||||
if(FileExists(filename))
|
||||
{
|
||||
mem = dest ? dest : ((char*)_other_buffer + modelNumber * 4096);
|
||||
|
||||
// get model from file
|
||||
Loadfile(filename, mem);
|
||||
return mem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// [D] [T]
|
||||
void ProcessDentLump(char *lump_ptr, int lump_size)
|
||||
{
|
||||
@ -424,11 +426,11 @@ void ProcessDentLump(char *lump_ptr, int lump_size)
|
||||
{
|
||||
offset = *(int *)(lump_ptr + model * 4);
|
||||
mem = (u_char*)lump_ptr;
|
||||
#ifndef PSX
|
||||
extern int gContentOverride;
|
||||
#if USE_PC_FILESYSTEM
|
||||
if (gContentOverride)
|
||||
{
|
||||
char* newDenting = LoadCarDentingFromFile(NULL, model);
|
||||
char* newDenting;
|
||||
newDenting = LoadCustomCarDentingFromFile(NULL, model);
|
||||
if (newDenting)
|
||||
{
|
||||
mem = (u_char*)newDenting;
|
||||
@ -454,6 +456,20 @@ void SetupSpecDenting(char *loadbuffer)
|
||||
{
|
||||
int offset;
|
||||
|
||||
#if USE_PC_FILESYSTEM
|
||||
if (gContentOverride)
|
||||
{
|
||||
char* newDenting;
|
||||
int model;
|
||||
model = MissionHeader->residentModels[4];
|
||||
|
||||
newDenting = LoadCustomCarDentingFromFile(NULL, model);
|
||||
if (newDenting)
|
||||
loadbuffer = newDenting;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// [A] this is better
|
||||
memcpy((u_char*)gCarDamageZoneVerts[4], (u_char*)loadbuffer, NUM_DAMAGE_ZONES * MAX_FILE_DAMAGE_ZONE_VERTS);
|
||||
offset = NUM_DAMAGE_ZONES * MAX_FILE_DAMAGE_ZONE_VERTS;
|
||||
|
Loading…
Reference in New Issue
Block a user