- 帖子
- 11
- 主题
- 3
- 积分
- 0
- 威望
- 0
- 金钱
- 0
- 在线时间
- 0 小时
|
5#
发表于 2015-9-25 17:52
| 只看该作者
- Figure out "pseudosprites"
- Add the special first pseudosprite
- Give your file an GRFID
- Add an "action 1" to introduce your vehicle graphics
- Use actions 2 and 3 to link your graphics to a vehicle in TTD
- Adjust the first pseudosprite again, and renumber all sprites
- Encode and add to newgrf(w).cfg
1、弄明白"假sprites"
2、添加特殊的第一个"假sprite"
3、标注grfid
4、增加"action 1 "来介绍你的grf文件
5、使用action2和3来使你的图形连接ttd里相应的运输工具
6、调整第一个假sprits,并重新编号所有的spirtes
7、编译并添加到游戏里。
Now let's look at this in more detail.
现在来详细介绍每个步骤
1) Figure out pseudosprites1、弄明白"假sprites"
If you've looked through trg1r.nfo, you may have noticed that some entries look different to the usual ones.
如果你查看trg1r.nfo时,你可以注意到一些段落与普遍的要些差别
Usual entry:
普通段落
24 C:\TTD\SPRITES\trg1r.pcx 450 8 01 9 7 0 0
This one is different:
不同的:
771 * 17 10 00 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 EF EF EF
The first one refers to an image in the PCX file. The second one is some additional data that's not an image. These types of entries are called "pseudosprites", and in TTDPatch .grf files they are used to give TTDPatch information what it should do with the graphics in the file.
第一个段落,是指向pcx中的一个图形,第二个段落是一些额外的数据,并不是一个图形。这些段落就叫“假sprites”,在ttdpatch中,.grf文件给予ttdpatch信息来让ttd运行这些图形。
Here's what you have to know:
这里,我们需要知道
- The first number is the well-known sprite number, simply counting entries from the beginning of the file
- Then follows an asterisk "*", where you would normally have the PCX filename
- Then there's another number, which is the length of the following data
- And finally the actual data, as a bunch of hex codes
第一个数字就是通常说的spirte编号,简单的计录从文件开始的段落数
紧接着的“*”和你通常的pcx文件名,
然后是另一个数字,就是接下来的数据“长度”
最后一串数字就是实际使用的数据。
So, that's what you have to know about pseudosprites for now. Let's get started...
至此,以上就是解释了什么叫“假sprite”,让我们开始吧。
2) Add the special first pseudosprite添加特殊的第一个“假sprite”
For TTDPatch graphics files, the first entry in the .nfo is special, and tells TTDPatch how many lines the file has. Since we don't yet know how big it will be, we add it but don't put any useful data in.
在.grf文件中,.nfo文件的第一个段落是特殊的,是为了告诉ttdpatch,该文件中有多少行。因此,在我们仍然不知道文件有多大时,我们添加它但不放入有用的数据。
Here's what you do: in your mytrain.nfo file, after the comment lines (those that begin with "//"), but before the first entry, insert the following line:
这里,你要在你的.nfo文件中,在注释行("//"开头的)后面和第一段落前面,插入以下行:
0 * 4 00 00 00 00
3) Give your file an GRFID3、标注grfid
Apart from the first line which we've added in the previous step, TTDPatch .nfo files are organized by "actions". These actions tell TTDPatch what to do with the graphics in your file. In our specific case, we need to tell TTDPatch to use those graphics for a train engine.
除开上一步我们添加的第一行外,TTDPATCH的.nfo文件通常是由“actions”组成。这些“actions”(后面翻译将改成脚本了)告诉ttdpatch怎么运行你文件里的图形。在本教程中,我们需要告诉ttdpatch使用这些图形用作一个火车头。
Before you go any further, just let me make clear what the different ID's mean that we will refer to. Here's a table:
在你深入研究前,请让我解释不同的ID意味着我们的指向,如下表所示:
ID Type | Purpose | Vehicle ID | A generic vehicle/station/building slot whose properties can be defined using an Action 0. A Cargo ID can be associated with this using Action 3. | set ID (called cargo ID for vehicles) | A ID asociated with one or more Spritesets using an Action 2. Can be asociated with a Vehicle ID using Action 3. | Spriteset | A value unique to each Action 1. Defines a set of 8/4 views i.e. a set of sprites. Is in an action 2 | GRFID | A word value used to differentiate between different grf files. This should be globally unique! |
ID 类型 | 目的 | 运输工具 ID | 通过使用脚本0来定义运输工具/站台/建筑的统一接口。货物ID通过使用脚本3来产生联系 | 固定ID (运输货物类型的ID) |
一个ID通过使用脚本2来与一个或多个sprites产生联系。通过使用脚本3来与运输工具的ID产生联系。
| Spriteset | 对应脚本1中的一个唯一值
A value unique to each Action 1. Defines a set of 8/4 views i.e. a set of sprites. Is in an action 2
| GRFID | 一个唯一值用来区别不同的grf文件。
|
Just keep that in mind and refer to it later on.
Now, lets continue.
记住以上信息并明白后面示例的意义。
现在继续
The first step to do that is by using an Action 8, which gives your file an GRFID, and allows people to turn it on or off in the GRF Status Window.
第一步,使用脚本8,赋予你的.grf文件一个grfid,然后允许玩家在游戏中开启和关闭
You have to choose the GRFID yourself. To find a good GRFID to use, for example use the initials of your first and last name, plus two numbers.
你必须自己选择一个grfid。例如最好的方法就是使用你姓名的首字母,加2个数字。
For example, for this tutorial, we'll use the initials "TW". In addition, we need two numbers to identify the file. These you can pick however you like, you'll use them to distinguish different graphics files made by you. Those will have the same initials, but must get different GRFIDs, so you pick different numbers. For example, here we pick 3 and 5.
例如,在本教程中,我们将使用"TW"。另外,我们需要2个数字来表明文件身份。数字可以是你喜欢的,你可以区别你自己的不同文件。这样,不同grf文件的grfid拥有相同的首字母,但必须拥有不同的grfid,所以你必须使用不同的数字。例如,这里我们选择了3和5
This means we get the following GRFID:
这样,我们得到以下的grfid
"TW" 03 05
You may also write the initials as hex codes. If you aren't familiar with hex codes, you can use the Hex Converter to help you. Simply enter your initials and click convert, and then write down the hex codes. This is more complicated, so very few people do it, but the result would be the following equivalent GRFID:
54 57 03 05 你也可以将缩写字母以十六进制的方式表达。如果你不熟悉十六进制,你可以使用转换器来帮助你。只需要输入你的字母,点击转换就可以了。这个结构很复杂,所以很少人用,但结果是一样的。
This form is the official form for a GRFID, and should be used in all non-.nfo contexts. In .nfos, you may use whichever form you prefer.
这个是指定的grfid方式,并被使用在非.nfo环境中。在.nfo文件中,你可以使用你更喜欢的。
The 54 57 are the hex codes for "TW". In both cases, 03 and 05 are the numbers we've picked, written in hex.
54 57 是"TW"的十六进制表达式,同时,03 05是我们选择的数字,也是以十六进制表达的。
Therefore, you insert the following line immediately after the line which you've added in the previous step:
1 * 8 08 06 "TW" 03 05 00 00
因些,你将以下表达方式插入在上一步中我们建立的行之前。
This gives your graphics file the GRFID. This action 8 must always be present in your files, and it must be one of the first lines. If you don't have an action 8, TTDPatch will complain about "invalid sprites" or an "incorrect version", and refuse to load your file.
这样你的grf文件就有了grfid,脚本8必须出现在你的文件里,而且必须是第一行。如果你没有定义脚本8,TTDPATCH将会报错,并拒绝加载你的文件。
You can optionally give your file also a name and a description or copyright info, but that's beyond the scope of this tutorial. Check the docs for action 8 for more details.
你也可以通过脚本8来定义一个名字和一个描述或者版权信息。以上已经超出了本教程的范围,请参考脚本8 |
|