[WIP] Replace appearance data with individual fields

Storing certain things in appearance data and others in their own fields
was gross. Now everything is stored on the same level and functions have
been added to generate appearance data when it's needed by the client.
This commit is contained in:
gsemaj
2021-06-20 14:37:37 -04:00
committed by gsemaj
parent 1858938280
commit f4f5f2e0bd
16 changed files with 273 additions and 249 deletions

View File

@@ -74,25 +74,31 @@ struct EntityRef {
*/
class BaseNPC : public Entity {
public:
sNPCAppearanceData appearanceData = {};
int id;
int type;
int hp;
int angle;
int cbf;
int barkerType;
bool loopingPath = false;
BaseNPC(int _X, int _Y, int _Z, int angle, uint64_t iID, int t, int id) { // XXX
BaseNPC(int _X, int _Y, int _Z, int _A, uint64_t iID, int t, int _id) { // XXX
x = _X;
y = _Y;
z = _Z;
appearanceData.iNPCType = t;
appearanceData.iHP = 400;
appearanceData.iAngle = angle;
appearanceData.iConditionBitFlag = 0;
appearanceData.iBarkerType = 0;
appearanceData.iNPC_ID = id;
type = t;
hp = 400;
angle = _A;
cbf = 0;
barkerType = 0;
id = _id;
instanceID = iID;
};
virtual void enterIntoViewOf(CNSocket *sock) override;
virtual void disappearFromViewOf(CNSocket *sock) override;
sNPCAppearanceData getAppearanceData();
};
struct CombatNPC : public BaseNPC {
@@ -115,7 +121,7 @@ struct CombatNPC : public BaseNPC {
_stepAI(this, currTime);
}
virtual bool isAlive() override { return appearanceData.iHP > 0; }
virtual bool isAlive() override { return hp > 0; }
};
// Mob is in MobAI.hpp, Player is in Player.hpp