mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Do a bit of comment cleanup.
This commit is contained in:
parent
ff41feb76e
commit
0e8d6d896f
17 changed files with 93 additions and 311 deletions
|
@ -271,14 +271,14 @@ MakeCampt (vec3_t in, campt_t * pt)
|
||||||
vec3_t temp;
|
vec3_t temp;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
// transform the points
|
// transform the points
|
||||||
VectorSubtract (in, r_origin, temp);
|
VectorSubtract (in, r_origin, temp);
|
||||||
|
|
||||||
pt->trans[0] = DotProduct (temp, r_matrix[0]);
|
pt->trans[0] = DotProduct (temp, r_matrix[0]);
|
||||||
pt->trans[1] = DotProduct (temp, r_matrix[1]);
|
pt->trans[1] = DotProduct (temp, r_matrix[1]);
|
||||||
pt->trans[2] = DotProduct (temp, r_matrix[2]);
|
pt->trans[2] = DotProduct (temp, r_matrix[2]);
|
||||||
|
|
||||||
// check clip flags
|
// check clip flags
|
||||||
if (pt->trans[2] < 1)
|
if (pt->trans[2] < 1)
|
||||||
pt->clipflags = CLIP_FRONT;
|
pt->clipflags = CLIP_FRONT;
|
||||||
else
|
else
|
||||||
|
@ -409,9 +409,7 @@ drawSolid
|
||||||
{
|
{
|
||||||
unsigned char *planes[5];
|
unsigned char *planes[5];
|
||||||
|
|
||||||
//
|
// draw it
|
||||||
// draw it
|
|
||||||
//
|
|
||||||
VectorCopy (origin, r_origin);
|
VectorCopy (origin, r_origin);
|
||||||
VectorCopy (matrix[0], r_matrix[0]);
|
VectorCopy (matrix[0], r_matrix[0]);
|
||||||
VectorCopy (matrix[1], r_matrix[1]);
|
VectorCopy (matrix[1], r_matrix[1]);
|
||||||
|
@ -427,14 +425,10 @@ drawSolid
|
||||||
REN_BeginCamera ();
|
REN_BeginCamera ();
|
||||||
REN_ClearBuffers ();
|
REN_ClearBuffers ();
|
||||||
|
|
||||||
//
|
// render the setbrushes
|
||||||
// render the setbrushes
|
|
||||||
//
|
|
||||||
[map_i makeAllPerform: @selector (CameraRenderSelf)];
|
[map_i makeAllPerform: @selector (CameraRenderSelf)];
|
||||||
|
|
||||||
//
|
// display the output
|
||||||
// display the output
|
|
||||||
//
|
|
||||||
[[self window] setBackingType: NSBackingStoreRetained];
|
[[self window] setBackingType: NSBackingStoreRetained];
|
||||||
|
|
||||||
planes[0] = (unsigned char *) imagebuffer;
|
planes[0] = (unsigned char *) imagebuffer;
|
||||||
|
@ -707,15 +701,11 @@ viewDrag:
|
||||||
NSEvent *event = 0;
|
NSEvent *event = 0;
|
||||||
NSPoint newpt;
|
NSPoint newpt;
|
||||||
|
|
||||||
//
|
// modal event loop using instance drawing
|
||||||
// modal event loop using instance drawing
|
|
||||||
//
|
|
||||||
goto drawentry;
|
goto drawentry;
|
||||||
|
|
||||||
while ([event type] != NSRightMouseUp) {
|
while ([event type] != NSRightMouseUp) {
|
||||||
//
|
|
||||||
// calculate new point
|
// calculate new point
|
||||||
//
|
|
||||||
newpt = [event locationInWindow];
|
newpt = [event locationInWindow];
|
||||||
newpt = [self convertPoint: newpt fromView: NULL];
|
newpt = [self convertPoint: newpt fromView: NULL];
|
||||||
|
|
||||||
|
@ -780,31 +770,24 @@ mouseDown
|
||||||
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
|
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
|
||||||
NSAlternateKeyMask | NSCommandKeyMask);
|
NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
//
|
// bare click to select a texture
|
||||||
// bare click to select a texture
|
|
||||||
//
|
|
||||||
if (flags == 0) {
|
if (flags == 0) {
|
||||||
[map_i getTextureRay: p1 : p2];
|
[map_i getTextureRay: p1 : p2];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
// shift click to select / deselect a brush from the world
|
||||||
// shift click to select / deselect a brush from the world
|
|
||||||
//
|
|
||||||
if (flags == NSShiftKeyMask) {
|
if (flags == NSShiftKeyMask) {
|
||||||
[map_i selectRay: p1 : p2 : NO];
|
[map_i selectRay: p1 : p2 : NO];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// cmd-shift click to set a target/targetname entity connection
|
||||||
// cmd-shift click to set a target/targetname entity connection
|
|
||||||
//
|
|
||||||
if (flags == (NSShiftKeyMask | NSCommandKeyMask)) {
|
if (flags == (NSShiftKeyMask | NSCommandKeyMask)) {
|
||||||
[map_i entityConnect: p1 : p2];
|
[map_i entityConnect: p1 : p2];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// alt click = set entire brush texture
|
// alt click = set entire brush texture
|
||||||
//
|
|
||||||
if (flags == NSAlternateKeyMask) {
|
if (flags == NSAlternateKeyMask) {
|
||||||
if (drawmode != dr_texture) {
|
if (drawmode != dr_texture) {
|
||||||
Sys_Printf ("No texture setting except in texture mode!\n");
|
Sys_Printf ("No texture setting except in texture mode!\n");
|
||||||
|
@ -815,9 +798,8 @@ mouseDown
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// ctrl-alt click = set single face texture
|
// ctrl-alt click = set single face texture
|
||||||
//
|
|
||||||
if (flags == (NSControlKeyMask | NSAlternateKeyMask)) {
|
if (flags == (NSControlKeyMask | NSAlternateKeyMask)) {
|
||||||
if (drawmode != dr_texture) {
|
if (drawmode != dr_texture) {
|
||||||
Sys_Printf ("No texture setting except in texture mode!\n");
|
Sys_Printf ("No texture setting except in texture mode!\n");
|
||||||
|
@ -853,9 +835,7 @@ rightMouseDown
|
||||||
& (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask
|
& (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask
|
||||||
| NSCommandKeyMask);
|
| NSCommandKeyMask);
|
||||||
|
|
||||||
//
|
// click = drag camera
|
||||||
// click = drag camera
|
|
||||||
//
|
|
||||||
if (flags == 0) {
|
if (flags == 0) {
|
||||||
Sys_Printf ("looking\n");
|
Sys_Printf ("looking\n");
|
||||||
[self viewDrag: &pt];
|
[self viewDrag: &pt];
|
||||||
|
|
|
@ -91,7 +91,7 @@ XYClick
|
||||||
new[1] = [xyview_i snapToGrid: pt.y];
|
new[1] = [xyview_i snapToGrid: pt.y];
|
||||||
new[2] = [map_i currentMinZ];
|
new[2] = [map_i currentMinZ];
|
||||||
|
|
||||||
// see if a point is allready there
|
// see if a point is allready there
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
if (new[0] == pos[i][0] && new[1] == pos[i][1]) {
|
if (new[0] == pos[i][0] && new[1] == pos[i][1]) {
|
||||||
if (pos[i][2] == [map_i currentMinZ])
|
if (pos[i][2] == [map_i currentMinZ])
|
||||||
|
|
|
@ -71,9 +71,6 @@ JDC
|
||||||
//
|
//
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
//
|
|
||||||
// Write a { } block out to a FILE*
|
|
||||||
//
|
|
||||||
- (id) writeBlockTo: (FILE *)fp
|
- (id) writeBlockTo: (FILE *)fp
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
|
@ -85,9 +82,6 @@ JDC
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Write a single { } block out
|
|
||||||
//
|
|
||||||
- (id) writeFile: (const char *)path
|
- (id) writeFile: (const char *)path
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -112,9 +106,7 @@ JDC
|
||||||
//
|
//
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
//
|
|
||||||
// Change a keyword's string
|
// Change a keyword's string
|
||||||
//
|
|
||||||
- (id) changeStringFor: (const char *)key to: (const char *)value
|
- (id) changeStringFor: (const char *)key to: (const char *)value
|
||||||
{
|
{
|
||||||
PL_D_AddObject (plist, key, PL_NewString (value));
|
PL_D_AddObject (plist, key, PL_NewString (value));
|
||||||
|
@ -130,9 +122,7 @@ JDC
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Search for keyword, return the string *
|
// Search for keyword, return the string *
|
||||||
//
|
|
||||||
- (const char *) getStringFor: (const char *)name
|
- (const char *) getStringFor: (const char *)name
|
||||||
{
|
{
|
||||||
plitem_t *item;
|
plitem_t *item;
|
||||||
|
@ -144,17 +134,13 @@ JDC
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Search for keyword, return the value
|
// Search for keyword, return the value
|
||||||
//
|
|
||||||
- (unsigned int) getValueFor: (const char *)name
|
- (unsigned int) getValueFor: (const char *)name
|
||||||
{
|
{
|
||||||
return atol ([self getStringFor: name]);
|
return atol ([self getStringFor: name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return # of units in keyword's value
|
// Return # of units in keyword's value
|
||||||
//
|
|
||||||
- (int) getValueUnits: (const char *)key
|
- (int) getValueUnits: (const char *)key
|
||||||
{
|
{
|
||||||
plitem_t *item;
|
plitem_t *item;
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
#include "THING+NSArray.m"
|
#include "THING+NSArray.m"
|
||||||
|
|
||||||
@implementation DictList
|
@implementation DictList
|
||||||
//
|
|
||||||
// Read in variable # of objects from FILE *
|
// Read in variable # of objects from FILE *
|
||||||
//
|
|
||||||
- (id) initListFromFile: (FILE *)fp
|
- (id) initListFromFile: (FILE *)fp
|
||||||
{
|
{
|
||||||
id d;
|
id d;
|
||||||
|
@ -24,9 +23,7 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Write out list file
|
// Write out list file
|
||||||
//
|
|
||||||
- (id) writeListFile: (const char *)filename
|
- (id) writeListFile: (const char *)filename
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -47,9 +44,7 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Find the keyword in all the Dict objects
|
// Find the keyword in all the Dict objects
|
||||||
//
|
|
||||||
- (id) findDictKeyword: (const char *)key
|
- (id) findDictKeyword: (const char *)key
|
||||||
{
|
{
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
|
@ -25,7 +25,7 @@ vec3_t bad_maxs = {8, 8, 8};
|
||||||
id new;
|
id new;
|
||||||
texturedef_t td;
|
texturedef_t td;
|
||||||
|
|
||||||
// get class
|
// get class
|
||||||
new = [entity_classes_i classForName: [self valueForQKey: "classname"]];
|
new = [entity_classes_i classForName: [self valueForQKey: "classname"]];
|
||||||
if (new) {
|
if (new) {
|
||||||
v = [new mins];
|
v = [new mins];
|
||||||
|
@ -349,7 +349,7 @@ int nument;
|
||||||
|
|
||||||
nument++;
|
nument++;
|
||||||
|
|
||||||
// get class
|
// get class
|
||||||
spawn = [self valueForQKey: "classname"];
|
spawn = [self valueForQKey: "classname"];
|
||||||
eclass = [entity_classes_i classForName: spawn];
|
eclass = [entity_classes_i classForName: spawn];
|
||||||
|
|
||||||
|
|
|
@ -90,11 +90,11 @@ parse_vector (script_t * script, vec3_t vec)
|
||||||
while (Script_TokenAvailable (script, 0))
|
while (Script_TokenAvailable (script, 0))
|
||||||
Script_GetToken (script, 0);
|
Script_GetToken (script, 0);
|
||||||
|
|
||||||
// find the length until close comment
|
// 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
|
// copy the comment block out
|
||||||
len = t - text;
|
len = t - text;
|
||||||
comments = malloc (len + 1);
|
comments = malloc (len + 1);
|
||||||
memcpy (comments, text, len);
|
memcpy (comments, text, len);
|
||||||
|
|
|
@ -82,18 +82,14 @@ InspectorControl *inspcontrol_i;
|
||||||
[self setCurrentInspector: i_project];
|
[self setCurrentInspector: i_project];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Sent by the PopUpList in the Inspector
|
// Sent by the PopUpList in the Inspector
|
||||||
// Each cell in the PopUpList must have the correct tag
|
// Each cell in the PopUpList must have the correct tag
|
||||||
//
|
|
||||||
- (IBAction) changeInspector: sender
|
- (IBAction) changeInspector: sender
|
||||||
{
|
{
|
||||||
[self setCurrentInspector: [sender selectedTag]];
|
[self setCurrentInspector: [sender selectedTag]];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Change to specific Inspector
|
// Change to specific Inspector
|
||||||
//
|
|
||||||
- (void) setCurrentInspector: (insp_e)which
|
- (void) setCurrentInspector: (insp_e)which
|
||||||
{
|
{
|
||||||
id newView;
|
id newView;
|
||||||
|
|
|
@ -756,7 +756,7 @@ sel_identity (void)
|
||||||
Sys_Printf ("can't modify spawned entities\n");
|
Sys_Printf ("can't modify spawned entities\n");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
// find an origin to apply the transformation to
|
// find an origin to apply the transformation to
|
||||||
sb_mins[0] = sb_mins[1] = sb_mins[2] = 99999;
|
sb_mins[0] = sb_mins[1] = sb_mins[2] = 99999;
|
||||||
sb_maxs[0] = sb_maxs[1] = sb_maxs[2] = -99999;
|
sb_maxs[0] = sb_maxs[1] = sb_maxs[2] = -99999;
|
||||||
[self makeSelectedPerform: @selector (addToBBox)];
|
[self makeSelectedPerform: @selector (addToBBox)];
|
||||||
|
@ -764,7 +764,7 @@ sel_identity (void)
|
||||||
sel_org[1] = [xyview_i snapToGrid: (sb_mins[1] + sb_maxs[1]) / 2];
|
sel_org[1] = [xyview_i snapToGrid: (sb_mins[1] + sb_maxs[1]) / 2];
|
||||||
sel_org[2] = [xyview_i snapToGrid: (sb_mins[2] + sb_maxs[2]) / 2];
|
sel_org[2] = [xyview_i snapToGrid: (sb_mins[2] + sb_maxs[2]) / 2];
|
||||||
|
|
||||||
// do it!
|
// do it!
|
||||||
[self makeSelectedPerform: @selector (transform)];
|
[self makeSelectedPerform: @selector (transform)];
|
||||||
|
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
|
|
|
@ -49,9 +49,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Read in at start of program
|
// Read in at start of program
|
||||||
//
|
|
||||||
- (id) readDefaults
|
- (id) readDefaults
|
||||||
{
|
{
|
||||||
[self setProjectPath: [prefs stringForKey: @"ProjectPath"]];
|
[self setProjectPath: [prefs stringForKey: @"ProjectPath"]];
|
||||||
|
@ -90,13 +88,11 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
return projectpath;
|
return projectpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
// BSP sound stuff
|
// BSP sound stuff
|
||||||
// ===============================================
|
// ===============================================
|
||||||
//
|
//
|
||||||
// Set the BSP sound using an OpenPanel
|
// Set the BSP sound using an OpenPanel
|
||||||
//
|
|
||||||
- (id) setBspSound: sender
|
- (id) setBspSound: sender
|
||||||
{
|
{
|
||||||
id panel;
|
id panel;
|
||||||
|
@ -124,18 +120,14 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Play the BSP sound
|
// Play the BSP sound
|
||||||
//
|
|
||||||
- (id) playBspSound
|
- (id) playBspSound
|
||||||
{
|
{
|
||||||
[bspSound_i play];
|
[bspSound_i play];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Set the bspSound path
|
// Set the bspSound path
|
||||||
//
|
|
||||||
- (id) setBspSoundPath: (NSString *)path
|
- (id) setBspSoundPath: (NSString *)path
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -165,9 +157,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
// Show BSP Output management
|
// Show BSP Output management
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
//
|
|
||||||
// Set the state
|
// Set the state
|
||||||
//
|
|
||||||
- (id) setShowBSP: (int)state
|
- (id) setShowBSP: (int)state
|
||||||
{
|
{
|
||||||
showBSP = state;
|
showBSP = state;
|
||||||
|
@ -177,9 +167,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Get the state
|
// Get the state
|
||||||
//
|
|
||||||
- (int) getShowBSP
|
- (int) getShowBSP
|
||||||
{
|
{
|
||||||
return showBSP;
|
return showBSP;
|
||||||
|
@ -189,9 +177,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
// "Offset Brush ..." management
|
// "Offset Brush ..." management
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
//
|
|
||||||
// Set the state
|
// Set the state
|
||||||
//
|
|
||||||
- (id) setBrushOffset: (int)state
|
- (id) setBrushOffset: (int)state
|
||||||
{
|
{
|
||||||
brushOffset = state;
|
brushOffset = state;
|
||||||
|
@ -200,9 +186,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Get the state
|
// Get the state
|
||||||
//
|
|
||||||
- (int) getBrushOffset
|
- (int) getBrushOffset
|
||||||
{
|
{
|
||||||
return brushOffset;
|
return brushOffset;
|
||||||
|
@ -234,7 +218,6 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
// ===============================================
|
// ===============================================
|
||||||
//
|
//
|
||||||
// Set the state
|
// Set the state
|
||||||
//
|
|
||||||
- (id) setXlight: (float)value
|
- (id) setXlight: (float)value
|
||||||
{
|
{
|
||||||
xlight = value;
|
xlight = value;
|
||||||
|
@ -268,9 +251,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Get the state
|
// Get the state
|
||||||
//
|
|
||||||
- (float) getXlight
|
- (float) getXlight
|
||||||
{
|
{
|
||||||
return [xlight_i floatValue];
|
return [xlight_i floatValue];
|
||||||
|
|
|
@ -86,9 +86,7 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Init Project Settings fields
|
// Init Project Settings fields
|
||||||
//
|
|
||||||
- (id) initProjSettings
|
- (id) initProjSettings
|
||||||
{
|
{
|
||||||
[pis_basepath_i setStringValue: path_basepath];
|
[pis_basepath_i setStringValue: path_basepath];
|
||||||
|
@ -101,9 +99,7 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Add text to the BSP Output window
|
// Add text to the BSP Output window
|
||||||
//
|
|
||||||
- (id) addToOutput: (const char *)string
|
- (id) addToOutput: (const char *)string
|
||||||
{
|
{
|
||||||
int end;
|
int end;
|
||||||
|
@ -151,10 +147,8 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Fill the QuakeEd Maps or wads browser
|
// Fill the QuakeEd Maps or wads browser
|
||||||
// (Delegate method - delegated in Interface Builder)
|
// (Delegate method - delegated in Interface Builder)
|
||||||
//
|
|
||||||
- (void) browser: sender createRowsForColumn: (int)column inMatrix: matrix
|
- (void) browser: sender createRowsForColumn: (int)column inMatrix: matrix
|
||||||
{
|
{
|
||||||
id cell;
|
id cell;
|
||||||
|
@ -183,9 +177,7 @@ id project_i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Clicked on a map name or description!
|
// Clicked on a map name or description!
|
||||||
//
|
|
||||||
- (id) clickedOnMap: sender
|
- (id) clickedOnMap: sender
|
||||||
{
|
{
|
||||||
id matrix;
|
id matrix;
|
||||||
|
@ -223,7 +215,7 @@ id project_i;
|
||||||
|
|
||||||
Sys_Printf ("loading %s\n", wf);
|
Sys_Printf ("loading %s\n", wf);
|
||||||
|
|
||||||
// set the row in the settings inspector wad browser
|
// set the row in the settings inspector wad browser
|
||||||
c = PL_A_NumObjects (wadList);
|
c = PL_A_NumObjects (wadList);
|
||||||
for (i = 0; i < c; i++) {
|
for (i = 0; i < c; i++) {
|
||||||
name = PL_String (PL_ObjectAtIndex (wadList, i));
|
name = PL_String (PL_ObjectAtIndex (wadList, i));
|
||||||
|
@ -233,7 +225,7 @@ id project_i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the texture inspector
|
// update the texture inspector
|
||||||
[texturepalette_i initPaletteFromWadfile: wf];
|
[texturepalette_i initPaletteFromWadfile: wf];
|
||||||
[[map_i objectAtIndex: 0] setKey: "wad" toValue: wf];
|
[[map_i objectAtIndex: 0] setKey: "wad" toValue: wf];
|
||||||
// [inspcontrol_i changeInspectorTo:i_textures];
|
// [inspcontrol_i changeInspectorTo:i_textures];
|
||||||
|
@ -243,9 +235,7 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Clicked on a wad name
|
// Clicked on a wad name
|
||||||
//
|
|
||||||
- (id) clickedOnWad: sender
|
- (id) clickedOnWad: sender
|
||||||
{
|
{
|
||||||
id matrix;
|
id matrix;
|
||||||
|
@ -261,9 +251,7 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Read in the <name>.QE_Project file
|
// Read in the <name>.QE_Project file
|
||||||
//
|
|
||||||
- (id) parseProjectFile
|
- (id) parseProjectFile
|
||||||
{
|
{
|
||||||
NSString *path;
|
NSString *path;
|
||||||
|
@ -285,9 +273,7 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Loads and parses a project file
|
// Loads and parses a project file
|
||||||
//
|
|
||||||
- (id) openProjectFile: (NSString *)path
|
- (id) openProjectFile: (NSString *)path
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -317,9 +303,7 @@ id project_i;
|
||||||
return path_projectinfo;
|
return path_projectinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Open a project file
|
// Open a project file
|
||||||
//
|
|
||||||
- (id) openProject
|
- (id) openProject
|
||||||
{
|
{
|
||||||
id openpanel;
|
id openpanel;
|
||||||
|
@ -364,9 +348,7 @@ id project_i;
|
||||||
return path_progdir;
|
return path_progdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the WAD name for cmd-8
|
// Return the WAD name for cmd-8
|
||||||
//
|
|
||||||
- (const char *) getWAD8
|
- (const char *) getWAD8
|
||||||
{
|
{
|
||||||
if (!path_wad8[0])
|
if (!path_wad8[0])
|
||||||
|
@ -375,9 +357,7 @@ id project_i;
|
||||||
return path_wad8;
|
return path_wad8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the WAD name for cmd-9
|
// Return the WAD name for cmd-9
|
||||||
//
|
|
||||||
- (const char *) getWAD9
|
- (const char *) getWAD9
|
||||||
{
|
{
|
||||||
if (!path_wad9[0])
|
if (!path_wad9[0])
|
||||||
|
@ -386,9 +366,7 @@ id project_i;
|
||||||
return path_wad9;
|
return path_wad9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the WAD name for cmd-0
|
// Return the WAD name for cmd-0
|
||||||
//
|
|
||||||
- (const char *) getWAD0
|
- (const char *) getWAD0
|
||||||
{
|
{
|
||||||
if (!path_wad0[0])
|
if (!path_wad0[0])
|
||||||
|
@ -397,9 +375,7 @@ id project_i;
|
||||||
return path_wad0;
|
return path_wad0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the FULLVIS cmd string
|
// Return the FULLVIS cmd string
|
||||||
//
|
|
||||||
- (const char *) getFullVisCmd
|
- (const char *) getFullVisCmd
|
||||||
{
|
{
|
||||||
if (!string_fullvis[0])
|
if (!string_fullvis[0])
|
||||||
|
@ -408,9 +384,7 @@ id project_i;
|
||||||
return string_fullvis;
|
return string_fullvis;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the FASTVIS cmd string
|
// Return the FASTVIS cmd string
|
||||||
//
|
|
||||||
- (const char *) getFastVisCmd
|
- (const char *) getFastVisCmd
|
||||||
{
|
{
|
||||||
if (!string_fastvis[0])
|
if (!string_fastvis[0])
|
||||||
|
@ -419,9 +393,7 @@ id project_i;
|
||||||
return string_fastvis;
|
return string_fastvis;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the NOVIS cmd string
|
// Return the NOVIS cmd string
|
||||||
//
|
|
||||||
- (const char *) getNoVisCmd
|
- (const char *) getNoVisCmd
|
||||||
{
|
{
|
||||||
if (!string_novis[0])
|
if (!string_novis[0])
|
||||||
|
@ -430,9 +402,7 @@ id project_i;
|
||||||
return string_novis;
|
return string_novis;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the RELIGHT cmd string
|
// Return the RELIGHT cmd string
|
||||||
//
|
|
||||||
- (const char *) getRelightCmd
|
- (const char *) getRelightCmd
|
||||||
{
|
{
|
||||||
if (!string_relight[0])
|
if (!string_relight[0])
|
||||||
|
@ -441,9 +411,7 @@ id project_i;
|
||||||
return string_relight;
|
return string_relight;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the LEAKTEST cmd string
|
// Return the LEAKTEST cmd string
|
||||||
//
|
|
||||||
- (const char *) getLeaktestCmd
|
- (const char *) getLeaktestCmd
|
||||||
{
|
{
|
||||||
if (!string_leaktest[0])
|
if (!string_leaktest[0])
|
||||||
|
|
|
@ -130,7 +130,7 @@ Every five minutes, save a modified map
|
||||||
*/
|
*/
|
||||||
- (void) AutoSave
|
- (void) AutoSave
|
||||||
{
|
{
|
||||||
// automatic backup
|
// automatic backup
|
||||||
if (autodirty) {
|
if (autodirty) {
|
||||||
autodirty = NO;
|
autodirty = NO;
|
||||||
#define FN_AUTOSAVE "/qcache/AutoSaveMap.map"
|
#define FN_AUTOSAVE "/qcache/AutoSaveMap.map"
|
||||||
|
@ -317,8 +317,8 @@ instance draw the brush after each flush
|
||||||
[cameraview_i lockFocus];
|
[cameraview_i lockFocus];
|
||||||
linestart (0, 0, 0);
|
linestart (0, 0, 0);
|
||||||
[map_i makeSelectedPerform: @selector (CameraDrawSelf)];
|
[map_i makeSelectedPerform: @selector (CameraDrawSelf)];
|
||||||
[clipper_i cameraDrawSelf];
|
|
||||||
lineflush ();
|
lineflush ();
|
||||||
|
[clipper_i cameraDrawSelf];
|
||||||
[cameraview_i unlockFocus];
|
[cameraview_i unlockFocus];
|
||||||
|
|
||||||
[xyview_i lockFocus];
|
[xyview_i lockFocus];
|
||||||
|
@ -387,8 +387,6 @@ App delegate methods
|
||||||
[self enableFlushWindow];
|
[self enableFlushWindow];
|
||||||
[self flushWindow];
|
[self flushWindow];
|
||||||
|
|
||||||
// NSPing ();
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,11 +440,9 @@ App delegate methods
|
||||||
|
|
||||||
[self makeKeyAndOrderFront: self];
|
[self makeKeyAndOrderFront: self];
|
||||||
|
|
||||||
// [self doOpen: "/raid/quake/id1_/maps/amlev1.map"]; // DEBUG
|
|
||||||
[map_i newMap];
|
[map_i newMap];
|
||||||
|
|
||||||
Sys_Printf ("ready.\n");
|
Sys_Printf ("ready.\n");
|
||||||
// malloc_debug(-1); // DEBUG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) appWillTerminate: sender
|
- (id) appWillTerminate: sender
|
||||||
|
@ -575,8 +571,7 @@ applyRegion:
|
||||||
{
|
{
|
||||||
id b;
|
id b;
|
||||||
|
|
||||||
// get the bounds of the current selection
|
// get the bounds of the current selection
|
||||||
|
|
||||||
if ([map_i numSelected] != 1) {
|
if ([map_i numSelected] != 1) {
|
||||||
Sys_Printf ("must have a single brush selected\n");
|
Sys_Printf ("must have a single brush selected\n");
|
||||||
return self;
|
return self;
|
||||||
|
@ -586,7 +581,7 @@ applyRegion:
|
||||||
[b getMins: region_min maxs: region_max];
|
[b getMins: region_min maxs: region_max];
|
||||||
[b remove];
|
[b remove];
|
||||||
|
|
||||||
// turn region on
|
// turn region on
|
||||||
[regionbutton_i setIntValue: 1];
|
[regionbutton_i setIntValue: 1];
|
||||||
[self applyRegion: self];
|
[self applyRegion: self];
|
||||||
|
|
||||||
|
@ -597,7 +592,7 @@ applyRegion:
|
||||||
{
|
{
|
||||||
NSRect bounds;
|
NSRect bounds;
|
||||||
|
|
||||||
// get xy size
|
// get xy size
|
||||||
bounds = [[xyview_i superview] bounds];
|
bounds = [[xyview_i superview] bounds];
|
||||||
|
|
||||||
region_min[0] = bounds.origin.x;
|
region_min[0] = bounds.origin.x;
|
||||||
|
@ -607,16 +602,14 @@ applyRegion:
|
||||||
region_max[1] = bounds.origin.y + bounds.size.height;
|
region_max[1] = bounds.origin.y + bounds.size.height;
|
||||||
region_max[2] = 99999;
|
region_max[2] = 99999;
|
||||||
|
|
||||||
// turn region on
|
// turn region on
|
||||||
[regionbutton_i setIntValue: 1];
|
[regionbutton_i setIntValue: 1];
|
||||||
[self applyRegion: self];
|
[self applyRegion: self];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// UI querie for other objects
|
// UI querie for other objects
|
||||||
//
|
|
||||||
- (BOOL) showCoordinates
|
- (BOOL) showCoordinates
|
||||||
{
|
{
|
||||||
return [show_coordinates_i intValue];
|
return [show_coordinates_i intValue];
|
||||||
|
@ -672,9 +665,8 @@ saveBSP
|
||||||
NSBeep ();
|
NSBeep ();
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// turn off the filters so all entities get saved
|
// turn off the filters so all entities get saved
|
||||||
//
|
|
||||||
oldLightFilter = [filter_light_i intValue];
|
oldLightFilter = [filter_light_i intValue];
|
||||||
oldPathFilter = [filter_path_i intValue];
|
oldPathFilter = [filter_path_i intValue];
|
||||||
[filter_light_i setIntValue: 0];
|
[filter_light_i setIntValue: 0];
|
||||||
|
@ -696,9 +688,7 @@ saveBSP
|
||||||
[filter_path_i setIntValue: oldPathFilter];
|
[filter_path_i setIntValue: oldPathFilter];
|
||||||
[self applyRegion: self];
|
[self applyRegion: self];
|
||||||
|
|
||||||
//
|
// write the command to the bsp host
|
||||||
// write the command to the bsp host
|
|
||||||
//
|
|
||||||
destdir = [project_i getFinalMapDirectory];
|
destdir = [project_i getFinalMapDirectory];
|
||||||
|
|
||||||
bsppath = [destdir stringByAppendingPathComponent:
|
bsppath = [destdir stringByAppendingPathComponent:
|
||||||
|
@ -841,7 +831,7 @@ save:
|
||||||
{
|
{
|
||||||
NSString *backup;
|
NSString *backup;
|
||||||
|
|
||||||
// force a name change if using tempname
|
// force a name change if using tempname
|
||||||
if (![filename compare: FN_TEMPSAVE])
|
if (![filename compare: FN_TEMPSAVE])
|
||||||
return [self saveAs: self];
|
return [self saveAs: self];
|
||||||
dirty = autodirty = NO;
|
dirty = autodirty = NO;
|
||||||
|
@ -891,9 +881,7 @@ saveAs
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//
|
|
||||||
// AJR - added this for Project info
|
// AJR - added this for Project info
|
||||||
//
|
|
||||||
- (NSString *) currentFilename
|
- (NSString *) currentFilename
|
||||||
{
|
{
|
||||||
return filename;
|
return filename;
|
||||||
|
@ -924,9 +912,7 @@ keyDown
|
||||||
NSString *chars = [theEvent characters];
|
NSString *chars = [theEvent characters];
|
||||||
unichar c = ([chars length] == 1) ? [chars characterAtIndex: 0] : '\0';
|
unichar c = ([chars length] == 1) ? [chars characterAtIndex: 0] : '\0';
|
||||||
|
|
||||||
//
|
// function keys
|
||||||
// function keys
|
|
||||||
//
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case NSF2FunctionKey:
|
case NSF2FunctionKey:
|
||||||
[cameraview_i setDrawMode: dr_wire];
|
[cameraview_i setDrawMode: dr_wire];
|
||||||
|
@ -1016,9 +1002,7 @@ keyDown
|
||||||
[map_i cloneSelection: self];
|
[map_i cloneSelection: self];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
// move selection keys
|
||||||
// move selection keys
|
|
||||||
//
|
|
||||||
case '2':
|
case '2':
|
||||||
VectorCopy (vec3_origin, sb_translate);
|
VectorCopy (vec3_origin, sb_translate);
|
||||||
sb_translate[1] = -[xyview_i gridsize];
|
sb_translate[1] = -[xyview_i gridsize];
|
||||||
|
|
|
@ -1610,7 +1610,7 @@ Set the regioned flag based on if the object is containted in region_min/max
|
||||||
int i;
|
int i;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
// filter away entities
|
// filter away entities
|
||||||
if (parent != [map_i objectAtIndex: 0]) {
|
if (parent != [map_i objectAtIndex: 0]) {
|
||||||
if (filter_entities) {
|
if (filter_entities) {
|
||||||
regioned = YES;
|
regioned = YES;
|
||||||
|
@ -1708,7 +1708,7 @@ id sb_newowner;
|
||||||
[parent removeObject: self];
|
[parent removeObject: self];
|
||||||
parent = sb_newowner;
|
parent = sb_newowner;
|
||||||
|
|
||||||
// hack to allow them to be copied to another map
|
// 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"]];
|
eclass = [entity_classes_i classForName: [parent valueForQKey: "classname"]];
|
||||||
c = [eclass drawColor];
|
c = [eclass drawColor];
|
||||||
|
@ -1724,7 +1724,7 @@ vec3_t sb_translate;
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
// move the planes
|
// move the planes
|
||||||
for (i = 0; i < numfaces; i++) {
|
for (i = 0; i < numfaces; i++) {
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
VectorAdd (faces[i].planepts[j], sb_translate, faces[i].planepts[j]);
|
VectorAdd (faces[i].planepts[j], sb_translate, faces[i].planepts[j]);
|
||||||
|
@ -1770,7 +1770,7 @@ vec3_t sb_mins, sb_maxs;
|
||||||
{
|
{
|
||||||
selected = NO;
|
selected = NO;
|
||||||
|
|
||||||
// the last selected brush determines
|
// the last selected brush determines
|
||||||
if (invalid)
|
if (invalid)
|
||||||
printf ("WARNING: deselected invalid brush\n");
|
printf ("WARNING: deselected invalid brush\n");
|
||||||
[map_i setCurrentMinZ: bmins[2]];
|
[map_i setCurrentMinZ: bmins[2]];
|
||||||
|
@ -1779,7 +1779,7 @@ vec3_t sb_mins, sb_maxs;
|
||||||
|
|
||||||
- (void) remove
|
- (void) remove
|
||||||
{
|
{
|
||||||
// the last selected brush determines
|
// the last selected brush determines
|
||||||
if (!invalid) {
|
if (!invalid) {
|
||||||
[map_i setCurrentMinZ: bmins[2]];
|
[map_i setCurrentMinZ: bmins[2]];
|
||||||
[map_i setCurrentMaxZ: bmaxs[2]];
|
[map_i setCurrentMaxZ: bmaxs[2]];
|
||||||
|
@ -1902,7 +1902,7 @@ id carve_in, carve_out;
|
||||||
numfaces++;
|
numfaces++;
|
||||||
[self calcWindings];
|
[self calcWindings];
|
||||||
|
|
||||||
// remove any degenerate faces
|
// remove any degenerate faces
|
||||||
return [self removeIfInvalid];
|
return [self removeIfInvalid];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -470,15 +470,13 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Set the selected texture
|
// Set the selected texture
|
||||||
//
|
|
||||||
- (id) setSelectedTexture: (int)which
|
- (id) setSelectedTexture: (int)which
|
||||||
{
|
{
|
||||||
texpal_t *t;
|
texpal_t *t;
|
||||||
NSRect r;
|
NSRect r;
|
||||||
|
|
||||||
// wipe the fields
|
// wipe the fields
|
||||||
[self clearTexinfo: self];
|
[self clearTexinfo: self];
|
||||||
|
|
||||||
if (which != selectedTexture) {
|
if (which != selectedTexture) {
|
||||||
|
@ -503,18 +501,14 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the selected texture index
|
// Return the selected texture index
|
||||||
//
|
|
||||||
- (int) getSelectedTexture
|
- (int) getSelectedTexture
|
||||||
{
|
{
|
||||||
return selectedTexture;
|
return selectedTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the original tex_ index of the selected texture
|
// Return the original tex_ index of the selected texture
|
||||||
// so the texture info can be indexed from tex_images, etc.
|
// so the texture info can be indexed from tex_images, etc.
|
||||||
//
|
|
||||||
- (int) getSelectedTexIndex
|
- (int) getSelectedTexIndex
|
||||||
{
|
{
|
||||||
texpal_t *t;
|
texpal_t *t;
|
||||||
|
@ -525,9 +519,7 @@ TEX_ForName (const char *name)
|
||||||
return t->index;
|
return t->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the name of the selected texture
|
// Return the name of the selected texture
|
||||||
//
|
|
||||||
- (const char *) getSelTextureName
|
- (const char *) getSelTextureName
|
||||||
{
|
{
|
||||||
texpal_t *t;
|
texpal_t *t;
|
||||||
|
@ -538,9 +530,7 @@ TEX_ForName (const char *name)
|
||||||
return t->name;
|
return t->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Set selected texture by texture name
|
// Set selected texture by texture name
|
||||||
//
|
|
||||||
- (id) setTextureByName: (const char *)name
|
- (id) setTextureByName: (const char *)name
|
||||||
{
|
{
|
||||||
texpal_t *t;
|
texpal_t *t;
|
||||||
|
@ -568,9 +558,7 @@ TEX_ForName (const char *name)
|
||||||
//
|
//
|
||||||
// ===================================================
|
// ===================================================
|
||||||
|
|
||||||
//
|
|
||||||
// Search for texture named in searchField
|
// Search for texture named in searchField
|
||||||
//
|
|
||||||
- (id) searchForTexture: sender
|
- (id) searchForTexture: sender
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -614,9 +602,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Set texture def from outside TexturePalette
|
// Set texture def from outside TexturePalette
|
||||||
//
|
|
||||||
- (id) setTextureDef: (texturedef_t *)td
|
- (id) setTextureDef: (texturedef_t *)td
|
||||||
{
|
{
|
||||||
[self setTextureByName: td->texture];
|
[self setTextureByName: td->texture];
|
||||||
|
@ -632,9 +618,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the current texture def to passed *
|
// Return the current texture def to passed *
|
||||||
//
|
|
||||||
- (id) getTextureDef: (texturedef_t *)td
|
- (id) getTextureDef: (texturedef_t *)td
|
||||||
{
|
{
|
||||||
if (selectedTexture == -1) {
|
if (selectedTexture == -1) {
|
||||||
|
@ -656,9 +640,7 @@ TEX_ForName (const char *name)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
//
|
|
||||||
// Change value in a field
|
// Change value in a field
|
||||||
//
|
|
||||||
- (id) changeField: (id)
|
- (id) changeField: (id)
|
||||||
field by: (int)amount
|
field by: (int)amount
|
||||||
{
|
{
|
||||||
|
@ -673,9 +655,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Inc/Dec the XShift field
|
// Inc/Dec the XShift field
|
||||||
//
|
|
||||||
- (id) incXShift: sender
|
- (id) incXShift: sender
|
||||||
{
|
{
|
||||||
[self changeField: field_Xshift_i by: 8];
|
[self changeField: field_Xshift_i by: 8];
|
||||||
|
@ -688,9 +668,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Inc/Dec the YShift field
|
// Inc/Dec the YShift field
|
||||||
//
|
|
||||||
- (id) incYShift: sender
|
- (id) incYShift: sender
|
||||||
{
|
{
|
||||||
[self changeField: field_Yshift_i by: 8];
|
[self changeField: field_Yshift_i by: 8];
|
||||||
|
@ -703,9 +681,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Inc/Dec the Rotate field
|
// Inc/Dec the Rotate field
|
||||||
//
|
|
||||||
- (id) incRotate: sender
|
- (id) incRotate: sender
|
||||||
{
|
{
|
||||||
[self changeField: field_Rotate_i by: 90];
|
[self changeField: field_Rotate_i by: 90];
|
||||||
|
@ -718,9 +694,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Inc/Dec the Xscale field
|
// Inc/Dec the Xscale field
|
||||||
//
|
|
||||||
- (id) incXScale: sender
|
- (id) incXScale: sender
|
||||||
{
|
{
|
||||||
[field_Xscale_i setIntValue: 1];
|
[field_Xscale_i setIntValue: 1];
|
||||||
|
@ -735,9 +709,7 @@ TEX_ForName (const char *name)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Inc/Dec the Yscale field
|
// Inc/Dec the Yscale field
|
||||||
//
|
|
||||||
- (id) incYScale: sender
|
- (id) incYScale: sender
|
||||||
{
|
{
|
||||||
[field_Yscale_i setIntValue: 1];
|
[field_Yscale_i setIntValue: 1];
|
||||||
|
@ -754,10 +726,8 @@ TEX_ForName (const char *name)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
//
|
|
||||||
// Search for texture in entire palette
|
// Search for texture in entire palette
|
||||||
// Return index of texturedef, or -1 if unsuccessful
|
// Return index of texturedef, or -1 if unsuccessful
|
||||||
//
|
|
||||||
- (int) searchForTextureInPalette: (const char *)texture
|
- (int) searchForTextureInPalette: (const char *)texture
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -777,9 +747,7 @@ TEX_ForName (const char *name)
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
// Scan thru map & display only textures that are in map
|
// Scan thru map & display only textures that are in map
|
||||||
//
|
|
||||||
- (id) onlyShowMapTextures: sender
|
- (id) onlyShowMapTextures: sender
|
||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
|
|
|
@ -29,9 +29,7 @@ id things_i;
|
||||||
[flags_i deselectAllCells];
|
[flags_i deselectAllCells];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Load the TEXT object with the entity comment
|
// Load the TEXT object with the entity comment
|
||||||
//
|
|
||||||
- (id) loadEntityComment: (id)obj
|
- (id) loadEntityComment: (id)obj
|
||||||
{
|
{
|
||||||
[entity_comment_i selectAll: self];
|
[entity_comment_i selectAll: self];
|
||||||
|
@ -85,9 +83,7 @@ id things_i;
|
||||||
return [[entity_classes_i objectAtIndex: lastSelected] classname];
|
return [[entity_classes_i objectAtIndex: lastSelected] classname];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Flush entity classes & reload them!
|
// Flush entity classes & reload them!
|
||||||
//
|
|
||||||
- (id) reloadEntityClasses: sender
|
- (id) reloadEntityClasses: sender
|
||||||
{
|
{
|
||||||
EntityClass *ent;
|
EntityClass *ent;
|
||||||
|
@ -179,9 +175,7 @@ id things_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Clicked in the Keypair view - set as selected
|
// Clicked in the Keypair view - set as selected
|
||||||
//
|
|
||||||
- (id) setSelectedKey: (epair_t *)ep;
|
- (id) setSelectedKey: (epair_t *)ep;
|
||||||
{
|
{
|
||||||
[keyInput_i setStringValue: [NSString stringWithCString: ep->key]];
|
[keyInput_i setStringValue: [NSString stringWithCString: ep->key]];
|
||||||
|
@ -199,9 +193,7 @@ id things_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Action methods
|
// Action methods
|
||||||
//
|
|
||||||
|
|
||||||
- (id) addPair: sender
|
- (id) addPair: sender
|
||||||
{
|
{
|
||||||
|
@ -237,9 +229,7 @@ id things_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Set the key/value fields to "angle <button value>"
|
// Set the key/value fields to "angle <button value>"
|
||||||
//
|
|
||||||
- (id) setAngle: sender
|
- (id) setAngle: sender
|
||||||
{
|
{
|
||||||
NSString *value;
|
NSString *value;
|
||||||
|
@ -289,10 +279,8 @@ id things_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Fill the Entity browser
|
// Fill the Entity browser
|
||||||
// (Delegate method - delegated in Interface Builder)
|
// (Delegate method - delegated in Interface Builder)
|
||||||
//
|
|
||||||
- (void) browser: sender
|
- (void) browser: sender
|
||||||
createRowsForColumn: (int)column
|
createRowsForColumn: (int)column
|
||||||
inMatrix: matrix
|
inMatrix: matrix
|
||||||
|
|
|
@ -67,9 +67,7 @@ initWithFrame:
|
||||||
xy_viewnormal[2] = -1;
|
xy_viewnormal[2] = -1;
|
||||||
xy_viewdist = -1024;
|
xy_viewdist = -1024;
|
||||||
|
|
||||||
//
|
// initialize the pop up menus
|
||||||
// initialize the pop up menus
|
|
||||||
//
|
|
||||||
scalebutton_i = [[NSPopUpButton alloc] init];
|
scalebutton_i = [[NSPopUpButton alloc] init];
|
||||||
[scalebutton_i setTarget: self];
|
[scalebutton_i setTarget: self];
|
||||||
[scalebutton_i setAction: @selector (scaleMenuTarget:)];
|
[scalebutton_i setAction: @selector (scaleMenuTarget:)];
|
||||||
|
@ -97,9 +95,7 @@ initWithFrame:
|
||||||
[gridbutton_i sizeToFit];
|
[gridbutton_i sizeToFit];
|
||||||
[gridbutton_i selectItemAtIndex: 4];
|
[gridbutton_i selectItemAtIndex: 4];
|
||||||
|
|
||||||
//
|
// initialize the scroll view
|
||||||
// initialize the scroll view
|
|
||||||
//
|
|
||||||
scrollview_i = [[PopScrollView alloc] initWithFrame: frameRect
|
scrollview_i = [[PopScrollView alloc] initWithFrame: frameRect
|
||||||
button1: scalebutton_i
|
button1: scalebutton_i
|
||||||
button2: gridbutton_i];
|
button2: gridbutton_i];
|
||||||
|
@ -107,9 +103,7 @@ initWithFrame:
|
||||||
[scrollview_i setAutoresizingMask: (NSViewWidthSizable |
|
[scrollview_i setAutoresizingMask: (NSViewWidthSizable |
|
||||||
NSViewHeightSizable)];
|
NSViewHeightSizable)];
|
||||||
|
|
||||||
//
|
// link objects together
|
||||||
// link objects together
|
|
||||||
//
|
|
||||||
[scrollview_i setDocumentView: self];
|
[scrollview_i setDocumentView: self];
|
||||||
return scrollview_i;
|
return scrollview_i;
|
||||||
}
|
}
|
||||||
|
@ -313,9 +307,7 @@ zoomIn
|
||||||
NSRect visrect;
|
NSRect visrect;
|
||||||
NSPoint ofs, new;
|
NSPoint ofs, new;
|
||||||
|
|
||||||
//
|
// set the popup
|
||||||
// set the popup
|
|
||||||
//
|
|
||||||
itemlist = [scalebutton_i itemArray];
|
itemlist = [scalebutton_i itemArray];
|
||||||
numrows = [itemlist count];
|
numrows = [itemlist count];
|
||||||
|
|
||||||
|
@ -325,9 +317,7 @@ zoomIn
|
||||||
return NULL;
|
return NULL;
|
||||||
[scalebutton_i selectItemAtIndex: selected];
|
[scalebutton_i selectItemAtIndex: selected];
|
||||||
|
|
||||||
//
|
// zoom the view
|
||||||
// zoom the view
|
|
||||||
//
|
|
||||||
visrect = [[self superview] bounds];
|
visrect = [[self superview] bounds];
|
||||||
ofs.x = constant->x - visrect.origin.x;
|
ofs.x = constant->x - visrect.origin.x;
|
||||||
ofs.y = constant->y - visrect.origin.y;
|
ofs.y = constant->y - visrect.origin.y;
|
||||||
|
@ -353,9 +343,7 @@ zoomOut
|
||||||
NSRect visrect;
|
NSRect visrect;
|
||||||
NSPoint ofs, new;
|
NSPoint ofs, new;
|
||||||
|
|
||||||
//
|
// set the popup
|
||||||
// set the popup
|
|
||||||
//
|
|
||||||
itemlist = [scalebutton_i itemArray];
|
itemlist = [scalebutton_i itemArray];
|
||||||
|
|
||||||
selectedItem = [scalebutton_i selectedItem];
|
selectedItem = [scalebutton_i selectedItem];
|
||||||
|
@ -365,9 +353,7 @@ zoomOut
|
||||||
|
|
||||||
[scalebutton_i selectItemAtIndex: selected];
|
[scalebutton_i selectItemAtIndex: selected];
|
||||||
|
|
||||||
//
|
// zoom the view
|
||||||
// zoom the view
|
|
||||||
//
|
|
||||||
visrect = [[self superview] bounds];
|
visrect = [[self superview] bounds];
|
||||||
ofs.x = constant->x - visrect.origin.x;
|
ofs.x = constant->x - visrect.origin.x;
|
||||||
ofs.y = constant->y - visrect.origin.y;
|
ofs.y = constant->y - visrect.origin.y;
|
||||||
|
@ -549,12 +535,10 @@ Rect is in global world (unscaled) coordinates
|
||||||
[path removeAllPoints];
|
[path removeAllPoints];
|
||||||
[path setLineWidth: 0.15];
|
[path setLineWidth: 0.15];
|
||||||
|
|
||||||
//
|
// grid
|
||||||
// grid
|
//
|
||||||
//
|
// can't just divide by grid size because of negetive coordinate
|
||||||
// can't just divide by grid size because of negetive coordinate
|
// truncating direction
|
||||||
// truncating direction
|
|
||||||
//
|
|
||||||
if (gridsize >= 4 / scale) {
|
if (gridsize >= 4 / scale) {
|
||||||
y = floor (bottom / gridsize);
|
y = floor (bottom / gridsize);
|
||||||
stopy = floor (top / gridsize);
|
stopy = floor (top / gridsize);
|
||||||
|
@ -607,9 +591,7 @@ Rect is in global world (unscaled) coordinates
|
||||||
[path stroke];
|
[path stroke];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// tiles
|
||||||
// tiles
|
|
||||||
//
|
|
||||||
// for text
|
// for text
|
||||||
[[NSColor colorWithCalibratedWhite: 0.0 / 16.0 alpha: 1.0] set];
|
[[NSColor colorWithCalibratedWhite: 0.0 / 16.0 alpha: 1.0] set];
|
||||||
|
|
||||||
|
@ -798,7 +780,6 @@ drawSolid
|
||||||
NSDrawBitmap (visRect, r_width, r_height, 8, 3, 32, r_width * 4, NO, NO,
|
NSDrawBitmap (visRect, r_width, r_height, 8, 3, 32, r_width * 4, NO, NO,
|
||||||
NSCalibratedRGBColorSpace, planes);
|
NSCalibratedRGBColorSpace, planes);
|
||||||
|
|
||||||
// NSPing ();
|
|
||||||
[[self window] setBackingType: NSBackingStoreBuffered];
|
[[self window] setBackingType: NSBackingStoreBuffered];
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
|
|
||||||
|
@ -1140,7 +1121,7 @@ ControlCallback (float dx, float dy)
|
||||||
pt = [theEvent locationInWindow];
|
pt = [theEvent locationInWindow];
|
||||||
pt = [self convertPoint: pt fromView: NULL];
|
pt = [self convertPoint: pt fromView: NULL];
|
||||||
|
|
||||||
// if the XY point is inside the brush, make the point on top
|
// if the XY point is inside the brush, make the point on top
|
||||||
p1[0] = pt.x;
|
p1[0] = pt.x;
|
||||||
p1[1] = pt.y;
|
p1[1] = pt.y;
|
||||||
VectorCopy (p1, p2);
|
VectorCopy (p1, p2);
|
||||||
|
|
|
@ -44,9 +44,7 @@ initWithFrame:
|
||||||
zview_i = self;
|
zview_i = self;
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
|
||||||
//
|
// initialize the pop up menus
|
||||||
// initialize the pop up menus
|
|
||||||
//
|
|
||||||
zscalebutton_i = [[NSPopUpButton alloc] init];
|
zscalebutton_i = [[NSPopUpButton alloc] init];
|
||||||
[zscalebutton_i setTarget: self];
|
[zscalebutton_i setTarget: self];
|
||||||
[zscalebutton_i setAction: @selector (scaleMenuTarget:)];
|
[zscalebutton_i setAction: @selector (scaleMenuTarget:)];
|
||||||
|
@ -60,7 +58,7 @@ initWithFrame:
|
||||||
[zscalebutton_i addItemWithTitle: @"300%"];
|
[zscalebutton_i addItemWithTitle: @"300%"];
|
||||||
[zscalebutton_i selectItemAtIndex: 4];
|
[zscalebutton_i selectItemAtIndex: 4];
|
||||||
|
|
||||||
// initialize the scroll view
|
// initialize the scroll view
|
||||||
zscrollview_i = [[ZScrollView alloc]
|
zscrollview_i = [[ZScrollView alloc]
|
||||||
initWithFrame: frameRect
|
initWithFrame: frameRect
|
||||||
button1: zscalebutton_i];
|
button1: zscalebutton_i];
|
||||||
|
@ -299,9 +297,7 @@ Rect is in global world (unscaled) coordinates
|
||||||
bottom = rect.origin.y - 1;
|
bottom = rect.origin.y - 1;
|
||||||
top = rect.origin.y + rect.size.height + 2;
|
top = rect.origin.y + rect.size.height + 2;
|
||||||
|
|
||||||
//
|
// grid
|
||||||
// grid
|
|
||||||
//
|
|
||||||
|
|
||||||
// can't just divide by grid size because of negetive coordinate
|
// can't just divide by grid size because of negetive coordinate
|
||||||
// truncating direction
|
// truncating direction
|
||||||
|
@ -330,9 +326,7 @@ Rect is in global world (unscaled) coordinates
|
||||||
[path stroke];
|
[path stroke];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// half tiles
|
||||||
// half tiles
|
|
||||||
//
|
|
||||||
y = floor (bottom / 32);
|
y = floor (bottom / 32);
|
||||||
stopy = floor (top / 32);
|
stopy = floor (top / 32);
|
||||||
|
|
||||||
|
@ -354,9 +348,7 @@ Rect is in global world (unscaled) coordinates
|
||||||
set];
|
set];
|
||||||
[path stroke];
|
[path stroke];
|
||||||
|
|
||||||
//
|
// tiles
|
||||||
// tiles
|
|
||||||
//
|
|
||||||
y = floor (bottom / 64);
|
y = floor (bottom / 64);
|
||||||
stopy = floor (top / 64);
|
stopy = floor (top / 64);
|
||||||
|
|
||||||
|
@ -388,9 +380,7 @@ Rect is in global world (unscaled) coordinates
|
||||||
[[NSColor colorWithCalibratedWhite: 10.0 / 16.0 alpha: 1.0] set];
|
[[NSColor colorWithCalibratedWhite: 10.0 / 16.0 alpha: 1.0] set];
|
||||||
[path stroke];
|
[path stroke];
|
||||||
|
|
||||||
//
|
// origin
|
||||||
// origin
|
|
||||||
//
|
|
||||||
[[NSColor colorWithCalibratedWhite: 4.0 / 16.0 alpha: 1.0] set];
|
[[NSColor colorWithCalibratedWhite: 4.0 / 16.0 alpha: 1.0] set];
|
||||||
[path removeAllPoints];
|
[path removeAllPoints];
|
||||||
[path setLineWidth: 5];
|
[path setLineWidth: 5];
|
||||||
|
@ -426,25 +416,25 @@ drawSelf
|
||||||
minheight = 999999;
|
minheight = 999999;
|
||||||
maxheight = -999999;
|
maxheight = -999999;
|
||||||
|
|
||||||
// allways draw the entire bar
|
// allways draw the entire bar
|
||||||
// visRect =[self visibleRect];
|
// visRect =[self visibleRect];
|
||||||
rect = [self visibleRect];
|
rect = [self visibleRect];
|
||||||
|
|
||||||
[quakeed_i zNoRestore: rect];
|
[quakeed_i zNoRestore: rect];
|
||||||
|
|
||||||
// erase window
|
// erase window
|
||||||
NSEraseRect (rect);
|
NSEraseRect (rect);
|
||||||
|
|
||||||
// draw grid
|
// draw grid
|
||||||
[self drawGrid: rect];
|
[self drawGrid: rect];
|
||||||
|
|
||||||
// draw zplane
|
// draw zplane
|
||||||
// [self drawZplane]; FIXME zplane doesn't do anything yet
|
// [self drawZplane]; FIXME zplane doesn't do anything yet
|
||||||
|
|
||||||
// draw all entities
|
// draw all entities
|
||||||
[map_i makeUnselectedPerform: @selector (ZDrawSelf)];
|
[map_i makeUnselectedPerform: @selector (ZDrawSelf)];
|
||||||
|
|
||||||
// possibly resize the view
|
// possibly resize the view
|
||||||
[self newRealBounds];
|
[self newRealBounds];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,34 +657,29 @@ mouseDown
|
||||||
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
|
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
|
||||||
NSAlternateKeyMask | NSCommandKeyMask);
|
NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
//
|
// shift click to select / deselect a brush from the world
|
||||||
// shift click to select / deselect a brush from the world
|
|
||||||
//
|
|
||||||
if (flags == NSShiftKeyMask) {
|
if (flags == NSShiftKeyMask) {
|
||||||
[map_i selectRay: p1: p1: NO];
|
[map_i selectRay: p1: p1: NO];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// alt click = set entire brush texture
|
// alt click = set entire brush texture
|
||||||
//
|
|
||||||
if (flags == NSAlternateKeyMask) {
|
if (flags == NSAlternateKeyMask) {
|
||||||
[map_i setTextureRay: p1: p1: YES];
|
[map_i setTextureRay: p1: p1: YES];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// control click = position view
|
// control click = position view
|
||||||
//
|
|
||||||
if (flags == NSControlKeyMask) {
|
if (flags == NSControlKeyMask) {
|
||||||
[cameraview_i setZOrigin: pt.y];
|
[cameraview_i setZOrigin: pt.y];
|
||||||
[quakeed_i updateAll];
|
[quakeed_i updateAll];
|
||||||
[cameraview_i ZmouseDown: &pt flags: [theEvent modifierFlags]];
|
[cameraview_i ZmouseDown: &pt flags: [theEvent modifierFlags]];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// bare click to drag icons or new brush drag
|
// bare click to drag icons or new brush drag
|
||||||
//
|
|
||||||
if (flags == 0) {
|
if (flags == 0) {
|
||||||
// check eye
|
// check eye
|
||||||
if ([cameraview_i ZmouseDown: &pt flags: [theEvent modifierFlags]])
|
if ([cameraview_i ZmouseDown: &pt flags: [theEvent modifierFlags]])
|
||||||
return;
|
return;
|
||||||
if ([map_i numSelected]) {
|
if ([map_i numSelected]) {
|
||||||
|
@ -729,9 +714,7 @@ rightMouseDown
|
||||||
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
|
[theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask |
|
||||||
NSAlternateKeyMask | NSCommandKeyMask);
|
NSAlternateKeyMask | NSCommandKeyMask);
|
||||||
|
|
||||||
//
|
// click = scroll view
|
||||||
// click = scroll view
|
|
||||||
//
|
|
||||||
if (flags == 0)
|
if (flags == 0)
|
||||||
[self scrollDragFrom: theEvent];
|
[self scrollDragFrom: theEvent];
|
||||||
Sys_Printf ("bad flags for click\n");
|
Sys_Printf ("bad flags for click\n");
|
||||||
|
|
|
@ -141,7 +141,7 @@ REN_DrawSpan (int y)
|
||||||
x2 = r_width;
|
x2 = r_width;
|
||||||
ofs = y * r_width + x1;
|
ofs = y * r_width + x1;
|
||||||
|
|
||||||
// this should be specialized for 1.0 / 0.5 / 0.75 light levels
|
// this should be specialized for 1.0 / 0.5 / 0.75 light levels
|
||||||
for (x = x1; x < x2; x++) {
|
for (x = x1; x < x2; x++) {
|
||||||
if (r_zbuffer[ofs] <= zfrac) {
|
if (r_zbuffer[ofs] <= zfrac) {
|
||||||
scale = 1 / zfrac;
|
scale = 1 / zfrac;
|
||||||
|
@ -213,7 +213,7 @@ REN_DrawFlatSpan (int y)
|
||||||
|
|
||||||
ofs = y * r_width + x1;
|
ofs = y * r_width + x1;
|
||||||
|
|
||||||
// this should be specialized for 1.0 / 0.5 / 0.75 light levels
|
// this should be specialized for 1.0 / 0.5 / 0.75 light levels
|
||||||
for (x = x1; x < x2; x++) {
|
for (x = x1; x < x2; x++) {
|
||||||
if (r_zbuffer[ofs] <= zfrac) {
|
if (r_zbuffer[ofs] <= zfrac) {
|
||||||
r_zbuffer[ofs] = zfrac;
|
r_zbuffer[ofs] = zfrac;
|
||||||
|
@ -241,9 +241,7 @@ REN_RasterizeFace (winding_t * w)
|
||||||
int count;
|
int count;
|
||||||
int numvertex;
|
int numvertex;
|
||||||
|
|
||||||
//
|
// find top vertex
|
||||||
// find top vertex
|
|
||||||
//
|
|
||||||
numvertex = w->numpoints;
|
numvertex = w->numpoints;
|
||||||
top = 0x7fffffff;
|
top = 0x7fffffff;
|
||||||
bot = 0x80000000;
|
bot = 0x80000000;
|
||||||
|
@ -267,9 +265,7 @@ REN_RasterizeFace (winding_t * w)
|
||||||
if (top < 0 || bot > r_height || top > bot)
|
if (top < 0 || bot > r_height || top > bot)
|
||||||
return; // shouldn't have to have this...
|
return; // shouldn't have to have this...
|
||||||
|
|
||||||
//
|
// render a trapezoid
|
||||||
// render a trapezoid
|
|
||||||
//
|
|
||||||
y = top;
|
y = top;
|
||||||
|
|
||||||
while (y < bot) {
|
while (y < bot) {
|
||||||
|
@ -407,9 +403,7 @@ REN_RasterizeFaceLinear (winding_t * w)
|
||||||
int count;
|
int count;
|
||||||
int numvertex;
|
int numvertex;
|
||||||
|
|
||||||
//
|
// find top vertex
|
||||||
// find top vertex
|
|
||||||
//
|
|
||||||
numvertex = w->numpoints;
|
numvertex = w->numpoints;
|
||||||
top = 0x7fffffff;
|
top = 0x7fffffff;
|
||||||
bot = 0x80000000;
|
bot = 0x80000000;
|
||||||
|
@ -430,9 +424,7 @@ REN_RasterizeFaceLinear (winding_t * w)
|
||||||
if (top < 0 || bot > r_height || top > bot)
|
if (top < 0 || bot > r_height || top > bot)
|
||||||
return; // shouldn't have to have this...
|
return; // shouldn't have to have this...
|
||||||
|
|
||||||
//
|
// render a trapezoid
|
||||||
// render a trapezoid
|
|
||||||
//
|
|
||||||
y = top;
|
y = top;
|
||||||
|
|
||||||
while (y < bot) {
|
while (y < bot) {
|
||||||
|
@ -564,15 +556,11 @@ REN_DrawCameraFace (face_t * idpol)
|
||||||
|
|
||||||
r_face = idpol;
|
r_face = idpol;
|
||||||
|
|
||||||
//
|
// back face cull
|
||||||
// back face cull
|
|
||||||
//
|
|
||||||
if (DotProduct (r_origin, idpol->plane.normal) <= idpol->plane.dist)
|
if (DotProduct (r_origin, idpol->plane.normal) <= idpol->plane.dist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//
|
// transform in 3D (FIXME: clip first, then transform)
|
||||||
// transform in 3D (FIXME: clip first, then transform)
|
|
||||||
//
|
|
||||||
in = idpol->w;
|
in = idpol->w;
|
||||||
numvertex = in->numpoints;
|
numvertex = in->numpoints;
|
||||||
|
|
||||||
|
@ -589,18 +577,14 @@ REN_DrawCameraFace (face_t * idpol)
|
||||||
w->points[i][4] = in->points[i][4];
|
w->points[i][4] = in->points[i][4];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// 3D clip
|
||||||
// 3D clip
|
|
||||||
//
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
w = ClipWinding (w, &rfrustum[i]);
|
w = ClipWinding (w, &rfrustum[i]);
|
||||||
if (!w)
|
if (!w)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// project to 2D
|
||||||
// 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];
|
scale = r_width_2 / w->points[i][2];
|
||||||
w->points[i][0] = r_width_2 + scale * w->points[i][0];
|
w->points[i][0] = r_width_2 + scale * w->points[i][0];
|
||||||
|
@ -608,9 +592,7 @@ REN_DrawCameraFace (face_t * idpol)
|
||||||
w->points[i][2] = scale;
|
w->points[i][2] = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// draw it
|
||||||
// draw it
|
|
||||||
//
|
|
||||||
REN_SetTexture (idpol);
|
REN_SetTexture (idpol);
|
||||||
|
|
||||||
REN_RasterizeFace (w);
|
REN_RasterizeFace (w);
|
||||||
|
@ -636,15 +618,11 @@ REN_DrawXYFace (face_t * idpol)
|
||||||
w = idpol->w;
|
w = idpol->w;
|
||||||
r_face = idpol;
|
r_face = idpol;
|
||||||
|
|
||||||
//
|
// back (and side) face cull
|
||||||
// back (and side) face cull
|
|
||||||
//
|
|
||||||
if (DotProduct (idpol->plane.normal, xy_viewnormal) > -VECTOR_EPSILON)
|
if (DotProduct (idpol->plane.normal, xy_viewnormal) > -VECTOR_EPSILON)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//
|
// transform
|
||||||
// transform
|
|
||||||
//
|
|
||||||
in = idpol->w;
|
in = idpol->w;
|
||||||
numvertex = in->numpoints;
|
numvertex = in->numpoints;
|
||||||
|
|
||||||
|
@ -661,18 +639,14 @@ REN_DrawXYFace (face_t * idpol)
|
||||||
w->points[i][4] = in->points[i][4];
|
w->points[i][4] = in->points[i][4];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// clip
|
||||||
// clip
|
|
||||||
//
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
w = ClipWinding (w, &rfrustum[i]);
|
w = ClipWinding (w, &rfrustum[i]);
|
||||||
if (!w)
|
if (!w)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// project to 2D
|
||||||
// project to 2D
|
|
||||||
//
|
|
||||||
for (i = 0; i < w->numpoints; i++) {
|
for (i = 0; i < w->numpoints; i++) {
|
||||||
dest = w->points[i];
|
dest = w->points[i];
|
||||||
if (dest[0] < 0)
|
if (dest[0] < 0)
|
||||||
|
@ -701,9 +675,7 @@ REN_DrawXYFace (face_t * idpol)
|
||||||
|
|
||||||
REN_SetTexture (idpol);
|
REN_SetTexture (idpol);
|
||||||
|
|
||||||
//
|
// draw it
|
||||||
// draw it
|
|
||||||
//
|
|
||||||
REN_RasterizeFaceLinear (w);
|
REN_RasterizeFaceLinear (w);
|
||||||
free (w);
|
free (w);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue