initial import of SDL port of Fitzquake-0.85 / 20090510 sources.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@2 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2010-02-15 23:26:55 +00:00
parent ed0da48b50
commit 08c736b005
160 changed files with 72105 additions and 0 deletions

View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Fitzquake" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/fitzquake" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Option parameters="-window -basedir /home/kristian/Desktop/Quake -sndspeed 48000" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/fitzquake" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="gcc" />
<Option parameters="-window -basedir /home/kristian/Desktop/Quake -sndspeed 48000" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="`sdl-config --cflags`" />
</Compiler>
<Linker>
<Add option="`sdl-config --libs`" />
<Add option="-lGL" />
<Add option="-lGLU" />
<Add option="-lSDL_net" />
<Add directory="C:/Programme/SDL/lib" />
</Linker>
<Unit filename="cb.bmp" />
<Unit filename="../Quake/anorm_dots.h" />
<Unit filename="../Quake/anorms.h" />
<Unit filename="../Quake/bspfile.h" />
<Unit filename="../Quake/cd_sdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cdaudio.h" />
<Unit filename="../Quake/chase.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cl_demo.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cl_input.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cl_main.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cl_parse.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cl_tent.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/client.h" />
<Unit filename="../Quake/cmd.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cmd.h" />
<Unit filename="../Quake/common.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/common.h" />
<Unit filename="../Quake/console.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/console.h" />
<Unit filename="../Quake/crc.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/crc.h" />
<Unit filename="../Quake/cvar.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/cvar.h" />
<Unit filename="../Quake/d_ifacea.h" />
<Unit filename="../Quake/draw.h" />
<Unit filename="../Quake/gl_draw.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_fog.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_mesh.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_model.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_model.h" />
<Unit filename="../Quake/gl_refrag.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_rlight.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_rmain.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_rmisc.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_screen.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_sky.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_test.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_texmgr.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_texmgr.h" />
<Unit filename="../Quake/gl_vidsdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_warp.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/gl_warp_sin.h" />
<Unit filename="../Quake/glquake.h" />
<Unit filename="../Quake/gnu.txt" />
<Unit filename="../Quake/host.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/host_cmd.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/image.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/image.h" />
<Unit filename="../Quake/in_sdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/input.h" />
<Unit filename="../Quake/keys.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/keys.h" />
<Unit filename="../Quake/main.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/mathlib.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/mathlib.h" />
<Unit filename="../Quake/menu.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/menu.h" />
<Unit filename="../Quake/modelgen.h" />
<Unit filename="../Quake/net.h" />
<Unit filename="../Quake/net_dgrm.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/net_dgrm.h" />
<Unit filename="../Quake/net_loop.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/net_loop.h" />
<Unit filename="../Quake/net_main.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/net_sdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/net_sdlnet.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/net_sdlnet.h" />
<Unit filename="../Quake/net_ser.h" />
<Unit filename="../Quake/pl_linux.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/platform.h" />
<Unit filename="../Quake/pr_cmds.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/pr_comp.h" />
<Unit filename="../Quake/pr_edict.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/pr_exec.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/progdefs.h" />
<Unit filename="../Quake/progdefs.q1" />
<Unit filename="../Quake/progs.h" />
<Unit filename="../Quake/protocol.h" />
<Unit filename="../Quake/quakedef.h" />
<Unit filename="../Quake/r_alias.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/r_brush.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/r_part.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/r_sprite.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/r_world.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/render.h" />
<Unit filename="../Quake/resource.h" />
<Unit filename="../Quake/sbar.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/sbar.h" />
<Unit filename="../Quake/screen.h" />
<Unit filename="../Quake/server.h" />
<Unit filename="../Quake/snd_dma.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/snd_mem.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/snd_mix.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/snd_sdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/sound.h" />
<Unit filename="../Quake/spritegn.h" />
<Unit filename="../Quake/sv_main.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/sv_move.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/sv_phys.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/sv_user.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/sys.h" />
<Unit filename="../Quake/sys_sdl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/vid.h" />
<Unit filename="../Quake/view.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/view.h" />
<Unit filename="../Quake/wad.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/wad.h" />
<Unit filename="../Quake/world.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/world.h" />
<Unit filename="../Quake/zone.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../Quake/zone.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Release" />
<File name="../Quake/cd_sdl.c" open="0" top="0" tabpos="0">
<Cursor position="1125" topLine="34" />
</File>
<File name="../Quake/chase.c" open="1" top="1" tabpos="1">
<Cursor position="1545" topLine="41" />
</File>
<File name="../Quake/cl_input.c" open="1" top="0" tabpos="5">
<Cursor position="5878" topLine="186" />
</File>
<File name="../Quake/cl_main.c" open="0" top="0" tabpos="6">
<Cursor position="14554" topLine="651" />
</File>
<File name="../Quake/cl_parse.c" open="0" top="0" tabpos="0">
<Cursor position="6252" topLine="251" />
</File>
<File name="../Quake/cl_tent.c" open="0" top="0" tabpos="0">
<Cursor position="8459" topLine="337" />
</File>
<File name="../Quake/common.c" open="0" top="0" tabpos="6">
<Cursor position="34577" topLine="1693" />
</File>
<File name="../Quake/common.h" open="0" top="0" tabpos="0">
<Cursor position="0" topLine="28" />
</File>
<File name="../Quake/console.h" open="1" top="0" tabpos="2">
<Cursor position="1590" topLine="15" />
</File>
<File name="../Quake/crc.h" open="0" top="0" tabpos="13">
<Cursor position="1086" topLine="0" />
</File>
<File name="../Quake/gl_draw.c" open="0" top="0" tabpos="1">
<Cursor position="10937" topLine="406" />
</File>
<File name="../Quake/gl_fog.c" open="0" top="0" tabpos="0">
<Cursor position="8190" topLine="368" />
</File>
<File name="../Quake/gl_sky.c" open="0" top="0" tabpos="9">
<Cursor position="14811" topLine="652" />
</File>
<File name="../Quake/gl_texmgr.h" open="0" top="0" tabpos="0">
<Cursor position="1553" topLine="22" />
</File>
<File name="../Quake/gl_vidsdl.c" open="0" top="0" tabpos="10">
<Cursor position="34053" topLine="1341" />
</File>
<File name="../Quake/glquake.h" open="0" top="0" tabpos="2">
<Cursor position="4610" topLine="161" />
</File>
<File name="../Quake/host.c" open="0" top="0" tabpos="1">
<Cursor position="15364" topLine="651" />
</File>
<File name="../Quake/image.h" open="0" top="0" tabpos="0">
<Cursor position="1040" topLine="7" />
</File>
<File name="../Quake/input.h" open="0" top="0" tabpos="0">
<Cursor position="1357" topLine="2" />
</File>
<File name="../Quake/mathlib.h" open="0" top="0" tabpos="3">
<Cursor position="2074" topLine="46" />
</File>
<File name="../Quake/menu.c" open="0" top="0" tabpos="2">
<Cursor position="63825" topLine="3065" />
</File>
<File name="../Quake/net_dgrm.c" open="0" top="0" tabpos="3">
<Cursor position="905" topLine="21" />
</File>
<File name="../Quake/platform.h" open="0" top="0" tabpos="0">
<Cursor position="983" topLine="10" />
</File>
<File name="../Quake/pr_exec.c" open="0" top="0" tabpos="7">
<Cursor position="4522" topLine="270" />
</File>
<File name="../Quake/quakedef.h" open="0" top="0" tabpos="5">
<Cursor position="823" topLine="0" />
</File>
<File name="../Quake/r_brush.c" open="0" top="0" tabpos="8">
<Cursor position="15512" topLine="585" />
</File>
<File name="../Quake/r_world.c" open="0" top="0" tabpos="7">
<Cursor position="9811" topLine="336" />
</File>
<File name="../Quake/render.h" open="0" top="0" tabpos="12">
<Cursor position="3869" topLine="105" />
</File>
<File name="../Quake/snd_dma.c" open="1" top="0" tabpos="4">
<Cursor position="1830" topLine="51" />
</File>
<File name="../Quake/snd_mix.c" open="0" top="0" tabpos="0">
<Cursor position="3595" topLine="145" />
</File>
<File name="../Quake/snd_sdl.c" open="1" top="0" tabpos="3">
<Cursor position="1435" topLine="20" />
</File>
<File name="../Quake/sys_sdl.c" open="0" top="0" tabpos="4">
<Cursor position="3415" topLine="137" />
</File>
<File name="../Quake/wad.c" open="0" top="0" tabpos="3">
<Cursor position="1942" topLine="38" />
</File>
</CodeBlocks_layout_file>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="Workspace">
<Project filename="Fitzquake.cbp" active="1" />
</Workspace>
</CodeBlocks_workspace_file>

BIN
quakespasm/Linux/cb.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,47 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import "QuakeArguments.h";
extern NSString *FQPrefCommandLineKey;
extern NSString *FQPrefFullscreenKey;
extern NSString *FQPrefScreenModeKey;
extern NSString *FQPrefShowDialog;
@interface AppController : NSObject {
IBOutlet NSWindow *launcherWindow;
IBOutlet NSTextField *paramTextField;
IBOutlet NSPopUpButton *screenModePopUp;
IBOutlet NSButton *fullscreenCheckBox;
IBOutlet NSButton *showDialogCheckBox;
NSMutableArray *screenModes;
QuakeArguments *arguments;
}
- (IBAction)changeScreenMode:(id)sender;
- (IBAction)launchQuake:(id)sender;
- (IBAction)cancel:(id)sender;
- (NSArray *)screenModes;
@end

View File

@ -0,0 +1,193 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "AppController.h"
#import "ScreenInfo.h"
#import "SDL.h"
#import "SDLMain.h"
NSString *FQPrefCommandLineKey = @"CommandLine";
NSString *FQPrefFullscreenKey = @"Fullscreen";
NSString *FQPrefScreenModeKey = @"ScreenMode";
NSString *FQPrefShowDialog = @"ShowDialog";
@implementation AppController
+(void) initialize {
NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
[defaults setObject:@"" forKey:FQPrefCommandLineKey];
[defaults setObject:[NSNumber numberWithBool:YES] forKey:FQPrefFullscreenKey];
[defaults setObject:[NSNumber numberWithInt:0] forKey:FQPrefScreenModeKey];
[defaults setObject:[NSNumber numberWithBool:YES] forKey:FQPrefShowDialog];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
}
- (id)init {
int i,j;
int flags;
int bpps[3] = {32, 24, 16};
SDL_PixelFormat format;
SDL_Rect **modes;
ScreenInfo *info;
self = [super init];
if (!self)
return nil;
screenModes = [[NSMutableArray alloc] init];
[screenModes addObject:@"Default or command line arguments"];
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
return self;
flags = SDL_OPENGL | SDL_FULLSCREEN;
format.palette = NULL;
for (i = 0; i < 3; i++) {
format.BitsPerPixel = bpps[i];
modes = SDL_ListModes(&format, flags);
if (modes == (SDL_Rect **)0 || modes == (SDL_Rect **)-1)
continue;
for (j = 0; modes[j]; j++) {
info = [[ScreenInfo alloc] initWithWidth:modes[j]->w height:modes[j]->h bpp:bpps[i]];
[screenModes addObject:info];
[info release];
}
}
SDL_QuitSubSystem(SDL_INIT_VIDEO);
arguments = [[QuakeArguments alloc] initWithArguments:gArgv + 1 count:gArgc - 1];
return self;
}
- (NSArray *)screenModes {
return screenModes;
}
- (void)awakeFromNib {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL showDialog = [defaults boolForKey:FQPrefShowDialog];
[showDialogCheckBox setState:showDialog ? NSOnState : NSOffState];
if ([arguments count] > 0) {
[paramTextField setStringValue:[arguments description]];
if ([arguments argument:@"-window"] != nil)
[fullscreenCheckBox setState:NSOffState];
} else {
[paramTextField setStringValue:[defaults stringForKey:FQPrefCommandLineKey]];
BOOL fullscreen = [defaults boolForKey:FQPrefFullscreenKey];
[fullscreenCheckBox setState:fullscreen ? NSOnState : NSOffState];
int screenModeIndex = [defaults integerForKey:FQPrefScreenModeKey];
[screenModePopUp selectItemAtIndex:screenModeIndex];
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL showDialog = [defaults boolForKey:FQPrefShowDialog];
CGEventRef event = CGEventCreate(NULL /*default event source*/);
CGEventFlags mods = CGEventGetFlags(event);
if (showDialog || (mods & kCGEventFlagMaskCommand))
[launcherWindow makeKeyAndOrderFront:self];
else
[self launchQuake:self];
}
- (IBAction)changeScreenMode:(id)sender {
int index = [screenModePopUp indexOfSelectedItem];
[fullscreenCheckBox setEnabled:index != 0];
}
- (IBAction)launchQuake:(id)sender {
[arguments parseArguments:[paramTextField stringValue]];
int index = [screenModePopUp indexOfSelectedItem];
if (index > 0) {
ScreenInfo *info = [screenModes objectAtIndex:index];
int width = [info width];
int height = [info height];
int bpp = [info bpp];
BOOL fullscreen = [fullscreenCheckBox state] == NSOnState;
[arguments addArgument:@"-width" withValue:[NSString stringWithFormat:@"%d", width]];
[arguments addArgument:@"-height" withValue:[NSString stringWithFormat:@"%d", height]];
[arguments addArgument:@"-bpp" withValue:[NSString stringWithFormat:@"%d", bpp]];
if (!fullscreen)
[arguments addArgument:@"-window"];
}
NSString *path = [NSString stringWithCString:gArgv[0] encoding:NSASCIIStringEncoding];
int i;
for (i = 0; i < 4; i++)
path = [path stringByDeletingLastPathComponent];
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager changeCurrentDirectoryPath:path];
int argc = [arguments count] + 1;
char *argv[argc];
argv[0] = gArgv[0];
[arguments setArguments:argv + 1];
[launcherWindow close];
// update the defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[paramTextField stringValue] forKey:FQPrefCommandLineKey];
[defaults setObject:[NSNumber numberWithBool:[fullscreenCheckBox state] == NSOnState] forKey:FQPrefFullscreenKey];
[defaults setObject:[NSNumber numberWithInt:index] forKey:FQPrefScreenModeKey];
[defaults setObject:[NSNumber numberWithBool:[showDialogCheckBox state] == NSOnState] forKey:FQPrefShowDialog];
[defaults synchronize];
int status = SDL_main (argc, argv);
exit(status);
}
- (IBAction)cancel:(id)sender {
exit(0);
}
- (void) dealloc
{
[screenModes release];
[super dealloc];
}
@end

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,149 @@
// !$*UTF8*$!
{
29B97313FDCFA39411CA2CEA /* Project object */ = {
activeArchitecture = i386;
activeBuildConfigurationName = Release;
activeExecutable = 9ABC4B480FB729A900F2D53C /* Fitzquake */;
activeTarget = 8D1107260486CEB800E47090 /* Fitzquake */;
codeSenseManager = 9ABC4B5A0FB729C800F2D53C /* Code sense */;
executables = (
9ABC4B480FB729A900F2D53C /* Fitzquake */,
);
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
380,
415.20849609375,
);
PBXFileTableDataSourceColumnsKey = (
PBXErrorsWarningsDataSource_TypeID,
PBXErrorsWarningsDataSource_MessageID,
PBXErrorsWarningsDataSource_LocationID,
);
};
PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
PBXFileTableDataSourceColumnWidthsKey = (
22,
300,
493,
);
PBXFileTableDataSourceColumnsKey = (
PBXExecutablesDataSource_ActiveFlagID,
PBXExecutablesDataSource_NameID,
PBXExecutablesDataSource_CommentsID,
);
};
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
605,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
565,
60,
20,
48.16259765625,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 263667008;
PBXWorkspaceStateSaveDate = 263667008;
};
sourceControlManager = 9ABC4B590FB729C800F2D53C /* Source Control */;
userBuildSettings = {
};
};
483A77F00D2EE97700CB2E4C /* quakedef.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {691, 4648}}";
sepNavSelRange = "{6952, 0}";
sepNavVisRange = "{6466, 510}";
sepNavWindowFrame = "{{84, 252}, {750, 558}}";
};
};
483A78050D2EE9F300CB2E4C /* gl_texmgr.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {691, 1386}}";
sepNavSelRange = "{2686, 16}";
sepNavVisRange = "{0, 1341}";
sepNavWindowFrame = "{{61, 273}, {750, 558}}";
};
};
8D1107260486CEB800E47090 /* Fitzquake */ = {
activeExec = 0;
executables = (
9ABC4B480FB729A900F2D53C /* Fitzquake */,
);
};
9ABC4B480FB729A900F2D53C /* Fitzquake */ = {
isa = PBXExecutable;
activeArgIndices = (
);
argumentStrings = (
);
autoAttachOnCrash = 1;
breakpointsEnabled = 0;
configStateDict = {
};
customDataFormattersEnabled = 1;
debuggerPlugin = GDBDebugging;
disassemblyDisplayState = 0;
dylibVariantSuffix = "";
enableDebugStr = 1;
environmentEntries = (
);
executableSystemSymbolLevel = 0;
executableUserSymbolLevel = 0;
libgmallocEnabled = 0;
name = Fitzquake;
sourceDirectories = (
);
};
9ABC4B590FB729C800F2D53C /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
};
};
9ABC4B5A0FB729C800F2D53C /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
}

View File

@ -0,0 +1,793 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; };
002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; };
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A2C09D0888800EBEB88 /* SDLMain.m */; };
002F3C0109D093BD00EBEB88 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F3C0009D093BD00EBEB88 /* OpenGL.framework */; };
002F3C6109D0951E00EBEB88 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F3C6009D0951E00EBEB88 /* GLUT.framework */; };
48243B140D33F01A00C29F8F /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 48243B130D33F01A00C29F8F /* main.c */; };
4824B3360DF5542E0001ED2C /* SDL_net.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 48DA393E0D998BC9007C2A77 /* SDL_net.framework */; };
48305B550D8AF90600A29C24 /* net_udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 48305B540D8AF90600A29C24 /* net_udp.c */; };
4830B79F0D464CAE00EF4498 /* Changelog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 4830B79D0D464CAE00EF4498 /* Changelog.txt */; };
4830B7A00D464CAE00EF4498 /* Todo.txt in Resources */ = {isa = PBXBuildFile; fileRef = 4830B79E0D464CAE00EF4498 /* Todo.txt */; };
483A780F0D2EEA0F00CB2E4C /* progdefs.q1 in Resources */ = {isa = PBXBuildFile; fileRef = 483A780E0D2EEA0F00CB2E4C /* progdefs.q1 */; };
483A78230D2EEA5400CB2E4C /* chase.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78100D2EEA5400CB2E4C /* chase.c */; };
483A78240D2EEA5400CB2E4C /* cmd.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78110D2EEA5400CB2E4C /* cmd.c */; };
483A78250D2EEA5400CB2E4C /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78120D2EEA5400CB2E4C /* common.c */; };
483A78260D2EEA5400CB2E4C /* console.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78130D2EEA5400CB2E4C /* console.c */; };
483A78270D2EEA5400CB2E4C /* crc.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78140D2EEA5400CB2E4C /* crc.c */; };
483A78280D2EEA5400CB2E4C /* cvar.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78150D2EEA5400CB2E4C /* cvar.c */; };
483A78290D2EEA5400CB2E4C /* host_cmd.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78160D2EEA5400CB2E4C /* host_cmd.c */; };
483A782A0D2EEA5400CB2E4C /* host.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78170D2EEA5400CB2E4C /* host.c */; };
483A782B0D2EEA5400CB2E4C /* mathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78180D2EEA5400CB2E4C /* mathlib.c */; };
483A782C0D2EEA5400CB2E4C /* menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78190D2EEA5400CB2E4C /* menu.c */; };
483A782D0D2EEA5400CB2E4C /* pr_cmds.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A781A0D2EEA5400CB2E4C /* pr_cmds.c */; };
483A782E0D2EEA5400CB2E4C /* pr_edict.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A781B0D2EEA5400CB2E4C /* pr_edict.c */; };
483A782F0D2EEA5400CB2E4C /* pr_exec.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A781C0D2EEA5400CB2E4C /* pr_exec.c */; };
483A78300D2EEA5400CB2E4C /* sbar.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A781D0D2EEA5400CB2E4C /* sbar.c */; };
483A78310D2EEA5400CB2E4C /* sys_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A781E0D2EEA5400CB2E4C /* sys_sdl.c */; };
483A78320D2EEA5400CB2E4C /* view.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A781F0D2EEA5400CB2E4C /* view.c */; };
483A78330D2EEA5400CB2E4C /* wad.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78200D2EEA5400CB2E4C /* wad.c */; };
483A78340D2EEA5400CB2E4C /* world.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78210D2EEA5400CB2E4C /* world.c */; };
483A78350D2EEA5400CB2E4C /* zone.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78220D2EEA5400CB2E4C /* zone.c */; };
483A78380D2EEA6D00CB2E4C /* in_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78360D2EEA6D00CB2E4C /* in_sdl.c */; };
483A78390D2EEA6D00CB2E4C /* keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78370D2EEA6D00CB2E4C /* keys.c */; };
483A78450D2EEAAB00CB2E4C /* cl_demo.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A783A0D2EEAAB00CB2E4C /* cl_demo.c */; };
483A78460D2EEAAB00CB2E4C /* cl_input.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A783B0D2EEAAB00CB2E4C /* cl_input.c */; };
483A78470D2EEAAB00CB2E4C /* cl_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A783C0D2EEAAB00CB2E4C /* cl_main.c */; };
483A78480D2EEAAB00CB2E4C /* cl_parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A783D0D2EEAAB00CB2E4C /* cl_parse.c */; };
483A78490D2EEAAB00CB2E4C /* cl_tent.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A783E0D2EEAAB00CB2E4C /* cl_tent.c */; };
483A784A0D2EEAAB00CB2E4C /* net_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A783F0D2EEAAB00CB2E4C /* net_main.c */; };
483A784B0D2EEAAB00CB2E4C /* net_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78400D2EEAAB00CB2E4C /* net_sdl.c */; };
483A784C0D2EEAAB00CB2E4C /* sv_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78410D2EEAAB00CB2E4C /* sv_main.c */; };
483A784D0D2EEAAB00CB2E4C /* sv_move.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78420D2EEAAB00CB2E4C /* sv_move.c */; };
483A784E0D2EEAAB00CB2E4C /* sv_phys.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78430D2EEAAB00CB2E4C /* sv_phys.c */; };
483A784F0D2EEAAB00CB2E4C /* sv_user.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78440D2EEAAB00CB2E4C /* sv_user.c */; };
483A78550D2EEAC300CB2E4C /* cd_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78500D2EEAC300CB2E4C /* cd_sdl.c */; };
483A78590D2EEAC300CB2E4C /* snd_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78540D2EEAC300CB2E4C /* snd_sdl.c */; };
483A786E0D2EEAF000CB2E4C /* gl_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A785A0D2EEAF000CB2E4C /* gl_draw.c */; };
483A786F0D2EEAF000CB2E4C /* gl_fog.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A785B0D2EEAF000CB2E4C /* gl_fog.c */; };
483A78700D2EEAF000CB2E4C /* gl_mesh.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A785C0D2EEAF000CB2E4C /* gl_mesh.c */; };
483A78710D2EEAF000CB2E4C /* gl_model.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A785D0D2EEAF000CB2E4C /* gl_model.c */; };
483A78720D2EEAF000CB2E4C /* gl_refrag.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A785E0D2EEAF000CB2E4C /* gl_refrag.c */; };
483A78730D2EEAF000CB2E4C /* gl_rlight.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A785F0D2EEAF000CB2E4C /* gl_rlight.c */; };
483A78740D2EEAF000CB2E4C /* gl_rmain.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78600D2EEAF000CB2E4C /* gl_rmain.c */; };
483A78750D2EEAF000CB2E4C /* gl_rmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78610D2EEAF000CB2E4C /* gl_rmisc.c */; };
483A78760D2EEAF000CB2E4C /* gl_screen.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78620D2EEAF000CB2E4C /* gl_screen.c */; };
483A78770D2EEAF000CB2E4C /* gl_sky.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78630D2EEAF000CB2E4C /* gl_sky.c */; };
483A78780D2EEAF000CB2E4C /* gl_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78640D2EEAF000CB2E4C /* gl_test.c */; };
483A78790D2EEAF000CB2E4C /* gl_texmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78650D2EEAF000CB2E4C /* gl_texmgr.c */; };
483A787A0D2EEAF000CB2E4C /* gl_vidsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78660D2EEAF000CB2E4C /* gl_vidsdl.c */; };
483A787B0D2EEAF000CB2E4C /* gl_warp.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78670D2EEAF000CB2E4C /* gl_warp.c */; };
483A787C0D2EEAF000CB2E4C /* image.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78680D2EEAF000CB2E4C /* image.c */; };
483A787D0D2EEAF000CB2E4C /* r_alias.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A78690D2EEAF000CB2E4C /* r_alias.c */; };
483A787E0D2EEAF000CB2E4C /* r_brush.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A786A0D2EEAF000CB2E4C /* r_brush.c */; };
483A787F0D2EEAF000CB2E4C /* r_part.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A786B0D2EEAF000CB2E4C /* r_part.c */; };
483A78800D2EEAF000CB2E4C /* r_sprite.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A786C0D2EEAF000CB2E4C /* r_sprite.c */; };
483A78810D2EEAF000CB2E4C /* r_world.c in Sources */ = {isa = PBXBuildFile; fileRef = 483A786D0D2EEAF000CB2E4C /* r_world.c */; };
484AA4B40D3FF6C0005D917A /* Fitzquake.icns in Resources */ = {isa = PBXBuildFile; fileRef = 484AA4B30D3FF6C0005D917A /* Fitzquake.icns */; };
486577CB0D31A22A00E7920A /* snd_dma.c in Sources */ = {isa = PBXBuildFile; fileRef = 486577C80D31A22A00E7920A /* snd_dma.c */; };
486577CC0D31A22A00E7920A /* snd_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 486577C90D31A22A00E7920A /* snd_mem.c */; };
486577CD0D31A22A00E7920A /* snd_mix.c in Sources */ = {isa = PBXBuildFile; fileRef = 486577CA0D31A22A00E7920A /* snd_mix.c */; };
48728D2D0D3004A80004D61B /* net_dgrm.c in Sources */ = {isa = PBXBuildFile; fileRef = 48728D280D3004A70004D61B /* net_dgrm.c */; };
48728D2E0D3004A80004D61B /* net_loop.c in Sources */ = {isa = PBXBuildFile; fileRef = 48728D2A0D3004A80004D61B /* net_loop.c */; };
487C0A5D0DA94A0700A49FF5 /* net_sdlnet.c in Sources */ = {isa = PBXBuildFile; fileRef = 487C0A5B0DA94A0700A49FF5 /* net_sdlnet.c */; };
48895DB90D4914A000849ABF /* pl_osx.m in Sources */ = {isa = PBXBuildFile; fileRef = 48895DB80D4914A000849ABF /* pl_osx.m */; };
489D8D2F0D3A630D00AA4471 /* ScreenInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 489D8D2E0D3A630D00AA4471 /* ScreenInfo.m */; };
48B9E7880D340B1E0001CACF /* Launcher.nib in Resources */ = {isa = PBXBuildFile; fileRef = 48B9E7860D340B1E0001CACF /* Launcher.nib */; };
48B9E7A70D340BEA0001CACF /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B9E7A60D340BEA0001CACF /* AppController.m */; };
48B9E7C00D340EA80001CACF /* SDLApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B9E7BF0D340EA80001CACF /* SDLApplication.m */; };
48C85E3B0D3AD10E00797678 /* QuakeArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 48C85E3A0D3AD10E00797678 /* QuakeArgument.m */; };
48DA393F0D998BC9007C2A77 /* SDL_net.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48DA393E0D998BC9007C2A77 /* SDL_net.framework */; };
48FE585B0D3A82C8006BB491 /* QuakeArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 48FE585A0D3A82C8006BB491 /* QuakeArguments.m */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */,
4824B3360DF5542E0001ED2C /* SDL_net.framework in Copy Frameworks into .app bundle */,
);
name = "Copy Frameworks into .app bundle";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
002F39F909D0881F00EBEB88 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
002F3A2B09D0888800EBEB88 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = "<group>"; };
002F3A2C09D0888800EBEB88 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = "<group>"; };
002F3C0009D093BD00EBEB88 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
002F3C6009D0951E00EBEB88 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../../../../../../../../System/Library/Frameworks/GLUT.framework; sourceTree = SOURCE_ROOT; };
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* Fitzquake_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fitzquake_Prefix.pch; sourceTree = "<group>"; };
48243B130D33F01A00C29F8F /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../Quake/main.c; sourceTree = SOURCE_ROOT; };
48305B530D8AF8EC00A29C24 /* net_udp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = net_udp.h; path = ../Quake/net_udp.h; sourceTree = SOURCE_ROOT; };
48305B540D8AF90600A29C24 /* net_udp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = net_udp.c; path = ../Quake/net_udp.c; sourceTree = SOURCE_ROOT; };
4830B79D0D464CAE00EF4498 /* Changelog.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Changelog.txt; path = ../Misc/Changelog.txt; sourceTree = SOURCE_ROOT; };
4830B79E0D464CAE00EF4498 /* Todo.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Todo.txt; path = ../Misc/Todo.txt; sourceTree = SOURCE_ROOT; };
483A77E60D2EE97700CB2E4C /* cmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cmd.h; path = ../Quake/cmd.h; sourceTree = SOURCE_ROOT; };
483A77E70D2EE97700CB2E4C /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../Quake/common.h; sourceTree = SOURCE_ROOT; };
483A77E80D2EE97700CB2E4C /* console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = console.h; path = ../Quake/console.h; sourceTree = SOURCE_ROOT; };
483A77E90D2EE97700CB2E4C /* crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crc.h; path = ../Quake/crc.h; sourceTree = SOURCE_ROOT; };
483A77EA0D2EE97700CB2E4C /* cvar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cvar.h; path = ../Quake/cvar.h; sourceTree = SOURCE_ROOT; };
483A77EB0D2EE97700CB2E4C /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlib.h; path = ../Quake/mathlib.h; sourceTree = SOURCE_ROOT; };
483A77EC0D2EE97700CB2E4C /* menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = menu.h; path = ../Quake/menu.h; sourceTree = SOURCE_ROOT; };
483A77ED0D2EE97700CB2E4C /* pr_comp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pr_comp.h; path = ../Quake/pr_comp.h; sourceTree = SOURCE_ROOT; };
483A77EE0D2EE97700CB2E4C /* progdefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = progdefs.h; path = ../Quake/progdefs.h; sourceTree = SOURCE_ROOT; };
483A77EF0D2EE97700CB2E4C /* progs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = progs.h; path = ../Quake/progs.h; sourceTree = SOURCE_ROOT; };
483A77F00D2EE97700CB2E4C /* quakedef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = quakedef.h; path = ../Quake/quakedef.h; sourceTree = SOURCE_ROOT; };
483A77F10D2EE97700CB2E4C /* sbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sbar.h; path = ../Quake/sbar.h; sourceTree = SOURCE_ROOT; };
483A77F20D2EE97700CB2E4C /* sys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sys.h; path = ../Quake/sys.h; sourceTree = SOURCE_ROOT; };
483A77F30D2EE97700CB2E4C /* view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = view.h; path = ../Quake/view.h; sourceTree = SOURCE_ROOT; };
483A77F40D2EE97700CB2E4C /* wad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wad.h; path = ../Quake/wad.h; sourceTree = SOURCE_ROOT; };
483A77F50D2EE97700CB2E4C /* world.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = world.h; path = ../Quake/world.h; sourceTree = SOURCE_ROOT; };
483A77F60D2EE97700CB2E4C /* zone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zone.h; path = ../Quake/zone.h; sourceTree = SOURCE_ROOT; };
483A77F70D2EE98D00CB2E4C /* input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = input.h; path = ../Quake/input.h; sourceTree = SOURCE_ROOT; };
483A77F80D2EE98D00CB2E4C /* keys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = keys.h; path = ../Quake/keys.h; sourceTree = SOURCE_ROOT; };
483A77F90D2EE9A900CB2E4C /* client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = client.h; path = ../Quake/client.h; sourceTree = SOURCE_ROOT; };
483A77FA0D2EE9A900CB2E4C /* net.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = net.h; path = ../Quake/net.h; sourceTree = SOURCE_ROOT; };
483A77FB0D2EE9A900CB2E4C /* protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = protocol.h; path = ../Quake/protocol.h; sourceTree = SOURCE_ROOT; };
483A77FC0D2EE9A900CB2E4C /* server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = server.h; path = ../Quake/server.h; sourceTree = SOURCE_ROOT; };
483A77FD0D2EE9BD00CB2E4C /* cdaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cdaudio.h; path = ../Quake/cdaudio.h; sourceTree = SOURCE_ROOT; };
483A77FE0D2EE9BD00CB2E4C /* sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sound.h; path = ../Quake/sound.h; sourceTree = SOURCE_ROOT; };
483A77FF0D2EE9F300CB2E4C /* anorm_dots.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = anorm_dots.h; path = ../Quake/anorm_dots.h; sourceTree = SOURCE_ROOT; };
483A78000D2EE9F300CB2E4C /* anorms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = anorms.h; path = ../Quake/anorms.h; sourceTree = SOURCE_ROOT; };
483A78010D2EE9F300CB2E4C /* bspfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bspfile.h; path = ../Quake/bspfile.h; sourceTree = SOURCE_ROOT; };
483A78020D2EE9F300CB2E4C /* d_ifacea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = d_ifacea.h; path = ../Quake/d_ifacea.h; sourceTree = SOURCE_ROOT; };
483A78030D2EE9F300CB2E4C /* draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = draw.h; path = ../Quake/draw.h; sourceTree = SOURCE_ROOT; };
483A78040D2EE9F300CB2E4C /* gl_model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl_model.h; path = ../Quake/gl_model.h; sourceTree = SOURCE_ROOT; };
483A78050D2EE9F300CB2E4C /* gl_texmgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl_texmgr.h; path = ../Quake/gl_texmgr.h; sourceTree = SOURCE_ROOT; };
483A78060D2EE9F300CB2E4C /* gl_warp_sin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl_warp_sin.h; path = ../Quake/gl_warp_sin.h; sourceTree = SOURCE_ROOT; };
483A78070D2EE9F300CB2E4C /* glquake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glquake.h; path = ../Quake/glquake.h; sourceTree = SOURCE_ROOT; };
483A78080D2EE9F300CB2E4C /* image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = image.h; path = ../Quake/image.h; sourceTree = SOURCE_ROOT; };
483A78090D2EE9F300CB2E4C /* modelgen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = modelgen.h; path = ../Quake/modelgen.h; sourceTree = SOURCE_ROOT; };
483A780A0D2EE9F300CB2E4C /* render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = render.h; path = ../Quake/render.h; sourceTree = SOURCE_ROOT; };
483A780B0D2EE9F300CB2E4C /* screen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = screen.h; path = ../Quake/screen.h; sourceTree = SOURCE_ROOT; };
483A780C0D2EE9F300CB2E4C /* spritegn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spritegn.h; path = ../Quake/spritegn.h; sourceTree = SOURCE_ROOT; };
483A780D0D2EE9F300CB2E4C /* vid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vid.h; path = ../Quake/vid.h; sourceTree = SOURCE_ROOT; };
483A780E0D2EEA0F00CB2E4C /* progdefs.q1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = progdefs.q1; path = ../Quake/progdefs.q1; sourceTree = SOURCE_ROOT; };
483A78100D2EEA5400CB2E4C /* chase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = chase.c; path = ../Quake/chase.c; sourceTree = SOURCE_ROOT; };
483A78110D2EEA5400CB2E4C /* cmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cmd.c; path = ../Quake/cmd.c; sourceTree = SOURCE_ROOT; };
483A78120D2EEA5400CB2E4C /* common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = common.c; path = ../Quake/common.c; sourceTree = SOURCE_ROOT; };
483A78130D2EEA5400CB2E4C /* console.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = console.c; path = ../Quake/console.c; sourceTree = SOURCE_ROOT; };
483A78140D2EEA5400CB2E4C /* crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crc.c; path = ../Quake/crc.c; sourceTree = SOURCE_ROOT; };
483A78150D2EEA5400CB2E4C /* cvar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cvar.c; path = ../Quake/cvar.c; sourceTree = SOURCE_ROOT; };
483A78160D2EEA5400CB2E4C /* host_cmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = host_cmd.c; path = ../Quake/host_cmd.c; sourceTree = SOURCE_ROOT; };
483A78170D2EEA5400CB2E4C /* host.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = host.c; path = ../Quake/host.c; sourceTree = SOURCE_ROOT; };
483A78180D2EEA5400CB2E4C /* mathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mathlib.c; path = ../Quake/mathlib.c; sourceTree = SOURCE_ROOT; };
483A78190D2EEA5400CB2E4C /* menu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = menu.c; path = ../Quake/menu.c; sourceTree = SOURCE_ROOT; };
483A781A0D2EEA5400CB2E4C /* pr_cmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pr_cmds.c; path = ../Quake/pr_cmds.c; sourceTree = SOURCE_ROOT; };
483A781B0D2EEA5400CB2E4C /* pr_edict.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pr_edict.c; path = ../Quake/pr_edict.c; sourceTree = SOURCE_ROOT; };
483A781C0D2EEA5400CB2E4C /* pr_exec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pr_exec.c; path = ../Quake/pr_exec.c; sourceTree = SOURCE_ROOT; };
483A781D0D2EEA5400CB2E4C /* sbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sbar.c; path = ../Quake/sbar.c; sourceTree = SOURCE_ROOT; };
483A781E0D2EEA5400CB2E4C /* sys_sdl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sys_sdl.c; path = ../Quake/sys_sdl.c; sourceTree = SOURCE_ROOT; };
483A781F0D2EEA5400CB2E4C /* view.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = view.c; path = ../Quake/view.c; sourceTree = SOURCE_ROOT; };
483A78200D2EEA5400CB2E4C /* wad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wad.c; path = ../Quake/wad.c; sourceTree = SOURCE_ROOT; };
483A78210D2EEA5400CB2E4C /* world.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = world.c; path = ../Quake/world.c; sourceTree = SOURCE_ROOT; };
483A78220D2EEA5400CB2E4C /* zone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zone.c; path = ../Quake/zone.c; sourceTree = SOURCE_ROOT; };
483A78360D2EEA6D00CB2E4C /* in_sdl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = in_sdl.c; path = ../Quake/in_sdl.c; sourceTree = SOURCE_ROOT; };
483A78370D2EEA6D00CB2E4C /* keys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = keys.c; path = ../Quake/keys.c; sourceTree = SOURCE_ROOT; };
483A783A0D2EEAAB00CB2E4C /* cl_demo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cl_demo.c; path = ../Quake/cl_demo.c; sourceTree = SOURCE_ROOT; };
483A783B0D2EEAAB00CB2E4C /* cl_input.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cl_input.c; path = ../Quake/cl_input.c; sourceTree = SOURCE_ROOT; };
483A783C0D2EEAAB00CB2E4C /* cl_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cl_main.c; path = ../Quake/cl_main.c; sourceTree = SOURCE_ROOT; };
483A783D0D2EEAAB00CB2E4C /* cl_parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cl_parse.c; path = ../Quake/cl_parse.c; sourceTree = SOURCE_ROOT; };
483A783E0D2EEAAB00CB2E4C /* cl_tent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cl_tent.c; path = ../Quake/cl_tent.c; sourceTree = SOURCE_ROOT; };
483A783F0D2EEAAB00CB2E4C /* net_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = net_main.c; path = ../Quake/net_main.c; sourceTree = SOURCE_ROOT; };
483A78400D2EEAAB00CB2E4C /* net_sdl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = net_sdl.c; path = ../Quake/net_sdl.c; sourceTree = SOURCE_ROOT; };
483A78410D2EEAAB00CB2E4C /* sv_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sv_main.c; path = ../Quake/sv_main.c; sourceTree = SOURCE_ROOT; };
483A78420D2EEAAB00CB2E4C /* sv_move.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sv_move.c; path = ../Quake/sv_move.c; sourceTree = SOURCE_ROOT; };
483A78430D2EEAAB00CB2E4C /* sv_phys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sv_phys.c; path = ../Quake/sv_phys.c; sourceTree = SOURCE_ROOT; };
483A78440D2EEAAB00CB2E4C /* sv_user.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sv_user.c; path = ../Quake/sv_user.c; sourceTree = SOURCE_ROOT; };
483A78500D2EEAC300CB2E4C /* cd_sdl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cd_sdl.c; path = ../Quake/cd_sdl.c; sourceTree = SOURCE_ROOT; };
483A78540D2EEAC300CB2E4C /* snd_sdl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_sdl.c; path = ../Quake/snd_sdl.c; sourceTree = SOURCE_ROOT; };
483A785A0D2EEAF000CB2E4C /* gl_draw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_draw.c; path = ../Quake/gl_draw.c; sourceTree = SOURCE_ROOT; };
483A785B0D2EEAF000CB2E4C /* gl_fog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_fog.c; path = ../Quake/gl_fog.c; sourceTree = SOURCE_ROOT; };
483A785C0D2EEAF000CB2E4C /* gl_mesh.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_mesh.c; path = ../Quake/gl_mesh.c; sourceTree = SOURCE_ROOT; };
483A785D0D2EEAF000CB2E4C /* gl_model.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_model.c; path = ../Quake/gl_model.c; sourceTree = SOURCE_ROOT; };
483A785E0D2EEAF000CB2E4C /* gl_refrag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_refrag.c; path = ../Quake/gl_refrag.c; sourceTree = SOURCE_ROOT; };
483A785F0D2EEAF000CB2E4C /* gl_rlight.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_rlight.c; path = ../Quake/gl_rlight.c; sourceTree = SOURCE_ROOT; };
483A78600D2EEAF000CB2E4C /* gl_rmain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_rmain.c; path = ../Quake/gl_rmain.c; sourceTree = SOURCE_ROOT; };
483A78610D2EEAF000CB2E4C /* gl_rmisc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_rmisc.c; path = ../Quake/gl_rmisc.c; sourceTree = SOURCE_ROOT; };
483A78620D2EEAF000CB2E4C /* gl_screen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_screen.c; path = ../Quake/gl_screen.c; sourceTree = SOURCE_ROOT; };
483A78630D2EEAF000CB2E4C /* gl_sky.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_sky.c; path = ../Quake/gl_sky.c; sourceTree = SOURCE_ROOT; };
483A78640D2EEAF000CB2E4C /* gl_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_test.c; path = ../Quake/gl_test.c; sourceTree = SOURCE_ROOT; };
483A78650D2EEAF000CB2E4C /* gl_texmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_texmgr.c; path = ../Quake/gl_texmgr.c; sourceTree = SOURCE_ROOT; };
483A78660D2EEAF000CB2E4C /* gl_vidsdl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_vidsdl.c; path = ../Quake/gl_vidsdl.c; sourceTree = SOURCE_ROOT; };
483A78670D2EEAF000CB2E4C /* gl_warp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_warp.c; path = ../Quake/gl_warp.c; sourceTree = SOURCE_ROOT; };
483A78680D2EEAF000CB2E4C /* image.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = image.c; path = ../Quake/image.c; sourceTree = SOURCE_ROOT; };
483A78690D2EEAF000CB2E4C /* r_alias.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = r_alias.c; path = ../Quake/r_alias.c; sourceTree = SOURCE_ROOT; };
483A786A0D2EEAF000CB2E4C /* r_brush.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = r_brush.c; path = ../Quake/r_brush.c; sourceTree = SOURCE_ROOT; };
483A786B0D2EEAF000CB2E4C /* r_part.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = r_part.c; path = ../Quake/r_part.c; sourceTree = SOURCE_ROOT; };
483A786C0D2EEAF000CB2E4C /* r_sprite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = r_sprite.c; path = ../Quake/r_sprite.c; sourceTree = SOURCE_ROOT; };
483A786D0D2EEAF000CB2E4C /* r_world.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = r_world.c; path = ../Quake/r_world.c; sourceTree = SOURCE_ROOT; };
4846EB500D329BEB00A108DE /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = ../Quake/platform.h; sourceTree = SOURCE_ROOT; };
484AA4B30D3FF6C0005D917A /* Fitzquake.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Fitzquake.icns; sourceTree = "<group>"; };
486577C80D31A22A00E7920A /* snd_dma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_dma.c; path = ../Quake/snd_dma.c; sourceTree = SOURCE_ROOT; };
486577C90D31A22A00E7920A /* snd_mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mem.c; path = ../Quake/snd_mem.c; sourceTree = SOURCE_ROOT; };
486577CA0D31A22A00E7920A /* snd_mix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mix.c; path = ../Quake/snd_mix.c; sourceTree = SOURCE_ROOT; };
48728D280D3004A70004D61B /* net_dgrm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = net_dgrm.c; path = ../Quake/net_dgrm.c; sourceTree = SOURCE_ROOT; };
48728D290D3004A80004D61B /* net_dgrm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = net_dgrm.h; path = ../Quake/net_dgrm.h; sourceTree = SOURCE_ROOT; };
48728D2A0D3004A80004D61B /* net_loop.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = net_loop.c; path = ../Quake/net_loop.c; sourceTree = SOURCE_ROOT; };
48728D2B0D3004A80004D61B /* net_loop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = net_loop.h; path = ../Quake/net_loop.h; sourceTree = SOURCE_ROOT; };
487C0A5B0DA94A0700A49FF5 /* net_sdlnet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = net_sdlnet.c; path = ../Quake/net_sdlnet.c; sourceTree = SOURCE_ROOT; };
487C0A5C0DA94A0700A49FF5 /* net_sdlnet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = net_sdlnet.h; path = ../Quake/net_sdlnet.h; sourceTree = SOURCE_ROOT; };
48895DB80D4914A000849ABF /* pl_osx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = pl_osx.m; path = ../Quake/pl_osx.m; sourceTree = SOURCE_ROOT; };
489D8D2D0D3A630D00AA4471 /* ScreenInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenInfo.h; sourceTree = "<group>"; };
489D8D2E0D3A630D00AA4471 /* ScreenInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenInfo.m; sourceTree = "<group>"; };
48B9E7870D340B1E0001CACF /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Launcher.nib; sourceTree = "<group>"; };
48B9E7A50D340BEA0001CACF /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
48B9E7A60D340BEA0001CACF /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
48B9E7BE0D340EA80001CACF /* SDLApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLApplication.h; sourceTree = "<group>"; };
48B9E7BF0D340EA80001CACF /* SDLApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLApplication.m; sourceTree = "<group>"; };
48C85E390D3AD10E00797678 /* QuakeArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuakeArgument.h; sourceTree = "<group>"; };
48C85E3A0D3AD10E00797678 /* QuakeArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuakeArgument.m; sourceTree = "<group>"; };
48DA393E0D998BC9007C2A77 /* SDL_net.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_net.framework; path = /Library/Frameworks/SDL_net.framework; sourceTree = "<absolute>"; };
48FE58590D3A82C8006BB491 /* QuakeArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuakeArguments.h; sourceTree = "<group>"; };
48FE585A0D3A82C8006BB491 /* QuakeArguments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuakeArguments.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Fitzquake.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Fitzquake.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */,
002F3C6109D0951E00EBEB88 /* GLUT.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
002F3C0109D093BD00EBEB88 /* OpenGL.framework in Frameworks */,
48DA393F0D998BC9007C2A77 /* SDL_net.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
002F39F909D0881F00EBEB88 /* SDL.framework */,
48DA393E0D998BC9007C2A77 /* SDL_net.framework */,
002F3C6009D0951E00EBEB88 /* GLUT.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
002F3C0009D093BD00EBEB88 /* OpenGL.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* Fitzquake.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* Fitzquake */ = {
isa = PBXGroup;
children = (
48243B060D33ED0A00C29F8F /* Mac OS X */,
483A77D80D2EE8C500CB2E4C /* Quake */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
4830B79D0D464CAE00EF4498 /* Changelog.txt */,
4830B79E0D464CAE00EF4498 /* Todo.txt */,
);
name = Fitzquake;
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
484AA4B30D3FF6C0005D917A /* Fitzquake.icns */,
48B9E7860D340B1E0001CACF /* Launcher.nib */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
48243B060D33ED0A00C29F8F /* Mac OS X */ = {
isa = PBXGroup;
children = (
48B9E7A50D340BEA0001CACF /* AppController.h */,
48B9E7A60D340BEA0001CACF /* AppController.m */,
32CA4F630368D1EE00C91783 /* Fitzquake_Prefix.pch */,
48FE58590D3A82C8006BB491 /* QuakeArguments.h */,
48FE585A0D3A82C8006BB491 /* QuakeArguments.m */,
489D8D2D0D3A630D00AA4471 /* ScreenInfo.h */,
489D8D2E0D3A630D00AA4471 /* ScreenInfo.m */,
48B9E7BE0D340EA80001CACF /* SDLApplication.h */,
48B9E7BF0D340EA80001CACF /* SDLApplication.m */,
002F3A2B09D0888800EBEB88 /* SDLMain.h */,
002F3A2C09D0888800EBEB88 /* SDLMain.m */,
48C85E390D3AD10E00797678 /* QuakeArgument.h */,
48C85E3A0D3AD10E00797678 /* QuakeArgument.m */,
);
name = "Mac OS X";
sourceTree = "<group>";
};
483A77D80D2EE8C500CB2E4C /* Quake */ = {
isa = PBXGroup;
children = (
483A77D90D2EE8D400CB2E4C /* Generic */,
483A77DA0D2EE8DA00CB2E4C /* Input */,
483A77DD0D2EE8F100CB2E4C /* Network */,
483A77DC0D2EE8ED00CB2E4C /* Sound */,
483A77DB0D2EE8E600CB2E4C /* Video */,
);
name = Quake;
sourceTree = "<group>";
};
483A77D90D2EE8D400CB2E4C /* Generic */ = {
isa = PBXGroup;
children = (
483A77DE0D2EE8FB00CB2E4C /* Headers */,
483A78100D2EEA5400CB2E4C /* chase.c */,
483A78110D2EEA5400CB2E4C /* cmd.c */,
483A78120D2EEA5400CB2E4C /* common.c */,
483A78130D2EEA5400CB2E4C /* console.c */,
483A78140D2EEA5400CB2E4C /* crc.c */,
483A78150D2EEA5400CB2E4C /* cvar.c */,
483A78170D2EEA5400CB2E4C /* host.c */,
483A78160D2EEA5400CB2E4C /* host_cmd.c */,
48243B130D33F01A00C29F8F /* main.c */,
483A78180D2EEA5400CB2E4C /* mathlib.c */,
483A78190D2EEA5400CB2E4C /* menu.c */,
48895DB80D4914A000849ABF /* pl_osx.m */,
483A781A0D2EEA5400CB2E4C /* pr_cmds.c */,
483A781B0D2EEA5400CB2E4C /* pr_edict.c */,
483A781C0D2EEA5400CB2E4C /* pr_exec.c */,
483A780E0D2EEA0F00CB2E4C /* progdefs.q1 */,
483A781D0D2EEA5400CB2E4C /* sbar.c */,
483A781E0D2EEA5400CB2E4C /* sys_sdl.c */,
483A781F0D2EEA5400CB2E4C /* view.c */,
483A78200D2EEA5400CB2E4C /* wad.c */,
483A78210D2EEA5400CB2E4C /* world.c */,
483A78220D2EEA5400CB2E4C /* zone.c */,
);
name = Generic;
sourceTree = "<group>";
};
483A77DA0D2EE8DA00CB2E4C /* Input */ = {
isa = PBXGroup;
children = (
483A77DF0D2EE90500CB2E4C /* Headers */,
483A78360D2EEA6D00CB2E4C /* in_sdl.c */,
483A78370D2EEA6D00CB2E4C /* keys.c */,
);
name = Input;
sourceTree = "<group>";
};
483A77DB0D2EE8E600CB2E4C /* Video */ = {
isa = PBXGroup;
children = (
483A77E20D2EE91500CB2E4C /* Headers */,
483A785A0D2EEAF000CB2E4C /* gl_draw.c */,
483A785B0D2EEAF000CB2E4C /* gl_fog.c */,
483A785C0D2EEAF000CB2E4C /* gl_mesh.c */,
483A785D0D2EEAF000CB2E4C /* gl_model.c */,
483A785E0D2EEAF000CB2E4C /* gl_refrag.c */,
483A785F0D2EEAF000CB2E4C /* gl_rlight.c */,
483A78600D2EEAF000CB2E4C /* gl_rmain.c */,
483A78610D2EEAF000CB2E4C /* gl_rmisc.c */,
483A78620D2EEAF000CB2E4C /* gl_screen.c */,
483A78630D2EEAF000CB2E4C /* gl_sky.c */,
483A78640D2EEAF000CB2E4C /* gl_test.c */,
483A78650D2EEAF000CB2E4C /* gl_texmgr.c */,
483A78660D2EEAF000CB2E4C /* gl_vidsdl.c */,
483A78670D2EEAF000CB2E4C /* gl_warp.c */,
483A78680D2EEAF000CB2E4C /* image.c */,
483A78690D2EEAF000CB2E4C /* r_alias.c */,
483A786A0D2EEAF000CB2E4C /* r_brush.c */,
483A786B0D2EEAF000CB2E4C /* r_part.c */,
483A786C0D2EEAF000CB2E4C /* r_sprite.c */,
483A786D0D2EEAF000CB2E4C /* r_world.c */,
);
name = Video;
sourceTree = "<group>";
};
483A77DC0D2EE8ED00CB2E4C /* Sound */ = {
isa = PBXGroup;
children = (
483A77E10D2EE91000CB2E4C /* Headers */,
483A78500D2EEAC300CB2E4C /* cd_sdl.c */,
486577C80D31A22A00E7920A /* snd_dma.c */,
486577C90D31A22A00E7920A /* snd_mem.c */,
486577CA0D31A22A00E7920A /* snd_mix.c */,
483A78540D2EEAC300CB2E4C /* snd_sdl.c */,
);
name = Sound;
sourceTree = "<group>";
};
483A77DD0D2EE8F100CB2E4C /* Network */ = {
isa = PBXGroup;
children = (
483A77E00D2EE90B00CB2E4C /* Headers */,
483A783A0D2EEAAB00CB2E4C /* cl_demo.c */,
483A783B0D2EEAAB00CB2E4C /* cl_input.c */,
483A783C0D2EEAAB00CB2E4C /* cl_main.c */,
483A783D0D2EEAAB00CB2E4C /* cl_parse.c */,
483A783E0D2EEAAB00CB2E4C /* cl_tent.c */,
48728D280D3004A70004D61B /* net_dgrm.c */,
48728D2A0D3004A80004D61B /* net_loop.c */,
483A783F0D2EEAAB00CB2E4C /* net_main.c */,
483A78400D2EEAAB00CB2E4C /* net_sdl.c */,
487C0A5B0DA94A0700A49FF5 /* net_sdlnet.c */,
48305B540D8AF90600A29C24 /* net_udp.c */,
483A78410D2EEAAB00CB2E4C /* sv_main.c */,
483A78420D2EEAAB00CB2E4C /* sv_move.c */,
483A78430D2EEAAB00CB2E4C /* sv_phys.c */,
483A78440D2EEAAB00CB2E4C /* sv_user.c */,
);
name = Network;
sourceTree = "<group>";
};
483A77DE0D2EE8FB00CB2E4C /* Headers */ = {
isa = PBXGroup;
children = (
483A77E60D2EE97700CB2E4C /* cmd.h */,
483A77E70D2EE97700CB2E4C /* common.h */,
483A77E80D2EE97700CB2E4C /* console.h */,
483A77E90D2EE97700CB2E4C /* crc.h */,
483A77EA0D2EE97700CB2E4C /* cvar.h */,
483A77EB0D2EE97700CB2E4C /* mathlib.h */,
483A77EC0D2EE97700CB2E4C /* menu.h */,
4846EB500D329BEB00A108DE /* platform.h */,
483A77ED0D2EE97700CB2E4C /* pr_comp.h */,
483A77EE0D2EE97700CB2E4C /* progdefs.h */,
483A77EF0D2EE97700CB2E4C /* progs.h */,
483A77F00D2EE97700CB2E4C /* quakedef.h */,
483A77F10D2EE97700CB2E4C /* sbar.h */,
483A77F20D2EE97700CB2E4C /* sys.h */,
483A77F30D2EE97700CB2E4C /* view.h */,
483A77F40D2EE97700CB2E4C /* wad.h */,
483A77F50D2EE97700CB2E4C /* world.h */,
483A77F60D2EE97700CB2E4C /* zone.h */,
);
name = Headers;
sourceTree = "<group>";
};
483A77DF0D2EE90500CB2E4C /* Headers */ = {
isa = PBXGroup;
children = (
483A77F70D2EE98D00CB2E4C /* input.h */,
483A77F80D2EE98D00CB2E4C /* keys.h */,
);
name = Headers;
sourceTree = "<group>";
};
483A77E00D2EE90B00CB2E4C /* Headers */ = {
isa = PBXGroup;
children = (
483A77F90D2EE9A900CB2E4C /* client.h */,
483A77FA0D2EE9A900CB2E4C /* net.h */,
48728D290D3004A80004D61B /* net_dgrm.h */,
48728D2B0D3004A80004D61B /* net_loop.h */,
487C0A5C0DA94A0700A49FF5 /* net_sdlnet.h */,
48305B530D8AF8EC00A29C24 /* net_udp.h */,
483A77FB0D2EE9A900CB2E4C /* protocol.h */,
483A77FC0D2EE9A900CB2E4C /* server.h */,
);
name = Headers;
sourceTree = "<group>";
};
483A77E10D2EE91000CB2E4C /* Headers */ = {
isa = PBXGroup;
children = (
483A77FD0D2EE9BD00CB2E4C /* cdaudio.h */,
483A77FE0D2EE9BD00CB2E4C /* sound.h */,
);
name = Headers;
sourceTree = "<group>";
};
483A77E20D2EE91500CB2E4C /* Headers */ = {
isa = PBXGroup;
children = (
483A77FF0D2EE9F300CB2E4C /* anorm_dots.h */,
483A78000D2EE9F300CB2E4C /* anorms.h */,
483A78010D2EE9F300CB2E4C /* bspfile.h */,
483A78020D2EE9F300CB2E4C /* d_ifacea.h */,
483A78030D2EE9F300CB2E4C /* draw.h */,
483A78040D2EE9F300CB2E4C /* gl_model.h */,
483A78050D2EE9F300CB2E4C /* gl_texmgr.h */,
483A78060D2EE9F300CB2E4C /* gl_warp_sin.h */,
483A78070D2EE9F300CB2E4C /* glquake.h */,
483A78080D2EE9F300CB2E4C /* image.h */,
483A78090D2EE9F300CB2E4C /* modelgen.h */,
483A780A0D2EE9F300CB2E4C /* render.h */,
483A780B0D2EE9F300CB2E4C /* screen.h */,
483A780C0D2EE9F300CB2E4C /* spritegn.h */,
483A780D0D2EE9F300CB2E4C /* vid.h */,
);
name = Headers;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* Fitzquake */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Fitzquake" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */,
);
buildRules = (
);
dependencies = (
);
name = Fitzquake;
productInstallPath = "$(HOME)/Applications";
productName = Fitzquake;
productReference = 8D1107320486CEB800E47090 /* Fitzquake.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Fitzquake" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* Fitzquake */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* Fitzquake */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
483A780F0D2EEA0F00CB2E4C /* progdefs.q1 in Resources */,
48B9E7880D340B1E0001CACF /* Launcher.nib in Resources */,
484AA4B40D3FF6C0005D917A /* Fitzquake.icns in Resources */,
4830B79F0D464CAE00EF4498 /* Changelog.txt in Resources */,
4830B7A00D464CAE00EF4498 /* Todo.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */,
483A78230D2EEA5400CB2E4C /* chase.c in Sources */,
483A78240D2EEA5400CB2E4C /* cmd.c in Sources */,
483A78250D2EEA5400CB2E4C /* common.c in Sources */,
483A78260D2EEA5400CB2E4C /* console.c in Sources */,
483A78270D2EEA5400CB2E4C /* crc.c in Sources */,
483A78280D2EEA5400CB2E4C /* cvar.c in Sources */,
483A78290D2EEA5400CB2E4C /* host_cmd.c in Sources */,
483A782A0D2EEA5400CB2E4C /* host.c in Sources */,
483A782B0D2EEA5400CB2E4C /* mathlib.c in Sources */,
483A782C0D2EEA5400CB2E4C /* menu.c in Sources */,
483A782D0D2EEA5400CB2E4C /* pr_cmds.c in Sources */,
483A782E0D2EEA5400CB2E4C /* pr_edict.c in Sources */,
483A782F0D2EEA5400CB2E4C /* pr_exec.c in Sources */,
483A78300D2EEA5400CB2E4C /* sbar.c in Sources */,
483A78310D2EEA5400CB2E4C /* sys_sdl.c in Sources */,
483A78320D2EEA5400CB2E4C /* view.c in Sources */,
483A78330D2EEA5400CB2E4C /* wad.c in Sources */,
483A78340D2EEA5400CB2E4C /* world.c in Sources */,
483A78350D2EEA5400CB2E4C /* zone.c in Sources */,
483A78380D2EEA6D00CB2E4C /* in_sdl.c in Sources */,
483A78390D2EEA6D00CB2E4C /* keys.c in Sources */,
483A78450D2EEAAB00CB2E4C /* cl_demo.c in Sources */,
483A78460D2EEAAB00CB2E4C /* cl_input.c in Sources */,
483A78470D2EEAAB00CB2E4C /* cl_main.c in Sources */,
483A78480D2EEAAB00CB2E4C /* cl_parse.c in Sources */,
483A78490D2EEAAB00CB2E4C /* cl_tent.c in Sources */,
483A784A0D2EEAAB00CB2E4C /* net_main.c in Sources */,
483A784B0D2EEAAB00CB2E4C /* net_sdl.c in Sources */,
483A784C0D2EEAAB00CB2E4C /* sv_main.c in Sources */,
483A784D0D2EEAAB00CB2E4C /* sv_move.c in Sources */,
483A784E0D2EEAAB00CB2E4C /* sv_phys.c in Sources */,
483A784F0D2EEAAB00CB2E4C /* sv_user.c in Sources */,
483A78550D2EEAC300CB2E4C /* cd_sdl.c in Sources */,
483A78590D2EEAC300CB2E4C /* snd_sdl.c in Sources */,
483A786E0D2EEAF000CB2E4C /* gl_draw.c in Sources */,
483A786F0D2EEAF000CB2E4C /* gl_fog.c in Sources */,
483A78700D2EEAF000CB2E4C /* gl_mesh.c in Sources */,
483A78710D2EEAF000CB2E4C /* gl_model.c in Sources */,
483A78720D2EEAF000CB2E4C /* gl_refrag.c in Sources */,
483A78730D2EEAF000CB2E4C /* gl_rlight.c in Sources */,
483A78740D2EEAF000CB2E4C /* gl_rmain.c in Sources */,
483A78750D2EEAF000CB2E4C /* gl_rmisc.c in Sources */,
483A78760D2EEAF000CB2E4C /* gl_screen.c in Sources */,
483A78770D2EEAF000CB2E4C /* gl_sky.c in Sources */,
483A78780D2EEAF000CB2E4C /* gl_test.c in Sources */,
483A78790D2EEAF000CB2E4C /* gl_texmgr.c in Sources */,
483A787A0D2EEAF000CB2E4C /* gl_vidsdl.c in Sources */,
483A787B0D2EEAF000CB2E4C /* gl_warp.c in Sources */,
483A787C0D2EEAF000CB2E4C /* image.c in Sources */,
483A787D0D2EEAF000CB2E4C /* r_alias.c in Sources */,
483A787E0D2EEAF000CB2E4C /* r_brush.c in Sources */,
483A787F0D2EEAF000CB2E4C /* r_part.c in Sources */,
483A78800D2EEAF000CB2E4C /* r_sprite.c in Sources */,
483A78810D2EEAF000CB2E4C /* r_world.c in Sources */,
48728D2D0D3004A80004D61B /* net_dgrm.c in Sources */,
48728D2E0D3004A80004D61B /* net_loop.c in Sources */,
486577CB0D31A22A00E7920A /* snd_dma.c in Sources */,
486577CC0D31A22A00E7920A /* snd_mem.c in Sources */,
486577CD0D31A22A00E7920A /* snd_mix.c in Sources */,
48243B140D33F01A00C29F8F /* main.c in Sources */,
48B9E7A70D340BEA0001CACF /* AppController.m in Sources */,
48B9E7C00D340EA80001CACF /* SDLApplication.m in Sources */,
489D8D2F0D3A630D00AA4471 /* ScreenInfo.m in Sources */,
48FE585B0D3A82C8006BB491 /* QuakeArguments.m in Sources */,
48C85E3B0D3AD10E00797678 /* QuakeArgument.m in Sources */,
48895DB90D4914A000849ABF /* pl_osx.m in Sources */,
48305B550D8AF90600A29C24 /* net_udp.c in Sources */,
487C0A5D0DA94A0700A49FF5 /* net_sdlnet.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
48B9E7860D340B1E0001CACF /* Launcher.nib */ = {
isa = PBXVariantGroup;
children = (
48B9E7870D340B1E0001CACF /* English */,
);
name = Launcher.nib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = Fitzquake;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = Fitzquake;
WRAPPER_EXTENSION = app;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks",
/Library/Frameworks,
"$(FRAMEWORK_SEARCH_PATHS)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks/SDL.framework/Headers",
/Library/Frameworks/SDL.framework/Headers,
"$(HEADER_SEARCH_PATHS)",
);
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks",
/Library/Frameworks,
"$(FRAMEWORK_SEARCH_PATHS)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks/SDL.framework/Headers",
/Library/Frameworks/SDL.framework/Headers,
"$(HEADER_SEARCH_PATHS)",
);
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Fitzquake" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Fitzquake" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

View File

@ -0,0 +1,25 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "SDL.h"
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Fitzquake</string>
<key>CFBundleIdentifier</key>
<string>net.celephais.Fitzquake</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>Launcher</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.Launcher</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@ -0,0 +1,36 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Cocoa/Cocoa.h>
@interface QuakeArgument : NSObject {
NSString *name;
NSString *value;
}
- (id)initWithArgument:(NSString *)n;
- (id)initWithArgument:(NSString *)n andValue:(NSString *)v;
- (NSString *)name;
- (NSString *)value;
- (BOOL)hasValue;
@end

View File

@ -0,0 +1,80 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "QuakeArgument.h"
@implementation QuakeArgument
- (id)initWithArgument:(NSString *)n {
return [self initWithArgument:n andValue:nil];
}
- (id)initWithArgument:(NSString *)n andValue:(NSString *)v {
self = [super init];
if (self == nil)
return nil;
name = [n retain];
if (v != nil)
value = [v retain];
return self;
}
- (NSString *)name {
return name;
}
- (NSString *)value {
return value;
}
- (BOOL)hasValue {
return value != nil;
}
- (NSString *)description {
NSMutableString *buffer = [[NSMutableString alloc] init];
[buffer appendString:name];
if ([self hasValue]) {
[buffer appendString:@" "];
[buffer appendString:value];
}
return buffer;
}
- (void) dealloc
{
[name release];
[value release];
[super dealloc];
}
@end

View File

@ -0,0 +1,39 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Cocoa/Cocoa.h>
#import "QuakeArgument.h"
@interface QuakeArguments : NSObject {
NSMutableArray *quakeArgs;
}
- (id)initWithArguments:(char **)argv count:(int)argc;
- (void)parseArguments:(NSString *)args;
- (void)addArgument:(NSString *)arg;
- (void)addArgument:(NSString *)arg withValue:(NSString *)value;
- (QuakeArgument *)argument:(NSString *)name;
- (int)count;
- (void)setArguments:(char **)args;
@end

View File

@ -0,0 +1,231 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "QuakeArguments.h"
#import "QuakeArgument.h"
@implementation QuakeArguments
- (id)init {
self = [super init];
if (!self)
return nil;
quakeArgs = [[NSMutableArray alloc] init];
return self;
}
- (id)initWithArguments:(char **)argv count:(int)argc {
int i;
NSString *next;
NSString *current;
QuakeArgument *argument;
self = [self init];
if (!self)
return nil;
if (argc > 0) {
for (i = 0; argv[i]; i++) {
current = [NSString stringWithCString:argv[i] encoding:NSASCIIStringEncoding];
if (i < argc-1) {
next = [NSString stringWithCString:argv[i+1] encoding:NSASCIIStringEncoding];
} else {
next = nil;
}
if (next != nil && [next characterAtIndex:0] != '-' && [next characterAtIndex:0] != '+') {
argument = [[QuakeArgument alloc] initWithArgument:current andValue:next];
i++;
} else {
argument = [[QuakeArgument alloc] initWithArgument:current];
}
[quakeArgs addObject:argument];
[argument release];
}
}
return self;
}
- (void)parseArguments:(NSString *)args {
int i;
unichar c;
unichar p = ' ';
NSMutableString *word = nil;
NSMutableArray *words = [[NSMutableArray alloc] init];
BOOL quoted = FALSE;
[quakeArgs removeAllObjects];
for (i = 0; i < [args length]; i++) {
c = [args characterAtIndex:i];
switch (c) {
case ' ':
if (!quoted) {
// ignore whitespace
if (p == ' ')
break;
if (word != nil) {
[words addObject:word];
[word release];
word = nil;
}
}
break;
case '"':
quoted = !quoted;
break;
default:
if (p == ' ') {
word = [[NSMutableString alloc] init];
}
[word appendFormat:@"%C", c];
break;
}
p = c;
}
if (word != nil) {
[words addObject:word];
[word release];
}
NSString *current;
NSString *next;
QuakeArgument *argument = nil;
for (i = 0; i < [words count];) {
current = [words objectAtIndex:i++];
if (i < [words count]) {
next = [words objectAtIndex:i++];
unichar c = [next characterAtIndex:0];
if (c != '-' && c != '+')
argument = [[QuakeArgument alloc] initWithArgument:current andValue:next];
else
i--;
}
if (argument == nil) {
argument = [[QuakeArgument alloc] initWithArgument:current];
}
[quakeArgs addObject:argument];
[argument release];
argument = nil;
}
}
- (void)addArgument:(NSString *)name {
QuakeArgument *argument = [[QuakeArgument alloc] initWithArgument:name];
[quakeArgs addObject:argument];
[argument release];
}
- (void)addArgument:(NSString *)name withValue:(NSString *)value {
QuakeArgument *argument = [[QuakeArgument alloc] initWithArgument:name andValue:value];
[quakeArgs addObject:argument];
[argument release];
}
- (QuakeArgument *)argument:(NSString *)name {
NSEnumerator *enumerator = [quakeArgs objectEnumerator];
QuakeArgument *argument;
while ((argument = [enumerator nextObject])) {
if ([name isEqualToString:[argument name]])
return argument;
}
return nil;
}
- (int)count {
int c = 0;
NSEnumerator *enumerator = [quakeArgs objectEnumerator];
QuakeArgument *argument;
while ((argument = [enumerator nextObject])) {
c++;
if ([argument hasValue])
c++;
}
return c;
}
- (void)setArguments:(char **)args {
int i = 0;
NSEnumerator *enumerator = [quakeArgs objectEnumerator];
QuakeArgument *argument;
while ((argument = [enumerator nextObject])) {
args[i++] = (char *)[[argument name] cStringUsingEncoding:NSASCIIStringEncoding];
if ([argument hasValue])
args[i++] = (char *)[[argument value] cStringUsingEncoding:NSASCIIStringEncoding];
}
}
- (NSString *)description {
int i;
NSMutableString *buffer = [[NSMutableString alloc] init];
for (i = 0; i < [quakeArgs count]; i++) {
if (i > 0)
[buffer appendString:@" "];
QuakeArgument *argument = [quakeArgs objectAtIndex:i];
[buffer appendString:[argument name]];
if ([argument hasValue]) {
[buffer appendString:@" "];
[buffer appendString:[argument value]];
}
}
return buffer;
}
- (void) dealloc
{
[quakeArgs release];
[super dealloc];
}
@end

View File

@ -0,0 +1,28 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Cocoa/Cocoa.h>
@interface SDLApplication : NSApplication {
}
@end

View File

@ -0,0 +1,34 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "SDLApplication.h"
#import "SDL.h"
@implementation SDLApplication
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
[super terminate:sender];
}
@end

View File

@ -0,0 +1,16 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <Cocoa/Cocoa.h>
extern int gArgc;
extern char **gArgv;
extern BOOL gFinderLaunch;
extern BOOL gCalledAppMainline;
@interface SDLMain : NSObject
@end

View File

@ -0,0 +1,84 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import "SDL.h"
#import "SDLMain.h"
#import <sys/param.h> /* for MAXPATHLEN */
#import <unistd.h>
#import "SDLApplication.h"
int gArgc;
char **gArgv;
BOOL gFinderLaunch;
BOOL gCalledAppMainline = FALSE;
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
}
CFRelease(url);
CFRelease(url2);
}
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
/* Hand off to main application code */
gCalledAppMainline = TRUE;
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
} else {
int i;
gArgc = argc;
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;
}
[SDLApplication poseAsClass:[NSApplication class]];
NSApplicationMain (argc, argv);
return 0;
}

View File

@ -0,0 +1,38 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Cocoa/Cocoa.h>
@interface ScreenInfo : NSObject {
int width;
int height;
int bpp;
NSString *description;
}
- (id)initWithWidth:(int)w height:(int)h bpp:(int)b;
- (int)width;
- (int)height;
- (int)bpp;
- (NSString *)description;
@end

View File

@ -0,0 +1,61 @@
/*
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "ScreenInfo.h"
@implementation ScreenInfo
- (id)initWithWidth:(int)w height:(int)h bpp:(int)b {
self = [super init];
if (!self)
return nil;
width = w;
height = h;
bpp = b;
description = [NSString stringWithFormat:@"%d x %d %d Bit", width, height, bpp];
return self;
}
- (int)width {
return width;
}
- (int)height {
return height;
}
- (int)bpp {
return bpp;
}
- (NSString *)description {
return description;
}
@end

View File

@ -0,0 +1,41 @@
01/22/2008
- release mouse pointer when console is active.
- enable key repeats (doesn't work on OS X, test in Win32).c
01/23/2008
- implement Sys_SendKeyEvents
- disable mouse input when console is inactive using SDL_SetEventFilter
- move mouse input processing to main event loop
- add vid.mode to determine window mode
- fixed Sys_printf()
- enable key repeats when console is active only
- return 0 if any of the cl_bob vars is 0 in V_CalcBob
01/24/2008
- changed in_deactivate so that it does not always release the mouse cursor
- adapted all calls to in_activate and in_deactive, because they need to be called regardless of the current mode
- added platform dependent messagebox code for fatal errors on OS X and Windows
02/06/2008
- fixed numlock acting as caps lock issue
- fixed: input is not activated on map command (hopefull got them all this time)
- center window in windowed modes
2008/03/14
- discard mouse movement while input is deactivated
- implement maps and mods commands using POSIX functions and added a POSIX wrapper for Win32
- activate mouse input when binding a key, otherwise mouse keys cannot be bound through the menu
- fixed shift key behaviour
2008/06/3
- fixed numerous bugs in sdl_net.c
2008/06/4
- fixed fog command (use fmax instead of max in Fog_FogCommand_f)
- fixed bug that lead to the screen being set to minimum size when the sizedown command is issued multiple times
2008/07/4
- LSHIFT + ESC and circomflex always opens the console
2008/07/5
- print everything to stdout

BIN
quakespasm/Misc/Icon.psd Normal file

Binary file not shown.

14
quakespasm/Misc/Todo.txt Normal file
View File

@ -0,0 +1,14 @@
- Implement TCP networking.
- Clean up in vidsdl: remove windowed and determine window state from modestate ?
- Fix Sys_Error behaviour (what is quake double error?)
- Open Console with Circomflex or Shift-Escape
- Change SDL cursor to resemble the OS cursor (John)
- Sensitivity is off (SDL related? Or can I try and replicate the original behaviour?) (John)
- Paste doesn't work (needs to be implemented in platform.h) (John)
- Keybindings are not loaded correctly upon first start? (spirit)
- Log everything to the shell as well as to the console (spirit)
- make esc work after a map tried changeleveling to a non-existant map (like e1m2quoth)
- Launch Fitzquake, switch to other game via game (I tried Quoth and Marcher), load any map (I tried quoth's startmap and marcher): segfault
- My "toggle r_showtris" bind causes the screen to be filled with the brown hud/viewsize texture. The only way to make the screen visible again was to delete the config. (works fine for me)

View File

@ -0,0 +1,462 @@
================================================================================
Beta release of an SDL port of Fitzquake version 0.80, July 5, 2008
Author : Kristian Duske
Email Address : deceive.inveigle.obfuscate@gmail.com
Author's Homepage : http://www.kristianduske.com/fitzquake
Minimum SDL version : 1.2.10
This is a port of the Fitzquake engine to SDL. The main goal of this port is to
allow fitzquake to run on all major platforms. Currently there are builds for
Windows, Linux and Mac OS X.
To run this engine, you need to install the SDL and SDL_net library binaries. For
Linux, you should probably use the packages for your distribution which should be
available through your package manager of choice. The minimum SDL version you
need to run this is 1.2.10. On Windows, you can download the SDL and SDL_net dlls
from http://www.libsdl.org/. On Mac, the SDL framework is included in the
application bundle.
The Mac OS X version includes a simple launcher program.
Known issues:
- Mouse sensitivity is different than in the original Fitzquake (or vanilla Quake,
for that matter).
- Pasting from the clipboard does not work.
- It is not possible to switch the screen refresh rates from within the engine.
- On Linux, there are problems with the default sound sampling rate of 11025Hz.
This can be fixed by supplying -sndspeed 48000 on the commandline.
Changes since the March 7 beta:
- discard mouse movement while input is deactivated
- implement maps and mods commands using POSIX functions and added a POSIX wrapper
for Win32
- activate mouse input when binding a key, otherwise mouse keys cannot be bound
through the menu
- fixed shift key behaviour
- implemented TCP networking
- fixed fog command (use fmax instead of max in Fog_FogCommand_f)
- fixed bug that lead to the screen being set to minimum size when the sizedown
command is issued multiple times
- LSHIFT + ESC and circomflex always opens the console
- print everything to stdout
- and more...
Below, you can find the original fitzquake readme.
================================================================================
Fitzquake version 0.80, May 26, 2005
Filename : fitzquake080.exe
Author : John Fitzgibbons
Email Address : johnfitz@u.washington.edu
Author's Homepage : http://www.celephais.net/
Fitzquake Homepage : http://www.celephais.net/fitzquake
Fitzquake is a modified glquake based on the source code released by id
Software. My primary focus is fixing a lot of the rendering bugs which made
glquake inferior to the software renderer. My secondary focus is adding
conveniences for mappers and general users. I am also slowly adding support for
new modding or mapping features such as skyboxes, fog, and colored light.
While I have made extensive changes to the code, I pretty much use the same
OpenGL features that the original glquake uses. Therefore, if you can run
glquake, you can probably run Fitzquake.
I am not finished working on this project, so bug reports and feature requests
are welcome.
Acknowlegements
--------------------------------------------------------------------------------
id Software (quake and quake2 code)
LordHavoc (code and assistance)
Bengt Jardrup (feedback, assistance, testing)
additional thanks to: Aardappel, SmallPileOfGibs, FrikaC, Vondur, Topaz, Tomaz,
Tonik, Radix, EvilTypeGuy, NightBringer, MH, Maddes, Fett, Craig Wills, Heffo,
Riot, Gleeb, people in #flipcode, and others for their tutorials, code, testing,
and assistance.
Copyright / Permissions
--------------------------------------------------------------------------------
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2005 John Fitzgibbons and others
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
History
================================================================================
changes in 0.80
---------------
- map loading is about four times faster. This is due to some optimizations in the texture loading code.
- video mode can now be changed in-game. You can change resolution, color depth, refresh rate, and switch between windowed and fullscreen modes. This can be accomplished easily using the video options menu, and is also available at the console using cvars. Note: if you launch fitzquake with -width, -height, -window, or -bpp in the command line, Fitzquake will use the command line settings and ignore whatever it reads from the config files at startup. However, you will still be able to change the video mode from the menu or the console as you like. Also note: to change video modes by execing a config file, the config file must include "vid_restart" after the other vid_ cvars have been set. (see cvars "vid_width," "vid_height," "vid_fullscreen," "vid_bpp," "vid_refreshrate," and commands "vid_restart," "vid_test")
- added control of entity count limits (MAX_EDICTS.) The default maximum has been increased from 600 to 1024. It can be raised even higher (up to 8192 -- this is a limit set by the network protocol) using a cvar. (see cvar "max_edicts")
- added control of vertical sync. (see cvar "vid_vsync")
- added control of anistropic filtering. Anisotropic filtering is a method to improve texture clarity on surfaces when viewed at steep angles. (see cvar "gl_texture_anisotropy")
- console buffer size can now be set. The command line option "-consize" allows you to specify the buffer size in kilobytes. For reference, fitzquake's default buffer size is 64k, and glquake's is 16k. 16k is also the smallest size fitzquake will allow you to set. Note: this buffer lives in the heap, so if you want to have a HUGE buffer, you might need to increase -heapsize also.
- increased max surface extents from 256 (the software quake maximum) to 2000. For reference, the glquake maximum is 512. This should eliminate the "bad surface extents" crash when running some maps that could be played in glquake, but not fitzquake or winquake.
- increased max vertices in an alias model from 1024 (the glquake maximum) to 2000 (the software quake maximum.)
- increased MAX_CHANNELS from 128 to 512 and MAX_DYNAMIC_CHANNELS from 8 to 128
- screenshot filenames are now in the format "fitz0000.tga", increasing the maximum number of screenshots per folder from one hundred to ten thousand.
- vid_describemodes output cleaned up; now displays a list of valid refresh rates for each mode
- added a more intuitive cvar control of slow motion/fast-forward for demos and live gameplay. (see cvar "host_timescale")
- "reset to defaults" option in the menu now executes the "resetall" command before loading default.cfg
- game command now writes config.cfg to current gamedir before switching
- +mlook is now saved to config.cfg
- changed smallest allowed window size from 320x240 to 320x200
- console cursor images are now hard-coded, and the insert mode cursor is now a vertical bar instead of an underscore. This was prompted by several popular mods (OUM, Xmen TC) using nonstandard cursors, which are incompatible the fitzquake console enhancements.
- gl_farclip now defaults to 16384. This should be high enough to handle even the largest open areas without unwanted clipping. The only reason you'd want to lower this number is if you see z-fighting.
- added cvar r_drawworld (see below)
- added cvar r_showtris (see below)
- added cvar r_showbboxes (see below)
- added a command to cycle a cvar through a list of values. (see command "cycle")
- mapname command now works on dedicated server.
- added a hack to fix those white edges on the bottom of the large box of shells. I feel dirty, but they look better, now.
- changed stuffcmds behavior to allow hyphenated map names, config file names, etc. in the command line. (example: "fitzquake.exe +exec my-config.cfg +map my-map") However, you still can't load a map or config file when the first character in the filename is a hyphen.
- skybox loader now reverts to scrolling sky if all 6 skybox faces failed to load.
- tweaked circular particles to match the apparent size of the square particles.
- fixed crash when loading mods with large player skins (like the chainsaw mod, and PerQuake.) Colormapping can now handle any size player texture (limited to the heapsize, of course.)
- fixed bug where a replacement model in a mod is messed up becuase a matching .ms2 file in id1/glquake is present. The fix is simply to disable all mesh caching, which slows down model loading a little.
- fixed freeze when gl_overbright is 1 and either texture_env_combine or multitexture is disabled or not supported.
- fixed "numgltextures == MAX_GLTEXTURES" crash when viewing multiplayer->setup menu.
- fixed "numgltextures == MAX_GLTEXTURES" crash when playing large maps (nesp09,) due to frequent model recaches.
- fixed bug where entities and water were not being drawn any frame in which a model had to be recached.
- fixed skybox texture showing up in the place of other textures/skins/lightmaps, when the previous loaded map had a skybox.
- fixed missing polygons on edges of screen when underwater and r_waterwarp is 1.
- fixed missing polygons on edges of screen when r_stereo is enabled.
- fixed long mapnames that scroll are truncated to be shorter than what appears in the console. Well, sort of. What I did was increase the maximum length from 39 to 127. A mapname longer than 127 will still be truncated, but these are pretty rare.
- fixed rogue's teamplay skin showing up as an all-white texture.
- fixed checkerboard texture shows up sometimes when an animated texture has fullbright pixels on some frames, but not others (reactor core in junk.bsp)
- fixed color 255 is not fullbright
- fixed fuscia dots appearing in corners of resampled textures
- fixed mapname command crashes when client is disconnected.
- fixed cl_nolerp 1 screws up speed of demo playback
- fixed annoying client-side step-up smoothing when in noclip mode (except on nonlocal servers.)
- fixed scr_clock 2 displays hour twelve as "0" instead of "12"
- fixed skip textured surfaces still drawn even after running tyrann's skip utility
- fixed crash when loading a map with a sky texture where the "sky" in the texturename is not lowercase
- fixed hang in e2m2 on easy skill, where you can shoot one of the buttons at the beginning and then trick-jump through the open gate. Now it prints a warning message ("SV_TouchLinks: null link") and lets you keep playing.
- fixed bug when viewsize < 100, and r_oldwater is 0, where you can see the water textures overlaying part of the brown frame around the viewport.
- fixed bug where imagelist and r_speeds2 would report the same megabyte counts in both 16bpp and 32bpp mode, even though texture bpp should match (and does match) framebuffer bpp. The numbers are now different and accurate for each bit depth.
- removed cvars "vid_config_x," "vid_config_y," "vid_wait," "vid_nopageflip," "_vid_wait_override," "_vid_default_mode," "_vid_default_mode_win," and "vid_stretch_by_2," none of which glquake ever used.
- removed cvar "vid_mode" and commands "vid_describemode" and "vid_nummodes," because of the new video mode handling.
cvars:
- gl_texture_anisotropy. Controls the amount of anisotropy in texture filtering. If 1 or less than 1, texture filtering is normal (isotropic.) If greater than 1, increasing degrees of anisotropic filtering are used, up to the hardware maximum. Set value to 2 for 2x anisotropic, 4 for 4x, etc. Default 1.
- host_timescale. Scales the passage of time on client and server. Set to 0 or 1 for normal speed, less than 1 for slow motion, and greater than 1 for fast-forward. If greater than 0, overrides host_framerate. Default 0.
- max_edicts. Sets the maximum number of entites on both the client and server. Default 1024. Acceptable values range from 256 to 8192. Set to 600 to mimic standard quake. Changes won't take effect until the next time a map is loaded. Note: if a client connects to a server, and the client's maximum is lower than the server's, the client will probably crash if it ever sees an entnum higher than its local max_edicts. Warning: you may need to increase -heapsize if you want a high max_edicts value.
- r_drawworld. If 1, draw world as usual. If 0, don't draw the world. Default 1. (compare r_drawentities)
- r_showbboxes. If 1, draw a wireframe bounding box around each entity. Note that these are the server-side per-edict physics bounding boxes, not the client-side per-model rendering bboxes. If 0, disable this feature. Default 0.
- r_showtris. If 1, draw wireframe outlines for every triangle in the scene. Like in Quake 3, the lines will be visible even through solid geometry. If 2, draw the outlines only on visible surfaces (like r_showtris 2 in Medal of Honor.) If 0, disable wireframe overlay. Default 0.
- vid_bpp. Sets the color depth of the screen in fullscreen mode. Windowed mode ignores this setting. Can be 16 or 32. Default 16. (Changes won't take effect until the next call to vid_restart.)
- vid_fullscreen. If 1, fitzquake will run fullscreen. If 0, fitzquake will run in a window. Default 1. (Changes won't take effect until the next call to vid_restart.)
- vid_height. Sets the vertical screen/window resolution. Default 480. In windowed mode, cannot be less than 200. (Changes won't take effect until the next call to vid_restart.)
- vid_refreshrate. Sets the refresh rate of the screen in fullscreen mode. Windowed mode ignores this setting. Possible values include 60, 70, 72, 75, 85, etc. Default 60. (Changes won't take effect until the next call to vid_restart.)
- vid_width. Sets the horizontal screen/window resolution. Default 640. In windowed mode, cannot be less than 320. (Changes won't take effect until the next call to vid_restart.)
- vid_vsync. Set to 1 to enable vertical sync, which eliminates tearing, but caps your framerate at the monitor refreshrate. Set to 0 to disable vertical sync, which allows tearing but doesn't cap your framerate. Default 0. Note: If fitzquake detects that your driver settings have forced vsync to be disabled, it will post a message to the console saying so, and this cvar will have no effect.
commands:
- "cycle <cvar> <value> [<value> [<value> ...]]" to cycle a cvar through a list of values.. Note: this command will get stuck on a list that contains the same value more than once, such as "cycle blah 1 2 1 3". If you're doing anything that complex you can just use aliases.
- vid_restart. Tries to set a video mode that matches the values of vid_width, vid_height, vid_fullscreen, and, if vid_fullscreen is 1, vid_bpp and vid_refreshrate.
- vid_test. Like vid_restart, except that after switching to the new mode pops up a confirmation dialogue. This is useful if you are not sure what modes your monitor can handle, so you don't get stuck with a blank screen. The dialogue has a time limit so that if you don't press a key within 5 seconds, it will revert to the previous mode.
changes in 0.75
---------------
- totally rewritten bsp drawing code. The new code combines the advantages of the gl_texsort 1 and gl_texsort 0 codepaths from glquake into one codepath that uses texture sorting and multitexture. In my tests, i've found that it's about the same speed as glquake in low poly scenes (like the original quake levels,) but as you get into the thousands of wpolys, it's faster and faster.
- 2x overbright lighting. Lighting now looks like software quake. Just like overbright lighting on models, overbright on world polys requires GL_EXT_texture_env_combine (TNT and later, voodoo4 and later.) Without it, FitzQuake will be use two passes to render overbright world polys. So if you don't have that extension, you might disable it for performance reasons. (see cvar "gl_overbright")
- colored lighting support using .lit files.
- totally new water surface animation. The new method requires no surface subdivision, isn't plagued by tearing and sparklies caused by tjunctions, and looks almost identical to software quake's water, and doesn't slow down on very large sheets of water. (see cvars "r_waterquality" and "r_oldwater")
- old water aninmation fixed so that it doesn't look bad when gl_subdivide_size is 32 or lower.
- can load external textures (currently targa and pcx) if they match the texture name in the bsp and are located in the id1/textures, or <MODDIR>/textures directory. At the moment no other images (skins, menu, etc.) can be replaced.
- gamma correction now goes back to normal when Fitzquake loses focus.
- tab completion now adds a space after the completed command/cvar if the cursor is at the end of the editline.
- increased the max length of the video mode list from 30 to 80. This should alleviate the problems people with newer cards were having trying to use some 32-bit modes -- there were so many 16-bit modes that they filled up the list before all 32-bit modes could be detected. The video menu will still only list a certain number of modes due to space constraints, but you can see the complete list by using the console command "vid_describemodes"
- number of listed video modes in the "video options" menu increased from 27 to 36.
- added alpha control for the front sky layer. (see cvar "r_skyalpha")
- clock can now display time in 24-hour or "military" time.
- added an "mtex" counter to the r_speeds 2 readout. This measures the number of megabytes of texture memory used each frame to draw the scene. Note: this doesn't count textures used to draw the console, menu, or statusbar.
- added optional drawing of surfaces inside sky leaves, for compiler/map testing purposes. (see cvar "r_oldskyleaf")
- sky surfaces on bmodels are now visible, though drawn incorrectly.
- fixed multiple textures in bsp with same name or no name get overwritten/not loaded. (example: rd1m3)
- fixed some nasty texture loading bugs that were especially hounding 3dfx users (wrong texture, no texture, or unnecessarily low-res textures displayed on models and world.) These bugs would also occur in conjunction with nonzero values of gl_max_size or gl_picmip.
- fixed bug where changing gl_max_size or gl_picmip in-game would screw up alias model texture coordinates.
- fixed bug where if -gamma is specified at the command line, the "gamma" cvar would be ignored.
- fixed model more than 2048 units above floor us unlit by static lighting.
- fixed crash with con_logcenterprint when centerprint message was too long.
- fixed crash when changing to a nonexistant gamedir and then trying to write a file (screenshot, etc.) Fitzquake now creates the directory as needed.
- fixed "bad surface extents" error when sky or water surface is missing from bsp file.
- fixed alias model shadows write to z-buffer.
- fixed underwater intermission camera has warp, but no screenblend.
- fixed console buffer still scrolled back after using the "clear" command.
- fixed console command history (the list of previous commands) not being rewound after toggling the console.
- removed cvar gl_texsort. New bsp drawing code always sorts by texture.
- removed cvar gl_ztrick. The depth buffer is now cleared every frame.
- removed cvar gl_keeptjunctions. Extra verts created by qbsp to eliminate tjunctions are now always kept.
- removed "sliding on monsters' heads" fix, becuase I decided I don't like the idea of changing gameplay, even if the original behaviour is clearly a bug. Since this bug can be fixed in quakec also, I feel safer leaving it as it was.
cvars:
- gl_overbright. default 1. This variable controls overbright lighting on the world polygons. (For lighting on models, use gl_overbright_models.) If 1, overbright will be enabled and lighting will resemble software Quake. If 0, overbright will be disabled and lighting will resemble GLQuake.
- r_oldskyleaf. default 0. If 0, surfaces inside sky leaves will be skipped by the renderer. If 1, they will be drawn whenever they are in your PVS, just like any other surface.
- r_oldwater. default 1. If 1, use the old GLQuake method of subdividing the water surface to enable a warping animation. If 0, use the new render-to-texture method. Note: in general, r_oldwater 0 looks better and runs slower. So experiment to see if the performance hit is acceptable to you.
- r_skyalpha. default 1. Sets the alpha of the front sky layer. Note that if sky alpha is less than 1.0, the sky will be drawn in two passes even if you have multitexture.
- r_waterquality. default 8. Sets the quality of the water when r_oldwater is 0. Can be anywhere from 1 to 64. Lower values give better performance, higher values look better. A value of 4 will provide water that looks at least as good as glquake can get, and 32 is close enough to software quake for all but the most picky. To control the quality of water when r_oldwater is 1, use gl_subdivide_size instead.
- scr_clock. default 0. If 1, game time is displayed. If 2, system time is displayed in 12-hour format. If 3, system time will be displayed in 24-hour or "military" time.
Changes in 0.70
---------------
- added anaglyph stereo rendering. Note that this will cut your framerate in half, as it is rendering the scene once for each eye. You might want to turn off r_drawviewmodel as it is hard to focus on becuase it is so close. (see cvars "r_stereo", "r_stereodepth")
- now uses ARB_multitexture if present, otherwise tries to use SGIS_multitexture. This should fix various blending bugs on some cards, such as weird cloud layers, all-black models, and inverted torches. (only ARB guarantees that GL_DECAL blending will work)
- overbright models now uses GL_EXT_texture_env_combine if supported (TNT and later, voodoo4 and later,) which saves one or two passes on model rendering when gl_overbright_models is 1. The command line option -nocombine will disable this.
- gl_overbright_models now defaults to 1
- custom palettes are now correctly loaded when you use the "game" command.
- RecursiveLightPoint is now lerped for smoother lighting of slow-moving models. Check out the ogre in e3m3 for an example.
- dynamic lighting (rockets, etc) has been moderately sped up. (some lightmaps were being uploaded even though they weren't actually touched by a dynamic light.)
- overhauled 2d drawing to allow independent scaling of console, menu, and sbar (see cvars "scr_conwdith," "scr_menuscale," and "scr_sbarscale") command line switches "-conwidth" and "-conheight" removed. cvar "scr_stretch_menus" removed.
- user control of max framerate. (see cvar "host_maxfps")
- improved the accuracy of the FPS counter a bit, but it still seems suspect.
- particles can now be drawn as quads or triangles. (see cvar "r_quadparticles")
- opengl information (vendor, renderer, version, extensions) is no longer printed during initialization. (see command "gl_info")
- rewrote texture management. Now instead of quake's memory usage going up and up forever (becuase textures were uploaded to the opengl.dll and never freed,) all textures will get flushed when you switch games, bringing you back down to where you were when fitzquake first launched.
- gl_texturemode command will now accept a number (1 through 6) as well as the name (gl_linear_mipmap_nearest, etc.)
- gl_describetexturemodes will list all texturemodes.
- the inside of sky leaves are no longer rendered -- so when noclipping inside them, it will look the same as noclipping inside a solid wall. This does not affect gameplay.
- cleaned up intermission display in singleplayer -- no more overlapping numbers
- r_speeds readout modified a bit. (see cvar "r_speeds")
- r_sky_quality now defaults to 12 instead of 8, since skies are now drawn in 1 pass (with multitexture at least)
- gl_texsort now always defaults to 0. (it used to be forced to 1 when multitexture was unavailable)
- fixed bug where models would actually darken when dlights got bright enough
- fixed deathmatch, coop cvars not reset to zero when starting a new game from the single player menu
- fixed r_lightmap doesn't work when gl_texsort = 0.
- fixed inverted lightmaps / no textures / no dynamic light bug when multitexture is disabled and gl_texsort = 0
- fixed scrolling map title in wrong place when width does not equal conwidth
- fixed a few color borking problems in 16-bit mode. The front sky layer, sprites, and pics with transparency will still look a bit off (as in glquake,) but at least the console image and statusbar background look better. Though it isn't perfect, it should once again look like what you expect from glquake in 16bit.
- fixed pixel gap on both sides of the console in 1024x768
- fixed wpoly count being slightly lower when gl_texsort = 0 (the count was correct when gl_texsort = 1)
- fixed lmap count always zero when gl_texsort = 1
- dlight fans are now drawn after water, so that it looks right at least when wateralpha is 1.
- fixed a possible bug with older 3dfx cards (voodoo 1/2/rush) where the gamma cvar might not work (untested)
- fixed old commands showing up in the console prompt after hitting 'enter'
- increased MAX_HANDLES so that you should never see the "out of handles" error message.
- removed cvar "chase_alpha." the transparent player model was buggy and didn't work well in a lot of conditions.
- removed cvar "gl_doubleeys" (yes, that is the correct misspelling) With overbright models, eyes can be seen as easily as in software mode.
- removed cvars "cl_crossx," "cl_crossy," "lcd_x," "lcd_yaw," and "gl_reporttjunctions" which didn't do anything (in glquake, at least).
- removed support for GL_EXT_shared_texture_palette (special 8-bit texture format)
- removed VCR code. command line switches "-record" and "-playback" no longer supported.
- removed support for command line switch "-gamma" -- just use the gamma cvar, or idgamma or something.
cvars:
- r_stereo. default 0. If nonzero, the scene will be rendered once in red, and again in cyan, with the two views shifted slightly. If you have 3D glasses you can appreciate this (assumes that the left eye is red and the right eye is cyan.) The value of r_stereo sets the eye separation. If your glasses have red on the right eye, use a negative value to flip the views.
- r_stereodepth. default 128. Sets the distance at which the two views will converge when stereo rendering is active.
- scr_conwdith. default 0. Sets the virtual console width, where smaller numbers means larger text. Values larger than window width, or smaller than 320, will be clamped to that range, and all values will be rounded to a multiple of 8. If 0, the window width will be used. Note that values that divide evenly into the window width will make the text look nicest.
- scr_menuscale. default 1. Sets the scale factor for menus and other centered overlays. If 1, images will be drawn at 1:1 scale. If 2, images will be double size. Menus will never be drawn smaller than 1:1, and never larger than the size of the window. Note that integer values will make the text look nicest.
- scr_sbarscale. default 1. Sets the scale factor for the statusbar. If 1, images will be drawn at 1:1 scale. If 2, images will be double size. The statusbar will never be drawn smaller than 1:1, and never larger than the width of the window. Note that integer values will make the text look nicest.
- host_maxfps. default 72. sets the maximum frames per second fitzquake will render (also the maximum number of server frames per second.) Clamped to the range 10 - 1000. Set to 72 to mimic standard quake.
- r_quadparticles. default 1. If 1, particles are drawn as GL_QUADS instead of GL_TRIANGLES. Quads use 4 verts instead of 3, but the fillrate cost is 1/2 that of triangles. Depending on your card, either one may be faster. This cvar has no effect on the appearance of particles.
- r_speeds. default 0. Values of 1 and 2 will give you increasing amounts of information. When you see two numbers separated by a slash, the first number is polys, and the second number is passes.
commands:
- gl_info. Displays opengl info which was previously displayed during initialization: vendor, renderer, version, and extensions
- imagelist. Displays a list of loaded textures, and their dimentions.
- gl_texturemode. Now accepts a number (1 through 6) as well as the name (gl_nearest, etc.)
- gl_describetexturemodes. Lists all texturemodes.
Changes in 0.65
---------------
- gamma cvar now supported. (see cvar "gamma")
- fullbrights on models now supported.
- odd-sized world textures are now bilinearly resampled (instead of glquake's nearest pixel resample)
- removed all fixed-size buffers for loading textures; now the only limit is the size of your memory heap (textures will still be downsampled if they are bigger than the hardware can handle)
- styled lights (torch flicker, etc.) can now be disabled (see cvar "r_flatlightstyles")
- sky now uses multitexture if available.
- centerprints are now optionally logged to the console (see cvar "con_logcenterprint")
- number of savegame slots increased to 20 (from 12)
- if a map title is longer than 22 characters, it scrolls marquee-style in the statusbar.
- gl_flashblend defaults to 1 again. (consistency with glquake)
- gl_ztrick defaults to 1 again. (consistency with glquake)
- command line gamma now defaults to 1.0 for all cards. (consistency with glquake, plus hardware gamma is better)
- now checks hardware for maximum texture size. Users of later voodoo cards should be able to see large textures now. (see cvar "gl_max_size")
- now shows AM/PM when scr_clock is 2
- fixed crash when starting dedicated server
- fixed crash when loading too many textures. (now it throws a sys_error and quits)
- fixed fitzquake-specific crash when player goes near water in a demo playback.
- scr_conalpha now actually works.
- keypad enter in the console works again.
- optional 2x overbrightening on models. (see cvar "gl_overbright_models")
- optional quake2-style noclip. (see cvar "sv_altnoclip")
- new icon
cvars:
- con_logcenterprint: If 1, centerprint messages will be logged to the console in sp/coop. If 2, they will also be logged in deathmatch. Default 1.
- gamma: Brighten or darken the screen to compensate for differences between monitors. This is now supported by using your video card's gamma support. Just like in winquake, values less than 1 are brighter and values greater than one are darker. Default 1. Notes: I have added special code so that this will work on 3dfx cards too, but i have no way to check that it works. If fitzquake crashes, your hardware gamma may be stuck at the wrong value. You can use the "display settings" control panel fix this, or you could try lordhavoc's useful "setgamma" utility (available on this page.) Also note that if texture-brightening gamma has been requested at the command line (fitzquake.exe -gamma ), harware gamma will not be used and the gamma cvar will have no effect.
- gl_max_size: Now defaults to 0. If 0, textures will be as large as the hardware allows. Positive values can be used to impose a limit smaller than the hardware's reported maximum.
- gl_overbright_models: If 1, models will be rendered using 2x overbrightening and will appear at roughly the same brightness as they do in software quake, which is noticably brighter than the default fitzquake / glquake appearance. I disabled this cvar by default becuase this is still a poorly supported feature -- it currently takes 2 or 3 passes to render a model when this feature is enabled, compared to only 1 pass when it is disabled. Default 0.
- r_flatlightstyles: If 1, styled lights (torch flicker, etc.) will be displayed as a steady light. If 2, the peak intensity will be used instead of the average intensity. Default 0.
- sv_altnoclip: If 1, enable the alternative noclip movement which resembles quake2 and is not constrained to the horizontal plane. Set to 0 to retain quake's original noclip behavior. Default 1.
Changes in 0.60
---------------
- graphics:
- better sky projection, configurable for performance
- menus and other overlays are now centered on the screen, and can optionally stretch to fit resolution.
- all 2d graphics now obey gl_texturemode and all texturemode changes take effect immediately
- underwater warping now resembles quake3's perspective munging, and obeys r_waterwarp
- fixed frustum culling b0rked (giving HOM at certain FOV / vidsize / screensize combinations)
- fixed lack of support for VP_PARALLEL_ORIENTED, VP_PARALLEL_UPRIGHT, and FACING_UPRIGHT sprites
- fixed fullbrights not displayed on world/bmodels
- fixed texture cache mismatch error
- fixed pink edges on sprites, menu items, etc
- fixed particle z-buffer bug (apparent when a particle is in front of a water surface)
- fixed ugly resampling of non-power of two gfx, skins, sprites
- fixed large models (shamblers, shub) dissapearing near edge of screen
- fixed statusbar not visible when gl_clear = 1
- fixed r_fullbright change not immedate when gl_texsort = 0
- fixed alias models still dark when r_fullbright = 1
- fixed HOM when screen is partially underwater
- fixed gunshot decals not showing up on some walls
- sky and water warp now freeze when you pause, as well as lightning bolts
- r_novis changes now take effect immediately, rather than when you cross a leaf boundary
- removed mirror code
- two particle styles, circle and square (cvar controlled)
- console:
- improved tab completion:
- hitting tab once will display a list of possible matches and complete the line using the first match
- hitting tab or shift-tab will cycle through the matches
- autocomplete will now match against aliases as well as commands and cvars.
- autocomplete will now complete later in the string (e.g. "bind mouse1 +att" + tab will complete '+attack')
- autocomplete will even complete inside the string (e.g. "bind m +attack" + tab will complete 'mouse1' if the cursor is right after the 'm')
- new key functionality:
- tab -- autocomplete, cycle through multiple matches
- shift-tab -- cycle backwards through multiple matches
- ins -- toggle insertmode
- del -- delete current character
- backspace -- delete previous character
- ctrl-v -- paste from windows clippboard
- leftarrow -- move cursor one character left in line
- rightarrow -- move cursor one character right in line. or, get one character from the previous command.
- home -- move cursor to beginning of line
- end -- move cursor to end of line
- ctrl-pgup -- scroll up a screen at a time
- ctrl-pgdn -- scroll down a screen at a time
- ctrl-home -- scroll to top of console history
- ctrl-end -- scroll to bottom of console history
- carets indicate that you are scrolled back, like in quakeworld/quake2
- left arrow, right arrow, pgup, pgdn keys now auto-repeat
- quadrupled the length of the console history
- commands:
- "game <gamedir>" to load a mod.
- "reset <cvar>" to reset a cvar to default. Note that this is the engine default, not the default.cfg value
- resetall. resets all cvars.
- mods. lists all child folders of quake directory which contain either a progs.dat or a pak file
- maps. lists all addon levels available (i.e. all levels that are not in id1/*.pak)
- mapname. outputs the short name of the current level (e.g. "e1m5")
- cmdlist. alphabetized. 'cmdlist blah' will list only cmds that start with 'blah'
- cvarlist. alphabetized. 'cvarlist blah' will list only cvars that start with 'blah'
- "inc <cvar> [amount]" to increment a cvar by amount. amount defaults to 1.
- "toggle <cvar>" to invert the value of a cvar (nonzero -> 0 and 0 -> 1)
- god, noclip, notarget, and fly can now be explicitly set. example: "god 0" will disable god mode
- viewpos. outputs (X,Y,Z) pitch yaw roll
- "give a <value>" now gives you armour. type depends on value
- bindlist. lists all key bindings
- "alias <name>" now outputs the current command string
- "unalias <name>" to delete an alias
- unaliasall. delete all aliases.
- condump. dumps console to condump.txt
- fog. set global fog. syntax is "fog <density>", "fog <red> <green> <blue>", or "fog <density> <red> <green> <blue>" See section on modding for details. Set density to 0 to disable fog.
- "sky <skyname>" to load a skybox. if skyname is "", this will turn off skybox rendering.
- stuffcmds now parses the "cmdline" cvar rather than the args actually passed to the program. This is useful for loading mods dynamically, so you can edit the cmdline before execing quake.rc (which calls "stuffcmds")
- cvars:
- scr_stretch_menus. default 1. if 1, menus and other overlays are stretched to fill the screen
- scr_conalpha. default 1. This is the opacity when the console is halfscreen. 0.6 will mimic glquake
- scr_clock. default 0. if 1, game time is displayed. If 2, system time is displayed.
- scr_showfps. default 0. if 1, FPS are displayed.
- r_waterwarp recognized. default 1. if zero, no underwater warping will take place
- r_drawflat recognized. default 0. if 1, polygons will be drawn as a solid color with no lightmap or texture
- r_particles. default 1. 0 = no particles, 1 = circular particles, 2 = square particles
- r_fastsky. default 0. if 1, sky will be rendered as solid color, for added performance
- r_sky_quality. default 8. Higher number divides the sky more, for a smoother effect and slower performance.
- r_clearcolor now supported. default 2. specify a palette index from 0 to 255.
- gl_fullbrights. default 1. set to 0 to disable fullbrights
- gl_farclip. default 8192. set to 4096 to mimic glquake. note that the skybox will be drawn somewhat closer than this value.
- cl_maxpitch. default 90 (straight down.) set to 80 to mimic normal quake
- cl_minpitch. default -90 (straight up.) set to -70 to mimic normal quake
- cl_keypad. default 1. if 0, keypad keys will respond as in quake.exe (for example, pushing 'KP_END' will be the same as pushing '1')
- gl_flashblend now defaults to 0.
- gl_ztrick now defaults to 0.
- gl_keeptjunctions now defaults to 1. (note, contrary to the name of this cvar, what is being kept is the extra polygon verts which *eliminate* tjunctions. This is a good thing, so i made it default to 1)
- chase_alpha. default 1. lower values make the chasecam player model translucent. Buggy.
- keyboard
- keypad keys are now bindable:
KP_NUMLOCK, KP_SLASH, KP_STAR, KP_MINUS, KP_HOME, KP_UPARROW, KP_PGUP, KP_PLUS, KP_LEFTARROW, KP_5, KP_RIGHTARROW, KP_END, KP_DOWNARROW, KP_PGDN, KP_ENTER, KP_INS, KP_DEL
- command line:
- running with -gamma at the command line will set the gamma. There is still no way to change this value in game. Default is 1.0 for 3dfx cards, 0.7 for all others
- if unspecified, -conwidth now defaults to -width
- modding extensions:
- skyboxes (worldspawn and qc settable), currently only targa and pcx formats accepted
- global fog (worldspawn and qc settable)
- physics
- fixed sliding around while standing on solid entities' bounding boxes (monsters, players, etc)
- misc
- default heapsize is now 32mb (was 16mb)
- default zonesize is now 256k (was 48k)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -0,0 +1,38 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
{
{1.23,1.30,1.47,1.35,1.56,1.71,1.37,1.38,1.59,1.60,1.79,1.97,1.88,1.92,1.79,1.02,0.93,1.07,0.82,0.87,0.88,0.94,0.96,1.14,1.11,0.82,0.83,0.89,0.89,0.86,0.94,0.91,1.00,1.21,0.98,1.48,1.30,1.57,0.96,1.07,1.14,1.60,1.61,1.40,1.37,1.72,1.78,1.79,1.93,1.99,1.90,1.68,1.71,1.86,1.60,1.68,1.78,1.86,1.93,1.99,1.97,1.44,1.22,1.49,0.93,0.99,0.99,1.23,1.22,1.44,1.49,0.89,0.89,0.97,0.91,0.98,1.19,0.82,0.76,0.82,0.71,0.72,0.73,0.76,0.79,0.86,0.83,0.72,0.76,0.76,0.89,0.82,0.89,0.82,0.89,0.91,0.83,0.96,1.14,0.97,1.40,1.19,0.98,0.94,1.00,1.07,1.37,1.21,1.48,1.30,1.57,1.61,1.37,0.86,0.83,0.91,0.82,0.82,0.88,0.89,0.96,1.14,0.98,0.87,0.93,0.94,1.02,1.30,1.07,1.35,1.38,1.11,1.56,1.92,1.79,1.79,1.59,1.60,1.72,1.90,1.79,0.80,0.85,0.79,0.93,0.80,0.85,0.77,0.74,0.72,0.77,0.74,0.72,0.70,0.70,0.71,0.76,0.73,0.79,0.79,0.73,0.76,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.26,1.26,1.48,1.23,1.50,1.71,1.14,1.19,1.38,1.46,1.64,1.94,1.87,1.84,1.71,1.02,0.92,1.00,0.79,0.85,0.84,0.91,0.90,0.98,0.99,0.77,0.77,0.83,0.82,0.79,0.86,0.84,0.92,0.99,0.91,1.24,1.03,1.33,0.88,0.94,0.97,1.41,1.39,1.18,1.11,1.51,1.61,1.59,1.80,1.91,1.76,1.54,1.65,1.76,1.70,1.70,1.85,1.85,1.97,1.99,1.93,1.28,1.09,1.39,0.92,0.97,0.99,1.18,1.26,1.52,1.48,0.83,0.85,0.90,0.88,0.93,1.00,0.77,0.73,0.78,0.72,0.71,0.74,0.75,0.79,0.86,0.81,0.75,0.81,0.79,0.96,0.88,0.94,0.86,0.93,0.92,0.85,1.08,1.33,1.05,1.55,1.31,1.01,1.05,1.27,1.31,1.60,1.47,1.70,1.54,1.76,1.76,1.57,0.93,0.90,0.99,0.88,0.88,0.95,0.97,1.11,1.39,1.20,0.92,0.97,1.01,1.10,1.39,1.22,1.51,1.58,1.32,1.64,1.97,1.85,1.91,1.77,1.74,1.88,1.99,1.91,0.79,0.86,0.80,0.94,0.84,0.88,0.74,0.74,0.71,0.82,0.77,0.76,0.70,0.73,0.72,0.73,0.70,0.74,0.85,0.77,0.82,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.34,1.27,1.53,1.17,1.46,1.71,0.98,1.05,1.20,1.34,1.48,1.86,1.82,1.71,1.62,1.09,0.94,0.99,0.79,0.85,0.82,0.90,0.87,0.93,0.96,0.76,0.74,0.79,0.76,0.74,0.79,0.78,0.85,0.92,0.85,1.00,0.93,1.06,0.81,0.86,0.89,1.16,1.12,0.97,0.95,1.28,1.38,1.35,1.60,1.77,1.57,1.33,1.50,1.58,1.69,1.63,1.82,1.74,1.91,1.92,1.80,1.04,0.97,1.21,0.90,0.93,0.97,1.05,1.21,1.48,1.37,0.77,0.80,0.84,0.85,0.88,0.92,0.73,0.71,0.74,0.74,0.71,0.75,0.73,0.79,0.84,0.78,0.79,0.86,0.81,1.05,0.94,0.99,0.90,0.95,0.92,0.86,1.24,1.44,1.14,1.59,1.34,1.02,1.27,1.50,1.49,1.80,1.69,1.86,1.72,1.87,1.80,1.69,1.00,0.98,1.23,0.95,0.96,1.09,1.16,1.37,1.63,1.46,0.99,1.10,1.25,1.24,1.51,1.41,1.67,1.77,1.55,1.72,1.95,1.89,1.98,1.91,1.86,1.97,1.99,1.94,0.81,0.89,0.85,0.98,0.90,0.94,0.75,0.78,0.73,0.89,0.83,0.82,0.72,0.77,0.76,0.72,0.70,0.71,0.91,0.83,0.89,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.46,1.34,1.60,1.16,1.46,1.71,0.94,0.99,1.05,1.26,1.33,1.74,1.76,1.57,1.54,1.23,0.98,1.05,0.83,0.89,0.84,0.92,0.87,0.91,0.96,0.78,0.74,0.79,0.72,0.72,0.75,0.76,0.80,0.88,0.83,0.94,0.87,0.95,0.76,0.80,0.82,0.97,0.96,0.89,0.88,1.08,1.11,1.10,1.37,1.59,1.37,1.07,1.27,1.34,1.57,1.45,1.69,1.55,1.77,1.79,1.60,0.93,0.90,0.99,0.86,0.87,0.93,0.96,1.07,1.35,1.18,0.73,0.76,0.77,0.81,0.82,0.85,0.70,0.71,0.72,0.78,0.73,0.77,0.73,0.79,0.82,0.76,0.83,0.90,0.84,1.18,0.98,1.03,0.92,0.95,0.90,0.86,1.32,1.45,1.15,1.53,1.27,0.99,1.42,1.65,1.58,1.93,1.83,1.94,1.81,1.88,1.74,1.70,1.19,1.17,1.44,1.11,1.15,1.36,1.41,1.61,1.81,1.67,1.22,1.34,1.50,1.42,1.65,1.61,1.82,1.91,1.75,1.80,1.89,1.89,1.98,1.99,1.94,1.98,1.92,1.87,0.86,0.95,0.92,1.14,0.98,1.03,0.79,0.84,0.77,0.97,0.90,0.89,0.76,0.82,0.82,0.74,0.72,0.71,0.98,0.89,0.97,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.60,1.44,1.68,1.22,1.49,1.71,0.93,0.99,0.99,1.23,1.22,1.60,1.68,1.44,1.49,1.40,1.14,1.19,0.89,0.96,0.89,0.97,0.89,0.91,0.98,0.82,0.76,0.82,0.71,0.72,0.73,0.76,0.79,0.86,0.83,0.91,0.83,0.89,0.72,0.76,0.76,0.89,0.89,0.82,0.82,0.98,0.96,0.97,1.14,1.40,1.19,0.94,1.00,1.07,1.37,1.21,1.48,1.30,1.57,1.61,1.37,0.86,0.83,0.91,0.82,0.82,0.88,0.89,0.96,1.14,0.98,0.70,0.72,0.73,0.77,0.76,0.79,0.70,0.72,0.71,0.82,0.77,0.80,0.74,0.79,0.80,0.74,0.87,0.93,0.85,1.23,1.02,1.02,0.93,0.93,0.87,0.85,1.30,1.35,1.07,1.38,1.11,0.94,1.47,1.71,1.56,1.97,1.88,1.92,1.79,1.79,1.59,1.60,1.30,1.35,1.56,1.37,1.38,1.59,1.60,1.79,1.92,1.79,1.48,1.57,1.72,1.61,1.78,1.79,1.93,1.99,1.90,1.86,1.78,1.86,1.93,1.99,1.97,1.90,1.79,1.72,0.94,1.07,1.00,1.37,1.21,1.30,0.86,0.91,0.83,1.14,0.98,0.96,0.82,0.88,0.89,0.79,0.76,0.73,1.07,0.94,1.11,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.74,1.57,1.76,1.33,1.54,1.71,0.94,1.05,0.99,1.26,1.16,1.46,1.60,1.34,1.46,1.59,1.37,1.37,0.97,1.11,0.96,1.10,0.95,0.94,1.08,0.89,0.82,0.88,0.72,0.76,0.75,0.80,0.80,0.88,0.87,0.91,0.83,0.87,0.72,0.76,0.74,0.83,0.84,0.78,0.79,0.96,0.89,0.92,0.98,1.23,1.05,0.86,0.92,0.95,1.11,0.98,1.22,1.03,1.34,1.42,1.14,0.79,0.77,0.84,0.78,0.76,0.82,0.82,0.89,0.97,0.90,0.70,0.71,0.71,0.73,0.72,0.74,0.73,0.76,0.72,0.86,0.81,0.82,0.76,0.79,0.77,0.73,0.90,0.95,0.86,1.18,1.03,0.98,0.92,0.90,0.83,0.84,1.19,1.17,0.98,1.15,0.97,0.89,1.42,1.65,1.44,1.93,1.83,1.81,1.67,1.61,1.36,1.41,1.32,1.45,1.58,1.57,1.53,1.74,1.70,1.88,1.94,1.81,1.69,1.77,1.87,1.79,1.89,1.92,1.98,1.99,1.98,1.89,1.65,1.80,1.82,1.91,1.94,1.75,1.61,1.50,1.07,1.34,1.27,1.60,1.45,1.55,0.93,0.99,0.90,1.35,1.18,1.07,0.87,0.93,0.96,0.85,0.82,0.77,1.15,0.99,1.27,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.86,1.71,1.82,1.48,1.62,1.71,0.98,1.20,1.05,1.34,1.17,1.34,1.53,1.27,1.46,1.77,1.60,1.57,1.16,1.38,1.12,1.35,1.06,1.00,1.28,0.97,0.89,0.95,0.76,0.81,0.79,0.86,0.85,0.92,0.93,0.93,0.85,0.87,0.74,0.78,0.74,0.79,0.82,0.76,0.79,0.96,0.85,0.90,0.94,1.09,0.99,0.81,0.85,0.89,0.95,0.90,0.99,0.94,1.10,1.24,0.98,0.75,0.73,0.78,0.74,0.72,0.77,0.76,0.82,0.89,0.83,0.73,0.71,0.71,0.71,0.70,0.72,0.77,0.80,0.74,0.90,0.85,0.84,0.78,0.79,0.75,0.73,0.92,0.95,0.86,1.05,0.99,0.94,0.90,0.86,0.79,0.81,1.00,0.98,0.91,0.96,0.89,0.83,1.27,1.50,1.23,1.80,1.69,1.63,1.46,1.37,1.09,1.16,1.24,1.44,1.49,1.69,1.59,1.80,1.69,1.87,1.86,1.72,1.82,1.91,1.94,1.92,1.95,1.99,1.98,1.91,1.97,1.89,1.51,1.72,1.67,1.77,1.86,1.55,1.41,1.25,1.33,1.58,1.50,1.80,1.63,1.74,1.04,1.21,0.97,1.48,1.37,1.21,0.93,0.97,1.05,0.92,0.88,0.84,1.14,1.02,1.34,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.94,1.84,1.87,1.64,1.71,1.71,1.14,1.38,1.19,1.46,1.23,1.26,1.48,1.26,1.50,1.91,1.80,1.76,1.41,1.61,1.39,1.59,1.33,1.24,1.51,1.18,0.97,1.11,0.82,0.88,0.86,0.94,0.92,0.99,1.03,0.98,0.91,0.90,0.79,0.84,0.77,0.79,0.84,0.77,0.83,0.99,0.85,0.91,0.92,1.02,1.00,0.79,0.80,0.86,0.88,0.84,0.92,0.88,0.97,1.10,0.94,0.74,0.71,0.74,0.72,0.70,0.73,0.72,0.76,0.82,0.77,0.77,0.73,0.74,0.71,0.70,0.73,0.83,0.85,0.78,0.92,0.88,0.86,0.81,0.79,0.74,0.75,0.92,0.93,0.85,0.96,0.94,0.88,0.86,0.81,0.75,0.79,0.93,0.90,0.85,0.88,0.82,0.77,1.05,1.27,0.99,1.60,1.47,1.39,1.20,1.11,0.95,0.97,1.08,1.33,1.31,1.70,1.55,1.76,1.57,1.76,1.70,1.54,1.85,1.97,1.91,1.99,1.97,1.99,1.91,1.77,1.88,1.85,1.39,1.64,1.51,1.58,1.74,1.32,1.22,1.01,1.54,1.76,1.65,1.93,1.70,1.85,1.28,1.39,1.09,1.52,1.48,1.26,0.97,0.99,1.18,1.00,0.93,0.90,1.05,1.01,1.31,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.97,1.92,1.88,1.79,1.79,1.71,1.37,1.59,1.38,1.60,1.35,1.23,1.47,1.30,1.56,1.99,1.93,1.90,1.60,1.78,1.61,1.79,1.57,1.48,1.72,1.40,1.14,1.37,0.89,0.96,0.94,1.07,1.00,1.21,1.30,1.14,0.98,0.96,0.86,0.91,0.83,0.82,0.88,0.82,0.89,1.11,0.87,0.94,0.93,1.02,1.07,0.80,0.79,0.85,0.82,0.80,0.87,0.85,0.93,1.02,0.93,0.77,0.72,0.74,0.71,0.70,0.70,0.71,0.72,0.77,0.74,0.82,0.76,0.79,0.72,0.73,0.76,0.89,0.89,0.82,0.93,0.91,0.86,0.83,0.79,0.73,0.76,0.91,0.89,0.83,0.89,0.89,0.82,0.82,0.76,0.72,0.76,0.86,0.83,0.79,0.82,0.76,0.73,0.94,1.00,0.91,1.37,1.21,1.14,0.98,0.96,0.88,0.89,0.96,1.14,1.07,1.60,1.40,1.61,1.37,1.57,1.48,1.30,1.78,1.93,1.79,1.99,1.92,1.90,1.79,1.59,1.72,1.79,1.30,1.56,1.35,1.38,1.60,1.11,1.07,0.94,1.68,1.86,1.71,1.97,1.68,1.86,1.44,1.49,1.22,1.44,1.49,1.22,0.99,0.99,1.23,1.19,0.98,0.97,0.97,0.98,1.19,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.94,1.97,1.87,1.91,1.85,1.71,1.60,1.77,1.58,1.74,1.51,1.26,1.48,1.39,1.64,1.99,1.97,1.99,1.70,1.85,1.76,1.91,1.76,1.70,1.88,1.55,1.33,1.57,0.96,1.08,1.05,1.31,1.27,1.47,1.54,1.39,1.20,1.11,0.93,0.99,0.90,0.88,0.95,0.88,0.97,1.32,0.92,1.01,0.97,1.10,1.22,0.84,0.80,0.88,0.79,0.79,0.85,0.86,0.92,1.02,0.94,0.82,0.76,0.77,0.72,0.73,0.70,0.72,0.71,0.74,0.74,0.88,0.81,0.85,0.75,0.77,0.82,0.94,0.93,0.86,0.92,0.92,0.86,0.85,0.79,0.74,0.79,0.88,0.85,0.81,0.82,0.83,0.77,0.78,0.73,0.71,0.75,0.79,0.77,0.74,0.77,0.73,0.70,0.86,0.92,0.84,1.14,0.99,0.98,0.91,0.90,0.84,0.83,0.88,0.97,0.94,1.41,1.18,1.39,1.11,1.33,1.24,1.03,1.61,1.80,1.59,1.91,1.84,1.76,1.64,1.38,1.51,1.71,1.26,1.50,1.23,1.19,1.46,0.99,1.00,0.91,1.70,1.85,1.65,1.93,1.54,1.76,1.52,1.48,1.26,1.28,1.39,1.09,0.99,0.97,1.18,1.31,1.01,1.05,0.90,0.93,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.86,1.95,1.82,1.98,1.89,1.71,1.80,1.91,1.77,1.86,1.67,1.34,1.53,1.51,1.72,1.92,1.91,1.99,1.69,1.82,1.80,1.94,1.87,1.86,1.97,1.59,1.44,1.69,1.05,1.24,1.27,1.49,1.50,1.69,1.72,1.63,1.46,1.37,1.00,1.23,0.98,0.95,1.09,0.96,1.16,1.55,0.99,1.25,1.10,1.24,1.41,0.90,0.85,0.94,0.79,0.81,0.85,0.89,0.94,1.09,0.98,0.89,0.82,0.83,0.74,0.77,0.72,0.76,0.73,0.75,0.78,0.94,0.86,0.91,0.79,0.83,0.89,0.99,0.95,0.90,0.90,0.92,0.84,0.86,0.79,0.75,0.81,0.85,0.80,0.78,0.76,0.77,0.73,0.74,0.71,0.71,0.73,0.74,0.74,0.71,0.76,0.72,0.70,0.79,0.85,0.78,0.98,0.92,0.93,0.85,0.87,0.82,0.79,0.81,0.89,0.86,1.16,0.97,1.12,0.95,1.06,1.00,0.93,1.38,1.60,1.35,1.77,1.71,1.57,1.48,1.20,1.28,1.62,1.27,1.46,1.17,1.05,1.34,0.96,0.99,0.90,1.63,1.74,1.50,1.80,1.33,1.58,1.48,1.37,1.21,1.04,1.21,0.97,0.97,0.93,1.05,1.34,1.02,1.14,0.84,0.88,0.92,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.74,1.89,1.76,1.98,1.89,1.71,1.93,1.99,1.91,1.94,1.82,1.46,1.60,1.65,1.80,1.79,1.77,1.92,1.57,1.69,1.74,1.87,1.88,1.94,1.98,1.53,1.45,1.70,1.18,1.32,1.42,1.58,1.65,1.83,1.81,1.81,1.67,1.61,1.19,1.44,1.17,1.11,1.36,1.15,1.41,1.75,1.22,1.50,1.34,1.42,1.61,0.98,0.92,1.03,0.83,0.86,0.89,0.95,0.98,1.23,1.14,0.97,0.89,0.90,0.78,0.82,0.76,0.82,0.77,0.79,0.84,0.98,0.90,0.98,0.83,0.89,0.97,1.03,0.95,0.92,0.86,0.90,0.82,0.86,0.79,0.77,0.84,0.81,0.76,0.76,0.72,0.73,0.70,0.72,0.71,0.73,0.73,0.72,0.74,0.71,0.78,0.74,0.72,0.75,0.80,0.76,0.94,0.88,0.91,0.83,0.87,0.84,0.79,0.76,0.82,0.80,0.97,0.89,0.96,0.88,0.95,0.94,0.87,1.11,1.37,1.10,1.59,1.57,1.37,1.33,1.05,1.08,1.54,1.34,1.46,1.16,0.99,1.26,0.96,1.05,0.92,1.45,1.55,1.27,1.60,1.07,1.34,1.35,1.18,1.07,0.93,0.99,0.90,0.93,0.87,0.96,1.27,0.99,1.15,0.77,0.82,0.85,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.60,1.78,1.68,1.93,1.86,1.71,1.97,1.99,1.99,1.97,1.93,1.60,1.68,1.78,1.86,1.61,1.57,1.79,1.37,1.48,1.59,1.72,1.79,1.92,1.90,1.38,1.35,1.60,1.23,1.30,1.47,1.56,1.71,1.88,1.79,1.92,1.79,1.79,1.30,1.56,1.35,1.37,1.59,1.38,1.60,1.90,1.48,1.72,1.57,1.61,1.79,1.21,1.00,1.30,0.89,0.94,0.96,1.07,1.14,1.40,1.37,1.14,0.96,0.98,0.82,0.88,0.82,0.89,0.83,0.86,0.91,1.02,0.93,1.07,0.87,0.94,1.11,1.02,0.93,0.93,0.82,0.87,0.80,0.85,0.79,0.80,0.85,0.77,0.72,0.74,0.71,0.70,0.70,0.71,0.72,0.77,0.74,0.72,0.76,0.73,0.82,0.79,0.76,0.73,0.79,0.76,0.93,0.86,0.91,0.83,0.89,0.89,0.82,0.72,0.76,0.76,0.89,0.82,0.89,0.82,0.89,0.91,0.83,0.96,1.14,0.97,1.40,1.44,1.19,1.22,0.99,0.98,1.49,1.44,1.49,1.22,0.99,1.23,0.98,1.19,0.97,1.21,1.30,1.00,1.37,0.94,1.07,1.14,0.98,0.96,0.86,0.91,0.83,0.88,0.82,0.89,1.11,0.94,1.07,0.73,0.76,0.79,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.46,1.65,1.60,1.82,1.80,1.71,1.93,1.91,1.99,1.94,1.98,1.74,1.76,1.89,1.89,1.42,1.34,1.61,1.11,1.22,1.36,1.50,1.61,1.81,1.75,1.15,1.17,1.41,1.18,1.19,1.42,1.44,1.65,1.83,1.67,1.94,1.81,1.88,1.32,1.58,1.45,1.57,1.74,1.53,1.70,1.98,1.69,1.87,1.77,1.79,1.92,1.45,1.27,1.55,0.97,1.07,1.11,1.34,1.37,1.59,1.60,1.35,1.07,1.18,0.86,0.93,0.87,0.96,0.90,0.93,0.99,1.03,0.95,1.15,0.90,0.99,1.27,0.98,0.90,0.92,0.78,0.83,0.77,0.84,0.79,0.82,0.86,0.73,0.71,0.73,0.72,0.70,0.73,0.72,0.76,0.81,0.76,0.76,0.82,0.77,0.89,0.85,0.82,0.75,0.80,0.80,0.94,0.88,0.94,0.87,0.95,0.96,0.88,0.72,0.74,0.76,0.83,0.78,0.84,0.79,0.87,0.91,0.83,0.89,0.98,0.92,1.23,1.34,1.05,1.16,0.99,0.96,1.46,1.57,1.54,1.33,1.05,1.26,1.08,1.37,1.10,0.98,1.03,0.92,1.14,0.86,0.95,0.97,0.90,0.89,0.79,0.84,0.77,0.82,0.76,0.82,0.97,0.89,0.98,0.71,0.72,0.74,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.34,1.51,1.53,1.67,1.72,1.71,1.80,1.77,1.91,1.86,1.98,1.86,1.82,1.95,1.89,1.24,1.10,1.41,0.95,0.99,1.09,1.25,1.37,1.63,1.55,0.96,0.98,1.16,1.05,1.00,1.27,1.23,1.50,1.69,1.46,1.86,1.72,1.87,1.24,1.49,1.44,1.69,1.80,1.59,1.69,1.97,1.82,1.94,1.91,1.92,1.99,1.63,1.50,1.74,1.16,1.33,1.38,1.58,1.60,1.77,1.80,1.48,1.21,1.37,0.90,0.97,0.93,1.05,0.97,1.04,1.21,0.99,0.95,1.14,0.92,1.02,1.34,0.94,0.86,0.90,0.74,0.79,0.75,0.81,0.79,0.84,0.86,0.71,0.71,0.73,0.76,0.73,0.77,0.74,0.80,0.85,0.78,0.81,0.89,0.84,0.97,0.92,0.88,0.79,0.85,0.86,0.98,0.92,1.00,0.93,1.06,1.12,0.95,0.74,0.74,0.78,0.79,0.76,0.82,0.79,0.87,0.93,0.85,0.85,0.94,0.90,1.09,1.27,0.99,1.17,1.05,0.96,1.46,1.71,1.62,1.48,1.20,1.34,1.28,1.57,1.35,0.90,0.94,0.85,0.98,0.81,0.89,0.89,0.83,0.82,0.75,0.78,0.73,0.77,0.72,0.76,0.89,0.83,0.91,0.71,0.70,0.72,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
{1.26,1.39,1.48,1.51,1.64,1.71,1.60,1.58,1.77,1.74,1.91,1.94,1.87,1.97,1.85,1.10,0.97,1.22,0.88,0.92,0.95,1.01,1.11,1.39,1.32,0.88,0.90,0.97,0.96,0.93,1.05,0.99,1.27,1.47,1.20,1.70,1.54,1.76,1.08,1.31,1.33,1.70,1.76,1.55,1.57,1.88,1.85,1.91,1.97,1.99,1.99,1.70,1.65,1.85,1.41,1.54,1.61,1.76,1.80,1.91,1.93,1.52,1.26,1.48,0.92,0.99,0.97,1.18,1.09,1.28,1.39,0.94,0.93,1.05,0.92,1.01,1.31,0.88,0.81,0.86,0.72,0.75,0.74,0.79,0.79,0.86,0.85,0.71,0.73,0.75,0.82,0.77,0.83,0.78,0.85,0.88,0.81,0.88,0.97,0.90,1.18,1.00,0.93,0.86,0.92,0.94,1.14,0.99,1.24,1.03,1.33,1.39,1.11,0.79,0.77,0.84,0.79,0.77,0.84,0.83,0.90,0.98,0.91,0.85,0.92,0.91,1.02,1.26,1.00,1.23,1.19,0.99,1.50,1.84,1.71,1.64,1.38,1.46,1.51,1.76,1.59,0.84,0.88,0.80,0.94,0.79,0.86,0.82,0.77,0.76,0.74,0.74,0.71,0.73,0.70,0.72,0.82,0.77,0.85,0.74,0.70,0.73,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00}
}

182
quakespasm/Quake/anorms.h Normal file
View File

@ -0,0 +1,182 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
{-0.525731, 0.000000, 0.850651},
{-0.442863, 0.238856, 0.864188},
{-0.295242, 0.000000, 0.955423},
{-0.309017, 0.500000, 0.809017},
{-0.162460, 0.262866, 0.951056},
{0.000000, 0.000000, 1.000000},
{0.000000, 0.850651, 0.525731},
{-0.147621, 0.716567, 0.681718},
{0.147621, 0.716567, 0.681718},
{0.000000, 0.525731, 0.850651},
{0.309017, 0.500000, 0.809017},
{0.525731, 0.000000, 0.850651},
{0.295242, 0.000000, 0.955423},
{0.442863, 0.238856, 0.864188},
{0.162460, 0.262866, 0.951056},
{-0.681718, 0.147621, 0.716567},
{-0.809017, 0.309017, 0.500000},
{-0.587785, 0.425325, 0.688191},
{-0.850651, 0.525731, 0.000000},
{-0.864188, 0.442863, 0.238856},
{-0.716567, 0.681718, 0.147621},
{-0.688191, 0.587785, 0.425325},
{-0.500000, 0.809017, 0.309017},
{-0.238856, 0.864188, 0.442863},
{-0.425325, 0.688191, 0.587785},
{-0.716567, 0.681718, -0.147621},
{-0.500000, 0.809017, -0.309017},
{-0.525731, 0.850651, 0.000000},
{0.000000, 0.850651, -0.525731},
{-0.238856, 0.864188, -0.442863},
{0.000000, 0.955423, -0.295242},
{-0.262866, 0.951056, -0.162460},
{0.000000, 1.000000, 0.000000},
{0.000000, 0.955423, 0.295242},
{-0.262866, 0.951056, 0.162460},
{0.238856, 0.864188, 0.442863},
{0.262866, 0.951056, 0.162460},
{0.500000, 0.809017, 0.309017},
{0.238856, 0.864188, -0.442863},
{0.262866, 0.951056, -0.162460},
{0.500000, 0.809017, -0.309017},
{0.850651, 0.525731, 0.000000},
{0.716567, 0.681718, 0.147621},
{0.716567, 0.681718, -0.147621},
{0.525731, 0.850651, 0.000000},
{0.425325, 0.688191, 0.587785},
{0.864188, 0.442863, 0.238856},
{0.688191, 0.587785, 0.425325},
{0.809017, 0.309017, 0.500000},
{0.681718, 0.147621, 0.716567},
{0.587785, 0.425325, 0.688191},
{0.955423, 0.295242, 0.000000},
{1.000000, 0.000000, 0.000000},
{0.951056, 0.162460, 0.262866},
{0.850651, -0.525731, 0.000000},
{0.955423, -0.295242, 0.000000},
{0.864188, -0.442863, 0.238856},
{0.951056, -0.162460, 0.262866},
{0.809017, -0.309017, 0.500000},
{0.681718, -0.147621, 0.716567},
{0.850651, 0.000000, 0.525731},
{0.864188, 0.442863, -0.238856},
{0.809017, 0.309017, -0.500000},
{0.951056, 0.162460, -0.262866},
{0.525731, 0.000000, -0.850651},
{0.681718, 0.147621, -0.716567},
{0.681718, -0.147621, -0.716567},
{0.850651, 0.000000, -0.525731},
{0.809017, -0.309017, -0.500000},
{0.864188, -0.442863, -0.238856},
{0.951056, -0.162460, -0.262866},
{0.147621, 0.716567, -0.681718},
{0.309017, 0.500000, -0.809017},
{0.425325, 0.688191, -0.587785},
{0.442863, 0.238856, -0.864188},
{0.587785, 0.425325, -0.688191},
{0.688191, 0.587785, -0.425325},
{-0.147621, 0.716567, -0.681718},
{-0.309017, 0.500000, -0.809017},
{0.000000, 0.525731, -0.850651},
{-0.525731, 0.000000, -0.850651},
{-0.442863, 0.238856, -0.864188},
{-0.295242, 0.000000, -0.955423},
{-0.162460, 0.262866, -0.951056},
{0.000000, 0.000000, -1.000000},
{0.295242, 0.000000, -0.955423},
{0.162460, 0.262866, -0.951056},
{-0.442863, -0.238856, -0.864188},
{-0.309017, -0.500000, -0.809017},
{-0.162460, -0.262866, -0.951056},
{0.000000, -0.850651, -0.525731},
{-0.147621, -0.716567, -0.681718},
{0.147621, -0.716567, -0.681718},
{0.000000, -0.525731, -0.850651},
{0.309017, -0.500000, -0.809017},
{0.442863, -0.238856, -0.864188},
{0.162460, -0.262866, -0.951056},
{0.238856, -0.864188, -0.442863},
{0.500000, -0.809017, -0.309017},
{0.425325, -0.688191, -0.587785},
{0.716567, -0.681718, -0.147621},
{0.688191, -0.587785, -0.425325},
{0.587785, -0.425325, -0.688191},
{0.000000, -0.955423, -0.295242},
{0.000000, -1.000000, 0.000000},
{0.262866, -0.951056, -0.162460},
{0.000000, -0.850651, 0.525731},
{0.000000, -0.955423, 0.295242},
{0.238856, -0.864188, 0.442863},
{0.262866, -0.951056, 0.162460},
{0.500000, -0.809017, 0.309017},
{0.716567, -0.681718, 0.147621},
{0.525731, -0.850651, 0.000000},
{-0.238856, -0.864188, -0.442863},
{-0.500000, -0.809017, -0.309017},
{-0.262866, -0.951056, -0.162460},
{-0.850651, -0.525731, 0.000000},
{-0.716567, -0.681718, -0.147621},
{-0.716567, -0.681718, 0.147621},
{-0.525731, -0.850651, 0.000000},
{-0.500000, -0.809017, 0.309017},
{-0.238856, -0.864188, 0.442863},
{-0.262866, -0.951056, 0.162460},
{-0.864188, -0.442863, 0.238856},
{-0.809017, -0.309017, 0.500000},
{-0.688191, -0.587785, 0.425325},
{-0.681718, -0.147621, 0.716567},
{-0.442863, -0.238856, 0.864188},
{-0.587785, -0.425325, 0.688191},
{-0.309017, -0.500000, 0.809017},
{-0.147621, -0.716567, 0.681718},
{-0.425325, -0.688191, 0.587785},
{-0.162460, -0.262866, 0.951056},
{0.442863, -0.238856, 0.864188},
{0.162460, -0.262866, 0.951056},
{0.309017, -0.500000, 0.809017},
{0.147621, -0.716567, 0.681718},
{0.000000, -0.525731, 0.850651},
{0.425325, -0.688191, 0.587785},
{0.587785, -0.425325, 0.688191},
{0.688191, -0.587785, 0.425325},
{-0.955423, 0.295242, 0.000000},
{-0.951056, 0.162460, 0.262866},
{-1.000000, 0.000000, 0.000000},
{-0.850651, 0.000000, 0.525731},
{-0.955423, -0.295242, 0.000000},
{-0.951056, -0.162460, 0.262866},
{-0.864188, 0.442863, -0.238856},
{-0.951056, 0.162460, -0.262866},
{-0.809017, 0.309017, -0.500000},
{-0.864188, -0.442863, -0.238856},
{-0.951056, -0.162460, -0.262866},
{-0.809017, -0.309017, -0.500000},
{-0.681718, 0.147621, -0.716567},
{-0.681718, -0.147621, -0.716567},
{-0.850651, 0.000000, -0.525731},
{-0.688191, 0.587785, -0.425325},
{-0.587785, 0.425325, -0.688191},
{-0.425325, 0.688191, -0.587785},
{-0.425325, -0.688191, -0.587785},
{-0.587785, -0.425325, -0.688191},
{-0.688191, -0.587785, -0.425325},

326
quakespasm/Quake/bspfile.h Normal file
View File

@ -0,0 +1,326 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// upper design bounds
#define MAX_MAP_HULLS 4
#define MAX_MAP_MODELS 256
#define MAX_MAP_BRUSHES 4096
#define MAX_MAP_ENTITIES 1024
#define MAX_MAP_ENTSTRING 65536
#define MAX_MAP_PLANES 32767
#define MAX_MAP_NODES 32767 // because negative shorts are contents
#define MAX_MAP_CLIPNODES 32767
#define MAX_MAP_LEAFS 32767 //johnfitz -- was 8192
#define MAX_MAP_VERTS 65535
#define MAX_MAP_FACES 65535
#define MAX_MAP_MARKSURFACES 65535
#define MAX_MAP_TEXINFO 4096
#define MAX_MAP_EDGES 256000
#define MAX_MAP_SURFEDGES 512000
#define MAX_MAP_TEXTURES 512
#define MAX_MAP_MIPTEX 0x200000
#define MAX_MAP_LIGHTING 0x100000
#define MAX_MAP_VISIBILITY 0x100000
#define MAX_MAP_PORTALS 65536
// key / value pair sizes
#define MAX_KEY 32
#define MAX_VALUE 1024
//=============================================================================
#define BSPVERSION 29
#define TOOLVERSION 2
typedef struct
{
int fileofs, filelen;
} lump_t;
#define LUMP_ENTITIES 0
#define LUMP_PLANES 1
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_NODES 5
#define LUMP_TEXINFO 6
#define LUMP_FACES 7
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12
#define LUMP_SURFEDGES 13
#define LUMP_MODELS 14
#define HEADER_LUMPS 15
typedef struct
{
float mins[3], maxs[3];
float origin[3];
int headnode[MAX_MAP_HULLS];
int visleafs; // not including the solid leaf 0
int firstface, numfaces;
} dmodel_t;
typedef struct
{
int version;
lump_t lumps[HEADER_LUMPS];
} dheader_t;
typedef struct
{
int nummiptex;
int dataofs[4]; // [nummiptex]
} dmiptexlump_t;
#define MIPLEVELS 4
typedef struct miptex_s
{
char name[16];
unsigned width, height;
unsigned offsets[MIPLEVELS]; // four mip maps stored
} miptex_t;
typedef struct
{
float point[3];
} dvertex_t;
// 0-2 are axial planes
#define PLANE_X 0
#define PLANE_Y 1
#define PLANE_Z 2
// 3-5 are non-axial planes snapped to the nearest
#define PLANE_ANYX 3
#define PLANE_ANYY 4
#define PLANE_ANYZ 5
typedef struct
{
float normal[3];
float dist;
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
} dplane_t;
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
int planenum;
short children[2]; // negative numbers are -(leafs+1), not nodes
short mins[3]; // for sphere culling
short maxs[3];
unsigned short firstface;
unsigned short numfaces; // counting both sides
} dnode_t;
typedef struct
{
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;
typedef struct texinfo_s
{
float vecs[2][4]; // [s/t][xyz offset]
int miptex;
int flags;
} texinfo_t;
#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
#define TEX_MISSING 2 // johnfitz -- this texinfo does not have a texture
// note that edge 0 is never used, because negative edge nums are used for
// counterclockwise use of the edge in a face
typedef struct
{
unsigned short v[2]; // vertex numbers
} dedge_t;
#define MAXLIGHTMAPS 4
typedef struct
{
short planenum;
short side;
int firstedge; // we must support > 64k edges
short numedges;
short texinfo;
// lighting info
byte styles[MAXLIGHTMAPS];
int lightofs; // start of [numstyles*surfsize] samples
} dface_t;
#define AMBIENT_WATER 0
#define AMBIENT_SKY 1
#define AMBIENT_SLIME 2
#define AMBIENT_LAVA 3
#define NUM_AMBIENTS 4 // automatic ambient sounds
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
// all other leafs need visibility info
typedef struct
{
int contents;
int visofs; // -1 = no visibility info
short mins[3]; // for frustum culling
short maxs[3];
unsigned short firstmarksurface;
unsigned short nummarksurfaces;
byte ambient_level[NUM_AMBIENTS];
} dleaf_t;
//============================================================================
#ifndef QUAKE_GAME
#define ANGLE_UP -1
#define ANGLE_DOWN -2
// the utilities get to be lazy and just use large static arrays
extern int nummodels;
extern dmodel_t dmodels[MAX_MAP_MODELS];
extern int visdatasize;
extern byte dvisdata[MAX_MAP_VISIBILITY];
extern int lightdatasize;
extern byte dlightdata[MAX_MAP_LIGHTING];
extern int texdatasize;
extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
extern int entdatasize;
extern char dentdata[MAX_MAP_ENTSTRING];
extern int numleafs;
extern dleaf_t dleafs[MAX_MAP_LEAFS];
extern int numplanes;
extern dplane_t dplanes[MAX_MAP_PLANES];
extern int numvertexes;
extern dvertex_t dvertexes[MAX_MAP_VERTS];
extern int numnodes;
extern dnode_t dnodes[MAX_MAP_NODES];
extern int numtexinfo;
extern texinfo_t texinfo[MAX_MAP_TEXINFO];
extern int numfaces;
extern dface_t dfaces[MAX_MAP_FACES];
extern int numclipnodes;
extern dclipnode_t dclipnodes[MAX_MAP_CLIPNODES];
extern int numedges;
extern dedge_t dedges[MAX_MAP_EDGES];
extern int nummarksurfaces;
extern unsigned short dmarksurfaces[MAX_MAP_MARKSURFACES];
extern int numsurfedges;
extern int dsurfedges[MAX_MAP_SURFEDGES];
void DecompressVis (byte *in, byte *decompressed);
int CompressVis (byte *vis, byte *dest);
void LoadBSPFile (char *filename);
void WriteBSPFile (char *filename);
void PrintBSPFileSizes (void);
//===============
typedef struct epair_s
{
struct epair_s *next;
char *key;
char *value;
} epair_t;
typedef struct
{
vec3_t origin;
int firstbrush;
int numbrushes;
epair_t *epairs;
} entity_t;
extern int num_entities;
extern entity_t entities[MAX_MAP_ENTITIES];
void ParseEntities (void);
void UnparseEntities (void);
void SetKeyValue (entity_t *ent, char *key, char *value);
char *ValueForKey (entity_t *ent, char *key);
// will return "" if not present
vec_t FloatForKey (entity_t *ent, char *key);
void GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
epair_t *ParseEpair (void);
#endif

54
quakespasm/Quake/cd_sdl.c Normal file
View File

@ -0,0 +1,54 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2005 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
extern cvar_t bgmvolume;
int CDAudio_Init (void)
{
return -1;
}
void CDAudio_Play (byte track, qboolean looping)
{
}
void CDAudio_Stop (void)
{
}
void CDAudio_Pause (void)
{
}
void CDAudio_Resume (void)
{
}
void CDAudio_Shutdown (void)
{
}
void CDAudio_Update (void)
{
}

View File

@ -0,0 +1,28 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
int CDAudio_Init(void);
void CDAudio_Play(byte track, qboolean looping);
void CDAudio_Stop(void);
void CDAudio_Pause(void);
void CDAudio_Resume(void);
void CDAudio_Shutdown(void);
void CDAudio_Update(void);

118
quakespasm/Quake/chase.c Normal file
View File

@ -0,0 +1,118 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// chase.c -- chase camera code
#include "quakedef.h"
cvar_t chase_back = {"chase_back", "100"};
cvar_t chase_up = {"chase_up", "16"};
cvar_t chase_right = {"chase_right", "0"};
cvar_t chase_active = {"chase_active", "0"};
/*
==============
Chase_Init
==============
*/
void Chase_Init (void)
{
Cvar_RegisterVariable (&chase_back, NULL);
Cvar_RegisterVariable (&chase_up, NULL);
Cvar_RegisterVariable (&chase_right, NULL);
Cvar_RegisterVariable (&chase_active, NULL);
}
/*
==============
TraceLine
TODO: impact on bmodels, monsters
==============
*/
void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
{
trace_t trace;
memset (&trace, 0, sizeof(trace));
SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
VectorCopy (trace.endpos, impact);
}
/*
==============
Chase_UpdateForClient -- johnfitz -- orient client based on camera. called after input
==============
*/
void Chase_UpdateForClient (void)
{
//place camera
//assign client angles to camera
//see where camera points
//adjust client angles to point at the same place
}
/*
==============
Chase_UpdateForDrawing -- johnfitz -- orient camera based on client. called before drawing
TODO: stay at least 8 units away from all walls in this leaf
==============
*/
void Chase_UpdateForDrawing (void)
{
int i;
//float dist;
vec3_t forward, up, right;
vec3_t ideal, crosshair, temp;
AngleVectors (cl.viewangles, forward, right, up);
// calc ideal camera location before checking for walls
for (i=0 ; i<3 ; i++)
ideal[i] = cl.viewent.origin[i]
- forward[i]*chase_back.value
+ right[i]*chase_right.value;
//+ up[i]*chase_up.value;
ideal[2] = cl.viewent.origin[2] + chase_up.value;
// make sure camera is not in or behind a wall
TraceLine(r_refdef.vieworg, ideal, temp);
if (Length(temp) != 0)
VectorCopy(temp, ideal);
// place camera
VectorCopy (ideal, r_refdef.vieworg);
// find the spot the player is looking at
VectorMA (cl.viewent.origin, 4096, forward, temp);
TraceLine (cl.viewent.origin, temp, crosshair);
// calculate camera angles to look at the same spot
VectorSubtract (crosshair, r_refdef.vieworg, temp);
VectorAngles (temp, r_refdef.viewangles);
if (r_refdef.viewangles[PITCH] == 90 || r_refdef.viewangles[PITCH] == -90)
r_refdef.viewangles[YAW] = cl.viewangles[YAW];
}

368
quakespasm/Quake/cl_demo.c Normal file
View File

@ -0,0 +1,368 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
void CL_FinishTimeDemo (void);
/*
==============================================================================
DEMO CODE
When a demo is playing back, all NET_SendMessages are skipped, and
NET_GetMessages are read from the demo file.
Whenever cl.time gets past the last received message, another message is
read from the demo file.
==============================================================================
*/
/*
==============
CL_StopPlayback
Called when a demo file runs out, or the user starts a game
==============
*/
void CL_StopPlayback (void)
{
if (!cls.demoplayback)
return;
fclose (cls.demofile);
cls.demoplayback = false;
cls.demofile = NULL;
cls.state = ca_disconnected;
if (cls.timedemo)
CL_FinishTimeDemo ();
}
/*
====================
CL_WriteDemoMessage
Dumps the current net message, prefixed by the length and view angles
====================
*/
void CL_WriteDemoMessage (void)
{
int len;
int i;
float f;
len = LittleLong (net_message.cursize);
fwrite (&len, 4, 1, cls.demofile);
for (i=0 ; i<3 ; i++)
{
f = LittleFloat (cl.viewangles[i]);
fwrite (&f, 4, 1, cls.demofile);
}
fwrite (net_message.data, net_message.cursize, 1, cls.demofile);
fflush (cls.demofile);
}
/*
====================
CL_GetMessage
Handles recording and playback of demos, on top of NET_ code
====================
*/
int CL_GetMessage (void)
{
int r, i;
float f;
if (cls.demoplayback)
{
// decide if it is time to grab the next message
if (cls.signon == SIGNONS) // allways grab until fully connected
{
if (cls.timedemo)
{
if (host_framecount == cls.td_lastframe)
return 0; // allready read this frame's message
cls.td_lastframe = host_framecount;
// if this is the second frame, grab the real td_starttime
// so the bogus time on the first frame doesn't count
if (host_framecount == cls.td_startframe + 1)
cls.td_starttime = realtime;
}
else if ( /* cl.time > 0 && */ cl.time <= cl.mtime[0])
{
return 0; // don't need another message yet
}
}
// get the next message
fread (&net_message.cursize, 4, 1, cls.demofile);
VectorCopy (cl.mviewangles[0], cl.mviewangles[1]);
for (i=0 ; i<3 ; i++)
{
r = fread (&f, 4, 1, cls.demofile);
cl.mviewangles[0][i] = LittleFloat (f);
}
net_message.cursize = LittleLong (net_message.cursize);
if (net_message.cursize > MAX_MSGLEN)
Sys_Error ("Demo message > MAX_MSGLEN");
r = fread (net_message.data, net_message.cursize, 1, cls.demofile);
if (r != 1)
{
CL_StopPlayback ();
return 0;
}
return 1;
}
while (1)
{
r = NET_GetMessage (cls.netcon);
if (r != 1 && r != 2)
return r;
// discard nop keepalive message
if (net_message.cursize == 1 && net_message.data[0] == svc_nop)
Con_Printf ("<-- server to client keepalive\n");
else
break;
}
if (cls.demorecording)
CL_WriteDemoMessage ();
return r;
}
/*
====================
CL_Stop_f
stop recording a demo
====================
*/
void CL_Stop_f (void)
{
if (cmd_source != src_command)
return;
if (!cls.demorecording)
{
Con_Printf ("Not recording a demo.\n");
return;
}
// write a disconnect message to the demo file
SZ_Clear (&net_message);
MSG_WriteByte (&net_message, svc_disconnect);
CL_WriteDemoMessage ();
// finish up
fclose (cls.demofile);
cls.demofile = NULL;
cls.demorecording = false;
Con_Printf ("Completed demo\n");
}
/*
====================
CL_Record_f
record <demoname> <map> [cd track]
====================
*/
void CL_Record_f (void)
{
int c;
char name[MAX_OSPATH];
int track;
if (cmd_source != src_command)
return;
c = Cmd_Argc();
if (c != 2 && c != 3 && c != 4)
{
Con_Printf ("record <demoname> [<map> [cd track]]\n");
return;
}
if (strstr(Cmd_Argv(1), ".."))
{
Con_Printf ("Relative pathnames are not allowed.\n");
return;
}
if (c == 2 && cls.state == ca_connected)
{
Con_Printf("Can not record - already connected to server\nClient demo recording must be started before connecting\n");
return;
}
// write the forced cd track number, or -1
if (c == 4)
{
track = atoi(Cmd_Argv(3));
Con_Printf ("Forcing CD track to %i\n", cls.forcetrack);
}
else
track = -1;
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
//
// start the map up
//
if (c > 2)
Cmd_ExecuteString ( va("map %s", Cmd_Argv(2)), src_command);
//
// open the demo file
//
COM_DefaultExtension (name, ".dem");
Con_Printf ("recording to %s.\n", name);
cls.demofile = fopen (name, "wb");
if (!cls.demofile)
{
Con_Printf ("ERROR: couldn't open.\n");
return;
}
cls.forcetrack = track;
fprintf (cls.demofile, "%i\n", cls.forcetrack);
cls.demorecording = true;
}
/*
====================
CL_PlayDemo_f
play [demoname]
====================
*/
void CL_PlayDemo_f (void)
{
char name[256];
int c;
qboolean neg = false;
if (cmd_source != src_command)
return;
if (Cmd_Argc() != 2)
{
Con_Printf ("play <demoname> : plays a demo\n");
return;
}
//
// disconnect from server
//
CL_Disconnect ();
//
// open the demo file
//
strcpy (name, Cmd_Argv(1));
COM_DefaultExtension (name, ".dem");
Con_Printf ("Playing demo from %s.\n", name);
COM_FOpenFile (name, &cls.demofile);
if (!cls.demofile)
{
Con_Printf ("ERROR: couldn't open.\n");
cls.demonum = -1; // stop demo loop
return;
}
cls.demoplayback = true;
cls.state = ca_connected;
cls.forcetrack = 0;
while ((c = getc(cls.demofile)) != '\n')
if (c == '-')
neg = true;
else
cls.forcetrack = cls.forcetrack * 10 + (c - '0');
if (neg)
cls.forcetrack = -cls.forcetrack;
// ZOID, fscanf is evil
// fscanf (cls.demofile, "%i\n", &cls.forcetrack);
}
/*
====================
CL_FinishTimeDemo
====================
*/
void CL_FinishTimeDemo (void)
{
int frames;
float time;
cls.timedemo = false;
// the first frame didn't count
frames = (host_framecount - cls.td_startframe) - 1;
time = realtime - cls.td_starttime;
if (!time)
time = 1;
Con_Printf ("%i frames %5.1f seconds %5.1f fps\n", frames, time, frames/time);
}
/*
====================
CL_TimeDemo_f
timedemo [demoname]
====================
*/
void CL_TimeDemo_f (void)
{
if (cmd_source != src_command)
return;
if (Cmd_Argc() != 2)
{
Con_Printf ("timedemo <demoname> : gets demo speeds\n");
return;
}
CL_PlayDemo_f ();
// cls.td_starttime will be grabbed at the second frame of the demo, so
// all the loading time doesn't get counted
cls.timedemo = true;
cls.td_startframe = host_framecount;
cls.td_lastframe = -1; // get a new message this frame
}

448
quakespasm/Quake/cl_input.c Normal file
View File

@ -0,0 +1,448 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl.input.c -- builds an intended movement command to send to the server
// Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All
// rights reserved.
#include "quakedef.h"
extern cvar_t cl_maxpitch; //johnfitz -- variable pitch clamping
extern cvar_t cl_minpitch; //johnfitz -- variable pitch clamping
/*
===============================================================================
KEY BUTTONS
Continuous button event tracking is complicated by the fact that two different
input sources (say, mouse button 1 and the control key) can both press the
same button, but the button should only be released when both of the
pressing key have been released.
When a key event issues a button command (+forward, +attack, etc), it appends
its key number as a parameter to the command so it can be matched up with
the release.
state bit 0 is the current state of the key
state bit 1 is edge triggered on the up to down transition
state bit 2 is edge triggered on the down to up transition
===============================================================================
*/
kbutton_t in_mlook, in_klook;
kbutton_t in_left, in_right, in_forward, in_back;
kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
kbutton_t in_strafe, in_speed, in_use, in_jump, in_attack;
kbutton_t in_up, in_down;
int in_impulse;
void KeyDown (kbutton_t *b)
{
int k;
char *c;
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
else
k = -1; // typed manually at the console for continuous down
if (k == b->down[0] || k == b->down[1])
return; // repeating key
if (!b->down[0])
b->down[0] = k;
else if (!b->down[1])
b->down[1] = k;
else
{
Con_Printf ("Three keys down for a button!\n");
return;
}
if (b->state & 1)
return; // still down
b->state |= 1 + 2; // down + impulse down
}
void KeyUp (kbutton_t *b)
{
int k;
char *c;
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
else
{ // typed manually at the console, assume for unsticking, so clear all
b->down[0] = b->down[1] = 0;
b->state = 4; // impulse up
return;
}
if (b->down[0] == k)
b->down[0] = 0;
else if (b->down[1] == k)
b->down[1] = 0;
else
return; // key up without coresponding down (menu pass through)
if (b->down[0] || b->down[1])
return; // some other key is still holding it down
if (!(b->state & 1))
return; // still up (this should not happen)
b->state &= ~1; // now up
b->state |= 4; // impulse up
}
void IN_KLookDown (void) {KeyDown(&in_klook);}
void IN_KLookUp (void) {KeyUp(&in_klook);}
void IN_MLookDown (void) {KeyDown(&in_mlook);}
void IN_MLookUp (void) {
KeyUp(&in_mlook);
if ( !(in_mlook.state&1) && lookspring.value)
V_StartPitchDrift();
}
void IN_UpDown(void) {KeyDown(&in_up);}
void IN_UpUp(void) {KeyUp(&in_up);}
void IN_DownDown(void) {KeyDown(&in_down);}
void IN_DownUp(void) {KeyUp(&in_down);}
void IN_LeftDown(void) {KeyDown(&in_left);}
void IN_LeftUp(void) {KeyUp(&in_left);}
void IN_RightDown(void) {KeyDown(&in_right);}
void IN_RightUp(void) {KeyUp(&in_right);}
void IN_ForwardDown(void) {KeyDown(&in_forward);}
void IN_ForwardUp(void) {KeyUp(&in_forward);}
void IN_BackDown(void) {KeyDown(&in_back);}
void IN_BackUp(void) {KeyUp(&in_back);}
void IN_LookupDown(void) {KeyDown(&in_lookup);}
void IN_LookupUp(void) {KeyUp(&in_lookup);}
void IN_LookdownDown(void) {KeyDown(&in_lookdown);}
void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
void IN_MoveleftDown(void) {KeyDown(&in_moveleft);}
void IN_MoveleftUp(void) {KeyUp(&in_moveleft);}
void IN_MoverightDown(void) {KeyDown(&in_moveright);}
void IN_MoverightUp(void) {KeyUp(&in_moveright);}
void IN_SpeedDown(void) {KeyDown(&in_speed);}
void IN_SpeedUp(void) {KeyUp(&in_speed);}
void IN_StrafeDown(void) {KeyDown(&in_strafe);}
void IN_StrafeUp(void) {KeyUp(&in_strafe);}
void IN_AttackDown(void) {KeyDown(&in_attack);}
void IN_AttackUp(void) {KeyUp(&in_attack);}
void IN_UseDown (void) {KeyDown(&in_use);}
void IN_UseUp (void) {KeyUp(&in_use);}
void IN_JumpDown (void) {KeyDown(&in_jump);}
void IN_JumpUp (void) {KeyUp(&in_jump);}
void IN_Impulse (void) {in_impulse=Q_atoi(Cmd_Argv(1));}
/*
===============
CL_KeyState
Returns 0.25 if a key was pressed and released during the frame,
0.5 if it was pressed and held
0 if held then released, and
1.0 if held for the entire time
===============
*/
float CL_KeyState (kbutton_t *key)
{
float val;
qboolean impulsedown, impulseup, down;
impulsedown = key->state & 2;
impulseup = key->state & 4;
down = key->state & 1;
val = 0;
if (impulsedown && !impulseup)
if (down)
val = 0.5; // pressed and held this frame
else
val = 0; // I_Error ();
if (impulseup && !impulsedown)
if (down)
val = 0; // I_Error ();
else
val = 0; // released this frame
if (!impulsedown && !impulseup)
if (down)
val = 1.0; // held the entire frame
else
val = 0; // up the entire frame
if (impulsedown && impulseup)
if (down)
val = 0.75; // released and re-pressed this frame
else
val = 0.25; // pressed and released this frame
key->state &= 1; // clear impulses
return val;
}
//==========================================================================
cvar_t cl_upspeed = {"cl_upspeed","200"};
cvar_t cl_forwardspeed = {"cl_forwardspeed","200", true};
cvar_t cl_backspeed = {"cl_backspeed","200", true};
cvar_t cl_sidespeed = {"cl_sidespeed","350"};
cvar_t cl_movespeedkey = {"cl_movespeedkey","2.0"};
cvar_t cl_yawspeed = {"cl_yawspeed","140"};
cvar_t cl_pitchspeed = {"cl_pitchspeed","150"};
cvar_t cl_anglespeedkey = {"cl_anglespeedkey","1.5"};
/*
================
CL_AdjustAngles
Moves the local angle positions
================
*/
void CL_AdjustAngles (void)
{
float speed;
float up, down;
if (in_speed.state & 1)
speed = host_frametime * cl_anglespeedkey.value;
else
speed = host_frametime;
if (!(in_strafe.state & 1))
{
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right);
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left);
cl.viewangles[YAW] = anglemod(cl.viewangles[YAW]);
}
if (in_klook.state & 1)
{
V_StopPitchDrift ();
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * CL_KeyState (&in_forward);
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
}
up = CL_KeyState (&in_lookup);
down = CL_KeyState(&in_lookdown);
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
if (up || down)
V_StopPitchDrift ();
//johnfitz -- variable pitch clamping
if (cl.viewangles[PITCH] > cl_maxpitch.value)
cl.viewangles[PITCH] = cl_maxpitch.value;
if (cl.viewangles[PITCH] < cl_minpitch.value)
cl.viewangles[PITCH] = cl_minpitch.value;
//johnfitz
if (cl.viewangles[ROLL] > 50)
cl.viewangles[ROLL] = 50;
if (cl.viewangles[ROLL] < -50)
cl.viewangles[ROLL] = -50;
}
/*
================
CL_BaseMove
Send the intended movement message to the server
================
*/
void CL_BaseMove (usercmd_t *cmd)
{
if (cls.signon != SIGNONS)
return;
CL_AdjustAngles ();
Q_memset (cmd, 0, sizeof(*cmd));
if (in_strafe.state & 1)
{
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right);
cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_left);
}
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_moveright);
cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_moveleft);
cmd->upmove += cl_upspeed.value * CL_KeyState (&in_up);
cmd->upmove -= cl_upspeed.value * CL_KeyState (&in_down);
if (! (in_klook.state & 1) )
{
cmd->forwardmove += cl_forwardspeed.value * CL_KeyState (&in_forward);
cmd->forwardmove -= cl_backspeed.value * CL_KeyState (&in_back);
}
//
// adjust for speed key
//
if (in_speed.state & 1)
{
cmd->forwardmove *= cl_movespeedkey.value;
cmd->sidemove *= cl_movespeedkey.value;
cmd->upmove *= cl_movespeedkey.value;
}
}
/*
==============
CL_SendMove
==============
*/
void CL_SendMove (usercmd_t *cmd)
{
int i;
int bits;
sizebuf_t buf;
byte data[128];
buf.maxsize = 128;
buf.cursize = 0;
buf.data = data;
cl.cmd = *cmd;
//
// send the movement message
//
MSG_WriteByte (&buf, clc_move);
MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times
for (i=0 ; i<3 ; i++)
//johnfitz -- 16-bit angles for PROTOCOL_FITZQUAKE
if (cl.protocol == PROTOCOL_NETQUAKE)
MSG_WriteAngle (&buf, cl.viewangles[i]);
else
MSG_WriteAngle16 (&buf, cl.viewangles[i]);
//johnfitz
MSG_WriteShort (&buf, cmd->forwardmove);
MSG_WriteShort (&buf, cmd->sidemove);
MSG_WriteShort (&buf, cmd->upmove);
//
// send button bits
//
bits = 0;
if ( in_attack.state & 3 )
bits |= 1;
in_attack.state &= ~2;
if (in_jump.state & 3)
bits |= 2;
in_jump.state &= ~2;
MSG_WriteByte (&buf, bits);
MSG_WriteByte (&buf, in_impulse);
in_impulse = 0;
//
// deliver the message
//
if (cls.demoplayback)
return;
//
// allways dump the first two message, because it may contain leftover inputs
// from the last level
//
if (++cl.movemessages <= 2)
return;
if (NET_SendUnreliableMessage (cls.netcon, &buf) == -1)
{
Con_Printf ("CL_SendMove: lost server connection\n");
CL_Disconnect ();
}
}
/*
============
CL_InitInput
============
*/
void CL_InitInput (void)
{
Cmd_AddCommand ("+moveup",IN_UpDown);
Cmd_AddCommand ("-moveup",IN_UpUp);
Cmd_AddCommand ("+movedown",IN_DownDown);
Cmd_AddCommand ("-movedown",IN_DownUp);
Cmd_AddCommand ("+left",IN_LeftDown);
Cmd_AddCommand ("-left",IN_LeftUp);
Cmd_AddCommand ("+right",IN_RightDown);
Cmd_AddCommand ("-right",IN_RightUp);
Cmd_AddCommand ("+forward",IN_ForwardDown);
Cmd_AddCommand ("-forward",IN_ForwardUp);
Cmd_AddCommand ("+back",IN_BackDown);
Cmd_AddCommand ("-back",IN_BackUp);
Cmd_AddCommand ("+lookup", IN_LookupDown);
Cmd_AddCommand ("-lookup", IN_LookupUp);
Cmd_AddCommand ("+lookdown", IN_LookdownDown);
Cmd_AddCommand ("-lookdown", IN_LookdownUp);
Cmd_AddCommand ("+strafe", IN_StrafeDown);
Cmd_AddCommand ("-strafe", IN_StrafeUp);
Cmd_AddCommand ("+moveleft", IN_MoveleftDown);
Cmd_AddCommand ("-moveleft", IN_MoveleftUp);
Cmd_AddCommand ("+moveright", IN_MoverightDown);
Cmd_AddCommand ("-moveright", IN_MoverightUp);
Cmd_AddCommand ("+speed", IN_SpeedDown);
Cmd_AddCommand ("-speed", IN_SpeedUp);
Cmd_AddCommand ("+attack", IN_AttackDown);
Cmd_AddCommand ("-attack", IN_AttackUp);
Cmd_AddCommand ("+use", IN_UseDown);
Cmd_AddCommand ("-use", IN_UseUp);
Cmd_AddCommand ("+jump", IN_JumpDown);
Cmd_AddCommand ("-jump", IN_JumpUp);
Cmd_AddCommand ("impulse", IN_Impulse);
Cmd_AddCommand ("+klook", IN_KLookDown);
Cmd_AddCommand ("-klook", IN_KLookUp);
Cmd_AddCommand ("+mlook", IN_MLookDown);
Cmd_AddCommand ("-mlook", IN_MLookUp);
}

807
quakespasm/Quake/cl_main.c Normal file
View File

@ -0,0 +1,807 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_main.c -- client main loop
#include "quakedef.h"
// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
// these two are not intended to be set directly
cvar_t cl_name = {"_cl_name", "player", true};
cvar_t cl_color = {"_cl_color", "0", true};
cvar_t cl_shownet = {"cl_shownet","0"}; // can be 0, 1, or 2
cvar_t cl_nolerp = {"cl_nolerp","0"};
cvar_t lookspring = {"lookspring","0", true};
cvar_t lookstrafe = {"lookstrafe","0", true};
cvar_t sensitivity = {"sensitivity","3", true};
cvar_t m_pitch = {"m_pitch","0.022", true};
cvar_t m_yaw = {"m_yaw","0.022", true};
cvar_t m_forward = {"m_forward","1", true};
cvar_t m_side = {"m_side","0.8", true};
cvar_t cl_maxpitch = {"cl_maxpitch", "90", true}; //johnfitz -- variable pitch clamping
cvar_t cl_minpitch = {"cl_minpitch", "-90", true}; //johnfitz -- variable pitch clamping
client_static_t cls;
client_state_t cl;
// FIXME: put these on hunk?
efrag_t cl_efrags[MAX_EFRAGS];
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS];
entity_t *cl_entities; //johnfitz -- was a static array, now on hunk
int cl_max_edicts; //johnfitz -- only changes when new map loads
int cl_numvisedicts;
entity_t *cl_visedicts[MAX_VISEDICTS];
extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz
/*
=====================
CL_ClearState
=====================
*/
void CL_ClearState (void)
{
int i;
if (!sv.active)
Host_ClearMemory ();
// wipe the entire cl structure
memset (&cl, 0, sizeof(cl));
SZ_Clear (&cls.message);
// clear other arrays
memset (cl_efrags, 0, sizeof(cl_efrags));
memset (cl_dlights, 0, sizeof(cl_dlights));
memset (cl_lightstyle, 0, sizeof(cl_lightstyle));
memset (cl_temp_entities, 0, sizeof(cl_temp_entities));
memset (cl_beams, 0, sizeof(cl_beams));
//johnfitz -- cl_entities is now dynamically allocated
cl_max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS);
cl_entities = Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities");
//johnfitz
//
// allocate the efrags and chain together into a free list
//
cl.free_efrags = cl_efrags;
for (i=0 ; i<MAX_EFRAGS-1 ; i++)
cl.free_efrags[i].entnext = &cl.free_efrags[i+1];
cl.free_efrags[i].entnext = NULL;
}
/*
=====================
CL_Disconnect
Sends a disconnect message to the server
This is also called on Host_Error, so it shouldn't cause any errors
=====================
*/
void CL_Disconnect (void)
{
// stop sounds (especially looping!)
S_StopAllSounds (true);
// if running a local server, shut it down
if (cls.demoplayback)
CL_StopPlayback ();
else if (cls.state == ca_connected)
{
if (cls.demorecording)
CL_Stop_f ();
Con_DPrintf ("Sending clc_disconnect\n");
SZ_Clear (&cls.message);
MSG_WriteByte (&cls.message, clc_disconnect);
NET_SendUnreliableMessage (cls.netcon, &cls.message);
SZ_Clear (&cls.message);
NET_Close (cls.netcon);
cls.state = ca_disconnected;
if (sv.active)
Host_ShutdownServer(false);
}
cls.demoplayback = cls.timedemo = false;
cls.signon = 0;
}
void CL_Disconnect_f (void)
{
CL_Disconnect ();
if (sv.active)
Host_ShutdownServer (false);
}
/*
=====================
CL_EstablishConnection
Host should be either "local" or a net address to be passed on
=====================
*/
void CL_EstablishConnection (char *host)
{
if (cls.state == ca_dedicated)
return;
if (cls.demoplayback)
return;
CL_Disconnect ();
cls.netcon = NET_Connect (host);
if (!cls.netcon)
Host_Error ("CL_Connect: connect failed\n");
Con_DPrintf ("CL_EstablishConnection: connected to %s\n", host);
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
cls.signon = 0; // need all the signon messages before playing
}
/*
=====================
CL_SignonReply
An svc_signonnum has been received, perform a client side setup
=====================
*/
void CL_SignonReply (void)
{
char str[8192];
Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
switch (cls.signon)
{
case 1:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "prespawn");
break;
case 2:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("color %i %i\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
MSG_WriteByte (&cls.message, clc_stringcmd);
sprintf (str, "spawn %s", cls.spawnparms);
MSG_WriteString (&cls.message, str);
break;
case 3:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "begin");
Cache_Report (); // print remaining memory
break;
case 4:
SCR_EndLoadingPlaque (); // allow normal screen updates
break;
}
}
/*
=====================
CL_NextDemo
Called to play the next demo in the demo loop
=====================
*/
void CL_NextDemo (void)
{
char str[1024];
if (cls.demonum == -1)
return; // don't play demos
SCR_BeginLoadingPlaque ();
if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS)
{
cls.demonum = 0;
if (!cls.demos[cls.demonum][0])
{
Con_Printf ("No demos listed with startdemos\n");
cls.demonum = -1;
return;
}
}
sprintf (str,"playdemo %s\n", cls.demos[cls.demonum]);
Cbuf_InsertText (str);
cls.demonum++;
}
/*
==============
CL_PrintEntities_f
==============
*/
void CL_PrintEntities_f (void)
{
entity_t *ent;
int i;
for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++)
{
Con_Printf ("%3i:",i);
if (!ent->model)
{
Con_Printf ("EMPTY\n");
continue;
}
Con_Printf ("%s:%2i (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n"
,ent->model->name,ent->frame, ent->origin[0], ent->origin[1], ent->origin[2], ent->angles[0], ent->angles[1], ent->angles[2]);
}
}
//johnfitz -- deleted SetPal()
/*
===============
CL_AllocDlight
===============
*/
dlight_t *CL_AllocDlight (int key)
{
int i;
dlight_t *dl;
// first look for an exact key match
if (key)
{
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->key == key)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
dl->color[0] = dl->color[1] = dl->color[2] = 1; //johnfitz -- lit support via lordhavoc
return dl;
}
}
}
// then look for anything else
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->die < cl.time)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
dl->color[0] = dl->color[1] = dl->color[2] = 1; //johnfitz -- lit support via lordhavoc
return dl;
}
}
dl = &cl_dlights[0];
memset (dl, 0, sizeof(*dl));
dl->key = key;
dl->color[0] = dl->color[1] = dl->color[2] = 1; //johnfitz -- lit support via lordhavoc
return dl;
}
/*
===============
CL_DecayLights
===============
*/
void CL_DecayLights (void)
{
int i;
dlight_t *dl;
float time;
time = cl.time - cl.oldtime;
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->die < cl.time || !dl->radius)
continue;
dl->radius -= time*dl->decay;
if (dl->radius < 0)
dl->radius = 0;
}
}
/*
===============
CL_LerpPoint
Determines the fraction between the last two messages that the objects
should be put at.
===============
*/
float CL_LerpPoint (void)
{
float f, frac;
f = cl.mtime[0] - cl.mtime[1];
if (!f || cls.timedemo || sv.active)
{
cl.time = cl.mtime[0];
return 1;
}
if (f > 0.1) // dropped packet, or start of demo
{
cl.mtime[1] = cl.mtime[0] - 0.1;
f = 0.1;
}
frac = (cl.time - cl.mtime[1]) / f;
if (frac < 0)
{
if (frac < -0.01)
cl.time = cl.mtime[1];
frac = 0;
}
else if (frac > 1)
{
if (frac > 1.01)
cl.time = cl.mtime[0];
frac = 1;
}
//johnfitz -- better nolerp behavior
if (cl_nolerp.value)
return 1;
//johnfitz
return frac;
}
/*
===============
CL_RelinkEntities
===============
*/
void CL_RelinkEntities (void)
{
entity_t *ent;
int i, j;
float frac, f, d;
vec3_t delta;
float bobjrotate;
vec3_t oldorg;
dlight_t *dl;
// determine partial update time
frac = CL_LerpPoint ();
cl_numvisedicts = 0;
//
// interpolate player info
//
for (i=0 ; i<3 ; i++)
cl.velocity[i] = cl.mvelocity[1][i] +
frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
if (cls.demoplayback)
{
// interpolate the angles
for (j=0 ; j<3 ; j++)
{
d = cl.mviewangles[0][j] - cl.mviewangles[1][j];
if (d > 180)
d -= 360;
else if (d < -180)
d += 360;
cl.viewangles[j] = cl.mviewangles[1][j] + frac*d;
}
}
bobjrotate = anglemod(100*cl.time);
// start on the entity after the world
for (i=1,ent=cl_entities+1 ; i<cl.num_entities ; i++,ent++)
{
if (!ent->model)
{ // empty slot
if (ent->forcelink)
R_RemoveEfrags (ent); // just became empty
continue;
}
// if the object wasn't included in the last packet, remove it
if (ent->msgtime != cl.mtime[0])
{
ent->model = NULL;
ent->lerpflags |= LERP_RESETMOVE|LERP_RESETANIM; //johnfitz -- next time this entity slot is reused, the lerp will need to be reset
continue;
}
VectorCopy (ent->origin, oldorg);
if (ent->forcelink)
{ // the entity was not updated in the last message
// so move to the final spot
VectorCopy (ent->msg_origins[0], ent->origin);
VectorCopy (ent->msg_angles[0], ent->angles);
}
else
{ // if the delta is large, assume a teleport and don't lerp
f = frac;
for (j=0 ; j<3 ; j++)
{
delta[j] = ent->msg_origins[0][j] - ent->msg_origins[1][j];
if (delta[j] > 100 || delta[j] < -100)
{
f = 1; // assume a teleportation, not a motion
ent->lerpflags |= LERP_RESETMOVE; //johnfitz -- don't lerp teleports
}
}
//johnfitz -- don't cl_lerp entities that will be r_lerped
if (r_lerpmove.value && (ent->lerpflags & LERP_MOVESTEP))
f = 1;
//johnfitz
// interpolate the origin and angles
for (j=0 ; j<3 ; j++)
{
ent->origin[j] = ent->msg_origins[1][j] + f*delta[j];
d = ent->msg_angles[0][j] - ent->msg_angles[1][j];
if (d > 180)
d -= 360;
else if (d < -180)
d += 360;
ent->angles[j] = ent->msg_angles[1][j] + f*d;
}
}
// rotate binary objects locally
if (ent->model->flags & EF_ROTATE)
ent->angles[1] = bobjrotate;
if (ent->effects & EF_BRIGHTFIELD)
R_EntityParticles (ent);
if (ent->effects & EF_MUZZLEFLASH)
{
vec3_t fv, rv, uv;
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->origin[2] += 16;
AngleVectors (ent->angles, fv, rv, uv);
VectorMA (dl->origin, 18, fv, dl->origin);
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
dl->die = cl.time + 0.1;
//johnfitz -- assume muzzle flash accompanied by muzzle flare, which looks bad when lerped
if (r_lerpmodels.value != 2)
{
if (ent == &cl_entities[cl.viewentity])
cl.viewent.lerpflags |= LERP_RESETANIM|LERP_RESETANIM2; //no lerping for two frames
else
ent->lerpflags |= LERP_RESETANIM|LERP_RESETANIM2; //no lerping for two frames
}
//johnfitz
}
if (ent->effects & EF_BRIGHTLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->origin[2] += 16;
dl->radius = 400 + (rand()&31);
dl->die = cl.time + 0.001;
}
if (ent->effects & EF_DIMLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200 + (rand()&31);
dl->die = cl.time + 0.001;
}
if (ent->model->flags & EF_GIB)
R_RocketTrail (oldorg, ent->origin, 2);
else if (ent->model->flags & EF_ZOMGIB)
R_RocketTrail (oldorg, ent->origin, 4);
else if (ent->model->flags & EF_TRACER)
R_RocketTrail (oldorg, ent->origin, 3);
else if (ent->model->flags & EF_TRACER2)
R_RocketTrail (oldorg, ent->origin, 5);
else if (ent->model->flags & EF_ROCKET)
{
R_RocketTrail (oldorg, ent->origin, 0);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200;
dl->die = cl.time + 0.01;
}
else if (ent->model->flags & EF_GRENADE)
R_RocketTrail (oldorg, ent->origin, 1);
else if (ent->model->flags & EF_TRACER3)
R_RocketTrail (oldorg, ent->origin, 6);
ent->forcelink = false;
if (i == cl.viewentity && !chase_active.value)
continue;
if (cl_numvisedicts < MAX_VISEDICTS)
{
cl_visedicts[cl_numvisedicts] = ent;
cl_numvisedicts++;
}
}
}
/*
===============
CL_ReadFromServer
Read all incoming data from the server
===============
*/
int CL_ReadFromServer (void)
{
int ret;
extern int num_temp_entities; //johnfitz
int num_beams = 0; //johnfitz
int num_dlights = 0; //johnfitz
beam_t *b; //johnfitz
dlight_t *l; //johnfitz
int i; //johnfitz
cl.oldtime = cl.time;
cl.time += host_frametime;
do
{
ret = CL_GetMessage ();
if (ret == -1)
Host_Error ("CL_ReadFromServer: lost server connection");
if (!ret)
break;
cl.last_received_message = realtime;
CL_ParseServerMessage ();
} while (ret && cls.state == ca_connected);
if (cl_shownet.value)
Con_Printf ("\n");
CL_RelinkEntities ();
CL_UpdateTEnts ();
//johnfitz -- devstats
//visedicts
if (cl_numvisedicts > 256 && dev_peakstats.visedicts <= 256)
Con_Warning ("%i visedicts exceeds standard limit of 256.\n", cl_numvisedicts);
dev_stats.visedicts = cl_numvisedicts;
dev_peakstats.visedicts = max(cl_numvisedicts, dev_peakstats.visedicts);
//temp entities
if (num_temp_entities > 64 && dev_peakstats.tempents <= 64)
Con_Warning ("%i tempentities exceeds standard limit of 64.\n", num_temp_entities);
dev_stats.tempents = num_temp_entities;
dev_peakstats.tempents = max(num_temp_entities, dev_peakstats.tempents);
//beams
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->model && b->endtime >= cl.time)
num_beams++;
if (num_beams > 24 && dev_peakstats.beams <= 24)
Con_Warning ("%i beams exceeded standard limit of 24.\n", num_beams);
dev_stats.beams = num_beams;
dev_peakstats.beams = max(num_beams, dev_peakstats.beams);
//dlights
for (i=0, l=cl_dlights ; i<MAX_DLIGHTS ; i++, l++)
if (l->die >= cl.time && l->radius)
num_dlights++;
if (num_dlights > 32 && dev_peakstats.dlights <= 32)
Con_Warning ("%i dlights exceeded standard limit of 32.\n", num_dlights);
dev_stats.dlights = num_dlights;
dev_peakstats.dlights = max(num_dlights, dev_peakstats.dlights);
//johnfitz
//
// bring the links up to date
//
return 0;
}
/*
=================
CL_SendCmd
=================
*/
void CL_SendCmd (void)
{
usercmd_t cmd;
if (cls.state != ca_connected)
return;
if (cls.signon == SIGNONS)
{
// get basic movement from keyboard
CL_BaseMove (&cmd);
// allow mice or other external controllers to add to the move
IN_Move (&cmd);
// send the unreliable message
CL_SendMove (&cmd);
}
if (cls.demoplayback)
{
SZ_Clear (&cls.message);
return;
}
// send the reliable message
if (!cls.message.cursize)
return; // no message at all
if (!NET_CanSendMessage (cls.netcon))
{
Con_DPrintf ("CL_WriteToServer: can't send\n");
return;
}
if (NET_SendMessage (cls.netcon, &cls.message) == -1)
Host_Error ("CL_WriteToServer: lost server connection");
SZ_Clear (&cls.message);
}
/*
=============
CL_Tracepos_f -- johnfitz
display impact point of trace along VPN
=============
*/
void CL_Tracepos_f (void)
{
vec3_t v, w;
VectorScale(vpn, 8192.0, v);
TraceLine(r_refdef.vieworg, v, w);
if (Length(w) == 0)
Con_Printf ("Tracepos: trace didn't hit anything\n");
else
Con_Printf ("Tracepos: (%i %i %i)\n", (int)w[0], (int)w[1], (int)w[2]);
}
/*
=============
CL_Viewpos_f -- johnfitz
display client's position and angles
=============
*/
void CL_Viewpos_f (void)
{
#if 0
//camera position
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",
(int)r_refdef.vieworg[0],
(int)r_refdef.vieworg[1],
(int)r_refdef.vieworg[2],
(int)r_refdef.viewangles[PITCH],
(int)r_refdef.viewangles[YAW],
(int)r_refdef.viewangles[ROLL]);
#else
//player position
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",
(int)cl_entities[cl.viewentity].origin[0],
(int)cl_entities[cl.viewentity].origin[1],
(int)cl_entities[cl.viewentity].origin[2],
(int)cl.viewangles[PITCH],
(int)cl.viewangles[YAW],
(int)cl.viewangles[ROLL]);
#endif
}
/*
=================
CL_Init
=================
*/
void CL_Init (void)
{
SZ_Alloc (&cls.message, 1024);
CL_InitInput ();
CL_InitTEnts ();
Cvar_RegisterVariable (&cl_name, NULL);
Cvar_RegisterVariable (&cl_color, NULL);
Cvar_RegisterVariable (&cl_upspeed, NULL);
Cvar_RegisterVariable (&cl_forwardspeed, NULL);
Cvar_RegisterVariable (&cl_backspeed, NULL);
Cvar_RegisterVariable (&cl_sidespeed, NULL);
Cvar_RegisterVariable (&cl_movespeedkey, NULL);
Cvar_RegisterVariable (&cl_yawspeed, NULL);
Cvar_RegisterVariable (&cl_pitchspeed, NULL);
Cvar_RegisterVariable (&cl_anglespeedkey, NULL);
Cvar_RegisterVariable (&cl_shownet, NULL);
Cvar_RegisterVariable (&cl_nolerp, NULL);
Cvar_RegisterVariable (&lookspring, NULL);
Cvar_RegisterVariable (&lookstrafe, NULL);
Cvar_RegisterVariable (&sensitivity, NULL);
Cvar_RegisterVariable (&m_pitch, NULL);
Cvar_RegisterVariable (&m_yaw, NULL);
Cvar_RegisterVariable (&m_forward, NULL);
Cvar_RegisterVariable (&m_side, NULL);
Cvar_RegisterVariable (&cl_maxpitch, NULL); //johnfitz -- variable pitch clamping
Cvar_RegisterVariable (&cl_minpitch, NULL); //johnfitz -- variable pitch clamping
Cmd_AddCommand ("entities", CL_PrintEntities_f);
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
Cmd_AddCommand ("record", CL_Record_f);
Cmd_AddCommand ("stop", CL_Stop_f);
Cmd_AddCommand ("playdemo", CL_PlayDemo_f);
Cmd_AddCommand ("timedemo", CL_TimeDemo_f);
Cmd_AddCommand ("tracepos", CL_Tracepos_f); //johnfitz
Cmd_AddCommand ("viewpos", CL_Viewpos_f); //johnfitz
}

1218
quakespasm/Quake/cl_parse.c Normal file

File diff suppressed because it is too large Load Diff

364
quakespasm/Quake/cl_tent.c Normal file
View File

@ -0,0 +1,364 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_tent.c -- client side temporary entities
#include "quakedef.h"
int num_temp_entities;
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
beam_t cl_beams[MAX_BEAMS];
sfx_t *cl_sfx_wizhit;
sfx_t *cl_sfx_knighthit;
sfx_t *cl_sfx_tink1;
sfx_t *cl_sfx_ric1;
sfx_t *cl_sfx_ric2;
sfx_t *cl_sfx_ric3;
sfx_t *cl_sfx_r_exp3;
/*
=================
CL_ParseTEnt
=================
*/
void CL_InitTEnts (void)
{
cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav");
cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav");
cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav");
cl_sfx_ric1 = S_PrecacheSound ("weapons/ric1.wav");
cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav");
cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav");
cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav");
}
/*
=================
CL_ParseBeam
=================
*/
void CL_ParseBeam (model_t *m)
{
int ent;
vec3_t start, end;
beam_t *b;
int i;
ent = MSG_ReadShort ();
start[0] = MSG_ReadCoord ();
start[1] = MSG_ReadCoord ();
start[2] = MSG_ReadCoord ();
end[0] = MSG_ReadCoord ();
end[1] = MSG_ReadCoord ();
end[2] = MSG_ReadCoord ();
// override any beam with the same entity
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == ent)
{
b->entity = ent;
b->model = m;
b->endtime = cl.time + 0.2;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
return;
}
// find a free beam
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
{
if (!b->model || b->endtime < cl.time)
{
b->entity = ent;
b->model = m;
b->endtime = cl.time + 0.2;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
return;
}
}
//johnfitz -- less spammy overflow message
if (!dev_overflows.beams || dev_overflows.beams + CONSOLE_RESPAM_TIME < realtime )
{
Con_Printf ("Beam list overflow!\n");
dev_overflows.beams = realtime;
}
//johnfitz
}
/*
=================
CL_ParseTEnt
=================
*/
void CL_ParseTEnt (void)
{
int type;
vec3_t pos;
dlight_t *dl;
int rnd;
int colorStart, colorLength;
type = MSG_ReadByte ();
switch (type)
{
case TE_WIZSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_RunParticleEffect (pos, vec3_origin, 20, 30);
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
case TE_KNIGHTSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_RunParticleEffect (pos, vec3_origin, 226, 20);
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
case TE_SPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLTEST
Test_Spawn (pos);
#else
R_RunParticleEffect (pos, vec3_origin, 0, 10);
#endif
if ( rand() % 5 )
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
else
{
rnd = rand() & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2)
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
}
break;
case TE_SUPERSPIKE: // super spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_RunParticleEffect (pos, vec3_origin, 0, 20);
if ( rand() % 5 )
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
else
{
rnd = rand() & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2)
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
}
break;
case TE_GUNSHOT: // bullet hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_RunParticleEffect (pos, vec3_origin, 0, 20);
break;
case TE_EXPLOSION: // rocket explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_ParticleExplosion (pos);
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
case TE_TAREXPLOSION: // tarbaby explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_BlobExplosion (pos);
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
case TE_LIGHTNING1: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt.mdl", true));
break;
case TE_LIGHTNING2: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt2.mdl", true));
break;
case TE_LIGHTNING3: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt3.mdl", true));
break;
// PGM 01/21/97
case TE_BEAM: // grappling hook beam
CL_ParseBeam (Mod_ForName("progs/beam.mdl", true));
break;
// PGM 01/21/97
case TE_LAVASPLASH:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_LavaSplash (pos);
break;
case TE_TELEPORT:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_TeleportSplash (pos);
break;
case TE_EXPLOSION2: // color mapped explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
colorStart = MSG_ReadByte ();
colorLength = MSG_ReadByte ();
R_ParticleExplosion2 (pos, colorStart, colorLength);
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
default:
Sys_Error ("CL_ParseTEnt: bad type");
}
}
/*
=================
CL_NewTempEntity
=================
*/
entity_t *CL_NewTempEntity (void)
{
entity_t *ent;
if (cl_numvisedicts == MAX_VISEDICTS)
return NULL;
if (num_temp_entities == MAX_TEMP_ENTITIES)
return NULL;
ent = &cl_temp_entities[num_temp_entities];
memset (ent, 0, sizeof(*ent));
num_temp_entities++;
cl_visedicts[cl_numvisedicts] = ent;
cl_numvisedicts++;
ent->colormap = vid.colormap;
return ent;
}
/*
=================
CL_UpdateTEnts
=================
*/
void CL_UpdateTEnts (void)
{
int i, j; //johnfitz -- use j instead of using i twice, so we don't corrupt memory
beam_t *b;
vec3_t dist, org;
float d;
entity_t *ent;
float yaw, pitch;
float forward;
num_temp_entities = 0;
srand ((int) (cl.time * 1000)); //johnfitz -- freeze beams when paused
// update lightning
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
{
if (!b->model || b->endtime < cl.time)
continue;
// if coming from the player, update the start position
if (b->entity == cl.viewentity)
{
VectorCopy (cl_entities[cl.viewentity].origin, b->start);
}
// calculate pitch and yaw
VectorSubtract (b->end, b->start, dist);
if (dist[1] == 0 && dist[0] == 0)
{
yaw = 0;
if (dist[2] > 0)
pitch = 90;
else
pitch = 270;
}
else
{
yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI);
if (yaw < 0)
yaw += 360;
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]);
pitch = (int) (atan2(dist[2], forward) * 180 / M_PI);
if (pitch < 0)
pitch += 360;
}
// add new entities for the lightning
VectorCopy (b->start, org);
d = VectorNormalize(dist);
while (d > 0)
{
ent = CL_NewTempEntity ();
if (!ent)
return;
VectorCopy (org, ent->origin);
ent->model = b->model;
ent->angles[0] = pitch;
ent->angles[1] = yaw;
ent->angles[2] = rand()%360;
//johnfitz -- use j instead of using i twice, so we don't corrupt memory
for (j=0 ; j<3 ; j++)
org[j] += dist[j]*30;
d -= 30;
}
}
}

369
quakespasm/Quake/client.h Normal file
View File

@ -0,0 +1,369 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// client.h
typedef struct
{
vec3_t viewangles;
// intended velocities
float forwardmove;
float sidemove;
float upmove;
} usercmd_t;
typedef struct
{
int length;
char map[MAX_STYLESTRING];
char average; //johnfitz
char peak; //johnfitz
} lightstyle_t;
typedef struct
{
char name[MAX_SCOREBOARDNAME];
float entertime;
int frags;
int colors; // two 4 bit fields
byte translations[VID_GRADES*256];
} scoreboard_t;
typedef struct
{
int destcolor[3];
int percent; // 0-256
} cshift_t;
#define CSHIFT_CONTENTS 0
#define CSHIFT_DAMAGE 1
#define CSHIFT_BONUS 2
#define CSHIFT_POWERUP 3
#define NUM_CSHIFTS 4
#define NAME_LENGTH 64
//
// client_state_t should hold all pieces of the client state
//
#define SIGNONS 4 // signon messages to receive before connected
#define MAX_DLIGHTS 64 //johnfitz -- was 32
typedef struct
{
vec3_t origin;
float radius;
float die; // stop lighting after this time
float decay; // drop this each second
float minlight; // don't add when contributing less
int key;
vec3_t color; //johnfitz -- lit support via lordhavoc
} dlight_t;
#define MAX_BEAMS 32 //johnfitz -- was 24
typedef struct
{
int entity;
struct model_s *model;
float endtime;
vec3_t start, end;
} beam_t;
#define MAX_EFRAGS 2048 //johnfitz -- was 640
#define MAX_MAPSTRING 2048
#define MAX_DEMOS 8
#define MAX_DEMONAME 16
typedef enum {
ca_dedicated, // a dedicated server with no ability to start a client
ca_disconnected, // full screen console with no connection
ca_connected // valid netcon, talking to a server
} cactive_t;
//
// the client_static_t structure is persistant through an arbitrary number
// of server connections
//
typedef struct
{
cactive_t state;
// personalization data sent to server
char mapstring[MAX_QPATH];
char spawnparms[MAX_MAPSTRING]; // to restart a level
// demo loop control
int demonum; // -1 = don't play demos
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
// demo recording info must be here, because record is started before
// entering a map (and clearing client_state_t)
qboolean demorecording;
qboolean demoplayback;
qboolean timedemo;
int forcetrack; // -1 = use normal cd track
FILE *demofile;
int td_lastframe; // to meter out one message a frame
int td_startframe; // host_framecount at start
float td_starttime; // realtime at second frame of timedemo
// connection information
int signon; // 0 to SIGNONS
struct qsocket_s *netcon;
sizebuf_t message; // writing buffer to send to server
} client_static_t;
extern client_static_t cls;
//
// the client_state_t structure is wiped completely at every
// server signon
//
typedef struct
{
int movemessages; // since connecting to this server
// throw out the first couple, so the player
// doesn't accidentally do something the
// first frame
usercmd_t cmd; // last command sent to the server
// information for local display
int stats[MAX_CL_STATS]; // health, etc
int items; // inventory bit flags
float item_gettime[32]; // cl.time of aquiring item, for blinking
float faceanimtime; // use anim frame if cl.time < this
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
// the client maintains its own idea of view angles, which are
// sent to the server each frame. The server sets punchangle when
// the view is temporarliy offset, and an angle reset commands at the start
// of each level and after teleporting.
vec3_t mviewangles[2]; // during demo playback viewangles is lerped
// between these
vec3_t viewangles;
vec3_t mvelocity[2]; // update by server, used for lean+bob
// (0 is newest)
vec3_t velocity; // lerped between mvelocity[0] and [1]
vec3_t punchangle; // temporary offset
// pitch drifting vars
float idealpitch;
float pitchvel;
qboolean nodrift;
float driftmove;
double laststop;
float viewheight;
float crouch; // local amount for smoothing stepups
qboolean paused; // send over by server
qboolean onground;
qboolean inwater;
int intermission; // don't change view angle, full screen, etc
int completed_time; // latched at intermission start
double mtime[2]; // the timestamp of last two messages
double time; // clients view of time, should be between
// servertime and oldservertime to generate
// a lerp point for other data
double oldtime; // previous cl.time, time-oldtime is used
// to decay light values and smooth step ups
float last_received_message; // (realtime) for net trouble icon
//
// information that is static for the entire time connected to a server
//
struct model_s *model_precache[MAX_MODELS];
struct sfx_s *sound_precache[MAX_SOUNDS];
char levelname[128]; // for display on solo scoreboard //johnfitz -- was 40.
int viewentity; // cl_entitites[cl.viewentity] = player
int maxclients;
int gametype;
// refresh related state
struct model_s *worldmodel; // cl_entitites[0].model
struct efrag_s *free_efrags;
int num_entities; // held in cl_entities array
int num_statics; // held in cl_staticentities array
entity_t viewent; // the gun model
int cdtrack, looptrack; // cd audio
// frag scoreboard
scoreboard_t *scores; // [cl.maxclients]
unsigned protocol; //johnfitz
} client_state_t;
//
// cvars
//
extern cvar_t cl_name;
extern cvar_t cl_color;
extern cvar_t cl_upspeed;
extern cvar_t cl_forwardspeed;
extern cvar_t cl_backspeed;
extern cvar_t cl_sidespeed;
extern cvar_t cl_movespeedkey;
extern cvar_t cl_yawspeed;
extern cvar_t cl_pitchspeed;
extern cvar_t cl_anglespeedkey;
extern cvar_t cl_autofire;
extern cvar_t cl_shownet;
extern cvar_t cl_nolerp;
extern cvar_t cl_pitchdriftspeed;
extern cvar_t lookspring;
extern cvar_t lookstrafe;
extern cvar_t sensitivity;
extern cvar_t m_pitch;
extern cvar_t m_yaw;
extern cvar_t m_forward;
extern cvar_t m_side;
#define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64
#define MAX_STATIC_ENTITIES 512 //johnfitz -- was 128
#define MAX_VISEDICTS 1024 //johnfitz -- was 256
extern client_state_t cl;
// FIXME, allocate dynamically
extern efrag_t cl_efrags[MAX_EFRAGS];
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
extern dlight_t cl_dlights[MAX_DLIGHTS];
extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
extern beam_t cl_beams[MAX_BEAMS];
extern entity_t *cl_visedicts[MAX_VISEDICTS];
extern int cl_numvisedicts;
extern entity_t *cl_entities; //johnfitz -- was a static array, now on hunk
extern int cl_max_edicts; //johnfitz -- only changes when new map loads
//=============================================================================
//
// cl_main
//
dlight_t *CL_AllocDlight (int key);
void CL_DecayLights (void);
void CL_Init (void);
void CL_EstablishConnection (char *host);
void CL_Signon1 (void);
void CL_Signon2 (void);
void CL_Signon3 (void);
void CL_Signon4 (void);
void CL_Disconnect (void);
void CL_Disconnect_f (void);
void CL_NextDemo (void);
//
// cl_input
//
typedef struct
{
int down[2]; // key nums holding it down
int state; // low bit is down state
} kbutton_t;
extern kbutton_t in_mlook, in_klook;
extern kbutton_t in_strafe;
extern kbutton_t in_speed;
void CL_InitInput (void);
void CL_SendCmd (void);
void CL_SendMove (usercmd_t *cmd);
void CL_ParseTEnt (void);
void CL_UpdateTEnts (void);
void CL_ClearState (void);
int CL_ReadFromServer (void);
void CL_WriteToServer (usercmd_t *cmd);
void CL_BaseMove (usercmd_t *cmd);
float CL_KeyState (kbutton_t *key);
char *Key_KeynumToString (int keynum);
//
// cl_demo.c
//
void CL_StopPlayback (void);
int CL_GetMessage (void);
void CL_Stop_f (void);
void CL_Record_f (void);
void CL_PlayDemo_f (void);
void CL_TimeDemo_f (void);
//
// cl_parse.c
//
void CL_ParseServerMessage (void);
void CL_NewTranslation (int slot);
//
// view
//
void V_StartPitchDrift (void);
void V_StopPitchDrift (void);
void V_RenderView (void);
//void V_UpdatePalette (void); //johnfitz
void V_Register (void);
void V_ParseDamage (void);
void V_SetContentsColor (int contents);
//
// cl_tent
//
void CL_InitTEnts (void);
void CL_SignonReply (void);

797
quakespasm/Quake/cmd.c Normal file
View File

@ -0,0 +1,797 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cmd.c -- Quake script command processing module
#include "quakedef.h"
void Cmd_ForwardToServer (void);
#define MAX_ALIAS_NAME 32
#define CMDLINE_LENGTH 256 //johnfitz -- mirrored in common.c
typedef struct cmdalias_s
{
struct cmdalias_s *next;
char name[MAX_ALIAS_NAME];
char *value;
} cmdalias_t;
cmdalias_t *cmd_alias;
int trashtest;
int *trashspot;
qboolean cmd_wait;
//=============================================================================
/*
============
Cmd_Wait_f
Causes execution of the remainder of the command buffer to be delayed until
next frame. This allows commands like:
bind g "impulse 5 ; +attack ; wait ; -attack ; impulse 2"
============
*/
void Cmd_Wait_f (void)
{
cmd_wait = true;
}
/*
=============================================================================
COMMAND BUFFER
=============================================================================
*/
sizebuf_t cmd_text;
/*
============
Cbuf_Init
============
*/
void Cbuf_Init (void)
{
SZ_Alloc (&cmd_text, 8192); // space for commands and script files
}
/*
============
Cbuf_AddText
Adds command text at the end of the buffer
============
*/
void Cbuf_AddText (char *text)
{
int l;
l = Q_strlen (text);
if (cmd_text.cursize + l >= cmd_text.maxsize)
{
Con_Printf ("Cbuf_AddText: overflow\n");
return;
}
SZ_Write (&cmd_text, text, Q_strlen (text));
}
/*
============
Cbuf_InsertText
Adds command text immediately after the current command
Adds a \n to the text
FIXME: actually change the command buffer to do less copying
============
*/
void Cbuf_InsertText (char *text)
{
char *temp;
int templen;
// copy off any commands still remaining in the exec buffer
templen = cmd_text.cursize;
if (templen)
{
temp = Z_Malloc (templen);
Q_memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
else
temp = NULL; // shut up compiler
// add the entire text of the file
Cbuf_AddText (text);
// add the copied off data
if (templen)
{
SZ_Write (&cmd_text, temp, templen);
Z_Free (temp);
}
}
/*
============
Cbuf_Execute
============
*/
void Cbuf_Execute (void)
{
int i;
char *text;
char line[1024];
int quotes;
while (cmd_text.cursize)
{
// find a \n or ; line break
text = (char *)cmd_text.data;
quotes = 0;
for (i=0 ; i< cmd_text.cursize ; i++)
{
if (text[i] == '"')
quotes++;
if ( !(quotes&1) && text[i] == ';')
break; // don't break if inside a quoted string
if (text[i] == '\n')
break;
}
memcpy (line, text, i);
line[i] = 0;
// delete the text from the command buffer and move remaining commands down
// this is necessary because commands (exec, alias) can insert data at the
// beginning of the text buffer
if (i == cmd_text.cursize)
cmd_text.cursize = 0;
else
{
i++;
cmd_text.cursize -= i;
Q_memcpy (text, text+i, cmd_text.cursize);
}
// execute the command line
Cmd_ExecuteString (line, src_command);
if (cmd_wait)
{ // skip out while text still remains in buffer, leaving it
// for next frame
cmd_wait = false;
break;
}
}
}
/*
==============================================================================
SCRIPT COMMANDS
==============================================================================
*/
/*
===============
Cmd_StuffCmds_f -- johnfitz -- rewritten to read the "cmdline" cvar, for use with dynamic mod loading
Adds command line parameters as script statements
Commands lead with a +, and continue until a - or another +
quake +prog jctest.qp +cmd amlev1
quake -nosound +cmd amlev1
===============
*/
void Cmd_StuffCmds_f (void)
{
extern cvar_t cmdline;
char cmds[CMDLINE_LENGTH];
int i, j, plus;
plus = true;
j = 0;
for (i=0; cmdline.string[i]; i++)
{
if (cmdline.string[i] == '+')
{
plus = true;
if (j > 0)
{
cmds[j-1] = ';';
cmds[j++] = ' ';
}
}
else if (cmdline.string[i] == '-' &&
(i==0 || cmdline.string[i-1] == ' ')) //johnfitz -- allow hypenated map names with +map
plus = false;
else if (plus)
cmds[j++] = cmdline.string[i];
}
cmds[j] = 0;
Cbuf_InsertText (cmds);
}
/*
===============
Cmd_Exec_f
===============
*/
void Cmd_Exec_f (void)
{
char *f;
int mark;
if (Cmd_Argc () != 2)
{
Con_Printf ("exec <filename> : execute a script file\n");
return;
}
mark = Hunk_LowMark ();
f = (char *)COM_LoadHunkFile (Cmd_Argv(1));
if (!f)
{
Con_Printf ("couldn't exec %s\n",Cmd_Argv(1));
return;
}
Con_Printf ("execing %s\n",Cmd_Argv(1));
Cbuf_InsertText (f);
Hunk_FreeToLowMark (mark);
}
/*
===============
Cmd_Echo_f
Just prints the rest of the line to the console
===============
*/
void Cmd_Echo_f (void)
{
int i;
for (i=1 ; i<Cmd_Argc() ; i++)
Con_Printf ("%s ",Cmd_Argv(i));
Con_Printf ("\n");
}
char *CopyString (char *in)
{
char *out;
out = Z_Malloc (strlen(in)+1);
strcpy (out, in);
return out;
}
/*
===============
Cmd_Alias_f -- johnfitz -- rewritten
Creates a new command that executes a command string (possibly ; seperated)
===============
*/
void Cmd_Alias_f (void)
{
cmdalias_t *a;
char cmd[1024];
int i, c;
char *s;
switch (Cmd_Argc())
{
case 1: //list all aliases
for (a = cmd_alias, i = 0; a; a=a->next, i++)
Con_SafePrintf (" %s: %s", a->name, a->value);
if (i)
Con_SafePrintf ("%i alias command(s)\n", i);
else
Con_SafePrintf ("no alias commands found\n");
break;
case 2: //output current alias string
for (a = cmd_alias ; a ; a=a->next)
if (!strcmp(Cmd_Argv(1), a->name))
Con_Printf (" %s: %s", a->name, a->value);
break;
default: //set alias string
s = Cmd_Argv(1);
if (strlen(s) >= MAX_ALIAS_NAME)
{
Con_Printf ("Alias name is too long\n");
return;
}
// if the alias allready exists, reuse it
for (a = cmd_alias ; a ; a=a->next)
{
if (!strcmp(s, a->name))
{
Z_Free (a->value);
break;
}
}
if (!a)
{
a = Z_Malloc (sizeof(cmdalias_t));
a->next = cmd_alias;
cmd_alias = a;
}
strcpy (a->name, s);
// copy the rest of the command line
cmd[0] = 0; // start out with a null string
c = Cmd_Argc();
for (i=2 ; i< c ; i++)
{
strcat (cmd, Cmd_Argv(i));
if (i != c)
strcat (cmd, " ");
}
strcat (cmd, "\n");
a->value = CopyString (cmd);
break;
}
}
/*
===============
Cmd_Unalias_f -- johnfitz
===============
*/
void Cmd_Unalias_f (void)
{
cmdalias_t *a, *prev;
switch (Cmd_Argc())
{
default:
case 1:
Con_Printf("unalias <name> : delete alias\n");
break;
case 2:
for (prev = a = cmd_alias; a; a = a->next)
{
if (!strcmp(Cmd_Argv(1), a->name))
{
prev->next = a->next;
Z_Free (a->value);
Z_Free (a);
prev = a;
return;
}
prev = a;
}
break;
}
}
/*
===============
Cmd_Unaliasall_f -- johnfitz
===============
*/
void Cmd_Unaliasall_f (void)
{
cmdalias_t *blah;
while (cmd_alias)
{
blah = cmd_alias->next;
Z_Free(cmd_alias->value);
Z_Free(cmd_alias);
cmd_alias = blah;
}
}
/*
=============================================================================
COMMAND EXECUTION
=============================================================================
*/
typedef struct cmd_function_s
{
struct cmd_function_s *next;
char *name;
xcommand_t function;
} cmd_function_t;
#define MAX_ARGS 80
static int cmd_argc;
static char *cmd_argv[MAX_ARGS];
static char *cmd_null_string = "";
static char *cmd_args = NULL;
cmd_source_t cmd_source;
//johnfitz -- better tab completion
//static cmd_function_t *cmd_functions; // possible commands to execute
cmd_function_t *cmd_functions; // possible commands to execute
//johnfitz
/*
============
Cmd_List_f -- johnfitz
============
*/
void Cmd_List_f (void)
{
cmd_function_t *cmd;
char *partial;
int len, count;
if (Cmd_Argc() > 1)
{
partial = Cmd_Argv (1);
len = Q_strlen(partial);
}
else
{
partial = NULL;
len = 0;
}
count=0;
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if (partial && Q_strncmp (partial,cmd->name, len))
{
continue;
}
Con_SafePrintf (" %s\n", cmd->name);
count++;
}
Con_SafePrintf ("%i commands", count);
if (partial)
{
Con_SafePrintf (" beginning with \"%s\"", partial);
}
Con_SafePrintf ("\n");
}
/*
============
Cmd_Init
============
*/
void Cmd_Init (void)
{
Cmd_AddCommand ("cmdlist", Cmd_List_f); //johnfitz
Cmd_AddCommand ("unalias", Cmd_Unalias_f); //johnfitz
Cmd_AddCommand ("unaliasall", Cmd_Unaliasall_f); //johnfitz
Cmd_AddCommand ("stuffcmds",Cmd_StuffCmds_f);
Cmd_AddCommand ("exec",Cmd_Exec_f);
Cmd_AddCommand ("echo",Cmd_Echo_f);
Cmd_AddCommand ("alias",Cmd_Alias_f);
Cmd_AddCommand ("cmd", Cmd_ForwardToServer);
Cmd_AddCommand ("wait", Cmd_Wait_f);
}
/*
============
Cmd_Argc
============
*/
int Cmd_Argc (void)
{
return cmd_argc;
}
/*
============
Cmd_Argv
============
*/
char *Cmd_Argv (int arg)
{
if ( (unsigned)arg >= cmd_argc )
return cmd_null_string;
return cmd_argv[arg];
}
/*
============
Cmd_Args
============
*/
char *Cmd_Args (void)
{
return cmd_args;
}
/*
============
Cmd_TokenizeString
Parses the given string into command line tokens.
============
*/
void Cmd_TokenizeString (char *text)
{
int i;
// clear the args from the last string
for (i=0 ; i<cmd_argc ; i++)
Z_Free (cmd_argv[i]);
cmd_argc = 0;
cmd_args = NULL;
while (1)
{
// skip whitespace up to a /n
while (*text && *text <= ' ' && *text != '\n')
{
text++;
}
if (*text == '\n')
{ // a newline seperates commands in the buffer
text++;
break;
}
if (!*text)
return;
if (cmd_argc == 1)
cmd_args = text;
text = COM_Parse (text);
if (!text)
return;
if (cmd_argc < MAX_ARGS)
{
cmd_argv[cmd_argc] = Z_Malloc (Q_strlen(com_token)+1);
Q_strcpy (cmd_argv[cmd_argc], com_token);
cmd_argc++;
}
}
}
/*
============
Cmd_AddCommand
============
*/
void Cmd_AddCommand (char *cmd_name, xcommand_t function)
{
cmd_function_t *cmd;
cmd_function_t *cursor,*prev; //johnfitz -- sorted list insert
if (host_initialized) // because hunk allocation would get stomped
Sys_Error ("Cmd_AddCommand after host_initialized");
// fail if the command is a variable name
if (Cvar_VariableString(cmd_name)[0])
{
Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
return;
}
// fail if the command already exists
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if (!Q_strcmp (cmd_name, cmd->name))
{
Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name);
return;
}
}
cmd = Hunk_Alloc (sizeof(cmd_function_t));
cmd->name = cmd_name;
cmd->function = function;
//johnfitz -- insert each entry in alphabetical order
if (cmd_functions == NULL || strcmp(cmd->name, cmd_functions->name) < 0) //insert at front
{
cmd->next = cmd_functions;
cmd_functions = cmd;
}
else //insert later
{
prev = cmd_functions;
cursor = cmd_functions->next;
while ((cursor != NULL) && (strcmp(cmd->name, cursor->name) > 0))
{
prev = cursor;
cursor = cursor->next;
}
cmd->next = prev->next;
prev->next = cmd;
}
//johnfitz
}
/*
============
Cmd_Exists
============
*/
qboolean Cmd_Exists (char *cmd_name)
{
cmd_function_t *cmd;
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if (!Q_strcmp (cmd_name,cmd->name))
return true;
}
return false;
}
/*
============
Cmd_CompleteCommand
============
*/
char *Cmd_CompleteCommand (char *partial)
{
cmd_function_t *cmd;
int len;
len = Q_strlen(partial);
if (!len)
return NULL;
// check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
if (!Q_strncmp (partial,cmd->name, len))
return cmd->name;
return NULL;
}
/*
============
Cmd_ExecuteString
A complete command line has been parsed, so try to execute it
FIXME: lookupnoadd the token to speed search?
============
*/
void Cmd_ExecuteString (char *text, cmd_source_t src)
{
cmd_function_t *cmd;
cmdalias_t *a;
cmd_source = src;
Cmd_TokenizeString (text);
// execute the command line
if (!Cmd_Argc())
return; // no tokens
// check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if (!Q_strcasecmp (cmd_argv[0],cmd->name))
{
cmd->function ();
return;
}
}
// check alias
for (a=cmd_alias ; a ; a=a->next)
{
if (!Q_strcasecmp (cmd_argv[0], a->name))
{
Cbuf_InsertText (a->value);
return;
}
}
// check cvars
if (!Cvar_Command ())
Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0));
}
/*
===================
Cmd_ForwardToServer
Sends the entire command line over to the server
===================
*/
void Cmd_ForwardToServer (void)
{
if (cls.state != ca_connected)
{
Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0));
return;
}
if (cls.demoplayback)
return; // not really connected
MSG_WriteByte (&cls.message, clc_stringcmd);
if (Q_strcasecmp(Cmd_Argv(0), "cmd") != 0)
{
SZ_Print (&cls.message, Cmd_Argv(0));
SZ_Print (&cls.message, " ");
}
if (Cmd_Argc() > 1)
SZ_Print (&cls.message, Cmd_Args());
else
SZ_Print (&cls.message, "\n");
}
/*
================
Cmd_CheckParm
Returns the position (1 to argc-1) in the command's argument list
where the given parameter apears, or 0 if not present
================
*/
int Cmd_CheckParm (char *parm)
{
int i;
if (!parm)
Sys_Error ("Cmd_CheckParm: NULL");
for (i = 1; i < Cmd_Argc (); i++)
if (! Q_strcasecmp (parm, Cmd_Argv (i)))
return i;
return 0;
}

121
quakespasm/Quake/cmd.h Normal file
View File

@ -0,0 +1,121 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cmd.h -- Command buffer and command execution
//===========================================================================
/*
Any number of commands can be added in a frame, from several different sources.
Most commands come from either keybindings or console line input, but remote
servers can also send across commands and entire text files can be execed.
The + command line options are also added to the command buffer.
The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute ();
*/
void Cbuf_Init (void);
// allocates an initial text buffer that will grow as needed
void Cbuf_AddText (char *text);
// as new commands are generated from the console or keybindings,
// the text is added to the end of the command buffer.
void Cbuf_InsertText (char *text);
// when a command wants to issue other commands immediately, the text is
// inserted at the beginning of the buffer, before any remaining unexecuted
// commands.
void Cbuf_Execute (void);
// Pulls off \n terminated lines of text from the command buffer and sends
// them through Cmd_ExecuteString. Stops when the buffer is empty.
// Normally called once per frame, but may be explicitly invoked.
// Do not call inside a command function!
//===========================================================================
/*
Command execution takes a null terminated string, breaks it into tokens,
then searches for a command or variable that matches the first token.
Commands can come from three sources, but the handler functions may choose
to dissallow the action or forward it to a remote server if the source is
not apropriate.
*/
typedef void (*xcommand_t) (void);
typedef enum
{
src_client, // came in over a net connection as a clc_stringcmd
// host_client will be valid during this state.
src_command // from the command buffer
} cmd_source_t;
extern cmd_source_t cmd_source;
void Cmd_Init (void);
void Cmd_AddCommand (char *cmd_name, xcommand_t function);
// called by the init functions of other parts of the program to
// register commands and functions to call for them.
// The cmd_name is referenced later, so it should not be in temp memory
qboolean Cmd_Exists (char *cmd_name);
// used by the cvar code to check for cvar / command name overlap
char *Cmd_CompleteCommand (char *partial);
// attempts to match a partial command for automatic command line completion
// returns NULL if nothing fits
int Cmd_Argc (void);
char *Cmd_Argv (int arg);
char *Cmd_Args (void);
// The functions that execute commands get their parameters with these
// functions. Cmd_Argv () will return an empty string, not a NULL
// if arg > argc, so string operations are allways safe.
int Cmd_CheckParm (char *parm);
// Returns the position (1 to argc-1) in the command's argument list
// where the given parameter apears, or 0 if not present
void Cmd_TokenizeString (char *text);
// Takes a null terminated string. Does not need to be /n terminated.
// breaks the string up into arg tokens.
void Cmd_ExecuteString (char *text, cmd_source_t src);
// Parses a single line of text into arguments and tries to execute it.
// The text can come from the command buffer, a remote client, or stdin.
void Cmd_ForwardToServer (void);
// adds the current command line as a clc_stringcmd to the client message.
// things like godmode, noclip, etc, are commands directed to the server,
// so when they are typed in at the console, they will need to be forwarded.
void Cmd_Print (char *text);
// used by command functions to send output to either the graphics console or
// passed as a print message to the client

1886
quakespasm/Quake/common.c Normal file

File diff suppressed because it is too large Load Diff

186
quakespasm/Quake/common.h Normal file
View File

@ -0,0 +1,186 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// comndef.h -- general definitions
#if !defined BYTE_DEFINED
typedef unsigned char byte;
#define BYTE_DEFINED 1
#endif
#undef true
#undef false
typedef enum {false, true} qboolean;
//============================================================================
typedef struct sizebuf_s
{
qboolean allowoverflow; // if false, do a Sys_Error
qboolean overflowed; // set to true if the buffer size failed
byte *data;
int maxsize;
int cursize;
} sizebuf_t;
void SZ_Alloc (sizebuf_t *buf, int startsize);
void SZ_Free (sizebuf_t *buf);
void SZ_Clear (sizebuf_t *buf);
void *SZ_GetSpace (sizebuf_t *buf, int length);
void SZ_Write (sizebuf_t *buf, void *data, int length);
void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf
//============================================================================
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
void ClearLink (link_t *l);
void RemoveLink (link_t *l);
void InsertLinkBefore (link_t *l, link_t *before);
void InsertLinkAfter (link_t *l, link_t *after);
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
//============================================================================
#ifndef NULL
#define NULL ((void *)0)
#endif
#define Q_MAXCHAR ((char)0x7f)
#define Q_MAXSHORT ((short)0x7fff)
#define Q_MAXINT ((int)0x7fffffff)
#define Q_MAXLONG ((int)0x7fffffff)
#define Q_MAXFLOAT ((int)0x7fffffff)
#define Q_MINCHAR ((char)0x80)
#define Q_MINSHORT ((short)0x8000)
#define Q_MININT ((int)0x80000000)
#define Q_MINLONG ((int)0x80000000)
#define Q_MINFLOAT ((int)0x7fffffff)
//============================================================================
extern qboolean bigendien;
extern short (*BigShort) (short l);
extern short (*LittleShort) (short l);
extern int (*BigLong) (int l);
extern int (*LittleLong) (int l);
extern float (*BigFloat) (float l);
extern float (*LittleFloat) (float l);
//============================================================================
void MSG_WriteChar (sizebuf_t *sb, int c);
void MSG_WriteByte (sizebuf_t *sb, int c);
void MSG_WriteShort (sizebuf_t *sb, int c);
void MSG_WriteLong (sizebuf_t *sb, int c);
void MSG_WriteFloat (sizebuf_t *sb, float f);
void MSG_WriteString (sizebuf_t *sb, char *s);
void MSG_WriteCoord (sizebuf_t *sb, float f);
void MSG_WriteAngle (sizebuf_t *sb, float f);
void MSG_WriteAngle16 (sizebuf_t *sb, float f); //johnfitz
extern int msg_readcount;
extern qboolean msg_badread; // set if a read goes beyond end of message
void MSG_BeginReading (void);
int MSG_ReadChar (void);
int MSG_ReadByte (void);
int MSG_ReadShort (void);
int MSG_ReadLong (void);
float MSG_ReadFloat (void);
char *MSG_ReadString (void);
float MSG_ReadCoord (void);
float MSG_ReadAngle (void);
float MSG_ReadAngle16 (void); //johnfitz
//============================================================================
void Q_memset (void *dest, int fill, int count);
void Q_memcpy (void *dest, void *src, int count);
int Q_memcmp (void *m1, void *m2, int count);
void Q_strcpy (char *dest, char *src);
void Q_strncpy (char *dest, char *src, int count);
int Q_strlen (char *str);
char *Q_strrchr (char *s, char c);
void Q_strcat (char *dest, char *src);
int Q_strcmp (char *s1, char *s2);
int Q_strncmp (char *s1, char *s2, int count);
int Q_strcasecmp (char *s1, char *s2);
int Q_strncasecmp (char *s1, char *s2, int n);
int Q_atoi (char *str);
float Q_atof (char *str);
//============================================================================
extern char com_token[1024];
extern qboolean com_eof;
char *COM_Parse (char *data);
extern int com_argc;
extern char **com_argv;
int COM_CheckParm (char *parm);
void COM_Init (char *path);
void COM_InitArgv (int argc, char **argv);
char *COM_SkipPath (char *pathname);
void COM_StripExtension (char *in, char *out);
void COM_FileBase (char *in, char *out);
void COM_DefaultExtension (char *path, char *extension);
char *va(char *format, ...);
// does a varargs printf into a temp buffer
//============================================================================
extern int com_filesize;
struct cache_user_s;
extern char com_gamedir[MAX_OSPATH];
void COM_WriteFile (char *filename, void *data, int len);
int COM_OpenFile (char *filename, int *hndl);
int COM_FOpenFile (char *filename, FILE **file);
void COM_CloseFile (int h);
byte *COM_LoadStackFile (char *path, void *buffer, int bufsize);
byte *COM_LoadTempFile (char *path);
byte *COM_LoadHunkFile (char *path);
void COM_LoadCacheFile (char *path, struct cache_user_s *cu);
extern struct cvar_s registered;
extern qboolean standard_quake, rogue, hipnotic;

1124
quakespasm/Quake/console.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// console
//
extern int con_totallines;
extern int con_backscroll;
extern qboolean con_forcedup; // because no entities to refresh
extern qboolean con_initialized;
extern byte *con_chars;
extern char con_lastcenterstring[]; //johnfitz
void Con_DrawCharacter (int cx, int line, int num);
void Con_CheckResize (void);
void Con_Init (void);
void Con_DrawConsole (int lines, qboolean drawinput);
void Con_Print (char *txt);
void Con_Printf (char *fmt, ...);
void Con_Warning (char *fmt, ...); //johnfitz
void Con_DPrintf (char *fmt, ...);
void Con_DPrintf2 (char *fmt, ...); //johnfitz
void Con_SafePrintf (char *fmt, ...);
void Con_Clear_f (void);
void Con_DrawNotify (void);
void Con_ClearNotify (void);
void Con_ToggleConsole_f (void);
void Con_NotifyBox (char *text); // during startup for sound / cd warnings
void Con_Show (void);
void Con_Hide (void);

94
quakespasm/Quake/crc.c Normal file
View File

@ -0,0 +1,94 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* crc.c */
#include "quakedef.h"
#include "crc.h"
// this is a 16 bit, non-reflected CRC using the polynomial 0x1021
// and the initial and final xor values shown below... in other words, the
// CCITT standard CRC used by XMODEM
#define CRC_INIT_VALUE 0xffff
#define CRC_XOR_VALUE 0x0000
static unsigned short crctable[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
void CRC_Init(unsigned short *crcvalue)
{
*crcvalue = CRC_INIT_VALUE;
}
void CRC_ProcessByte(unsigned short *crcvalue, byte data)
{
*crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data];
}
unsigned short CRC_Value(unsigned short crcvalue)
{
return crcvalue ^ CRC_XOR_VALUE;
}
//johnfitz -- texture crc
unsigned short CRC_Block (byte *start, int count)
{
unsigned short crc;
CRC_Init (&crc);
while (count--)
crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++];
return crc;
}

26
quakespasm/Quake/crc.h Normal file
View File

@ -0,0 +1,26 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* crc.h */
void CRC_Init(unsigned short *crcvalue);
void CRC_ProcessByte(unsigned short *crcvalue, byte data);
unsigned short CRC_Value(unsigned short crcvalue);
unsigned short CRC_Block (byte *start, int count); //johnfitz -- texture crc

481
quakespasm/Quake/cvar.c Normal file
View File

@ -0,0 +1,481 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cvar.c -- dynamic variable tracking
#include "quakedef.h"
cvar_t *cvar_vars;
char *cvar_null_string = "";
//==============================================================================
//
// USER COMMANDS
//
//==============================================================================
void Cvar_Reset (char *name); //johnfitz
/*
============
Cvar_List_f -- johnfitz
============
*/
void Cvar_List_f (void)
{
cvar_t *cvar;
char *partial;
int len, count;
if (Cmd_Argc() > 1)
{
partial = Cmd_Argv (1);
len = Q_strlen(partial);
}
else
{
partial = NULL;
len = 0;
}
count=0;
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
{
if (partial && Q_strncmp (partial,cvar->name, len))
{
continue;
}
Con_SafePrintf ("%s%s %s \"%s\"\n",
cvar->archive ? "*" : " ",
cvar->server ? "s" : " ",
cvar->name,
cvar->string);
count++;
}
Con_SafePrintf ("%i cvars", count);
if (partial)
{
Con_SafePrintf (" beginning with \"%s\"", partial);
}
Con_SafePrintf ("\n");
}
/*
============
Cvar_Inc_f -- johnfitz
============
*/
void Cvar_Inc_f (void)
{
switch (Cmd_Argc())
{
default:
case 1:
Con_Printf("inc <cvar> [amount] : increment cvar\n");
break;
case 2:
Cvar_SetValue (Cmd_Argv(1), Cvar_VariableValue(Cmd_Argv(1)) + 1);
break;
case 3:
Cvar_SetValue (Cmd_Argv(1), Cvar_VariableValue(Cmd_Argv(1)) + Q_atof(Cmd_Argv(2)));
break;
}
}
/*
============
Cvar_Toggle_f -- johnfitz
============
*/
void Cvar_Toggle_f (void)
{
switch (Cmd_Argc())
{
default:
case 1:
Con_Printf("toggle <cvar> : toggle cvar\n");
break;
case 2:
if (Cvar_VariableValue(Cmd_Argv(1)))
Cvar_Set (Cmd_Argv(1), "0");
else
Cvar_Set (Cmd_Argv(1), "1");
break;
}
}
/*
============
Cvar_Cycle_f -- johnfitz
============
*/
void Cvar_Cycle_f (void)
{
int i;
if (Cmd_Argc() < 3)
{
Con_Printf("cycle <cvar> <value list>: cycle cvar through a list of values\n");
return;
}
//loop through the args until you find one that matches the current cvar value.
//yes, this will get stuck on a list that contains the same value twice.
//it's not worth dealing with, and i'm not even sure it can be dealt with.
for (i=2;i<Cmd_Argc();i++)
{
//zero is assumed to be a string, even though it could actually be zero. The worst case
//is that the first time you call this command, it won't match on zero when it should, but after that,
//it will be comparing strings that all had the same source (the user) so it will work.
if (atof(Cmd_Argv(i)) == 0)
{
if (!strcmp(Cmd_Argv(i), Cvar_VariableString(Cmd_Argv(1))))
break;
}
else
{
if (atof(Cmd_Argv(i)) == Cvar_VariableValue(Cmd_Argv(1)))
break;
}
}
if (i == Cmd_Argc())
Cvar_Set (Cmd_Argv(1), Cmd_Argv(2)); // no match
else if (i + 1 == Cmd_Argc())
Cvar_Set (Cmd_Argv(1), Cmd_Argv(2)); // matched last value in list
else
Cvar_Set (Cmd_Argv(1), Cmd_Argv(i+1)); // matched earlier in list
}
/*
============
Cvar_Reset_f -- johnfitz
============
*/
void Cvar_Reset_f (void)
{
switch (Cmd_Argc())
{
default:
case 1:
Con_Printf ("reset <cvar> : reset cvar to default\n");
break;
case 2:
Cvar_Reset (Cmd_Argv(1));
break;
}
}
/*
============
Cvar_ResetAll_f -- johnfitz
============
*/
void Cvar_ResetAll_f (void)
{
cvar_t *var;
for (var = cvar_vars; var; var = var->next)
Cvar_Reset (var->name);
}
//==============================================================================
//
// INIT
//
//==============================================================================
/*
============
Cvar_Init -- johnfitz
============
*/
void Cvar_Init (void)
{
Cmd_AddCommand ("cvarlist", Cvar_List_f);
Cmd_AddCommand ("toggle", Cvar_Toggle_f);
Cmd_AddCommand ("cycle", Cvar_Cycle_f);
Cmd_AddCommand ("inc", Cvar_Inc_f);
Cmd_AddCommand ("reset", Cvar_Reset_f);
Cmd_AddCommand ("resetall", Cvar_ResetAll_f);
}
//==============================================================================
//
// CVAR FUNCTIONS
//
//==============================================================================
/*
============
Cvar_FindVar
============
*/
cvar_t *Cvar_FindVar (char *var_name)
{
cvar_t *var;
for (var=cvar_vars ; var ; var=var->next)
if (!Q_strcmp (var_name, var->name))
return var;
return NULL;
}
/*
============
Cvar_VariableValue
============
*/
float Cvar_VariableValue (char *var_name)
{
cvar_t *var;
var = Cvar_FindVar (var_name);
if (!var)
return 0;
return Q_atof (var->string);
}
/*
============
Cvar_VariableString
============
*/
char *Cvar_VariableString (char *var_name)
{
cvar_t *var;
var = Cvar_FindVar (var_name);
if (!var)
return cvar_null_string;
return var->string;
}
/*
============
Cvar_CompleteVariable
============
*/
char *Cvar_CompleteVariable (char *partial)
{
cvar_t *cvar;
int len;
len = Q_strlen(partial);
if (!len)
return NULL;
// check functions
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
if (!Q_strncmp (partial,cvar->name, len))
return cvar->name;
return NULL;
}
/*
============
Cvar_Reset -- johnfitz
============
*/
void Cvar_Reset (char *name)
{
cvar_t *var;
var = Cvar_FindVar (name);
if (!var)
Con_Printf ("variable \"%s\" not found\n", name);
else
Cvar_Set (var->name, var->default_string);
}
/*
============
Cvar_Set
============
*/
void Cvar_Set (char *var_name, char *value)
{
cvar_t *var;
qboolean changed;
var = Cvar_FindVar (var_name);
if (!var)
{ // there is an error in C code if this happens
Con_Printf ("Cvar_Set: variable %s not found\n", var_name);
return;
}
changed = Q_strcmp(var->string, value);
Z_Free (var->string); // free the old value string
var->string = Z_Malloc (Q_strlen(value)+1);
Q_strcpy (var->string, value);
var->value = Q_atof (var->string);
//johnfitz -- during initialization, update default too
if (!host_initialized)
{
Z_Free (var->default_string);
var->default_string = Z_Malloc (Q_strlen(value)+1);
Q_strcpy (var->default_string, value);
}
//johnfitz
if (var->server && changed)
{
if (sv.active)
SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string);
}
//johnfitz
if(var->callback && changed)
var->callback();
//johnfitz
}
/*
============
Cvar_SetValue
============
*/
void Cvar_SetValue (char *var_name, float value)
{
char val[32];
sprintf (val, "%f",value);
Cvar_Set (var_name, val);
}
/*
============
Cvar_RegisterVariable
Adds a freestanding variable to the variable list.
============
*/
void Cvar_RegisterVariable (cvar_t *variable, void *function)
{
char *oldstr;
cvar_t *cursor,*prev; //johnfitz -- sorted list insert
// first check to see if it has allready been defined
if (Cvar_FindVar (variable->name))
{
Con_Printf ("Can't register variable %s, allready defined\n", variable->name);
return;
}
// check for overlap with a command
if (Cmd_Exists (variable->name))
{
Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name);
return;
}
// copy the value off, because future sets will Z_Free it
oldstr = variable->string;
variable->string = Z_Malloc (Q_strlen(variable->string)+1);
Q_strcpy (variable->string, oldstr);
variable->value = Q_atof (variable->string);
//johnfitz -- save initial value for "reset" command
variable->default_string = Z_Malloc (Q_strlen(variable->string)+1);
Q_strcpy (variable->default_string, oldstr);
//johnfitz
// link the variable in
//johnfitz -- insert each entry in alphabetical order
if (cvar_vars == NULL || strcmp(variable->name, cvar_vars->name) < 0) //insert at front
{
variable->next = cvar_vars;
cvar_vars = variable;
}
else //insert later
{
prev = cvar_vars;
cursor = cvar_vars->next;
while (cursor && (strcmp(variable->name, cursor->name) > 0))
{
prev = cursor;
cursor = cursor->next;
}
variable->next = prev->next;
prev->next = variable;
}
//johnfitz
variable->callback = function; //johnfitz
}
/*
============
Cvar_Command
Handles variable inspection and changing from the console
============
*/
qboolean Cvar_Command (void)
{
cvar_t *v;
// check variables
v = Cvar_FindVar (Cmd_Argv(0));
if (!v)
return false;
// perform a variable print or set
if (Cmd_Argc() == 1)
{
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
return true;
}
Cvar_Set (v->name, Cmd_Argv(1));
return true;
}
/*
============
Cvar_WriteVariables
Writes lines containing "set variable value" for all variables
with the archive flag set to true.
============
*/
void Cvar_WriteVariables (FILE *f)
{
cvar_t *var;
for (var = cvar_vars ; var ; var = var->next)
if (var->archive)
fprintf (f, "%s \"%s\"\n", var->name, var->string);
}

100
quakespasm/Quake/cvar.h Normal file
View File

@ -0,0 +1,100 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cvar.h
/*
cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly
in C code.
it is sufficient to initialize a cvar_t with just the first two fields, or
you can add a ,true flag for variables that you want saved to the configuration
file when the game is quit:
cvar_t r_draworder = {"r_draworder","1"};
cvar_t scr_screensize = {"screensize","1",true};
Cvars must be registered before use, or they will have a 0 value instead of the float interpretation of the string. Generally, all cvar_t declarations should be registered in the apropriate init function before any console commands are executed:
Cvar_RegisterVariable (&host_framerate);
C code usually just references a cvar in place:
if ( r_draworder.value )
It could optionally ask for the value to be looked up for a string name:
if (Cvar_VariableValue ("r_draworder"))
Interpreted prog code can access cvars with the cvar(name) or
cvar_set (name, value) internal functions:
teamplay = cvar("teamplay");
cvar_set ("registered", "1");
The user can access cvars from the console in two ways:
r_draworder prints the current value
r_draworder 0 sets the current value to 0
Cvars are restricted from having the same names as commands to keep this
interface from being ambiguous.
*/
typedef struct cvar_s
{
char *name;
char *string;
qboolean archive; // set to true to cause it to be saved to vars.rc
qboolean server; // notifies players when changed
float value;
struct cvar_s *next;
char *default_string; //johnfitz -- remember defaults for reset function
void (*callback) (void); //johnfitz
} cvar_t;
void Cvar_RegisterVariable (cvar_t *variable, void *function); //johnfitz -- cvar callback
// registers a cvar that allready has the name, string, and optionally the
// archive elements set.
void Cvar_Set (char *var_name, char *value);
// equivelant to "<name> <variable>" typed at the console
void Cvar_SetValue (char *var_name, float value);
// expands value to a string and calls Cvar_Set
float Cvar_VariableValue (char *var_name);
// returns 0 if not defined or non numeric
char *Cvar_VariableString (char *var_name);
// returns an empty string if not defined
char *Cvar_CompleteVariable (char *partial);
// attempts to match a partial variable name for command line completion
// returns NULL if nothing fits
qboolean Cvar_Command (void);
// called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known
// command. Returns true if the command was a variable reference that
// was handled. (print or change)
void Cvar_WriteVariables (FILE *f);
// Writes lines containing "set variable value" for all variables
// with the archive flag set to true.
cvar_t *Cvar_FindVar (char *var_name);
extern cvar_t *cvar_vars;

View File

@ -0,0 +1,99 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// d_ifacea.h
//
// Include file for asm driver interface.
//
//
// !!! note that this file must match the corresponding C structures in
// d_iface.h at all times !!!
//
// !!! if this is changed, it must be changed in r_shared.h too !!!
#define ALIAS_ONSEAM 0x0020
// !!! if this is changed, it must be changed in d_iface.h too !!!
#define TURB_TEX_SIZE 64 // base turbulent texture size
// !!! if this is changed, it must be changed in d_iface.h too !!!
#define CYCLE 128
// !!! if this is changed, it must be changed in r_shared.h too !!!
#define MAXHEIGHT 1024
// !!! if this is changed, it must be changed in quakedef.h too !!!
#define CACHE_SIZE 32 // used to align key data structures
// particle_t structure
// !!! if this is changed, it must be changed in d_iface.h too !!!
// driver-usable fields
#define pt_org 0
#define pt_color 12
// drivers never touch the following fields
#define pt_next 16
#define pt_vel 20
#define pt_ramp 32
#define pt_die 36
#define pt_type 40
#define pt_size 44
#define PARTICLE_Z_CLIP 8.0
// finalvert_t structure
// !!! if this is changed, it must be changed in d_iface.h too !!!
#define fv_v 0 // !!! if this is moved, cases where the !!!
// !!! address of this field is pushed in !!!
// !!! d_polysa.s must be changed !!!
#define fv_flags 24
#define fv_reserved 28
#define fv_size 32
#define fv_shift 5
// stvert_t structure
// !!! if this is changed, it must be changed in modelgen.h too !!!
#define stv_onseam 0
#define stv_s 4
#define stv_t 8
#define stv_size 12
// trivertx_t structure
// !!! if this is changed, it must be changed in modelgen.h too !!!
#define tv_v 0
#define tv_lightnormalindex 3
#define tv_size 4
// affinetridesc_t structure
// !!! if this is changed, it must be changed in d_iface.h too !!!
#define atd_pskin 0
#define atd_pskindesc 4
#define atd_skinwidth 8
#define atd_skinheight 12
#define atd_ptriangles 16
#define atd_pfinalverts 20
#define atd_numtriangles 24
#define atd_drawtype 28
#define atd_seamfixupX16 32
#define atd_size 36

41
quakespasm/Quake/draw.h Normal file
View File

@ -0,0 +1,41 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// draw.h -- these are the only functions outside the refresh allowed
// to touch the vid buffer
extern qpic_t *draw_disc; // also used on sbar
void Draw_Init (void);
void Draw_Character (int x, int y, int num);
void Draw_DebugChar (char num);
void Draw_Pic (int x, int y, qpic_t *pic);
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom); //johnfitz -- more parameters
void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int lines
void Draw_BeginDisc (void);
void Draw_TileClear (int x, int y, int w, int h);
void Draw_Fill (int x, int y, int w, int h, int c, float alpha); //johnfitz -- added alpha
void Draw_FadeScreen (void);
void Draw_String (int x, int y, char *str);
qpic_t *Draw_PicFromWad (char *name);
qpic_t *Draw_CachePic (char *path);
//void GL_SetCanvas (canvastype newcanvas); //johnfitz

810
quakespasm/Quake/gl_draw.c Normal file
View File

@ -0,0 +1,810 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// draw.c -- 2d drawing
#include "quakedef.h"
//extern unsigned char d_15to8table[65536]; //johnfitz -- never used
cvar_t scr_conalpha = {"scr_conalpha", "1"}; //johnfitz
qpic_t *draw_disc;
qpic_t *draw_backtile;
gltexture_t *char_texture; //johnfitz
qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling
qpic_t *pic_nul; //johnfitz -- for missing gfx, don't crash
//johnfitz -- new pics
byte pic_ovr_data[8][8] =
{
{255,255,255,255,255,255,255,255},
{255, 15, 15, 15, 15, 15, 15,255},
{255, 15, 15, 15, 15, 15, 15, 2},
{255, 15, 15, 15, 15, 15, 15, 2},
{255, 15, 15, 15, 15, 15, 15, 2},
{255, 15, 15, 15, 15, 15, 15, 2},
{255, 15, 15, 15, 15, 15, 15, 2},
{255,255, 2, 2, 2, 2, 2, 2},
};
byte pic_ins_data[9][8] =
{
{ 15, 15,255,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{ 15, 15, 2,255,255,255,255,255},
{255, 2, 2,255,255,255,255,255},
};
byte pic_nul_data[8][8] =
{
{252,252,252,252, 0, 0, 0, 0},
{252,252,252,252, 0, 0, 0, 0},
{252,252,252,252, 0, 0, 0, 0},
{252,252,252,252, 0, 0, 0, 0},
{ 0, 0, 0, 0,252,252,252,252},
{ 0, 0, 0, 0,252,252,252,252},
{ 0, 0, 0, 0,252,252,252,252},
{ 0, 0, 0, 0,252,252,252,252},
};
byte pic_stipple_data[8][8] =
{
{255, 0, 0, 0,255, 0, 0, 0},
{ 0, 0,255, 0, 0, 0,255, 0},
{255, 0, 0, 0,255, 0, 0, 0},
{ 0, 0,255, 0, 0, 0,255, 0},
{255, 0, 0, 0,255, 0, 0, 0},
{ 0, 0,255, 0, 0, 0,255, 0},
{255, 0, 0, 0,255, 0, 0, 0},
{ 0, 0,255, 0, 0, 0,255, 0},
};
byte pic_crosshair_data[8][8] =
{
{255,255,255,255,255,255,255,255},
{255,255,255, 8, 9,255,255,255},
{255,255,255, 6, 8, 2,255,255},
{255, 6, 8, 8, 6, 8, 8,255},
{255,255, 2, 8, 8, 2, 2, 2},
{255,255,255, 7, 8, 2,255,255},
{255,255,255,255, 2, 2,255,255},
{255,255,255,255,255,255,255,255},
};
//johnfitz
typedef struct
{
gltexture_t *gltexture;
float sl, tl, sh, th;
} glpic_t;
canvastype currentcanvas = CANVAS_NONE; //johnfitz -- for GL_SetCanvas
//==============================================================================
//
// PIC CACHING
//
//==============================================================================
typedef struct cachepic_s
{
char name[MAX_QPATH];
qpic_t pic;
byte padding[32]; // for appended glpic
} cachepic_t;
#define MAX_CACHED_PICS 128
cachepic_t menu_cachepics[MAX_CACHED_PICS];
int menu_numcachepics;
byte menuplyr_pixels[4096];
// scrap allocation
// Allocate all the little status bar obejcts into a single texture
// to crutch up stupid hardware / drivers
#define MAX_SCRAPS 2
#define BLOCK_WIDTH 256
#define BLOCK_HEIGHT 256
int scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH];
byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT]; //johnfitz -- removed *4 after BLOCK_HEIGHT
qboolean scrap_dirty;
gltexture_t *scrap_textures[MAX_SCRAPS]; //johnfitz
/*
================
Scrap_AllocBlock
returns an index into scrap_texnums[] and the position inside it
================
*/
int Scrap_AllocBlock (int w, int h, int *x, int *y)
{
int i, j;
int best, best2;
//int bestx; unused -- kristian
int texnum;
for (texnum=0 ; texnum<MAX_SCRAPS ; texnum++)
{
best = BLOCK_HEIGHT;
for (i=0 ; i<BLOCK_WIDTH-w ; i++)
{
best2 = 0;
for (j=0 ; j<w ; j++)
{
if (scrap_allocated[texnum][i+j] >= best)
break;
if (scrap_allocated[texnum][i+j] > best2)
best2 = scrap_allocated[texnum][i+j];
}
if (j == w)
{ // this is a valid spot
*x = i;
*y = best = best2;
}
}
if (best + h > BLOCK_HEIGHT)
continue;
for (i=0 ; i<w ; i++)
scrap_allocated[texnum][*x + i] = best + h;
return texnum;
}
Sys_Error ("Scrap_AllocBlock: full"); //johnfitz -- correct function name
return 0; //johnfitz -- shut up compiler
}
/*
================
Scrap_Upload -- johnfitz -- now uses TexMgr
================
*/
void Scrap_Upload (void)
{
char name[8];
int i;
for (i=0; i<MAX_SCRAPS; i++)
{
sprintf (name, "scrap%i", i);
scrap_textures[i] = TexMgr_LoadImage (NULL, name, BLOCK_WIDTH, BLOCK_HEIGHT, SRC_INDEXED, scrap_texels[i],
"", (unsigned)scrap_texels[i], TEXPREF_ALPHA | TEXPREF_OVERWRITE | TEXPREF_NOPICMIP);
}
scrap_dirty = false;
}
/*
================
Draw_PicFromWad
================
*/
qpic_t *Draw_PicFromWad (char *name)
{
qpic_t *p;
glpic_t *gl;
unsigned offset; //johnfitz
p = W_GetLumpName (name);
if (!p) return pic_nul; //johnfitz
gl = (glpic_t *)p->data;
// load little ones into the scrap
if (p->width < 64 && p->height < 64)
{
int x, y;
int i, j, k;
int texnum;
texnum = Scrap_AllocBlock (p->width, p->height, &x, &y);
scrap_dirty = true;
k = 0;
for (i=0 ; i<p->height ; i++)
for (j=0 ; j<p->width ; j++, k++)
scrap_texels[texnum][(y+i)*BLOCK_WIDTH + x + j] = p->data[k];
gl->gltexture = scrap_textures[texnum]; //johnfitz -- changed to an array
//johnfitz -- no longer go from 0.01 to 0.99
gl->sl = x/(float)BLOCK_WIDTH;
gl->sh = (x+p->width)/(float)BLOCK_WIDTH;
gl->tl = y/(float)BLOCK_WIDTH;
gl->th = (y+p->height)/(float)BLOCK_WIDTH;
}
else
{
char texturename[64]; //johnfitz
sprintf (texturename, "%s:%s", WADFILENAME, name); //johnfitz
offset = (unsigned)p - (unsigned)wad_base + sizeof(int)*2; //johnfitz
gl->gltexture = TexMgr_LoadImage (NULL, texturename, p->width, p->height, SRC_INDEXED, p->data, WADFILENAME,
offset, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
gl->sl = 0;
gl->sh = (float)p->width/(float)TexMgr_PadConditional(p->width); //johnfitz
gl->tl = 0;
gl->th = (float)p->height/(float)TexMgr_PadConditional(p->height); //johnfitz
}
return p;
}
/*
================
Draw_CachePic
================
*/
qpic_t *Draw_CachePic (char *path)
{
cachepic_t *pic;
int i;
qpic_t *dat;
glpic_t *gl;
for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
if (!strcmp (path, pic->name))
return &pic->pic;
if (menu_numcachepics == MAX_CACHED_PICS)
Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
menu_numcachepics++;
strcpy (pic->name, path);
//
// load the pic from disk
//
dat = (qpic_t *)COM_LoadTempFile (path);
if (!dat)
Sys_Error ("Draw_CachePic: failed to load %s", path);
SwapPic (dat);
// HACK HACK HACK --- we need to keep the bytes for
// the translatable player picture just for the menu
// configuration dialog
if (!strcmp (path, "gfx/menuplyr.lmp"))
memcpy (menuplyr_pixels, dat->data, dat->width*dat->height);
pic->pic.width = dat->width;
pic->pic.height = dat->height;
gl = (glpic_t *)pic->pic.data;
gl->gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path,
sizeof(int)*2, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
gl->sl = 0;
gl->sh = (float)dat->width/(float)TexMgr_PadConditional(dat->width); //johnfitz
gl->tl = 0;
gl->th = (float)dat->height/(float)TexMgr_PadConditional(dat->height); //johnfitz
return &pic->pic;
}
/*
================
Draw_MakePic -- johnfitz -- generate pics from internal data
================
*/
qpic_t *Draw_MakePic (char *name, int width, int height, byte *data)
{
int flags = TEXPREF_NEAREST | TEXPREF_ALPHA | TEXPREF_PERSIST | TEXPREF_NOPICMIP | TEXPREF_PAD;
qpic_t *pic;
glpic_t *gl;
pic = Hunk_Alloc (sizeof(qpic_t) - 4 + sizeof (glpic_t));
pic->width = width;
pic->height = height;
gl = (glpic_t *)pic->data;
gl->gltexture = TexMgr_LoadImage (NULL, name, width, height, SRC_INDEXED, data, "", (unsigned)data, flags);
gl->sl = 0;
gl->sh = (float)width/(float)TexMgr_PadConditional(width);
gl->tl = 0;
gl->th = (float)height/(float)TexMgr_PadConditional(height);
return pic;
}
//==============================================================================
//
// INIT
//
//==============================================================================
/*
===============
Draw_LoadPics -- johnfitz
===============
*/
void Draw_LoadPics (void)
{
byte *data;
unsigned offset;
data = W_GetLumpName ("conchars");
if (!data) Sys_Error ("Draw_LoadPics: couldn't load conchars");
offset = (unsigned)data - (unsigned)wad_base;
char_texture = TexMgr_LoadImage (NULL, WADFILENAME":conchars", 128, 128, SRC_INDEXED, data,
WADFILENAME, offset, TEXPREF_ALPHA | TEXPREF_NEAREST | TEXPREF_NOPICMIP | TEXPREF_CONCHARS);
draw_disc = Draw_PicFromWad ("disc");
draw_backtile = Draw_PicFromWad ("backtile");
}
/*
===============
Draw_NewGame -- johnfitz
===============
*/
void Draw_NewGame (void)
{
//gltexture_t *glt; unused -- kristian
cachepic_t *pic;
int i;
// empty scrap and reallocate gltextures
memset(&scrap_allocated, 0, sizeof(scrap_allocated));
memset(&scrap_texels, 255, sizeof(scrap_texels));
Scrap_Upload (); //creates 2 empty gltextures
// reload wad pics
W_LoadWadFile (); //johnfitz -- filename is now hard-coded for honesty
Draw_LoadPics ();
SCR_LoadPics ();
Sbar_LoadPics ();
// empty lmp cache
for (pic = menu_cachepics, i = 0; i < menu_numcachepics; pic++, i++)
pic->name[0] = 0;
menu_numcachepics = 0;
}
/*
===============
Draw_Init -- johnfitz -- rewritten
===============
*/
void Draw_Init (void)
{
Cvar_RegisterVariable (&scr_conalpha, NULL);
// clear scrap and allocate gltextures
memset(&scrap_allocated, 0, sizeof(scrap_allocated));
memset(&scrap_texels, 255, sizeof(scrap_texels));
Scrap_Upload (); //creates 2 empty textures
// create internal pics
pic_ins = Draw_MakePic ("ins", 8, 9, &pic_ins_data[0][0]);
pic_ovr = Draw_MakePic ("ovr", 8, 8, &pic_ovr_data[0][0]);
pic_nul = Draw_MakePic ("nul", 8, 8, &pic_nul_data[0][0]);
// load game pics
Draw_LoadPics ();
}
//==============================================================================
//
// 2D DRAWING
//
//==============================================================================
/*
================
Draw_CharacterQuad -- johnfitz -- seperate function to spit out verts
================
*/
void Draw_CharacterQuad (int x, int y, char num)
{
int row, col;
float frow, fcol, size;
row = num>>4;
col = num&15;
frow = row*0.0625;
fcol = col*0.0625;
size = 0.0625;
glTexCoord2f (fcol, frow);
glVertex2f (x, y);
glTexCoord2f (fcol + size, frow);
glVertex2f (x+8, y);
glTexCoord2f (fcol + size, frow + size);
glVertex2f (x+8, y+8);
glTexCoord2f (fcol, frow + size);
glVertex2f (x, y+8);
}
/*
================
Draw_Character -- johnfitz -- modified to call Draw_CharacterQuad
================
*/
void Draw_Character (int x, int y, int num)
{
if (y <= -8)
return; // totally off screen
num &= 255;
if (num == 32)
return; //don't waste verts on spaces
GL_Bind (char_texture);
glBegin (GL_QUADS);
Draw_CharacterQuad (x, y, (char) num);
glEnd ();
}
/*
================
Draw_String -- johnfitz -- modified to call Draw_CharacterQuad
================
*/
void Draw_String (int x, int y, char *str)
{
if (y <= -8)
return; // totally off screen
GL_Bind (char_texture);
glBegin (GL_QUADS);
while (*str)
{
if (*str != 32) //don't waste verts on spaces
Draw_CharacterQuad (x, y, *str);
str++;
x += 8;
}
glEnd ();
}
/*
=============
Draw_Pic -- johnfitz -- modified
=============
*/
void Draw_Pic (int x, int y, qpic_t *pic)
{
glpic_t *gl;
if (scrap_dirty)
Scrap_Upload ();
gl = (glpic_t *)pic->data;
GL_Bind (gl->gltexture);
glBegin (GL_QUADS);
glTexCoord2f (gl->sl, gl->tl);
glVertex2f (x, y);
glTexCoord2f (gl->sh, gl->tl);
glVertex2f (x+pic->width, y);
glTexCoord2f (gl->sh, gl->th);
glVertex2f (x+pic->width, y+pic->height);
glTexCoord2f (gl->sl, gl->th);
glVertex2f (x, y+pic->height);
glEnd ();
}
/*
=============
Draw_TransPicTranslate -- johnfitz -- rewritten to use texmgr to do translation
Only used for the player color selection menu
=============
*/
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom)
{
static int oldtop = -2;
static int oldbottom = -2;
gltexture_t *glt;
if (top != oldtop || bottom != oldbottom)
{
oldtop = top;
oldbottom = bottom;
glt = ((glpic_t *)pic->data)->gltexture;
TexMgr_ReloadImage (glt, top, bottom);
}
Draw_Pic (x, y, pic);
}
/*
================
Draw_ConsoleBackground -- johnfitz -- rewritten
================
*/
void Draw_ConsoleBackground (void)
{
qpic_t *pic;
float alpha;
pic = Draw_CachePic ("gfx/conback.lmp");
pic->width = vid.conwidth;
pic->height = vid.conheight;
alpha = (con_forcedup) ? 1.0 : scr_conalpha.value;
// GL_SetCanvas (CANVAS_CONSOLE); //in case this is called from weird places
if (alpha > 0.0)
{
if (alpha < 1.0)
{
glEnable (GL_BLEND);
glColor4f (1,1,1,alpha);
glDisable (GL_ALPHA_TEST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
Draw_Pic (0, 0, pic);
if (alpha < 1.0)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable (GL_ALPHA_TEST);
glDisable (GL_BLEND);
glColor4f (1,1,1,1);
}
}
}
/*
=============
Draw_TileClear
This repeats a 64*64 tile graphic to fill the screen around a sized down
refresh window.
=============
*/
void Draw_TileClear (int x, int y, int w, int h)
{
glpic_t *gl;
gl = (glpic_t *)draw_backtile->data;
glColor3f (1,1,1);
GL_Bind (gl->gltexture);
glBegin (GL_QUADS);
glTexCoord2f (x/64.0, y/64.0);
glVertex2f (x, y);
glTexCoord2f ( (x+w)/64.0, y/64.0);
glVertex2f (x+w, y);
glTexCoord2f ( (x+w)/64.0, (y+h)/64.0);
glVertex2f (x+w, y+h);
glTexCoord2f ( x/64.0, (y+h)/64.0 );
glVertex2f (x, y+h);
glEnd ();
}
/*
=============
Draw_Fill
Fills a box of pixels with a single color
=============
*/
void Draw_Fill (int x, int y, int w, int h, int c, float alpha) //johnfitz -- added alpha
{
byte *pal = (byte *)d_8to24table; //johnfitz -- use d_8to24table instead of host_basepal
glDisable (GL_TEXTURE_2D);
glEnable (GL_BLEND); //johnfitz -- for alpha
glDisable (GL_ALPHA_TEST); //johnfitz -- for alpha
glColor4f (pal[c*4]/255.0, pal[c*4+1]/255.0, pal[c*4+2]/255.0, alpha); //johnfitz -- added alpha
glBegin (GL_QUADS);
glVertex2f (x,y);
glVertex2f (x+w, y);
glVertex2f (x+w, y+h);
glVertex2f (x, y+h);
glEnd ();
glColor3f (1,1,1);
glDisable (GL_BLEND); //johnfitz -- for alpha
glEnable (GL_ALPHA_TEST); //johnfitz -- for alpha
glEnable (GL_TEXTURE_2D);
}
/*
================
Draw_FadeScreen -- johnfitz -- revised
================
*/
void Draw_FadeScreen (void)
{
GL_SetCanvas (CANVAS_DEFAULT);
glEnable (GL_BLEND);
glDisable (GL_ALPHA_TEST);
glDisable (GL_TEXTURE_2D);
glColor4f (0, 0, 0, 0.5);
glBegin (GL_QUADS);
glVertex2f (0,0);
glVertex2f (glwidth, 0);
glVertex2f (glwidth, glheight);
glVertex2f (0, glheight);
glEnd ();
glColor4f (1,1,1,1);
glEnable (GL_TEXTURE_2D);
glEnable (GL_ALPHA_TEST);
glDisable (GL_BLEND);
Sbar_Changed();
}
/*
================
Draw_BeginDisc
Draws the little blue disc in the corner of the screen.
Call before beginning any disc IO.
================
*/
void Draw_BeginDisc (void)
{
int viewport[4]; //johnfitz
canvastype oldcanvas; //johnfitz
if (!draw_disc)
return;
//johnfitz -- intel video workarounds from Baker
if (isIntelVideo)
return;
//johnfitz
//johnfitz -- canvas and matrix stuff
glGetIntegerv (GL_VIEWPORT, viewport);
glMatrixMode(GL_PROJECTION);
glPushMatrix ();
glMatrixMode(GL_MODELVIEW);
glPushMatrix ();
oldcanvas = currentcanvas;
GL_SetCanvas (CANVAS_TOPRIGHT);
currentcanvas = oldcanvas; // a bit of a hack, since GL_SetCanvas doesn't know we are going to pop the stack
//johnfitz
glDrawBuffer (GL_FRONT);
Draw_Pic (320 - 24, 0, draw_disc);
glDrawBuffer (GL_BACK);
//johnfitz -- restore everything so that 3d rendering isn't fucked up
glMatrixMode(GL_PROJECTION);
glPopMatrix ();
glMatrixMode(GL_MODELVIEW);
glPopMatrix ();
glViewport (viewport[0], viewport[1], viewport[2], viewport[3]);
//johnfitz
}
/*
================
GL_SetCanvas -- johnfitz -- support various canvas types
================
*/
void GL_SetCanvas (canvastype newcanvas)
{
extern vrect_t scr_vrect;
float s, w;
int lines;
if (newcanvas == currentcanvas)
return;
currentcanvas = newcanvas;
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
switch(newcanvas)
{
case CANVAS_DEFAULT:
glOrtho (0, glwidth, glheight, 0, -99999, 99999);
glViewport (glx, gly, glwidth, glheight);
break;
case CANVAS_CONSOLE:
lines = vid.conheight - (scr_con_current * vid.conheight / glheight);
glOrtho (0, vid.conwidth, vid.conheight + lines, lines, -99999, 99999);
glViewport (glx, gly, glwidth, glheight);
break;
case CANVAS_MENU:
s = min ((float)glwidth / 320.0, (float)glheight / 200.0);
s = CLAMP (1.0, scr_menuscale.value, s);
glOrtho (0, 320, 200, 0, -99999, 99999);
glViewport (glx + (glwidth - 320*s) / 2, gly + (glheight - 200*s) / 2, 320*s, 200*s);
break;
case CANVAS_SBAR:
s = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
if (cl.gametype == GAME_DEATHMATCH)
{
glOrtho (0, glwidth / s, 48, 0, -99999, 99999);
glViewport (glx, gly, glwidth, 48*s);
}
else
{
glOrtho (0, 320, 48, 0, -99999, 99999);
glViewport (glx + (glwidth - 320*s) / 2, gly, 320*s, 48*s);
}
break;
case CANVAS_WARPIMAGE:
glOrtho (0, 128, 0, 128, -99999, 99999);
glViewport (glx, gly+glheight-gl_warpimagesize, gl_warpimagesize, gl_warpimagesize);
break;
case CANVAS_CROSSHAIR: //0,0 is center of viewport
s = CLAMP (1.0, scr_crosshaircale.value, 10.0);
glOrtho (scr_vrect.width/-2/s, scr_vrect.width/2/s, scr_vrect.height/2/s, scr_vrect.height/-2/s, -99999, 99999);
glViewport (scr_vrect.x, glheight - scr_vrect.y - scr_vrect.height, scr_vrect.width & ~1, scr_vrect.height & ~1);
break;
case CANVAS_BOTTOMLEFT: //used by devstats
s = (float)glwidth/vid.conwidth; //use console scale
glOrtho (0, 320, 200, 0, -99999, 99999);
glViewport (glx, gly, 320*s, 200*s);
break;
case CANVAS_BOTTOMRIGHT: //used by fps/clock
s = (float)glwidth/vid.conwidth; //use console scale
glOrtho (0, 320, 200, 0, -99999, 99999);
glViewport (glx+glwidth-320*s, gly, 320*s, 200*s);
break;
case CANVAS_TOPRIGHT: //used by disc
s = 1;
glOrtho (0, 320, 200, 0, -99999, 99999);
glViewport (glx+glwidth-320*s, gly+glheight-200*s, 320*s, 200*s);
break;
default:
Sys_Error ("GL_SetCanvas: bad canvas type");
}
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
}
/*
================
GL_Set2D -- johnfitz -- rewritten
================
*/
void GL_Set2D (void)
{
currentcanvas = -1;
GL_SetCanvas (CANVAS_DEFAULT);
glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE);
glDisable (GL_BLEND);
glEnable (GL_ALPHA_TEST);
glColor4f (1,1,1,1);
}

386
quakespasm/Quake/gl_fog.c Normal file
View File

@ -0,0 +1,386 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//gl_fog.c -- global and volumetric fog
#include "quakedef.h"
//==============================================================================
//
// GLOBAL FOG
//
//==============================================================================
float fog_density;
float fog_red;
float fog_green;
float fog_blue;
float old_density;
float old_red;
float old_green;
float old_blue;
float fade_time; //duration of fade
float fade_done; //time when fade will be done
/*
=============
Fog_Update
update internal variables
=============
*/
void Fog_Update (float density, float red, float green, float blue, float time)
{
//save previous settings for fade
if (time > 0)
{
//check for a fade in progress
if (fade_done > cl.time)
{
float f;//, d; unused -- kristian
f = (fade_done - cl.time) / fade_time;
old_density = f * old_density + (1.0 - f) * fog_density;
old_red = f * old_red + (1.0 - f) * fog_red;
old_green = f * old_green + (1.0 - f) * fog_green;
old_blue = f * old_blue + (1.0 - f) * fog_blue;
}
else
{
old_density = fog_density;
old_red = fog_red;
old_green = fog_green;
old_blue = fog_blue;
}
}
fog_density = density;
fog_red = red;
fog_green = green;
fog_blue = blue;
fade_time = time;
fade_done = cl.time + time;
}
/*
=============
Fog_ParseServerMessage
handle an SVC_FOG message from server
=============
*/
void Fog_ParseServerMessage (void)
{
float density, red, green, blue, time;
density = MSG_ReadByte() / 255.0;
red = MSG_ReadByte() / 255.0;
green = MSG_ReadByte() / 255.0;
blue = MSG_ReadByte() / 255.0;
time = max(0.0, MSG_ReadShort() / 100.0);
Fog_Update (density, red, green, blue, time);
}
/*
=============
Fog_FogCommand_f
handle the 'fog' console command
=============
*/
void Fog_FogCommand_f (void)
{
switch (Cmd_Argc())
{
default:
case 1:
Con_Printf("usage:\n");
Con_Printf(" fog <density>\n");
Con_Printf(" fog <red> <green> <blue>\n");
Con_Printf(" fog <density> <red> <green> <blue>\n");
Con_Printf("current values:\n");
Con_Printf(" \"density\" is \"%f\"\n", fog_density);
Con_Printf(" \"red\" is \"%f\"\n", fog_red);
Con_Printf(" \"green\" is \"%f\"\n", fog_green);
Con_Printf(" \"blue\" is \"%f\"\n", fog_blue);
break;
case 2:
Fog_Update(max(0.0, atof(Cmd_Argv(1))),
fog_red,
fog_green,
fog_blue,
0.0);
break;
case 3: //TEST
Fog_Update(max(0.0, atof(Cmd_Argv(1))),
fog_red,
fog_green,
fog_blue,
atof(Cmd_Argv(2)));
break;
case 4:
Fog_Update(fog_density,
CLAMP(0.0, atof(Cmd_Argv(1)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
0.0);
break;
case 5:
Fog_Update(fmax(0.0, atof(Cmd_Argv(1))),
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
0.0);
break;
case 6: //TEST
Fog_Update(fmax(0.0, atof(Cmd_Argv(1))),
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
atof(Cmd_Argv(5)));
break;
}
}
/*
=============
Fog_ParseWorldspawn
called at map load
=============
*/
void Fog_ParseWorldspawn (void)
{
char key[128], value[4096];
char *data;
//initially no fog
fog_density = 0.0;
old_density = 0.0;
fade_time = 0.0;
fade_done = 0.0;
data = COM_Parse(cl.worldmodel->entities);
if (!data)
return; // error
if (com_token[0] != '{')
return; // error
while (1)
{
data = COM_Parse(data);
if (!data)
return; // error
if (com_token[0] == '}')
break; // end of worldspawn
if (com_token[0] == '_')
strcpy(key, com_token + 1);
else
strcpy(key, com_token);
while (key[strlen(key)-1] == ' ') // remove trailing spaces
key[strlen(key)-1] = 0;
data = COM_Parse(data);
if (!data)
return; // error
strcpy(value, com_token);
if (!strcmp("fog", key))
{
sscanf(value, "%f %f %f %f", &fog_density, &fog_red, &fog_green, &fog_blue);
}
}
}
/*
=============
Fog_GetColor
calculates fog color for this frame, taking into account fade times
=============
*/
float *Fog_GetColor (void)
{
static float c[4];
float f;
int i;
if (fade_done > cl.time)
{
f = (fade_done - cl.time) / fade_time;
c[0] = f * old_red + (1.0 - f) * fog_red;
c[1] = f * old_green + (1.0 - f) * fog_green;
c[2] = f * old_blue + (1.0 - f) * fog_blue;
c[3] = 1.0;
}
else
{
c[0] = fog_red;
c[1] = fog_green;
c[2] = fog_blue;
c[3] = 1.0;
}
//find closest 24-bit RGB value, so solid-colored sky can match the fog perfectly
for (i=0;i<3;i++)
c[i] = (float)(Q_rint(c[i] * 255)) / 255.0f;
return c;
}
/*
=============
Fog_GetDensity
returns current density of fog
=============
*/
float Fog_GetDensity (void)
{
float f;
if (fade_done > cl.time)
{
f = (fade_done - cl.time) / fade_time;
return f * old_density + (1.0 - f) * fog_density;
}
else
return fog_density;
}
/*
=============
Fog_SetupFrame
called at the beginning of each frame
=============
*/
void Fog_SetupFrame (void)
{
glFogfv(GL_FOG_COLOR, Fog_GetColor());
glFogf(GL_FOG_DENSITY, Fog_GetDensity() / 64.0);
}
/*
=============
Fog_EnableGFog
called before drawing stuff that should be fogged
=============
*/
void Fog_EnableGFog (void)
{
if (Fog_GetDensity() > 0)
glEnable(GL_FOG);
}
/*
=============
Fog_DisableGFog
called after drawing stuff that should be fogged
=============
*/
void Fog_DisableGFog (void)
{
if (Fog_GetDensity() > 0)
glDisable(GL_FOG);
}
/*
=============
Fog_StartAdditive
called before drawing stuff that is additive blended -- sets fog color to black
=============
*/
void Fog_StartAdditive (void)
{
vec3_t color = {0,0,0};
if (Fog_GetDensity() > 0)
glFogfv(GL_FOG_COLOR, color);
}
/*
=============
Fog_StopAdditive
called after drawing stuff that is additive blended -- restores fog color
=============
*/
void Fog_StopAdditive (void)
{
if (Fog_GetDensity() > 0)
glFogfv(GL_FOG_COLOR, Fog_GetColor());
}
//==============================================================================
//
// VOLUMETRIC FOG
//
//==============================================================================
cvar_t r_vfog = {"r_vfog", "1"};
void Fog_DrawVFog (void){}
void Fog_MarkModels (void){}
//==============================================================================
//
// INIT
//
//==============================================================================
/*
=============
Fog_NewMap
called whenever a map is loaded
=============
*/
void Fog_NewMap (void)
{
Fog_ParseWorldspawn (); //for global fog
Fog_MarkModels (); //for volumetric fog
}
/*
=============
Fog_Init
called when quake initializes
=============
*/
void Fog_Init (void)
{
Cmd_AddCommand ("fog",Fog_FogCommand_f);
//Cvar_RegisterVariable (&r_vfog, NULL);
//set up global fog
fog_density = 0.0;
fog_red = 0.3;
fog_green = 0.3;
fog_blue = 0.3;
glFogi(GL_FOG_MODE, GL_EXP2);
}

413
quakespasm/Quake/gl_mesh.c Normal file
View File

@ -0,0 +1,413 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// gl_mesh.c: triangle model functions
#include "quakedef.h"
/*
=================================================================
ALIAS MODEL DISPLAY LIST GENERATION
=================================================================
*/
model_t *aliasmodel;
aliashdr_t *paliashdr;
qboolean used[8192];
// the command list holds counts and s/t values that are valid for
// every frame
int commands[8192];
int numcommands;
// all frames will have their vertexes rearranged and expanded
// so they are in the order expected by the command list
int vertexorder[8192];
int numorder;
int allverts, alltris;
int stripverts[128];
int striptris[128];
int stripcount;
/*
================
StripLength
================
*/
int StripLength (int starttri, int startv)
{
int m1, m2;
int j;
mtriangle_t *last, *check;
int k;
used[starttri] = 2;
last = &triangles[starttri];
stripverts[0] = last->vertindex[(startv)%3];
stripverts[1] = last->vertindex[(startv+1)%3];
stripverts[2] = last->vertindex[(startv+2)%3];
striptris[0] = starttri;
stripcount = 1;
m1 = last->vertindex[(startv+2)%3];
m2 = last->vertindex[(startv+1)%3];
// look for a matching triangle
nexttri:
for (j=starttri+1, check=&triangles[starttri+1] ; j<pheader->numtris ; j++, check++)
{
if (check->facesfront != last->facesfront)
continue;
for (k=0 ; k<3 ; k++)
{
if (check->vertindex[k] != m1)
continue;
if (check->vertindex[ (k+1)%3 ] != m2)
continue;
// this is the next part of the fan
// if we can't use this triangle, this tristrip is done
if (used[j])
goto done;
// the new edge
if (stripcount & 1)
m2 = check->vertindex[ (k+2)%3 ];
else
m1 = check->vertindex[ (k+2)%3 ];
stripverts[stripcount+2] = check->vertindex[ (k+2)%3 ];
striptris[stripcount] = j;
stripcount++;
used[j] = 2;
goto nexttri;
}
}
done:
// clear the temp used flags
for (j=starttri+1 ; j<pheader->numtris ; j++)
if (used[j] == 2)
used[j] = 0;
return stripcount;
}
/*
===========
FanLength
===========
*/
int FanLength (int starttri, int startv)
{
int m1, m2;
int j;
mtriangle_t *last, *check;
int k;
used[starttri] = 2;
last = &triangles[starttri];
stripverts[0] = last->vertindex[(startv)%3];
stripverts[1] = last->vertindex[(startv+1)%3];
stripverts[2] = last->vertindex[(startv+2)%3];
striptris[0] = starttri;
stripcount = 1;
m1 = last->vertindex[(startv+0)%3];
m2 = last->vertindex[(startv+2)%3];
// look for a matching triangle
nexttri:
for (j=starttri+1, check=&triangles[starttri+1] ; j<pheader->numtris ; j++, check++)
{
if (check->facesfront != last->facesfront)
continue;
for (k=0 ; k<3 ; k++)
{
if (check->vertindex[k] != m1)
continue;
if (check->vertindex[ (k+1)%3 ] != m2)
continue;
// this is the next part of the fan
// if we can't use this triangle, this tristrip is done
if (used[j])
goto done;
// the new edge
m2 = check->vertindex[ (k+2)%3 ];
stripverts[stripcount+2] = m2;
striptris[stripcount] = j;
stripcount++;
used[j] = 2;
goto nexttri;
}
}
done:
// clear the temp used flags
for (j=starttri+1 ; j<pheader->numtris ; j++)
if (used[j] == 2)
used[j] = 0;
return stripcount;
}
/*
================
BuildTris
Generate a list of trifans or strips
for the model, which holds for all frames
================
*/
void BuildTris (void)
{
int i, j, k;
int startv;
/* unused -- kristian
mtriangle_t *last, *check;
int m1, m2;
int striplength;
trivertx_t *v;
mtriangle_t *tv;
int index;
*/
float s, t;
int len, bestlen, besttype;
int bestverts[1024];
int besttris[1024];
int type;
//
// build tristrips
//
numorder = 0;
numcommands = 0;
memset (used, 0, sizeof(used));
for (i=0 ; i<pheader->numtris ; i++)
{
// pick an unused triangle and start the trifan
if (used[i])
continue;
bestlen = 0;
for (type = 0 ; type < 2 ; type++)
// type = 1;
{
for (startv =0 ; startv < 3 ; startv++)
{
if (type == 1)
len = StripLength (i, startv);
else
len = FanLength (i, startv);
if (len > bestlen)
{
besttype = type;
bestlen = len;
for (j=0 ; j<bestlen+2 ; j++)
bestverts[j] = stripverts[j];
for (j=0 ; j<bestlen ; j++)
besttris[j] = striptris[j];
}
}
}
// mark the tris on the best strip as used
for (j=0 ; j<bestlen ; j++)
used[besttris[j]] = 1;
if (besttype == 1)
commands[numcommands++] = (bestlen+2);
else
commands[numcommands++] = -(bestlen+2);
for (j=0 ; j<bestlen+2 ; j++)
{
// emit a vertex into the reorder buffer
k = bestverts[j];
vertexorder[numorder++] = k;
// emit s/t coords into the commands stream
s = stverts[k].s;
t = stverts[k].t;
if (!triangles[besttris[0]].facesfront && stverts[k].onseam)
s += pheader->skinwidth / 2; // on back side
s = (s + 0.5) / pheader->skinwidth;
t = (t + 0.5) / pheader->skinheight;
*(float *)&commands[numcommands++] = s;
*(float *)&commands[numcommands++] = t;
}
}
commands[numcommands++] = 0; // end of list marker
Con_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->numtris, numorder, numcommands);
allverts += numorder;
alltris += pheader->numtris;
}
/*
================
GL_MakeAliasModelDisplayLists
================
*/
void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
{
int i, j;
int *cmds;
trivertx_t *verts;
/* unused -- kristian
maliasgroup_t *paliasgroup;
char cache[MAX_QPATH], fullpath[MAX_OSPATH], *c;
FILE *f;
int len;
byte *data;
*/
float hscale, vscale; //johnfitz -- padded skins
int count; //johnfitz -- precompute texcoords for padded skins
int *loadcmds; //johnfitz
//johnfitz -- padded skins
hscale = (float)hdr->skinwidth/(float)TexMgr_PadConditional(hdr->skinwidth);
vscale = (float)hdr->skinheight/(float)TexMgr_PadConditional(hdr->skinheight);
//johnfitz
aliasmodel = m;
paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m);
//johnfitz -- generate meshes
#if 1 //always regenerate meshes
Con_DPrintf ("meshing %s...\n",m->name);
BuildTris ();
#else //conditional regeneration
if (gl_alwaysmesh.value) // build it from scratch, and don't bother saving it to disk
{
Con_DPrintf ("meshing %s...\n",m->name);
BuildTris ();
}
else // check disk cache, and rebuild it and save to disk if necessary
{
// FITZQUAKE 0.85 CREATES DIRECTORIES HERE
//
// look for a cached version
//
strcpy (cache, "glquake/");
COM_StripExtension (m->name+strlen("progs/"), cache+strlen("glquake/"));
strcat (cache, ".ms2");
COM_FOpenFile (cache, &f);
if (f)
{
fread (&numcommands, 4, 1, f);
fread (&numorder, 4, 1, f);
fread (&commands, numcommands * sizeof(commands[0]), 1, f);
fread (&vertexorder, numorder * sizeof(vertexorder[0]), 1, f);
fclose (f);
}
else
{
//
// build it from scratch
//
Con_Printf ("meshing %s...\n",m->name);
BuildTris ();
//
// save out the cached version
//
sprintf (fullpath, "%s/%s", com_gamedir, cache);
f = fopen (fullpath, "wb");
if (f)
{
fwrite (&numcommands, 4, 1, f);
fwrite (&numorder, 4, 1, f);
fwrite (&commands, numcommands * sizeof(commands[0]), 1, f);
fwrite (&vertexorder, numorder * sizeof(vertexorder[0]), 1, f);
fclose (f);
}
}
}
#endif
//johnfitz
// save the data out
paliashdr->poseverts = numorder;
cmds = Hunk_Alloc (numcommands * 4);
paliashdr->commands = (byte *)cmds - (byte *)paliashdr;
//johnfitz -- precompute texcoords for padded skins
loadcmds = commands;
while(1)
{
*cmds++ = count = *loadcmds++;
if (!count)
break;
if (count < 0)
count = -count;
do
{
*(float *)cmds++ = hscale * (*(float *)loadcmds++);
*(float *)cmds++ = vscale * (*(float *)loadcmds++);
} while (--count);
}
//johnfitz
verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts * sizeof(trivertx_t));
paliashdr->posedata = (byte *)verts - (byte *)paliashdr;
for (i=0 ; i<paliashdr->numposes ; i++)
for (j=0 ; j<numorder ; j++)
*verts++ = poseverts[i][vertexorder[j]];
}

2371
quakespasm/Quake/gl_model.c Normal file

File diff suppressed because it is too large Load Diff

454
quakespasm/Quake/gl_model.h Normal file
View File

@ -0,0 +1,454 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODEL__
#define __MODEL__
#include "modelgen.h"
#include "spritegn.h"
/*
d*_t structures are on-disk representations
m*_t structures are in-memory
*/
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
/*
==============================================================================
BRUSH MODELS
==============================================================================
*/
//
// in memory representation
//
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
vec3_t position;
} mvertex_t;
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
// plane_t structure
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct mplane_s
{
vec3_t normal;
float dist;
byte type; // for texture axis selection and fast side tests
byte signbits; // signx + signy<<1 + signz<<1
byte pad[2];
} mplane_t;
typedef struct texture_s
{
char name[16];
unsigned width, height;
struct gltexture_s *gltexture; //johnfitz -- pointer to gltexture
struct gltexture_s *fullbright; //johnfitz -- fullbright mask texture
struct gltexture_s *warpimage; //johnfitz -- for water animation
qboolean update_warp; //johnfitz -- update warp this frame
struct msurface_s *texturechain; // for texture chains
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
} texture_t;
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWSPRITE 8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
#define SURF_UNDERWATER 0x80
#define SURF_NOTEXTURE 0x100 //johnfitz
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
unsigned short v[2];
unsigned int cachededgeoffset;
} medge_t;
typedef struct
{
float vecs[2][4];
float mipadjust;
texture_t *texture;
int flags;
} mtexinfo_t;
#define VERTEXSIZE 7
typedef struct glpoly_s
{
struct glpoly_s *next;
struct glpoly_s *chain;
int numverts;
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;
typedef struct msurface_s
{
int visframe; // should be drawn when node is crossed
qboolean culled; // johnfitz -- for frustum culling
float mins[3]; // johnfitz -- for frustum culling
float maxs[3]; // johnfitz -- for frustum culling
mplane_t *plane;
int flags;
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
short texturemins[2];
short extents[2];
int light_s, light_t; // gl lightmap coordinates
glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain;
mtexinfo_t *texinfo;
// lighting info
int dlightframe;
int dlightbits;
int lightmaptexturenum;
byte styles[MAXLIGHTMAPS];
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
qboolean cached_dlight; // true if dynamic light in cache
byte *samples; // [numstyles*surfsize]
} msurface_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// node specific
mplane_t *plane;
struct mnode_s *children[2];
unsigned short firstsurface;
unsigned short numsurfaces;
} mnode_t;
typedef struct mleaf_s
{
// common with node
int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
efrag_t *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
//johnfitz -- for clipnodes>32k
typedef struct mclipnode_s
{
int planenum;
int children[2]; // negative numbers are contents
} mclipnode_t;
//johnfitz
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
/*
==============================================================================
SPRITE MODELS
==============================================================================
*/
// FIXME: shorten these?
typedef struct mspriteframe_s
{
int width, height;
float up, down, left, right;
float smax, tmax; //johnfitz -- image might be padded
struct gltexture_s *gltexture;
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
int type;
int maxwidth;
int maxheight;
int numframes;
float beamlength; // remove?
void *cachespot; // remove?
mspriteframedesc_t frames[1];
} msprite_t;
/*
==============================================================================
ALIAS MODELS
Alias models are position independent, so the cache manager can move them.
==============================================================================
*/
typedef struct
{
int firstpose;
int numposes;
float interval;
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
char name[16];
} maliasframedesc_t;
typedef struct
{
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
} maliasgroupframedesc_t;
typedef struct
{
int numframes;
int intervals;
maliasgroupframedesc_t frames[1];
} maliasgroup_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s {
int facesfront;
int vertindex[3];
} mtriangle_t;
#define MAX_SKINS 32
typedef struct {
int ident;
int version;
vec3_t scale;
vec3_t scale_origin;
float boundingradius;
vec3_t eyeposition;
int numskins;
int skinwidth;
int skinheight;
int numverts;
int numtris;
int numframes;
synctype_t synctype;
int flags;
float size;
int numposes;
int poseverts;
int posedata; // numposes*poseverts trivert_t
int commands; // gl command list with embedded s/t
struct gltexture_s *gltextures[MAX_SKINS][4]; //johnfitz
struct gltexture_s *fbtextures[MAX_SKINS][4]; //johnfitz
int texels[MAX_SKINS]; // only for player skins
maliasframedesc_t frames[1]; // variable sized
} aliashdr_t;
#define MAXALIASVERTS 2000 //johnfitz -- was 1024
#define MAXALIASFRAMES 256
#define MAXALIASTRIS 2048
extern aliashdr_t *pheader;
extern stvert_t stverts[MAXALIASVERTS];
extern mtriangle_t triangles[MAXALIASTRIS];
extern trivertx_t *poseverts[MAXALIASFRAMES];
//===================================================================
//
// Whole model
//
typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
#define EF_ROCKET 1 // leave a trail
#define EF_GRENADE 2 // leave a trail
#define EF_GIB 4 // leave a trail
#define EF_ROTATE 8 // rotate (bonus items)
#define EF_TRACER 16 // green split trail
#define EF_ZOMGIB 32 // small blood trail
#define EF_TRACER2 64 // orange split trail + rotate
#define EF_TRACER3 128 // purple trail
//johnfitz -- extra flags for rendering
#define MOD_NOLERP 256 //don't lerp when animating
#define MOD_NOSHADOW 512 //don't cast a shadow
#define MOD_FBRIGHTHACK 1024 //when fullbrights are disabled, use a hack to render this model brighter
//johnfitz
typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
modtype_t type;
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model graphics
//
vec3_t mins, maxs;
vec3_t ymins, ymaxs; //johnfitz -- bounds for entities with nonzero yaw
vec3_t rmins, rmaxs; //johnfitz -- bounds for entities with nonzero pitch or roll
//johnfitz -- removed float radius;
//
// solid volume for clipping
//
qboolean clipbox;
vec3_t clipmins, clipmaxs;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels;
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numvertexes;
mvertex_t *vertexes;
int numedges;
medge_t *edges;
int numnodes;
mnode_t *nodes;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int numclipnodes;
mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t
int nummarksurfaces;
msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS];
int numtextures;
texture_t **textures;
byte *visdata;
byte *lightdata;
char *entities;
//
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
//============================================================================
void Mod_Init (void);
void Mod_ClearAll (void);
model_t *Mod_ForName (char *name, qboolean crash);
void *Mod_Extradata (model_t *mod); // handles caching
void Mod_TouchModel (char *name);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
#endif // __MODEL__

View File

@ -0,0 +1,244 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_efrag.c
#include "quakedef.h"
mnode_t *r_pefragtopnode;
//===========================================================================
/*
===============================================================================
ENTITY FRAGMENT FUNCTIONS
===============================================================================
*/
efrag_t **lastlink;
vec3_t r_emins, r_emaxs;
entity_t *r_addent;
/*
================
R_RemoveEfrags
Call when removing an object from the world or moving it to another position
================
*/
void R_RemoveEfrags (entity_t *ent)
{
efrag_t *ef, *old, *walk, **prev;
ef = ent->efrag;
while (ef)
{
prev = &ef->leaf->efrags;
while (1)
{
walk = *prev;
if (!walk)
break;
if (walk == ef)
{ // remove this fragment
*prev = ef->leafnext;
break;
}
else
prev = &walk->leafnext;
}
old = ef;
ef = ef->entnext;
// put it on the free list
old->entnext = cl.free_efrags;
cl.free_efrags = old;
}
ent->efrag = NULL;
}
/*
===================
R_SplitEntityOnNode
===================
*/
void R_SplitEntityOnNode (mnode_t *node)
{
efrag_t *ef;
mplane_t *splitplane;
mleaf_t *leaf;
int sides;
if (node->contents == CONTENTS_SOLID)
{
return;
}
// add an efrag if the node is a leaf
if ( node->contents < 0)
{
if (!r_pefragtopnode)
r_pefragtopnode = node;
leaf = (mleaf_t *)node;
// grab an efrag off the free list
ef = cl.free_efrags;
if (!ef)
{
//johnfitz -- less spammy overflow message
if (!dev_overflows.efrags || dev_overflows.efrags + CONSOLE_RESPAM_TIME < realtime )
{
Con_Printf ("Too many efrags!\n");
dev_overflows.efrags = realtime;
}
//johnfitz
return; // no free fragments...
}
cl.free_efrags = cl.free_efrags->entnext;
ef->entity = r_addent;
// add the entity link
*lastlink = ef;
lastlink = &ef->entnext;
ef->entnext = NULL;
// set the leaf links
ef->leaf = leaf;
ef->leafnext = leaf->efrags;
leaf->efrags = ef;
return;
}
// NODE_MIXED
splitplane = node->plane;
sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane);
if (sides == 3)
{
// split on this plane
// if this is the first splitter of this bmodel, remember it
if (!r_pefragtopnode)
r_pefragtopnode = node;
}
// recurse down the contacted sides
if (sides & 1)
R_SplitEntityOnNode (node->children[0]);
if (sides & 2)
R_SplitEntityOnNode (node->children[1]);
}
/*
===========
R_CheckEfrags -- johnfitz -- check for excessive efrag count
===========
*/
void R_CheckEfrags (void)
{
efrag_t *ef;
int count;
if (cls.signon < 2)
return; //don't spam when still parsing signon packet full of static ents
for (count=MAX_EFRAGS, ef = cl.free_efrags; ef; count--, ef = ef->entnext)
;
if (count > 640 && dev_peakstats.efrags <= 640)
Con_Warning ("%i efrags exceeds standard limit of 640.\n", count);
dev_stats.efrags = count;
dev_peakstats.efrags = max(count, dev_peakstats.efrags);
}
/*
===========
R_AddEfrags
===========
*/
void R_AddEfrags (entity_t *ent)
{
model_t *entmodel;
int i;
if (!ent->model)
return;
r_addent = ent;
lastlink = &ent->efrag;
r_pefragtopnode = NULL;
entmodel = ent->model;
for (i=0 ; i<3 ; i++)
{
r_emins[i] = ent->origin[i] + entmodel->mins[i];
r_emaxs[i] = ent->origin[i] + entmodel->maxs[i];
}
R_SplitEntityOnNode (cl.worldmodel->nodes);
ent->topnode = r_pefragtopnode;
R_CheckEfrags (); //johnfitz
}
/*
================
R_StoreEfrags -- johnfitz -- pointless switch statement removed.
================
*/
void R_StoreEfrags (efrag_t **ppefrag)
{
entity_t *pent;
efrag_t *pefrag;
while ((pefrag = *ppefrag) != NULL)
{
pent = pefrag->entity;
if ((pent->visframe != r_framecount) && (cl_numvisedicts < MAX_VISEDICTS))
{
cl_visedicts[cl_numvisedicts++] = pent;
pent->visframe = r_framecount;
}
ppefrag = &pefrag->leafnext;
}
}

View File

@ -0,0 +1,391 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_light.c
#include "quakedef.h"
int r_dlightframecount;
extern cvar_t r_flatlightstyles; //johnfitz
/*
==================
R_AnimateLight
==================
*/
void R_AnimateLight (void)
{
int i,j,k;
//
// light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int)(cl.time*10);
for (j=0 ; j<MAX_LIGHTSTYLES ; j++)
{
if (!cl_lightstyle[j].length)
{
d_lightstylevalue[j] = 256;
continue;
}
//johnfitz -- r_flatlightstyles
if (r_flatlightstyles.value == 2)
k = cl_lightstyle[j].peak - 'a';
else if (r_flatlightstyles.value == 1)
k = cl_lightstyle[j].average - 'a';
else
{
k = i % cl_lightstyle[j].length;
k = cl_lightstyle[j].map[k] - 'a';
}
d_lightstylevalue[j] = k*22;
//johnfitz
}
}
/*
=============================================================================
DYNAMIC LIGHTS BLEND RENDERING (gl_flashblend 1)
=============================================================================
*/
void AddLightBlend (float r, float g, float b, float a2)
{
float a;
v_blend[3] = a = v_blend[3] + a2*(1-v_blend[3]);
a2 = a2/a;
v_blend[0] = v_blend[1]*(1-a2) + r*a2;
v_blend[1] = v_blend[1]*(1-a2) + g*a2;
v_blend[2] = v_blend[2]*(1-a2) + b*a2;
}
void R_RenderDlight (dlight_t *light)
{
int i, j;
float a;
vec3_t v;
float rad;
rad = light->radius * 0.35;
VectorSubtract (light->origin, r_origin, v);
if (Length (v) < rad)
{ // view is inside the dlight
AddLightBlend (1, 0.5, 0, light->radius * 0.0003);
return;
}
glBegin (GL_TRIANGLE_FAN);
glColor3f (0.2,0.1,0.0);
for (i=0 ; i<3 ; i++)
v[i] = light->origin[i] - vpn[i]*rad;
glVertex3fv (v);
glColor3f (0,0,0);
for (i=16 ; i>=0 ; i--)
{
a = i/16.0 * M_PI*2;
for (j=0 ; j<3 ; j++)
v[j] = light->origin[j] + vright[j]*cos(a)*rad
+ vup[j]*sin(a)*rad;
glVertex3fv (v);
}
glEnd ();
}
/*
=============
R_RenderDlights
=============
*/
void R_RenderDlights (void)
{
int i;
dlight_t *l;
if (!gl_flashblend.value)
return;
r_dlightframecount = r_framecount + 1; // because the count hasn't
// advanced yet for this frame
glDepthMask (0);
glDisable (GL_TEXTURE_2D);
glShadeModel (GL_SMOOTH);
glEnable (GL_BLEND);
glBlendFunc (GL_ONE, GL_ONE);
l = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, l++)
{
if (l->die < cl.time || !l->radius)
continue;
R_RenderDlight (l);
}
glColor3f (1,1,1);
glDisable (GL_BLEND);
glEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (1);
}
/*
=============================================================================
DYNAMIC LIGHTS
=============================================================================
*/
/*
=============
R_MarkLights -- johnfitz -- rewritten to use LordHavoc's lighting speedup
=============
*/
void R_MarkLights (dlight_t *light, int bit, mnode_t *node)
{
mplane_t *splitplane;
msurface_t *surf;
vec3_t impact;
float dist, l, maxdist;
int i, j, s, t;
start:
if (node->contents < 0)
return;
splitplane = node->plane;
if (splitplane->type < 3)
dist = light->origin[splitplane->type] - splitplane->dist;
else
dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
if (dist > light->radius)
{
node = node->children[0];
goto start;
}
if (dist < -light->radius)
{
node = node->children[1];
goto start;
}
maxdist = light->radius*light->radius;
// mark the polygons
surf = cl.worldmodel->surfaces + node->firstsurface;
for (i=0 ; i<node->numsurfaces ; i++, surf++)
{
for (j=0 ; j<3 ; j++)
impact[j] = light->origin[j] - surf->plane->normal[j]*dist;
// clamp center of light to corner and check brightness
l = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0];
s = l+0.5;if (s < 0) s = 0;else if (s > surf->extents[0]) s = surf->extents[0];
s = l - s;
l = DotProduct (impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1];
t = l+0.5;if (t < 0) t = 0;else if (t > surf->extents[1]) t = surf->extents[1];
t = l - t;
// compare to minimum light
if ((s*s+t*t+dist*dist) < maxdist)
{
if (surf->dlightframe != r_dlightframecount) // not dynamic until now
{
surf->dlightbits = bit;
surf->dlightframe = r_dlightframecount;
}
else // already dynamic
surf->dlightbits |= bit;
}
}
if (node->children[0]->contents >= 0)
R_MarkLights (light, bit, node->children[0]);
if (node->children[1]->contents >= 0)
R_MarkLights (light, bit, node->children[1]);
}
/*
=============
R_PushDlights
=============
*/
void R_PushDlights (void)
{
int i;
dlight_t *l;
if (gl_flashblend.value)
return;
r_dlightframecount = r_framecount + 1; // because the count hasn't
// advanced yet for this frame
l = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, l++)
{
if (l->die < cl.time || !l->radius)
continue;
R_MarkLights ( l, 1<<i, cl.worldmodel->nodes );
}
}
/*
=============================================================================
LIGHT SAMPLING
=============================================================================
*/
mplane_t *lightplane;
vec3_t lightspot;
vec3_t lightcolor; //johnfitz -- lit support via lordhavoc
/*
=============
RecursiveLightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc
=============
*/
int RecursiveLightPoint (vec3_t color, mnode_t *node, vec3_t start, vec3_t end)
{
float front, back, frac;
vec3_t mid;
loc0:
if (node->contents < 0)
return false; // didn't hit anything
// calculate mid point
if (node->plane->type < 3)
{
front = start[node->plane->type] - node->plane->dist;
back = end[node->plane->type] - node->plane->dist;
}
else
{
front = DotProduct(start, node->plane->normal) - node->plane->dist;
back = DotProduct(end, node->plane->normal) - node->plane->dist;
}
// LordHavoc: optimized recursion
if ((back < 0) == (front < 0))
// return RecursiveLightPoint (color, node->children[front < 0], start, end);
{
node = node->children[front < 0];
goto loc0;
}
frac = front / (front-back);
mid[0] = start[0] + (end[0] - start[0])*frac;
mid[1] = start[1] + (end[1] - start[1])*frac;
mid[2] = start[2] + (end[2] - start[2])*frac;
// go down front side
if (RecursiveLightPoint (color, node->children[front < 0], start, mid))
return true; // hit something
else
{
int i, ds, dt;
msurface_t *surf;
// check for impact on this node
VectorCopy (mid, lightspot);
lightplane = node->plane;
surf = cl.worldmodel->surfaces + node->firstsurface;
for (i = 0;i < node->numsurfaces;i++, surf++)
{
if (surf->flags & SURF_DRAWTILED)
continue; // no lightmaps
ds = (int) ((float) DotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]);
dt = (int) ((float) DotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]);
if (ds < surf->texturemins[0] || dt < surf->texturemins[1])
continue;
ds -= surf->texturemins[0];
dt -= surf->texturemins[1];
if (ds > surf->extents[0] || dt > surf->extents[1])
continue;
if (surf->samples)
{
// LordHavoc: enhanced to interpolate lighting
byte *lightmap;
int maps, line3, dsfrac = ds & 15, dtfrac = dt & 15, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0;
float scale;
line3 = ((surf->extents[0]>>4)+1)*3;
lightmap = surf->samples + ((dt>>4) * ((surf->extents[0]>>4)+1) + (ds>>4))*3; // LordHavoc: *3 for color
for (maps = 0;maps < MAXLIGHTMAPS && surf->styles[maps] != 255;maps++)
{
scale = (float) d_lightstylevalue[surf->styles[maps]] * 1.0 / 256.0;
r00 += (float) lightmap[ 0] * scale;g00 += (float) lightmap[ 1] * scale;b00 += (float) lightmap[2] * scale;
r01 += (float) lightmap[ 3] * scale;g01 += (float) lightmap[ 4] * scale;b01 += (float) lightmap[5] * scale;
r10 += (float) lightmap[line3+0] * scale;g10 += (float) lightmap[line3+1] * scale;b10 += (float) lightmap[line3+2] * scale;
r11 += (float) lightmap[line3+3] * scale;g11 += (float) lightmap[line3+4] * scale;b11 += (float) lightmap[line3+5] * scale;
lightmap += ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting
}
color[0] += (float) ((int) ((((((((r11-r10) * dsfrac) >> 4) + r10)-((((r01-r00) * dsfrac) >> 4) + r00)) * dtfrac) >> 4) + ((((r01-r00) * dsfrac) >> 4) + r00)));
color[1] += (float) ((int) ((((((((g11-g10) * dsfrac) >> 4) + g10)-((((g01-g00) * dsfrac) >> 4) + g00)) * dtfrac) >> 4) + ((((g01-g00) * dsfrac) >> 4) + g00)));
color[2] += (float) ((int) ((((((((b11-b10) * dsfrac) >> 4) + b10)-((((b01-b00) * dsfrac) >> 4) + b00)) * dtfrac) >> 4) + ((((b01-b00) * dsfrac) >> 4) + b00)));
}
return true; // success
}
// go down back side
return RecursiveLightPoint (color, node->children[front >= 0], mid, end);
}
}
/*
=============
R_LightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc
=============
*/
int R_LightPoint (vec3_t p)
{
vec3_t end;
if (!cl.worldmodel->lightdata)
{
lightcolor[0] = lightcolor[1] = lightcolor[2] = 255;
return 255;
}
end[0] = p[0];
end[1] = p[1];
end[2] = p[2] - 8192; //johnfitz -- was 2048
lightcolor[0] = lightcolor[1] = lightcolor[2] = 0;
RecursiveLightPoint (lightcolor, cl.worldmodel->nodes, p, end);
return ((lightcolor[0] + lightcolor[1] + lightcolor[2]) * (1.0f / 3.0f));
}

860
quakespasm/Quake/gl_rmain.c Normal file
View File

@ -0,0 +1,860 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_main.c
#include "quakedef.h"
qboolean r_cache_thrash; // compatability
vec3_t modelorg, r_entorigin;
entity_t *currententity;
int r_visframecount; // bumped when going to a new PVS
int r_framecount; // used for dlight push checking
mplane_t frustum[4];
//johnfitz -- rendering statistics
int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
float rs_megatexels;
qboolean envmap; // true during envmap command capture
//
// view origin
//
vec3_t vup;
vec3_t vpn;
vec3_t vright;
vec3_t r_origin;
float r_world_matrix[16];
float r_base_world_matrix[16];
float r_fovx, r_fovy; //johnfitz -- rendering fov may be different becuase of r_waterwarp and r_stereo
//
// screen size info
//
refdef_t r_refdef;
mleaf_t *r_viewleaf, *r_oldviewleaf;
int d_lightstylevalue[256]; // 8.8 fraction of base light value
cvar_t r_norefresh = {"r_norefresh","0"};
cvar_t r_drawentities = {"r_drawentities","1"};
cvar_t r_drawviewmodel = {"r_drawviewmodel","1"};
cvar_t r_speeds = {"r_speeds","0"};
cvar_t r_fullbright = {"r_fullbright","0"};
cvar_t r_lightmap = {"r_lightmap","0"};
cvar_t r_shadows = {"r_shadows","0"};
cvar_t r_wateralpha = {"r_wateralpha","1"};
cvar_t r_dynamic = {"r_dynamic","1"};
cvar_t r_novis = {"r_novis","0"};
cvar_t gl_finish = {"gl_finish","0"};
cvar_t gl_clear = {"gl_clear","0"};
cvar_t gl_cull = {"gl_cull","1"};
cvar_t gl_smoothmodels = {"gl_smoothmodels","1"};
cvar_t gl_affinemodels = {"gl_affinemodels","0"};
cvar_t gl_polyblend = {"gl_polyblend","1"};
cvar_t gl_flashblend = {"gl_flashblend","1"};
cvar_t gl_playermip = {"gl_playermip","0"};
cvar_t gl_nocolors = {"gl_nocolors","0"};
//johnfitz -- new cvars
cvar_t r_stereo = {"r_stereo","0"};
cvar_t r_stereodepth = {"r_stereodepth","128"};
cvar_t r_clearcolor = {"r_clearcolor","2", true};
cvar_t r_drawflat = {"r_drawflat","0"};
cvar_t r_flatlightstyles = {"r_flatlightstyles", "0"};
cvar_t gl_fullbrights = {"gl_fullbrights", "1", true};
cvar_t gl_farclip = {"gl_farclip", "16384", true};
cvar_t gl_overbright = {"gl_overbright", "1", true};
cvar_t gl_overbright_models = {"gl_overbright_models", "1", true};
cvar_t r_oldskyleaf = {"r_oldskyleaf", "0"};
cvar_t r_drawworld = {"r_drawworld", "1"};
cvar_t r_showtris = {"r_showtris", "0"};
cvar_t r_showbboxes = {"r_showbboxes", "0"};
cvar_t r_lerpmodels = {"r_lerpmodels", "1"};
cvar_t r_lerpmove = {"r_lerpmove", "1"};
cvar_t r_nolerp_list = {"r_nolerp_list", "progs/flame.mdl,progs/flame2.mdl,progs/braztall.mdl,progs/brazshrt.mdl,progs/longtrch.mdl,progs/flame_pyre.mdl,progs/v_saw.mdl,progs/v_xfist.mdl,progs/h2stuff/newfire.mdl"};
//johnfitz
/*
=================
R_CullBox -- johnfitz -- replaced with new function from lordhavoc
Returns true if the box is completely outside the frustum
=================
*/
qboolean R_CullBox (vec3_t emins, vec3_t emaxs)
{
int i;
mplane_t *p;
for (i = 0;i < 4;i++)
{
p = frustum + i;
switch(p->signbits)
{
default:
case 0:
if (p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2] < p->dist)
return true;
break;
case 1:
if (p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2] < p->dist)
return true;
break;
case 2:
if (p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2] < p->dist)
return true;
break;
case 3:
if (p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2] < p->dist)
return true;
break;
case 4:
if (p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2] < p->dist)
return true;
break;
case 5:
if (p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2] < p->dist)
return true;
break;
case 6:
if (p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2] < p->dist)
return true;
break;
case 7:
if (p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2] < p->dist)
return true;
break;
}
}
return false;
}
/*
===============
R_CullModelForEntity -- johnfitz -- uses correct bounds based on rotation
===============
*/
qboolean R_CullModelForEntity (entity_t *e)
{
vec3_t mins, maxs;
if (e->angles[0] || e->angles[2]) //pitch or roll
{
VectorAdd (e->origin, e->model->rmins, mins);
VectorAdd (e->origin, e->model->rmaxs, maxs);
}
else if (e->angles[1]) //yaw
{
VectorAdd (e->origin, e->model->ymins, mins);
VectorAdd (e->origin, e->model->ymaxs, maxs);
}
else //no rotation
{
VectorAdd (e->origin, e->model->mins, mins);
VectorAdd (e->origin, e->model->maxs, maxs);
}
return R_CullBox (mins, maxs);
}
/*
===============
R_RotateForEntity -- johnfitz -- modified to take origin and angles instead of pointer to entity
===============
*/
void R_RotateForEntity (vec3_t origin, vec3_t angles)
{
glTranslatef (origin[0], origin[1], origin[2]);
glRotatef (angles[1], 0, 0, 1);
glRotatef (-angles[0], 0, 1, 0);
glRotatef (angles[2], 1, 0, 0);
}
/*
=============
GL_PolygonOffset -- johnfitz
negative offset moves polygon closer to camera
=============
*/
void GL_PolygonOffset (int offset)
{
if (offset > 0)
{
glEnable (GL_POLYGON_OFFSET_FILL);
glEnable (GL_POLYGON_OFFSET_LINE);
glPolygonOffset(1, offset);
}
else if (offset < 0)
{
glEnable (GL_POLYGON_OFFSET_FILL);
glEnable (GL_POLYGON_OFFSET_LINE);
glPolygonOffset(-1, offset);
}
else
{
glDisable (GL_POLYGON_OFFSET_FILL);
glDisable (GL_POLYGON_OFFSET_LINE);
}
}
//==============================================================================
//
// SETUP FRAME
//
//==============================================================================
int SignbitsForPlane (mplane_t *out)
{
int bits, j;
// for fast box on planeside test
bits = 0;
for (j=0 ; j<3 ; j++)
{
if (out->normal[j] < 0)
bits |= 1<<j;
}
return bits;
}
/*
===============
TurnVector -- johnfitz
turn forward towards side on the plane defined by forward and side
if angle = 90, the result will be equal to side
assumes side and forward are perpendicular, and normalized
to turn away from side, use a negative angle
===============
*/
#define DEG2RAD( a ) ( (a) * M_PI_DIV_180 )
void TurnVector (vec3_t out, const vec3_t forward, const vec3_t side, float angle)
{
float scale_forward, scale_side;
scale_forward = cos( DEG2RAD( angle ) );
scale_side = sin( DEG2RAD( angle ) );
out[0] = scale_forward*forward[0] + scale_side*side[0];
out[1] = scale_forward*forward[1] + scale_side*side[1];
out[2] = scale_forward*forward[2] + scale_side*side[2];
}
/*
===============
R_SetFrustum -- johnfitz -- rewritten
===============
*/
void R_SetFrustum (float fovx, float fovy)
{
int i;
if (r_stereo.value)
fovx += 10; //silly hack so that polygons don't drop out becuase of stereo skew
TurnVector(frustum[0].normal, vpn, vright, fovx/2 - 90); //left plane
TurnVector(frustum[1].normal, vpn, vright, 90 - fovx/2); //right plane
TurnVector(frustum[2].normal, vpn, vup, 90 - fovy/2); //bottom plane
TurnVector(frustum[3].normal, vpn, vup, fovy/2 - 90); //top plane
for (i=0 ; i<4 ; i++)
{
frustum[i].type = PLANE_ANYZ;
frustum[i].dist = DotProduct (r_origin, frustum[i].normal); //FIXME: shouldn't this always be zero?
frustum[i].signbits = SignbitsForPlane (&frustum[i]);
}
}
/*
=============
GL_SetFrustum -- johnfitz -- written to replace MYgluPerspective
=============
*/
#define NEARCLIP 4
float frustum_skew = 0.0; //used by r_stereo
void GL_SetFrustum(float fovx, float fovy)
{
float xmax, ymax;
xmax = NEARCLIP * tan( fovx * M_PI / 360.0 );
ymax = NEARCLIP * tan( fovy * M_PI / 360.0 );
glFrustum(-xmax + frustum_skew, xmax + frustum_skew, -ymax, ymax, NEARCLIP, gl_farclip.value);
}
/*
=============
R_SetupGL
=============
*/
void R_SetupGL (void)
{
//johnfitz -- rewrote this section
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glViewport (glx + r_refdef.vrect.x,
gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height,
r_refdef.vrect.width,
r_refdef.vrect.height);
//johnfitz
GL_SetFrustum (r_fovx, r_fovy); //johnfitz -- use r_fov* vars
// glCullFace(GL_BACK); //johnfitz -- glquake used CCW with backwards culling -- let's do it right
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glRotatef (-90, 1, 0, 0); // put Z going up
glRotatef (90, 0, 0, 1); // put Z going up
glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);
glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
//
// set drawing parms
//
if (gl_cull.value)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glEnable(GL_DEPTH_TEST);
}
/*
=============
R_Clear -- johnfitz -- rewritten and gutted
=============
*/
void R_Clear (void)
{
extern int gl_stencilbits;
unsigned int clearbits;
clearbits = GL_DEPTH_BUFFER_BIT;
if (gl_clear.value || isIntelVideo) clearbits |= GL_COLOR_BUFFER_BIT; //intel video workarounds from Baker
if (gl_stencilbits) clearbits |= GL_STENCIL_BUFFER_BIT;
glClear (clearbits);
}
/*
===============
R_SetupScene -- johnfitz -- this is the stuff that needs to be done once per eye in stereo mode
===============
*/
void R_SetupScene (void)
{
R_PushDlights ();
R_AnimateLight ();
r_framecount++;
R_SetupGL ();
}
/*
===============
R_SetupView -- johnfitz -- this is the stuff that needs to be done once per frame, even in stereo mode
===============
*/
void R_SetupView (void)
{
Fog_SetupFrame (); //johnfitz
// build the transformation matrix for the given view angles
VectorCopy (r_refdef.vieworg, r_origin);
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
// current viewleaf
r_oldviewleaf = r_viewleaf;
r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel);
V_SetContentsColor (r_viewleaf->contents);
V_CalcBlend ();
r_cache_thrash = false;
//johnfitz -- calculate r_fovx and r_fovy here
r_fovx = r_refdef.fov_x;
r_fovy = r_refdef.fov_y;
if (r_waterwarp.value)
{
int contents = Mod_PointInLeaf (r_origin, cl.worldmodel)->contents;
if (contents == CONTENTS_WATER || contents == CONTENTS_SLIME || contents == CONTENTS_LAVA)
{
//variance is a percentage of width, where width = 2 * tan(fov / 2) otherwise the effect is too dramatic at high FOV and too subtle at low FOV. what a mess!
r_fovx = atan(tan(DEG2RAD(r_refdef.fov_x) / 2) * (0.97 + sin(cl.time * 1.5) * 0.03)) * 2 / M_PI_DIV_180;
r_fovy = atan(tan(DEG2RAD(r_refdef.fov_y) / 2) * (1.03 - sin(cl.time * 1.5) * 0.03)) * 2 / M_PI_DIV_180;
}
}
//johnfitz
R_SetFrustum (r_fovx, r_fovy); //johnfitz -- use r_fov* vars
R_MarkSurfaces (); //johnfitz -- create texture chains from PVS
R_CullSurfaces (); //johnfitz -- do after R_SetFrustum and R_MarkSurfaces
R_UpdateWarpTextures (); //johnfitz -- do this before R_Clear
R_Clear ();
//johnfitz -- cheat-protect some draw modes
r_drawflat_cheatsafe = r_fullbright_cheatsafe = r_lightmap_cheatsafe = false;
r_drawworld_cheatsafe = true;
if (cl.maxclients == 1)
{
if (!r_drawworld.value) r_drawworld_cheatsafe = false;
if (r_drawflat.value) r_drawflat_cheatsafe = true;
else if (r_fullbright.value || !cl.worldmodel->lightdata) r_fullbright_cheatsafe = true;
else if (r_lightmap.value) r_lightmap_cheatsafe = true;
}
//johnfitz
}
//==============================================================================
//
// RENDER VIEW
//
//==============================================================================
/*
=============
R_DrawEntitiesOnList
=============
*/
void R_DrawEntitiesOnList (qboolean alphapass) //johnfitz -- added parameter
{
extern cvar_t r_vfog; //johnfitz
int i;
if (!r_drawentities.value)
return;
//johnfitz -- sprites are not a special case
for (i=0 ; i<cl_numvisedicts ; i++)
{
currententity = cl_visedicts[i];
//johnfitz -- if alphapass is true, draw only alpha entites this time
//if alphapass is false, draw only nonalpha entities this time
if ((ENTALPHA_DECODE(currententity->alpha) < 1 && !alphapass) ||
(ENTALPHA_DECODE(currententity->alpha) == 1 && alphapass))
continue;
//johnfitz -- chasecam
if (currententity == &cl_entities[cl.viewentity])
currententity->angles[0] *= 0.3;
//johnfitz
switch (currententity->model->type)
{
case mod_alias:
R_DrawAliasModel (currententity);
break;
case mod_brush:
R_DrawBrushModel (currententity);
break;
case mod_sprite:
R_DrawSpriteModel (currententity);
break;
}
}
}
/*
=============
R_DrawViewModel -- johnfitz -- gutted
=============
*/
void R_DrawViewModel (void)
{
if (!r_drawviewmodel.value || !r_drawentities.value || chase_active.value || envmap)
return;
if (cl.items & IT_INVISIBILITY || cl.stats[STAT_HEALTH] <= 0)
return;
currententity = &cl.viewent;
if (!currententity->model)
return;
//johnfitz -- this fixes a crash
if (currententity->model->type != mod_alias)
return;
//johnfitz
// hack the depth range to prevent view model from poking into walls
glDepthRange (0, 0.3);
R_DrawAliasModel (currententity);
glDepthRange (0, 1);
}
/*
================
R_EmitWirePoint -- johnfitz -- draws a wireframe cross shape for point entities
================
*/
void R_EmitWirePoint (vec3_t origin)
{
int size=8;
glBegin (GL_LINES);
glVertex3f (origin[0]-size, origin[1], origin[2]);
glVertex3f (origin[0]+size, origin[1], origin[2]);
glVertex3f (origin[0], origin[1]-size, origin[2]);
glVertex3f (origin[0], origin[1]+size, origin[2]);
glVertex3f (origin[0], origin[1], origin[2]-size);
glVertex3f (origin[0], origin[1], origin[2]+size);
glEnd ();
}
/*
================
R_EmitWireBox -- johnfitz -- draws one axis aligned bounding box
================
*/
void R_EmitWireBox (vec3_t mins, vec3_t maxs)
{
glBegin (GL_QUAD_STRIP);
glVertex3f (mins[0], mins[1], mins[2]);
glVertex3f (mins[0], mins[1], maxs[2]);
glVertex3f (maxs[0], mins[1], mins[2]);
glVertex3f (maxs[0], mins[1], maxs[2]);
glVertex3f (maxs[0], maxs[1], mins[2]);
glVertex3f (maxs[0], maxs[1], maxs[2]);
glVertex3f (mins[0], maxs[1], mins[2]);
glVertex3f (mins[0], maxs[1], maxs[2]);
glVertex3f (mins[0], mins[1], mins[2]);
glVertex3f (mins[0], mins[1], maxs[2]);
glEnd ();
}
/*
================
R_ShowBoundingBoxes -- johnfitz
draw bounding boxes -- the server-side boxes, not the renderer cullboxes
================
*/
void R_ShowBoundingBoxes (void)
{
extern edict_t *sv_player;
vec3_t mins,maxs;
edict_t *ed;
int i;
if (!r_showbboxes.value || cl.maxclients > 1 || !r_drawentities.value || !sv.active)
return;
glDisable (GL_DEPTH_TEST);
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
GL_PolygonOffset (OFFSET_SHOWTRIS);
glDisable (GL_TEXTURE_2D);
glDisable (GL_CULL_FACE);
glColor3f (1,1,1);
for (i=0, ed=NEXT_EDICT(sv.edicts) ; i<sv.num_edicts ; i++, ed=NEXT_EDICT(ed))
{
if (ed == sv_player)
continue; //don't draw player's own bbox
// if (r_showbboxes.value != 2)
// if (!SV_VisibleToClient (sv_player, ed, sv.worldmodel))
// continue; //don't draw if not in pvs
if (ed->v.mins[0] == ed->v.maxs[0] && ed->v.mins[1] == ed->v.maxs[1] && ed->v.mins[2] == ed->v.maxs[2])
{
//point entity
R_EmitWirePoint (ed->v.origin);
}
else
{
//box entity
VectorAdd (ed->v.mins, ed->v.origin, mins);
VectorAdd (ed->v.maxs, ed->v.origin, maxs);
R_EmitWireBox (mins, maxs);
}
}
glColor3f (1,1,1);
glEnable (GL_TEXTURE_2D);
glEnable (GL_CULL_FACE);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
GL_PolygonOffset (OFFSET_NONE);
glEnable (GL_DEPTH_TEST);
Sbar_Changed (); //so we don't get dots collecting on the statusbar
}
/*
================
R_ShowTris -- johnfitz
================
*/
void R_ShowTris (void)
{
extern cvar_t r_particles;
int i;
if (r_showtris.value < 1 || r_showtris.value > 2 || cl.maxclients > 1)
return;
if (r_showtris.value == 1)
glDisable (GL_DEPTH_TEST);
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
GL_PolygonOffset (OFFSET_SHOWTRIS);
glDisable (GL_TEXTURE_2D);
glColor3f (1,1,1);
// glEnable (GL_BLEND);
// glBlendFunc (GL_ONE, GL_ONE);
if (r_drawworld.value)
{
R_DrawTextureChains_ShowTris ();
}
if (r_drawentities.value)
{
for (i=0 ; i<cl_numvisedicts ; i++)
{
currententity = cl_visedicts[i];
if (currententity == &cl_entities[cl.viewentity]) // chasecam
currententity->angles[0] *= 0.3;
switch (currententity->model->type)
{
case mod_brush:
R_DrawBrushModel_ShowTris (currententity);
break;
case mod_alias:
R_DrawAliasModel_ShowTris (currententity);
break;
case mod_sprite:
R_DrawSpriteModel (currententity);
break;
default:
break;
}
}
// viewmodel
currententity = &cl.viewent;
if (r_drawviewmodel.value
&& !chase_active.value
&& !envmap
&& cl.stats[STAT_HEALTH] > 0
&& !(cl.items & IT_INVISIBILITY)
&& currententity->model
&& currententity->model->type == mod_alias)
{
glDepthRange (0, 0.3);
R_DrawAliasModel_ShowTris (currententity);
glDepthRange (0, 1);
}
}
if (r_particles.value)
{
R_DrawParticles_ShowTris ();
}
// glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// glDisable (GL_BLEND);
glColor3f (1,1,1);
glEnable (GL_TEXTURE_2D);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
GL_PolygonOffset (OFFSET_NONE);
if (r_showtris.value == 1)
glEnable (GL_DEPTH_TEST);
Sbar_Changed (); //so we don't get dots collecting on the statusbar
}
/*
================
R_DrawShadows
================
*/
void R_DrawShadows (void)
{
int i;
if (!r_shadows.value || !r_drawentities.value || r_drawflat_cheatsafe || r_lightmap_cheatsafe)
return;
for (i=0 ; i<cl_numvisedicts ; i++)
{
currententity = cl_visedicts[i];
if (currententity->model->type != mod_alias)
continue;
if (currententity == &cl.viewent)
return;
GL_DrawAliasShadow (currententity);
}
}
/*
================
R_RenderScene
================
*/
void R_RenderScene (void)
{
R_SetupScene (); //johnfitz -- this does everything that should be done once per call to RenderScene
Fog_EnableGFog (); //johnfitz
Sky_DrawSky (); //johnfitz
R_DrawWorld ();
S_ExtraUpdate (); // don't let sound get messed up if going slow
R_DrawShadows (); //johnfitz -- render entity shadows
R_DrawEntitiesOnList (false); //johnfitz -- false means this is the pass for nonalpha entities
R_DrawTextureChains_Water (); //johnfitz -- drawn here since they might have transparency
R_DrawEntitiesOnList (true); //johnfitz -- true means this is the pass for alpha entities
R_RenderDlights (); //triangle fan dlights -- johnfitz -- moved after water
R_DrawParticles ();
Fog_DisableGFog (); //johnfitz
R_DrawViewModel (); //johnfitz -- moved here from R_RenderView
R_ShowTris (); //johnfitz
R_ShowBoundingBoxes (); //johnfitz
#ifdef GLTEST
Test_Draw ();
#endif
}
/*
================
R_RenderView
================
*/
void R_RenderView (void)
{
double time1, time2;
if (r_norefresh.value)
return;
if (!cl.worldmodel)
Sys_Error ("R_RenderView: NULL worldmodel");
if (r_speeds.value)
{
glFinish ();
time1 = Sys_FloatTime ();
//johnfitz -- rendering statistics
rs_brushpolys = rs_aliaspolys = rs_skypolys = rs_particles = rs_fogpolys = rs_megatexels =
rs_dynamiclightmaps = rs_aliaspasses = rs_skypasses = rs_brushpasses = 0;
}
else if (gl_finish.value)
glFinish ();
R_SetupView (); //johnfitz -- this does everything that should be done once per frame
//johnfitz -- stereo rendering -- full of hacky goodness
if (r_stereo.value)
{
float eyesep = CLAMP(-8.0f, r_stereo.value, 8.0f);
float fdepth = CLAMP(32.0f, r_stereodepth.value, 1024.0f);
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
//render left eye (red)
glColorMask(1, 0, 0, 1);
VectorMA (r_refdef.vieworg, -0.5f * eyesep, vright, r_refdef.vieworg);
frustum_skew = 0.5 * eyesep * NEARCLIP / fdepth;
srand((int) (cl.time * 1000)); //sync random stuff between eyes
R_RenderScene ();
//render right eye (cyan)
glClear (GL_DEPTH_BUFFER_BIT);
glColorMask(0, 1, 1, 1);
VectorMA (r_refdef.vieworg, 1.0f * eyesep, vright, r_refdef.vieworg);
frustum_skew = -frustum_skew;
srand((int) (cl.time * 1000)); //sync random stuff between eyes
R_RenderScene ();
//restore
glColorMask(1, 1, 1, 1);
VectorMA (r_refdef.vieworg, -0.5f * eyesep, vright, r_refdef.vieworg);
frustum_skew = 0.0f;
}
else
{
R_RenderScene ();
}
//johnfitz
//johnfitz -- modified r_speeds output
time2 = Sys_FloatTime ();
if (r_speeds.value == 2)
Con_Printf ("%3i ms %4i/%4i wpoly %4i/%4i epoly %3i lmap %4i/%4i sky %1.1f mtex\n",
(int)((time2-time1)*1000),
rs_brushpolys,
rs_brushpasses,
rs_aliaspolys,
rs_aliaspasses,
rs_dynamiclightmaps,
rs_skypolys,
rs_skypasses,
TexMgr_FrameUsage ());
else if (r_speeds.value)
Con_Printf ("%3i ms %4i wpoly %4i epoly %3i lmap\n",
(int)((time2-time1)*1000),
rs_brushpolys,
rs_aliaspolys,
rs_dynamiclightmaps);
//johnfitz
}

405
quakespasm/Quake/gl_rmisc.c Normal file
View File

@ -0,0 +1,405 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_misc.c
#include "quakedef.h"
//johnfitz -- new cvars
extern cvar_t r_stereo;
extern cvar_t r_stereodepth;
extern cvar_t r_clearcolor;
extern cvar_t r_drawflat;
extern cvar_t r_flatlightstyles;
extern cvar_t gl_fullbrights;
extern cvar_t gl_farclip;
extern cvar_t gl_overbright;
extern cvar_t gl_overbright_models;
extern cvar_t r_waterquality;
extern cvar_t r_oldwater;
extern cvar_t r_waterwarp;
extern cvar_t r_oldskyleaf;
extern cvar_t r_drawworld;
extern cvar_t r_showtris;
extern cvar_t r_showbboxes;
extern cvar_t r_lerpmodels;
extern cvar_t r_lerpmove;
extern cvar_t r_nolerp_list;
//johnfitz
extern float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
extern cvar_t gl_subdivide_size; //johnfitz -- moved here from gl_model.c
extern gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz
void R_NoLerpList_f (void); //johnfitz
/*
====================
GL_Overbright_f -- johnfitz
====================
*/
void GL_Overbright_f (void)
{
R_RebuildAllLightmaps ();
}
/*
====================
GL_Fullbrights_f -- johnfitz
====================
*/
void GL_Fullbrights_f (void)
{
TexMgr_ReloadNobrightImages ();
}
/*
====================
R_SetClearColor_f -- johnfitz
====================
*/
void R_SetClearColor_f (void)
{
byte *rgb;
int s;
s = (int)r_clearcolor.value & 0xFF;
rgb = (byte*)(d_8to24table + s);
glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0);
}
/*
====================
R_Novis_f -- johnfitz
====================
*/
void R_Novis_f (void)
{
extern int vis_changed;
vis_changed = 1;
}
/*
====================
R_OldSkyLeaf_f -- johnfitz
====================
*/
void R_OldSkyLeaf_f (void)
{
extern int vis_changed;
vis_changed = 1;
}
/*
===============
R_Envmap_f
Grab six views for environment mapping tests
===============
*/
void R_Envmap_f (void)
{
byte buffer[256*256*4];
// char name[1024]; unused -- kristian
glDrawBuffer (GL_FRONT);
glReadBuffer (GL_FRONT);
envmap = true;
r_refdef.vrect.x = 0;
r_refdef.vrect.y = 0;
r_refdef.vrect.width = 256;
r_refdef.vrect.height = 256;
r_refdef.viewangles[0] = 0;
r_refdef.viewangles[1] = 0;
r_refdef.viewangles[2] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env0.rgb", buffer, sizeof(buffer));
r_refdef.viewangles[1] = 90;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env1.rgb", buffer, sizeof(buffer));
r_refdef.viewangles[1] = 180;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env2.rgb", buffer, sizeof(buffer));
r_refdef.viewangles[1] = 270;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env3.rgb", buffer, sizeof(buffer));
r_refdef.viewangles[0] = -90;
r_refdef.viewangles[1] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env4.rgb", buffer, sizeof(buffer));
r_refdef.viewangles[0] = 90;
r_refdef.viewangles[1] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env5.rgb", buffer, sizeof(buffer));
envmap = false;
glDrawBuffer (GL_BACK);
glReadBuffer (GL_BACK);
GL_EndRendering ();
}
/*
===============
R_Init
===============
*/
void R_Init (void)
{
// extern byte *hunk_base; unused -- kristian
extern cvar_t gl_finish;
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f);
Cmd_AddCommand ("envmap", R_Envmap_f);
Cmd_AddCommand ("pointfile", R_ReadPointFile_f);
Cvar_RegisterVariable (&r_norefresh, NULL);
Cvar_RegisterVariable (&r_lightmap, NULL);
Cvar_RegisterVariable (&r_fullbright, NULL);
Cvar_RegisterVariable (&r_drawentities, NULL);
Cvar_RegisterVariable (&r_drawviewmodel, NULL);
Cvar_RegisterVariable (&r_shadows, NULL);
Cvar_RegisterVariable (&r_wateralpha, NULL);
Cvar_RegisterVariable (&r_dynamic, NULL);
Cvar_RegisterVariable (&r_novis, R_Novis_f);
Cvar_RegisterVariable (&r_speeds, NULL);
Cvar_RegisterVariable (&gl_finish, NULL);
Cvar_RegisterVariable (&gl_clear, NULL);
Cvar_RegisterVariable (&gl_cull, NULL);
Cvar_RegisterVariable (&gl_smoothmodels, NULL);
Cvar_RegisterVariable (&gl_affinemodels, NULL);
Cvar_RegisterVariable (&gl_polyblend, NULL);
Cvar_RegisterVariable (&gl_flashblend, NULL);
Cvar_RegisterVariable (&gl_playermip, NULL);
Cvar_RegisterVariable (&gl_nocolors, NULL);
//johnfitz -- new cvars
Cvar_RegisterVariable (&r_stereo, NULL);
Cvar_RegisterVariable (&r_stereodepth, NULL);
Cvar_RegisterVariable (&r_clearcolor, R_SetClearColor_f);
Cvar_RegisterVariable (&r_waterquality, NULL);
Cvar_RegisterVariable (&r_oldwater, NULL);
Cvar_RegisterVariable (&r_waterwarp, NULL);
Cvar_RegisterVariable (&r_drawflat, NULL);
Cvar_RegisterVariable (&r_flatlightstyles, NULL);
Cvar_RegisterVariable (&r_oldskyleaf, R_OldSkyLeaf_f);
Cvar_RegisterVariable (&r_drawworld, NULL);
Cvar_RegisterVariable (&r_showtris, NULL);
Cvar_RegisterVariable (&r_showbboxes, NULL);
Cvar_RegisterVariable (&gl_farclip, NULL);
Cvar_RegisterVariable (&gl_fullbrights, GL_Fullbrights_f);
Cvar_RegisterVariable (&gl_overbright, GL_Overbright_f);
Cvar_RegisterVariable (&gl_overbright_models, NULL);
Cvar_RegisterVariable (&r_lerpmodels, NULL);
Cvar_RegisterVariable (&r_lerpmove, NULL);
Cvar_RegisterVariable (&r_nolerp_list, R_NoLerpList_f);
//johnfitz
Cvar_RegisterVariable (&gl_subdivide_size, NULL); //johnfitz -- moved here from gl_model.c
R_InitParticles ();
R_SetClearColor_f (); //johnfitz
Sky_Init (); //johnfitz
Fog_Init (); //johnfitz
#ifdef GLTEST
Test_Init ();
#endif
}
/*
===============
R_NoLerpList_f -- johnfitz -- called when r_nolerp_list cvar changes
===============
*/
void R_NoLerpList_f (void)
{
int i;
for (i=0; i < MAX_MODELS; i++)
Mod_SetExtraFlags (cl.model_precache[i]);
}
/*
===============
R_TranslatePlayerSkin -- johnfitz -- rewritten. also, only handles new colors, not new skins
===============
*/
void R_TranslatePlayerSkin (int playernum)
{
int top, bottom;
top = (cl.scores[playernum].colors & 0xf0)>>4;
bottom = cl.scores[playernum].colors &15;
//FIXME: if gl_nocolors is on, then turned off, the textures may be out of sync with the scoreboard colors.
if (!gl_nocolors.value)
if (playertextures[playernum])
TexMgr_ReloadImage (playertextures[playernum], top, bottom);
}
/*
===============
R_TranslateNewPlayerSkin -- johnfitz -- split off of TranslatePlayerSkin -- this is called when
the skin or model actually changes, instead of just new colors
added bug fix from bengt jardup
===============
*/
void R_TranslateNewPlayerSkin (int playernum)
{
char name[64];
byte *pixels;
aliashdr_t *paliashdr;
int skinnum;
//get correct texture pixels
currententity = &cl_entities[1+playernum];
if (!currententity->model || currententity->model->type != mod_alias)
return;
paliashdr = (aliashdr_t *)Mod_Extradata (currententity->model);
skinnum = currententity->skinnum;
//TODO: move these tests to the place where skinnum gets received from the server
if (skinnum < 0 || skinnum >= paliashdr->numskins)
{
Con_DPrintf("(%d): Invalid player skin #%d\n", playernum, skinnum);
skinnum = 0;
}
pixels = (byte *)paliashdr + paliashdr->texels[skinnum]; // This is not a persistent place!
//upload new image
sprintf(name, "player_%i", playernum);
playertextures[playernum] = TexMgr_LoadImage (currententity->model, name, paliashdr->skinwidth, paliashdr->skinheight,
SRC_INDEXED, pixels, paliashdr->gltextures[skinnum][0]->source_file, paliashdr->gltextures[skinnum][0]->source_offset, TEXPREF_PAD | TEXPREF_OVERWRITE);
//now recolor it
R_TranslatePlayerSkin (playernum);
}
/*
===============
R_NewGame -- johnfitz -- handle a game switch
===============
*/
void R_NewGame (void)
{
int i;
//clear playertexture pointers (the textures themselves were freed by texmgr_newgame)
for (i=0; i<MAX_SCOREBOARD; i++)
playertextures[i] = NULL;
}
/*
===============
R_NewMap
===============
*/
void R_NewMap (void)
{
int i;
for (i=0 ; i<256 ; i++)
d_lightstylevalue[i] = 264; // normal light value
// clear out efrags in case the level hasn't been reloaded
// FIXME: is this one short?
for (i=0 ; i<cl.worldmodel->numleafs ; i++)
cl.worldmodel->leafs[i].efrags = NULL;
r_viewleaf = NULL;
R_ClearParticles ();
GL_BuildLightmaps ();
r_framecount = 0; //johnfitz -- paranoid?
r_visframecount = 0; //johnfitz -- paranoid?
Sky_NewMap (); //johnfitz -- skybox in worldspawn
Fog_NewMap (); //johnfitz -- global fog in worldspawn
load_subdivide_size = gl_subdivide_size.value; //johnfitz -- is this the right place to set this?
}
/*
====================
R_TimeRefresh_f
For program optimization
====================
*/
void R_TimeRefresh_f (void)
{
int i;
float start, stop, time;
/* unused -- kristian
int startangle;
vrect_t vr;
*/
glDrawBuffer (GL_FRONT);
glFinish ();
start = Sys_FloatTime ();
for (i=0 ; i<128 ; i++)
{
r_refdef.viewangles[1] = i/128.0*360.0;
R_RenderView ();
}
glFinish ();
stop = Sys_FloatTime ();
time = stop-start;
Con_Printf ("%f seconds (%f fps)\n", time, 128/time);
glDrawBuffer (GL_BACK);
GL_EndRendering ();
}
void D_FlushCaches (void)
{
}

1071
quakespasm/Quake/gl_screen.c Normal file

File diff suppressed because it is too large Load Diff

1017
quakespasm/Quake/gl_sky.c Normal file

File diff suppressed because it is too large Load Diff

183
quakespasm/Quake/gl_test.c Normal file
View File

@ -0,0 +1,183 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#ifdef GLTEST
typedef struct
{
plane_t *plane;
vec3_t origin;
vec3_t normal;
vec3_t up;
vec3_t right;
vec3_t reflect;
float length;
} puff_t;
#define MAX_PUFFS 64
puff_t puffs[MAX_PUFFS];
void Test_Init (void)
{
}
plane_t junk;
plane_t *HitPlane (vec3_t start, vec3_t end)
{
trace_t trace;
// fill in a default trace
memset (&trace, 0, sizeof(trace_t));
trace.fraction = 1;
trace.allsolid = true;
VectorCopy (end, trace.endpos);
SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
junk = trace.plane;
return &junk;
}
void Test_Spawn (vec3_t origin)
{
int i;
puff_t *p;
vec3_t temp;
vec3_t normal;
vec3_t incoming;
plane_t *plane;
float d;
for (i=0,p=puffs ; i<MAX_PUFFS ; i++,p++)
{
if (p->length <= 0)
break;
}
if (i == MAX_PUFFS)
return;
VectorSubtract (r_refdef.vieworg, origin, incoming);
VectorSubtract (origin, incoming, temp);
plane = HitPlane (r_refdef.vieworg, temp);
VectorNormalize (incoming);
d = DotProduct (incoming, plane->normal);
VectorSubtract (vec3_origin, incoming, p->reflect);
VectorMA (p->reflect, d*2, plane->normal, p->reflect);
VectorCopy (origin, p->origin);
VectorCopy (plane->normal, p->normal);
CrossProduct (incoming, p->normal, p->up);
CrossProduct (p->up, p->normal, p->right);
p->length = 8;
}
void DrawPuff (puff_t *p)
{
vec3_t pts[2][3];
int i, j;
float s, d;
for (i=0 ; i<2 ; i++)
{
if (i == 1)
{
s = 6;
d = p->length;
}
else
{
s = 2;
d = 0;
}
for (j=0 ; j<3 ; j++)
{
pts[i][0][j] = p->origin[j] + p->up[j]*s + p->reflect[j]*d;
pts[i][1][j] = p->origin[j] + p->right[j]*s + p->reflect[j]*d;
pts[i][2][j] = p->origin[j] + -p->right[j]*s + p->reflect[j]*d;
}
}
glColor3f (1, 0, 0);
#if 0
glBegin (GL_LINES);
glVertex3fv (p->origin);
glVertex3f (p->origin[0] + p->length*p->reflect[0],
p->origin[1] + p->length*p->reflect[1],
p->origin[2] + p->length*p->reflect[2]);
glVertex3fv (pts[0][0]);
glVertex3fv (pts[1][0]);
glVertex3fv (pts[0][1]);
glVertex3fv (pts[1][1]);
glVertex3fv (pts[0][2]);
glVertex3fv (pts[1][2]);
glEnd ();
#endif
glBegin (GL_QUADS);
for (i=0 ; i<3 ; i++)
{
j = (i+1)%3;
glVertex3fv (pts[0][j]);
glVertex3fv (pts[1][j]);
glVertex3fv (pts[1][i]);
glVertex3fv (pts[0][i]);
}
glEnd ();
glBegin (GL_TRIANGLES);
glVertex3fv (pts[1][0]);
glVertex3fv (pts[1][1]);
glVertex3fv (pts[1][2]);
glEnd ();
p->length -= host_frametime*2;
}
void Test_Draw (void)
{
int i;
puff_t *p;
for (i=0, p=puffs ; i<MAX_PUFFS ; i++,p++)
{
if (p->length > 0)
DrawPuff (p);
}
}
#endif

1415
quakespasm/Quake/gl_texmgr.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//gl_texmgr.h -- fitzquake's texture manager. manages opengl texture images
#define TEXPREF_NONE 0x0000
#define TEXPREF_MIPMAP 0x0001 // generate mipmaps
#define TEXPREF_LINEAR 0x0002 // force linear
#define TEXPREF_NEAREST 0x0004 // force nearest
#define TEXPREF_ALPHA 0x0008 // allow alpha
#define TEXPREF_PAD 0x0010 // allow padding
#define TEXPREF_PERSIST 0x0020 // never free
#define TEXPREF_OVERWRITE 0x0040 // overwrite existing same-name texture
#define TEXPREF_NOPICMIP 0x0080 // always load full-sized
#define TEXPREF_FULLBRIGHT 0x0100 // use fullbright mask palette
#define TEXPREF_NOBRIGHT 0x0200 // use nobright mask palette
#define TEXPREF_CONCHARS 0x0400 // use conchars palette
#define TEXPREF_WARPIMAGE 0x0800 // resize this texture when warpimagesize changes
enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA};
typedef struct gltexture_s {
//managed by texture manager
unsigned int texnum;
struct gltexture_s *next;
model_t *owner;
//managed by image loading
char name[64];
unsigned int width; //size of image as it exists in opengl
unsigned int height; //size of image as it exists in opengl
unsigned int flags;
char source_file[MAX_QPATH]; //relative filepath to data source, or "" if source is in memory
unsigned int source_offset; //byte offset into file, or memory address
enum srcformat source_format; //format of pixel data (indexed, lightmap, or rgba)
unsigned int source_width; //size of image in source data
unsigned int source_height; //size of image in source data
unsigned short source_crc; //generated by source data before modifications
char shirt; //0-13 shirt color, or -1 if never colormapped
char pants; //0-13 pants color, or -1 if never colormapped
//used for rendering
int visframe; //matches r_framecount if texture was bound this frame
} gltexture_t;
gltexture_t *notexture;
gltexture_t *nulltexture;
unsigned int d_8to24table[256];
unsigned int d_8to24table_fbright[256];
unsigned int d_8to24table_nobright[256];
unsigned int d_8to24table_conchars[256];
unsigned int d_8to24table_shirt[256];
unsigned int d_8to24table_pants[256];
// TEXTURE MANAGER
float TexMgr_FrameUsage (void);
gltexture_t *TexMgr_FindTexture (model_t *owner, char *name);
gltexture_t *TexMgr_NewTexture (void);
void TexMgr_FreeTexture (gltexture_t *kill);
void TexMgr_FreeTextures (int flags, int mask);
void TexMgr_FreeTexturesForOwner (model_t *owner);
void TexMgr_NewGame (void);
void TexMgr_Init (void);
// IMAGE LOADING
gltexture_t *TexMgr_LoadImage (model_t *owner, char *name, int width, int height, enum srcformat format,
byte *data, char *source_file, unsigned source_offset, unsigned flags);
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants);
void TexMgr_ReloadImages (void);
void TexMgr_ReloadNobrightImages (void);
int TexMgr_Pad(int s);
int TexMgr_SafeTextureSize (int s);
int TexMgr_PadConditional (int s);
// TEXTURE BINDING & TEXTURE UNIT SWITCHING
extern qboolean gl_mtexable;
void GL_DisableMultitexture (void); //selects texture unit 0
void GL_EnableMultitexture (void); //selects texture unit 1
void GL_Bind (gltexture_t *texture);

2856
quakespasm/Quake/gl_vidnt.c Normal file

File diff suppressed because it is too large Load Diff

1852
quakespasm/Quake/gl_vidsdl.c Normal file

File diff suppressed because it is too large Load Diff

267
quakespasm/Quake/gl_warp.c Normal file
View File

@ -0,0 +1,267 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//gl_warp.c -- warping animation support
#include "quakedef.h"
extern cvar_t r_drawflat;
cvar_t r_oldwater = {"r_oldwater", "1"};
cvar_t r_waterquality = {"r_waterquality", "8"};
cvar_t r_waterwarp = {"r_waterwarp", "1"};
float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
float turbsin[] =
{
#include "gl_warp_sin.h"
};
#define WARPCALC(s,t) ((s + turbsin[(int)((t*2)+(cl.time*(128.0/M_PI))) & 255]) * (1.0/64)) //johnfitz -- correct warp
#define WARPCALC2(s,t) ((s + turbsin[(int)((t*0.125+cl.time)*(128.0/M_PI)) & 255]) * (1.0/64)) //johnfitz -- old warp
//==============================================================================
//
// OLD-STYLE WATER
//
//==============================================================================
extern model_t *loadmodel;
msurface_t *warpface;
cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", true};
void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
{
int i, j;
float *v;
mins[0] = mins[1] = mins[2] = 9999;
maxs[0] = maxs[1] = maxs[2] = -9999;
v = verts;
for (i=0 ; i<numverts ; i++)
for (j=0 ; j<3 ; j++, v++)
{
if (*v < mins[j])
mins[j] = *v;
if (*v > maxs[j])
maxs[j] = *v;
}
}
void SubdividePolygon (int numverts, float *verts)
{
int i, j, k;
vec3_t mins, maxs;
float m;
float *v;
vec3_t front[64], back[64];
int f, b;
float dist[64];
float frac;
glpoly_t *poly;
float s, t;
if (numverts > 60)
Sys_Error ("numverts = %i", numverts);
BoundPoly (numverts, verts, mins, maxs);
for (i=0 ; i<3 ; i++)
{
m = (mins[i] + maxs[i]) * 0.5;
m = gl_subdivide_size.value * floor (m/gl_subdivide_size.value + 0.5);
if (maxs[i] - m < 8)
continue;
if (m - mins[i] < 8)
continue;
// cut it
v = verts + i;
for (j=0 ; j<numverts ; j++, v+= 3)
dist[j] = *v - m;
// wrap cases
dist[j] = dist[0];
v-=i;
VectorCopy (verts, v);
f = b = 0;
v = verts;
for (j=0 ; j<numverts ; j++, v+= 3)
{
if (dist[j] >= 0)
{
VectorCopy (v, front[f]);
f++;
}
if (dist[j] <= 0)
{
VectorCopy (v, back[b]);
b++;
}
if (dist[j] == 0 || dist[j+1] == 0)
continue;
if ( (dist[j] > 0) != (dist[j+1] > 0) )
{
// clip point
frac = dist[j] / (dist[j] - dist[j+1]);
for (k=0 ; k<3 ; k++)
front[f][k] = back[b][k] = v[k] + frac*(v[3+k] - v[k]);
f++;
b++;
}
}
SubdividePolygon (f, front[0]);
SubdividePolygon (b, back[0]);
return;
}
poly = Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float));
poly->next = warpface->polys->next;
warpface->polys->next = poly;
poly->numverts = numverts;
for (i=0 ; i<numverts ; i++, verts+= 3)
{
VectorCopy (verts, poly->verts[i]);
s = DotProduct (verts, warpface->texinfo->vecs[0]);
t = DotProduct (verts, warpface->texinfo->vecs[1]);
poly->verts[i][3] = s;
poly->verts[i][4] = t;
}
}
/*
================
GL_SubdivideSurface
================
*/
void GL_SubdivideSurface (msurface_t *fa)
{
vec3_t verts[64];
int i;
warpface = fa;
//the first poly in the chain is the undivided poly for newwater rendering.
//grab the verts from that.
for (i=0; i<fa->polys->numverts; i++)
VectorCopy (fa->polys->verts[i], verts[i]);
SubdividePolygon (fa->polys->numverts, verts[0]);
}
/*
================
DrawWaterPoly -- johnfitz
================
*/
void DrawWaterPoly (glpoly_t *p)
{
float *v;
int i;
if (load_subdivide_size > 48)
{
glBegin (GL_POLYGON);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
glTexCoord2f (WARPCALC2(v[3],v[4]), WARPCALC2(v[4],v[3]));
glVertex3fv (v);
}
glEnd ();
}
else
{
glBegin (GL_POLYGON);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
glTexCoord2f (WARPCALC(v[3],v[4]), WARPCALC(v[4],v[3]));
glVertex3fv (v);
}
glEnd ();
}
}
//==============================================================================
//
// RENDER-TO-FRAMEBUFFER WATER
//
//==============================================================================
/*
=============
R_UpdateWarpTextures -- johnfitz -- each frame, update warping textures
=============
*/
void R_UpdateWarpTextures (void)
{
texture_t *tx;
int i;
float x, y, x2, warptess;
if (r_oldwater.value || cl.paused || r_drawflat_cheatsafe || r_lightmap_cheatsafe)
return;
warptess = 128.0/CLAMP (3.0, floor(r_waterquality.value), 64.0);
for (i=0; i<cl.worldmodel->numtextures; i++)
{
if (!(tx = cl.worldmodel->textures[i]))
continue;
if (!tx->update_warp)
continue;
//render warp
GL_SetCanvas (CANVAS_WARPIMAGE);
GL_Bind (tx->gltexture);
for (x=0.0; x<128.0; x=x2)
{
x2 = x + warptess;
glBegin (GL_TRIANGLE_STRIP);
for (y=0.0; y<128.01; y+=warptess) // .01 for rounding errors
{
glTexCoord2f (WARPCALC(x,y), WARPCALC(y,x));
glVertex2f (x,y);
glTexCoord2f (WARPCALC(x2,y), WARPCALC(y,x2));
glVertex2f (x2,y);
}
glEnd();
}
//copy to texture
GL_Bind (tx->warpimage);
glCopyTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, glx, gly+glheight-gl_warpimagesize, gl_warpimagesize, gl_warpimagesize);
tx->update_warp = false;
}
//if warp render went down into sbar territory, we need to be sure to refresh it next frame
if (gl_warpimagesize + sb_lines > glheight)
Sbar_Changed ();
//if viewsize is less than 100, we need to redraw the frame around the viewport
scr_tileclear_updates = 0;
}

View File

@ -0,0 +1,52 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
0, 0.19633, 0.392541, 0.588517, 0.784137, 0.979285, 1.17384, 1.3677,
1.56072, 1.75281, 1.94384, 2.1337, 2.32228, 2.50945, 2.69512, 2.87916,
3.06147, 3.24193, 3.42044, 3.59689, 3.77117, 3.94319, 4.11282, 4.27998,
4.44456, 4.60647, 4.76559, 4.92185, 5.07515, 5.22538, 5.37247, 5.51632,
5.65685, 5.79398, 5.92761, 6.05767, 6.18408, 6.30677, 6.42566, 6.54068,
6.65176, 6.75883, 6.86183, 6.9607, 7.05537, 7.14579, 7.23191, 7.31368,
7.39104, 7.46394, 7.53235, 7.59623, 7.65552, 7.71021, 7.76025, 7.80562,
7.84628, 7.88222, 7.91341, 7.93984, 7.96148, 7.97832, 7.99036, 7.99759,
8, 7.99759, 7.99036, 7.97832, 7.96148, 7.93984, 7.91341, 7.88222,
7.84628, 7.80562, 7.76025, 7.71021, 7.65552, 7.59623, 7.53235, 7.46394,
7.39104, 7.31368, 7.23191, 7.14579, 7.05537, 6.9607, 6.86183, 6.75883,
6.65176, 6.54068, 6.42566, 6.30677, 6.18408, 6.05767, 5.92761, 5.79398,
5.65685, 5.51632, 5.37247, 5.22538, 5.07515, 4.92185, 4.76559, 4.60647,
4.44456, 4.27998, 4.11282, 3.94319, 3.77117, 3.59689, 3.42044, 3.24193,
3.06147, 2.87916, 2.69512, 2.50945, 2.32228, 2.1337, 1.94384, 1.75281,
1.56072, 1.3677, 1.17384, 0.979285, 0.784137, 0.588517, 0.392541, 0.19633,
9.79717e-16, -0.19633, -0.392541, -0.588517, -0.784137, -0.979285, -1.17384, -1.3677,
-1.56072, -1.75281, -1.94384, -2.1337, -2.32228, -2.50945, -2.69512, -2.87916,
-3.06147, -3.24193, -3.42044, -3.59689, -3.77117, -3.94319, -4.11282, -4.27998,
-4.44456, -4.60647, -4.76559, -4.92185, -5.07515, -5.22538, -5.37247, -5.51632,
-5.65685, -5.79398, -5.92761, -6.05767, -6.18408, -6.30677, -6.42566, -6.54068,
-6.65176, -6.75883, -6.86183, -6.9607, -7.05537, -7.14579, -7.23191, -7.31368,
-7.39104, -7.46394, -7.53235, -7.59623, -7.65552, -7.71021, -7.76025, -7.80562,
-7.84628, -7.88222, -7.91341, -7.93984, -7.96148, -7.97832, -7.99036, -7.99759,
-8, -7.99759, -7.99036, -7.97832, -7.96148, -7.93984, -7.91341, -7.88222,
-7.84628, -7.80562, -7.76025, -7.71021, -7.65552, -7.59623, -7.53235, -7.46394,
-7.39104, -7.31368, -7.23191, -7.14579, -7.05537, -6.9607, -6.86183, -6.75883,
-6.65176, -6.54068, -6.42566, -6.30677, -6.18408, -6.05767, -5.92761, -5.79398,
-5.65685, -5.51632, -5.37247, -5.22538, -5.07515, -4.92185, -4.76559, -4.60647,
-4.44456, -4.27998, -4.11282, -3.94319, -3.77117, -3.59689, -3.42044, -3.24193,
-3.06147, -2.87916, -2.69512, -2.50945, -2.32228, -2.1337, -1.94384, -1.75281,
-1.56072, -1.3677, -1.17384, -0.979285, -0.784137, -0.588517, -0.392541, -0.19633,

274
quakespasm/Quake/glquake.h Normal file
View File

@ -0,0 +1,274 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// disable data conversion warnings
void GL_BeginRendering (int *x, int *y, int *width, int *height);
void GL_EndRendering (void);
//johnfitz -- removed texture object stuff since they are standard in gl 1.1
typedef struct
{
float x, y, z;
float s, t;
float r, g, b;
} glvert_t;
extern glvert_t glv;
extern int glx, gly, glwidth, glheight;
// r_local.h -- private refresh defs
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
// normalizing factor so player model works out to about
// 1 pixel per triangle
#define MAX_LBM_HEIGHT 480
#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
#define SKYSHIFT 7
#define SKYSIZE (1 << SKYSHIFT)
#define SKYMASK (SKYSIZE - 1)
#define BACKFACE_EPSILON 0.01
void R_TimeRefresh_f (void);
void R_ReadPointFile_f (void);
texture_t *R_TextureAnimation (texture_t *base, int frame);
typedef struct surfcache_s
{
struct surfcache_s *next;
struct surfcache_s **owner; // NULL is an empty chunk of memory
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
int dlight;
int size; // including header
unsigned width;
unsigned height; // DEBUG only needed for debug
float mipscale;
struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements
} surfcache_t;
typedef struct
{
pixel_t *surfdat; // destination for generated surface
int rowbytes; // destination logical width in bytes
msurface_t *surf; // description for surface to generate
fixed8_t lightadj[MAXLIGHTMAPS];
// adjust for lightmap levels for dynamic lighting
texture_t *texture; // corrected for animating textures
int surfmip; // mipmapped ratio of surface texels / world pixels
int surfwidth; // in mipmapped texels
int surfheight; // in mipmapped texels
} drawsurf_t;
typedef enum {
pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
} ptype_t;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
// driver-usable fields
vec3_t org;
float color;
// drivers never touch the following fields
struct particle_s *next;
vec3_t vel;
float ramp;
float die;
ptype_t type;
} particle_t;
//====================================================
extern qboolean r_cache_thrash; // compatability
extern vec3_t modelorg, r_entorigin;
extern entity_t *currententity;
extern int r_visframecount; // ??? what difs?
extern int r_framecount;
extern mplane_t frustum[4];
//
// view origin
//
extern vec3_t vup;
extern vec3_t vpn;
extern vec3_t vright;
extern vec3_t r_origin;
//
// screen size info
//
extern refdef_t r_refdef;
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
extern qboolean envmap;
extern cvar_t r_norefresh;
extern cvar_t r_drawentities;
extern cvar_t r_drawworld;
extern cvar_t r_drawviewmodel;
extern cvar_t r_speeds;
extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
extern cvar_t r_lightmap;
extern cvar_t r_shadows;
extern cvar_t r_wateralpha;
extern cvar_t r_dynamic;
extern cvar_t r_novis;
extern cvar_t gl_clear;
extern cvar_t gl_cull;
extern cvar_t gl_smoothmodels;
extern cvar_t gl_affinemodels;
extern cvar_t gl_polyblend;
extern cvar_t gl_flashblend;
extern cvar_t gl_nocolors;
extern cvar_t gl_max_size;
extern cvar_t gl_playermip;
extern float r_world_matrix[16];
extern const char *gl_vendor;
extern const char *gl_renderer;
extern const char *gl_version;
extern const char *gl_extensions;
void R_TranslatePlayerSkin (int playernum);
void R_TranslateNewPlayerSkin (int playernum); //johnfitz -- this handles cases when the actual texture changes
// Multitexture
#define TEXTURE0_SGIS 0x835E
#define TEXTURE1_SGIS 0x835F
//#define APIENTRY /* */
//johnfitz -- modified multitexture support
/*
typedef void (APIENTRY *SELECTTEXFUNC) (GLenum);
typedef void (APIENTRY *MTEXCOORDFUNC) (GLenum, GLfloat, GLfloat);
extern MTEXCOORDFUNC GL_MTexCoord2fFunc;
extern SELECTTEXFUNC GL_SelectTextureFunc;
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
*/
//johnfitz
extern PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc;
extern PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc;
extern GLenum TEXTURE0, TEXTURE1;
//johnfitz -- anisotropic filtering
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
//johnfitz
//johnfitz -- polygon offset
#define OFFSET_BMODEL 1
#define OFFSET_NONE 0
#define OFFSET_DECAL -1
#define OFFSET_FOG -2
#define OFFSET_SHOWTRIS -3
void GL_PolygonOffset (int);
//johnfitz
//johnfitz -- GL_EXT_texture_env_combine
//the values for GL_ARB_ are identical
#define GL_COMBINE_EXT 0x8570
#define GL_COMBINE_RGB_EXT 0x8571
#define GL_COMBINE_ALPHA_EXT 0x8572
#define GL_RGB_SCALE_EXT 0x8573
#define GL_CONSTANT_EXT 0x8576
#define GL_PRIMARY_COLOR_EXT 0x8577
#define GL_PREVIOUS_EXT 0x8578
#define GL_SOURCE0_RGB_EXT 0x8580
#define GL_SOURCE1_RGB_EXT 0x8581
#define GL_SOURCE0_ALPHA_EXT 0x8588
#define GL_SOURCE1_ALPHA_EXT 0x8589
extern qboolean gl_texture_env_combine;
//johnfitz
extern qboolean gl_texture_env_add; //johnfitz -- for GL_EXT_texture_env_add
extern qboolean isIntelVideo; //johnfitz -- intel video workarounds from Baker
//johnfitz -- rendering statistics
extern int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
extern int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
extern float rs_megatexels;
//johnfitz
//johnfitz -- track developer statistics that vary every frame
extern cvar_t devstats;
typedef struct {
int packetsize;
int edicts;
int visedicts;
int efrags;
int tempents;
int beams;
int dlights;
} devstats_t;
devstats_t dev_stats, dev_peakstats;
//johnfitz
//ohnfitz -- reduce overflow warning spam
typedef struct {
double packetsize;
double efrags;
double beams;
} overflowtimes_t;
overflowtimes_t dev_overflows; //this stores the last time overflow messages were displayed, not the last time overflows occured
#define CONSOLE_RESPAM_TIME 3 // seconds between repeated warning messages
//johnfitz
//johnfitz -- moved here from r_brush.c
#define MAX_LIGHTMAPS 256 //johnfitz -- was 64
gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array
//johnfitz
int gl_warpimagesize; //johnfitz -- for water warp
qboolean r_drawflat_cheatsafe, r_fullbright_cheatsafe, r_lightmap_cheatsafe, r_drawworld_cheatsafe; //johnfitz
//johnfitz -- fog functions called from outside gl_fog.c
void Fog_ParseServerMessage (void);
float *Fog_GetColor (void);
float Fog_GetDensity (void);
void Fog_EnableGFog (void);
void Fog_DisableGFog (void);
void Fog_StartAdditive (void);
void Fog_StopAdditive (void);
void Fog_SetupFrame (void);
void Fog_NewMap (void);
void Fog_Init (void);
//johnfitz

899
quakespasm/Quake/host.c Normal file
View File

@ -0,0 +1,899 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// host.c -- coordinates spawning and killing of local servers
#include "quakedef.h"
/*
A server can allways be started, even if the system started out as a client
to a remote system.
A client can NOT be started if the system started as a dedicated server.
Memory is cleared / released when a server or client begins, not when they end.
*/
quakeparms_t host_parms;
qboolean host_initialized; // true if into command execution
double host_frametime;
double host_time;
double realtime; // without any filtering or bounding
double oldrealtime; // last frame run
int host_framecount;
int host_hunklevel;
int minimum_memory;
client_t *host_client; // current client
jmp_buf host_abortserver;
byte *host_colormap;
cvar_t host_framerate = {"host_framerate","0"}; // set for slow motion
cvar_t host_speeds = {"host_speeds","0"}; // set for running times
cvar_t host_maxfps = {"host_maxfps", "72", true}; //johnfitz
cvar_t host_timescale = {"host_timescale", "0"}; //johnfitz
cvar_t max_edicts = {"max_edicts", "1024", true}; //johnfitz
cvar_t sys_ticrate = {"sys_ticrate","0.05"}; // dedicated server
cvar_t serverprofile = {"serverprofile","0"};
cvar_t fraglimit = {"fraglimit","0",false,true};
cvar_t timelimit = {"timelimit","0",false,true};
cvar_t teamplay = {"teamplay","0",false,true};
cvar_t samelevel = {"samelevel","0"};
cvar_t noexit = {"noexit","0",false,true};
cvar_t skill = {"skill","1"}; // 0 - 3
cvar_t deathmatch = {"deathmatch","0"}; // 0, 1, or 2
cvar_t coop = {"coop","0"}; // 0 or 1
cvar_t pausable = {"pausable","1"};
cvar_t developer = {"developer","0"};
cvar_t temp1 = {"temp1","0"};
cvar_t devstats = {"devstats","0"}; //johnfitz -- track developer statistics that vary every frame
/*
================
Max_Edicts_f -- johnfitz
================
*/
void Max_Edicts_f (void)
{
static float oldval = 1024; //must match the default value for max_edicts
//TODO: clamp it here?
if (max_edicts.value == oldval)
return;
if (cls.state == ca_connected || sv.active)
Con_Printf ("Changes to max_edicts will not take effect until the next time a map is loaded.\n");
oldval = max_edicts.value;
}
/*
================
Host_EndGame
================
*/
void Host_EndGame (char *message, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,message);
vsprintf (string,message,argptr);
va_end (argptr);
Con_DPrintf ("Host_EndGame: %s\n",string);
if (sv.active)
Host_ShutdownServer (false);
if (cls.state == ca_dedicated)
Sys_Error ("Host_EndGame: %s\n",string); // dedicated servers exit
if (cls.demonum != -1)
CL_NextDemo ();
else
CL_Disconnect ();
longjmp (host_abortserver, 1);
}
/*
================
Host_Error
This shuts down both the client and server
================
*/
void Host_Error (char *error, ...)
{
va_list argptr;
char string[1024];
static qboolean inerror = false;
if (inerror)
Sys_Error ("Host_Error: recursively entered");
inerror = true;
SCR_EndLoadingPlaque (); // reenable screen updates
va_start (argptr,error);
vsprintf (string,error,argptr);
va_end (argptr);
Con_Printf ("Host_Error: %s\n",string);
if (sv.active)
Host_ShutdownServer (false);
if (cls.state == ca_dedicated)
Sys_Error ("Host_Error: %s\n",string); // dedicated servers exit
CL_Disconnect ();
cls.demonum = -1;
cl.intermission = 0; //johnfitz -- for errors during intermissions (changelevel with no map found, etc.)
inerror = false;
longjmp (host_abortserver, 1);
}
/*
================
Host_FindMaxClients
================
*/
void Host_FindMaxClients (void)
{
int i;
svs.maxclients = 1;
i = COM_CheckParm ("-dedicated");
if (i)
{
cls.state = ca_dedicated;
if (i != (com_argc - 1))
{
svs.maxclients = Q_atoi (com_argv[i+1]);
}
else
svs.maxclients = 8;
}
else
cls.state = ca_disconnected;
i = COM_CheckParm ("-listen");
if (i)
{
if (cls.state == ca_dedicated)
Sys_Error ("Only one of -dedicated or -listen can be specified");
if (i != (com_argc - 1))
svs.maxclients = Q_atoi (com_argv[i+1]);
else
svs.maxclients = 8;
}
if (svs.maxclients < 1)
svs.maxclients = 8;
else if (svs.maxclients > MAX_SCOREBOARD)
svs.maxclients = MAX_SCOREBOARD;
svs.maxclientslimit = svs.maxclients;
if (svs.maxclientslimit < 4)
svs.maxclientslimit = 4;
svs.clients = Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients");
if (svs.maxclients > 1)
Cvar_SetValue ("deathmatch", 1.0);
else
Cvar_SetValue ("deathmatch", 0.0);
}
/*
=======================
Host_InitLocal
======================
*/
void Host_InitLocal (void)
{
Host_InitCommands ();
Cvar_RegisterVariable (&host_framerate, NULL);
Cvar_RegisterVariable (&host_speeds, NULL);
Cvar_RegisterVariable (&host_maxfps, NULL); //johnfitz
Cvar_RegisterVariable (&host_timescale, NULL); //johnfitz
Cvar_RegisterVariable (&max_edicts, Max_Edicts_f); //johnfitz
Cvar_RegisterVariable (&devstats, NULL); //johnfitz
Cvar_RegisterVariable (&sys_ticrate, NULL);
Cvar_RegisterVariable (&serverprofile, NULL);
Cvar_RegisterVariable (&fraglimit, NULL);
Cvar_RegisterVariable (&timelimit, NULL);
Cvar_RegisterVariable (&teamplay, NULL);
Cvar_RegisterVariable (&samelevel, NULL);
Cvar_RegisterVariable (&noexit, NULL);
Cvar_RegisterVariable (&skill, NULL);
Cvar_RegisterVariable (&developer, NULL);
Cvar_RegisterVariable (&deathmatch, NULL);
Cvar_RegisterVariable (&coop, NULL);
Cvar_RegisterVariable (&pausable, NULL);
Cvar_RegisterVariable (&temp1, NULL);
Host_FindMaxClients ();
host_time = 1.0; // so a think at time 0 won't get called
}
/*
===============
Host_WriteConfiguration
Writes key bindings and archived cvars to config.cfg
===============
*/
void Host_WriteConfiguration (void)
{
FILE *f;
// dedicated servers initialize the host but don't parse and set the
// config.cfg cvars
if (host_initialized & !isDedicated)
{
f = fopen (va("%s/config.cfg", com_gamedir), "w");
if (!f)
{
Con_Printf ("Couldn't write config.cfg.\n");
return;
}
VID_SyncCvars (); //johnfitz -- write actual current mode to config file, in case cvars were messed with
Key_WriteBindings (f);
Cvar_WriteVariables (f);
//johnfitz -- extra commands to preserve state
fprintf (f, "vid_restart\n");
if (in_mlook.state & 1) fprintf (f, "+mlook\n");
//johnfitz
fclose (f);
//johnfitz -- also save fitzquake.rc
#if 0
f = fopen (va("%s/fitzquake.rc", GAMENAME), "w"); //always save in id1
if (!f)
{
Con_Printf ("Couldn't write fitzquake.rc.\n");
return;
}
Cvar_WriteVariables (f);
fprintf (f, "vid_restart\n");
if (in_mlook.state & 1) fprintf (f, "+mlook\n");
fclose (f);
#endif
//johnfitz
}
}
/*
=================
SV_ClientPrintf
Sends text across to be displayed
FIXME: make this just a stuffed echo?
=================
*/
void SV_ClientPrintf (char *fmt, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
MSG_WriteByte (&host_client->message, svc_print);
MSG_WriteString (&host_client->message, string);
}
/*
=================
SV_BroadcastPrintf
Sends text to all active clients
=================
*/
void SV_BroadcastPrintf (char *fmt, ...)
{
va_list argptr;
char string[1024];
int i;
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
for (i=0 ; i<svs.maxclients ; i++)
if (svs.clients[i].active && svs.clients[i].spawned)
{
MSG_WriteByte (&svs.clients[i].message, svc_print);
MSG_WriteString (&svs.clients[i].message, string);
}
}
/*
=================
Host_ClientCommands
Send text over to the client to be executed
=================
*/
void Host_ClientCommands (char *fmt, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
MSG_WriteByte (&host_client->message, svc_stufftext);
MSG_WriteString (&host_client->message, string);
}
/*
=====================
SV_DropClient
Called when the player is getting totally kicked off the host
if (crash = true), don't bother sending signofs
=====================
*/
void SV_DropClient (qboolean crash)
{
int saveSelf;
int i;
client_t *client;
if (!crash)
{
// send any final messages (don't check for errors)
if (NET_CanSendMessage (host_client->netconnection))
{
MSG_WriteByte (&host_client->message, svc_disconnect);
NET_SendMessage (host_client->netconnection, &host_client->message);
}
if (host_client->edict && host_client->spawned)
{
// call the prog function for removing a client
// this will set the body to a dead frame, among other things
saveSelf = pr_global_struct->self;
pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
PR_ExecuteProgram (pr_global_struct->ClientDisconnect);
pr_global_struct->self = saveSelf;
}
Sys_Printf ("Client %s removed\n",host_client->name);
}
// break the net connection
NET_Close (host_client->netconnection);
host_client->netconnection = NULL;
// free the client (the body stays around)
host_client->active = false;
host_client->name[0] = 0;
host_client->old_frags = -999999;
net_activeconnections--;
// send notification to all clients
for (i=0, client = svs.clients ; i<svs.maxclients ; i++, client++)
{
if (!client->active)
continue;
MSG_WriteByte (&client->message, svc_updatename);
MSG_WriteByte (&client->message, host_client - svs.clients);
MSG_WriteString (&client->message, "");
MSG_WriteByte (&client->message, svc_updatefrags);
MSG_WriteByte (&client->message, host_client - svs.clients);
MSG_WriteShort (&client->message, 0);
MSG_WriteByte (&client->message, svc_updatecolors);
MSG_WriteByte (&client->message, host_client - svs.clients);
MSG_WriteByte (&client->message, 0);
}
}
/*
==================
Host_ShutdownServer
This only happens at the end of a game, not between levels
==================
*/
void Host_ShutdownServer(qboolean crash)
{
int i;
int count;
sizebuf_t buf;
char message[4];
double start;
if (!sv.active)
return;
sv.active = false;
// stop all client sounds immediately
if (cls.state == ca_connected)
CL_Disconnect ();
// flush any pending messages - like the score!!!
start = Sys_FloatTime();
do
{
count = 0;
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (host_client->active && host_client->message.cursize)
{
if (NET_CanSendMessage (host_client->netconnection))
{
NET_SendMessage(host_client->netconnection, &host_client->message);
SZ_Clear (&host_client->message);
}
else
{
NET_GetMessage(host_client->netconnection);
count++;
}
}
}
if ((Sys_FloatTime() - start) > 3.0)
break;
}
while (count);
// make sure all the clients know we're disconnecting
buf.data = message;
buf.maxsize = 4;
buf.cursize = 0;
MSG_WriteByte(&buf, svc_disconnect);
count = NET_SendToAll(&buf, 5);
if (count)
Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %u clients\n", count);
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
if (host_client->active)
SV_DropClient(crash);
//
// clear structures
//
memset (&sv, 0, sizeof(sv));
memset (svs.clients, 0, svs.maxclientslimit*sizeof(client_t));
}
/*
================
Host_ClearMemory
This clears all the memory used by both the client and server, but does
not reinitialize anything.
================
*/
void Host_ClearMemory (void)
{
Con_DPrintf ("Clearing memory\n");
D_FlushCaches ();
Mod_ClearAll ();
if (host_hunklevel)
Hunk_FreeToLowMark (host_hunklevel);
cls.signon = 0;
memset (&sv, 0, sizeof(sv));
memset (&cl, 0, sizeof(cl));
}
//==============================================================================
//
// Host Frame
//
//==============================================================================
/*
===================
Host_FilterTime
Returns false if the time is too short to run a frame
===================
*/
qboolean Host_FilterTime (float time)
{
float maxfps; //johnfitz
realtime += time;
//johnfitz -- max fps cvar
maxfps = CLAMP (10.0, host_maxfps.value, 1000.0);
if (!cls.timedemo && realtime - oldrealtime < 1.0/maxfps)
return false; // framerate is too high
//johnfitz
host_frametime = realtime - oldrealtime;
oldrealtime = realtime;
//johnfitz -- host_timescale is more intuitive than host_framerate
if (host_timescale.value > 0)
host_frametime *= host_timescale.value;
//johnfitz
else if (host_framerate.value > 0)
host_frametime = host_framerate.value;
else // don't allow really long or short frames
host_frametime = CLAMP (0.001, host_frametime, 0.1); //johnfitz -- use CLAMP
return true;
}
/*
===================
Host_GetConsoleCommands
Add them exactly as if they had been typed at the console
===================
*/
void Host_GetConsoleCommands (void)
{
char *cmd;
while (1)
{
cmd = Sys_ConsoleInput ();
if (!cmd)
break;
Cbuf_AddText (cmd);
}
}
/*
==================
Host_ServerFrame
==================
*/
void Host_ServerFrame (void)
{
int i, active; //johnfitz
edict_t *ent; //johnfitz
// run the world state
pr_global_struct->frametime = host_frametime;
// set the time and clear the general datagram
SV_ClearDatagram ();
// check for new clients
SV_CheckForNewClients ();
// read client messages
SV_RunClients ();
// move things around and think
// always pause in single player if in console or menus
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) )
SV_Physics ();
//johnfitz -- devstats
if (cls.signon == SIGNONS)
{
for (i=0, active=0; i<sv.num_edicts; i++)
{
ent = EDICT_NUM(i);
if (!ent->free)
active++;
}
if (active > 600 && dev_peakstats.edicts <= 600)
Con_Warning ("%i edicts exceeds standard limit of 600.\n", active);
dev_stats.edicts = active;
dev_peakstats.edicts = max(active, dev_peakstats.edicts);
}
//johnfitz
// send all messages to the clients
SV_SendClientMessages ();
}
/*
==================
Host_Frame
Runs all active servers
==================
*/
void _Host_Frame (float time)
{
static double time1 = 0;
static double time2 = 0;
static double time3 = 0;
int pass1, pass2, pass3;
if (setjmp (host_abortserver) )
return; // something bad happened, or the server disconnected
// keep the random time dependent
rand ();
// decide the simulation time
if (!Host_FilterTime (time))
return; // don't run too fast, or packets will flood out
// get new key events
//Sys_SendKeyEvents (); not needed for SDL
// allow mice or other external controllers to add commands
IN_Commands ();
// process console commands
Cbuf_Execute ();
NET_Poll();
// if running the server locally, make intentions now
if (sv.active)
CL_SendCmd ();
//-------------------
//
// server operations
//
//-------------------
// check for commands typed to the host
Host_GetConsoleCommands ();
if (sv.active)
Host_ServerFrame ();
//-------------------
//
// client operations
//
//-------------------
// if running the server remotely, send intentions now after
// the incoming messages have been read
if (!sv.active)
CL_SendCmd ();
host_time += host_frametime;
// fetch results from server
if (cls.state == ca_connected)
{
CL_ReadFromServer ();
}
// update video
if (host_speeds.value)
time1 = Sys_FloatTime ();
SCR_UpdateScreen ();
CL_RunParticles (); //johnfitz -- seperated from rendering
if (host_speeds.value)
time2 = Sys_FloatTime ();
// update audio
if (cls.signon == SIGNONS)
{
S_Update (r_origin, vpn, vright, vup);
CL_DecayLights ();
}
else
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
CDAudio_Update();
if (host_speeds.value)
{
pass1 = (time1 - time3)*1000;
time3 = Sys_FloatTime ();
pass2 = (time2 - time1)*1000;
pass3 = (time3 - time2)*1000;
Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
pass1+pass2+pass3, pass1, pass2, pass3);
}
host_framecount++;
}
void Host_Frame (float time)
{
double time1, time2;
static double timetotal;
static int timecount;
int i, c, m;
if (!serverprofile.value)
{
_Host_Frame (time);
return;
}
time1 = Sys_FloatTime ();
_Host_Frame (time);
time2 = Sys_FloatTime ();
timetotal += time2 - time1;
timecount++;
if (timecount < 1000)
return;
m = timetotal*1000/timecount;
timecount = 0;
timetotal = 0;
c = 0;
for (i=0 ; i<svs.maxclients ; i++)
{
if (svs.clients[i].active)
c++;
}
Con_Printf ("serverprofile: %2i clients %2i msec\n", c, m);
}
/*
====================
Host_Init
====================
*/
void Host_Init (quakeparms_t *parms)
{
if (standard_quake)
minimum_memory = MINIMUM_MEMORY;
else
minimum_memory = MINIMUM_MEMORY_LEVELPAK;
if (COM_CheckParm ("-minmemory"))
parms->memsize = minimum_memory;
host_parms = *parms;
if (parms->memsize < minimum_memory)
Sys_Error ("Only %4.1f megs of memory available, can't execute game", parms->memsize / (float)0x100000);
com_argc = parms->argc;
com_argv = parms->argv;
Memory_Init (parms->membase, parms->memsize);
Cbuf_Init ();
Cmd_Init ();
Cvar_Init (); //johnfitz
V_Init ();
Chase_Init ();
COM_Init (parms->basedir);
Host_InitLocal ();
W_LoadWadFile (); //johnfitz -- filename is now hard-coded for honesty
Key_Init ();
Con_Init ();
M_Init ();
PR_Init ();
Mod_Init ();
NET_Init ();
SV_Init ();
ExtraMaps_Init (); //johnfitz
Modlist_Init (); //johnfitz
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
if (cls.state != ca_dedicated)
{
host_colormap = (byte *)COM_LoadHunkFile ("gfx/colormap.lmp");
if (!host_colormap)
Sys_Error ("Couldn't load gfx/colormap.lmp");
VID_Init ();
IN_Init (); // moved here, SDL inits the input system with the video system -- kristian
TexMgr_Init (); //johnfitz
Draw_Init ();
SCR_Init ();
R_Init ();
S_Init ();
CDAudio_Init ();
Sbar_Init ();
CL_Init ();
}
Cbuf_InsertText ("exec quake.rc\n");
// Cbuf_InsertText ("exec fitzquake.rc\n"); //johnfitz (inserted second so it'll be executed first)
Cbuf_AddText ("\n\nvid_unlock\n"); //johnfitz -- in case the vid mode was locked during vid_init, we can unlock it now.
//note: added two newlines to the front becuase the command buffer swallows one of them.
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark ();
host_initialized = true;
Con_Printf ("\n========= Quake Initialized =========\n\n"); //johnfitz - was Sys_Printf
}
/*
===============
Host_Shutdown
FIXME: this is a callback from Sys_Quit and Sys_Error. It would be better
to run quit through here before the final handoff to the sys code.
===============
*/
void Host_Shutdown(void)
{
static qboolean isdown = false;
if (isdown)
{
printf ("recursive shutdown\n");
return;
}
isdown = true;
// keep Con_Printf from trying to update the screen
scr_disabled_for_loading = true;
Host_WriteConfiguration ();
CDAudio_Shutdown ();
NET_Shutdown ();
S_Shutdown();
if (cls.state != ca_dedicated)
{
IN_Shutdown (); // input is only initialized in Host_Init if we're not dedicated -- kristian
VID_Shutdown();
}
}

2235
quakespasm/Quake/host_cmd.c Normal file

File diff suppressed because it is too large Load Diff

423
quakespasm/Quake/image.c Normal file
View File

@ -0,0 +1,423 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//image.c -- image loading
#include "quakedef.h"
char loadfilename[MAX_OSPATH]; //file scope so that error messages can use it
/*
============
Image_LoadImage
returns a pointer to hunk allocated RGBA data
TODO: search order: tga png jpg pcx lmp
============
*/
byte *Image_LoadImage (char *name, int *width, int *height)
{
FILE *f;
sprintf (loadfilename, "%s.tga", name);
COM_FOpenFile (loadfilename, &f);
if (f)
return Image_LoadTGA (f, width, height);
sprintf (loadfilename, "%s.pcx", name);
COM_FOpenFile (loadfilename, &f);
if (f)
return Image_LoadPCX (f, width, height);
return NULL;
}
//==============================================================================
//
// TGA
//
//==============================================================================
typedef struct targaheader_s {
unsigned char id_length, colormap_type, image_type;
unsigned short colormap_index, colormap_length;
unsigned char colormap_size;
unsigned short x_origin, y_origin, width, height;
unsigned char pixel_size, attributes;
} targaheader_t;
#define TARGAHEADERSIZE 18 //size on disk
targaheader_t targa_header;
int fgetLittleShort (FILE *f)
{
byte b1, b2;
b1 = fgetc(f);
b2 = fgetc(f);
return (short)(b1 + b2*256);
}
int fgetLittleLong (FILE *f)
{
byte b1, b2, b3, b4;
b1 = fgetc(f);
b2 = fgetc(f);
b3 = fgetc(f);
b4 = fgetc(f);
return b1 + (b2<<8) + (b3<<16) + (b4<<24);
}
/*
============
Image_WriteTGA -- writes RGB or RGBA data to a TGA file
returns true if successful
TODO: support BGRA and BGR formats (since opengl can return them, and we don't have to swap)
============
*/
qboolean Image_WriteTGA (char *name, byte *data, int width, int height, int bpp, qboolean upsidedown)
{
int handle, i, size, temp, bytes;
char pathname[MAX_OSPATH];
byte header[TARGAHEADERSIZE];
Sys_mkdir (com_gamedir); //if we've switched to a nonexistant gamedir, create it now so we don't crash
sprintf (pathname, "%s/%s", com_gamedir, name);
handle = Sys_FileOpenWrite (pathname);
if (handle == -1)
return false;
Q_memset (&header, 0, TARGAHEADERSIZE);
header[2] = 2; // uncompressed type
header[12] = width&255;
header[13] = width>>8;
header[14] = height&255;
header[15] = height>>8;
header[16] = bpp; // pixel size
if (upsidedown)
header[17] = 0x20; //upside-down attribute
// swap red and blue bytes
bytes = bpp/8;
size = width*height*bytes;
for (i=0; i<size; i+=bytes)
{
temp = data[i];
data[i] = data[i+2];
data[i+2] = temp;
}
Sys_FileWrite (handle, &header, TARGAHEADERSIZE);
Sys_FileWrite (handle, data, size);
Sys_FileClose (handle);
return true;
}
/*
=============
Image_LoadTGA
=============
*/
byte *Image_LoadTGA (FILE *fin, int *width, int *height)
{
int columns, rows, numPixels;
byte *pixbuf;
int row, column;
byte *targa_rgba;
int realrow; //johnfitz -- fix for upside-down targas
qboolean upside_down; //johnfitz -- fix for upside-down targas
targa_header.id_length = fgetc(fin);
targa_header.colormap_type = fgetc(fin);
targa_header.image_type = fgetc(fin);
targa_header.colormap_index = fgetLittleShort(fin);
targa_header.colormap_length = fgetLittleShort(fin);
targa_header.colormap_size = fgetc(fin);
targa_header.x_origin = fgetLittleShort(fin);
targa_header.y_origin = fgetLittleShort(fin);
targa_header.width = fgetLittleShort(fin);
targa_header.height = fgetLittleShort(fin);
targa_header.pixel_size = fgetc(fin);
targa_header.attributes = fgetc(fin);
if (targa_header.image_type!=2 && targa_header.image_type!=10)
Sys_Error ("Image_LoadTGA: %s is not a type 2 or type 10 targa\n", loadfilename);
if (targa_header.colormap_type !=0 || (targa_header.pixel_size!=32 && targa_header.pixel_size!=24))
Sys_Error ("Image_LoadTGA: %s is not a 24bit or 32bit targa\n", loadfilename);
columns = targa_header.width;
rows = targa_header.height;
numPixels = columns * rows;
upside_down = !(targa_header.attributes & 0x20); //johnfitz -- fix for upside-down targas
targa_rgba = Hunk_Alloc (numPixels*4);
if (targa_header.id_length != 0)
fseek(fin, targa_header.id_length, SEEK_CUR); // skip TARGA image comment
if (targa_header.image_type==2) // Uncompressed, RGB images
{
for(row=rows-1; row>=0; row--)
{
//johnfitz -- fix for upside-down targas
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
//johnfitz
for(column=0; column<columns; column++)
{
unsigned char red,green,blue,alphabyte;
switch (targa_header.pixel_size)
{
case 24:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = 255;
break;
case 32:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
break;
}
}
}
}
else if (targa_header.image_type==10) // Runlength encoded RGB images
{
unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j;
for(row=rows-1; row>=0; row--)
{
//johnfitz -- fix for upside-down targas
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
//johnfitz
for(column=0; column<columns; )
{
packetHeader=getc(fin);
packetSize = 1 + (packetHeader & 0x7f);
if (packetHeader & 0x80) // run-length packet
{
switch (targa_header.pixel_size)
{
case 24:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = 255;
break;
case 32:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
break;
}
for(j=0;j<packetSize;j++)
{
*pixbuf++=red;
*pixbuf++=green;
*pixbuf++=blue;
*pixbuf++=alphabyte;
column++;
if (column==columns) // run spans across rows
{
column=0;
if (row>0)
row--;
else
goto breakOut;
//johnfitz -- fix for upside-down targas
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
//johnfitz
}
}
}
else // non run-length packet
{
for(j=0;j<packetSize;j++)
{
switch (targa_header.pixel_size)
{
case 24:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = 255;
break;
case 32:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
break;
}
column++;
if (column==columns) // pixel packet run spans across rows
{
column=0;
if (row>0)
row--;
else
goto breakOut;
//johnfitz -- fix for upside-down targas
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
//johnfitz
}
}
}
}
breakOut:;
}
}
fclose(fin);
*width = (int)(targa_header.width);
*height = (int)(targa_header.height);
return targa_rgba;
}
//==============================================================================
//
// PCX
//
//==============================================================================
typedef struct
{
char signature;
char version;
char encoding;
char bits_per_pixel;
unsigned short xmin,ymin,xmax,ymax;
unsigned short hdpi,vdpi;
byte colortable[48];
char reserved;
char color_planes;
unsigned short bytes_per_line;
unsigned short palette_type;
char filler[58];
} pcxheader_t;
/*
============
Image_LoadPCX
============
*/
byte *Image_LoadPCX (FILE *f, int *width, int *height)
{
pcxheader_t pcx;
int x, y, w, h, readbyte, runlength, start;
byte *p, *data;
byte palette[768];
start = ftell (f); //save start of file (since we might be inside a pak file, SEEK_SET might not be the start of the pcx)
fread(&pcx, sizeof(pcx), 1, f);
pcx.xmin = (unsigned short)LittleShort (pcx.xmin);
pcx.ymin = (unsigned short)LittleShort (pcx.ymin);
pcx.xmax = (unsigned short)LittleShort (pcx.xmax);
pcx.ymax = (unsigned short)LittleShort (pcx.ymax);
pcx.bytes_per_line = (unsigned short)LittleShort (pcx.bytes_per_line);
if (pcx.signature != 0x0A)
Sys_Error ("'%s' is not a valid PCX file", loadfilename);
if (pcx.version != 5)
Sys_Error ("'%s' is version %i, should be 5", loadfilename, pcx.version);
if (pcx.encoding != 1 || pcx.bits_per_pixel != 8 || pcx.color_planes != 1)
Sys_Error ("'%s' has wrong encoding or bit depth", loadfilename);
w = pcx.xmax - pcx.xmin + 1;
h = pcx.ymax - pcx.ymin + 1;
data = Hunk_Alloc((w*h+1)*4); //+1 to allow reading padding byte on last line
//load palette
fseek (f, start + com_filesize - 768, SEEK_SET);
fread (palette, 1, 768, f);
//back to start of image data
fseek (f, start + sizeof(pcx), SEEK_SET);
for (y=0; y<h; y++)
{
p = data + y * w * 4;
for (x=0; x<(pcx.bytes_per_line); ) //read the extra padding byte if necessary
{
readbyte = fgetc(f);
if(readbyte >= 0xC0)
{
runlength = readbyte & 0x3F;
readbyte = fgetc(f);
}
else
runlength = 1;
while(runlength--)
{
p[0] = palette[readbyte*3];
p[1] = palette[readbyte*3+1];
p[2] = palette[readbyte*3+2];
p[3] = 255;
p += 4;
x++;
}
}
}
fclose(f);
*width = w;
*height = h;
return data;
}

28
quakespasm/Quake/image.h Normal file
View File

@ -0,0 +1,28 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//image.h -- image reading / writing
//be sure to free the hunk after using these loading functions
byte *Image_LoadTGA (FILE *f, int *width, int *height);
byte *Image_LoadPCX (FILE *f, int *width, int *height);
byte *Image_LoadImage (char *name, int *width, int *height);
qboolean Image_WriteTGA (char *name, byte *data, int width, int height, int bpp, qboolean upsidedown);

168
quakespasm/Quake/in_sdl.c Normal file
View File

@ -0,0 +1,168 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2005 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
// mouse variables
cvar_t m_filter = {"m_filter","0"};
// total accumulated mouse movement since last frame
// this gets updated from the main game loop via IN_MouseMove
int total_dx, total_dy = 0;
int FilterMouseEvents (const SDL_Event *event)
{
switch (event->type) {
case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
return 0;
}
return 1;
}
void IN_Activate (void)
{
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON)
{
SDL_WM_GrabInput(SDL_GRAB_ON);
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON)
Con_Printf("WARNING: SDL_WM_GrabInput(SDL_GRAB_ON) failed.\n");
}
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE)
{
SDL_ShowCursor(SDL_DISABLE);
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE)
Con_Printf("WARNING: SDL_ShowCursor(SDL_DISABLE) failed.\n");
}
if (SDL_GetEventFilter() != NULL)
SDL_SetEventFilter(NULL);
total_dx = 0;
total_dy = 0;
}
void IN_Deactivate (qboolean free_cursor)
{
if (free_cursor)
{
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF)
{
SDL_WM_GrabInput(SDL_GRAB_OFF);
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF)
Con_Printf("WARNING: SDL_WM_GrabInput(SDL_GRAB_OFF) failed.\n");
}
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE)
{
SDL_ShowCursor(SDL_ENABLE);
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE)
Con_Printf("WARNING: SDL_ShowCursor(SDL_ENABLE) failed.\n");
}
}
// discard all mouse events when input is deactivated
if (SDL_GetEventFilter() != FilterMouseEvents)
SDL_SetEventFilter(FilterMouseEvents);
}
void IN_Init (void)
{
BuildKeyMaps();
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
IN_Activate();
}
void IN_Shutdown (void)
{
IN_Deactivate(true);
}
void IN_Commands (void)
{
// TODO: implement this for joystick support
}
extern cvar_t cl_maxpitch; //johnfitz -- variable pitch clamping
extern cvar_t cl_minpitch; //johnfitz -- variable pitch clamping
void IN_MouseMove(int dx, int dy)
{
total_dx += dx;
total_dy += dy;
}
void IN_Move (usercmd_t *cmd)
{
int dmx, dmy;
/* TODO: fix this
if (m_filter.value)
{
dmx = (2*mx - dmx) * 0.5;
dmy = (2*my - dmy) * 0.5;
}
*/
dmx = total_dx * sensitivity.value;
dmy = total_dy * sensitivity.value;
total_dx = 0;
total_dy = 0;
if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
cmd->sidemove += m_side.value * dmx;
else
cl.viewangles[YAW] -= m_yaw.value * dmx;
if (in_mlook.state & 1)
V_StopPitchDrift ();
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
{
cl.viewangles[PITCH] += m_pitch.value * dmy;
//johnfitz -- variable pitch clamping
if (cl.viewangles[PITCH] > cl_maxpitch.value)
cl.viewangles[PITCH] = cl_maxpitch.value;
if (cl.viewangles[PITCH] < cl_minpitch.value)
cl.viewangles[PITCH] = cl_minpitch.value;
//johnfitz
}
else
{
if ((in_strafe.state & 1) && noclip_anglehack)
cmd->upmove -= m_forward.value * dmy;
else
cmd->forwardmove -= m_forward.value * dmy;
}
}
void IN_ClearStates (void)
{
}

44
quakespasm/Quake/input.h Normal file
View File

@ -0,0 +1,44 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// input.h -- external (non-keyboard) input devices
void IN_Init (void);
void IN_Shutdown (void);
void IN_Commands (void);
// oportunity for devices to stick commands on the script buffer
// mouse moved by dx and dy pixels
void IN_MouseMove(int dx, int dy);
void IN_Move (usercmd_t *cmd);
// add additional movement on top of the keyboard move cmd
void IN_ClearStates (void);
// restores all button and position states to defaults
// called when the app becomes active
void IN_Activate ();
// called when the app becomes inactive
void IN_Deactivate (qboolean free_cursor);

1141
quakespasm/Quake/keys.c Normal file

File diff suppressed because it is too large Load Diff

154
quakespasm/Quake/keys.h Normal file
View File

@ -0,0 +1,154 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
// normal keys should be passed as lowercased ascii
#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152
//johnfitz -- keypad
#define KP_NUMLOCK 153
#define KP_SLASH 154
#define KP_STAR 155
#define KP_MINUS 156
#define KP_HOME 157
#define KP_UPARROW 158
#define KP_PGUP 159
#define KP_PLUS 160
#define KP_LEFTARROW 161
#define KP_5 162
#define KP_RIGHTARROW 163
#define KP_END 164
#define KP_DOWNARROW 165
#define KP_PGDN 166
#define KP_ENTER 167
#define KP_INS 168
#define KP_DEL 169
//johnfitz
#define K_PAUSE 255
//
// mouse buttons generate virtual keys
//
#define K_MOUSE1 200
#define K_MOUSE2 201
#define K_MOUSE3 202
//
// joystick buttons
//
#define K_JOY1 203
#define K_JOY2 204
#define K_JOY3 205
#define K_JOY4 206
//
// aux keys are for multi-buttoned joysticks to generate so they can use
// the normal binding process
//
#define K_AUX1 207
#define K_AUX2 208
#define K_AUX3 209
#define K_AUX4 210
#define K_AUX5 211
#define K_AUX6 212
#define K_AUX7 213
#define K_AUX8 214
#define K_AUX9 215
#define K_AUX10 216
#define K_AUX11 217
#define K_AUX12 218
#define K_AUX13 219
#define K_AUX14 220
#define K_AUX15 221
#define K_AUX16 222
#define K_AUX17 223
#define K_AUX18 224
#define K_AUX19 225
#define K_AUX20 226
#define K_AUX21 227
#define K_AUX22 228
#define K_AUX23 229
#define K_AUX24 230
#define K_AUX25 231
#define K_AUX26 232
#define K_AUX27 233
#define K_AUX28 234
#define K_AUX29 235
#define K_AUX30 236
#define K_AUX31 237
#define K_AUX32 238
// JACK: Intellimouse(c) Mouse Wheel Support
#define K_MWHEELUP 239
#define K_MWHEELDOWN 240
typedef enum {key_game, key_console, key_message, key_menu} keydest_t;
extern keydest_t key_dest;
extern char *keybindings[256];
extern int key_repeats[256];
extern int key_count; // incremented every key event
extern int key_lastpress;
void Key_Event (int key, qboolean down);
void Key_Init (void);
void Key_WriteBindings (FILE *f);
void Key_SetBinding (int keynum, char *binding);
void Key_ClearStates (void);

147
quakespasm/Quake/main.c Normal file
View File

@ -0,0 +1,147 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2005 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include "quakedef.h"
#define DEFAULT_MEMORY 0x2000000
int main(int argc, char *argv[])
{
SDL_Event event;
quakeparms_t parms;
int t;
int done = 0;
double time, oldtime, newtime;
parms.basedir = ".";
parms.cachedir = NULL;
parms.argc = argc;
parms.argv = argv;
COM_InitArgv(parms.argc, parms.argv);
isDedicated = (COM_CheckParm("-dedicated") != 0);
// default memory size
parms.memsize = DEFAULT_MEMORY;
if (COM_CheckParm("-heapsize"))
{
t = COM_CheckParm("-heapsize") + 1;
if (t < com_argc)
parms.memsize = Q_atoi(com_argv[t]) * 1024;
}
parms.membase = malloc (parms.memsize);
if (!parms.membase)
Sys_Error ("Not enough memory free; check disk space\n");
// Sys_PageIn (parms.membase, parms.memsize); don't think this is needed -- kristian
// TODO: dedicated server setup
// S_BlockSound(); do I need this?
Con_Printf("Host_Init\n");
Host_Init(&parms);
oldtime = Sys_FloatTime();
while (!done)
{
// TODO: dedicated server loop
while (!done && SDL_PollEvent (&event)) {
switch (event.type) {
case SDL_ACTIVEEVENT:
if (event.active.state & SDL_APPACTIVE & SDL_APPINPUTFOCUS)
if (event.active.gain)
{
IN_Activate();
}
else
{
// TODO: handle sound
IN_Deactivate(vid.type == MODE_WINDOWED);
}
break;
case SDL_MOUSEMOTION:
IN_MouseMove(event.motion.xrel, event.motion.yrel);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
switch (event.button.button) {
case SDL_BUTTON_LEFT:
Key_Event(K_MOUSE1, event.button.type == SDL_MOUSEBUTTONDOWN);
break;
case SDL_BUTTON_RIGHT:
Key_Event(K_MOUSE2, event.button.type == SDL_MOUSEBUTTONDOWN);
break;
case SDL_BUTTON_MIDDLE:
Key_Event(K_MOUSE3, event.button.type == SDL_MOUSEBUTTONDOWN);
break;
case SDL_BUTTON_WHEELUP:
Key_Event(K_MWHEELUP, event.button.type == SDL_MOUSEBUTTONDOWN);
break;
case SDL_BUTTON_WHEELDOWN:
Key_Event(K_MWHEELDOWN, event.button.type == SDL_MOUSEBUTTONDOWN);
break;
}
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
// LSHIFT + ESC and circomflex always opens the console no matter what
if ((event.key.keysym.sym == SDLK_ESCAPE && (event.key.keysym.mod & KMOD_LSHIFT != 0)) || (event.key.keysym.sym == SDLK_CARET))
{
if (event.key.type == SDL_KEYDOWN)
Con_ToggleConsole_f();
}
else
{
Key_Event(Key_Map(&(event.key)), event.key.type == SDL_KEYDOWN);
}
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
newtime = Sys_FloatTime();
time = newtime - oldtime;
Host_Frame(time);
// throttle the game loop just a little bit - noone needs more than 1000fps, I think
if (newtime - oldtime < 1)
SDL_Delay(1);
oldtime = newtime;
}
Sys_Quit();
return 0;
}

557
quakespasm/Quake/mathlib.c Normal file
View File

@ -0,0 +1,557 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// mathlib.c -- math primitives
#include <math.h>
#include "quakedef.h"
void Sys_Error (char *error, ...);
vec3_t vec3_origin = {0,0,0};
int nanmask = 255<<23;
/*-----------------------------------------------------------------*/
//#define DEG2RAD( a ) ( a * M_PI ) / 180.0F
#define DEG2RAD( a ) ( (a) * M_PI_DIV_180 ) //johnfitz
// kristian - missing math functions
#ifndef max
int max (int x, int y)
{
if (x > y)
return x;
return y;
}
#endif
#ifndef min
int min (int x, int y)
{
if (x < y)
return x;
return y;
}
#endif
// kristian
void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
{
float d;
vec3_t n;
float inv_denom;
inv_denom = 1.0F / DotProduct( normal, normal );
d = DotProduct( normal, p ) * inv_denom;
n[0] = normal[0] * inv_denom;
n[1] = normal[1] * inv_denom;
n[2] = normal[2] * inv_denom;
dst[0] = p[0] - d * n[0];
dst[1] = p[1] - d * n[1];
dst[2] = p[2] - d * n[2];
}
/*
** assumes "src" is normalized
*/
void PerpendicularVector( vec3_t dst, const vec3_t src )
{
int pos;
int i;
float minelem = 1.0F;
vec3_t tempvec;
/*
** find the smallest magnitude axially aligned vector
*/
for ( pos = 0, i = 0; i < 3; i++ )
{
if ( fabs( src[i] ) < minelem )
{
pos = i;
minelem = fabs( src[i] );
}
}
tempvec[0] = tempvec[1] = tempvec[2] = 0.0F;
tempvec[pos] = 1.0F;
/*
** project the point onto the plane defined by src
*/
ProjectPointOnPlane( dst, tempvec, src );
/*
** normalize the result
*/
VectorNormalize( dst );
}
//johnfitz -- removed RotatePointAroundVector() becuase it's no longer used and my compiler fucked it up anyway
/*-----------------------------------------------------------------*/
float anglemod(float a)
{
#if 0
if (a >= 0)
a -= 360*(int)(a/360);
else
a += 360*( 1 + (int)(-a/360) );
#endif
a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535);
return a;
}
/*
==================
BOPS_Error
Split out like this for ASM to call.
==================
*/
void BOPS_Error (void)
{
Sys_Error ("BoxOnPlaneSide: Bad signbits");
}
/*
==================
BoxOnPlaneSide
Returns 1, 2, or 1 + 2
==================
*/
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
{
float dist1, dist2;
int sides;
#if 0 // this is done by the BOX_ON_PLANE_SIDE macro before calling this
// function
// fast axial cases
if (p->type < 3)
{
if (p->dist <= emins[p->type])
return 1;
if (p->dist >= emaxs[p->type])
return 2;
return 3;
}
#endif
// general case
switch (p->signbits)
{
case 0:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
break;
case 1:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
break;
case 2:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
break;
case 3:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
break;
case 4:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
break;
case 5:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
break;
case 6:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
break;
case 7:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
break;
default:
dist1 = dist2 = 0; // shut up compiler
BOPS_Error ();
break;
}
#if 0
int i;
vec3_t corners[2];
for (i=0 ; i<3 ; i++)
{
if (plane->normal[i] < 0)
{
corners[0][i] = emins[i];
corners[1][i] = emaxs[i];
}
else
{
corners[1][i] = emins[i];
corners[0][i] = emaxs[i];
}
}
dist = DotProduct (plane->normal, corners[0]) - plane->dist;
dist2 = DotProduct (plane->normal, corners[1]) - plane->dist;
sides = 0;
if (dist1 >= 0)
sides = 1;
if (dist2 < 0)
sides |= 2;
#endif
sides = 0;
if (dist1 >= p->dist)
sides = 1;
if (dist2 < p->dist)
sides |= 2;
#ifdef PARANOID
if (sides == 0)
Sys_Error ("BoxOnPlaneSide: sides==0");
#endif
return sides;
}
//johnfitz -- the opposite of AngleVectors. this takes forward and generates pitch yaw roll
//TODO: take right and up vectors to properly set yaw and roll
void VectorAngles (const vec3_t forward, vec3_t angles)
{
vec3_t temp;
temp[0] = forward[0];
temp[1] = forward[1];
temp[2] = 0;
angles[PITCH] = -atan2(forward[2], Length(temp)) / M_PI_DIV_180;
angles[YAW] = atan2(forward[1], forward[0]) / M_PI_DIV_180;
angles[ROLL] = 0;
}
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
{
float angle;
float sr, sp, sy, cr, cp, cy;
angle = angles[YAW] * (M_PI*2 / 360);
sy = sin(angle);
cy = cos(angle);
angle = angles[PITCH] * (M_PI*2 / 360);
sp = sin(angle);
cp = cos(angle);
angle = angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
forward[0] = cp*cy;
forward[1] = cp*sy;
forward[2] = -sp;
right[0] = (-1*sr*sp*cy+-1*cr*-sy);
right[1] = (-1*sr*sp*sy+-1*cr*cy);
right[2] = -1*sr*cp;
up[0] = (cr*sp*cy+-sr*-sy);
up[1] = (cr*sp*sy+-sr*cy);
up[2] = cr*cp;
}
int VectorCompare (vec3_t v1, vec3_t v2)
{
int i;
for (i=0 ; i<3 ; i++)
if (v1[i] != v2[i])
return 0;
return 1;
}
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
{
vecc[0] = veca[0] + scale*vecb[0];
vecc[1] = veca[1] + scale*vecb[1];
vecc[2] = veca[2] + scale*vecb[2];
}
vec_t _DotProduct (vec3_t v1, vec3_t v2)
{
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
}
void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out)
{
out[0] = veca[0]-vecb[0];
out[1] = veca[1]-vecb[1];
out[2] = veca[2]-vecb[2];
}
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out)
{
out[0] = veca[0]+vecb[0];
out[1] = veca[1]+vecb[1];
out[2] = veca[2]+vecb[2];
}
void _VectorCopy (vec3_t in, vec3_t out)
{
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
}
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross)
{
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
}
double sqrt(double x);
vec_t Length(vec3_t v)
{
int i;
float length;
length = 0;
for (i=0 ; i< 3 ; i++)
length += v[i]*v[i];
length = sqrt (length); // FIXME
return length;
}
float VectorNormalize (vec3_t v)
{
float length, ilength;
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
length = sqrt (length); // FIXME
if (length)
{
ilength = 1/length;
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
return length;
}
void VectorInverse (vec3_t v)
{
v[0] = -v[0];
v[1] = -v[1];
v[2] = -v[2];
}
void VectorScale (vec3_t in, vec_t scale, vec3_t out)
{
out[0] = in[0]*scale;
out[1] = in[1]*scale;
out[2] = in[2]*scale;
}
int Q_log2(int val)
{
int answer=0;
while (val>>=1)
answer++;
return answer;
}
/*
================
R_ConcatRotations
================
*/
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3])
{
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
in1[0][2] * in2[2][0];
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
in1[0][2] * in2[2][1];
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
in1[0][2] * in2[2][2];
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
in1[1][2] * in2[2][0];
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
in1[1][2] * in2[2][1];
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
in1[1][2] * in2[2][2];
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
in1[2][2] * in2[2][0];
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
in1[2][2] * in2[2][1];
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
in1[2][2] * in2[2][2];
}
/*
================
R_ConcatTransforms
================
*/
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
{
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
in1[0][2] * in2[2][0];
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
in1[0][2] * in2[2][1];
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
in1[0][2] * in2[2][2];
out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +
in1[0][2] * in2[2][3] + in1[0][3];
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
in1[1][2] * in2[2][0];
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
in1[1][2] * in2[2][1];
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
in1[1][2] * in2[2][2];
out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +
in1[1][2] * in2[2][3] + in1[1][3];
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
in1[2][2] * in2[2][0];
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
in1[2][2] * in2[2][1];
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
in1[2][2] * in2[2][2];
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
in1[2][2] * in2[2][3] + in1[2][3];
}
/*
===================
FloorDivMod
Returns mathematically correct (floor-based) quotient and remainder for
numer and denom, both of which should contain no fractional part. The
quotient must fit in 32 bits.
====================
*/
void FloorDivMod (double numer, double denom, int *quotient,
int *rem)
{
int q, r;
double x;
#ifndef PARANOID
if (denom <= 0.0)
Sys_Error ("FloorDivMod: bad denominator %d\n", denom);
// if ((floor(numer) != numer) || (floor(denom) != denom))
// Sys_Error ("FloorDivMod: non-integer numer or denom %f %f\n",
// numer, denom);
#endif
if (numer >= 0.0)
{
x = floor(numer / denom);
q = (int)x;
r = (int)floor(numer - (x * denom));
}
else
{
//
// perform operations with positive values, and fix mod to make floor-based
//
x = floor(-numer / denom);
q = -(int)x;
r = (int)floor(-numer - (x * denom));
if (r != 0)
{
q--;
r = (int)denom - r;
}
}
*quotient = q;
*rem = r;
}
/*
===================
GreatestCommonDivisor
====================
*/
int GreatestCommonDivisor (int i1, int i2)
{
if (i1 > i2)
{
if (i2 == 0)
return (i1);
return GreatestCommonDivisor (i2, i1 % i2);
}
else
{
if (i1 == 0)
return (i2);
return GreatestCommonDivisor (i1, i2 % i1);
}
}
#if !id386
// TODO: move to nonintel.c
/*
===================
Invert24To16
Inverts an 8.24 value to a 16.16 value
====================
*/
fixed16_t Invert24To16(fixed16_t val)
{
if (val < 256)
return (0xFFFFFFFF);
return (fixed16_t)
(((double)0x10000 * (double)0x1000000 / (double)val) + 0.5);
}
#endif

122
quakespasm/Quake/mathlib.h Normal file
View File

@ -0,0 +1,122 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// mathlib.h
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef vec_t vec5_t[5];
typedef int fixed4_t;
typedef int fixed8_t;
typedef int fixed16_t;
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#define M_PI_DIV_180 (M_PI / 180.0) //johnfitz
struct mplane_s;
extern vec3_t vec3_origin;
extern int nanmask;
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
#define CLAMP(min, x, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) //johnfitz
#define Q_rint(x) ((x) > 0 ? (int)((x) + 0.5) : (int)((x) - 0.5)) //johnfitz -- from joequake
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
//johnfitz -- courtesy of lordhavoc
#define VectorNormalizeFast(_v)\
{\
float _y, _number;\
_number = DotProduct(_v, _v);\
if (_number != 0.0)\
{\
*((long *)&_y) = 0x5f3759df - ((* (long *) &_number) >> 1);\
_y = _y * (1.5f - (_number * 0.5f * _y * _y));\
VectorScale(_v, _y, _v);\
}\
}
// kristian - missing math functions
#if !defined(max)
inline int max (int x, int y);
#endif
#if !defined(min)
inline int min (int x, int y);
#endif
// kristian
void TurnVector (vec3_t out, const vec3_t forward, const vec3_t side, float angle); //johnfitz
void VectorAngles (const vec3_t forward, vec3_t angles); //johnfitz
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2);
void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorCopy (vec3_t in, vec3_t out);
int VectorCompare (vec3_t v1, vec3_t v2);
vec_t Length (vec3_t v);
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
float VectorNormalize (vec3_t v); // returns vector length
void VectorInverse (vec3_t v);
void VectorScale (vec3_t in, vec_t scale, vec3_t out);
int Q_log2(int val);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void FloorDivMod (double numer, double denom, int *quotient,
int *rem);
fixed16_t Invert24To16(fixed16_t val);
int GreatestCommonDivisor (int i1, int i2);
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
float anglemod(float a);
#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
(((p)->type < 3)? \
( \
((p)->dist <= (emins)[(p)->type])? \
1 \
: \
( \
((p)->dist >= (emaxs)[(p)->type])?\
2 \
: \
3 \
) \
) \
: \
BoxOnPlaneSide( (emins), (emaxs), (p)))

3155
quakespasm/Quake/menu.c Normal file

File diff suppressed because it is too large Load Diff

39
quakespasm/Quake/menu.h Normal file
View File

@ -0,0 +1,39 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// the net drivers should just set the apropriate bits in m_activenet,
// instead of having the menu code look through their internal tables
//
#define MNET_IPX 1
#define MNET_TCP 2
extern int m_activenet;
//
// menus
//
void M_Init (void);
void M_Keydown (int key);
void M_Draw (void);
void M_ToggleMenu_f (void);

135
quakespasm/Quake/modelgen.h Normal file
View File

@ -0,0 +1,135 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// modelgen.h: header file for model generation program
//
// *********************************************************
// * This file must be identical in the modelgen directory *
// * and in the Quake directory, because it's used to *
// * pass data from one to the other via model files. *
// *********************************************************
#ifdef INCLUDELIBS
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "cmdlib.h"
#include "scriplib.h"
#include "trilib.h"
#include "lbmlib.h"
#include "mathlib.h"
#endif
#define ALIAS_VERSION 6
#define ALIAS_ONSEAM 0x0020
// must match definition in spritegn.h
#ifndef SYNCTYPE_T
#define SYNCTYPE_T
typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
#endif
typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t;
typedef enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t;
typedef struct {
int ident;
int version;
vec3_t scale;
vec3_t scale_origin;
float boundingradius;
vec3_t eyeposition;
int numskins;
int skinwidth;
int skinheight;
int numverts;
int numtris;
int numframes;
synctype_t synctype;
int flags;
float size;
} mdl_t;
// TODO: could be shorts
typedef struct {
int onseam;
int s;
int t;
} stvert_t;
typedef struct dtriangle_s {
int facesfront;
int vertindex[3];
} dtriangle_t;
#define DT_FACES_FRONT 0x0010
// This mirrors trivert_t in trilib.h, is present so Quake knows how to
// load this data
typedef struct {
byte v[3];
byte lightnormalindex;
} trivertx_t;
typedef struct {
trivertx_t bboxmin; // lightnormal isn't used
trivertx_t bboxmax; // lightnormal isn't used
char name[16]; // frame name from grabbing
} daliasframe_t;
typedef struct {
int numframes;
trivertx_t bboxmin; // lightnormal isn't used
trivertx_t bboxmax; // lightnormal isn't used
} daliasgroup_t;
typedef struct {
int numskins;
} daliasskingroup_t;
typedef struct {
float interval;
} daliasinterval_t;
typedef struct {
float interval;
} daliasskininterval_t;
typedef struct {
aliasframetype_t type;
} daliasframetype_t;
typedef struct {
aliasskintype_t type;
} daliasskintype_t;
#define IDPOLYHEADER (('O'<<24)+('P'<<16)+('D'<<8)+'I')
// little-endian "IDPO"

334
quakespasm/Quake/net.h Normal file
View File

@ -0,0 +1,334 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net.h -- quake's interface to the networking layer
struct qsockaddr
{
short sa_family;
unsigned char sa_data[14];
};
#define NET_NAMELEN 64
#define NET_MAXMESSAGE 32000 //johnfitz -- was 8192
#define NET_HEADERSIZE (2 * sizeof(unsigned int))
#define NET_DATAGRAMSIZE (MAX_DATAGRAM + NET_HEADERSIZE)
// NetHeader flags
#define NETFLAG_LENGTH_MASK 0x0000ffff
#define NETFLAG_DATA 0x00010000
#define NETFLAG_ACK 0x00020000
#define NETFLAG_NAK 0x00040000
#define NETFLAG_EOM 0x00080000
#define NETFLAG_UNRELIABLE 0x00100000
#define NETFLAG_CTL 0x80000000
#define NET_PROTOCOL_VERSION 3
// This is the network info/connection protocol. It is used to find Quake
// servers, get info about them, and connect to them. Once connected, the
// Quake game protocol (documented elsewhere) is used.
//
//
// General notes:
// game_name is currently always "QUAKE", but is there so this same protocol
// can be used for future games as well; can you say Quake2?
//
// CCREQ_CONNECT
// string game_name "QUAKE"
// byte net_protocol_version NET_PROTOCOL_VERSION
//
// CCREQ_SERVER_INFO
// string game_name "QUAKE"
// byte net_protocol_version NET_PROTOCOL_VERSION
//
// CCREQ_PLAYER_INFO
// byte player_number
//
// CCREQ_RULE_INFO
// string rule
//
//
//
// CCREP_ACCEPT
// long port
//
// CCREP_REJECT
// string reason
//
// CCREP_SERVER_INFO
// string server_address
// string host_name
// string level_name
// byte current_players
// byte max_players
// byte protocol_version NET_PROTOCOL_VERSION
//
// CCREP_PLAYER_INFO
// byte player_number
// string name
// long colors
// long frags
// long connect_time
// string address
//
// CCREP_RULE_INFO
// string rule
// string value
// note:
// There are two address forms used above. The short form is just a
// port number. The address that goes along with the port is defined as
// "whatever address you receive this reponse from". This lets us use
// the host OS to solve the problem of multiple host addresses (possibly
// with no routing between them); the host will use the right address
// when we reply to the inbound connection request. The long from is
// a full address and port in a string. It is used for returning the
// address of a server that is not running locally.
#define CCREQ_CONNECT 0x01
#define CCREQ_SERVER_INFO 0x02
#define CCREQ_PLAYER_INFO 0x03
#define CCREQ_RULE_INFO 0x04
#define CCREP_ACCEPT 0x81
#define CCREP_REJECT 0x82
#define CCREP_SERVER_INFO 0x83
#define CCREP_PLAYER_INFO 0x84
#define CCREP_RULE_INFO 0x85
typedef struct qsocket_s
{
struct qsocket_s *next;
double connecttime;
double lastMessageTime;
double lastSendTime;
qboolean disconnected;
qboolean canSend;
qboolean sendNext;
int driver;
int landriver;
int socket;
void *driverdata;
unsigned int ackSequence;
unsigned int sendSequence;
unsigned int unreliableSendSequence;
int sendMessageLength;
byte sendMessage [NET_MAXMESSAGE];
unsigned int receiveSequence;
unsigned int unreliableReceiveSequence;
int receiveMessageLength;
byte receiveMessage [NET_MAXMESSAGE];
struct qsockaddr addr;
char address[NET_NAMELEN];
} qsocket_t;
extern qsocket_t *net_activeSockets;
extern qsocket_t *net_freeSockets;
extern int net_numsockets;
typedef struct
{
char *name;
qboolean initialized;
int controlSock;
int (*Init) (void);
void (*Shutdown) (void);
void (*Listen) (qboolean state);
int (*OpenSocket) (int port);
int (*CloseSocket) (int socket);
int (*Connect) (int socket, struct qsockaddr *addr);
int (*CheckNewConnections) (void);
int (*Read) (int socket, byte *buf, int len, struct qsockaddr *addr);
int (*Write) (int socket, byte *buf, int len, struct qsockaddr *addr);
int (*Broadcast) (int socket, byte *buf, int len);
char * (*AddrToString) (struct qsockaddr *addr);
int (*StringToAddr) (char *string, struct qsockaddr *addr);
int (*GetSocketAddr) (int socket, struct qsockaddr *addr);
int (*GetNameFromAddr) (struct qsockaddr *addr, char *name);
int (*GetAddrFromName) (char *name, struct qsockaddr *addr);
int (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2);
int (*GetSocketPort) (struct qsockaddr *addr);
int (*SetSocketPort) (struct qsockaddr *addr, int port);
} net_landriver_t;
#define MAX_NET_DRIVERS 8
extern int net_numlandrivers;
extern net_landriver_t net_landrivers[MAX_NET_DRIVERS];
typedef struct
{
char *name;
qboolean initialized;
int (*Init) (void);
void (*Listen) (qboolean state);
void (*SearchForHosts) (qboolean xmit);
qsocket_t *(*Connect) (char *host);
qsocket_t *(*CheckNewConnections) (void);
int (*QGetMessage) (qsocket_t *sock);
int (*QSendMessage) (qsocket_t *sock, sizebuf_t *data);
int (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data);
qboolean (*CanSendMessage) (qsocket_t *sock);
qboolean (*CanSendUnreliableMessage) (qsocket_t *sock);
void (*Close) (qsocket_t *sock);
void (*Shutdown) (void);
int controlSock;
} net_driver_t;
extern int net_numdrivers;
extern net_driver_t net_drivers[MAX_NET_DRIVERS];
extern int DEFAULTnet_hostport;
extern int net_hostport;
extern int net_driverlevel;
extern cvar_t hostname;
extern char playername[];
extern int playercolor;
extern int messagesSent;
extern int messagesReceived;
extern int unreliableMessagesSent;
extern int unreliableMessagesReceived;
qsocket_t *NET_NewQSocket (void);
void NET_FreeQSocket(qsocket_t *);
double SetNetTime(void);
#define HOSTCACHESIZE 8
typedef struct
{
char name[16];
char map[16];
char cname[32];
int users;
int maxusers;
int driver;
int ldriver;
struct qsockaddr addr;
} hostcache_t;
extern int hostCacheCount;
extern hostcache_t hostcache[HOSTCACHESIZE];
#if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__)
#ifndef htonl
extern unsigned long htonl (unsigned long hostlong);
#endif
#ifndef htons
extern unsigned short htons (unsigned short hostshort);
#endif
#ifndef ntohl
extern unsigned long ntohl (unsigned long netlong);
#endif
#ifndef ntohs
extern unsigned short ntohs (unsigned short netshort);
#endif
#endif
//============================================================================
//
// public network functions
//
//============================================================================
extern double net_time;
extern sizebuf_t net_message;
extern int net_activeconnections;
void NET_Init (void);
void NET_Shutdown (void);
struct qsocket_s *NET_CheckNewConnections (void);
// returns a new connection number if there is one pending, else -1
struct qsocket_s *NET_Connect (char *host);
// called by client to connect to a host. Returns -1 if not able to
qboolean NET_CanSendMessage (qsocket_t *sock);
// Returns true or false if the given qsocket can currently accept a
// message to be transmitted.
int NET_GetMessage (struct qsocket_s *sock);
// returns data in net_message sizebuf
// returns 0 if no data is waiting
// returns 1 if a message was received
// returns 2 if an unreliable message was received
// returns -1 if the connection died
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
// returns 0 if the message connot be delivered reliably, but the connection
// is still considered valid
// returns 1 if the message was sent properly
// returns -1 if the connection died
int NET_SendToAll(sizebuf_t *data, int blocktime);
// This is a reliable *blocking* send to all attached clients.
void NET_Close (struct qsocket_s *sock);
// if a dead connection is returned by a get or send function, this function
// should be called when it is convenient
// Server calls when a client is kicked off for a game related misbehavior
// like an illegal protocal conversation. Client calls when disconnecting
// from a server.
// A netcon_t number will not be reused until this function is called for it
void NET_Poll(void);
typedef struct _PollProcedure
{
struct _PollProcedure *next;
double nextTime;
void (*procedure)();
void *arg;
} PollProcedure;
void SchedulePollProcedure(PollProcedure *pp, double timeOffset);
extern qboolean serialAvailable;
extern qboolean ipxAvailable;
extern qboolean tcpipAvailable;
extern char my_ipx_address[NET_NAMELEN];
extern char my_tcpip_address[NET_NAMELEN];
extern void (*GetComPortConfig) (int portNumber, int *port, int *irq, int *baud, qboolean *useModem);
extern void (*SetComPortConfig) (int portNumber, int port, int irq, int baud, qboolean useModem);
extern void (*GetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
extern void (*SetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
extern qboolean slistInProgress;
extern qboolean slistSilent;
extern qboolean slistLocal;
void NET_Slist_f (void);

1384
quakespasm/Quake/net_dgrm.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_dgrm.h
int Datagram_Init (void);
void Datagram_Listen (qboolean state);
void Datagram_SearchForHosts (qboolean xmit);
qsocket_t *Datagram_Connect (char *host);
qsocket_t *Datagram_CheckNewConnections (void);
int Datagram_GetMessage (qsocket_t *sock);
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
qboolean Datagram_CanSendMessage (qsocket_t *sock);
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock);
void Datagram_Close (qsocket_t *sock);
void Datagram_Shutdown (void);

246
quakespasm/Quake/net_loop.c Normal file
View File

@ -0,0 +1,246 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_loop.c
#include "quakedef.h"
#include "net_loop.h"
qboolean localconnectpending = false;
qsocket_t *loop_client = NULL;
qsocket_t *loop_server = NULL;
int Loop_Init (void)
{
if (cls.state == ca_dedicated)
return -1;
return 0;
}
void Loop_Shutdown (void)
{
}
void Loop_Listen (qboolean state)
{
}
void Loop_SearchForHosts (qboolean xmit)
{
if (!sv.active)
return;
hostCacheCount = 1;
if (Q_strcmp(hostname.string, "UNNAMED") == 0)
Q_strcpy(hostcache[0].name, "local");
else
Q_strcpy(hostcache[0].name, hostname.string);
Q_strcpy(hostcache[0].map, sv.name);
hostcache[0].users = net_activeconnections;
hostcache[0].maxusers = svs.maxclients;
hostcache[0].driver = net_driverlevel;
Q_strcpy(hostcache[0].cname, "local");
}
qsocket_t *Loop_Connect (char *host)
{
if (Q_strcmp(host,"local") != 0)
return NULL;
localconnectpending = true;
if (!loop_client)
{
if ((loop_client = NET_NewQSocket ()) == NULL)
{
Con_Printf("Loop_Connect: no qsocket available\n");
return NULL;
}
Q_strcpy (loop_client->address, "localhost");
}
loop_client->receiveMessageLength = 0;
loop_client->sendMessageLength = 0;
loop_client->canSend = true;
if (!loop_server)
{
if ((loop_server = NET_NewQSocket ()) == NULL)
{
Con_Printf("Loop_Connect: no qsocket available\n");
return NULL;
}
Q_strcpy (loop_server->address, "LOCAL");
}
loop_server->receiveMessageLength = 0;
loop_server->sendMessageLength = 0;
loop_server->canSend = true;
loop_client->driverdata = (void *)loop_server;
loop_server->driverdata = (void *)loop_client;
return loop_client;
}
qsocket_t *Loop_CheckNewConnections (void)
{
if (!localconnectpending)
return NULL;
localconnectpending = false;
loop_server->sendMessageLength = 0;
loop_server->receiveMessageLength = 0;
loop_server->canSend = true;
loop_client->sendMessageLength = 0;
loop_client->receiveMessageLength = 0;
loop_client->canSend = true;
return loop_server;
}
static int IntAlign(int value)
{
return (value + (sizeof(int) - 1)) & (~(sizeof(int) - 1));
}
int Loop_GetMessage (qsocket_t *sock)
{
int ret;
int length;
if (sock->receiveMessageLength == 0)
return 0;
ret = sock->receiveMessage[0];
length = sock->receiveMessage[1] + (sock->receiveMessage[2] << 8);
// alignment byte skipped here
SZ_Clear (&net_message);
SZ_Write (&net_message, &sock->receiveMessage[4], length);
length = IntAlign(length + 4);
sock->receiveMessageLength -= length;
if (sock->receiveMessageLength)
Q_memcpy(sock->receiveMessage, &sock->receiveMessage[length], sock->receiveMessageLength);
if (sock->driverdata && ret == 1)
((qsocket_t *)sock->driverdata)->canSend = true;
return ret;
}
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
{
byte *buffer;
int *bufferLength;
if (!sock->driverdata)
return -1;
bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength;
if ((*bufferLength + data->cursize + 4) > NET_MAXMESSAGE)
Sys_Error("Loop_SendMessage: overflow\n");
buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength;
// message type
*buffer++ = 1;
// length
*buffer++ = data->cursize & 0xff;
*buffer++ = data->cursize >> 8;
// align
buffer++;
// message
Q_memcpy(buffer, data->data, data->cursize);
*bufferLength = IntAlign(*bufferLength + data->cursize + 4);
sock->canSend = false;
return 1;
}
int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
{
byte *buffer;
int *bufferLength;
if (!sock->driverdata)
return -1;
bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength;
if ((*bufferLength + data->cursize + sizeof(byte) + sizeof(short)) > NET_MAXMESSAGE)
return 0;
buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength;
// message type
*buffer++ = 2;
// length
*buffer++ = data->cursize & 0xff;
*buffer++ = data->cursize >> 8;
// align
buffer++;
// message
Q_memcpy(buffer, data->data, data->cursize);
*bufferLength = IntAlign(*bufferLength + data->cursize + 4);
return 1;
}
qboolean Loop_CanSendMessage (qsocket_t *sock)
{
if (!sock->driverdata)
return false;
return sock->canSend;
}
qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock)
{
return true;
}
void Loop_Close (qsocket_t *sock)
{
if (sock->driverdata)
((qsocket_t *)sock->driverdata)->driverdata = NULL;
sock->receiveMessageLength = 0;
sock->sendMessageLength = 0;
sock->canSend = true;
if (sock == loop_client)
loop_client = NULL;
else
loop_server = NULL;
}

View File

@ -0,0 +1,34 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_loop.h
int Loop_Init (void);
void Loop_Listen (qboolean state);
void Loop_SearchForHosts (qboolean xmit);
qsocket_t *Loop_Connect (char *host);
qsocket_t *Loop_CheckNewConnections (void);
int Loop_GetMessage (qsocket_t *sock);
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data);
int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
qboolean Loop_CanSendMessage (qsocket_t *sock);
qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock);
void Loop_Close (qsocket_t *sock);
void Loop_Shutdown (void);

865
quakespasm/Quake/net_main.c Normal file
View File

@ -0,0 +1,865 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_main.c
#include "quakedef.h"
qsocket_t *net_activeSockets = NULL;
qsocket_t *net_freeSockets = NULL;
int net_numsockets = 0;
qboolean serialAvailable = false;
qboolean ipxAvailable = false;
qboolean tcpipAvailable = false;
int net_hostport;
int DEFAULTnet_hostport = 26000;
char my_ipx_address[NET_NAMELEN];
char my_tcpip_address[NET_NAMELEN];
void (*GetComPortConfig) (int portNumber, int *port, int *irq, int *baud, qboolean *useModem);
void (*SetComPortConfig) (int portNumber, int port, int irq, int baud, qboolean useModem);
void (*GetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
void (*SetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
static qboolean listening = false;
qboolean slistInProgress = false;
qboolean slistSilent = false;
qboolean slistLocal = true;
static double slistStartTime;
static int slistLastShown;
static void Slist_Send(void);
static void Slist_Poll(void);
PollProcedure slistSendProcedure = {NULL, 0.0, Slist_Send};
PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll};
sizebuf_t net_message;
int net_activeconnections = 0;
int messagesSent = 0;
int messagesReceived = 0;
int unreliableMessagesSent = 0;
int unreliableMessagesReceived = 0;
cvar_t net_messagetimeout = {"net_messagetimeout","300"};
cvar_t hostname = {"hostname", "UNNAMED"};
qboolean configRestored = false;
cvar_t config_com_port = {"_config_com_port", "0x3f8", true};
cvar_t config_com_irq = {"_config_com_irq", "4", true};
cvar_t config_com_baud = {"_config_com_baud", "57600", true};
cvar_t config_com_modem = {"_config_com_modem", "1", true};
cvar_t config_modem_dialtype = {"_config_modem_dialtype", "T", true};
cvar_t config_modem_clear = {"_config_modem_clear", "ATZ", true};
cvar_t config_modem_init = {"_config_modem_init", "", true};
cvar_t config_modem_hangup = {"_config_modem_hangup", "AT H", true};
// these two macros are to make the code more readable
#define sfunc net_drivers[sock->driver]
#define dfunc net_drivers[net_driverlevel]
int net_driverlevel;
double net_time;
double SetNetTime(void)
{
net_time = Sys_FloatTime();
return net_time;
}
/*
===================
NET_NewQSocket
Called by drivers when a new communications endpoint is required
The sequence and buffer fields will be filled in properly
===================
*/
qsocket_t *NET_NewQSocket (void)
{
qsocket_t *sock;
if (net_freeSockets == NULL)
return NULL;
if (net_activeconnections >= svs.maxclients)
return NULL;
// get one from free list
sock = net_freeSockets;
net_freeSockets = sock->next;
// add it to active list
sock->next = net_activeSockets;
net_activeSockets = sock;
sock->disconnected = false;
sock->connecttime = net_time;
Q_strcpy (sock->address,"UNSET ADDRESS");
sock->driver = net_driverlevel;
sock->socket = 0;
sock->driverdata = NULL;
sock->canSend = true;
sock->sendNext = false;
sock->lastMessageTime = net_time;
sock->ackSequence = 0;
sock->sendSequence = 0;
sock->unreliableSendSequence = 0;
sock->sendMessageLength = 0;
sock->receiveSequence = 0;
sock->unreliableReceiveSequence = 0;
sock->receiveMessageLength = 0;
return sock;
}
void NET_FreeQSocket(qsocket_t *sock)
{
qsocket_t *s;
// remove it from active list
if (sock == net_activeSockets)
net_activeSockets = net_activeSockets->next;
else
{
for (s = net_activeSockets; s; s = s->next)
if (s->next == sock)
{
s->next = sock->next;
break;
}
if (!s)
Sys_Error ("NET_FreeQSocket: not active\n");
}
// add it to free list
sock->next = net_freeSockets;
net_freeSockets = sock;
sock->disconnected = true;
}
static void NET_Listen_f (void)
{
if (Cmd_Argc () != 2)
{
Con_Printf ("\"listen\" is \"%u\"\n", listening ? 1 : 0);
return;
}
listening = Q_atoi(Cmd_Argv(1)) ? true : false;
for (net_driverlevel=0 ; net_driverlevel<net_numdrivers; net_driverlevel++)
{
if (net_drivers[net_driverlevel].initialized == false)
continue;
dfunc.Listen (listening);
}
}
static void MaxPlayers_f (void)
{
int n;
if (Cmd_Argc () != 2)
{
Con_Printf ("\"maxplayers\" is \"%u\"\n", svs.maxclients);
return;
}
if (sv.active)
{
Con_Printf ("maxplayers can not be changed while a server is running.\n");
return;
}
n = Q_atoi(Cmd_Argv(1));
if (n < 1)
n = 1;
if (n > svs.maxclientslimit)
{
n = svs.maxclientslimit;
Con_Printf ("\"maxplayers\" set to \"%u\"\n", n);
}
if ((n == 1) && listening)
Cbuf_AddText ("listen 0\n");
if ((n > 1) && (!listening))
Cbuf_AddText ("listen 1\n");
svs.maxclients = n;
if (n == 1)
Cvar_Set ("deathmatch", "0");
else
Cvar_Set ("deathmatch", "1");
}
static void NET_Port_f (void)
{
int n;
if (Cmd_Argc () != 2)
{
Con_Printf ("\"port\" is \"%u\"\n", net_hostport);
return;
}
n = Q_atoi(Cmd_Argv(1));
if (n < 1 || n > 65534)
{
Con_Printf ("Bad value, must be between 1 and 65534\n");
return;
}
DEFAULTnet_hostport = n;
net_hostport = n;
if (listening)
{
// force a change to the new port
Cbuf_AddText ("listen 0\n");
Cbuf_AddText ("listen 1\n");
}
}
static void PrintSlistHeader(void)
{
Con_Printf("Server Map Users\n");
Con_Printf("--------------- --------------- -----\n");
slistLastShown = 0;
}
static void PrintSlist(void)
{
int n;
for (n = slistLastShown; n < hostCacheCount; n++)
{
if (hostcache[n].maxusers)
Con_Printf("%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
else
Con_Printf("%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
}
slistLastShown = n;
}
static void PrintSlistTrailer(void)
{
if (hostCacheCount)
Con_Printf("== end list ==\n\n");
else
Con_Printf("No Quake servers found.\n\n");
}
void NET_Slist_f (void)
{
if (slistInProgress)
return;
if (! slistSilent)
{
Con_Printf("Looking for Quake servers...\n");
PrintSlistHeader();
}
slistInProgress = true;
slistStartTime = Sys_FloatTime();
SchedulePollProcedure(&slistSendProcedure, 0.0);
SchedulePollProcedure(&slistPollProcedure, 0.1);
hostCacheCount = 0;
}
static void Slist_Send(void)
{
for (net_driverlevel=0; net_driverlevel < net_numdrivers; net_driverlevel++)
{
if (!slistLocal && net_driverlevel == 0)
continue;
if (net_drivers[net_driverlevel].initialized == false)
continue;
dfunc.SearchForHosts (true);
}
if ((Sys_FloatTime() - slistStartTime) < 0.5)
SchedulePollProcedure(&slistSendProcedure, 0.75);
}
static void Slist_Poll(void)
{
for (net_driverlevel=0; net_driverlevel < net_numdrivers; net_driverlevel++)
{
if (!slistLocal && net_driverlevel == 0)
continue;
if (net_drivers[net_driverlevel].initialized == false)
continue;
dfunc.SearchForHosts (false);
}
if (! slistSilent)
PrintSlist();
if ((Sys_FloatTime() - slistStartTime) < 1.5)
{
SchedulePollProcedure(&slistPollProcedure, 0.1);
return;
}
if (! slistSilent)
PrintSlistTrailer();
slistInProgress = false;
slistSilent = false;
slistLocal = true;
}
/*
===================
NET_Connect
===================
*/
int hostCacheCount = 0;
hostcache_t hostcache[HOSTCACHESIZE];
qsocket_t *NET_Connect (char *host)
{
qsocket_t *ret;
int n;
int numdrivers = net_numdrivers;
SetNetTime();
if (host && *host == 0)
host = NULL;
if (host)
{
if (Q_strcasecmp (host, "local") == 0)
{
numdrivers = 1;
goto JustDoIt;
}
if (hostCacheCount)
{
for (n = 0; n < hostCacheCount; n++)
if (Q_strcasecmp (host, hostcache[n].name) == 0)
{
host = hostcache[n].cname;
break;
}
if (n < hostCacheCount)
goto JustDoIt;
}
}
slistSilent = host ? true : false;
NET_Slist_f ();
while(slistInProgress)
NET_Poll();
if (host == NULL)
{
if (hostCacheCount != 1)
return NULL;
host = hostcache[0].cname;
Con_Printf("Connecting to...\n%s @ %s\n\n", hostcache[0].name, host);
}
if (hostCacheCount)
for (n = 0; n < hostCacheCount; n++)
if (Q_strcasecmp (host, hostcache[n].name) == 0)
{
host = hostcache[n].cname;
break;
}
JustDoIt:
for (net_driverlevel=0 ; net_driverlevel<numdrivers; net_driverlevel++)
{
if (net_drivers[net_driverlevel].initialized == false)
continue;
ret = dfunc.Connect (host);
if (ret)
return ret;
}
if (host)
{
Con_Printf("\n");
PrintSlistHeader();
PrintSlist();
PrintSlistTrailer();
}
return NULL;
}
/*
===================
NET_CheckNewConnections
===================
*/
qsocket_t *NET_CheckNewConnections (void)
{
qsocket_t *ret;
SetNetTime();
for (net_driverlevel=0 ; net_driverlevel<net_numdrivers; net_driverlevel++)
{
if (net_drivers[net_driverlevel].initialized == false)
continue;
if (net_driverlevel && listening == false)
continue;
ret = dfunc.CheckNewConnections ();
if (ret)
{
return ret;
}
}
return NULL;
}
/*
===================
NET_Close
===================
*/
void NET_Close (qsocket_t *sock)
{
if (!sock)
return;
if (sock->disconnected)
return;
SetNetTime();
// call the driver_Close function
sfunc.Close (sock);
NET_FreeQSocket(sock);
}
/*
=================
NET_GetMessage
If there is a complete message, return it in net_message
returns 0 if no data is waiting
returns 1 if a message was received
returns -1 if connection is invalid
=================
*/
extern void PrintStats(qsocket_t *s);
int NET_GetMessage (qsocket_t *sock)
{
int ret;
if (!sock)
return -1;
if (sock->disconnected)
{
Con_Printf("NET_GetMessage: disconnected socket\n");
return -1;
}
SetNetTime();
ret = sfunc.QGetMessage(sock);
// see if this connection has timed out
if (ret == 0 && sock->driver)
{
if (net_time - sock->lastMessageTime > net_messagetimeout.value)
{
NET_Close(sock);
return -1;
}
}
if (ret > 0)
{
if (sock->driver)
{
sock->lastMessageTime = net_time;
if (ret == 1)
messagesReceived++;
else if (ret == 2)
unreliableMessagesReceived++;
}
}
return ret;
}
/*
==================
NET_SendMessage
Try to send a complete length+message unit over the reliable stream.
returns 0 if the message cannot be delivered reliably, but the connection
is still considered valid
returns 1 if the message was sent properly
returns -1 if the connection died
==================
*/
int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
{
int r;
if (!sock)
return -1;
if (sock->disconnected)
{
Con_Printf("NET_SendMessage: disconnected socket\n");
return -1;
}
SetNetTime();
r = sfunc.QSendMessage(sock, data);
if (r == 1 && sock->driver)
messagesSent++;
return r;
}
int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
{
int r;
if (!sock)
return -1;
if (sock->disconnected)
{
Con_Printf("NET_SendMessage: disconnected socket\n");
return -1;
}
SetNetTime();
r = sfunc.SendUnreliableMessage(sock, data);
if (r == 1 && sock->driver)
unreliableMessagesSent++;
return r;
}
/*
==================
NET_CanSendMessage
Returns true or false if the given qsocket can currently accept a
message to be transmitted.
==================
*/
qboolean NET_CanSendMessage (qsocket_t *sock)
{
int r;
if (!sock)
return false;
if (sock->disconnected)
return false;
SetNetTime();
r = sfunc.CanSendMessage(sock);
return r;
}
int NET_SendToAll(sizebuf_t *data, int blocktime)
{
double start;
int i;
int count = 0;
qboolean state1 [MAX_SCOREBOARD];
qboolean state2 [MAX_SCOREBOARD];
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (!host_client->netconnection)
continue;
if (host_client->active)
{
if (host_client->netconnection->driver == 0)
{
NET_SendMessage(host_client->netconnection, data);
state1[i] = true;
state2[i] = true;
continue;
}
count++;
state1[i] = false;
state2[i] = false;
}
else
{
state1[i] = true;
state2[i] = true;
}
}
start = Sys_FloatTime();
while (count)
{
count = 0;
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (! state1[i])
{
if (NET_CanSendMessage (host_client->netconnection))
{
state1[i] = true;
NET_SendMessage(host_client->netconnection, data);
}
else
{
NET_GetMessage (host_client->netconnection);
}
count++;
continue;
}
if (! state2[i])
{
if (NET_CanSendMessage (host_client->netconnection))
{
state2[i] = true;
}
else
{
NET_GetMessage (host_client->netconnection);
}
count++;
continue;
}
}
if ((Sys_FloatTime() - start) > blocktime)
break;
}
return count;
}
//=============================================================================
/*
====================
NET_Init
====================
*/
void NET_Init (void)
{
int i;
int controlSocket;
qsocket_t *s;
i = COM_CheckParm ("-port");
if (!i)
i = COM_CheckParm ("-udpport");
if (!i)
i = COM_CheckParm ("-ipxport");
if (i)
{
if (i < com_argc-1)
DEFAULTnet_hostport = Q_atoi (com_argv[i+1]);
else
Sys_Error ("NET_Init: you must specify a number after -port");
}
net_hostport = DEFAULTnet_hostport;
if (COM_CheckParm("-listen") || cls.state == ca_dedicated)
listening = true;
net_numsockets = svs.maxclientslimit;
if (cls.state != ca_dedicated)
net_numsockets++;
SetNetTime();
for (i = 0; i < net_numsockets; i++)
{
s = (qsocket_t *)Hunk_AllocName(sizeof(qsocket_t), "qsocket");
s->next = net_freeSockets;
net_freeSockets = s;
s->disconnected = true;
}
// allocate space for network message buffer
SZ_Alloc (&net_message, NET_MAXMESSAGE);
Cvar_RegisterVariable (&net_messagetimeout, NULL);
Cvar_RegisterVariable (&hostname, NULL);
Cvar_RegisterVariable (&config_com_port, NULL);
Cvar_RegisterVariable (&config_com_irq, NULL);
Cvar_RegisterVariable (&config_com_baud, NULL);
Cvar_RegisterVariable (&config_com_modem, NULL);
Cvar_RegisterVariable (&config_modem_dialtype, NULL);
Cvar_RegisterVariable (&config_modem_clear, NULL);
Cvar_RegisterVariable (&config_modem_init, NULL);
Cvar_RegisterVariable (&config_modem_hangup, NULL);
Cmd_AddCommand ("slist", NET_Slist_f);
Cmd_AddCommand ("listen", NET_Listen_f);
Cmd_AddCommand ("maxplayers", MaxPlayers_f);
Cmd_AddCommand ("port", NET_Port_f);
// initialize all the drivers
for (net_driverlevel=0 ; net_driverlevel<net_numdrivers ; net_driverlevel++)
{
controlSocket = net_drivers[net_driverlevel].Init();
if (controlSocket == -1)
continue;
net_drivers[net_driverlevel].initialized = true;
net_drivers[net_driverlevel].controlSock = controlSocket;
if (listening)
net_drivers[net_driverlevel].Listen (true);
}
if (*my_ipx_address)
Con_DPrintf("IPX address %s\n", my_ipx_address);
if (*my_tcpip_address)
Con_DPrintf("TCP/IP address %s\n", my_tcpip_address);
}
/*
====================
NET_Shutdown
====================
*/
void NET_Shutdown (void)
{
qsocket_t *sock;
SetNetTime();
for (sock = net_activeSockets; sock; sock = sock->next)
NET_Close(sock);
//
// shutdown the drivers
//
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
{
if (net_drivers[net_driverlevel].initialized == true)
{
net_drivers[net_driverlevel].Shutdown ();
net_drivers[net_driverlevel].initialized = false;
}
}
}
static PollProcedure *pollProcedureList = NULL;
void NET_Poll(void)
{
PollProcedure *pp;
qboolean useModem;
if (!configRestored)
{
if (serialAvailable)
{
if (config_com_modem.value == 1.0)
useModem = true;
else
useModem = false;
SetComPortConfig (0, (int)config_com_port.value, (int)config_com_irq.value, (int)config_com_baud.value, useModem);
SetModemConfig (0, config_modem_dialtype.string, config_modem_clear.string, config_modem_init.string, config_modem_hangup.string);
}
configRestored = true;
}
SetNetTime();
for (pp = pollProcedureList; pp; pp = pp->next)
{
if (pp->nextTime > net_time)
break;
pollProcedureList = pp->next;
pp->procedure(pp->arg);
}
}
void SchedulePollProcedure(PollProcedure *proc, double timeOffset)
{
PollProcedure *pp, *prev;
proc->nextTime = Sys_FloatTime() + timeOffset;
for (pp = pollProcedureList, prev = NULL; pp; pp = pp->next)
{
if (pp->nextTime >= proc->nextTime)
break;
prev = pp;
}
if (prev == NULL)
{
proc->next = pollProcedureList;
pollProcedureList = proc;
return;
}
proc->next = pp;
prev->next = proc;
}

112
quakespasm/Quake/net_sdl.c Normal file
View File

@ -0,0 +1,112 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2005 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "net_loop.h"
#include "net_dgrm.h"
#include "net_sdlnet.h"
net_driver_t net_drivers[MAX_NET_DRIVERS] =
{
{
"Loopback",
false,
Loop_Init,
Loop_Listen,
Loop_SearchForHosts,
Loop_Connect,
Loop_CheckNewConnections,
Loop_GetMessage,
Loop_SendMessage,
Loop_SendUnreliableMessage,
Loop_CanSendMessage,
Loop_CanSendUnreliableMessage,
Loop_Close,
Loop_Shutdown
}
,
{
"Datagram",
false,
Datagram_Init,
Datagram_Listen,
Datagram_SearchForHosts,
Datagram_Connect,
Datagram_CheckNewConnections,
Datagram_GetMessage,
Datagram_SendMessage,
Datagram_SendUnreliableMessage,
Datagram_CanSendMessage,
Datagram_CanSendUnreliableMessage,
Datagram_Close,
Datagram_Shutdown
}
,
{
"Datagram",
false,
Datagram_Init,
Datagram_Listen,
Datagram_SearchForHosts,
Datagram_Connect,
Datagram_CheckNewConnections,
Datagram_GetMessage,
Datagram_SendMessage,
Datagram_SendUnreliableMessage,
Datagram_CanSendMessage,
Datagram_CanSendUnreliableMessage,
Datagram_Close,
Datagram_Shutdown
}
};
int net_numdrivers = 2;
net_landriver_t net_landrivers[MAX_NET_DRIVERS] =
{
{
"UDP",
false,
0,
SDLN_Init,
SDLN_Shutdown,
SDLN_Listen,
SDLN_OpenSocket,
SDLN_CloseSocket,
SDLN_Connect,
SDLN_CheckNewConnections,
SDLN_Read,
SDLN_Write,
SDLN_Broadcast,
SDLN_AddrToString,
SDLN_StringToAddr,
SDLN_GetSocketAddr,
SDLN_GetNameFromAddr,
SDLN_GetAddrFromName,
SDLN_AddrCompare,
SDLN_GetSocketPort,
SDLN_SetSocketPort
}
};
int net_numlandrivers = 1;

View File

@ -0,0 +1,565 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundat(&addr->sa_dataion, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#if defined(_WIN32)
#include <winsock2.h>
#endif
#if defined(LINUX)
#include <SDL_net.h>
#else
#include <SDL_net/SDL_net.h>
#endif
#include "net_sdlnet.h"
#define MAX_SOCKETS 32
#define MAXHOSTNAMELEN 255
#define AF_INET 2 /* internet */
static int net_controlsocket;
static int net_broadcastsocket = 0;
static int net_acceptsocket = -1;
static struct qsockaddr broadcastaddr;
SDLNet_SocketSet acceptsocket_set;
IPaddress myaddr;
// contains a map of socket numbers to SDL_net UDP sockets
UDPsocket net_sockets[MAX_SOCKETS];
int socket_id(UDPsocket socket)
{
int i;
int index = -1;
for (i = 0; i < MAX_SOCKETS; i++)
{
if (net_sockets[i] == socket)
return i;
if (net_sockets[i] == NULL && index == -1)
{
index = i;
break;
}
}
if (index == -1)
{
// todo error
}
net_sockets[index] = socket;
return index;
}
char *_AddrToString (int ip, int port)
{
static char buffer[22];
sprintf(buffer, "%d.%d.%d.%d:%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff, port);
return buffer;
}
char *_IPAddrToString (IPaddress *address)
{
int ip;
int port;
ip = SDLNet_Read32(&address->host);
port = SDLNet_Read16(&address->port);
return _AddrToString(ip, port);
}
int SDLN_Init (void)
{
int i;
char buff[MAXHOSTNAMELEN];
char *p;
IPaddress *ipaddress;
// init SDL
if (SDLNet_Init() == -1)
{
Con_SafePrintf ("SDL_net initialization failed.\n");
return -1;
}
// allocate a socket set for the accept socket
acceptsocket_set = SDLNet_AllocSocketSet(1);
if (acceptsocket_set == NULL)
{
Con_DPrintf ("SDL_net initialization failed: Could not create socket set.\n");
return -1;
}
// determine my name
if (gethostname(buff, MAXHOSTNAMELEN) == -1)
{
Con_DPrintf ("SDL_net initialization failed: Could not determine host name.\n");
return -1;
}
// if the quake hostname isn't set, set it to the machine name
if (Q_strcmp(hostname.string, "UNNAMED") == 0)
{
// see if it's a text IP address (well, close enough)
for (p = buff; *p; p++)
if ((*p < '0' || *p > '9') && *p != '.')
break;
// if it is a real name, strip off the domain; we only want the host
if (*p)
{
for (i = 0; i < 15; i++)
if (buff[i] == '.')
break;
buff[i] = 0;
}
Cvar_Set ("hostname", buff);
}
// set my IP address
i = COM_CheckParm ("-ip");
if (i)
{
if (i < com_argc-1)
{
SDLNet_ResolveHost(&myaddr, com_argv[i+1], 0);
if (myaddr.host == INADDR_NONE)
Sys_Error ("%s is not a valid IP address", com_argv[i+1]);
strcpy(my_tcpip_address, com_argv[i+1]);
}
else
{
Sys_Error ("NET_Init: you must specify an IP address after -ip");
}
}
else
{
SDLNet_ResolveHost(&myaddr, NULL, 0);
strcpy(my_tcpip_address, "INADDR_ANY");
}
// open the control socket
if ((net_controlsocket = SDLN_OpenSocket (0)) == -1)
{
Con_Printf("SDLN_Init: Unable to open control socket\n");
return -1;
}
broadcastaddr.sa_family = AF_INET;
ipaddress = (IPaddress *)&(broadcastaddr.sa_data);
SDLNet_Write32(INADDR_BROADCAST, &ipaddress->host);
SDLNet_Write16(net_hostport, &ipaddress->port);
Con_Printf("SDL_net TCP/IP initialized\n");
tcpipAvailable = true;
return net_controlsocket;
}
void SDLN_Shutdown (void)
{
SDLN_Listen (false);
SDLN_CloseSocket (net_controlsocket);
}
void SDLN_GetLocalAddress()
{
if (myaddr.host != INADDR_ANY)
return;
SDLNet_ResolveHost(&myaddr, NULL, 0);
}
void SDLN_Listen (qboolean state)
{
// enable listening
if (state)
{
if (net_acceptsocket != -1)
return;
SDLN_GetLocalAddress();
if ((net_acceptsocket = SDLN_OpenSocket (net_hostport)) == -1)
Sys_Error ("SDLN_Listen: Unable to open accept socket\n");
SDLNet_UDP_AddSocket(acceptsocket_set, net_sockets[net_acceptsocket]);
}
else
{
// disable listening
if (net_acceptsocket == -1)
return;
SDLNet_UDP_DelSocket(acceptsocket_set, net_sockets[net_acceptsocket]);
SDLN_CloseSocket(net_acceptsocket);
net_acceptsocket = -1;
}
}
int SDLN_OpenSocket (int port)
{
UDPsocket newsocket;
static IPaddress address;
if ((newsocket = SDLNet_UDP_Open(port)) == NULL)
return -1;
// todo check what this does
// if (pioctlsocket (newsocket, FIONBIO, &_true) == -1)
// goto ErrorReturn;
address.host = myaddr.host;
address.port = SDLNet_Read16(&port);
if (SDLNet_UDP_Bind(newsocket, 0, &address) != -1)
return socket_id(newsocket);
Sys_Error ("Unable to bind to %s", _IPAddrToString(&address));
SDLNet_UDP_Close(newsocket);
return -1;
}
int SDLN_CloseSocket (int socketid)
{
UDPsocket socket;
if (socketid == net_broadcastsocket)
net_broadcastsocket = -1;
socket = net_sockets[socketid];
if (socket == NULL)
return -1;
SDLNet_UDP_Close(socket);
net_sockets[socketid] = NULL;
return 0;
}
int SDLN_Connect (int socket, struct qsockaddr *addr)
{
return 0;
}
int SDLN_CheckNewConnections (void)
{
if (net_acceptsocket == -1)
return -1;
if (SDLNet_CheckSockets(acceptsocket_set, 0) > 0)
return net_acceptsocket;
return -1;
}
UDPpacket *init_packet(UDPpacket *packet, int len)
{
if (packet == NULL)
return SDLNet_AllocPacket(len);
if (packet->maxlen < len)
SDLNet_ResizePacket(packet, len);
return packet;
}
int SDLN_Read (int socketid, byte *buf, int len, struct qsockaddr *addr)
{
int numrecv;
static UDPpacket *packet;
IPaddress *ipaddress;
UDPsocket socket = net_sockets[socketid];
if (socket == NULL)
return -1;
packet = init_packet(packet, len);
numrecv = SDLNet_UDP_Recv(socket, packet);
if (numrecv == 1)
{
memcpy(buf, packet->data, packet->len);
addr->sa_family = AF_INET;
ipaddress = (IPaddress *)&(addr->sa_data);
ipaddress->host = packet->address.host;
ipaddress->port = packet->address.port;
return packet->len;
}
return numrecv;
}
int SDLN_Write (int socketid, byte *buf, int len, struct qsockaddr *addr)
{
int numsent;
static UDPpacket *packet;
UDPsocket socket;
IPaddress *ipaddress;
socket = net_sockets[socketid];
if (socket == NULL)
return -1;
packet = init_packet(packet, len);
memcpy(packet->data, buf, len);
packet->len = len;
ipaddress = (IPaddress *)&(addr->sa_data);
packet->address.host = ipaddress->host;
packet->address.port = ipaddress->port;
numsent = SDLNet_UDP_Send(socket, -1, packet);
if (numsent == 0)
return 0;
return len;
}
int SDLN_Broadcast (int socketid, byte *buf, int len)
{
if (socketid != net_broadcastsocket)
{
if (net_broadcastsocket != 0)
Sys_Error("Attempted to use multiple broadcast sockets\n");
// todo make socket broadcast capable
Sys_Error("Unable to make socket broadcast capable\n");
}
return SDLN_Write(socketid, buf, len, &broadcastaddr);
}
char *SDLN_AddrToString (struct qsockaddr *addr)
{
int ip;
int port;
IPaddress *ipaddress;
ipaddress = (IPaddress *)&(addr->sa_data);
ip = SDLNet_Read32(&ipaddress->host);
port = SDLNet_Read16(&ipaddress->port);
return _AddrToString(ip, port);
}
int SDLN_StringToAddr (char *string, struct qsockaddr *addr)
{
int ha1, ha2, ha3, ha4, hp;
int hostaddr;
IPaddress *ipaddress;
sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);
hostaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
addr->sa_family = AF_INET;
ipaddress = (IPaddress *)&(addr->sa_data);
SDLNet_Write32(hostaddr, &ipaddress->host);
SDLNet_Write16(hp, &ipaddress->port);
return 0;
}
int SDLN_GetSocketAddr (int socketid, struct qsockaddr *addr)
{
static UDPsocket socket;
IPaddress *peeraddress;
IPaddress *ipaddress;
Q_memset(addr, 0, sizeof(struct qsockaddr));
socket = net_sockets[socketid];
if (socket == NULL)
return -1;
peeraddress = SDLNet_UDP_GetPeerAddress(socket, -1);
if (peeraddress == NULL)
return -1;
addr->sa_family = AF_INET;
ipaddress = (IPaddress *)&(addr->sa_data);
if (peeraddress->host == 0 || peeraddress->host == inet_addr("127.0.0.1"))
{
ipaddress->host = myaddr.host;
ipaddress->port = myaddr.port;
}
else
{
ipaddress->host = peeraddress->host;
ipaddress->port = peeraddress->port;
}
return 0;
}
int SDLN_GetNameFromAddr (struct qsockaddr *addr, char *name)
{
char *buf;
IPaddress *ipaddress;
ipaddress = (IPaddress *)&(addr->sa_data);
buf = (char *)SDLNet_ResolveIP(ipaddress);
if (buf != NULL) {
Q_strncpy(name, buf, NET_NAMELEN - 1);
return 0;
}
Q_strcpy(name, SDLN_AddrToString(addr));
return 0;
}
//=============================================================================
/*
============
PartialIPAddress
this lets you type only as much of the net address as required, using
the local network components to fill in the rest
============
*/
static int PartialIPAddress (char *in, struct qsockaddr *hostaddr)
{
char buff[256];
char *b;
int addr;
int num;
int mask;
int tmp;
int run;
int port;
IPaddress *ipaddress;
buff[0] = '.';
b = buff;
strcpy(buff+1, in);
if (buff[1] == '.')
b++;
addr = 0;
mask=-1;
while (*b == '.')
{
b++;
num = 0;
run = 0;
while (!( *b < '0' || *b > '9'))
{
num = num*10 + *b++ - '0';
if (++run > 3)
return -1;
}
if ((*b < '0' || *b > '9') && *b != '.' && *b != ':' && *b != 0)
return -1;
if (num < 0 || num > 255)
return -1;
mask<<=8;
addr = (addr<<8) + num;
}
if (*b++ == ':')
port = Q_atoi(b);
else
port = net_hostport;
tmp = SDLNet_Read32(&myaddr.host);
tmp = (tmp & mask) | addr;
hostaddr->sa_family = AF_INET;
ipaddress = (IPaddress *)&(hostaddr->sa_data);
SDLNet_Write32(tmp, &ipaddress->host);
SDLNet_Write16(port, &ipaddress->port);
return 0;
}
int SDLN_GetAddrFromName (char *name, struct qsockaddr *addr)
{
IPaddress *ipaddress;
if (name[0] >= '0' && name[0] <= '9')
return PartialIPAddress (name, addr);
ipaddress = (IPaddress *)&(addr->sa_data);
if (SDLNet_ResolveHost((IPaddress *)(&addr->sa_data), name, 26000) == -1)
return -1;
addr->sa_family = AF_INET;
return 0;
}
int SDLN_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2)
{
IPaddress *ipaddr1;
IPaddress *ipaddr2;
if (addr1->sa_family != addr2->sa_family)
return -1;
ipaddr1 = (IPaddress *)&(addr1->sa_data);
ipaddr2 = (IPaddress *)&(addr2->sa_data);
if (ipaddr1->host != ipaddr2->host)
return -1;
if (ipaddr1->port != ipaddr2->port)
return 1;
return 0;
}
int SDLN_GetSocketPort (struct qsockaddr *addr)
{
IPaddress *ipaddress;
ipaddress = (IPaddress *)&(addr->sa_data);
return SDLNet_Read16(&ipaddress->port);
}
int SDLN_SetSocketPort (struct qsockaddr *addr, int port)
{
IPaddress *ipaddress;
ipaddress = (IPaddress *)&(addr->sa_data);
SDLNet_Write16(port, &ipaddress->port);
return 0;
}

View File

@ -0,0 +1,38 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
int SDLN_Init (void);
void SDLN_Shutdown (void);
void SDLN_Listen (qboolean state);
int SDLN_OpenSocket (int port);
int SDLN_CloseSocket (int socket);
int SDLN_Connect (int socket, struct qsockaddr *addr);
int SDLN_CheckNewConnections (void);
int SDLN_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
int SDLN_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
int SDLN_Broadcast (int socket, byte *buf, int len);
char *SDLN_AddrToString (struct qsockaddr *addr);
int SDLN_StringToAddr (char *string, struct qsockaddr *addr);
int SDLN_GetSocketAddr (int socket, struct qsockaddr *addr);
int SDLN_GetNameFromAddr (struct qsockaddr *addr, char *name);
int SDLN_GetAddrFromName (char *name, struct qsockaddr *addr);
int SDLN_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
int SDLN_GetSocketPort (struct qsockaddr *addr);
int SDLN_SetSocketPort (struct qsockaddr *addr, int port);

Some files were not shown because too many files have changed in this diff Show More