McMartin's task patch.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@56 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+162
-153
@@ -25,7 +25,7 @@ CFG=Starcon2 - Win32 Debug
|
|||||||
# PROP AllowPerConfigDependencies 0
|
# PROP AllowPerConfigDependencies 0
|
||||||
# PROP Scc_ProjName ""
|
# PROP Scc_ProjName ""
|
||||||
# PROP Scc_LocalPath ""
|
# PROP Scc_LocalPath ""
|
||||||
CPP=snCl.exe
|
CPP=cl.exe
|
||||||
RSC=rc.exe
|
RSC=rc.exe
|
||||||
|
|
||||||
!IF "$(CFG)" == "Starcon2 - Win32 Release"
|
!IF "$(CFG)" == "Starcon2 - Win32 Release"
|
||||||
@@ -45,12 +45,12 @@ RSC=rc.exe
|
|||||||
# 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 "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_SDL" /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 "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_SDL" /YX /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=snBsc.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=snLink.exe
|
LINK32=link.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 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 /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 /nologo /subsystem:console /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"../../Content/Starcon2.exe"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "Starcon2 - Win32 Debug"
|
!ELSEIF "$(CFG)" == "Starcon2 - Win32 Debug"
|
||||||
|
|
||||||
@@ -69,12 +69,12 @@ LINK32=snLink.exe
|
|||||||
# 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 "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_SDL" /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 "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "SOUNDMODULE_SDL" /FR /YX /FD /GZ /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
BSC32=snBsc.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo /o"Starcon2.bsc"
|
# ADD BSC32 /nologo /o"Starcon2.bsc"
|
||||||
LINK32=snLink.exe
|
LINK32=link.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 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 /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 /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../Content/Starcon2Debug.exe" /pdbtype:sept
|
||||||
# SUBTRACT LINK32 /nodefaultlib
|
# SUBTRACT LINK32 /nodefaultlib
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
@@ -86,18 +86,6 @@ LINK32=snLink.exe
|
|||||||
# Begin Group "Source Files"
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# 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"
|
# Begin Group "sc2code"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
@@ -127,6 +115,66 @@ SOURCE=..\sc2code\libs\decomp\update.c
|
|||||||
# Begin Group "graphics"
|
# Begin Group "graphics"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
|
# Begin Group "sdl"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\3do_blt.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\3do_funcs.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\3do_getbody.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\dcqueue.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\opengl.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\opengl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\primitives.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\primitives.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\pure.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\sdl\pure.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 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
|
||||||
|
# End Group
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\boxint.c
|
SOURCE=..\sc2code\libs\graphics\boxint.c
|
||||||
@@ -137,6 +185,14 @@ SOURCE=..\sc2code\libs\graphics\clipline.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\cmap.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\graphics\cmap.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\context.c
|
SOURCE=..\sc2code\libs\graphics\context.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -173,6 +229,14 @@ SOURCE=..\sc2code\libs\graphics\frame.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin 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 Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\gfxintrn.h
|
SOURCE=..\sc2code\libs\graphics\gfxintrn.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -215,86 +279,22 @@ SOURCE=..\sc2code\libs\graphics\resgfx.c
|
|||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\stamp.c
|
SOURCE=..\sc2code\libs\graphics\stamp.c
|
||||||
# End Source File
|
# 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 Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\cmap.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\cmap.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\dcqueue.c
|
|
||||||
# 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 Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\primitives.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\primitives.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\opengl.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\opengl.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\pure.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\pure.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\3do_blt.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\3do_funcs.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\graphics\sdl\3do_getbody.c
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "input"
|
# Begin Group "input"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
|
# Begin Group "sdl No. 1"
|
||||||
|
|
||||||
|
# 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
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\input\inpintrn.h
|
SOURCE=..\sc2code\libs\input\inpintrn.h
|
||||||
@@ -307,19 +307,6 @@ SOURCE=..\sc2code\libs\input\input_common.c
|
|||||||
|
|
||||||
SOURCE=..\sc2code\libs\input\input_common.h
|
SOURCE=..\sc2code\libs\input\input_common.h
|
||||||
# End Source File
|
# 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
|
# End Group
|
||||||
# Begin Group "math"
|
# Begin Group "math"
|
||||||
|
|
||||||
@@ -392,6 +379,26 @@ SOURCE=..\sc2code\libs\resource\resintrn.h
|
|||||||
# Begin Group "sound"
|
# Begin Group "sound"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
|
# Begin Group "sdl No. 2"
|
||||||
|
|
||||||
|
# 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
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\sound\fileinst.c
|
SOURCE=..\sc2code\libs\sound\fileinst.c
|
||||||
@@ -414,37 +421,16 @@ SOURCE=..\sc2code\libs\sound\sndintrn.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\sound\trackplayer.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\sound\sound_common.c
|
SOURCE=..\sc2code\libs\sound\sound_common.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\sound\sound_common.h
|
SOURCE=..\sc2code\libs\sound\sound_common.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Group "sdl"
|
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\sound\sdl\modfuncs.c
|
SOURCE=..\sc2code\libs\sound\trackplayer.h
|
||||||
# End Source File
|
# 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
|
# End Group
|
||||||
# Begin Group "strings"
|
# Begin Group "strings"
|
||||||
|
|
||||||
@@ -481,15 +467,7 @@ SOURCE=..\sc2code\libs\video\vfileins.c
|
|||||||
# Begin Group "threads"
|
# Begin Group "threads"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Group "sdl No. 3"
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\threads\thrcommon.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\threads\thrcommon.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Group "sdl"
|
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -501,19 +479,19 @@ SOURCE=..\sc2code\libs\threads\sdl\sdlthreads.c
|
|||||||
SOURCE=..\sc2code\libs\threads\sdl\sdlthreads.h
|
SOURCE=..\sc2code\libs\threads\sdl\sdlthreads.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\threads\thrcommon.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\threads\thrcommon.h
|
||||||
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "time"
|
# Begin Group "time"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Group "sdl No. 4"
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\time\timecommon.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\time\timecommon.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Group "sdl"
|
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -525,6 +503,22 @@ SOURCE=..\sc2code\libs\time\sdl\sdltime.c
|
|||||||
SOURCE=..\sc2code\libs\time\sdl\sdltime.h
|
SOURCE=..\sc2code\libs\time\sdl\sdltime.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\time\timecommon.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\time\timecommon.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "task"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\task\tasklib.c
|
||||||
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
@@ -556,6 +550,10 @@ SOURCE=..\sc2code\libs\memlib.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\misc.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\reslib.h
|
SOURCE=..\sc2code\libs\reslib.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -568,6 +566,10 @@ SOURCE=..\sc2code\libs\strlib.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sc2code\libs\tasklib.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\threadlib.h
|
SOURCE=..\sc2code\libs\threadlib.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -582,11 +584,6 @@ SOURCE=..\sc2code\libs\vargs.h
|
|||||||
|
|
||||||
SOURCE=..\sc2code\libs\vidlib.h
|
SOURCE=..\sc2code\libs\vidlib.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\misc.h
|
|
||||||
# End Source File
|
|
||||||
|
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "comm"
|
# Begin Group "comm"
|
||||||
|
|
||||||
@@ -3065,6 +3062,18 @@ SOURCE=..\sc2code\weapon.c
|
|||||||
SOURCE=..\sc2code\weapon.h
|
SOURCE=..\sc2code\weapon.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\port.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\port.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\starcon2.c
|
||||||
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# End Target
|
# End Target
|
||||||
# End Project
|
# End Project
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#define IsLeapYear(yi) (!((yi) & 3) && (((yi) % 100) || ((yi) % 400)))
|
#define IsLeapYear(yi) (!((yi) & 3) && (((yi) % 100) || ((yi) % 400)))
|
||||||
|
|
||||||
int clock_task_func(void* blah)
|
int clock_task_func(void* data)
|
||||||
{
|
{
|
||||||
BOOLEAN LastPilot;
|
BOOLEAN LastPilot;
|
||||||
DWORD LastTime;
|
DWORD LastTime;
|
||||||
@@ -41,13 +41,14 @@ int clock_task_func(void* blah)
|
|||||||
};
|
};
|
||||||
#define NUM_CYCLES (sizeof (cycle_tab) / sizeof (cycle_tab[0]))
|
#define NUM_CYCLES (sizeof (cycle_tab) / sizeof (cycle_tab[0]))
|
||||||
#define NUM_DELAYS 9
|
#define NUM_DELAYS 9
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
LastPilot = FALSE;
|
LastPilot = FALSE;
|
||||||
LastTime = 0;
|
LastTime = 0;
|
||||||
cycle_index = delay_count = 0;
|
cycle_index = delay_count = 0;
|
||||||
while (GLOBAL (GameClock).day_in_ticks == 0)
|
while (GLOBAL (GameClock).day_in_ticks == 0 && !Task_ReadState (task, TASK_EXIT))
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
BOOLEAN OnAutoPilot;
|
BOOLEAN OnAutoPilot;
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
@@ -153,7 +154,7 @@ int clock_task_func(void* blah)
|
|||||||
ClearSemaphore (GLOBAL (GameClock).clock_sem);
|
ClearSemaphore (GLOBAL (GameClock).clock_sem);
|
||||||
SleepThreadUntil (TimeIn + 1);
|
SleepThreadUntil (TimeIn + 1);
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ InitGameClock (void)
|
|||||||
GLOBAL (GameClock).tick_count = GLOBAL (GameClock).day_in_ticks = 0;
|
GLOBAL (GameClock).tick_count = GLOBAL (GameClock).day_in_ticks = 0;
|
||||||
SuspendGameClock ();
|
SuspendGameClock ();
|
||||||
if ((GLOBAL (GameClock.clock_task) =
|
if ((GLOBAL (GameClock.clock_task) =
|
||||||
CreateThread (clock_task_func, NULL, 2048,
|
AssignTask (clock_task_func, 2048,
|
||||||
"game clock")) == 0)
|
"game clock")) == 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ UninitGameClock (void)
|
|||||||
ResumeGameClock ();
|
ResumeGameClock ();
|
||||||
|
|
||||||
SetSemaphore (GLOBAL (GameClock.clock_sem));
|
SetSemaphore (GLOBAL (GameClock.clock_sem));
|
||||||
KillThread (GLOBAL (GameClock.clock_task));
|
Task_SetState (GLOBAL (GameClock.clock_task), TASK_EXIT);
|
||||||
ClearSemaphore (GLOBAL (GameClock.clock_sem));
|
ClearSemaphore (GLOBAL (GameClock.clock_sem));
|
||||||
|
|
||||||
GLOBAL (GameClock.clock_task) = 0;
|
GLOBAL (GameClock.clock_task) = 0;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#ifndef _CLOCK_H
|
#ifndef _CLOCK_H
|
||||||
#define _CLOCK_H
|
#define _CLOCK_H
|
||||||
|
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
#define START_YEAR 2155
|
#define START_YEAR 2155
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -55,7 +57,7 @@ typedef struct
|
|||||||
COUNT year_index;
|
COUNT year_index;
|
||||||
SIZE tick_count, day_in_ticks;
|
SIZE tick_count, day_in_ticks;
|
||||||
Semaphore clock_sem;
|
Semaphore clock_sem;
|
||||||
Thread clock_task;
|
Task clock_task;
|
||||||
DWORD TimeCounter;
|
DWORD TimeCounter;
|
||||||
|
|
||||||
QUEUE event_q;
|
QUEUE event_q;
|
||||||
|
|||||||
+18
-15
@@ -59,7 +59,7 @@ typedef struct encounter_state
|
|||||||
RESPONSE_FUNC response_func;
|
RESPONSE_FUNC response_func;
|
||||||
} response_list[MAX_RESPONSES];
|
} response_list[MAX_RESPONSES];
|
||||||
|
|
||||||
Thread AnimTask;
|
Task AnimTask;
|
||||||
|
|
||||||
COUNT phrase_buf_index;
|
COUNT phrase_buf_index;
|
||||||
UNICODE phrase_buf[512];
|
UNICODE phrase_buf[512];
|
||||||
@@ -361,18 +361,19 @@ static struct
|
|||||||
{
|
{
|
||||||
COLORMAPPTR CMapPtr;
|
COLORMAPPTR CMapPtr;
|
||||||
SIZE Ticks;
|
SIZE Ticks;
|
||||||
Thread XFormTask;
|
Task XFormTask;
|
||||||
} TaskControl;
|
} TaskControl;
|
||||||
|
|
||||||
static BOOLEAN ColorChange;
|
static BOOLEAN ColorChange;
|
||||||
static BOOLEAN volatile XFormFlush;
|
static BOOLEAN volatile XFormFlush;
|
||||||
static COUNT volatile NumXFormTasks;
|
static COUNT volatile NumXFormTasks;
|
||||||
|
|
||||||
int xform_PLUT_task(void* blah)
|
int xform_PLUT_task(void* data)
|
||||||
{
|
{
|
||||||
COLORMAPPTR CurMapPtr;
|
COLORMAPPTR CurMapPtr;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
while (TaskControl.XFormTask == 0)
|
while (TaskControl.XFormTask == 0 && !Task_ReadState (task, TASK_EXIT))
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
TaskControl.XFormTask = 0;
|
TaskControl.XFormTask = 0;
|
||||||
CurMapPtr = TaskControl.CMapPtr;
|
CurMapPtr = TaskControl.CMapPtr;
|
||||||
@@ -452,11 +453,12 @@ if (_varPLUTs)
|
|||||||
|
|
||||||
ColorChange = TRUE;
|
ColorChange = TRUE;
|
||||||
|
|
||||||
} while (TTotal -= TDelta);
|
} while (TTotal -= TDelta && !Task_ReadState (task, TASK_EXIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
--NumXFormTasks;
|
--NumXFormTasks;
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
|
||||||
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +490,7 @@ XFormPLUT (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
if ((TaskControl.Ticks = TimeInterval) <= 0)
|
if ((TaskControl.Ticks = TimeInterval) <= 0)
|
||||||
TaskControl.Ticks = 1; /* prevent divide by zero and negative fade */
|
TaskControl.Ticks = 1; /* prevent divide by zero and negative fade */
|
||||||
if (TimeInterval == 0 || (TaskControl.XFormTask =
|
if (TimeInterval == 0 || (TaskControl.XFormTask =
|
||||||
CreateThread (xform_PLUT_task, NULL, 1024,
|
AssignTask (xform_PLUT_task, 1024,
|
||||||
"transform palette")) == 0)
|
"transform palette")) == 0)
|
||||||
{
|
{
|
||||||
SetColorMap (ColorMapPtr, TFB_COLORMAP_COMM);
|
SetColorMap (ColorMapPtr, TFB_COLORMAP_COMM);
|
||||||
@@ -676,7 +678,7 @@ UpdateSpeechGraphics (BOOLEAN Initialize)
|
|||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ambient_anim_task(void* blah)
|
int ambient_anim_task(void* data)
|
||||||
{
|
{
|
||||||
SIZE TalkAlarm;
|
SIZE TalkAlarm;
|
||||||
FRAME TalkFrame;
|
FRAME TalkFrame;
|
||||||
@@ -689,8 +691,9 @@ int ambient_anim_task(void* blah)
|
|||||||
ANIMATION_DESCPTR ADPtr;
|
ANIMATION_DESCPTR ADPtr;
|
||||||
DWORD ActiveMask;
|
DWORD ActiveMask;
|
||||||
DWORD LastOscillTime;
|
DWORD LastOscillTime;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
while ((CommFrame = CommData.AlienFrame) == 0)
|
while ((CommFrame = CommData.AlienFrame) == 0 && !Task_ReadState (task, TASK_EXIT))
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
@@ -703,7 +706,7 @@ DWORD LastOscillTime;
|
|||||||
TalkFrame = 0;
|
TalkFrame = 0;
|
||||||
LastTime = GetTimeCounter ();
|
LastTime = GetTimeCounter ();
|
||||||
LastOscillTime = LastTime;
|
LastOscillTime = LastTime;
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
BOOLEAN Change, CanTalk;
|
BOOLEAN Change, CanTalk;
|
||||||
DWORD CurTime, ElapsedTicks;
|
DWORD CurTime, ElapsedTicks;
|
||||||
@@ -729,7 +732,7 @@ LastOscillTime = LastTime;
|
|||||||
pBatch = &DisplayArray[MAX_ANIMATIONS + 1];
|
pBatch = &DisplayArray[MAX_ANIMATIONS + 1];
|
||||||
pSeq = &Sequencer[i];
|
pSeq = &Sequencer[i];
|
||||||
ADPtr = &CommData.AlienAmbientArray[i];
|
ADPtr = &CommData.AlienAmbientArray[i];
|
||||||
while (i--)
|
while (i-- && !Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
--ADPtr;
|
--ADPtr;
|
||||||
--pSeq;
|
--pSeq;
|
||||||
@@ -1035,7 +1038,7 @@ if (LastOscillTime + (ONE_SECOND / 32) < CurTime)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1206,8 +1209,8 @@ UnbatchGraphics ();
|
|||||||
|
|
||||||
TimeOut = GetTimeCounter () + (ONE_SECOND >> 1);
|
TimeOut = GetTimeCounter () + (ONE_SECOND >> 1);
|
||||||
/* if (CommData.NumAnimations) */
|
/* if (CommData.NumAnimations) */
|
||||||
pCurInputState->AnimTask = CreateThread (ambient_anim_task,
|
pCurInputState->AnimTask = AssignTask (ambient_anim_task,
|
||||||
NULL, 3072, "ambient animations");
|
3072, "ambient animations");
|
||||||
|
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
SleepThreadUntil (TimeOut);
|
SleepThreadUntil (TimeOut);
|
||||||
@@ -1378,7 +1381,7 @@ DoCommunication (INPUT_STATE InputState, PENCOUNTER_STATE pES)
|
|||||||
|
|
||||||
if (pES->AnimTask)
|
if (pES->AnimTask)
|
||||||
{
|
{
|
||||||
KillThread (pES->AnimTask);
|
Task_SetState (pES->AnimTask, TASK_EXIT);
|
||||||
pES->AnimTask = 0;
|
pES->AnimTask = 0;
|
||||||
}
|
}
|
||||||
CommData.AlienTransitionDesc.AnimFlags &= ~(TALK_INTRO | TALK_DONE);
|
CommData.AlienTransitionDesc.AnimFlags &= ~(TALK_INTRO | TALK_DONE);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
SUBDIRS = decomp graphics input math memory resource sound strings threads \
|
SUBDIRS = decomp graphics input math memory resource sound strings \
|
||||||
time video
|
task threads time video
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
compiler.h declib.h errlib.h gfxlib.h inplib.h mathlib.h \
|
compiler.h declib.h errlib.h gfxlib.h inplib.h mathlib.h \
|
||||||
memlib.h reslib.h sndlib.h strlib.h threadlib.h timelib.h \
|
memlib.h reslib.h sndlib.h strlib.h tasklib.h threadlib.h \
|
||||||
vargs.h vidlib.h misc.h
|
timelib.h vargs.h vidlib.h misc.h
|
||||||
|
|
||||||
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
@@ -16,6 +16,6 @@ liblibs_la_SOURCES = dummy.c
|
|||||||
liblibs_la_LIBADD = decomp/libdecomp.la graphics/libgraphics.la \
|
liblibs_la_LIBADD = decomp/libdecomp.la graphics/libgraphics.la \
|
||||||
input/libinput.la math/libmath.la memory/libmemory.la \
|
input/libinput.la math/libmath.la memory/libmemory.la \
|
||||||
resource/libresource.la sound/libsound.la \
|
resource/libresource.la sound/libsound.la \
|
||||||
strings/libstrings.la threads/libthreads.la \
|
strings/libstrings.la task/libtask.la threads/libthreads.la \
|
||||||
time/libtime.la video/libvideo.la
|
time/libtime.la video/libvideo.la
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "libs/graphics/sdl/sdl_common.h"
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "gfx_common.h"
|
#include "gfx_common.h"
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,7 @@ static struct
|
|||||||
union
|
union
|
||||||
{
|
{
|
||||||
COUNT NumCycles;
|
COUNT NumCycles;
|
||||||
Thread XFormTask;
|
Task XFormTask;
|
||||||
} tc;
|
} tc;
|
||||||
} TaskControl;
|
} TaskControl;
|
||||||
|
|
||||||
@@ -198,12 +199,13 @@ _threedo_set_colors (UBYTE *colors, unsigned int indices)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
color_cycle (void *foo)
|
color_cycle (void *data)
|
||||||
{
|
{
|
||||||
UWORD color_beg, color_len, color_indices;
|
UWORD color_beg, color_len, color_indices;
|
||||||
COUNT Cycles, CycleCount;
|
COUNT Cycles, CycleCount;
|
||||||
DWORD TimeIn, SleepTicks;
|
DWORD TimeIn, SleepTicks;
|
||||||
COLORMAPPTR BegMapPtr, CurMapPtr;
|
COLORMAPPTR BegMapPtr, CurMapPtr;
|
||||||
|
Task task = (Task)data;
|
||||||
|
|
||||||
Cycles = CycleCount = TaskControl.tc.NumCycles;
|
Cycles = CycleCount = TaskControl.tc.NumCycles;
|
||||||
BegMapPtr = TaskControl.CMapPtr;
|
BegMapPtr = TaskControl.CMapPtr;
|
||||||
@@ -216,7 +218,7 @@ color_cycle (void *foo)
|
|||||||
|
|
||||||
TaskControl.CMapPtr = 0;
|
TaskControl.CMapPtr = 0;
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState(task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
//_threedo_set_colors (CurMapPtr, color_indices);
|
//_threedo_set_colors (CurMapPtr, color_indices);
|
||||||
|
|
||||||
@@ -234,10 +236,12 @@ color_cycle (void *foo)
|
|||||||
if (TaskControl.CMapPtr)
|
if (TaskControl.CMapPtr)
|
||||||
{
|
{
|
||||||
TaskControl.CMapPtr = (COLORMAPPTR)0;
|
TaskControl.CMapPtr = (COLORMAPPTR)0;
|
||||||
for (;;)
|
while (!Task_ReadState(task, TASK_EXIT))
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FinishTask (task);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CYCLE_REF
|
CYCLE_REF
|
||||||
@@ -245,7 +249,7 @@ CycleColorMap (COLORMAPPTR ColorMapPtr, COUNT Cycles, SIZE TimeInterval)
|
|||||||
{
|
{
|
||||||
if (ColorMapPtr && Cycles && ColorMapPtr[0] <= ColorMapPtr[1])
|
if (ColorMapPtr && Cycles && ColorMapPtr[0] <= ColorMapPtr[1])
|
||||||
{
|
{
|
||||||
Thread T;
|
Task T;
|
||||||
|
|
||||||
while (TaskControl.CMapPtr)
|
while (TaskControl.CMapPtr)
|
||||||
{
|
{
|
||||||
@@ -257,7 +261,7 @@ CycleColorMap (COLORMAPPTR ColorMapPtr, COUNT Cycles, SIZE TimeInterval)
|
|||||||
if ((TaskControl.Ticks = TimeInterval) <= 0)
|
if ((TaskControl.Ticks = TimeInterval) <= 0)
|
||||||
TaskControl.Ticks = 1;
|
TaskControl.Ticks = 1;
|
||||||
|
|
||||||
T = CreateThread (color_cycle, NULL, 0, "color cycle");
|
T = AssignTask (color_cycle, 0, "color cycle");
|
||||||
if (T)
|
if (T)
|
||||||
{
|
{
|
||||||
_batch_flags |= ENABLE_CYCLE;
|
_batch_flags |= ENABLE_CYCLE;
|
||||||
@@ -276,9 +280,9 @@ CycleColorMap (COLORMAPPTR ColorMapPtr, COUNT Cycles, SIZE TimeInterval)
|
|||||||
void
|
void
|
||||||
StopCycleColorMap (CYCLE_REF CycleRef)
|
StopCycleColorMap (CYCLE_REF CycleRef)
|
||||||
{
|
{
|
||||||
Thread T;
|
Task T;
|
||||||
|
|
||||||
T = (Thread) CycleRef;
|
T = (Task) CycleRef;
|
||||||
if (T)
|
if (T)
|
||||||
{
|
{
|
||||||
TaskControl.CMapPtr = (COLORMAPPTR)1;
|
TaskControl.CMapPtr = (COLORMAPPTR)1;
|
||||||
@@ -286,7 +290,7 @@ StopCycleColorMap (CYCLE_REF CycleRef)
|
|||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
_batch_flags &= ~ENABLE_CYCLE;
|
_batch_flags &= ~ENABLE_CYCLE;
|
||||||
KillThread (T);
|
Task_SetState (T, TASK_EXIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,13 +301,14 @@ StopCycleColorMap (CYCLE_REF CycleRef)
|
|||||||
static int cur = NORMAL_INTENSITY, end, XForming;
|
static int cur = NORMAL_INTENSITY, end, XForming;
|
||||||
|
|
||||||
static
|
static
|
||||||
int xform_clut_task (void *foo)
|
int xform_clut_task (void *data)
|
||||||
{
|
{
|
||||||
SIZE TDelta, TTotal;
|
SIZE TDelta, TTotal;
|
||||||
DWORD CurTime;
|
DWORD CurTime;
|
||||||
|
Task task = (Task)data;
|
||||||
|
|
||||||
XForming = TRUE;
|
XForming = TRUE;
|
||||||
while (TaskControl.tc.XFormTask == 0)
|
while (TaskControl.tc.XFormTask == 0 && (!Task_ReadState (task, TASK_EXIT)))
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
TTotal = TaskControl.Ticks;
|
TTotal = TaskControl.Ticks;
|
||||||
TaskControl.tc.XFormTask = 0;
|
TaskControl.tc.XFormTask = 0;
|
||||||
@@ -322,12 +327,12 @@ int xform_clut_task (void *foo)
|
|||||||
|
|
||||||
cur += (end - cur) * TDelta / TTotal;
|
cur += (end - cur) * TDelta / TTotal;
|
||||||
//_threedo_change_clut (cur);
|
//_threedo_change_clut (cur);
|
||||||
} while (TTotal -= TDelta);
|
} while (TTotal -= TDelta && (!Task_ReadState (task, TASK_EXIT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
XForming = FALSE;
|
XForming = FALSE;
|
||||||
|
|
||||||
(void) foo; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,8 +374,8 @@ XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
|
|
||||||
TaskControl.Ticks = TimeInterval;
|
TaskControl.Ticks = TimeInterval;
|
||||||
if (TaskControl.Ticks <= 0 ||
|
if (TaskControl.Ticks <= 0 ||
|
||||||
(TaskControl.tc.XFormTask = CreateThread (xform_clut_task,
|
(TaskControl.tc.XFormTask = AssignTask (xform_clut_task,
|
||||||
NULL, 1024, "transform colormap")) == 0)
|
1024, "transform colormap")) == 0)
|
||||||
{
|
{
|
||||||
//_threedo_change_clut (end);
|
//_threedo_change_clut (end);
|
||||||
TimeOut = GetTimeCounter ();
|
TimeOut = GetTimeCounter ();
|
||||||
|
|||||||
@@ -18,10 +18,11 @@
|
|||||||
|
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/sound/sound_common.h"
|
#include "libs/sound/sound_common.h"
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
extern int _music_volume;
|
extern int _music_volume;
|
||||||
|
|
||||||
static Thread FadeTask;
|
static Task FadeTask;
|
||||||
static SIZE TTotal;
|
static SIZE TTotal;
|
||||||
static SIZE volume_end;
|
static SIZE volume_end;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ fade_task (void *data)
|
|||||||
{
|
{
|
||||||
SIZE TDelta, volume_beg;
|
SIZE TDelta, volume_beg;
|
||||||
DWORD StartTime, CurTime;
|
DWORD StartTime, CurTime;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
volume_beg = _music_volume;
|
volume_beg = _music_volume;
|
||||||
StartTime = CurTime = GetTimeCounter ();
|
StartTime = CurTime = GetTimeCounter ();
|
||||||
@@ -45,6 +47,7 @@ fade_task (void *data)
|
|||||||
} while (TDelta < TTotal);
|
} while (TDelta < TTotal);
|
||||||
|
|
||||||
FadeTask = 0;
|
FadeTask = 0;
|
||||||
|
FinishTask (task);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +70,7 @@ FadeMusic (BYTE end_vol, SIZE TimeInterval)
|
|||||||
TTotal = 1; /* prevent divide by zero and negative fade */
|
TTotal = 1; /* prevent divide by zero and negative fade */
|
||||||
volume_end = end_vol;
|
volume_end = end_vol;
|
||||||
|
|
||||||
if (TTotal > 1 && (FadeTask = CreateThread (fade_task, NULL, 0,
|
if (TTotal > 1 && (FadeTask = AssignTask (fade_task, 0,
|
||||||
"fade music")))
|
"fade music")))
|
||||||
{
|
{
|
||||||
TimeOut = GetTimeCounter () + TTotal + 1;
|
TimeOut = GetTimeCounter () + TTotal + 1;
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
INCLUDES = @SDL_CFLAGS@ @SMPEG_CFLAGS@ \
|
||||||
|
-I$(top_srcdir)/src \
|
||||||
|
-I$(top_srcdir)/src/sc2code \
|
||||||
|
-I$(top_srcdir)/src/sc2code/libs
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES = libtask.la
|
||||||
|
libtask_la_SOURCES = tasklib.c
|
||||||
|
#noinst_HEADERS =
|
||||||
|
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* By Michael Martin, 2002-09-21
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
|
#define TASK_MAX 64
|
||||||
|
|
||||||
|
static struct taskstruct task_array[TASK_MAX];
|
||||||
|
|
||||||
|
Task
|
||||||
|
AssignTask (ThreadFunction task_func, SDWORD stackSize, const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < TASK_MAX; ++i)
|
||||||
|
{
|
||||||
|
if (!Task_SetState (task_array+i, TASK_INUSE))
|
||||||
|
{
|
||||||
|
// fprintf (stderr, "Assigning Task #%i: %s\n", i+1, name);
|
||||||
|
Task_ClearState (task_array+i, ~TASK_INUSE);
|
||||||
|
task_array[i].name = name;
|
||||||
|
task_array[i].thread = CreateThread (task_func, task_array+i,
|
||||||
|
stackSize, name);
|
||||||
|
return task_array+i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf (stderr, "Task error! Task array exhausted. Check for thread leaks.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FinishTask (Task task)
|
||||||
|
{
|
||||||
|
// fprintf (stderr, "Releasing Task: %s\n", task->name);
|
||||||
|
task->thread = 0;
|
||||||
|
if (!Task_ClearState (task, TASK_INUSE))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Task error! Attempted to FinishTask \"%s\"... "
|
||||||
|
"but it was already done!\n", task->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This could probably be done better with a condition variable of some kind. */
|
||||||
|
void
|
||||||
|
ConcludeTask (Task task)
|
||||||
|
{
|
||||||
|
Thread old = task->thread;
|
||||||
|
// fprintf (stderr, "Awaiting conclusion of %s\n", task->name);
|
||||||
|
if (old)
|
||||||
|
{
|
||||||
|
Task_SetState (task, TASK_EXIT);
|
||||||
|
while (task->thread == old)
|
||||||
|
{
|
||||||
|
TaskSwitch ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
Task_SetState (Task task, DWORD state_mask)
|
||||||
|
{
|
||||||
|
DWORD old_state;
|
||||||
|
LockMutex (task->state_mutex);
|
||||||
|
old_state = task->state;
|
||||||
|
task->state |= state_mask;
|
||||||
|
UnlockMutex (task->state_mutex);
|
||||||
|
old_state &= state_mask;
|
||||||
|
return old_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
Task_ClearState (Task task, DWORD state_mask)
|
||||||
|
{
|
||||||
|
DWORD old_state;
|
||||||
|
LockMutex (task->state_mutex);
|
||||||
|
old_state = task->state;
|
||||||
|
task->state &= ~state_mask;
|
||||||
|
UnlockMutex (task->state_mutex);
|
||||||
|
old_state &= state_mask;
|
||||||
|
return old_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
Task_ToggleState (Task task, DWORD state_mask)
|
||||||
|
{
|
||||||
|
DWORD old_state;
|
||||||
|
LockMutex (task->state_mutex);
|
||||||
|
old_state = task->state;
|
||||||
|
task->state ^= state_mask;
|
||||||
|
UnlockMutex (task->state_mutex);
|
||||||
|
old_state &= state_mask;
|
||||||
|
return old_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
Task_ReadState (Task task, DWORD state_mask)
|
||||||
|
{
|
||||||
|
return task->state & state_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InitTaskSystem (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < TASK_MAX; ++i)
|
||||||
|
{
|
||||||
|
task_array[i].state_mutex = CreateMutex ();
|
||||||
|
}
|
||||||
|
atexit (CleanupTaskSystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CleanupTaskSystem (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < TASK_MAX; ++i)
|
||||||
|
{
|
||||||
|
DestroyMutex (task_array[i].state_mutex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* By Michael Martin, 2002-09-21
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The task libraries are a set of facilities for controlling synchronous
|
||||||
|
* processes. They are built on top of threads, but add the ability to
|
||||||
|
* modify a "state" variable to pass messages back and forth. */
|
||||||
|
|
||||||
|
#ifndef _TASKLIB_H
|
||||||
|
#define _TASKLIB_H
|
||||||
|
|
||||||
|
#include "libs/threadlib.h"
|
||||||
|
|
||||||
|
/* Bitmasks for setting task state. */
|
||||||
|
#define TASK_INUSE 1
|
||||||
|
#define TASK_EXIT 2
|
||||||
|
|
||||||
|
struct taskstruct {
|
||||||
|
Mutex state_mutex;
|
||||||
|
volatile DWORD state; // Protected by state_mutex
|
||||||
|
const char *name;
|
||||||
|
volatile Thread thread;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct taskstruct *Task;
|
||||||
|
|
||||||
|
extern void InitTaskSystem (void);
|
||||||
|
extern void CleanupTaskSystem (void);
|
||||||
|
|
||||||
|
extern Task AssignTask (ThreadFunction task_func, SDWORD Stacksize, const char *name);
|
||||||
|
extern DWORD Task_SetState (Task task, DWORD state_mask);
|
||||||
|
extern DWORD Task_ClearState (Task task, DWORD state_mask);
|
||||||
|
extern DWORD Task_ToggleState (Task task, DWORD state_mask);
|
||||||
|
extern DWORD Task_ReadState (Task task, DWORD state_mask);
|
||||||
|
extern void FinishTask (Task task);
|
||||||
|
extern void ConcludeTask (Task task);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "declib.h"
|
#include "declib.h"
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
ACTIVITY NextActivity;
|
ACTIVITY NextActivity;
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
DECODE_REF fh;
|
DECODE_REF fh;
|
||||||
COUNT num_links;
|
COUNT num_links;
|
||||||
Thread clock_task;
|
Task clock_task;
|
||||||
QUEUE event_q, encounter_q, avail_q, npc_q, player_q;
|
QUEUE event_q, encounter_q, avail_q, npc_q, player_q;
|
||||||
STAR_DESC SD;
|
STAR_DESC SD;
|
||||||
ACTIVITY Activity;
|
ACTIVITY Activity;
|
||||||
|
|||||||
@@ -497,12 +497,13 @@ Select (BYTE opt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int flash_selection_func(void* blah)
|
int flash_selection_func(void* data)
|
||||||
{
|
{
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
#define FLASH_RATE (ONE_SECOND / 8)
|
#define FLASH_RATE (ONE_SECOND / 8)
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
@@ -524,7 +525,8 @@ int flash_selection_func(void* blah)
|
|||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,7 +549,7 @@ InitMelee (PMELEE_STATE pMS)
|
|||||||
r.corner.x = r.corner.y = 0;
|
r.corner.x = r.corner.y = 0;
|
||||||
RepairMeleeFrame (&r);
|
RepairMeleeFrame (&r);
|
||||||
|
|
||||||
pMS->flash_task = CreateThread (flash_selection_func, NULL, 2048,
|
pMS->flash_task = AssignTask (flash_selection_func, 2048,
|
||||||
"flash melee selection");
|
"flash melee selection");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1420,7 +1422,7 @@ FreeMeleeInfo (PMELEE_STATE pMS)
|
|||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
{
|
{
|
||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
KillThread (pMS->flash_task);
|
Task_SetState (pMS->flash_task, TASK_EXIT);
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
@@ -1522,7 +1524,7 @@ DoMelee (INPUT_STATE InputState, PMELEE_STATE pMS)
|
|||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
{
|
{
|
||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
KillThread (pMS->flash_task);
|
Task_SetState (pMS->flash_task, TASK_EXIT);
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#ifndef _MELEE_H
|
#ifndef _MELEE_H
|
||||||
#define _MELEE_H
|
#define _MELEE_H
|
||||||
|
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MELEE_ANDROSYNTH,
|
MELEE_ANDROSYNTH,
|
||||||
@@ -89,7 +91,7 @@ typedef struct melee_state
|
|||||||
TEAM_IMAGE TeamImage[NUM_SIDES];
|
TEAM_IMAGE TeamImage[NUM_SIDES];
|
||||||
COUNT star_bucks[NUM_SIDES];
|
COUNT star_bucks[NUM_SIDES];
|
||||||
COUNT CurIndex;
|
COUNT CurIndex;
|
||||||
Thread flash_task;
|
Task flash_task;
|
||||||
TEAM_IMAGE FileList[MAX_VIS_TEAMS];
|
TEAM_IMAGE FileList[MAX_VIS_TEAMS];
|
||||||
TEAM_IMAGE PreBuiltList[NUM_PREBUILT];
|
TEAM_IMAGE PreBuiltList[NUM_PREBUILT];
|
||||||
} MELEE_STATE;
|
} MELEE_STATE;
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ LoadPlanet (BOOLEAN IsDefined)
|
|||||||
if (pSolarSysState->MenuState.flash_task == 0)
|
if (pSolarSysState->MenuState.flash_task == 0)
|
||||||
{
|
{
|
||||||
pSolarSysState->MenuState.flash_task =
|
pSolarSysState->MenuState.flash_task =
|
||||||
CreateThread (rotate_planet_task, NULL, 4096,
|
AssignTask (rotate_planet_task, 4096,
|
||||||
"rotate planets");
|
"rotate planets");
|
||||||
|
|
||||||
while (pSolarSysState->MenuState.Initialized == 2)
|
while (pSolarSysState->MenuState.Initialized == 2)
|
||||||
@@ -189,7 +189,7 @@ FreePlanet (void)
|
|||||||
|
|
||||||
if (pSolarSysState->MenuState.flash_task)
|
if (pSolarSysState->MenuState.flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pSolarSysState->MenuState.flash_task);
|
Task_SetState (pSolarSysState->MenuState.flash_task, TASK_EXIT);
|
||||||
pSolarSysState->MenuState.flash_task = 0;
|
pSolarSysState->MenuState.flash_task = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -915,25 +915,26 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rotate_planet_task(void *blah)
|
rotate_planet_task(void *data)
|
||||||
{
|
{
|
||||||
SIZE i;
|
SIZE i;
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
PSOLARSYS_STATE pSS;
|
PSOLARSYS_STATE pSS;
|
||||||
BOOLEAN repair, zooming;
|
BOOLEAN repair, zooming;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
repair = FALSE;
|
repair = FALSE;
|
||||||
zooming = TRUE;
|
zooming = TRUE;
|
||||||
|
|
||||||
pSS = pSolarSysState;
|
pSS = pSolarSysState;
|
||||||
while (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized < 2)
|
while (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized < 2 && !Task_ReadState (task, TASK_EXIT))
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
SetPlanetTilt ((pSS->SysInfo.PlanetInfo.AxialTilt << 8) / 360);
|
SetPlanetTilt ((pSS->SysInfo.PlanetInfo.AxialTilt << 8) / 360);
|
||||||
|
|
||||||
i = 1 - ((pSS->SysInfo.PlanetInfo.AxialTilt & 1) << 1);
|
i = 1 - ((pSS->SysInfo.PlanetInfo.AxialTilt & 1) << 1);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
BYTE view_index;
|
BYTE view_index;
|
||||||
COORD x;
|
COORD x;
|
||||||
@@ -978,8 +979,8 @@ rotate_planet_task(void *blah)
|
|||||||
|
|
||||||
SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / MAP_WIDTH));
|
SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / MAP_WIDTH));
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
} while (--view_index);
|
} while (--view_index && !Task_ReadState (task, TASK_EXIT));
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,11 +45,12 @@ void RepairBackRect (PRECT pRect);
|
|||||||
static BOOLEAN transition_pending;
|
static BOOLEAN transition_pending;
|
||||||
|
|
||||||
int
|
int
|
||||||
flash_cursor_func(void *blah)
|
flash_cursor_func(void *data)
|
||||||
{
|
{
|
||||||
BYTE c, val;
|
BYTE c, val;
|
||||||
POINT universe;
|
POINT universe;
|
||||||
STAMP s;
|
STAMP s;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
|
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
|
||||||
universe = CurStarDescPtr->star_pt;
|
universe = CurStarDescPtr->star_pt;
|
||||||
@@ -62,7 +63,7 @@ flash_cursor_func(void *blah)
|
|||||||
|
|
||||||
c = 0x00;
|
c = 0x00;
|
||||||
val = -0x02;
|
val = -0x02;
|
||||||
for (;;)
|
while (!Task_ReadState(task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
COLOR OldColor;
|
COLOR OldColor;
|
||||||
@@ -85,7 +86,7 @@ flash_cursor_func(void *blah)
|
|||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
SleepThreadUntil (TimeIn + (ONE_SECOND >> 4));
|
SleepThreadUntil (TimeIn + (ONE_SECOND >> 4));
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +612,7 @@ DoMoveCursor (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
);
|
);
|
||||||
pMS->InputFunc = DoMoveCursor;
|
pMS->InputFunc = DoMoveCursor;
|
||||||
|
|
||||||
pMS->flash_task = CreateThread (flash_cursor_func, NULL, 2048,
|
pMS->flash_task = AssignTask (flash_cursor_func, 2048,
|
||||||
"flash location on star map");
|
"flash location on star map");
|
||||||
s.origin.x = UNIVERSE_TO_DISPX (pMS->first_item.x);
|
s.origin.x = UNIVERSE_TO_DISPX (pMS->first_item.x);
|
||||||
s.origin.y = UNIVERSE_TO_DISPY (pMS->first_item.y);
|
s.origin.y = UNIVERSE_TO_DISPY (pMS->first_item.y);
|
||||||
@@ -621,13 +622,11 @@ DoMoveCursor (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
}
|
}
|
||||||
else if (InputState & DEVICE_BUTTON2)
|
else if (InputState & DEVICE_BUTTON2)
|
||||||
{
|
{
|
||||||
SetSemaphore (GraphicsSem);
|
|
||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pMS->flash_task);
|
ConcludeTask (pMS->flash_task);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
ClearSemaphore (GraphicsSem);
|
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,15 @@
|
|||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
flash_ship_task(void *blah)
|
flash_ship_task(void *data)
|
||||||
{
|
{
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
COLOR c;
|
COLOR c;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
c = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x19, 0x19), 0x24);
|
c = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x19, 0x19), 0x24);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
STAMP s;
|
STAMP s;
|
||||||
SHIP_FRAGMENTPTR StarShipPtr;
|
SHIP_FRAGMENTPTR StarShipPtr;
|
||||||
@@ -57,7 +58,7 @@ flash_ship_task(void *blah)
|
|||||||
SleepThreadUntil (TimeIn + 8);
|
SleepThreadUntil (TimeIn + 8);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ RosterCleanup (PMENU_STATE pMS)
|
|||||||
{
|
{
|
||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pMS->flash_task);
|
Task_SetState (pMS->flash_task, TASK_EXIT);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +349,7 @@ SelectSupport:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pMS->flash_task == 0)
|
if (pMS->flash_task == 0)
|
||||||
pMS->flash_task = CreateThread (flash_ship_task, NULL, 2048,
|
pMS->flash_task = AssignTask (flash_ship_task, 2048,
|
||||||
"flash roster menu");
|
"flash roster menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,11 +335,12 @@ SetPlanetLoc (POINT new_pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
flash_planet_loc_func(void *blah)
|
flash_planet_loc_func(void *data)
|
||||||
{
|
{
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
BYTE c, val;
|
BYTE c, val;
|
||||||
PRIMITIVE p;
|
PRIMITIVE p;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
SetPrimType (&p, STAMPFILL_PRIM);
|
SetPrimType (&p, STAMPFILL_PRIM);
|
||||||
SetPrimNextLink (&p, END_OF_LIST);
|
SetPrimNextLink (&p, END_OF_LIST);
|
||||||
@@ -349,7 +350,7 @@ flash_planet_loc_func(void *blah)
|
|||||||
c = 0x00;
|
c = 0x00;
|
||||||
val = -0x02;
|
val = -0x02;
|
||||||
TimeIn = 0;
|
TimeIn = 0;
|
||||||
for (;;)
|
while (!Task_ReadState(task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
DWORD T;
|
DWORD T;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
@@ -388,7 +389,7 @@ flash_planet_loc_func(void *blah)
|
|||||||
|
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,9 +402,7 @@ PickPlanetSide (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
{
|
{
|
||||||
if (pMenuState->flash_task)
|
if (pMenuState->flash_task)
|
||||||
{
|
{
|
||||||
SetSemaphore (GraphicsSem);
|
ConcludeTask(pMenuState->flash_task);
|
||||||
KillThread (pMenuState->flash_task);
|
|
||||||
ClearSemaphore (GraphicsSem);
|
|
||||||
pMenuState->flash_task = 0;
|
pMenuState->flash_task = 0;
|
||||||
}
|
}
|
||||||
goto ExitPlanetSide;
|
goto ExitPlanetSide;
|
||||||
@@ -442,8 +441,8 @@ PickPlanetSide (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
|
|
||||||
InitLander (0);
|
InitLander (0);
|
||||||
|
|
||||||
pMenuState->flash_task = CreateThread (flash_planet_loc_func,
|
pMenuState->flash_task = AssignTask (flash_planet_loc_func,
|
||||||
NULL, 2048, "flash planet location");
|
2048, "flash planet location");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (InputState & (DEVICE_BUTTON1 | DEVICE_BUTTON2))
|
else if (InputState & (DEVICE_BUTTON1 | DEVICE_BUTTON2))
|
||||||
@@ -455,12 +454,12 @@ PickPlanetSide (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
|
|
||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
DrawStatusMessage (NULL_PTR);
|
DrawStatusMessage (NULL_PTR);
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
if (pMenuState->flash_task)
|
if (pMenuState->flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pMenuState->flash_task);
|
ConcludeTask (pMenuState->flash_task);
|
||||||
pMenuState->flash_task = 0;
|
pMenuState->flash_task = 0;
|
||||||
}
|
}
|
||||||
ClearSemaphore (GraphicsSem);
|
|
||||||
|
|
||||||
if (!(InputState & DEVICE_BUTTON1))
|
if (!(InputState & DEVICE_BUTTON1))
|
||||||
SetPlanetLoc (pSolarSysState->MenuState.first_item);
|
SetPlanetLoc (pSolarSysState->MenuState.first_item);
|
||||||
@@ -495,13 +494,11 @@ PickPlanetSide (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
extern ACTIVITY NextActivity;
|
extern ACTIVITY NextActivity;
|
||||||
extern void SaveFlagshipState (void);
|
extern void SaveFlagshipState (void);
|
||||||
|
|
||||||
SetSemaphore (GraphicsSem);
|
|
||||||
if (pMenuState->flash_task)
|
if (pMenuState->flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pMenuState->flash_task);
|
ConcludeTask (pMenuState->flash_task);
|
||||||
pMenuState->flash_task = 0;
|
pMenuState->flash_task = 0;
|
||||||
}
|
}
|
||||||
ClearSemaphore (GraphicsSem);
|
|
||||||
|
|
||||||
NextActivity |= CHECK_LOAD; /* fake a load game */
|
NextActivity |= CHECK_LOAD; /* fake a load game */
|
||||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||||
|
|||||||
@@ -330,9 +330,9 @@ FreeSolarSys (void)
|
|||||||
FreePlanet ();
|
FreePlanet ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetSemaphore (GraphicsSem);
|
ConcludeTask (pSolarSysState->MenuState.flash_task);
|
||||||
KillThread (pSolarSysState->MenuState.flash_task);
|
|
||||||
pSolarSysState->MenuState.flash_task = 0;
|
pSolarSysState->MenuState.flash_task = 0;
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||||
{
|
{
|
||||||
extern void SaveFlagshipState (void);
|
extern void SaveFlagshipState (void);
|
||||||
@@ -985,13 +985,14 @@ ScaleSystem (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPtask_func(void* blah)
|
int IPtask_func(void* data)
|
||||||
{
|
{
|
||||||
#define IP_FRAME_RATE 4
|
#define IP_FRAME_RATE 4
|
||||||
#define DEBOUNCE_DELAY ((ONE_SECOND >> 1) / IP_FRAME_RATE)
|
#define DEBOUNCE_DELAY ((ONE_SECOND >> 1) / IP_FRAME_RATE)
|
||||||
BYTE MenuTransition;
|
BYTE MenuTransition;
|
||||||
DWORD NextTime;
|
DWORD NextTime;
|
||||||
INPUT_STATE InputState;
|
INPUT_STATE InputState;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
@@ -1002,7 +1003,7 @@ int IPtask_func(void* blah)
|
|||||||
|
|
||||||
MenuTransition = 0;
|
MenuTransition = 0;
|
||||||
NextTime = GetTimeCounter ();
|
NextTime = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
BOOLEAN InnerSystem;
|
BOOLEAN InnerSystem;
|
||||||
@@ -1010,11 +1011,12 @@ int IPtask_func(void* blah)
|
|||||||
|
|
||||||
InnerSystem = FALSE;
|
InnerSystem = FALSE;
|
||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
while (pSolarSysState->MenuState.Initialized > 1
|
while ((pSolarSysState->MenuState.Initialized > 1
|
||||||
|| (GLOBAL (CurrentActivity)
|
|| (GLOBAL (CurrentActivity)
|
||||||
& (START_ENCOUNTER | END_INTERPLANETARY
|
& (START_ENCOUNTER | END_INTERPLANETARY
|
||||||
| CHECK_ABORT | CHECK_LOAD))
|
| CHECK_ABORT | CHECK_LOAD))
|
||||||
|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0)
|
|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0)
|
||||||
|
&& !Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
InputState = 0;
|
InputState = 0;
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
@@ -1023,6 +1025,12 @@ int IPtask_func(void* blah)
|
|||||||
NextTime = GetTimeCounter ();
|
NextTime = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Task_ReadState (task, TASK_EXIT))
|
||||||
|
{
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
OldContext = SetContext (StatusContext);
|
OldContext = SetContext (StatusContext);
|
||||||
if (pSolarSysState->MenuState.CurState
|
if (pSolarSysState->MenuState.CurState
|
||||||
|| pSolarSysState->MenuState.Initialized == 0)
|
|| pSolarSysState->MenuState.Initialized == 0)
|
||||||
@@ -1142,6 +1150,11 @@ TheMess:
|
|||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
if (Task_ReadState (task, TASK_EXIT))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(InputState & DEVICE_BUTTON2))
|
if (!(InputState & DEVICE_BUTTON2))
|
||||||
{
|
{
|
||||||
SleepThreadUntil (NextTime + IP_FRAME_RATE);
|
SleepThreadUntil (NextTime + IP_FRAME_RATE);
|
||||||
@@ -1177,7 +1190,7 @@ TheMess:
|
|||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,7 +1275,7 @@ StartGroups:
|
|||||||
CheckIntersect (TRUE);
|
CheckIntersect (TRUE);
|
||||||
|
|
||||||
pSolarSysState->MenuState.flash_task =
|
pSolarSysState->MenuState.flash_task =
|
||||||
CreateThread (IPtask_func, NULL, 6144,
|
AssignTask (IPtask_func, 6144,
|
||||||
"flash solar system menu");
|
"flash solar system menu");
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "commglue.h"
|
#include "commglue.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
RepairSISBorder (void)
|
RepairSISBorder (void)
|
||||||
@@ -923,11 +924,11 @@ CountSISPieces (BYTE piece_type)
|
|||||||
return (num_pieces);
|
return (num_pieces);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Thread flash_task;
|
static Task flash_task;
|
||||||
static RECT flash_rect;
|
static RECT flash_rect;
|
||||||
static FRAME flash_frame;
|
static FRAME flash_frame;
|
||||||
|
|
||||||
int flash_rect_func(void *blah)
|
int flash_rect_func(void *data)
|
||||||
{
|
{
|
||||||
#define NORMAL_STRENGTH 4
|
#define NORMAL_STRENGTH 4
|
||||||
#define NORMAL_F_STRENGTH 0
|
#define NORMAL_F_STRENGTH 0
|
||||||
@@ -935,13 +936,14 @@ int flash_rect_func(void *blah)
|
|||||||
SIZE strength, fstrength, incr;
|
SIZE strength, fstrength, incr;
|
||||||
/* Added by Michael: simple on-off flash right now */
|
/* Added by Michael: simple on-off flash right now */
|
||||||
BOOLEAN flash_on;
|
BOOLEAN flash_on;
|
||||||
|
Task task = (Task)data;
|
||||||
|
|
||||||
fstrength = NORMAL_F_STRENGTH;
|
fstrength = NORMAL_F_STRENGTH;
|
||||||
incr = 1;
|
incr = 1;
|
||||||
strength = NORMAL_STRENGTH;
|
strength = NORMAL_STRENGTH;
|
||||||
flash_on = 0;
|
flash_on = 0;
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState(task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
|
||||||
@@ -1018,7 +1020,8 @@ int flash_rect_func(void *blah)
|
|||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
flash_task = 0;
|
||||||
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,8 +1056,7 @@ SetFlashRect (PRECT pRect, FRAME f)
|
|||||||
flash_rect.extent.width = 0;
|
flash_rect.extent.width = 0;
|
||||||
if (flash_task)
|
if (flash_task)
|
||||||
{
|
{
|
||||||
KillThread (flash_task);
|
Task_SetState (flash_task, TASK_EXIT);
|
||||||
flash_task = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1067,7 +1069,7 @@ SetFlashRect (PRECT pRect, FRAME f)
|
|||||||
|
|
||||||
if (flash_task == 0)
|
if (flash_task == 0)
|
||||||
{
|
{
|
||||||
flash_task = CreateThread (flash_rect_func, NULL, 2048,
|
flash_task = AssignTask (flash_rect_func, 2048,
|
||||||
"flash rectangle");
|
"flash rectangle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
PMENU_STATE pMenuState;
|
PMENU_STATE pMenuState;
|
||||||
|
|
||||||
@@ -240,16 +241,17 @@ DrawShipPiece (PMENU_STATE pMS, COUNT which_piece, COUNT which_slot,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rotate_starbase(void* blah)
|
int rotate_starbase(void* data)
|
||||||
{
|
{
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
STAMP s;
|
STAMP s;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
s.origin.x = s.origin.y = 0;
|
s.origin.x = s.origin.y = 0;
|
||||||
s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
|
s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
|
||||||
s.frame = IncFrameIndex (pMenuState->CurFrame);
|
s.frame = IncFrameIndex (pMenuState->CurFrame);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
//CONTEXT OldContext;
|
//CONTEXT OldContext;
|
||||||
|
|
||||||
@@ -264,7 +266,7 @@ s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
|
|||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) blah; /* Satisfying compiler (unused parameter) */
|
FinishTask (task);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +298,7 @@ DoStarBase (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
|
|
||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pMS->flash_task);
|
Task_SetState (pMS->flash_task, TASK_EXIT);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +331,7 @@ s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
|
|||||||
}
|
}
|
||||||
PlayMusic (pMS->hMusic, TRUE, 1);
|
PlayMusic (pMS->hMusic, TRUE, 1);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
pMS->flash_task = CreateThread (rotate_starbase, NULL, 4096,
|
pMS->flash_task = AssignTask (rotate_starbase, 4096,
|
||||||
"rotate starbase");
|
"rotate starbase");
|
||||||
ClearSemaphore (GraphicsSem);
|
ClearSemaphore (GraphicsSem);
|
||||||
}
|
}
|
||||||
@@ -341,7 +343,7 @@ ExitStarBase:
|
|||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
if (pMS->flash_task)
|
if (pMS->flash_task)
|
||||||
{
|
{
|
||||||
KillThread (pMS->flash_task);
|
Task_SetState (pMS->flash_task, TASK_EXIT);
|
||||||
pMS->flash_task = 0;
|
pMS->flash_task = 0;
|
||||||
}
|
}
|
||||||
DestroyDrawable (ReleaseDrawable (pMS->CurFrame));
|
DestroyDrawable (ReleaseDrawable (pMS->CurFrame));
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#ifndef _STARBASE_H
|
#ifndef _STARBASE_H
|
||||||
#define _STARBASE_H
|
#define _STARBASE_H
|
||||||
|
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
TALK_COMMANDER = 0,
|
TALK_COMMANDER = 0,
|
||||||
@@ -45,7 +47,7 @@ typedef struct menu_state
|
|||||||
SIZE delta_item;
|
SIZE delta_item;
|
||||||
|
|
||||||
FRAME ModuleFrame;
|
FRAME ModuleFrame;
|
||||||
Thread flash_task;
|
Task flash_task;
|
||||||
RECT flash_rect0,
|
RECT flash_rect0,
|
||||||
flash_rect1;
|
flash_rect1;
|
||||||
FRAME flash_frame0,
|
FRAME flash_frame0,
|
||||||
|
|||||||
@@ -30,15 +30,16 @@ enum
|
|||||||
OPENING
|
OPENING
|
||||||
};
|
};
|
||||||
|
|
||||||
int arilou_gate_task(void* Blah)
|
int arilou_gate_task(void* data)
|
||||||
{
|
{
|
||||||
BYTE counter;
|
BYTE counter;
|
||||||
DWORD TimeIn;
|
DWORD TimeIn;
|
||||||
|
Task task = (Task) data;
|
||||||
|
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
|
|
||||||
counter = GET_GAME_STATE (ARILOU_SPACE_COUNTER);
|
counter = GET_GAME_STATE (ARILOU_SPACE_COUNTER);
|
||||||
for (;;)
|
while (!Task_ReadState (task, TASK_EXIT))
|
||||||
{
|
{
|
||||||
SetSemaphore (GLOBAL (GameClock.clock_sem));
|
SetSemaphore (GLOBAL (GameClock.clock_sem));
|
||||||
|
|
||||||
@@ -61,8 +62,8 @@ int arilou_gate_task(void* Blah)
|
|||||||
SleepThreadUntil (TimeIn + BATTLE_FRAME_RATE);
|
SleepThreadUntil (TimeIn + BATTLE_FRAME_RATE);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
|
FinishTask (task);
|
||||||
|
|
||||||
(void) Blah; /* Satisfying compiler (unused parameter) */
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,18 +953,18 @@ if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Thread ArilouTask;
|
Task ArilouTask;
|
||||||
|
|
||||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);
|
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);
|
||||||
|
|
||||||
ArilouTask = CreateThread (arilou_gate_task, NULL, 128,
|
ArilouTask = AssignTask (arilou_gate_task, 128,
|
||||||
"arilou gate (?)");
|
"quasispace portal manager");
|
||||||
|
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
Battle ();
|
Battle ();
|
||||||
if (ArilouTask)
|
if (ArilouTask)
|
||||||
KillThread (ArilouTask);
|
Task_SetState (ArilouTask, TASK_EXIT);
|
||||||
}
|
}
|
||||||
#ifdef TESTING
|
#ifdef TESTING
|
||||||
if (_simple_count != sc) printf ("%d difference!\n", (int)_simple_count - (int)sc);
|
if (_simple_count != sc) printf ("%d difference!\n", (int)_simple_count - (int)sc);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/sound/sound_common.h"
|
#include "libs/sound/sound_common.h"
|
||||||
#include "libs/input/input_common.h"
|
#include "libs/input/input_common.h"
|
||||||
|
#include "libs/tasklib.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
@@ -71,6 +72,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
InitThreadSystem ();
|
InitThreadSystem ();
|
||||||
InitTimeSystem ();
|
InitTimeSystem ();
|
||||||
|
InitTaskSystem ();
|
||||||
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);
|
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);
|
||||||
TFB_InitSound (TFB_SOUNDDRIVER_SDL, 0, frequency);
|
TFB_InitSound (TFB_SOUNDDRIVER_SDL, 0, frequency);
|
||||||
TFB_InitInput (TFB_INPUTDRIVER_SDL, 0);
|
TFB_InitInput (TFB_INPUTDRIVER_SDL, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user