DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
character.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "common.h"
4
5#include <libvu0.h>
6
7#include "dataalloc_fwd.hpp"
8#include "fakepointlight.hpp"
9#include "gameutil.hpp"
10#include "object.hpp"
11#include "textureanime.hpp"
12
21// clang-format off
26
27// clang-format on
28
29// Forward declarations for the types these declarations name. The skeleton
30// headers are generated from the retail symbol table, which knows the type
31// names but not where they live.
32class CCloth;
33
35#define CHARA_MOTION_MAX 8
37#define CHARA_POINT_LIGHT_MAX 2
39#define CHARA_CLOTH_MAX 4
41#define CHARA_FOOT_SOUND_MAX 6
43#define CHARA_EVENT_MAX 32
44
49 s32 frame;
50 s32 unk_04;
51 s32 foot;
53 s32 unk_10;
54};
55
56STATIC_ASSERT(sizeof(CHARA_FOOT_SOUND) == 0x14);
57
62 s32 frame;
63 s32 kind;
64 s32 no;
66 s32 unk_10;
67};
68
69STATIC_ASSERT(sizeof(CHARA_EVENT) == 0x14);
70
75 s32 unk_00;
76 float unk_04;
77 s32 unk_08;
78 s32 unk_0C;
79 s32 unk_10;
80};
81
82STATIC_ASSERT(sizeof(CHARA_UNK_1068) == 0x14);
83
88public:
89 u8 storage[sizeof(tagMOTION_TYPE)];
99};
100
101STATIC_ASSERT(sizeof(MotionParam) == 0x80);
102
110int scissior(float out[][4], float first[][4], float second[][4], float near_z);
111
115class CCharacter : public CObject {
116public:
122 u_int *images[4];
123 char *config;
139 float unk_C6C;
143 s32 wind;
146 sceVu0FVECTOR ground_ambient[2];
147 sceVu0FVECTOR ambient_tint;
148 sceVu0FVECTOR ambient_offset;
149 float fade[4];
157 CHARA_UNK_1068 unk_1068[16];
158
160 static s32 MotionStopFlag;
161
168
172 void SetMotion(int no, int mode, float speed = -1.0f) {
173 motion_no = no;
174 motion_flags = mode;
175 motion_speed = speed;
176 }
177
181 void SetMotionSpeed(float speed) {
182 motion_speed = speed;
183#ifdef PAL_TIMING
184 // Motion authored at 60 fields per second advances faster at 50.
185 motion_speed = 6.0f * speed / 5.0f;
186#endif
187 }
188
196 void ClearPointLight();
197
205 int SetPointLight(float *pos, float inner_range, float outer_range, float red, float green, float blue, float alpha);
206
214 void InitializeTexAnime(CTexAnimeData *data, int count);
215
223 void ClearTexAnime();
224
232 void TextureAnime(int step);
233
241 void TexAnimeOn(int no);
242
250 void TexAnimeOff(int no);
251
259 int SetFootSound(float left_frame, float right_frame, int motion_no);
260
268 void SetFootSoundID(int id);
269
277 void FootSoundEnable(int on);
278
286 void EventEnable(int on);
287
295 void SetEvent(float frame, int kind, int no, int motion_no);
296
304 void ClearEvent(int motion_no);
305
313 void SetMotionCamera(CCamera *camera);
314
322 tagMOTION_TYPE *GetMotionParam(int motion_no, int *out_index, int *out_start, int *out_end, int *out_set);
323
332
340 float GetNowTime();
341
349 virtual void Step();
350
358 virtual void ShadowStep();
359
367 virtual void ClothStep(int step);
368
376 virtual void ClothFloor(int floor);
377
385 virtual void StopCloth(int unused);
386
394 virtual void GetPosition(float *out_position);
395
403 virtual void SetPosition(float x, float y, float z);
404
412 virtual void GetWorldPosition(float *out_position);
413
421 virtual int PickUpPoly(float *position, CCPoly *polygons);
422
430 virtual void SetPosition(float *position);
431
439 virtual void SetPosition(CVector3_f_ position);
440
448 virtual void SetRotation(float x, float y, float z);
449
457 virtual void SetRotation(float *rotation);
458
466 virtual void SetRotation(CVector3_f_ rotation);
467
475 virtual void SetScale(float x, float y, float z);
476
484 virtual void SetScale(float *scale);
485
493 virtual void Draw();
494
502 virtual void DrawShadow();
503
511 virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2<1> *model_alloc, CDataAlloc2<1> *texture_alloc);
512
520 virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2<1> *model_alloc, CDataAlloc2<1> *motion_alloc, CDataAlloc2<1> *texture_alloc);
521
530 virtual void LoadPackData2(unsigned int *pack, char *name, CDataAlloc2<1> *alloc, int texture_block_no, CDataAlloc2<1> *image_alloc, int visual_type);
531
540 virtual void LoadPackData3(unsigned int *pack, char *name, CDataAlloc2<1> *alloc, int texture_block_no, CDataAlloc2<1> *image_alloc, int keep_textures, int visual_type);
541
549 void DeleteExtendTexture(int block_no);
550
558 void DeleteExtendMotion();
559
567 virtual void Initialize();
568};
569
570STATIC_ASSERT(sizeof(CCharacter) == 0x11B0);
571
575class CMainChara : public CCharacter {
576public:
577 s32 unk_11B0;
578 s32 unk_11B4;
579 s32 unk_11B8;
580 s32 unk_11BC;
581 s32 unk_11C0;
582 s32 unk_11C4;
583 s32 unk_11C8;
584 s32 unk_11CC;
589
597 virtual void Draw();
598
606 virtual void Initialize();
607};
608
609STATIC_ASSERT(sizeof(CMainChara) == 0x12A0);
610
614extern "C" void *GeneratedCharacterVtable[];
#define CHARA_EVENT_MAX
Definition character.hpp:43
#define CHARA_MOTION_MAX
Definition character.hpp:35
CharaEventKind
Definition character.hpp:22
@ CHARA_EVENT_SOUND_EFFECT
Definition character.hpp:24
@ CHARA_EVENT_FOOT_SOUND
Definition character.hpp:23
#define CHARA_FOOT_SOUND_MAX
Definition character.hpp:41
#define CHARA_POINT_LIGHT_MAX
Definition character.hpp:37
void * GeneratedCharacterVtable[]
int scissior(float out[][4], float first[][4], float second[][4], float near_z)
Definition character.cpp:58
CCloth ** cloth
void TexAnimeOn(int no)
virtual void StopCloth(int unused)
virtual void GetWorldPosition(float *out_position)
void SetMotion(int no, int mode, float speed=-1.0f)
CFrame * frame
virtual void GetPosition(float *out_position)
virtual void LoadPackData2(unsigned int *pack, char *name, CDataAlloc2< 1 > *alloc, int texture_block_no, CDataAlloc2< 1 > *image_alloc, int visual_type)
void ClearEvent(int motion_no)
MOTION_INFO * GetMotionInfo(int motion_no)
void ClearPointLight()
void DeleteExtendMotion()
virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2< 1 > *model_alloc, CDataAlloc2< 1 > *texture_alloc)
void SetEvent(float frame, int kind, int no, int motion_no)
tagMOTION_TYPE * GetMotionParam(int motion_no, int *out_index, int *out_start, int *out_end, int *out_set)
virtual void SetScale(float x, float y, float z)
virtual void LoadPackData3(unsigned int *pack, char *name, CDataAlloc2< 1 > *alloc, int texture_block_no, CDataAlloc2< 1 > *image_alloc, int keep_textures, int visual_type)
CCloth * cloth_buf[8]
void InitializeTexAnime(CTexAnimeData *data, int count)
CFakePointLight point_light[CHARA_POINT_LIGHT_MAX]
void SetFootSoundID(int id)
void SetMotionCamera(CCamera *camera)
virtual void Step()
sceVu0FVECTOR ambient_offset
void EventEnable(int on)
tagMOTION_TYPE * shadow_motion[CHARA_MOTION_MAX]
sceVu0FVECTOR ground_ambient[2]
void SetMotionSpeed(float speed)
MotionParam shadow_motion_storage[CHARA_MOTION_MAX]
CHARA_FOOT_SOUND foot_sound[CHARA_FOOT_SOUND_MAX]
virtual void ShadowStep()
s32 foot_sound_id
tagMOTION_TYPE motion_type
float fade[4]
void ClearTexAnime()
s32 motion_end[CHARA_MOTION_MAX]
static s32 MotionStopFlag
tagMOTION_TYPE shadow_motion_type
virtual void SetRotation(float x, float y, float z)
void FootSoundEnable(int on)
void TextureAnime(int step)
char * config
virtual void ClothFloor(int floor)
void DeleteExtendTexture(int block_no)
virtual void DrawShadow()
s32 ground_ambient_no
virtual void Initialize()
CFrame * shadow_frame
void TexAnimeOff(int no)
MotionParam motion_storage[CHARA_MOTION_MAX]
u_int * images[4]
float body_height
s32 foot_sound_enable
tagFRAME_INF * shadow_frame_info
float body_depth
s32 foot_sound_wait
CTextureAnime tex_anime
int SetFootSound(float left_frame, float right_frame, int motion_no)
float motion_speed
float GetNowTime()
virtual void Draw()
sceVu0FVECTOR ambient_tint
s32 motion_start[CHARA_MOTION_MAX]
float body_width
virtual void SetPosition(float x, float y, float z)
virtual int PickUpPoly(float *position, CCPoly *polygons)
int SetPointLight(float *pos, float inner_range, float outer_range, float red, float green, float blue, float alpha)
tagMOTION_TYPE * motion[CHARA_MOTION_MAX]
virtual void ClothStep(int step)
tagFRAME_INF * frame_info
virtual void Initialize()
MoveCheckInfo move_info
virtual void Draw()
float scale[4]
Definition object.hpp:26
CVector3_f_ rotation
Definition object.hpp:23
float pos[4]
Definition object.hpp:18
u8 storage[sizeof(tagMOTION_TYPE)]
Definition character.hpp:89