Spyro 1 Reverse Engineering
Decompilation of functions from Spyro 1 into human readable C
 
Loading...
Searching...
No Matches
vector.c
Go to the documentation of this file.
1#include <custom_types.h>
2
20void Vec3Add(int* result, int* a, int* b)
21{
22 int temp_a1 = a[1];
23 int temp_a2 = a[2];
24 int temp_b1 = b[1];
25 int temp_b2 = b[2];
26
27 result[0] = a[0] + b[0];
28 result[1] = temp_a1 + temp_b1;
29 result[2] = temp_a2 + temp_b2;
30
31 return;
32}
33
34
47void Vec3Copy(int* dst, int* src)
48{
49 int temp_src1 = src[1];
50 int temp_src2 = src[2];
51
52 dst[0] = src[0];
53 dst[1] = temp_src1;
54 dst[2] = temp_src2;
55
56 return;
57}
58
68void MatrixTranspose(uint* outputMatrix, uint* inputMatrix)
69
70{
71 uint A12;
72 uint A23;
73 uint A21;
74 uint A31;
75 uint A13;
76 uint A23A22;
77 uint A32;
78 uint A33;
79
80 uint B13;
81 uint B32;
82
83 A23A22 = inputMatrix[2];
84 A12 = *inputMatrix & 0xffff0000;
85 A21 = inputMatrix[1] & 0xffff0000;
86 A13 = inputMatrix[1] ^ A21;
87 B13 = A13 & 0xffff;
88 A31 = inputMatrix[3] & 0xffff;
89 A32 = inputMatrix[3] ^ A31;
90 A23 = A23A22 & 0xffff0000;
91 B32 = A32 & 0xffff0000;
92 *outputMatrix = *inputMatrix ^ A12 | A21;
93 outputMatrix[1] = (A13 | A12) ^ B13 | A31;
94 outputMatrix[2] = A23A22 ^ A23 | B32;
95 outputMatrix[3] = (A32 | B13) ^ B32 | A23;
96 outputMatrix[4] = inputMatrix[4];
97 return;
98}
99
100// void MatrixTranspose(unsigned int *outputMatrix, unsigned int *inputMatrix)
101
102// {
103
104// *outputMatrix = (*inputMatrix & 0xffff) + (inputMatrix[1] & 0xffff0000);
105// outputMatrix[1] = (inputMatrix[3] & 0xffff) + (*inputMatrix & 0xffff0000);
106// outputMatrix[2] = (inputMatrix[2] & 0xffff) + (inputMatrix[3] & 0xffff0000);
107// outputMatrix[3] = (inputMatrix[1] & 0xffff) + (inputMatrix[2] & 0xffff0000);
108// outputMatrix[4] = inputMatrix[4];
109// return;
110// }
111
112 // end of reveresed_functions
unsigned int uint
void Vec3Add(int *result, int *a, int *b)
Adds vector 'a' and vector 'b' together, and stores the resulting vector in 'result'.
Definition vector.c:20
void MatrixTranspose(uint *outputMatrix, uint *inputMatrix)
Definition vector.c:68
void Vec3Copy(int *dst, int *src)
Copies the 'src' Vector to the 'dst' Vector.
Definition vector.c:47