comparison ps2util.c @ 91:cb6c6de125dc

halfway
author Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
date Thu, 26 May 2011 14:44:03 +0900
parents
children b0249b856488
comparison
equal deleted inserted replaced
90:8edae89a3877 91:cb6c6de125dc
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "libps2.h"
4 #include "ps2util.h"
5
6
7 /*
8 たぶん、本当は読み込んだ xml file から情報を取得するとかそんなんだと思う
9 どんな処理か分からないので、とりあえず、初期化している。
10 */
11
12 OBJECT *ps2util_obj_Create_fromXML(char *filename)
13 {
14 OBJECT *body;
15 /*
16 body->xyz = {0,0,0,0};
17 body->angle = {0,0,0,0};
18 body->transfer = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} };
19 body->*name = filename;
20 body->*free_me = NULL;
21 */
22 return body;
23 }
24
25
26
27 void ps2util_obj_Set_effect(OBJECT *body, int def)
28 {
29 //none
30 }
31
32
33 void ps2_vu0_copy_vector(FVECTOR directionA, FVECTOR directionB)
34 {
35 //none
36 }
37
38
39 void ps2util_obj_Renew_transMatrix(OBJECT *car){
40 //none
41 }
42
43
44 /*
45 ps2 内の texture.c から
46 */
47 TEXTURE* read_png_file(char *texname)
48 {
49 //とりあえず戻り値を返してエラーをどうにか
50 TEXTURE* tex;
51 return tex;
52 }
53
54
55
56 void ps2util_tex_Set(TEXTURE* tex)
57 {
58 //none
59 }
60
61
62 void ps2util_obj_Set_texture(OBJECT* car_body, TEXTURE *tex)
63 {
64 //none
65 }
66
67 void ps2_vu0_unit_matrix(FMATRIX rot)
68 {
69 //none
70 }
71
72 void ps2_vu0_rot_matrix_y(FMATRIX rot1, FMATRIX rot2, float radian)
73 {
74 //none
75 }
76
77
78 void ps2_vu0_apply_matrix(FVECTOR direction, FMATRIX rot, FVECTOR v)
79 {
80 //none
81 }
82
83
84 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed)
85 {
86 //none
87 }
88
89 void ps2_vu0_add_vector(FVECTOR car_location1, FVECTOR car_location2,FVECTOR mov)
90 {
91 //none
92 }
93
94
95 void ps2_vu0_outer_product(FVECTOR rotaxis, FVECTOR car_vertical, FVECTOR yd)
96 {
97 //none
98 }
99
100
101 float ps2_vu0_inner_product(FVECTOR yd, FVECTOR car_vertical)
102 {
103 float ret;
104 return ret;
105 }
106
107
108 void ps2_vu0_mul_matrix(FMATRIX pose1, FMATRIX yrot, FMATRIX pose2)
109 {
110 //none
111 }
112
113 void ps2_vu0_copy_matrix(FMATRIX car_body_transfer, FMATRIX pose)
114 {
115 //none
116 }
117
118
119 void ps2util_tex_Exclude(TEXTURE* t)
120 {
121 //none
122 }
123
124 void ps2util_obj_Free(OBJECT* p_body)
125 {
126 //none
127 }
128
129
130
131 void ps2_vu0_sub_vector(FVECTOR o0, FVECTOR p, FVECTOR p0)
132 {
133 //none
134 }
135
136
137
138
139 void ps2_vu0_normalize(FVECTOR colface_normal1, FVECTOR colface_normal2)
140 {
141 //none
142 }
143
144
145 void xml_free(PolygonInfo xml)
146 {
147 //none
148 }
149
150
151 void ps2util_obj_Draw(OBJECT *object)
152 {
153 //none
154 }
155
156
157 void gSprite_Init()
158 {
159 //none
160 }
161
162
163 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite )
164 {
165 //none
166 }
167
168
169
170
171
172
173
174 /*
175 からの関数
176 ps2 依存関係にあったけど、( name_dictionary.c ) の中のもの
177 だけど、他にも持ってくるものが増えるので、とりあえず、からの関数に
178 */
179 void delete_name_dictionary(const char *string)
180 {
181 /*
182 int number;
183 NAME_DIC *dic_ptr;
184
185 if (string == NULL) return;
186
187 number = hash_func(string,NAME_HASH_SIZE);
188
189 for (dic_ptr=name_hash+number;dic_ptr->name;dic_ptr=name_hash+number) {
190 if (!strcmp(string,dic_ptr->name)) {
191 dic_ptr->ref_num--;
192 if (dic_ptr->ref_num == 0) {
193 free(dic_ptr->name);
194 dic_ptr->name = NULL;
195 }
196 return;
197 } else {
198 number += REHASH_NUM;
199 if (number > NAME_HASH_SIZE) number -= NAME_HASH_SIZE;
200 }
201 }
202 */
203 }
204
205
206
207 /*
208 ps2 依存関係から持ってきた。
209 テクスチャに割り振ったメモリの解放処理?
210 元ファイル:texture.c
211 */
212 void free_texture(TEXTURE *tex)
213 {
214 if (tex == NULL) return;
215
216 delete_name_dictionary(tex->name);
217 free(tex->free_texenv);
218 free(tex->free_image);
219 free(tex);
220 }
221
222
223 /*
224 ps2 依存関係内の、texture.c から拝借
225 この malloc によるメモリ取得をあちこちで行っているっぽい
226 */
227 int malloc_align16(void *free, void *aligned, int size)
228 {
229 char *index;
230 unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned;
231
232 if (free == NULL || aligned == NULL || size <= 0) return(-1);
233
234 index = (char *)malloc(size + ALIGN_16BYTE);
235 if (index == NULL) {
236 return(-1);
237 }
238
239 *f = *a = (unsigned long int)index;
240 if (((unsigned long int)index % ALIGN_16BYTE) != 0) {
241 index += ALIGN_16BYTE - ((unsigned long int)index % ALIGN_16BYTE);
242 *a = (unsigned long int)index;
243 }
244
245 return(0);
246 }