char name[20];
char filename[33];
char action[20];

I have problems with those strings in the entity struct. Are you sure the sizes are okay? There also seem to be two different entity types (7 and 3). What is the difference between them?