static bool load_image(const char * fname, TGAImageRec & tex);
static bool load_png(const char * fname, TGAImageRec & tex);
static bool load_jpg(const char * fname, TGAImageRec & tex);
-static bool save_image(const char * fname);
+bool save_image(const char * fname);
static bool save_png(const char * fname);
extern float realmultiplier;
extern int slomo;
extern bool cellophane;
-// MODIFIED GWC
-//extern int terraindetail;
-//extern int texdetail;
extern float terraindetail;
extern float texdetail;
using namespace std;
-
-
SDL_Rect **resolutions = NULL;
static SDL_Rect rect_1024_768 = { 0, 0, 1024, 768 };
static SDL_Rect rect_800_600 = { 0, 0, 800, 600 };
NULL
};
-
-
-unsigned int resolutionDepths[8][2] = {0};
-
-int closestResolution(int width, int height);
-int resolutionID(int width, int height);
-
-void ReportError (char * strError);
-
void DrawGL(Game & game);
-void CreateGLWindow (void);
Boolean SetUp (Game & game);
void DoUpdate (Game & game);
-void DoEvent (void);
void CleanUp (void);
-
// statics/globals (internal only) ------------------------------------------
-#ifndef WIN32
-typedef struct tagPOINT {
- int x;
- int y;
-} POINT, *PPOINT;
-#endif
-
-
#ifdef _MSC_VER
#pragma warning(push)
// no-op.
}
-
-
-void sdlGetCursorPos(POINT *pt)
-{
- SDL_GetMouseState(&(pt->x), &(pt->y));
-}
-#define GetCursorPos(x) sdlGetCursorPos(x)
-#define SetCursorPos(x, y) SDL_WarpMouse(x, y)
-#define ScreenToClient(x, pt)
-#define ClientToScreen(x, pt)
#ifdef MessageBox
#undef MessageBox
#endif
#define MessageBox(hwnd,text,title,flags) STUBBED("msgbox")
-
-Point delta;
-
-static bool g_button, fullscreen = true;
-
-
// Menu defs
-enum
-{
- kFileQuit = 1
-};
-
-enum
-{
- kForegroundSleep = 10,
- kBackgroundSleep = 10000
-};
-
int kContextWidth;
int kContextHeight;
-const RGBColor rgbBlack = { 0x0000, 0x0000, 0x0000 };
-
-GLuint gFontList;
-char gcstrMode [256] = "";
-
-UInt32 gSleepTime = kForegroundSleep;
-Boolean gDone = false, gfFrontProcess = true;
+Boolean gDone = false;
Game * pgame = 0;
return false;
}
-
-// --------------------------------------------------------------------------
-
-void ReportError (char * strError)
-{
-#ifdef _MSC_VER // !!! FIXME. --ryan.
- throw std::exception( strError);
-#endif
-
- /* char errMsgCStr [256];
- Str255 strErr;
-
- sprintf (errMsgCStr, "%s", strError);
-
- // out as debug string
- CToPStr (strErr, errMsgCStr);
- DebugStr (strErr);
- */
-}
-
//-----------------------------------------------------------------------------------------------------------------------
// OpenGL Drawing
-void DrawGL (Game & game)
-{
- if ( stereomode == stereoNone ) {
- game.DrawGLScene(stereoCenter);
- } else {
- game.DrawGLScene(stereoLeft);
- game.DrawGLScene(stereoRight);
- }
-}
-
static void sdlEventProc(const SDL_Event &e, Game &game)
{
- int val;
- SDLMod mod;
-
switch(e.type)
{
case SDL_MOUSEMOTION:
num_channels = 0;
}
*/
- DrawGL (game);
+ game.DrawGL();
}
// --------------------------------------------------------------------------
{
LOGFUNC;
-// game.Dispose();
-
-
-
-
SDL_Quit();
#define GL_FUNC(ret,fn,params,call,rt) p##fn = NULL;
#include "glstubs.h"
LOGFUNC;
- //memset( &g_theKeys, 0, sizeof( KeyMap));
-
- //initSDLKeyTable();
-
try
{
bool regnow = false;
- // --------------------------------------------------------------------------
+// --------------------------------------------------------------------------
- extern int channels[100];
- extern OPENAL_SAMPLE * samp[100];
- extern OPENAL_STREAM * strm[20];
+extern int channels[100];
+extern OPENAL_SAMPLE * samp[100];
+extern OPENAL_STREAM * strm[20];
- extern "C" void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
+extern "C" void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
+{
+ const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
+ if (currSample && currSample == samp[chan])
{
- const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
- if (currSample && currSample == samp[chan])
+ if (OPENAL_GetPaused(channels[chan]))
+ {
+ OPENAL_StopSound(channels[chan]);
+ channels[chan] = OPENAL_FREE;
+ }
+ else if (OPENAL_IsPlaying(channels[chan]))
{
- if (OPENAL_GetPaused(channels[chan]))
+ int loop_mode = OPENAL_GetLoopMode(channels[chan]);
+ if (loop_mode & OPENAL_LOOP_OFF)
{
- OPENAL_StopSound(channels[chan]);
channels[chan] = OPENAL_FREE;
}
- else if (OPENAL_IsPlaying(channels[chan]))
- {
- int loop_mode = OPENAL_GetLoopMode(channels[chan]);
- if (loop_mode & OPENAL_LOOP_OFF)
- {
- channels[chan] = OPENAL_FREE;
- }
- }
- }
- else
- {
- channels[chan] = OPENAL_FREE;
}
+ }
+ else
+ {
+ channels[chan] = OPENAL_FREE;
+ }
- channels[chan] = OPENAL_PlaySoundEx(channels[chan], sptr, dsp, startpaused);
- if (channels[chan] < 0)
- {
- channels[chan] = OPENAL_PlaySoundEx(OPENAL_FREE, sptr, dsp, startpaused);
- }
+ channels[chan] = OPENAL_PlaySoundEx(channels[chan], sptr, dsp, startpaused);
+ if (channels[chan] < 0)
+ {
+ channels[chan] = OPENAL_PlaySoundEx(OPENAL_FREE, sptr, dsp, startpaused);
}
+}
- extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
+extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
+{
+ const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
+ if (currSample && currSample == OPENAL_Stream_GetSample(sptr))
{
- const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
- if (currSample && currSample == OPENAL_Stream_GetSample(sptr))
- {
- OPENAL_StopSound(channels[chan]);
- OPENAL_Stream_Stop(sptr);
- }
- else
- {
+ OPENAL_StopSound(channels[chan]);
OPENAL_Stream_Stop(sptr);
- channels[chan] = OPENAL_FREE;
- }
-
- channels[chan] = OPENAL_Stream_PlayEx(channels[chan], sptr, dsp, startpaused);
- if (channels[chan] < 0)
- {
- channels[chan] = OPENAL_Stream_PlayEx(OPENAL_FREE, sptr, dsp, startpaused);
- }
}
-
-
- bool LoadImage(const char * fname, TGAImageRec & tex)
+ else
{
- if ( tex.data == NULL )
- return false;
- else
- return load_image(fname, tex);
+ OPENAL_Stream_Stop(sptr);
+ channels[chan] = OPENAL_FREE;
}
- void ScreenShot(const char * fname)
+ channels[chan] = OPENAL_Stream_PlayEx(channels[chan], sptr, dsp, startpaused);
+ if (channels[chan] < 0)
{
- save_image(fname);
+ channels[chan] = OPENAL_Stream_PlayEx(OPENAL_FREE, sptr, dsp, startpaused);
}
+}
+
+
+bool LoadImage(const char * fname, TGAImageRec & tex)
+{
+ if ( tex.data == NULL )
+ return false;
+ else
+ return load_image(fname, tex);
+}
+
+void ScreenShot(const char * fname)
+{
+
+}
}
-static bool save_image(const char *file_name)
+bool save_image(const char *file_name)
{
const char *ptr = strrchr((char *)file_name, '.');
if (ptr)