~melchizedek6809/WolkenWelten

ref: e910bd82e598d6f560b8899dd1d88fb3ed554cd3 WolkenWelten/common/src/game_structs.h -rw-r--r-- 5.1 KiB
e910bd82Ben (X13/Arch) Updated contact info 9 months ago
                                                                                
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#pragma once
#include "gfx_structs.h"
#include "misc/side.h"

extern u64 gameTicks;

typedef struct sfx sfx;
typedef struct bgm bgm;
typedef struct hook hook;
typedef struct bigchungus bigchungus;
typedef struct chungus chungus;
typedef struct chunk chunk;

typedef enum blockCategory {
	NONE,
	DIRT,
	STONE,
	WOOD,
	LEAVES
} blockCategory;

typedef enum deathCause {
	deathCauseCommand = 0,
	deathCauseBeamblast,
	deathCauseMelee,
	deathCauseProjectile,
	deathCausePhysics,
	deathCauseAbyss,
	deathCauseFire,
	deathCauseGrenade
} deathCause;

typedef struct {
	u8            tex[sideMAX];
	u8            texX[sideMAX];
	u8            texY[sideMAX];
	u32           color[2];
	mesh         *singleBlock;
	int           hp,firehp;
	blockCategory cat;
	char         *name;
	float         weight;
} blockType;

typedef struct {
	u16 ID;
	i16 amount;
} item;

typedef struct {
	char name[32];
	mesh *iMesh;
	i16 damage[5];
	u16 ammunition,stackSize,magazineSize;
	i16 fireDamage;
	u16 fireHealth;
	u32 itemDropChance;
	float inaccuracy;
	float weight;

	i16 spriteIndex[4];
	u32 spriteColor[4];
} itemType;

typedef uint32_t being;
#define BEING_NULL       0
#define BEING_CHARACTER  1
#define BEING_ANIMAL     2
#define BEING_HOOK       3
#define BEING_GRENADE    4
#define BEING_PROJECTILE 5
#define BEING_ITEMDROP   6
#define BEING_FIRE       7

#define BEING_THROWABLE  9

typedef struct beingListEntry beingListEntry;
struct beingListEntry {
	beingListEntry *next;
	being v[14];
};

typedef struct beingList beingList;
struct beingList {
	beingListEntry *first;
	uint count;
	beingList *parent;
};

typedef struct {
	vec pos,vel,rot;
	float yoff;
	float weight;
	u32 flags;

	mesh    *eMesh;
	chungus *curChungus;
	void    *nextFree;
} entity;
#define ENTITY_FALLING     (1   )
#define ENTITY_NOCLIP      (1<<1)
#define ENTITY_UPDATED     (1<<2)
#define ENTITY_COLLIDE     (1<<3)
#define ENTITY_NOREPULSION (1<<4)
#define ENTITY_SLOW_UPDATE (1<<5)

typedef struct {
	being a,b;
	float length;
	u16   flags;
} rope;
#define ROPE_TEX       0x0FF
#define ROPE_TEX_ROPE  0x000
#define ROPE_TEX_CHAIN 0x001
#define ROPE_DIRTY     0x100


#define CHAR_FALLING      (1    )
#define CHAR_NOCLIP       (1<< 1)
#define CHAR_COLLIDE      (1<< 2)
#define CHAR_FALLINGSOUND (1<< 3)
#define CHAR_SNEAK        (1<< 4)
#define CHAR_GLIDE        (1<< 5)
#define CHAR_SPAWNING     (1<< 6)
#define CHAR_JUMPING      (1<< 7)
#define CHAR_BOOSTING     (1<< 8)
#define CHAR_AIMING       (1<< 9)
#define CHAR_THROW_AIM    (1<<10)
#define CHAR_CONS_MODE    (1<<11)
#define CHAR_JUMP_NEXT    (1<<12)

typedef enum animType {
	animationHit = 0,
	animationFire,
	animationReload,
	animationEmpty,
	animationEat,
	animationSwitch
} animType;

#define CHAR_EQ_MAX    3
#define CHAR_INV_MAX  60

#define CHAR_EQ_GLIDER     0
#define CHAR_EQ_HOOK       1
#define CHAR_EQ_PACK       2

typedef struct {
	 vec  pos,vel,gvel,controls,rot,screenPos;
	float yoff,shake,inaccuracy;
	float gyoff;

    animType  animationIndex;
	 int  animationTicksMax;
	 int  animationTicksLeft;
	uint  breathing;
        uint  temp;

	 u32  flags;

	float gliderFade;
	float goalZoomFactor;
	float zoomFactor;

	mesh *eMesh;
	hook *hook;

	 i16 hp,maxhp;

	 vec hookPos;
	 int blockMiningX,blockMiningY,blockMiningZ;

	 int actionTimeout;
	uint stepTimeout;
	 int cloudyness;
          u8 effectValue;

	u16 activeItem,inventorySize;
	item inventory[CHAR_INV_MAX];
	item equipment[CHAR_EQ_MAX];

	void *nextFree;
} character;

typedef struct {
	vec pos,vel,rot;
	vec gvel,grot;
	vec screenPos;
	float yoff;

	i8 age;
	i8 health;
	i8 hunger;
	i8 pregnancy;
	i8 sleepy;
	u8 flags;
	u8 type;
	u8 state;
	u8 effectValue;

	u16 nextFree;
	u16 breathing;
	u16 temp;
	being target;

	u64 clientPriorization;
	u32 stateTicks;

	beingList *bl;
} animal;
#define ANIMAL_FALLING    (1   )
#define ANIMAL_BELLYSLEEP (1<<1)
#define ANIMAL_AGGRESIVE  (1<<2)
#define ANIMAL_COLLIDE    (1<<3)
#define ANIMAL_MALE       (1<<4)
#define ANIMAL_NO_NEEDS   (1<<5)

#define ANIMAL_S_LOITER      0
#define ANIMAL_S_FLEE        1
#define ANIMAL_S_HEAT        2
#define ANIMAL_S_SLEEP       3
#define ANIMAL_S_PLAYING     4
#define ANIMAL_S_FOOD_SEARCH 5
#define ANIMAL_S_EAT         6
#define ANIMAL_S_FIGHT       7
#define ANIMAL_S_HUNT        8

struct hook {
	entity       *ent;
	character *parent;
	rope        *rope;
	being    attached;
	float  goalLength;
	bool       hooked;
	bool    returning;
};

typedef struct {
	entity    *ent;
	item       itm;
	union {
		u16 aniStep;
		i16 nextFree;
	};
	i16     player;

	u16 lastFire;
	i16 fireDmg;
} itemDrop;


typedef struct {
	entity     *ent;
	item        itm;
	i16    nextFree;
	u16     counter;
	u8        flags;
	i8       damage;
	being   thrower;
} throwable;

#define THROWABLE_PITCH_SPIN   (1   )
#define THROWABLE_TIP_HEAVY    (1<<1)
#define THROWABLE_PIERCE       (1<<2)
#define THROWABLE_COLLECTABLE  (1<<3)
#define THROWABLE_BURNING      (1<<4)

typedef struct {
	vec pos,vel;
	being target,source;
	u16 style;
	i16 ttl;
} projectile;

typedef struct {
	u16 x,y,z;
	i16 strength;
	i16 blockDmg;
	i16 oxygen;
	beingList *bl;
} fire;

typedef struct {
	entity *ent;
	int ticksLeft,cluster;
	float pwr,clusterPwr;
} grenade;