Cube  Diff

Differences From Artifact [696569b661]:

To Artifact [7c6be4eed6]:


1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
// 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"


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










>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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

54
55
56
57
58
59
60

61
62
63
64
65
66
67
static struct sqr rtex;

VAR(editing, 0, 0, 1);

void
toggleedit()
{

	if (player1.state == CS_DEAD)
		return; // do not allow dead players to edit to avoid state
		        // confusion
	if (!editmode && !allowedittoggle())
		return; // not in most multiplayer modes
	if (!(editmode = !editmode)) {
		settagareas();     // reset triggers to allow quick playtesting







>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
static struct sqr rtex;

VAR(editing, 0, 0, 1);

void
toggleedit()
{
	Player *player1 = Player.player1;
	if (player1.state == CS_DEAD)
		return; // do not allow dead players to edit to avoid state
		        // confusion
	if (!editmode && !allowedittoggle())
		return; // not in most multiplayer modes
	if (!(editmode = !editmode)) {
		settagareas();     // reset triggers to allow quick playtesting
153
154
155
156
157
158
159

160
161
162
163
164
165
166
	    ? (s->type == FHF ? s->floor - t->vdelta / 4.0f : (float)s->floor)
	    : (s->type == CHF ? s->ceil + t->vdelta / 4.0f : (float)s->ceil);
}

void
cursorupdate() // called every frame from hud
{

	flrceil = ((int)(player1.pitch >= 0)) * 2;

	volatile float x =
	    worldpos.x; // volatile needed to prevent msvc7 optimizer bug?
	volatile float y = worldpos.y;
	volatile float z = worldpos.z;








>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	    ? (s->type == FHF ? s->floor - t->vdelta / 4.0f : (float)s->floor)
	    : (s->type == CHF ? s->ceil + t->vdelta / 4.0f : (float)s->ceil);
}

void
cursorupdate() // called every frame from hud
{
	Player *player1 = Player.player1;
	flrceil = ((int)(player1.pitch >= 0)) * 2;

	volatile float x =
	    worldpos.x; // volatile needed to prevent msvc7 optimizer bug?
	volatile float y = worldpos.y;
	volatile float z = worldpos.z;

622
623
624
625
626
627
628
629
630
631
632
	loopselxy(s->tag = tag);
})

COMMAND(newent, ARG_5STR,
    ^(OFString *what, OFString *a1, OFString *a2, OFString *a3, OFString *a4) {
	    EDITSEL;

	    newentity(sel.x, sel.y, (int)player1.origin.z, what,
	        [a1 cube_intValueWithBase:0], [a2 cube_intValueWithBase:0],
	        [a3 cube_intValueWithBase:0], [a4 cube_intValueWithBase:0]);
    })







|



625
626
627
628
629
630
631
632
633
634
635
	loopselxy(s->tag = tag);
})

COMMAND(newent, ARG_5STR,
    ^(OFString *what, OFString *a1, OFString *a2, OFString *a3, OFString *a4) {
	    EDITSEL;

	    newentity(sel.x, sel.y, (int)Player.player1.origin.z, what,
	        [a1 cube_intValueWithBase:0], [a2 cube_intValueWithBase:0],
	        [a3 cube_intValueWithBase:0], [a4 cube_intValueWithBase:0]);
    })