约翰卡马克的编码规范

 

通用命名规则

-------

 

tab 键的空格数设置为4个。

 

在每处都使用大括号(if,else,函数,结构体,typedef,类定义,等等)

 

if ( x ) {

}

else 代码段的左大括号 与 右大括号开始在同一行

if ( x ) {

} else {
}

表达式与左右括号间要用空格空开。

 

例如:用

if ( x ) {

}

代替如下语句

if (x) {

}

又如,用

x = ( y * 0.5f );

代替如下语句

x = (y * 0.5f);


为浮点值添加精度标示符,除非明确需要用到double

 

例如:用

float f =0.5f;

 

代替如下语句

float f =0.5;

 

又如,用

 

float f =1.0f;

 

代替如下语句

float f =1.f;

 

函数名以大写字母开头:

 

例如:

void Function( void );

 

若为多单词函数名,每个词以大写字母开头:

 

例如:

void ThisFunctionDoesSomething( void);

 

函数的标准头部注释如下:

 

/*

====================

FunctionName

 

 Description

============

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This is the complete source code for winquake, glquake, quakeworld, and glquakeworld. The projects have been tested with visual C++ 6.0, but masm is also required to build the assembly language files. It is possible to change a #define and build with only C code, but the software rendering versions lose almost half its speed. The OpenGL versions will not be effected very much. The gas2masm tool was created to allow us to use the same source for the dos, linux, and windows versions, but I don't really recommend anyone mess with the asm code. The original dos version of Quake should also be buildable from these sources, but we didn't bother trying. The code is all licensed under the terms of the GPL (gnu public license). You should read the entire license, but the gist of it is that you can do anything you want with the code, including sell your new version. The catch is that if you distribute new binary versions, you are required to make the entire source code available for free to everyone. Our previous code releases have been under licenses that preclude commercial exploitation, but have no clause forcing sharing of source code. There have been some unfortunate losses to the community as a result of mod teams keeping their sources closed (and sometimes losing them). If you are going to publicly release modified versions of this code, you must also make source code available. I would encourage teams to even go a step farther and investigate using public CVS servers for development where possible. The primary intent of this release is for entertainment and educational purposes, but the GPL does allow commercial exploitation if you obey the full license. If you want to do something commercial and you just can't bear to have your source changes released, we could still negotiate a separate license agreement (for $$$), but I would encourage you to just live with the GPL. All of the Quake data files remain copyrighted and licensed under the original terms, so you cannot redistribute data from the original game, but if you do a true total conversion, you can create a standalone game based on this code. I will see about having the license changed on the shareware episode of quake to allow it to be duplicated more freely (for linux distributions, for example), but I can't give a timeframe for it. You can still download one of the original quake demos and use that data with the code, but there are restrictions on the redistribution of the demo data. If you never actually bought a complete version of Quake, you might want to rummage around in a local software bargain bin for one of the originals, or perhaps find a copy of the "Quake: the offering" boxed set with both mission packs. Thanks to Dave "Zoid" Kirsh and Robert Duffy for doing the grunt work of building this release. John Carmack Id Software

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值