Cube  Diff

Differences From Artifact [8cc717f782]:

To Artifact [63027fcfcd]:


16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
@property (class, readonly, nonatomic) Cube *sharedInstance;
@property (readonly, nonatomic) SDL_Window *window;
@property (readonly, nonatomic) OFIRI *gameDataIRI, *userDataIRI;
@property (nonatomic) bool repeatsKeys;
@property (nonatomic) int framesInMap;
@end

enum // block types, order matters!
{

	SOLID = 0, // entirely solid cube [only specifies wtex]
	CORNER,    // half full corner of a wall
	FHF,       // floor heightfield using neighbour vdelta values
	CHF,       // idem ceiling
	SPACE,     // entirely empty cube
	SEMISOLID, // generated by mipmapping
	MAXTYPE







|
<
>







16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
@property (class, readonly, nonatomic) Cube *sharedInstance;
@property (readonly, nonatomic) SDL_Window *window;
@property (readonly, nonatomic) OFIRI *gameDataIRI, *userDataIRI;
@property (nonatomic) bool repeatsKeys;
@property (nonatomic) int framesInMap;
@end

// block types, order matters!

enum {
	SOLID = 0, // entirely solid cube [only specifies wtex]
	CORNER,    // half full corner of a wall
	FHF,       // floor heightfield using neighbour vdelta values
	CHF,       // idem ceiling
	SPACE,     // entirely empty cube
	SEMISOLID, // generated by mipmapping
	MAXTYPE
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
	char defer; // used in mipmapping, when true this cube is not a perfect
	            // mip
	char occluded; // true when occluded
	uchar utex;    // upper wall tex id
	uchar tag;     // used by triggers
};

enum // hardcoded texture numbers
{

	DEFAULT_SKY = 0,
	DEFAULT_LIQUID,
	DEFAULT_WALL,
	DEFAULT_FLOOR,
	DEFAULT_CEIL
};

enum // static entity types
{

	NOTUSED = 0, // entity slot not in use in map
	LIGHT,       // lightsource, attr1 = radius, attr2 = intensity
	PLAYERSTART, // attr1 = angle
	I_SHELLS,
	I_BULLETS,
	I_ROCKETS,
	I_ROUNDS,







|
<
>







|
<
>







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
	char defer; // used in mipmapping, when true this cube is not a perfect
	            // mip
	char occluded; // true when occluded
	uchar utex;    // upper wall tex id
	uchar tag;     // used by triggers
};

// hardcoded texture numbers

enum {
	DEFAULT_SKY = 0,
	DEFAULT_LIQUID,
	DEFAULT_WALL,
	DEFAULT_FLOOR,
	DEFAULT_CEIL
};

// static entity types

enum {
	NOTUSED = 0, // entity slot not in use in map
	LIGHT,       // lightsource, attr1 = radius, attr2 = intensity
	PLAYERSTART, // attr1 = angle
	I_SHELLS,
	I_BULLETS,
	I_ROCKETS,
	I_ROUNDS,
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
	MAPMODEL, // attr1 = angle, attr2 = idx
	MONSTER,  // attr1 = angle, attr2 = monstertype
	CARROT,   // attr1 = tag, attr2 = type
	JUMPPAD,  // attr1 = zpush, attr2 = ypush, attr3 = xpush
	MAXENTTYPES
};


struct persistent_entity // map entity
{
	short x, y, z; // cube aligned position
	short attr1;
	uchar type; // type is one of the above
	uchar attr2, attr3, attr4;
};

struct entity: public persistent_entity {
	bool spawned; // the only dynamic state of a map entity
};

#define MAPVERSION 5 // bump if map format changes, see worldio.cpp

struct header // map file format header
{

	char head[4];   // "CUBE"
	int version;    // any >8bit quantity is a little indian
	int headersize; // sizeof(header)
	int sfactor;    // in bits
	int numents;
	char maptitle[128];
	uchar texlists[3][256];







>
|
<












|
<
>







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
	MAPMODEL, // attr1 = angle, attr2 = idx
	MONSTER,  // attr1 = angle, attr2 = monstertype
	CARROT,   // attr1 = tag, attr2 = type
	JUMPPAD,  // attr1 = zpush, attr2 = ypush, attr3 = xpush
	MAXENTTYPES
};

// map entity
struct persistent_entity {

	short x, y, z; // cube aligned position
	short attr1;
	uchar type; // type is one of the above
	uchar attr2, attr3, attr4;
};

struct entity: public persistent_entity {
	bool spawned; // the only dynamic state of a map entity
};

#define MAPVERSION 5 // bump if map format changes, see worldio.cpp

// map file format header

struct header {
	char head[4];   // "CUBE"
	int version;    // any >8bit quantity is a little indian
	int headersize; // sizeof(header)
	int sfactor;    // in bits
	int numents;
	char maptitle[128];
	uchar texlists[3][256];
340
341
342
343
344
345
346
347
348

349
350
351
352
353
354
355
#define m_tarena (gamemode >= 10)
#define m_teammode (gamemode & 1 && gamemode > 2)
#define m_sp (gamemode < 0)
#define m_dmsp (gamemode == -1)
#define m_classicsp (gamemode == -2)
#define isteam(a, b) (m_teammode && [a isEqual:b])

enum // function signatures for script functions, see command.cpp
{

	ARG_1INT,
	ARG_2INT,
	ARG_3INT,
	ARG_4INT,
	ARG_NONE,
	ARG_1STR,
	ARG_2STR,







|
<
>







340
341
342
343
344
345
346
347

348
349
350
351
352
353
354
355
#define m_tarena (gamemode >= 10)
#define m_teammode (gamemode & 1 && gamemode > 2)
#define m_sp (gamemode < 0)
#define m_dmsp (gamemode == -1)
#define m_classicsp (gamemode == -2)
#define isteam(a, b) (m_teammode && [a isEqual:b])

// function signatures for script functions, see command.mm

enum {
	ARG_1INT,
	ARG_2INT,
	ARG_3INT,
	ARG_4INT,
	ARG_NONE,
	ARG_1STR,
	ARG_2STR,