DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
mathutil.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "common.h"
4
13// clang-format off
18
19// clang-format on
20
29typedef void (*MWRuntimeObjectFunction)(void *object, int mode);
30
31extern "C" void __construct_array(void *array, MWRuntimeObjectFunction constructor, MWRuntimeObjectFunction destructor, unsigned int element_size, unsigned int count);
32
40extern "C" void *__construct_new_array(void *allocation, MWRuntimeObjectFunction constructor, MWRuntimeObjectFunction destructor, unsigned int element_size, unsigned int count);
41
49void __dl(void *storage) throw();
50
58extern "C" char __throw_catch_compare(const char *thrown_type, const char *caught_type, long *pointer_adjustment);
59
67extern "C" void unexpected__3stdFv();
68
76extern "C" void terminate__3stdFv();
77
85extern "C" void duhandler__3stdFv();
86
94extern "C" void dthandler__3stdFv();
95
104
108extern "C" void (*thandler__3std)() __attribute__((section(".data"))) __attribute__((aligned(8)));
109
113extern "C" void (*uhandler__3std)() __attribute__((section(".data"))) __attribute__((aligned(8)));
114
118extern "C" MWGlobalDestructor *__global_destructor_chain __attribute__((section(".bss")));
119
127extern "C" void *__register_global_object(void *object, MWRuntimeObjectFunction destructor, MWGlobalDestructor *record);
128
136extern "C" void __initialize_cpp_rts(void *first, void *last, void *overlay_start, void *overlay_end);
137
145char *__DecodeUnsignedNumber(char *encoded, unsigned int *value);
146
154char *__DecodeSignedNumber(char *encoded, int *value);
155
174
179 unsigned int count;
180 unsigned int unused_unsigned;
182 unsigned char *types;
183};
184
185extern "C" void __end__catch(MWCatchRecord *record);
186
194extern "C" void __unexpected(void *exception_record);
195
203extern "C" void mwInit(int argc, const char **argv, const char **envp);
204
209 u8 unk_00[0x14];
213 u8 unk_20[0x20];
214};
215
216STATIC_ASSERT(sizeof(OverlayHeader) == 0x40);
217
225extern "C" void mwOverlayInit(void *overlay, int size);
226
234extern "C" void MWNotifyOverlayLoaded(void *address);
235
243extern "C" int mwBload(char *path, void *buffer);
244
252extern "C" int mwLoadOverlay(char *path, void *address);
253
260void VectorMax(float *max, float *a, float *b);
261
268void VectorMax(float *max, float *a, float *b, float *c);
269
276void VectorMax(float *max, float *a, float *b, float *c, float *d);
277
284void VectorMin(float *min, float *a, float *b);
285
292void VectorMin(float *min, float *a, float *b, float *c, float *d);
293
300void VectorMaxMin(float *max, float *min, float *a, float *b);
301
308void VectorMaxMin(float *max, float *min, float *a, float *b, float *c);
309
316void VectorMaxMin(float *max, float *min, float *a, float *b, float *c, float *d);
317
324void PlaneNormal(float *normal, float *v0, float *v1, float *v2);
325
331float DistPlanePoint(float *normal, float *on_plane, float *point);
332
338float ReflectionPlane(float *normal, float *on_plane, float *point, float *reflection);
339
345int IntersectionPoint_line_poly3(float *from, float *to, float *v0, float *v1, float *v2, float *normal, float *hit);
346
352int Check_Point_Poly3_XYZ(float *point, float *v0, float *v1, float *v2, float *normal);
353
359float DistVector(float *vector);
360
368float DistVector(float *a, float *b);
369
376void MulMatrix(float (*product)[4], float (*left_matrix)[4], float (*right_matrix)[4]);
377
384void RotMatrixY(float (*matrix)[4], float angle_y);
385
392void LookAtMatrixZ(float (*matrix)[4], float *direction);
393
400void ApplyMatrixN(float (*out)[4], float (*matrix)[4], float (*in)[4], int count);
401
408void VectorInterpolate(float *out, float *from, float *to, float step, int mode);
409
415float AngleInterpolate(float from, float to, float step, int mode);
416
423int AngleCmp(float a, float b, float tolerance);
424
432float AngleLimit(float angle);
433
439float rnd();
440
446float nrnd();
447
454void CreateSinTable();
455
461float Sinf(float angle);
462
468float Cosf(float angle);
469
475extern void (*__static_init[])();
476
480extern void (*__static_init_end[])();
481
489extern "C" void *__dt__Q23std9exceptionFv(void **self, short flag) throw();
490
498extern "C" const char *what__Q23std9exceptionCFv(const void *exception);
499
507extern "C" void *__dt__Q23std13bad_exceptionFv(void **self, short flag) throw();
508
516extern "C" const char *what__Q23std13bad_exceptionCFv(const void *exception);
517
521extern const unsigned char __RTTI__Q23std9exception[];
522
523struct MWBaseClass;
524
529 const char *name;
531};
532
538 int offset;
539};
540
542 MWBaseClass base;
543 const MWTypeInfo *end;
544};
545
549extern const char BadExceptionTypeName[];
550
554extern const char ExceptionTypeName[];
555
559extern const MWTypeInfo ExceptionTypeInfo;
560
565
570
574extern const char ExceptionWhat[];
575
579extern const char BadExceptionWhat[];
float AngleInterpolate(float from, float to, float step, int mode)
void mwOverlayInit(void *overlay, int size)
Definition mathutil.cpp:645
void ApplyMatrixN(float(*out)[4], float(*matrix)[4], float(*in)[4], int count)
void * __construct_new_array(void *allocation, MWRuntimeObjectFunction constructor, MWRuntimeObjectFunction destructor, unsigned int element_size, unsigned int count)
Definition mathutil.cpp:119
const char BadExceptionWhat[]
Definition mathutil.cpp:582
void terminate__3stdFv()
Definition mathutil.cpp:351
void __dl(void *storage)
Definition mathutil.cpp:155
void __end__catch(MWCatchRecord *record)
Definition mathutil.cpp:508
const char ExceptionTypeName[]
Definition mathutil.cpp:575
float rnd()
void VectorMaxMin(float *max, float *min, float *a, float *b)
Definition mathutil.cpp:803
void mwInit(int argc, const char **argv, const char **envp)
Definition mathutil.cpp:634
void VectorInterpolate(float *out, float *from, float *to, float step, int mode)
void RotMatrixY(float(*matrix)[4], float angle_y)
void __initialize_cpp_rts(void *first, void *last, void *overlay_start, void *overlay_end)
Definition mathutil.cpp:413
void duhandler__3stdFv()
Definition mathutil.cpp:365
void __construct_array(void *array, MWRuntimeObjectFunction constructor, MWRuntimeObjectFunction destructor, unsigned int element_size, unsigned int count)
Definition mathutil.cpp:94
void VectorMin(float *min, float *a, float *b)
Definition mathutil.cpp:771
float Cosf(float angle)
InterpolateMode
Definition mathutil.hpp:14
@ INTERPOLATE_FRACTION
Definition mathutil.hpp:16
@ INTERPOLATE_STEP
Definition mathutil.hpp:15
const MWSingleBaseClass BadExceptionBaseClasses
Definition mathutil.cpp:577
void * __register_global_object(void *object, MWRuntimeObjectFunction destructor, MWGlobalDestructor *record)
Definition mathutil.cpp:393
const MWTypeInfo ExceptionTypeInfo
Definition mathutil.cpp:576
float DistPlanePoint(float *normal, float *on_plane, float *point)
Definition mathutil.cpp:881
void LookAtMatrixZ(float(*matrix)[4], float *direction)
void * __dt__Q23std9exceptionFv(void **self, short flag)
Definition mathutil.cpp:171
void(* __static_init[])()
int Check_Point_Poly3_XYZ(float *point, float *v0, float *v1, float *v2, float *normal)
Definition mathutil.cpp:923
int AngleCmp(float a, float b, float tolerance)
void CreateSinTable()
float DistVector(float *vector)
Definition mathutil.cpp:965
const char * what__Q23std13bad_exceptionCFv(const void *exception)
Definition mathutil.cpp:620
char * __DecodeSignedNumber(char *encoded, int *value)
Definition mathutil.cpp:472
float ReflectionPlane(float *normal, float *on_plane, float *point, float *reflection)
Definition mathutil.cpp:888
const char * what__Q23std9exceptionCFv(const void *exception)
Definition mathutil.cpp:194
int IntersectionPoint_line_poly3(float *from, float *to, float *v0, float *v1, float *v2, float *normal, float *hit)
Definition mathutil.cpp:899
void MulMatrix(float(*product)[4], float(*left_matrix)[4], float(*right_matrix)[4])
const unsigned char __RTTI__Q23std9exception[]
float AngleLimit(float angle)
const char ExceptionWhat[]
Definition mathutil.cpp:80
void(* __static_init_end[])()
void PlaneNormal(float *normal, float *v0, float *v1, float *v2)
Definition mathutil.cpp:863
void dthandler__3stdFv()
Definition mathutil.cpp:379
const MWTypeInfo __RTTI__Q23std13bad_exception
Definition mathutil.cpp:581
const char BadExceptionTypeName[]
Definition mathutil.cpp:574
char __throw_catch_compare(const char *thrown_type, const char *caught_type, long *pointer_adjustment)
Definition mathutil.cpp:213
int mwBload(char *path, void *buffer)
Definition mathutil.cpp:676
int mwLoadOverlay(char *path, void *address)
Definition mathutil.cpp:705
MWGlobalDestructor * __global_destructor_chain
Definition mathutil.hpp:118
void __unexpected(void *exception_record)
Definition mathutil.cpp:544
float nrnd()
void(* uhandler__3std)()
Definition mathutil.hpp:113
void MWNotifyOverlayLoaded(void *address)
Definition mathutil.cpp:667
void VectorMax(float *max, float *a, float *b)
Definition mathutil.cpp:723
float Sinf(float angle)
void * __dt__Q23std13bad_exceptionFv(void **self, short flag)
Definition mathutil.cpp:593
void unexpected__3stdFv()
Definition mathutil.cpp:337
void(* thandler__3std)()
Definition mathutil.hpp:108
void(* MWRuntimeObjectFunction)(void *object, int mode)
Definition mathutil.hpp:29
char * __DecodeUnsignedNumber(char *encoded, unsigned int *value)
Definition mathutil.cpp:436
const MWTypeInfo * type
Definition mathutil.hpp:537
MWRuntimeObjectFunction destructor
Definition mathutil.hpp:169
void * sub_object
Definition mathutil.hpp:170
void * stack_top
Definition mathutil.hpp:172
const char * type_info
Definition mathutil.hpp:168
unsigned int unused_unsigned
Definition mathutil.hpp:180
unsigned char * types
Definition mathutil.hpp:182
MWRuntimeObjectFunction destructor
Definition mathutil.hpp:101
MWGlobalDestructor * next
Definition mathutil.hpp:100
const char * name
Definition mathutil.hpp:529
const MWBaseClass * bases
Definition mathutil.hpp:530
void * static_init_end
Definition mathutil.hpp:212
void * static_init
Definition mathutil.hpp:211