mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 13:53: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,
|
||||
const char *filename,
|
||||
unsigned int filesize) {
|
||||
if (filedata == NULL || filesize <= 0) {
|
||||
struct Header *h = NULL;
|
||||
if (!(DEVIL1GEO.getheader(h, filedata))|| filesize <= 0) {
|
||||
return;
|
||||
}
|
||||
struct Header *h = (struct Header*)filedata;
|
||||
struct MeshHeader *mh = NULL;
|
||||
struct Mesh m;
|
||||
m.b = NULL;
|
||||
|
@ -8,10 +8,9 @@ void extracttextures(const char *filedata,
|
||||
struct Texture *t = NULL;
|
||||
struct TextureBatchDescriptor *d = NULL;
|
||||
char * fmt = NULL;
|
||||
if (filedata == NULL || filesize == 0) {
|
||||
if (!(DEVIL1TEX.getheader(p, filedata)) || filesize == 0) {
|
||||
return;
|
||||
}
|
||||
p = (struct TexturePack*)filedata;
|
||||
fmt = (char*)malloc(strlen(filename) + 3 + 4);
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
|
@ -88,10 +88,10 @@ static bool getmeshheader(struct MeshHeader **hs,
|
||||
unsigned int i,
|
||||
const char * const filedata) {
|
||||
bool done = false;
|
||||
if (hs == NULL || filedata == NULL) {
|
||||
struct Header *h = NULL;
|
||||
if (hs == NULL || !(getgheader(h, filedata))) {
|
||||
return done;
|
||||
}
|
||||
struct Header *h = (struct Header*)filedata;
|
||||
if (h -> numMesh < i) {
|
||||
return done;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ static void printtph(struct TexturePack*);
|
||||
static void printtbd(struct TextureBatchDescriptor*);
|
||||
|
||||
// Get Texture Pack Header
|
||||
static bool getpackheader(struct TexturePack*, const char*);
|
||||
static inline bool getpackheader(struct TexturePack*, const char*);
|
||||
|
||||
// Get Texture Batch Descriptor.
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
@ -86,10 +86,9 @@ static bool gettexbatch(struct TextureBatch **batch,
|
||||
const char *filedata,
|
||||
unsigned int filesize) {
|
||||
struct TexturePack *p = NULL;
|
||||
if (filedata == NULL) { // no data to get batch from.
|
||||
if (!(getpackheader(p, filedata))) {
|
||||
return false;
|
||||
}
|
||||
p = (struct TexturePack*)filedata;
|
||||
if (i > p -> batchNumber) { // no such batch in texture pack
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user