Exemplo n.º 1
0
void PrintRecord(Gamerec *g)
{

int i, len, count;
unsigned char xside;
Position temp;

if(g->moves[0].mtype == EMPTY)  {
  printf("\nGame record is empty.\n");
  return;  }

StartPosition(&temp);

printf("\n***** GAME RECORD *****\n");

for(len = 1; len < MAXGAMESIZE; len++)  {
  if(g->moves[(len*(len-1)/2)].mtype != EMPTY) printf("\n     %2d. ", len);
  count = 0;
  if(temp.side == WHITE) xside = BLACK;
  else xside = WHITE;
  while(count < len && !IsCheck(&temp, xside))  {
    i = len * (len - 1) / 2 + count;
    if(g->moves[i].mtype != EMPTY)   {
      PrintMove(&temp, &(g->moves[i]));
      MakeMove(&temp, &(g->moves[i]));  }
    else  {
      printf("\n");
      return;  }
    count++;  
    }
  if(temp.side == WHITE) temp.side = BLACK;
  else temp.side = WHITE;
  }
}
Exemplo n.º 2
0
void Missile::MoveMissile(Monster* mon,Ball* cha,float time){
	switch(nNowType){
	case 0:
		bStart = true;
		StartPosition(mon);
		RendValue();
		RendGoal(cha);
		nNowType = 1;
		break;
	case 1:
		vMissile_wall_length = vPosition - vBackPosition;
		if(D3DXVec3Length(&vMissile_wall_length)>6.0f){SetPosition(vPosition-(vMissile_wall_length)/1000);}
		else{nNowType = 2;}
		break;
	case 2:
		vGoal = cha->GetPosition()+cha->GetVelocity()*3;
		vMissile_my_length = vGoal - vPosition;
		D3DXVec3Normalize(&vMissile_my_length ,&vMissile_my_length );
		vVelocity = vMissile_my_length * nSpeed;
		nNowType = 3;
		break;
	case 3:
		SetPosition(vPosition+vVelocity/2);
		if(vPosition.x>MAXBOUNDX*2||vPosition.z>MAXBOUNDZ*2||vPosition.x<MINBOUNDX-100||vPosition.z<MINBOUNDZ-100){
			nNowType = 4;
		}
		break;
	case 4:
		if(bStart){
			bStart = false;
		}
		break;
	}
}