mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 17:31:28 +00:00
Make MapEdit (QuakeEd) compile.
It won't work yet as there's no gorm file and there's code that has been commented out, but it finally compiles.
This commit is contained in:
parent
7dc1ccdbea
commit
44dd62d369
32 changed files with 785 additions and 686 deletions
|
@ -2,9 +2,13 @@
|
||||||
#define CameraView_h
|
#define CameraView_h
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
#include "mathlib.h"
|
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
#include "SetBrush.h"
|
#include "SetBrush.h"
|
||||||
|
|
||||||
|
#include "render.h"
|
||||||
|
|
||||||
extern id cameraview_i;
|
extern id cameraview_i;
|
||||||
|
|
||||||
extern byte renderlist[1024*1024*4];
|
extern byte renderlist[1024*1024*4];
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#include "qedefs.h"
|
#include "QF/sys.h"
|
||||||
|
|
||||||
|
#include "CameraView.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "QuakeEd.h"
|
||||||
|
#include "XYView.h"
|
||||||
|
#include "ZView.h"
|
||||||
|
|
||||||
id cameraview_i;
|
id cameraview_i;
|
||||||
|
extern NSBezierPath *path;
|
||||||
|
|
||||||
BOOL timedrawing = 0;
|
BOOL timedrawing = 0;
|
||||||
|
|
||||||
|
@ -75,10 +82,10 @@ initWithFrame:
|
||||||
[map_i makeAllPerform: @selector(feetToFloor)];
|
[map_i makeAllPerform: @selector(feetToFloor)];
|
||||||
if (sb_floor_dist == 99999)
|
if (sb_floor_dist == 99999)
|
||||||
{
|
{
|
||||||
qprintf ("already on top floor");
|
Sys_Printf ("already on top floor");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
qprintf ("up floor");
|
Sys_Printf ("up floor");
|
||||||
origin[2] += sb_floor_dist;
|
origin[2] += sb_floor_dist;
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
return self;
|
return self;
|
||||||
|
@ -91,10 +98,10 @@ initWithFrame:
|
||||||
[map_i makeAllPerform: @selector(feetToFloor)];
|
[map_i makeAllPerform: @selector(feetToFloor)];
|
||||||
if (sb_floor_dist == -99999)
|
if (sb_floor_dist == -99999)
|
||||||
{
|
{
|
||||||
qprintf ("already on bottom floor");
|
Sys_Printf ("already on bottom floor");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
qprintf ("down floor");
|
Sys_Printf ("down floor");
|
||||||
origin[2] += sb_floor_dist;
|
origin[2] += sb_floor_dist;
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
return self;
|
return self;
|
||||||
|
@ -121,7 +128,7 @@ homeView
|
||||||
|
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
|
|
||||||
qprintf ("homed view angle");
|
Sys_Printf ("homed view angle");
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +230,7 @@ float mid_x, mid_y;
|
||||||
float topscale = (240.0/3)/160;
|
float topscale = (240.0/3)/160;
|
||||||
float bottomscale = (240.0*2/3)/160;
|
float bottomscale = (240.0*2/3)/160;
|
||||||
|
|
||||||
extern plane_t frustum[5];
|
extern plane_t rfrustum[5];
|
||||||
|
|
||||||
void MakeCampt (vec3_t in, campt_t *pt)
|
void MakeCampt (vec3_t in, campt_t *pt)
|
||||||
{
|
{
|
||||||
|
@ -267,15 +274,16 @@ void CameraMoveto(vec3_t p)
|
||||||
{
|
{
|
||||||
campt_t *pt;
|
campt_t *pt;
|
||||||
|
|
||||||
if (upath->numberOfPoints > 2048)
|
if ([path elementCount] > 2048)
|
||||||
lineflush ();
|
lineflush ();
|
||||||
|
|
||||||
pt = &campts[cam_cur];
|
pt = &campts[cam_cur];
|
||||||
cam_cur ^= 1;
|
cam_cur ^= 1;
|
||||||
MakeCampt (p,pt);
|
MakeCampt (p,pt);
|
||||||
if (!pt->clipflags)
|
if (!pt->clipflags) {
|
||||||
{ // onscreen, so move there immediately
|
// onscreen, so move there immediately
|
||||||
UPmoveto (upath, pt->screen[0], pt->screen[1]);
|
NSPoint point = {pt->screen[0], pt->screen[1]};
|
||||||
|
[path moveToPoint: point];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,22 +293,23 @@ void ClipLine (vec3_t p1, vec3_t p2, int planenum)
|
||||||
vec3_t new;
|
vec3_t new;
|
||||||
plane_t *pl;
|
plane_t *pl;
|
||||||
float scale;
|
float scale;
|
||||||
|
NSPoint point;
|
||||||
|
|
||||||
if (planenum == 5)
|
if (planenum == 5) {
|
||||||
{ // draw it!
|
// draw it!
|
||||||
scale = mid_x/p1[2];
|
scale = mid_x/p1[2];
|
||||||
new[0] = mid_x + p1[0]*scale;
|
point.x = mid_x + p1[0]*scale;
|
||||||
new[1] = mid_y + p1[1]*scale;
|
point.y = mid_y + p1[1]*scale;
|
||||||
UPmoveto (upath, new[0], new[1]);
|
[path moveToPoint: point];
|
||||||
|
|
||||||
scale = mid_x/p2[2];
|
scale = mid_x/p2[2];
|
||||||
new[0] = mid_x + p2[0]*scale;
|
point.x = mid_x + p2[0]*scale;
|
||||||
new[1] = mid_y + p2[1]*scale;
|
point.y = mid_y + p2[1]*scale;
|
||||||
UPlineto (upath, new[0], new[1]);
|
[path lineToPoint: point];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pl = &frustum[planenum];
|
pl = &rfrustum[planenum];
|
||||||
|
|
||||||
d = DotProduct (p1, pl->normal) - pl->dist;
|
d = DotProduct (p1, pl->normal) - pl->dist;
|
||||||
d2 = DotProduct (p2, pl->normal) - pl->dist;
|
d2 = DotProduct (p2, pl->normal) - pl->dist;
|
||||||
|
@ -348,9 +357,11 @@ void CameraLineto(vec3_t p)
|
||||||
|
|
||||||
if (! bits )
|
if (! bits )
|
||||||
{
|
{
|
||||||
|
NSPoint point1 = {p1->screen[0], p1->screen[1]};
|
||||||
|
NSPoint point2 = {p2->screen[0], p2->screen[1]};
|
||||||
c_on++;
|
c_on++;
|
||||||
UPmoveto (upath, p1->screen[0], p1->screen[1]);
|
[path moveToPoint: point1];
|
||||||
UPlineto (upath, p2->screen[0], p2->screen[1]);
|
[path lineToPoint: point2];
|
||||||
return; // entirely on screen
|
return; // entirely on screen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,10 +474,10 @@ drawSelf
|
||||||
*/
|
*/
|
||||||
- drawSelf:(NSRect)rects :(int)rectCount
|
- drawSelf:(NSRect)rects :(int)rectCount
|
||||||
{
|
{
|
||||||
static float drawtime; // static to shut up compiler warning
|
float drawtime = 0;
|
||||||
|
|
||||||
if (timedrawing)
|
if (timedrawing)
|
||||||
drawtime = I_FloatTime ();
|
drawtime = Sys_DoubleTime ();
|
||||||
|
|
||||||
if (drawmode == dr_texture || drawmode == dr_flat)
|
if (drawmode == dr_texture || drawmode == dr_flat)
|
||||||
[self drawSolid];
|
[self drawSolid];
|
||||||
|
@ -476,7 +487,7 @@ drawSelf
|
||||||
if (timedrawing)
|
if (timedrawing)
|
||||||
{
|
{
|
||||||
//XXX NSPing ();
|
//XXX NSPing ();
|
||||||
drawtime = I_FloatTime() - drawtime;
|
drawtime = Sys_DoubleTime () - drawtime;
|
||||||
printf ("CameraView drawtime: %5.3f\n", drawtime);
|
printf ("CameraView drawtime: %5.3f\n", drawtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +575,7 @@ modalMoveLoop
|
||||||
int i;
|
int i;
|
||||||
// vec3_t temp;
|
// vec3_t temp;
|
||||||
|
|
||||||
qprintf ("moving camera position");
|
Sys_Printf ("moving camera position");
|
||||||
|
|
||||||
VectorCopy (origin, originbase);
|
VectorCopy (origin, originbase);
|
||||||
|
|
||||||
|
@ -810,7 +821,7 @@ mouseDown
|
||||||
{
|
{
|
||||||
if (drawmode != dr_texture)
|
if (drawmode != dr_texture)
|
||||||
{
|
{
|
||||||
qprintf ("No texture setting except in texture mode!\n");
|
Sys_Printf ("No texture setting except in texture mode!\n");
|
||||||
NopSound ();
|
NopSound ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +837,7 @@ mouseDown
|
||||||
{
|
{
|
||||||
if (drawmode != dr_texture)
|
if (drawmode != dr_texture)
|
||||||
{
|
{
|
||||||
qprintf ("No texture setting except in texture mode!\n");
|
Sys_Printf ("No texture setting except in texture mode!\n");
|
||||||
NopSound ();
|
NopSound ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -836,7 +847,7 @@ mouseDown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qprintf ("bad flags for click");
|
Sys_Printf ("bad flags for click");
|
||||||
NopSound ();
|
NopSound ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -863,13 +874,13 @@ rightMouseDown
|
||||||
//
|
//
|
||||||
if (flags == 0)
|
if (flags == 0)
|
||||||
{
|
{
|
||||||
qprintf ("looking");
|
Sys_Printf ("looking");
|
||||||
[self viewDrag: &pt];
|
[self viewDrag: &pt];
|
||||||
qprintf ("");
|
Sys_Printf ("%s", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qprintf ("bad flags for click");
|
Sys_Printf ("bad flags for click");
|
||||||
NopSound ();
|
NopSound ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
#ifndef Clipper_h
|
#ifndef Clipper_h
|
||||||
#define Clipper_h
|
#define Clipper_h
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
|
#include "SetBrush.h"
|
||||||
|
|
||||||
extern id clipper_i;
|
extern id clipper_i;
|
||||||
|
|
||||||
@interface Clipper : NSObject
|
@interface Clipper : NSObject
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
|
||||||
|
|
||||||
#include <AppKit/NSGraphics.h>
|
#include <AppKit/NSGraphics.h>
|
||||||
#include <AppKit/DPSOperators.h>
|
#include <AppKit/DPSOperators.h>
|
||||||
|
|
||||||
|
#include "QF/sys.h"
|
||||||
|
|
||||||
|
#include "Clipper.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "XYView.h"
|
||||||
|
#include "CameraView.h"
|
||||||
|
#include "QuakeEd.h"
|
||||||
|
|
||||||
id clipper_i;
|
id clipper_i;
|
||||||
|
|
||||||
@implementation Clipper
|
@implementation Clipper
|
||||||
|
@ -42,7 +48,7 @@ id clipper_i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qprintf ("no clipplane");
|
Sys_Printf ("no clipplane");
|
||||||
NSBeep ();
|
NSBeep ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,28 @@
|
||||||
#ifndef Entity_h
|
#ifndef Entity_h
|
||||||
#define Entity_h
|
#define Entity_h
|
||||||
|
|
||||||
#define MAX_KEY 64
|
#include <AppKit/AppKit.h>
|
||||||
#define MAX_VALUE 128
|
|
||||||
typedef struct epair_s
|
#include "QF/mathlib.h"
|
||||||
{
|
|
||||||
|
typedef struct epair_s {
|
||||||
struct epair_s *next;
|
struct epair_s *next;
|
||||||
char key[MAX_KEY];
|
char *key;
|
||||||
char value[MAX_VALUE];
|
char *value;
|
||||||
} epair_t;
|
} epair_t;
|
||||||
|
|
||||||
// an Entity is a list of brush objects, with additional key / value info
|
// an Entity is a list of brush objects, with additional key / value info
|
||||||
|
|
||||||
@interface Entity : NSObject <NSCopying, NSMutableCopying>
|
@interface Entity : NSMutableArray
|
||||||
{
|
{
|
||||||
epair_t *epairs;
|
epair_t *epairs;
|
||||||
BOOL modifiable;
|
BOOL modifiable;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initClass: (char *)classname;
|
- initClass: (char *)classname;
|
||||||
- initFromTokens;
|
- initFromScript: (struct script_s *) script;
|
||||||
|
|
||||||
- free;
|
- (void)dealloc;
|
||||||
|
|
||||||
- (BOOL)modifiable;
|
- (BOOL)modifiable;
|
||||||
- setModifiable: (BOOL)m;
|
- setModifiable: (BOOL)m;
|
||||||
|
@ -32,7 +33,7 @@ typedef struct epair_s
|
||||||
|
|
||||||
- (char *)valueForQKey: (char *)k;
|
- (char *)valueForQKey: (char *)k;
|
||||||
- getVector: (vec3_t)v forKey: (char *)k;
|
- getVector: (vec3_t)v forKey: (char *)k;
|
||||||
- setKey:(char *)k toValue:(char *)v;
|
- setKey:(const char *)k toValue:(const char *)v;
|
||||||
- (int)numPairs;
|
- (int)numPairs;
|
||||||
- (epair_t *)epairs;
|
- (epair_t *)epairs;
|
||||||
- removeKeyPair: (char *)key;
|
- removeKeyPair: (char *)key;
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "QF/dstring.h"
|
||||||
|
#include "QF/script.h"
|
||||||
|
#include "QF/sys.h"
|
||||||
|
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "EntityClass.h"
|
||||||
|
#include "TexturePalette.h"
|
||||||
|
#include "SetBrush.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "CameraView.h"
|
||||||
|
|
||||||
@implementation Entity
|
@implementation Entity
|
||||||
|
|
||||||
|
@ -15,13 +24,10 @@ vec3_t bad_maxs = {8, 8, 8};
|
||||||
|
|
||||||
// get class
|
// get class
|
||||||
new = [entity_classes_i classForName: [self valueForQKey: "classname"]];
|
new = [entity_classes_i classForName: [self valueForQKey: "classname"]];
|
||||||
if (new)
|
if (new) {
|
||||||
{
|
|
||||||
v = [new mins];
|
v = [new mins];
|
||||||
v2 = [new maxs];
|
v2 = [new maxs];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
v = bad_mins;
|
v = bad_mins;
|
||||||
v2 = bad_maxs;
|
v2 = bad_maxs;
|
||||||
}
|
}
|
||||||
|
@ -43,31 +49,6 @@ vec3_t bad_maxs = {8, 8, 8};
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- copyWithZone:(NSZone *)zone
|
|
||||||
{
|
|
||||||
id new, nb;
|
|
||||||
epair_t *e;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
new = [[Entity alloc] init];
|
|
||||||
[new setModifiable: modifiable];
|
|
||||||
|
|
||||||
for (e=epairs ; e ; e=e->next)
|
|
||||||
{ // don't copy target and targetname fields
|
|
||||||
if (strncmp(e->key,"target",6))
|
|
||||||
[new setKey: e->key toValue: e->value];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0 ; i<numElements ; i++)
|
|
||||||
{
|
|
||||||
nb = [[self objectAt: i] copy];
|
|
||||||
[nb setParent: new];
|
|
||||||
[new addObject: nb];
|
|
||||||
}
|
|
||||||
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
- initClass: (char *)classname
|
- initClass: (char *)classname
|
||||||
{
|
{
|
||||||
id new;
|
id new;
|
||||||
|
@ -108,16 +89,18 @@ vec3_t bad_maxs = {8, 8, 8};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- free
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
epair_t *e, *n;
|
epair_t *e, *n;
|
||||||
|
|
||||||
for (e=epairs ; e ; e=n)
|
for (e=epairs ; e ; e=n)
|
||||||
{
|
{
|
||||||
n = e->next;
|
n = e->next;
|
||||||
|
free (e->key);
|
||||||
|
free (e->value);
|
||||||
free (e);
|
free (e);
|
||||||
}
|
}
|
||||||
return [super free];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)modifiable
|
- (BOOL)modifiable
|
||||||
|
@ -131,19 +114,17 @@ vec3_t bad_maxs = {8, 8, 8};
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- removeObject: o
|
- (void)removeObject: o
|
||||||
{
|
{
|
||||||
o = [super removeObject: o];
|
[super removeObject: o];
|
||||||
if (numElements)
|
if ([self count])
|
||||||
return o;
|
return;
|
||||||
// the entity is empty, so remove the entire thing
|
// the entity is empty, so remove the entire thing
|
||||||
if ( self == [map_i objectAt: 0])
|
if ( self == [map_i objectAtIndex: 0])
|
||||||
return o; // never remove the world
|
return; // never remove the world
|
||||||
|
|
||||||
[map_i removeObject: self];
|
[map_i removeObject: self];
|
||||||
[self free];
|
[self release];
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,33 +165,27 @@ vec3_t bad_maxs = {8, 8, 8};
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- setKey:(char *)k toValue:(char *)v
|
- setKey:(const char *)k toValue:(const char *)v
|
||||||
{
|
{
|
||||||
epair_t *e;
|
epair_t *e;
|
||||||
|
|
||||||
if (strlen(k) > MAX_KEY)
|
|
||||||
Error ("setKey: %s > MAX_KEY", k);
|
|
||||||
if (strlen(v) > MAX_VALUE)
|
|
||||||
Error ("setKey: %s > MAX_VALUE", v);
|
|
||||||
|
|
||||||
while (*k && *k <= ' ')
|
while (*k && *k <= ' ')
|
||||||
k++;
|
k++;
|
||||||
if (!*k)
|
if (!*k)
|
||||||
return self; // don't set NULL values
|
return self; // don't set NULL values
|
||||||
|
|
||||||
for (e=epairs ; e ; e=e->next)
|
for (e=epairs ; e ; e=e->next) {
|
||||||
if (!strcmp(k,e->key))
|
if (!strcmp (k, e->key)) {
|
||||||
{
|
free (e->value);
|
||||||
memset (e->value, 0, sizeof(e->value));
|
e->value = strdup (v);
|
||||||
strcpy (e->value, v);
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e = malloc (sizeof(epair_t));
|
e = malloc (sizeof(epair_t));
|
||||||
memset (e, 0, sizeof(epair_t));
|
|
||||||
|
|
||||||
strcpy (e->key, k);
|
e->key = strdup (k);
|
||||||
strcpy (e->value, v);
|
e->value = strdup (v);
|
||||||
e->next = epairs;
|
e->next = epairs;
|
||||||
epairs = e;
|
epairs = e;
|
||||||
|
|
||||||
|
@ -287,7 +262,7 @@ If the entity does not have a "targetname" key, a unique one is generated
|
||||||
maxt = 0;
|
maxt = 0;
|
||||||
for (i=1 ; i<count ; i++)
|
for (i=1 ; i<count ; i++)
|
||||||
{
|
{
|
||||||
ent = [map_i objectAt: i];
|
ent = [map_i objectAtIndex: i];
|
||||||
t = [ent valueForQKey: "targetname"];
|
t = [ent valueForQKey: "targetname"];
|
||||||
if (!t || t[0] != 't')
|
if (!t || t[0] != 't')
|
||||||
continue;
|
continue;
|
||||||
|
@ -313,9 +288,9 @@ FILE METHODS
|
||||||
|
|
||||||
int nument;
|
int nument;
|
||||||
|
|
||||||
- initFromTokens
|
- initFromScript: (script_t *) script
|
||||||
{
|
{
|
||||||
char key[MAXTOKEN];
|
char *key;
|
||||||
id eclass, brush;
|
id eclass, brush;
|
||||||
char *spawn;
|
char *spawn;
|
||||||
vec3_t emins, emaxs;
|
vec3_t emins, emaxs;
|
||||||
|
@ -327,31 +302,30 @@ int nument;
|
||||||
|
|
||||||
[self init];
|
[self init];
|
||||||
|
|
||||||
if (!GetToken (true))
|
if (!Script_GetToken (script, true))
|
||||||
{
|
{
|
||||||
[self free];
|
[self dealloc];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp (token, "{") )
|
if (strcmp (Script_Token (script), "{") )
|
||||||
Error ("initFromFileP: { not found");
|
Sys_Error ("initFromFileP: { not found");
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
if (!Script_GetToken (script, true))
|
||||||
if (!GetToken (true))
|
|
||||||
break;
|
break;
|
||||||
if (!strcmp (token, "}") )
|
if (!strcmp (Script_Token (script), "}") )
|
||||||
break;
|
break;
|
||||||
if (!strcmp (token, "{") )
|
if (!strcmp (Script_Token (script), "{") ) {
|
||||||
{ // read a brush
|
// read a brush
|
||||||
brush = [[SetBrush alloc] initFromTokens: self];
|
brush = [[SetBrush alloc] initFromScript: script owner:self];
|
||||||
[self addObject: brush];
|
[self addObject: brush];
|
||||||
}
|
} else {
|
||||||
else
|
// read a key / value pair
|
||||||
{ // read a key / value pair
|
key = strdup (Script_Token (script));
|
||||||
strcpy (key, token);
|
Script_GetToken (script, false);
|
||||||
GetToken (false);
|
[self setKey: key toValue:Script_Token (script)];
|
||||||
[self setKey: key toValue:token];
|
free (key);
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
|
@ -368,7 +342,7 @@ int nument;
|
||||||
if ([self count] && esize != esize_model)
|
if ([self count] && esize != esize_model)
|
||||||
{
|
{
|
||||||
printf ("WARNING:Entity with brushes and wrong model type\n");
|
printf ("WARNING:Entity with brushes and wrong model type\n");
|
||||||
[self empty];
|
[self removeAllObjects];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![self count] && esize == esize_model)
|
if (![self count] && esize == esize_model)
|
||||||
|
@ -397,7 +371,7 @@ int nument;
|
||||||
c = [self count];
|
c = [self count];
|
||||||
for (i=0 ; i<c ; i++)
|
for (i=0 ; i<c ; i++)
|
||||||
{
|
{
|
||||||
brush = [self objectAt: i];
|
brush = [self objectAtIndex: i];
|
||||||
[brush setEntityColor: color];
|
[brush setEntityColor: color];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +386,7 @@ int nument;
|
||||||
id new;
|
id new;
|
||||||
char value[80];
|
char value[80];
|
||||||
vec3_t mins, maxs, org;
|
vec3_t mins, maxs, org;
|
||||||
float *v;
|
const vec_t *v;
|
||||||
BOOL temporg;
|
BOOL temporg;
|
||||||
char oldang[80];
|
char oldang[80];
|
||||||
|
|
||||||
|
@ -426,8 +400,8 @@ int nument;
|
||||||
sprintf (value, "%i", (int)([cameraview_i yawAngle]*180/M_PI));
|
sprintf (value, "%i", (int)([cameraview_i yawAngle]*180/M_PI));
|
||||||
[self setKey: "angle" toValue: value];
|
[self setKey: "angle" toValue: value];
|
||||||
}
|
}
|
||||||
else if ( self != [map_i objectAt: 0]
|
else if ( self != [map_i objectAtIndex: 0]
|
||||||
&& [[self objectAt: 0] regioned] )
|
&& [[self objectAtIndex: 0] regioned] )
|
||||||
return self; // skip the entire entity definition
|
return self; // skip the entire entity definition
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +410,7 @@ int nument;
|
||||||
// set an origin epair
|
// set an origin epair
|
||||||
if (!modifiable)
|
if (!modifiable)
|
||||||
{
|
{
|
||||||
[[self objectAt: 0] getMins: mins maxs: maxs];
|
[[self objectAtIndex: 0] getMins: mins maxs: maxs];
|
||||||
if (temporg)
|
if (temporg)
|
||||||
{
|
{
|
||||||
[cameraview_i getOrigin: mins];
|
[cameraview_i getOrigin: mins];
|
||||||
|
@ -462,8 +436,8 @@ int nument;
|
||||||
// fixed size entities don't save out brushes
|
// fixed size entities don't save out brushes
|
||||||
if ( modifiable )
|
if ( modifiable )
|
||||||
{
|
{
|
||||||
for (i=0 ; i<numElements ; i++)
|
for (i = 0 ; i < [self count]; i++)
|
||||||
[[self objectAt: i] writeToFILE: f region: reg];
|
[[self objectAtIndex: i] writeToFILE: f region: reg];
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (f,"}\n");
|
fprintf (f,"}\n");
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
#define EntityClass_h
|
#define EntityClass_h
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
#include "mathlib.h"
|
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
typedef enum {esize_model, esize_fixed} esize_t;
|
typedef enum {esize_model, esize_fixed} esize_t;
|
||||||
|
|
||||||
|
@ -15,10 +16,10 @@ typedef enum {esize_model, esize_fixed} esize_t;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
vec3_t color;
|
vec3_t color;
|
||||||
char *comments;
|
char *comments;
|
||||||
char flagnames[MAX_FLAGS][32];
|
char *flagnames[MAX_FLAGS];
|
||||||
}
|
}
|
||||||
|
|
||||||
- initFromText: (char *)text;
|
- initFromText: (const char *)text source: (const char *)filename;
|
||||||
- (char *)classname;
|
- (char *)classname;
|
||||||
- (esize_t)esize;
|
- (esize_t)esize;
|
||||||
- (float *)mins; // only for esize_fixed
|
- (float *)mins; // only for esize_fixed
|
||||||
|
|
|
@ -1,8 +1,36 @@
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "QF/dstring.h"
|
||||||
|
#include "QF/quakeio.h"
|
||||||
|
#include "QF/script.h"
|
||||||
|
#include "QF/sys.h"
|
||||||
|
#include "QF/va.h"
|
||||||
|
|
||||||
|
#include "EntityClass.h"
|
||||||
|
|
||||||
@implementation EntityClass
|
@implementation EntityClass
|
||||||
|
|
||||||
|
static int
|
||||||
|
parse_vector (script_t *script, vec3_t vec)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if (!Script_GetToken (script, 0))
|
||||||
|
return 0;
|
||||||
|
if (strcmp (script->token->str, "("))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
r = sscanf (script->p, "%f %f %f)", &vec[0], &vec[1], &vec[2]);
|
||||||
|
if (r != 3)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while (strcmp (script->token->str, ")")) {
|
||||||
|
if (!Script_GetToken (script, 0))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// the classname, color triple, and bounding box are parsed out of comments
|
// the classname, color triple, and bounding box are parsed out of comments
|
||||||
// A ? size means take the exact brush size.
|
// A ? size means take the exact brush size.
|
||||||
//
|
//
|
||||||
|
@ -13,84 +41,59 @@
|
||||||
//
|
//
|
||||||
// /*QUAKED func_door (0 .5 .8) ? START_OPEN STONE_SOUND DOOR_DONT_LINK GOLD_KEY SILVER_KEY
|
// /*QUAKED func_door (0 .5 .8) ? START_OPEN STONE_SOUND DOOR_DONT_LINK GOLD_KEY SILVER_KEY
|
||||||
|
|
||||||
char *debugname;
|
- initFromText: (const char *)text source: (const char *)filename
|
||||||
- initFromText: (char *)text
|
|
||||||
{
|
{
|
||||||
char *t;
|
const char *t;
|
||||||
int len;
|
size_t len;
|
||||||
int r, i;
|
int i;
|
||||||
char parms[256], *p;
|
script_t *script;
|
||||||
|
|
||||||
[super init];
|
[super init];
|
||||||
|
|
||||||
text += strlen("/*QUAKED ");
|
text += strlen("/*QUAKED ");
|
||||||
|
|
||||||
|
script = Script_New ();
|
||||||
|
Script_Start (script, filename, text);
|
||||||
|
|
||||||
// grab the name
|
// grab the name
|
||||||
text = COM_Parse (text);
|
if (!Script_GetToken (script, 0))
|
||||||
name = malloc (strlen(com_token)+1);
|
return 0;
|
||||||
strcpy (name, com_token);
|
if (!strcmp (script->token->str, "*/"))
|
||||||
debugname = name;
|
return 0;
|
||||||
|
name = strdup (script->token->str);
|
||||||
|
|
||||||
// grab the color
|
// grab the color
|
||||||
r = sscanf (text," (%f %f %f)", &color[0], &color[1], &color[2]);
|
if (!parse_vector (script, color))
|
||||||
if (r != 3)
|
return 0;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
while (*text != ')')
|
|
||||||
{
|
|
||||||
if (!*text)
|
|
||||||
return NULL;
|
|
||||||
text++;
|
|
||||||
}
|
|
||||||
text++;
|
|
||||||
|
|
||||||
// get the size
|
// get the size
|
||||||
text = COM_Parse (text);
|
if (!strcmp (script->token->str, "(")) {
|
||||||
if (com_token[0] == '(')
|
Script_UngetToken (script);
|
||||||
{ // parse the size as two vectors
|
if (!parse_vector (script, mins))
|
||||||
|
return 0;
|
||||||
|
if (!parse_vector (script, maxs))
|
||||||
|
return 0;
|
||||||
esize = esize_fixed;
|
esize = esize_fixed;
|
||||||
r = sscanf (text,"%f %f %f) (%f %f %f)", &mins[0], &mins[1], &mins[2], &maxs[0], &maxs[1], &maxs[2]);
|
} else if (!strcmp (script->token->str, "?")) {
|
||||||
if (r != 6)
|
// use the brushes
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i=0 ; i<2 ; i++)
|
|
||||||
{
|
|
||||||
while (*text != ')')
|
|
||||||
{
|
|
||||||
if (!*text)
|
|
||||||
return NULL;
|
|
||||||
text++;
|
|
||||||
}
|
|
||||||
text++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // use the brushes
|
|
||||||
esize = esize_model;
|
esize = esize_model;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the flags
|
// get the flags
|
||||||
|
// any remaining words on the line are parm flags
|
||||||
|
for (i = 0; i < MAX_FLAGS; i++) {
|
||||||
// copy to the first /n
|
if (!Script_TokenAvailable (script, 0))
|
||||||
p = parms;
|
|
||||||
while (*text && *text != '\n')
|
|
||||||
*p++ = *text++;
|
|
||||||
*p = 0;
|
|
||||||
text++;
|
|
||||||
|
|
||||||
// any remaining words are parm flags
|
|
||||||
p = parms;
|
|
||||||
for (i=0 ; i<8 ; i++)
|
|
||||||
{
|
|
||||||
p = COM_Parse (p);
|
|
||||||
if (!p)
|
|
||||||
break;
|
break;
|
||||||
strcpy (flagnames[i], com_token);
|
Script_GetToken (script, 0);
|
||||||
|
flagnames[i] = strdup (script->token->str);
|
||||||
}
|
}
|
||||||
|
while (Script_TokenAvailable (script, 0))
|
||||||
|
Script_GetToken (script, 0);
|
||||||
|
|
||||||
// find the length until close comment
|
// find the length until close comment
|
||||||
for (t=text ; t[0] && !(t[0]=='*' && t[1]=='/') ; t++)
|
for (t = script->p; t[0] && !(t[0] == '*' && t[1] == '/'); t++)
|
||||||
;
|
;
|
||||||
|
|
||||||
// copy the comment block out
|
// copy the comment block out
|
||||||
|
@ -136,7 +139,7 @@ char *debugname;
|
||||||
- (char *)flagName: (unsigned)flagnum
|
- (char *)flagName: (unsigned)flagnum
|
||||||
{
|
{
|
||||||
if (flagnum >= MAX_FLAGS)
|
if (flagnum >= MAX_FLAGS)
|
||||||
Error ("EntityClass flagName: bad number");
|
Sys_Error ("EntityClass flagName: bad number");
|
||||||
return flagnames[flagnum];
|
return flagnames[flagnum];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,24 +179,34 @@ scanFile
|
||||||
*/
|
*/
|
||||||
- (void)scanFile: (char *)filename
|
- (void)scanFile: (char *)filename
|
||||||
{
|
{
|
||||||
int size;
|
int size, line;
|
||||||
char *data;
|
char *data;
|
||||||
id cl;
|
id cl;
|
||||||
int i;
|
int i;
|
||||||
char path[1024];
|
char path[1024];
|
||||||
|
QFile *file;
|
||||||
|
|
||||||
sprintf (path,"%s/%s", source_path, filename);
|
sprintf (path,"%s/%s", source_path, filename);
|
||||||
|
|
||||||
size = LoadFile (path, (void *)&data);
|
file = Qopen (path, "rt");
|
||||||
|
if (!file)
|
||||||
|
return;
|
||||||
|
size = Qfilesize (file);
|
||||||
|
data = malloc (size + 1);
|
||||||
|
size = Qread (file, data, size);
|
||||||
|
data[size] = 0;
|
||||||
|
Qclose (file);
|
||||||
|
|
||||||
for (i=0 ; i<size ; i++)
|
line = 1;
|
||||||
if (!strncmp(data+i, "/*QUAKED",8))
|
for (i=0 ; i<size ; i++) {
|
||||||
{
|
if (!strncmp(data+i, "/*QUAKED",8)) {
|
||||||
cl = [[EntityClass alloc] initFromText: data+i];
|
cl = [[EntityClass alloc] initFromText: (data + i)
|
||||||
|
source: va ("%s:%d", filename, line)];
|
||||||
if (cl)
|
if (cl)
|
||||||
[self insertEC: cl];
|
[self insertEC: cl];
|
||||||
else
|
} else if (data[i] == '\n') {
|
||||||
printf ("Error parsing: %s in %s\n",debugname, filename);
|
line++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free (data);
|
free (data);
|
||||||
|
@ -208,7 +221,7 @@ scanDirectory
|
||||||
- (void)scanDirectory
|
- (void)scanDirectory
|
||||||
{
|
{
|
||||||
int count, i;
|
int count, i;
|
||||||
struct direct **namelist, *ent;
|
struct dirent **namelist, *ent;
|
||||||
|
|
||||||
[self removeAllObjects];
|
[self removeAllObjects];
|
||||||
|
|
||||||
|
@ -239,8 +252,9 @@ id entity_classes_i;
|
||||||
|
|
||||||
entity_classes_i = self;
|
entity_classes_i = self;
|
||||||
|
|
||||||
nullclass = [[EntityClass alloc] initFromText:
|
nullclass = [[EntityClass alloc]
|
||||||
"/*QUAKED UNKNOWN_CLASS (0 0.5 0) ?"];
|
initFromText: "/*QUAKED UNKNOWN_CLASS (0 0.5 0) ?*/"
|
||||||
|
source: va ("%s:%d", __FILE__, __LINE__ - 1)];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ MapEdit_RESOURCE_FILES= \
|
||||||
MapEdit.gorm
|
MapEdit.gorm
|
||||||
|
|
||||||
MapEdit_OBJC_FILES= \
|
MapEdit_OBJC_FILES= \
|
||||||
CameraView.m Clipper.m EntityClass.m KeypairView.m PopScrollView.m ZView.m misc.m render.m
|
CameraView.m Clipper.m EntityClass.m KeypairView.m PopScrollView.m ZView.m render.m
|
||||||
|
|
||||||
MapEdit_HEADERS= \
|
MapEdit_HEADERS= \
|
||||||
EntityClass.h
|
EntityClass.h
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef KeypairView_h
|
#ifndef KeypairView_h
|
||||||
#define KeypairView_h
|
#define KeypairView_h
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
extern id keypairview_i;
|
extern id keypairview_i;
|
||||||
|
|
||||||
@interface KeypairView:NSView
|
@interface KeypairView:NSView
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "KeypairView.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "Things.h"
|
||||||
|
|
||||||
id keypairview_i;
|
id keypairview_i;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef Map_h
|
#ifndef Map_h
|
||||||
#define Map_h
|
#define Map_h
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
// Map is a list of Entity objects
|
// Map is a list of Entity objects
|
||||||
|
|
||||||
extern id map_i;
|
extern id map_i;
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "QF/quakeio.h"
|
||||||
|
#include "QF/script.h"
|
||||||
|
#include "QF/sys.h"
|
||||||
|
|
||||||
|
#include "Map.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "TexturePalette.h"
|
||||||
|
#include "SetBrush.h"
|
||||||
|
#include "XYView.h"
|
||||||
|
#include "CameraView.h"
|
||||||
|
#include "QuakeEd.h"
|
||||||
|
#include "Things.h"
|
||||||
|
#include "InspectorControl.h"
|
||||||
|
#include "Project.h"
|
||||||
|
|
||||||
|
|
||||||
id map_i;
|
id map_i;
|
||||||
|
|
||||||
|
@ -46,7 +59,7 @@ FILE METHODS
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[w removeObjectAtIndex: 0];
|
[w removeObjectAtIndex: 0];
|
||||||
[o free];
|
[o release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +68,8 @@ FILE METHODS
|
||||||
{
|
{
|
||||||
o = [self objectAtIndex: 0];
|
o = [self objectAtIndex: 0];
|
||||||
[self removeObjectAtIndex: 0];
|
[self removeObjectAtIndex: 0];
|
||||||
[o freeObjects];
|
[o removeAllObjects];
|
||||||
[o free];
|
[o release];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -169,6 +182,7 @@ FILE METHODS
|
||||||
|
|
||||||
- writeStats
|
- writeStats
|
||||||
{
|
{
|
||||||
|
/*XXX
|
||||||
FILE *f;
|
FILE *f;
|
||||||
extern int c_updateall;
|
extern int c_updateall;
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
|
@ -180,6 +194,7 @@ FILE METHODS
|
||||||
fprintf (f,"%i %i\n", (int)tp.tv_sec, c_updateall);
|
fprintf (f,"%i %i\n", (int)tp.tv_sec, c_updateall);
|
||||||
c_updateall = 0;
|
c_updateall = 0;
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
*/
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,17 +238,26 @@ readMapFile
|
||||||
int i, c;
|
int i, c;
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
float angle;
|
float angle;
|
||||||
|
QFile *file;
|
||||||
|
script_t *script;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
[self saveSelected];
|
[self saveSelected];
|
||||||
|
|
||||||
qprintf ("loading %s\n", fname);
|
Sys_Printf ("loading %s\n", fname);
|
||||||
|
|
||||||
LoadFile (fname, (void **)&dat);
|
file = Qopen (fname, "rt");
|
||||||
StartTokenParsing (dat);
|
size = Qfilesize (file);
|
||||||
|
dat = malloc (size + 1);
|
||||||
|
size = Qread (file, dat, size);
|
||||||
|
Qclose (file);
|
||||||
|
dat[size] = 0;
|
||||||
|
|
||||||
do
|
script = Script_New ();
|
||||||
{
|
Script_Start (script, fname, dat);
|
||||||
new = [[Entity alloc] initFromTokens];
|
|
||||||
|
do {
|
||||||
|
new = [[Entity alloc] initFromScript: script];
|
||||||
if (!new)
|
if (!new)
|
||||||
break;
|
break;
|
||||||
[self addObject: new];
|
[self addObject: new];
|
||||||
|
@ -288,11 +312,11 @@ writeMapFile
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
qprintf ("writeMapFile: %s", fname);
|
Sys_Printf ("writeMapFile: %s", fname);
|
||||||
|
|
||||||
f = fopen (fname,"w");
|
f = fopen (fname,"w");
|
||||||
if (!f)
|
if (!f)
|
||||||
Error ("couldn't write %s", fname);
|
Sys_Error ("couldn't write %s", fname);
|
||||||
|
|
||||||
for (i=0 ; i<[self count] ; i++)
|
for (i=0 ; i<[self count] ; i++)
|
||||||
[[self objectAtIndex: i] writeToFILE: f region: reg];
|
[[self objectAtIndex: i] writeToFILE: f region: reg];
|
||||||
|
@ -353,7 +377,7 @@ make a target connection from the original entity.
|
||||||
oldent = [self currentEntity];
|
oldent = [self currentEntity];
|
||||||
if (oldent == [self objectAtIndex: 0])
|
if (oldent == [self objectAtIndex: 0])
|
||||||
{
|
{
|
||||||
qprintf ("Must have a non-world entity selected to connect");
|
Sys_Printf ("Must have a non-world entity selected to connect");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,13 +385,13 @@ make a target connection from the original entity.
|
||||||
ent = [self currentEntity];
|
ent = [self currentEntity];
|
||||||
if (ent == oldent)
|
if (ent == oldent)
|
||||||
{
|
{
|
||||||
qprintf ("Must click on a different entity to connect");
|
Sys_Printf ("Must click on a different entity to connect");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent == [self objectAtIndex: 0])
|
if (ent == [self objectAtIndex: 0])
|
||||||
{
|
{
|
||||||
qprintf ("Must click on a non-world entity to connect");
|
Sys_Printf ("Must click on a non-world entity to connect");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,13 +446,13 @@ to intervening world brushes
|
||||||
|
|
||||||
if (besttime == 99999)
|
if (besttime == 99999)
|
||||||
{
|
{
|
||||||
qprintf ("trace missed");
|
Sys_Printf ("trace missed");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( [bestbrush regioned] )
|
if ( [bestbrush regioned] )
|
||||||
{
|
{
|
||||||
qprintf ("WANRING: clicked on regioned brush");
|
Sys_Printf ("WANRING: clicked on regioned brush");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,12 +472,12 @@ to intervening world brushes
|
||||||
}
|
}
|
||||||
|
|
||||||
[bestbrush setSelected: YES];
|
[bestbrush setSelected: YES];
|
||||||
qprintf ("selected entity %i brush %i face %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush], bestface);
|
Sys_Printf ("selected entity %i brush %i face %i", (int) [self indexOfObject:bestent], (int) [bestent indexOfObject: bestbrush], bestface);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[bestbrush setSelected: NO];
|
[bestbrush setSelected: NO];
|
||||||
qprintf ("deselected entity %i brush %i face %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush], bestface);
|
Sys_Printf ("deselected entity %i brush %i face %i", (int) [self indexOfObject:bestent], (int) [bestent indexOfObject: bestbrush], bestface);
|
||||||
}
|
}
|
||||||
|
|
||||||
[quakeed_i enableFlushWindow];
|
[quakeed_i enableFlushWindow];
|
||||||
|
@ -548,14 +572,14 @@ getTextureRay
|
||||||
|
|
||||||
if ( ![bestent modifiable])
|
if ( ![bestent modifiable])
|
||||||
{
|
{
|
||||||
qprintf ("can't modify spawned entities");
|
Sys_Printf ("can't modify spawned entities");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
td = [bestbrush texturedefForFace: bestface];
|
td = [bestbrush texturedefForFace: bestface];
|
||||||
[texturepalette_i setTextureDef: td];
|
[texturepalette_i setTextureDef: td];
|
||||||
|
|
||||||
qprintf ("grabbed texturedef and sizes");
|
Sys_Printf ("grabbed texturedef and sizes");
|
||||||
|
|
||||||
[bestbrush getMins: mins maxs: maxs];
|
[bestbrush getMins: mins maxs: maxs];
|
||||||
|
|
||||||
|
@ -604,19 +628,19 @@ setTextureRay
|
||||||
|
|
||||||
if (besttime == 99999)
|
if (besttime == 99999)
|
||||||
{
|
{
|
||||||
qprintf ("trace missed");
|
Sys_Printf ("trace missed");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ![bestent modifiable])
|
if ( ![bestent modifiable])
|
||||||
{
|
{
|
||||||
qprintf ("can't modify spawned entities");
|
Sys_Printf ("can't modify spawned entities");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( [bestbrush regioned] )
|
if ( [bestbrush regioned] )
|
||||||
{
|
{
|
||||||
qprintf ("WANRING: clicked on regioned brush");
|
Sys_Printf ("WANRING: clicked on regioned brush");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,12 +650,12 @@ setTextureRay
|
||||||
if (allsides)
|
if (allsides)
|
||||||
{
|
{
|
||||||
[bestbrush setTexturedef: &td];
|
[bestbrush setTexturedef: &td];
|
||||||
qprintf ("textured entity %i brush %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush]);
|
Sys_Printf ("textured entity %i brush %i", (int) [self indexOfObject:bestent], (int) [bestent indexOfObject: bestbrush]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[bestbrush setTexturedef: &td forFace: bestface];
|
[bestbrush setTexturedef: &td forFace: bestface];
|
||||||
qprintf ("deselected entity %i brush %i face %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush], bestface);
|
Sys_Printf ("deselected entity %i brush %i face %i", (int) [self indexOfObject:bestent], (int) [bestent indexOfObject: bestbrush], bestface);
|
||||||
}
|
}
|
||||||
[quakeed_i enableFlushWindow];
|
[quakeed_i enableFlushWindow];
|
||||||
|
|
||||||
|
@ -669,12 +693,12 @@ OPERATIONS ON SELECTIONS
|
||||||
if ([brush regioned])
|
if ([brush regioned])
|
||||||
continue;
|
continue;
|
||||||
total++;
|
total++;
|
||||||
[brush perform:sel];
|
[brush performSelector:sel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!total)
|
// if (!total)
|
||||||
// qprintf ("nothing selected");
|
// Sys_Printf ("nothing selected");
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -696,7 +720,7 @@ OPERATIONS ON SELECTIONS
|
||||||
continue;
|
continue;
|
||||||
if ([brush regioned])
|
if ([brush regioned])
|
||||||
continue;
|
continue;
|
||||||
[brush perform:sel];
|
[brush performSelector:sel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +742,7 @@ OPERATIONS ON SELECTIONS
|
||||||
brush = [ent objectAtIndex: j];
|
brush = [ent objectAtIndex: j];
|
||||||
if ([brush regioned])
|
if ([brush regioned])
|
||||||
continue;
|
continue;
|
||||||
[brush perform:sel];
|
[brush performSelector:sel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +762,7 @@ OPERATIONS ON SELECTIONS
|
||||||
for (j = c2-1 ; j >=0 ; j--)
|
for (j = c2-1 ; j >=0 ; j--)
|
||||||
{
|
{
|
||||||
brush = [ent objectAtIndex: j];
|
brush = [ent objectAtIndex: j];
|
||||||
[brush perform:sel];
|
[brush performSelector:sel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,7 +781,7 @@ void sel_identity (void)
|
||||||
{
|
{
|
||||||
if ( ![currentEntity modifiable])
|
if ( ![currentEntity modifiable])
|
||||||
{
|
{
|
||||||
qprintf ("can't modify spawned entities");
|
Sys_Printf ("can't modify spawned entities");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,14 +936,14 @@ UI operations
|
||||||
o = [self selectedBrush];
|
o = [self selectedBrush];
|
||||||
if (!o)
|
if (!o)
|
||||||
{
|
{
|
||||||
qprintf ("nothing selected");
|
Sys_Printf ("nothing selected");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
o = [o parent];
|
o = [o parent];
|
||||||
c = [o count];
|
c = [o count];
|
||||||
for (i=0 ; i<c ; i++)
|
for (i=0 ; i<c ; i++)
|
||||||
[[o objectAtIndex: i] setSelected: YES];
|
[[o objectAtIndex: i] setSelected: YES];
|
||||||
qprintf ("%i brushes selected", c);
|
Sys_Printf ("%i brushes selected", c);
|
||||||
|
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
|
|
||||||
|
@ -930,14 +954,14 @@ UI operations
|
||||||
{
|
{
|
||||||
if (currentEntity != [self objectAtIndex: 0])
|
if (currentEntity != [self objectAtIndex: 0])
|
||||||
{
|
{
|
||||||
qprintf ("ERROR: can't makeEntity inside an entity");
|
Sys_Printf ("ERROR: can't makeEntity inside an entity");
|
||||||
NSBeep ();
|
NSBeep ();
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( [self numSelected] == 0)
|
if ( [self numSelected] == 0)
|
||||||
{
|
{
|
||||||
qprintf ("ERROR: must have a seed brush to make an entity");
|
Sys_Printf ("ERROR: must have a seed brush to make an entity");
|
||||||
NSBeep ();
|
NSBeep ();
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -967,7 +991,7 @@ UI operations
|
||||||
|
|
||||||
if ([self numSelected] != 1)
|
if ([self numSelected] != 1)
|
||||||
{
|
{
|
||||||
qprintf ("must have a single brush selected");
|
Sys_Printf ("must have a single brush selected");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,7 +1001,7 @@ UI operations
|
||||||
|
|
||||||
[self makeUnselectedPerform: selector];
|
[self makeUnselectedPerform: selector];
|
||||||
|
|
||||||
qprintf ("identified contents");
|
Sys_Printf ("identified contents");
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -1002,7 +1026,7 @@ UI operations
|
||||||
|
|
||||||
if ([self numSelected] != 1)
|
if ([self numSelected] != 1)
|
||||||
{
|
{
|
||||||
qprintf ("must have a single brush selected");
|
Sys_Printf ("must have a single brush selected");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,7 +1054,7 @@ UI operations
|
||||||
|
|
||||||
if ([self numSelected] != 1)
|
if ([self numSelected] != 1)
|
||||||
{
|
{
|
||||||
qprintf ("must have a single brush selected");
|
Sys_Printf ("must have a single brush selected");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,7 +1085,7 @@ subtractSelection
|
||||||
id o, o2;
|
id o, o2;
|
||||||
id sellist, sourcelist;
|
id sellist, sourcelist;
|
||||||
|
|
||||||
qprintf ("performing brush subtraction...");
|
Sys_Printf ("performing brush subtraction...");
|
||||||
|
|
||||||
sourcelist = [[NSMutableArray alloc] init];
|
sourcelist = [[NSMutableArray alloc] init];
|
||||||
sellist = [[NSMutableArray alloc] init];
|
sellist = [[NSMutableArray alloc] init];
|
||||||
|
@ -1090,32 +1114,32 @@ subtractSelection
|
||||||
{
|
{
|
||||||
o2 = [sourcelist objectAtIndex: j];
|
o2 = [sourcelist objectAtIndex: j];
|
||||||
[o2 carve];
|
[o2 carve];
|
||||||
[carve_in freeObjects];
|
[carve_in removeAllObjects];
|
||||||
}
|
}
|
||||||
|
|
||||||
[sourcelist free]; // the individual have been moved/freed
|
[sourcelist release]; // the individual have been moved/freed
|
||||||
sourcelist = carve_out;
|
sourcelist = carve_out;
|
||||||
carve_out = [[NSMutableArray alloc] init];
|
carve_out = [[NSMutableArray alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the selection back to the remnants
|
// add the selection back to the remnants
|
||||||
[currentEntity removeAllObjects];
|
[currentEntity removeAllObjects];
|
||||||
[currentEntity appendList: sourcelist];
|
[currentEntity addObjectsFromArray: sourcelist];
|
||||||
[currentEntity appendList: sellist];
|
[currentEntity addObjectsFromArray: sellist];
|
||||||
|
|
||||||
[sourcelist free];
|
[sourcelist release];
|
||||||
[sellist free];
|
[sellist release];
|
||||||
[carve_in free];
|
[carve_in release];
|
||||||
[carve_out free];
|
[carve_out release];
|
||||||
|
|
||||||
if (![currentEntity count])
|
if (![currentEntity count])
|
||||||
{
|
{
|
||||||
o = currentEntity;
|
o = currentEntity;
|
||||||
[self removeObject: o];
|
[self removeObject: o];
|
||||||
[o free];
|
[o release];
|
||||||
}
|
}
|
||||||
|
|
||||||
qprintf ("subtracted selection");
|
Sys_Printf ("subtracted selection");
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "PopScrollView.h"
|
||||||
|
|
||||||
@implementation PopScrollView
|
@implementation PopScrollView
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef QuakeEd_h
|
#ifndef QuakeEd_h
|
||||||
#define QuakeEd_h
|
#define QuakeEd_h
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
extern id quakeed_i;
|
extern id quakeed_i;
|
||||||
|
|
||||||
extern BOOL filter_light, filter_path, filter_entities;
|
extern BOOL filter_light, filter_path, filter_entities;
|
||||||
extern BOOL filter_clip_brushes, filter_water_brushes, filter_world;
|
extern BOOL filter_clip_brushes, filter_water_brushes, filter_world;
|
||||||
|
|
||||||
extern UserPath *upath;
|
|
||||||
|
|
||||||
extern id g_cmd_out_i;
|
extern id g_cmd_out_i;
|
||||||
|
|
||||||
double I_FloatTime (void);
|
double I_FloatTime (void);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "QuakeEd.h"
|
||||||
|
|
||||||
id quakeed_i;
|
id quakeed_i;
|
||||||
id entclasses_i;
|
id entclasses_i;
|
||||||
|
@ -29,8 +29,6 @@ void NopSound (void)
|
||||||
NSBeep ();
|
NSBeep ();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserPath *upath;
|
|
||||||
|
|
||||||
|
|
||||||
void My_Malloc_Error (int code)
|
void My_Malloc_Error (int code)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
#ifndef SetBrush_h
|
#ifndef SetBrush_h
|
||||||
#define SetBrush_h
|
#define SetBrush_h
|
||||||
|
|
||||||
#define MAX_FACES 16
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
typedef float vec5_t[5];
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
|
#include "TexturePalette.h"
|
||||||
|
|
||||||
|
#define MAX_FACES 16
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -61,7 +65,7 @@ winding_t *NewWinding (int points);
|
||||||
}
|
}
|
||||||
|
|
||||||
- initOwner: own mins:(float *)mins maxs:(float *)maxs texture:(texturedef_t *)tex;
|
- initOwner: own mins:(float *)mins maxs:(float *)maxs texture:(texturedef_t *)tex;
|
||||||
- initFromTokens: own;
|
- initFromScript: (struct script_s *) script owner: own;
|
||||||
- setMins:(float *)mins maxs:(float *)maxs;
|
- setMins:(float *)mins maxs:(float *)maxs;
|
||||||
|
|
||||||
- parent;
|
- parent;
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
#include "qedefs.h"
|
#include "QF/script.h"
|
||||||
|
#include "QF/sys.h"
|
||||||
|
|
||||||
|
#include "SetBrush.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "EntityClass.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "Preferences.h"
|
||||||
|
|
||||||
@implementation SetBrush
|
@implementation SetBrush
|
||||||
|
|
||||||
|
@ -74,10 +81,10 @@ void CheckFace (face_t *f)
|
||||||
|
|
||||||
w = f->w;
|
w = f->w;
|
||||||
if (!w)
|
if (!w)
|
||||||
Error ("CheckFace: no winding");
|
Sys_Error ("CheckFace: no winding");
|
||||||
|
|
||||||
if (w->numpoints < 3)
|
if (w->numpoints < 3)
|
||||||
Error ("CheckFace: %i points",w->numpoints);
|
Sys_Error ("CheckFace: %i points",w->numpoints);
|
||||||
|
|
||||||
for (i=0 ; i<w->numpoints ; i++)
|
for (i=0 ; i<w->numpoints ; i++)
|
||||||
{
|
{
|
||||||
|
@ -85,21 +92,21 @@ void CheckFace (face_t *f)
|
||||||
|
|
||||||
for (j=0 ; j<3 ; j++)
|
for (j=0 ; j<3 ; j++)
|
||||||
if (p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE)
|
if (p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE)
|
||||||
Error ("CheckFace: BUGUS_RANGE: %f",p1[j]);
|
Sys_Error ("CheckFace: BUGUS_RANGE: %f",p1[j]);
|
||||||
|
|
||||||
j = i+1 == w->numpoints ? 0 : i+1;
|
j = i+1 == w->numpoints ? 0 : i+1;
|
||||||
|
|
||||||
// check the point is on the face plane
|
// check the point is on the face plane
|
||||||
d = DotProduct (p1, f->plane.normal) - f->plane.dist;
|
d = DotProduct (p1, f->plane.normal) - f->plane.dist;
|
||||||
if (d < -ON_EPSILON || d > ON_EPSILON)
|
if (d < -ON_EPSILON || d > ON_EPSILON)
|
||||||
Error ("CheckFace: point off plane");
|
Sys_Error ("CheckFace: point off plane");
|
||||||
|
|
||||||
// check the edge isn't degenerate
|
// check the edge isn't degenerate
|
||||||
p2 = w->points[j];
|
p2 = w->points[j];
|
||||||
VectorSubtract (p2, p1, dir);
|
VectorSubtract (p2, p1, dir);
|
||||||
|
|
||||||
if (VectorLength (dir) < ON_EPSILON)
|
if (VectorLength (dir) < ON_EPSILON)
|
||||||
Error ("CheckFace: degenerate edge");
|
Sys_Error ("CheckFace: degenerate edge");
|
||||||
|
|
||||||
CrossProduct (f->plane.normal, dir, edgenormal);
|
CrossProduct (f->plane.normal, dir, edgenormal);
|
||||||
VectorNormalize (edgenormal);
|
VectorNormalize (edgenormal);
|
||||||
|
@ -113,7 +120,7 @@ void CheckFace (face_t *f)
|
||||||
continue;
|
continue;
|
||||||
d = DotProduct (w->points[j], edgenormal);
|
d = DotProduct (w->points[j], edgenormal);
|
||||||
if (d > edgedist)
|
if (d > edgedist)
|
||||||
Error ("CheckFace: non-convex");
|
Sys_Error ("CheckFace: non-convex");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,12 +143,12 @@ NewWinding
|
||||||
winding_t *NewWinding (int points)
|
winding_t *NewWinding (int points)
|
||||||
{
|
{
|
||||||
winding_t *w;
|
winding_t *w;
|
||||||
int size;
|
size_t size;
|
||||||
|
|
||||||
if (points > MAX_POINTS_ON_WINDING)
|
if (points > MAX_POINTS_ON_WINDING)
|
||||||
Error ("NewWinding: %i points", points);
|
Sys_Error ("NewWinding: %i points", points);
|
||||||
|
|
||||||
size = (int)((winding_t *)0)->points[points];
|
size = (size_t)((winding_t *)0)->points[points];
|
||||||
w = malloc (size);
|
w = malloc (size);
|
||||||
memset (w, 0, size);
|
memset (w, 0, size);
|
||||||
|
|
||||||
|
@ -156,10 +163,10 @@ CopyWinding
|
||||||
*/
|
*/
|
||||||
winding_t *CopyWinding (winding_t *w)
|
winding_t *CopyWinding (winding_t *w)
|
||||||
{
|
{
|
||||||
int size;
|
size_t size;
|
||||||
winding_t *c;
|
winding_t *c;
|
||||||
|
|
||||||
size = (int)((winding_t *)0)->points[w->numpoints];
|
size = (size_t)((winding_t *)0)->points[w->numpoints];
|
||||||
c = malloc (size);
|
c = malloc (size);
|
||||||
memcpy (c, w, size);
|
memcpy (c, w, size);
|
||||||
return c;
|
return c;
|
||||||
|
@ -263,7 +270,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (neww->numpoints > maxpts)
|
if (neww->numpoints > maxpts)
|
||||||
Error ("ClipWinding: points exceeded estimate");
|
Sys_Error ("ClipWinding: points exceeded estimate");
|
||||||
|
|
||||||
// free the original winding
|
// free the original winding
|
||||||
free (in);
|
free (in);
|
||||||
|
@ -306,7 +313,7 @@ winding_t *BasePolyForPlane (face_t *f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (x==-1)
|
if (x==-1)
|
||||||
Error ("BasePolyForPlane: no axis found");
|
Sys_Error ("BasePolyForPlane: no axis found");
|
||||||
|
|
||||||
VectorCopy (vec3_origin, vup);
|
VectorCopy (vec3_origin, vup);
|
||||||
switch (x)
|
switch (x)
|
||||||
|
@ -321,7 +328,7 @@ winding_t *BasePolyForPlane (face_t *f)
|
||||||
}
|
}
|
||||||
|
|
||||||
v = DotProduct (vup, p->normal);
|
v = DotProduct (vup, p->normal);
|
||||||
VectorMA (vup, -v, p->normal, vup);
|
VectorMultAdd (vup, -v, p->normal, vup);
|
||||||
VectorNormalize (vup);
|
VectorNormalize (vup);
|
||||||
|
|
||||||
VectorScale (p->normal, p->dist, org);
|
VectorScale (p->normal, p->dist, org);
|
||||||
|
@ -621,23 +628,10 @@ initOwner:::
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- copyFromZone:(NSZone *)zone
|
- (void)dealloc
|
||||||
{
|
|
||||||
id new;
|
|
||||||
|
|
||||||
[self freeWindings];
|
|
||||||
new = [super copyFromZone: zone];
|
|
||||||
|
|
||||||
[self calcWindings];
|
|
||||||
[new calcWindings];
|
|
||||||
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
- free
|
|
||||||
{
|
{
|
||||||
[self freeWindings];
|
[self freeWindings];
|
||||||
return [super free];
|
return [super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -646,7 +640,7 @@ initOwner: fromTokens
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
int numsb;
|
int numsb;
|
||||||
- initFromTokens: own
|
- initFromScript: (script_t *) script owner: own
|
||||||
{
|
{
|
||||||
face_t *f;
|
face_t *f;
|
||||||
int i,j;
|
int i,j;
|
||||||
|
@ -659,44 +653,44 @@ int numsb;
|
||||||
numfaces = 0;
|
numfaces = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!GetToken (true))
|
if (!Script_GetToken (script, true))
|
||||||
break;
|
break;
|
||||||
if (!strcmp (token, "}") )
|
if (!strcmp (Script_Token (script), "}") )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (i=0 ; i<3 ; i++)
|
for (i=0 ; i<3 ; i++)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
GetToken (true);
|
Script_GetToken (script, true);
|
||||||
if (strcmp (token, "(") )
|
if (strcmp (Script_Token (script), "(") )
|
||||||
Error ("parsing map file");
|
Sys_Error ("parsing map file");
|
||||||
|
|
||||||
for (j=0 ; j<3 ; j++)
|
for (j=0 ; j<3 ; j++)
|
||||||
{
|
{
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
f->planepts[i][j] = atoi(token);
|
f->planepts[i][j] = atoi(Script_Token (script));
|
||||||
}
|
}
|
||||||
|
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
if (strcmp (token, ")") )
|
if (strcmp (Script_Token (script), ")") )
|
||||||
Error ("parsing map file");
|
Sys_Error ("parsing map file");
|
||||||
}
|
}
|
||||||
|
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
strcpy (f->texture.texture, token);
|
strcpy (f->texture.texture, Script_Token (script));
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
f->texture.shift[0] = atof(token);
|
f->texture.shift[0] = atof(Script_Token (script));
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
f->texture.shift[1] = atof(token);
|
f->texture.shift[1] = atof(Script_Token (script));
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
f->texture.rotate = atof(token);
|
f->texture.rotate = atof(Script_Token (script));
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
f->texture.scale[0] = atof(token);
|
f->texture.scale[0] = atof(Script_Token (script));
|
||||||
GetToken (false);
|
Script_GetToken (script, false);
|
||||||
f->texture.scale[1] = atof(token);
|
f->texture.scale[1] = atof(Script_Token (script));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
flags = atoi(token);
|
flags = atoi(Script_Token (script));
|
||||||
|
|
||||||
flags &= 7;
|
flags &= 7;
|
||||||
|
|
||||||
|
@ -827,7 +821,7 @@ setTexturedef
|
||||||
- setTexturedef: (texturedef_t *)tex forFace:(int)f
|
- setTexturedef: (texturedef_t *)tex forFace:(int)f
|
||||||
{
|
{
|
||||||
if ( (unsigned)f > numfaces)
|
if ( (unsigned)f > numfaces)
|
||||||
Error ("setTexturedef:forFace: bad face number %i",f);
|
Sys_Error ("setTexturedef:forFace: bad face number %i",f);
|
||||||
|
|
||||||
faces[f].texture = *tex;
|
faces[f].texture = *tex;
|
||||||
faces[f].qtexture = NULL; // recache next render
|
faces[f].qtexture = NULL; // recache next render
|
||||||
|
@ -1000,7 +994,7 @@ hitByRay
|
||||||
*time = DotProduct (frontpoint, dir);
|
*time = DotProduct (frontpoint, dir);
|
||||||
|
|
||||||
if (*time < 0)
|
if (*time < 0)
|
||||||
Error ("hitByRay: negative t");
|
Sys_Error ("hitByRay: negative t");
|
||||||
|
|
||||||
*face = frontface;
|
*face = frontface;
|
||||||
|
|
||||||
|
@ -1027,9 +1021,9 @@ BOOL fakebrush;
|
||||||
vec3_t forward, right;
|
vec3_t forward, right;
|
||||||
char *targname;
|
char *targname;
|
||||||
vec3_t min, max, temp;
|
vec3_t min, max, temp;
|
||||||
char targ[64];
|
char *targ;
|
||||||
|
|
||||||
strcpy (targ, [parent valueForQKey: "target"]);
|
targ = [parent valueForQKey: "target"];
|
||||||
|
|
||||||
if (!targ || !targ[0])
|
if (!targ || !targ[0])
|
||||||
return self;
|
return self;
|
||||||
|
@ -1040,12 +1034,12 @@ BOOL fakebrush;
|
||||||
c = [map_i count];
|
c = [map_i count];
|
||||||
for (i=0 ; i<c ; i++)
|
for (i=0 ; i<c ; i++)
|
||||||
{
|
{
|
||||||
obj = [map_i objectAt: i];
|
obj = [map_i objectAtIndex: i];
|
||||||
targname = [obj valueForQKey: "targetname"];
|
targname = [obj valueForQKey: "targetname"];
|
||||||
if (strcmp (targ, targname))
|
if (strcmp (targ, targname))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
[[obj objectAt:0] getMins: min maxs: max];
|
[[obj objectAtIndex:0] getMins: min maxs: max];
|
||||||
dest[0] = (min[0] + max[0]) /2;
|
dest[0] = (min[0] + max[0]) /2;
|
||||||
dest[1] = (min[1] + max[1]) /2;
|
dest[1] = (min[1] + max[1]) /2;
|
||||||
|
|
||||||
|
@ -1098,7 +1092,7 @@ BOOL fakebrush;
|
||||||
if (copy)
|
if (copy)
|
||||||
{
|
{
|
||||||
[copy perform:call];
|
[copy perform:call];
|
||||||
[copy free];
|
[copy dealloc];
|
||||||
}
|
}
|
||||||
fakebrush = NO;
|
fakebrush = NO;
|
||||||
return YES;
|
return YES;
|
||||||
|
@ -1125,10 +1119,10 @@ XYDrawSelf
|
||||||
[xyview_i addToScrollRange: bmins[0] : bmins[1]];
|
[xyview_i addToScrollRange: bmins[0] : bmins[1]];
|
||||||
[xyview_i addToScrollRange: bmaxs[0] : bmaxs[1]];
|
[xyview_i addToScrollRange: bmaxs[0] : bmaxs[1]];
|
||||||
|
|
||||||
worldent = [map_i objectAt: 0];
|
worldent = [map_i objectAtIndex: 0];
|
||||||
currentent = [map_i currentEntity];
|
currentent = [map_i currentEntity];
|
||||||
|
|
||||||
if (parent != worldent && self == [parent objectAt: 0])
|
if (parent != worldent && self == [parent objectAtIndex: 0])
|
||||||
keybrush = YES;
|
keybrush = YES;
|
||||||
else
|
else
|
||||||
keybrush = NO;
|
keybrush = NO;
|
||||||
|
@ -1283,7 +1277,7 @@ CameraDrawSelf
|
||||||
if ([self fakeBrush: @selector(CameraDrawSelf)])
|
if ([self fakeBrush: @selector(CameraDrawSelf)])
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
worldent = [map_i objectAt: 0];
|
worldent = [map_i objectAtIndex: 0];
|
||||||
currentent = [map_i currentEntity];
|
currentent = [map_i currentEntity];
|
||||||
|
|
||||||
if (parent != worldent && worldent == currentent)
|
if (parent != worldent && worldent == currentent)
|
||||||
|
@ -1587,7 +1581,7 @@ float *controlpoints[MAX_FACES*3];
|
||||||
|
|
||||||
if (k != 3)
|
if (k != 3)
|
||||||
{
|
{
|
||||||
// Error ("getXYShearPoints: didn't get three points on plane");
|
// Sys_Error ("getXYShearPoints: didn't get three points on plane");
|
||||||
numcontrolpoints = 0;
|
numcontrolpoints = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -1623,7 +1617,7 @@ Set the regioned flag based on if the object is containted in region_min/max
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
// filter away entities
|
// filter away entities
|
||||||
if (parent != [map_i objectAt: 0])
|
if (parent != [map_i objectAtIndex: 0])
|
||||||
{
|
{
|
||||||
if (filter_entities)
|
if (filter_entities)
|
||||||
{
|
{
|
||||||
|
@ -1816,7 +1810,7 @@ vec3_t sb_mins, sb_maxs;
|
||||||
}
|
}
|
||||||
|
|
||||||
[parent removeObject: self];
|
[parent removeObject: self];
|
||||||
[self free];
|
[self dealloc];
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -1940,7 +1934,7 @@ id carve_in, carve_out;
|
||||||
- addFace: (face_t *)f
|
- addFace: (face_t *)f
|
||||||
{
|
{
|
||||||
if (numfaces == MAX_FACES)
|
if (numfaces == MAX_FACES)
|
||||||
Error ("addFace: numfaces == MAX_FACES");
|
Sys_Error ("addFace: numfaces == MAX_FACES");
|
||||||
|
|
||||||
faces[numfaces] = *f;
|
faces[numfaces] = *f;
|
||||||
faces[numfaces].texture = faces[0].texture;
|
faces[numfaces].texture = faces[0].texture;
|
||||||
|
@ -1980,7 +1974,7 @@ id carve_in, carve_out;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if ( (i = NSMallocCheck()) )
|
if ( (i = NSMallocCheck()) )
|
||||||
Error ("MallocCheck failure");
|
Sys_Error ("MallocCheck failure");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check bboxes
|
// check bboxes
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef TexturePalette_h
|
#ifndef TexturePalette_h
|
||||||
#define TexturePalette_h
|
#define TexturePalette_h
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
#include "QF/qtypes.h"
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
byte chan[4];
|
byte chan[4];
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
#include "QF/qendian.h"
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "TexturePalette.h"
|
||||||
|
|
||||||
id texturepalette_i;
|
id texturepalette_i;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ unsigned badtex_d[] =
|
||||||
0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
|
0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
|
||||||
};
|
};
|
||||||
|
|
||||||
qtexture_t badtex = {"notexture",16,16,NULL, badtex_d, {0,0,255,255}};
|
qtexture_t badtex = {"notexture",16,16,NULL, badtex_d, {{0,0,255,255}}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
#include "Entity.h"
|
||||||
|
|
||||||
extern id things_i;
|
extern id things_i;
|
||||||
|
|
||||||
#define ENTITYNAMEKEY "spawn"
|
#define ENTITYNAMEKEY "spawn"
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "Things.h"
|
||||||
|
#include "QuakeEd.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "EntityClass.h"
|
||||||
|
#include "KeypairView.h"
|
||||||
|
#include "Project.h"
|
||||||
|
|
||||||
id things_i;
|
id things_i;
|
||||||
|
|
||||||
|
@ -21,7 +26,7 @@ id things_i;
|
||||||
- loadEntityComment:(id)obj
|
- loadEntityComment:(id)obj
|
||||||
{
|
{
|
||||||
[entity_comment_i selectAll:self];
|
[entity_comment_i selectAll:self];
|
||||||
[entity_comment_i replaceSel:[obj comments]];
|
[entity_comment_i replaceCharactersInRange:[entity_comment_i selectedRange] withString:[NSString stringWithCString:[obj comments]]];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -33,13 +38,13 @@ id things_i;
|
||||||
|
|
||||||
path = [project_i getProgDirectory];
|
path = [project_i getProgDirectory];
|
||||||
|
|
||||||
[prog_path_i setStringValue: path];
|
[prog_path_i setStringValue: [NSString stringWithCString:path]];
|
||||||
|
|
||||||
[[EntityClassList alloc] initForSourceDirectory: path];
|
[[EntityClassList alloc] initForSourceDirectory: path];
|
||||||
|
|
||||||
[self loadEntityComment:[entity_classes_i objectAt:lastSelected]];
|
[self loadEntityComment:[entity_classes_i objectAtIndex:lastSelected]];
|
||||||
[entity_browser_i loadColumnZero];
|
[entity_browser_i loadColumnZero];
|
||||||
[[entity_browser_i matrixInColumn:0] selectCellAt:lastSelected :0];
|
[[entity_browser_i matrixInColumn:0] selectCellAtRow:lastSelected column:0];
|
||||||
|
|
||||||
[entity_browser_i setDoubleAction: @selector(doubleClickEntity:)];
|
[entity_browser_i setDoubleAction: @selector(doubleClickEntity:)];
|
||||||
|
|
||||||
|
@ -52,7 +57,7 @@ id things_i;
|
||||||
|
|
||||||
matr = [sender matrixInColumn: 0];
|
matr = [sender matrixInColumn: 0];
|
||||||
lastSelected = [matr selectedRow];
|
lastSelected = [matr selectedRow];
|
||||||
[self loadEntityComment:[entity_classes_i objectAt:lastSelected]];
|
[self loadEntityComment:[entity_classes_i objectAtIndex:lastSelected]];
|
||||||
[quakeed_i makeFirstResponder: quakeed_i];
|
[quakeed_i makeFirstResponder: quakeed_i];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -67,7 +72,7 @@ id things_i;
|
||||||
|
|
||||||
- (char *)spawnName
|
- (char *)spawnName
|
||||||
{
|
{
|
||||||
return [[entity_classes_i objectAt:lastSelected] classname];
|
return [[entity_classes_i objectAtIndex:lastSelected] classname];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,22 +88,22 @@ id things_i;
|
||||||
if (!path || !path[0])
|
if (!path || !path[0])
|
||||||
{
|
{
|
||||||
path = [project_i getProgDirectory];
|
path = [project_i getProgDirectory];
|
||||||
[prog_path_i setStringValue: path];
|
[prog_path_i setStringValue: [NSString stringWithCString:path]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free all entity info in memory...
|
// Free all entity info in memory...
|
||||||
[entity_classes_i freeObjects];
|
[entity_classes_i removeAllObjects];
|
||||||
[entity_classes_i free];
|
[entity_classes_i release];
|
||||||
|
|
||||||
// Now, RELOAD!
|
// Now, RELOAD!
|
||||||
[[EntityClassList alloc] initForSourceDirectory: path];
|
[[EntityClassList alloc] initForSourceDirectory: path];
|
||||||
|
|
||||||
lastSelected = 0;
|
lastSelected = 0;
|
||||||
ent = [entity_classes_i objectAt:lastSelected];
|
ent = [entity_classes_i objectAtIndex:lastSelected];
|
||||||
[self loadEntityComment:[entity_classes_i objectAt:lastSelected]];
|
[self loadEntityComment:[entity_classes_i objectAtIndex:lastSelected]];
|
||||||
|
|
||||||
[entity_browser_i loadColumnZero];
|
[entity_browser_i loadColumnZero];
|
||||||
[[entity_browser_i matrixInColumn:0] selectCellAt:lastSelected :0];
|
[[entity_browser_i matrixInColumn:0] selectCellAtRow:lastSelected column:0];
|
||||||
|
|
||||||
[self newCurrentEntity]; // in case flags changed
|
[self newCurrentEntity]; // in case flags changed
|
||||||
|
|
||||||
|
@ -113,14 +118,14 @@ id things_i;
|
||||||
classent = [entity_classes_i classForName:class];
|
classent = [entity_classes_i classForName:class];
|
||||||
if (!classent)
|
if (!classent)
|
||||||
return self;
|
return self;
|
||||||
lastSelected = [entity_classes_i indexOf: classent];
|
lastSelected = [entity_classes_i indexOfObject: classent];
|
||||||
|
|
||||||
if (lastSelected < 0)
|
if (lastSelected < 0)
|
||||||
lastSelected = 0;
|
lastSelected = 0;
|
||||||
|
|
||||||
[self loadEntityComment:classent];
|
[self loadEntityComment:classent];
|
||||||
[[entity_browser_i matrixInColumn:0] selectCellAt:lastSelected :0];
|
[[entity_browser_i matrixInColumn:0] selectCellAtRow:lastSelected column:0];
|
||||||
[[entity_browser_i matrixInColumn:0] scrollCellToVisible:lastSelected :0];
|
[[entity_browser_i matrixInColumn:0] scrollCellToVisibleAtRow:lastSelected column:0];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +141,7 @@ id things_i;
|
||||||
|
|
||||||
ent = [map_i currentEntity];
|
ent = [map_i currentEntity];
|
||||||
classname = [ent valueForQKey: "classname"];
|
classname = [ent valueForQKey: "classname"];
|
||||||
if (ent != [map_i objectAt: 0])
|
if (ent != [map_i objectAtIndex: 0])
|
||||||
[self selectClass: classname]; // don't reset for world
|
[self selectClass: classname]; // don't reset for world
|
||||||
classent = [entity_classes_i classForName:classname];
|
classent = [entity_classes_i classForName:classname];
|
||||||
flagname = [ent valueForQKey: "spawnflags"];
|
flagname = [ent valueForQKey: "spawnflags"];
|
||||||
|
@ -149,11 +154,11 @@ id things_i;
|
||||||
for (r=0 ; r<4 ; r++)
|
for (r=0 ; r<4 ; r++)
|
||||||
for (c=0 ; c<3 ; c++)
|
for (c=0 ; c<3 ; c++)
|
||||||
{
|
{
|
||||||
cell = [flags_i cellAt: r : c];
|
cell = [flags_i cellAtRow: r column: c];
|
||||||
if (c < 2)
|
if (c < 2)
|
||||||
{
|
{
|
||||||
flagname = [classent flagName: c*4 + r];
|
flagname = [classent flagName: c*4 + r];
|
||||||
[cell setTitle: flagname];
|
[cell setTitle: [NSString stringWithCString:flagname]];
|
||||||
}
|
}
|
||||||
[cell setIntValue: (flags & (1<< ((c*4)+r)) ) > 0];
|
[cell setIntValue: (flags & (1<< ((c*4)+r)) ) > 0];
|
||||||
}
|
}
|
||||||
|
@ -175,8 +180,8 @@ id things_i;
|
||||||
//
|
//
|
||||||
- setSelectedKey:(epair_t *)ep;
|
- setSelectedKey:(epair_t *)ep;
|
||||||
{
|
{
|
||||||
[keyInput_i setStringValue:ep->key];
|
[keyInput_i setStringValue:[NSString stringWithCString:ep->key]];
|
||||||
[valueInput_i setStringValue:ep->value];
|
[valueInput_i setStringValue:[NSString stringWithCString:ep->value]];
|
||||||
[valueInput_i selectText:self];
|
[valueInput_i selectText:self];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +242,7 @@ id things_i;
|
||||||
const char *title;
|
const char *title;
|
||||||
char value[10];
|
char value[10];
|
||||||
|
|
||||||
title = [[sender selectedCell] title];
|
title = [[[sender selectedCell] title] cString];
|
||||||
if (!strcmp(title,"Up"))
|
if (!strcmp(title,"Up"))
|
||||||
strcpy (value, "-1");
|
strcpy (value, "-1");
|
||||||
else if (!strcmp(title,"Dn"))
|
else if (!strcmp(title,"Dn"))
|
||||||
|
@ -245,8 +250,8 @@ id things_i;
|
||||||
else
|
else
|
||||||
strcpy (value, title);
|
strcpy (value, title);
|
||||||
|
|
||||||
[keyInput_i setStringValue:"angle"];
|
[keyInput_i setStringValue:@"angle"];
|
||||||
[valueInput_i setStringValue:value];
|
[valueInput_i setStringValue:[NSString stringWithCString:value]];
|
||||||
[self addPair:NULL];
|
[self addPair:NULL];
|
||||||
|
|
||||||
[self clearInputs];
|
[self clearInputs];
|
||||||
|
@ -269,7 +274,7 @@ id things_i;
|
||||||
for (r=0 ; r<4 ; r++)
|
for (r=0 ; r<4 ; r++)
|
||||||
for (c=0 ; c<3 ; c++)
|
for (c=0 ; c<3 ; c++)
|
||||||
{
|
{
|
||||||
cell = [flags_i cellAt: r : c];
|
cell = [flags_i cellAtRow: r column: c];
|
||||||
i = ([cell intValue] > 0);
|
i = ([cell intValue] > 0);
|
||||||
flags |= (i<< ((c*4)+r));
|
flags |= (i<< ((c*4)+r));
|
||||||
}
|
}
|
||||||
|
@ -304,10 +309,10 @@ id things_i;
|
||||||
i = 0;
|
i = 0;
|
||||||
while(max--)
|
while(max--)
|
||||||
{
|
{
|
||||||
object = [entity_classes_i objectAt:i];
|
object = [entity_classes_i objectAtIndex:i];
|
||||||
[matrix addRow];
|
[matrix addRow];
|
||||||
cell = [matrix cellAt:i++ :0];
|
cell = [matrix cellAtRow:i++ column:0];
|
||||||
[cell setStringValue:[object classname]];
|
[cell setStringValue:[NSString stringWithCString:[object classname]]];
|
||||||
[cell setLeaf:YES];
|
[cell setLeaf:YES];
|
||||||
[cell setLoaded:YES];
|
[cell setLoaded:YES];
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "UserPath.h"
|
#include "UserPath.h"
|
||||||
#include <mach/mach_init.h>
|
//#include <mach/mach_init.h>
|
||||||
#include <appkit/graphics.h>
|
//#include <appkit/graphics.h>
|
||||||
#include <appkit/errors.h>
|
//#include <appkit/errors.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
|
||||||
|
@ -137,16 +137,16 @@ int sendUserPath(UserPath *up)
|
||||||
|
|
||||||
exception.code = 0;
|
exception.code = 0;
|
||||||
if (up->opForUserPath != 0) {
|
if (up->opForUserPath != 0) {
|
||||||
NS_DURING
|
//NS_DURING
|
||||||
DPSDoUserPath(up->points, up->numberOfPoints, dps_float, up->ops,
|
DPSDoUserPath(up->points, up->numberOfPoints, dps_float, up->ops,
|
||||||
up->numberOfOps, up->bbox, up->opForUserPath);
|
up->numberOfOps, up->bbox, up->opForUserPath);
|
||||||
if (up->ping) {
|
if (up->ping) {
|
||||||
NSPing();
|
NSPing();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_HANDLER
|
//NS_HANDLER
|
||||||
exception = NSLocalHandler;
|
// exception = NSLocalHandler;
|
||||||
NS_ENDHANDLER
|
//NS_ENDHANDLER
|
||||||
if (exception.code) {
|
if (exception.code) {
|
||||||
NSReportError(&exception);
|
NSReportError(&exception);
|
||||||
if (exception.code == dps_err_ps) {
|
if (exception.code == dps_err_ps) {
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
#define XYView_h
|
#define XYView_h
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
#include "mathlib.h"
|
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
#include "SetBrush.h"
|
#include "SetBrush.h"
|
||||||
|
|
||||||
|
#include "render.h"
|
||||||
|
|
||||||
extern id xyview_i;
|
extern id xyview_i;
|
||||||
|
|
||||||
#define MINSCALE 0.125
|
#define MINSCALE 0.125
|
||||||
|
@ -23,7 +27,6 @@ void linecolor (float r, float g, float b);
|
||||||
void XYmoveto (vec3_t pt);
|
void XYmoveto (vec3_t pt);
|
||||||
void XYlineto (vec3_t pt);
|
void XYlineto (vec3_t pt);
|
||||||
|
|
||||||
typedef enum {dr_wire, dr_flat, dr_texture} drawmode_t;
|
|
||||||
|
|
||||||
|
|
||||||
@interface XYView : NSView
|
@interface XYView : NSView
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
#include "qedefs.h"
|
#include "XYView.h"
|
||||||
|
#include "ZView.h"
|
||||||
|
#include "CameraView.h"
|
||||||
|
#include "Clipper.h"
|
||||||
|
#include "QuakeEd.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "PopScrollView.h"
|
||||||
|
|
||||||
id xyview_i;
|
id xyview_i;
|
||||||
|
|
||||||
id scalemenu_i, gridmenu_i, scrollview_i, gridbutton_i, scalebutton_i;
|
id scrollview_i, gridbutton_i, scalebutton_i;
|
||||||
|
|
||||||
vec3_t xy_viewnormal; // v_forward for xy view
|
vec3_t xy_viewnormal; // v_forward for xy view
|
||||||
float xy_viewdist; // clip behind this plane
|
float xy_viewdist; // clip behind this plane
|
||||||
|
@ -14,12 +21,12 @@ float xy_viewdist; // clip behind this plane
|
||||||
initWithFrame:
|
initWithFrame:
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
- initWithFrame:(const NSRect *)frameRect
|
- initWithFrame:(NSRect)frameRect
|
||||||
{
|
{
|
||||||
[super initWithFrame:frameRect];
|
[super initWithFrame:frameRect];
|
||||||
[self allocateGState];
|
[self allocateGState];
|
||||||
|
|
||||||
NSSetRect (&realbounds, 0,0,0,0);
|
realbounds = NSMakeRect (0,0,0,0);
|
||||||
|
|
||||||
gridsize = 16;
|
gridsize = 16;
|
||||||
scale = 1.0;
|
scale = 1.0;
|
||||||
|
@ -31,37 +38,32 @@ initWithFrame:
|
||||||
//
|
//
|
||||||
// initialize the pop up menus
|
// initialize the pop up menus
|
||||||
//
|
//
|
||||||
scalemenu_i = [[PopUpList alloc] init];
|
scalebutton_i = [[NSPopUpButton alloc] init];
|
||||||
[scalemenu_i setTarget: self];
|
[scalebutton_i setTarget: self];
|
||||||
[scalemenu_i setAction: @selector(scaleMenuTarget:)];
|
[scalebutton_i setAction: @selector(scaleMenuTarget:)];
|
||||||
|
[scalebutton_i addItemWithTitle: @"12.5%"];
|
||||||
[scalemenu_i addItem: "12.5%"];
|
[scalebutton_i addItemWithTitle: @"25%"];
|
||||||
[scalemenu_i addItem: "25%"];
|
[scalebutton_i addItemWithTitle: @"50%"];
|
||||||
[scalemenu_i addItem: "50%"];
|
[scalebutton_i addItemWithTitle: @"75%"];
|
||||||
[scalemenu_i addItem: "75%"];
|
[scalebutton_i addItemWithTitle: @"100%"];
|
||||||
[scalemenu_i addItem: "100%"];
|
[scalebutton_i addItemWithTitle: @"200%"];
|
||||||
[scalemenu_i addItem: "200%"];
|
[scalebutton_i addItemWithTitle: @"300%"];
|
||||||
[scalemenu_i addItem: "300%"];
|
[scalebutton_i selectItemAtIndex: 4];
|
||||||
[[scalemenu_i itemList] selectCellAt: 4 : 0];
|
|
||||||
|
|
||||||
scalebutton_i = NSCreatePopUpListButton(scalemenu_i);
|
|
||||||
|
|
||||||
|
|
||||||
gridmenu_i = [[PopUpList alloc] init];
|
gridbutton_i = [[NSPopUpButton alloc] init];
|
||||||
[gridmenu_i setTarget: self];
|
[gridbutton_i setTarget: self];
|
||||||
[gridmenu_i setAction: @selector(gridMenuTarget:)];
|
[gridbutton_i setAction: @selector(gridMenuTarget:)];
|
||||||
|
|
||||||
[gridmenu_i addItem: "grid 1"];
|
[gridbutton_i addItemWithTitle: @"grid 1"];
|
||||||
[gridmenu_i addItem: "grid 2"];
|
[gridbutton_i addItemWithTitle: @"grid 2"];
|
||||||
[gridmenu_i addItem: "grid 4"];
|
[gridbutton_i addItemWithTitle: @"grid 4"];
|
||||||
[gridmenu_i addItem: "grid 8"];
|
[gridbutton_i addItemWithTitle: @"grid 8"];
|
||||||
[gridmenu_i addItem: "grid 16"];
|
[gridbutton_i addItemWithTitle: @"grid 16"];
|
||||||
[gridmenu_i addItem: "grid 32"];
|
[gridbutton_i addItemWithTitle: @"grid 32"];
|
||||||
[gridmenu_i addItem: "grid 64"];
|
[gridbutton_i addItemWithTitle: @"grid 64"];
|
||||||
|
|
||||||
[[gridmenu_i itemList] selectCellAt: 4 : 0];
|
[gridbutton_i selectItemAtIndex: 4];
|
||||||
|
|
||||||
gridbutton_i = NSCreatePopUpListButton(gridmenu_i);
|
|
||||||
|
|
||||||
// initialize the scroll view
|
// initialize the scroll view
|
||||||
scrollview_i = [[PopScrollView alloc]
|
scrollview_i = [[PopScrollView alloc]
|
||||||
|
@ -70,11 +72,11 @@ initWithFrame:
|
||||||
button2: gridbutton_i
|
button2: gridbutton_i
|
||||||
];
|
];
|
||||||
[scrollview_i setLineScroll: 64];
|
[scrollview_i setLineScroll: 64];
|
||||||
[scrollview_i setAutosizing: NS_WIDTHSIZABLE | NS_HEIGHTSIZABLE];
|
[scrollview_i setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||||
|
|
||||||
// link objects together
|
// link objects together
|
||||||
[[scrollview_i setDocView: self] free];
|
[scrollview_i setDocumentView: self];
|
||||||
|
RELEASE (scrollview_i);
|
||||||
return scrollview_i;
|
return scrollview_i;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,7 +97,7 @@ initWithFrame:
|
||||||
|
|
||||||
- drawMode: sender
|
- drawMode: sender
|
||||||
{
|
{
|
||||||
drawmode = [sender selectedCol];
|
drawmode = [sender selectedColumn];
|
||||||
[quakeed_i updateXY];
|
[quakeed_i updateXY];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +105,7 @@ initWithFrame:
|
||||||
- setDrawMode: (drawmode_t)mode
|
- setDrawMode: (drawmode_t)mode
|
||||||
{
|
{
|
||||||
drawmode = mode;
|
drawmode = mode;
|
||||||
[mode_radio_i selectCellAt:0: mode];
|
[mode_radio_i selectCellAtRow:0 column: mode];
|
||||||
[quakeed_i updateXY];
|
[quakeed_i updateXY];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -115,9 +117,7 @@ initWithFrame:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===================
|
v
|
||||||
setOrigin:scale:
|
|
||||||
===================
|
|
||||||
*/
|
*/
|
||||||
- setOrigin: (NSPoint *)pt scale: (float)sc
|
- setOrigin: (NSPoint *)pt scale: (float)sc
|
||||||
{
|
{
|
||||||
|
@ -129,38 +129,38 @@ setOrigin:scale:
|
||||||
//
|
//
|
||||||
scale = sc;
|
scale = sc;
|
||||||
|
|
||||||
[superview getFrame: &sframe];
|
sframe = [[self superview] frame];
|
||||||
[superview getFrame: &newbounds];
|
newbounds = [[self superview] frame];
|
||||||
newbounds.origin = *pt;
|
newbounds.origin = *pt;
|
||||||
newbounds.size.width /= scale;
|
newbounds.size.width /= scale;
|
||||||
newbounds.size.height /= scale;
|
newbounds.size.height /= scale;
|
||||||
|
sframe.size.width /= scale;
|
||||||
|
sframe.size.height /= scale;
|
||||||
|
|
||||||
//
|
//
|
||||||
// union with the realbounds
|
// union with the realbounds
|
||||||
//
|
//
|
||||||
NSUnionRect (&realbounds, &newbounds);
|
newbounds = NSUnionRect (realbounds, newbounds);
|
||||||
|
|
||||||
//
|
//
|
||||||
// redisplay everything
|
// redisplay everything
|
||||||
//
|
//
|
||||||
[quakeed_i disableDisplay];
|
//XXX[quakeed_i disableDisplay];
|
||||||
|
|
||||||
//
|
//
|
||||||
// size this view
|
// size this view
|
||||||
//
|
//
|
||||||
[self sizeTo: newbounds.size.width : newbounds.size.height];
|
[self setBoundsSize: newbounds.size];
|
||||||
[self setDrawOrigin: newbounds.origin.x : newbounds.origin.y];
|
[self setBoundsOrigin: newbounds.origin];
|
||||||
[self moveTo: newbounds.origin.x : newbounds.origin.y];
|
//XXX[self moveTo: newbounds.origin.x : newbounds.origin.y];
|
||||||
|
|
||||||
//
|
//
|
||||||
// scroll and scale the clip view
|
// scroll and scale the clip view
|
||||||
//
|
//
|
||||||
[superview setDrawSize
|
[[self superview] setBoundsSize: sframe.size];
|
||||||
: sframe.size.width/scale
|
[[self superview] setBoundsOrigin: *pt];
|
||||||
: sframe.size.height/scale];
|
|
||||||
[superview setDrawOrigin: pt->x : pt->y];
|
|
||||||
|
|
||||||
[quakeed_i reenableDisplay];
|
//XXX[quakeed_i reenableDisplay];
|
||||||
[scrollview_i display];
|
[scrollview_i display];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -171,7 +171,7 @@ setOrigin:scale:
|
||||||
NSRect sbounds;
|
NSRect sbounds;
|
||||||
NSPoint mid, delta;
|
NSPoint mid, delta;
|
||||||
|
|
||||||
[[xyview_i superview] getBounds: &sbounds];
|
sbounds = [[xyview_i superview] bounds];
|
||||||
|
|
||||||
mid.x = sbounds.origin.x + sbounds.size.width/2;
|
mid.x = sbounds.origin.x + sbounds.size.width/2;
|
||||||
mid.y = sbounds.origin.y + sbounds.size.height/2;
|
mid.y = sbounds.origin.y + sbounds.size.height/2;
|
||||||
|
@ -197,7 +197,7 @@ When superview is resized
|
||||||
{
|
{
|
||||||
NSRect r;
|
NSRect r;
|
||||||
|
|
||||||
[superview getBounds: &r];
|
r = [[self superview] bounds];
|
||||||
[self newRealBounds: &r];
|
[self newRealBounds: &r];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -221,25 +221,25 @@ If realbounds has shrunk, nothing will change.
|
||||||
//
|
//
|
||||||
// calculate the area visible in the cliprect
|
// calculate the area visible in the cliprect
|
||||||
//
|
//
|
||||||
[superview getBounds: &sbounds];
|
sbounds = [[self superview] bounds];
|
||||||
NSUnionRect (nb, &sbounds);
|
sbounds = NSUnionRect (*nb, sbounds);
|
||||||
|
|
||||||
//
|
//
|
||||||
// size this view
|
// size this view
|
||||||
//
|
//
|
||||||
[quakeed_i disableDisplay];
|
//XXX[quakeed_i disableDisplay];
|
||||||
|
|
||||||
[self suspendNotifyAncestorWhenFrameChanged:YES];
|
[self setPostsBoundsChangedNotifications:NO];
|
||||||
[self sizeTo: sbounds.size.width : sbounds.size.height];
|
[self setBoundsSize: sbounds.size];
|
||||||
[self setDrawOrigin: sbounds.origin.x : sbounds.origin.y];
|
[self setBoundsOrigin: sbounds.origin];
|
||||||
[self moveTo: sbounds.origin.x : sbounds.origin.y];
|
//XXX[self moveTo: sbounds.origin.x : sbounds.origin.y];
|
||||||
[self suspendNotifyAncestorWhenFrameChanged:NO];
|
[self setPostsBoundsChangedNotifications:YES];
|
||||||
|
|
||||||
[scrollview_i reflectScroll: superview];
|
[scrollview_i reflectScrolledClipView: [scrollview_i contentView]];
|
||||||
[quakeed_i reenableDisplay];
|
//XXX[quakeed_i reenableDisplay];
|
||||||
|
|
||||||
[[scrollview_i horizScroller] display];
|
[[scrollview_i horizontalScroller] display];
|
||||||
[[scrollview_i vertScroller] display];
|
[[scrollview_i verticalScroller] display];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ Called when the scaler popup on the window is used
|
||||||
NSRect visrect, sframe;
|
NSRect visrect, sframe;
|
||||||
float nscale;
|
float nscale;
|
||||||
|
|
||||||
item = [[sender selectedCell] title];
|
item = [[[sender selectedCell] title] cString];
|
||||||
sscanf (item,"%f",&nscale);
|
sscanf (item,"%f",&nscale);
|
||||||
nscale /= 100;
|
nscale /= 100;
|
||||||
|
|
||||||
|
@ -267,8 +267,8 @@ Called when the scaler popup on the window is used
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// keep the center of the view constant
|
// keep the center of the view constant
|
||||||
[superview getBounds: &visrect];
|
visrect = [[self superview] bounds];
|
||||||
[superview getFrame: &sframe];
|
sframe = [[self superview] frame];
|
||||||
visrect.origin.x += visrect.size.width/2;
|
visrect.origin.x += visrect.size.width/2;
|
||||||
visrect.origin.y += visrect.size.height/2;
|
visrect.origin.y += visrect.size.height/2;
|
||||||
|
|
||||||
|
@ -287,8 +287,8 @@ zoomIn
|
||||||
*/
|
*/
|
||||||
- zoomIn: (NSPoint *)constant
|
- zoomIn: (NSPoint *)constant
|
||||||
{
|
{
|
||||||
id itemlist;
|
id itemlist, selectedItem;
|
||||||
int selected, numrows, numcollumns;
|
int selected, numrows;
|
||||||
|
|
||||||
NSRect visrect;
|
NSRect visrect;
|
||||||
NSPoint ofs, new;
|
NSPoint ofs, new;
|
||||||
|
@ -296,20 +296,20 @@ zoomIn
|
||||||
//
|
//
|
||||||
// set the popup
|
// set the popup
|
||||||
//
|
//
|
||||||
itemlist = [scalemenu_i itemList];
|
itemlist = [scalebutton_i itemArray];
|
||||||
[itemlist getNumRows: &numrows numCols:&numcollumns];
|
numrows = [itemlist count];
|
||||||
|
|
||||||
selected = [itemlist selectedRow] + 1;
|
selectedItem = [scalebutton_i selectedItem];
|
||||||
|
selected = [itemlist indexOfObject: selectedItem] + 1;
|
||||||
if (selected >= numrows)
|
if (selected >= numrows)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
[itemlist selectCellAt: selected : 0];
|
[scalebutton_i selectItemAtIndex: selected];
|
||||||
[scalebutton_i setTitle: [[itemlist selectedCell] title]];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// zoom the view
|
// zoom the view
|
||||||
//
|
//
|
||||||
[superview getBounds: &visrect];
|
visrect = [[self superview] bounds];
|
||||||
ofs.x = constant->x - visrect.origin.x;
|
ofs.x = constant->x - visrect.origin.x;
|
||||||
ofs.y = constant->y - visrect.origin.y;
|
ofs.y = constant->y - visrect.origin.y;
|
||||||
|
|
||||||
|
@ -329,8 +329,8 @@ zoomOut
|
||||||
*/
|
*/
|
||||||
- zoomOut: (NSPoint *)constant
|
- zoomOut: (NSPoint *)constant
|
||||||
{
|
{
|
||||||
id itemlist;
|
id itemlist, selectedItem;
|
||||||
int selected, numrows, numcollumns;
|
int selected;
|
||||||
|
|
||||||
NSRect visrect;
|
NSRect visrect;
|
||||||
NSPoint ofs, new;
|
NSPoint ofs, new;
|
||||||
|
@ -338,20 +338,19 @@ zoomOut
|
||||||
//
|
//
|
||||||
// set the popup
|
// set the popup
|
||||||
//
|
//
|
||||||
itemlist = [scalemenu_i itemList];
|
itemlist = [scalebutton_i itemArray];
|
||||||
[itemlist getNumRows: &numrows numCols:&numcollumns];
|
|
||||||
|
|
||||||
selected = [itemlist selectedRow] - 1;
|
selectedItem = [scalebutton_i selectedItem];
|
||||||
|
selected = [itemlist indexOfObject: selectedItem] - 1;
|
||||||
if (selected < 0)
|
if (selected < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
[itemlist selectCellAt: selected : 0];
|
[scalebutton_i selectItemAtIndex: selected];
|
||||||
[scalebutton_i setTitle: [[itemlist selectedCell] title]];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// zoom the view
|
// zoom the view
|
||||||
//
|
//
|
||||||
[superview getBounds: &visrect];
|
visrect = [[self superview] bounds];
|
||||||
ofs.x = constant->x - visrect.origin.x;
|
ofs.x = constant->x - visrect.origin.x;
|
||||||
ofs.y = constant->y - visrect.origin.y;
|
ofs.y = constant->y - visrect.origin.y;
|
||||||
|
|
||||||
|
@ -377,7 +376,7 @@ Called when the scaler popup on the window is used
|
||||||
char const *item;
|
char const *item;
|
||||||
int grid;
|
int grid;
|
||||||
|
|
||||||
item = [[sender selectedCell] title];
|
item = [[[sender selectedCell] title] cString];
|
||||||
sscanf (item,"grid %d",&grid);
|
sscanf (item,"grid %d",&grid);
|
||||||
|
|
||||||
if (grid == gridsize)
|
if (grid == gridsize)
|
||||||
|
@ -461,23 +460,22 @@ superviewChanged
|
||||||
*/
|
*/
|
||||||
|
|
||||||
vec3_t cur_linecolor;
|
vec3_t cur_linecolor;
|
||||||
|
NSBezierPath *path;
|
||||||
|
|
||||||
void linestart (float r, float g, float b)
|
void linestart (float r, float g, float b)
|
||||||
{
|
{
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
cur_linecolor[0] = r;
|
VectorSet (r, g, b, cur_linecolor);
|
||||||
cur_linecolor[1] = g;
|
|
||||||
cur_linecolor[2] = b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lineflush (void)
|
void lineflush (void)
|
||||||
{
|
{
|
||||||
if (!upath->numberOfPoints)
|
if ([path isEmpty])
|
||||||
return;
|
return;
|
||||||
endUserPath (upath, dps_ustroke);
|
//endUserPath (upath, dps_ustroke);
|
||||||
PSsetrgbcolor (cur_linecolor[0], cur_linecolor[1], cur_linecolor[2]);
|
PSsetrgbcolor (cur_linecolor[0], cur_linecolor[1], cur_linecolor[2]);
|
||||||
sendUserPath (upath);
|
[path stroke];
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
}
|
}
|
||||||
|
|
||||||
void linecolor (float r, float g, float b)
|
void linecolor (float r, float g, float b)
|
||||||
|
@ -485,21 +483,21 @@ void linecolor (float r, float g, float b)
|
||||||
if (cur_linecolor[0] == r && cur_linecolor[1] == g && cur_linecolor[2] == b)
|
if (cur_linecolor[0] == r && cur_linecolor[1] == g && cur_linecolor[2] == b)
|
||||||
return; // do nothing
|
return; // do nothing
|
||||||
lineflush ();
|
lineflush ();
|
||||||
cur_linecolor[0] = r;
|
VectorSet (r, g, b, cur_linecolor);
|
||||||
cur_linecolor[1] = g;
|
|
||||||
cur_linecolor[2] = b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XYmoveto (vec3_t pt)
|
void XYmoveto (vec3_t pt)
|
||||||
{
|
{
|
||||||
if (upath->numberOfPoints > 2048)
|
NSPoint point = {pt[0], pt[1]};
|
||||||
|
if ([path elementCount] > 2048)
|
||||||
lineflush ();
|
lineflush ();
|
||||||
UPmoveto (upath, pt[0], pt[1]);
|
[path moveToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
void XYlineto (vec3_t pt)
|
void XYlineto (vec3_t pt)
|
||||||
{
|
{
|
||||||
UPlineto (upath, pt[0], pt[1]);
|
NSPoint point = {pt[0], pt[1]};
|
||||||
|
[path lineToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -513,19 +511,20 @@ Rect is in global world (unscaled) coordinates
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
- drawGrid: (const NSRect *)rect
|
- drawGrid: (NSRect)rect
|
||||||
{
|
{
|
||||||
int x,y, stopx, stopy;
|
int x,y, stopx, stopy;
|
||||||
float top,bottom,right,left;
|
float top,bottom,right,left;
|
||||||
char text[10];
|
char text[10];
|
||||||
BOOL showcoords;
|
BOOL showcoords;
|
||||||
|
NSPoint point;
|
||||||
|
|
||||||
showcoords = [quakeed_i showCoordinates];
|
showcoords = [quakeed_i showCoordinates];
|
||||||
|
|
||||||
left = rect->origin.x-1;
|
left = rect.origin.x-1;
|
||||||
bottom = rect->origin.y-1;
|
bottom = rect.origin.y-1;
|
||||||
right = rect->origin.x+rect->size.width+2;
|
right = rect.origin.x+rect.size.width+2;
|
||||||
top = rect->origin.y+rect->size.height+2;
|
top = rect.origin.y+rect.size.height+2;
|
||||||
|
|
||||||
PSsetlinewidth (0.15);
|
PSsetlinewidth (0.15);
|
||||||
|
|
||||||
|
@ -555,24 +554,30 @@ Rect is in global world (unscaled) coordinates
|
||||||
if (stopy >= top)
|
if (stopy >= top)
|
||||||
stopy -= gridsize;
|
stopy -= gridsize;
|
||||||
|
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
|
|
||||||
for ( ; y<=stopy ; y+= gridsize)
|
for ( ; y<=stopy ; y+= gridsize)
|
||||||
if (y&63)
|
if (y&63)
|
||||||
{
|
{
|
||||||
UPmoveto (upath, left, y);
|
point.x = left;
|
||||||
UPlineto (upath, right, y);
|
point.y = y;
|
||||||
|
[path moveToPoint: point];
|
||||||
|
point.x = right;
|
||||||
|
[path lineToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; x<=stopx ; x+= gridsize)
|
for ( ; x<=stopx ; x+= gridsize)
|
||||||
if (x&63)
|
if (x&63)
|
||||||
{
|
{
|
||||||
UPmoveto (upath, x, top);
|
point.x = x;
|
||||||
UPlineto (upath, x, bottom);
|
point.y = top;
|
||||||
|
[path moveToPoint: point];
|
||||||
|
point.y = bottom;
|
||||||
|
[path lineToPoint: point];
|
||||||
}
|
}
|
||||||
endUserPath (upath, dps_ustroke);
|
//endUserPath (upath, dps_ustroke);
|
||||||
PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
||||||
sendUserPath (upath);
|
[path stroke];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +606,7 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
||||||
if (stopy >= top)
|
if (stopy >= top)
|
||||||
stopy -= 64;
|
stopy -= 64;
|
||||||
|
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
|
|
||||||
for ( ; y<=stopy ; y+= 64)
|
for ( ; y<=stopy ; y+= 64)
|
||||||
{
|
{
|
||||||
|
@ -611,8 +616,9 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
||||||
PSmoveto (left, y);
|
PSmoveto (left, y);
|
||||||
PSshow (text);
|
PSshow (text);
|
||||||
}
|
}
|
||||||
UPmoveto (upath, left, y);
|
[path moveToPoint: point];
|
||||||
UPlineto (upath, right, y);
|
point.x = right;
|
||||||
|
[path lineToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; x<=stopx ; x+= 64)
|
for ( ; x<=stopx ; x+= 64)
|
||||||
|
@ -623,13 +629,16 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
||||||
PSmoveto (x, bottom + 2);
|
PSmoveto (x, bottom + 2);
|
||||||
PSshow (text);
|
PSshow (text);
|
||||||
}
|
}
|
||||||
UPmoveto (upath, x, top);
|
point.x = x;
|
||||||
UPlineto (upath, x, bottom);
|
point.y = top;
|
||||||
|
[path moveToPoint: point];
|
||||||
|
point.y = bottom;
|
||||||
|
[path lineToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
endUserPath (upath, dps_ustroke);
|
//endUserPath (upath, dps_ustroke);
|
||||||
PSsetgray (12.0/16);
|
PSsetgray (12.0/16);
|
||||||
sendUserPath (upath);
|
[path stroke];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -640,7 +649,7 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
||||||
drawWire
|
drawWire
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
- drawWire: (const NSRect *)rects
|
- drawWire: (NSRect)rects
|
||||||
{
|
{
|
||||||
NSRect visRect;
|
NSRect visRect;
|
||||||
int i,j, c, c2;
|
int i,j, c, c2;
|
||||||
|
@ -652,9 +661,9 @@ drawWire
|
||||||
|
|
||||||
if ([quakeed_i showCoordinates]) // if coords are showing, update everything
|
if ([quakeed_i showCoordinates]) // if coords are showing, update everything
|
||||||
{
|
{
|
||||||
[self getVisibleRect:&visRect];
|
visRect = [self visibleRect];
|
||||||
rects = &visRect;
|
rects = visRect;
|
||||||
xy_draw_rect = *rects;
|
xy_draw_rect = rects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -672,11 +681,11 @@ drawWire
|
||||||
c = [map_i count];
|
c = [map_i count];
|
||||||
for (i=0 ; i<c ; i++)
|
for (i=0 ; i<c ; i++)
|
||||||
{
|
{
|
||||||
ent = [map_i objectAt: i];
|
ent = [map_i objectAtIndex: i];
|
||||||
c2 = [ent count];
|
c2 = [ent count];
|
||||||
for (j = c2-1 ; j >=0 ; j--)
|
for (j = c2-1 ; j >=0 ; j--)
|
||||||
{
|
{
|
||||||
brush = [ent objectAt: j];
|
brush = [ent objectAtIndex: j];
|
||||||
if ( [brush selected] )
|
if ( [brush selected] )
|
||||||
continue;
|
continue;
|
||||||
if ([brush regioned])
|
if ([brush regioned])
|
||||||
|
@ -685,7 +694,7 @@ drawWire
|
||||||
}
|
}
|
||||||
if (i > 0 && drawnames)
|
if (i > 0 && drawnames)
|
||||||
{ // draw entity names
|
{ // draw entity names
|
||||||
brush = [ent objectAt: 0];
|
brush = [ent objectAtIndex: 0];
|
||||||
if (![brush regioned])
|
if (![brush regioned])
|
||||||
{
|
{
|
||||||
[brush getMins: mins maxs: maxs];
|
[brush getMins: mins maxs: maxs];
|
||||||
|
@ -703,7 +712,7 @@ drawWire
|
||||||
newrect.origin.y -= gridsize;
|
newrect.origin.y -= gridsize;
|
||||||
newrect.size.width += 2*gridsize;
|
newrect.size.width += 2*gridsize;
|
||||||
newrect.size.height += 2*gridsize;
|
newrect.size.height += 2*gridsize;
|
||||||
if (!NSEqualRect (&newrect, &realbounds))
|
if (!NSEqualRects (newrect, realbounds))
|
||||||
[self newRealBounds: &newrect];
|
[self newRealBounds: &newrect];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -717,10 +726,10 @@ drawSolid
|
||||||
*/
|
*/
|
||||||
- drawSolid
|
- drawSolid
|
||||||
{
|
{
|
||||||
unsigned char *planes[5];
|
const unsigned char *planes[5];
|
||||||
NSRect visRect;
|
NSRect visRect;
|
||||||
|
|
||||||
[self getVisibleRect:&visRect];
|
visRect = [self visibleRect];
|
||||||
|
|
||||||
//
|
//
|
||||||
// draw the image into imagebuffer
|
// draw the image into imagebuffer
|
||||||
|
@ -762,11 +771,11 @@ drawSolid
|
||||||
// display the output
|
// display the output
|
||||||
//
|
//
|
||||||
[self lockFocus];
|
[self lockFocus];
|
||||||
[[self window] setBackingType:NS_RETAINED];
|
[[self window] setBackingType:NSBackingStoreRetained];
|
||||||
|
|
||||||
planes[0] = (unsigned char *)r_picbuffer;
|
planes[0] = (unsigned char *)r_picbuffer;
|
||||||
NSDrawBitmap(
|
NSDrawBitmap(
|
||||||
&visRect,
|
visRect,
|
||||||
r_width,
|
r_width,
|
||||||
r_height,
|
r_height,
|
||||||
8,
|
8,
|
||||||
|
@ -775,12 +784,12 @@ drawSolid
|
||||||
r_width*4,
|
r_width*4,
|
||||||
NO,
|
NO,
|
||||||
NO,
|
NO,
|
||||||
NS_RGBColorSpace,
|
NSCalibratedRGBColorSpace,
|
||||||
planes
|
planes
|
||||||
);
|
);
|
||||||
|
|
||||||
NSPing ();
|
//NSPing ();
|
||||||
[[self window] setBackingType:NS_BUFFERED];
|
[[self window] setBackingType:NSBackingStoreBuffered];
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -792,19 +801,20 @@ drawSelf
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
NSRect xy_draw_rect;
|
NSRect xy_draw_rect;
|
||||||
- drawSelf:(const NSRect *)rects :(int)rectCount
|
- drawSelf:(NSRect)rects :(int)rectCount
|
||||||
{
|
{
|
||||||
static float drawtime; // static to shut up compiler warning
|
static float drawtime; // static to shut up compiler warning
|
||||||
|
|
||||||
if (timedrawing)
|
if (timedrawing)
|
||||||
drawtime = I_FloatTime ();
|
drawtime = I_FloatTime ();
|
||||||
|
|
||||||
xy_draw_rect = *rects;
|
xy_draw_rect = rects;
|
||||||
newrect.origin.x = newrect.origin.y = 99999;
|
newrect.origin.x = newrect.origin.y = 99999;
|
||||||
newrect.size.width = newrect.size.height = -2*99999;
|
newrect.size.width = newrect.size.height = -2*99999;
|
||||||
|
|
||||||
// setup for text
|
// setup for text
|
||||||
PSselectfont("Helvetica-Medium",10/scale);
|
//PSselectfont("Helvetica-Medium",10/scale);
|
||||||
|
GSSetFont (DEFCTXT, [NSFont fontWithName:@"Helvetica-Medium" size: 10/scale]);
|
||||||
PSrotate(0);
|
PSrotate(0);
|
||||||
|
|
||||||
if (drawmode == dr_texture || drawmode == dr_flat)
|
if (drawmode == dr_texture || drawmode == dr_flat)
|
||||||
|
@ -814,7 +824,7 @@ NSRect xy_draw_rect;
|
||||||
|
|
||||||
if (timedrawing)
|
if (timedrawing)
|
||||||
{
|
{
|
||||||
NSPing ();
|
//NSPing ();
|
||||||
drawtime = I_FloatTime() - drawtime;
|
drawtime = I_FloatTime() - drawtime;
|
||||||
printf ("CameraView drawtime: %5.3f\n", drawtime);
|
printf ("CameraView drawtime: %5.3f\n", drawtime);
|
||||||
}
|
}
|
||||||
|
@ -846,8 +856,8 @@ static NSPoint oldreletive;
|
||||||
NSPoint startpt, newpt;
|
NSPoint startpt, newpt;
|
||||||
NSPoint reletive, delta;
|
NSPoint reletive, delta;
|
||||||
|
|
||||||
startpt = startevent->location;
|
startpt = [startevent locationInWindow];
|
||||||
[self convertPoint:&startpt fromView:NULL];
|
startpt = [self convertPoint:startpt fromView:NULL];
|
||||||
|
|
||||||
oldreletive.x = oldreletive.y = 0;
|
oldreletive.x = oldreletive.y = 0;
|
||||||
|
|
||||||
|
@ -859,19 +869,25 @@ static NSPoint oldreletive;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
event = [NSApp getNextEvent: NS_LMOUSEUPMASK | NS_LMOUSEDRAGGEDMASK
|
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask
|
||||||
| NS_RMOUSEUPMASK | NS_RMOUSEDRAGGEDMASK | NS_APPDEFINEDMASK];
|
| NSRightMouseUpMask | NSRightMouseDraggedMask
|
||||||
|
| NSApplicationDefinedMask;
|
||||||
|
event = [NSApp nextEventMatchingMask: eventMask
|
||||||
|
untilDate: [NSDate distantFuture]
|
||||||
|
inMode: NSEventTrackingRunLoopMode
|
||||||
|
dequeue: YES];
|
||||||
|
|
||||||
if (event->type == NS_LMOUSEUP || event->type == NS_RMOUSEUP)
|
|
||||||
|
if ([event type] == NSLeftMouseUp || [event type] == NSRightMouseUp)
|
||||||
break;
|
break;
|
||||||
if (event->type == NS_APPDEFINED)
|
if ([event type] == NSApplicationDefined)
|
||||||
{ // doesn't work. grrr.
|
{ // doesn't work. grrr.
|
||||||
[quakeed_i applicationDefined:event];
|
//[quakeed_i applicationDefined:event];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
newpt = event->location;
|
newpt = [event locationInWindow];
|
||||||
[self convertPoint:&newpt fromView:NULL];
|
newpt = [self convertPoint:newpt fromView:NULL];
|
||||||
|
|
||||||
if (ug)
|
if (ug)
|
||||||
{
|
{
|
||||||
|
@ -929,8 +945,8 @@ void ScrollCallback (float dx, float dy)
|
||||||
NSPoint neworg;
|
NSPoint neworg;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
[ [xyview_i superview] getBounds: &basebounds];
|
basebounds = [[xyview_i superview] bounds];
|
||||||
[xyview_i convertRectFromSuperview: &basebounds];
|
[xyview_i convertRect: basebounds fromView: [xyview_i superview]];
|
||||||
|
|
||||||
neworg.x = basebounds.origin.x - dx;
|
neworg.x = basebounds.origin.x - dx;
|
||||||
neworg.y = basebounds.origin.y - dy;
|
neworg.y = basebounds.origin.y - dy;
|
||||||
|
@ -983,8 +999,8 @@ void DirectionCallback (float dx, float dy)
|
||||||
|
|
||||||
qprintf ("changing camera direction");
|
qprintf ("changing camera direction");
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
direction[0] = pt.x;
|
direction[0] = pt.x;
|
||||||
direction[1] = pt.y;
|
direction[1] = pt.y;
|
||||||
|
@ -1038,8 +1054,8 @@ void NewCallback (float dx, float dy)
|
||||||
|
|
||||||
qprintf ("sizing new brush");
|
qprintf ("sizing new brush");
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
neworg[0] = [self snapToGrid: pt.x];
|
neworg[0] = [self snapToGrid: pt.x];
|
||||||
neworg[1] = [self snapToGrid: pt.y];
|
neworg[1] = [self snapToGrid: pt.y];
|
||||||
|
@ -1095,8 +1111,8 @@ void ControlCallback (float dx, float dy)
|
||||||
if ([map_i numSelected] != 1)
|
if ([map_i numSelected] != 1)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
dragpoint[0] = pt.x;
|
dragpoint[0] = pt.x;
|
||||||
dragpoint[1] = pt.y;
|
dragpoint[1] = pt.y;
|
||||||
|
@ -1108,8 +1124,8 @@ void ControlCallback (float dx, float dy)
|
||||||
|
|
||||||
qprintf ("dragging brush plane");
|
qprintf ("dragging brush plane");
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
[self dragFrom: theEvent
|
[self dragFrom: theEvent
|
||||||
useGrid: YES
|
useGrid: YES
|
||||||
|
@ -1136,8 +1152,8 @@ void ControlCallback (float dx, float dy)
|
||||||
return NO;
|
return NO;
|
||||||
br = [map_i selectedBrush];
|
br = [map_i selectedBrush];
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
// if the XY point is inside the brush, make the point on top
|
// if the XY point is inside the brush, make the point on top
|
||||||
p1[0] = pt.x;
|
p1[0] = pt.x;
|
||||||
|
@ -1167,8 +1183,8 @@ void ControlCallback (float dx, float dy)
|
||||||
|
|
||||||
qprintf ("dragging brush plane");
|
qprintf ("dragging brush plane");
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
[self dragFrom: theEvent
|
[self dragFrom: theEvent
|
||||||
useGrid: YES
|
useGrid: YES
|
||||||
|
@ -1203,20 +1219,20 @@ mouseDown
|
||||||
vec3_t p1, p2;
|
vec3_t p1, p2;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
p1[0] = p2[0] = pt.x;
|
p1[0] = p2[0] = pt.x;
|
||||||
p1[1] = p2[1] = pt.y;
|
p1[1] = p2[1] = pt.y;
|
||||||
p1[2] = xy_viewnormal[2] * -4096;
|
p1[2] = xy_viewnormal[2] * -4096;
|
||||||
p2[2] = xy_viewnormal[2] * 4096;
|
p2[2] = xy_viewnormal[2] * 4096;
|
||||||
|
|
||||||
flags = theEvent->flags & (NS_SHIFTMASK | NS_CONTROLMASK | NS_ALTERNATEMASK | NS_COMMANDMASK);
|
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
//
|
//
|
||||||
// shift click to select / deselect a brush from the world
|
// shift click to select / deselect a brush from the world
|
||||||
//
|
//
|
||||||
if (flags == NS_SHIFTMASK)
|
if (flags == NSShiftKeyMask)
|
||||||
{
|
{
|
||||||
[map_i selectRay: p1 : p2 : YES];
|
[map_i selectRay: p1 : p2 : YES];
|
||||||
return self;
|
return self;
|
||||||
|
@ -1225,7 +1241,7 @@ mouseDown
|
||||||
//
|
//
|
||||||
// cmd-shift click to set a target/targetname entity connection
|
// cmd-shift click to set a target/targetname entity connection
|
||||||
//
|
//
|
||||||
if (flags == (NS_SHIFTMASK|NS_COMMANDMASK) )
|
if (flags == (NSShiftKeyMask|NSCommandKeyMask) )
|
||||||
{
|
{
|
||||||
[map_i entityConnect: p1 : p2];
|
[map_i entityConnect: p1 : p2];
|
||||||
return self;
|
return self;
|
||||||
|
@ -1237,7 +1253,7 @@ mouseDown
|
||||||
if ( flags == 0 )
|
if ( flags == 0 )
|
||||||
{
|
{
|
||||||
// if double click, position Z checker
|
// if double click, position Z checker
|
||||||
if (theEvent->data.mouse.click > 1)
|
if ([theEvent clickCount] > 1)
|
||||||
{
|
{
|
||||||
qprintf ("positioned Z checker");
|
qprintf ("positioned Z checker");
|
||||||
[zview_i setPoint: &pt];
|
[zview_i setPoint: &pt];
|
||||||
|
@ -1247,7 +1263,7 @@ mouseDown
|
||||||
}
|
}
|
||||||
|
|
||||||
// check eye
|
// check eye
|
||||||
if ( [cameraview_i XYmouseDown: &pt flags: theEvent->flags] )
|
if ( [cameraview_i XYmouseDown: &pt flags: [theEvent modifierFlags]] )
|
||||||
return self; // camera move
|
return self; // camera move
|
||||||
|
|
||||||
// check z post
|
// check z post
|
||||||
|
@ -1279,12 +1295,12 @@ mouseDown
|
||||||
//
|
//
|
||||||
// control click = position and drag camera
|
// control click = position and drag camera
|
||||||
//
|
//
|
||||||
if (flags == NS_CONTROLMASK)
|
if (flags == NSControlKeyMask)
|
||||||
{
|
{
|
||||||
[cameraview_i setXYOrigin: &pt];
|
[cameraview_i setXYOrigin: &pt];
|
||||||
[quakeed_i newinstance];
|
[quakeed_i newinstance];
|
||||||
[cameraview_i display];
|
[cameraview_i display];
|
||||||
[cameraview_i XYmouseDown: &pt flags: theEvent->flags];
|
[cameraview_i XYmouseDown: &pt flags: [theEvent modifierFlags]];
|
||||||
qprintf ("");
|
qprintf ("");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1308,7 @@ mouseDown
|
||||||
//
|
//
|
||||||
// command click = drag Z checker
|
// command click = drag Z checker
|
||||||
//
|
//
|
||||||
if (flags == NS_COMMANDMASK)
|
if (flags == NSCommandKeyMask)
|
||||||
{
|
{
|
||||||
// check single plane dragging
|
// check single plane dragging
|
||||||
[self shearDragFrom: theEvent];
|
[self shearDragFrom: theEvent];
|
||||||
|
@ -1309,7 +1325,7 @@ return self;
|
||||||
//
|
//
|
||||||
// alt click = set entire brush texture
|
// alt click = set entire brush texture
|
||||||
//
|
//
|
||||||
if (flags == NS_ALTERNATEMASK)
|
if (flags == NSAlternateKeyMask)
|
||||||
{
|
{
|
||||||
if (drawmode != dr_texture)
|
if (drawmode != dr_texture)
|
||||||
{
|
{
|
||||||
|
@ -1325,7 +1341,7 @@ return self;
|
||||||
//
|
//
|
||||||
// ctrl-alt click = set single face texture
|
// ctrl-alt click = set single face texture
|
||||||
//
|
//
|
||||||
if (flags == (NS_CONTROLMASK | NS_ALTERNATEMASK) )
|
if (flags == (NSControlKeyMask | NSAlternateKeyMask) )
|
||||||
{
|
{
|
||||||
if (drawmode != dr_texture)
|
if (drawmode != dr_texture)
|
||||||
{
|
{
|
||||||
|
@ -1353,22 +1369,22 @@ rightMouseDown
|
||||||
NSPoint pt;
|
NSPoint pt;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
flags = theEvent->flags & (NS_SHIFTMASK | NS_CONTROLMASK | NS_ALTERNATEMASK | NS_COMMANDMASK);
|
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
if (flags == NS_COMMANDMASK)
|
if (flags == NSCommandKeyMask)
|
||||||
{
|
{
|
||||||
return [self scrollDragFrom: theEvent];
|
return [self scrollDragFrom: theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags == NS_ALTERNATEMASK)
|
if (flags == NSAlternateKeyMask)
|
||||||
{
|
{
|
||||||
return [clipper_i XYClick: pt];
|
return [clipper_i XYClick: pt];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags == 0 || flags == NS_CONTROLMASK)
|
if (flags == 0 || flags == NSControlKeyMask)
|
||||||
{
|
{
|
||||||
return [self directionDragFrom: theEvent];
|
return [self directionDragFrom: theEvent];
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
id button1;
|
id button1;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initFrame:(NSRect)frameRect button1: b1;
|
- initWithFrame:(NSRect)frameRect button1: b1;
|
||||||
- tile;
|
- tile;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "qedefs.h"
|
#include "ZScrollView.h"
|
||||||
|
|
||||||
@implementation ZScrollView
|
@implementation ZScrollView
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Initizes a scroll view with a button at it's lower right corner
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
- initWithFrame:(const NSRect *)frameRect button1:b1
|
- initWithFrame:(NSRect)frameRect button1:b1
|
||||||
{
|
{
|
||||||
[super initWithFrame: frameRect];
|
[super initWithFrame: frameRect];
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ Initizes a scroll view with a button at it's lower right corner
|
||||||
|
|
||||||
button1 = b1;
|
button1 = b1;
|
||||||
|
|
||||||
[self setHorizScrollerRequired: YES];
|
[self setHasHorizontalScroller: YES];
|
||||||
[self setVertScrollerRequired: YES];
|
[self setHasVerticalScroller: YES];
|
||||||
|
|
||||||
[self setBorderType: NS_BEZEL];
|
[self setBorderType: NSBezelBorder];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ Adjust the size for the pop up scale menu
|
||||||
NSRect scrollerframe;
|
NSRect scrollerframe;
|
||||||
|
|
||||||
[super tile];
|
[super tile];
|
||||||
[_horizScroller getFrame: &scrollerframe];
|
scrollerframe = [_horizScroller frame];
|
||||||
[button1 setFrame: &scrollerframe];
|
[button1 setFrame: scrollerframe];
|
||||||
|
|
||||||
scrollerframe.size.width = 0;
|
scrollerframe.size.width = 0;
|
||||||
[_horizScroller setFrame: &scrollerframe];
|
[_horizScroller setFrame: scrollerframe];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -55,16 +55,16 @@ Adjust the size for the pop up scale menu
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
- superviewSizeChanged:(const NSSize *)oldSize
|
- superviewSizeChanged:(const NSSize *)oldSize
|
||||||
{
|
{
|
||||||
[super superviewSizeChanged: oldSize];
|
[super superviewSizeChanged: oldSize];
|
||||||
|
|
||||||
[[self docView] newSuperBounds];
|
[[self documentView] newSuperBounds];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
#define ZView_h
|
#define ZView_h
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
#include "mathlib.h"
|
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
|
#include "render.h"
|
||||||
|
|
||||||
extern id zview_i;
|
extern id zview_i;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "ZView.h"
|
||||||
|
#include "ZScrollView.h"
|
||||||
|
#include "QuakeEd.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "XYView.h"
|
||||||
|
#include "CameraView.h"
|
||||||
|
|
||||||
id zview_i;
|
id zview_i;
|
||||||
|
|
||||||
|
@ -8,6 +13,8 @@ id zscrollview_i, zscalemenu_i, zscalebutton_i;
|
||||||
float zplane;
|
float zplane;
|
||||||
float zplanedir;
|
float zplanedir;
|
||||||
|
|
||||||
|
extern NSBezierPath *path;
|
||||||
|
|
||||||
@implementation ZView
|
@implementation ZView
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -48,7 +55,7 @@ initWithFrame:
|
||||||
|
|
||||||
// initialize the scroll view
|
// initialize the scroll view
|
||||||
zscrollview_i = [[ZScrollView alloc]
|
zscrollview_i = [[ZScrollView alloc]
|
||||||
initFrame: frameRect
|
initWithFrame: frameRect
|
||||||
button1: zscalebutton_i
|
button1: zscalebutton_i
|
||||||
];
|
];
|
||||||
[zscrollview_i setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
[zscrollview_i setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
@ -335,18 +342,18 @@ Rect is in global world (unscaled) coordinates
|
||||||
if (y<bottom)
|
if (y<bottom)
|
||||||
y+= gridsize;
|
y+= gridsize;
|
||||||
|
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
|
|
||||||
for ( ; y<=stopy ; y+= gridsize)
|
for ( ; y<=stopy ; y+= gridsize)
|
||||||
if (y&31)
|
if (y&31)
|
||||||
{
|
{
|
||||||
UPmoveto (upath, left, y);
|
[path moveToPoint: NSMakePoint (left, y)];
|
||||||
UPlineto (upath, right, y);
|
[path lineToPoint: NSMakePoint (right, y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
endUserPath (upath, dps_ustroke);
|
//endUserPath (upath, dps_ustroke);
|
||||||
PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
|
||||||
sendUserPath (upath);
|
[path stroke];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -362,17 +369,17 @@ Rect is in global world (unscaled) coordinates
|
||||||
if (stopy >= top)
|
if (stopy >= top)
|
||||||
stopy -= 32;
|
stopy -= 32;
|
||||||
|
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
|
|
||||||
for ( ; y<=stopy ; y+= 64)
|
for ( ; y<=stopy ; y+= 64)
|
||||||
{
|
{
|
||||||
UPmoveto (upath, left, y);
|
[path moveToPoint: NSMakePoint (left, y)];
|
||||||
UPlineto (upath, right, y);
|
[path lineToPoint: NSMakePoint (right, y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
endUserPath (upath, dps_ustroke);
|
//endUserPath (upath, dps_ustroke);
|
||||||
PSsetgray (12.0/16.0);
|
PSsetgray (12.0/16.0);
|
||||||
sendUserPath (upath);
|
[path stroke];
|
||||||
|
|
||||||
//
|
//
|
||||||
// tiles
|
// tiles
|
||||||
|
@ -387,9 +394,9 @@ Rect is in global world (unscaled) coordinates
|
||||||
if (stopy >= top)
|
if (stopy >= top)
|
||||||
stopy -= 64;
|
stopy -= 64;
|
||||||
|
|
||||||
beginUserPath (upath,NO);
|
[path removeAllPoints];
|
||||||
PSsetgray (0); // for text
|
PSsetgray (0); // for text
|
||||||
PSselectfont("Helvetica-Medium",10/scale);
|
GSSetFont (DEFCTXT, [NSFont fontWithName:@"Helvetica-Medium" size: 10/scale]);
|
||||||
PSrotate(0);
|
PSrotate(0);
|
||||||
|
|
||||||
for ( ; y<=stopy ; y+= 64)
|
for ( ; y<=stopy ; y+= 64)
|
||||||
|
@ -400,17 +407,17 @@ Rect is in global world (unscaled) coordinates
|
||||||
PSmoveto(left,y);
|
PSmoveto(left,y);
|
||||||
PSshow(text);
|
PSshow(text);
|
||||||
}
|
}
|
||||||
UPmoveto (upath, left+24, y);
|
[path moveToPoint: NSMakePoint (left + 24, y)];
|
||||||
UPlineto (upath, right, y);
|
[path lineToPoint: NSMakePoint (right, y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// divider
|
// divider
|
||||||
UPmoveto (upath, 0, _bounds.origin.y);
|
[path moveToPoint: NSMakePoint (0, _bounds.origin.y)];
|
||||||
UPlineto (upath, 0, _bounds.origin.y + _bounds.size.height);
|
[path lineToPoint: NSMakePoint (0, _bounds.origin.y + _bounds.size.height)];
|
||||||
|
|
||||||
endUserPath (upath, dps_ustroke);
|
//endUserPath (upath, dps_ustroke);
|
||||||
PSsetgray (10.0/16.0);
|
PSsetgray (10.0/16.0);
|
||||||
sendUserPath (upath);
|
[path stroke];
|
||||||
|
|
||||||
//
|
//
|
||||||
// origin
|
// origin
|
||||||
|
@ -448,11 +455,11 @@ drawSelf
|
||||||
maxheight = -999999;
|
maxheight = -999999;
|
||||||
|
|
||||||
// allways draw the entire bar
|
// allways draw the entire bar
|
||||||
[self getVisibleRect:&visRect];
|
visRect = [self visibleRect];
|
||||||
rects = &visRect;
|
rects = &visRect;
|
||||||
|
|
||||||
// erase window
|
// erase window
|
||||||
NSEraseRect (&rects[0]);
|
NSEraseRect (rects[0]);
|
||||||
|
|
||||||
// draw grid
|
// draw grid
|
||||||
[self drawGrid: &rects[0]];
|
[self drawGrid: &rects[0]];
|
||||||
|
@ -534,21 +541,27 @@ static NSPoint oldreletive;
|
||||||
|
|
||||||
gridsize = [xyview_i gridsize];
|
gridsize = [xyview_i gridsize];
|
||||||
|
|
||||||
startpt = startevent->location;
|
startpt = [startevent locationInWindow];
|
||||||
[self convertPoint:&startpt fromView:NULL];
|
startpt = [self convertPoint:startpt fromView:NULL];
|
||||||
|
|
||||||
oldreletive.x = oldreletive.y = 0;
|
oldreletive.x = oldreletive.y = 0;
|
||||||
|
reletive.x = 0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
event = [NSApp getNextEvent:
|
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask
|
||||||
NSLeftMouseUpMask | NSLeftMouseDraggedMask
|
| NSRightMouseUpMask | NSRightMouseDraggedMask
|
||||||
| NSRightMouseUpMask | NSRightMouseDraggedMask];
|
| NSApplicationDefinedMask;
|
||||||
if (event->type == NSLeftMouseUp || event->type == NSRightMouseUp)
|
event = [NSApp nextEventMatchingMask: eventMask
|
||||||
|
untilDate: [NSDate distantFuture]
|
||||||
|
inMode: NSEventTrackingRunLoopMode
|
||||||
|
dequeue: YES];
|
||||||
|
|
||||||
|
if ([event type] == NSLeftMouseUp || [event type] == NSRightMouseUp)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
newpt = event->location;
|
newpt = [event locationInWindow];
|
||||||
[self convertPoint:&newpt fromView:NULL];
|
newpt = [self convertPoint:newpt fromView:NULL];
|
||||||
|
|
||||||
reletive.y = newpt.y - startpt.y;
|
reletive.y = newpt.y - startpt.y;
|
||||||
|
|
||||||
|
@ -602,8 +615,8 @@ void ZScrollCallback (float dy)
|
||||||
NSPoint neworg;
|
NSPoint neworg;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
[ [zview_i _super_view] getBounds: &basebounds];
|
basebounds = [[zview_i superview] bounds];
|
||||||
[zview_i convertRectFromSuperview: &basebounds];
|
basebounds = [zview_i convertRect: basebounds fromView: [zview_i superview]];
|
||||||
|
|
||||||
neworg.y = basebounds.origin.y - dy;
|
neworg.y = basebounds.origin.y - dy;
|
||||||
|
|
||||||
|
@ -644,8 +657,8 @@ void ZControlCallback (float dy)
|
||||||
if ([map_i numSelected] != 1)
|
if ([map_i numSelected] != 1)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
dragpoint[0] = origin[0];
|
dragpoint[0] = origin[0];
|
||||||
dragpoint[1] = origin[1];
|
dragpoint[1] = origin[1];
|
||||||
|
@ -657,8 +670,8 @@ void ZControlCallback (float dy)
|
||||||
|
|
||||||
qprintf ("dragging brush plane");
|
qprintf ("dragging brush plane");
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
[self dragFrom: theEvent
|
[self dragFrom: theEvent
|
||||||
useGrid: YES
|
useGrid: YES
|
||||||
|
@ -685,14 +698,14 @@ mouseDown
|
||||||
int flags;
|
int flags;
|
||||||
vec3_t p1;
|
vec3_t p1;
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
p1[0] = origin[0];
|
p1[0] = origin[0];
|
||||||
p1[1] = origin[1];
|
p1[1] = origin[1];
|
||||||
p1[2] = pt.y;
|
p1[2] = pt.y;
|
||||||
|
|
||||||
flags = theEvent->flags & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
|
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
//
|
//
|
||||||
// shift click to select / deselect a brush from the world
|
// shift click to select / deselect a brush from the world
|
||||||
|
@ -719,7 +732,7 @@ mouseDown
|
||||||
{
|
{
|
||||||
[cameraview_i setZOrigin: pt.y];
|
[cameraview_i setZOrigin: pt.y];
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
[cameraview_i ZmouseDown: &pt flags:theEvent->flags];
|
[cameraview_i ZmouseDown: &pt flags:[theEvent modifierFlags]];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,7 +742,7 @@ mouseDown
|
||||||
if ( flags == 0 )
|
if ( flags == 0 )
|
||||||
{
|
{
|
||||||
// check eye
|
// check eye
|
||||||
if ( [cameraview_i ZmouseDown: &pt flags:theEvent->flags] )
|
if ( [cameraview_i ZmouseDown: &pt flags:[theEvent modifierFlags]] )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([map_i numSelected])
|
if ([map_i numSelected])
|
||||||
|
@ -760,10 +773,10 @@ rightMouseDown
|
||||||
NSPoint pt;
|
NSPoint pt;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
pt= theEvent->location;
|
pt= [theEvent locationInWindow];
|
||||||
[self convertPoint:&pt fromView:NULL];
|
pt = [self convertPoint:pt fromView:NULL];
|
||||||
|
|
||||||
flags = theEvent->flags & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
|
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -808,13 +821,13 @@ modalMoveLoop
|
||||||
//
|
//
|
||||||
goto drawentry;
|
goto drawentry;
|
||||||
|
|
||||||
while (event->type != NSLeftMouseUp)
|
while ([event type] != NSLeftMouseUp)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// calculate new point
|
// calculate new point
|
||||||
//
|
//
|
||||||
newpt = event->location;
|
newpt = [event locationInWindow];
|
||||||
[converter convertPoint:&newpt fromView:NULL];
|
newpt = [converter convertPoint:newpt fromView:NULL];
|
||||||
|
|
||||||
delta[0] = newpt.x-basept->x;
|
delta[0] = newpt.x-basept->x;
|
||||||
delta[1] = newpt.y-basept->y;
|
delta[1] = newpt.y-basept->y;
|
||||||
|
@ -830,10 +843,12 @@ drawentry:
|
||||||
//
|
//
|
||||||
[quakeed_i newinstance];
|
[quakeed_i newinstance];
|
||||||
[self display];
|
[self display];
|
||||||
NSPing ();
|
|
||||||
|
|
||||||
event = [NSApp getNextEvent:
|
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
|
||||||
NSLeftMouseUpMask | NSLeftMouseDraggedMask];
|
event = [NSApp nextEventMatchingMask: eventMask
|
||||||
|
untilDate: [NSDate distantFuture]
|
||||||
|
inMode: NSEventTrackingRunLoopMode
|
||||||
|
dequeue: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
|
||||||
|
|
||||||
|
|
||||||
char token[MAXTOKEN];
|
char token[MAXTOKEN];
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef render_h
|
#ifndef render_h
|
||||||
#define render_h
|
#define render_h
|
||||||
|
|
||||||
|
#include "SetBrush.h"
|
||||||
|
|
||||||
|
typedef enum {dr_wire, dr_flat, dr_texture} drawmode_t;
|
||||||
|
|
||||||
extern int r_width, r_height;
|
extern int r_width, r_height;
|
||||||
extern unsigned *r_picbuffer;
|
extern unsigned *r_picbuffer;
|
||||||
extern float *r_zbuffer;
|
extern float *r_zbuffer;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
#include "qedefs.h"
|
#include "render.h"
|
||||||
|
|
||||||
|
extern vec3_t xy_viewnormal;
|
||||||
|
|
||||||
//define NOLIGHT
|
//define NOLIGHT
|
||||||
|
|
||||||
|
@ -511,7 +512,7 @@ REN_BeginCamera
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
float r_width_2, r_height_3;
|
float r_width_2, r_height_3;
|
||||||
plane_t frustum[5];
|
plane_t rfrustum[5];
|
||||||
|
|
||||||
void REN_BeginCamera (void)
|
void REN_BeginCamera (void)
|
||||||
{
|
{
|
||||||
|
@ -520,58 +521,58 @@ void REN_BeginCamera (void)
|
||||||
|
|
||||||
|
|
||||||
// clip to right side
|
// clip to right side
|
||||||
frustum[0].normal[0] = -1;
|
rfrustum[0].normal[0] = -1;
|
||||||
frustum[0].normal[1] = 0;
|
rfrustum[0].normal[1] = 0;
|
||||||
frustum[0].normal[2] = 1;
|
rfrustum[0].normal[2] = 1;
|
||||||
frustum[0].dist = 0;
|
rfrustum[0].dist = 0;
|
||||||
|
|
||||||
// clip to left side
|
// clip to left side
|
||||||
frustum[1].normal[0] = 1;
|
rfrustum[1].normal[0] = 1;
|
||||||
frustum[1].normal[1] = 0;
|
rfrustum[1].normal[1] = 0;
|
||||||
frustum[1].normal[2] = 1;
|
rfrustum[1].normal[2] = 1;
|
||||||
frustum[1].dist = 0;
|
rfrustum[1].dist = 0;
|
||||||
|
|
||||||
// clip to top side
|
// clip to top side
|
||||||
frustum[2].normal[0] = 0;
|
rfrustum[2].normal[0] = 0;
|
||||||
frustum[2].normal[1] = -1;
|
rfrustum[2].normal[1] = -1;
|
||||||
frustum[2].normal[2] = r_height_3 / r_width_2;
|
rfrustum[2].normal[2] = r_height_3 / r_width_2;
|
||||||
frustum[2].dist = 0;
|
rfrustum[2].dist = 0;
|
||||||
|
|
||||||
// clip to bottom side
|
// clip to bottom side
|
||||||
frustum[3].normal[0] = 0;
|
rfrustum[3].normal[0] = 0;
|
||||||
frustum[3].normal[1] = 1;
|
rfrustum[3].normal[1] = 1;
|
||||||
frustum[3].normal[2] = 2*r_height_3 / r_width_2;
|
rfrustum[3].normal[2] = 2*r_height_3 / r_width_2;
|
||||||
frustum[3].dist = 0;
|
rfrustum[3].dist = 0;
|
||||||
|
|
||||||
// near Z
|
// near Z
|
||||||
frustum[4].normal[0] = 0;
|
rfrustum[4].normal[0] = 0;
|
||||||
frustum[4].normal[1] = 0;
|
rfrustum[4].normal[1] = 0;
|
||||||
frustum[4].normal[2] = 1;
|
rfrustum[4].normal[2] = 1;
|
||||||
frustum[4].dist = 1;
|
rfrustum[4].dist = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void REN_BeginXY (void)
|
void REN_BeginXY (void)
|
||||||
{
|
{
|
||||||
frustum[0].normal[0] = 1;
|
rfrustum[0].normal[0] = 1;
|
||||||
frustum[0].normal[1] = 0;
|
rfrustum[0].normal[1] = 0;
|
||||||
frustum[0].normal[2] = 0;
|
rfrustum[0].normal[2] = 0;
|
||||||
frustum[0].dist = 0;
|
rfrustum[0].dist = 0;
|
||||||
|
|
||||||
frustum[1].normal[0] = -1;
|
rfrustum[1].normal[0] = -1;
|
||||||
frustum[1].normal[1] = 0;
|
rfrustum[1].normal[1] = 0;
|
||||||
frustum[1].normal[2] = 0;
|
rfrustum[1].normal[2] = 0;
|
||||||
frustum[1].dist = -r_width;
|
rfrustum[1].dist = -r_width;
|
||||||
|
|
||||||
frustum[2].normal[0] = 0;
|
rfrustum[2].normal[0] = 0;
|
||||||
frustum[2].normal[1] = 1;
|
rfrustum[2].normal[1] = 1;
|
||||||
frustum[2].normal[2] = 0;
|
rfrustum[2].normal[2] = 0;
|
||||||
frustum[2].dist = 0;
|
rfrustum[2].dist = 0;
|
||||||
|
|
||||||
frustum[3].normal[0] = 0;
|
rfrustum[3].normal[0] = 0;
|
||||||
frustum[3].normal[1] = -1;
|
rfrustum[3].normal[1] = -1;
|
||||||
frustum[3].normal[2] = 0;
|
rfrustum[3].normal[2] = 0;
|
||||||
frustum[3].dist = -r_height;
|
rfrustum[3].dist = -r_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -623,7 +624,7 @@ void REN_DrawCameraFace (face_t *idpol)
|
||||||
//
|
//
|
||||||
for (i=0 ; i<4 ; i++)
|
for (i=0 ; i<4 ; i++)
|
||||||
{
|
{
|
||||||
w = ClipWinding (w, &frustum[i]);
|
w = ClipWinding (w, &rfrustum[i]);
|
||||||
if (!w)
|
if (!w)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -698,7 +699,7 @@ void REN_DrawXYFace (face_t *idpol)
|
||||||
//
|
//
|
||||||
for (i=0 ; i<4 ; i++)
|
for (i=0 ; i<4 ; i++)
|
||||||
{
|
{
|
||||||
w = ClipWinding (w, &frustum[i]);
|
w = ClipWinding (w, &rfrustum[i]);
|
||||||
if (!w)
|
if (!w)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue