1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 /* 14 * ShotUpdate: 15 * Encapsulates info needed to update a shot on remote 16 * hosts. Can be packed for transmission on the net. 17 * 18 * FiringInfo: 19 * Encapsulates info needed to create RemoteShotPath. 20 * Can be packed for transmission on the net. 21 */ 22 23 #ifndef BZF_SHOT_UPDATE_H 24 #define BZF_SHOT_UPDATE_H 25 26 // system headers 27 #include <math.h> 28 29 // local implementation headers 30 #include "common.h" 31 #include "Address.h" 32 #include "Flag.h" 33 34 const int ShotUpdatePLen = PlayerIdPLen + 32; 35 const int FiringInfoPLen = ShotUpdatePLen + 10; 36 37 class BaseLocalPlayer; 38 39 struct ShotUpdate 40 { 41 public: 42 void* pack(void*) const; 43 const void* unpack(const void*); 44 45 public: 46 PlayerId player; // who's shot 47 uint16_t id; // shot id unique to player 48 float pos[3]; // shot position 49 float vel[3]; // shot velocity 50 float dt; // time shot has existed 51 TeamColor team; 52 }; 53 54 struct FiringInfo 55 { 56 public: 57 FiringInfo(); 58 FiringInfo(const BaseLocalPlayer&, int id); 59 60 void* pack(void*) const; 61 const void* unpack(const void*); 62 63 public: 64 float timeSent; 65 ShotUpdate shot; 66 FlagType* flagType; // flag when fired 67 float lifetime; // lifetime of shot (s) 68 }; 69 70 #endif // BZF_SHOT_UPDATE_H 71 72 // Local Variables: *** 73 // mode: C++ *** 74 // tab-width: 4 *** 75 // c-basic-offset: 4 *** 76 // indent-tabs-mode: nil *** 77 // End: *** 78 // ex: shiftwidth=4 tabstop=4 79