Hi,
It seems like an interesting game.
I don't know scons or GL, but I've managed to hack it enough that it compiles (patch below). It doesn't link (errors below) and I somehow think this was a bit too easy (there are lots of warnings too, most of which I disabled). scons does some strange things, but it does finish eventually. Running it a second time (after it fails) shows the command used to link (which needs -lm added to it).
Linking fails with the following symbols undefined: fftw_execute (which is in /usr/nekoware/lib/libfftw* but those don't get linked for some reason), glActiveTexture, fftw_plan_dft_c2r_2d, fftw_destroy_plan, glBindProgramARB, glProgramLocalParameter4fARB, glLockArraysEXT, glUnlockArraysEXT, glClientActiveTexture, glGenProgramsARB, glProgramStringARB, glGetProgramivARB, glDeleteProgramsARB.
That's after adding -lm manually. Anyone know what these symbols are and if they're usable on IRIX? Google didn't seem to be of much help (although I didn't search for all of them). I think the fftw things shouldn't be too hard to fix, but I don't know what to do with the gl ones.
Patch 5329 may be needed (it was for me).
This is also at http://rafb.net/p/RRqjNE41.html but that will expire after 24 hours. That should work if copying the following doesn't apply cleanly.
It seems like an interesting game.
I don't know scons or GL, but I've managed to hack it enough that it compiles (patch below). It doesn't link (errors below) and I somehow think this was a bit too easy (there are lots of warnings too, most of which I disabled). scons does some strange things, but it does finish eventually. Running it a second time (after it fails) shows the command used to link (which needs -lm added to it).
Linking fails with the following symbols undefined: fftw_execute (which is in /usr/nekoware/lib/libfftw* but those don't get linked for some reason), glActiveTexture, fftw_plan_dft_c2r_2d, fftw_destroy_plan, glBindProgramARB, glProgramLocalParameter4fARB, glLockArraysEXT, glUnlockArraysEXT, glClientActiveTexture, glGenProgramsARB, glProgramStringARB, glGetProgramivARB, glDeleteProgramsARB.
That's after adding -lm manually. Anyone know what these symbols are and if they're usable on IRIX? Google didn't seem to be of much help (although I didn't search for all of them). I think the fftw things shouldn't be too hard to fix, but I don't know what to do with the gl ones.
Patch 5329 may be needed (it was for me).
This is also at http://rafb.net/p/RRqjNE41.html but that will expire after 24 hours. That should work if copying the following doesn't apply cleanly.
Code: Select all
diff -ur dangerdeep-0.2.0//SConstruct dangerdeep-current//SConstruct
--- dangerdeep-0.2.0//SConstruct Fri Oct 13 03:44:44 JST 2006
+++ dangerdeep-current//SConstruct Sat Dec 30 19:14:41 JST 2006
@@ -118,12 +118,12 @@
else:
print "Compiling for Unix/Posix/Linux Environment"
env = Environment(ENV = os.environ)
- env.Append(CPPPATH = ['/usr/include/SDL', '/usr/include/GL'])
+ env.Append(CPPPATH = ['/usr/nekoware/include','/usr/nekoware/include/SDL','/usr/include/GL'])
libpath = ['/usr/X11R6/lib']
gllibs = ['GL', 'GLU']
sdllibs = ['SDL', 'SDL_image']
- ccflags = '-Wall `sdl-config --cflags` `pkg-config --cflags x11`'
- env.Append(LINKFLAGS = '`pkg-config --libs-only-L x11`')
+ ccflags = '-Wall `sdl-config --cflags`'
+ env.Append(LINKFLAGS = '-lm -L/usr/nekoware/lib -lGL -lGLU -lX11 -lXext')
if (debug >= 3):
ccflags += ' -g -pg -O3' # profiling
elif (debug == 2):
@@ -139,7 +139,8 @@
elif (debug == -3): # special g++4.0+ auto vectorization
ccflags += ' -g -O3 -march=athlon64 -mfpmath=sse -mmmx -msse -msse2 -m3dnow -ftree-vectorize -ftree-vectorizer-verbose=2'
else:
- ccflags += ' -g -O2' # debug symbols will be stripped by the linker for a debian package
+ ccflags += ' -O3 -mips4 -n32 -woff 3649,3625,3201,1209,1174,1201,3554,1171 -I/usr/nekoware/include'
+
if (useefence >= 1):
extralibs += ['efence']
print 'Linking to ElectricFence library!'
@@ -146,17 +147,18 @@
if (cvedit == 1):
env.Append(CPPDEFINES = ['CVEDIT'])
# check for mmx/sse support
- cpuinfof = open('/proc/cpuinfo', 'r')
- cpuinfol = cpuinfof.readlines()
+# cpuinfof = open('/proc/cpuinfo', 'r')
+# cpuinfol = cpuinfof.readlines()
mmxsupported = False
ssesupported = False
- for i in cpuinfol:
- if i.startswith('flags'):
- m = Split(i)
- if 'mmx' in m:
- mmxsupported = True
- if 'sse' in m:
- ssesupported = True
+# for i in cpuinfol:
+# if i.startswith('flags'):
+# m = Split(i)
+# if 'mmx' in m:
+# mmxsupported = True
+# if 'sse' in m:
+# ssesupported = True
+ usex86sse = 0
if (usex86sse == 0) and (mmxsupported and ssesupported):
usex86sse = 1
if usex86sse >= 1:
@@ -174,7 +176,7 @@
print 'Using x86 SSE/MMX optimizations.'
env.Append(CCFLAGS = ccflags)
datadir = '/usr/local/share/dangerdeep'
- build_dir = 'linux'
+ build_dir = 'irix'
# check for broken libGL, ignore undefined symbols then
if (os.system('grep glBindProgram /usr/include/GL/gl*.h > /dev/null') == 0):
gllibdirs = ['/usr/X11R6/lib/', '/usr/lib/', '/usr/local/lib/']
@@ -190,8 +192,8 @@
if (os.system('grep glBindProgram '+gllibdir+'libGL.so > /dev/null') != 0):
print 'GL headers declare glBindProgram, but libGL.so has no such symbol! Ignoring all undefined symbols...'
# I'm not sure which option will hopefully fix the problem... so i use both...
- env.Append(LINKFLAGS = '--unresolved-symbols=ignore-all')
- env.Append(LINKFLAGS = '-Xlinker --unresolved-symbols -Xlinker ignore-all')
+# env.Append(LINKFLAGS = '--unresolved-symbols=ignore-all')
+# env.Append(LINKFLAGS = '-Xlinker --unresolved-symbols -Xlinker ignore-all')
###### optionally change install and data dirs
if ARGUMENTS.get('datadir', 0):
@@ -208,7 +210,7 @@
################ configure
conf = Configure(env)
-if (devel == 0):
+if (1 == 0):
if not conf.CheckLibWithHeader('GL', 'gl.h', 'C'):
print 'GL library must be installed!'
Exit(1)
@@ -232,11 +234,11 @@
Exit(1)
if conf.CheckLibWithHeader('fftw3f', 'fftw3.h', 'C'):
print 'fftw3 library supports float type. Using it...'
- fftwlib = 'fftw3f'
- conf.env.Append(CPPDEFINES = ['WITH_FLOAT_FFTW'])
+ fftwlib = 'fftw3'
+# conf.env.Append(CPPDEFINES = ['WITH_FLOAT_FFTW'])
else:
- fftwlib = 'fftw3f'
- conf.env.Append(CPPDEFINES = ['WITH_FLOAT_FFTW']) # developers always use float...
+ fftwlib = 'fftw3'
+# conf.env.Append(CPPDEFINES = ['WITH_FLOAT_FFTW']) # developers always use float...
env = conf.Finish()
######################### source file lists
diff -ur dangerdeep-0.2.0//src/bspline.h dangerdeep-current//src/bspline.h
--- dangerdeep-0.2.0//src/bspline.h Fri Oct 13 03:16:09 JST 2006
+++ dangerdeep-current//src/bspline.h Sat Dec 30 19:12:34 JST 2006
@@ -26,12 +26,12 @@
#include <vector>
#include <cmath>
-#if (defined(__APPLE__) && defined(__GNUC__)) || defined(__MACOSX__)
+#if defined(__sgi) || (defined(__APPLE__) && defined(__GNUC__)) || defined(__MACOSX__)
#include <complex.h>
#ifndef isfinite
#define isfinite(x) finite(x)
#endif
-#elseif defined(WIN32)
+#elif defined(WIN32)
#ifndef isfinite
#define isfinite(x) _finite(x)
#endif
diff -ur dangerdeep-0.2.0//src/coastmap.cpp dangerdeep-current//src/coastmap.cpp
--- dangerdeep-0.2.0//src/coastmap.cpp Fri Oct 13 03:16:12 JST 2006
+++ dangerdeep-current//src/coastmap.cpp Sat Dec 30 19:12:34 JST 2006
@@ -38,6 +38,10 @@
#include <fstream>
#include <list>
#include <vector>
+#ifdef __sgi
+extern double round(double);
+#pragma optional round
+#endif
using namespace std;
@@ -1190,6 +1194,7 @@
// try to connect segcls that were made from the same global cl
unsigned erased = 0;
+ vector<coastsegment::segpos>::iterator i1; /* for mipspro */
for (unsigned i = 0; i < cs.segcls.size(); ++i) {
coastsegment::segcl& cl0 = cs.segcls[i];
if (cl0.global_clnr == -1) continue;
@@ -1204,7 +1209,9 @@
ASSERT(cl0.next == -1, "strange paranoia1 next != -1");
ASSERT(cl1.next == -1, "strange paranoia2 next != -1");
//connect the segcls.
- cl0.points.insert(cl0.points.end(), ++cl1.points.begin(), cl1.points.end());
+ i1 = cl1.points.begin();
+ i1++;
+ cl0.points.insert(cl0.points.end(), i1, cl1.points.end());
// cl0.points += cl1.points;
cl0.endpos = cl1.endpos;
cl1.global_clnr = -1; // mark as erased.
diff -ur dangerdeep-0.2.0//src/faulthandler.h dangerdeep-current//src/faulthandler.h
--- dangerdeep-0.2.0//src/faulthandler.h Fri Oct 13 03:16:09 JST 2006
+++ dangerdeep-current//src/faulthandler.h Sat Dec 30 19:12:34 JST 2006
@@ -23,7 +23,7 @@
#ifndef FAULTHANDLER_H
#define FAULTHANDLER_H
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__sgi)
#include <execinfo.h>
#include <stdio.h>
diff -ur dangerdeep-0.2.0//src/global_data.h dangerdeep-current//src/global_data.h
--- dangerdeep-0.2.0//src/global_data.h Fri Oct 13 03:16:09 JST 2006
+++ dangerdeep-current//src/global_data.h Sat Dec 30 19:12:34 JST 2006
@@ -32,7 +32,7 @@
#include <SDL.h>
#include <string>
#include <list>
-#include <cmath>
+#include <math.h>
#include "objcache.h"
// fixme: remove this ugly crap, move to .cpp
diff -ur dangerdeep-0.2.0//src/make_mesh.cpp dangerdeep-current//src/make_mesh.cpp
--- dangerdeep-0.2.0//src/make_mesh.cpp Fri Oct 13 03:16:12 JST 2006
+++ dangerdeep-current//src/make_mesh.cpp Sat Dec 30 19:12:34 JST 2006
@@ -23,12 +23,12 @@
#include "make_mesh.h"
#include <cmath>
-#if (defined(__APPLE__) && defined(__GNUC__)) || defined(__MACOSX__)
+#if defined(__sgi) || (defined(__APPLE__) && defined(__GNUC__)) || defined(__MACOSX__)
#include <complex.h>
#ifndef isfinite
#define isfinite(x) finite(x)
#endif
-#elseif defined(WIN32)
+#elif defined(WIN32)
#ifndef isfinite
#define isfinite(x) _finite(x)
#endif
diff -ur dangerdeep-0.2.0//src/model.cpp dangerdeep-current//src/model.cpp
--- dangerdeep-0.2.0//src/model.cpp Fri Oct 13 03:16:12 JST 2006
+++ dangerdeep-current//src/model.cpp Sat Dec 30 19:12:34 JST 2006
@@ -28,12 +28,12 @@
#endif
#include <cmath>
-#if (defined(__APPLE__) && defined(__GNUC__)) || defined(__MACOSX__)
+#if defined(__sgi) || (defined(__APPLE__) && defined(__GNUC__)) || defined(__MACOSX__)
#include <complex.h>
#ifndef isfinite
#define isfinite(x) finite(x)
#endif
-#elseif defined(WIN32)
+#elif defined(WIN32)
#ifndef isfinite
#define isfinite(x) _finite(x)
#endif
@@ -259,8 +259,8 @@
meshes[0]->compute_bounds();
min = meshes[0]->min;
max = meshes[0]->max;
-
- for (vector<model::mesh*>::iterator it = ++meshes.begin(); it != meshes.end(); ++it) {
+ vector<model::mesh*>::iterator it = meshes.begin();
+ for (++it; it != meshes.end(); ++it) {
(*it)->compute_bounds();
min = (*it)->min.min(min);
max = (*it)->max.max(max);
@@ -283,7 +283,8 @@
if (vertices.size() == 0) return;
min = max = vertices[0];
- for (vector<vector3f>::iterator it2 = ++vertices.begin(); it2 != vertices.end(); ++it2) {
+ vector<vector3f>::iterator it2 = vertices.begin();
+ for (++it2; it2 != vertices.end(); ++it2) {
min = it2->min(min);
max = it2->max(max);
}
diff -ur dangerdeep-0.2.0//src/sonar.h dangerdeep-current//src/sonar.h
--- dangerdeep-0.2.0//src/sonar.h Fri Oct 13 03:16:09 JST 2006
+++ dangerdeep-current//src/sonar.h Sat Dec 30 19:12:34 JST 2006
@@ -58,8 +58,11 @@
// base^dB_val = real noise, dB = 10 * log10(real) -> dB/10 = log10(real)
// -> 10^(dB/10) = real -> (10^0.1)^dB = real, 10^0.1 = dB_base
// so dB_base^dB = real
+#ifndef __sgi
static const double dB_base = 1.25892541179;
-
+#else /* MIPSpro doesn't like initializing the static const */
+ const double dB_base = 1.25892541179;
+#endif
// limits of frequency bands in Hertz
static const double frequency_band_lower_limit[NR_OF_FREQUENCY_BANDS];
static const double frequency_band_upper_limit[NR_OF_FREQUENCY_BANDS];
@@ -79,8 +82,11 @@
static const double typical_frequency[NR_OF_FREQUENCY_BANDS];
// additional extra noise constant for cavitation, when running at full/flank speed, in dB
+#ifndef __sgi
static const double cavitation_noise = 2;
-
+#else
+ const double cavitation_noise = 2;
+#endif
static double dB_to_absolute(double dB) {
return (dB < 0) ? 0.0 : pow(dB_base, dB);
}
diff -ur dangerdeep-0.2.0//src/sonar_operator.h dangerdeep-current//src/sonar_operator.h
--- dangerdeep-0.2.0//src/sonar_operator.h Fri Oct 13 03:16:09 JST 2006
+++ dangerdeep-current//src/sonar_operator.h Sat Dec 30 19:12:34 JST 2006
@@ -54,11 +54,15 @@
// fixme: good idea, but a contact is reported many times then while the sub turns, fixme!
std::map<double, contact> contacts;
bool active; // disabled, when user does the work
-
+#ifndef __sgi /* MIPSpro doesn't like initializing static const */
static const double turn_speed_fast = 6.0; // degrees per second.
static const double turn_speed_slow = 2.0; // degrees per second.
static const double simulation_step = 0.1; // in seconds
-
+#else
+ const double turn_speed_fast = 6.0; // degrees per second.
+ const double turn_speed_slow = 2.0; // degrees per second.
+ const double simulation_step = 0.1; // in seconds
+#endif
double last_simulation_step_time;
angle find_peak_lower_limit, find_peak_upper_limit;
diff -ur dangerdeep-0.2.0//src/system.h dangerdeep-current//src/system.h
--- dangerdeep-0.2.0//src/system.h Fri Oct 13 03:16:09 JST 2006
+++ dangerdeep-current//src/system.h Sat Dec 30 19:12:34 JST 2006
@@ -46,12 +46,15 @@
#endif
// a helpful macro
+#ifndef __sgi /* MIPSpro doesn't like ... in macros */
#ifdef DEBUG
#define ASSERT(a,...) {if(!(a)){sys().error(__VA_ARGS__);}}
#else
#define ASSERT(a,...)
#endif
-
+#else
+#define ASSERT
+#endif
class font;
class texture;
diff -ur dangerdeep-0.2.0//src/tone_reproductor.cpp dangerdeep-current//src/tone_reproductor.cpp
--- dangerdeep-0.2.0//src/tone_reproductor.cpp Fri Oct 13 03:16:12 JST 2006
+++ dangerdeep-current//src/tone_reproductor.cpp Sat Dec 30 19:12:34 JST 2006
@@ -21,7 +21,7 @@
#include "tone_reproductor.h"
#ifndef pow10
-#define pow10(x) pow(10.0, x)
+#define pow10(x) pow((float)10.0, x)
#endif
// Set some values to prevent bugs in case of bad use
diff -ur dangerdeep-0.2.0//src/water.cpp dangerdeep-current//src/water.cpp
--- dangerdeep-0.2.0//src/water.cpp Fri Oct 13 03:16:12 JST 2006
+++ dangerdeep-current//src/water.cpp Sat Dec 30 19:12:34 JST 2006
@@ -1068,7 +1068,7 @@
const float VIRTUAL_PLANE_HEIGHT = 25.0f; // fixme experiment, amount of reflection distorsion, 30.0f seems ok, maybe a bit too much
// maximum height of waves (half amplitude)
- const double WAVE_HEIGHT = std::max(double(curr_wtp->maxh), fabs(curr_wtp->minh));
+ const double WAVE_HEIGHT = std::max(double(curr_wtp->maxh), (double)fabs(curr_wtp->minh));
// cout << "Wave height is: " << WAVE_HEIGHT << "\n";
@@ -1381,7 +1381,7 @@
// compute dynamic normals
// clear values from last frame (fixme: a plain memset(...,0 ) may be faster, or even mmx memset
- fill(normals.begin(), normals.end(), vector3f());
+ std::fill(normals.begin(), normals.end(), vector3f());
// compute normals for all faces, add them to vertex normals
// fixme: angles at vertices are ignored yet