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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include <stdio.h>
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 #include "libps2.h"
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 /*
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 たぶん、本当は読み込んだ xml file から情報を取得するとかそんなんだと思う
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 どんな処理か分からないので、とりあえず、初期化している。
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 */
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
100
e5f2eb98b575 change cc
e085768
parents: 99
diff changeset
16 OBJECT *ps2util_obj_Create_fromXML(const char *filename)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 /*
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 body->xyz = {0,0,0,0};
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 body->angle = {0,0,0,0};
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 body->transfer = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} };
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 body->*name = filename;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 body->*free_me = NULL;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 */
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
27
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 return body;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 void ps2util_obj_Set_effect(OBJECT *body, int def)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 //none
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 void ps2_vu0_copy_vector(FVECTOR directionA, FVECTOR directionB)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 void ps2util_obj_Renew_transMatrix(OBJECT *car){
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 //none
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 /*
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 ps2 内の texture.c から
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 */
100
e5f2eb98b575 change cc
e085768
parents: 99
diff changeset
53 TEXTURE* read_png_file(const char *texname)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 {
98
1033fece71ce text_vector
e085768
parents: 97
diff changeset
55 printf("trace\n");
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 //とりあえず戻り値を返してエラーをどうにか
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 TEXTURE* tex;
98
1033fece71ce text_vector
e085768
parents: 97
diff changeset
58
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 return tex;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
64 int ps2util_tex_Set(TEXTURE* tex)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
66 return -1;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
67 }
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
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
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
70 {
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
71 return -1;
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 void ps2util_obj_Set_texture(OBJECT* car_body, TEXTURE *tex)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 //none
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
80 // 与えられた行列を単位行列に変換する
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
81 void ps2_vu0_unit_matrix(FMATRIX m)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
83 m[0][1] = m[0][2] = m[0][3] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
84 m[1][0] = m[1][2] = m[1][3] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
85 m[2][0] = m[2][1] = m[2][3] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
86 m[3][0] = m[3][1] = m[3][2] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
87 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0;
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
95 void ps2_vu0_rot_matrix_y(FMATRIX result, FMATRIX m, float radian)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
99 m[0][1] = m[0][2] = m[0][3] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
100 m[1][0] = m[1][2] = m[1][3] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
101 m[2][0] = m[2][1] = m[2][3] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
102 m[3][0] = m[3][1] = m[3][2] = 0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
103 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
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
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
113
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
114 ps2_vu0_mul_matrix(result, m1, m);
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
119 void ps2_vu0_apply_matrix(FVECTOR result, FMATRIX m, FVECTOR v)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
121 result[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2] + m[0][3] * v[3] ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
122 result[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2] + m[1][3] * v[3] ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
123 result[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2] + m[2][3] * v[3] ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
124 result[3] = m[3][0] * v[0] + m[3][1] * v[1] + m[3][2] * v[2] + m[3][3] * v[3] ;
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
130 mov[0] = car_direction[0] * car_speed ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
131 mov[1] = car_direction[1] * car_speed ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
132 mov[2] = car_direction[2] * car_speed ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
133 mov[3] = car_direction[3];
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
1033fece71ce text_vector
e085768
parents: 97
diff changeset
143 // result[3] = v0[3] + v1[3];
1033fece71ce text_vector
e085768
parents: 97
diff changeset
144 result[3] = v0[3];
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
147 // 外積
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
148 void ps2_vu0_outer_product(FVECTOR result, FVECTOR v0, FVECTOR v1)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
150 result[0] = v0[1] * v1[2] - v0[2] * v1[1] ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
151 result[1] = v0[0] * v1[2] - v0[2] * v1[0] ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
152 result[2] = v0[0] * v1[1] - v0[1] * v1[0] ;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
153 result[3] = 1;
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
155
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
156 // 内積
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
157 float ps2_vu0_inner_product(FVECTOR v0, FVECTOR v1)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
159 return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2];
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
192 void ps2util_obj_Free(OBJECT* obj)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 {
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
194 free(obj);
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
1033fece71ce text_vector
e085768
parents: 97
diff changeset
204 result[3] = v0[3];// - v1[3];
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
209 void ps2_vu0_normalize(FVECTOR result, FVECTOR v)
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 {
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
211 // 大きさで割ってるだけって
98
1033fece71ce text_vector
e085768
parents: 97
diff changeset
212 float d = sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
213 result[0] = v[0] / d;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
214 result[1] = v[1] / d;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
215 result[2] = v[2] / d;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
216 result[3] = 1;
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 void xml_free(PolygonInfo xml)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 //none
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 void ps2util_obj_Draw(OBJECT *object)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 //none
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite )
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 //none
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
237
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
240 void ps2util_sprite_Set_basicAttribute(ps2utilSprite *p,
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
241 unsigned short x, unsigned short y,
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
242 unsigned short sptable_tw1, unsigned short sptable_th1,
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
243 unsigned short sptable_tx, unsigned short sptable_ty,
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
244 unsigned short sptable_tw2, unsigned short sptable_th2,
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
245 int sprite_prio_foreground)
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
246 {
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
247 //none
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
248 }
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
249
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
250 void ps2util_sprite_Request(ps2utilSprite *p)
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
251 {
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
252 //none
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
253 }
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
254
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
255
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
256 void ps2util_sprite_Unuse_alpha(ps2utilSprite *sp)
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
257 {
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
258 //none
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
259 }
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
260
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
261 void ps2util_graphic_Init()
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
262 {
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
263 //none
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
264 }
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
265
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
266
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
267 /*
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
268 ps2 依存関係の sprite.c より引用。
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
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
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
275 sprite_disappear( SPRITE* sprite )
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
276 {
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
277 int i;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
278 GsSpritePacket* packet = sprite->gs_packet;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
279 for (i=0; i<SPRITE_HAS_4VERTEXIS; i++)
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
280 packet->primData[i].xyz_addr = PS2_GS_XYZ3;
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
281 }
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
282
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
283
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 /*
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 ps2 依存関係から持ってきた。
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 テクスチャに割り振ったメモリの解放処理?
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 元ファイル:texture.c
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 */
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 void free_texture(TEXTURE *tex)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 free(tex->free_texenv);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 free(tex->free_image);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 free(tex);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
299
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 /*
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 ps2 依存関係内の、texture.c から拝借
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 この malloc によるメモリ取得をあちこちで行っているっぽい
95
b0249b856488 change_ps2util
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
303 cerium にある。
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 */
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 int malloc_align16(void *free, void *aligned, int size)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 char *index;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
309
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 if (free == NULL || aligned == NULL || size <= 0) return(-1);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
311
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 index = (char *)malloc(size + ALIGN_16BYTE);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 if (index == NULL) {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 return(-1);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 *f = *a = (unsigned long int)index;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 if (((unsigned long int)index % ALIGN_16BYTE) != 0) {
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 index += ALIGN_16BYTE - ((unsigned long int)index % ALIGN_16BYTE);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 *a = (unsigned long int)index;
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 }
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
322
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 return(0);
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
e5f2eb98b575 change cc
e085768
parents: 99
diff changeset
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 }