Code: Show/Hide int i;
short id; for (i = 1; i + 2 < PacketSize; i += 2) { id = *(short*)(Packet + i); if (id & 0x8000) { id ^= 0x8000; //Removes the first bit /* Whatever you do to handle that obj #id is now turned off */ } else { /* Whatever you do to handle that obj #id is now turned on */ } } |
Code: Show/Hide struct PacketObjectInfo {
unsigned short mapobject : 1; //If its a map object or not unsigned short id : 15; //Which object short x; //X location it will go to short y; //Y location it will go to char imagenumber; //Which image number will effect char layer; //Which layer it is on unsigned short displaytime : 12; //Time it will be displayed, in 1/10th seconds unsigned short timermode : 4; //Which timer it will be used }; |