annotate field.c @ 88:ce9ef7dcf2f0

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