Skip to content

Instantly share code, notes, and snippets.

@TyounanMOTI
Created July 6, 2012 17:45
Show Gist options
  • Save TyounanMOTI/3061579 to your computer and use it in GitHub Desktop.
Save TyounanMOTI/3061579 to your computer and use it in GitHub Desktop.
warsow0.7 mac_build update SHA:1ff970fd2f7 in https://github.com/TyounanMOTI/warsow_mac
diff --git angelwrap/addon/addon_dictionary.h angelwrap/addon/addon_dictionary.h
index c5d0166..8873c63 100644
--- angelwrap/addon/addon_dictionary.h
+++ angelwrap/addon/addon_dictionary.h
@@ -5,7 +5,11 @@
// string type must be registered with the engine before registering the
// dictionary type
+#if defined ( __APPLE__ )
+#include <angelscript/angelscript.h>
+#else
#include <angelscript.h>
+#endif
#include <string>
#ifdef _MSC_VER
diff --git gameshared/q_math.c gameshared/q_math.c
index cd244a6..8f0552a 100644
--- gameshared/q_math.c
+++ gameshared/q_math.c
@@ -1112,7 +1112,7 @@ void Quat_Quat3( const vec3_t in, quat_t out )
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
- out[3] = -sqrt(max(1 - in[0]*in[0] - in[1]*in[1] - in[2]*in[2], 0));
+ out[3] = -sqrt(max(1 - in[0]*in[0] - in[1]*in[1] - in[2]*in[2], 0.0f));
}
qboolean Quat_Compare( const quat_t q1, const quat_t q2 )
diff --git ref_gl/r_image.c ref_gl/r_image.c
index 1586a30..5b0817e 100644
--- ref_gl/r_image.c
+++ ref_gl/r_image.c
@@ -21,10 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if defined ( __MACOSX__ )
#include "libjpeg/jpeglib.h"
+#include "png/png.h"
#else
#include "jpeglib.h"
-#endif
#include "png.h"
+#endif
+
#include <setjmp.h>
diff --git ui/as/asbind.h ui/as/asbind.h
index e9b161d..351e3ee 100644
--- ui/as/asbind.h
+++ ui/as/asbind.h
@@ -998,10 +998,10 @@ template<typename T> struct GetArg<const T*> {
const T * operator()( asIScriptContext *ctx ) { return ctx->GetReturnAddress(); }
};
template<typename T> struct GetArg<T&> {
- T & operator()( asIScriptContext *ctx ) { return *ctx->GetReturnAddress(); }
+ T & operator()( asIScriptContext *ctx ) { return *static_cast<T*>(ctx->GetReturnAddress()); }
};
template<typename T> struct GetArg<const T&> {
- const T & operator()( asIScriptContext *ctx ) { return *ctx->GetReturnAddress(); }
+ const T & operator()( asIScriptContext *ctx ) { return *static_cast<T*>(ctx->GetReturnAddress()); }
};
//====================
diff --git ui/ui_precompiled.h ui/ui_precompiled.h
index 59bff95..7eb9f7d 100644
--- ui/ui_precompiled.h
+++ ui/ui_precompiled.h
@@ -21,3 +21,9 @@
#include <stdexcept>
#include "kernel/ui_syscalls.h"
+
+#if defined (__APPLE__)
+// LLVM GCC 4.2 complains min and max undefined in q_math.c
+using std::max;
+using std::min;
+#endif
diff --git mac_glw.h mac_glw.h
index 4560bf2..c9a53a5 100644
--- mac_glw.h
+++ mac_glw.h
@@ -29,6 +29,9 @@ typedef struct
extern glwstate_t glw_state;
+extern cvar_t *vid_fullscreen;
+extern cvar_t *vid_multiscreen_head;
+
#define VIDEOMODE_HACK
#endif // __MAC_GLW_H_
diff --git mac_glw.m mac_glw.m
index f0c63d8..a3bdfac 100644
--- mac_glw.m
+++ mac_glw.m
@@ -24,9 +24,11 @@
#include <OpenGL/OpenGL.h>
#include "../ref_gl/r_local.h"
-#include "../client/keys.h"
+#include "../client/client.h"
#include "mac_glw.h"
+void VID_NewWindow( int width, int height );
+
glwstate_t glw_state = { NULL, qfalse };
/**
@@ -35,20 +37,20 @@ glwstate_t glw_state = { NULL, qfalse };
* @param fullscreen <code>qtrue</code> for a fullscreen mode,
* <code>qfalse</code> otherwise
*/
-int GLimp_SetMode( int mode, qboolean fullscreen )
+rserr_t GLimp_SetMode( int x, int y, int width, int height, qboolean fullscreen, qboolean wideScreen )
{
- int width;
- int height;
int colorbits;
- qboolean wideScreen;
+ /*
if( !VID_GetModeInfo( &width, &height, &wideScreen, mode ) )
{
Com_Printf( " invalid mode\n" );
return rserr_invalid_mode;
}
+ */
- colorbits = r_colorbits->integer;
+ if( r_colorbits->integer == 16 || r_colorbits->integer == 24 ) colorbits = r_colorbits->integer;
+ else colorbits = 0;
#ifdef VIDEOMODE_HACK
/*
@@ -97,25 +99,6 @@ int GLimp_SetMode( int mode, qboolean fullscreen )
}
/**
- * Get current videomode
- */
-
-int GLimp_GetCurrentMode( void )
-{
- const SDL_VideoInfo *info = NULL;
-
- info = SDL_GetVideoInfo();
- if( !info )
- {
- Com_Printf( "Video query failed: %s\n", SDL_GetError() );
- return -1;
- }
- Com_Printf( "SDL: Detected resolution %ix%i\n", info->current_w, info->current_h );
-
- return VID_GetModeNum( info->current_w, info->current_h );
-}
-
-/**
* Shutdown GLimp sub system.
*/
void GLimp_Shutdown()
@@ -123,7 +106,6 @@ void GLimp_Shutdown()
}
-
/**
* Initialize GLimp sub system.
* @param hinstance
@@ -273,3 +255,5 @@ void Sys_FreeClipboardData( char *data )
{
Q_free( data );
}
+
+void Sys_OpenURLInBrowser( const char *url ) {}
\ No newline at end of file
diff --git mac_vid.m mac_vid.m
new file mode 100644
index 0000000..334b38e
--- /dev/null
+++ mac_vid.m
@@ -0,0 +1,109 @@
+/*
+ Copyright (C) 1997-2001 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.
+
+ */
+
+#include "../client/client.h"
+#import <AppKit/NSScreen.h>
+
+static int VID_WndProc( void *wnd, int ev, int p1, int p2 )
+{
+ return 0;
+}
+
+/*
+ * VID_Sys_Init
+ */
+int VID_Sys_Init( int x, int y, int width, int height, qboolean fullScreen, qboolean wideScreen, qboolean verbose )
+{
+ extern cvar_t *vid_parentwid;
+
+ return R_Init( NULL, NULL, (void *)(strtol( vid_parentwid->string, NULL, 0 )),
+ x, y, width, height, fullScreen, wideScreen, verbose );
+}
+
+/*
+ * VID_Front_f
+ */
+void VID_Front_f( void )
+{
+}
+
+/*
+ * VID_UpdateWindowPosAndSize
+ */
+void VID_UpdateWindowPosAndSize( int x, int y )
+{
+}
+
+/*
+ * VID_EnableAltTab
+ */
+void VID_EnableAltTab( qboolean enable )
+{
+}
+
+/*
+ * VID_GetWindowHandle - The sound module may require the handle when using Window's directsound
+ */
+void *VID_GetWindowHandle( void )
+{
+ return ( void * )NULL;
+}
+
+/*
+ * VID_EnableWinKeys
+ */
+void VID_EnableWinKeys( qboolean enable )
+{
+}
+
+/*
+ ** VID_FlashWindow
+ *
+ * Sends a flash message to inactive window
+ */
+void VID_FlashWindow( int count )
+{
+}
+
+/*
+ ** VID_GetScreenSize
+ */
+qboolean VID_GetScreenSize( int *width, int *height )
+{
+ NSScreen* screen = [NSScreen mainScreen];
+ if (screen)
+ {
+ NSRect rect = [screen frame];
+ *width = floor(rect.size.width);
+ *height = floor(rect.size.height);
+ return qtrue;
+ }
+
+ return qfalse;
+}
+
+/*
+ ** VID_NewWindow
+ */
+void VID_NewWindow( int width, int height )
+{
+ viddef.width = width;
+ viddef.height = height;
+}
@TyounanMOTI
Copy link
Author

implemented Sys_OpenURLInBrowser

+
+void   Sys_OpenURLInBrowser( const char *url )
+{
+  NSString *string_url = [NSString stringWithUTF8String:url];
+  NSURL *ns_url = [NSURL URLWithString:string_url];
+  [[NSWorkspace sharedWorkspace] openURL:ns_url];
+}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment