Use macro GET_WEAPON_FLAGS to hide differences in D1X vs D2X

D2X uses a bigger field due to added weapons, but the idea is the same
in both games.
This commit is contained in:
Kp 2013-08-11 15:17:28 +00:00
parent 5ef0358a4b
commit 202755e8e3
2 changed files with 6 additions and 4 deletions

View file

@ -1622,8 +1622,9 @@ multi_do_player_explode(const ubyte *buf)
// Stuff the Players structure to prepare for the explosion
count = 2;
Players[pnum].primary_weapon_flags = buf[count]; count++;
Players[pnum].secondary_weapon_flags = buf[count]; count++;
#define GET_WEAPON_FLAGS(buf,count) buf[count++]
Players[pnum].primary_weapon_flags = GET_WEAPON_FLAGS(buf,count);
Players[pnum].secondary_weapon_flags = GET_WEAPON_FLAGS(buf,count);
Players[pnum].laser_level = buf[count]; count++;
Players[pnum].secondary_ammo[HOMING_INDEX] = buf[count]; count++;
Players[pnum].secondary_ammo[CONCUSSION_INDEX] = buf[count];count++;

View file

@ -1697,8 +1697,9 @@ multi_do_player_explode(const ubyte *buf)
// Stuff the Players structure to prepare for the explosion
count = 2;
Players[pnum].primary_weapon_flags = GET_INTEL_SHORT(buf + count); count += 2;
Players[pnum].secondary_weapon_flags = GET_INTEL_SHORT(buf + count); count += 2;
#define GET_WEAPON_FLAGS(buf,count) (count += sizeof(uint16_t), GET_INTEL_SHORT(buf + (count - sizeof(uint16_t))))
Players[pnum].primary_weapon_flags = GET_WEAPON_FLAGS(buf,count);
Players[pnum].secondary_weapon_flags = GET_WEAPON_FLAGS(buf,count);
Players[pnum].laser_level = buf[count]; count++;
Players[pnum].secondary_ammo[HOMING_INDEX] = buf[count]; count++;
Players[pnum].secondary_ammo[CONCUSSION_INDEX] = buf[count];count++;