Mercurial > hg > old > magoroku_racing.bad
annotate ps2util.cc @ 101:67c843471b77
add name_dictionary.cc
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 02 Jun 2011 19:50:06 +0900 |
parents | e5f2eb98b575 |
children | 8a525ec378fc |
rev | line source |
---|---|
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
1 /* ps2util.c */ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
2 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
3 #include <string.h> |
91 | 4 #include <stdio.h> |
5 #include <stdlib.h> | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
6 #include <math.h> |
91 | 7 #include "libps2.h" |
8 #include "ps2util.h" | |
101
67c843471b77
add name_dictionary.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
9 #include "name_dictionary.h" |
91 | 10 |
11 /* | |
12 たぶん、本当は読み込んだ xml file から情報を取得するとかそんなんだと思う | |
13 どんな処理か分からないので、とりあえず、初期化している。 | |
14 */ | |
15 | |
100 | 16 OBJECT *ps2util_obj_Create_fromXML(const char *filename) |
91 | 17 { |
18 OBJECT *body; | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
19 |
91 | 20 /* |
21 body->xyz = {0,0,0,0}; | |
22 body->angle = {0,0,0,0}; | |
23 body->transfer = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; | |
24 body->*name = filename; | |
25 body->*free_me = NULL; | |
26 */ | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
27 |
91 | 28 return body; |
29 } | |
30 | |
31 | |
32 | |
33 void ps2util_obj_Set_effect(OBJECT *body, int def) | |
34 { | |
35 //none | |
36 } | |
37 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
38 // ベクトル v1 をベクトル v2 にコピーする |
91 | 39 void ps2_vu0_copy_vector(FVECTOR directionA, FVECTOR directionB) |
40 { | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
41 memcpy(directionA, directionB, sizeof(FVECTOR)); |
91 | 42 } |
43 | |
44 | |
45 void ps2util_obj_Renew_transMatrix(OBJECT *car){ | |
46 //none | |
47 } | |
48 | |
49 | |
50 /* | |
51 ps2 内の texture.c から | |
52 */ | |
100 | 53 TEXTURE* read_png_file(const char *texname) |
91 | 54 { |
98 | 55 printf("trace\n"); |
91 | 56 //とりあえず戻り値を返してエラーをどうにか |
57 TEXTURE* tex; | |
98 | 58 |
91 | 59 return tex; |
60 } | |
61 | |
62 | |
63 | |
95 | 64 int ps2util_tex_Set(TEXTURE* tex) |
91 | 65 { |
95 | 66 return -1; |
67 } | |
68 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
69 int ps2util_sprite_Create(ps2utilSprite *Sp, TEXTURE *sprite_tex) |
95 | 70 { |
71 return -1; | |
91 | 72 } |
73 | |
74 | |
75 void ps2util_obj_Set_texture(OBJECT* car_body, TEXTURE *tex) | |
76 { | |
77 //none | |
78 } | |
79 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
80 // 与えられた行列を単位行列に変換する |
95 | 81 void ps2_vu0_unit_matrix(FMATRIX m) |
91 | 82 { |
95 | 83 m[0][1] = m[0][2] = m[0][3] = 0; |
84 m[1][0] = m[1][2] = m[1][3] = 0; | |
85 m[2][0] = m[2][1] = m[2][3] = 0; | |
86 m[3][0] = m[3][1] = m[3][2] = 0; | |
87 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0; | |
91 | 88 } |
89 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
90 /* |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
91 Y軸を中心とした行列の回転 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
92 回転角 rx より X 軸を中心とした回転マトリックスを求めて、マトリックス m1 に左側から乗算して、その結果をマトリックス m0 に与える。 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
93 X 軸だけでなく Y 軸、Z 軸を中心とした関数もある。また3ついっんに回転させる関数もある。 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
94 */ |
95 | 95 void ps2_vu0_rot_matrix_y(FMATRIX result, FMATRIX m, float radian) |
91 | 96 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
97 // 回転行列を作ってかけてやれば良い |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
98 |
95 | 99 m[0][1] = m[0][2] = m[0][3] = 0; |
100 m[1][0] = m[1][2] = m[1][3] = 0; | |
101 m[2][0] = m[2][1] = m[2][3] = 0; | |
102 m[3][0] = m[3][1] = m[3][2] = 0; | |
103 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0; | |
104 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
105 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
106 m[0][0] = sinf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
107 m[2][2] = sinf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
108 m[0][2] = -cosf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
109 m[2][0] = cosf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
110 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
111 FMATRIX m1;// = m; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
112 memcpy(&m1, m, sizeof(FMATRIX)); |
95 | 113 |
114 ps2_vu0_mul_matrix(result, m1, m); | |
91 | 115 } |
116 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
117 // ベクトルの計算 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
118 // マトリックス m にベクトル を右から乗算して result に与える |
95 | 119 void ps2_vu0_apply_matrix(FVECTOR result, FMATRIX m, FVECTOR v) |
91 | 120 { |
95 | 121 result[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2] + m[0][3] * v[3] ; |
122 result[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2] + m[1][3] * v[3] ; | |
123 result[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2] + m[2][3] * v[3] ; | |
124 result[3] = m[3][0] * v[0] + m[3][1] * v[1] + m[3][2] * v[2] + m[3][3] * v[3] ; | |
91 | 125 } |
126 | |
127 | |
128 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed) | |
129 { | |
95 | 130 mov[0] = car_direction[0] * car_speed ; |
131 mov[1] = car_direction[1] * car_speed ; | |
132 mov[2] = car_direction[2] * car_speed ; | |
133 mov[3] = car_direction[3]; | |
91 | 134 } |
135 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
136 // ベクトル v1 の各要素とベクトル v2 の各要素を各々加算してv0に与える |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
137 // v0 = v1+v2 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
138 void ps2_vu0_add_vector(FVECTOR result, FVECTOR v0, FVECTOR v1) |
91 | 139 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
140 result[0] = v0[0] + v1[0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
141 result[1] = v0[1] + v1[1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
142 result[2] = v0[2] + v1[2]; |
98 | 143 // result[3] = v0[3] + v1[3]; |
144 result[3] = v0[3]; | |
91 | 145 } |
146 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
147 // 外積 |
95 | 148 void ps2_vu0_outer_product(FVECTOR result, FVECTOR v0, FVECTOR v1) |
91 | 149 { |
95 | 150 result[0] = v0[1] * v1[2] - v0[2] * v1[1] ; |
151 result[1] = v0[0] * v1[2] - v0[2] * v1[0] ; | |
152 result[2] = v0[0] * v1[1] - v0[1] * v1[0] ; | |
153 result[3] = 1; | |
91 | 154 } |
155 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
156 // 内積 |
95 | 157 float ps2_vu0_inner_product(FVECTOR v0, FVECTOR v1) |
91 | 158 { |
95 | 159 return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2]; |
91 | 160 } |
161 | |
162 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
163 void ps2_vu0_mul_matrix(FMATRIX result, FMATRIX m0, FMATRIX m1) |
91 | 164 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
165 result[0][0] = m0[0][0] * m1[0][0] + m0[0][1] * m1[1][0] + m0[0][2] * m1[2][0] + m0[0][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
166 result[0][1] = m0[0][0] * m1[0][1] + m0[0][1] * m1[1][1] + m0[0][2] * m1[2][1] + m0[0][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
167 result[0][2] = m0[0][0] * m1[0][2] + m0[0][1] * m1[1][2] + m0[0][2] * m1[2][2] + m0[0][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
168 result[0][3] = m0[0][0] * m1[0][3] + m0[0][1] * m1[1][3] + m0[0][2] * m1[2][3] + m0[0][3] * m1[3][3]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
169 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
170 result[1][0] = m0[1][0] * m1[0][0] + m0[1][1] * m1[1][0] + m0[1][2] * m1[2][0] + m0[1][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
171 result[1][1] = m0[1][0] * m1[0][1] + m0[1][1] * m1[1][1] + m0[1][2] * m1[2][1] + m0[1][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
172 result[1][2] = m0[1][0] * m1[0][2] + m0[1][1] * m1[1][2] + m0[1][2] * m1[2][2] + m0[1][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
173 result[1][3] = m0[1][0] * m1[0][3] + m0[1][1] * m1[1][3] + m0[1][2] * m1[2][3] + m0[1][3] * m1[3][3]; |
91 | 174 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
175 result[2][0] = m0[2][0] * m1[0][0] + m0[2][1] * m1[1][0] + m0[2][2] * m1[2][0] + m0[2][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
176 result[2][1] = m0[2][0] * m1[0][1] + m0[2][1] * m1[1][1] + m0[2][2] * m1[2][1] + m0[2][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
177 result[2][2] = m0[2][0] * m1[0][2] + m0[2][1] * m1[1][2] + m0[2][2] * m1[2][2] + m0[2][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
178 result[2][3] = m0[2][0] * m1[0][3] + m0[2][1] * m1[1][3] + m0[2][2] * m1[2][3] + m0[2][3] * m1[3][3]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
179 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
180 result[3][0] = m0[3][0] * m1[0][0] + m0[3][1] * m1[1][0] + m0[3][2] * m1[2][0] + m0[3][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
181 result[3][1] = m0[3][0] * m1[0][1] + m0[3][1] * m1[1][1] + m0[3][2] * m1[2][1] + m0[3][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
182 result[3][2] = m0[3][0] * m1[0][2] + m0[3][1] * m1[1][2] + m0[3][2] * m1[2][2] + m0[3][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
183 result[3][3] = m0[3][0] * m1[0][3] + m0[3][1] * m1[1][3] + m0[3][2] * m1[2][3] + m0[3][3] * m1[3][3]; |
91 | 184 } |
185 | |
186 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
187 void ps2_vu0_copy_matrix(FMATRIX transfer, FMATRIX pose) |
91 | 188 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
189 memcpy(transfer, pose, sizeof(FMATRIX)); |
91 | 190 } |
191 | |
95 | 192 void ps2util_obj_Free(OBJECT* obj) |
91 | 193 { |
95 | 194 free(obj); |
91 | 195 } |
196 | |
197 | |
198 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
199 void ps2_vu0_sub_vector(FVECTOR result, FVECTOR v0, FVECTOR v1) |
91 | 200 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
201 result[0] = v0[0] - v1[0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
202 result[1] = v0[1] - v1[1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
203 result[2] = v0[2] - v1[2]; |
98 | 204 result[3] = v0[3];// - v1[3]; |
91 | 205 } |
206 | |
207 | |
208 | |
95 | 209 void ps2_vu0_normalize(FVECTOR result, FVECTOR v) |
91 | 210 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
211 // 大きさで割ってるだけって |
98 | 212 float d = sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); |
95 | 213 result[0] = v[0] / d; |
214 result[1] = v[1] / d; | |
215 result[2] = v[2] / d; | |
216 result[3] = 1; | |
91 | 217 } |
218 | |
219 | |
220 void xml_free(PolygonInfo xml) | |
221 { | |
222 //none | |
223 } | |
224 | |
225 | |
226 void ps2util_obj_Draw(OBJECT *object) | |
227 { | |
228 //none | |
229 } | |
230 | |
231 | |
232 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite ) | |
233 { | |
234 //none | |
235 } | |
236 | |
237 | |
238 | |
239 | |
95 | 240 void ps2util_sprite_Set_basicAttribute(ps2utilSprite *p, |
241 unsigned short x, unsigned short y, | |
242 unsigned short sptable_tw1, unsigned short sptable_th1, | |
243 unsigned short sptable_tx, unsigned short sptable_ty, | |
244 unsigned short sptable_tw2, unsigned short sptable_th2, | |
245 int sprite_prio_foreground) | |
246 { | |
247 //none | |
248 } | |
249 | |
250 void ps2util_sprite_Request(ps2utilSprite *p) | |
251 { | |
252 //none | |
253 } | |
254 | |
255 | |
256 void ps2util_sprite_Unuse_alpha(ps2utilSprite *sp) | |
257 { | |
258 //none | |
259 } | |
260 | |
261 void ps2util_graphic_Init() | |
262 { | |
263 //none | |
264 } | |
265 | |
266 | |
267 /* | |
268 ps2 依存関係の sprite.c より引用。 | |
269 */ | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
270 #define SPRITE_HAS_4VERTEXIS 4 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
271 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
272 #define PS2_GS_XYZ3 1 // なにかわからん定数だから適当に作りました |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
273 |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
274 void |
95 | 275 sprite_disappear( SPRITE* sprite ) |
276 { | |
277 int i; | |
278 GsSpritePacket* packet = sprite->gs_packet; | |
279 for (i=0; i<SPRITE_HAS_4VERTEXIS; i++) | |
280 packet->primData[i].xyz_addr = PS2_GS_XYZ3; | |
281 } | |
282 | |
283 | |
91 | 284 /* |
285 ps2 依存関係から持ってきた。 | |
286 テクスチャに割り振ったメモリの解放処理? | |
287 元ファイル:texture.c | |
288 */ | |
289 void free_texture(TEXTURE *tex) | |
290 { | |
291 if (tex == NULL) return; | |
101
67c843471b77
add name_dictionary.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
292 |
67c843471b77
add name_dictionary.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
293 //delete_name_dictionary(tex->name); |
91 | 294 free(tex->free_texenv); |
295 free(tex->free_image); | |
296 free(tex); | |
297 } | |
298 | |
299 | |
300 /* | |
301 ps2 依存関係内の、texture.c から拝借 | |
302 この malloc によるメモリ取得をあちこちで行っているっぽい | |
95 | 303 cerium にある。 |
91 | 304 */ |
305 int malloc_align16(void *free, void *aligned, int size) | |
306 { | |
307 char *index; | |
308 unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned; | |
309 | |
310 if (free == NULL || aligned == NULL || size <= 0) return(-1); | |
311 | |
312 index = (char *)malloc(size + ALIGN_16BYTE); | |
313 if (index == NULL) { | |
314 return(-1); | |
315 } | |
316 | |
317 *f = *a = (unsigned long int)index; | |
318 if (((unsigned long int)index % ALIGN_16BYTE) != 0) { | |
319 index += ALIGN_16BYTE - ((unsigned long int)index % ALIGN_16BYTE); | |
320 *a = (unsigned long int)index; | |
321 } | |
322 | |
323 return(0); | |
324 } | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
325 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
326 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
327 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
328 // miya |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
329 void ps2util_tex_Exclude( TEXTURE* t ) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
330 { |
100 | 331 const char *test = "test"; |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
332 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
333 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
334 void ps2util_sprite_Draw() |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
335 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
336 printf("ps2util_sprite_Draw()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
337 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
338 |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
339 void ps2util_graphic_Finish() |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
340 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
341 printf("ps2util_graphic_Finish()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
342 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
343 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
344 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
345 // title.cに書いてた |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
346 void ps2util_sprite_Use_alpha( ps2utilSprite *title ) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
347 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
348 printf("ps2util_sprite_Use_alpha()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
349 } |