Pass .m files through indent.

The result isn't perfect, but it cleans up the whitespace and makes the
code more consistent with the rest of the project.
This commit is contained in:
Bill Currie 2010-09-11 19:03:41 +09:00
parent d3a12ee727
commit d23300d58b
25 changed files with 5481 additions and 5886 deletions

View file

@ -12,7 +12,6 @@ extern NSBezierPath *path;
BOOL timedrawing = 0;
@implementation CameraView
/*
==================
initWithFrame:
@ -80,8 +79,7 @@ initWithFrame:
sb_floor_dir = 1;
sb_floor_dist = 99999;
[map_i makeAllPerform: @selector (feetToFloor)];
if (sb_floor_dist == 99999)
{
if (sb_floor_dist == 99999) {
Sys_Printf ("already on top floor");
return self;
}
@ -96,8 +94,7 @@ initWithFrame:
sb_floor_dir = -1;
sb_floor_dist = -99999;
[map_i makeAllPerform: @selector (feetToFloor)];
if (sb_floor_dist == -99999)
{
if (sb_floor_dist == -99999) {
Sys_Printf ("already on bottom floor");
return self;
}
@ -143,7 +140,7 @@ homeView
-setDrawMode:(drawmode_t)mode
{
drawmode = mode;
//XXX[mode_radio_i selectCellAt:0: mode];
[mode_radio_i selectCellAtRow: 0 column: mode];
[quakeed_i updateCamera];
return self;
}
@ -209,12 +206,12 @@ TRANSFORMATION METHODS
===============================================================================
*/
typedef struct
{
typedef struct {
vec3_t trans;
int clipflags;
vec3_t screen; // valid only if clipflags == 0
} campt_t;
#define CLIP_RIGHT 1
#define CLIP_LEFT 2
#define CLIP_TOP 4
@ -232,7 +229,8 @@ float bottomscale = (240.0*2/3)/160;
extern plane_t rfrustum[5];
void MakeCampt (vec3_t in, campt_t *pt)
void
MakeCampt (vec3_t in, campt_t * pt)
{
vec3_t temp;
float scale;
@ -270,7 +268,8 @@ void MakeCampt (vec3_t in, campt_t *pt)
}
void CameraMoveto(vec3_t p)
void
CameraMoveto (vec3_t p)
{
campt_t *pt;
@ -287,7 +286,8 @@ void CameraMoveto(vec3_t p)
}
}
void ClipLine (vec3_t p1, vec3_t p2, int planenum)
void
ClipLine (vec3_t p1, vec3_t p2, int planenum)
{
float d, d2, frac;
vec3_t new;
@ -313,13 +313,11 @@ void ClipLine (vec3_t p1, vec3_t p2, int planenum)
d = DotProduct (p1, pl->normal) - pl->dist;
d2 = DotProduct (p2, pl->normal) - pl->dist;
if (d <= ON_EPSILON && d2 <= ON_EPSILON)
{ // off screen
if (d <= ON_EPSILON && d2 <= ON_EPSILON) { // off screen
return;
}
if (d >= 0 && d2 >= 0)
{ // on front
if (d >= 0 && d2 >= 0) { // on front
ClipLine (p1, p2, planenum + 1);
return;
}
@ -337,7 +335,8 @@ void ClipLine (vec3_t p1, vec3_t p2, int planenum)
int c_off, c_on, c_clip;
void CameraLineto(vec3_t p)
void
CameraLineto (vec3_t p)
{
campt_t *p1, *p2;
int bits;
@ -347,16 +346,14 @@ void CameraLineto(vec3_t p)
p1 = &campts[cam_cur];
MakeCampt (p, p2);
if (p1->clipflags & p2->clipflags)
{
if (p1->clipflags & p2->clipflags) {
c_off++;
return; // entirely off screen
}
bits = p1->clipflags | p2->clipflags;
if (! bits )
{
if (!bits) {
NSPoint point1 = { p1->screen[0], p1->screen[1] };
NSPoint point2 = { p2->screen[0], p2->screen[1] };
c_on++;
@ -364,7 +361,6 @@ void CameraLineto(vec3_t p)
[path lineToPoint: point2];
return; // entirely on screen
}
// needs to be clipped
c_clip++;
@ -410,19 +406,12 @@ drawSolid
[[self window] setBackingType: NSBackingStoreRetained];
planes[0] = (unsigned char *) imagebuffer;
NSDrawBitmap(
_bounds,
r_width,
r_height,
8,
3,
32,
r_width*4,
NO,
NO,
@"RGB", //FIXME what should this be?
(const unsigned char **const)planes
);
NSDrawBitmap (_bounds, r_width, r_height, 8, 3, 32, r_width * 4, NO, NO, @"RGB", // FIXME
// what
// should
// this
// be?
(const unsigned char **const) planes);
// XXX NSPing ();
[[self window] setBackingType: NSBackingStoreBuffered];
@ -484,8 +473,7 @@ drawSelf
else
[self drawWire: rects];
if (timedrawing)
{
if (timedrawing) {
// XXX NSPing ();
drawtime = Sys_DoubleTime () - drawtime;
printf ("CameraView drawtime: %5.3f\n", drawtime);
@ -569,10 +557,13 @@ modalMoveLoop
vec3_t originbase;
NSEvent *event = 0; // XXX
NSPoint newpt;
// NSPoint brushpt;
vec3_t delta;
// id ent;
int i;
// vec3_t temp;
Sys_Printf ("moving camera position");
@ -584,8 +575,7 @@ modalMoveLoop
//
goto drawentry;
while ([event type] != NSLeftMouseUp && [event type] != NSRightMouseUp)
{
while ([event type] != NSLeftMouseUp &&[event type] != NSRightMouseUp) {
//
// calculate new point
//
@ -603,16 +593,13 @@ modalMoveLoop
//
// if command is down, look towards brush or entity
//
if (event->flags & NS_SHIFTMASK)
{
if (event->flags & NS_SHIFTMASK) {
ent =[quakemap_i selectedEntity];
if (ent)
{
if (ent) {
[ent origin: temp];
brushpt.x = temp[0];
brushpt.y = temp[1];
}
else
} else
brushpt =[brush_i centerPoint];
ya = atan2 (brushpt.y - newpt.y, brushpt.x - newpt.x);
[self matrixFromAngles];
@ -625,13 +612,12 @@ drawentry:
//
[quakeed_i newinstance];
[self display];
/*XXX
event = [NSApp nextEventMatchingMask: NSLeftMouseUpMask
| NSLeftMouseDraggedMask | NSRightMouseUpMask
| NSRightMouseDraggedMask | NSApplicationDefinedMask];
*/
if ([event type] == NSKeyDown)
{
| NSRightMouseDraggedMask | NSApplicationDefinedMask
untilDate: [NSDate distantFuture]
inMode: NSEventTrackingRunLoopMode dequeue: YES];
if ([event type] == NSKeyDown) {
[self _keyDown: event];
[self display];
goto drawentry;
@ -649,22 +635,20 @@ drawentry:
XYmouseDown
===============
*/
- (BOOL)XYmouseDown: (NSPoint *)pt flags:(int)flags // return YES if brush handled
-(BOOL) XYmouseDown:(NSPoint *)pt flags:(int)flags
// return YES if brush handled
{
vec3_t movemod;
if (fabs(pt->x - origin[0]) > 16
|| fabs(pt->y - origin[1]) > 16 )
if (fabs (pt->x - origin[0]) > 16 || fabs (pt->y - origin[1]) > 16)
return NO;
#if 0
if (flags & NSAlternateKeyMask)
{ // up / down drag
if (flags & NSAlternateKeyMask) { // up / down drag
movemod[0] = 0;
movemod[1] = 0;
movemod[2] = 1;
}
else
} else
#endif
{
movemod[0] = 1;
@ -683,12 +667,12 @@ XYmouseDown
ZmouseDown
===============
*/
- (BOOL)ZmouseDown: (NSPoint *)pt flags:(int)flags // return YES if brush handled
-(BOOL) ZmouseDown:(NSPoint *)pt flags:(int)flags
// return YES if brush handled
{
vec3_t movemod;
if (fabs(pt->y - origin[2]) > 16
|| pt->x < -8 || pt->x > 8 )
if (fabs (pt->y - origin[2]) > 16 || pt->x < -8 || pt->x > 8)
return NO;
movemod[0] = 0;
@ -719,8 +703,7 @@ viewDrag:
//
goto drawentry;
while ([event type] != NSRightMouseUp)
{
while ([event type] != NSRightMouseUp) {
//
// calculate new point
//
@ -739,12 +722,11 @@ viewDrag:
drawentry:
[quakeed_i newinstance];
[self display];
/*XXX
event = [NSApp getNextEvent:
NSKeyDownMask | NSRightMouseUpMask | NSRightMouseDraggedMask];
*/
if ([event type] == NSKeyDown)
{
event = [NSApp nextEventMatchingMask: NSRightMouseUpMask
| NSRightMouseDraggedMask
untilDate: [NSDate distantFuture]
inMode: NSEventTrackingRunLoopMode dequeue: YES];
if ([event type] == NSKeyDown) {
[self _keyDown:event];
[self display];
goto drawentry;
@ -780,47 +762,42 @@ mouseDown
right = pt.x - 160;
up = pt.y - 240 * 2 / 3;
for (i = 0; i < 3; i++)
p2[i] = forward*matrix[2][i] + up*matrix[1][i] + right*matrix[0][i];
p2[i] =
forward * matrix[2][i] + up * matrix[1][i] + right * matrix[0][i];
for (i = 0; i < 3; i++)
p2[i] = p1[i] + 100 * p2[i];
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
flags =
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
NSAlternateKeyMask | NSCommandKeyMask);
//
// bare click to select a texture
//
if (flags == 0)
{
if (flags == 0) {
[map_i getTextureRay: p1 : p2];
return;
}
//
// shift click to select / deselect a brush from the world
//
if (flags == NSShiftKeyMask)
{
if (flags == NSShiftKeyMask) {
[map_i selectRay: p1 : p2 : NO];
return;
}
//
// cmd-shift click to set a target/targetname entity connection
//
if (flags == (NSShiftKeyMask|NSCommandKeyMask) )
{
if (flags == (NSShiftKeyMask | NSCommandKeyMask)) {
[map_i entityConnect: p1 : p2];
return;
}
//
// alt click = set entire brush texture
//
if (flags == NSAlternateKeyMask)
{
if (drawmode != dr_texture)
{
if (flags == NSAlternateKeyMask) {
if (drawmode != dr_texture) {
Sys_Printf ("No texture setting except in texture mode!\n");
NopSound ();
return;
@ -829,14 +806,11 @@ mouseDown
[quakeed_i updateAll];
return;
}
//
// ctrl-alt click = set single face texture
//
if (flags == (NSControlKeyMask | NSAlternateKeyMask) )
{
if (drawmode != dr_texture)
{
if (flags == (NSControlKeyMask | NSAlternateKeyMask)) {
if (drawmode != dr_texture) {
Sys_Printf ("No texture setting except in texture mode!\n");
NopSound ();
return;
@ -867,13 +841,14 @@ rightMouseDown
[self convertPoint: pt fromView: NULL];
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
flags =
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
NSAlternateKeyMask | NSCommandKeyMask);
//
// click = drag camera
//
if (flags == 0)
{
if (flags == 0) {
Sys_Printf ("looking");
[self viewDrag: &pt];
Sys_Printf ("%s", "");
@ -904,8 +879,7 @@ keyDown
ch = tolower ([[theEvent characters] characterAtIndex: 0]);
switch (ch)
{
switch (ch) {
case 13:
return self;
@ -979,4 +953,3 @@ keyDown
@end

View file

@ -34,20 +34,15 @@ id clipper_i;
{
vec3_t temp;
if (num == 2)
{
if (num == 2) {
VectorCopy (pos[0], temp);
VectorCopy (pos[1], pos[0]);
VectorCopy (temp, pos[1]);
}
else if (num == 3)
{
} else if (num == 3) {
VectorCopy (pos[0], temp);
VectorCopy (pos[2], pos[0]);
VectorCopy (temp, pos[2]);
}
else
{
} else {
Sys_Printf ("no clipplane");
NSBeep ();
}
@ -64,8 +59,7 @@ id clipper_i;
plane.dist = 0;
if (num < 2)
return NO;
if (num == 2)
{
if (num == 2) {
VectorCopy (pos[0], pos[2]);
pos[2][2] += 16;
}
@ -102,10 +96,8 @@ XYClick
new[2] =[map_i currentMinZ];
// see if a point is allready there
for (i=0 ; i<num ; i++)
{
if (new[0] == pos[i][0] && new[1] == pos[i][1])
{
for (i = 0; i < num; i++) {
if (new[0] == pos[i][0] && new[1] == pos[i][1]) {
if (pos[i][2] ==[map_i currentMinZ])
pos[i][2] =[map_i currentMaxZ];
else
@ -136,8 +128,7 @@ XYDrag
{
int i;
for (i=0 ; i<3 ; i++)
{
for (i = 0; i < 3; i++) {
if (fabs (pt->x - pos[i][0] > 10) || fabs (pt->y - pos[i][1] > 10))
continue;
// drag this point
@ -169,8 +160,7 @@ XYDrag
linecolor (1, 0.5, 0);
for (i=0 ; i<num ; i++)
{
for (i = 0; i < num; i++) {
VectorCopy (pos[i], mid);
mid[0] -= 8;
mid[1] -= 8;
@ -200,8 +190,7 @@ XYDrag
// XXX PSselectfont("Helvetica-Medium",10/[xyview_i currentScale]);
PSrotate (0);
for (i=0 ; i<num ; i++)
{
for (i = 0; i < num; i++) {
PSmoveto (pos[i][0] - 4, pos[i][1] - 4);
sprintf (text, "%i", i);
PSshow (text);
@ -221,8 +210,7 @@ XYDrag
// XXX PSselectfont("Helvetica-Medium",10/[zview_i currentScale]);
PSrotate (0);
for (i=0 ; i<num ; i++)
{
for (i = 0; i < num; i++) {
PSmoveto (-28 + i * 8 - 4, pos[i][2] - 4);
sprintf (text, "%i", i);
PSshow (text);

View file

@ -5,8 +5,7 @@
-init
{
[super initCount:0
elementSize:sizeof(dict_t)
[super initCount: 0 elementSize:sizeof (dict_t)
description:NULL];
return self;
}
@ -16,8 +15,7 @@
int i;
dict_t *d;
for (i=0 ; i<numElements ; i++)
{
for (i = 0; i < numElements; i++) {
d =[self elementAt:i];
printf ("%s : %s\n", d->key, d->value);
}
@ -39,8 +37,7 @@ JDC
char *old;
new =[super copy];
for (i=0 ; i<numElements ; i++)
{
for (i = 0; i < numElements; i++) {
d =[self elementAt:i];
old = d->key;
d->key = malloc (strlen (old) + 1);
@ -77,8 +74,7 @@ JDC
fprintf (fp, "{\n");
max =[super count];
for (i = 0;i < max;i++)
{
for (i = 0; i < max; i++) {
d =[super elementAt:i];
fprintf (fp, "\t{\"%s\"\t\"%s\"}\n", d->key, d->value);
}
@ -95,15 +91,12 @@ JDC
FILE *fp;
fp = fopen (path, "w+t");
if (fp != NULL)
{
if (fp != NULL) {
printf ("Writing dictionary file %s.\n", path);
fprintf (fp, "// QE_Project file %s\n", path);
[self writeBlockTo:fp];
fclose (fp);
}
else
{
} else {
printf ("Error writing %s!\n", path);
return NULL;
}
@ -128,8 +121,7 @@ JDC
dict_t *d;
max =[super count];
for (i = 0;i < max;i++)
{
for (i = 0; i < max; i++) {
d =[super elementAt:i];
if (!strcmp (d->key, key))
return d;
@ -141,20 +133,18 @@ JDC
//
// Change a keyword's string
//
- changeStringFor:(char *)key to:(char *)value
-changeStringFor:(char *)
key to:(char *) value
{
dict_t *d;
dict_t newd;
d =[self findKeyword:key];
if (d != NULL)
{
if (d != NULL) {
free (d->value);
d->value = malloc (strlen (value) + 1);
strcpy (d->value, value);
}
else
{
} else {
newd.key = malloc (strlen (key) + 1);
strcpy (newd.key, key);
newd.value = malloc (strlen (value) + 1);
@ -220,8 +210,7 @@ JDC
max =[list count];
tempstr[0] = 0;
for (i = 0;i < max;i++)
{
for (i = 0; i < max; i++) {
s =[list elementAt:i];
strcat (tempstr, s);
strcat (tempstr, " ");
@ -249,7 +238,8 @@ JDC
//
// Delete string from keyword's value
//
- delString:(char *)string fromValue:(char *)key
-delString:(char *)
string fromValue:(char *) key
{
id temp;
int count;
@ -262,11 +252,9 @@ JDC
return NULL;
temp =[self parseMultipleFrom:key];
count =[temp count];
for (i = 0;i < count;i++)
{
for (i = 0; i < count; i++) {
s =[temp elementAt:i];
if (!strcmp(s,string))
{
if (!strcmp (s, string)) {
[temp removeElementAt:i];
free (d->value);
d->value =[self convertListToString:temp];
@ -281,7 +269,8 @@ JDC
//
// Add string to keyword's value
//
- addString:(char *)string toValue:(char *)key
-addString:(char *)
string toValue:(char *) key
{
char *newstr;
char spacing[] = "\t";
@ -290,7 +279,8 @@ JDC
d =[self findKeyword:key];
if (d == NULL)
return NULL;
newstr = malloc(strlen(string) + strlen(d->value) + strlen(spacing) + 1);
newstr =
malloc (strlen (string) + strlen (d->value) + strlen (spacing) + 1);
strcpy (newstr, d->value);
strcat (newstr, spacing);
strcat (newstr, string);
@ -324,8 +314,7 @@ char item[4096];
s = FindWhitespcInBuffer (item);
if (!*s)
searchStr = NULL;
else
{
else {
*s = 0;
searchStr = FindNonwhitespcInBuffer (s + 1);
}
@ -347,13 +336,10 @@ char item[4096];
return NULL;
stuff =[[Storage alloc]
initCount:0
elementSize:ITEMSIZE
description:NULL];
initCount: 0 elementSize: ITEMSIZE description:NULL];
[self setupMultiple:s];
while((s = [self getNextParameter]))
{
while ((s =[self getNextParameter])) {
bzero (string, ITEMSIZE);
strcpy (string, s);
[stuff addElement:string];
@ -381,8 +367,7 @@ char item[4096];
if (c == -1)
return NULL;
while((c = FindBrace(fp)) != '}')
{
while ((c = FindBrace (fp)) != '}') {
if (c == -1)
return NULL;
// c = FindNonwhitespc(fp);
@ -397,8 +382,7 @@ char item[4096];
c = fgetc (fp);
if (c == '\"')
CopyUntilQuote (fp, string);
else
{
else {
ungetc (c, fp);
CopyUntilWhitespc (fp, string);
}
@ -419,13 +403,13 @@ char item[4096];
}
@end
//===============================================
//
// C routines for string parsing
//
//===============================================
int GetNextChar(FILE *fp)
int
GetNextChar (FILE * fp)
{
int c;
int c2;
@ -436,29 +420,26 @@ int GetNextChar(FILE *fp)
if (c == '/') // parse comments
{
c2 = getc (fp);
if (c2 == '/')
{
if (c2 == '/') {
while ((c2 = getc (fp)) != '\n');
c = getc (fp);
}
else
} else
ungetc (c2, fp);
}
return c;
}
void CopyUntilWhitespc(FILE *fp,char *buffer)
void
CopyUntilWhitespc (FILE * fp, char *buffer)
{
int count = 800;
int c;
while(count--)
{
while (count--) {
c = GetNextChar (fp);
if (c == EOF)
return;
if (c <= ' ')
{
if (c <= ' ') {
*buffer = 0;
return;
}
@ -466,18 +447,17 @@ void CopyUntilWhitespc(FILE *fp,char *buffer)
}
}
void CopyUntilQuote(FILE *fp,char *buffer)
void
CopyUntilQuote (FILE * fp, char *buffer)
{
int count = 800;
int c;
while(count--)
{
while (count--) {
c = GetNextChar (fp);
if (c == EOF)
return;
if (c == '\"')
{
if (c == '\"') {
*buffer = 0;
return;
}
@ -485,30 +465,29 @@ void CopyUntilQuote(FILE *fp,char *buffer)
}
}
int FindBrace(FILE *fp)
int
FindBrace (FILE * fp)
{
int count = 800;
int c;
while(count--)
{
while (count--) {
c = GetNextChar (fp);
if (c == EOF)
return -1;
if (c == '{' ||
c == '}')
if (c == '{' || c == '}')
return c;
}
return -1;
}
int FindQuote(FILE *fp)
int
FindQuote (FILE * fp)
{
int count = 800;
int c;
while(count--)
{
while (count--) {
c = GetNextChar (fp);
if (c == EOF)
return -1;
@ -518,18 +497,17 @@ int FindQuote(FILE *fp)
return -1;
}
int FindWhitespc(FILE *fp)
int
FindWhitespc (FILE * fp)
{
int count = 800;
int c;
while(count--)
{
while (count--) {
c = GetNextChar (fp);
if (c == EOF)
return -1;
if (c <= ' ')
{
if (c <= ' ') {
ungetc (c, fp);
return c;
}
@ -537,18 +515,17 @@ int FindWhitespc(FILE *fp)
return -1;
}
int FindNonwhitespc(FILE *fp)
int
FindNonwhitespc (FILE * fp)
{
int count = 800;
int c;
while(count--)
{
while (count--) {
c = GetNextChar (fp);
if (c == EOF)
return -1;
if (c > ' ')
{
if (c > ' ') {
ungetc (c, fp);
return c;
}
@ -556,7 +533,8 @@ int FindNonwhitespc(FILE *fp)
return -1;
}
char *FindWhitespcInBuffer(char *buffer)
char *
FindWhitespcInBuffer (char *buffer)
{
int count = 1000;
char *b = buffer;
@ -569,7 +547,8 @@ char *FindWhitespcInBuffer(char *buffer)
return NULL;
}
char *FindNonwhitespcInBuffer(char *buffer)
char *
FindNonwhitespcInBuffer (char *buffer)
{
int count = 1000;
char *b = buffer;

View file

@ -3,7 +3,6 @@
#include "Dict.h"
@implementation DictList
//
// Read in variable # of objects from FILE *
//
@ -12,8 +11,7 @@
id d;
[super init];
do
{
do {
d =[(Dict *)[Dict alloc] initFromFile:fp];
if (d != NULL)
[self addObject:d];
@ -38,8 +36,7 @@
fprintf (fp, "// Object List written by QuakeEd\n");
for (i = 0;i < [self count];i++)
{
for (i = 0; i <[self count]; i++) {
obj =[self objectAtIndex:i];
[obj writeBlockTo:fp];
}
@ -57,8 +54,7 @@
dict_t *d;
id dict;
for (i = 0;i < [self count];i++)
{
for (i = 0; i <[self count]; i++) {
dict =[self objectAtIndex:i];
d =[(Dict *) dict findKeyword:key];
if (d != NULL)

View file

@ -40,8 +40,7 @@ vec3_t bad_maxs = {8, 8, 8};
VectorAdd (org, v, emins);
VectorAdd (org, v2, emaxs);
new = [[SetBrush alloc] initOwner: self mins:emins maxs:emaxs
texture: &td];
new =[[SetBrush alloc] initOwner: self mins: emins maxs: emaxs texture:&td];
[new setEntityColor:color];
[self addObject:new];
@ -71,8 +70,7 @@ vec3_t bad_maxs = {8, 8, 8};
esize =[new esize];
// create a brush if needed
if (esize == esize_fixed)
{
if (esize == esize_fixed) {
v =[new mins];
[[map_i selectedBrush] getMins: min maxs:max];
VectorSubtract (min, v, min);
@ -81,8 +79,7 @@ vec3_t bad_maxs = {8, 8, 8};
[self setKey: "origin" toValue:value];
[self createFixedBrush:min];
}
else
} else
modifiable = YES;
return self;
@ -93,8 +90,7 @@ vec3_t bad_maxs = {8, 8, 8};
{
epair_t *e, *n;
for (e=epairs ; e ; e=n)
{
for (e = epairs; e; e = n) {
n = e->next;
free (e->key);
free (e->value);
@ -134,15 +130,15 @@ vec3_t bad_maxs = {8, 8, 8};
static char ret[64];
for (e = epairs; e; e = e->next)
if (!strcmp(k,e->key))
{
if (!strcmp (k, e->key)) {
strcpy (ret, e->value);
return ret;
}
return "";
}
- getVector: (vec3_t)v forKey: (char *)k
-getVector:(vec3_t)
v forKey:(char *) k
{
char *c;
@ -165,7 +161,8 @@ vec3_t bad_maxs = {8, 8, 8};
return self;
}
- setKey:(const char *)k toValue:(const char *)v
-setKey:(const char *)
k toValue:(const char *) v
{
epair_t *e;
@ -215,17 +212,14 @@ vec3_t bad_maxs = {8, 8, 8};
if (!epairs)
return self;
e = epairs;
if (!strcmp(e->key, key))
{
if (!strcmp (e->key, key)) {
epairs = e->next;
free (e);
return self;
}
for (; e ; e=e->next)
{
if (e->next && !strcmp(e->next->key, key))
{
for (; e; e = e->next) {
if (e->next && !strcmp (e->next->key, key)) {
e2 = e->next;
e->next = e2->next;
free (e2);
@ -260,8 +254,7 @@ If the entity does not have a "targetname" key, a unique one is generated
// make a unique name of the form t<number>
count =[map_i count];
maxt = 0;
for (i=1 ; i<count ; i++)
{
for (i = 1; i < count; i++) {
ent =[map_i objectAtIndex:i];
t =[ent valueForQKey:"targetname"];
if (!t || t[0] != 't')
@ -275,7 +268,8 @@ If the entity does not have a "targetname" key, a unique one is generated
[self setKey: "targetname" toValue:name];
return [self valueForQKey: "targetname"]; // so it's not on the stack
return[self valueForQKey:"targetname"];
// so it's not on the stack
}
/*
@ -302,8 +296,7 @@ int nument;
[self init];
if (!Script_GetToken (script, true))
{
if (!Script_GetToken (script, true)) {
[self dealloc];
return nil;
}
@ -339,26 +332,21 @@ int nument;
[self getVector: org forKey:"origin"];
if ([self count] && esize != esize_model)
{
if ([self count] && esize != esize_model) {
printf ("WARNING:Entity with brushes and wrong model type\n");
[self removeAllObjects];
}
if (![self count] && esize == esize_model)
{
if (![self count] && esize == esize_model) {
printf ("WARNING:Entity with no brushes and esize_model\n");
[texturepalette_i getTextureDef:&td];
for (i=0 ; i<3 ; i++)
{
for (i = 0; i < 3; i++) {
emins[i] = org[i] - 8;
emaxs[i] = org[i] + 8;
}
brush = [[SetBrush alloc] initOwner: self mins:emins maxs:emaxs
texture: &td];
brush =[[SetBrush alloc] initOwner: self mins: emins maxs: emaxs texture:&td];
[self addObject:brush];
}
// create a brush if needed
if (esize == esize_fixed)
[self createFixedBrush:org];
@ -369,8 +357,7 @@ int nument;
color =[eclass drawColor];
c =[self count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
brush =[self objectAtIndex:i];
[brush setEntityColor:color];
}
@ -379,7 +366,8 @@ int nument;
}
- writeToFILE: (FILE *)f region:(BOOL)reg;
-writeToFILE:(FILE *)
f region:(BOOL) reg;
{
epair_t *e;
int i;
@ -391,16 +379,16 @@ int nument;
char oldang[80];
temporg = NO;
if (reg)
{
if ( !strcmp ([self valueForQKey: "classname"], "info_player_start") )
{ // move the playerstart temporarily to the camera position
if (reg) {
if (!strcmp ([self valueForQKey:"classname"], "info_player_start")) {
// move the playerstart
// temporarily to the camera
// position
temporg = YES;
strcpy (oldang,[self valueForQKey:"angle"]);
sprintf (value, "%i", (int) ([cameraview_i yawAngle] * 180 / M_PI));
[self setKey: "angle" toValue:value];
}
else if ( self != [map_i objectAtIndex: 0]
} else if (self !=[map_i objectAtIndex:0]
&&[[self objectAtIndex:0] regioned])
return self; // skip the entire entity definition
}
@ -408,11 +396,9 @@ int nument;
fprintf (f, "{\n");
// set an origin epair
if (!modifiable)
{
if (!modifiable) {
[[self objectAtIndex: 0] getMins: mins maxs:maxs];
if (temporg)
{
if (temporg) {
[cameraview_i getOrigin:mins];
mins[0] -= 16;
mins[1] -= 16;
@ -434,8 +420,7 @@ int nument;
fprintf (f, "\"%s\"\t\"%s\"\n", e->key, e->value);
// fixed size entities don't save out brushes
if ( modifiable )
{
if (modifiable) {
for (i = 0; i <[self count]; i++)
[[self objectAtIndex: i] writeToFILE: f region:reg];
}

View file

@ -41,7 +41,8 @@ parse_vector (script_t *script, vec3_t vec)
//
// /*QUAKED func_door (0 .5 .8) ? START_OPEN STONE_SOUND DOOR_DONT_LINK GOLD_KEY SILVER_KEY
- initFromText: (const char *)text source: (const char *)filename
-initFromText:(const char *)
text source:(const char *) filename
{
const char *t;
size_t len;
@ -93,8 +94,7 @@ parse_vector (script_t *script, vec3_t vec)
Script_GetToken (script, 0);
// find the length until close comment
for (t = script->p; t[0] && !(t[0] == '*' && t[1] == '/'); t++)
;
for (t = script->p; t[0] && !(t[0] == '*' && t[1] == '/'); t++);
// copy the comment block out
len = t - text;
@ -144,11 +144,9 @@ parse_vector (script_t *script, vec3_t vec)
}
@end
//===========================================================================
@implementation EntityClassList
/*
=================
insertEC:
@ -160,10 +158,8 @@ insertEC:
int i;
name =[ec classname];
for (i=0 ; i<[self count] ; i++)
{
if (strcasecmp (name, [[self objectAtIndex: i] classname]) < 0)
{
for (i = 0; i <[self count]; i++) {
if (strcasecmp (name,[[self objectAtIndex:i] classname]) < 0) {
[self insertObject: ec atIndex:i];
return;
}
@ -227,9 +223,9 @@ scanDirectory
count = scandir (source_path, &namelist, NULL, NULL);
for (i=0 ; i<count ; i++)
{
for (i = 0; i < count; i++) {
int len;
ent = namelist[i];
len = strlen (ent->d_name);
if (len <= 3)
@ -253,8 +249,9 @@ id entity_classes_i;
entity_classes_i = self;
nullclass =[[EntityClass alloc]
initFromText: "/*QUAKED UNKNOWN_CLASS (0 0.5 0) ?*/"
source: va ("%s:%d", __FILE__, __LINE__ - 1)];
initFromText: "/*QUAKED UNKNOWN_CLASS (0 0.5 0) ?*/" source:va ("%s:%d", __FILE__,
__LINE__ -
1)];
return self;
}
@ -264,8 +261,7 @@ id entity_classes_i;
int i;
id o;
for (i=0 ; i<[self count] ; i++)
{
for (i = 0; i <[self count]; i++) {
o =[self objectAtIndex:i];
if (!strcmp (name,[o classname]))
return o;
@ -276,4 +272,3 @@ id entity_classes_i;
@end

View file

@ -10,8 +10,7 @@ id inspcontrol_i;
@implementation InspectorControl
- awakeFromNib
{
-awakeFromNib {
inspcontrol_i = self;
currentInspectorType = -1;
@ -106,7 +105,8 @@ id inspcontrol_i;
[inspectorView_i replaceSubview: inspectorSubview_i with:newView];
r =[inspectorView_i frame];
inspectorSubview_i = newView;
[inspectorSubview_i setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[inspectorSubview_i setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
r.size.width -= 4;
r.size.height -= 4;
[inspectorSubview_i setFrameSize:r.size];

View file

@ -7,7 +7,6 @@
id keypairview_i;
@implementation KeypairView
/*
==================
initWithFrame:
@ -55,8 +54,7 @@ initWithFrame:
pair =[[map_i currentEntity] epairs];
y = _bounds.size.height - LINEHEIGHT;
for ( ; pair ; pair=pair->next)
{
for (; pair; pair = pair->next) {
PSmoveto (SPACING, y);
PSshow (pair->key);
PSmoveto (100, y);
@ -80,8 +78,7 @@ initWithFrame:
i = (_bounds.size.height - loc.y - 4) / LINEHEIGHT;
p =[[map_i currentEntity] epairs];
while ( i )
{
while (i) {
p = p->next;
if (!p)
return;

View file

@ -21,7 +21,6 @@
id map_i;
@implementation Map
/*
===============================================================================
@ -29,9 +28,7 @@ FILE METHODS
===============================================================================
*/
- init
{
- init {
[super init];
map_i = self;
minz = 0;
@ -51,21 +48,18 @@ FILE METHODS
w =[self objectAtIndex:0];
c =[w count];
sb_newowner = oldselection;
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
o =[w objectAtIndex:0];
if ([o selected])
[o moveToEntity];
else
{
else {
[w removeObjectAtIndex:0];
[o release];
}
}
c =[self count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
o =[self objectAtIndex:0];
[self removeObjectAtIndex:0];
[o removeAllObjects];
@ -84,8 +78,7 @@ FILE METHODS
w =[self objectAtIndex:0]; // world object
sb_newowner = w;
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
n =[oldselection objectAtIndex:i];
[n moveToEntity];
i--;
@ -122,8 +115,7 @@ FILE METHODS
old = currentEntity;
currentEntity = ent;
if (old != ent)
{
if (old != ent) {
[things_i newCurrentEntity]; // update inspector
[inspcontrol_i changeInspectorTo:i_things];
}
@ -172,8 +164,7 @@ FILE METHODS
{
[super removeObject:o];
if (o == currentEntity)
{ // select the world
if (o == currentEntity) { // select the world
[self setCurrentEntity: [self objectAtIndex:0]];
}
@ -271,25 +262,20 @@ readMapFile
// load the apropriate texture wad
dat =[currentEntity valueForQKey:"wad"];
if (dat && dat[0])
{
if (dat && dat[0]) {
if (dat[0] == '/') // remove old style fullpaths
[currentEntity removeKeyPair:"wad"];
else
{
else {
if (strcmp ([texturepalette_i currentWad], dat))
[project_i setTextureWad:dat];
}
}
// center the camera and XY view on the playerstart
c =[self count];
for (i=1 ; i<c ; i++)
{
for (i = 1; i < c; i++) {
ent =[self objectAtIndex:i];
cl =[ent valueForQKey:"classname"];
if (cl && !strcasecmp (cl,"info_player_start"))
{
if (cl && !strcasecmp (cl, "info_player_start")) {
angle = atof ([ent valueForQKey:"angle"]);
angle = angle / 180 * M_PI;
[ent getVector: org forKey:"origin"];
@ -307,7 +293,8 @@ readMapFile
writeMapFile
=================
*/
- writeMapFile: (char *)fname useRegion: (BOOL)reg
-writeMapFile:(char *)
fname useRegion:(BOOL) reg
{
FILE *f;
int i;
@ -375,22 +362,19 @@ make a target connection from the original entity.
id oldent, ent;
oldent =[self currentEntity];
if (oldent == [self objectAtIndex: 0])
{
if (oldent ==[self objectAtIndex:0]) {
Sys_Printf ("Must have a non-world entity selected to connect");
return self;
}
[self selectRay: p1: p2:YES];
ent =[self currentEntity];
if (ent == oldent)
{
if (ent == oldent) {
Sys_Printf ("Must click on a different entity to connect");
return self;
}
if (ent == [self objectAtIndex: 0])
{
if (ent ==[self objectAtIndex:0]) {
Sys_Printf ("Must click on a non-world entity to connect");
return self;
}
@ -425,12 +409,10 @@ to intervening world brushes
besttime = 99999;
c =[self count];
for (i=c-1 ; i>=0 ; i--)
{
for (i = c - 1; i >= 0; i--) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j=0 ; j<c2 ; j++)
{
for (j = 0; j < c2; j++) {
brush =[ent objectAtIndex:j];
[brush hitByRay: p1: p2: &time:&face];
if (time < 0 || time > besttime)
@ -441,41 +423,36 @@ to intervening world brushes
bestface = face;
}
if (i == 1 && ef && bestbrush)
break; // found an entity, so don't check the world
break; // found an entity, so don't check the
// world
}
if (besttime == 99999)
{
if (besttime == 99999) {
Sys_Printf ("trace missed");
return self;
}
if ( [bestbrush regioned] )
{
if ([bestbrush regioned]) {
Sys_Printf ("WANRING: clicked on regioned brush");
return self;
}
if (bestent != currentEntity)
{
if (bestent != currentEntity) {
[self makeSelectedPerform:@selector (deselect)];
[self setCurrentEntity:bestent];
}
[quakeed_i disableFlushWindow];
if ( ![bestbrush selected] )
{
if ( [map_i numSelected] == 0)
{ // don't grab texture if others are selected
if (![bestbrush selected]) {
if ([map_i numSelected] == 0) { // don't grab texture if others are
// selected
td =[bestbrush texturedefForFace:bestface];
[texturepalette_i setTextureDef:td];
}
[bestbrush setSelected:YES];
Sys_Printf ("selected entity %i brush %i face %i", (int)[self indexOfObject: bestent], (int)[bestent indexOfObject:bestbrush], bestface);
}
else
{
} else {
[bestbrush setSelected:NO];
Sys_Printf ("deselected entity %i brush %i face %i", (int)[self indexOfObject: bestent], (int)[bestent indexOfObject:bestbrush], bestface);
}
@ -506,12 +483,10 @@ Returns the brush hit, or nil if missed.
besttime = 99999;
c =[self count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j=0 ; j<c2 ; j++)
{
for (j = 0; j < c2; j++) {
brush =[ent objectAtIndex:j];
if (![brush selected])
continue;
@ -550,12 +525,10 @@ getTextureRay
besttime = 99999;
bestface = -1;
c =[self count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j=0 ; j<c2 ; j++)
{
for (j = 0; j < c2; j++) {
brush =[ent objectAtIndex:j];
[brush hitByRay: p1: p2: &time:&face];
if (time < 0 || time > besttime)
@ -570,8 +543,7 @@ getTextureRay
if (besttime == 99999)
return nil;
if ( ![bestent modifiable])
{
if (![bestent modifiable]) {
Sys_Printf ("can't modify spawned entities");
return self;
}
@ -609,12 +581,10 @@ setTextureRay
besttime = 99999;
c =[self count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j=0 ; j<c2 ; j++)
{
for (j = 0; j < c2; j++) {
brush =[ent objectAtIndex:j];
[brush hitByRay: p1: p2: &time:&face];
if (time < 0 || time > besttime)
@ -626,20 +596,17 @@ setTextureRay
}
}
if (besttime == 99999)
{
if (besttime == 99999) {
Sys_Printf ("trace missed");
return self;
}
if ( ![bestent modifiable])
{
if (![bestent modifiable]) {
Sys_Printf ("can't modify spawned entities");
return self;
}
if ( [bestbrush regioned] )
{
if ([bestbrush regioned]) {
Sys_Printf ("WANRING: clicked on regioned brush");
return self;
}
@ -647,13 +614,10 @@ setTextureRay
[texturepalette_i getTextureDef:&td];
[quakeed_i disableFlushWindow];
if (allsides)
{
if (allsides) {
[bestbrush setTexturedef:&td];
Sys_Printf ("textured entity %i brush %i", (int)[self indexOfObject: bestent], (int)[bestent indexOfObject:bestbrush]);
}
else
{
} else {
[bestbrush setTexturedef: &td forFace:bestface];
Sys_Printf ("deselected entity %i brush %i face %i", (int)[self indexOfObject: bestent], (int)[bestent indexOfObject:bestbrush], bestface);
}
@ -681,12 +645,10 @@ OPERATIONS ON SELECTIONS
total = 0;
c =[self count];
for (i=c-1 ; i>=0 ; i--)
{
for (i = c - 1; i >= 0; i--) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j = c2-1 ; j >=0 ; j--)
{
for (j = c2 - 1; j >= 0; j--) {
brush =[ent objectAtIndex:j];
if (![brush selected])
continue;
@ -709,12 +671,10 @@ OPERATIONS ON SELECTIONS
id ent, brush;
c =[self count];
for (i=c-1 ; i>=0 ; i--)
{
for (i = c - 1; i >= 0; i--) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j = c2-1 ; j >=0 ; j--)
{
for (j = c2 - 1; j >= 0; j--) {
brush =[ent objectAtIndex:j];
if ([brush selected])
continue;
@ -733,12 +693,10 @@ OPERATIONS ON SELECTIONS
id ent, brush;
c =[self count];
for (i=c-1 ; i>=0 ; i--)
{
for (i = c - 1; i >= 0; i--) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j = c2-1 ; j >=0 ; j--)
{
for (j = c2 - 1; j >= 0; j--) {
brush =[ent objectAtIndex:j];
if ([brush regioned])
continue;
@ -755,12 +713,10 @@ OPERATIONS ON SELECTIONS
id ent, brush;
c =[self count];
for (i=c-1 ; i>=0 ; i--)
{
for (i = c - 1; i >= 0; i--) {
ent =[self objectAtIndex:i];
c2 =[ent count];
for (j = c2-1 ; j >=0 ; j--)
{
for (j = c2 - 1; j >= 0; j--) {
brush =[ent objectAtIndex:j];
[brush performSelector:sel];
}
@ -770,21 +726,26 @@ OPERATIONS ON SELECTIONS
}
void sel_identity (void)
void
sel_identity (void)
{
sel_x[0]=1; sel_x[1]=0; sel_x[2]=0;
sel_y[0]=0; sel_y[1]=1; sel_y[2]=0;
sel_z[0]=0; sel_z[1]=0; sel_z[2]=1;
sel_x[0] = 1;
sel_x[1] = 0;
sel_x[2] = 0;
sel_y[0] = 0;
sel_y[1] = 1;
sel_y[2] = 0;
sel_z[0] = 0;
sel_z[1] = 0;
sel_z[2] = 1;
}
-transformSelection
{
if ( ![currentEntity modifiable])
{
if (![currentEntity modifiable]) {
Sys_Printf ("can't modify spawned entities");
return self;
}
// find an origin to apply the transformation to
sb_mins[0] = sb_mins[1] = sb_mins[2] = 99999;
sb_maxs[0] = sb_maxs[1] = sb_maxs[2] = -99999;
@ -801,7 +762,8 @@ void sel_identity (void)
}
void swapvectors (vec3_t a, vec3_t b)
void
swapvectors (vec3_t a, vec3_t b)
{
vec3_t temp;
@ -884,8 +846,7 @@ UI operations
// copy individual brushes in the world entity
o =[self objectAtIndex:0];
c =[o count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
b =[o objectAtIndex:i];
if (![b selected])
continue;
@ -900,8 +861,7 @@ UI operations
// copy entire entities otherwise
originalElements =[self count]; // don't copy the new ones
for (i=1 ; i<originalElements ; i++)
{
for (i = 1; i < originalElements; i++) {
o =[self objectAtIndex:i];
if (![[o objectAtIndex:0] selected])
continue;
@ -914,8 +874,7 @@ UI operations
[[o objectAtIndex: j] setSelected:NO];
c =[new count];
for (j=0 ; j<c ; j++)
{
for (j = 0; j < c; j++) {
b =[new objectAtIndex:j];
[b translate];
[b setSelected:YES];
@ -934,8 +893,7 @@ UI operations
int i, c;
o =[self selectedBrush];
if (!o)
{
if (!o) {
Sys_Printf ("nothing selected");
return self;
}
@ -952,15 +910,13 @@ UI operations
-makeEntity:sender
{
if (currentEntity != [self objectAtIndex: 0])
{
if (currentEntity !=[self objectAtIndex:0]) {
Sys_Printf ("ERROR: can't makeEntity inside an entity");
NSBeep ();
return self;
}
if ( [self numSelected] == 0)
{
if ([self numSelected] == 0) {
Sys_Printf ("ERROR: must have a seed brush to make an entity");
NSBeep ();
return self;
@ -970,8 +926,8 @@ UI operations
if ([sb_newowner modifiable])
[self makeSelectedPerform:@selector (moveToEntity)];
else
{ // throw out seed brush and select entity fixed brush
else { // throw out seed brush and select
// entity fixed brush
[self makeSelectedPerform:@selector (remove)];
[[sb_newowner objectAtIndex: 0] setSelected:YES];
}
@ -989,8 +945,7 @@ UI operations
{
id b;
if ([self numSelected] != 1)
{
if ([self numSelected] != 1) {
Sys_Printf ("must have a single brush selected");
return self;
}
@ -1024,8 +979,7 @@ UI operations
vec3_t mins, maxs;
texturedef_t td;
if ([self numSelected] != 1)
{
if ([self numSelected] != 1) {
Sys_Printf ("must have a single brush selected");
return self;
}
@ -1052,8 +1006,7 @@ UI operations
vec3_t mins, maxs;
texturedef_t td;
if ([self numSelected] != 1)
{
if ([self numSelected] != 1) {
Sys_Printf ("must have a single brush selected");
return self;
}
@ -1093,8 +1046,7 @@ subtractSelection
carve_out =[[NSMutableArray alloc] init];
c =[currentEntity count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
o =[currentEntity objectAtIndex:i];
if ([o selected])
[sellist addObject:o];
@ -1104,14 +1056,12 @@ subtractSelection
c =[sellist count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
o =[sellist objectAtIndex:i];
[o setCarveVars];
c2 =[sourcelist count];
for (j=0 ; j<c2 ; j++)
{
for (j = 0; j < c2; j++) {
o2 =[sourcelist objectAtIndex:j];
[o2 carve];
[carve_in removeAllObjects];
@ -1132,8 +1082,7 @@ subtractSelection
[carve_in release];
[carve_out release];
if (![currentEntity count])
{
if (![currentEntity count]) {
o = currentEntity;
[self removeObject:o];
[o release];

View file

@ -2,7 +2,6 @@
#include "PopScrollView.h"
@implementation PopScrollView
/*
====================
initWithFrame: button:
@ -10,9 +9,8 @@ initWithFrame: button:
Initizes a scroll view with a button at it's lower right corner
====================
*/
- initWithFrame:(NSRect)frameRect button1:b1 button2:b2
{
- initWithFrame:(NSRect)
frameRect button1:b1 button2:b2 {
[super initWithFrame:frameRect];
[self addSubview:b1];
@ -28,17 +26,13 @@ Initizes a scroll view with a button at it's lower right corner
return self;
}
/*
================
tile
Adjust the size for the pop up scale menu
=================
*/
- tile
*/ -tile
{
NSRect scrollerframe;
NSRect buttonframe, buttonframe2;
@ -84,4 +78,3 @@ Adjust the size for the pop up scale menu
@end

View file

@ -19,28 +19,33 @@ float lightaxis[3] = {1, 0.6, 0.75};
return self;
}
int _atoi (char *c)
int
_atoi (char *c)
{
if (!c)
return 0;
return atoi (c);
}
int _atof (char *c)
int
_atof (char *c)
{
if (!c)
return 0;
return atof (c);
}
void WriteNumericDefault (char *name, float value)
void
WriteNumericDefault (char *name, float value)
{
char str[128];
sprintf (str, "%f", value);
// XXX NSWriteDefault (DEFOWNER, name, str);
}
void WriteStringDefault (char *name, char *value)
void
WriteStringDefault (char *name, char *value)
{
// XXX NSWriteDefault (DEFOWNER, name, value);
}
@ -62,7 +67,8 @@ void WriteStringDefault (char *name, char *value)
// XXX value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"ShowBSPOutput"));
[self setShowBSP:value];
//XXX value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"OffsetBrushCopy"));
// XXX value = _atoi((char
// *)NSGetDefaultValue(DEFOWNER,"OffsetBrushCopy"));
[self setBrushOffset:value];
// XXX value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"StartWad"));
@ -93,7 +99,8 @@ void WriteStringDefault (char *name, char *value)
-setCurrentProject:sender
{
[startproject_i setStringValue: [NSString stringWithCString:[project_i currentProjectFile]]];
[startproject_i setStringValue: [NSString stringWithCString:[project_i
currentProjectFile]]];
[self UIChanged:self];
return self;
}
@ -124,13 +131,11 @@ void WriteStringDefault (char *name, char *value)
// XXX ExtractFilePath (bspSound, path);
// XXX ExtractFileBase (bspSound, file);
rtn = [panel
runModalForDirectory:[NSString stringWithCString:path]
rtn =[panel runModalForDirectory: [NSString stringWithCString:path]
file: [NSString stringWithCString:file]
types: [NSArray arrayWithObjects: types count:1]];
if (rtn)
{
if (rtn) {
filenames =[panel filenames];
strcpy (bspSound,[[panel directory] cString]);
strcat (bspSound, "/");
@ -165,8 +170,7 @@ void WriteStringDefault (char *name, char *value)
if (bspSound_i)
[bspSound_i release];
bspSound_i =[[NSSound alloc] initWithContentsOfFile: [NSString stringWithCString:bspSound]];
if (!bspSound_i)
{
if (!bspSound_i) {
strcpy (bspSound, "/NextLibrary/Sounds/Funk.snd");
bspSound_i =[[NSSound alloc] initWithContentsOfFile: [NSString stringWithCString:bspSound]];
}
@ -264,6 +268,7 @@ void WriteStringDefault (char *name, char *value)
WriteNumericDefault ("Xlight", xlight);
return self;
}
-setYlight:(float) value
{
ylight = value;
@ -274,6 +279,7 @@ void WriteStringDefault (char *name, char *value)
WriteNumericDefault ("Ylight", ylight);
return self;
}
-setZlight:(float) value
{
zlight = value;
@ -292,10 +298,12 @@ void WriteStringDefault (char *name, char *value)
{
return[xlight_i floatValue];
}
-(float) getYlight
{
return[ylight_i floatValue];
}
-(float) getZlight
{
return[zlight_i floatValue];

View file

@ -50,11 +50,11 @@ id project_i;
strcpy (path_finalmapdir, s);
strcat (path_finalmapdir, "/" SUBDIR_MAPS); // dest dir
[basepathinfo_i setStringValue:[NSString stringWithCString:s]]; // in Project Inspector
[basepathinfo_i setStringValue: [NSString stringWithCString:s]];
// in Project Inspector
#if 0
if ((s = [projectInfo getStringFor:BASEPATHKEY]))
{
if ((s =[projectInfo getStringFor:BASEPATHKEY])) {
strcpy (path_basepath, s);
strcpy (path_progdir, s);
@ -66,46 +66,40 @@ id project_i;
strcpy (path_finalmapdir, s);
strcat (path_finalmapdir, "/" SUBDIR_MAPS); // dest dir
[basepathinfo_i setStringValue:s]; // in Project Inspector
[basepathinfo_i setStringValue:s];
// in Project Inspector
}
#endif
if ((s = [projectInfo getStringFor:BSPFULLVIS]))
{
if ((s =[projectInfo getStringFor:BSPFULLVIS])) {
strcpy (string_fullvis, s);
changeString ('@', '\"', string_fullvis);
}
if ((s = [projectInfo getStringFor:BSPFASTVIS]))
{
if ((s =[projectInfo getStringFor:BSPFASTVIS])) {
strcpy (string_fastvis, s);
changeString ('@', '\"', string_fastvis);
}
if ((s = [projectInfo getStringFor:BSPNOVIS]))
{
if ((s =[projectInfo getStringFor:BSPNOVIS])) {
strcpy (string_novis, s);
changeString ('@', '\"', string_novis);
}
if ((s = [projectInfo getStringFor:BSPRELIGHT]))
{
if ((s =[projectInfo getStringFor:BSPRELIGHT])) {
strcpy (string_relight, s);
changeString ('@', '\"', string_relight);
}
if ((s = [projectInfo getStringFor:BSPLEAKTEST]))
{
if ((s =[projectInfo getStringFor:BSPLEAKTEST])) {
strcpy (string_leaktest, s);
changeString ('@', '\"', string_leaktest);
}
if ((s = [projectInfo getStringFor:BSPENTITIES]))
{
if ((s =[projectInfo getStringFor:BSPENTITIES])) {
strcpy (string_entities, s);
changeString ('@', '\"', string_entities);
}
// Build list of wads
wadList =[projectInfo parseMultipleFrom:WADSKEY];
@ -187,15 +181,16 @@ id project_i;
//
// Change a character to another in a Storage list of strings
//
- changeChar:(char)f to:(char)t in:(id)obj
-changeChar:(char)
f to:(char)
t in:(id) obj
{
int i;
int max;
char *string;
max =[obj count];
for (i = 0;i < max;i++)
{
for (i = 0; i < max; i++) {
string =[obj elementAt:i];
changeString (f, t, string);
}
@ -217,15 +212,13 @@ id project_i;
list = mapList;
else if (sender == pis_wads_i)
list = wadList;
else
{
else {
list = nil;
Sys_Error ("Project: unknown browser to fill");
}
max =[list count];
for (i = 0 ; i<max ; i++)
{
for (i = 0; i < max; i++) {
name =[list elementAt:i];
[matrix addRow];
cell =[matrix cellAtRow: i column:0];
@ -248,8 +241,7 @@ id project_i;
matrix =[sender matrixInColumn:0];
row =[matrix selectedRow];
sprintf(fname,"%s/%s.map",path_mapdirectory,
(char *)[mapList elementAt:row]);
sprintf (fname, "%s/%s.map", path_mapdirectory, (char *)[mapList elementAt:row]);
panel = NSGetAlertPanel (@"Loading...",
@"Loading map. Please wait.", NULL, NULL, NULL);
@ -272,11 +264,9 @@ id project_i;
// set the row in the settings inspector wad browser
c =[wadList count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
name = (char *)[wadList elementAt:i];
if (!strcmp(name, wf))
{
if (!strcmp (name, wf)) {
[[pis_wads_i matrixInColumn: 0] selectCellAtRow: i column:0];
break;
}
@ -320,11 +310,10 @@ id project_i;
int rtn;
path =[preferences_i getProjectPath];
if (!path || !path[0] || access(path,0))
{
if (!path || !path[0] || access (path, 0)) {
rtn = NSRunAlertPanel (@"Project Error!",
@"A default project has not been found.\n"
, @"Open Project", NULL, NULL);
@"A default project has not been found.\n",
@"Open Project", NULL, NULL);
if ([self openProject] == nil)
while (1) // can't run without a project
[NSApp terminate:self];
@ -380,8 +369,7 @@ id project_i;
// [openpanel allowMultipleFiles:NO];
// [openpanel chooseDirectories:NO];
rtn =[openpanel runModalForTypes: [NSArray arrayWithObjects: projtypes count:1]];
if (rtn == NSOKButton)
{
if (rtn == NSOKButton) {
filenames =[openpanel filenames];
dir =[[openpanel directory] cString];
sprintf (path, "%s/%s", dir,[[filenames objectAtIndex:0] cString]);
@ -397,15 +385,15 @@ id project_i;
//
// Search for a string in a List of strings
//
- (int)searchForString:(char *)str in:(id)obj
-(int) searchForString:(char *)
str in:(id) obj
{
int i;
int max;
char *s;
max =[obj count];
for (i = 0;i < max; i++)
{
for (i = 0; i < max; i++) {
s = (char *)[obj elementAt:i];
if (!strcmp (s, str))
return 1;
@ -517,15 +505,14 @@ id project_i;
}
@end
//====================================================
// C Functions
//====================================================
//
// Change a character to a different char in a string
//
void changeString(char cf,char ct,char *string)
void
changeString (char cf, char ct, char *string)
{
int j;
@ -533,5 +520,3 @@ void changeString(char cf,char ct,char *string)
if (string[j] == cf)
string[j] = ct;
}

View file

@ -33,27 +33,33 @@ int bsppid;
#if 0
// example command strings
char *fullviscmd = "rsh satan \"/LocalApps/qbsp $1 $2 ; /LocalApps/light $2 ; /LocalApps/vis $2\"";
char *fastviscmd = "rsh satan \"/LocalApps/qbsp $1 $2 ; /LocalApps/light $2 ; /LocalApps/vis -fast $2\"";
char *noviscmd = "rsh satan \"/LocalApps/qbsp $1 $2 ; /LocalApps/light $2\"";
char *fullviscmd =
"rsh satan \"/LocalApps/qbsp $1 $2 ; /LocalApps/light $2 ; /LocalApps/vis $2\"";
char *fastviscmd =
"rsh satan \"/LocalApps/qbsp $1 $2 ; /LocalApps/light $2 ; /LocalApps/vis -fast $2\"";
char *noviscmd =
"rsh satan \"/LocalApps/qbsp $1 $2 ; /LocalApps/light $2\"";
char *relightcmd = "rsh satan \"/LocalApps/light $2\"";
char *leakcmd = "rsh satan \"/LocalApps/qbsp -mark -notjunc $1 $2\"";
#endif
void NopSound (void)
void
NopSound (void)
{
NSBeep ();
}
void My_Malloc_Error (int code)
void
My_Malloc_Error (int code)
{
// recursive toast Error ("Malloc error: %i\n", code);
write (1, "malloc error!\n", strlen ("malloc error!\n") + 1);
}
#define FN_CMDOUT "/tmp/QuakeEdCmd.txt"
void DisplayCmdOutput (void)
void
DisplayCmdOutput (void)
{
char *buffer;
QFile *file;
@ -83,7 +89,8 @@ See if the BSP is done
===============
*/
//DPSTimedEntry cmdte;
void CheckCmdDone(/*DPSTimedEntry tag,*/ double now, void *userData)
void
CheckCmdDone ( /* DPSTimedEntry tag, */ double now, void *userData)
{
union wait statusp;
struct rusage rusage;
@ -98,7 +105,6 @@ void CheckCmdDone(/*DPSTimedEntry tag,*/ double now, void *userData)
//============================================================================
@implementation QuakeEd
/*
===============
AutoSave
@ -106,11 +112,9 @@ AutoSave
Every five minutes, save a modified map
===============
*/
-(void) AutoSave
{
- (void) AutoSave {
// automatic backup
if (autodirty)
{
if (autodirty) {
autodirty = NO;
#define FN_AUTOSAVE "/qcache/AutoSaveMap.map"
[map_i writeMapFile: FN_AUTOSAVE useRegion:NO];
@ -123,16 +127,9 @@ Every five minutes, save a modified map
init
===============
*/
- initContent:(NSRect)contentRect
style:(int)aStyle
backing:(int)backingType
buttonMask:(int)mask
defer:(BOOL)flag
-initContent: (NSRect) contentRect style: (int) aStyle backing: (int) backingType buttonMask: (int) mask defer:(BOOL) flag
{
[super initWithContentRect:contentRect
styleMask:aStyle
backing:backingType
defer:flag];
[super initWithContentRect: contentRect styleMask: aStyle backing: backingType defer:flag];
// XXX [self addToEventMask:
// XXX NSRightMouseDragged|NSLeftMouseDragged];
@ -142,16 +139,15 @@ defer:(BOOL)flag
quakeed_i = self;
dirty = autodirty = NO;
[NSTimer timerWithTimeInterval: 5 * 60
target: self
selector: @selector(AutoSave)
userInfo: nil
repeats: YES];
[NSTimer timerWithTimeInterval: 5 * 60 target: self selector:@selector
(AutoSave)
userInfo: nil repeats:YES];
path =[NSBezierPath new];
return self;
}
#define FN_TEMPSAVE "/qcache/temp.map"
-setDefaultFilename
{
@ -183,7 +179,8 @@ BOOL updatexy;
BOOL updatez;
BOOL updatecamera;
void postappdefined (void)
void
postappdefined (void)
{
NSEvent *ev;
@ -191,15 +188,10 @@ void postappdefined (void)
return;
// post an event at the end of the que
ev = [NSEvent otherEventWithType: NSApplicationDefined
location: NSZeroPoint
modifierFlags: 0
timestamp: [[NSDate date] timeIntervalSinceReferenceDate]
windowNumber: 0
context: [NSApp context]
subtype: 0
data1: 0
data2: 0];
ev =[NSEvent otherEventWithType: NSApplicationDefined location: NSZeroPoint modifierFlags: 0 timestamp:[[NSDate date]
timeIntervalSinceReferenceDate]
windowNumber: 0 context:[NSApp context]
subtype: 0 data1: 0 data2:0];
[NSApp postEvent: ev atStart:NO];
//printf ("posted\n");
updateinflight = YES;
@ -207,6 +199,7 @@ void postappdefined (void)
int c_updateall;
-updateAll // when a model has been changed
{
updatecamera = updatexy = updatez = YES;
@ -270,18 +263,17 @@ instance draw the brush after each flush
[super flushWindow];
if (!running)
return self; // don't lock focus before nib is finished loading
return self; // don't lock focus before nib is
// finished loading
// if (_flushDisabled)
// return self;
[cameraview_i lockFocus];
if (clearinstance)
{
if (clearinstance) {
// XXX PSnewinstance ();
clearinstance = NO;
}
// XXX PSsetinstance (1);
linestart (0, 0, 0);
[map_i makeSelectedPerform:@selector (CameraDrawSelf)];
@ -330,12 +322,10 @@ App delegate methods
//printf ("serviced\n");
// update screen
evp = [NSApp nextEventMatchingMask: NSAnyEventMask
untilDate: [NSDate distantPast]
inMode: NSEventTrackingRunLoopMode
dequeue: NO];
if (evp)
{
evp =[NSApp nextEventMatchingMask: NSAnyEventMask untilDate:[NSDate
distantPast]
inMode: NSEventTrackingRunLoopMode dequeue:NO];
if (evp) {
postappdefined ();
return self;
}
@ -376,7 +366,8 @@ App delegate methods
[preferences_i readDefaults];
[project_i initProject];
[xyview_i setModeRadio: xy_drawmode_i]; // because xy view is inside
[xyview_i setModeRadio:xy_drawmode_i];
// because xy view is inside
// scrollview and can't be
// connected directly in IB
@ -418,22 +409,19 @@ App delegate methods
t =[[sender stringValue] cString];
if (!strcmp (t, "texname"))
{
if (!strcmp (t, "texname")) {
texturedef_t *td;
id b;
b =[map_i selectedBrush];
if (!b)
{
if (!b) {
qprintf ("nothing selected");
return self;
}
td =[b texturedef];
qprintf (td->texture);
return self;
}
else
} else
qprintf ("Unknown command\n");
return self;
}
@ -490,12 +478,9 @@ App delegate methods
-changeXYLookUp:sender
{
if ([sender intValue])
{
if ([sender intValue]) {
xy_viewnormal[2] = 1;
}
else
{
} else {
xy_viewnormal[2] = -1;
}
[self updateAll];
@ -525,8 +510,7 @@ applyRegion:
filter_entities =[filter_entities_i intValue];
filter_world =[filter_world_i intValue];
if (![regionbutton_i intValue])
{
if (![regionbutton_i intValue]) {
region_min[0] = region_min[1] = region_min[2] = -9999;
region_max[0] = region_max[1] = region_max[2] = 9999;
}
@ -544,8 +528,7 @@ applyRegion:
// get the bounds of the current selection
if ([map_i numSelected] != 1)
{
if ([map_i numSelected] != 1) {
qprintf ("must have a single brush selected");
return self;
}
@ -604,19 +587,15 @@ BSP PROCESSING
==============================================================================
*/
void ExpandCommand (char *in, char *out, char *src, char *dest)
{
while (*in)
{
if (in[0] == '$')
{
if (in[1] == '1')
void
ExpandCommand (char *in, char *out, char *src, char *dest)
{
while (*in) {
if (in[0] == '$') {
if (in[1] == '1') {
strcpy (out, src);
out += strlen (src);
}
else if (in[1] == '2')
{
} else if (in[1] == '2') {
strcpy (out, dest);
out += strlen (dest);
}
@ -634,7 +613,8 @@ void ExpandCommand (char *in, char *out, char *src, char *dest)
saveBSP
=============
*/
- saveBSP:(char *)cmdline dialog:(BOOL)wt
-saveBSP:(char *)
cmdline dialog:(BOOL) wt
{
char expandedcmd[1024];
char mappath[1024];
@ -643,12 +623,10 @@ saveBSP
int oldPathFilter;
char *destdir;
if (bsppid)
{
if (bsppid) {
NSBeep ();
return self;
}
//
// turn off the filters so all entities get saved
//
@ -658,15 +636,13 @@ saveBSP
[filter_path_i setIntValue:0];
[self applyRegion:self];
if ([regionbutton_i intValue])
{
if ([regionbutton_i intValue]) {
strcpy (mappath, filename);
// XXX StripExtension (mappath);
strcat (mappath, ".reg");
[map_i writeMapFile: mappath useRegion:YES];
wt = YES; // allways pop the dialog on region ops
}
else
} else
strcpy (mappath, filename);
// save the entire thing, just in case there is a problem
@ -699,8 +675,7 @@ saveBSP
if ([preferences_i getShowBSP])
[inspcontrol_i changeInspectorTo:i_output];
if (wt)
{
if (wt) {
id panel;
panel = NSGetAlertPanel (@"BSP In Progress",[NSString stringWithCString:expandedcmd], NULL, NULL, NULL);
@ -709,12 +684,9 @@ saveBSP
[panel release];
[self makeKeyAndOrderFront:NULL];
DisplayCmdOutput ();
}
else
{
} else {
// cmdte = DPSAddTimedEntry(1, CheckCmdDone, self, NS_BASETHRESHOLD);
if (! (bsppid = fork ()) )
{
if (!(bsppid = fork ())) {
system (expandedcmd);
exit (0);
}
@ -756,8 +728,7 @@ saveBSP
-BSP_stop:sender
{
if (!bsppid)
{
if (!bsppid) {
NSBeep ();
return self;
}
@ -806,10 +777,10 @@ open
openpanel =[NSOpenPanel new];
if ( [openpanel
runModalForDirectory: [NSString stringWithCString:[project_i getMapDirectory]]
file: @""
types: [NSArray arrayWithObjects:suffixlist count:1]] != NSOKButton)
if ([openpanel runModalForDirectory: [NSString stringWithCString:[project_i
getMapDirectory]]
file: @"" types: [NSArray arrayWithObjects: suffixlist count:1]] !=
NSOKButton)
return self;
[self doOpen:(char *)[[openpanel filename] cString]];
@ -857,7 +828,8 @@ saveAs
panel_i =[NSSavePanel new];
// XXX ExtractFileBase (filename, dir);
[panel_i setRequiredFileType:@"map"];
if ( [panel_i runModalForDirectory:[NSString stringWithCString:[project_i getMapDirectory]] file: [NSString stringWithCString:dir]] != NSOKButton)
if ([panel_i runModalForDirectory: [NSString stringWithCString: [project_i getMapDirectory]] file: [NSString stringWithCString:dir]] !=
NSOKButton)
return self;
strcpy (filename,[[panel_i filename] cString]);
@ -892,7 +864,8 @@ saveAs
if ([clipper_i hide]) // first click hides only the clipper
return[self updateAll];
[map_i setCurrentEntity: [map_i objectAtIndex: 0]]; // make world selected
[map_i setCurrentEntity: [map_i objectAtIndex:0]];
// make world selected
[map_i makeSelectedPerform:@selector (deselect)];
[self updateAll];
@ -916,8 +889,7 @@ keyDown
int ch;
// function keys
switch ([theEvent keyCode])
{
switch ([theEvent keyCode]) {
case 60: // F2
[cameraview_i setDrawMode:dr_wire];
qprintf ("wire draw mode");
@ -963,8 +935,7 @@ keyDown
// portable things
ch = tolower ([[theEvent characters] cString][0]);
switch (ch)
{
switch (ch) {
case KEY_RIGHTARROW:
case KEY_LEFTARROW:
case KEY_UPARROW:

View file

@ -13,15 +13,13 @@
#include "QuakeEd.h"
@implementation SetBrush
/*
==================
textureAxisFromPlane
==================
*/
#if 1
vec3_t baseaxis[18] =
{
vec3_t baseaxis[18] = {
{0, 0, 1}, {1, 0, 0}, {0, -1, 0}, // floor
{0, 0, -1}, {1, 0, 0}, {0, -1, 0}, // ceiling
{1, 0, 0}, {0, 1, 0}, {0, 0, -1}, // west wall
@ -30,8 +28,7 @@ vec3_t baseaxis[18] =
{0, -1, 0}, {1, 0, 0}, {0, 0, -1} // north wall
};
#else
vec3_t baseaxis[18] =
{
vec3_t baseaxis[18] = {
{0, 0, 1}, {1, 0, 0}, {0, -1, 0}, // floor
{0, 0, -1}, {1, 0, 0}, {0, 1, 0}, // ceiling
{1, 0, 0}, {0, 1, 0}, {0, 0, -1}, // west wall
@ -42,7 +39,8 @@ vec3_t baseaxis[18] =
#endif
float TextureAxisFromPlane(plane_t *pln, float *xv, float *yv)
float
TextureAxisFromPlane (plane_t *pln, float *xv, float *yv)
{
int bestaxis;
float dot, best;
@ -51,11 +49,9 @@ float TextureAxisFromPlane(plane_t *pln, float *xv, float *yv)
best = 0;
bestaxis = 0;
for (i=0 ; i<6 ; i++)
{
for (i = 0; i < 6; i++) {
dot = DotProduct (pln->normal, baseaxis[i * 3]);
if (dot > best)
{
if (dot > best) {
best = dot;
bestaxis = i;
}
@ -76,7 +72,8 @@ CheckFace
Note: this will not catch 0 area polygons
=================
*/
void CheckFace (face_t *f)
void
CheckFace (face_t * f)
{
int i, j;
float *p1, *p2;
@ -91,8 +88,7 @@ void CheckFace (face_t *f)
if (w->numpoints < 3)
Sys_Error ("CheckFace: %i points", w->numpoints);
for (i=0 ; i<w->numpoints ; i++)
{
for (i = 0; i < w->numpoints; i++) {
p1 = w->points[i];
for (j = 0; j < 3; j++)
@ -119,8 +115,7 @@ void CheckFace (face_t *f)
edgedist += ON_EPSILON;
// all other points must be on front side
for (j=0 ; j<w->numpoints ; j++)
{
for (j = 0; j < w->numpoints; j++) {
if (j == i)
continue;
d = DotProduct (w->points[j], edgenormal);
@ -145,7 +140,8 @@ void CheckFace (face_t *f)
NewWinding
==================
*/
winding_t *NewWinding (int points)
winding_t *
NewWinding (int points)
{
winding_t *w;
size_t size;
@ -166,7 +162,8 @@ winding_t *NewWinding (int points)
CopyWinding
==================
*/
winding_t *CopyWinding (winding_t *w)
winding_t *
CopyWinding (winding_t * w)
{
size_t size;
winding_t *c;
@ -186,7 +183,8 @@ Clips the winding to the plane, returning the new winding on the positive side
Frees the input winding.
==================
*/
winding_t *ClipWinding (winding_t *in, plane_t *split)
winding_t *
ClipWinding (winding_t * in, plane_t *split)
{
float dists[MAX_POINTS_ON_WINDING];
int sides[MAX_POINTS_ON_WINDING];
@ -200,8 +198,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
counts[0] = counts[1] = counts[2] = 0;
// determine sides for each point
for (i=0 ; i<in->numpoints ; i++)
{
for (i = 0; i < in->numpoints; i++) {
dot = DotProduct (in->points[i], split->normal);
dot -= split->dist;
dists[i] = dot;
@ -209,8 +206,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
sides[i] = SIDE_FRONT;
else if (dot < -ON_EPSILON)
sides[i] = SIDE_BACK;
else
{
else {
sides[i] = SIDE_ON;
}
counts[sides[i]]++;
@ -221,8 +217,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
if (!counts[0] && !counts[1])
return in;
if (!counts[0])
{
if (!counts[0]) {
free (in);
return NULL;
}
@ -233,14 +228,12 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
// of fp grouping errors
neww = NewWinding (maxpts);
for (i=0 ; i<in->numpoints ; i++)
{
for (i = 0; i < in->numpoints; i++) {
p1 = in->points[i];
mid = neww->points[neww->numpoints];
if (sides[i] == SIDE_FRONT || sides[i] == SIDE_ON)
{
if (sides[i] == SIDE_FRONT || sides[i] == SIDE_ON) {
VectorCopy (p1, mid);
mid[3] = p1[3];
mid[4] = p1[4];
@ -262,8 +255,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
neww->numpoints++;
dot = dists[i] / (dists[i] - dists[i + 1]);
for (j=0 ; j<3 ; j++)
{ // avoid round off error when possible
for (j = 0; j < 3; j++) { // avoid round off error when possible
if (split->normal[j] == 1)
mid[j] = split->dist;
else if (split->normal[j] == -1)
@ -290,7 +282,8 @@ BasePolyForPlane
There has GOT to be a better way of doing this...
=================
*/
winding_t *BasePolyForPlane (face_t *f)
winding_t *
BasePolyForPlane (face_t * f)
{
int i, x;
float max, v;
@ -308,11 +301,9 @@ winding_t *BasePolyForPlane (face_t *f)
max = -BOGUS_RANGE;
x = -1;
for (i=0 ; i<3; i++)
{
for (i = 0; i < 3; i++) {
v = fabs (p->normal[i]);
if (v > max)
{
if (v > max) {
x = i;
max = v;
}
@ -321,8 +312,7 @@ winding_t *BasePolyForPlane (face_t *f)
Sys_Error ("BasePolyForPlane: no axis found");
VectorCopy (vec3_origin, vup);
switch (x)
{
switch (x) {
case 0:
case 1:
vup[2] = 1;
@ -373,8 +363,7 @@ winding_t *BasePolyForPlane (face_t *f)
if (!td->scale[1])
td->scale[1] = 1;
for (i=0 ; i<4 ; i++)
{
for (i = 0; i < 4; i++) {
s = DotProduct (w->points[i], xaxis);
t = DotProduct (w->points[i], yaxis);
@ -413,21 +402,18 @@ can be removed.
[self freeWindings];
for (i=0 ; i<MAX_FACES ; i++)
{
for (i = 0; i < MAX_FACES; i++) {
f = &faces[i];
// calc a plane from the points
for (j=0 ; j<3 ; j++)
{
for (j = 0; j < 3; j++) {
t1[j] = f->planepts[0][j] - f->planepts[1][j];
t2[j] = f->planepts[2][j] - f->planepts[1][j];
t3[j] = f->planepts[1][j];
}
CrossProduct (t1, t2, f->plane.normal);
if (VectorCompare (f->plane.normal, vec3_origin))
{
if (VectorCompare (f->plane.normal, vec3_origin)) {
useplane[i] = NO;
break;
}
@ -437,13 +423,11 @@ can be removed.
// if the plane duplicates another plane, ignore it
// (assume it is a brush being edited that will be fixed)
useplane[i] = YES;
for (j=0 ; j< i ; j++)
{
for (j = 0; j < i; j++) {
if (f->plane.normal[0] == faces[j].plane.normal[0]
&& f->plane.normal[1] == faces[j].plane.normal[1]
&& f->plane.normal[2] == faces[j].plane.normal[2]
&& f->plane.dist == faces[j].plane.dist )
{
&& f->plane.dist == faces[j].plane.dist) {
useplane[i] = NO;
break;
}
@ -451,16 +435,14 @@ can be removed.
}
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
if (!useplane[i])
continue; // duplicate plane
f = &faces[i];
w = BasePolyForPlane (f);
for (j=0 ; j<numfaces && w ; j++)
{
for (j = 0; j < numfaces && w; j++) {
if (j == i)
continue;
@ -471,13 +453,10 @@ can be removed.
w = ClipWinding (w, &plane);
}
f->w = w;
if (w)
{
if (w) {
CheckFace (f);
for (j=0 ; j<w->numpoints ; j++)
{
for (k=0 ; k<3 ; k++)
{
for (j = 0; j < w->numpoints; j++) {
for (k = 0; k < 3; k++) {
v = w->points[j][k];
if (fabs (v - rint (v)) < FP_EPSILON)
v = w->points[j][k] = rint (v);
@ -490,8 +469,7 @@ can be removed.
}
}
if (bmins[0] == 99999)
{
if (bmins[0] == 99999) {
invalid = YES;
VectorCopy (vec3_origin, bmins);
VectorCopy (vec3_origin, bmaxs);
@ -508,7 +486,9 @@ can be removed.
initOwner:::
===========
*/
- initOwner: own mins:(float *)mins maxs:(float *)maxs texture:(texturedef_t *)tex
-initOwner: own mins:(float *)
mins maxs:(float *)
maxs texture:(texturedef_t *) tex
{
[super init];
@ -519,15 +499,14 @@ initOwner:::
return self;
}
- setMins:(float *)mins maxs:(float *)maxs
-setMins:(float *)
mins maxs:(float *) maxs
{
int i, j;
vec3_t pts[4][2];
for (i=0 ; i<3 ; i++)
{
if (maxs[i] - mins[i] <= 0)
{
for (i = 0; i < 3; i++) {
if (maxs[i] - mins[i] <= 0) {
VectorCopy (mins, bmins);
VectorCopy (maxs, bmaxs);
invalid = YES;
@ -548,8 +527,7 @@ initOwner:::
pts[3][0][0] = maxs[0];
pts[3][0][1] = mins[1];
for (i=0 ; i<4 ; i++)
{
for (i = 0; i < 4; i++) {
pts[i][0][2] = mins[2];
pts[i][1][0] = pts[i][0][0];
pts[i][1][1] = pts[i][0][1];
@ -557,8 +535,7 @@ initOwner:::
}
numfaces = 6;
for (i=0 ; i<4 ; i++)
{
for (i = 0; i < 4; i++) {
j = (i + 1) % 4;
faces[i].planepts[0][0] = pts[j][1][0];
faces[i].planepts[0][1] = pts[j][1][1];
@ -625,8 +602,7 @@ initOwner:::
int i;
for (i = 0; i < MAX_FACES; i++)
if (faces[i].w)
{
if (faces[i].w) {
free (faces[i].w);
faces[i].w = NULL;
}
@ -645,8 +621,9 @@ initOwner: fromTokens
===========
*/
int numsb;
- initFromScript: (script_t *) script owner: own
{
-initFromScript:(script_t *)
script owner:own {
face_t *f;
int i, j;
@ -663,20 +640,17 @@ int numsb;
if (!strcmp (Script_Token (script), "}"))
break;
for (i=0 ; i<3 ; i++)
{
for (i = 0; i < 3; i++) {
if (i != 0)
Script_GetToken (script, true);
if (strcmp (Script_Token (script), "("))
Sys_Error ("parsing map file");
for (j=0 ; j<3 ; j++)
{
for (j = 0; j < 3; j++) {
Script_GetToken (script, false);
f->planepts[i][j] = atoi (Script_Token (script));
}
} Script_GetToken (script, false);
Script_GetToken (script, false);
if (strcmp (Script_Token (script), ")"))
Sys_Error ("parsing map file");
}
@ -707,16 +681,13 @@ int numsb;
#define TEX_FLIPS 2
#define TEX_FLIPT 4
if (flags & TEX_FLIPAXIS)
{
if (flags & TEX_FLIPAXIS) {
f->texture.rotate = 90;
if (!(flags & TEX_FLIPT))
f->texture.scale[0] = -1;
if (flags & TEX_FLIPS)
f->texture.scale[1] = -1;
}
else
{
} else {
if (flags & TEX_FLIPS)
f->texture.scale[0] = -1;
if (flags & TEX_FLIPT)
@ -739,7 +710,8 @@ int numsb;
writeToFILE
===========
*/
- writeToFILE: (FILE *)f region: (BOOL)reg
-writeToFILE:(FILE *)
f region:(BOOL) reg
{
int i, j;
face_t *fa;
@ -750,13 +722,15 @@ writeToFILE
return self;
fprintf (f, "{\n");
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
fa = &faces[i];
for (j = 0; j < 3; j++)
fprintf (f,"( %d %d %d ) ", (int)fa->planepts[j][0], (int)fa->planepts[j][1], (int)fa->planepts[j][2]);
fprintf (f, "( %d %d %d ) ", (int) fa->planepts[j][0],
(int) fa->planepts[j][1], (int) fa->planepts[j][2]);
td = &fa->texture;
fprintf (f,"%s %d %d %d %f %f\n", td->texture, (int)td->shift[0], (int)td->shift[1], (int)td->rotate, td->scale[0], td->scale[1]);
fprintf (f, "%s %d %d %d %f %f\n", td->texture, (int) td->shift[0],
(int) td->shift[1], (int) td->rotate, td->scale[0],
td->scale[1]);
}
fprintf (f, "}\n");
@ -773,7 +747,8 @@ INTERACTION
==============================================================================
*/
- getMins: (vec3_t)mins maxs: (vec3_t)maxs
-getMins:(vec3_t)
mins maxs:(vec3_t) maxs
{
VectorCopy (bmins, mins);
VectorCopy (bmaxs, maxs);
@ -813,8 +788,7 @@ setTexturedef
{
int i;
for (i=0 ; i<MAX_FACES ; i++)
{
for (i = 0; i < MAX_FACES; i++) {
faces[i].texture = *tex;
faces[i].qtexture = NULL; // recache next render
}
@ -823,7 +797,8 @@ setTexturedef
return self;
}
- setTexturedef: (texturedef_t *)tex forFace:(int)f
-setTexturedef:(texturedef_t *)
tex forFace:(int) f
{
if ((unsigned) f > numfaces)
Sys_Error ("setTexturedef:forFace: bad face number %i", f);
@ -862,8 +837,7 @@ So created veneers don't stay around
{
int i, j;
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
if (faces[i].w)
continue;
for (j = i + 1; j < numfaces; j++)
@ -874,8 +848,7 @@ So created veneers don't stay around
for (; i < MAX_FACES; i++)
faces[i].w = NULL;
if (numfaces<4)
{
if (numfaces < 4) {
invalid = YES;
[self remove];
return nil;
@ -905,9 +878,7 @@ clipRay
===========
*/
- clipRay: (vec3_t)p1 : (vec3_t) p2
:(vec3_t)frontpoint : (int *)f_face
:(vec3_t)backpoint : (int *)b_face
-clipRay: (vec3_t) p1: (vec3_t) p2: (vec3_t) frontpoint: (int *) f_face: (vec3_t) backpoint:(int *) b_face
{
int frontface, backface;
int i, j;
@ -921,28 +892,25 @@ clipRay
backface = -2;
f = faces;
for (i=0 ; i<numfaces ; i++, f++)
{
for (i = 0; i < numfaces; i++, f++) {
if (!f->w)
continue; // clipped off plane
d1 = DotProduct (p1, f->plane.normal) - f->plane.dist;
d2 = DotProduct (p2, f->plane.normal) - f->plane.dist;
if (d1 >= 0 && d2 >= 0)
{ // the entire ray is in front of the polytope
if (d1 >= 0 && d2 >= 0) { // the entire ray is in front of the
// polytope
*f_face = -1;
*b_face = -1;
return self;
}
if (d1 > 0 && d2 < 0)
{ // new front plane
if (d1 > 0 && d2 < 0) { // new front plane
frontface = i;
m = d1 / (d1 - d2);
for (j = 0; j < 3; j++)
frontpoint[j] = p1[j] + m * (p2[j] - p1[j]);
p1 = frontpoint;
}
if (d1 < 0 && d2 > 0)
{ // new back plane
if (d1 < 0 && d2 > 0) { // new back plane
backface = i;
m = d1 / (d1 - d2);
for (j = 0; j < 3; j++)
@ -969,8 +937,7 @@ hitByRay
vec3_t frontpoint, backpoint, dir;
int frontface, backface;
if (regioned)
{
if (regioned) {
*time = -1;
*face = -1;
return self;
@ -978,16 +945,16 @@ hitByRay
[self clipRay: p1: p2: frontpoint: &frontface: backpoint:&backface];
if (frontface == -2 && backface == -2)
{ // entire ray is inside the brush, select first face
if (frontface == -2 && backface == -2) { // entire ray is inside the
// brush, select first face
*time = 0;
*face = 0;
return self;
}
if (frontface < 0)
{ // ray started inside the polytope, don't select it
if (frontface < 0) { // ray started inside the polytope,
// don't select it
*time = -1;
*face = -1;
return self;
@ -1037,8 +1004,7 @@ BOOL fakebrush;
origin[1] = (bmins[1] + bmaxs[1]) / 2;
c =[map_i count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
obj =[map_i objectAtIndex:i];
targname =[obj valueForQKey:"targetname"];
if (strcmp (targ, targname))
@ -1094,8 +1060,7 @@ BOOL fakebrush;
fakebrush = YES;
copy =[self copy];
copy =[copy addFace:&face];
if (copy)
{
if (copy) {
[copy performSelector:call];
[copy dealloc];
}
@ -1151,8 +1116,7 @@ XYDrawSelf
|| bmins[1] > xy_draw_rect.origin.y + xy_draw_rect.size.height))
return self; // off view, don't bother
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
w = faces[i].w;
if (!w)
continue;
@ -1164,12 +1128,10 @@ XYDrawSelf
XYlineto (w->points[j]);
}
if (keybrush)
{
if (keybrush) {
// angle arrow
val =[parent valueForQKey:"angle"];
if (val && val[0])
{
if (val && val[0]) {
ang = atof (val) * M_PI / 180;
if (ang > 0) // negative values are up/down flags
{
@ -1216,8 +1178,7 @@ ZDrawSelf
[zview_i addToHeightRange:bmins[2]];
[zview_i addToHeightRange:bmaxs[2]];
if (selected)
{
if (selected) {
PSmoveto (1, bmaxs[2]);
PSlineto (23, bmaxs[2]);
PSlineto (23, bmins[2]);
@ -1251,9 +1212,8 @@ ZDrawSelf
PSlineto (-8, backpoint[2]);
PSlineto (-8, frontpoint[2]);
PSsetrgbcolor (q->flatcolor.chan[0]/255.0
, q->flatcolor.chan[1]/255.0
, q->flatcolor.chan[2]/255.0);
PSsetrgbcolor (q->flatcolor.chan[0] / 255.0, q->flatcolor.chan[1] / 255.0,
q->flatcolor.chan[2] / 255.0);
PSfill ();
PSmoveto (-12, frontpoint[2]);
@ -1294,8 +1254,7 @@ CameraDrawSelf
else
linecolor (0, 0.5, 0);
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
w = faces[i].w;
if (!w)
continue;
@ -1340,8 +1299,7 @@ CameraRenderSelf
if ([self fakeBrush:@selector (CameraRenderSelf)])
return self;
// hack to draw entity boxes as single flat color
if ( ![parent modifiable] )
{
if (![parent modifiable]) {
olddraw = r_drawflat;
r_drawflat = YES;
@ -1356,9 +1314,7 @@ CameraRenderSelf
badtex.flatcolor = p;
r_drawflat = olddraw;
}
else
{
} else {
for (i = 0; i < numfaces; i++)
REN_DrawCameraFace (&faces[i]);
}
@ -1407,8 +1363,7 @@ float *controlpoints[MAX_FACES*3];
numcontrolpoints = 0;
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
if (!faces[i].w)
continue;
if (faces[i].plane.normal[2] == 1)
@ -1421,8 +1376,7 @@ float *controlpoints[MAX_FACES*3];
if (d <= 0)
continue;
for (j=0 ; j<3 ; j++)
{
for (j = 0; j < 3; j++) {
controlpoints[numcontrolpoints] = faces[i].planepts[j];
numcontrolpoints++;
}
@ -1441,8 +1395,7 @@ float *controlpoints[MAX_FACES*3];
if (![self checkModifiable])
return self;
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
if (!faces[i].w)
continue;
if (faces[i].plane.normal[2])
@ -1452,8 +1405,7 @@ float *controlpoints[MAX_FACES*3];
if (d <= 0)
continue;
for (j=0 ; j<3 ; j++)
{
for (j = 0; j < 3; j++) {
controlpoints[numcontrolpoints] = faces[i].planepts[j];
numcontrolpoints++;
}
@ -1479,8 +1431,7 @@ float *controlpoints[MAX_FACES*3];
numcontrolpoints = 0;
numdragplanes = 0;
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
dragplane[i] = NO;
if (!faces[i].w)
continue;
@ -1496,16 +1447,13 @@ float *controlpoints[MAX_FACES*3];
}
// find faces that just share an edge with a drag plane
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
f = &faces[i];
w = f->w;
if (!w)
continue;
if (dragplane[i] && numdragplanes == 1)
{
for (j=0 ; j<3 ; j++)
{
if (dragplane[i] && numdragplanes == 1) {
for (j = 0; j < 3; j++) {
controlpoints[numcontrolpoints] = faces[i].planepts[j];
numcontrolpoints++;
}
@ -1515,11 +1463,9 @@ float *controlpoints[MAX_FACES*3];
continue;
facectl = 0;
for (j=0 ; j<w->numpoints ; j++)
{
for (j = 0; j < w->numpoints; j++) {
onplane[j] = NO;
for (k=0 ; k<numfaces ; k++)
{
for (k = 0; k < numfaces; k++) {
if (!dragplane[k])
continue;
if (k == i)
@ -1539,8 +1485,7 @@ float *controlpoints[MAX_FACES*3];
// find one or two static points to go with the controlpoints
// and change the plane points
k = 0;
for (j=0 ; j<w->numpoints ; j++)
{
for (j = 0; j < w->numpoints; j++) {
if (!onplane[j])
continue;
if (facectl >= 2 && !onplane[(j + 1) % w->numpoints])
@ -1553,15 +1498,13 @@ float *controlpoints[MAX_FACES*3];
numcontrolpoints++;
k++;
if (facectl >= 2)
{
if (facectl >= 2) {
VectorCopy (w->points[(j + 1) % w->numpoints], f->planepts[k]);
controlpoints[numcontrolpoints] = f->planepts[k];
numcontrolpoints++;
k++;
}
if (facectl == 3)
{
if (facectl == 3) {
VectorCopy (w->points[(j + 2) % w->numpoints], f->planepts[k]);
controlpoints[numcontrolpoints] = f->planepts[k];
numcontrolpoints++;
@ -1571,21 +1514,18 @@ float *controlpoints[MAX_FACES*3];
}
for (; j < w->numpoints && k != 3; j++)
if (!onplane[j])
{
if (!onplane[j]) {
VectorCopy (w->points[j], f->planepts[k]);
k++;
}
for (j = 0; j < w->numpoints && k != 3; j++)
if (!onplane[j])
{
if (!onplane[j]) {
VectorCopy (w->points[j], f->planepts[k]);
k++;
}
if (k != 3)
{
if (k != 3) {
// Sys_Error ("getXYShearPoints: didn't get three points on plane");
numcontrolpoints = 0;
return self;
@ -1622,10 +1562,8 @@ Set the regioned flag based on if the object is containted in region_min/max
char *name;
// filter away entities
if (parent != [map_i objectAtIndex: 0])
{
if (filter_entities)
{
if (parent !=[map_i objectAtIndex:0]) {
if (filter_entities) {
regioned = YES;
return self;
}
@ -1633,34 +1571,27 @@ Set the regioned flag based on if the object is containted in region_min/max
name =[parent valueForQKey:"classname"];
if ((filter_light && !strncmp (name, "light", 5))
|| (filter_path && !strncmp(name,"path",4) ) )
{
|| (filter_path && !strncmp (name, "path", 4))) {
regioned = YES;
return self;
}
}
else if (filter_world)
{
} else if (filter_world) {
regioned = YES;
return self;
}
if (filter_clip_brushes && !strcasecmp(faces[0].texture.texture, "clip"))
{
if (filter_clip_brushes && !strcasecmp (faces[0].texture.texture, "clip")) {
regioned = YES;
return self;
}
if (filter_water_brushes && faces[0].texture.texture[0] == '*')
{
if (filter_water_brushes && faces[0].texture.texture[0] == '*') {
regioned = YES;
return self;
}
for (i=0 ; i<3 ; i++)
{
if (region_min[i] >= bmaxs[i] || region_max[i] <= bmins[i])
{
for (i = 0; i < 3; i++) {
if (region_min[i] >= bmaxs[i] || region_max[i] <= bmins[i]) {
if (selected)
[self deselect];
regioned = YES;
@ -1673,9 +1604,11 @@ Set the regioned flag based on if the object is containted in region_min/max
}
vec3_t select_min, select_max;
-selectPartial
{
int i;
for (i = 0; i < 3; i++)
if (select_min[i] >= bmaxs[i] || select_max[i] <= bmins[i])
return self;
@ -1686,6 +1619,7 @@ vec3_t select_min, select_max;
-selectComplete
{
int i;
for (i = 0; i < 3; i++)
if (select_min[i] > bmins[i] || select_max[i] < bmaxs[i])
return self;
@ -1697,6 +1631,7 @@ vec3_t select_min, select_max;
-regionPartial
{
int i;
for (i = 0; i < 3; i++)
if (select_min[i] >= bmaxs[i] || select_max[i] <= bmins[i])
return self;
@ -1707,6 +1642,7 @@ vec3_t select_min, select_max;
-regionComplete
{
int i;
for (i = 0; i < 3; i++)
if (select_min[i] > bmins[i] || select_max[i] < bmaxs[i])
return self;
@ -1716,6 +1652,7 @@ vec3_t select_min, select_max;
id sb_newowner;
-moveToEntity
{
id eclass;
@ -1725,8 +1662,7 @@ id sb_newowner;
parent = sb_newowner;
// hack to allow them to be copied to another map
if ( [parent respondsToSelector:@selector(valueForQKey:)])
{
if ([parent respondsToSelector: @selector (valueForQKey:)]) {
eclass =[entity_classes_i classForName: [parent valueForQKey:"classname"]];
c =[eclass drawColor];
[self setEntityColor:c];
@ -1744,9 +1680,9 @@ vec3_t sb_translate;
// move the planes
for (i = 0; i < numfaces; i++)
for (j=0 ; j<3 ; j++)
{
VectorAdd (faces[i].planepts[j], sb_translate, faces[i].planepts[j]);
for (j = 0; j < 3; j++) {
VectorAdd (faces[i].planepts[j], sb_translate,
faces[i].planepts[j]);
}
[self calcWindings];
@ -1755,6 +1691,7 @@ vec3_t sb_translate;
}
vec3_t sb_mins, sb_maxs;
-addToBBox
{
int k;
@ -1762,8 +1699,7 @@ vec3_t sb_mins, sb_maxs;
if (numfaces < 4)
return self;
for (k=0 ; k<3 ; k++)
{
for (k = 0; k < 3; k++) {
if (bmins[k] < sb_mins[k])
sb_mins[k] = bmins[k];
if (bmaxs[k] > sb_maxs[k])
@ -1808,8 +1744,7 @@ vec3_t sb_mins, sb_maxs;
-remove
{
// the last selected brush determines
if (!invalid)
{
if (!invalid) {
[map_i setCurrentMinZ:bmins[2]];
[map_i setCurrentMaxZ:bmaxs[2]];
}
@ -1823,6 +1758,7 @@ vec3_t sb_mins, sb_maxs;
vec3_t sel_x, sel_y, sel_z;
vec3_t sel_org;
-transform
{
int i, j;
@ -1830,8 +1766,7 @@ vec3_t sel_org;
float *p;
for (i = 0; i < numfaces; i++)
for (j=0 ; j<3 ; j++)
{
for (j = 0; j < 3; j++) {
p = faces[i].planepts[j];
VectorCopy (p, old);
VectorSubtract (old, sel_org, old);
@ -1846,13 +1781,13 @@ vec3_t sel_org;
return self;
}
- flipNormals // used after an inside-out transform (flip x/y/z)
-flipNormals // used after an inside-out transform
// (flip x/y/z)
{
int i;
vec3_t temp;
for (i=0 ; i<numfaces ; i++)
{
for (i = 0; i < numfaces; i++) {
VectorCopy (faces[i].planepts[0], temp);
VectorCopy (faces[i].planepts[2], faces[i].planepts[0]);
VectorCopy (temp, faces[i].planepts[2]);
@ -1886,6 +1821,7 @@ vec3_t sel_org;
float sb_floor_dir, sb_floor_dist;
-feetToFloor
{
float oldz;
@ -1907,13 +1843,10 @@ float sb_floor_dir, sb_floor_dist;
dist = frontpoint[2] - oldz;
if (sb_floor_dir == 1)
{
if (sb_floor_dir == 1) {
if (dist > 0 && dist < sb_floor_dist)
sb_floor_dist = dist;
}
else
{
} else {
if (dist < 0 && dist > sb_floor_dist)
sb_floor_dist = dist;
}
@ -1952,7 +1885,9 @@ id carve_in, carve_out;
return[self removeIfInvalid];
}
- clipByFace: (face_t *)fa front:(id *)f back:(id *)b
-clipByFace:(face_t *)
fa front:(id *)
f back:(id *) b
{
id front, back;
face_t fb;
@ -1984,16 +1919,13 @@ id carve_in, carve_out;
// check bboxes
for (i = 0; i < 3; i++)
if (bmins[i] >= carvemax[i] || bmaxs[i] <= carvemin[i])
{
if (bmins[i] >= carvemax[i] || bmaxs[i] <= carvemin[i]) {
[carve_out addObject:self];
return self;
}
// carve by the planes
back = self;
for (i=0 ; i<numcarvefaces ; i++)
{
for (i = 0; i < numcarvefaces; i++) {
[back clipByFace: &carvefaces[i] front: &front back:&back];
if (front)
[carve_out addObject:front];

View file

@ -47,9 +47,8 @@ typedef struct {
// INITIALIZING, FREEING;
- initCount: (NSUInteger)numSlots
elementSize: (NSUInteger)sizeInBytes
description: (const char*)elemDesc;
-initCount: (NSUInteger) numSlots elementSize: (NSUInteger) sizeInBytes description:(const char *)
elemDesc;
{
[super init];
numElements = numSlots;
@ -63,8 +62,7 @@ typedef struct {
-init
{
return [self initCount:1
elementSize:sizeof(id)
return[self initCount: 1 elementSize:sizeof (id)
description:@encode (id)];
}
@ -87,6 +85,7 @@ typedef struct {
-copy
{
Storage *c =[super copy];
c->dataPtr = (void *) objc_malloc (maxElements * elementSize);
memcpy (c->dataPtr, dataPtr, numElements * elementSize);
return c;
@ -107,20 +106,20 @@ typedef struct {
// MANAGING THE STORAGE CAPACITY;
static inline void _makeRoomForAnotherIfNecessary(Storage *self)
{
if (self->numElements == self->maxElements)
static inline void
_makeRoomForAnotherIfNecessary (Storage * self)
{
if (self->numElements == self->maxElements) {
self->maxElements *= 2;
self->dataPtr = (void *)
objc_realloc (self->dataPtr, self->maxElements * self->elementSize);
}
}
static inline void _shrinkIfDesired(Storage *self)
{
if (self->numElements < (self->maxElements / 2))
static inline void
_shrinkIfDesired (Storage * self)
{
if (self->numElements < (self->maxElements / 2)) {
self->maxElements /= 2;
self->dataPtr = (void *)
objc_realloc (self->dataPtr, self->maxElements * self->elementSize);
@ -129,8 +128,7 @@ static inline void _shrinkIfDesired(Storage *self)
-setAvailableCapacity:(NSUInteger) numSlots
{
if (numSlots > numElements)
{
if (numSlots > numElements) {
maxElements = numSlots;
dataPtr = (void *) objc_realloc (dataPtr, maxElements * elementSize);
}
@ -139,14 +137,12 @@ static inline void _shrinkIfDesired(Storage *self)
-setNumSlots:(NSUInteger) numSlots
{
if (numSlots > numElements)
{
if (numSlots > numElements) {
maxElements = numSlots;
dataPtr = (void *) objc_realloc (dataPtr, maxElements * elementSize);
bzero(STORAGE_NTH(numElements), (maxElements-numElements)*elementSize);
}
else if (numSlots < numElements)
{
bzero (STORAGE_NTH (numElements),
(maxElements - numElements) * elementSize);
} else if (numSlots < numElements) {
numElements = numSlots;
_shrinkIfDesired (self);
}
@ -176,7 +172,8 @@ static inline void _shrinkIfDesired(Storage *self)
return self;
}
- insertElement: (void*)anElement at: (NSUInteger)index
-insertElement:(void *)
anElement at:(NSUInteger) index
{
int i;
@ -187,8 +184,7 @@ static inline void _shrinkIfDesired(Storage *self)
memcpy (STORAGE_NTH (i + 1), STORAGE_NTH (i), elementSize);
#else
memcpy (STORAGE_NTH (index + 1),
STORAGE_NTH (index),
elementSize*(numElements-index));
STORAGE_NTH (index), elementSize * (numElements - index));
#endif
memcpy (STORAGE_NTH (i), anElement, elementSize);
numElements++;
@ -203,13 +199,10 @@ static inline void _shrinkIfDesired(Storage *self)
numElements--;
#ifndef STABLE_MEMCPY
for (i = index; i < numElements; i++)
memcpy(STORAGE_NTH(i),
STORAGE_NTH(i+1),
elementSize);
memcpy (STORAGE_NTH (i), STORAGE_NTH (i + 1), elementSize);
#else
memcpy (STORAGE_NTH (index),
STORAGE_NTH (index+1),
elementSize*(numElements-index-1));
STORAGE_NTH (index + 1), elementSize * (numElements - index - 1));
#endif
_shrinkIfDesired (self);
return self;
@ -217,15 +210,15 @@ static inline void _shrinkIfDesired(Storage *self)
-removeLastElement
{
if (numElements)
{
if (numElements) {
numElements--;
_shrinkIfDesired (self);
}
return self;
}
- replaceElementAt:(NSUInteger)index with:(void*)newElement
-replaceElementAt:(NSUInteger)
index with:(void *) newElement
{
CHECK_INDEX (index);
memcpy (STORAGE_NTH (index), newElement, elementSize);
@ -274,11 +267,11 @@ static inline void _shrinkIfDesired(Storage *self)
return[[self alloc] init];
}
+ newCount:(NSUInteger)count elementSize:(NSUInteger)sizeInBytes
+newCount:(NSUInteger)
count elementSize:(NSUInteger) sizeInBytes
description:(const char *) descriptor
{
return [[self alloc] initCount:count elementSize:sizeInBytes
description:descriptor];
return[[self alloc] initCount: count elementSize: sizeInBytes description:descriptor];
}
@end

View file

@ -21,8 +21,7 @@ id texturepalette_i;
int tex_count;
qtexture_t qtextures[MAX_TEXTURES];
typedef struct
{
typedef struct {
char name[16];
unsigned width, height;
unsigned offsets[4]; // four mip maps stored
@ -30,8 +29,7 @@ typedef struct
unsigned tex_palette[256];
unsigned badtex_d[] =
{
unsigned badtex_d[] = {
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0, 0, 0, 0, 0, 0, 0, 0,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
@ -67,20 +65,21 @@ unsigned badtex_d[] =
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}} };
/*
==============
TEX_InitPalette
==============
*/
void TEX_InitPalette (byte *pal)
void
TEX_InitPalette (byte * pal)
{
int r, g, b, v;
int i;
for (i=0 ; i<256 ; i++)
{
for (i = 0; i < 256; i++) {
r = pal[0];
g = pal[1];
b = pal[2];
@ -99,7 +98,8 @@ void TEX_InitPalette (byte *pal)
TEX_ImageFromMiptex
=================
*/
void TEX_ImageFromMiptex (miptex_t *qtex)
void
TEX_ImageFromMiptex (miptex_t *qtex)
{
NSBitmapImageRep *bm;
byte *source;
@ -112,16 +112,7 @@ void TEX_ImageFromMiptex (miptex_t *qtex)
height = LittleLong (qtex->height);
bm =[[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: NULL
pixelsWide: width
pixelsHigh: height
bitsPerSample: 8
samplesPerPixel:3
hasAlpha: NO
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: width*4
bitsPerPixel: 32];
initWithBitmapDataPlanes: NULL pixelsWide: width pixelsHigh: height bitsPerSample: 8 samplesPerPixel: 3 hasAlpha: NO isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace bytesPerRow: width * 4 bitsPerPixel:32];
dest = (unsigned *)[bm bitmapData];
count = width * height;
@ -137,8 +128,7 @@ void TEX_ImageFromMiptex (miptex_t *qtex)
tr = tg = tb = 0;
for (i=0 ; i<count ; i++)
{
for (i = 0; i < count; i++) {
dest[i] = tex_palette[source[i]];
tr += ((pixel32_t *) & dest[i])->chan[0];
tg += ((pixel32_t *) & dest[i])->chan[1];
@ -153,16 +143,14 @@ void TEX_ImageFromMiptex (miptex_t *qtex)
//=============================================================================
typedef struct
{
typedef struct {
char identification[4]; // should be WAD2 or 2DAW
int numlumps;
int infotableofs;
} wadinfo_t;
typedef struct
{
typedef struct {
int filepos;
int disksize;
int size; // uncompressed
@ -177,7 +165,8 @@ typedef struct
TEX_InitFromWad
=================
*/
void TEX_InitFromWad (char *path)
void
TEX_InitFromWad (char *path)
{
int i;
char local[1024];
@ -213,8 +202,7 @@ void TEX_InitFromWad (char *path)
Qclose (file);
wadinfo = (wadinfo_t *) wadfile;
if (strncmp ((char *)wadfile, "WAD2", 4))
{
if (strncmp ((char *) wadfile, "WAD2", 4)) {
unlink (local);
Sys_Error ("TEX_InitFromWad: %s isn't a wadfile", newpath);
}
@ -222,8 +210,7 @@ void TEX_InitFromWad (char *path)
numlumps = LittleLong (wadinfo->numlumps);
lumpinfo = (lumpinfo_t *) (wadfile + LittleLong (wadinfo->infotableofs));
if (strcmp (lumpinfo->name, "PALETTE"))
{
if (strcmp (lumpinfo->name, "PALETTE")) {
unlink (local);
Sys_Error ("TEX_InitFromWad: %s doesn't have palette as 0", path);
}
@ -231,8 +218,7 @@ void TEX_InitFromWad (char *path)
TEX_InitPalette (wadfile + LittleLong (lumpinfo->filepos));
lumpinfo++;
for (i=1 ; i<numlumps ; i++, lumpinfo++)
{
for (i = 1; i < numlumps; i++, lumpinfo++) {
if (lumpinfo->type != TYP_MIPTEX)
Sys_Error ("TEX_InitFromWad: %s is not a miptex!", lumpinfo->name);
// XXX CleanupName (lumpinfo->name,qtextures[tex_count].name);
@ -252,7 +238,8 @@ void TEX_InitFromWad (char *path)
TEX_NumForName
=================
*/
qtexture_t *TEX_ForName (char *name)
qtexture_t *
TEX_ForName (char *name)
{
// XXX char newname[16];
int i;
@ -260,8 +247,7 @@ qtexture_t *TEX_ForName (char *name)
// XXX CleanupName (name, newname);
for (i=0,q = qtextures ; i< tex_count ; i++, q++)
{
for (i = 0, q = qtextures; i < tex_count; i++, q++) {
if (!strcmp (name, q->name))
return q;
}
@ -274,7 +260,6 @@ qtexture_t *TEX_ForName (char *name)
//===========================================================================
@implementation TexturePalette
-init
{
[super init];
@ -312,14 +297,12 @@ qtexture_t *TEX_ForName (char *name)
[textureList_i empty];
else
textureList_i =[[Storage alloc]
initCount:0
elementSize:sizeof(texpal_t)
initCount: 0 elementSize:sizeof (texpal_t)
description: NULL];
// Init STORAGE
for (i = 0,q=qtextures;i < tex_count; i++,q++)
{
for (i = 0, q = qtextures; i < tex_count; i++, q++) {
t.image = q->rep;
t.r.size.width =[t.image pixelsWide];
if (t.r.size.width < 64)
@ -361,15 +344,12 @@ qtexture_t *TEX_ForName (char *name)
max =[textureList_i count];
found = 1;
while(found)
{
while (found) {
found = 0;
for (i = 0;i < max-1;i++)
{
for (i = 0; i < max - 1; i++) {
t1p =[textureList_i elementAt:i];
t2p =[textureList_i elementAt:i + 1];
if (strcmp(t1p->name,t2p->name) < 0)
{
if (strcmp (t1p->name, t2p->name) < 0) {
t1 = *t1p;
t2 = *t2p;
[textureList_i replaceElementAt: i with:&t2];
@ -403,11 +383,9 @@ qtexture_t *TEX_ForName (char *name)
b =[view bounds];
maxwidth = b.size.width;
for (i = 0;i < max; i++)
{
for (i = 0; i < max; i++) {
t =[textureList_i elementAt:i];
if (x + t->r.size.width + TEX_INDENT > maxwidth)
{
if (x + t->r.size.width + TEX_INDENT > maxwidth) {
x = TEX_INDENT;
y += maxheight;
maxheight = 0;
@ -438,14 +416,12 @@ qtexture_t *TEX_ForName (char *name)
-texturedefChanged:sender
{
if ([map_i numSelected])
{
if ( [[map_i currentEntity] modifiable] )
{
[map_i makeSelectedPerform: @selector(takeCurrentTexture)];
if ([map_i numSelected]) {
if ([[map_i currentEntity] modifiable]) {
[map_i makeSelectedPerform:@selector
(takeCurrentTexture)];
[quakeed_i updateAll];
}
else
} else
qprintf ("can't modify spawned entities");
}
[quakeed_i makeFirstResponder:quakeed_i];
@ -477,8 +453,7 @@ qtexture_t *TEX_ForName (char *name)
// wipe the fields
[self clearTexinfo:self];
if (which != selectedTexture)
{
if (which != selectedTexture) {
[textureView_i deselect];
selectedTexture = which;
t =[textureList_i elementAt:which];
@ -545,11 +520,9 @@ qtexture_t *TEX_ForName (char *name)
max =[textureList_i count];
// XXX CleanupName(name,name);
for (i = 0;i < max;i++)
{
for (i = 0; i < max; i++) {
t =[textureList_i elementAt:i];
if (!strcmp(t->name,name))
{
if (!strcmp (t->name, name)) {
[self setSelectedTexture:i];
return self;
}
@ -585,11 +558,9 @@ qtexture_t *TEX_ForName (char *name)
[sender setStringValue: [NSString stringWithCString:name]];
len = strlen (name);
for (i = selectedTexture-1;i >= 0; i--)
{
for (i = selectedTexture - 1; i >= 0; i--) {
t =[textureList_i elementAt:i];
if (!strncmp(t->name,name,len))
{
if (!strncmp (t->name, name, len)) {
[self setTextureByName:t->name];
[sender selectText:sender];
[self texturedefChanged:self];
@ -597,11 +568,9 @@ qtexture_t *TEX_ForName (char *name)
}
}
for (i = max-1;i >= selectedTexture; i--)
{
for (i = max - 1; i >= selectedTexture; i--) {
t =[textureList_i elementAt:i];
if (!strncmp(t->name,name,len))
{
if (!strncmp (t->name, name, len)) {
[self setTextureByName:t->name];
[sender selectText:sender];
[self texturedefChanged:self];
@ -636,8 +605,7 @@ qtexture_t *TEX_ForName (char *name)
//
-getTextureDef:(texturedef_t *) td
{
if (selectedTexture == -1)
{
if (selectedTexture == -1) {
memset (td, 0, sizeof (*td));
strcpy (td->texture, "notexture");
return self;
@ -659,7 +627,8 @@ qtexture_t *TEX_ForName (char *name)
//
// Change value in a field
//
- changeField:(id)field by:(int)amount
-changeField:(id)
field by:(int) amount
{
int val;
@ -680,6 +649,7 @@ qtexture_t *TEX_ForName (char *name)
[self changeField: field_Xshift_i by:8];
return self;
}
-decXShift:sender
{
[self changeField: field_Xshift_i by:-8];
@ -694,6 +664,7 @@ qtexture_t *TEX_ForName (char *name)
[self changeField: field_Yshift_i by:8];
return self;
}
-decYShift:sender
{
[self changeField: field_Yshift_i by:-8];
@ -708,6 +679,7 @@ qtexture_t *TEX_ForName (char *name)
[self changeField: field_Rotate_i by:90];
return self;
}
-decRotate:sender
{
[self changeField: field_Rotate_i by:-90];
@ -723,6 +695,7 @@ qtexture_t *TEX_ForName (char *name)
[self texturedefChanged:self];
return self;
}
-decXScale:sender
{
[field_Xscale_i setIntValue:-1];
@ -739,6 +712,7 @@ qtexture_t *TEX_ForName (char *name)
[self texturedefChanged:self];
return self;
}
-decYScale:sender
{
[field_Yscale_i setIntValue:-1];
@ -767,8 +741,7 @@ qtexture_t *TEX_ForName (char *name)
max =[textureList_i count];
strcpy (name, texture);
for (i = 0; i < max; i++)
{
for (i = 0; i < max; i++) {
t =[textureList_i elementAt:i];
if (!strcmp (t->name, name))
return i;
@ -791,30 +764,27 @@ qtexture_t *TEX_ForName (char *name)
int index;
// Turn 'em off
if ([sender intValue])
{
if ([sender intValue]) {
max =[textureList_i count];
for (i = 0; i < max; i++)
[self setDisplayFlag: i to:0];
brushes =[map_i objectAtIndex:0];
max =[brushes count];
for (i = 0;i < max; i++)
{
for (i = 0; i < max; i++) {
b = (SetBrush *)[brushes objectAtIndex:i];
numfaces =[b getNumBrushFaces];
for (j = 0; j < numfaces; j++)
{
for (j = 0; j < numfaces; j++) {
f =[b getBrushFace:j];
index = [self searchForTextureInPalette:f->texture.texture];
index =[self searchForTextureInPalette:f->texture.
texture];
if (index >= 0)
[self setDisplayFlag: index to:1];
}
}
}
// Turn 'em on
else
{
else {
max =[textureList_i count];
for (i = 0; i < max; i++)
[self setDisplayFlag: i to:1];
@ -825,7 +795,8 @@ qtexture_t *TEX_ForName (char *name)
return self;
}
- setDisplayFlag:(int)index to:(int)value
-setDisplayFlag:(int)
index to:(int) value
{
texpal_t *tp;

View file

@ -54,8 +54,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
if (!list_i) // WADfile didn't init
return self;
if (deselectIndex != -1)
{
if (deselectIndex != -1) {
t =[list_i elementAt:deselectIndex];
r = t->r;
r.origin.x -= TEX_INDENT;
@ -64,8 +63,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
r.size.height += TEX_INDENT * 2;
// XXX PSsetgray(NSGrayComponent(NS_COLORLTGRAY));
PSrectfill(r.origin.x, r.origin.y,
r.size.width, r.size.height);
PSrectfill (r.origin.x, r.origin.y, r.size.width, r.size.height);
p = t->r.origin;
p.y += TEX_SPACING;
[t->image drawAtPoint: p fromRect: r operation: NSCompositeCopy fraction:1.0];
@ -81,18 +79,14 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
max =[list_i count];
PSsetgray (0);
for (i = 0;i < max; i++)
{
for (i = 0; i < max; i++) {
t =[list_i elementAt:i];
r = t->r;
r.origin.x -= TEX_INDENT / 2;
r.size.width += TEX_INDENT;
r.origin.y += 4;
if (NSIntersectsRect(rects[0],r) == YES &&
t->display)
{
if (selected == i)
{
if (NSIntersectsRect (rects[0], r) == YES && t->display) {
if (selected == i) {
PSsetgray (1);
PSrectfill (r.origin.x, r.origin.y,
r.size.width, r.size.height);
@ -126,6 +120,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
NSPoint loc;
int i;
int max;
// int oldwindowmask;
texpal_t *t;
id list;
@ -137,12 +132,10 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
list =[parent_i getList];
max =[list count];
for (i = 0;i < max; i++)
{
for (i = 0; i < max; i++) {
t =[list elementAt:i];
r = t->r;
if (NSPointInRect(loc,r) == YES)
{
if (NSPointInRect (loc, r) == YES) {
[self deselect];
[parent_i setSelectedTexture:i];
break;

View file

@ -26,7 +26,8 @@ id things_i;
-loadEntityComment:(id) obj
{
[entity_comment_i selectAll:self];
[entity_comment_i replaceCharactersInRange:[entity_comment_i selectedRange] withString:[NSString stringWithCString:[obj comments]]];
[entity_comment_i replaceCharactersInRange: [entity_comment_i selectedRange] withString: [NSString stringWithCString:[obj
comments]]];
return self;
}
@ -85,12 +86,10 @@ id things_i;
char *path;
path = (char *)[prog_path_i stringValue];
if (!path || !path[0])
{
if (!path || !path[0]) {
path =[project_i getProgDirectory];
[prog_path_i setStringValue: [NSString stringWithCString:path]];
}
// Free all entity info in memory...
[entity_classes_i removeAllObjects];
[entity_classes_i release];
@ -152,11 +151,9 @@ id things_i;
[flags_i setAutodisplay:NO];
for (r = 0; r < 4; r++)
for (c=0 ; c<3 ; c++)
{
for (c = 0; c < 3; c++) {
cell =[flags_i cellAtRow: r column:c];
if (c < 2)
{
if (c < 2) {
flagname =[classent flagName:c * 4 + r];
[cell setTitle: [NSString stringWithCString:flagname]];
}
@ -272,8 +269,7 @@ id things_i;
flags = 0;
for (r = 0; r < 4; r++)
for (c=0 ; c<3 ; c++)
{
for (c = 0; c < 3; c++) {
cell =[flags_i cellAtRow: r column:c];
i = ([cell intValue] > 0);
flags |= (i << ((c * 4) + r));
@ -281,8 +277,7 @@ id things_i;
if (!flags)
[[map_i currentEntity] removeKeyPair:"spawnflags"];
else
{
else {
sprintf (str, "%i", flags);
[[map_i currentEntity] setKey: "spawnflags" toValue:str];
}
@ -307,12 +302,12 @@ id things_i;
max =[entity_classes_i count];
i = 0;
while(max--)
{
while (max--) {
object =[entity_classes_i objectAtIndex:i];
[matrix addRow];
cell =[matrix cellAtRow: i++ column:0];
[cell setStringValue:[NSString stringWithCString:[object classname]]];
[cell setStringValue: [NSString stringWithCString:[object
classname]]];
[cell setLeaf:YES];
[cell setLoaded:YES];
}

View file

@ -16,7 +16,8 @@
static NSZone *upZone = NULL;
NSZone *userPathZone()
NSZone *
userPathZone ()
/* Creates a unique zone for use by all user paths */
{
if (!upZone) {
@ -26,7 +27,8 @@ NSZone *userPathZone()
return upZone;
}
UserPath *newUserPath()
UserPath *
newUserPath ()
/* Creates a new User Path in the zone returned by userPathZone */
{
UserPath *up;
@ -42,7 +44,8 @@ UserPath *newUserPath()
return up;
}
void freeUserPath(UserPath *up)
void
freeUserPath (UserPath * up)
/* Frees User Path and its associated buffers */
{
free (up->points);
@ -52,7 +55,8 @@ void freeUserPath(UserPath *up)
return;
}
void growUserPath(UserPath *up)
void
growUserPath (UserPath * up)
/*
* grows the associated buffers as necessary. buffer size doubles on each
* call. You never need to call grow directly as it is called as needed by the
@ -70,7 +74,8 @@ printf ("growUserPath\n");
return;
}
void beginUserPath(UserPath *up, BOOL cache)
void
beginUserPath (UserPath * up, BOOL cache)
/*
* Call this to start generating a user path. The cache argument specifies if
* you want the user path cached at the server (i.e. dps_ucache). In either
@ -91,7 +96,8 @@ void beginUserPath(UserPath *up, BOOL cache)
return;
}
void endUserPath(UserPath *up, int op)
void
endUserPath (UserPath * up, int op)
/*
* Call this to stop filling the path. Note this does not send the userpath to
* the server -- use sendUserPath. The op argument should be one of the
@ -107,7 +113,8 @@ void endUserPath(UserPath *up, int op)
}
void UPdebug(UserPath *up, BOOL shouldPing)
void
UPdebug (UserPath * up, BOOL shouldPing)
/*
* Sets ping to YES so that after each time a user path is sent down to the
* window server, an NSPing() is sent after. The purpose is to catch PostScript
@ -121,7 +128,8 @@ void UPdebug(UserPath *up, BOOL shouldPing)
return;
}
int sendUserPath(UserPath *up)
int
sendUserPath (UserPath * up)
/*
* Call this to send the path down to the server. If ping==YES (set via
* debug:), the function will send an NSPing() after the Path. In any event,
@ -143,7 +151,6 @@ int sendUserPath(UserPath *up)
if (up->ping) {
NSPing ();
}
// NS_HANDLER
// exception = NSLocalHandler;
// NS_ENDHANDLER
@ -161,7 +168,8 @@ int sendUserPath(UserPath *up)
}
void UPmoveto(UserPath *up, float x, float y)
void
UPmoveto (UserPath * up, float x, float y)
/* adds <x y moveto> to user path and updates bounding box */
{
up->ops[up->numberOfOps++] = dps_moveto;
@ -185,7 +193,8 @@ void UPmoveto(UserPath *up, float x, float y)
}
void UPlineto(UserPath *up, float x, float y)
void
UPlineto (UserPath * up, float x, float y)
/* adds <x y lineto> to user path and updates bounding box */
{
up->ops[up->numberOfOps++] = dps_lineto;
@ -206,4 +215,3 @@ void UPlineto(UserPath *up, float x, float y)
}
return;
}

View file

@ -15,7 +15,6 @@ vec3_t xy_viewnormal; // v_forward for xy view
float xy_viewdist; // clip behind this plane
@implementation XYView
/*
==================
initWithFrame:
@ -67,12 +66,10 @@ initWithFrame:
// initialize the scroll view
scrollview_i =[[PopScrollView alloc]
initWithFrame: frameRect
button1: scalebutton_i
button2: gridbutton_i
];
initWithFrame: frameRect button1: scalebutton_i button2:gridbutton_i];
[scrollview_i setLineScroll:64];
[scrollview_i setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
[scrollview_i setAutoresizingMask:(NSViewWidthSizable |
NSViewHeightSizable)];
// link objects together
[scrollview_i setDocumentView:self];
@ -87,7 +84,9 @@ initWithFrame:
}
-setModeRadio:m
{ // this should be set from IB, but because I toss myself in a popscrollview
{ // this should be set from IB, but
// because I toss myself in a
// popscrollview
// the connection gets lost
mode_radio_i = m;
[mode_radio_i setTarget:self];
@ -119,7 +118,8 @@ initWithFrame:
/*
v
*/
- setOrigin: (NSPoint *)pt scale: (float)sc
-setOrigin:(NSPoint *)
pt scale:(float) sc
{
NSRect sframe;
NSRect newbounds;
@ -417,14 +417,12 @@ addToScrollRange::
*/
-addToScrollRange: (float) x:(float) y;
{
if (x < newrect.origin.x)
{
if (x < newrect.origin.x) {
newrect.size.width += newrect.origin.x - x;
newrect.origin.x = x;
}
if (y < newrect.origin.y)
{
if (y < newrect.origin.y) {
newrect.size.height += newrect.origin.y - y;
newrect.origin.y = y;
}
@ -462,13 +460,15 @@ superviewChanged
vec3_t cur_linecolor;
NSBezierPath *path;
void linestart (float r, float g, float b)
void
linestart (float r, float g, float b)
{
[path removeAllPoints];
VectorSet (r, g, b, cur_linecolor);
}
void lineflush (void)
void
lineflush (void)
{
if ([path isEmpty])
return;
@ -478,7 +478,8 @@ void lineflush (void)
[path removeAllPoints];
}
void linecolor (float r, float g, float b)
void
linecolor (float r, float g, float b)
{
if (cur_linecolor[0] == r && cur_linecolor[1] == g && cur_linecolor[2] == b)
return; // do nothing
@ -486,7 +487,8 @@ void linecolor (float r, float g, float b)
VectorSet (r, g, b, cur_linecolor);
}
void XYmoveto (vec3_t pt)
void
XYmoveto (vec3_t pt)
{
NSPoint point = { pt[0], pt[1] };
if ([path elementCount] > 2048)
@ -494,7 +496,8 @@ void XYmoveto (vec3_t pt)
[path moveToPoint:point];
}
void XYlineto (vec3_t pt)
void
XYlineto (vec3_t pt)
{
NSPoint point = { pt[0], pt[1] };
[path lineToPoint:point];
@ -534,8 +537,7 @@ Rect is in global world (unscaled) coordinates
// can't just divide by grid size because of negetive coordinate
// truncating direction
//
if (gridsize >= 4/scale)
{
if (gridsize >= 4 / scale) {
y = floor (bottom / gridsize);
stopy = floor (top / gridsize);
x = floor (left / gridsize);
@ -557,8 +559,7 @@ Rect is in global world (unscaled) coordinates
[path removeAllPoints];
for (; y <= stopy; y += gridsize)
if (y&63)
{
if (y & 63) {
point.x = left;
point.y = y;
[path moveToPoint:point];
@ -567,8 +568,7 @@ Rect is in global world (unscaled) coordinates
}
for (; x <= stopx; x += gridsize)
if (x&63)
{
if (x & 63) {
point.x = x;
point.y = top;
[path moveToPoint:point];
@ -580,14 +580,12 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
[path stroke];
}
//
// tiles
//
PSsetgray (0); // for text
if (scale > 4.0/64)
{
if (scale > 4.0 / 64) {
y = floor (bottom / 64);
stopy = floor (top / 64);
x = floor (left / 64);
@ -608,10 +606,8 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
[path removeAllPoints];
for ( ; y<=stopy ; y+= 64)
{
if (showcoords)
{
for (; y <= stopy; y += 64) {
if (showcoords) {
sprintf (text, "%i", y);
PSmoveto (left, y);
PSshow (text);
@ -621,10 +617,8 @@ PSsetrgbcolor (0.8,0.8,1.0); // thin grid color
[path lineToPoint:point];
}
for ( ; x<=stopx ; x+= 64)
{
if (showcoords)
{
for (; x <= stopx; x += 64) {
if (showcoords) {
sprintf (text, "%i", x);
PSmoveto (x, bottom + 2);
PSshow (text);
@ -659,7 +653,8 @@ drawWire
drawnames =[quakeed_i showNames];
if ([quakeed_i showCoordinates]) // if coords are showing, update everything
if ([quakeed_i showCoordinates]) // if coords are showing, update
// everything
{
visRect =[self visibleRect];
rects = visRect;
@ -679,12 +674,10 @@ drawWire
linestart (0, 0, 0);
c =[map_i count];
for (i=0 ; i<c ; i++)
{
for (i = 0; i < c; i++) {
ent =[map_i objectAtIndex:i];
c2 =[ent count];
for (j = c2-1 ; j >=0 ; j--)
{
for (j = c2 - 1; j >= 0; j--) {
brush =[ent objectAtIndex:j];
if ([brush selected])
continue;
@ -692,11 +685,9 @@ drawWire
continue;
[brush XYDrawSelf];
}
if (i > 0 && drawnames)
{ // draw entity names
if (i > 0 && drawnames) { // draw entity names
brush =[ent objectAtIndex:0];
if (![brush regioned])
{
if (![brush regioned]) {
[brush getMins: mins maxs:maxs];
PSmoveto (mins[0], mins[1]);
PSsetrgbcolor (0, 0, 0);
@ -737,18 +728,17 @@ drawSolid
r_origin[0] = visRect.origin.x;
r_origin[1] = visRect.origin.y;
r_origin[2] = scale/2; // using Z as a scale for the 2D projection
r_origin[2] = scale / 2; // using Z as a scale for the 2D
// projection
r_width = visRect.size.width * r_origin[2];
r_height = visRect.size.height * r_origin[2];
if (r_width != xywidth || r_height != xyheight)
{
if (r_width != xywidth || r_height != xyheight) {
xywidth = r_width;
xyheight = r_height;
if (xypicbuffer)
{
if (xypicbuffer) {
free (xypicbuffer);
free (xyzbuffer);
}
@ -774,19 +764,12 @@ drawSolid
[[self window] setBackingType:NSBackingStoreRetained];
planes[0] = (unsigned char *) r_picbuffer;
NSDrawBitmap(
visRect,
NSDrawBitmap (visRect,
r_width,
r_height,
8,
3,
32,
r_width*4,
NO,
NO,
NSCalibratedRGBColorSpace,
planes
);
32, r_width * 4, NO, NO, NSCalibratedRGBColorSpace, planes);
// NSPing ();
[[self window] setBackingType:NSBackingStoreBuffered];
@ -801,6 +784,7 @@ drawSelf
===================
*/
NSRect xy_draw_rect;
-drawSelf: (NSRect) rects:(int) rectCount
{
static float drawtime; // static to shut up compiler warning
@ -822,8 +806,7 @@ NSRect xy_draw_rect;
else
[self drawWire:rects];
if (timedrawing)
{
if (timedrawing) {
// NSPing ();
drawtime = I_FloatTime () - drawtime;
printf ("CameraView drawtime: %5.3f\n", drawtime);
@ -848,9 +831,8 @@ dragLoop:
================
*/
static NSPoint oldreletive;
- dragFrom: (NSEvent *)startevent
useGrid: (BOOL)ug
callback: (void (*) (float dx, float dy)) callback
-dragFrom: (NSEvent *) startevent useGrid: (BOOL) ug callback:(void (*)(float dx, float dy)) callback
{
NSEvent *event;
NSPoint startpt, newpt;
@ -861,27 +843,23 @@ static NSPoint oldreletive;
oldreletive.x = oldreletive.y = 0;
if (ug)
{
if (ug) {
startpt.x =[self snapToGrid:startpt.x];
startpt.y =[self snapToGrid:startpt.y];
}
while (1)
{
while (1) {
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask
| NSRightMouseUpMask | NSRightMouseDraggedMask
| NSApplicationDefinedMask;
event = [NSApp nextEventMatchingMask: eventMask
untilDate: [NSDate distantFuture]
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
event =[NSApp nextEventMatchingMask: eventMask untilDate:[NSDate
distantFuture]
inMode: NSEventTrackingRunLoopMode dequeue:YES];
if ([event type] == NSLeftMouseUp ||[event type] == NSRightMouseUp)
break;
if ([event type] == NSApplicationDefined)
{ // doesn't work. grrr.
if ([event type] == NSApplicationDefined) { // doesn't work. grrr.
// [quakeed_i applicationDefined:event];
continue;
}
@ -889,8 +867,7 @@ static NSPoint oldreletive;
newpt =[event locationInWindow];
newpt =[self convertPoint: newpt fromView:NULL];
if (ug)
{
if (ug) {
newpt.x =[self snapToGrid:newpt.x];
newpt.y =[self snapToGrid:newpt.y];
}
@ -914,7 +891,8 @@ static NSPoint oldreletive;
//============================================================================
void DragCallback (float dx, float dy)
void
DragCallback (float dx, float dy)
{
sb_translate[0] = dx;
sb_translate[1] = dy;
@ -928,9 +906,7 @@ void DragCallback (float dx, float dy)
-selectionDragFrom:(NSEvent *) theEvent
{
qprintf ("dragging selection");
[self dragFrom: theEvent
useGrid: YES
callback: DragCallback ];
[self dragFrom: theEvent useGrid: YES callback:DragCallback];
[quakeed_i updateAll];
qprintf ("");
return self;
@ -939,7 +915,8 @@ void DragCallback (float dx, float dy)
//============================================================================
void ScrollCallback (float dx, float dy)
void
ScrollCallback (float dx, float dy)
{
NSRect basebounds;
NSPoint neworg;
@ -961,9 +938,7 @@ void ScrollCallback (float dx, float dy)
-scrollDragFrom:(NSEvent *) theEvent
{
qprintf ("scrolling view");
[self dragFrom: theEvent
useGrid: YES
callback: ScrollCallback ];
[self dragFrom: theEvent useGrid: YES callback:ScrollCallback];
qprintf ("");
return self;
@ -973,7 +948,8 @@ void ScrollCallback (float dx, float dy)
vec3_t direction;
void DirectionCallback (float dx, float dy)
void
DirectionCallback (float dx, float dy)
{
vec3_t org;
float ya;
@ -1007,9 +983,7 @@ void DirectionCallback (float dx, float dy)
DirectionCallback (0, 0);
[self dragFrom: theEvent
useGrid: NO
callback: DirectionCallback ];
[self dragFrom: theEvent useGrid: NO callback:DirectionCallback];
qprintf ("");
return self;
}
@ -1019,7 +993,8 @@ void DirectionCallback (float dx, float dy)
id newbrush;
vec3_t neworg, newdrag;
void NewCallback (float dx, float dy)
void
NewCallback (float dx, float dy)
{
vec3_t min, max;
int i;
@ -1027,15 +1002,11 @@ void NewCallback (float dx, float dy)
newdrag[0] += dx;
newdrag[1] += dy;
for (i=0 ; i<3 ; i++)
{
if (neworg[i] < newdrag[i])
{
for (i = 0; i < 3; i++) {
if (neworg[i] < newdrag[i]) {
min[i] = neworg[i];
max[i] = newdrag[i];
}
else
{
} else {
min[i] = newdrag[i];
max[i] = neworg[i];
}
@ -1069,15 +1040,12 @@ void NewCallback (float dx, float dy)
[texturepalette_i getTextureDef:&td];
newbrush = [[SetBrush alloc] initOwner: owner
mins: neworg maxs: newdrag texture: &td];
newbrush =[[SetBrush alloc] initOwner: owner mins: neworg maxs: newdrag texture:&td];
[owner addObject:newbrush];
[newbrush setSelected:YES];
[self dragFrom: theEvent
useGrid: YES
callback: NewCallback ];
[self dragFrom: theEvent useGrid: YES callback:NewCallback];
[newbrush removeIfInvalid];
@ -1089,12 +1057,12 @@ void NewCallback (float dx, float dy)
//============================================================================
void ControlCallback (float dx, float dy)
void
ControlCallback (float dx, float dy)
{
int i;
for (i=0 ; i<numcontrolpoints ; i++)
{
for (i = 0; i < numcontrolpoints; i++) {
controlpoints[i][0] += dx;
controlpoints[i][1] += dy;
}
@ -1127,9 +1095,7 @@ void ControlCallback (float dx, float dy)
pt =[theEvent locationInWindow];
pt =[self convertPoint: pt fromView:NULL];
[self dragFrom: theEvent
useGrid: YES
callback: ControlCallback ];
[self dragFrom: theEvent useGrid: YES callback:ControlCallback];
[[map_i selectedBrush] removeIfInvalid];
@ -1166,12 +1132,9 @@ void ControlCallback (float dx, float dy)
VectorCopy (p1, dragpoint);
[br hitByRay: p1: p2: &time:&face];
if (time > 0)
{
if (time > 0) {
dragpoint[2] = p1[2] + (time - 0.01) * xy_viewnormal[2];
}
else
{
} else {
[br getMins: p1 maxs:p2];
dragpoint[2] = (p1[2] + p2[2]) / 2;
}
@ -1186,9 +1149,7 @@ void ControlCallback (float dx, float dy)
pt =[theEvent locationInWindow];
pt =[self convertPoint: pt fromView:NULL];
[self dragFrom: theEvent
useGrid: YES
callback: ControlCallback ];
[self dragFrom: theEvent useGrid: YES callback:ControlCallback];
[br removeIfInvalid];
@ -1227,43 +1188,39 @@ mouseDown
p1[2] = xy_viewnormal[2] * -4096;
p2[2] = xy_viewnormal[2] * 4096;
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
flags =
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
NSAlternateKeyMask | NSCommandKeyMask);
//
// shift click to select / deselect a brush from the world
//
if (flags == NSShiftKeyMask)
{
if (flags == NSShiftKeyMask) {
[map_i selectRay: p1: p2:YES];
return self;
}
//
// cmd-shift click to set a target/targetname entity connection
//
if (flags == (NSShiftKeyMask|NSCommandKeyMask) )
{
if (flags == (NSShiftKeyMask | NSCommandKeyMask)) {
[map_i entityConnect: p1:p2];
return self;
}
//
// bare click to either drag selection, or rubber band a new brush
//
if ( flags == 0 )
{
if (flags == 0) {
// if double click, position Z checker
if ([theEvent clickCount] > 1)
{
if ([theEvent clickCount] > 1) {
qprintf ("positioned Z checker");
[zview_i setPoint:&pt];
[quakeed_i newinstance];
[quakeed_i updateZ];
return self;
}
// check eye
if ( [cameraview_i XYmouseDown: &pt flags: [theEvent modifierFlags]] )
if ([cameraview_i XYmouseDown: &pt flags:[theEvent
modifierFlags]])
return self; // camera move
// check z post
@ -1283,20 +1240,17 @@ mouseDown
if (ent)
return[self selectionDragFrom:theEvent];
if ([map_i numSelected])
{
if ([map_i numSelected]) {
qprintf ("missed");
return self;
}
return[self newBrushDragFrom:theEvent];
}
//
// control click = position and drag camera
//
if (flags == NSControlKeyMask)
{
if (flags == NSControlKeyMask) {
[cameraview_i setXYOrigin:&pt];
[quakeed_i newinstance];
[cameraview_i display];
@ -1304,12 +1258,10 @@ mouseDown
qprintf ("");
return self;
}
//
// command click = drag Z checker
//
if (flags == NSCommandKeyMask)
{
if (flags == NSCommandKeyMask) {
// check single plane dragging
[self shearDragFrom:theEvent];
return self;
@ -1321,14 +1273,11 @@ return self;
qprintf ("");
return self;
}
//
// alt click = set entire brush texture
//
if (flags == NSAlternateKeyMask)
{
if (drawmode != dr_texture)
{
if (flags == NSAlternateKeyMask) {
if (drawmode != dr_texture) {
qprintf ("No texture setting except in texture mode!\n");
NopSound ();
return self;
@ -1337,14 +1286,11 @@ return self;
[quakeed_i updateAll];
return self;
}
//
// ctrl-alt click = set single face texture
//
if (flags == (NSControlKeyMask | NSAlternateKeyMask) )
{
if (drawmode != dr_texture)
{
if (flags == (NSControlKeyMask | NSAlternateKeyMask)) {
if (drawmode != dr_texture) {
qprintf ("No texture setting except in texture mode!\n");
NopSound ();
return self;
@ -1372,20 +1318,19 @@ rightMouseDown
pt =[theEvent locationInWindow];
pt =[self convertPoint: pt fromView:NULL];
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
flags =
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
NSAlternateKeyMask | NSCommandKeyMask);
if (flags == NSCommandKeyMask)
{
if (flags == NSCommandKeyMask) {
return[self scrollDragFrom:theEvent];
}
if (flags == NSAlternateKeyMask)
{
if (flags == NSAlternateKeyMask) {
return[clipper_i XYClick:pt];
}
if (flags == 0 || flags == NSControlKeyMask)
{
if (flags == 0 || flags == NSControlKeyMask) {
return[self directionDragFrom:theEvent];
}
@ -1397,4 +1342,3 @@ rightMouseDown
@end

View file

@ -1,7 +1,6 @@
#include "ZScrollView.h"
@implementation ZScrollView
/*
====================
initWithFrame: button:
@ -9,9 +8,8 @@ initWithFrame: button:
Initizes a scroll view with a button at it's lower right corner
====================
*/
- initWithFrame:(NSRect)frameRect button1:b1
{
- initWithFrame:(NSRect)
frameRect button1:b1 {
[super initWithFrame:frameRect];
[self addSubview:b1];
@ -25,17 +23,13 @@ Initizes a scroll view with a button at it's lower right corner
return self;
}
/*
================
tile
Adjust the size for the pop up scale menu
=================
*/
- tile
*/ -tile
{
NSRect scrollerframe;
@ -55,6 +49,7 @@ Adjust the size for the pop up scale menu
{
return YES;
}
/*
- superviewSizeChanged:(const NSSize *)oldSize
{
@ -68,4 +63,3 @@ Adjust the size for the pop up scale menu
@end

View file

@ -16,7 +16,6 @@ float zplanedir;
extern NSBezierPath *path;
@implementation ZView
/*
==================
initWithFrame:
@ -55,10 +54,9 @@ initWithFrame:
// initialize the scroll view
zscrollview_i =[[ZScrollView alloc]
initWithFrame: frameRect
button1: zscalebutton_i
];
[zscrollview_i setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
initWithFrame: frameRect button1:zscalebutton_i];
[zscrollview_i setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
[zscrollview_i setDocumentView:self];
RELEASE (zscrollview_i);
@ -95,7 +93,8 @@ initWithFrame:
setOrigin:scale:
===================
*/
- setOrigin: (NSPoint *)pt scale: (float)sc
-setOrigin:(NSPoint *)
pt scale:(float) sc
{
NSRect sframe;
NSRect newbounds;
@ -114,17 +113,14 @@ setOrigin:scale:
//
// union with the realbounds
//
if (newbounds.origin.y > oldminheight)
{
if (newbounds.origin.y > oldminheight) {
newbounds.size.height += newbounds.origin.y - oldminheight;
newbounds.origin.y = oldminheight;
}
if (newbounds.origin.y+newbounds.size.height < oldmaxheight)
{
if (newbounds.origin.y + newbounds.size.height < oldmaxheight) {
newbounds.size.height += oldmaxheight
- (newbounds.origin.y + newbounds.size.height);
}
//
// redisplay everything
//
@ -267,7 +263,8 @@ If realbounds has shrunk, nothing will change.
maxheight = vistop;
if (visbottom < minheight)
minheight = visbottom;
if (minheight == _bounds.origin.y && maxheight-minheight == _bounds.size.height)
if (minheight == _bounds.origin.y
&& maxheight - minheight == _bounds.size.height)
return self;
sbounds.origin.y = minheight;
@ -332,8 +329,7 @@ Rect is in global world (unscaled) coordinates
// can't just divide by grid size because of negetive coordinate
// truncating direction
//
if (gridsize>= 4/scale)
{
if (gridsize >= 4 / scale) {
y = floor (bottom / gridsize);
stopy = floor (top / gridsize);
@ -345,17 +341,14 @@ Rect is in global world (unscaled) coordinates
[path removeAllPoints];
for (; y <= stopy; y += gridsize)
if (y&31)
{
if (y & 31) {
[path moveToPoint:NSMakePoint (left, y)];
[path lineToPoint:NSMakePoint (right, y)];
}
// endUserPath (upath, dps_ustroke);
PSsetrgbcolor (0.8, 0.8, 1.0); // thin grid color
[path stroke];
}
//
// half tiles
//
@ -371,8 +364,7 @@ Rect is in global world (unscaled) coordinates
[path removeAllPoints];
for ( ; y<=stopy ; y+= 64)
{
for (; y <= stopy; y += 64) {
[path moveToPoint:NSMakePoint (left, y)];
[path lineToPoint:NSMakePoint (right, y)];
}
@ -399,10 +391,8 @@ Rect is in global world (unscaled) coordinates
GSSetFont (DEFCTXT,[NSFont fontWithName: @"Helvetica-Medium" size:10 / scale]);
PSrotate (0);
for ( ; y<=stopy ; y+= 64)
{
if (showcoords)
{
for (; y <= stopy; y += 64) {
if (showcoords) {
sprintf (text, "%i", y);
PSmoveto (left, y);
PSshow (text);
@ -413,7 +403,8 @@ Rect is in global world (unscaled) coordinates
// divider
[path moveToPoint:NSMakePoint (0, _bounds.origin.y)];
[path lineToPoint: NSMakePoint (0, _bounds.origin.y + _bounds.size.height)];
[path lineToPoint:NSMakePoint (0,
_bounds.origin.y + _bounds.size.height)];
// endUserPath (upath, dps_ustroke);
PSsetgray (10.0 / 16.0);
@ -530,9 +521,8 @@ dragLoop:
================
*/
static NSPoint oldreletive;
- dragFrom: (NSEvent *)startevent
useGrid: (BOOL)ug
callback: (void (*) (float dy)) callback
-dragFrom: (NSEvent *) startevent useGrid: (BOOL) ug callback:(void (*)(float dy)) callback
{
NSEvent *event;
NSPoint startpt, newpt;
@ -547,15 +537,13 @@ static NSPoint oldreletive;
oldreletive.x = oldreletive.y = 0;
reletive.x = 0;
while (1)
{
while (1) {
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask
| NSRightMouseUpMask | NSRightMouseDraggedMask
| NSApplicationDefinedMask;
event = [NSApp nextEventMatchingMask: eventMask
untilDate: [NSDate distantFuture]
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
event =[NSApp nextEventMatchingMask: eventMask untilDate:[NSDate
distantFuture]
inMode: NSEventTrackingRunLoopMode dequeue:YES];
if ([event type] == NSLeftMouseUp ||[event type] == NSRightMouseUp)
break;
@ -565,8 +553,8 @@ static NSPoint oldreletive;
reletive.y = newpt.y - startpt.y;
if (ug)
{ // we want truncate towards 0 behavior here
if (ug) { // we want truncate towards 0 behavior
// here
reletive.y = gridsize * (int) (reletive.y / gridsize);
}
@ -584,7 +572,8 @@ static NSPoint oldreletive;
//============================================================================
void ZDragCallback (float dy)
void
ZDragCallback (float dy)
{
sb_translate[0] = 0;
sb_translate[1] = 0;
@ -598,9 +587,7 @@ void ZDragCallback (float dy)
-selectionDragFrom:(NSEvent *) theEvent
{
qprintf ("dragging selection");
[self dragFrom: theEvent
useGrid: YES
callback: ZDragCallback ];
[self dragFrom: theEvent useGrid: YES callback:ZDragCallback];
[quakeed_i updateCamera];
qprintf ("");
return self;
@ -609,14 +596,16 @@ void ZDragCallback (float dy)
//============================================================================
void ZScrollCallback (float dy)
void
ZScrollCallback (float dy)
{
NSRect basebounds;
NSPoint neworg;
float scale;
basebounds =[[zview_i superview] bounds];
basebounds = [zview_i convertRect: basebounds fromView: [zview_i superview]];
basebounds =[zview_i convertRect: basebounds fromView:[zview_i
superview]];
neworg.y = basebounds.origin.y - dy;
@ -629,16 +618,15 @@ void ZScrollCallback (float dy)
-scrollDragFrom:(NSEvent *) theEvent
{
qprintf ("scrolling view");
[self dragFrom: theEvent
useGrid: YES
callback: ZScrollCallback ];
[self dragFrom: theEvent useGrid: YES callback:ZScrollCallback];
qprintf ("");
return self;
}
//============================================================================
void ZControlCallback (float dy)
void
ZControlCallback (float dy)
{
int i;
@ -673,9 +661,7 @@ void ZControlCallback (float dy)
pt =[theEvent locationInWindow];
pt =[self convertPoint: pt fromView:NULL];
[self dragFrom: theEvent
useGrid: YES
callback: ZControlCallback ];
[self dragFrom: theEvent useGrid: YES callback:ZControlCallback];
[[map_i selectedBrush] removeIfInvalid];
@ -705,50 +691,44 @@ mouseDown
p1[1] = origin[1];
p1[2] = pt.y;
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
flags =
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
NSAlternateKeyMask | NSCommandKeyMask);
//
// shift click to select / deselect a brush from the world
//
if (flags == NSShiftKeyMask)
{
if (flags == NSShiftKeyMask) {
[map_i selectRay: p1: p1:NO];
return;
}
//
// alt click = set entire brush texture
//
if (flags == NSAlternateKeyMask)
{
if (flags == NSAlternateKeyMask) {
[map_i setTextureRay: p1: p1:YES];
return;
}
//
// control click = position view
//
if (flags == NSControlKeyMask)
{
if (flags == NSControlKeyMask) {
[cameraview_i setZOrigin:pt.y];
[quakeed_i updateAll];
[cameraview_i ZmouseDown: &pt flags:[theEvent modifierFlags]];
return;
}
//
// bare click to drag icons or new brush drag
//
if ( flags == 0 )
{
if (flags == 0) {
// check eye
if ( [cameraview_i ZmouseDown: &pt flags:[theEvent modifierFlags]] )
if ([cameraview_i ZmouseDown: &pt flags:[theEvent
modifierFlags]])
return;
if ([map_i numSelected])
{
if ( pt.x > 0)
{
if ([map_i numSelected]) {
if (pt.x > 0) {
if ([self planeDragFrom:theEvent])
return;
}
@ -776,14 +756,15 @@ rightMouseDown
pt =[theEvent locationInWindow];
pt =[self convertPoint: pt fromView:NULL];
flags = [theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask);
flags =
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
NSAlternateKeyMask | NSCommandKeyMask);
//
// click = scroll view
//
if (flags == 0)
{
if (flags == 0) {
[self scrollDragFrom:theEvent];
}
@ -821,8 +802,7 @@ modalMoveLoop
//
goto drawentry;
while ([event type] != NSLeftMouseUp)
{
while ([event type] != NSLeftMouseUp) {
//
// calculate new point
//
@ -845,10 +825,10 @@ drawentry:
[self display];
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
event = [NSApp nextEventMatchingMask: eventMask
untilDate: [NSDate distantFuture]
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
event =[NSApp nextEventMatchingMask: eventMask untilDate:[NSDate
distantFuture]
inMode: NSEventTrackingRunLoopMode dequeue:YES];
}
//
@ -868,8 +848,7 @@ XYmouseDown
{
vec3_t movemod;
if (fabs(pt->x - origin[0]) > 16
|| fabs(pt->y - origin[1]) > 16)
if (fabs (pt->x - origin[0]) > 16 || fabs (pt->y - origin[1]) > 16)
return NO;
movemod[0] = 1;

View file

@ -6,14 +6,16 @@ boolean unget;
char *script_p;
int scriptline;
void StartTokenParsing (char *data)
void
StartTokenParsing (char *data)
{
scriptline = 1;
script_p = data;
unget = false;
}
boolean GetToken (boolean crossline)
boolean
GetToken (boolean crossline)
{
char *token_p;
@ -24,16 +26,13 @@ boolean GetToken (boolean crossline)
// skip space
//
skipspace:
while (*script_p <= 32)
{
if (!*script_p)
{
while (*script_p <= 32) {
if (!*script_p) {
if (!crossline)
Error ("Line %i is incomplete", scriptline);
return false;
}
if (*script_p++ == '\n')
{
if (*script_p++ == '\n') {
if (!crossline)
Error ("Line %i is incomplete", scriptline);
scriptline++;
@ -45,25 +44,21 @@ skipspace:
if (!crossline)
Error ("Line %i is incomplete\n", scriptline);
while (*script_p++ != '\n')
if (!*script_p)
{
if (!*script_p) {
if (!crossline)
Error ("Line %i is incomplete", scriptline);
return false;
}
goto skipspace;
}
//
// copy token
//
token_p = token;
if (*script_p == '"')
{
if (*script_p == '"') {
script_p++;
while ( *script_p != '"' )
{
while (*script_p != '"') {
if (!*script_p)
Error ("EOF inside quoted token");
*token_p++ = *script_p++;
@ -71,9 +66,8 @@ skipspace:
Error ("Token too large on line %i", scriptline);
}
script_p++;
}
else while ( *script_p > 32 )
{
} else
while (*script_p > 32) {
*token_p++ = *script_p++;
if (token_p == &token[MAXTOKEN])
Error ("Token too large on line %i", scriptline);
@ -84,7 +78,8 @@ skipspace:
return true;
}
void UngetToken ()
void
UngetToken ()
{
unget = true;
}
@ -93,7 +88,8 @@ void UngetToken ()
void qprintf (char *fmt, ...) // prints text to cmd_out_i
void
qprintf (char *fmt, ...) // prints text to cmd_out_i
{
va_list argptr;
static char string[1024];
@ -117,7 +113,8 @@ For abnormal program terminations
=================
*/
BOOL in_error;
void Error (char *error, ...)
void
Error (char *error, ...)
{
va_list argptr;
static char string[1024];
@ -133,19 +130,20 @@ void Error (char *error, ...)
strcat (string, "\nmap saved to " FN_CRASHSAVE);
[map_i writeMapFile: FN_CRASHSAVE useRegion:NO];
NSRunAlertPanel (@"Error", [NSString stringWithCString: string],NULL,NULL,NULL);
NSRunAlertPanel (@"Error",[NSString stringWithCString:string], NULL, NULL,
NULL);
[NSApp terminate:NULL];
}
void CleanupName (char *in, char *out)
void
CleanupName (char *in, char *out)
{
int i;
for (i=0 ; i< 16 ; i++ )
{
for (i = 0; i < 16; i++) {
if (!in[i])
break;
@ -157,12 +155,12 @@ void CleanupName (char *in, char *out)
}
void PrintRect (NSRect *r)
void
PrintRect (NSRect * r)
{
printf ("(%4.0f, %4.0f) + (%4.0f, %4.0f) = (%4.0f,%4.0f)\n"
,r->origin.x,r->origin.y,
r->size.width, r->size.height, r->origin.x+r->size.width,
r->origin.y+r->size.height);
printf ("(%4.0f, %4.0f) + (%4.0f, %4.0f) = (%4.0f,%4.0f)\n", r->origin.x,
r->origin.y, r->size.width, r->size.height,
r->origin.x + r->size.width, r->origin.y + r->size.height);
}
@ -173,7 +171,8 @@ FileTime
returns -1 if not present
============
*/
int FileTime (char *path)
int
FileTime (char *path)
{
struct stat buf;
@ -188,14 +187,13 @@ int FileTime (char *path)
CreatePath
============
*/
void CreatePath (char *path)
void
CreatePath (char *path)
{
char *ofs;
for (ofs = path+1 ; *ofs ; ofs++)
{
if (*ofs == '/')
{ // create the directory
for (ofs = path + 1; *ofs; ofs++) {
if (*ofs == '/') { // create the directory
*ofs = 0;
mkdir (path, 0777);
*ofs = '/';
@ -203,7 +201,8 @@ void CreatePath (char *path)
}
}
int I_FileOpenRead (char *path, int *handle)
int
I_FileOpenRead (char *path, int *handle)
{
int h;
struct stat fileinfo;
@ -220,14 +219,14 @@ int I_FileOpenRead (char *path, int *handle)
return fileinfo.st_size;
}
int I_FileOpenWrite (char *path)
int
I_FileOpenWrite (char *path)
{
int handle;
umask (0);
handle = open(path,O_RDWR | O_CREAT | O_TRUNC
, 0666);
handle = open (path, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (handle == -1)
Error ("Error opening %s: %s", path, strerror (errno));
@ -242,7 +241,8 @@ Sys_UpdateFile
Copies a more recent net file to the local drive
============
*/
void Sys_UpdateFile (char *path, char *netpath)
void
Sys_UpdateFile (char *path, char *netpath)
{
int ltime, ntime;
int in, out, size;
@ -269,5 +269,3 @@ void Sys_UpdateFile (char *path, char *netpath)
close (out);
}

View file

@ -31,7 +31,8 @@ int sy[20];
REN_ClearBuffers
====================
*/
void REN_ClearBuffers (void)
void
REN_ClearBuffers (void)
{
int size;
@ -48,7 +49,8 @@ REN_SetTexture
====================
*/
void REN_SetTexture (face_t *face)
void
REN_SetTexture (face_t * face)
{
int i;
int t_heightshift;
@ -75,16 +77,14 @@ void REN_SetTexture (face_t *face)
t_widthshift = 0;
i = t_width;
while (i >= 2)
{
while (i >= 2) {
t_widthshift++;
i >>= 1;
}
t_heightshift = 0;
i = t_width;
while (i >= 2)
{
while (i >= 2) {
t_heightshift++;
i >>= 1;
}
@ -98,7 +98,8 @@ void REN_SetTexture (face_t *face)
REN_DrawSpan
==================
*/
void REN_DrawSpan (int y)
void
REN_DrawSpan (int y)
{
int x, count;
int ofs;
@ -132,8 +133,7 @@ void REN_DrawSpan (int y)
ustep = (rightside[3] - ufrac) * scale;
vstep = (rightside[4] - vfrac) * scale;
if (x1 < 0)
{
if (x1 < 0) {
ufrac -= x1 * ustep;
vfrac -= x1 * vstep;
zfrac -= x1 * zstep;
@ -146,22 +146,17 @@ void REN_DrawSpan (int y)
ofs = y * r_width + x1;
// this should be specialized for 1.0 / 0.5 / 0.75 light levels
for (x=x1 ; x < x2 ; x++)
{
if (r_zbuffer[ofs] <= zfrac)
{
for (x = x1; x < x2; x++) {
if (r_zbuffer[ofs] <= zfrac) {
scale = 1 / zfrac;
r_zbuffer[ofs] = zfrac;
if (t_widthshift)
{
if (t_widthshift) {
tx = (int) ((ufrac * scale)) & t_widthmask;
ty = (int) ((vfrac * scale)) & t_heightmask;
in = (pixel32_t *) & t_data[(ty << t_widthshift) + tx];
}
else
{
} else {
tx = (int) ((ufrac * scale) + t_widthadd) % t_width;
ty = (int) ((vfrac * scale) + t_heightadd) % t_height;
in = (pixel32_t *) & t_data[ty * t_width + tx];
@ -190,7 +185,8 @@ void REN_DrawSpan (int y)
REN_DrawFlatSpan
==================
*/
void REN_DrawFlatSpan (int y)
void
REN_DrawFlatSpan (int y)
{
int x, count;
int ofs;
@ -212,8 +208,7 @@ void REN_DrawFlatSpan (int y)
zstep = (rightside[2] - zfrac) / count;
if (x1 < 0)
{
if (x1 < 0) {
zfrac -= x1 * zstep;
x1 = 0;
}
@ -224,10 +219,8 @@ void REN_DrawFlatSpan (int y)
ofs = y * r_width + x1;
// this should be specialized for 1.0 / 0.5 / 0.75 light levels
for (x=x1 ; x < x2 ; x++)
{
if (r_zbuffer[ofs] <= zfrac)
{
for (x = x1; x < x2; x++) {
if (r_zbuffer[ofs] <= zfrac) {
r_zbuffer[ofs] = zfrac;
out = (int *) &r_picbuffer[ofs];
*out = r_flatcolor.p;
@ -244,7 +237,8 @@ REN_RasterizeFace
=====================
*/
void REN_RasterizeFace (winding_t *w)
void
REN_RasterizeFace (winding_t * w)
{
int y;
int i;
@ -261,15 +255,13 @@ void REN_RasterizeFace (winding_t *w)
bot = 0x80000000;
leftv = 0;
for (i=0 ; i<numvertex ; i++)
{
for (i = 0; i < numvertex; i++) {
w->points[i][3] *= w->points[i][2];
w->points[i][4] *= w->points[i][2];
sy[i] = (int) w->points[i][1];
if (sy[i] < top)
{
if (sy[i] < top) {
top = sy[i];
leftv = i;
}
@ -286,12 +278,9 @@ void REN_RasterizeFace (winding_t *w)
//
y = top;
while (y < bot)
{
if (y >= sy[leftv])
{
do
{
while (y < bot) {
if (y >= sy[leftv]) {
do {
for (i = 0; i < 5; i++)
leftside[i] = w->points[leftv][i];
leftv--;
@ -302,10 +291,8 @@ void REN_RasterizeFace (winding_t *w)
for (i = 0; i < 5; i++)
leftstep[i] = (w->points[leftv][i] - leftside[i]) / count;
}
if (y >= sy[rightv])
{
do
{
if (y >= sy[rightv]) {
do {
for (i = 0; i < 5; i++)
rightside[i] = w->points[rightv][i];
rightv++;
@ -322,8 +309,7 @@ void REN_RasterizeFace (winding_t *w)
else
REN_DrawSpan (y);
for (i=0 ; i<5 ; i++)
{
for (i = 0; i < 5; i++) {
leftside[i] += leftstep[i];
rightside[i] += rightstep[i];
}
@ -339,7 +325,8 @@ void REN_RasterizeFace (winding_t *w)
REN_DrawSpanLinear
==================
*/
void REN_DrawSpanLinear (int y)
void
REN_DrawSpanLinear (int y)
{
int x, count;
int ofs;
@ -373,8 +360,7 @@ void REN_DrawSpanLinear (int y)
vstep = (rightside[4] - vfrac) * scale;
if (x1 < 0)
{
if (x1 < 0) {
ufrac -= x1 * ustep;
vfrac -= x1 * vstep;
zfrac -= x1 * zstep;
@ -386,20 +372,15 @@ void REN_DrawSpanLinear (int y)
ofs = y * r_width + x1;
for (x=x1 ; x < x2 ; x++)
{
if (r_zbuffer[ofs] <= zfrac)
{
for (x = x1; x < x2; x++) {
if (r_zbuffer[ofs] <= zfrac) {
r_zbuffer[ofs] = zfrac;
if (t_widthshift)
{
if (t_widthshift) {
tx = (int) ufrac & t_widthmask;
ty = (int) vfrac & t_heightmask;
in = (pixel32_t *) & t_data[(ty << t_widthshift) + tx];
}
else
{
} else {
tx = (int) (ufrac + t_widthadd) % t_width;
ty = (int) (vfrac + t_heightadd) % t_height;
in = (pixel32_t *) & t_data[ty * t_width + tx];
@ -422,7 +403,8 @@ REN_RasterizeFaceLinear
=====================
*/
void REN_RasterizeFaceLinear (winding_t *w)
void
REN_RasterizeFaceLinear (winding_t * w)
{
int y;
int i;
@ -439,12 +421,10 @@ void REN_RasterizeFaceLinear (winding_t *w)
bot = 0x80000000;
leftv = 0;
for (i=0 ; i<numvertex ; i++)
{
for (i = 0; i < numvertex; i++) {
sy[i] = (int) w->points[i][1];
if (sy[i] < top)
{
if (sy[i] < top) {
top = sy[i];
leftv = i;
}
@ -461,12 +441,9 @@ void REN_RasterizeFaceLinear (winding_t *w)
//
y = top;
while (y < bot)
{
if (y >= sy[leftv])
{
do
{
while (y < bot) {
if (y >= sy[leftv]) {
do {
for (i = 0; i < 5; i++)
leftside[i] = w->points[leftv][i];
leftv--;
@ -477,10 +454,8 @@ void REN_RasterizeFaceLinear (winding_t *w)
for (i = 0; i < 5; i++)
leftstep[i] = (w->points[leftv][i] - leftside[i]) / count;
}
if (y >= sy[rightv])
{
do
{
if (y >= sy[rightv]) {
do {
for (i = 0; i < 5; i++)
rightside[i] = w->points[rightv][i];
rightv++;
@ -494,8 +469,7 @@ void REN_RasterizeFaceLinear (winding_t *w)
REN_DrawSpanLinear (y);
for (i=0 ; i<5 ; i++)
{
for (i = 0; i < 5; i++) {
leftside[i] += leftstep[i];
rightside[i] += rightstep[i];
}
@ -514,7 +488,8 @@ REN_BeginCamera
float r_width_2, r_height_3;
plane_t rfrustum[5];
void REN_BeginCamera (void)
void
REN_BeginCamera (void)
{
r_width_2 = (float) r_width / 2;
r_height_3 = (float) r_height / 3;
@ -552,7 +527,8 @@ void REN_BeginCamera (void)
}
void REN_BeginXY (void)
void
REN_BeginXY (void)
{
rfrustum[0].normal[0] = 1;
rfrustum[0].normal[1] = 0;
@ -580,7 +556,8 @@ void REN_BeginXY (void)
REN_DrawCameraFace
=====================
*/
void REN_DrawCameraFace (face_t *idpol)
void
REN_DrawCameraFace (face_t * idpol)
{
int i;
float scale;
@ -607,8 +584,7 @@ void REN_DrawCameraFace (face_t *idpol)
w = NewWinding (numvertex);
w->numpoints = numvertex;
for (i=0 ; i<numvertex ; i++)
{
for (i = 0; i < numvertex; i++) {
VectorSubtract (in->points[i], r_origin, temp);
w->points[i][0] = DotProduct (temp, r_matrix[0]);
@ -622,8 +598,7 @@ void REN_DrawCameraFace (face_t *idpol)
//
// 3D clip
//
for (i=0 ; i<4 ; i++)
{
for (i = 0; i < 4; i++) {
w = ClipWinding (w, &rfrustum[i]);
if (!w)
return;
@ -632,8 +607,7 @@ void REN_DrawCameraFace (face_t *idpol)
//
// project to 2D
//
for (i=0 ; i<w->numpoints ; i++)
{
for (i = 0; i < w->numpoints; i++) {
scale = r_width_2 / w->points[i][2];
w->points[i][0] = r_width_2 + scale * w->points[i][0];
w->points[i][1] = r_height_3 - scale * w->points[i][1];
@ -656,7 +630,8 @@ void REN_DrawCameraFace (face_t *idpol)
REN_DrawXYFace
=====================
*/
void REN_DrawXYFace (face_t *idpol)
void
REN_DrawXYFace (face_t * idpol)
{
int i, j, numvertex;
winding_t *w, *in;
@ -684,11 +659,11 @@ void REN_DrawXYFace (face_t *idpol)
w = NewWinding (numvertex);
w->numpoints = numvertex;
for (i=0 ; i<numvertex ; i++)
{
for (i = 0; i < numvertex; i++) {
// using Z as a scale for the 2D projection
w->points[i][0] = (in->points[i][0] - r_origin[0]) * r_origin[2];
w->points[i][1] = r_height - (in->points[i][1] - r_origin[1])*r_origin[2];
w->points[i][1] =
r_height - (in->points[i][1] - r_origin[1]) * r_origin[2];
w->points[i][2] = in->points[i][2] + 3000;
w->points[i][3] = in->points[i][3];
w->points[i][4] = in->points[i][4];
@ -697,8 +672,7 @@ void REN_DrawXYFace (face_t *idpol)
//
// clip
//
for (i=0 ; i<4 ; i++)
{
for (i = 0; i < 4; i++) {
w = ClipWinding (w, &rfrustum[i]);
if (!w)
return;
@ -707,8 +681,7 @@ void REN_DrawXYFace (face_t *idpol)
//
// project to 2D
//
for (i=0 ; i<w->numpoints ; i++)
{
for (i = 0; i < w->numpoints; i++) {
dest = w->points[i];
if (dest[0] < 0)
dest[0] = 0;
@ -722,14 +695,11 @@ void REN_DrawXYFace (face_t *idpol)
dest[2] = 4096 - dest[2];
}
if (xy_viewnormal[2] > 0)
{ // flip order when upside down
for (i=0 ; i<w->numpoints/2 ; i++)
{
if (xy_viewnormal[2] > 0) { // flip order when upside down
for (i = 0; i < w->numpoints / 2; i++) {
dest = w->points[i];
source = w->points[w->numpoints - 1 - i];
for (j=0 ; j<5 ; j++)
{
for (j = 0; j < 5; j++) {
temp = dest[j];
dest[j] = source[j];
source[j] = temp;
@ -746,4 +716,3 @@ void REN_DrawXYFace (face_t *idpol)
REN_RasterizeFaceLinear (w);
free (w);
}