ADDED src/Player.h Index: src/Player.h ================================================================== --- /dev/null +++ src/Player.h @@ -0,0 +1,12 @@ +#import "DynamicEntity.h" + +@interface Player: DynamicEntity +// special client ent that receives input and acts as camera +@property (class, nonatomic) Player *player1; +// sequence id for each respawn, used in damage test +@property (nonatomic) int lifeSequence; +@property (nonatomic) int frags; +@property (copy, nonatomic) OFString *team; + ++ (instancetype)player; +@end ADDED src/Player.m Index: src/Player.m ================================================================== --- /dev/null +++ src/Player.m @@ -0,0 +1,46 @@ +#import "Player.h" + +static Player *player1; + +@implementation Player ++ (void)initialize +{ + if (self == Player.class) + player1 = [[Player alloc] init]; +} + ++ (instancetype)player +{ + return [[self alloc] init]; +} + ++ (void)setPlayer1:(Player *)player1_ +{ + player1 = player1_; +} + ++ (Player *)player1 +{ + return player1; +} + +- (instancetype)init +{ + self = [super init]; + + _team = @""; + + return self; +} + +- (id)copy +{ + Player *copy = [super copy]; + + copy->_lifeSequence = _lifeSequence; + copy->_frags = _frags; + copy->_team = [_team copy]; + + return copy; +} +@end