#pragma once
+void ClientState_attach(entity this);
+
CLASS(Client, Object)
/** Client name */
ATTRIB(Client, netname, string, this.netname)
ATTRIB(Client, crypto_encryptmethod, string, this.crypto_encryptmethod)
/** the string "HMAC-SHA256" if signing, and string_null if plaintext */
ATTRIB(Client, crypto_signmethod, string, this.crypto_signmethod)
+
+ // custom
+
+ ATTRIB(Client, flags, int, 0)
+ ATTRIB(Client, playerid, int, 0)
+
+ METHOD(Client, m_unwind, bool(Client this));
+
INIT(Client) {
+ if (this.m_unwind(this)) return this;
+ this.classname = "player_joining";
this.flags = FL_CLIENT;
+ static int playerid_last;
+ this.playerid = ++playerid_last;
+ ClientState_attach(this);
}
ENDCLASS(Client)
+CLASS(Observer, Client)
+ INIT(Observer) {
+ this.classname = STR_OBSERVER;
+ }
+ DESTRUCTOR(Observer) { }
+ENDCLASS(Observer)
+
+CLASS(Spectator, Client)
+ INIT(Spectator) {
+ this.classname = STR_SPECTATOR;
+ }
+ DESTRUCTOR(Spectator) { }
+ENDCLASS(Spectator)
+
+CLASS(Player, Client)
+ INIT(Player) {
+ this.classname = STR_PLAYER;
+ }
+ DESTRUCTOR(Player) { }
+ENDCLASS(Player)
+
+METHOD(Client, m_unwind, bool(Client this))
+{
+ TC(Client, this);
+ #define UNWIND(class) MACRO_BEGIN if (this.instanceOf##class) { METHOD_REFERENCE(class, dtorimpl)(this); } MACRO_END
+ switch (this.classname) {
+ case "Observer":
+ UNWIND(Spectator);
+ UNWIND(Player);
+ return true;
+ case "Spectator":
+ UNWIND(Observer);
+ UNWIND(Player);
+ return true;
+ case "Player":
+ UNWIND(Observer);
+ UNWIND(Spectator);
+ return true;
+ }
+ #undef UNWIND
+ return false;
+}
+
float c1, c2, c3, c4;
void play_countdown(float finished, Sound samp);