Permalink
Browse files

initial commit

  • Loading branch information...
1 parent ad0e693 commit 294db6dfbae77eb1fa7af2c64dd32e1dd105e1c2 @core-code committed Nov 1, 2012
Showing 776 changed files with 145,714 additions and 1 deletion.
@@ -0,0 +1,17 @@
+//
+// AnimatedTextureShader.h
+// Core3D
+//
+// Created by CoreCode on 29.12.07.
+// Copyright 2007 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+
+@interface AnimatedTextureShader : SceneNode
+{
+ Shader *shader;
+ GLuint replacementColorPos;
+ vector4f savedColor;
+}
+
+@end
@@ -0,0 +1,57 @@
+//
+// AnimatedTextureShader.m
+// Core3D
+//
+// Created by CoreCode on 29.12.07.
+// Copyright 2007 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+#import "Game.h"
+
+
+@implementation AnimatedTextureShader
+
+- (id)init
+{
+ if ((self = [super init]))
+ {
+ shader = [Shader newShaderNamed:@"phong_animated" withTexcoordsBound:YES andNormalsBound:YES];
+
+ [shader bind];
+ replacementColorPos = glGetUniformLocation(shader.shaderName, "replacementColor");
+ }
+
+ return self;
+}
+
+- (void)render // override render instead of implementing renderNode
+{
+ if ([currentRenderPass settings] & kRenderPassSetMaterial)
+ {
+ [shader bind];
+
+ vector4f col;
+
+ if (globalInfo.frame % 10 > 5)
+ col = vector4f(1.0f, 0.1f, 0.1f, 1.0f);
+ else
+ col = vector4f(1.0f, 1.0f, 0.4f, 1.0f);
+
+ if (col != savedColor)
+ {
+ glUniform4fv(replacementColorPos, 1, col.data());
+ savedColor = col;
+ }
+ }
+
+ [children makeObjectsPerformSelector:@selector(render)];
+}
+
+- (void)dealloc
+{
+ [shader release];
+
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,26 @@
+//
+// ApplicationDelegate.h
+// CoreBreach
+//
+// Created by CoreCode on 25.01.11.
+// Copyright 2011 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+#ifdef SDL
+ #import "HIDSupport_SDL.h"
+#elif defined(TARGET_OS_MAC)
+ #import "HIDSupport.h"
+#endif
+
+@interface ApplicationDelegate : NSObject
+{
+ HIDSupport *hid;
+}
+
+@property (readonly, nonatomic) HIDSupport *hid;
+
+#ifndef TARGET_OS_MAC
+- (IBAction)installRaceTrack:(id)sender;
+#endif
+
+@end
@@ -0,0 +1,155 @@
+//
+// ApplicationDelegate.m
+// CoreBreach
+//
+// Created by CoreCode on 25.01.11.
+// Copyright 2011 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+#import "ApplicationDelegate.h"
+
+
+@class Launcher;
+
+@implementation ApplicationDelegate
+
+@synthesize hid;
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notification
+{
+
+ // NSLog(@"applicationDidFinishLaunching");
+
+
+#ifdef SDL
+ SDL_Init(SDL_INIT_JOYSTICK);
+#endif
+
+
+ hid = [[HIDSupport alloc] init];
+
+ [hid restoreConfiguration:self];
+ // [hid startHID];
+
+
+#ifdef SDL
+ SDL_Quit();
+#endif
+
+
+#ifdef TIMEDEMO
+ LOAD_NIB(@"Core3D", NSApp);
+
+#else
+
+#ifdef __COCOTRON__
+ LOAD_NIB(@"KeepCocotronAlive", NSApp);
+
+#endif
+
+#if defined(TARGET_OS_MAC) && defined(SDL)
+ LOAD_NIB(@"Launcher-windows", NSApp);
+#else
+
+
+ if (!LOAD_NIB(@"Launcher", NSApp))
+ NSLog(@"Error: could not load Launcher NIB");
+#endif
+#endif
+}
+
+#if defined(SDL) && defined(TARGET_OS_MAC)
+- (void)awakeFromNib
+{
+ [self applicationDidFinishLaunching:nil];
+}
+#endif
+
+- (void)applicationWillTerminate:(NSNotification *)aNotification
+{
+// NSLog(@"applicationWillTerminate");
+ if (hid)
+ {
+ //[[HIDSupport sharedInstance] stopHID];
+ [hid release];
+ hid = nil;
+ }
+}
+
+#ifdef GNUSTEP
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
+{
+ return NO; // neccessary when NSMenuInterfaceStyle = NSWindows95InterfaceStyle
+}
+#endif
+
+//- (void)applicationWillResignActive:(NSNotification *)aNotification
+//{
+// NSLog(@"res del");
+// [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillResignActiveNotification object:self];
+//
+//}
+
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+ if (NSRunAlertPanel(@"CoreBreach", $stringf(@"%@\n%@",
+ NSLocalizedString(@"Do you really want to install this 3rd party track? Please only install tracks from the official site or from people you can trust.", nil),
+ [filename lastPathComponent]),
+ NSLocalizedString(@"Install", nil),
+ NSLocalizedString(@"Cancel", nil), nil) != 0)
+ {
+ NSString *appsupp = APPLICATION_SUPPORT_DIR;
+#ifdef __COCOTRON__ // bug #821
+ [[NSFileManager defaultManager] createDirectoryAtPath:[appsupp stringByAppendingPathComponent:[filename lastPathComponent]] withIntermediateDirectories:YES attributes:nil error:NULL];
+
+ NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:filename error:NULL];
+ for (NSString *file in contents)
+ {
+ // BOOL succ =
+ [[NSFileManager defaultManager] copyItemAtPath:[filename stringByAppendingPathComponent:file]
+ toPath:[[appsupp stringByAppendingPathComponent:[filename lastPathComponent]] stringByAppendingPathComponent:file]
+ error:NULL];
+ // NSLog(@" copy from to %@ %@ %i", [appsupp stringByAppendingPathComponent:file], [[appsupp stringByAppendingPathComponent:[filename lastPathComponent]] stringByAppendingPathComponent:file], succ);
+ }
+
+#else
+
+ [[NSFileManager defaultManager] createDirectoryAtPath:appsupp withIntermediateDirectories:YES attributes:nil error:NULL];
+
+ [[NSFileManager defaultManager] copyItemAtPath:filename
+ toPath:[appsupp stringByAppendingPathComponent:[filename lastPathComponent]]
+ error:NULL];
+#endif
+#ifdef TARGET_OS_MAC
+ [(NSNotificationCenter *)[NSNotificationCenter defaultCenter] postNotificationName:@"mapInstalled" object:nil];
+#else
+ NSRunAlertPanel(@"CoreBreach", @"The 3rd party track was successfully installed, please quit and re-launch CoreBreach.", @"OK", nil, nil);
+#endif
+
+ return YES;
+ }
+
+ return NO;
+}
+
+#ifndef TARGET_OS_MAC
+- (IBAction)installRaceTrack:(id)sender
+{
+ NSOpenPanel *panel = [NSOpenPanel openPanel];
+ [panel setAllowedFileTypes:$array(@"cbtrack")];
+ [panel setCanChooseFiles:NO];
+ [panel setCanChooseDirectories:YES];
+
+
+ if ([panel runModalForDirectory:NSHomeDirectory() file:nil types:$array(@"cbtrack")] == NSOKButton)
+ [self application:nil openFile:[[panel filenames] objectAtIndex:0]];
+}
+#endif
+
+//- (void)dealloc
+//{
+// NSLog(@"appdelegate dealloc");
+//
+// [super dealloc];
+//}
+@end
@@ -0,0 +1,15 @@
+//
+// ApplicationSubclass.h
+// CoreBreach
+//
+// Created by CoreCode on 14.03.11.
+// Copyright 2011 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+
+
+@interface ApplicationSubclass : NSApplication
+{
+}
+
+@end
@@ -0,0 +1,46 @@
+//
+// ApplicationSubclass.m
+// CoreBreach
+//
+// Created by CoreCode on 14.03.11.
+// Copyright 2011 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+#import "ApplicationSubclass.h"
+
+
+@implementation ApplicationSubclass
+
+#ifdef TARGET_OS_MAC
+- (NSInteger)requestUserAttention:(NSRequestUserAttentionType)requestType
+{
+ return 0;
+}
+
+- (void)sendEvent:(NSEvent *)anEvent{
+ //This works around an AppKit bug, where key up events while holding
+ //down the command key don't get sent to the key window.
+ if([anEvent type] == NSKeyUp && ([anEvent modifierFlags] & NSCommandKeyMask))
+ {
+ [[self keyWindow] sendEvent:anEvent];
+ }
+ else
+ {
+ [super sendEvent:anEvent];
+ }
+}
+
+- (void)terminate:(id)sender
+{
+ // NSLog(@"subterm");
+ [[self delegate] applicationWillTerminate:nil];
+
+ [super terminate:sender];
+}
+#endif
+
+- (void)showHelp:(id)sender
+{
+ [[NSWorkspace sharedWorkspace] openFile:[[NSBundle mainBundle] pathForResource:@"Manual" ofType:@"pdf"]];
+}
+@end
View
@@ -0,0 +1,21 @@
+//
+// BonusBox.h
+// CoreBreach
+//
+// Created by CoreCode on 24.03.11.
+// Copyright 2011 - 2012 CoreCode. Licensed under the GPL License, see LICENSE.txt
+//
+
+
+@interface BonusBox : CollideableSceneNode
+{
+ BOOL isSpeedbox;
+ BOOL wasVisible;
+ vector3f shadowOrientation;
+ float slopeAngle, turnAngle;
+}
+
+@property (assign, nonatomic) vector3f shadowOrientation;
+@property (assign, nonatomic) BOOL isSpeedbox;
+
+@end
Oops, something went wrong.

0 comments on commit 294db6d

Please sign in to comment.