Map now compiles (but probably doesn't work: lots of warnings)

This commit is contained in:
Bill Currie 2001-02-09 06:50:40 +00:00
parent 27ed336d44
commit c1e3e1e9e7
2 changed files with 69 additions and 69 deletions

View file

@ -20,7 +20,7 @@ FILE METHODS
minz = 0; minz = 0;
maxz = 80; maxz = 80;
oldselection = [[List alloc] init]; oldselection = [[NSMutableArray alloc] init];
return self; return self;
} }
@ -30,18 +30,18 @@ FILE METHODS
int i, c; int i, c;
id o, w; id o, w;
[oldselection empty]; [oldselection removeAllObjects];
w = [self objectAt: 0]; w = [self objectAtIndex: 0];
c = [w count]; c = [w count];
sb_newowner = oldselection; sb_newowner = oldselection;
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
o = [w objectAt: 0]; o = [w objectAtIndex: 0];
if ([o selected]) if ([o selected])
[o moveToEntity]; [o moveToEntity];
else else
{ {
[w removeObjectAt: 0]; [w removeObjectAtIndex: 0];
[o free]; [o free];
} }
} }
@ -49,8 +49,8 @@ FILE METHODS
c = [self count]; c = [self count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
o = [self objectAt: 0]; o = [self objectAtIndex: 0];
[self removeObjectAt: 0]; [self removeObjectAtIndex: 0];
[o freeObjects]; [o freeObjects];
[o free]; [o free];
} }
@ -64,17 +64,17 @@ FILE METHODS
id n, w; id n, w;
c = [oldselection count]; c = [oldselection count];
w = [self objectAt: 0]; // world object w = [self objectAtIndex: 0]; // world object
sb_newowner = w; sb_newowner = w;
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
n = [oldselection objectAt:i]; n = [oldselection objectAtIndex:i];
[n moveToEntity]; [n moveToEntity];
i--; i--;
c--; c--;
} }
[oldselection empty]; [oldselection removeAllObjects];
return self; return self;
} }
@ -151,16 +151,14 @@ FILE METHODS
return self; return self;
} }
- removeObject: o - (void) removeObject: o
{ {
o = [super removeObject: o]; [super removeObject: o];
if (o == currentEntity) if (o == currentEntity)
{ // select the world { // select the world
[self setCurrentEntity: [self objectAt: 0]]; [self setCurrentEntity: [self objectAtIndex: 0]];
} }
return o;
} }
- writeStats - writeStats
@ -187,7 +185,7 @@ FILE METHODS
num = 0; num = 0;
c = [currentEntity count]; c = [currentEntity count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
if ( [[currentEntity objectAt: i] selected] ) if ( [[currentEntity objectAtIndex: i] selected] )
num++; num++;
return num; return num;
} }
@ -200,8 +198,8 @@ FILE METHODS
num = 0; num = 0;
c = [currentEntity count]; c = [currentEntity count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
if ( [[currentEntity objectAt: i] selected] ) if ( [[currentEntity objectAtIndex: i] selected] )
return [currentEntity objectAt: i]; return [currentEntity objectAtIndex: i];
return nil; return nil;
} }
@ -237,7 +235,7 @@ readMapFile
free (dat); free (dat);
[self setCurrentEntity: [self objectAt: 0]]; [self setCurrentEntity: [self objectAtIndex: 0]];
[self addSelected]; [self addSelected];
@ -258,7 +256,7 @@ readMapFile
c = [self count]; c = [self count];
for (i=1 ; i<c ; i++) for (i=1 ; i<c ; i++)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
cl = [ent valueForQKey: "classname"]; cl = [ent valueForQKey: "classname"];
if (cl && !strcasecmp (cl,"info_player_start")) if (cl && !strcasecmp (cl,"info_player_start"))
{ {
@ -290,8 +288,8 @@ writeMapFile
if (!f) if (!f)
Error ("couldn't write %s", fname); Error ("couldn't write %s", fname);
for (i=0 ; i<numElements ; i++) for (i=0 ; i<[self count] ; i++)
[[self objectAt: i] writeToFILE: f region: reg]; [[self objectAtIndex: i] writeToFILE: f region: reg];
fclose (f); fclose (f);
@ -313,7 +311,7 @@ DRAWING
count = [self count]; count = [self count];
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
[[self objectAt: i] ZDrawSelf]; [[self objectAtIndex: i] ZDrawSelf];
return self; return self;
} }
@ -325,7 +323,7 @@ DRAWING
count = [self count]; count = [self count];
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
[[self objectAt: i] RenderSelf: callback]; [[self objectAtIndex: i] RenderSelf: callback];
return self; return self;
} }
@ -347,7 +345,7 @@ make a target connection from the original entity.
id oldent, ent; id oldent, ent;
oldent = [self currentEntity]; oldent = [self currentEntity];
if (oldent == [self objectAt: 0]) if (oldent == [self objectAtIndex: 0])
{ {
qprintf ("Must have a non-world entity selected to connect"); qprintf ("Must have a non-world entity selected to connect");
return self; return self;
@ -361,7 +359,7 @@ make a target connection from the original entity.
return self; return self;
} }
if (ent == [self objectAt: 0]) if (ent == [self objectAtIndex: 0])
{ {
qprintf ("Must click on a non-world entity to connect"); qprintf ("Must click on a non-world entity to connect");
return self; return self;
@ -399,11 +397,11 @@ to intervening world brushes
c = [self count]; c = [self count];
for (i=c-1 ; i>=0 ; i--) for (i=c-1 ; i>=0 ; i--)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j=0 ; j<c2 ; j++) for (j=0 ; j<c2 ; j++)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
[brush hitByRay: p1 : p2 : &time : &face]; [brush hitByRay: p1 : p2 : &time : &face];
if (time < 0 || time >besttime) if (time < 0 || time >besttime)
continue; continue;
@ -444,12 +442,12 @@ to intervening world brushes
} }
[bestbrush setSelected: YES]; [bestbrush setSelected: YES];
qprintf ("selected entity %i brush %i face %i", [self indexOf:bestent], [bestent indexOf: bestbrush], bestface); qprintf ("selected entity %i brush %i face %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush], bestface);
} }
else else
{ {
[bestbrush setSelected: NO]; [bestbrush setSelected: NO];
qprintf ("deselected entity %i brush %i face %i", [self indexOf:bestent], [bestent indexOf: bestbrush], bestface); qprintf ("deselected entity %i brush %i face %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush], bestface);
} }
[quakeed_i reenableFlushWindow]; [quakeed_i reenableFlushWindow];
@ -480,11 +478,11 @@ Returns the brush hit, or nil if missed.
c = [self count]; c = [self count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j=0 ; j<c2 ; j++) for (j=0 ; j<c2 ; j++)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
if (![brush selected]) if (![brush selected])
continue; continue;
[brush hitByRay: p1 : p2 : &time : &face]; [brush hitByRay: p1 : p2 : &time : &face];
@ -524,11 +522,11 @@ getTextureRay
c = [self count]; c = [self count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j=0 ; j<c2 ; j++) for (j=0 ; j<c2 ; j++)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
[brush hitByRay: p1 : p2 : &time : &face]; [brush hitByRay: p1 : p2 : &time : &face];
if (time < 0 || time >besttime) if (time < 0 || time >besttime)
continue; continue;
@ -583,11 +581,11 @@ setTextureRay
c = [self count]; c = [self count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j=0 ; j<c2 ; j++) for (j=0 ; j<c2 ; j++)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
[brush hitByRay: p1 : p2 : &time : &face]; [brush hitByRay: p1 : p2 : &time : &face];
if (time < 0 || time >besttime) if (time < 0 || time >besttime)
continue; continue;
@ -622,12 +620,12 @@ setTextureRay
if (allsides) if (allsides)
{ {
[bestbrush setTexturedef: &td]; [bestbrush setTexturedef: &td];
qprintf ("textured entity %i brush %i", [self indexOf:bestent], [bestent indexOf: bestbrush]); qprintf ("textured entity %i brush %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush]);
} }
else else
{ {
[bestbrush setTexturedef: &td forFace: bestface]; [bestbrush setTexturedef: &td forFace: bestface];
qprintf ("deselected entity %i brush %i face %i", [self indexOf:bestent], [bestent indexOf: bestbrush], bestface); qprintf ("deselected entity %i brush %i face %i", [self indexOfObject:bestent], [bestent indexOfObject: bestbrush], bestface);
} }
[quakeed_i reenableFlushWindow]; [quakeed_i reenableFlushWindow];
@ -655,11 +653,11 @@ OPERATIONS ON SELECTIONS
c = [self count]; c = [self count];
for (i=c-1 ; i>=0 ; i--) for (i=c-1 ; i>=0 ; i--)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j = c2-1 ; j >=0 ; j--) for (j = c2-1 ; j >=0 ; j--)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
if (! [brush selected] ) if (! [brush selected] )
continue; continue;
if ([brush regioned]) if ([brush regioned])
@ -683,11 +681,11 @@ OPERATIONS ON SELECTIONS
c = [self count]; c = [self count];
for (i=c-1 ; i>=0 ; i--) for (i=c-1 ; i>=0 ; i--)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j = c2-1 ; j >=0 ; j--) for (j = c2-1 ; j >=0 ; j--)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
if ( [brush selected] ) if ( [brush selected] )
continue; continue;
if ([brush regioned]) if ([brush regioned])
@ -707,11 +705,11 @@ OPERATIONS ON SELECTIONS
c = [self count]; c = [self count];
for (i=c-1 ; i>=0 ; i--) for (i=c-1 ; i>=0 ; i--)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j = c2-1 ; j >=0 ; j--) for (j = c2-1 ; j >=0 ; j--)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
if ([brush regioned]) if ([brush regioned])
continue; continue;
[brush perform:sel]; [brush perform:sel];
@ -729,11 +727,11 @@ OPERATIONS ON SELECTIONS
c = [self count]; c = [self count];
for (i=c-1 ; i>=0 ; i--) for (i=c-1 ; i>=0 ; i--)
{ {
ent = [self objectAt: i]; ent = [self objectAtIndex: i];
c2 = [ent count]; c2 = [ent count];
for (j = c2-1 ; j >=0 ; j--) for (j = c2-1 ; j >=0 ; j--)
{ {
brush = [ent objectAt: j]; brush = [ent objectAtIndex: j];
[brush perform:sel]; [brush perform:sel];
} }
} }
@ -854,11 +852,11 @@ UI operations
sb_translate[2] = 0; sb_translate[2] = 0;
// copy individual brushes in the world entity // copy individual brushes in the world entity
o = [self objectAt: 0]; o = [self objectAtIndex: 0];
c = [o count]; c = [o count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
b = [o objectAt: i]; b = [o objectAtIndex: i];
if (![b selected]) if (![b selected])
continue; continue;
@ -871,11 +869,11 @@ UI operations
} }
// copy entire entities otherwise // copy entire entities otherwise
originalElements = numElements; // don't copy the new ones originalElements = [self count]; // don't copy the new ones
for (i=1 ; i<originalElements ; i++) for (i=1 ; i<originalElements ; i++)
{ {
o = [self objectAt: i]; o = [self objectAtIndex: i];
if (![[o objectAt: 0] selected]) if (![[o objectAtIndex: 0] selected])
continue; continue;
new = [o copy]; new = [o copy];
@ -883,12 +881,12 @@ UI operations
c = [o count]; c = [o count];
for (j=0 ; j<c ; j++) for (j=0 ; j<c ; j++)
[[o objectAt: j] setSelected: NO]; [[o objectAtIndex: j] setSelected: NO];
c = [new count]; c = [new count];
for (j=0 ; j<c ; j++) for (j=0 ; j<c ; j++)
{ {
b = [new objectAt: j]; b = [new objectAtIndex: j];
[b translate]; [b translate];
[b setSelected: YES]; [b setSelected: YES];
} }
@ -914,7 +912,7 @@ UI operations
o = [o parent]; o = [o parent];
c = [o count]; c = [o count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
[[o objectAt: i] setSelected: YES]; [[o objectAtIndex: i] setSelected: YES];
qprintf ("%i brushes selected", c); qprintf ("%i brushes selected", c);
[quakeed_i updateAll]; [quakeed_i updateAll];
@ -924,7 +922,7 @@ UI operations
- makeEntity: sender - makeEntity: sender
{ {
if (currentEntity != [self objectAt: 0]) if (currentEntity != [self objectAtIndex: 0])
{ {
qprintf ("ERROR: can't makeEntity inside an entity"); qprintf ("ERROR: can't makeEntity inside an entity");
NXBeep (); NXBeep ();
@ -945,7 +943,7 @@ UI operations
else else
{ // throw out seed brush and select entity fixed brush { // throw out seed brush and select entity fixed brush
[self makeSelectedPerform: @selector(remove)]; [self makeSelectedPerform: @selector(remove)];
[[sb_newowner objectAt: 0] setSelected: YES]; [[sb_newowner objectAtIndex: 0] setSelected: YES];
} }
[self addObject: sb_newowner]; [self addObject: sb_newowner];
@ -1010,8 +1008,8 @@ UI operations
mins[2] = -2048; mins[2] = -2048;
maxs[2] = 2048; maxs[2] = 2048;
b = [[SetBrush alloc] initOwner: [map_i objectAt:0] mins: mins maxs: maxs texture: &td]; b = [[SetBrush alloc] initOwner: [map_i objectAtIndex:0] mins: mins maxs: maxs texture: &td];
[[map_i objectAt: 0] addObject: b]; [[map_i objectAtIndex: 0] addObject: b];
[b setSelected: YES]; [b setSelected: YES];
[quakeed_i updateAll]; [quakeed_i updateAll];
@ -1038,8 +1036,8 @@ UI operations
mins[2] = 0; mins[2] = 0;
maxs[2] = 16; maxs[2] = 16;
b = [[SetBrush alloc] initOwner: [map_i objectAt:0] mins: mins maxs: maxs texture: &td]; b = [[SetBrush alloc] initOwner: [map_i objectAtIndex:0] mins: mins maxs: maxs texture: &td];
[[map_i objectAt: 0] addObject: b]; [[map_i objectAtIndex: 0] addObject: b];
[b setSelected: YES]; [b setSelected: YES];
[quakeed_i updateAll]; [quakeed_i updateAll];
@ -1059,15 +1057,15 @@ subtractSelection
qprintf ("performing brush subtraction..."); qprintf ("performing brush subtraction...");
sourcelist = [[List alloc] init]; sourcelist = [[NSMutableArray alloc] init];
sellist = [[List alloc] init]; sellist = [[NSMutableArray alloc] init];
carve_in = [[List alloc] init]; carve_in = [[NSMutableArray alloc] init];
carve_out = [[List alloc] init]; carve_out = [[NSMutableArray alloc] init];
c = [currentEntity count]; c = [currentEntity count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
o = [currentEntity objectAt: i]; o = [currentEntity objectAtIndex: i];
if ([o selected]) if ([o selected])
[sellist addObject: o]; [sellist addObject: o];
else else
@ -1078,24 +1076,24 @@ subtractSelection
c = [sellist count]; c = [sellist count];
for (i=0 ; i<c ; i++) for (i=0 ; i<c ; i++)
{ {
o = [sellist objectAt: i]; o = [sellist objectAtIndex: i];
[o setCarveVars]; [o setCarveVars];
c2 = [sourcelist count]; c2 = [sourcelist count];
for (j=0 ; j<c2 ; j++) for (j=0 ; j<c2 ; j++)
{ {
o2 = [sourcelist objectAt: j]; o2 = [sourcelist objectAtIndex: j];
[o2 carve]; [o2 carve];
[carve_in freeObjects]; [carve_in freeObjects];
} }
[sourcelist free]; // the individual have been moved/freed [sourcelist free]; // the individual have been moved/freed
sourcelist = carve_out; sourcelist = carve_out;
carve_out = [[List alloc] init]; carve_out = [[NSMutableArray alloc] init];
} }
// add the selection back to the remnants // add the selection back to the remnants
[currentEntity empty]; [currentEntity removeAllObjects];
[currentEntity appendList: sourcelist]; [currentEntity appendList: sourcelist];
[currentEntity appendList: sellist]; [currentEntity appendList: sellist];

View file

@ -3,6 +3,8 @@
#import <ctype.h> #import <ctype.h>
#import <sys/types.h> #import <sys/types.h>
#import <sys/dir.h> #import <sys/dir.h>
#import <sys/time.h>
#import <unistd.h>
#import "UserPath.h" #import "UserPath.h"
#import "cmdlib.h" #import "cmdlib.h"