What could be the purpose of a header file with raw data?

543 views Asked by At

Decided to check out some code other than my own, Quake I was the choice. The first file I click on is filled with nothing but raw data and the only comments are the GPL. I am guessing it is an array containing normal vectors? Regardless of what its purpose was, what confuses me is what it is doing in a header file anorms.h. I am wondering what could be the purpose of doing this?

The other source, actual code, feels fairly complicated to me. As a novice programmer I probably just need to spend more time at it.

1

There are 1 answers

4
Bartek Banachewicz On BEST ANSWER

Guessing by the looks, it's indeed a normal array used somewhere in the game.

In older days, pretty much every game content was hardcoded; now you can simply open a file and load the data, because the HDDs (and more often SSDs) got so much faster.

Older games were also compiled as plain C executable; in modern IDEs such as Visual Studio (or pretty much anything, really), you can easily compile arbitrary data into the .exe in form of resources.

All that being said, it's simply legacy cruft and I shouldn't be very concerned with it.


Sample usage:

struct Vec { float x,y,z };
Vec arr[] = {
    #include "anorms.h"
};