annotate field.c @ 90:8edae89a3877

compile on Mac OS X
author Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
date Thu, 19 May 2011 16:41:21 +0900
parents ce9ef7dcf2f0
children cb6c6de125dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
1 /*
18
3780d1b2943e *** empty log message ***
gongo
parents: 17
diff changeset
2 * $Id$
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
3 */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
4 #include <stdio.h>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
5 #include <stdlib.h>
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
6 #include <stdbool.h>
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
7 //#include "libps2.h"
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
8 //#include "ps2util.h"
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
9 #include "mytype.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
10 #include "field.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
11 #include "car.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
12 #include "quotanion.h"
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
13 #include <stdbool.h>
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
14
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
15 #define DEFAULT_SET (EFFECT_TEXTURE_USE | EFFECT_ALPHABLEND_UNUSE | EFFECT_SHADING_FLAT)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
16 #define BUFSIZE 256
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
17
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
18 /* --- main.c --- */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
19 extern FILE *main_fp;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
20
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
21 static int field_num_max = 0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
22 static int field_num = 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
23
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
24 static FieldPtr field_list;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
25 static FieldPtr field_actual;
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
26 /*
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
27 static FieldPtr
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
28 field_create(char *fieldImg, char *colImg)//, TEXTURE* tex)
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
29 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
30 FieldPtr self;
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
31 // OBJECT *obj;
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
32 // PolygonInfo *xml;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
33 void *free_addr;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
34
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
35 // FVECTOR location = {0, 0, 0, 1};
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
36 // FVECTOR direction = {0, 0, 0, 1};
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
37
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
38 // obj = ps2util_obj_Create_fromXML(fieldImg);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
39 // memcpy(obj->xyz, location, sizeof(FVECTOR));
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
40 // memcpy(obj->angle, direction, sizeof(FVECTOR));
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
41 // ps2util_obj_Renew_transMatrix(obj);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
42 // ps2util_obj_Set_effect(obj, DEFAULT_SET);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
43 // ps2util_obj_Set_texture(obj, tex);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
44
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
45 // xml = xml_read_file(colImg); //ここでコースの走れる場所(当たり判定)
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
46
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
47 if (true){//malloc_align16(&free_addr, &self, sizeof(Field)) == -1) {
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
48 fprintf(stderr, "field.c: malloc_align16 error\n");
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
49 fflush(stderr);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
50 exit(EXIT_FAILURE);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
51 }
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
52 // self->object = obj;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
53 self->next = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
54 self->prev = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
55 self->free_addr = free_addr;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
56 #ifdef DEBUG
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
57 // fprintf(main_fp, "malloc fieldNode addr = %x(free), %x(obj)\n", (int)free_addr, (int)self);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
58 #endif
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
59 // col_init(&self->colface, xml);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
60
34
55f2d0326c4d *** empty log message ***
gongo
parents: 33
diff changeset
61 #ifdef DEBUG
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
62 // fprintf(main_fp, " facenum = %d\n", self->colface.facenum);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
63 // fprintf(main_fp, " facenum = %x(free), ", (int)self->colface.free_addr);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
64 // fprintf(main_fp, "facenum = %x(obj)\n", (int)self->colface.colface);
34
55f2d0326c4d *** empty log message ***
gongo
parents: 33
diff changeset
65 #endif
55f2d0326c4d *** empty log message ***
gongo
parents: 33
diff changeset
66
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
67 // xml_free(xml);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
68
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
69 return self;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
70 }
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
71 //こっちもどこでも呼ばれていないらしい(おれのせいですorz)
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
72 */
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
73
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
74 static void
32
b5c5ffd4d2f2 *** empty log message ***
gongo
parents: 18
diff changeset
75 field_new_readCSV(FILE *fp, int id)
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
76 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
77 FieldPtr fieldHead = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
78 FieldPtr newField = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
79 FieldPtr prevField = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
80 char buff[BUFSIZE], *bufp;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
81 char fieldImg[BUFSIZE], colImg[BUFSIZE], texname[BUFSIZE];
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
82 // TEXTURE *tex = NULL;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
83 int course_id;
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
84 bool flag = false;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
85
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
86 while ((bufp = fgets(buff, BUFSIZE, fp)) != NULL) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
87 bufp++;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
88
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
89 switch (buff[0]) {
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
90 case 'n': // コースIDの読み取り
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
91 if (!flag) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
92 sscanf(bufp, " %d\n", &course_id);
32
b5c5ffd4d2f2 *** empty log message ***
gongo
parents: 18
diff changeset
93 if (id == course_id) {
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
94 flag = true;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
95 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
96 } else {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
97 goto FINISH_LOAD;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
98 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
99 break;
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
100 case 't': // テクスチャのロード
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
101 if (flag) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
102 sscanf(bufp, " %s\n", texname);
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
103 // tex = read_png_file(texname);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
104 // ps2util_tex_Set(tex);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
105 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
106 break;
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
107 case 'c': // コースのロード
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
108 if (flag) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
109 sscanf(bufp, " %s %s\n", fieldImg, colImg);
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
110 // newField = field_create(fieldImg, colImg, tex);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
111 if (!fieldHead) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
112 fieldHead = prevField = newField;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
113 } else {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
114 prevField->next = newField;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
115 newField->prev = prevField;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
116 prevField = newField;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
117 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
118 newField->init = fieldHead;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
119 field_num_max++;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
120 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
121 break;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
122 default:
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
123 break;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
124 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
125 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
126
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
127 FINISH_LOAD:
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
128 // 先頭と最後尾のリンクを張る
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
129 newField->next = newField->init;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
130 newField->init->prev = newField;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
131
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
132 field_list = field_actual = fieldHead;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
133 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
134
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
135
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
136 /*---------------------/
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
137 FieldPtr
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
138 field_init:
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
139 指定したファイルからコースを生成する。
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
140 戻り値
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
141 コース先頭のポインタ
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
142 /---------------------*/
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
143 void
32
b5c5ffd4d2f2 *** empty log message ***
gongo
parents: 18
diff changeset
144 field_init(int id)
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
145 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
146 FILE *fp;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
147 char *filename = "course/course.dat";
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
148
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
149 if (!(fp = fopen(filename, "r"))) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
150 fprintf(main_fp, "error read file %s\n", filename);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
151 exit(EXIT_FAILURE);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
152 }
32
b5c5ffd4d2f2 *** empty log message ***
gongo
parents: 18
diff changeset
153 field_new_readCSV(fp, id);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
154 fclose(fp);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
155 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
156
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
157 /*
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
158 static void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
159 field_draw(FieldPtr p)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
160 {
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
161 // ps2_vu0_unit_matrix(p->object->transfer);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
162
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
163 // p->object->transfer[3][0] = p->location[0];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
164 // p->object->transfer[3][1] = p->location[1];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
165 // p->object->transfer[3][2] = p->location[2];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
166 // p->object->transfer[3][3] = p->location[3];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
167 // ps2util_obj_Draw(p->object);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
168 }
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
169 */
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
170
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
171 void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
172 field_update(CarPtr car)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
173 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
174 FieldPtr p;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
175
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
176 p = field_actual;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
177 // current
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
178 // p->location[0] = -car->location[0];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
179 // p->location[1] = -car->location[1];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
180 // p->location[2] = -car->location[2];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
181 // p->location[3] = 1;
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
182 // field_draw(p);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
183
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
184 // next
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
185 p = field_actual->next;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
186 if (p) {
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
187 // p->location[0] = -car->location[0];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
188 // p->location[1] = -car->location[1];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
189 // p->location[2] = -car->location[2];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
190 // p->location[3] = 1;
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
191 // field_draw(p);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
192 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
193
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
194 // prev
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
195 p = field_actual->prev;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
196 if (p) {
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
197 // p->location[0] = -car->location[0];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
198 // p->location[1] = -car->location[1];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
199 // p->location[2] = -car->location[2];
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
200 // p->location[3] = 1;
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
201 // field_draw(p);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
202 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
203 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
204
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
205 void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
206 field_destroy()
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
207 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
208 FieldPtr p = field_list;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
209 FieldPtr d;
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
210 // TEXTURE *t;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
211
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
212 p->prev->next = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
213
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
214 // t = p->object->surfaces->texture;
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
215 // ps2util_tex_Exclude(t);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
216 // free_texture(t);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
217
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
218 while (p) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
219 d = p;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
220 p = p->next;
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
221 // ps2util_obj_Free(d->object);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
222 // free(d->colface.free_addr);
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
223 // free(d->free_addr);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
224 #ifdef DEBUG
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
225 // fprintf(main_fp, "free fieldNode addr = %x\n", (int)d->free_addr);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
226 #endif
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
227 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
228
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
229 field_num_max = 0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
230 field_num = 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
231 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
232
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
233 /*
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
234 * 周回記録。1周する毎に1を返す。
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
235 */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
236 int
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
237 field_rap_increment(int n)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
238 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
239 field_num += n;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
240 if (field_num > field_num_max) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
241 field_num = 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
242 return 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
243 } else {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
244 return 0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
245 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
246 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
247
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
248 void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
249 field_set_actual(FieldPtr p)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
250 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
251 field_actual = p;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
252 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
253
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
254 FieldPtr
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
255 field_get_actual()
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
256 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
257 return field_actual;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
258 }