kaos/KaosSrc/player.hpp

81 lines
2.4 KiB
C++
Raw Normal View History

2024-10-12 20:32:30 -05:00
/************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
************************************************************************/
#define COM_DIRECT 0
#define COM_SAVE 1
#define COM_LOAD 2
#define COM_SEND 3
#define COM_RECEIVE 4
// Player Flags
#define PFL_GOD 0x01
#define PFL_MAPVIEW 0x02
// Fast access
#define GODMODE (pflags & PFL_GOD)
#define MAPVIEW (pflags & PFL_MAPVIEW)
typedef struct {
//long score;
int health;
byte curarm, keys, armflag;
int armbull[6]; // !!!!!!!!!!!!!!!!!!!!! adesso non mi va !
} TPlayerData;
class Player : public CanFireActor
{
friend InfoBar;
friend LittleInfoBar;
TControl control;
TControl command;
char myseenmap[MAPDIM];
int animtrig;
virtual char fire(int angle);
int speed,angspeed,latspeed,angwalk;
int hitspeed, hitangle, vangle, vangang;
byte keys, oldkeys, controlnum;
word oldarms;
char pflags, upwalk, comtype;
word oldpack;
//long score;
//char cdraw,fdraw;
int handang; //, handh;
int cecita, hardcount; // rattoppo
fixed hwalk;
void makeboom(fixed x,fixed y, fixed z, int angle, int id, byte type);
void updatecommands();
word setpackbit(byte bit, byte val);
char getpackbit(word pack, byte bit);
word packcom();
void unpackcom(word pack);
void savepack(word pack);
word loadpack();
/*
void savepack2(word pack); // versione multiplayer (rete ?)
word loadpack2();
*/
// Statistics
long fires, hits, blood, tecno;
int kills, plkilled;
public:
Player(fixed px, fixed py, int ang, byte cntrlnum);
Player(int handle);
Player(fixed px, fixed py, int ang, TPlayerData &data,
byte cntrlnum);
void setcomtype(char type);
virtual void save(int handle);
~Player();
void moveto(fixed x, fixed y, int ang);
virtual void animate();
virtual void draw(int vidx, int vidy, char &cd, char &fd);
virtual void transf(int vidx, int vidy);
virtual void handle_event(TEvent &event);
void getdata(TPlayerData &data);
void updatestat(int type, int num);
void getstats(long &fires,long &hits,long &blood,
long &tecno,int &kills);
};