⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buildinf.txt

📁 小型游戏引擎
💻 TXT
📖 第 1 页 / 共 2 页
字号:
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman// Ken Silverman's official web site: "http://www.advsys.net/ken"// See the included license file "BUILDLIC.TXT" for license info.Build information to get you started:The first half of this file explains the .ART, .MAP, and PALETTE.DAT formats.The second half has documentation about every BUILD engine function, what it	does, and what the parameters are.-Ken S.------------------------------------------------------------------------------Documentation on Ken's .ART file format                     by Ken Silverman	I am documenting my ART format to allow you to program your own customart utilites if you so desire.  I am still planning on writing the scriptsystem.	All art files must have xxxxx###.ART.  When loading an art file youshould keep trying to open new xxxxx###'s, incrementing the number, untilan art file is not found.1. long artversion;		The first 4 bytes in the art format are the version number.  The current	current art version is now 1.  If artversion is not 1 then either it's the	wrong art version or something is wrong.2. long numtiles;		Numtiles is not really used anymore.  I wouldn't trust it.  Actually	when I originally planning art version 1 many months ago, I thought I	would need this variable, but it turned it is was unnecessary.  To get	the number of tiles, you should search all art files, and check the	localtilestart and localtileend values for each file.3. long localtilestart;		Localtilestart is the tile number of the first tile in this art file.4. long localtileend;		Localtileend is the tile number of the last tile in this art file.		Note:  Localtileend CAN be higher than the last used slot in an art		file.			Example:  If you chose 256 tiles per art file:		TILES000.ART -> localtilestart = 0,   localtileend = 255		TILES001.ART -> localtilestart = 256, localtileend = 511		TILES002.ART -> localtilestart = 512, localtileend = 767		TILES003.ART -> localtilestart = 768, localtileend = 10235. short tilesizx[localtileend-localtilestart+1];		This is an array of shorts of all the x dimensions of the tiles	in this art file.  If you chose 256 tiles per art file then	[localtileend-localtilestart+1] should equal 256.6. short tilesizy[localtileend-localtilestart+1];		This is an array of shorts of all the y dimensions.7. long picanm[localtileend-localtilestart+1];		This array of longs stores a few attributes for each tile that you	can set inside EDITART.  You probably won't be touching this array, but	I'll document it anyway.	Bit:  |31           24|23           16|15            8|7             0|			-----------------------------------------------------------------			| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |			-----------------------------------------------------------------					  | Anim. |  Signed char  |  Signed char  |   |  Animate  |					  | Speed |   Y-center    |   X-center    |   |   number  |					  --------|    offset     |    offset     |   |------------								 --------------------------------|   ------------																			| Animate type:|																			| 00 - NoAnm   |																			| 01 - Oscil   |																			| 10 - AnmFd   |																			| 11 - AnmBk   |																			----------------			 You probably recognize these:		 Animate speed -            EDITART key: 'A', + and - to adjust		 Signed char x&y offset -   EDITART key: '`', Arrows to adjust		 Animate number&type -      EDITART key: +/- on keypad8. After the picanm's, the rest of the file is straight-forward rectangular		art data.  You must go through the tilesizx and tilesizy arrays to find		where the artwork is actually stored in this file.		Note:  The tiles are stored in the opposite coordinate system than			the screen memory is stored.  Example on a 4*4 file:			Offsets:			-----------------			| 0 | 4 | 8 |12 |			-----------------			| 1 | 5 | 9 |13 |			-----------------			| 2 | 6 |10 |14 |			-----------------			| 3 | 7 |11 |15 |			---------------------------------------------------------------------------------------------	If you wish to display the artwork, you will also need to load yourpalette.  To load the palette, simply read the first 768 bytes of yourpalette.dat and write it directly to the video card - like this:	Example:		long i, fil;		fil = open("palette.dat",O_BINARY|O_RDWR,S_IREAD);		read(fil,&palette[0],768);		close(fil);		outp(0x3c8,0);		for(i=0;i<768;i++)			outp(0x3c9,palette[i]);------------------------------------------------------------------------------Packet format for DUKE3D (specifically for network mode 1, n(n-1) mode):Example bunch of packets:A  B  C   D  E  F     G      H      I   J  K  L  M   N...       O---------------------------------------------------------------------d9 00 d9  11 01 00  -  -   -  -   -  -   -  -  -  -  4f       16 31da 00 da  11 01 00  -  -   -  -   -  -   -  -  -  -  b2       b7 9ddb 00 db  11 01 00  -  -   -  -   -  -   -  -  -  -  b1       24 62dc 00 dc  11 01 00  -  -   -  -   -  -   -  -  -  -  ca       1d 58dd 00 dd  11 01 00  -  -   -  -   -  -   -  -  -  -  a9       94 14de 00 de  11 01 05  00 00  -  -   03 00  -  -  -  -  c5       50 b9df 00 df  11 01 0f  a1 ff  fe 09  00 00  26 -  -  -  e2       88 6fe0 00 e0  11 01 04  -  -   -  -   fd ff  -  -  -  -  77       51 d7e1 00 e1  11 01 03  1f 00  ff 09  -  -   -  -  -  -  ac       14 b7e2 00 e2  11 01 0b  9c 00  fb 09  -  -   24 -  -  -  f8       6c 22GAME sends fields D-NMMULTI adds fields A-C and O for error correction.A: Packet count sending modulo 256B: Error state.  Usually 0.  To request a resend, bit 0 is set.  In order		to catch up on networks, sending many packets is bad, so 2 packets		are sent in 1 IPX packet.  To send 2 packets in 1 packet, bit 1 is set.		In special cases, this value may be different.C: Packet count receiving modulo 256D: Message header byte.  These are all the possible values currently.  You		are probably only interested in case 17.  Note that fields E-N apply		to case 17 only.	  0: send movement info from master to slave (network mode 0 only)	  1: send movement info from slave to master (network mode 0 only)	  4: user-typed messages	  5: Re-start level with given parameters	  6: Send player name	  7: Play Remote Ridicule sound	  8: Re-start level with given parameters for a user map	 17: send movement info to everybody else (network mode 1 only)	250: Wait for Everybody (Don't start until everybody's done loading)	255: Player quit to DOSE: Timing byte used to calculate lag time.  This prevents the 2 computer's		timers from drifting apart.F: Bits field byte.  Fields G-M are sent only when certain bits		in this byte are set.G: X momentum update (2 bytes).  Sent only if ((F&1) != 0)H: Y momentum update (2 bytes).  Sent only if ((F&2) != 0)I: Angle momentum update (2 bytes).  Sent only if ((F&4) != 0)J: The states of 8 different keys (1 byte).  Sent only if ((F&8) != 0)K: The states of 8 different keys (1 byte).  Sent only if ((F&16) != 0)L: The states of 8 different keys (1 byte).  Sent only if ((F&32) != 0)M: The states of 8 different keys (1 byte).  Sent only if ((F&64) != 0)N: Sync checking byte.  Useful for debugging programming errors.  Can be a	variable number of bytes.  Actual number of sync checking bytes is	calculated by length of the whole packet minus the rest of the bytes sent.O: CRC-16------------------------------------------------------------------------------|   @@@@@@@@@@@     @@@       @@@  @@@@@@@@@  @@@           @@@@@@@@@        ||   @@@@@@@@@@@@@   @@@       @@@  @@@@@@@@@  @@@           @@@@@@@@@@@      ||   @@@       @@@@  @@@       @@@     @@@     @@@           @@@    @@@@@     ||   @@@        @@@  @@@       @@@     @@@     @@@           @@@      @@@@    ||   @@@       @@@@  @@@       @@@     @@@     @@@           @@@       @@@    ||   @@@@@@@@@@@@@   @@@       @@@     @@@     @@@           @@@       @@@    ||   @@@@@@@@@@@@@   @@@       @@@     @@@     @@@           @@@       @@@    ||   @@@       @@@@  @@@       @@@     @@@     @@@           @@@       @@@    ||   @@@        @@@  @@@       @@@     @@@     @@@           @@@      @@@@    ||   @@@       @@@@  @@@@     @@@@     @@@     @@@           @@@    @@@@@     ||   @@@@@@@@@@@@@    @@@@@@@@@@@   @@@@@@@@@  @@@@@@@@@@@@  @@@@@@@@@@@      ||   @@@@@@@@@@@        @@@@@@@     @@@@@@@@@  @@@@@@@@@@@@  @@@@@@@@@        ||                                                                            ||                          M A P   F O R M A T !                             |------------------------------------------------------------------------------Here is Ken's documentation on the COMPLETE BUILD map format:BUILD engine and editor programmed completely by Ken SilvermanHere's how you should read a BUILD map file:{	fil = open(???);		//Load map version number (current version is 7L)	read(fil,&mapversion,4);		//Load starting position	read(fil,posx,4);	read(fil,posy,4);	read(fil,posz,4);          //Note: Z coordinates are all shifted up 4	read(fil,ang,2);           //All angles are from 0-2047, clockwise	read(fil,cursectnum,2);    //Sector of starting point		//Load all sectors (see sector structure described below)	read(fil,&numsectors,2);	read(fil,&sector[0],sizeof(sectortype)*numsectors);		//Load all walls (see wall structure described below)	read(fil,&numwalls,2);	read(fil,&wall[0],sizeof(walltype)*numwalls);		//Load all sprites (see sprite structure described below)	read(fil,&numsprites,2);	read(fil,&sprite[0],sizeof(spritetype)*numsprites);	close(fil);}		-------------------------------------------------------------		| @@@@@@@ @@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@  @@@@@@@ |		| @@      @@      @@         @@    @@   @@ @@   @@@ @@      |		| @@@@@@@ @@@@@   @@         @@    @@   @@ @@@@@@@  @@@@@@@ |		|      @@ @@      @@         @@    @@   @@ @@   @@@      @@ |		| @@@@@@@ @@@@@@@ @@@@@@@    @@    @@@@@@@ @@    @@ @@@@@@@ |		-------------------------------------------------------------	//sizeof(sectortype) = 40typedef struct{	short wallptr, wallnum;	long ceilingz, floorz;	short ceilingstat, floorstat;	short ceilingpicnum, ceilingheinum;	signed char ceilingshade;	char ceilingpal, ceilingxpanning, ceilingypanning;	short floorpicnum, floorheinum;	signed char floorshade;	char floorpal, floorxpanning, floorypanning;	char visibility, filler;	short lotag, hitag, extra;} sectortype;sectortype sector[1024];wallptr - index to first wall of sectorwallnum - number of walls in sectorz's - z coordinate (height) of ceiling / floor at first point of sectorstat's	bit 0: 1 = parallaxing, 0 = not                                 "P"	bit 1: 1 = sloped, 0 = not	bit 2: 1 = swap x&y, 0 = not                                    "F"	bit 3: 1 = double smooshiness                                   "E"	bit 4: 1 = x-flip                                               "F"	bit 5: 1 = y-flip                                               "F"	bit 6: 1 = Align texture to first wall of sector                "R"	bits 7-15: reservedpicnum's - texture index into art fileheinum's - slope value (rise/run) (0-parallel to floor, 4096-45 degrees)shade's - shade offset of ceiling/floorpal's - palette lookup table number (0 - use standard colors)panning's - used to align textures or to do texture panningvisibility - determines how fast an area changes shade relative to distancefiller - useless byte to make structure alignedlotag, hitag, extra - These variables used by the game programmer only			 -----------------------------------------------			 | @@      @@ @@@@@@@@ @@      @@      @@@@@@@ |			 | @@      @@ @@    @@ @@      @@      @@      |			 | @@  @@  @@ @@@@@@@@ @@      @@      @@@@@@@ |			 | @@ @@@@ @@ @@    @@ @@      @@           @@ |			 |  @@@ @@@@  @@    @@ @@@@@@@ @@@@@@@ @@@@@@@ |			 ----------------------------------------------|	//sizeof(walltype) = 32typedef struct{	long x, y;	short point2, nextwall, nextsector, cstat;	short picnum, overpicnum;	signed char shade;	char pal, xrepeat, yrepeat, xpanning, ypanning;	short lotag, hitag, extra;} walltype;walltype wall[8192];x, y: Coordinate of left side of wall, get right side from next wall's left sidepoint2: Index to next wall on the right (always in the same sector)nextwall: Index to wall on other side of wall (-1 if there is no sector)nextsector: Index to sector on other side of wall (-1 if there is no sector)cstat:	bit 0: 1 = Blocking wall (use with clipmove, getzrange)         "B"	bit 1: 1 = bottoms of invisible walls swapped, 0 = not          "2"	bit 2: 1 = align picture on bottom (for doors), 0 = top         "O"	bit 3: 1 = x-flipped, 0 = normal                                "F"	bit 4: 1 = masking wall, 0 = not                                "M"	bit 5: 1 = 1-way wall, 0 = not                                  "1"	bit 6: 1 = Blocking wall (use with hitscan / cliptype 1)        "H"	bit 7: 1 = Transluscence, 0 = not                               "T"	bit 8: 1 = y-flipped, 0 = normal                                "F"	bit 9: 1 = Transluscence reversing, 0 = normal                  "T"	bits 10-15: reservedpicnum - texture index into art fileoverpicnum - texture index into art file for masked walls / 1-way wallsshade - shade offset of wallpal - palette lookup table number (0 - use standard colors)repeat's - used to change the size of pixels (stretch textures)pannings - used to align textures or to do texture panninglotag, hitag, extra - These variables used by the game programmer only		-------------------------------------------------------------		| @@@@@@@ @@@@@@@ @@@@@@@   @@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@ |		| @@      @@   @@ @@   @@@    @@      @@    @@      @@      |		| @@@@@@@ @@@@@@@ @@@@@@@     @@      @@    @@@@@   @@@@@@@ |		|      @@ @@      @@    @@    @@      @@    @@           @@ |		| @@@@@@@ @@      @@    @@  @@@@@@    @@    @@@@@@@ @@@@@@@ |		-------------------------------------------------------------	//sizeof(spritetype) = 44typedef struct{	long x, y, z;	short cstat, picnum;	signed char shade;	char pal, clipdist, filler;	unsigned char xrepeat, yrepeat;	signed char xoffset, yoffset;	short sectnum, statnum;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -