First steps towards modularization...
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@15 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+2
-2
@@ -14,7 +14,7 @@ INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||
|
||||
bin_PROGRAMS = sc2
|
||||
|
||||
sc2_SOURCES = SDL_wrapper.c port.c starcon2.c trackplayer.c
|
||||
sc2_SOURCES = port.c starcon2.c
|
||||
sc2_LDADD = sc2code/libsc2.la @SDL_LIBS@ @GL_LIBS@ @SMPEG_LIBS@
|
||||
noinst_HEADERS = SDL_wrapper.h
|
||||
noinst_HEADERS = port.h
|
||||
|
||||
|
||||
+121
-48
@@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D SAFE_X=0 /D SAFE_Y=0 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D SAFE_X=0 /D SAFE_Y=0 /D "GFXMODULE_SDL_PURE" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=snBsc.exe
|
||||
@@ -50,7 +50,7 @@ BSC32=snBsc.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=snLink.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib smpeg.lib opengl32.lib glu32.lib /nodefaultlib:"msvcrtd.lib" /nologo /subsystem:console /machine:I386 /out:"../../Content/Starcon2.exe"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib smpeg.lib /nodefaultlib:"msvcrtd.lib" /nologo /subsystem:console /machine:I386 /out:"../../Content/Starcon2.exe"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Starcon2 - Win32 Debug"
|
||||
|
||||
@@ -66,7 +66,7 @@ LINK32=snLink.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D SAFE_X=0 /D SAFE_Y=0 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D SAFE_X=0 /D SAFE_Y=0 /D "GFXMODULE_SDL_PURE" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=snBsc.exe
|
||||
@@ -74,7 +74,7 @@ BSC32=snBsc.exe
|
||||
# ADD BSC32 /nologo /o"Starcon2.bsc"
|
||||
LINK32=snLink.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib smpeg.lib opengl32.lib glu32.lib /nodefaultlib:"msvcrt.lib" /nologo /subsystem:console /debug /machine:I386 /out:"../../Content/Starcon2Debug.exe" /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib smpeg.lib /nodefaultlib:"msvcrt.lib" /nologo /subsystem:console /debug /machine:I386 /out:"../../Content/Starcon2Debug.exe" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
@@ -85,8 +85,20 @@ LINK32=snLink.exe
|
||||
# Name "Starcon2 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Group "3DO Code"
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\starcon2.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\port.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\port.h
|
||||
# End Source File
|
||||
# Begin Group "sc2code"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "libs"
|
||||
@@ -161,10 +173,6 @@ SOURCE=..\sc2code\libs\graphics\frame.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\getbody.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\gfxintrn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -207,6 +215,60 @@ SOURCE=..\sc2code\libs\graphics\resgfx.c
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\stamp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\gfx_common.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\gfx_common.h
|
||||
# End Source File
|
||||
# Begin Group "sdl"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\sdl_common.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\sdl_common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\rotozoom.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\rotozoom.h
|
||||
# End Source File
|
||||
# Begin Group "opengl"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\opengl\opengl.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\opengl\opengl.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
# Begin Group "pure"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\pure\pure.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\graphics\sdl\pure\pure.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "input"
|
||||
|
||||
@@ -217,8 +279,21 @@ SOURCE=..\sc2code\libs\input\inpintrn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\input\input.c
|
||||
SOURCE=..\sc2code\libs\input\input_common.c
|
||||
# End Source File
|
||||
# Begin Group "sdl"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\input\sdl\input.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\input\sdl\input.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
# End Group
|
||||
# Begin Group "math"
|
||||
|
||||
@@ -297,11 +372,7 @@ SOURCE=..\sc2code\libs\sound\fileinst.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\modfuncs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\play.c
|
||||
SOURCE=..\sc2code\libs\sound\play.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -315,6 +386,35 @@ SOURCE=..\sc2code\libs\sound\resinst.c
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\sndintrn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\trackplayer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\sound_common.c
|
||||
# End Source File
|
||||
# Begin Group "sdl"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\sdl\modfuncs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\sdl\play.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\sdl\sound.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\sound\sdl\trackplayer.c
|
||||
# End Source File
|
||||
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "strings"
|
||||
|
||||
@@ -400,6 +500,11 @@ SOURCE=..\sc2code\libs\vargs.h
|
||||
|
||||
SOURCE=..\sc2code\libs\vidlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\misc.h
|
||||
# End Source File
|
||||
|
||||
# End Group
|
||||
# Begin Group "comm"
|
||||
|
||||
@@ -2882,38 +2987,6 @@ SOURCE=..\sc2code\weapon.c
|
||||
SOURCE=..\sc2code\weapon.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "NeoStarcon2 Wrappers"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\SDL_wrapper.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\SDL_wrapper.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\starcon2.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\trackplayer.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\port.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\port.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\gl.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
//#include "starcon.h"
|
||||
|
||||
QUEUE disp_q;
|
||||
|
||||
@@ -17,16 +17,17 @@
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/sound/trackplayer.h"
|
||||
#include "starcon.h"
|
||||
#include "commglue.h"
|
||||
|
||||
void InitOscilloscope (Sint32 x, Sint32 y, Sint32 width, Sint32 height,
|
||||
void InitOscilloscope (int x, int y, int width, int height,
|
||||
void *f);
|
||||
void SetSliderImage (void *f);
|
||||
void InitSlider (Sint32 x, Sint32 y, Sint32 width, Sint32 height,
|
||||
Sint32 bwidth, Sint32 bheight, void *f);
|
||||
void Oscilloscope (Sint32 grab_data);
|
||||
void InitSlider (int x, int y, int width, int height,
|
||||
int bwidth, int bheight, void *f);
|
||||
void Oscilloscope (int grab_data);
|
||||
void Slider (void);
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "commglue.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/sound/trackplayer.h"
|
||||
|
||||
void
|
||||
NPCPhrase (int index)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "commglue.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/sound/trackplayer.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "vidlib.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <ctype.h>
|
||||
#include "starcon.h"
|
||||
#include "commglue.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ SUBDIRS = decomp graphics input math memory resource sound strings video
|
||||
|
||||
noinst_HEADERS = \
|
||||
compiler.h declib.h errlib.h gfxlib.h inplib.h mathlib.h \
|
||||
memlib.h reslib.h sndlib.h strlib.h timlib.h vargs.h vidlib.h
|
||||
memlib.h reslib.h sndlib.h strlib.h timlib.h vargs.h vidlib.h \
|
||||
misc.h
|
||||
|
||||
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||
-I$(top_srcdir)/src \
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# Written by Mudry <mudry@user.sf.net>, protected by GNU GPL.
|
||||
# CVS $ Id: $
|
||||
|
||||
SUBDIRS = sdl
|
||||
|
||||
CFLAGS = -Wall
|
||||
|
||||
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||
@@ -14,9 +16,11 @@ noinst_LTLIBRARIES = libgraphics.la
|
||||
|
||||
libgraphics_la_SOURCES = clipline.c context.c drawable.c filegfx.c font.c \
|
||||
frame.c intersec.c line.c loaddisp.c makepoly.c map.c \
|
||||
pixmap.c poly.c rect.c resgfx.c stamp.c boxint.c getbody.c
|
||||
pixmap.c poly.c rect.c resgfx.c stamp.c boxint.c gfx_common.c
|
||||
|
||||
libgraphics_la_LIBADD = sdl/libsdl.la
|
||||
|
||||
#libgraphics_la_LDFLAGS = @SMPEG_LIBS@
|
||||
|
||||
noinst_HEADERS = context.h display.h drawable.h font.h gfxintrn.h
|
||||
noinst_HEADERS = context.h display.h drawable.h font.h gfxintrn.h gfx_common.h
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
#include "SDL_wrapper.h"
|
||||
|
||||
FRAMEPTR _CurFramePtr;
|
||||
|
||||
@@ -58,66 +57,6 @@ SetContextBGFrame (FRAME Frame)
|
||||
return (LastFrame);
|
||||
}
|
||||
|
||||
DRAWABLE
|
||||
_request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType,
|
||||
CREATE_FLAGS flags, SIZE width, SIZE height)
|
||||
{
|
||||
DRAWABLE Drawable;
|
||||
|
||||
Drawable = AllocDrawableImage (
|
||||
NumFrames, DrawableType, flags, width, height
|
||||
);
|
||||
if (Drawable)
|
||||
{
|
||||
DRAWABLEPTR DrawablePtr;
|
||||
|
||||
if ((DrawablePtr = LockDrawable (Drawable)) == 0)
|
||||
{
|
||||
FreeDrawable (Drawable);
|
||||
Drawable = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int imgw, imgh;
|
||||
FRAMEPTR FramePtr;
|
||||
|
||||
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
|
||||
TYPE_SET (DrawablePtr->FlagsAndIndex, flags << FTYPE_SHIFT);
|
||||
INDEX_SET (DrawablePtr->FlagsAndIndex, NumFrames - 1);
|
||||
|
||||
imgw = (flags & MAPPED_TO_DISPLAY) ? width * ScreenWidthActual / ScreenWidth : width;
|
||||
imgh = (flags & MAPPED_TO_DISPLAY) ? height * ScreenHeightActual / ScreenHeight : height;
|
||||
FramePtr = &DrawablePtr->Frame[NumFrames - 1];
|
||||
while (NumFrames--)
|
||||
{
|
||||
TFB_Image *Image;
|
||||
|
||||
|
||||
if (DrawableType == RAM_DRAWABLE
|
||||
&& (Image = TFB_LoadImage (SDL_CreateRGBSurface (
|
||||
SDL_HWSURFACE,
|
||||
imgw,
|
||||
imgh,
|
||||
24,
|
||||
0x00FF0000,
|
||||
0x0000FF00,
|
||||
0x000000FF,
|
||||
0x00000000
|
||||
))))
|
||||
FramePtr->DataOffs = (BYTE *)Image - (BYTE *)FramePtr;
|
||||
|
||||
TYPE_SET (FramePtr->TypeIndexAndFlags, DrawableType);
|
||||
INDEX_SET (FramePtr->TypeIndexAndFlags, NumFrames);
|
||||
SetFrameBounds (FramePtr, width, height);
|
||||
--FramePtr;
|
||||
}
|
||||
UnlockDrawable (Drawable);
|
||||
}
|
||||
}
|
||||
|
||||
return (Drawable);
|
||||
}
|
||||
|
||||
DRAWABLE
|
||||
CreateDisplay (CREATE_FLAGS CreateFlags, PSIZE pwidth, PSIZE pheight)
|
||||
{
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
# Written by Mudry <mudry@user.sf.net>, protected by GNU GPL.
|
||||
# CVS $ Id: $
|
||||
|
||||
SUBDIRS = sdl
|
||||
|
||||
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/sc2code \
|
||||
-I$(top_srcdir)/src/sc2code/libs
|
||||
|
||||
noinst_LTLIBRARIES = libinput.la
|
||||
libinput_la_SOURCES = input.c
|
||||
libinput_la_SOURCES = input_common.c
|
||||
libinput_la_LIBADD = sdl/libsdlinput.la
|
||||
noinst_HEADERS = inpintrn.h
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "resintrn.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "port.h"
|
||||
|
||||
char *_cur_resfile_name;
|
||||
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
# Written by Mudry <mudry@user.sf.net>, protected by GNU GPL.
|
||||
# CVS $ Id: $
|
||||
|
||||
SUBDIRS = sdl
|
||||
|
||||
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/sc2code \
|
||||
-I$(top_srcdir)/src/sc2code/libs
|
||||
|
||||
noinst_LTLIBRARIES = libsound.la
|
||||
libsound_la_SOURCES = fileinst.c play.c resinst.c modfuncs.c
|
||||
noinst_HEADERS = play.h redbook.h sndintrn.h
|
||||
libsound_la_SOURCES = fileinst.c resinst.c sound_common.c
|
||||
libsound_la_LIBADD = sdl/libsdlsound.la
|
||||
noinst_HEADERS = play.h redbook.h sndintrn.h trackplayer.h
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAY_H
|
||||
#define _PLAY_H
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "strintrn.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
+10
-11
@@ -23,20 +23,19 @@
|
||||
//#include "filefunctions.h"
|
||||
//#include "BlockFile.h"
|
||||
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
//Modified by Mika (removed use of SDL datatypes)
|
||||
|
||||
#include "SDL/SDL.h"
|
||||
|
||||
typedef Uint8 uint8;
|
||||
typedef Uint8 uchar;
|
||||
typedef Sint8 sint8;
|
||||
typedef Uint16 uint16;
|
||||
typedef Sint16 sint16;
|
||||
typedef Uint32 uint32;
|
||||
typedef Sint32 int32;
|
||||
typedef Sint32 sint32;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char uchar;
|
||||
typedef signed char sint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef signed short sint16;
|
||||
typedef unsigned int uint32;
|
||||
typedef signed int int32;
|
||||
typedef signed int sint32;
|
||||
|
||||
//End Added by Chris
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "starcon.h"
|
||||
#include "lander.h"
|
||||
#include "lifeform.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
//#include "filefunctions.h"
|
||||
//#include "BlockFile.h"
|
||||
#include "starcon.h"
|
||||
#include "SDL.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
@@ -55,7 +54,7 @@
|
||||
|
||||
#define NUM_TINTS 4
|
||||
|
||||
#define PIXC_DUP(v) (((Uint32)(v) << PPMP_0_SHIFT) | ((Uint32)(v) << PPMP_1_SHIFT))
|
||||
#define PIXC_DUP(v) (((unsigned int)(v) << PPMP_0_SHIFT) | ((unsigned int)(v) << PPMP_1_SHIFT))
|
||||
#define PIXC_UNCODED16 (PIXC_DUP (PPMPC_MF_8 | PPMPC_SF_8))
|
||||
#define PIXC_UNCODED8 (PIXC_DUP (PPMPC_MF_8 | PPMPC_SF_8))
|
||||
#define PIXC_CODED (PIXC_DUP (PPMPC_MS_PIN | PPMPC_SF_8))
|
||||
@@ -89,9 +88,9 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Sint32 x0[15], x1[15], y0[15], y1[15];
|
||||
Sint32 ystep[15];
|
||||
Sint32 src_ws[XBANDS];
|
||||
int x0[15], x1[15], y0[15], y1[15];
|
||||
int ystep[15];
|
||||
int src_ws[XBANDS];
|
||||
|
||||
CCB planet_ccb, surface_ccb, tint_ccb[NUM_TINTS];
|
||||
|
||||
@@ -99,13 +98,13 @@ typedef struct
|
||||
|
||||
CCB repair_ccb[2];
|
||||
|
||||
Sint32 black_circ_plut[16];
|
||||
int black_circ_plut[16];
|
||||
|
||||
UBYTE rmap[HEIGHT][LINE_PIXELS];
|
||||
|
||||
CCB *cur_ccb;
|
||||
|
||||
Sint32 old_sx, old_sy;
|
||||
int old_sx, old_sy;
|
||||
|
||||
CCB plCCB[NUM_CELS];
|
||||
|
||||
@@ -113,7 +112,7 @@ typedef struct
|
||||
UBYTE zoom_batch;
|
||||
|
||||
#ifdef SCALE_ROTATE
|
||||
Sint32 scale;
|
||||
int scale;
|
||||
#endif
|
||||
|
||||
CCB *pcirc_ccb, *pblur_ccb;
|
||||
@@ -178,11 +177,11 @@ static PLANET_STUFF *planet_stuff;
|
||||
#define SCALE_CEL(ccb,cx,cy) \
|
||||
do \
|
||||
{ \
|
||||
Sint32 s, _dx, _dy; \
|
||||
int s, _dx, _dy; \
|
||||
\
|
||||
s = scale & SCALE_AMT_MASK; \
|
||||
_dx = (Sint32)((scale & SCALE_X_MASK) >> SCALE_X_SHIFT) - 1; \
|
||||
_dy = (Sint32)((scale & SCALE_Y_MASK) >> SCALE_Y_SHIFT) - 1; \
|
||||
_dx = (int)((scale & SCALE_X_MASK) >> SCALE_X_SHIFT) - 1; \
|
||||
_dy = (int)((scale & SCALE_Y_MASK) >> SCALE_Y_SHIFT) - 1; \
|
||||
(ccb)->ccb_XPos = (((ccb)->ccb_XPos - (cx)) * s) >> SCALE_AMT_SHIFT; \
|
||||
(ccb)->ccb_YPos = (((ccb)->ccb_YPos - (cy)) * s) >> SCALE_AMT_SHIFT; \
|
||||
if (_dx < 0) \
|
||||
@@ -213,7 +212,7 @@ static PLANET_STUFF *planet_stuff;
|
||||
static void
|
||||
build_steps ()
|
||||
{
|
||||
Sint32 y, i, c, inc;
|
||||
int y, i, c, inc;
|
||||
|
||||
c = 1;
|
||||
inc = 1;
|
||||
@@ -249,9 +248,9 @@ for (i = 0; y < (HEIGHT >> 1); i++)
|
||||
}
|
||||
|
||||
static void
|
||||
build_tables (Sint32 da)
|
||||
build_tables (int da)
|
||||
{
|
||||
Sint32 y, i;
|
||||
int y, i;
|
||||
|
||||
build_steps ();
|
||||
|
||||
@@ -259,7 +258,7 @@ build_tables (Sint32 da)
|
||||
|
||||
for (y = 0, i = 0; y <= (HEIGHT >> 1); i++)
|
||||
{
|
||||
Sint32 dx, dy, a, h;
|
||||
int dx, dy, a, h;
|
||||
|
||||
h = ystep[i];
|
||||
|
||||
@@ -300,14 +299,14 @@ printf ("%ld,%ld\n", x1[i] >> 16, y1[i] >> 16);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_band (Sint32 src_x, Sint32 src_y, Sint32 dst_cx, Sint32 dst_cy)
|
||||
draw_band (int src_x, int src_y, int dst_cx, int dst_cy)
|
||||
{
|
||||
//I_CANNOT_FIGURE_OUT_HOW_TO_FIX_THIS_FILE___STREAM???();
|
||||
|
||||
Sint32 *sp;
|
||||
Sint32 i;
|
||||
int *sp;
|
||||
int i;
|
||||
|
||||
sp = (Sint32 *)planet_ccb.ccb_SourcePtr + src_y * (LINE_PIXELS >> 1);
|
||||
sp = (int *)planet_ccb.ccb_SourcePtr + src_y * (LINE_PIXELS >> 1);
|
||||
|
||||
for (i = 0; i < XBANDS; i++)
|
||||
{
|
||||
@@ -330,9 +329,9 @@ draw_band (Sint32 src_x, Sint32 src_y, Sint32 dst_cx, Sint32 dst_cy)
|
||||
}
|
||||
|
||||
static void
|
||||
set_band_cels (Sint32 src_y, Sint32 src_h, Sint32 band)
|
||||
set_band_cels (int src_y, int src_h, int band)
|
||||
{
|
||||
Sint32 i, dst_x0, dst_y0, dst_x1, dst_y1, dx0, dy0, dx1, dy1;
|
||||
int i, dst_x0, dst_y0, dst_x1, dst_y1, dx0, dy0, dx1, dy1;
|
||||
|
||||
if (src_y > (HEIGHT >> 1))
|
||||
{
|
||||
@@ -376,7 +375,7 @@ set_band_cels (Sint32 src_y, Sint32 src_h, Sint32 band)
|
||||
#define dd d[i]
|
||||
#define src_w src_ws[i]
|
||||
POINT quadpts[4];
|
||||
Sint32 d[XBANDS] = { 17, 47, 64, 64, 47, 17 };
|
||||
int d[XBANDS] = { 17, 47, 64, 64, 47, 17 };
|
||||
|
||||
quadpts[0].x = dst_x0;
|
||||
quadpts[0].y = dst_y0;
|
||||
@@ -413,7 +412,7 @@ set_band_cels (Sint32 src_y, Sint32 src_h, Sint32 band)
|
||||
static void
|
||||
init_rotate_cels ()
|
||||
{
|
||||
Sint32 i, incr, y;
|
||||
int i, incr, y;
|
||||
|
||||
incr = 1;
|
||||
cur_ccb = plCCB;
|
||||
@@ -438,10 +437,10 @@ printf ("using %d cels for rotate\n", cur_ccb - plCCB);
|
||||
#endif
|
||||
|
||||
void
|
||||
SetPlanetTilt (Sint32 da)
|
||||
SetPlanetTilt (int da)
|
||||
{
|
||||
#if 0
|
||||
Sint32 w, i;
|
||||
int w, i;
|
||||
|
||||
shield_pulse = MAX_PULSE_RED;
|
||||
for (i = 0, cur_ccb = plCCB; i < NUM_ROTATE_CELS; i++, cur_ccb++)
|
||||
@@ -452,7 +451,7 @@ SetPlanetTilt (Sint32 da)
|
||||
|
||||
if (!src_ws[0])
|
||||
{
|
||||
Sint32 err;
|
||||
int err;
|
||||
|
||||
w = (WIDTH / 2) / XBANDS;
|
||||
err = XBANDS;
|
||||
@@ -487,13 +486,13 @@ SetPlanetTilt (Sint32 da)
|
||||
}
|
||||
|
||||
int
|
||||
RotatePlanet (Sint32 x, Sint32 dx, Sint32 dy)
|
||||
RotatePlanet (int x, int dx, int dy)
|
||||
{
|
||||
#if 1
|
||||
return (0);
|
||||
#else
|
||||
Sint32 i, y;
|
||||
Sint32 incr;
|
||||
int i, y;
|
||||
int incr;
|
||||
CCB *first;
|
||||
|
||||
dx <<= 16;
|
||||
@@ -661,7 +660,7 @@ while (AnyButtonPress (FALSE));
|
||||
}
|
||||
|
||||
void
|
||||
DrawPlanet (Sint32 x, Sint32 y, Sint32 dy, Uint32 rgb)
|
||||
DrawPlanet (int x, int y, int dy, unsigned int rgb)
|
||||
{
|
||||
#if 1
|
||||
STAMP s;
|
||||
@@ -673,7 +672,7 @@ DrawPlanet (Sint32 x, Sint32 y, Sint32 dy, Uint32 rgb)
|
||||
#else
|
||||
if (rgb || !pshield_ccb->ccb_HDY)
|
||||
{
|
||||
Sint32 i, nt, my;
|
||||
int i, nt, my;
|
||||
|
||||
if (!pshield_ccb->ccb_HDY)
|
||||
{
|
||||
@@ -723,7 +722,7 @@ DrawPlanet (Sint32 x, Sint32 y, Sint32 dy, Uint32 rgb)
|
||||
else
|
||||
tint_ccb[i].ccb_YPos = my << 16;
|
||||
tint_ccb[i].ccb_XPos = x << 16;
|
||||
*((Uint32 *)tint_ccb[i].ccb_SourcePtr) = rgb | (rgb << 16) | 0x80008000;
|
||||
*((unsigned int *)tint_ccb[i].ccb_SourcePtr) = rgb | (rgb << 16) | 0x80008000;
|
||||
add_cel (&tint_ccb[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "scan.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -17,18 +17,17 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
|
||||
extern void DeltaTopography (COUNT num_iterations, PSBYTE DepthArray,
|
||||
PRECT pRect, SIZE depth_delta);
|
||||
|
||||
void SetPlanetMusic (BYTE planet_type);
|
||||
|
||||
void SetPlanetTilt (Sint32 da);
|
||||
void SetPlanetTilt (int da);
|
||||
|
||||
void RepairBackRect (PRECT pRect);
|
||||
|
||||
int RotatePlanet (Sint32 x, Sint32 dx, Sint32 dy);
|
||||
int RotatePlanet (int x, int dx, int dy);
|
||||
|
||||
#define NUM_BATCH_POINTS 64
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "gfxlib.h"
|
||||
#include "scan.h"
|
||||
#include "libs/compiler.h"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "lifeform.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
COUNT DisplayFreeList;
|
||||
PRIMITIVE DisplayArray[MAX_DISPLAY_PRIMS];
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "melee.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
//Added by Chris
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "commglue.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
void
|
||||
RepairSISBorder (void)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "starcon.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
PMENU_STATE pMenuState;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "starcon.h"
|
||||
#include "commglue.h"
|
||||
#include "SDL_wrapper.h"
|
||||
#include "libs/sound/trackplayer.h"
|
||||
|
||||
void
|
||||
DrawStarConBox (PRECT pRect, SIZE BorderWidth, COLOR TopLeftColor, COLOR
|
||||
|
||||
+5
-526
@@ -24,538 +24,17 @@
|
||||
|
||||
Copyright Toys for Bob, 2002
|
||||
|
||||
starcon2.cpp programmer: Chris Nelson
|
||||
Programmer: Chris Nelson
|
||||
|
||||
*****************************************/
|
||||
|
||||
#include "SDL_wrapper.h"
|
||||
|
||||
//Global Variables for the wrapper.
|
||||
|
||||
Uint8 KeyboardDown[512];
|
||||
#define KBDBUFSIZE (1 << 8)
|
||||
static int kbdhead, kbdtail;
|
||||
static Uint16 kbdbuf[KBDBUFSIZE];
|
||||
|
||||
UBYTE ControlA;
|
||||
UBYTE ControlB;
|
||||
UBYTE ControlC;
|
||||
UBYTE ControlX;
|
||||
UBYTE ControlStart;
|
||||
UBYTE ControlLeftShift;
|
||||
UBYTE ControlRightShift;
|
||||
|
||||
int ScreenWidth;
|
||||
int ScreenHeight;
|
||||
int ScreenWidthActual;
|
||||
int ScreenHeightActual;
|
||||
int ScreenBPPActual;
|
||||
|
||||
SDL_Surface *ExtraScreen;
|
||||
|
||||
int TFB_DEBUG_HALT;
|
||||
|
||||
Uint16
|
||||
GetUNICODEKey ()
|
||||
{
|
||||
if (kbdtail != kbdhead)
|
||||
{
|
||||
Uint16 ch;
|
||||
|
||||
ch = kbdbuf[kbdhead];
|
||||
kbdhead = (kbdhead + 1) & (KBDBUFSIZE - 1);
|
||||
return (ch);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
FlushInput ()
|
||||
{
|
||||
kbdtail = kbdhead = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ProcessKeyboardEvent(const SDL_Event *Event)
|
||||
{
|
||||
if(Event->key.keysym.sym == SDLK_TAB && Event->type == SDL_KEYDOWN)
|
||||
{
|
||||
SDL_GL_SwapBuffers(); //Debug: Hit tab to swap buffers
|
||||
}
|
||||
else if(Event->key.keysym.sym == SDLK_BACKQUOTE)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
else//if(Event->type == SDL_KEYDOWN)
|
||||
{
|
||||
if (Event->type == SDL_KEYDOWN)
|
||||
{
|
||||
if ((kbdbuf[kbdtail] = Event->key.keysym.unicode)
|
||||
|| (kbdbuf[kbdtail] = Event->key.keysym.sym) <= 0x7F)
|
||||
{
|
||||
kbdtail = (kbdtail + 1) & (KBDBUFSIZE - 1);
|
||||
if (kbdtail == kbdhead)
|
||||
kbdhead = (kbdhead + 1) & (KBDBUFSIZE - 1);
|
||||
}
|
||||
KeyboardDown[Event->key.keysym.sym]=TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyboardDown[Event->key.keysym.sym]=FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Event->key.keysym.sym == SDLK_BACKSPACE && Event->type == SDL_KEYDOWN)
|
||||
{
|
||||
//Stop + Start Starcon running.
|
||||
|
||||
//TFB_DEBUG_HALT = !TFB_DEBUG_HALT;
|
||||
}
|
||||
|
||||
if (Event->type == SDL_KEYDOWN && TFB_DEBUG_HALT)
|
||||
{
|
||||
//Used for debugging Buffer copy operations
|
||||
|
||||
if (Event->key.keysym.sym==SDLK_d)
|
||||
{
|
||||
//Draw
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix ();
|
||||
|
||||
//
|
||||
|
||||
glDrawBuffer (GL_BACK_LEFT);
|
||||
glLoadIdentity ();
|
||||
glOrtho (0, ScreenWidth, ScreenHeight, 0, -1, 1);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
{
|
||||
glColor3f (rand() % 2, rand () % 2, rand () % 2);
|
||||
glVertex2i (0, ScreenHeight);
|
||||
//glColor3f (rand() % 2, rand() % 2, rand() % 2);
|
||||
glVertex2i(0, 0);
|
||||
//glColor3f (rand() % 2, rand () % 2, rand () % 2);
|
||||
glVertex2i (ScreenWidth, 0);
|
||||
glColor3f (rand() % 2, rand () % 2, rand () % 2);
|
||||
glVertex2i(ScreenWidth, ScreenHeight);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
//
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
if (Event->key.keysym.sym == SDLK_s)
|
||||
{
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
if (Event->key.keysym.sym == SDLK_c)
|
||||
{
|
||||
//Copy from front to back
|
||||
glReadBuffer(GL_FRONT);
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
glOrtho (0, ScreenWidthActual, ScreenHeightActual, 0, -1, 1);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
glRasterPos2d (0, ScreenHeightActual - .1);
|
||||
//Re "-.1": All values 0 < x < .5 work. Strange!!
|
||||
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
glCopyPixels (0, 0, ScreenWidthActual, ScreenHeightActual,
|
||||
GL_COLOR);
|
||||
|
||||
glPopMatrix ();
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessJoystickEvent (const SDL_Event* Event)
|
||||
{
|
||||
SDL_Event PseudoEvent;
|
||||
|
||||
return;
|
||||
|
||||
if (Event->type == SDL_JOYAXISMOTION)
|
||||
{
|
||||
if (Event->jaxis.axis == 0)
|
||||
{
|
||||
//x-axis
|
||||
|
||||
if (Event->jaxis.value <= -5) //Left
|
||||
{
|
||||
PseudoEvent.type = SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = SDLK_LEFT;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_RIGHT;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jaxis.value >= 5) //Right
|
||||
{
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_LEFT;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
|
||||
PseudoEvent.type = SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = SDLK_RIGHT;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jaxis.value > -5 && Event->jaxis.value < 5)
|
||||
//Neither Left nor Right
|
||||
{
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_LEFT;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_RIGHT;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
}
|
||||
if (Event->jaxis.axis == 1)
|
||||
{
|
||||
//y-axis
|
||||
|
||||
if (Event->jaxis.value <= -5) //Down
|
||||
{
|
||||
PseudoEvent.type = SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = SDLK_DOWN;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_UP;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jaxis.value >= 5) //Up
|
||||
{
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_DOWN;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
|
||||
PseudoEvent.type = SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = SDLK_UP;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jaxis.value >-5 && Event->jaxis.value < 5)
|
||||
//Neither Down nor Up
|
||||
{
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_DOWN;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = SDLK_UP;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Event->type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
printf("Joystick %i down\n", Event->jbutton.button);
|
||||
|
||||
if (Event->jbutton.button % 3 == 0)
|
||||
{
|
||||
//Mimic the Primary key
|
||||
|
||||
PseudoEvent.type=SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = ControlA;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jbutton.button % 3 == 1)
|
||||
{
|
||||
//Mimic the Secondary key
|
||||
|
||||
PseudoEvent.type = SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = ControlB;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jbutton.button % 3 == 2)
|
||||
{
|
||||
//Mimic the Tertiary key
|
||||
|
||||
PseudoEvent.type = SDL_KEYDOWN;
|
||||
PseudoEvent.key.keysym.sym = ControlC;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
}
|
||||
if (Event->type == SDL_JOYBUTTONUP)
|
||||
{
|
||||
if (Event->jbutton.button % 3 == 0)
|
||||
{
|
||||
//Mimic the Primary key
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = ControlA;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jbutton.button % 3 == 1)
|
||||
{
|
||||
//Mimic the Secondary key
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = ControlB;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
if (Event->jbutton.button % 3 == 2)
|
||||
{
|
||||
//Mimic the Tertiary key
|
||||
|
||||
PseudoEvent.type = SDL_KEYUP;
|
||||
PseudoEvent.key.keysym.sym = ControlC;
|
||||
ProcessKeyboardEvent (&PseudoEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Surface* Screen;
|
||||
SDL_Joystick *Joystick1;
|
||||
SDL_Event Event;
|
||||
SDL_version compile_version;
|
||||
// TODO: Currently every graphics module has to implement its own main function.
|
||||
// Should be divided later into smaller parts with common code.
|
||||
|
||||
char SoundcardName[256];
|
||||
char VideoName[256];
|
||||
int audio_rate,audio_channels;
|
||||
Uint16 audio_format;
|
||||
|
||||
int a,i;
|
||||
|
||||
//FILE* Debug;
|
||||
//Debug = fopen ("Debug.txt","w"); _dup2(fileno(Debug),1);
|
||||
|
||||
//Begin System Initialization
|
||||
|
||||
printf("Initializing SDL.\n");
|
||||
|
||||
if ((SDL_Init (SDL_INIT_VIDEO
|
||||
| SDL_INIT_AUDIO
|
||||
| SDL_INIT_JOYSTICK
|
||||
| SDL_INIT_NOPARACHUTE //For Debugging in MSVC++
|
||||
) == -1))
|
||||
{
|
||||
printf("Could not initialize SDL: %s.\n", SDL_GetError());
|
||||
exit(-1);
|
||||
}
|
||||
SDL_VideoDriverName (VideoName, sizeof (VideoName));
|
||||
printf("SDL driver used: %s\n", VideoName);
|
||||
// Set the environment variable SDL_VIDEODRIVER to override
|
||||
// For Linux: x11 (default), dga, fbcon, directfb, svgalib,
|
||||
// ggi, aalib
|
||||
// For Windows: directx (default), windib
|
||||
atexit (SDL_Quit);
|
||||
|
||||
printf ("SDL initialized.\n");
|
||||
|
||||
SDL_EnableUNICODE (1);
|
||||
|
||||
printf ("Initializing Screen.\n");
|
||||
|
||||
ScreenWidth = 320;
|
||||
ScreenHeight = 240;
|
||||
ScreenWidthActual = 640;
|
||||
ScreenHeightActual = 480;
|
||||
ScreenBPPActual = 16;
|
||||
|
||||
switch(ScreenBPPActual) {
|
||||
case 8:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 3);
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
break;
|
||||
}
|
||||
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, ScreenBPPActual);
|
||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||
|
||||
Screen = SDL_SetVideoMode (
|
||||
ScreenWidthActual, ScreenHeightActual, ScreenBPPActual,
|
||||
0
|
||||
// | SDL_HWSURFACE
|
||||
// | SDL_DOUBLEBUF
|
||||
| SDL_OPENGL
|
||||
| SDL_ANYFORMAT
|
||||
// | SDL_FULLSCREEN
|
||||
);
|
||||
if (Screen == NULL)
|
||||
{
|
||||
printf ("Couldn't set %ix%ix%i video mode: %s\n",
|
||||
ScreenWidthActual, ScreenHeightActual, ScreenBPPActual,
|
||||
SDL_GetError ());
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("Set the resolution to: %ix%ix%i\n",
|
||||
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
|
||||
SDL_GetVideoSurface()->format->BitsPerPixel);
|
||||
printf("OpenGL renderer: %s version: %s\n", glGetString(GL_RENDERER),
|
||||
glGetString(GL_VERSION));
|
||||
|
||||
}
|
||||
|
||||
//glShadeModel (GL_SMOOTH);
|
||||
glClearColor (0,0,0,0);
|
||||
glViewport (0, 0, ScreenWidthActual, ScreenHeightActual);
|
||||
glDrawBuffer (GL_FRONT_LEFT);
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
SDL_GL_SwapBuffers (); //Clear both buffers at init
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
glEnable (GL_ALPHA_TEST);
|
||||
glDisable (GL_DITHER);
|
||||
glAlphaFunc (GL_GREATER, 0);
|
||||
|
||||
printf ("%i joysticks were found.\n", SDL_NumJoysticks ());
|
||||
if(SDL_NumJoysticks() > 0)
|
||||
{
|
||||
printf ("The names of the joysticks are:\n");
|
||||
for(i = 0; i < SDL_NumJoysticks (); i++)
|
||||
{
|
||||
printf(" %s\n", SDL_JoystickName (i));
|
||||
}
|
||||
SDL_JoystickEventState (SDL_ENABLE);
|
||||
Joystick1 = SDL_JoystickOpen (0);
|
||||
if (SDL_NumJoysticks () > 1)
|
||||
SDL_JoystickOpen(1);
|
||||
}
|
||||
|
||||
if (Mix_OpenAudio(44100, AUDIO_S16, 2, 4096))
|
||||
{
|
||||
printf ("Unable to open audio!\n");
|
||||
exit (-1);
|
||||
}
|
||||
atexit (Mix_CloseAudio);
|
||||
|
||||
SDL_AudioDriverName (SoundcardName, sizeof (SoundcardName));
|
||||
|
||||
Mix_QuerySpec (&audio_rate, &audio_format, &audio_channels);
|
||||
printf ("Opened %s at %d Hz %d bit %s, %d bytes audio buffer\n",
|
||||
SoundcardName, audio_rate, audio_format & 0xFF,
|
||||
audio_channels > 1 ? "stereo" : "mono", 4096);
|
||||
|
||||
MIX_VERSION (&compile_version);
|
||||
printf ("Compiled with SDL_mixer version: %d.%d.%d\n",
|
||||
compile_version.major,
|
||||
compile_version.minor,
|
||||
compile_version.patch);
|
||||
printf ("Running with SDL_mixer version: %d.%d.%d\n",
|
||||
Mix_Linked_Version()->major,
|
||||
Mix_Linked_Version()->minor,
|
||||
Mix_Linked_Version()->patch);
|
||||
|
||||
//SDL_ShowCursor (SDL_DISABLE);
|
||||
|
||||
GraphicsSem = SDL_CreateSemaphore (1);
|
||||
_MemorySem = SDL_CreateSemaphore (1);
|
||||
|
||||
//End System Initialization
|
||||
|
||||
//Begin Game Initialization
|
||||
|
||||
for(a = 0; a < 512; a++)
|
||||
{
|
||||
KeyboardDown[a] = FALSE;
|
||||
//KeyboardStroke[a] = FALSE;
|
||||
}
|
||||
ControlA = SDLK_f;
|
||||
ControlB = SDLK_d;
|
||||
ControlC = SDLK_s;
|
||||
ControlX = SDLK_a;
|
||||
ControlStart = SDLK_RETURN;
|
||||
ControlLeftShift = SDLK_LSHIFT;
|
||||
ControlRightShift = SDLK_RSHIFT;
|
||||
|
||||
//End Game Initialization
|
||||
|
||||
TFB_DEBUG_HALT = 0;
|
||||
|
||||
//Begin MultiThreading
|
||||
|
||||
printf ("\n---\n\n");
|
||||
|
||||
SDL_CreateThread (Starcon2Main, NULL);
|
||||
|
||||
//End MultiThreading
|
||||
|
||||
//Start Test Code
|
||||
|
||||
//End Test Code
|
||||
|
||||
//Start main game loop here
|
||||
|
||||
for (;;)
|
||||
{
|
||||
//Process Events
|
||||
|
||||
while (SDL_PollEvent (&Event))
|
||||
{
|
||||
switch (Event.type) {
|
||||
case SDL_ACTIVEEVENT: /* Loose/gain visibility */
|
||||
// TODO
|
||||
break;
|
||||
case SDL_KEYDOWN: /* Key pressed */
|
||||
case SDL_KEYUP: /* Key released */
|
||||
ProcessKeyboardEvent (&Event);
|
||||
break;
|
||||
case SDL_JOYAXISMOTION: /* Joystick axis motion */
|
||||
case SDL_JOYBUTTONDOWN: /* Joystick button pressed */
|
||||
case SDL_JOYBUTTONUP: /* Joystick button released */
|
||||
ProcessJoystickEvent (&Event);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
exit (0);
|
||||
break;
|
||||
case SDL_VIDEORESIZE: /* User resized video mode */
|
||||
// TODO
|
||||
break;
|
||||
case SDL_VIDEOEXPOSE: /* Screen needs to be redrawn */
|
||||
// TODO
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TFB_FlushGraphics ();
|
||||
|
||||
//Still testing this... Should fix sticky input soon...
|
||||
/*
|
||||
{
|
||||
Uint8* Temp;
|
||||
|
||||
SDL_PumpEvents ();
|
||||
Temp = SDL_GetKeyState (NULL);
|
||||
for(a = 0; a < 512; a++)
|
||||
{
|
||||
KeyboardDown[a] = Temp[a];
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
return Main(argc,argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user