DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
collisiondata.hpp
1#pragma once
2
3#include "common.h"
4
5#include <libvu0.h>
6
7#include "mathutil.hpp"
8
12// clang-format off
13enum DebugInfoCodeId {
14 DEBUG_INFO_NONE = 0,
15 DEBUG_INFO_CLOSE = 1,
16 DEBUG_INFO_MINIMAP_VIEW = 10,
17 DEBUG_INFO_COLLISION = 20,
18 DEBUG_INFO_ITEM_PUT_ZONE = 30,
19 DEBUG_INFO_UNK_28 = 40,
20 DEBUG_INFO_BGM_PLAY = 41,
21 DEBUG_INFO_VIEW_INFO = 50,
22 DEBUG_INFO_UNK_3C = 60,
23 DEBUG_INFO_PARAMETER = 70,
24 DEBUG_INFO_FLOOR_ATRA_GET = 80,
25 DEBUG_INFO_EVENT_TEST = 90,
26 DEBUG_INFO_RELOAD_ENEMY = 100,
27 DEBUG_INFO_LIGHT_MODE = 110,
28 DEBUG_INFO_SET_STATUS = 120,
29 DEBUG_INFO_SE_PLAY = 130,
30 DEBUG_INFO_SET_CHR_KEY = 140,
31 DEBUG_INFO_ULTRA_MAN = 150,
32};
33
34// clang-format on
35
39// clang-format off
40enum HitElementFlag {
41 HIT_ELEMENT_FIRE = 0x01,
42 HIT_ELEMENT_COLD = 0x02,
43 HIT_ELEMENT_THUNDER = 0x04,
44 HIT_ELEMENT_WIND = 0x08,
45 HIT_ELEMENT_HOLY = 0x10,
46};
47
48// clang-format on
49
50class CTexture;
51
59char *NameExchg(char *name, int language);
60
65 sceVu0FVECTOR pos;
66 sceVu0FVECTOR base_point;
67 sceVu0FVECTOR velocity;
68 u8 unk_30[4];
69 s32 damage;
70 float scale_rate;
71 float radius;
72 float unk_40;
73 s32 life;
75 s32 kind;
76 s32 flags;
78 s32 owner;
81 char *vs_monster;
84 s32 phase;
86 u8 unk_78[8];
87 sceVu0FVECTOR knockback_origin;
91 u8 unk_9C[4];
92};
93
94STATIC_ASSERT(sizeof(COLLISION_HIT) == 0xA0);
95
100public:
102 s32 active[96];
104 u8 unk_3D84[0xC];
105
109 int GetMonsterOwner(int index) { return hit[index].monster_no; }
110
114 int GetFlags(int index) { return hit[index].flags; }
115
119 int GetUserID(int index) { return hit[index].owner; }
120
124 void SetUserID(int id, int attack) {
125 hit[now_hit].owner = id;
126 hit[now_hit].attack_no = attack;
127 }
128
132 COLLISION_HIT *Get(int index) { return &hit[index]; }
133
137 void SetVelocity(int index, float *direction, float scale) {
138 sceVu0FVECTOR normalized;
139 sceVu0Normalize(normalized, direction);
140 sceVu0ScaleVectorXYZ(hit[index].velocity, normalized, scale);
141 }
142
146 int FindMonsterHit(float *position, float radius) {
147 for (int i = 0; i < 96; i++) {
148 if (active[i] != 0 && (hit[i].target_mask & 2) && hit[i].phase == hit[i].ready_phase && DistVector(position, hit[i].pos) <= radius + hit[i].radius) {
149 return i;
150 }
151 }
152
153 return -1;
154 }
155
163 int Set(float *position, int damage, int life, float radius, float scale_rate, int target_mask, int kind, int flags, int attribute);
164
172 int CheckHitUser(float *position, int mask, float height);
173
181 void SetKickBack(float *origin, float speed, float decay, int mode);
182};
183
184STATIC_ASSERT(sizeof(CCollisionData) == 0x3D90);
185
193int SetGateKeyStack(int item);
194
195#ifdef PAL
203void StartMessageDraw(CTexture *texture, int dungeon, int floor, int ura, int alpha);
204#endif
int FindMonsterHit(float *position, float radius)
int CheckHitUser(float *position, int mask, float height)
void SetVelocity(int index, float *direction, float scale)
int Set(float *position, int damage, int life, float radius, float scale_rate, int target_mask, int kind, int flags, int attribute)
COLLISION_HIT hit[96]
void SetUserID(int id, int attack)
int GetMonsterOwner(int index)
int GetFlags(int index)
void SetKickBack(float *origin, float speed, float decay, int mode)
int GetUserID(int index)
COLLISION_HIT * Get(int index)
char name[32]
Definition texture.hpp:56
sceVu0FVECTOR knockback_origin
sceVu0FVECTOR pos
sceVu0FVECTOR base_point
sceVu0FVECTOR velocity