-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcwe_api.h
More file actions
171 lines (135 loc) · 5.6 KB
/
cwe_api.h
File metadata and controls
171 lines (135 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#pragma once
#include "SA2ModLoader.h"
#include <string>
//ignore this, this is for our side of things
#ifdef CWEV9
#include "alg_kinder_bl.h"
#else
struct BlackMarketItemAttributes
{
int PurchasePrice;
int SalePrice;
__int16 RequiredEmblems;
__int16 Name;
__int16 Descriptions;
__int16 Unknown;
};
struct __declspec(align(4)) MotionTableAction
{
NJS_MOTION* NJS_MOTION;
__int16 FlagThing1;
__int16 field_6;
int TransitionToID;
int field_C;
float StartFrame;
float EndFrame;
float PlaySpeed;
};
#endif
#define ICON_TYPE_BALL 0
#define ICON_TYPE_HALO 1
#define ICON_TYPE_SPIKY 2
#define ICON_TYPE_CUSTOM 3 //don't use this for now, since pIconData isnt finished
#define CUSTOM_CHAO_FLAG_SECOND_EVO BIT_0 //only for advanced users for now since we don't have safety checks in place for it yet
struct CWE_API_CHAO_DATA {
using CanEvolve = bool(*)(ObjectMaster* tp);
NJS_OBJECT* pObject; //chunk model format (sa2mdl)
NJS_OBJECT* pSecondEvoList[5];
const char* TextureName; //we don't support texlists because we need to "inject" the loaded textures into al_body
int TextureCount;
Uint32 IconColor; //emotion ball color
Uint32 IconType; //0 - ball, 1 - halo, 2 - spiky, 3 - custom emote ball
void* pIconData; //placeholder for custom emotion balls in the future
CanEvolve pEvolveFunc; //if function returns true during evolution, chao will evolve into this type
Uint32 Flags;
const char* Name; //we use it for the health center for now, also useful for KCE, ex. "Spartoi"
char ID[16]; //type id, HAS TO BE NULL TERMINATED, ex. "cwe_spartoi"
Sint32 reserved[4];
};
using OtherItemPtr = void(*)(int ID);
using LastBiteFruitFuncPtr = void(*)(ChaoData* chaoData, ObjectMaster* fruit);
using SpecialItemFuncPtr = void(*)(ObjectMaster* chao, ObjectMaster* item);
using SpecialConditionFuncPtr = bool(*)(ObjectMaster* chao, ObjectMaster* item);
enum EAccessoryType : unsigned char {
Head = 0,
Face,
Generic1,
Generic2,
AccessoryTypeCount
};
struct CWE_API_TREE_DATA {
NJS_OBJECT* pSeedObj;
NJS_OBJECT* pSaplingObj;
NJS_OBJECT* pAdultObj;
NJS_OBJECT* pDeadObj;
NJS_TEXLIST* pTexlist;
char ID[16]; //use if possible, but it goes unused in cwe code for now
Uint32 Flags; //unused for now
int FruitIDs[3]; //the 3 fruit IDs to init with
Sint32 reserved[4];
};
//animal stuff
struct CWE_PARTS {
NJS_OBJECT** objects;
NJS_TEXLIST* tex;
};
enum {
COLOR_SWIM,
COLOR_FLY,
COLOR_RUN,
COLOR_POWER,
COLOR_RANDOM
};
struct CWE_MINIMAL {
CWE_PARTS child;
CWE_PARTS adult;
NJS_OBJECT* animalObject;
const char* texlistName;
NJS_TEXLIST* animalTexlist;
NJS_MOTION* motions[4];
ChaoItemStats stats;
int color;
Uint32 Flags;
char ID[16];
const char* Name;
Sint32 reserved[4];
};
struct CWE_REGAPI {
Uint32 Version;
//"msg" functions
size_t(*RegisterFoName)(char* str); //fortune teller names, doesn't support every type of characters, try to stick to just letters
size_t(*RegisterAlItemString)(const char* str); //blackmarket strings, id returned used in BlackMarketItemAttributes Name/Description
void(*OverwriteAlItemString)(size_t id, const char* str);
//black market functions
void(*RegisterBlackMarketGeneralFruit)(int ID, int chance);
void(*RegisterBlackMarketRareFruit)(int ID, int chance);
BlackMarketItemAttributes* (*GetItemAttr)(ChaoItemCategory cat, int index); //let's you pull and edit existing item attributes
void(*RegisterOtherItemFunc)(int ID, OtherItemPtr func); //things like "themes", we don't really support this properly yet though, we just did it to code the themes
void(*SetRebuyFlag)(int Category, int ID, bool rebuy);
size_t(*AddChaoHat)(NJS_OBJECT* model, NJS_TEXLIST* texlist, BlackMarketItemAttributes* attrib, const char* name, const char* description);
//fruit functions
int(*RegisterChaoFruit)(NJS_OBJECT* model, NJS_TEXLIST* texlist, ChaoItemStats* stats, BlackMarketItemAttributes* attrib, LastBiteFruitFuncPtr funcPtr, const char* name, const char* description);
void(*SetFruitTexlist)(int ID, NJS_TEXLIST* texlist); //used to override the textures of a fruit, i honestly don't remember why we did this at all
//accessory functions
int(*RegisterChaoAccessory)(EAccessoryType type, NJS_OBJECT* model, NJS_TEXLIST* texlist, BlackMarketItemAttributes* attrib, const char* name, const char* description);
void(*AccessoryMakeBald)(int accessory_id);
void(*AccessoryDisableJiggle)(int accessory_id);
//tree
size_t(*AddChaoTree)(const CWE_API_TREE_DATA& tree_data, BlackMarketItemAttributes* attrib, const char* name, const char* description);
//specials
int(*RegisterChaoSpecial)(NJS_OBJECT* model, NJS_TEXLIST* texlist, BlackMarketItemAttributes* attrib, SpecialItemFuncPtr func, SpecialConditionFuncPtr cond, const char* name, const char* description, bool isAction);
size_t(*RegisterEyeColor)(const char* textureName, NJS_TEXLIST* texlist, int specialID); //lens, to be used in conjunction with specials
//custom chao
size_t(*AddChaoType)(CWE_API_CHAO_DATA const* pData);
//animals
size_t(*AddChaoMinimal)(CWE_MINIMAL* pMinimal);
void(*RegisterChaoMinimalFruit)(int fruitID, int minimalID, int chanceMin, int chanceMax);
//animation
int(*RegisterChaoAnimation)(std::string name, MotionTableAction* action);
int (*RegisterChaoAnimTransition) (const std::string& from, const std::string& to);
int(*GetChaoAnimationIndex)(const std::string& name);
MotionTableAction* (*GetChaoAnimation) (size_t index);
//misc
void(*RegisterChaoTexlistLoad)(const char* name, NJS_TEXLIST* load); //register texlists to load/unload in chao world
void(*RegisterSaveLoad)(const char* suffix, void* buffer, int size); //register custom chao world savefiles like _CWE, karate mod uses this too
};