annotate test/putenemy.c @ 585:a5b902b20300 ia32-no-rname

ia32 reconfigure end (correct?)
author kono
date Wed, 18 Jan 2006 12:26:48 +0900
parents 528fed826f17
children 442e90958386
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
556
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
1 #include <math.h>
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
2
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
3 // for rand
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
4 #include <stdlib.h>
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
5
492
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
6 extern int printf(char *,...);
556
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
7 #define SANKAKU 100000
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
8
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
9 static const double pi2 = M_PI * 2.0;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
10
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
11 int mysin[181];
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
12 int mycos[181];
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
13
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
14 void sankakuf()
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
15 {
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
16 int i;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
17 for(i=0;i<181;i++)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
18 {
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
19 mysin[i]=sin(i /360.0*pi2)*SANKAKU;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
20 }
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
21 for(i=0;i<181;i++)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
22 {
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
23 mycos[i]=cos(i /360.0*pi2)*SANKAKU;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
24 }
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
25 }
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
26
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
27 int Mycos(int c)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
28 {
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
29 c%=360;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
30 if(c<0) c+=360;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
31 if((c<=180))
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
32 return(mycos[c]);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
33 if(c>180)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
34 return(mycos[180-(c-180)]);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
35 return(0);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
36 }
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
37
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
38 int Mysin(int c)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
39 {
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
40 c%=360;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
41 if(c<0) c+=360;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
42 if(c<=180)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
43 return(mysin[c]);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
44 if(c>180)
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
45 return(mysin[180-(c-180)]*-1);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
46 return(0);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
47 }
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
48
492
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
49 void
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
50 Putenemy(int charno,float x,float y,float sx,float sy,int move) {
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
51 if(x)
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
52 printf("#0051:%d %f %f %f %f %d\n",charno,x,y,sx,sy,move);
492
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
53 else
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
54 printf("#0053:check\n");
492
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
55 }
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
56 int
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
57 main()
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
58 {
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
59 int ix=32,iy=32; float fx=32,fy=32;
556
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
60 sankakuf();
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
61 printf("#0060:%d %d\n", Mysin(45),Mycos(-30));
556
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
62 {
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
63 float x=10,y=20;
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
64 Putenemy(3,x,y,(float) Mysin(15)*2/SANKAKU,(float)Mycos(15)*2/SANKAKU,0);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
65 //Putenemy(3,x,y,(float) Mysin(15)*2.0/SANKAKU,(float)Mycos(15)*2.0/SANKAKU,0);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
66 Putenemy(3,x,y,(float) Mysin(rand()%15*-1)*2/SANKAKU,(float)Mycos(rand()%15*-1)*2/SANKAKU,0);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
67 // Putenemy(3,x,y,(float) Mysin(rand()%15*-1)*2.0/SANKAKU,(float)Mycos(rand()%15*-1)*2.0/SANKAKU,0);
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
68 }
492
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
69 Putenemy(0,ix,iy,1,0,10);
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
70 Putenemy(1,(float)ix,(float)iy,1,0,10);
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
71 Putenemy(2,(float)ix,(float)iy,(float)ix,(float)iy,ix);
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
72 Putenemy(3,(float)ix,(float)iy,(float)ix,0,ix);
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
73 Putenemy(4,fx,fy,1,0,10);
556
ef225b589888 s-dandy fix
kono
parents: 496
diff changeset
74 return(0);
492
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
75 }
cc1a5f764782 *** empty log message ***
kono
parents:
diff changeset
76