Advertisement

Halflife BSP MAP LOADING

Started by March 08, 2001 04:22 PM
-1 comments, last by steveharper101 23 years, 8 months ago
I have downloaded the halflife loader it''s excellent.But i want to implement it my self. I cannot understand the following code: void* bsp_file_t::suck_lump(FILE* f, lump_t& l, int sz, int& count) { fseek(f, l.fileofs, SEEK_SET); count = l.filelen/sz; byte* p = new byte[l.filelen]; if(fread(p, 1, l.filelen, f) == l.filelen) { return p; } return 0; } Here the file is loaded into the structure but how does it do it? I think that pointer p is returning the begging address of the data just loaded in p and then the code: faces = (dface_t*) suck_lump(f, h.lumps[LUMP_FACES], sizeof(dface_t), face_count); casts it to the right structure and then points to the structure faces is this correct?. And I didn''t know you could point the data into a structure by just casting it this way. The suck_lump function creates an array of faces how does it do this because i haveb''t seen an array been declared anywhere in the code? Thanks very very much For your help on previous posts Steve Cheers Steve

This topic is closed to new replies.

Advertisement