Cube  Diff

Differences From Artifact [7c6be4eed6]:

To Artifact [03b89b7ddc]:


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
// editing.cpp: most map editing commands go here, entity editing commands are
// in world.cpp

#include "cube.h"

#import "Command.h"
#import "DynamicEntity.h"
#import "Monster.h"
#import "OFString+Cube.h"
#import "Player.h"


bool editmode = false;

// the current selection, used by almost all editing commands
// invariant: all code assumes that these are kept inside MINBORD distance of
// the edge of the map

struct block sel;

OF_CONSTRUCTOR()
{
	enqueueInit(^{
		sel = (struct block) {


			variable(@"selx", 0, 0, 4096, &sel.x, NULL, false),

			variable(@"sely", 0, 0, 4096, &sel.y, NULL, false),

			variable(@"selxs", 0, 0, 4096, &sel.xs, NULL, false),
			variable(@"selys", 0, 0, 4096, &sel.ys, NULL, false),
		};







	});
}

int selh = 0;
bool selset = false;

#define loopselxy(b)                                                       \










>







|




|
>
>
|
>
|
>
|
|
<
>
>
>
>
>
>
>







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
// editing.cpp: most map editing commands go here, entity editing commands are
// in world.cpp

#include "cube.h"

#import "Command.h"
#import "DynamicEntity.h"
#import "Monster.h"
#import "OFString+Cube.h"
#import "Player.h"
#import "Variable.h"

bool editmode = false;

// the current selection, used by almost all editing commands
// invariant: all code assumes that these are kept inside MINBORD distance of
// the edge of the map

struct block sel = { 0, 0, 0, 0 };

OF_CONSTRUCTOR()
{
	enqueueInit(^{
		static const struct {
			OFString *name;
			int *storage;
		} vars[4] = { { @"selx", &sel.x }, { @"sely", &sel.y },
			{ @"selxs", &sel.xs }, { @"selys", &sel.ys } };

		for (size_t i = 0; i < 4; i++) {
			Variable *variable =
			    [Variable variableWithName:vars[i].name

			                           min:0
			                           max:4096
			                       storage:vars[i].storage
			                      function:NULL
			                     persisted:false];
			Identifier.identifiers[vars[i].name] = variable;
		}
	});
}

int selh = 0;
bool selset = false;

#define loopselxy(b)                                                       \