mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-29 10:12:02 +05:30
Replaced old casts with function calls
This commit is contained in:
parent
6d0b82682e
commit
046e1f8617
@ -59,10 +59,10 @@ void writemesh(const struct MeshHeader *mh,
|
|||||||
void extractmeshes(const char *filedata,
|
void extractmeshes(const char *filedata,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
unsigned int filesize) {
|
unsigned int filesize) {
|
||||||
if (filedata == NULL || filesize <= 0) {
|
struct Header *h = NULL;
|
||||||
|
if (!(DEVIL1GEO.getheader(h, filedata))|| filesize <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct Header *h = (struct Header*)filedata;
|
|
||||||
struct MeshHeader *mh = NULL;
|
struct MeshHeader *mh = NULL;
|
||||||
struct Mesh m;
|
struct Mesh m;
|
||||||
m.b = NULL;
|
m.b = NULL;
|
||||||
|
@ -8,10 +8,9 @@ void extracttextures(const char *filedata,
|
|||||||
struct Texture *t = NULL;
|
struct Texture *t = NULL;
|
||||||
struct TextureBatchDescriptor *d = NULL;
|
struct TextureBatchDescriptor *d = NULL;
|
||||||
char * fmt = NULL;
|
char * fmt = NULL;
|
||||||
if (filedata == NULL || filesize == 0) {
|
if (!(DEVIL1TEX.getheader(p, filedata)) || filesize == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = (struct TexturePack*)filedata;
|
|
||||||
fmt = (char*)malloc(strlen(filename) + 3 + 4);
|
fmt = (char*)malloc(strlen(filename) + 3 + 4);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
@ -88,10 +88,10 @@ static bool getmeshheader(struct MeshHeader **hs,
|
|||||||
unsigned int i,
|
unsigned int i,
|
||||||
const char * const filedata) {
|
const char * const filedata) {
|
||||||
bool done = false;
|
bool done = false;
|
||||||
if (hs == NULL || filedata == NULL) {
|
struct Header *h = NULL;
|
||||||
|
if (hs == NULL || !(getgheader(h, filedata))) {
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
struct Header *h = (struct Header*)filedata;
|
|
||||||
if (h -> numMesh < i) {
|
if (h -> numMesh < i) {
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ static void printtph(struct TexturePack*);
|
|||||||
static void printtbd(struct TextureBatchDescriptor*);
|
static void printtbd(struct TextureBatchDescriptor*);
|
||||||
|
|
||||||
// Get Texture Pack Header
|
// Get Texture Pack Header
|
||||||
static bool getpackheader(struct TexturePack*, const char*);
|
static inline bool getpackheader(struct TexturePack*, const char*);
|
||||||
|
|
||||||
// Get Texture Batch Descriptor.
|
// Get Texture Batch Descriptor.
|
||||||
static bool gettexdescriptor(struct TextureBatchDescriptor**,
|
static bool gettexdescriptor(struct TextureBatchDescriptor**,
|
||||||
@ -58,7 +58,7 @@ static void printtbd(struct TextureBatchDescriptor *bd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool getpackheader(struct TexturePack* p, const char *filedata) {
|
inline static bool getpackheader(struct TexturePack* p, const char *filedata) {
|
||||||
if (filedata == NULL) {
|
if (filedata == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -86,10 +86,9 @@ static bool gettexbatch(struct TextureBatch **batch,
|
|||||||
const char *filedata,
|
const char *filedata,
|
||||||
unsigned int filesize) {
|
unsigned int filesize) {
|
||||||
struct TexturePack *p = NULL;
|
struct TexturePack *p = NULL;
|
||||||
if (filedata == NULL) { // no data to get batch from.
|
if (!(getpackheader(p, filedata))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
p = (struct TexturePack*)filedata;
|
|
||||||
if (i > p -> batchNumber) { // no such batch in texture pack
|
if (i > p -> batchNumber) { // no such batch in texture pack
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user