You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(147) |
Oct
(219) |
Nov
(189) |
Dec
(380) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(301) |
Feb
(369) |
Mar
(155) |
Apr
(61) |
May
(77) |
Jun
(101) |
Jul
(191) |
Aug
(107) |
Sep
(180) |
Oct
(37) |
Nov
(7) |
Dec
(28) |
| 2004 |
Jan
(34) |
Feb
(45) |
Mar
(7) |
Apr
(17) |
May
(6) |
Jun
(59) |
Jul
(4) |
Aug
(8) |
Sep
(6) |
Oct
(18) |
Nov
(11) |
Dec
(15) |
| 2005 |
Jan
(148) |
Feb
(146) |
Mar
(73) |
Apr
(154) |
May
(192) |
Jun
(11) |
Jul
(23) |
Aug
(23) |
Sep
(26) |
Oct
(68) |
Nov
(109) |
Dec
(294) |
| 2006 |
Jan
(172) |
Feb
(22) |
Mar
(81) |
Apr
(79) |
May
(83) |
Jun
(23) |
Jul
(35) |
Aug
(66) |
Sep
(39) |
Oct
(133) |
Nov
(125) |
Dec
(90) |
| 2007 |
Jan
(49) |
Feb
(21) |
Mar
(3) |
Apr
(33) |
May
(19) |
Jun
(26) |
Jul
(32) |
Aug
(18) |
Sep
(14) |
Oct
(2) |
Nov
(8) |
Dec
(22) |
| 2008 |
Jan
(23) |
Feb
(14) |
Mar
(28) |
Apr
(11) |
May
(55) |
Jun
(8) |
Jul
(1) |
Aug
(36) |
Sep
(8) |
Oct
(20) |
Nov
(6) |
Dec
|
| 2009 |
Jan
(2) |
Feb
(7) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(46) |
Jul
(15) |
Aug
(1) |
Sep
(3) |
Oct
(88) |
Nov
(108) |
Dec
(119) |
| 2010 |
Jan
(31) |
Feb
(3) |
Mar
(5) |
Apr
(1) |
May
(5) |
Jun
(5) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
(23) |
Mar
(1) |
Apr
(20) |
May
(27) |
Jun
(2) |
Jul
(40) |
Aug
(14) |
Sep
(17) |
Oct
(5) |
Nov
|
Dec
(28) |
| 2012 |
Jan
(31) |
Feb
(19) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
(1) |
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: <mcm...@us...> - 2013-09-23 09:20:35
|
Revision: 3782
http://sourceforge.net/p/sc2/code/3782
Author: mcmartin
Date: 2013-09-23 09:20:31 +0000 (Mon, 23 Sep 2013)
Log Message:
-----------
fix a crash when talking to the Ur-Quan drone on 64-bit Linux
Modified Paths:
--------------
trunk/sc2/src/libs/strings/getstr.c
Modified: trunk/sc2/src/libs/strings/getstr.c
===================================================================
--- trunk/sc2/src/libs/strings/getstr.c 2013-03-28 12:36:56 UTC (rev 3781)
+++ trunk/sc2/src/libs/strings/getstr.c 2013-09-23 09:20:31 UTC (rev 3782)
@@ -108,15 +108,15 @@
DWORD slen[MAX_STRINGS];
// Length of each of the dialog strings.
DWORD StringOffs;
- DWORD tot_string_size;
+ size_t tot_string_size;
DWORD clen[MAX_STRINGS];
// Length of each of the speech file names.
DWORD ClipOffs;
- DWORD tot_clip_size;
+ size_t tot_clip_size;
DWORD tslen[MAX_STRINGS];
// Length of each of the timestamp strings.
DWORD TSOffs;
- DWORD tot_ts_size = 0;
+ size_t tot_ts_size = 0;
char CurrentLine[1024];
char paths[1024];
char *clip_path;
@@ -423,7 +423,7 @@
DWORD opos;
DWORD slen[MAX_STRINGS];
DWORD StringOffs;
- DWORD tot_string_size;
+ size_t tot_string_size;
char CurrentLine[1024];
char *strdata = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mee...@us...> - 2013-03-28 12:36:59
|
Revision: 3781
http://sourceforge.net/p/sc2/code/3781
Author: meep-eep
Date: 2013-03-28 12:36:56 +0000 (Thu, 28 Mar 2013)
Log Message:
-----------
Insight from James Scott.
Modified Paths:
--------------
trunk/sc2/src/uqm/planets/calc.c
Modified: trunk/sc2/src/uqm/planets/calc.c
===================================================================
--- trunk/sc2/src/uqm/planets/calc.c 2013-02-19 03:23:27 UTC (rev 3780)
+++ trunk/sc2/src/uqm/planets/calc.c 2013-03-28 12:36:56 UTC (rev 3781)
@@ -166,6 +166,11 @@
// have the colour you'd expect based on the true temperature.
// (eg. Beta Corvi I). I don't know what the idea behind this is,
// but the if statement must be there for a reason. -- SvdB
+// Update 2013-03-28: The contents of the if() block is probably there to
+// model a greenhouse effect. It seems that it is taken into account when
+// calculating the actual temperature (when landing or scanning), but not
+// when determining the colors of the drawn orbits. (Thanks to James Scott
+// for this insight.)
static SIZE
CalcTemp (SYSTEM_INFO *SysInfoPtr, SIZE radius)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mcm...@us...> - 2013-02-19 03:23:29
|
Revision: 3780
http://sourceforge.net/p/sc2/code/3780
Author: mcmartin
Date: 2013-02-19 03:23:27 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
Update the Win32 installer to fit the new site design and to make Remix Pack 4 available. Juggle some file locations to make it easier to run the NSI script directly out of the win32_install directory.
The installer code is still kind of a mess, but this makes it more reliable than the old 0.7 installer from a user experience standpoint.
Modified Paths:
--------------
trunk/sc2/build/win32_install/packages.nsh
trunk/sc2/build/win32_install/uqm-installer.nsi
trunk/sc2/doc/users/manual.txt
Added Paths:
-----------
trunk/sc2/build/win32_install/uqm-3do.cfg
trunk/sc2/build/win32_install/uqm-pc.cfg
Modified: trunk/sc2/build/win32_install/packages.nsh
===================================================================
--- trunk/sc2/build/win32_install/packages.nsh 2013-01-05 17:35:49 UTC (rev 3779)
+++ trunk/sc2/build/win32_install/packages.nsh 2013-02-19 03:23:27 UTC (rev 3780)
@@ -18,3 +18,6 @@
!define PKG_REMIX3_FILE "uqm-remix-disc3.uqm"
!define PKG_REMIX3_MD5SUM "5ccc6d4ac301ae98e172ac6835dcdead"
!define PKG_REMIX3_SIZE 38989
+!define PKG_REMIX4_FILE "uqm-remix-disc4.uqm"
+!define PKG_REMIX4_MD5SUM "d3dc6036588662391a3820ca6b222dd6"
+!define PKG_REMIX4_SIZE 84517
\ No newline at end of file
Added: trunk/sc2/build/win32_install/uqm-3do.cfg
===================================================================
--- trunk/sc2/build/win32_install/uqm-3do.cfg (rev 0)
+++ trunk/sc2/build/win32_install/uqm-3do.cfg 2013-02-19 03:23:27 UTC (rev 3780)
@@ -0,0 +1,11 @@
+3domusic = BOOLEAN:true
+textmenu = BOOLEAN:false
+textgradients = BOOLEAN:false
+subtitles = BOOLEAN:false
+iconicscan = BOOLEAN:true
+3domovies = BOOLEAN:true
+speechvol = INT32:100
+pulseshield = BOOLEAN:true
+smoothmelee = BOOLEAN:true
+smoothscroll = BOOLEAN:true
+remixmusic = BOOLEAN:false
Modified: trunk/sc2/build/win32_install/uqm-installer.nsi
===================================================================
--- trunk/sc2/build/win32_install/uqm-installer.nsi 2013-01-05 17:35:49 UTC (rev 3779)
+++ trunk/sc2/build/win32_install/uqm-installer.nsi 2013-02-19 03:23:27 UTC (rev 3780)
@@ -14,6 +14,10 @@
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
+; The INSTALLER_VERSION is a suffix to the version number for installer patches or to mark
+; alpha/beta/release candidate status. In normal releases it is the empty string.
+!define INSTALLER_VERSION "-1"
+
; UQM Package definitions
!include "packages.nsh"
@@ -80,7 +84,7 @@
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
-OutFile "uqm-${PRODUCT_VERSION}-installer.exe"
+OutFile "uqm-${PRODUCT_VERSION}${INSTALLER_VERSION}-installer.exe"
InstallDir "$PROGRAMFILES\The Ur-Quan Masters\"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
@@ -125,115 +129,75 @@
Function RandomServer
Push $0
- Push 27
+ Push 17
Call Random
Pop $0
IntCmp $0 0 0 +4 +4
- StrCpy $0 "ovh"
+ StrCpy $0 "aarnet"
Exch $0
Return
IntCmp $0 1 0 +4 +4
- StrCpy $0 "mesh"
+ StrCpy $0 "citylan"
Exch $0
Return
IntCmp $0 2 0 +4 +4
- StrCpy $0 "aarnet"
+ StrCpy $0 "freefr"
Exch $0
Return
IntCmp $0 3 0 +4 +4
- StrCpy $0 "switch"
+ StrCpy $0 "garr"
Exch $0
Return
IntCmp $0 4 0 +4 +4
- StrCpy $0 "superb-sea2"
+ StrCpy $0 "heanet"
Exch $0
Return
IntCmp $0 5 0 +4 +4
- StrCpy $0 "jaist"
+ StrCpy $0 "hivelocity"
Exch $0
Return
IntCmp $0 6 0 +4 +4
- StrCpy $0 "voxel"
+ StrCpy $0 "ignum"
Exch $0
Return
IntCmp $0 7 0 +4 +4
- StrCpy $0 "heanet"
+ StrCpy $0 "internode"
Exch $0
Return
IntCmp $0 8 0 +4 +4
- StrCpy $0 "cdnetworks-us-1"
+ StrCpy $0 "iweb"
Exch $0
Return
IntCmp $0 9 0 +4 +4
- StrCpy $0 "cdnetworks-us-2"
+ StrCpy $0 "jaist"
Exch $0
Return
IntCmp $0 10 0 +4 +4
- StrCpy $0 "cdnetworks-kr-1"
+ StrCpy $0 "nchc"
Exch $0
Return
IntCmp $0 11 0 +4 +4
- StrCpy $0 "surfnet"
+ StrCpy $0 "netcologne"
Exch $0
Return
IntCmp $0 12 0 +4 +4
- StrCpy $0 "cdnetworks-kr-2"
+ StrCpy $0 "switch"
Exch $0
Return
IntCmp $0 13 0 +4 +4
- StrCpy $0 "kent"
+ StrCpy $0 "tenet"
Exch $0
Return
IntCmp $0 14 0 +4 +4
- StrCpy $0 "nchc"
+ StrCpy $0 "ufpr"
Exch $0
Return
IntCmp $0 15 0 +4 +4
- StrCpy $0 "dfn"
+ StrCpy $0 "voxel"
Exch $0
Return
- IntCmp $0 16 0 +4 +4
- StrCpy $0 "freefr"
+ StrCpy $0 "waix"
Exch $0
- Return
- IntCmp $0 17 0 +4 +4
- StrCpy $0 "garr"
- Exch $0
- Return
- IntCmp $0 18 0 +4 +4
- StrCpy $0 "ignum"
- Exch $0
- Return
- IntCmp $0 19 0 +4 +4
- StrCpy $0 "internode"
- Exch $0
- Return
- IntCmp $0 20 0 +4 +4
- StrCpy $0 "iweb"
- Exch $0
- Return
- IntCmp $0 21 0 +4 +4
- StrCpy $0 "netcologne"
- Exch $0
- Return
- IntCmp $0 22 0 +4 +4
- StrCpy $0 "leaseweb"
- Exch $0
- Return
- IntCmp $0 23 0 +4 +4
- StrCpy $0 "ncu"
- Exch $0
- Return
- IntCmp $0 24 0 +4 +4
- StrCpy $0 "tenet"
- Exch $0
- Return
- IntCmp $0 25 0 +4 +4
- StrCpy $0 "transact"
- Exch $0
- Return
- StrCpy $0 "citylan"
- Exch $0
FunctionEnd
# To use:
@@ -251,6 +215,7 @@
Exch $1 # File name
Push $2
Push $3
+ StrCpy $R9 0 # failure count
# Check to make sure the file wasn't already installed
IfFileExists "$0\$1" 0 NotThere
md5dll::GetFileMD5 "$0\$1"
@@ -289,6 +254,12 @@
StrCmp $2 "success" DownloadSuccessful
StrCmp $2 "cancel" DownloadCanceled
StrCpy $2 "Could not install the package $1 due to the following error: $\"$2$\"."
+ # Only actually display the error every third try, unless it's a user cancellation. We can't
+ # really rely on SF.net to have everything at every mirror.
+ IntOp $R9 $R9 + 1
+ IntCmp $R9 3 0 AttemptDownload
+ # If we fell through, reset the count.
+ StrCpy $R9 0
Goto CheckMandatory
DownloadCanceled:
StrCpy $2 "Download was canceled by user."
@@ -411,7 +382,7 @@
AddSize ${PKG_CONTENT_SIZE}
StrCpy $MANDATORY 1
StrCpy $MD5SUM "${PKG_CONTENT_MD5SUM}"
- File "content\version"
+ File "..\..\content\version"
StrCpy $DOWNLOADPATH "UQM/0.7/"
Push "${PKG_CONTENT_FILE}"
Push "$INSTDIR\content\packages"
@@ -504,20 +475,20 @@
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
-# Section "Pack 4" SEC08
-# SectionIn 6
-# AddSize ${PKG_REMIX4_SIZE}
-# StrCpy $MANDATORY 0
-# StrCpy $MD5SUM "${PKG_REMIX4_MD5SUM}"
-# StrCpy $DOWNLOADPATH "UQM%20Remix%20Packs/UQM%20Remix%20Pack%204/"
-# Push "${PKG_REMIX4_FILE}"
-# Push "$INSTDIR\content\addons"
-# Call HandlePackage
-# Call EnableRemixes
-# ; Shortcuts
-# !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
-# !insertmacro MUI_STARTMENU_WRITE_END
-# SectionEnd
+ Section "Pack 4" SEC08
+ SectionIn 6
+ AddSize ${PKG_REMIX4_SIZE}
+ StrCpy $MANDATORY 0
+ StrCpy $MD5SUM "${PKG_REMIX4_MD5SUM}"
+ StrCpy $DOWNLOADPATH "UQM%20Remix%20Packs/UQM%20Remix%20Pack%204/"
+ Push "${PKG_REMIX4_FILE}"
+ Push "$INSTDIR\content\addons"
+ Call HandlePackage
+ Call EnableRemixes
+ ; Shortcuts
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+ !insertmacro MUI_STARTMENU_WRITE_END
+ SectionEnd
SectionGroupEnd
Section -ShortcutsAndIcons
@@ -588,7 +559,7 @@
!insertmacro MUI_DESCRIPTION_TEXT ${SEC05} `Ur-Quan Masters Remix Pack 1 - 'Super Melee!' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} `Ur-Quan Masters Remix Pack 2 - 'Neutral Aliens - Don't Shoot!' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_DESCRIPTION_TEXT ${SEC07} `Ur-Quan Masters Remix Pack 3 - 'The Ur-Quan Hierarchy.' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
-# !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} `Ur-Quan Masters Remix Pack 4 - 'The New Alliance of Free Stars.' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} `Ur-Quan Masters Remix Pack 4 - 'The New Alliance of Free Stars.' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Added: trunk/sc2/build/win32_install/uqm-pc.cfg
===================================================================
--- trunk/sc2/build/win32_install/uqm-pc.cfg (rev 0)
+++ trunk/sc2/build/win32_install/uqm-pc.cfg 2013-02-19 03:23:27 UTC (rev 3780)
@@ -0,0 +1,11 @@
+3domusic = BOOLEAN:false
+textmenu = BOOLEAN:true
+textgradients = BOOLEAN:true
+subtitles = BOOLEAN:true
+iconicscan = BOOLEAN:false
+3domovies = BOOLEAN:false
+positionalsfx = BOOLEAN:false
+pulseshield = BOOLEAN:false
+smoothmelee = BOOLEAN:false
+smoothscroll = BOOLEAN:false
+remixmusic = BOOLEAN:false
Modified: trunk/sc2/doc/users/manual.txt
===================================================================
--- trunk/sc2/doc/users/manual.txt 2013-01-05 17:35:49 UTC (rev 3779)
+++ trunk/sc2/doc/users/manual.txt 2013-02-19 03:23:27 UTC (rev 3780)
@@ -1,6 +1,6 @@
THE UR-QUAN MASTERS v0.7 -- homepage: http://sc2.sf.net/
-Welcome to the sixth release of the Ur-Quan Masters port. This
+Welcome to this beta release of the Ur-Quan Masters port. This
document will tell you everything you need to play, even if you've
never played the original.
@@ -134,6 +134,15 @@
Set speech volume (0-100). If set to 0, the game runs in 'no speech'
mode and the oscilloscope reacts to the music.
+ -m 3do (or --music 3do)
+
+Use the 3DO remixed soundtrack for songs that were in fact remixed.
+The default.
+
+ -m pc (or --music pc)
+
+Use the .MOD based PC soundtrack everywhere.
+
-q (or --audioquality)
Can be "high", "medium", or "low". Specifies how nice the audio
@@ -782,7 +791,7 @@
in the game. '--addon' may be specified more than once to enable multiple
add-ons.
-Formerly standard packages, 3domusic and 3dovoice are now standard add-ons,
+Unlike previous releases, 3domusic and 3dovoice are now standard add-ons,
and can be turned on and off from the in-game setup menu.
The Precursors UQM Remix project is intended to be used as an add-on.
If you install UQM 0.7 from the Windows installer, the remix packs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Mee...@us...> - 2013-01-05 17:36:04
|
Revision: 3779
http://sc2.svn.sourceforge.net/sc2/?rev=3779&view=rev
Author: Meep-Eep
Date: 2013-01-05 17:35:49 +0000 (Sat, 05 Jan 2013)
Log Message:
-----------
Update; convert AUTHORS to UTF-8.
Modified Paths:
--------------
trunk/sc2/AUTHORS
trunk/sc2/content/base/cutscene/credits/credits.txt
Modified: trunk/sc2/AUTHORS
===================================================================
--- trunk/sc2/AUTHORS 2012-02-26 21:05:46 UTC (rev 3778)
+++ trunk/sc2/AUTHORS 2013-01-05 17:35:49 UTC (rev 3779)
@@ -7,7 +7,7 @@
-------------------------
Core team (in alphabetical order):
- Serge van den Boom <sv...@st...>
+ Serge van den Boom <se...@vd...>
Mika Kolehmainen <mk...@ka...>
Michael Chapman Martin <mcm...@gm...>
Chris Nelson <ch...@to...>
@@ -19,13 +19,18 @@
Music remixers (in alphabetical order):
Jouni Airaksinen <mar...@sp...>
- Tore Aune Fjellstad
- Espen G\xE4tzschmann
+ András Barják <for...@fr...>
+ Matt Bentley
+ Tore Aune Fjellstad <vo...@me...>
+ Espen Gätzschmann <ti...@me...>
Aaron J. Grier <ag...@po...>
+ A. Keren
+ Casey Monroe
Dan Nicholson <da...@ko...>
George Nowik <no...@at...>
- Riku Nuottaj\xE4rvi <rik...@pp...>
+ Riku Nuottajärvi <rik...@pp...>
Erol Otus <er...@to...>
+ Greg Szymanski
Other contributions (in alphabetical order):
Jouni Airaksinen <mar...@sp...> (Startup Menu)
@@ -138,7 +143,7 @@
Music:
Burke Treischmann
Dan Nicholson
- Riku Nuottaj\xE4rvi
+ Riku Nuottajärvi
Eric Berge
Erol Otus
Marc Brown
Modified: trunk/sc2/content/base/cutscene/credits/credits.txt
===================================================================
--- trunk/sc2/content/base/cutscene/credits/credits.txt 2012-02-26 21:05:46 UTC (rev 3778)
+++ trunk/sc2/content/base/cutscene/credits/credits.txt 2013-01-05 17:35:49 UTC (rev 3779)
@@ -61,13 +61,18 @@
#(Music remixers)
13 C
Jouni Airaksinen
+András Barják
+Matt Bentley
Tore Aune Fjellstad
Espen Gätzschmann
Aaron J. Grier
+A. Keren
+Casey Monroe
Dan Nicholson
George Nowik
Riku Nuottajärvi
Erol Otus
+Greg Szymanski
#(Other contrib caption)
13 C
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-26 21:05:52
|
Revision: 3778
http://sc2.svn.sourceforge.net/sc2/?rev=3778&view=rev
Author: avolkov
Date: 2012-02-26 21:05:46 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Make init_RACE()/uninit_RACE() calls symmetric; takes care of memory leaks from bug #1149; thanks to Louis Delacroix
Modified Paths:
--------------
trunk/sc2/src/uqm/init.c
trunk/sc2/src/uqm/loadship.c
trunk/sc2/src/uqm/tactrans.c
Modified: trunk/sc2/src/uqm/init.c
===================================================================
--- trunk/sc2/src/uqm/init.c 2012-02-26 20:32:22 UTC (rev 3777)
+++ trunk/sc2/src/uqm/init.c 2012-02-26 21:05:46 UTC (rev 3778)
@@ -311,9 +311,6 @@
crew_retrieved;
}
- if (StarShipPtr->RaceDescPtr->uninit_func != NULL)
- (*StarShipPtr->RaceDescPtr->uninit_func) (
- StarShipPtr->RaceDescPtr);
/* Record crew left after battle */
StarShipPtr->crew_level =
StarShipPtr->RaceDescPtr->ship_info.crew_level;
Modified: trunk/sc2/src/uqm/loadship.c
===================================================================
--- trunk/sc2/src/uqm/loadship.c 2012-02-26 20:32:22 UTC (rev 3777)
+++ trunk/sc2/src/uqm/loadship.c 2012-02-26 21:05:46 UTC (rev 3778)
@@ -170,6 +170,9 @@
free_ship (RACE_DESC *raceDescPtr, BOOLEAN FreeIconData,
BOOLEAN FreeBattleData)
{
+ if (raceDescPtr->uninit_func != NULL)
+ (*raceDescPtr->uninit_func) (raceDescPtr);
+
if (FreeBattleData)
{
DATA_STUFF *shipData = &raceDescPtr->ship_data;
Modified: trunk/sc2/src/uqm/tactrans.c
===================================================================
--- trunk/sc2/src/uqm/tactrans.c 2012-02-26 20:32:22 UTC (rev 3777)
+++ trunk/sc2/src/uqm/tactrans.c 2012-02-26 21:05:46 UTC (rev 3778)
@@ -473,9 +473,6 @@
SetElementStarShip (DeadShipPtr, 0);
RestartMusic = OpponentAlive (DeadStarShipPtr);
- if (DeadStarShipPtr->RaceDescPtr->uninit_func != NULL)
- (*DeadStarShipPtr->RaceDescPtr->uninit_func) (
- DeadStarShipPtr->RaceDescPtr);
free_ship (DeadStarShipPtr->RaceDescPtr, TRUE, TRUE);
DeadStarShipPtr->RaceDescPtr = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-26 20:32:28
|
Revision: 3777
http://sc2.svn.sourceforge.net/sc2/?rev=3777&view=rev
Author: avolkov
Date: 2012-02-26 20:32:22 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Bugfix: TFB_DRAWCOMMANDTYPE_REINITVIDEO is allowed to be queued from the main() thread
Modified Paths:
--------------
trunk/sc2/src/libs/graphics/dcqueue.c
Modified: trunk/sc2/src/libs/graphics/dcqueue.c
===================================================================
--- trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-26 19:42:15 UTC (rev 3776)
+++ trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-26 20:32:22 UTC (rev 3777)
@@ -226,7 +226,7 @@
}
static void
-checkExclusiveThread (void)
+checkExclusiveThread (TFB_DrawCommand* DrawCommand)
{
#ifdef DEBUG_DCQ_THREADS
static uint32 exclusiveThreadId;
@@ -234,10 +234,18 @@
// Only one thread is currently allowed to enqueue commands
// This is not a technical limitation but rather a semantical one atm.
+ if (DrawCommand->Type == TFB_DRAWCOMMANDTYPE_REINITVIDEO)
+ { // TFB_DRAWCOMMANDTYPE_REINITVIDEO is an exception
+ // It is queued from the main() thread, which is safe to do
+ return;
+ }
+
if (!exclusiveThreadId)
exclusiveThreadId = SDL_ThreadID();
else
assert (SDL_ThreadID() == exclusiveThreadId);
+#else
+ (void) DrawCommand; // suppress unused warning
#endif
}
@@ -249,7 +257,7 @@
return;
}
- checkExclusiveThread ();
+ checkExclusiveThread (DrawCommand);
if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE
&& _CurFramePtr->Type == SCREEN_DRAWABLE)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-26 19:42:21
|
Revision: 3776
http://sc2.svn.sourceforge.net/sc2/?rev=3776&view=rev
Author: avolkov
Date: 2012-02-26 19:42:15 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
More work towards exit cleanliness; bugs 50, 1149:
* Some atexit() callbacks removed, to be called in order during clean exit (Abort key bypasses these)
The only things called atexit() are now removeTempDir, SDL_Quit() and log messageboxes
* gfxlib cleans up remaining SDL_Surfaces
* Other cleanup improvements: the goal is to allow library cleanup funcs to be called more than once w/o crashing,
and then decide which should and can be called atexit() safely.
Modified Paths:
--------------
trunk/sc2/src/libs/graphics/dcqueue.c
trunk/sc2/src/libs/graphics/sdl/opengl.c
trunk/sc2/src/libs/graphics/sdl/opengl.h
trunk/sc2/src/libs/graphics/sdl/pure.c
trunk/sc2/src/libs/graphics/sdl/pure.h
trunk/sc2/src/libs/graphics/sdl/sdl_common.c
trunk/sc2/src/libs/graphics/sdl/sdl_common.h
trunk/sc2/src/libs/input/sdl/input.c
trunk/sc2/src/libs/log/uqmlog.c
trunk/sc2/src/libs/sound/mixer/nosound/audiodrv_nosound.c
trunk/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c
trunk/sc2/src/libs/sound/openal/audiodrv_openal.c
trunk/sc2/src/libs/task/tasklib.c
trunk/sc2/src/uqm/globdata.c
trunk/sc2/src/uqm.c
Modified: trunk/sc2/src/libs/graphics/dcqueue.c
===================================================================
--- trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -156,8 +156,17 @@
void
Uninit_DrawCommandQueue (void)
{
- DestroyCondVar (RenderingCond);
- DestroyRecursiveMutex (DCQ_Mutex);
+ if (RenderingCond)
+ {
+ DestroyCondVar (RenderingCond);
+ RenderingCond = 0;
+ }
+
+ if (DCQ_Mutex)
+ {
+ DestroyRecursiveMutex (DCQ_Mutex);
+ DCQ_Mutex = 0;
+ }
}
void
Modified: trunk/sc2/src/libs/graphics/sdl/opengl.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/opengl.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/sdl/opengl.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -274,6 +274,15 @@
return 0;
}
+void
+TFB_GL_UninitGraphics (void)
+{
+ int i;
+
+ for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
+ UnInit_Screen (&GL_Screens[i].scaled);
+}
+
void TFB_GL_UploadTransitionScreen (void)
{
GL_Screens[TFB_SCREEN_TRANSITION].updated.x = 0;
Modified: trunk/sc2/src/libs/graphics/sdl/opengl.h
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/opengl.h 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/sdl/opengl.h 2012-02-26 19:42:15 UTC (rev 3776)
@@ -22,6 +22,7 @@
#include "libs/graphics/sdl/sdl_common.h"
int TFB_GL_InitGraphics (int driver, int flags, int width, int height);
+void TFB_GL_UninitGraphics (void);
int TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int togglefullscreen);
void TFB_GL_UploadTransitionScreen (void);
Modified: trunk/sc2/src/libs/graphics/sdl/pure.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/pure.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/sdl/pure.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -263,6 +263,14 @@
return 0;
}
+void
+TFB_Pure_UninitGraphics (void)
+{
+ UnInit_Screen (&scaled_display);
+ UnInit_Screen (&fade_color_surface);
+ UnInit_Screen (&fade_temp);
+}
+
static void
ScanLines (SDL_Surface *dst, SDL_Rect *r)
{
Modified: trunk/sc2/src/libs/graphics/sdl/pure.h
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/pure.h 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/sdl/pure.h 2012-02-26 19:42:15 UTC (rev 3776)
@@ -22,6 +22,7 @@
#include "libs/graphics/sdl/sdl_common.h"
int TFB_Pure_InitGraphics (int driver, int flags, int width, int height);
+void TFB_Pure_UninitGraphics (void);
int TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int togglefullscreen);
void Scale_PerfTest (void);
Modified: trunk/sc2/src/libs/graphics/sdl/sdl_common.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/sdl_common.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/sdl/sdl_common.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -52,6 +52,8 @@
volatile int QuitPosted = 0;
volatile int GameActive = 1; // Track the SDL_ACTIVEEVENT state SDL_APPACTIVE
+static void TFB_PreQuit (void);
+
void
TFB_PreInit (void)
{
@@ -76,8 +78,16 @@
log_add (log_Fatal, "Could not initialize SDL: %s.", SDL_GetError ());
exit (EXIT_FAILURE);
}
+
+ atexit (TFB_PreQuit);
}
+static void
+TFB_PreQuit (void)
+{
+ SDL_Quit ();
+}
+
int
TFB_ReInitGraphics (int driver, int flags, int width, int height)
{
@@ -129,15 +139,9 @@
int
TFB_InitGraphics (int driver, int flags, int width, int height)
{
- int result, i;
+ int result;
char caption[200];
- /* Null out screen pointers the first time */
- for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
- {
- SDL_Screens[i] = NULL;
- }
-
GfxFlags = flags;
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
@@ -168,17 +172,25 @@
TFB_DrawCanvas_Initialize ();
- atexit (TFB_UninitGraphics);
-
return 0;
}
void
TFB_UninitGraphics (void)
{
+ int i;
+
Uninit_DrawCommandQueue ();
- // TODO: Uninit whatever the drivers have set up for us
- SDL_Quit ();
+
+ for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
+ UnInit_Screen (&SDL_Screens[i]);
+
+ TFB_Pure_UninitGraphics ();
+#ifdef HAVE_OPENGL
+ TFB_GL_UninitGraphics ();
+#endif
+
+ UnInit_Screen (&format_conv_surf);
}
void
@@ -370,9 +382,18 @@
int
ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h)
{
- if (*screen)
- SDL_FreeSurface (*screen);
+ UnInit_Screen (screen);
*screen = Create_Screen (templat, w, h);
return *screen == 0 ? -1 : 0;
}
+
+void
+UnInit_Screen (SDL_Surface **screen)
+{
+ if (*screen == NULL)
+ return;
+
+ SDL_FreeSurface (*screen);
+ *screen = NULL;
+}
Modified: trunk/sc2/src/libs/graphics/sdl/sdl_common.h
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/sdl_common.h 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/graphics/sdl/sdl_common.h 2012-02-26 19:42:15 UTC (rev 3776)
@@ -50,5 +50,6 @@
SDL_Surface* Create_Screen (SDL_Surface *templat, int w, int h);
int ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h);
+void UnInit_Screen (SDL_Surface **screen);
#endif
Modified: trunk/sc2/src/libs/input/sdl/input.c
===================================================================
--- trunk/sc2/src/libs/input/sdl/input.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/input/sdl/input.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -273,7 +273,6 @@
VControl_ResetInput ();
InputInitialized = TRUE;
- atexit (TFB_UninitInput);
return 0;
}
Modified: trunk/sc2/src/libs/log/uqmlog.c
===================================================================
--- trunk/sc2/src/libs/log/uqmlog.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/log/uqmlog.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -159,6 +159,7 @@
{
qlock = 0;
DestroyMutex (qmutex);
+ qmutex = 0;
}
return code;
Modified: trunk/sc2/src/libs/sound/mixer/nosound/audiodrv_nosound.c
===================================================================
--- trunk/sc2/src/libs/sound/mixer/nosound/audiodrv_nosound.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/sound/mixer/nosound/audiodrv_nosound.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -146,8 +146,6 @@
return -1;
}
- atexit (unInitAudio);
-
PlaybackTask = AssignTask (PlaybackTaskFunc, 1024,
"nosound audio playback");
Modified: trunk/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c
===================================================================
--- trunk/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/sound/mixer/sdl/audiodrv_sdl.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -212,8 +212,6 @@
return -1;
}
- atexit (unInitAudio);
-
SDL_PauseAudio (0);
return 0;
@@ -239,6 +237,7 @@
HFree (sbuffer);
}
DestroyMutex (soundSource[i].stream_mutex);
+ soundSource[i].stream_mutex = 0;
mixSDL_DeleteSources (1, &soundSource[i].handle);
}
Modified: trunk/sc2/src/libs/sound/openal/audiodrv_openal.c
===================================================================
--- trunk/sc2/src/libs/sound/openal/audiodrv_openal.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/sound/openal/audiodrv_openal.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -126,7 +126,6 @@
}
*driver = openAL_Driver;
- atexit (unInitAudio);
alcContext = alcCreateContext (alcDevice, NULL);
if (!alcContext)
Modified: trunk/sc2/src/libs/task/tasklib.c
===================================================================
--- trunk/sc2/src/libs/task/tasklib.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/libs/task/tasklib.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -124,7 +124,6 @@
{
task_array[i].state_mutex = CreateMutex ("task manager lock", SYNC_CLASS_TOPLEVEL | SYNC_CLASS_RESOURCE);
}
- atexit (CleanupTaskSystem);
}
void
@@ -134,6 +133,7 @@
for (i = 0; i < TASK_MAX; ++i)
{
DestroyMutex (task_array[i].state_mutex);
+ task_array[i].state_mutex = 0;
}
}
Modified: trunk/sc2/src/uqm/globdata.c
===================================================================
--- trunk/sc2/src/uqm/globdata.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/uqm/globdata.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -46,9 +46,7 @@
GLOBDATA GlobData;
-static BOOLEAN initedGameStructs = FALSE;
-
BYTE
getGameState (int startBit, int endBit)
{
@@ -347,17 +345,6 @@
GLOBAL (autopilot.x) = ~0;
GLOBAL (autopilot.y) = ~0;
- /* In case the program is exited before the full game is terminated,
- * make sure that the temporary files are deleted.
- * This can be removed if we make sure if the full game is terminated
- * before the game is exited.
- * The initedSIS variable is added so the uninit won't happen more
- * than once, as you can't remove the atexit function (when the full game
- * ends).
- */
- initedGameStructs = TRUE;
- atexit (UninitGameStructures);
-
return (TRUE);
}
@@ -379,9 +366,6 @@
{
HFLEETINFO hStarShip;
- if (!initedGameStructs)
- return;
-
UninitQueue (&GLOBAL (encounter_q));
UninitQueue (&GLOBAL (ip_group_q));
UninitQueue (&GLOBAL (npc_built_ship_q));
@@ -409,7 +393,6 @@
DestroyDrawable (ReleaseDrawable (PlayFrame));
PlayFrame = 0;
- initedGameStructs = FALSE;
}
void
Modified: trunk/sc2/src/uqm.c
===================================================================
--- trunk/sc2/src/uqm.c 2012-02-25 20:15:23 UTC (rev 3775)
+++ trunk/sc2/src/uqm.c 2012-02-26 19:42:15 UTC (rev 3776)
@@ -464,14 +464,14 @@
* tasks might still be using it */
if (MainExited)
{
- // Not yet: TFB_UninitInput ();
+ TFB_UninitInput ();
unInitAudio ();
uninit_communication ();
- // TODO: Merge into TFB_UninitGraphics when it goes live
+
TFB_PurgeDanglingGraphics ();
// Purge above refers to colormaps which have to be still up
UninitColorMaps ();
- // Not yet: TFB_UninitGraphics ();
+ TFB_UninitGraphics ();
#ifdef NETPLAY
NetManager_uninit ();
@@ -481,7 +481,7 @@
Callback_uninit ();
Alarm_uninit ();
- // Not yet: CleanupTaskSystem ();
+ CleanupTaskSystem ();
UnInitTimeSystem ();
#if 0
unInitTempDir ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-25 20:15:30
|
Revision: 3775
http://sc2.svn.sourceforge.net/sc2/?rev=3775&view=rev
Author: avolkov
Date: 2012-02-25 20:15:23 +0000 (Sat, 25 Feb 2012)
Log Message:
-----------
Prevent reads from uninitialized ship_footprint variable; bug #1150; thanks for Louis Delacroix
Modified Paths:
--------------
trunk/sc2/src/uqm/cyborg.c
Modified: trunk/sc2/src/uqm/cyborg.c
===================================================================
--- trunk/sc2/src/uqm/cyborg.c 2012-02-25 19:33:43 UTC (rev 3774)
+++ trunk/sc2/src/uqm/cyborg.c 2012-02-25 20:15:23 UTC (rev 3775)
@@ -1092,7 +1092,7 @@
if (GRAVITY_MASS (ed.ObjectPtr->mass_points))
{
COUNT maneuver_turn, ship_bounds;
- RECT ship_footprint;
+ RECT ship_footprint = {{0, 0}, {0, 0}};
if (UltraManeuverable)
maneuver_turn = 16;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Mee...@us...> - 2012-02-25 19:33:49
|
Revision: 3774
http://sc2.svn.sourceforge.net/sc2/?rev=3774&view=rev
Author: Meep-Eep
Date: 2012-02-25 19:33:43 +0000 (Sat, 25 Feb 2012)
Log Message:
-----------
The code is not ready for this assertion.
Modified Paths:
--------------
trunk/sc2/src/uqm/globdata.c
Modified: trunk/sc2/src/uqm/globdata.c
===================================================================
--- trunk/sc2/src/uqm/globdata.c 2012-02-24 21:00:39 UTC (rev 3773)
+++ trunk/sc2/src/uqm/globdata.c 2012-02-25 19:33:43 UTC (rev 3774)
@@ -483,7 +483,7 @@
BOOLEAN
inHQSpace (void)
{
- assert (inFullGame ());
+ //assert (inFullGame ());
return (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE);
// IN_HYPERSPACE is also set for QuasiSpace
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Mee...@us...> - 2012-02-24 21:00:46
|
Revision: 3773
http://sc2.svn.sourceforge.net/sc2/?rev=3773&view=rev
Author: Meep-Eep
Date: 2012-02-24 21:00:39 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
Some functions for activities.
Modified Paths:
--------------
trunk/sc2/src/uqm/battle.c
trunk/sc2/src/uqm/comm.c
trunk/sc2/src/uqm/encount.c
trunk/sc2/src/uqm/galaxy.c
trunk/sc2/src/uqm/gameev.c
trunk/sc2/src/uqm/globdata.c
trunk/sc2/src/uqm/globdata.h
trunk/sc2/src/uqm/init.c
trunk/sc2/src/uqm/pickship.c
trunk/sc2/src/uqm/planets/devices.c
trunk/sc2/src/uqm/planets/pstarmap.c
trunk/sc2/src/uqm/process.c
trunk/sc2/src/uqm/save.c
trunk/sc2/src/uqm/ship.c
trunk/sc2/src/uqm/ships/sis_ship/sis_ship.c
trunk/sc2/src/uqm/sis.c
trunk/sc2/src/uqm/uqmdebug.c
Modified: trunk/sc2/src/uqm/battle.c
===================================================================
--- trunk/sc2/src/uqm/battle.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/battle.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -236,12 +236,12 @@
{
if (BattleRef == 0)
{
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
- BattleRef = LoadMusic (BATTLE_MUSIC);
- else if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
+ if (inHyperSpace ())
BattleRef = LoadMusic (HYPERSPACE_MUSIC);
- else
+ else if (inQuasiSpace ())
BattleRef = LoadMusic (QUASISPACE_MUSIC);
+ else
+ BattleRef = LoadMusic (BATTLE_MUSIC);
}
if (DoPlay)
@@ -463,8 +463,7 @@
#endif /* NETPLAY */
bs.InputFunc = DoBattle;
bs.frame_cb = callback;
- bs.first_time = (BOOLEAN)(LOBYTE (GLOBAL (CurrentActivity)) ==
- IN_HYPERSPACE);
+ bs.first_time = inHQSpace ();
DoInput (&bs, FALSE);
Modified: trunk/sc2/src/uqm/comm.c
===================================================================
--- trunk/sc2/src/uqm/comm.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/comm.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -1327,7 +1327,7 @@
RepairSISBorder ();
}
DrawSISMessage (NULL);
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
DrawHyperCoords (GLOBAL (ShipStamp.origin));
else if (GLOBAL (ip_planet) == 0)
DrawHyperCoords (CurStarDescPtr->star_pt);
@@ -1492,7 +1492,7 @@
SET_GAME_STATE (ESCAPE_COUNTER, ec);
return;
}
- else if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ else if (inHQSpace ())
{
ReinitQueue (&GLOBAL (npc_built_ship_q));
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) >= 2)
Modified: trunk/sc2/src/uqm/encount.c
===================================================================
--- trunk/sc2/src/uqm/encount.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/encount.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -296,7 +296,7 @@
SetContextFont (MicroFont);
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01));
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
t.pStr = GAME_STRING (ENCOUNTER_STRING_BASE + 0);
// "ENCOUNTER IN"
@@ -566,7 +566,7 @@
{
DrawSISFrame ();
DrawSISMessage (NULL);
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
DrawHyperCoords (GLOBAL (ShipStamp.origin));
else if (GLOBAL (ip_planet) == 0)
DrawHyperCoords (CurStarDescPtr->star_pt);
Modified: trunk/sc2/src/uqm/galaxy.c
===================================================================
--- trunk/sc2/src/uqm/galaxy.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/galaxy.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -268,7 +268,7 @@
else
{
SetPrimType (&DisplayArray[p], POINT_PRIM);
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
SetPrimColor (&DisplayArray[p],
BUILD_COLOR (MAKE_RGB15 (0x15, 0x15, 0x15), 0x07));
else if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
@@ -327,7 +327,7 @@
if (view_state == VIEW_CHANGE)
{
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
for (iss = 0, pprim = DisplayArray; iss < 2; ++iss)
{
@@ -385,7 +385,7 @@
}
}
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
for (i = BIG_STAR_COUNT + MED_STAR_COUNT, pprim = DisplayArray;
i > 0; --i, ++pprim)
@@ -406,7 +406,7 @@
WrapStarBlock (1, dx, dy);
WrapStarBlock (0, dx, dy);
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
{
dx = SpaceOrg.x;
dy = SpaceOrg.y;
Modified: trunk/sc2/src/uqm/gameev.c
===================================================================
--- trunk/sc2/src/uqm/gameev.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/gameev.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -60,8 +60,7 @@
break;
case HYPERSPACE_ENCOUNTER_EVENT:
check_race_growth ();
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE
- && GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
+ if (inHyperSpace ())
check_hyperspace_encounter ();
AddEvent (RELATIVE_EVENT, 0, 1, 0, HYPERSPACE_ENCOUNTER_EVENT);
Modified: trunk/sc2/src/uqm/globdata.c
===================================================================
--- trunk/sc2/src/uqm/globdata.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/globdata.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -32,6 +32,7 @@
#include "grpinfo.h"
#include "gamestr.h"
+#include <assert.h>
#include <stdlib.h>
#ifdef STATE_DEBUG
# include "libs/log.h"
@@ -424,4 +425,88 @@
}
+BOOLEAN
+inFullGame (void)
+{
+ ACTIVITY act = LOBYTE (GLOBAL (CurrentActivity));
+ return (act == IN_LAST_BATTLE || act == IN_ENCOUNTER ||
+ act == IN_HYPERSPACE || act == IN_INTERPLANETARY ||
+ act == WON_LAST_BATTLE);
+}
+BOOLEAN
+inSuperMelee (void)
+{
+ return (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE);
+ // TODO: && !inMainMenu ()
+}
+
+#if 0
+BOOLEAN
+inBattle (void)
+{
+ // TODO: IN_BATTLE is also set while in HyperSpace/QuasiSpace.
+ return ((GLOBAL (CurrentActivity) & IN_BATTLE) != 0);
+}
+#endif
+
+#if 0
+// Disabled for now as there are similar functions in uqm/planets/planets.h
+// Pre: inFullGame()
+BOOLEAN
+inInterPlanetary (void)
+{
+ assert (inFullGame ());
+ return (pSolarSysState != NULL);
+}
+
+// Pre: inFullGame()
+BOOLEAN
+inSolarSystem (void)
+{
+ assert (inFullGame ());
+ return (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY);
+}
+
+// Pre: inFullGame()
+BOOLEAN
+inOrbit (void)
+{
+ assert (inFullGame ());
+ return (pSolarSysState != NULL) &&
+ (pSolarSysState->pOrbitalDesc != NULL);
+}
+#endif
+
+// In HyperSpace or QuasiSpace
+// Pre: inFullGame()
+BOOLEAN
+inHQSpace (void)
+{
+ assert (inFullGame ());
+ return (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE);
+ // IN_HYPERSPACE is also set for QuasiSpace
+}
+
+// In HyperSpace
+// Pre: inFullGame()
+BOOLEAN
+inHyperSpace (void)
+{
+ //assert (inFullGame ());
+ return (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE) &&
+ (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1);
+ // IN_HYPERSPACE is also set for QuasiSpace
+}
+
+// In QuasiSpace
+// Pre: inFullGame()
+BOOLEAN
+inQuasiSpace (void)
+{
+ //assert (inFullGame ());
+ return (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE) &&
+ (GET_GAME_STATE (ARILOU_SPACE_SIDE) > 1);
+ // IN_HYPERSPACE is also set for QuasiSpace
+}
+
Modified: trunk/sc2/src/uqm/globdata.h
===================================================================
--- trunk/sc2/src/uqm/globdata.h 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/globdata.h 2012-02-24 21:00:39 UTC (rev 3773)
@@ -892,7 +892,7 @@
SUPER_MELEE = 0, /* Is also used while in the main menu */
IN_LAST_BATTLE,
IN_ENCOUNTER,
- IN_HYPERSPACE /* in Hyperspace or Quasispace */,
+ IN_HYPERSPACE /* in HyperSpace or QuasiSpace */,
IN_INTERPLANETARY,
WON_LAST_BATTLE,
@@ -904,6 +904,7 @@
CHECK_PAUSE = MAKE_WORD (0, (1 << 0)),
IN_BATTLE = MAKE_WORD (0, (1 << 1)),
+ /* Is also set while in HyperSpace/QuasiSpace */
START_ENCOUNTER = MAKE_WORD (0, (1 << 2)),
START_INTERPLANETARY = MAKE_WORD (0, (1 << 3)),
CHECK_LOAD = MAKE_WORD (0, (1 << 4)),
@@ -1011,6 +1012,16 @@
extern void InitGlobData (void);
+BOOLEAN inFullGame (void);
+BOOLEAN inSuperMelee (void);
+//BOOLEAN inBattle (void);
+//BOOLEAN inInterPlanetary (void);
+//BOOLEAN inSolarSystem (void);
+//BOOLEAN inOrbit (void);
+BOOLEAN inHQSpace (void);
+BOOLEAN inHyperSpace (void);
+BOOLEAN inQuasiSpace (void);
+
extern BOOLEAN InitGameStructures (void);
extern void UninitGameStructures (void);
Modified: trunk/sc2/src/uqm/init.c
===================================================================
--- trunk/sc2/src/uqm/init.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/init.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -187,7 +187,7 @@
InitDisplayList ();
InitGalaxy ();
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
ReinitQueue (&race_q[0]);
ReinitQueue (&race_q[1]);
@@ -346,7 +346,7 @@
for (i = 0; i < NUM_PLAYERS; i++)
ReinitQueue (&race_q[i]);
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
FreeHyperspace ();
}
}
Modified: trunk/sc2/src/uqm/pickship.c
===================================================================
--- trunk/sc2/src/uqm/pickship.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/pickship.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -304,7 +304,7 @@
HSTARSHIP
GetEncounterStarShip (STARSHIP *LastStarShipPtr, COUNT which_player)
{
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
assert (which_player == RPG_PLAYER_NUM);
// SIS for the Hyperspace flight
Modified: trunk/sc2/src/uqm/planets/devices.c
===================================================================
--- trunk/sc2/src/uqm/planets/devices.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/planets/devices.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -217,7 +217,7 @@
static BOOLEAN
UseCaster (void)
{
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
{
@@ -372,7 +372,7 @@
NextActivity |= CHECK_LOAD; /* fake a load game */
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 0);
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
if (GetHeadEncounter ())
{
@@ -443,8 +443,7 @@
break;
case PORTAL_SPAWNER_DEVICE:
#define PORTAL_FUEL_COST (10 * FUEL_TANK_SCALE)
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE
- && GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1
+ if (inHyperSpace ()
&& GLOBAL_SIS (FuelOnBoard) >= PORTAL_FUEL_COST)
{
/* No DeltaSISGauges because the flagship picture
Modified: trunk/sc2/src/uqm/planets/pstarmap.c
===================================================================
--- trunk/sc2/src/uqm/planets/pstarmap.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/planets/pstarmap.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -161,7 +161,7 @@
cycle, delta;
POINT pt;
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
pt = CurStarDescPtr->star_pt;
else
{
@@ -346,7 +346,7 @@
{
Color OldColor;
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
r.corner = CurStarDescPtr->star_pt;
else
{
@@ -773,7 +773,7 @@
DWORD f;
POINT pt;
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
pt = CurStarDescPtr->star_pt;
else
{
@@ -1223,7 +1223,7 @@
pMS->Initialized = TRUE;
pMS->InputFunc = DoMoveCursor;
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
universe = CurStarDescPtr->star_pt;
else
{
@@ -1250,7 +1250,7 @@
{
PlayMenuSound (MENU_SOUND_INVOKED);
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
// Move to the new location immediately.
doInstantMove ();
@@ -1579,7 +1579,7 @@
mapOrigin.y = MAX_Y_UNIVERSE >> 1;
StarMapFrame = SetAbsFrameIndex (MiscDataFrame, 48);
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
universe = CurStarDescPtr->star_pt;
else
{
Modified: trunk/sc2/src/uqm/process.c
===================================================================
--- trunk/sc2/src/uqm/process.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/process.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -308,12 +308,11 @@
dy = -ORG_JUMP_Y;
}
- if ((dx || dy) && LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if ((dx || dy) && inHQSpace ())
MoveSIS (&dx, &dy);
if (zoom_out == next_reduction)
- view_state = dx == 0 && dy == 0
- && LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE
+ view_state = dx == 0 && dy == 0 && !inHQSpace ()
? VIEW_STABLE : VIEW_SCROLL;
else
{
Modified: trunk/sc2/src/uqm/save.c
===================================================================
--- trunk/sc2/src/uqm/save.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/save.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -486,7 +486,7 @@
switch (SummPtr->Activity)
{
case IN_HYPERSPACE:
- if (GET_GAME_STATE (ARILOU_SPACE_SIDE) > 1)
+ if (inQuasiSpace ())
SummPtr->Activity = IN_QUASISPACE;
break;
case IN_INTERPLANETARY:
@@ -621,7 +621,7 @@
static void
SaveFlagshipState (void)
{
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
// Player is in HyperSpace or QuasiSpace.
SaveSisHyperState ();
Modified: trunk/sc2/src/uqm/ship.c
===================================================================
--- trunk/sc2/src/uqm/ship.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/ship.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -454,7 +454,7 @@
else
{
StarShipPtr->ShipFacing = NORMALIZE_FACING (TFB_Random ());
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{ // Only one ship is ever spawned in HyperSpace -- flagship
COUNT facing = GLOBAL (ShipFacing);
// XXX: Solar system reentry test depends on ShipFacing != 0
Modified: trunk/sc2/src/uqm/ships/sis_ship/sis_ship.c
===================================================================
--- trunk/sc2/src/uqm/ships/sis_ship/sis_ship.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/ships/sis_ship/sis_ship.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -891,7 +891,7 @@
new_sis_desc.uninit_func = uninit_sis;
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
+ if (inHQSpace ())
{
for (i = 0; i < NUM_VIEWS; ++i)
{
@@ -950,7 +950,7 @@
static void
uninit_sis (RACE_DESC *pRaceDesc)
{
- if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
+ if (!inHQSpace ())
{
GLOBAL_SIS (CrewEnlisted) = pRaceDesc->ship_info.crew_level;
if (pRaceDesc->ship_info.ship_flags & PLAYER_CAPTAIN)
Modified: trunk/sc2/src/uqm/sis.c
===================================================================
--- trunk/sc2/src/uqm/sis.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/sis.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -214,7 +214,7 @@
pStr = buf;
break;
case IN_HYPERSPACE:
- if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
+ if (inHyperSpace ())
{
pStr = GAME_STRING (NAVIGATION_STRING_BASE);
// "HyperSpace"
Modified: trunk/sc2/src/uqm/uqmdebug.c
===================================================================
--- trunk/sc2/src/uqm/uqmdebug.c 2012-02-24 19:52:10 UTC (rev 3772)
+++ trunk/sc2/src/uqm/uqmdebug.c 2012-02-24 21:00:39 UTC (rev 3773)
@@ -369,7 +369,7 @@
}
// Make sure everything is redrawn:
- if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE ||
+ if (inHQSpace () ||
LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
{
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
@@ -1508,7 +1508,7 @@
CONTEXT OldContext;
if (!(GLOBAL (CurrentActivity) & IN_BATTLE) ||
- (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE))
+ (inHQSpace ()))
return;
StarShipPtr = findPlayerShip (RPG_PLAYER_NUM);
@@ -1531,7 +1531,7 @@
CONTEXT OldContext;
if (!(GLOBAL (CurrentActivity) & IN_BATTLE) ||
- (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE))
+ (inHQSpace ()))
return;
StarShipPtr = findPlayerShip (RPG_PLAYER_NUM);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Mee...@us...> - 2012-02-24 19:52:18
|
Revision: 3772
http://sc2.svn.sourceforge.net/sc2/?rev=3772&view=rev
Author: Meep-Eep
Date: 2012-02-24 19:52:10 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
Add setSegue(), getSegue().
Modified Paths:
--------------
trunk/sc2/src/uqm/comm/arilou/arilouc.c
trunk/sc2/src/uqm/comm/blackur/blackurc.c
trunk/sc2/src/uqm/comm/chmmr/chmmrc.c
trunk/sc2/src/uqm/comm/comandr/comandr.c
trunk/sc2/src/uqm/comm/druuge/druugec.c
trunk/sc2/src/uqm/comm/ilwrath/ilwrathc.c
trunk/sc2/src/uqm/comm/melnorm/melnorm.c
trunk/sc2/src/uqm/comm/mycon/myconc.c
trunk/sc2/src/uqm/comm/orz/orzc.c
trunk/sc2/src/uqm/comm/pkunk/pkunkc.c
trunk/sc2/src/uqm/comm/rebel/rebel.c
trunk/sc2/src/uqm/comm/shofixt/shofixt.c
trunk/sc2/src/uqm/comm/slyhome/slyhome.c
trunk/sc2/src/uqm/comm/slyland/slyland.c
trunk/sc2/src/uqm/comm/spahome/spahome.c
trunk/sc2/src/uqm/comm/spathi/spathic.c
trunk/sc2/src/uqm/comm/starbas/starbas.c
trunk/sc2/src/uqm/comm/supox/supoxc.c
trunk/sc2/src/uqm/comm/syreen/syreenc.c
trunk/sc2/src/uqm/comm/talkpet/talkpet.c
trunk/sc2/src/uqm/comm/thradd/thraddc.c
trunk/sc2/src/uqm/comm/umgah/umgahc.c
trunk/sc2/src/uqm/comm/urquan/urquanc.c
trunk/sc2/src/uqm/comm/utwig/utwigc.c
trunk/sc2/src/uqm/comm/vux/vuxc.c
trunk/sc2/src/uqm/comm/yehat/yehatc.c
trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c
trunk/sc2/src/uqm/commglue.c
trunk/sc2/src/uqm/commglue.h
Modified: trunk/sc2/src/uqm/comm/arilou/arilouc.c
===================================================================
--- trunk/sc2/src/uqm/comm/arilou/arilouc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/arilou/arilouc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -230,7 +230,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye_angry_space))
NPCPhrase (GOODBYE_ANGRY_SPACE);
@@ -644,7 +644,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
else if (!GET_GAME_STATE (MET_ARILOU))
@@ -691,7 +691,7 @@
}
SET_GAME_STATE (ARILOU_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (Manner == 1)
{
@@ -801,7 +801,7 @@
{
BYTE Manner;
- if (GET_GAME_STATE (BATTLE_SEGUE) == 1
+ if (getSegue () == Segue_hostile
&& (Manner = GET_GAME_STATE (ARILOU_MANNER)) != 2)
{
SET_GAME_STATE (ARILOU_MANNER, 1);
@@ -843,11 +843,11 @@
|| GET_GAME_STATE (ARILOU_MANNER) == 3
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &arilou_desc;
Modified: trunk/sc2/src/uqm/comm/blackur/blackurc.c
===================================================================
--- trunk/sc2/src/uqm/comm/blackur/blackurc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/blackur/blackurc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -134,7 +134,7 @@
{
BYTE NumVisits;
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, bye))
{
@@ -447,7 +447,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -455,7 +455,7 @@
{
NPCPhrase (GAME_OVER_DUDE);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -474,7 +474,7 @@
NPCPhrase (HELLO_SAMATRA);
SET_GAME_STATE (AWARE_OF_SAMATRA, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
@@ -555,11 +555,11 @@
if (!GET_GAME_STATE (KOHR_AH_KILLED_ALL)
&& LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
retval = &blackurq_desc;
Modified: trunk/sc2/src/uqm/comm/chmmr/chmmrc.c
===================================================================
--- trunk/sc2/src/uqm/comm/chmmr/chmmrc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/chmmr/chmmrc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -120,7 +120,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye))
NPCPhrase (GOODBYE);
@@ -634,7 +634,7 @@
chmmr_desc.AlienTextBaseline.y = 0;
chmmr_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &chmmr_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/comandr/comandr.c
===================================================================
--- trunk/sc2/src/uqm/comm/comandr/comandr.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/comandr/comandr.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -687,7 +687,7 @@
commander_desc.AlienTextBaseline.x = 164;
commander_desc.AlienTextBaseline.y = 20;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &commander_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/druuge/druugec.c
===================================================================
--- trunk/sc2/src/uqm/comm/druuge/druugec.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/druuge/druugec.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -166,7 +166,7 @@
{
if (PLAYER_SAID (R, bye))
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
{
@@ -210,7 +210,7 @@
}
else /* if (R == then_we_take_bomb) */
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
NPCPhrase (FIGHT_FOR_BOMB);
}
@@ -683,7 +683,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -720,7 +720,7 @@
SET_GAME_STATE (DRUUGE_VISITS, NumVisits);
}
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
{
@@ -814,7 +814,7 @@
}
SET_GAME_STATE (DRUUGE_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
@@ -850,7 +850,7 @@
}
SET_GAME_STATE (DRUUGE_SALVAGE, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
AttemptedSalvage = TRUE;
}
else
@@ -882,7 +882,7 @@
static void
post_druuge_enc (void)
{
- if (GET_GAME_STATE (BATTLE_SEGUE) == 1
+ if (getSegue () == Segue_hostile
&& !AttemptedSalvage
&& !GET_GAME_STATE (DRUUGE_MANNER))
{
@@ -914,11 +914,11 @@
&& (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7)))
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &druuge_desc;
Modified: trunk/sc2/src/uqm/comm/ilwrath/ilwrathc.c
===================================================================
--- trunk/sc2/src/uqm/comm/ilwrath/ilwrathc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/ilwrath/ilwrathc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -102,7 +102,7 @@
static void
CombatIsInevitable (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, you_are_weak))
NPCPhrase (STRENGTH_NOT_ALL);
@@ -124,7 +124,7 @@
{
NPCPhrase (GOODBYE_GODS);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
if (PLAYER_SAID (R, whats_up))
{
@@ -586,7 +586,7 @@
else
NPCPhrase (JUST_GRUNTS);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 4))
{
@@ -596,7 +596,7 @@
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
NPCPhrase (HAPPY_FIGHTING_THRADDASH);
@@ -637,11 +637,11 @@
& ((1 << 4) | (1 << 5)))
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &ilwrath_desc;
Modified: trunk/sc2/src/uqm/comm/melnorm/melnorm.c
===================================================================
--- trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -766,14 +766,14 @@
NPCPhrase (YOU_GIVE_US_NO_CHOICE);
SET_GAME_STATE (MELNORME_ANGER, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, so_we_can_attack))
{
NPCPhrase (DECEITFUL_HUMAN);
SET_GAME_STATE (MELNORME_ANGER, 2);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, bye_melnorme_slightly_angry))
NPCPhrase (MELNORME_SLIGHTLY_ANGRY_GOODBYE);
@@ -795,7 +795,7 @@
NPCPhrase (OK_FIGHT_SOME_MORE);
SET_GAME_STATE (MELNORME_ANGER, 3);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, bye_melnorme_pissed_off))
NPCPhrase (MELNORME_PISSED_OFF_GOODBYE);
@@ -803,7 +803,7 @@
{
NPCPhrase (WE_FIGHT_AGAIN);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, you_hate_us_so_we_go_away))
NPCPhrase (HATE_YOU_GOODBYE);
@@ -1847,7 +1847,7 @@
prevMsgMode = SMM_UNDEFINED;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
AskedToBuy = FALSE;
retval = &melnorme_desc;
Modified: trunk/sc2/src/uqm/comm/mycon/myconc.c
===================================================================
--- trunk/sc2/src/uqm/comm/mycon/myconc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/mycon/myconc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -245,7 +245,7 @@
static void
CombatIsInevitable (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, bye_space))
NPCPhrase (BYE_AND_DIE_SPACE);
@@ -257,7 +257,7 @@
{
NPCPhrase (GOODBYE_SUN_DEVICE);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
@@ -340,7 +340,7 @@
{
NPCPhrase (WE_GO_TO_IMPLANT);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (MYCON_FELL_FOR_AMBUSH, 1);
AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_MYCON_MISSION);
}
@@ -505,13 +505,13 @@
}
SET_GAME_STATE (MYCON_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (MYCON_KNOW_AMBUSH))
{
NPCPhrase (DIE_LIAR);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
{
@@ -631,11 +631,11 @@
if (LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
retval = &mycon_desc;
Modified: trunk/sc2/src/uqm/comm/orz/orzc.c
===================================================================
--- trunk/sc2/src/uqm/comm/orz/orzc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/orz/orzc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -174,7 +174,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye_ally))
NPCPhrase (GOODBYE_ALLY);
@@ -193,7 +193,7 @@
{
NPCPhrase (HOSTILITY_IS_BAD_2);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, may_we_land))
{
@@ -219,7 +219,7 @@
{
NPCPhrase (NO_DEMAND);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, about_andro_3)
|| PLAYER_SAID (R, must_know_about_androsyn))
@@ -231,7 +231,7 @@
SET_GAME_STATE (ORZ_VISITS, 0);
SET_GAME_STATE (ORZ_MANNER, 2);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, about_andro_3))
{
SetRaceAllied (ORZ_SHIP, FALSE);
@@ -257,13 +257,13 @@
break;
case 2:
NPCPhrase (INSULTED_3);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
break;
case 7:
--NumVisits;
default:
NPCPhrase (INSULTED_4);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
break;
}
SET_GAME_STATE (ORZ_PERSONAL_INFO, NumVisits);
@@ -643,7 +643,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -669,7 +669,7 @@
}
SET_GAME_STATE (ORZ_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
{
@@ -857,7 +857,7 @@
{
BYTE Manner;
- if (GET_GAME_STATE (BATTLE_SEGUE) == 1
+ if (getSegue () == Segue_hostile
&& (Manner = GET_GAME_STATE (ORZ_MANNER)) != 2)
{
SET_GAME_STATE (ORZ_MANNER, 1);
@@ -886,11 +886,11 @@
if (GET_GAME_STATE (ORZ_MANNER) == 3
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &orz_desc;
Modified: trunk/sc2/src/uqm/comm/pkunk/pkunkc.c
===================================================================
--- trunk/sc2/src/uqm/comm/pkunk/pkunkc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/pkunk/pkunkc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -132,7 +132,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, friendly_bye_space))
NPCPhrase (FRIENDLY_GOODBYE_SPACE);
@@ -187,13 +187,13 @@
SET_GAME_STATE (PKUNK_MANNER, 2);
}
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, die_idiot_fools))
{
NPCPhrase (VERY_WELL);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, suit_yourself))
NPCPhrase (GOODBYE_MIGRATION);
@@ -853,7 +853,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -880,7 +880,7 @@
}
SET_GAME_STATE (PKUNK_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (Manner == 1)
{
@@ -1104,7 +1104,7 @@
{
BYTE Manner;
- if (GET_GAME_STATE (BATTLE_SEGUE) == 1
+ if (getSegue () == Segue_hostile
&& (Manner = GET_GAME_STATE (PKUNK_MANNER)) != 2)
{
SET_GAME_STATE (PKUNK_MANNER, 1);
@@ -1133,12 +1133,12 @@
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
// Enter communications immediately.
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
// Ask the player whether to attack or talk.
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &pkunk_desc;
Modified: trunk/sc2/src/uqm/comm/rebel/rebel.c
===================================================================
--- trunk/sc2/src/uqm/comm/rebel/rebel.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/rebel/rebel.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -376,7 +376,7 @@
{
BYTE NumVisits;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
{
NPCPhrase (YEHAT_CAVALRY);
@@ -442,7 +442,7 @@
yehat_desc.AlienAltSongRes = REBEL_MUSIC;
yehat_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &yehat_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/shofixt/shofixt.c
===================================================================
--- trunk/sc2/src/uqm/comm/shofixt/shofixt.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/shofixt/shofixt.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -170,25 +170,25 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, bye0))
{
NPCPhrase (GOODBYE);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, go_ahead))
{
NPCPhrase (ON_SECOND_THOUGHT);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, need_you_for_duty))
{
NPCPhrase (OK_WILL_BE_SENTRY);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, females)
|| PLAYER_SAID (R, nubiles)
@@ -198,7 +198,7 @@
SET_GAME_STATE (SHOFIXTI_RECRUITED, 1);
SET_GAME_STATE (MAIDENS_ON_SHIP, 0);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
AddEvent (RELATIVE_EVENT, 2, 0, 0, SHOFIXTI_RETURN_EVENT);
}
@@ -546,7 +546,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -644,7 +644,7 @@
shofixti_desc.AlienTextBaseline.y = 0;
shofixti_desc.AlienTextWidth = SIS_TEXT_WIDTH;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &shofixti_desc;
Modified: trunk/sc2/src/uqm/comm/slyhome/slyhome.c
===================================================================
--- trunk/sc2/src/uqm/comm/slyhome/slyhome.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/slyhome/slyhome.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -175,7 +175,7 @@
ExitConversation (RESPONSE_REF R)
{
(void) R; // ignored
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
switch (GET_GAME_STATE (SLYLANDRO_HOME_VISITS))
{
@@ -914,7 +914,7 @@
slylandro_desc.AlienTextBaseline.y = 0;
slylandro_desc.AlienTextWidth = SIS_TEXT_WIDTH;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &slylandro_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/slyland/slyland.c
===================================================================
--- trunk/sc2/src/uqm/comm/slyland/slyland.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/slyland/slyland.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -314,8 +314,7 @@
else if (PLAYER_SAID (R, destruct_code))
{
NPCPhrase (DESTRUCT_SEQUENCE);
- instantVictory = TRUE;
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_victory);
}
else
{
@@ -443,7 +442,7 @@
NPCPhrase (HOSTILE);
SET_GAME_STATE (PROBE_EXHIBITED_BUG, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
}
@@ -511,7 +510,7 @@
slylandro_desc.AlienTextBaseline.y = 0;
slylandro_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
retval = &slylandro_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/spahome/spahome.c
===================================================================
--- trunk/sc2/src/uqm/comm/spahome/spahome.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/spahome/spahome.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -186,24 +186,24 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, we_attack_again))
{
NPCPhrase (WE_FIGHT_AGAIN);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, surrender_or_die))
{
NPCPhrase (DEFEND_OURSELVES);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, we_are_vindicator0))
{
NPCPhrase (NO_PASSWORD);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, gort_merenga)
|| PLAYER_SAID (R, guph_florp)
@@ -212,13 +212,13 @@
{
NPCPhrase (WRONG_PASSWORD);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, screw_password))
{
NPCPhrase (NO_PASSWORD);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, bye_no_ally_offer))
NPCPhrase (GOODBYE_NO_ALLY_OFFER);
@@ -906,7 +906,7 @@
if (Manner == 2)
{
NPCPhrase (HATE_YOU_FOREVER);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (Manner == 1
&& GET_GAME_STATE (KNOW_SPATHI_PASSWORD)
@@ -940,7 +940,7 @@
NPCPhrase (YOU_LIED_2);
SET_GAME_STATE (SPATHI_MANNER, 2);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
}
else if (GET_GAME_STATE (KNOW_SPATHI_QUEST))
@@ -974,7 +974,7 @@
{
BYTE Manner;
- if (GET_GAME_STATE (BATTLE_SEGUE) == 1
+ if (getSegue () == Segue_hostile
&& (Manner = GET_GAME_STATE (SPATHI_MANNER)) != 2)
{
SET_GAME_STATE (SPATHI_MANNER, 1);
@@ -1005,11 +1005,11 @@
if (GET_GAME_STATE (SPATHI_MANNER) == 3)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &spahome_desc;
Modified: trunk/sc2/src/uqm/comm/spathi/spathic.c
===================================================================
--- trunk/sc2/src/uqm/comm/spathi/spathic.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/spathi/spathic.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -147,7 +147,7 @@
static void
ExitConversation (RESPONSE_REF Response)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (Response, bye_ally_space))
NPCPhrase (GOODBYE_ALLY_SPACE);
@@ -165,13 +165,13 @@
{
NPCPhrase (YIPES);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (Response, we_fight_again_space))
{
NPCPhrase (OK_FIGHT_AGAIN_SPACE);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (Response, die_slugboy)
|| PLAYER_SAID (Response, we_fight_1)
@@ -184,7 +184,7 @@
NPCPhrase (FAKE_COORDINATES);
NPCPhrase (OK_WE_FIGHT_AT_PLUTO);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (Response, join_us))
{
@@ -726,7 +726,7 @@
else if (Manner == 2)
{
NPCPhrase (HATE_YOU_FOREVER_SPACE);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (Manner == 1)
{
@@ -779,7 +779,7 @@
{
SET_GAME_STATE (FOUND_PLUTO_SPATHI, 2);
}
- else if (GET_GAME_STATE (BATTLE_SEGUE) == 1
+ else if (getSegue () == Segue_hostile
&& (Manner = GET_GAME_STATE (SPATHI_MANNER)) != 2)
{
SET_GAME_STATE (SPATHI_MANNER, 1);
@@ -822,11 +822,11 @@
|| GET_GAME_STATE (SPATHI_MANNER) == 3
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &spathi_desc;
Modified: trunk/sc2/src/uqm/comm/starbas/starbas.c
===================================================================
--- trunk/sc2/src/uqm/comm/starbas/starbas.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/starbas/starbas.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -1954,7 +1954,7 @@
commander_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
CurBulletinMask = 0;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &commander_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/supox/supoxc.c
===================================================================
--- trunk/sc2/src/uqm/comm/supox/supoxc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/supox/supoxc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -103,7 +103,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye_neutral))
NPCPhrase (GOODBYE_NEUTRAL);
@@ -531,7 +531,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -550,7 +550,7 @@
}
SET_GAME_STATE (SUPOX_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (CheckAlliance (SUPOX_SHIP) == GOOD_GUY)
{
@@ -696,11 +696,11 @@
if (!GET_GAME_STATE (SUPOX_HOSTILE)
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &supox_desc;
Modified: trunk/sc2/src/uqm/comm/syreen/syreenc.c
===================================================================
--- trunk/sc2/src/uqm/comm/syreen/syreenc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/syreen/syreenc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -193,7 +193,7 @@
static void
FriendlyExit (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye))
NPCPhrase (GOODBYE);
@@ -555,7 +555,7 @@
{
NPCPhrase (HORRIBLE_TRUTH);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (SYREEN_HOME_VISITS, 0);
SET_GAME_STATE (SYREEN_KNOW_ABOUT_MYCON, 1);
@@ -729,7 +729,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -871,7 +871,7 @@
syreen_desc.AlienTextBaseline.y = 0;
syreen_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
retval = &syreen_desc;
return (retval);
Modified: trunk/sc2/src/uqm/comm/talkpet/talkpet.c
===================================================================
--- trunk/sc2/src/uqm/comm/talkpet/talkpet.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/talkpet/talkpet.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -213,7 +213,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (SHIP_TO_COMPEL, 0);
if (PLAYER_SAID (R, compel_urquan))
@@ -498,7 +498,7 @@
{
NPCPhrase (CANT_COMPEL);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
return;
@@ -649,14 +649,14 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
{
SET_GAME_STATE (SHIP_TO_COMPEL, 0);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (!(GLOBAL (glob_flags) & CYBORG_ENABLED))
{
NPCPhrase (HUMAN_PEP_TALK);
@@ -679,13 +679,13 @@
else
NPCPhrase (SOUP_UP_BOMB);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (GET_GAME_STATE (URQUAN_MESSED_UP))
{
NPCPhrase (HELLO_AFTER_COMPEL_URQUAN);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
@@ -769,13 +769,13 @@
else if (!GET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP))
{
SET_GAME_STATE (PLAYER_HYPNOTIZED, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
NPCPhrase (CANT_COMPEL);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
}
else
@@ -828,11 +828,11 @@
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &talkpet_desc;
Modified: trunk/sc2/src/uqm/comm/thradd/thraddc.c
===================================================================
--- trunk/sc2/src/uqm/comm/thradd/thraddc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/thradd/thraddc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -239,7 +239,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, bye_hostile_2))
NPCPhrase (GOODBYE_HOSTILE_2);
@@ -261,7 +261,7 @@
{
NPCPhrase (GOOD_IDEA);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_THRADD_MISSION);
SET_GAME_STATE (THRADD_STACK_1, 5);
}
@@ -289,14 +289,14 @@
break;
}
SET_GAME_STATE (THRADD_STACK_1, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, may_i_land))
{
NPCPhrase (SURE_LAND);
SET_GAME_STATE (HELIX_UNPROTECTED, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, demand_to_land))
NPCPhrase (NO_DEMAND);
@@ -330,7 +330,7 @@
}
NPCPhrase (WORK_TO_DO);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
}
@@ -700,7 +700,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -719,7 +719,7 @@
}
SET_GAME_STATE (HELIX_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
{
@@ -752,7 +752,7 @@
}
SET_GAME_STATE (THRADD_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (GET_GAME_STATE (THRADD_MANNER))
{
@@ -942,11 +942,11 @@
if (GET_GAME_STATE (THRADD_MANNER)
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &thradd_desc;
Modified: trunk/sc2/src/uqm/comm/umgah/umgahc.c
===================================================================
--- trunk/sc2/src/uqm/comm/umgah/umgahc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/umgah/umgahc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -198,13 +198,13 @@
static void
CombatIsInevitable (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, bye_zombie))
{
NPCPhrase (GOODBYE_ZOMBIE);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, bye_pre_zombie))
NPCPhrase (GOODBYE_PRE_ZOMBIE);
@@ -235,7 +235,7 @@
{
NPCPhrase (GOODBYE_UNKNOWN);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, bye_post_zombie))
{
@@ -346,14 +346,14 @@
{
NPCPhrase (NOT_GIVE_UP);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
return;
}
else if (PLAYER_SAID (R, arilou_told_us))
{
NPCPhrase (THEN_DIE);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
SET_GAME_STATE (KNOW_UMGAH_ZOMBIES, 1);
SET_GAME_STATE (UMGAH_VISITS, 0);
return;
@@ -541,7 +541,7 @@
}
SET_GAME_STATE (UMGAH_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (UMGAH_ZOMBIE_BLOBBIES))
{
@@ -565,7 +565,7 @@
break;
}
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (GET_GAME_STATE (KNOW_UMGAH_ZOMBIES))
{
@@ -586,7 +586,7 @@
break;
}
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
@@ -681,7 +681,7 @@
}
SET_GAME_STATE (UMGAH_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
}
}
@@ -717,11 +717,11 @@
if ((GET_GAME_STATE (TALKING_PET) && !GET_GAME_STATE (UMGAH_HOSTILE))
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &umgah_desc;
Modified: trunk/sc2/src/uqm/comm/urquan/urquanc.c
===================================================================
--- trunk/sc2/src/uqm/comm/urquan/urquanc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/urquan/urquanc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -123,7 +123,7 @@
static void
CombatIsInevitable (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, you_must_surrender))
NPCPhrase (NOPE);
@@ -159,9 +159,7 @@
{
NPCPhrase (GOOD_CHOICE);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
- GLOBAL_SIS (CrewEnlisted) = (COUNT)~0;
- GLOBAL (CurrentActivity) |= CHECK_RESTART;
+ setSegue (Segue_defeat);
}
else if (PLAYER_SAID (R, like_to_leave))
NPCPhrase (INDEPENDENCE_IS_BAD);
@@ -169,7 +167,7 @@
{
NPCPhrase (GOODBYE_WARS_OVER);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, bye_sub_hypno))
NPCPhrase (GOODBYE_AND_DIE_SUB_HYPNO);
@@ -184,7 +182,7 @@
{
NPCPhrase (BAD_NEWS);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (URQUAN_HYPNO_VISITS, 1);
}
else if (PLAYER_SAID (R, falling_asleep)
@@ -192,7 +190,7 @@
{
NPCPhrase (SOUNDS_FAMILIAR);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (URQUAN_HYPNO_VISITS, 1);
}
}
@@ -415,7 +413,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -450,7 +448,7 @@
{
NPCPhrase (CAUGHT_YA);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
return;
}
@@ -462,7 +460,7 @@
NPCPhrase (HELLO_SAMATRA);
SET_GAME_STATE (AWARE_OF_SAMATRA, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
@@ -501,7 +499,7 @@
break;
case 1:
NPCPhrase (SUBSEQUENT_FLEE_HUMAN);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
--NumVisits;
break;
}
@@ -545,11 +543,11 @@
&& GLOBAL (BattleGroupRef)
&& GLOBAL (BattleGroupRef) == GrpOffs))
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &urquan_desc;
Modified: trunk/sc2/src/uqm/comm/utwig/utwigc.c
===================================================================
--- trunk/sc2/src/uqm/comm/utwig/utwigc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/utwig/utwigc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -200,7 +200,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye_neutral))
NPCPhrase (GOODBYE_NEUTRAL);
@@ -216,7 +216,7 @@
{
NPCPhrase (GUARDS_FIGHT);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, got_ultron)
|| PLAYER_SAID (R, hey_wait_got_ultron))
@@ -244,7 +244,7 @@
{
NPCPhrase (TRICKED_US_1);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
break;
case 1:
@@ -254,7 +254,7 @@
{
NPCPhrase (TRICKED_US_2);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
break;
}
@@ -497,7 +497,7 @@
{
NPCPhrase (MOCK_OUR_PAIN);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
SET_GAME_STATE (UTWIG_STACK1, 4);
SET_GAME_STATE (UTWIG_HOSTILE, 1);
SET_GAME_STATE (UTWIG_INFO, 0);
@@ -651,7 +651,7 @@
{
NPCPhrase (GUARDS_FIGHT);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
SET_GAME_STATE (UTWIG_HOSTILE, 1);
SET_GAME_STATE (UTWIG_INFO, 0);
SET_GAME_STATE (UTWIG_HOME_VISITS, 0);
@@ -745,7 +745,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -800,7 +800,7 @@
if (!GET_GAME_STATE (ULTRON_CONDITION)
|| (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6)))
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
@@ -984,11 +984,11 @@
if (GET_GAME_STATE (UTWIG_HAVE_ULTRON)
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &utwig_desc;
Modified: trunk/sc2/src/uqm/comm/vux/vuxc.c
===================================================================
--- trunk/sc2/src/uqm/comm/vux/vuxc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/vux/vuxc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -205,7 +205,7 @@
{
BYTE NumVisits;
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, ok_take_beast))
{
@@ -220,7 +220,7 @@
SET_GAME_STATE (VUX_BEAST_ON_SHIP, 0);
SET_GAME_STATE (ZEX_IS_DEAD, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else if (PLAYER_SAID (R, try_any_way))
{
@@ -290,7 +290,7 @@
{
NPCPhrase (GOODBYE_ZEX);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
@@ -376,13 +376,13 @@
{
NPCPhrase (FIGHT_AGAIN);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, regardless))
{
NPCPhrase (THEN_FIGHT);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
SET_GAME_STATE (ZEX_STACK_3, 2);
SET_GAME_STATE (ZEX_VISITS, 0);
}
@@ -696,7 +696,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -784,11 +784,11 @@
if ((GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &vux_desc;
Modified: trunk/sc2/src/uqm/comm/yehat/yehatc.c
===================================================================
--- trunk/sc2/src/uqm/comm/yehat/yehatc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/yehat/yehatc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -194,7 +194,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
if (PLAYER_SAID (R, bye_homeworld))
NPCPhrase (GOODBYE_AND_DIE_HOMEWORLD);
@@ -214,7 +214,7 @@
{
NPCPhrase (GO_IN_PEACE);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
}
else if (PLAYER_SAID (R, not_here)
@@ -235,7 +235,7 @@
{
NPCPhrase (WE_REVOLT);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (YEHAT_CIVIL_WAR, 1);
SET_GAME_STATE (YEHAT_VISITS, 0);
SET_GAME_STATE (YEHAT_HOME_VISITS, 0);
@@ -439,7 +439,7 @@
{
NPCPhrase (WE_CANNOT_2);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
SET_GAME_STATE (NO_YEHAT_ALLY_SPACE, 2);
return;
@@ -565,7 +565,7 @@
{
NPCPhrase (OUT_TAKES);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -673,11 +673,11 @@
if (LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
retval = &yehat_desc;
Modified: trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c
===================================================================
--- trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -179,7 +179,7 @@
static void
ExitConversation (RESPONSE_REF R)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
if (PLAYER_SAID (R, bye_homeworld))
{
@@ -236,7 +236,7 @@
SET_GAME_STATE (ZOQFOT_HOSTILE, 1);
SET_GAME_STATE (ZOQFOT_HOME_VISITS, 0);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (PLAYER_SAID (R, never))
{
@@ -246,7 +246,7 @@
SET_GAME_STATE (ZOQFOT_HOME_VISITS, 0);
SET_GAME_STATE (ZOQFOT_HOSTILE, 1);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
}
@@ -777,7 +777,7 @@
NPCPhrase_cb (OUT_TAKES12, &SelectAlienZOQ);
NPCPhrase_cb (OUT_TAKES13, &SelectAlienPIK);
ZFPTalkSegue ((COUNT)~0);
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
return;
}
@@ -814,7 +814,7 @@
}
SET_GAME_STATE (ZOQFOT_HOME_VISITS, NumVisits);
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
else if (!GET_GAME_STATE (MET_ZOQFOT))
{
@@ -961,11 +961,11 @@
if (CheckAlliance (ZOQFOTPIK_SHIP) == GOOD_GUY
|| LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{
- SET_GAME_STATE (BATTLE_SEGUE, 0);
+ setSegue (Segue_peace);
}
else
{
- SET_GAME_STATE (BATTLE_SEGUE, 1);
+ setSegue (Segue_hostile);
}
retval = &zoqfot_desc;
Modified: trunk/sc2/src/uqm/commglue.c
===================================================================
--- trunk/sc2/src/uqm/commglue.c 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/commglue.c 2012-02-24 19:52:10 UTC (rev 3772)
@@ -18,6 +18,8 @@
#include "commglue.h"
+#include "battle.h"
+ // For instantVictory
#include "races.h"
#include <stdarg.h>
@@ -310,6 +312,48 @@
}
}
+void
+setSegue (Segue segue)
+{
+ switch (segue)
+ {
+ case Segue_peace:
+ SET_GAME_STATE (BATTLE_SEGUE, 0);
+ break;
+ case Segue_hostile:
+ SET_GAME_STATE (BATTLE_SEGUE, 1);
+ break;
+ case Segue_victory:
+ instantVictory = TRUE;
+ SET_GAME_STATE (BATTLE_SEGUE, 1);
+ break;
+ case Segue_defeat:
+ SET_GAME_STATE (BATTLE_SEGUE, 0);
+ GLOBAL_SIS(CrewEnlisted) = (COUNT)~0;
+ GLOBAL(CurrentActivity) |= CHECK_RESTART;
+ break;
+ }
+}
+
+Segue
+getSegue (void)
+{
+ if (GET_GAME_STATE(BATTLE_SEGUE) == 0) {
+ if (GLOBAL_SIS(CrewEnlisted) == (COUNT)~0 &&
+ (GLOBAL(CurrentActivity) & CHECK_RESTART)) {
+ return Segue_defeat;
+ } else {
+ return Segue_peace;
+ }
+ } else /* GET_GAME_STATE(BATTLE_SEGUE) == 1) */ {
+ if (instantVictory) {
+ return Segue_victory;
+ } else {
+ return Segue_hostile;
+ }
+ }
+}
+
LOCDATA*
init_race (CONVERSATION comm_id)
{
Modified: trunk/sc2/src/uqm/commglue.h
===================================================================
--- trunk/sc2/src/uqm/commglue.h 2012-02-18 20:26:58 UTC (rev 3771)
+++ trunk/sc2/src/uqm/commglue.h 2012-02-24 19:52:10 UTC (rev 3772)
@@ -102,6 +102,22 @@
extern void construct_response (UNICODE *buf, int R /* promoted from
RESPONSE_REF */, ...);
+typedef enum {
+ Segue_peace,
+ // When initiating a conversation, open comms directly.
+ // When terminating a conversation, depart in peace.
+ Segue_hostile,
+ // When initiating a conversation, offer the choice to attack.
+ // When terminating a conversation, go into battle.
+ Segue_victory,
+ // (when terminating a conversation) instant victory
+ Segue_defeat,
+ // (when terminating a conversation) game over
+} Segue;
+
+void setSegue (Segue segue);
+Segue getSegue (void);
+
extern LOCDATA* init_race (CONVERSATION comm_id);
extern LOCDATA* init_arilou_comm (void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Mee...@us...> - 2012-02-18 20:27:04
|
Revision: 3771
http://sc2.svn.sourceforge.net/sc2/?rev=3771&view=rev
Author: Meep-Eep
Date: 2012-02-18 20:26:58 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Literacy.
Modified Paths:
--------------
trunk/sc2/src/libs/uio/debug.c
trunk/sc2/src/libs/uio/match.c
trunk/sc2/src/libs/uio/match.h
Modified: trunk/sc2/src/libs/uio/debug.c
===================================================================
--- trunk/sc2/src/libs/uio/debug.c 2012-02-13 01:10:40 UTC (rev 3770)
+++ trunk/sc2/src/libs/uio/debug.c 2012-02-18 20:26:58 UTC (rev 3771)
@@ -473,7 +473,7 @@
O_RDONLY, tempDir);
if (handles[i - 1] == NULL) {
if (errno == ENOENT) {
- // No match; we keep what's typed litterally.
+ // No match; we keep what's typed literally.
newArgs[i - 1] = argv[i];
continue;
}
@@ -703,7 +703,7 @@
match_MATCH_PREFIX);
} else {
dirList = uio_getDirList(debugContext->cwd, cpath, pattern,
- match_MATCH_LITTERAL);
+ match_MATCH_LITERAL);
}
#endif
if (dirList == NULL) {
Modified: trunk/sc2/src/libs/uio/match.c
===================================================================
--- trunk/sc2/src/libs/uio/match.c 2012-02-13 01:10:40 UTC (rev 3770)
+++ trunk/sc2/src/libs/uio/match.c 2012-02-18 20:26:58 UTC (rev 3771)
@@ -37,9 +37,9 @@
static inline match_MatchContext *match_allocMatchContext(void);
static inline void match_freeMatchContext(match_MatchContext *context);
-static inline match_LitteralContext *match_newLitteralContext(char *pattern);
-static inline match_LitteralContext *match_allocLitteralContext(void);
-static inline void match_freeLitteralContext(match_LitteralContext *context);
+static inline match_LiteralContext *match_newLiteralContext(char *pattern);
+static inline match_LiteralContext *match_allocLiteralContext(void);
+static inline void match_freeLiteralContext(match_LiteralContext *context);
static inline match_PrefixContext *match_newPrefixContext(char *pattern);
static inline match_PrefixContext *match_allocPrefixContext(void);
static inline void match_freePrefixContext(match_PrefixContext *context);
@@ -85,9 +85,9 @@
*contextPtr = match_allocMatchContext();
(*contextPtr)->type = type;
switch (type) {
- case match_MATCH_LITTERAL:
- result = match_prepareLitteral(pattern,
- &(*contextPtr)->u.litteral);
+ case match_MATCH_LITERAL:
+ result = match_prepareLiteral(pattern,
+ &(*contextPtr)->u.literal);
break;
case match_MATCH_PREFIX:
result = match_preparePrefix(pattern, &(*contextPtr)->u.prefix);
@@ -122,8 +122,8 @@
match_Result
match_matchPattern(match_MatchContext *context, const char *string) {
switch (context->type) {
- case match_MATCH_LITTERAL:
- return match_matchLitteral(context->u.litteral, string);
+ case match_MATCH_LITERAL:
+ return match_matchLiteral(context->u.literal, string);
case match_MATCH_PREFIX:
return match_matchPrefix(context->u.prefix, string);
case match_MATCH_SUFFIX:
@@ -168,8 +168,8 @@
switch (context->type) {
#if 0
- case match_MATCH_LITTERAL:
- return match_errorStringLitteral(context->u.litteral, result);
+ case match_MATCH_LITERAL:
+ return match_errorStringLiteral(context->u.literal, result);
case match_MATCH_PREFIX:
return match_errorStringPrefix(context->u.prefix, result);
case match_MATCH_SUFFIX:
@@ -193,8 +193,8 @@
void
match_freeContext(match_MatchContext *context) {
switch (context->type) {
- case match_MATCH_LITTERAL:
- match_freeLitteral(context->u.litteral);
+ case match_MATCH_LITERAL:
+ match_freeLiteral(context->u.literal);
break;
case match_MATCH_PREFIX:
match_freePrefix(context->u.prefix);
@@ -239,43 +239,43 @@
}
-// *** Litteral part ***
+// *** Literal part ***
match_Result
-match_prepareLitteral(const char *pattern,
- match_LitteralContext **contextPtr) {
- *contextPtr = match_newLitteralContext(uio_strdup(pattern));
+match_prepareLiteral(const char *pattern,
+ match_LiteralContext **contextPtr) {
+ *contextPtr = match_newLiteralContext(uio_strdup(pattern));
return match_OK;
}
match_Result
-match_matchLitteral(match_LitteralContext *context, const char *string) {
+match_matchLiteral(match_LiteralContext *context, const char *string) {
return (strcmp(context->pattern, string) == 0) ?
match_MATCH : match_NOMATCH;
}
void
-match_freeLitteral(match_LitteralContext *context) {
+match_freeLiteral(match_LiteralContext *context) {
uio_free(context->pattern);
- match_freeLitteralContext(context);
+ match_freeLiteralContext(context);
}
-static inline match_LitteralContext *
-match_newLitteralContext(char *pattern) {
- match_LitteralContext *result;
+static inline match_LiteralContext *
+match_newLiteralContext(char *pattern) {
+ match_LiteralContext *result;
- result = match_allocLitteralContext();
+ result = match_allocLiteralContext();
result->pattern = pattern;
return result;
}
-static inline match_LitteralContext *
-match_allocLitteralContext(void) {
- return uio_malloc(sizeof (match_LitteralContext));
+static inline match_LiteralContext *
+match_allocLiteralContext(void) {
+ return uio_malloc(sizeof (match_LiteralContext));
}
static inline void
-match_freeLitteralContext(match_LitteralContext *context) {
+match_freeLiteralContext(match_LiteralContext *context) {
uio_free(context);
}
Modified: trunk/sc2/src/libs/uio/match.h
===================================================================
--- trunk/sc2/src/libs/uio/match.h 2012-02-13 01:10:40 UTC (rev 3770)
+++ trunk/sc2/src/libs/uio/match.h 2012-02-18 20:26:58 UTC (rev 3771)
@@ -31,7 +31,7 @@
typedef enum {
- match_MATCH_LITTERAL = 0,
+ match_MATCH_LITERAL = 0,
match_MATCH_PREFIX,
match_MATCH_SUFFIX,
match_MATCH_SUBSTRING,
@@ -52,7 +52,7 @@
#define match_ECUSTOM -3
#define match_ENOTINIT -4
-typedef struct match_LitteralContext match_LitteralContext;
+typedef struct match_LiteralContext match_LiteralContext;
typedef struct match_PrefixContext match_PrefixContext;
typedef struct match_SuffixContext match_SuffixContext;
typedef struct match_SubStringContext match_SubStringContext;
@@ -87,7 +87,7 @@
struct match_MatchContext {
match_MatchType type;
union {
- match_LitteralContext *litteral;
+ match_LiteralContext *literal;
match_PrefixContext *prefix;
match_SuffixContext *suffix;
match_SubStringContext *subString;
@@ -100,7 +100,7 @@
} u;
};
-struct match_LitteralContext {
+struct match_LiteralContext {
char *pattern;
};
@@ -134,11 +134,11 @@
};
#endif
-match_Result match_prepareLitteral(const char *pattern,
- match_LitteralContext **contextPtr);
-match_Result match_matchLitteral(match_LitteralContext *context,
+match_Result match_prepareLiteral(const char *pattern,
+ match_LiteralContext **contextPtr);
+match_Result match_matchLiteral(match_LiteralContext *context,
const char *string);
-void match_freeLitteral(match_LitteralContext *context);
+void match_freeLiteral(match_LiteralContext *context);
match_Result match_preparePrefix(const char *pattern,
match_PrefixContext **contextPtr);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-13 01:10:46
|
Revision: 3770
http://sc2.svn.sourceforge.net/sc2/?rev=3770&view=rev
Author: avolkov
Date: 2012-02-13 01:10:40 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
Consolidate duplicate screen init functions
Modified Paths:
--------------
trunk/sc2/src/libs/graphics/sdl/opengl.c
trunk/sc2/src/libs/graphics/sdl/pure.c
trunk/sc2/src/libs/graphics/sdl/sdl_common.c
trunk/sc2/src/libs/graphics/sdl/sdl_common.h
Modified: trunk/sc2/src/libs/graphics/sdl/opengl.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/opengl.c 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/opengl.c 2012-02-13 01:10:40 UTC (rev 3770)
@@ -69,31 +69,7 @@
TFB_GL_ColorLayer };
-static SDL_Surface *
-Create_Screen (SDL_Surface *templat, int w, int h)
-{
- SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
- templat->format->BitsPerPixel,
- templat->format->Rmask, templat->format->Gmask,
- templat->format->Bmask, 0);
- if (newsurf == 0) {
- log_add (log_Error, "Couldn't create screen buffers: %s",
- SDL_GetError());
- }
- return newsurf;
-}
-
static int
-ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h)
-{
- if (*screen)
- SDL_FreeSurface (*screen);
- *screen = Create_Screen (templat, w, h);
-
- return *screen == 0 ? -1 : 0;
-}
-
-static int
AttemptColorDepth (int flags, int width, int height, int bpp)
{
int videomode_flags;
Modified: trunk/sc2/src/libs/graphics/sdl/pure.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/pure.c 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/pure.c 2012-02-13 01:10:40 UTC (rev 3770)
@@ -47,30 +47,6 @@
TFB_Pure_ScreenLayer,
TFB_Pure_ColorLayer };
-static SDL_Surface *
-Create_Screen (SDL_Surface *templat, int w, int h)
-{
- SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
- templat->format->BitsPerPixel,
- templat->format->Rmask, templat->format->Gmask,
- templat->format->Bmask, 0);
- if (newsurf == 0) {
- log_add (log_Error, "Couldn't create screen buffers: %s",
- SDL_GetError());
- }
- return newsurf;
-}
-
-static int
-ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h)
-{
- if (*screen)
- SDL_FreeSurface (*screen);
- *screen = Create_Screen (templat, w, h);
-
- return *screen == 0 ? -1 : 0;
-}
-
// We cannot rely on SDL_DisplayFormatAlpha() anymore. It can return
// formats that we do not expect (SDL v1.2.14 on Mac OSX). Mac likes
// ARGB surfaces, but SDL_DisplayFormatAlpha thinks that only RGBA are fast.
Modified: trunk/sc2/src/libs/graphics/sdl/sdl_common.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/sdl_common.c 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/sdl_common.c 2012-02-13 01:10:40 UTC (rev 3770)
@@ -352,3 +352,27 @@
{
return (SDL_SetGamma (gamma, gamma, gamma) == 0);
}
+
+SDL_Surface *
+Create_Screen (SDL_Surface *templat, int w, int h)
+{
+ SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
+ templat->format->BitsPerPixel,
+ templat->format->Rmask, templat->format->Gmask,
+ templat->format->Bmask, 0);
+ if (newsurf == 0) {
+ log_add (log_Error, "Couldn't create screen buffers: %s",
+ SDL_GetError());
+ }
+ return newsurf;
+}
+
+int
+ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h)
+{
+ if (*screen)
+ SDL_FreeSurface (*screen);
+ *screen = Create_Screen (templat, w, h);
+
+ return *screen == 0 ? -1 : 0;
+}
Modified: trunk/sc2/src/libs/graphics/sdl/sdl_common.h
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/sdl_common.h 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/sdl_common.h 2012-02-13 01:10:40 UTC (rev 3770)
@@ -48,4 +48,7 @@
SDL_Surface* TFB_DisplayFormatAlpha (SDL_Surface *surface);
+SDL_Surface* Create_Screen (SDL_Surface *templat, int w, int h);
+int ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h);
+
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-13 01:08:22
|
Revision: 3769
http://sc2.svn.sourceforge.net/sc2/?rev=3769&view=rev
Author: avolkov
Date: 2012-02-13 01:08:15 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
Change return type of IsVelocityZero() to reflect the real return value
Modified Paths:
--------------
trunk/sc2/src/uqm/velocity.h
Modified: trunk/sc2/src/uqm/velocity.h
===================================================================
--- trunk/sc2/src/uqm/velocity.h 2012-02-12 20:46:54 UTC (rev 3768)
+++ trunk/sc2/src/uqm/velocity.h 2012-02-13 01:08:15 UTC (rev 3769)
@@ -49,7 +49,7 @@
extern void DeltaVelocityComponents (VELOCITY_DESC *velocityptr, SIZE dx,
SIZE dy);
-static inline BOOLEAN
+static inline bool
IsVelocityZero (VELOCITY_DESC *vptr)
{
return vptr->vector.width == 0 && vptr->vector.height == 0 &&
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 20:47:00
|
Revision: 3768
http://sc2.svn.sourceforge.net/sc2/?rev=3768&view=rev
Author: avolkov
Date: 2012-02-12 20:46:54 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Do not leak MenuState.CurFrame in RestartMenu; bug #1156
Modified Paths:
--------------
trunk/sc2/src/uqm/restart.c
Modified: trunk/sc2/src/uqm/restart.c
===================================================================
--- trunk/sc2/src/uqm/restart.c 2012-02-12 20:18:33 UTC (rev 3767)
+++ trunk/sc2/src/uqm/restart.c 2012-02-12 20:46:54 UTC (rev 3768)
@@ -60,8 +60,7 @@
TEXT t;
UNICODE buf[64];
- s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
- pMS->CurFrame = s.frame;
+ s.frame = pMS->CurFrame;
GetFrameRect (s.frame, &r);
s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;
s.origin.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
@@ -300,6 +299,9 @@
SleepThreadUntil (FadeScreen (FadeAllToBlack, TimeOut));
if (TimeOut == ONE_SECOND / 8)
SleepThread (ONE_SECOND * 3);
+
+ pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
+
DrawRestartMenuGraphic (pMS);
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
@@ -314,7 +316,9 @@
}
Flash_terminate (pMS->flashContext);
+ pMS->flashContext = 0;
DestroyDrawable (ReleaseDrawable (pMS->CurFrame));
+ pMS->CurFrame = 0;
if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
return (FALSE); // timed out
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 20:18:39
|
Revision: 3767
http://sc2.svn.sourceforge.net/sc2/?rev=3767&view=rev
Author: avolkov
Date: 2012-02-12 20:18:33 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Cleanup mounted dirs upon exit; bug #1149; thanks to Louis Delacroix
Modified Paths:
--------------
trunk/sc2/src/options.c
trunk/sc2/src/options.h
trunk/sc2/src/uqm.c
Modified: trunk/sc2/src/options.c
===================================================================
--- trunk/sc2/src/options.c 2012-02-12 20:01:20 UTC (rev 3766)
+++ trunk/sc2/src/options.c 2012-02-12 20:18:33 UTC (rev 3767)
@@ -603,6 +603,31 @@
}
}
+void
+unprepareAllDirs (void)
+{
+ if (saveDir)
+ {
+ uio_closeDir (saveDir);
+ saveDir = 0;
+ }
+ if (meleeDir)
+ {
+ uio_closeDir (meleeDir);
+ meleeDir = 0;
+ }
+ if (contentDir)
+ {
+ uio_closeDir (contentDir);
+ contentDir = 0;
+ }
+ if (configDir)
+ {
+ uio_closeDir (configDir);
+ configDir = 0;
+ }
+}
+
bool
setGammaCorrection (float gamma)
{
Modified: trunk/sc2/src/options.h
===================================================================
--- trunk/sc2/src/options.h 2012-02-12 20:01:20 UTC (rev 3766)
+++ trunk/sc2/src/options.h 2012-02-12 20:18:33 UTC (rev 3767)
@@ -79,6 +79,7 @@
void prepareSaveDir (void);
void prepareAddons (const char **addons);
void prepareShadowAddons (const char **addons);
+void unprepareAllDirs (void);
BOOLEAN loadAddon (const char *addon);
int loadIndices (uio_DirHandle *baseDir);
Modified: trunk/sc2/src/uqm.c
===================================================================
--- trunk/sc2/src/uqm.c 2012-02-12 20:01:20 UTC (rev 3766)
+++ trunk/sc2/src/uqm.c 2012-02-12 20:18:33 UTC (rev 3767)
@@ -486,6 +486,7 @@
#if 0
unInitTempDir ();
#endif
+ unprepareAllDirs ();
uninitIO ();
UnInitThreadSystem ();
mem_uninit ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 20:01:26
|
Revision: 3766
http://sc2.svn.sourceforge.net/sc2/?rev=3766&view=rev
Author: avolkov
Date: 2012-02-12 20:01:20 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Remove dated SCREEN_DRAWABLE logic to allow for Screen FRAME cleanup; bug #1149
Modified Paths:
--------------
trunk/sc2/src/libs/graphics/gfxload.c
trunk/sc2/src/uqm/cleanup.c
Modified: trunk/sc2/src/libs/graphics/gfxload.c
===================================================================
--- trunk/sc2/src/libs/graphics/gfxload.c 2012-02-12 19:10:15 UTC (rev 3765)
+++ trunk/sc2/src/libs/graphics/gfxload.c 2012-02-12 20:01:20 UTC (rev 3766)
@@ -321,16 +321,8 @@
return (FALSE);
cel_ct = DrawablePtr->MaxIndex + 1;
+ FramePtr = DrawablePtr->Frame;
- if (DrawablePtr->Frame)
- {
- FramePtr = DrawablePtr->Frame;
- if (FramePtr->Type == SCREEN_DRAWABLE)
- {
- FramePtr = NULL;
- }
- }
-
HFree (handle);
if (FramePtr)
{
Modified: trunk/sc2/src/uqm/cleanup.c
===================================================================
--- trunk/sc2/src/uqm/cleanup.c 2012-02-12 19:10:15 UTC (rev 3765)
+++ trunk/sc2/src/uqm/cleanup.c 2012-02-12 20:01:20 UTC (rev 3766)
@@ -39,7 +39,9 @@
UninitResourceSystem ();
DestroyDrawable (ReleaseDrawable (Screen));
+ Screen = 0;
DestroyContext (ScreenContext);
+ ScreenContext = 0;
UninitVideoPlayer ();
UninitSound ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 19:10:21
|
Revision: 3765
http://sc2.svn.sourceforge.net/sc2/?rev=3765&view=rev
Author: avolkov
Date: 2012-02-12 19:10:15 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Cleanup colormaps upon exiting the game; bug #1149
Modified Paths:
--------------
trunk/sc2/src/libs/graphics/cmap.c
trunk/sc2/src/libs/graphics/dcqueue.c
trunk/sc2/src/libs/graphics/gfx_common.c
trunk/sc2/src/uqm.c
Modified: trunk/sc2/src/libs/graphics/cmap.c
===================================================================
--- trunk/sc2/src/libs/graphics/cmap.c 2012-02-12 02:41:11 UTC (rev 3764)
+++ trunk/sc2/src/libs/graphics/cmap.c 2012-02-12 19:10:15 UTC (rev 3765)
@@ -64,6 +64,10 @@
static Mutex maplock;
+static void release_colormap (TFB_ColorMap *map);
+static void delete_colormap (TFB_ColorMap *map);
+
+
void
InitColorMaps (void)
{
@@ -84,13 +88,23 @@
void
UninitColorMaps (void)
{
+ int i;
TFB_ColorMap *next;
+ for (i = 0; i < MAX_COLORMAPS; ++i)
+ {
+ TFB_ColorMap *map = colormaps[i];
+ if (!map)
+ continue;
+ release_colormap (map);
+ colormaps[i] = 0;
+ }
+
// free spares
- for ( ; poolhead; poolhead = next)
+ for ( ; poolhead; poolhead = next, --poolcount)
{
next = poolhead->next;
- HFree (poolhead);
+ delete_colormap (poolhead);
}
DestroyMutex (fadeLock);
@@ -155,6 +169,13 @@
return map;
}
+static void
+delete_colormap (TFB_ColorMap *map)
+{
+ FreeNativePalette (map->palette);
+ HFree (map);
+}
+
static inline void
free_colormap (TFB_ColorMap *map)
{
@@ -172,8 +193,7 @@
}
else
{ // don't need any more spares
- FreeNativePalette (map->palette);
- HFree (map);
+ delete_colormap (map);
}
}
@@ -193,7 +213,7 @@
return map;
}
-static inline void
+static void
release_colormap (TFB_ColorMap *map)
{
if (!map)
Modified: trunk/sc2/src/libs/graphics/dcqueue.c
===================================================================
--- trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-12 02:41:11 UTC (rev 3764)
+++ trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-12 19:10:15 UTC (rev 3765)
@@ -635,6 +635,13 @@
HFree (data);
break;
}
+ case TFB_DRAWCOMMANDTYPE_IMAGE:
+ {
+ TFB_ColorMap *cmap = DC.data.image.colormap;
+ if (cmap)
+ TFB_ReturnColorMap (cmap);
+ break;
+ }
case TFB_DRAWCOMMANDTYPE_SENDSIGNAL:
{
ClearSemaphore (DC.data.sendsignal.sem);
Modified: trunk/sc2/src/libs/graphics/gfx_common.c
===================================================================
--- trunk/sc2/src/libs/graphics/gfx_common.c 2012-02-12 02:41:11 UTC (rev 3764)
+++ trunk/sc2/src/libs/graphics/gfx_common.c 2012-02-12 19:10:15 UTC (rev 3765)
@@ -99,7 +99,7 @@
been processed. */
void
-FlushGraphics ()
+FlushGraphics (void)
{
TFB_DrawScreen_WaitForSignal ();
}
Modified: trunk/sc2/src/uqm.c
===================================================================
--- trunk/sc2/src/uqm.c 2012-02-12 02:41:11 UTC (rev 3764)
+++ trunk/sc2/src/uqm.c 2012-02-12 19:10:15 UTC (rev 3765)
@@ -467,9 +467,10 @@
// Not yet: TFB_UninitInput ();
unInitAudio ();
uninit_communication ();
- UninitColorMaps ();
// TODO: Merge into TFB_UninitGraphics when it goes live
TFB_PurgeDanglingGraphics ();
+ // Purge above refers to colormaps which have to be still up
+ UninitColorMaps ();
// Not yet: TFB_UninitGraphics ();
#ifdef NETPLAY
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 02:41:17
|
Revision: 3764
http://sc2.svn.sourceforge.net/sc2/?rev=3764&view=rev
Author: avolkov
Date: 2012-02-12 02:41:11 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Free the state-file data upon delete, from Louis Delacroix
Modified Paths:
--------------
trunk/sc2/src/uqm/state.c
Modified: trunk/sc2/src/uqm/state.c
===================================================================
--- trunk/sc2/src/uqm/state.c 2012-02-12 02:32:30 UTC (rev 3763)
+++ trunk/sc2/src/uqm/state.c 2012-02-12 02:41:11 UTC (rev 3764)
@@ -124,6 +124,8 @@
fp->used = 0;
fp->ptr = 0;
+ HFree (fp->data);
+ fp->data = 0;
}
DWORD
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 02:32:36
|
Revision: 3763
http://sc2.svn.sourceforge.net/sc2/?rev=3763&view=rev
Author: avolkov
Date: 2012-02-12 02:32:30 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Const-correctness for STRING resources; bug #1155; in part from Louis Delacroix
Modified Paths:
--------------
trunk/sc2/src/libs/reslib.h
trunk/sc2/src/libs/resource/resinit.c
Modified: trunk/sc2/src/libs/reslib.h
===================================================================
--- trunk/sc2/src/libs/reslib.h 2012-02-12 01:07:17 UTC (rev 3762)
+++ trunk/sc2/src/libs/reslib.h 2012-02-12 02:32:30 UTC (rev 3763)
@@ -37,6 +37,7 @@
typedef union {
DWORD num;
void *ptr;
+ const char *str;
} RESOURCE_DATA;
#define NULL_RESOURCE NULL
Modified: trunk/sc2/src/libs/resource/resinit.c
===================================================================
--- trunk/sc2/src/libs/resource/resinit.c 2012-02-12 01:07:17 UTC (rev 3762)
+++ trunk/sc2/src/libs/resource/resinit.c 2012-02-12 02:32:30 UTC (rev 3763)
@@ -139,7 +139,7 @@
static void
UseDescriptorAsRes (const char *descriptor, RESOURCE_DATA *resdata)
{
- resdata->ptr = (void *)descriptor;
+ resdata->str = descriptor;
}
static void
@@ -286,7 +286,7 @@
static void
RawDescriptor (RESOURCE_DATA *resdata, char *buf, unsigned int size)
{
- snprintf (buf, size, "%s", (char *)resdata->ptr);
+ snprintf (buf, size, "%s", resdata->str);
}
static void
@@ -475,12 +475,12 @@
{
RESOURCE_INDEX idx = _get_current_index_header ();
ResourceDesc *desc = lookupResourceDesc (idx, key);
- if (!desc || !desc->resdata.ptr || strcmp(desc->vtable->resType, "STRING"))
+ if (!desc || !desc->resdata.str || strcmp(desc->vtable->resType, "STRING"))
return "";
/* TODO: Work out exact STRING semantics, specifically, the lifetime of
* the returned value. If caller is allowed to reference the returned
* value forever, STRING has to be ref-counted. */
- return (const char *)desc->resdata.ptr;
+ return desc->resdata.str;
}
void
@@ -489,24 +489,24 @@
RESOURCE_INDEX idx = _get_current_index_header ();
ResourceDesc *desc = lookupResourceDesc (idx, key);
int srclen, dstlen;
- if (!desc || !desc->resdata.ptr || strcmp(desc->vtable->resType, "STRING"))
+ if (!desc || !desc->resdata.str || strcmp(desc->vtable->resType, "STRING"))
{
/* TODO: This is kind of roundabout. We can do better by refactoring newResourceDesc */
process_resource_desc(key, "STRING:undefined");
desc = lookupResourceDesc (idx, key);
}
srclen = strlen (value);
- dstlen = strlen (desc->resdata.ptr);
+ dstlen = strlen (desc->fname);
if (srclen > dstlen) {
char *newValue = HMalloc(srclen + 1);
char *oldValue = desc->fname;
log_add(log_Warning, "Reallocating string space for '%s'", key);
strncpy (newValue, value, srclen + 1);
- desc->resdata.ptr = newValue;
+ desc->resdata.str = newValue;
desc->fname = newValue;
HFree (oldValue);
} else {
- strncpy (desc->resdata.ptr, value, srclen + 1);
+ strncpy (desc->fname, value, srclen + 1);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-12 01:07:25
|
Revision: 3762
http://sc2.svn.sourceforge.net/sc2/?rev=3762&view=rev
Author: avolkov
Date: 2012-02-12 01:07:17 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Enable DEBUG_DCQ_THREADS for msvc Debug builds by default
Modified Paths:
--------------
trunk/sc2/build/msvc6/UrQuanMasters.dsp
Modified: trunk/sc2/build/msvc6/UrQuanMasters.dsp
===================================================================
--- trunk/sc2/build/msvc6/UrQuanMasters.dsp 2012-02-11 23:41:06 UTC (rev 3761)
+++ trunk/sc2/build/msvc6/UrQuanMasters.dsp 2012-02-12 01:07:17 UTC (rev 3762)
@@ -74,7 +74,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\src" /I "..\..\src\regex" /D "DEBUG" /D "_DEBUG" /D "DEBUG_TRACK_SEM" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "THREADLIB_SDL" /D "HAVE_OPENAL" /D "HAVE_ZIP" /D "HAVE_JOYSTICK" /D "NETPLAY" /D "ZLIB_DLL" /D "USE_INTERNAL_MIKMOD" /D "USE_PLATFORM_ACCEL" /FR /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\src" /I "..\..\src\regex" /D "DEBUG" /D "_DEBUG" /D "DEBUG_TRACK_SEM" /D "DEBUG_DCQ_THREADS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "THREADLIB_SDL" /D "HAVE_OPENAL" /D "HAVE_ZIP" /D "HAVE_JOYSTICK" /D "NETPLAY" /D "ZLIB_DLL" /D "USE_INTERNAL_MIKMOD" /D "USE_PLATFORM_ACCEL" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
@@ -101,7 +101,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\src" /I "..\..\src\regex" /D "DEBUG" /D "_DEBUG" /D "DEBUG_TRACK_SEM" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "THREADLIB_SDL" /D "HAVE_OPENAL" /D "HAVE_ZIP" /D "HAVE_JOYSTICK" /D "NETPLAY" /D "ZLIB_DLL" /D "USE_INTERNAL_MIKMOD" /FR /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\src" /I "..\..\src\regex" /D "DEBUG" /D "_DEBUG" /D "DEBUG_TRACK_SEM" /D "DEBUG_DCQ_THREADS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "THREADLIB_SDL" /D "HAVE_OPENAL" /D "HAVE_ZIP" /D "HAVE_JOYSTICK" /D "NETPLAY" /D "ZLIB_DLL" /D "USE_INTERNAL_MIKMOD" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-02-11 23:41:16
|
Revision: 3761
http://sc2.svn.sourceforge.net/sc2/?rev=3761&view=rev
Author: avolkov
Date: 2012-02-11 23:41:06 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
Quantum-erase GraphicsLock; Some changes needed to accomplish this:
* comm/trackplayer Callbacks are now queued instead of asynchronously called on the stream decoder thread
* libs/callback now guards the list with a mutex (called from different threads)
* only one thread (Starcon2Main) is allowed to queue draw commands right now; a sanity check is in place (define DEBUG_DCQ_THREADS)
Fixes: Alarms and Callbacks are used for more than just Netplay, reflect this.
Modified Paths:
--------------
trunk/sc2/ChangeLog
trunk/sc2/build/msvc6/UrQuanMasters.dsp
trunk/sc2/doc/devel/threads
trunk/sc2/src/libs/callback/callback.c
trunk/sc2/src/libs/callback/callback.h
trunk/sc2/src/libs/graphics/dcqueue.c
trunk/sc2/src/libs/sound/trackint.h
trunk/sc2/src/libs/sound/trackplayer.c
trunk/sc2/src/libs/sound/trackplayer.h
trunk/sc2/src/libs/video/video.c
trunk/sc2/src/libs/video/vidintrn.h
trunk/sc2/src/libs/video/vidplayer.c
trunk/sc2/src/uqm/battle.c
trunk/sc2/src/uqm/battle.h
trunk/sc2/src/uqm/build.c
trunk/sc2/src/uqm/clock.c
trunk/sc2/src/uqm/cnctdlg.c
trunk/sc2/src/uqm/comm/comandr/comandr.c
trunk/sc2/src/uqm/comm/druuge/druugec.c
trunk/sc2/src/uqm/comm/melnorm/melnorm.c
trunk/sc2/src/uqm/comm/starbas/starbas.c
trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c
trunk/sc2/src/uqm/comm.c
trunk/sc2/src/uqm/commglue.c
trunk/sc2/src/uqm/commglue.h
trunk/sc2/src/uqm/confirm.c
trunk/sc2/src/uqm/controls.h
trunk/sc2/src/uqm/credits.c
trunk/sc2/src/uqm/encount.c
trunk/sc2/src/uqm/flash.c
trunk/sc2/src/uqm/fmv.c
trunk/sc2/src/uqm/gameopt.c
trunk/sc2/src/uqm/hyper.c
trunk/sc2/src/uqm/intro.c
trunk/sc2/src/uqm/menu.c
trunk/sc2/src/uqm/outfit.c
trunk/sc2/src/uqm/pickship.c
trunk/sc2/src/uqm/planets/cargo.c
trunk/sc2/src/uqm/planets/devices.c
trunk/sc2/src/uqm/planets/generate/genchmmr.c
trunk/sc2/src/uqm/planets/generate/genmyc.c
trunk/sc2/src/uqm/planets/generate/genorz.c
trunk/sc2/src/uqm/planets/generate/genpet.c
trunk/sc2/src/uqm/planets/generate/genthrad.c
trunk/sc2/src/uqm/planets/generate/genutw.c
trunk/sc2/src/uqm/planets/generate/genvux.c
trunk/sc2/src/uqm/planets/lander.c
trunk/sc2/src/uqm/planets/pl_stuff.c
trunk/sc2/src/uqm/planets/planets.c
trunk/sc2/src/uqm/planets/plangen.c
trunk/sc2/src/uqm/planets/pstarmap.c
trunk/sc2/src/uqm/planets/report.c
trunk/sc2/src/uqm/planets/roster.c
trunk/sc2/src/uqm/planets/scan.c
trunk/sc2/src/uqm/planets/solarsys.c
trunk/sc2/src/uqm/restart.c
trunk/sc2/src/uqm/save.c
trunk/sc2/src/uqm/setup.c
trunk/sc2/src/uqm/setup.h
trunk/sc2/src/uqm/shipyard.c
trunk/sc2/src/uqm/sis.c
trunk/sc2/src/uqm/sis.h
trunk/sc2/src/uqm/starbase.c
trunk/sc2/src/uqm/starcon.c
trunk/sc2/src/uqm/supermelee/buildpick.c
trunk/sc2/src/uqm/supermelee/loadmele.c
trunk/sc2/src/uqm/supermelee/melee.c
trunk/sc2/src/uqm/supermelee/pickmele.c
trunk/sc2/src/uqm/uqmdebug.c
trunk/sc2/src/uqm/util.c
trunk/sc2/src/uqm.c
Removed Paths:
-------------
trunk/sc2/doc/devel/graphicslock
Modified: trunk/sc2/ChangeLog
===================================================================
--- trunk/sc2/ChangeLog 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/ChangeLog 2012-02-11 23:41:06 UTC (rev 3761)
@@ -1,4 +1,5 @@
Changes towards version 0.8:
+- Removed GraphicsLock and made comm callbacks queued - Alex
- Split debug key function into sync and async parts, paving the way
for GraphicsLock removal - Alex
- PageUp/PageDown now add/remove 10 fuel in the shipyard, from
Modified: trunk/sc2/build/msvc6/UrQuanMasters.dsp
===================================================================
--- trunk/sc2/build/msvc6/UrQuanMasters.dsp 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/build/msvc6/UrQuanMasters.dsp 2012-02-11 23:41:06 UTC (rev 3761)
@@ -3654,10 +3654,6 @@
# End Source File
# Begin Source File
-SOURCE=..\..\doc\devel\graphicslock
-# End Source File
-# Begin Source File
-
SOURCE=..\..\doc\devel\input
# End Source File
# Begin Source File
Deleted: trunk/sc2/doc/devel/graphicslock
===================================================================
--- trunk/sc2/doc/devel/graphicslock 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/doc/devel/graphicslock 2012-02-11 23:41:06 UTC (rev 3761)
@@ -1,104 +0,0 @@
-HOW TO NOT GET HOSED BY DOUBLE-LOCK/UNLOCKS WITH GraphicsLock
-
-For the kinds of modifications you're likely to be doing, there only a
-few functions that you must take care to ensure that you hold
-GraphicsLock before calling. There are also some general guidelines.
-
-GENERAL GUIDELINES
-
-- Don't hold the GraphicsLock in Generate* functions.
-
-- Always hold it while doing ship operations - they're all only called
- by RedrawQueue. (preprocess, postprocess, etc.)
-
-- On ConcludeTask, you must not be holding *anything* or you could
- cause a deadlock if the thread you're waiting to conclude needs
- whatever lock you hold before it can safely exit. It is
- acceptable to hold the GraphicsLock when merely calling
- Task_SetState.
-
-Specific Guidelines:
-
-Always hold the GraphicsLock when calling...
-
-- SetFlashRect in sis.c; this changes which part of the screen is
- flashing. Very common.
-
-- RedrawQueue in process.c; this is for updating all the the graphics
- for ship animations.
-
-- GetMeleeStarShip in pickmele.c. That this is extern at all is
- probably a sign of lousy code organization.
-
-- DoMenuOptions in hyper.c; this is a consequence of being called from
- a ship operation when in hyperspace, which means that it must assume
- that it's called with the GraphicsLock held.
-
-- DoDiscoveryReport in planets/report.c; this is called by the
- Generate* functions, which always start out not holding the Lock.
-
-- ClearSISRect and DeltaSISGauges in sis.c; you might call these if
- working on code that modifies fuel or crew somehow.
-
-THE GORY DETAILS
-
-[functionname] means that the function is static and demands lockedness.
-<functionname> means that the function is static and demands unlockedness.
-*functionname* means that the function is extern and demands lockedness
-(functionname) means that the function is extern and demands unlockedness.
-
-This information is incomplete, and the result of a fairly informal
-hand-analysis of the code. In the case of extern-requires-lock,
-context and calling sites have been tracked so that all such functions
-are reached.
-
-battle.c: (Battle)
-border.c: (DrawSISFrame)
-build.c: (ActivateStarShip)
-clock.c: (clock_task_func)
-comm.c: (ambient_anim_task) [SpewPhrases] (AlienTalkSegue)
- <DoCommunication> [HailAlien] (InitCommunication)
-confirm.c: (DoConfirmExit)
-credits.c: (Credits) (OutTakes)
-encount.c: <DoSelectAction> (InitEncounter) [DrawFadeText]
- (UninitEncounter) (EncounterBattle)
-fmv.c: (Introduction)
-gameopt.c: <FeedbackSetting> <FeedbackQuit> <DrawDescriptionString>
- <DoNaming> <DoSettings> <DoQuitMenu> [ShowSummary]
- <DoPickGame> <PickGame>
-hyper.c: *LoadHyperspace* *FreeHyperspace* *DoMenuOptions*
-init.c: *InitShips* *UninitShips*
-melee.c: [DrawPickFrame] (flash_selection_func) <DrawMeleeShipStrings>
- <DoLoadTeam> <DoSaveTeam> <DoEdit> <DoPickShip>
- <FreeMeleeInfo> <DoMelee>
-menu.c: (DrawMenuStateStrings)
-outfit.c: <DoInstallModule> (ChangeFuelQuantity) (DoOutfit)
-pickmele.c: *GetMeleeStarShip*
-pickship.c: <DoPickBattleShip> [GetArmadaStarShip]
-process.c: *RedrawQueue*
-restart.c: <DrawRestartMenu> <DoRestart> (StartGame)
-save.c: (SaveProblem)
-ship.c: *ship_preprocess*
-shipyard.c: (hangar_anim_func) <DrawRaceStrings> <ShowCombatShip>
- [CrewTransaction] <DoModifyShips> <DrawBluePrint>
- (DoShipyard)
-sis.c: *ClearSISRect* *DeltaSISGauges* (flash_rect_func)
- *SetFlashRect*
-starbase.c: (rotate_starbase) (DoStarBase)
-starcon.c: (arilou_gate_task) (Starcon2Main)
-utils.c: (PauseGame)
-cargo.c: (DrawCargoStrings) <DoDiscardCargo> (Cargo)
-devices.c: <DrawDevices> <DoManipulateDevices> (Devices)
-lander.c: <ScrollPlanetSide> [AnimateLaunch] <InitPlanetSide>
- <ReturnToOrbit> (PlanetSide) (InitLander)
-planets.c: (LoadPlanet) (FreePlanet)
-plangen.c: (rotate_planet_task)
-pstarmap.c: (flash_cursor_func) (DrawStarMap) [EraseCursor]
- <DoMoveCursor> [DoStarMap] (DoFlagshipCommands)
-report.c: [MakeReport] *DoDiscoveryReport*
-roster.c: (flash_ship_task) <DoModifyRoster>
-scan.c: <EraseCoarseScan> <PrintCoarseScanPC> <PrintCoarseScan3DO>
- <SetPlanetLoc> (flash_planet_loc_func) <PickPlanetSide>
- <DoScan> (ScanSystem)
-solarsys.c: <FreeSolarSys> (IPtask_func) <DrawInnerSystem>
- (ChangeSolarSys) <InitSolarSys>
Modified: trunk/sc2/doc/devel/threads
===================================================================
--- trunk/sc2/doc/devel/threads 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/doc/devel/threads 2012-02-11 23:41:06 UTC (rev 3761)
@@ -97,10 +97,7 @@
sleep if the mutex is already locked, and awaken once the mutex
becomes available. A Mutex must be unlocked by the same thread that
locked it, and a thread must never lock a mutex it has already locked
-(without unlocking it first). The most important Mutex in the program
-the GraphicsLock. Code in UQM that does things like change the
-screen's clipping rectangle always grabs the GraphicsLock first, to
-ensure that the screen doesn't go crazy.
+(without unlocking it first).
API:
Mutex CreateMutex (const char *name, DWORD syncClass);
Modified: trunk/sc2/src/libs/callback/callback.c
===================================================================
--- trunk/sc2/src/libs/callback/callback.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/callback/callback.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <sys/types.h>
+#include "libs/threadlib.h"
+
typedef struct CallbackLink CallbackLink;
#define CALLBACK_INTERNAL
@@ -38,16 +40,16 @@
static CallbackLink **callbacksEnd;
static CallbackLink *const *callbacksProcessEnd;
+static Mutex callbackListLock;
+
static inline void
CallbackList_lock(void) {
- // TODO
- // Necessary for reentrant operation
+ LockMutex(callbackListLock);
}
static inline void
CallbackList_unlock(void) {
- // TODO
- // Necessary for reentrant operation
+ UnlockMutex(callbackListLock);
}
#if 0
@@ -62,8 +64,16 @@
callbacks = NULL;
callbacksEnd = &callbacks;
callbacksProcessEnd = &callbacks;
+ callbackListLock = CreateMutex("Callback List Lock", SYNC_CLASS_TOPLEVEL);
}
+void
+Callback_uninit(void) {
+ // TODO: cleanup the queue?
+ DestroyMutex (callbackListLock);
+ callbackListLock = 0;
+}
+
// Callbacks are guaranteed to be called in the order that they are queued.
CallbackID
Callback_add(CallbackFunction callback, CallbackArg arg) {
Modified: trunk/sc2/src/libs/callback/callback.h
===================================================================
--- trunk/sc2/src/libs/callback/callback.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/callback/callback.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -33,6 +33,7 @@
typedef void (*CallbackFunction)(CallbackArg arg);
void Callback_init(void);
+void Callback_uninit(void);
CallbackID Callback_add(CallbackFunction callback, CallbackArg arg);
bool Callback_remove(CallbackID id);
void Callback_process(void);
Modified: trunk/sc2/src/libs/graphics/dcqueue.c
===================================================================
--- trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/graphics/dcqueue.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -216,6 +216,22 @@
UnlockRecursiveMutex (DCQ_Mutex);
}
+static void
+checkExclusiveThread (void)
+{
+#ifdef DEBUG_DCQ_THREADS
+ static uint32 exclusiveThreadId;
+ extern uint32 SDL_ThreadID(void);
+
+ // Only one thread is currently allowed to enqueue commands
+ // This is not a technical limitation but rather a semantical one atm.
+ if (!exclusiveThreadId)
+ exclusiveThreadId = SDL_ThreadID();
+ else
+ assert (SDL_ThreadID() == exclusiveThreadId);
+#endif
+}
+
void
TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
{
@@ -224,6 +240,8 @@
return;
}
+ checkExclusiveThread ();
+
if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE
&& _CurFramePtr->Type == SCREEN_DRAWABLE)
{
Modified: trunk/sc2/src/libs/sound/trackint.h
===================================================================
--- trunk/sc2/src/libs/sound/trackint.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/sound/trackint.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -17,6 +17,8 @@
#ifndef TRACKINT_H
#define TRACKINT_H
+#include "libs/callback.h"
+
struct tfb_soundchunk
{
TFB_SoundDecoder *decoder; // decoder for this chunk
@@ -24,7 +26,7 @@
int tag_me; // set for chunks with subtitles
uint32 track_num; // logical track #, comm code needs this
UNICODE *text; // subtitle text
- TFB_TrackCB callback; // comm callback, executed on chunk start
+ CallbackFunction callback; // comm callback, executed on chunk start
struct tfb_soundchunk *next;
};
Modified: trunk/sc2/src/libs/sound/trackplayer.c
===================================================================
--- trunk/sc2/src/libs/sound/trackplayer.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/sound/trackplayer.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -199,7 +199,8 @@
DoTrackTag (TFB_SoundChunk *chunk)
{
if (chunk->callback)
- chunk->callback ();
+ Callback_add(chunk->callback, 0);
+
cur_sub_chunk = chunk;
}
@@ -421,7 +422,7 @@
// XXX: This code and the entire trackplayer are begging to be overhauled
void
-SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, TFB_TrackCB cb)
+SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, CallbackFunction cb)
{
static UNICODE last_track_name[128] = "";
static unsigned long dec_offset = 0;
Modified: trunk/sc2/src/libs/sound/trackplayer.h
===================================================================
--- trunk/sc2/src/libs/sound/trackplayer.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/sound/trackplayer.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -20,9 +20,8 @@
#define TRACKPLAYER_H
#include "libs/compiler.h"
+#include "libs/callback.h"
-typedef void (*TFB_TrackCB) (void);
-
#define ACCEL_SCROLL_SPEED 300
extern void PlayTrack (void);
@@ -37,7 +36,7 @@
extern void FastReverse_Page (void);
extern void FastForward_Page (void);
-extern void SpliceTrack (UNICODE *filespec, UNICODE *textspec, UNICODE *TimeStamp, TFB_TrackCB cb);
+extern void SpliceTrack (UNICODE *filespec, UNICODE *textspec, UNICODE *TimeStamp, CallbackFunction cb);
extern void SpliceMultiTrack (UNICODE *TrackNames[], UNICODE *TrackText);
extern int GetTrackPosition (int in_units);
Modified: trunk/sc2/src/libs/video/video.c
===================================================================
--- trunk/sc2/src/libs/video/video.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/video/video.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -127,7 +127,6 @@
_cur_speech = 0;
_cur_video = NULL_VIDEO_REF;
- LockMutex (GraphicsLock);
// play video in the center of the screen
if (TFB_PlayVideo (vid, (ScreenWidth - vid->w) / 2,
(ScreenHeight - vid->h) / 2))
@@ -144,7 +143,6 @@
{
ret = NO_FMV;
}
- UnlockMutex (GraphicsLock);
return ret;
}
Modified: trunk/sc2/src/libs/video/vidintrn.h
===================================================================
--- trunk/sc2/src/libs/video/vidintrn.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/video/vidintrn.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -38,10 +38,4 @@
MUSIC_REF speechref;
};
-// XXX: There has to be a better way to synchronize gfx calls with the rest
-// of the game. The only thing we need to sync is the current context, and
-// even there only the cliprect. Perhaps a DCQ command that takes an
-// explicit cliprect would be better.
-extern Mutex GraphicsLock;
-
#endif
Modified: trunk/sc2/src/libs/video/vidplayer.c
===================================================================
--- trunk/sc2/src/libs/video/vidplayer.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/libs/video/vidplayer.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -143,14 +143,12 @@
vid->cur_frame = vid->decoder->cur_frame;
// draw the frame
- LockMutex (GraphicsLock);
// We have the cliprect precalculated and don't need the rest
oldContext = SetContext (NULL);
TFB_DrawScreen_Image (vid->frame,
vid->dst_rect.corner.x, vid->dst_rect.corner.y, 0, 0,
NULL, DRAW_REPLACE_MODE, TFB_SCREEN_MAIN);
SetContext (oldContext);
- UnlockMutex (GraphicsLock);
FlushGraphics (); // needed to prevent half-frame updates
// increase interframe with positive lag-count to allow audio to catch up
@@ -195,14 +193,12 @@
vid->cur_frame = vid->decoder->cur_frame;
- LockMutex (GraphicsLock);
// We have the cliprect precalculated and don't need the rest
oldContext = SetContext (NULL);
TFB_DrawScreen_Image (vid->frame,
vid->dst_rect.corner.x, vid->dst_rect.corner.y, 0, 0,
NULL, DRAW_REPLACE_MODE, TFB_SCREEN_MAIN);
SetContext (oldContext);
- UnlockMutex (GraphicsLock);
FlushGraphics (); // needed to prevent half-frame updates
if (vid->cur_frame == vid->loop_frame)
Modified: trunk/sc2/src/uqm/battle.c
===================================================================
--- trunk/sc2/src/uqm/battle.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/battle.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -302,7 +302,6 @@
}
#endif
- LockMutex (GraphicsLock);
if (bs->first_time)
{
r.corner.x = SIS_ORG_X;
@@ -325,7 +324,6 @@
ScreenTransition (3, &r);
}
UnbatchGraphics ();
- UnlockMutex (GraphicsLock);
if ((!(GLOBAL (CurrentActivity) & IN_BATTLE)) ||
(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
{
@@ -399,7 +397,6 @@
{
SIZE num_ships;
- LockMutex (GraphicsLock);
#if !(DEMO_MODE || CREATE_JOURNAL)
if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) {
@@ -469,9 +466,7 @@
bs.first_time = (BOOLEAN)(LOBYTE (GLOBAL (CurrentActivity)) ==
IN_HYPERSPACE);
- UnlockMutex (GraphicsLock);
DoInput (&bs, FALSE);
- LockMutex (GraphicsLock);
AbortBattle:
if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)
@@ -481,12 +476,10 @@
// Do not return to the main menu when a game is aborted,
// (just to the supermelee menu).
#ifdef NETPLAY
- UnlockMutex (GraphicsLock);
waitResetConnections(NetState_inSetup);
// A connection may already be in inSetup (set from
// GetMeleeStarship). This is not a problem, although
// it will generate a warning in debug mode.
- LockMutex (GraphicsLock);
#endif
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
@@ -514,7 +507,6 @@
UninitShips ();
FreeBattleSong ();
- UnlockMutex (GraphicsLock);
return (BOOLEAN) (num_ships < 0);
}
Modified: trunk/sc2/src/uqm/battle.h
===================================================================
--- trunk/sc2/src/uqm/battle.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/battle.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -31,8 +31,7 @@
#endif
// The callback function is called on every battle frame
-// with GraphicsLock held, just before the display queue
-// is drawn
+// just before the display queue is drawn
typedef void (BattleFrameCallback) (void);
typedef struct battlestate_struct {
Modified: trunk/sc2/src/uqm/build.c
===================================================================
--- trunk/sc2/src/uqm/build.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/build.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -144,9 +144,7 @@
InsertQueue (&GLOBAL (built_ship_q), hStarShip, hOldShip);
}
- LockMutex (GraphicsLock);
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
- UnlockMutex (GraphicsLock);
return i;
}
@@ -389,9 +387,7 @@
if (count > 0)
{
// Update the display.
- LockMutex (GraphicsLock);
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
- UnlockMutex (GraphicsLock);
}
return count;
Modified: trunk/sc2/src/uqm/clock.c
===================================================================
--- trunk/sc2/src/uqm/clock.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/clock.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -276,7 +276,6 @@
return (0);
}
-// This function must be called with GraphicsLock held.
void
GameClockTick (void)
{
@@ -299,7 +298,6 @@
UnlockMutex (clock_mutex);
}
-// This function must be called with GraphicsLock held.
void
MoveGameClockDays (COUNT days)
{
Modified: trunk/sc2/src/uqm/cnctdlg.c
===================================================================
--- trunk/sc2/src/uqm/cnctdlg.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/cnctdlg.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -531,14 +531,12 @@
r.corner.x = (SCREEN_WIDTH - r.extent.width) >> 1;
r.corner.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
- LockMutex (GraphicsLock);
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
menu.draw ((WIDGET *)&menu, r.corner.x + 10, r.corner.y + 10);
- UnlockMutex (GraphicsLock);
}
static BOOLEAN
Modified: trunk/sc2/src/uqm/comm/comandr/comandr.c
===================================================================
--- trunk/sc2/src/uqm/comm/comandr/comandr.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/comm/comandr/comandr.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -227,10 +227,8 @@
{
NPCPhrase (HERE_IS_A_NEW_LANDER);
++GLOBAL_SIS (NumLanders);
- LockMutex (GraphicsLock);
DrawLanders ();
DeltaSISGauges (4, 0, 0);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (LANDERS_LOST, 1);
}
@@ -238,27 +236,21 @@
{
NPCPhrase (HERE_IS_ANOTHER_LANDER);
++GLOBAL_SIS (NumLanders);
- LockMutex (GraphicsLock);
DrawLanders ();
DeltaSISGauges (4, 0, 0);
- UnlockMutex (GraphicsLock);
}
else if (PLAYER_SAID (R, need_fuel_mercury) ||
PLAYER_SAID (R, need_fuel_luna))
{
NPCPhrase (GIVE_FUEL);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
}
else if (PLAYER_SAID (R, need_fuel_again))
{
NPCPhrase (GIVE_FUEL_AGAIN);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
}
if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE]))
@@ -297,10 +289,8 @@
{
NPCPhrase (HERE_IS_A_NEW_LANDER);
++GLOBAL_SIS (NumLanders);
- LockMutex (GraphicsLock);
DrawLanders ();
DeltaSISGauges (4, 0, 0);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (LANDERS_LOST, 1);
}
@@ -308,27 +298,21 @@
{
NPCPhrase (HERE_IS_ANOTHER_LANDER);
++GLOBAL_SIS (NumLanders);
- LockMutex (GraphicsLock);
DrawLanders ();
DeltaSISGauges (4, 0, 0);
- UnlockMutex (GraphicsLock);
}
else if (PLAYER_SAID (R, need_fuel_mercury) ||
PLAYER_SAID (R, need_fuel_luna))
{
NPCPhrase (GIVE_FUEL);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
}
else if (PLAYER_SAID (R, need_fuel_again))
{
NPCPhrase (GIVE_FUEL_AGAIN);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
}
else if (PLAYER_SAID (R, where_get_radios))
{
@@ -399,10 +383,8 @@
{
NPCPhrase (HERE_IS_A_NEW_LANDER);
++GLOBAL_SIS (NumLanders);
- LockMutex (GraphicsLock);
DrawLanders ();
DeltaSISGauges (4, 0, 0);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (LANDERS_LOST, 1);
}
@@ -410,27 +392,21 @@
{
NPCPhrase (HERE_IS_ANOTHER_LANDER);
++GLOBAL_SIS (NumLanders);
- LockMutex (GraphicsLock);
DrawLanders ();
DeltaSISGauges (4, 0, 0);
- UnlockMutex (GraphicsLock);
}
else if (PLAYER_SAID (R, need_fuel_mercury) ||
PLAYER_SAID (R, need_fuel_luna))
{
NPCPhrase (GIVE_FUEL);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
}
else if (PLAYER_SAID (R, need_fuel_again))
{
NPCPhrase (GIVE_FUEL_AGAIN);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
}
else if (PLAYER_SAID (R, we_are_here_to_help))
{
@@ -593,9 +569,7 @@
NPCPhrase (FUEL_UP1);
AlienTalkSegue (1);
- LockMutex (GraphicsLock);
CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED;
- UnlockMutex (GraphicsLock);
XFormColorMap (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
Modified: trunk/sc2/src/uqm/comm/druuge/druugec.c
===================================================================
--- trunk/sc2/src/uqm/comm/druuge/druugec.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/comm/druuge/druugec.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -244,9 +244,7 @@
NPCPhrase (NOT_ENOUGH_ROOM);
else
{
- LockMutex (GraphicsLock);
DeltaSISGauges (-SHIP_CREW_COST, 0, 0);
- UnlockMutex (GraphicsLock);
SlaveryCount += SHIP_CREW_COST;
AddEscortShips (DRUUGE_SHIP, 1);
@@ -260,9 +258,7 @@
NPCPhrase (NOT_ENOUGH_CREW);
else
{
- LockMutex (GraphicsLock);
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
- UnlockMutex (GraphicsLock);
SlaveryCount += ARTIFACT_CREW_COST;
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
SET_GAME_STATE (ROSY_SPHERE, 1);
@@ -276,9 +272,7 @@
NPCPhrase (NOT_ENOUGH_CREW);
else
{
- LockMutex (GraphicsLock);
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
- UnlockMutex (GraphicsLock);
SlaveryCount += ARTIFACT_CREW_COST;
SET_GAME_STATE (ARTIFACT_2_ON_SHIP, 1);
@@ -291,9 +285,7 @@
NPCPhrase (NOT_ENOUGH_CREW);
else
{
- LockMutex (GraphicsLock);
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
- UnlockMutex (GraphicsLock);
SlaveryCount += ARTIFACT_CREW_COST;
SET_GAME_STATE (ARTIFACT_3_ON_SHIP, 1);
@@ -307,10 +299,8 @@
NPCPhrase (NOT_ENOUGH_CREW);
else
{
- LockMutex (GraphicsLock);
DeltaSISGauges (-FUEL_CREW_COST,
FUEL_CREW_COST * FUEL_TANK_SCALE, 0);
- UnlockMutex (GraphicsLock);
SlaveryCount += FUEL_CREW_COST;
NPCPhrase (BOUGHT_FUEL);
@@ -466,14 +456,12 @@
capacity -= GLOBAL_SIS (FuelOnBoard);
f = (COUNT)((capacity + (FUEL_TANK_SCALE >> 1)) / FUEL_TANK_SCALE);
- LockMutex (GraphicsLock);
while (capacity > 0x3FFFL)
{
DeltaSISGauges (0, 0x3FFF, 0);
capacity -= 0x3FFF;
}
DeltaSISGauges (0, (SIZE)capacity, 0);
- UnlockMutex (GraphicsLock);
NPCPhrase (FUEL0);
NPCNumber (f, NULL);
Modified: trunk/sc2/src/uqm/comm/melnorm/melnorm.c
===================================================================
--- trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -21,8 +21,6 @@
#include "strings.h"
#include "uqm/gameev.h"
-#include "uqm/setup.h"
- // for GraphicsLock
#include "uqm/shipcont.h"
#include "libs/inplib.h"
#include "libs/mathlib.h"
@@ -590,9 +588,7 @@
if (fuel_required == 0)
{
GlobData.SIS_state = SIS_copy;
- LockMutex (GraphicsLock);
DeltaSISGauges (UNDEFINED_DELTA, rescue_fuel, UNDEFINED_DELTA);
- UnlockMutex (GraphicsLock);
}
else if (fuel_required == (COUNT)~0)
{
@@ -616,9 +612,7 @@
GLOBAL_SIS (ModuleSlots[i]) = EMPTY_SLOT + 2;
}
- LockMutex (GraphicsLock);
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
- UnlockMutex (GraphicsLock);
}
else if (fuel_required)
{
@@ -735,9 +729,7 @@
if (total == 0)
{
NPCPhrase (CHARITY);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, fuel_required, 0);
- UnlockMutex (GraphicsLock);
return (FALSE);
}
else
@@ -891,9 +883,7 @@
{
Credit += delta_credit;
SetAvailableCredits (Credit);
- LockMutex (GraphicsLock);
DrawStatusMessage (NULL);
- UnlockMutex (GraphicsLock);
return true;
}
@@ -1045,14 +1035,12 @@
NPCPhrase (GOT_FUEL);
f = (DWORD)needed_credit * FUEL_TANK_SCALE;
- LockMutex (GraphicsLock);
while (f > 0x3FFFL)
{
DeltaSISGauges (0, 0x3FFF, 0);
f -= 0x3FFF;
}
DeltaSISGauges (0, (SIZE)f, 0);
- UnlockMutex (GraphicsLock);
}
needed_credit *= (BIO_CREDIT_VALUE / 2);
}
@@ -1251,9 +1239,7 @@
} while (GLOBAL_SIS (TotalBioMass));
SleepThread (ONE_SECOND / 2);
- LockMutex (GraphicsLock);
ClearSISRect (DRAW_SIS_DISPLAY);
- UnlockMutex (GraphicsLock);
}
else /* if (R == sell_rainbow_locations) */
{
@@ -1838,11 +1824,9 @@
static void
post_melnorme_enc (void)
{
- LockMutex (GraphicsLock);
if (prevMsgMode != SMM_UNDEFINED)
SetStatusMessageMode (prevMsgMode);
DrawStatusMessage (NULL);
- UnlockMutex (GraphicsLock);
}
LOCDATA*
Modified: trunk/sc2/src/uqm/comm/starbas/starbas.c
===================================================================
--- trunk/sc2/src/uqm/comm/starbas/starbas.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/comm/starbas/starbas.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -1656,9 +1656,7 @@
else
NPCPhrase (GLOBAL_SHIP_NAME);
NPCPhrase (STARBASE_IS_READY_C);
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 0, 2500);
- UnlockMutex (GraphicsLock);
SET_GAME_STATE (STARBASE_MONTH,
GLOBAL (GameClock.month_index));
SET_GAME_STATE (STARBASE_DAY,
@@ -1770,9 +1768,7 @@
Sleepy = FALSE;
GLOBAL_SIS (ElementAmounts[i]) = 0;
GLOBAL_SIS (TotalElementMass) -= amount;
- LockMutex (GraphicsLock);
DeltaSISGauges (0, 0, amount * GLOBAL (ElementWorth[i]));
- UnlockMutex (GraphicsLock);
break;
}
@@ -1781,10 +1777,8 @@
TaskSwitch ();
TimeIn = GetTimeCounter ();
DrawCargoStrings ((BYTE)i, (BYTE)i);
- LockMutex (GraphicsLock);
ShowRemainingCapacity ();
DeltaSISGauges (0, 0, GLOBAL (ElementWorth[i]));
- UnlockMutex (GraphicsLock);
} while (--amount);
}
if (Sleepy) {
@@ -1794,9 +1788,7 @@
}
SleepThread (ONE_SECOND / 2);
- LockMutex (GraphicsLock);
ClearSISRect (DRAW_SIS_DISPLAY);
- UnlockMutex (GraphicsLock);
// DrawStorageBays (FALSE);
if (total < 1000)
Modified: trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c
===================================================================
--- trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/comm/zoqfot/zoqfotc.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -118,15 +118,12 @@
static int LastAlien;
+// Queued and executes synchronously on the Starcon2Main thread
static void
-SelectAlienZOQ (void)
+SelectAlienZOQ (CallbackArg arg)
{
if (LastAlien != ZOQ_ALIEN)
{
- // XXX: This should hold the GraphicsLock to block comm anims and
- // prevent CommData half-updates, but if we do so, the stream
- // decoder will deadlock with the drawing thread.
-
// Transition to neutral state first if Pik was talking
if (LastAlien != FOT_ALIEN)
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
@@ -142,17 +139,16 @@
CommData.AlienTextFColor = ZOQ_FG_COLOR;
CommData.AlienTextBColor = ZOQ_BG_COLOR;
}
+
+ (void)arg; // ignored
}
+// Queued and executes synchronously on the Starcon2Main thread
static void
-SelectAlienPIK (void)
+SelectAlienPIK (CallbackArg arg)
{
if (LastAlien != PIK_ALIEN)
{
- // XXX: This should hold the GraphicsLock to block comm anims and
- // prevent CommData half-updates, but if we do so, the stream
- // decoder will deadlock with the drawing thread.
-
// Transition to neutral state first if Zoq was talking
if (LastAlien != FOT_ALIEN)
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
@@ -168,13 +164,15 @@
CommData.AlienTextFColor = PIK_FG_COLOR;
CommData.AlienTextBColor = PIK_BG_COLOR;
}
+
+ (void)arg; // ignored
}
static void
ZFPTalkSegue (COUNT wait_track)
{
LastAlien = FOT_ALIEN;
- SelectAlienZOQ ();
+ SelectAlienZOQ (0);
AlienTalkSegue (wait_track);
}
Modified: trunk/sc2/src/uqm/comm.c
===================================================================
--- trunk/sc2/src/uqm/comm.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/comm.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -632,13 +632,11 @@
CheckSubtitles ();
}
- LockMutex (GraphicsLock);
// XXX: When seeking, all animations (talking and ambient) stop
// progressing. This is an original 3DO behavior, and I see no
// reason why the animations cannot continue while seeking.
UpdateAnimations (pTS->seeking);
UpdateSpeechGraphics ();
- UnlockMutex (GraphicsLock);
curTrack = PlayingTrack ();
pTS->ended = !pTS->seeking && !curTrack;
@@ -653,9 +651,7 @@
static void
runCommAnimFrame (void)
{
- LockMutex (GraphicsLock);
UpdateCommGraphics ();
- UnlockMutex (GraphicsLock);
SleepThread (COMM_ANIM_RATE);
}
@@ -764,13 +760,11 @@
if (!pCurInputState->Initialized)
{
InitSpeechGraphics ();
- LockMutex (GraphicsLock);
SetColorMap (GetColorMapAddress (CommData.AlienColorMap));
SetContext (AnimContext);
DrawAlienFrame (NULL, 0, TRUE);
UpdateSpeechGraphics ();
CommIntroTransition ();
- UnlockMutex (GraphicsLock);
pCurInputState->Initialized = TRUE;
@@ -845,7 +839,6 @@
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2;
- LockMutex (GraphicsLock);
SetContext (AnimContext);
SetContextForeGroundColor (COMM_HISTORY_BACKGROUND_COLOR);
DrawFilledRectangle (&r);
@@ -914,7 +907,6 @@
font_DrawText (&mt);
}
- UnlockMutex (GraphicsLock);
pSS->PrintNext = FALSE;
}
@@ -934,9 +926,7 @@
&pES->response_list[pES->cur_response].response_text;
utf8StringCopy (pES->phrase_buf, sizeof pES->phrase_buf,
response_text->pStr);
- LockMutex (GraphicsLock);
FeedbackPlayerPhrase (pES->phrase_buf);
- UnlockMutex (GraphicsLock);
StopTrack ();
ClearSubtitles ();
SetSliderImage (SetAbsFrameIndex (ActivityFrame, 2));
@@ -955,29 +945,23 @@
{
SUMMARY_STATE SummaryState;
- LockMutex (GraphicsLock);
if (pES)
FeedbackPlayerPhrase (pES->phrase_buf);
- UnlockMutex (GraphicsLock);
SummaryState.Initialized = FALSE;
DoConvSummary (&SummaryState);
- LockMutex (GraphicsLock);
if (pES)
RefreshResponses (pES);
clear_subtitles = TRUE;
- UnlockMutex (GraphicsLock);
}
static void
SelectReplay (ENCOUNTER_STATE *pES)
{
FadeMusic (BACKGROUND_VOL, ONE_SECOND);
- LockMutex (GraphicsLock);
if (pES)
FeedbackPlayerPhrase (pES->phrase_buf);
- UnlockMutex (GraphicsLock);
TalkSegue (0);
}
@@ -990,9 +974,7 @@
if (pES->top_response == (BYTE)~0)
{
pES->top_response = 0;
- LockMutex (GraphicsLock);
RefreshResponses (pES);
- UnlockMutex (GraphicsLock);
}
if (PulsedInputState.menu[KEY_MENU_SELECT])
@@ -1013,9 +995,7 @@
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
{
- LockMutex (GraphicsLock);
RefreshResponses (pES);
- UnlockMutex (GraphicsLock);
FadeMusic (FOREGROUND_VOL, ONE_SECOND);
}
}
@@ -1029,7 +1009,6 @@
{
COORD y;
- LockMutex (GraphicsLock);
BatchGraphics ();
add_text (-2,
&pES->response_list[pES->cur_response].response_text);
@@ -1049,12 +1028,9 @@
RefreshResponses (pES);
}
UnbatchGraphics ();
- UnlockMutex (GraphicsLock);
}
- LockMutex (GraphicsLock);
UpdateCommGraphics ();
- UnlockMutex (GraphicsLock);
SleepThreadUntil (pES->NextTime);
pES->NextTime = GetTimeCounter () + COMM_ANIM_RATE;
@@ -1094,9 +1070,7 @@
pLRS->TimeOut = FadeMusic (0, ONE_SECOND * 2) + ONE_SECOND / 60;
}
- LockMutex (GraphicsLock);
UpdateCommGraphics ();
- UnlockMutex (GraphicsLock);
SleepThreadUntil (pLRS->NextTime);
pLRS->NextTime = GetTimeCounter () + COMM_ANIM_RATE;
@@ -1135,11 +1109,9 @@
return TRUE;
}
- LockMutex (GraphicsLock);
SetContext (SpaceContext);
DestroyContext (AnimContext);
AnimContext = NULL;
- UnlockMutex (GraphicsLock);
FlushColorXForms ();
ClearSubtitles ();
@@ -1228,7 +1200,6 @@
SubtitleText.baseline = CommData.AlienTextBaseline;
SubtitleText.align = CommData.AlienTextAlign;
- LockMutex (GraphicsLock);
// init subtitle cache context
TextCacheContext = CreateContext ("TextCacheContext");
@@ -1293,7 +1264,6 @@
DrawSISComWindow ();
}
- UnlockMutex (GraphicsLock);
LastActivity |= CHECK_LOAD; /* prevent spurious input */
(*CommData.init_encounter_func) ();
@@ -1302,10 +1272,8 @@
(*CommData.post_encounter_func) ();
(*CommData.uninit_encounter_func) ();
- LockMutex (GraphicsLock);
SetContext (SpaceContext);
SetContextFont (OldFont);
- UnlockMutex (GraphicsLock);
DestroyStringTable (ReleaseStringTable (CommData.ConversationPhrases));
DestroyMusic (CommData.AlienSong);
@@ -1343,7 +1311,6 @@
return 0;
#endif
- LockMutex (GraphicsLock);
if (LastActivity & CHECK_LOAD)
{
@@ -1369,7 +1336,6 @@
}
}
- UnlockMutex (GraphicsLock);
if (which_comm == URQUAN_DRONE_CONVERSATION)
{
Modified: trunk/sc2/src/uqm/commglue.c
===================================================================
--- trunk/sc2/src/uqm/commglue.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/commglue.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -28,8 +28,10 @@
static int NPCNumberPhrase (int number, const char *fmt, UNICODE **ptrack);
+// The CallbackFunction is queued and executes synchronously
+// on the Starcon2Main thread
void
-NPCPhrase_cb (int index, TFB_TrackCB cb)
+NPCPhrase_cb (int index, CallbackFunction cb)
{
UNICODE *pStr, buf[400];
void *pClip, *pTimeStamp;
Modified: trunk/sc2/src/uqm/commglue.h
===================================================================
--- trunk/sc2/src/uqm/commglue.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/commglue.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -22,6 +22,7 @@
#include "globdata.h"
#include "resinst.h"
#include "libs/sound/trackplayer.h"
+#include "libs/callback.h"
#if defined(__cplusplus)
extern "C" {
@@ -88,7 +89,9 @@
response_func, UNICODE *ContstructStr);
extern void DoNPCPhrase (UNICODE *pStr);
-extern void NPCPhrase_cb (int index, TFB_TrackCB cb);
+// The CallbackFunction is queued and executes synchronously
+// on the Starcon2Main thread
+extern void NPCPhrase_cb (int index, CallbackFunction cb);
#define NPCPhrase(index) NPCPhrase_cb ((index), NULL)
extern void NPCPhrase_splice (int index);
extern void NPCNumber (int number, const char *fmt);
Modified: trunk/sc2/src/uqm/confirm.c
===================================================================
--- trunk/sc2/src/uqm/confirm.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/confirm.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -85,7 +85,6 @@
PauseFlash ();
- LockMutex (GraphicsLock);
{
RECT r;
STAMP s;
@@ -160,7 +159,6 @@
SetContextClipRect (&oldRect);
SetContext (oldContext);
}
- UnlockMutex (GraphicsLock);
ContinueFlash ();
@@ -217,7 +215,6 @@
label.lines = lines;
PauseFlash ();
- LockMutex (GraphicsLock);
oldContext = SetContext (ScreenContext);
GetContextClipRect (&oldRect);
@@ -246,7 +243,6 @@
DestroyDrawable (ReleaseDrawable (s.frame));
SetContextClipRect (&oldRect);
SetContext (oldContext);
- UnlockMutex (GraphicsLock);
ContinueFlash ();
SetMenuSounds (s0, s1);
StringBank_Free (bank);
Modified: trunk/sc2/src/uqm/controls.h
===================================================================
--- trunk/sc2/src/uqm/controls.h 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/controls.h 2012-02-11 23:41:06 UTC (rev 3761)
@@ -119,9 +119,6 @@
void DoPopupWindow(const char *msg);
typedef void (InputFrameCallback) (void);
-// Anything using input callbacks MUST NOT keep GraphicsLock across
-// InputFunc executions. This also means NOT holding GraphicsLock
-// when calling DoInput().
InputFrameCallback* SetInputCallback (InputFrameCallback *);
// pInputState must point to a struct derived from INPUT_STATE_DESC
void DoInput (void *pInputState, BOOLEAN resetInput);
Modified: trunk/sc2/src/uqm/credits.c
===================================================================
--- trunk/sc2/src/uqm/credits.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/credits.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -240,7 +240,6 @@
t.pStr = " ";
t.CharCount = 1;
- LockMutex (GraphicsLock);
OldContext = SetContext (TempContext);
// get font dimensions
@@ -312,7 +311,6 @@
SetContextFGFrame (OldFrame);
SetContext (OldContext);
- UnlockMutex (GraphicsLock);
return f;
}
@@ -331,7 +329,6 @@
STAMP s;
int i;
- LockMutex (GraphicsLock);
oldContext = SetContext (targetContext);
// draw background
s.origin.x = 0;
@@ -358,7 +355,6 @@
}
SetContext (oldContext);
- UnlockMutex (GraphicsLock);
}
static void
@@ -373,7 +369,6 @@
LocalContext = CreateContext ("Credits.LocalContext");
DrawContext = CreateContext ("Credits.DrawContext");
- LockMutex (GraphicsLock);
targetFrame = GetContextFGFrame ();
GetContextClipRect (&ctxRect);
CreditsExtent = ctxRect.extent;
@@ -402,7 +397,6 @@
SetContextFGFrame (targetFrame);
SetContext (oldContext);
- UnlockMutex (GraphicsLock);
// Prepare the first screen frame
RenderCreditsScreen (LocalContext);
@@ -493,12 +487,10 @@
s.origin.y = 0;
s.frame = CreditsFrame;
- LockMutex (GraphicsLock);
OldContext = SetContext (DrawContext);
DrawStamp (&s);
SetContext (OldContext);
FlushGraphics ();
- UnlockMutex (GraphicsLock);
// prepare next screen frame
deficitHeight = calcDeficitHeight ();
@@ -782,13 +774,11 @@
hMusic = LoadMusic (CREDITS_MUSIC);
- LockMutex (GraphicsLock);
SetContext (ScreenContext);
SetContextClipRect (NULL);
GetContextClipRect (&screenRect);
SetContextBackGroundColor (BLACK_COLOR);
ClearDrawable ();
- UnlockMutex (GraphicsLock);
if (!LoadCredits ())
return;
@@ -797,10 +787,8 @@
s.origin.x = 0;
s.origin.y = 0;
s.frame = CreditsBack;
- LockMutex (GraphicsLock);
DrawStamp (&s);
FadeScreen (FadeAllToColor, ONE_SECOND / 2);
- UnlockMutex (GraphicsLock);
// set the position of outtakes comm
CommWndRect.corner.x = (screenRect.extent.width - CommWndRect.extent.width)
@@ -836,11 +824,9 @@
FadeMusic (0, ONE_SECOND / 2);
UninitCredits ();
- LockMutex (GraphicsLock);
SetContext (ScreenContext);
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
FlushColorXForms ();
- UnlockMutex (GraphicsLock);
if (hMusic)
{
Modified: trunk/sc2/src/uqm/encount.c
===================================================================
--- trunk/sc2/src/uqm/encount.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/encount.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -78,9 +78,7 @@
if (!GameOptions ())
return FALSE;
DrawMenuStateStrings (PM_CONVERSE, pMS->CurState);
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
break;
default:
printf ("Unknown option: %d\n", pMS->CurState);
@@ -270,7 +268,6 @@
extern FRAME planet[];
MUSIC_REF MR;
- LockMutex (GraphicsLock);
SetContext (SpaceContext);
SetContextFont (TinyFont);
@@ -278,11 +275,9 @@
MR = LoadMusic (REDALERT_MUSIC);
PlayMusic (MR, FALSE, 1);
SegueFrame = CaptureDrawable (LoadGraphic (SEGUE_PMAP_ANIM));
- UnlockMutex (GraphicsLock);
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
StopMusic ();
DestroyMusic (MR);
- LockMutex (GraphicsLock);
s.origin.x = s.origin.y = 0;
SetTransitionSource (NULL);
@@ -394,7 +389,6 @@
DestroyDrawable (ReleaseDrawable (SegueFrame));
ScreenTransition (3, NULL);
- UnlockMutex (GraphicsLock);
{
MENU_STATE MenuState;
@@ -403,15 +397,11 @@
MenuState.Initialized = FALSE;
DrawMenuStateStrings (PM_CONVERSE, MenuState.CurState = HAIL);
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
DoInput (&MenuState, TRUE);
- LockMutex (GraphicsLock);
SetFlashRect (NULL);
- UnlockMutex (GraphicsLock);
return (MenuState.CurState);
}
@@ -451,10 +441,8 @@
{
for (i = 0; i < (SIZE) NUM_FADES; ++i)
{
- UnlockMutex (GraphicsLock);
if (AnyButtonPress (TRUE))
i = NUM_FADES - 1;
- LockMutex (GraphicsLock);
SetContextForeGroundColor (fade_cycle[i]);
font_DrawText (&t1);
@@ -467,10 +455,8 @@
{
for (i = NUM_FADES - 1; i >= 0; --i)
{
- UnlockMutex (GraphicsLock);
if (AnyButtonPress (TRUE))
i = 0;
- LockMutex (GraphicsLock);
SetContextForeGroundColor (fade_cycle[i]);
font_DrawText (&t1);
@@ -492,7 +478,6 @@
ships_killed = 0;
- LockMutex (GraphicsLock);
free_gravity_well ();
if ((GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
@@ -702,10 +687,8 @@
TimeCount Time = GetTimeCounter ();
for (j = 0; j < NUM_SHIP_FADES; ++j)
{
- UnlockMutex (GraphicsLock);
Sleepy = (BOOLEAN)!AnyButtonPress (TRUE) &&
!(GLOBAL (CurrentActivity) & CHECK_ABORT);
- LockMutex (GraphicsLock);
if (!Sleepy)
break;
@@ -738,9 +721,7 @@
DestroyDrawable (ReleaseDrawable (s.frame));
#endif /* NEVER */
- UnlockMutex (GraphicsLock);
WaitForAnyButton (TRUE, ONE_SECOND * 3, FALSE);
- LockMutex (GraphicsLock);
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
{
DrawFadeText (str1, str2, FALSE, &scavenge_r);
@@ -766,9 +747,7 @@
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7);
// "Scavenged"
DrawFadeText (str1, str2, TRUE, &scavenge_r);
- UnlockMutex (GraphicsLock);
WaitForAnyButton (TRUE, ONE_SECOND * 2, FALSE);
- LockMutex (GraphicsLock);
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
DrawFadeText (str1, str2, FALSE, &scavenge_r);
}
@@ -787,7 +766,6 @@
}
}
ExitUninitEncounter:
- UnlockMutex (GraphicsLock);
return (ships_killed);
}
@@ -799,7 +777,6 @@
extern UWORD nth_frame;
InputContext *savedPlayerInput = NULL;
- LockMutex (GraphicsLock);
SET_GAME_STATE (BATTLE_SEGUE, 1);
@@ -838,9 +815,7 @@
GameSounds = CaptureSound (LoadSound (GAME_SOUNDS));
- UnlockMutex (GraphicsLock);
Battle (NULL);
- LockMutex (GraphicsLock);
DestroySound (ReleaseSound (GameSounds));
GameSounds = 0;
@@ -864,6 +839,5 @@
GLOBAL (CurrentActivity) = OldActivity;
- UnlockMutex (GraphicsLock);
}
Modified: trunk/sc2/src/uqm/flash.c
===================================================================
--- trunk/sc2/src/uqm/flash.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/flash.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -36,8 +36,6 @@
#define FLASH_INTERNAL
#include "flash.h"
-#include "setup.h"
- // For GraphicsLock.
#include "libs/log.h"
#include "libs/memlib.h"
#include "libs/threadlib.h"
@@ -545,7 +543,6 @@
if (context->original != (FRAME) 0)
DestroyDrawable (ReleaseDrawable (context->original));
- LockMutex (GraphicsLock);
oldGfxContext = SetContext (context->gfxContext);
context->original = CaptureDrawable (CopyContextRect (&context->rect));
SetContext (oldGfxContext);
@@ -553,7 +550,6 @@
// CopyContextRect() may have queued the command to read
// a rectangle from the screen; a FlushGraphics()
// is necessary to ensure that it can actually be used.
- UnlockMutex (GraphicsLock);
}
static inline void
@@ -589,7 +585,6 @@
Flash_blendFraction (context, numer, denom, &blendedNumer, &blendedDenom);
- LockMutex (GraphicsLock);
oldGfxContext = SetContext (workGfxContext);
SetContextFGFrame (dest);
@@ -650,7 +645,6 @@
}
SetContext (oldGfxContext);
- UnlockMutex (GraphicsLock);
}
// Prepare an entry in the cache.
@@ -686,7 +680,6 @@
CONTEXT oldGfxContext;
STAMP stamp;
- LockMutex (GraphicsLock);
oldGfxContext = SetContext (context->gfxContext);
stamp.origin = context->rect.corner;
@@ -694,7 +687,6 @@
DrawStamp(&stamp);
SetContext (oldGfxContext);
- UnlockMutex (GraphicsLock);
}
static void
Modified: trunk/sc2/src/uqm/fmv.c
===================================================================
--- trunk/sc2/src/uqm/fmv.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/fmv.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -79,13 +79,11 @@
DWORD TimeOut;
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 120));
- LockMutex (GraphicsLock);
SetContext (ScreenContext);
s.origin.x = s.origin.y = 0;
s.frame = CaptureDrawable (LoadGraphic (TITLE_ANIM));
DrawStamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame));
- UnlockMutex (GraphicsLock);
TimeOut = FadeScreen (FadeAllToColor, ONE_SECOND / 2);
Modified: trunk/sc2/src/uqm/gameopt.c
===================================================================
--- trunk/sc2/src/uqm/gameopt.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/gameopt.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -167,9 +167,7 @@
break;
}
- LockMutex (GraphicsLock);
DrawStatusMessage (buf);
- UnlockMutex (GraphicsLock);
}
#define DDSHS_NORMAL 0
@@ -229,7 +227,6 @@
lf.align = ALIGN_CENTER;
}
- LockMutex (GraphicsLock);
SetContext (StatusContext);
SetContextFont (Font);
lf.pStr = Str;
@@ -253,14 +250,11 @@
if ((text_r.extent.width + 2) >= r.extent.width)
{ // the text does not fit the input box size and so
// will not fit when displayed later
- UnlockMutex (GraphicsLock);
// disallow the change
return (FALSE);
}
- UnlockMutex (GraphicsLock);
PreUpdateFlashRect ();
- LockMutex (GraphicsLock);
SetContextForeGroundColor (BackGround);
DrawFilledRectangle (&r);
@@ -299,10 +293,9 @@
SetContextForeGroundColor (ForeGround);
font_DrawText (&lf);
- PostUpdateFlashRectLocked ();
+ PostUpdateFlashRect ();
}
- UnlockMutex (GraphicsLock);
return (TRUE);
}
@@ -325,15 +318,11 @@
TEXTENTRY_STATE tes;
UNICODE *Setting;
- LockMutex (GraphicsLock);
SetFlashRect (nameCaptain ? &captainNameRect : &shipNameRect);
- UnlockMutex (GraphicsLock);
DrawNameString (nameCaptain, buf, 0, DDSHS_EDIT);
- LockMutex (GraphicsLock);
DrawStatusMessage (GAME_STRING (NAMING_STRING_BASE + 0));
- UnlockMutex (GraphicsLock);
if (nameCaptain)
{
@@ -359,9 +348,7 @@
else
utf8StringCopy (buf, sizeof (buf), Setting);
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
DrawNameString (nameCaptain, buf, 0, DDSHS_NORMAL);
@@ -450,9 +437,7 @@
MenuState.InputFunc = DoSettings;
DoInput (&MenuState, FALSE);
- LockMutex (GraphicsLock);
DrawStatusMessage (NULL);
- UnlockMutex (GraphicsLock);
}
typedef struct
@@ -677,10 +662,8 @@
r.corner.y = SIS_ORG_Y + 84;
r.extent = OldRect.extent;
SetContextClipRect (&r);
- UnlockMutex (GraphicsLock);
// draw the lander with upgrades
InitLander (pSD->Flags | OVERRIDE_LANDER_FLAGS);
- LockMutex (GraphicsLock);
SetContextClipRect (&OldRect);
SetContext (SpaceContext);
@@ -941,11 +924,9 @@
if (NewState != pMS->CurState)
{
- LockMutex (GraphicsLock);
pMS->CurState = NewState;
SetContext (SpaceContext);
RedrawPickDisplay (pickState, pMS->CurState);
- UnlockMutex (GraphicsLock);
}
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
@@ -965,9 +946,7 @@
// TODO: fix ConfirmSaveLoad() interface so it does not rely on
// MsgStamp != NULL parameter.
- LockMutex (GraphicsLock);
ConfirmSaveLoad (pickState->saving ? &saveStamp : NULL);
- UnlockMutex (GraphicsLock);
if (pickState->saving)
success = SaveGame (gameIndex, desc);
@@ -978,9 +957,7 @@
// display a load problem message
if (pickState->saving)
{ // restore the screen under "SAVING..." message
- LockMutex (GraphicsLock);
DrawStamp (&saveStamp);
- UnlockMutex (GraphicsLock);
}
DestroyDrawable (ReleaseDrawable (saveStamp.frame));
@@ -1015,12 +992,10 @@
LoadGameDescriptions (pickState.summary);
- LockMutex (GraphicsLock);
OldContext = SetContext (SpaceContext);
// Save the current state of the screen for later restoration
DlgStamp = SaveContextFrame (NULL);
GetContextClipRect (&DlgRect);
- UnlockMutex (GraphicsLock);
SleepThreadUntil (TimeOut);
PauseMusic ();
@@ -1028,7 +1003,6 @@
FadeMusic (NORMAL_VOLUME, 0);
// draw the current savegame and fade in
- LockMutex (GraphicsLock);
SetTransitionSource (NULL);
BatchGraphics ();
@@ -1050,7 +1024,6 @@
ScreenTransition (3, &ctxRect);
UnbatchGraphics ();
}
- UnlockMutex (GraphicsLock);
SetMenuSounds (MENU_SOUND_ARROWS | MENU_SOUND_PAGEUP | MENU_SOUND_PAGEDOWN,
0);
@@ -1076,9 +1049,7 @@
// reload and redraw everything
LoadGameDescriptions (pickState.summary);
- LockMutex (GraphicsLock);
RedrawPickDisplay (&pickState, MenuState.CurState);
- UnlockMutex (GraphicsLock);
}
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
@@ -1091,20 +1062,16 @@
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT) &&
(saving || (!pickState.success && !fromMainMenu)))
{ // Restore previous screen
- LockMutex (GraphicsLock);
SetTransitionSource (&DlgRect);
BatchGraphics ();
DrawStamp (&DlgStamp);
ScreenTransition (3, &DlgRect);
UnbatchGraphics ();
- UnlockMutex (GraphicsLock);
}
DestroyDrawable (ReleaseDrawable (DlgStamp.frame));
- LockMutex (GraphicsLock);
SetContext (OldContext);
- UnlockMutex (GraphicsLock);
ResumeMusic ();
@@ -1132,14 +1099,10 @@
{
case SAVE_GAME:
case LOAD_GAME:
- LockMutex (GraphicsLock);
SetFlashRect (NULL);
- UnlockMutex (GraphicsLock);
if (PickGame (pMS->CurState == SAVE_GAME, FALSE))
return FALSE;
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
break;
case QUIT_GAME:
if (ConfirmExit ())
@@ -1181,17 +1144,13 @@
MenuState.CurState = SAVE_GAME;
DrawMenuStateStrings (PM_SAVE_GAME, MenuState.CurState);
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
MenuState.InputFunc = DoGameOptions;
DoInput (&MenuState, TRUE);
- LockMutex (GraphicsLock);
SetFlashRect (NULL);
- UnlockMutex (GraphicsLock);
return !(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD));
}
Modified: trunk/sc2/src/uqm/hyper.c
===================================================================
--- trunk/sc2/src/uqm/hyper.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/hyper.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -1633,9 +1633,7 @@
if (!select)
return TRUE;
- LockMutex (GraphicsLock);
SetFlashRect (NULL);
- UnlockMutex (GraphicsLock);
switch (pMS->CurState)
{
@@ -1675,9 +1673,7 @@
pMS->CurState = NAVIGATION;
DrawMenuStateStrings (PM_STARMAP, pMS->CurState);
}
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
}
return TRUE;
@@ -1695,7 +1691,6 @@
OldContext = SetContext (SpaceContext);
OldColor = SetContextBackGroundColor (BLACK_COLOR);
- UnlockMutex (GraphicsLock);
memset (&MenuState, 0, sizeof (MenuState));
MenuState.InputFunc = DoHyperspaceMenu;
@@ -1703,14 +1698,11 @@
MenuState.CurState = STARMAP;
DrawMenuStateStrings (PM_STARMAP, STARMAP);
- LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO);
- UnlockMutex (GraphicsLock);
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
DoInput (&MenuState, TRUE);
- LockMutex (GraphicsLock);
SetFlashRect (NULL);
SetContext (SpaceContext);
@@ -1718,9 +1710,7 @@
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
{
ClearSISRect (CLEAR_SIS_RADAR);
- UnlockMutex (GraphicsLock);
WaitForNoInput (ONE_SECOND / 2, FALSE);
- LockMutex (GraphicsLock);
}
SetContextBackGroundColor (OldColor);
Modified: trunk/sc2/src/uqm/intro.c
===================================================================
--- trunk/sc2/src/uqm/intro.c 2012-02-06 17:43:46 UTC (rev 3760)
+++ trunk/sc2/src/uqm/intro.c 2012-02-11 23:41:06 UTC (rev 3761)
@@ -160,7 +160,6 @@
if (!pPIS->Batched)
{
pPIS->Batched = TRUE;
- LockMutex (GraphicsLock);
BatchGraphics ();
}
}
@@ -171,7 +170,6 @@
if (pPIS->Batched)
{
UnbatchGraphics ();
- UnlockMutex (GraphicsLock);
pPIS->Batched = FALSE;
if (bYield)
TaskSwitch ();
@@ -196,7 +194,6 @@
COUNT piece;
Color SisBack;
- LockMutex (GraphicsLock);
OldContext = SetContext (OffScreenContext);
SkelFrame = CaptureDrawable (LoadGraphic (SISSKEL_MASK_PMAP_ANIM));
@@ -264,7 +261,6 @@
SetContext (OldContext);
FlushGraphics ();
- UnlockMutex (GraphicsLock);
pPIS->SisFrame = SisFrame;
}
@@ -277,9 +273,7 @@
s.origin.x = 0;
s.origin.y = 0;
s.frame = SetAbsFrameIndex (pPIS->Frame, pPIS->MovieFrame);
- LockMutex (GraphicsLock);
DrawStamp (&s);
- UnlockMutex (GraphicsLock);
}
static BOOLEAN
@@ -362,9 +356,7 @@
/* center on screen */
pPIS->clip_r.corner.x = (SCREEN_WIDTH - w) / 2;
pPIS->clip_r.corner.y = (SCREEN_HEIGHT - h) / 2;
- LockMutex (GraphicsLock);
SetContextClipRect (&pPIS->clip_r);
- UnlockMutex (GraphicsLock);
}
}
else if (strcmp (Opcode, "FONT") == 0)
@@ -390,11 +382,7 @@
*pFont = LoadFontFile (pPIS->Buffer);
}
- if (!pPIS->Batched)
- LockMutex (GraphicsLock);
SetContextFont (*pFont);
- if (!pPIS->Batched)
- UnlockMutex (GraphicsLock);
}
else if (strcmp (Opcode, "ANI") == 0)
{ /* set ani */
@@ -490,12 +478,8 @@
t.CharCount = (COUNT)~0;
t.baseline.x = x;
t.baseline.y = y;
- if (!pPIS->Batched)
- LockMutex (GraphicsLock);
DrawTextEffect (&t, pPIS->TextColor, pPIS->TextBackColor,
pPIS->TextEffect);
- if (!pPIS->Batched)
- UnlockMutex (GraphicsLock);
}
}
else if (strcmp (Opcode, "TFI") == 0)
@@ -510,9 +494,7 @@
Present_UnbatchGraphics (pPIS, TRUE);
- LockMutex (GraphicsLock);
GetContextFontLeading (&leading);
- UnlockMutex (GraphicsLock);
switch (pPIS->TextVPos)
{
@@ -536,7 +518,6 @@
pPIS->TextLines[i].baseline.y = y;
}
- LockMutex (GraphicsLock);
for (i = 0; i < pPIS->LinesCount; ++i)
DrawTextEffect (pPIS->TextLines + i, pPIS->TextFadeColor,
pPIS->TextFadeColor, pPIS->TextEffect);
@@ -550,7 +531,6 @@
ScreenTransition (3, &pPIS->tfade_r);
UnbatchGraphics ();
- UnlockMutex (GraphicsLock);
}
else if (strcmp (Opcode, "TFO") == 0)
{ /* text fade-out */
@@ -558,7 +538,6 @@
Present_UnbatchGraphics (pPIS, TRUE);
- LockMutex (GraphicsLock);
/* do transition */
SetTransitionSource (&pPIS->tfade_r);
BatchGraphics ();
@@ -567,7 +546,6 @@
pPIS->TextFadeColor, pPIS->TextEffect);
ScreenTransition (3, &pPIS->tfade_r);
UnbatchGraphics ();
- UnlockMutex (GraphicsLock);
}
else if (strcmp (Opcode, "SAVEBG") == 0)
{ /* save background */
@@ -652,15 +630,11 @@
}
s.origin.x = x;
s.origin.y = y;
- if (!pPIS->Batched)
- LockMutex (GraphicsLock);
old_mode = SetGraphicScaleMode (scale_mode);
old_scale = SetGraphicScale (scale);
DrawStamp (&s);
SetGraphicScale (old_scale);
SetGraphicScaleMode (old_mode);
- if (!pPIS->Batched)
- UnlockMutex (GraphicsLock);
}
else if (strcmp (Opcode, "BATCH") == 0)
{ /* batch graphics */
@@ -689,9 +663,7 @@
{ /* clear screen */
Present_UnbatchGraphics (pPIS, TRUE);
- LockMutex (GraphicsLock);
ClearDrawable ();
- UnlockMutex (GraphicsLock);
}
else if (strcmp (Opcode, "CALL") == 0)
{ /* call another script */
@@ -712,12 +684,8 @@
l.second.x = x2;
l.second.y = y2;
- if (!pPIS->Batched)
- LockMutex (GraphicsLock);
SetContextForeGroundColor (pPIS->TextColor);
DrawLine (&l);
- if (!pPIS->Batched)
- UnlockMutex (GraphicsLock);
}
else
{
@@ -771,12 +739,10 @@
pis.SlideShow = SetAbsStringTableIndex (pis.SlideShow, 0);
pis.OperIndex = 0;
- LockMutex ...
[truncated message content] |
|
From: <Mee...@us...> - 2012-02-06 17:43:52
|
Revision: 3760
http://sc2.svn.sourceforge.net/sc2/?rev=3760&view=rev
Author: Meep-Eep
Date: 2012-02-06 17:43:46 +0000 (Mon, 06 Feb 2012)
Log Message:
-----------
Only build with Ogg Vorbis if so specified.
Modified Paths:
--------------
trunk/sc2/build.vars.in
Modified: trunk/sc2/build.vars.in
===================================================================
--- trunk/sc2/build.vars.in 2012-01-29 20:18:50 UTC (rev 3759)
+++ trunk/sc2/build.vars.in 2012-02-06 17:43:46 UTC (rev 3760)
@@ -58,7 +58,8 @@
MACRO___MINGW32__='@MACRO___MINGW32__@'
export BUILD_SYSTEM HOST_SYSTEM DEBUG
export MACRO_WIN32 MACRO___MINGW32__
-export uqm_SOUNDMODULE uqm_USE_INTERNAL_MIKMOD uqm_HAVE_GETOPT_LONG
-export uqm_HAVE_REGEX uqm_USE_WINSOCK uqm_GFXMODULE uqm_HAVE_OPENGL
+export uqm_SOUNDMODULE uqm_OGGVORBIS uqm_USE_INTERNAL_MIKMOD
+export uqm_HAVE_GETOPT_LONG uqm_HAVE_REGEX uqm_USE_WINSOCK uqm_GFXMODULE
+export uqm_HAVE_OPENGL
export uqm_USE_ZIP_IO uqm_USE_PLATFORM_ACCEL uqm_THREADLIB uqm_NETPLAY
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <av...@us...> - 2012-01-29 20:18:57
|
Revision: 3759
http://sc2.svn.sourceforge.net/sc2/?rev=3759&view=rev
Author: avolkov
Date: 2012-01-29 20:18:50 +0000 (Sun, 29 Jan 2012)
Log Message:
-----------
Split debug key function into sync and async parts (wrt the game logic thread), paving the way for GraphicsLock and GameClock lock removal
Modified Paths:
--------------
trunk/sc2/ChangeLog
trunk/sc2/src/uqm/clock.c
trunk/sc2/src/uqm/gameinp.c
trunk/sc2/src/uqm/planets/calc.c
trunk/sc2/src/uqm/starcon.c
trunk/sc2/src/uqm/uqmdebug.c
trunk/sc2/src/uqm/uqmdebug.h
Modified: trunk/sc2/ChangeLog
===================================================================
--- trunk/sc2/ChangeLog 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/ChangeLog 2012-01-29 20:18:50 UTC (rev 3759)
@@ -1,4 +1,6 @@
Changes towards version 0.8:
+- Split debug key function into sync and async parts, paving the way
+ for GraphicsLock removal - Alex
- PageUp/PageDown now add/remove 10 fuel in the shipyard, from
Scott A. Colcord, Nic
- Annihigate flash thread - SvdB
Modified: trunk/sc2/src/uqm/clock.c
===================================================================
--- trunk/sc2/src/uqm/clock.c 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/src/uqm/clock.c 2012-01-29 20:18:50 UTC (rev 3759)
@@ -157,22 +157,16 @@
BOOLEAN
GameClockRunning (void)
{
- SIZE prev_tick, cur_tick;
+ SIZE day_in_ticks;
if (!clock_mutex)
return FALSE;
LockMutex (clock_mutex);
- prev_tick = GLOBAL (GameClock.tick_count);
+ day_in_ticks = GLOBAL (GameClock.day_in_ticks);
UnlockMutex (clock_mutex);
- SleepThread (ONE_SECOND / 5);
-
- LockMutex (clock_mutex);
- cur_tick = GLOBAL (GameClock.tick_count);
- UnlockMutex (clock_mutex);
-
- return cur_tick != prev_tick;
+ return day_in_ticks != 0;
}
void
Modified: trunk/sc2/src/uqm/gameinp.c
===================================================================
--- trunk/sc2/src/uqm/gameinp.c 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/src/uqm/gameinp.c 2012-01-29 20:18:50 UTC (rev 3759)
@@ -275,6 +275,11 @@
if (CurrentInputState.menu[KEY_EXIT])
ExitRequested = TRUE;
+
+#if defined(DEBUG) || defined(USE_DEBUG_KEY)
+ if (PulsedInputState.menu[KEY_DEBUG])
+ debugKeyPressedSynchronous ();
+#endif
}
InputFrameCallback *
@@ -365,19 +370,6 @@
UpdateInputState ();
-#ifdef DEBUG
- if (doInputDebugHook != NULL)
- {
- void (*saveDebugHook) (void);
- saveDebugHook = doInputDebugHook;
- doInputDebugHook = NULL;
- // No further debugHook calls unless the called
- // function resets doInputDebugHook.
- (*saveDebugHook) ();
- continue;
- }
-#endif
-
#if DEMO_MODE || CREATE_JOURNAL
if (ArrowInput != DemoInput)
#endif
Modified: trunk/sc2/src/uqm/planets/calc.c
===================================================================
--- trunk/sc2/src/uqm/planets/calc.c 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/src/uqm/planets/calc.c 2012-01-29 20:18:50 UTC (rev 3759)
@@ -352,7 +352,8 @@
void
DoPlanetaryAnalysis (SYSTEM_INFO *SysInfoPtr, PLANET_DESC *pPlanetDesc)
{
- assert (pPlanetDesc->data_index != HIERARCHY_STARBASE);
+ assert ((pPlanetDesc->data_index & ~WORLD_TYPE_SPECIAL)
+ < NUMBER_OF_PLANET_TYPES);
RandomContext_SeedRandom (SysGenRNG, pPlanetDesc->rand_seed);
Modified: trunk/sc2/src/uqm/starcon.c
===================================================================
--- trunk/sc2/src/uqm/starcon.c 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/src/uqm/starcon.c 2012-01-29 20:18:50 UTC (rev 3759)
@@ -105,6 +105,7 @@
}
}
+// Executes on the main() thread
void
SignalStopMainThread (void)
{
@@ -113,6 +114,7 @@
TaskSwitch ();
}
+// Executes on the main() thread
void
ProcessUtilityKeys (void)
{
@@ -132,11 +134,17 @@
}
#if defined(DEBUG) || defined(USE_DEBUG_KEY)
- if (ImmediateInputState.menu[KEY_DEBUG])
- {
- // clear ImmediateInputState so we don't repeat this next frame
- FlushInput ();
- debugKeyPressed ();
+ { // Only call the debug func on the rising edge of
+ // ImmediateInputState[KEY_DEBUG] so it does not execute repeatedly.
+ // This duplicates the PulsedInputState somewhat, but we cannot
+ // use PulsedInputState here because it is meant for another thread.
+ static int debugKeyState;
+
+ if (ImmediateInputState.menu[KEY_DEBUG] && debugKeyState == 0)
+ {
+ debugKeyPressed ();
+ }
+ debugKeyState = ImmediateInputState.menu[KEY_DEBUG];
}
#endif /* DEBUG */
}
Modified: trunk/sc2/src/uqm/uqmdebug.c
===================================================================
--- trunk/sc2/src/uqm/uqmdebug.c 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/src/uqm/uqmdebug.c 2012-01-29 20:18:50 UTC (rev 3759)
@@ -72,11 +72,12 @@
BOOLEAN instantMove = FALSE;
BOOLEAN disableInteractivity = FALSE;
void (* volatile debugHook) (void) = NULL;
-void (* volatile doInputDebugHook) (void) = NULL;
+// Must be called on the Starcon2Main thread.
+// This function is called synchronously wrt the game logic thread.
void
-debugKeyPressed (void)
+debugKeyPressedSynchronous (void)
{
// State modifying:
equipShip ();
@@ -107,28 +108,36 @@
// SET_GAME_STATE (MELNORME_CREDIT1, 100);
// GLOBAL_SIS (ResUnits) = 100000;
+ // Informational:
+// dumpEvents (stderr);
+
+ // Graphical and textual:
+// debugContexts();
+}
+
+// Can be called on any thread, but usually on main()
+// This function is called asynchronously wrt the game logic thread,
+// which means locking applies. Use carefully.
+// TODO: Once game logic thread is purged of graphics and clock locks,
+// this function may not call graphics and game clock functions at all.
+void
+debugKeyPressed (void)
+{
// Tests
// Scale_PerfTest ();
// Informational:
// dumpStrings (stdout);
-// dumpEvents (stderr);
// dumpPlanetTypes(stderr);
// debugHook = dumpUniverseToFile;
// This will cause dumpUniverseToFile to be called from the
- // main loop. Calling it from here would give threading
+ // Starcon2Main loop. Calling it from here would give threading
// problems.
// debugHook = tallyResourcesToFile;
// This will cause tallyResourcesToFile to be called from the
- // main loop. Calling it from here would give threading
+ // Starcon2Main loop. Calling it from here would give threading
// problems.
- // Graphical and textual:
- //doInputDebugHook = debugContexts;
- // This will cause debugContexts to be called from the
- // Starcon2Main thread, from DoInput(). Calling it from here
- // would give threading problems.
-
// Interactive:
// uio_debugInteractive(stdin, stdout, stderr);
}
@@ -137,6 +146,9 @@
// Fast forwards to the next event.
// If skipHEE is set, HYPERSPACE_ENCOUNTER_EVENTs are skipped.
+// Must be called from the Starcon2Main thread.
+// TODO: GraphicsLock and LockGameClock may be removed since it is only
+// supposed to be called synchronously wrt the game logic thread.
void
forwardToNextEvent (BOOLEAN skipHEE)
{
@@ -596,6 +608,8 @@
////////////////////////////////////////////////////////////////////////////
+// Must be called from the Starcon2Main thread.
+// TODO: LockGameClock may be removed
void
UniverseRecurse (UniverseRecurseArg *universeRecurseArg)
{
@@ -728,10 +742,13 @@
if (universeRecurseArg->moonFunc != NULL)
{
system->pOrbitalDesc = moon;
- DoPlanetaryAnalysis (&system->SysInfo, moon);
+ if (moon->data_index != HIERARCHY_STARBASE && moon->data_index != SA_MATRA)
+ {
+ DoPlanetaryAnalysis (&system->SysInfo, moon);
// When GenerateDefaultFunctions is used as genFuncs,
// generateOrbital will also call DoPlanetaryAnalysis,
// but with other GenerateFunctions this is not guaranteed.
+ }
(*system->genFuncs->generateOrbital) (system, moon);
(*universeRecurseArg->moonFunc) (
moon, universeRecurseArg->arg);
@@ -745,6 +762,7 @@
FILE *out;
} DumpUniverseArg;
+// Must be called from the Starcon2Main thread.
void
dumpUniverse (FILE *out)
{
@@ -763,7 +781,7 @@
UniverseRecurse (&universeRecurseArg);
}
-// Must be called from the main thread.
+// Must be called from the Starcon2Main thread.
void
dumpUniverseToFile (void)
{
@@ -1146,6 +1164,7 @@
COUNT bioCount;
};
+// Must be called from the Starcon2Main thread.
void
tallyResources (FILE *out)
{
@@ -1164,7 +1183,7 @@
UniverseRecurse (&universeRecurseArg);
}
-// Must be called from the main thread.
+// Must be called from the Starcon2Main thread.
void
tallyResourcesToFile (void)
{
Modified: trunk/sc2/src/uqm/uqmdebug.h
===================================================================
--- trunk/sc2/src/uqm/uqmdebug.h 2012-01-29 18:35:35 UTC (rev 3758)
+++ trunk/sc2/src/uqm/uqmdebug.h 2012-01-29 20:18:50 UTC (rev 3759)
@@ -33,19 +33,19 @@
// Starcon2Main thread, in the main game loop.
extern void (* volatile debugHook) (void);
-// If a function is assigned to this, it will be called from the
-// Starcon2Main thread, in doInput().
-extern void (* volatile doInputDebugHook) (void);
-
-
-// Called when the debug key (symbol 'Debug' in the keys.cfg) is pressed.
+// Called on the main() thread when the debug key (symbol 'Debug' in the
+// keys.cfg) is pressed
void debugKeyPressed (void);
+// Called on the Starcon2Main() thread when the debug key (symbol 'Debug'
+// in the keys.cfg) is pressed.
+void debugKeyPressedSynchronous (void);
// Forward time to the next event. If skipHEE is set, the event named
// HYPERSPACE_ENCOUNTER_EVENT, which normally occurs every game day,
-// is skipped.
+// is skipped. Must be called on the Starcon2Main thread.
void forwardToNextEvent (BOOLEAN skipHEE);
// Generate a list of all events in the event queue.
+// Must be called on the Starcon2Main thread.
void dumpEvents (FILE *out);
// Describe one event.
void dumpEvent (FILE *out, const EVENT *eventPtr);
@@ -102,11 +102,13 @@
// User data.
} UniverseRecurseArg;
// Recurse through all systems, planets, and moons in the universe.
+// Must be called on the Starcon2Main thread.
void UniverseRecurse (UniverseRecurseArg *universeRecurseArg);
-// Describe the entire universe.
+// Describe the entire universe. Must be called on the Starcon2Main thread.
void dumpUniverse (FILE *out);
// Describe the entire universe, output to a file "./PlanetInfo".
+// Must be called on the Starcon2Main thread.
void dumpUniverseToFile (void);
// Describe one star system.
void dumpSystem (FILE *out, const STAR_DESC *star,
@@ -137,9 +139,10 @@
const PLANET_DESC *world, COUNT bio[]);
// Tally the resources for each star system.
+// Must be called on the Starcon2Main thread.
void tallyResources (FILE *out);
// Tally the resources for each star system, output to a file
-// "./ResourceTally".
+// "./ResourceTally". Must be called on the Starcon2Main thread.
void tallyResourcesToFile (void);
@@ -186,7 +189,7 @@
// Graphically and textually show all the contexts.
-// Should be called from debugHook.
+// Must be called on the Starcon2Main thread.
void debugContexts (void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Mee...@us...> - 2012-01-29 18:35:41
|
Revision: 3758
http://sc2.svn.sourceforge.net/sc2/?rev=3758&view=rev
Author: Meep-Eep
Date: 2012-01-29 18:35:35 +0000 (Sun, 29 Jan 2012)
Log Message:
-----------
Corrections, updates.
Modified Paths:
--------------
trunk/sc2/doc/devel/checklist
trunk/sc2/doc/devel/generate
trunk/sc2/doc/devel/queues
trunk/sc2/doc/devel/racestrings
Modified: trunk/sc2/doc/devel/checklist
===================================================================
--- trunk/sc2/doc/devel/checklist 2012-01-29 15:43:55 UTC (rev 3757)
+++ trunk/sc2/doc/devel/checklist 2012-01-29 18:35:35 UTC (rev 3758)
@@ -42,6 +42,7 @@
- send a mail to sc2-announce
- set the forum 'news'
- set the #sc2 irc channel topic
+- update the version number in http://uqm.stack.nl/wiki/Template:Uqmversion
Moving on to the next version:
Modified: trunk/sc2/doc/devel/generate
===================================================================
--- trunk/sc2/doc/devel/generate 2012-01-29 15:43:55 UTC (rev 3757)
+++ trunk/sc2/doc/devel/generate 2012-01-29 18:35:35 UTC (rev 3758)
@@ -142,7 +142,7 @@
There is no generate function for the names of moons. The few moons that
are named (those in the Sol system), are handled as a special case of
the routines that prints these names (PrintCoarseScan3DO and
-PrintCoraseScanPC).
+PrintCoarseScanPC).
INIT_NPCS
REINIT_NPCS
Modified: trunk/sc2/doc/devel/queues
===================================================================
--- trunk/sc2/doc/devel/queues 2012-01-29 15:43:55 UTC (rev 3757)
+++ trunk/sc2/doc/devel/queues 2012-01-29 18:35:35 UTC (rev 3758)
@@ -7,7 +7,7 @@
except for, technically, SAMATRA_SHIP. URQUAN_PROBE_SHIP is a
very incomplete 'race'.
Elements are of type FLEET_INFO.
- Filled in InitSIS().
+ Filled in InitGameStructures().
Partially included in savegames.
GlobData.Game_state.built_ship_q:
@@ -19,7 +19,7 @@
master_q:
List of templates for all the ships that are available in SuperMelee.
Elements are of type MASTER_SHIP_INFO.
- Sorted on the (abbreviated) race name (see doc/racestrings).
+ Sorted on the (abbreviated) race name (see doc/devel/racestrings).
Filled in LoadMasterShipList().
GlobData.Game_state.npc_built_ship_q:
Modified: trunk/sc2/doc/devel/racestrings
===================================================================
--- trunk/sc2/doc/devel/racestrings 2012-01-29 15:43:55 UTC (rev 3757)
+++ trunk/sc2/doc/devel/racestrings 2012-01-29 18:35:35 UTC (rev 3758)
@@ -1,4 +1,5 @@
-This file describes the use for each entry of the content/<race>/*.txt files
+This file describes the use for each entry of the
+content/base/ships/<race>/<ship>.txt files.
Entry #0:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|