source: abuse/trunk/src/calctrig.cpp @ 112

Last change on this file since 112 was 56, checked in by Sam Hocevar, 11 years ago
  • Add licensing terms to most C / C++ files (Ref #5).
File size: 829 bytes
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#include "config.h"
11
12#include <math.h>
13
14main()
15{
16  int i,x;
17  printf("int32_t sin_table[360]={\n  ");
18  for (i=0;i<360;i++)
19  {
20    printf("0x%08x",(long)(sin(i/180.0*3.141592654)*65536));
21    if (i!=359) printf(", ");
22    if ((i%6)==5) printf("\n  ");
23  }
24  printf("};\n");
25
26  printf("uint16_t atan_table[1662]={\n  ");
27 
28  for (i=1;i<1662;i++)
29  {   
30    if (i<29) x=0;
31    else x=(long)(atan(i/(double)29)/3.14152654*180)-45;
32    if (x<0) x+=360;
33    printf("%3d",x);
34    if (i!=1661) printf(", ");
35    if ((i%12)==11) printf("\n  ");
36  }
37  printf("};\n"); 
38}
Note: See TracBrowser for help on using the repository browser.