more fix up work. Nothing totally right, yet, but getting closer.

This commit is contained in:
Bill Currie 2001-02-12 09:20:26 +00:00
parent 091e4f77b1
commit 8ad4a755a2
6 changed files with 102 additions and 102 deletions

View File

@ -45,7 +45,7 @@ winding_t *CopyWinding (winding_t *w);
winding_t *NewWinding (int points);
@interface SetBrush : Object
@interface SetBrush : NSObject <NSCopying>
{
BOOL regioned; // not active
BOOL selected;

View File

@ -211,7 +211,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
if (!counts[0])
{
free (in);
dealloc (in);
return NULL;
}
if (!counts[1])
@ -266,7 +266,7 @@ winding_t *ClipWinding (winding_t *in, plane_t *split)
Error ("ClipWinding: points exceeded estimate");
// free the original winding
free (in);
dealloc (in);
return neww;
}
@ -615,18 +615,18 @@ initOwner:::
for (i=0 ; i<MAX_FACES ; i++)
if (faces[i].w)
{
free (faces[i].w);
dealloc (faces[i].w);
faces[i].w = NULL;
}
return self;
}
- copyFromZone:(NXZone *)zone
- copyWithZone:(NSZone *)zone
{
id new;
[self freeWindings];
new = [super copyFromZone: zone];
new = [super copyWithZone: zone];
[self calcWindings];
[new calcWindings];
@ -634,10 +634,10 @@ initOwner:::
return new;
}
- free
- (void) dealloc
{
[self freeWindings];
return [super free];
return [super dealloc];
}
/*
@ -1040,12 +1040,12 @@ BOOL fakebrush;
c = [map_i count];
for (i=0 ; i<c ; i++)
{
obj = [map_i objectAt: i];
obj = [map_i objectAtIndex: i];
targname = [obj valueForQKey: "targetname"];
if (strcmp (targ, targname))
continue;
[[obj objectAt:0] getMins: min maxs: max];
[[obj objectAtIndex:0] getMins: min maxs: max];
dest[0] = (min[0] + max[0]) /2;
dest[1] = (min[1] + max[1]) /2;
@ -1098,7 +1098,7 @@ BOOL fakebrush;
if (copy)
{
[copy perform:call];
[copy free];
[copy dealloc];
}
fakebrush = NO;
return YES;
@ -1125,10 +1125,10 @@ XYDrawSelf
[xyview_i addToScrollRange: bmins[0] : bmins[1]];
[xyview_i addToScrollRange: bmaxs[0] : bmaxs[1]];
worldent = [map_i objectAt: 0];
worldent = [map_i objectAtIndex: 0];
currentent = [map_i currentEntity];
if (parent != worldent && self == [parent objectAt: 0])
if (parent != worldent && self == [parent objectAtIndex: 0])
keybrush = YES;
else
keybrush = NO;
@ -1228,7 +1228,7 @@ ZDrawSelf
PSstroke ();
}
[zview_i getPoint: (NXPoint *)p1];
[zview_i getPoint: (NSPoint *)p1];
for (i=0 ; i<2 ; i++)
if (bmins[i] >= p1[i] || bmaxs[i] <= p1[i])
@ -1283,7 +1283,7 @@ CameraDrawSelf
if ([self fakeBrush: @selector(CameraDrawSelf)])
return self;
worldent = [map_i objectAt: 0];
worldent = [map_i objectAtIndex: 0];
currentent = [map_i currentEntity];
if (parent != worldent && worldent == currentent)
@ -1623,7 +1623,7 @@ Set the regioned flag based on if the object is containted in region_min/max
char *name;
// filter away entities
if (parent != [map_i objectAt: 0])
if (parent != [map_i objectAtIndex: 0])
{
if (filter_entities)
{
@ -1816,7 +1816,7 @@ vec3_t sb_mins, sb_maxs;
}
[parent removeObject: self];
[self free];
[self dealloc];
return nil;
}

View File

@ -89,7 +89,7 @@ TEX_ImageFromMiptex
*/
void TEX_ImageFromMiptex (miptex_t *qtex)
{
NXBitmapImageRep *bm;
NSBitmapImageRep *bm;
byte *source;
unsigned *dest;
int width, height, i, count;
@ -99,19 +99,19 @@ void TEX_ImageFromMiptex (miptex_t *qtex)
width = LittleLong(qtex->width);
height = LittleLong(qtex->height);
bm = [[NXBitmapImageRep alloc]
initData: NULL
bm = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: NULL
pixelsWide: width
pixelsHigh: height
bitsPerSample: 8
samplesPerPixel:3
hasAlpha: NO
isPlanar: NO
colorSpace: NX_RGBColorSpace
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: width*4
bitsPerPixel: 32];
dest = (unsigned *)[bm data];
dest = (unsigned *)[bm bitmapData];
count = width*height;
source = (byte *)qtex + LittleLong(qtex->offsets[0]);
@ -184,7 +184,7 @@ void TEX_InitFromWad (char *path)
// free any textures
for (i=0 ; i<tex_count ; i++)
[qtextures[i].rep free];
[qtextures[i].rep dealloc];
tex_count = 0;
// try and use the cached wadfile
@ -292,7 +292,7 @@ qtexture_t *TEX_ForName (char *name)
// Create STORAGE
if (textureList_i)
[textureList_i empty];
[textureList_i removeAllObjects];
else
textureList_i = [[Storage alloc]
initCount:0
@ -349,8 +349,8 @@ qtexture_t *TEX_ForName (char *name)
found = 0;
for (i = 0;i < max-1;i++)
{
t1p = [textureList_i elementAt:i];
t2p = [textureList_i elementAt:i+1];
t1p = [textureList_i elementAtIndex:i];
t2p = [textureList_i elementAtIndex:i+1];
if (strcmp(t1p->name,t2p->name) < 0)
{
t1 = *t1p;
@ -372,7 +372,7 @@ qtexture_t *TEX_ForName (char *name)
texpal_t *t;
int y;
id view;
NXRect b;
NSRect b;
int maxwidth;
int maxheight;
NXPoint pt;
@ -388,7 +388,7 @@ qtexture_t *TEX_ForName (char *name)
for (i = 0;i < max; i++)
{
t = [textureList_i elementAt:i];
t = [textureList_i elementAtIndex:i];
if (x + t->r.size.width + TEX_INDENT > maxwidth)
{
x = TEX_INDENT;
@ -454,7 +454,7 @@ qtexture_t *TEX_ForName (char *name)
- setSelectedTexture:(int)which
{
texpal_t *t;
NXRect r;
NSRect r;
char string[16];
// wipe the fields
@ -464,7 +464,7 @@ qtexture_t *TEX_ForName (char *name)
{
[textureView_i deselect];
selectedTexture = which;
t = [textureList_i elementAt:which];
t = [textureList_i elementAtIndex:which];
r = t->r;
r.size.width += TEX_INDENT*2;
r.size.height += TEX_INDENT*2;
@ -500,7 +500,7 @@ qtexture_t *TEX_ForName (char *name)
if (selectedTexture == -1)
return -1;
t = [textureList_i elementAt:selectedTexture];
t = [textureList_i elementAtIndex:selectedTexture];
return t->index;
}
@ -513,7 +513,7 @@ qtexture_t *TEX_ForName (char *name)
if (selectedTexture == -1)
return NULL;
t = [textureList_i elementAt:selectedTexture];
t = [textureList_i elementAtIndex:selectedTexture];
return t->name;
}
@ -530,7 +530,7 @@ qtexture_t *TEX_ForName (char *name)
CleanupName(name,name);
for (i = 0;i < max;i++)
{
t = [textureList_i elementAt:i];
t = [textureList_i elementAtIndex:i];
if (!strcmp(t->name,name))
{
[self setSelectedTexture: i];
@ -568,7 +568,7 @@ qtexture_t *TEX_ForName (char *name)
for (i = selectedTexture-1;i >= 0; i--)
{
t = [textureList_i elementAt:i];
t = [textureList_i elementAtIndex:i];
if (!strncmp(t->name,name,len))
{
[self setTextureByName:t->name];
@ -580,7 +580,7 @@ qtexture_t *TEX_ForName (char *name)
for (i = max-1;i >= selectedTexture; i--)
{
t = [textureList_i elementAt:i];
t = [textureList_i elementAtIndex:i];
if (!strncmp(t->name,name,len))
{
[self setTextureByName:t->name];
@ -750,7 +750,7 @@ qtexture_t *TEX_ForName (char *name)
for (i = 0; i < max; i++)
{
t = [textureList_i elementAt:i];
t = [textureList_i elementAtIndex:i];
if (!strcmp(t->name,name))
return i;
}
@ -778,11 +778,11 @@ qtexture_t *TEX_ForName (char *name)
for (i = 0;i < max; i++)
[self setDisplayFlag:i to:0];
brushes = [map_i objectAt:0];
brushes = [map_i objectAtIndex:0];
max = [brushes count];
for (i = 0;i < max; i++)
{
b = (SetBrush *)[brushes objectAt:i];
b = (SetBrush *)[brushes objectAtIndex:i];
numfaces = [b getNumBrushFaces];
for (j = 0; j < numfaces; j++)
{
@ -810,7 +810,7 @@ qtexture_t *TEX_ForName (char *name)
{
texpal_t *tp;
tp = [textureList_i elementAt:index];
tp = [textureList_i elementAtIndex:index];
tp->display = value;
return self;
};

View File

@ -26,7 +26,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
return YES;
}
- drawSelf:(const NXRect *)rects :(int)rectCount
- drawSelf:(const NSRect *)rects :(int)rectCount
{
int i;
int max;
@ -34,8 +34,8 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
texpal_t *t;
int x;
int y;
NXPoint p;
NXRect r;
NSPoint p;
NSRect r;
int selected;
selected = [parent_i getSelectedTexture];
@ -43,7 +43,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
PSselectfont("Helvetica-Medium",FONTSIZE);
PSrotate(0);
PSsetgray(NX_LTGRAY);
PSsetgray(NSLightGray);
PSrectfill(rects->origin.x, rects->origin.y,
rects->size.width, rects->size.height);
@ -52,19 +52,19 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
if (deselectIndex != -1)
{
t = [list_i elementAt:deselectIndex];
t = [list_i elementAtIndex:deselectIndex];
r = t->r;
r.origin.x -= TEX_INDENT;
r.origin.y -= TEX_INDENT;
r.size.width += TEX_INDENT*2;
r.size.height += TEX_INDENT*2;
PSsetgray(NXGrayComponent(NX_COLORLTGRAY));
PSsetgray(NSGrayComponent(NSGray));
PSrectfill(r.origin.x, r.origin.y,
r.size.width, r.size.height);
p = t->r.origin;
p.y += TEX_SPACING;
[t->image drawAt:&p];
[t->image drawAtPoint:p];
PSsetgray(0);
x = t->r.origin.x;
y = t->r.origin.y + 7;
@ -79,12 +79,12 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
for (i = 0;i < max; i++)
{
t = [list_i elementAt:i];
t = [list_i elementAtIndex:i];
r = t->r;
r.origin.x -= TEX_INDENT/2;
r.size.width += TEX_INDENT;
r.origin.y += 4;
if (NXIntersectsRect(&rects[0],&r) == YES &&
if (NSIntersectsRect(rects[0],r) == YES &&
t->display)
{
if (selected == i)
@ -100,7 +100,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
p = t->r.origin;
p.y += TEX_SPACING;
[t->image drawAt:&p];
[t->image drawAtPoint:p];
x = t->r.origin.x;
y = t->r.origin.y + 7;
PSmoveto(x,y);
@ -117,27 +117,27 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
return self;
}
- mouseDown:(NXEvent *)theEvent
- mouseDown:(NSEvent *)theEvent
{
NXPoint loc;
NSPoint loc;
int i;
int max;
int oldwindowmask;
texpal_t *t;
id list;
NXRect r;
NSRect r;
oldwindowmask = [window addToEventMask:NX_LMOUSEDRAGGEDMASK];
loc = theEvent->location;
[self convertPoint:&loc fromView:NULL];
oldwindowmask = [[self window] addToEventMask:NSLeftMouseDraggedMask];
loc = [theEvent locationInWindow];
[self convertPoint:loc fromView:NULL];
list = [parent_i getList];
max = [list count];
for (i = 0;i < max; i++)
{
t = [list elementAt:i];
t = [list elementAtIndex:i];
r = t->r;
if (NXPointInRect(&loc,&r) == YES)
if (NSPointInRect(loc,r) == YES)
{
[self deselect];
[parent_i setSelectedTexture:i];
@ -145,7 +145,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
}
}
[window setEventMask:oldwindowmask];
[[self window] setEventMask:oldwindowmask];
return self;
}

View File

@ -33,13 +33,13 @@ id things_i;
path = [project_i getProgDirectory];
[prog_path_i setStringValue: path];
[prog_path_i setStringValue: [NSString stringWithCString:path]];
[[EntityClassList alloc] initForSourceDirectory: path];
[self loadEntityComment:[entity_classes_i objectAt:lastSelected]];
[self loadEntityComment:[entity_classes_i objectAtIndex:lastSelected]];
[entity_browser_i loadColumnZero];
[[entity_browser_i matrixInColumn:0] selectCellAt:lastSelected :0];
[[entity_browser_i matrixInColumn:0] selectCellAtRow:lastSelected column:0];
[entity_browser_i setDoubleAction: @selector(doubleClickEntity:)];
@ -52,7 +52,7 @@ id things_i;
matr = [sender matrixInColumn: 0];
lastSelected = [matr selectedRow];
[self loadEntityComment:[entity_classes_i objectAt:lastSelected]];
[self loadEntityComment:[entity_classes_i objectAtIndex:lastSelected]];
[quakeed_i makeFirstResponder: quakeed_i];
return self;
@ -67,7 +67,7 @@ id things_i;
- (char *)spawnName
{
return [[entity_classes_i objectAt:lastSelected] classname];
return [[entity_classes_i objectAtIndex:lastSelected] classname];
}
@ -83,7 +83,7 @@ id things_i;
if (!path || !path[0])
{
path = [project_i getProgDirectory];
[prog_path_i setStringValue: path];
[prog_path_i setStringValue: [NSString stringWithCString:path]];
}
// Free all entity info in memory...
@ -94,11 +94,11 @@ id things_i;
[[EntityClassList alloc] initForSourceDirectory: path];
lastSelected = 0;
ent = [entity_classes_i objectAt:lastSelected];
[self loadEntityComment:[entity_classes_i objectAt:lastSelected]];
ent = [entity_classes_i objectAtIndex:lastSelected];
[self loadEntityComment:[entity_classes_i objectAtIndex:lastSelected]];
[entity_browser_i loadColumnZero];
[[entity_browser_i matrixInColumn:0] selectCellAt:lastSelected :0];
[[entity_browser_i matrixInColumn:0] selectCellAtRow:lastSelected column:0];
[self newCurrentEntity]; // in case flags changed
@ -113,14 +113,14 @@ id things_i;
classent = [entity_classes_i classForName:class];
if (!classent)
return self;
lastSelected = [entity_classes_i indexOf: classent];
lastSelected = [entity_classes_i indexOfObject: classent];
if (lastSelected < 0)
lastSelected = 0;
[self loadEntityComment:classent];
[[entity_browser_i matrixInColumn:0] selectCellAt:lastSelected :0];
[[entity_browser_i matrixInColumn:0] scrollCellToVisible:lastSelected :0];
[[entity_browser_i matrixInColumn:0] selectCellAtRow:lastSelected column:0];
[[entity_browser_i matrixInColumn:0] scrollCellToVisibleAtRow:lastSelected column:0];
return self;
}
@ -136,7 +136,7 @@ id things_i;
ent = [map_i currentEntity];
classname = [ent valueForQKey: "classname"];
if (ent != [map_i objectAt: 0])
if (ent != [map_i objectAtIndex: 0])
[self selectClass: classname]; // don't reset for world
classent = [entity_classes_i classForName:classname];
flagname = [ent valueForQKey: "spawnflags"];
@ -149,11 +149,11 @@ id things_i;
for (r=0 ; r<4 ; r++)
for (c=0 ; c<3 ; c++)
{
cell = [flags_i cellAt: r : c];
cell = [flags_i cellAtRow: r column: c];
if (c < 2)
{
flagname = [classent flagName: c*4 + r];
[cell setTitle: flagname];
[cell setTitle: [NSString stringWithCString:flagname]];
}
[cell setIntValue: (flags & (1<< ((c*4)+r)) ) > 0];
}
@ -175,8 +175,8 @@ id things_i;
//
- setSelectedKey:(epair_t *)ep;
{
[keyInput_i setStringValue:ep->key];
[valueInput_i setStringValue:ep->value];
[keyInput_i setStringValue:[NSString stringWithCString:ep->key]];
[valueInput_i setStringValue:[NSString stringWithCString:ep->value]];
[valueInput_i selectText:self];
return self;
}
@ -269,7 +269,7 @@ id things_i;
for (r=0 ; r<4 ; r++)
for (c=0 ; c<3 ; c++)
{
cell = [flags_i cellAt: r : c];
cell = [flags_i cellAtRow: r column: c];
i = ([cell intValue] > 0);
flags |= (i<< ((c*4)+r));
}
@ -304,10 +304,10 @@ id things_i;
i = 0;
while(max--)
{
object = [entity_classes_i objectAt:i];
object = [entity_classes_i objectAtIndex:i];
[matrix addRow];
cell = [matrix cellAt:i++ :0];
[cell setStringValue:[object classname]];
cell = [matrix cellAtRow:i++ column:0];
[cell setStringValue:[NSString stringWithCString:[object classname]]];
[cell setLeaf:YES];
[cell setLoaded:YES];
}

View File

@ -8,19 +8,19 @@
*/
#import "UserPath.h"
#import <mach/mach_init.h>
#import <appkit/graphics.h>
#import <appkit/errors.h>
//#import <mach/mach_init.h>
#import <AppKit/NSGraphics.h>
//#import <AppKit/errors.h>
#import <math.h>
#import <libc.h>
//#import <libc.h>
static NXZone *upZone = NULL;
static NSZone *upZone = NULL;
NXZone *userPathZone()
NSZone *userPathZone()
/* Creates a unique zone for use by all user paths */
{
if (!upZone) {
upZone = NXCreateZone(vm_page_size, vm_page_size, 1);
upZone = NSCreateZone(vm_page_size, vm_page_size, 1);
}
return upZone;
@ -31,11 +31,11 @@ UserPath *newUserPath()
{
UserPath *up;
up = (UserPath *)NXZoneMalloc(userPathZone(), sizeof(UserPath));
up = (UserPath *)NSZoneMalloc(userPathZone(), sizeof(UserPath));
up->max = 8192; // JDC
up->points = (float *)NXZoneMalloc(userPathZone(),
up->points = (float *)NSZoneMalloc(userPathZone(),
sizeof(float) * up->max);
up->ops = (char *)NXZoneMalloc(userPathZone(),
up->ops = (char *)NSZoneMalloc(userPathZone(),
(2 + (up->max / 2)) * sizeof(char));
up->ping = NO;
@ -62,9 +62,9 @@ void growUserPath(UserPath *up)
/* double the size of the internal buffers */
printf ("growUserPath\n");
up->max *= 2;
up->points = (float *)NXZoneRealloc(userPathZone(), up->points,
up->points = (float *)NSZoneRealloc(userPathZone(), up->points,
sizeof(float) * up->max);
up->ops = (char *)NXZoneRealloc(userPathZone(), up->ops,
up->ops = (char *)NSZoneRealloc(userPathZone(), up->ops,
(2 + (up->max / 2)) * sizeof(char));
return;
@ -110,9 +110,9 @@ void endUserPath(UserPath *up, int op)
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 NXPing() is sent after. The purpose is to catch PostScript
* window server, an NSPing() is sent after. The purpose is to catch PostScript
* errors that may be generated by the user path. sendUserPath brackets the
* download and the NXPing() in an NX_DURING... NX_HANDLER construct. Normally
* download and the NSPing() in an NS_DURING... NS_HANDLER construct. Normally
* ping is NO.
*/
{
@ -124,8 +124,8 @@ void UPdebug(UserPath *up, BOOL shouldPing)
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 NXPing() after the Path. In any event,
* code is bracketed by a NX_DURING ... NX_HANDLER construct which will try to
* debug:), the function will send an NSPing() after the Path. In any event,
* code is bracketed by a NS_DURING ... NS_HANDLER construct which will try to
* catch postscript errors. If ping==NO (the default) it is unlikely to catch
* errors, with ping==YES it will. Whether you can recover or not is another
* matter. sendUserPath returns 0 on success and -1 on failure. If no previous
@ -133,22 +133,22 @@ int sendUserPath(UserPath *up)
* server.
*/
{
NXHandler exception;
NSHandler exception;
exception.code = 0;
if (up->opForUserPath != 0) {
NX_DURING
NS_DURING
DPSDoUserPath(up->points, up->numberOfPoints, dps_float, up->ops,
up->numberOfOps, up->bbox, up->opForUserPath);
if (up->ping) {
NXPing();
NSPing();
}
NX_HANDLER
exception = NXLocalHandler;
NX_ENDHANDLER
NS_HANDLER
exception = NSLocalHandler;
NS_ENDHANDLER
if (exception.code) {
NXReportError(&exception);
NSReportError(&exception);
if (exception.code == dps_err_ps) {
return -1;
}