File: team.C

package info (click to toggle)
battleball 2.0-13
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,016 kB
  • ctags: 3,097
  • sloc: cpp: 15,310; makefile: 48; csh: 34
file content (45 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 1997 Philip A. Hardin (pahardin@cs.utexas.edu)
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License v2 or later.


#include "team.h"


int team::insigniaRandomizer= 0;


// The primary & secondary colors of the team insignia
int primaryColorNums[NUMINSIGNIA]= {
  c_white, c_darkGreen, c_yellow, c_firebrick, c_green3, c_orangeRed
};
int secondaryColorNums[NUMINSIGNIA]= {
  c_darkOliveGreen, c_forestGreen, c_blue, c_black, c_yellow, c_gray80
};


/*-------------------------------------------------------------------------*/
team::team(int num)
  : score(0),
    teamNum(num),
    hq(NULL)
{ 
  forii(fixedColors)
    colorNums[i]= i;
  int insigniaNum= (teamNum+insigniaRandomizer)%NUMINSIGNIA;
  colorNums[c_teamPrimary]= primaryColorNums[insigniaNum];
  colorNums[c_teamSecondary]= secondaryColorNums[insigniaNum];
}


/*-------------------------------------------------------------------------*/
// Initialize this team object for a new game round

void team::InitForRound(gobList& gobs, coord hqDist, int numTeams) {
  tcomp pos;
  pos.Ang()= -MA_PI/2 + (teamNum * 2*MA_PI)/numTeams;
  pos.Cart()= pt3d(hqDist,0) >> pos.Ang();
  pos.Ang() += MA_PI;
  hq= new bldgGob(pos,pt3d(0,0),teamNum);
  gobs.push_back(hq);
}