Normally these things happens for the reason that you are trying to get access past the dimension of the array or memory buffer. I'd check that if i were you. Look at TR2fread function, you are usinng sizeof(Level->NumRooms) , are you sure you want to read the number of rooms or the memory size ? in this case you should multiply the number of rooms by the size in byte of the structure.

kurlyak
—
2012-02-25T16:43:05Z —
#3

Thank you for you reply! At first I am trying read number of Room in my level.

TR2fread(&Level->NumRooms, sizeof(Level->NumRooms), 1, fp);

Next I am using NumRooms for allocate memory:

Level->Rooms = new tr2_room[Level->NumRooms];

I had check NumRooms = 38 (via Debugger). This is right value (i had saw source code of level = 38 room).