Code: Show/Hide Weapon type :5 bits
Weapon level :2 bits Bouncing (Boolean) :1 bit EMP (Boolean) :1 bit <<--- Is bomb (Boolean) :1 bit <<--- Shrapnel :5 bits Alternate (Boolean) :1 bit |
Code: Show/Hide struct Weapons /* 2 bytes */
{ u16 type : 5; u16 level : 2; u16 shrapbouncing : 1; u16 shraplevel : 2; <<--- u16 shrap : 5; u16 alternate : 1; }; |
grazzhoppa (nopswd) wrote: | |
|
grazzhoppa (nopswd) wrote: | |
|
Quote: |
If emp is 1, the bomb is an EMP bomb
...What level the shrapnel is on the bomb. Say the player firing the bomb has L2 bullets. Then shraplevel would be 2 |
Quote: |
If Is bomb is 0 (i think) then the bomb is actually a mine, not a bomb |
Code: Show/Hide union weaponInfo
{ struct { Uint16 type : 5; // enum Projectile_Types Uint16 level : 2; // Only for bombs/bullets Uint16 shrapBounce : 1; // Bouncing shrapnel? Uint16 shrapLevel : 2; // Shrapnel level 0..3 Uint16 shrapCount : 5; // 0-31 Uint16 fireType : 1; // Bombs -> Mines, Bullets -> Multifire }; Uint16 n; }; // Weapon types for weaponInfo.type enum Projectile_Types { // Seen "in the wild" PROJ_None, PROJ_Bullet, PROJ_BBullet, PROJ_Bomb, PROJ_PBomb, PROJ_Repel, PROJ_Decoy, PROJ_Burst, PROJ_Thor, // Internal to the bot PROJ_InactiveBullet, PROJ_Shrapnel }; |
Quote: |
Mostly because two bytes of information won't fit into one byte. |
Code: Show/Hide struct WEAPONS_ { uint8_t type : 5; uint8_t level : 2; uint8_t shrap_bounce : 1; uint8_t shrap_level : 2; /* bullet/gun level */ uint8_t shrap : 5; uint8_t alternate : 1; /* Bombs -> Mines or Bullets -> Multifire */ } |