static void createscores(int score) { FILE *handle; int i,j; score_t scores[NUMSCORES]; char header[strlen (SCORE_HEADER)+1]; if (score == 0) return; /* No need saving this */ for (i = 1; i < NUMSCORES; i++) { strcpy (scores[i].name,"None"); scores[i].score = -1; scores[i].timestamp = 0; } getname (scores[0].name); scores[0].score = score; scores[0].timestamp = time (NULL); if ((handle = fopen (scorefile,"w")) == NULL) err1 (); strcpy (header,SCORE_HEADER); i = fwrite (header,strlen (SCORE_HEADER),1,handle); if (i != 1) err2(); for (i = 0; i < NUMSCORES; i++) { j = fwrite (scores[i].name,strlen (scores[i].name) + 1,1,handle); if (j != 1) err2(); j = fwrite (&(scores[i].score),sizeof (int),1,handle); if (j != 1) err2(); j = fwrite (&(scores[i].timestamp),sizeof (time_t),1,handle); if (j != 1) err2(); } fclose (handle); fprintf (stderr,"%s",scoretitle); fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name); }
void dgCollisionScene::CalcAABB (const dgMatrix& matrix, dgVector& p0, dgVector& p1) const { dgVector origin (matrix.TransformVector(m_boxOrigin)); dgVector size (m_boxSize.m_x * dgAbsf(matrix[0][0]) + m_boxSize.m_y * dgAbsf(matrix[1][0]) + m_boxSize.m_z * dgAbsf(matrix[2][0]) + DG_MAX_COLLISION_PADDING, m_boxSize.m_x * dgAbsf(matrix[0][1]) + m_boxSize.m_y * dgAbsf(matrix[1][1]) + m_boxSize.m_z * dgAbsf(matrix[2][1]) + DG_MAX_COLLISION_PADDING, m_boxSize.m_x * dgAbsf(matrix[0][2]) + m_boxSize.m_y * dgAbsf(matrix[1][2]) + m_boxSize.m_z * dgAbsf(matrix[2][2]) + DG_MAX_COLLISION_PADDING, dgFloat32 (0.0f)); p0 = origin - size; p1 = origin + size; #ifdef DG_DEBUG_AABB dgInt32 i; dgVector q0; dgVector q1; dgMatrix trans (matrix.Transpose()); for (i = 0; i < 3; i ++) { q0[i] = matrix.m_posit[i] + matrix.RotateVector (BoxSupportMapping(trans[i].Scale (-1.0f)))[i]; q1[i] = matrix.m_posit[i] + matrix.RotateVector (BoxSupportMapping(trans[i]))[i]; } dgVector err0 (p0 - q0); dgVector err1 (p1 - q1); dgFloat32 err; err = GetMax (size.m_x, size.m_y, size.m_z) * 0.5f; _ASSERTE ((err0 % err0) < err); _ASSERTE ((err1 % err1) < err); #endif }
void endproc() { struct labelblock *lp; if(parstate < INDATA) enddcl(); if(ctlstack >= ctls) err("DO loop or BLOCK IF not closed"); for(lp = labeltab ; lp < labtabend ; ++lp) if(lp->stateno!=0 && lp->labdefined==NO) err1("missing statement number %s", convic(lp->stateno) ); epicode(); procode(); dobss(); prdbginfo(); putbracket(); procinit(); /* clean up for next procedure */ }