From 6aeefd781d62a9b5b8cf2f4d3a7ba4abaf82f54f Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Thu, 24 Nov 2016 16:52:52 +0800 Subject: [PATCH] Removed obsolete PLATFORM_MACOSX code --- Source/Game.h | 16 ------- Source/GameDraw.cpp | 10 ---- Source/GameInitDispose.cpp | 20 -------- Source/MacCompatibility.cpp | 6 --- Source/MacCompatibility.h | 3 -- Source/Models.cpp | 8 ---- Source/Quaternions.h | 20 +------- Source/TGALoader.cpp | 96 ------------------------------------- 8 files changed, 1 insertion(+), 178 deletions(-) diff --git a/Source/Game.h b/Source/Game.h index ca3f194..f554d1e 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -22,20 +22,6 @@ along with Lugaru. If not, see . #include "SDL.h" -#if (defined(__APPLE__) && defined(__MACH__)) -# ifdef PLATFORM_MACOSX -# error Do not define PLATFORM_MACOSX for new builds. It is for the old Carbonized build. -# endif -#endif - -#ifdef PLATFORM_MACOSX -#include -#include "Quicktime.h" -#endif - -//Jordan included glut.h -//#include - #include "TGALoader.h" #include "Terrain.h" @@ -45,10 +31,8 @@ along with Lugaru. If not, see . #include "Lights.h" #include "Person.h" #include "Sprite.h" -//#include #include "Text.h" #include "Objects.h" -//#include #include "Weapons.h" #include "binio.h" #include diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 213d894..6c8ac0a 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -230,16 +230,6 @@ int Game::DrawGLScene(StereoSide side) if (winfreeze || mainmenu) drawmode = normalmode; -#if PLATFORM_MACOSX - if (drawmode == glowmode) { - RGBColor color2; - color2.red = 0; - color2.green = 0; - color2.blue = 0; - DSpContext_FadeGamma(NULL, 200, &color2); - } -#endif - if (drawtoggle != 2) drawtoggle = 1 - drawtoggle; diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index b60f34d..c766332 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -484,26 +484,6 @@ extern bool cmdline(const char *cmd); void Game::InitGame() { -#if PLATFORM_MACOSX - ProcessSerialNumber PSN; - ProcessInfoRec pinfo; - FSSpec pspec; - OSStatus err; - /* set up process serial number */ - PSN.highLongOfPSN = 0; - PSN.lowLongOfPSN = kCurrentProcess; - /* set up info block */ - pinfo.processInfoLength = sizeof(pinfo); - pinfo.processName = NULL; - pinfo.processAppSpec = &pspec; - /* grab the vrefnum and directory */ - err = GetProcessInformation(&PSN, &pinfo); - if (err == noErr) { - vRefNum = pspec.vRefNum; - dirID = pspec.parID; - } -#endif - LOGFUNC; numchallengelevels = 14; diff --git a/Source/MacCompatibility.cpp b/Source/MacCompatibility.cpp index 7d04905..7e06997 100644 --- a/Source/MacCompatibility.cpp +++ b/Source/MacCompatibility.cpp @@ -17,8 +17,6 @@ You should have received a copy of the GNU General Public License along with Lugaru. If not, see . */ -#if !PLATFORM_MACOSX - /**> HEADER FILES <**/ #include "MacCompatibility.h" @@ -285,7 +283,3 @@ char* ConvertFileName( const char* orgfilename, const char *mode) return g_filename; } - -#endif - - diff --git a/Source/MacCompatibility.h b/Source/MacCompatibility.h index 1ce59d4..1bade1c 100644 --- a/Source/MacCompatibility.h +++ b/Source/MacCompatibility.h @@ -20,8 +20,6 @@ along with Lugaru. If not, see . #ifndef _MACCOMPATIBLITY_H_ #define _MACCOMPATIBLITY_H_ -#if !PLATFORM_MACOSX - #include #include #include @@ -108,6 +106,5 @@ char* ConvertFileName( const char* orgfilename, const char *mode = "rb" ); #define fopen( a, b) fopen(ConvertFileName(a, b), b) #endif -#endif diff --git a/Source/Models.cpp b/Source/Models.cpp index 0203689..20c30f7 100644 --- a/Source/Models.cpp +++ b/Source/Models.cpp @@ -922,14 +922,7 @@ void Model::draw() glInterleavedArrays( GL_T2F_C3F_V3F, 8 * sizeof(GLfloat), &vArray[0]); textureptr.bind(); -#if PLATFORM_MACOSX - glLockArraysEXT( 0, TriangleNum * 3); -#endif glDrawArrays(GL_TRIANGLES, 0, TriangleNum * 3); -#if PLATFORM_MACOSX - glUnlockArraysEXT(); -#endif - if (!color) glDisableClientState(GL_NORMAL_ARRAY); @@ -937,7 +930,6 @@ void Model::draw() glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); - //drawimmediate(); } //TODO: phase out in favor of Texture diff --git a/Source/Quaternions.h b/Source/Quaternions.h index 499bc0d..e885469 100644 --- a/Source/Quaternions.h +++ b/Source/Quaternions.h @@ -240,25 +240,7 @@ inline void CrossProduct(XYZ P, XYZ Q, XYZ *V) inline float fast_sqrt (register float arg) { -#if PLATFORM_MACOSX - // Can replace with slower return std::sqrt(arg); - register float result; - - if (arg == 0.0) - return 0.0; - - asm { - frsqrte result, arg // Calculate Square root - } - - // Newton Rhapson iterations. - result = result + 0.5 * result * (1.0 - arg * result * result); - result = result + 0.5 * result * (1.0 - arg * result * result); - - return result * arg; -#else - return sqrtf( arg); -#endif + return sqrtf(arg); } inline float normaldotproduct(XYZ point1, XYZ point2) diff --git a/Source/TGALoader.cpp b/Source/TGALoader.cpp index 748e8e3..c9796b5 100644 --- a/Source/TGALoader.cpp +++ b/Source/TGALoader.cpp @@ -34,104 +34,8 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) if (visibleloading) Game::LoadingScreen(); -#if !PLATFORM_MACOSX - // for Windows, just use TGA loader for now char fileName[256]; CopyPascalStringToC( filePath, fileName); return (LoadImage(fileName, texture)); - -#else - - OSStatus err; - ComponentResult cr; - - //Boolean isdir; - FSSpec fsspec; - err = FSMakeFSSpec (0, 0, filePath, &fsspec); - if (err) - return; - - GraphicsImportComponent gi; - err = GetGraphicsImporterForFile(&fsspec, &gi); - if (err) - return; - - Rect natbounds; - cr = GraphicsImportGetNaturalBounds(gi, &natbounds); - - texture.sizeX = natbounds.right; - texture.sizeY = natbounds.bottom; - texture.bpp = 32; - - GWorldPtr gw; - err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &natbounds, NULL, NULL, - 0, texture.data, 4 * natbounds.right); - if (err) - return; - - cr = GraphicsImportSetGWorld(gi, gw, NULL); - - natbounds.top = natbounds.bottom; - natbounds.bottom = 0; - - cr = GraphicsImportSetBoundsRect(gi, &natbounds); - - cr = GraphicsImportDraw(gi); - - err = CloseComponent(gi); - if (err) - return; - - DisposeGWorld(gw); - - // Loop Through The Image Data - GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram - GLuint temp; // Temporary Variable - GLuint bytesPerPixel; // Temporary Variable - bytesPerPixel = texture.bpp / 8; - imageSize = texture.sizeX * texture.sizeY * bytesPerPixel; - - for ( GLuint i = 0; i < int( imageSize ); i += 4 ) { - // Swaps The 1st And 3rd Bytes ('R'ed and 'B'lue) - temp = texture.data[i]; // Temporarily Store The Value At Image Data 'i' - texture.data[i] = texture.data[i + 1]; // Set The 1st Byte To The Value Of The 3rd Byte - texture.data[i + 1] = texture.data[i + 2]; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value) - texture.data[i + 2] = texture.data[i + 3]; - texture.data[i + 3] = temp; - } - - if (!hasalpha) { - for ( GLuint i = 0; i < int( imageSize ); i += 4 ) { - texture.data[i + 3] = 255; - } - } - - if (texdetail > 1) { - int which = 0; - float temp; - float howmany; - for ( GLuint k = 0; k < int( imageSize); k += bytesPerPixel * texture.sizeX * texdetail ) { - for ( GLuint i = 0; i < int( imageSize / texture.sizeY ); i += bytesPerPixel * texdetail ) { - for ( GLuint b = 0; b < bytesPerPixel ; b ++ ) { - temp = 0; - howmany = 0; - for ( GLuint l = 0; l < texdetail * texture.sizeX ; l += texture.sizeX ) { - for ( GLuint j = 0; j < texdetail ; j ++ ) { - temp += (int)texture.data[k + i + j * bytesPerPixel + l * bytesPerPixel + b]; // Set The 1st Byte To The Value Of The 3rd Byte - howmany++; - } - } - texture.data[which + b] = GLubyte(temp / howmany); - } - which += bytesPerPixel; - } - } - texture.sizeX /= texdetail; - texture.sizeY /= texdetail; - } - - return true; - -#endif } -- 2.39.5