具有原始数据的头文件的目的是什么? [英] What could be the purpose of a header file with raw data?

查看:104
本文介绍了具有原始数据的头文件的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

决定不使用我自己的代码,而是选择其他代码, Quake I 是您的选择.我单击的第一个文件只填充了原始数据,唯一的注释是GPL.我猜这是一个包含法线向量的数组吗?不管目的是什么,令我困惑的是它在头文件 anorms.h .我想知道这样做的目的是什么?

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.

推荐答案

通过外观猜测,它的确是游戏中某个地方使用的普通数组.

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

在过去,几乎所有游戏内容都是经过硬编码的;现在,您只需打开一个文件并加载数据,因为HDD(以及更多的SSD)变得非常快.

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.

旧版游戏也被编译为纯C可执行文件;在像Visual Studio这样的现代IDE(或几乎所有东西)中,您可以轻松地以 resources 的形式将任意数据编译到.exe中.

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.

话虽这么说,这只是遗留的残cru剩饭,我不应该对此很在意.

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

样品用量:

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

这篇关于具有原始数据的头文件的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆