91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 #include <stdio.h>
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 #include <stdlib.h>
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 #include "libps2.h"
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 #include "ps2util.h"
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 たぶん、本当は読み込んだ xml file から情報を取得するとかそんなんだと思う
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 どんな処理か分からないので、とりあえず、初期化している。
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 OBJECT *ps2util_obj_Create_fromXML(char *filename)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 OBJECT *body;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 body->xyz = {0,0,0,0};
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 body->angle = {0,0,0,0};
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 body->transfer = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} };
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 body->*name = filename;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 body->*free_me = NULL;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 return body;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 void ps2util_obj_Set_effect(OBJECT *body, int def)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 void ps2_vu0_copy_vector(FVECTOR directionA, FVECTOR directionB)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 void ps2util_obj_Renew_transMatrix(OBJECT *car){
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 ps2 内の texture.c から
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 TEXTURE* read_png_file(char *texname)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 //とりあえず戻り値を返してエラーをどうにか
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 TEXTURE* tex;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 return tex;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55
|
95
|
56 int ps2util_tex_Set(TEXTURE* tex)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 {
|
95
|
58 return -1;
|
|
59 }
|
|
60
|
|
61 int ps2util_sprite_Create(ps2utilSprite sp, TEXTURE *sprite_tex)
|
|
62 {
|
|
63 return -1;
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 void ps2util_obj_Set_texture(OBJECT* car_body, TEXTURE *tex)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71
|
95
|
72 void ps2_vu0_unit_matrix(FMATRIX m)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 {
|
95
|
74 m[0][1] = m[0][2] = m[0][3] = 0;
|
|
75 m[1][0] = m[1][2] = m[1][3] = 0;
|
|
76 m[2][0] = m[2][1] = m[2][3] = 0;
|
|
77 m[3][0] = m[3][1] = m[3][2] = 0;
|
|
78 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0;
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80
|
95
|
81 void ps2_vu0_rot_matrix_y(FMATRIX result, FMATRIX m, float radian)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 {
|
95
|
83 FMATRIX rot;
|
|
84 m[0][1] = m[0][2] = m[0][3] = 0;
|
|
85 m[1][0] = m[1][2] = m[1][3] = 0;
|
|
86 m[2][0] = m[2][1] = m[2][3] = 0;
|
|
87 m[3][0] = m[3][1] = m[3][2] = 0;
|
|
88 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0;
|
|
89
|
|
90 m[0][0] = fsign(radian);
|
|
91 m[2][2] = fsign(radian);
|
|
92 m[0][2] = -fcos(radian);
|
|
93 m[2][0] = fcos(radian);
|
|
94
|
|
95 FMATRIX m1 = m;
|
|
96
|
|
97 ps2_vu0_mul_matrix(result, m1, m);
|
|
98
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
99 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101
|
95
|
102 void ps2_vu0_apply_matrix(FVECTOR result, FMATRIX m, FVECTOR v)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 {
|
95
|
104 result[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2] + m[0][3] * v[3] ;
|
|
105 result[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2] + m[1][3] * v[3] ;
|
|
106 result[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2] + m[2][3] * v[3] ;
|
|
107 result[3] = m[3][0] * v[0] + m[3][1] * v[1] + m[3][2] * v[2] + m[3][3] * v[3] ;
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 {
|
95
|
113 mov[0] = car_direction[0] * car_speed ;
|
|
114 mov[1] = car_direction[1] * car_speed ;
|
|
115 mov[2] = car_direction[2] * car_speed ;
|
|
116 mov[3] = car_direction[3];
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 void ps2_vu0_add_vector(FVECTOR car_location1, FVECTOR car_location2,FVECTOR mov)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
121 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124
|
95
|
125 void ps2_vu0_outer_product(FVECTOR result, FVECTOR v0, FVECTOR v1)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126 {
|
95
|
127 result[0] = v0[1] * v1[2] - v0[2] * v1[1] ;
|
|
128 result[1] = v0[0] * v1[2] - v0[2] * v1[0] ;
|
|
129 result[2] = v0[0] * v1[1] - v0[1] * v1[0] ;
|
|
130 result[3] = 1;
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
131 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
132
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
133
|
95
|
134 float ps2_vu0_inner_product(FVECTOR v0, FVECTOR v1)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
135 {
|
95
|
136 return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2];
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 void ps2_vu0_mul_matrix(FMATRIX pose1, FMATRIX yrot, FMATRIX pose2)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
141 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
142 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
143 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
144
|
95
|
145 void ps2_vu0_copy_matrix(FMATRIX from, FMATRIX to)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
146 {
|
95
|
147 to = from;
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
148 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
149
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
150
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
151 void ps2util_tex_Exclude(TEXTURE* t)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
152 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
153 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
154 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
155
|
95
|
156 void ps2util_obj_Free(OBJECT* obj)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
157 {
|
95
|
158 free(obj);
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
159 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
160
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
161
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
162
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
163 void ps2_vu0_sub_vector(FVECTOR o0, FVECTOR p, FVECTOR p0)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
164 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
165 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
166 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
167
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
168
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
169
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
170
|
95
|
171 void ps2_vu0_normalize(FVECTOR result, FVECTOR v)
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
172 {
|
95
|
173 float d = fsqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
|
174 result[0] = v[0] / d;
|
|
175 result[1] = v[1] / d;
|
|
176 result[2] = v[2] / d;
|
|
177 result[3] = 1;
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
178 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
179
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
180
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
181 void xml_free(PolygonInfo xml)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
182 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
183 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
184 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
185
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
186
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
187 void ps2util_obj_Draw(OBJECT *object)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
188 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
189 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
190 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
191
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
192
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
193 void gSprite_Init()
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
194 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
195 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
196 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
197
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
198
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
199 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite )
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
200 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
201 //none
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
202 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
203
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
204
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
205
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
206
|
95
|
207 void ps2util_sprite_Set_basicAttribute(ps2utilSprite *p,
|
|
208 unsigned short x, unsigned short y,
|
|
209 unsigned short sptable_tw1, unsigned short sptable_th1,
|
|
210 unsigned short sptable_tx, unsigned short sptable_ty,
|
|
211 unsigned short sptable_tw2, unsigned short sptable_th2,
|
|
212 int sprite_prio_foreground)
|
|
213 {
|
|
214 //none
|
|
215 }
|
|
216
|
|
217 void ps2util_sprite_Request(ps2utilSprite *p)
|
|
218 {
|
|
219 //none
|
|
220 }
|
|
221
|
|
222
|
|
223 void ps2util_sprite_Unuse_alpha(ps2utilSprite *sp)
|
|
224 {
|
|
225 //none
|
|
226 }
|
|
227
|
|
228 void ps2util_graphic_Init()
|
|
229 {
|
|
230 //none
|
|
231 }
|
|
232
|
|
233
|
|
234 /*
|
|
235 ps2 依存関係の sprite.c より引用。
|
|
236 */
|
|
237 inline void
|
|
238 sprite_disappear( SPRITE* sprite )
|
|
239 {
|
|
240
|
|
241 int i;
|
|
242 GsSpritePacket* packet = sprite->gs_packet;
|
|
243 for (i=0; i<SPRITE_HAS_4VERTEXIS; i++)
|
|
244 packet->primData[i].xyz_addr = PS2_GS_XYZ3;
|
|
245
|
|
246 }
|
|
247
|
|
248
|
|
249
|
|
250
|
|
251
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
252
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
253
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
254
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
255 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
256 からの関数
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
257 ps2 依存関係にあったけど、( name_dictionary.c ) の中のもの
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
258 だけど、他にも持ってくるものが増えるので、とりあえず、からの関数に
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
259 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
260 void delete_name_dictionary(const char *string)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
261 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
262 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
263 int number;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
264 NAME_DIC *dic_ptr;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
265
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
266 if (string == NULL) return;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
267
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
268 number = hash_func(string,NAME_HASH_SIZE);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
269
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
270 for (dic_ptr=name_hash+number;dic_ptr->name;dic_ptr=name_hash+number) {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
271 if (!strcmp(string,dic_ptr->name)) {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
272 dic_ptr->ref_num--;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
273 if (dic_ptr->ref_num == 0) {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
274 free(dic_ptr->name);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
275 dic_ptr->name = NULL;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
276 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
277 return;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
278 } else {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
279 number += REHASH_NUM;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
280 if (number > NAME_HASH_SIZE) number -= NAME_HASH_SIZE;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
281 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
282 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
283 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
284 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
285
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
286
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
287
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
288 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
289 ps2 依存関係から持ってきた。
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
290 テクスチャに割り振ったメモリの解放処理?
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
291 元ファイル:texture.c
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
292 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
293 void free_texture(TEXTURE *tex)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
294 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
295 if (tex == NULL) return;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
296
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
297 delete_name_dictionary(tex->name);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
298 free(tex->free_texenv);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
299 free(tex->free_image);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
300 free(tex);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
301 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
302
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
303
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
304 /*
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
305 ps2 依存関係内の、texture.c から拝借
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
306 この malloc によるメモリ取得をあちこちで行っているっぽい
|
95
|
307 cerium にある。
|
91
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
308 */
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
309 int malloc_align16(void *free, void *aligned, int size)
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
310 {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
311 char *index;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
312 unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
313
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
314 if (free == NULL || aligned == NULL || size <= 0) return(-1);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
315
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
316 index = (char *)malloc(size + ALIGN_16BYTE);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
317 if (index == NULL) {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
318 return(-1);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
319 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
320
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
321 *f = *a = (unsigned long int)index;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
322 if (((unsigned long int)index % ALIGN_16BYTE) != 0) {
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
323 index += ALIGN_16BYTE - ((unsigned long int)index % ALIGN_16BYTE);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
324 *a = (unsigned long int)index;
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
325 }
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
326
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
327 return(0);
|
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
328 }
|