404 on Thu, 12 Mar 1998 22:09:26 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Syndicate: * |
{ * typedef BYTE TERRAIN; enum { BUILDING=0, RIVER, SWAMP, CRATER, ROAD, FOREST, RUBBLE, GRASS, HALFBUILDING, BOAT, DEEPSEA, REFBASE_T, PILLBOX_T, NUM_TERRAINS, TERRAIN_MASK = 0xF, TERRAIN_MINE = 0x80, }; <--For each object you can see, you are told its position, and some information. Your own tank is not included in the array of objects. All friendly pillboxes and bases are included in the array, even if currently beyond visual range--> typedef u_short OBJECT; enum { OBJECT_TANK=0, OBJECT_SHOT, OBJECT_PILLBOX, OBJECT_REFBASE, OBJECT_BUILDMAN }; #define OBJECT_HOSTILE 1 #define OBJECT_OWNED 2 typedef struct { OBJECT object; WORLD_X x; WORLD_Y y; WORD idnum; BYTE direction; BYTE info; } ObjectInfo; <--For tanks, pillboxes, refuelling bases, and men, an identifying number is given, which ranges from zero to the number of that kind of object minus one. One useful fact is that man number n is owned by tank number n. For tanks and shots the approximate direction of travel is given. For pillboxes the 'direction' value gives the pillbox's current strength, in the range 0-15, as can be determined by human players looking at the graphics on the screen. For refueling bases and building men, the 'direction' value is unused. Bit 0 of the info field (OBJECT_HOSTILE) is set if the object is hostile, and clear if it is friendly. Bit 1 of the info field (OBJECT_OWNED) is set if the object is currently 'owned' by some player, and clear if it is neutral. #If a message was sent to you then the MessageInfo pointer will be non-null, and will point to a MessageInfo structure as described below--> typedef struct { u_short sender; PlayerMap *receivers; u_char *message; } MessageInfo; <--The sender field tells you which player sent the message. You may examine playernames[sender] to find out the ASCII name of that player. The receivers field points to a bit map indicating which players the message was sent to, and the text of the message is given by the message field--> typedef BYTE BUILDMODE; enum { BUILDMODE_FARM=1, BUILDMODE_ROAD, BUILDMODE_BUILD, BUILDMODE_PBOX, BUILDMODE_MINE }; typedef struct { MAP_X x; MAP_Y y; BUILDMODE action; } BuildInfo; <--If the action field is zero, you may set the x and y coordinates to the location you wish to build at, and then set the action field to the operation you wish the man to perform. (IMPORTANT: You must set the coordinates BEFORE you set the action). When the man has been dispatched from the tank to do the building, the action field will be reset to zero, and you may then queue up the next action, to be performed when the man returns. #messagedest points to a bitmap of flags as described above. For each tank you want to send to, set the appropriate bit in the bitmap. If sendmessage[0] is zero then you may write a message into the buffer it points to. The message should be a pascal string -- ie sendmessage[0] will then contain the length of the string. When the message has been sent, sendmessage[0] will be reset to zero. You can send a message to yourself only for the purpose of displaying debugging messages, if necessary. #Directions are given as single bytes, with the circle divided into 256 divisions. 0 is North, 64 is East, 128 is South, 192 is West, and 255 is all the way around, almost back to due North. #MAP coordinates are 8 bits each for X and Y, and the unit is one map square. 0,0 is the top left corner of the 'world', and coordinates increase downwards and to the right. 255,255 is the bottom right corner of the world. The position of pillboxes and refueling bases are given in MAP coordinates, since they are constrained to lie on map squares. #WORLD coordinates are 16 bits each for X and Y. They are a higher resolution version of MAP coordinates, used for objects such as tanks which can move on a finer grid than whole map squares. Like MAP coordinates, WORLD coordinates start with 0,0 in the top left, increasing downwards and to the right. 256 WORLD coordinate units make one MAP coordinate unit, so effectively the top byte of the WORLD coordinate gives the MAP square, and the low byte gives the location within the square. The coordinates given for objects like tanks and shots give the position of the centre of the object-->