DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
collision.hpp
1#pragma once
2
3#include "common.h"
4
5#include <libvu0.h>
6
10// clang-format off
11enum AreaKind {
12 AREA_KIND_NONE = 0,
13 AREA_KIND_FADE_OUT = 2,
14 AREA_KIND_AMBIENT_0 = 3,
15 AREA_KIND_AMBIENT_1 = 4,
16 AREA_KIND_HIGH_CAMERA = 10,
17};
18
19// clang-format on
20
21struct MDT_HEADER;
22
26class CBoxVu0 {
27public:
28 sceVu0FVECTOR max;
29 sceVu0FVECTOR min;
30};
31
36public:
37 float unk_00;
38 float unk_04;
39 float unk_08;
40 float unk_0c;
41};
42
46class CCPoly {
47public:
48 sceVu0FVECTOR vertex[3];
49 sceVu0FVECTOR normal;
51 union {
54 struct {
59 u8 unk_48[8];
60 } attr;
61 };
62} __attribute__((aligned(16)));
63
67class CCPolyBox {
68public:
71};
72
77public:
78 sceVu0FVECTOR max;
79 sceVu0FVECTOR min;
81 virtual int GetPolygon(int index, sceVu0FMATRIX v0, sceVu0FMATRIX v1, sceVu0FMATRIX v2);
82 virtual int GetMaxY(float *position);
83 virtual sceVu0FVECTOR *GetVertexAddress(int *count);
84 virtual int Intersection(float *from, float *to, float *hit);
85 virtual int PickUpNearPoly(CCPoly *poly, float *position, float radius);
86 virtual int PickUpNearPoly(CCPoly *poly, const CBoxVu0 &box);
87 virtual int PickUpNearPoly(CCPoly *poly);
88 virtual void Initialize();
89
90 void CreateBBox();
91};
92
96class CCollisionMDT : public CCollision {
97public:
102 /* The same three fields Initialize clears, cleared again here because construction cannot
103 reach a virtual of its own class. */
104 CCollisionMDT() {
105 model = 0;
106 mesh = 0;
107 mesh_count = 0;
108 }
109
110 virtual int GetPolygon(int index, sceVu0FMATRIX v0, sceVu0FMATRIX v1, sceVu0FMATRIX v2);
111 virtual int GetMaxY(float *position);
112 virtual sceVu0FVECTOR *GetVertexAddress(int *count);
113 virtual int Intersection(float *from, float *to, float *hit);
114 virtual int PickUpNearPoly(CCPoly *poly, float *position, float radius);
115 virtual int PickUpNearPoly(CCPoly *poly, const CBoxVu0 &box);
116 virtual int PickUpNearPoly(CCPoly *poly);
117 virtual void Initialize();
118};
119
120STATIC_ASSERT(sizeof(CCPoly) == 0x50);
121STATIC_ASSERT(sizeof(CBoxVu0) == 0x20);
122
131int CheckHit(CCPoly *poly, int count, float *from, float *to, float *hit_point, int nearest, int mode);
132
141int GetFootPoly(float *position, float depth, CCPoly *found, float *ground, CCPoly *polys, int count, int mode);
sceVu0FVECTOR min
Definition collision.hpp:29
sceVu0FVECTOR max
Definition collision.hpp:28
CCPoly poly
Definition collision.hpp:69
CBoxVu0 box
Definition collision.hpp:70
s16 foot_sound
Definition collision.hpp:56
s16 area_kind
Definition collision.hpp:57
CCPolyInfo info
Definition collision.hpp:52
s16 ignore_mask
Definition collision.hpp:58
sceVu0FVECTOR normal
Definition collision.hpp:49
sceVu0FVECTOR vertex[3]
Definition collision.hpp:48
s16 ground_kind
Definition collision.hpp:55
CCPolyBox * mesh
Definition collision.hpp:99
MDT_HEADER * model
Definition collision.hpp:98
sceVu0FVECTOR min
Definition collision.hpp:79
sceVu0FVECTOR max
Definition collision.hpp:78