mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-09-09 06:00:52 +02:00
col repack for liberty
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -377,6 +377,7 @@ liberty/dca-liberty-sim.elf
|
||||
liberty/animtool*
|
||||
liberty/texconv*
|
||||
liberty/imgtool*
|
||||
liberty/coltool*
|
||||
liberty/extract-sfx*
|
||||
liberty/pack-sfx*
|
||||
liberty/analyze-profile*
|
||||
@@ -395,6 +396,7 @@ miami/dca-miami-sim.elf
|
||||
miami/animtool*
|
||||
miami/texconv*
|
||||
miami/imgtool*
|
||||
miami/coltool*
|
||||
miami/extract-sfx*
|
||||
miami/pack-sfx*
|
||||
miami/analyze-profile*
|
||||
|
@@ -293,6 +293,9 @@ texconv: $(OBJS_TEXCONV) | pvrtex # You'll have to rebuild pvrtex manually if yo
|
||||
animtool: ../src/tools/animtool.cpp
|
||||
$(CXX) -std=c++17 -o $@ -g -O0 $<
|
||||
|
||||
coltool: ../src/tools/coltool.cpp
|
||||
$(CXX) -std=c++17 -o $@ -g -O0 $<
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
#### Repacking ####
|
||||
@@ -520,6 +523,22 @@ $(REPACK_GTA_DIR)/%.IFP: $(GTA_DIR)/%.IFP animtool
|
||||
@mkdir -p $(@D)
|
||||
./animtool $< $@
|
||||
|
||||
# first try the mods loose directory
|
||||
$(REPACK_GTA_DIR)/%.col: $(GTA_MOD_LOOSE_DIR)/%.col coltool
|
||||
@mkdir -p $(@D)
|
||||
./coltool $< $@
|
||||
$(REPACK_GTA_DIR)/%.COL: $(GTA_MOD_LOOSE_DIR)/%.COL coltool
|
||||
@mkdir -p $(@D)
|
||||
./coltool $< $@
|
||||
|
||||
#if not, the original files
|
||||
$(REPACK_GTA_DIR)/%.col: $(GTA_DIR)/%.col coltool
|
||||
@mkdir -p $(@D)
|
||||
./coltool $< $@
|
||||
$(REPACK_GTA_DIR)/%.COL: $(GTA_DIR)/%.COL coltool
|
||||
@mkdir -p $(@D)
|
||||
./coltool $< $@
|
||||
|
||||
$(REPACK_DIR)/packed: $(IMG_TEXTURES_DC) $(IMG_MODELS_DC)
|
||||
mkdir -p $(@D)
|
||||
mkdir -p "$(REPACK_GTA_DIR)/models/gta3"
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# models/coll/peds.col # not actually used
|
||||
|
||||
MISC_FILES = \
|
||||
anim/cuts.dir \
|
||||
anim/cuts.img \
|
||||
@@ -110,7 +112,6 @@ MISC_FILES = \
|
||||
models/Coll/commer.col \
|
||||
models/Coll/generic.col \
|
||||
models/Coll/indust.col \
|
||||
models/Coll/peds.col \
|
||||
models/Coll/suburb.col \
|
||||
models/Coll/vehicles.col \
|
||||
models/Coll/weapons.col \
|
||||
|
@@ -299,7 +299,7 @@ texconv: $(OBJS_TEXCONV) | pvrtex # You'll have to rebuild pvrtex manually if yo
|
||||
animtool: ../src/tools/animtool.cpp
|
||||
$(CXX) -std=c++17 -o $@ -g -O0 $<
|
||||
|
||||
coltool: coltool.cpp
|
||||
coltool: ../src/tools/coltool.cpp
|
||||
$(CXX) -std=c++17 -o $@ -g -O0 $<
|
||||
|
||||
-include $(DEPS)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# models/coll/peds.col # seems like this is corrupted
|
||||
# models/coll/peds.col # not actually used
|
||||
|
||||
MISC_FILES = \
|
||||
\
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "ColTriangle.h"
|
||||
|
||||
void
|
||||
CColTriangle::Set(const CompressedVector *, int a, int b, int c, uint8 surf, uint8 piece)
|
||||
CColTriangle::Set(const CompressedVector *, uint16 a, uint16 b, uint16 c, uint8 surf, uint8 piece)
|
||||
{
|
||||
this->a = a;
|
||||
this->b = b;
|
||||
|
@@ -18,7 +18,7 @@ struct CColTriangle
|
||||
uint16 c;
|
||||
uint8 surface;
|
||||
|
||||
void Set(const CompressedVector *v, int a, int b, int c, uint8 surf, uint8 piece);
|
||||
void Set(const CompressedVector *v, uint16 a, uint16 b, uint16 c, uint8 surf, uint8 piece);
|
||||
};
|
||||
|
||||
struct CColTrianglePlane
|
||||
|
@@ -5,7 +5,7 @@ struct CompressedVector
|
||||
#ifdef COMPRESSED_COL_VECTORS
|
||||
int16 x, y, z;
|
||||
CVector Get(void) const { return CVector(x, y, z)/128.0f; };
|
||||
void Set(float x, float y, float z) { this->x = lroundf(x*128.0f); this->y = lroundf(y*128.0f); this->z = lroundf(z*128.0f); };
|
||||
void SetFixed(int16 x, int16 y, int16 z) { this->x = x; this->y = y; this->z = z; };
|
||||
#ifdef GTA_PS2
|
||||
void Unpack(uint128 &qword) const {
|
||||
__asm__ volatile (
|
||||
|
@@ -215,7 +215,7 @@ CFileLoader::LoadCollisionFile(const char *filename)
|
||||
fd = CFileMgr::OpenFile(filename, "rb");
|
||||
|
||||
while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){
|
||||
assert(header.ident == 'LLOC');
|
||||
assert(header.ident == 'CLOC');
|
||||
CFileMgr::Read(fd, (char*)work_buff, header.size);
|
||||
memcpy(modelname, work_buff, 24);
|
||||
|
||||
@@ -295,14 +295,8 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
|
||||
model.vertices = (CompressedVector*)RwMalloc(numVertices*sizeof(CompressedVector));
|
||||
REGISTER_MEMPTR(&model.vertices);
|
||||
for(i = 0; i < numVertices; i++){
|
||||
model.vertices[i].Set(*(float*)buf, *(float*)(buf+4), *(float*)(buf+8));
|
||||
if(lroundf(Abs(*(float*)buf)) >= 256 ||
|
||||
lroundf(Abs(*(float*)(buf+4))) >= 256 ||
|
||||
lroundf(Abs(*(float*)(buf+8))) >= 256) {
|
||||
dbglog(DBG_CRITICAL, "%s:Collision volume too big\n", modelname);
|
||||
assert(false && "Collision volume too big");
|
||||
}
|
||||
buf += 12;
|
||||
model.vertices[i].SetFixed(*(int16*)buf, *(int16*)(buf+2), *(int16*)(buf+4));
|
||||
buf += 6;
|
||||
}
|
||||
}else
|
||||
model.vertices = nil;
|
||||
@@ -313,8 +307,11 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
|
||||
model.triangles = (CColTriangle*)RwMalloc(model.numTriangles*sizeof(CColTriangle));
|
||||
REGISTER_MEMPTR(&model.triangles);
|
||||
for(i = 0; i < model.numTriangles; i++){
|
||||
model.triangles[i].Set(model.vertices, *(int32*)buf, *(int32*)(buf+4), *(int32*)(buf+8), buf[12], buf[13]);
|
||||
buf += 16;
|
||||
model.triangles[i].Set(model.vertices, *(uint16*)buf, *(uint16*)(buf+2), *(uint16*)(buf+4), buf[6], buf[7]);
|
||||
buf += 8;
|
||||
assert(model.triangles[i].a < numVertices);
|
||||
assert(model.triangles[i].b < numVertices);
|
||||
assert(model.triangles[i].c < numVertices);
|
||||
}
|
||||
}else
|
||||
model.triangles = nil;
|
||||
|
@@ -163,36 +163,36 @@ Error(char *fmt, ...)
|
||||
void
|
||||
ValidateVersion()
|
||||
{
|
||||
int32 file = CFileMgr::OpenFile("models\\coll\\peds.col", "rb");
|
||||
char buff[128];
|
||||
// int32 file = CFileMgr::OpenFile("models\\coll\\peds.col", "rb");
|
||||
// char buff[128];
|
||||
|
||||
if ( file != -1 )
|
||||
{
|
||||
CFileMgr::Seek(file, 100, SEEK_SET);
|
||||
// if ( file != -1 )
|
||||
// {
|
||||
// CFileMgr::Seek(file, 100, SEEK_SET);
|
||||
|
||||
for ( int i = 0; i < 128; i++ )
|
||||
{
|
||||
CFileMgr::Read(file, &buff[i], sizeof(char));
|
||||
buff[i] -= 23;
|
||||
if ( buff[i] == '\0' )
|
||||
break;
|
||||
CFileMgr::Seek(file, 99, SEEK_CUR);
|
||||
}
|
||||
// for ( int i = 0; i < 128; i++ )
|
||||
// {
|
||||
// CFileMgr::Read(file, &buff[i], sizeof(char));
|
||||
// buff[i] -= 23;
|
||||
// if ( buff[i] == '\0' )
|
||||
// break;
|
||||
// CFileMgr::Seek(file, 99, SEEK_CUR);
|
||||
// }
|
||||
|
||||
if ( !strncmp(buff, "grandtheftauto3", 15) )
|
||||
{
|
||||
strncpy(version_name, &buff[15], 64);
|
||||
CFileMgr::CloseFile(file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if ( !strncmp(buff, "grandtheftauto3", 15) )
|
||||
// {
|
||||
// strncpy(version_name, &buff[15], 64);
|
||||
// CFileMgr::CloseFile(file);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
LoadingScreen("Invalid version", NULL, NULL);
|
||||
// LoadingScreen("Invalid version", NULL, NULL);
|
||||
|
||||
while(true)
|
||||
{
|
||||
;
|
||||
}
|
||||
// while(true)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
|
||||
bool
|
||||
|
@@ -6,7 +6,6 @@ struct CompressedVector
|
||||
int16 x, y, z;
|
||||
CVector Get(void) const { return CVector(x, y, z)/128.0f; };
|
||||
void SetFixed(int16 x, int16 y, int16 z) { this->x = x; this->y = y; this->z = z; };
|
||||
void Set(float x, float y, float z) { this->x = x*128.0f; this->y = y*128.0f; this->z = z*128.0f; };
|
||||
#ifdef GTA_PS2
|
||||
void Unpack(uint128 &qword) const {
|
||||
__asm__ volatile (
|
||||
|
@@ -140,7 +140,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
out_buff.push_back(work_buff[offset]);
|
||||
out_buff.push_back(0); // padding
|
||||
out_buff.push_back(work_buff[offset+1]); // 'piece', not actually used
|
||||
offset += 4;
|
||||
}
|
||||
// === End repackaging of collision model data ===
|
||||
|
Reference in New Issue
Block a user