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. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3761 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.8:
|
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
|
- Split debug key function into sync and async parts, paving the way
|
||||||
for GraphicsLock removal - Alex
|
for GraphicsLock removal - Alex
|
||||||
- PageUp/PageDown now add/remove 10 fuel in the shipyard, from
|
- PageUp/PageDown now add/remove 10 fuel in the shipyard, from
|
||||||
|
|||||||
@@ -3654,10 +3654,6 @@ SOURCE=..\..\doc\devel\glossary
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\doc\devel\graphicslock
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\..\doc\devel\input
|
SOURCE=..\..\doc\devel\input
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -97,10 +97,7 @@ The simplest form of lock. If a thread tries to lock a mutex, it will
|
|||||||
sleep if the mutex is already locked, and awaken once the mutex
|
sleep if the mutex is already locked, and awaken once the mutex
|
||||||
becomes available. A Mutex must be unlocked by the same thread that
|
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
|
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
|
(without unlocking it first).
|
||||||
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.
|
|
||||||
|
|
||||||
API:
|
API:
|
||||||
Mutex CreateMutex (const char *name, DWORD syncClass);
|
Mutex CreateMutex (const char *name, DWORD syncClass);
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "libs/threadlib.h"
|
||||||
|
|
||||||
typedef struct CallbackLink CallbackLink;
|
typedef struct CallbackLink CallbackLink;
|
||||||
|
|
||||||
#define CALLBACK_INTERNAL
|
#define CALLBACK_INTERNAL
|
||||||
@@ -38,16 +40,16 @@ static CallbackLink *callbacks;
|
|||||||
static CallbackLink **callbacksEnd;
|
static CallbackLink **callbacksEnd;
|
||||||
static CallbackLink *const *callbacksProcessEnd;
|
static CallbackLink *const *callbacksProcessEnd;
|
||||||
|
|
||||||
|
static Mutex callbackListLock;
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
CallbackList_lock(void) {
|
CallbackList_lock(void) {
|
||||||
// TODO
|
LockMutex(callbackListLock);
|
||||||
// Necessary for reentrant operation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
CallbackList_unlock(void) {
|
CallbackList_unlock(void) {
|
||||||
// TODO
|
UnlockMutex(callbackListLock);
|
||||||
// Necessary for reentrant operation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -62,6 +64,14 @@ Callback_init(void) {
|
|||||||
callbacks = NULL;
|
callbacks = NULL;
|
||||||
callbacksEnd = &callbacks;
|
callbacksEnd = &callbacks;
|
||||||
callbacksProcessEnd = &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.
|
// Callbacks are guaranteed to be called in the order that they are queued.
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ typedef void *CallbackArg;
|
|||||||
typedef void (*CallbackFunction)(CallbackArg arg);
|
typedef void (*CallbackFunction)(CallbackArg arg);
|
||||||
|
|
||||||
void Callback_init(void);
|
void Callback_init(void);
|
||||||
|
void Callback_uninit(void);
|
||||||
CallbackID Callback_add(CallbackFunction callback, CallbackArg arg);
|
CallbackID Callback_add(CallbackFunction callback, CallbackArg arg);
|
||||||
bool Callback_remove(CallbackID id);
|
bool Callback_remove(CallbackID id);
|
||||||
void Callback_process(void);
|
void Callback_process(void);
|
||||||
|
|||||||
@@ -216,6 +216,22 @@ TFB_DrawCommandQueue_Clear ()
|
|||||||
UnlockRecursiveMutex (DCQ_Mutex);
|
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
|
void
|
||||||
TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
|
TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
|
||||||
{
|
{
|
||||||
@@ -224,6 +240,8 @@ TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkExclusiveThread ();
|
||||||
|
|
||||||
if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE
|
if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE
|
||||||
&& _CurFramePtr->Type == SCREEN_DRAWABLE)
|
&& _CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#ifndef TRACKINT_H
|
#ifndef TRACKINT_H
|
||||||
#define TRACKINT_H
|
#define TRACKINT_H
|
||||||
|
|
||||||
|
#include "libs/callback.h"
|
||||||
|
|
||||||
struct tfb_soundchunk
|
struct tfb_soundchunk
|
||||||
{
|
{
|
||||||
TFB_SoundDecoder *decoder; // decoder for this chunk
|
TFB_SoundDecoder *decoder; // decoder for this chunk
|
||||||
@@ -24,7 +26,7 @@ struct tfb_soundchunk
|
|||||||
int tag_me; // set for chunks with subtitles
|
int tag_me; // set for chunks with subtitles
|
||||||
uint32 track_num; // logical track #, comm code needs this
|
uint32 track_num; // logical track #, comm code needs this
|
||||||
UNICODE *text; // subtitle text
|
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;
|
struct tfb_soundchunk *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,8 @@ static void
|
|||||||
DoTrackTag (TFB_SoundChunk *chunk)
|
DoTrackTag (TFB_SoundChunk *chunk)
|
||||||
{
|
{
|
||||||
if (chunk->callback)
|
if (chunk->callback)
|
||||||
chunk->callback ();
|
Callback_add(chunk->callback, 0);
|
||||||
|
|
||||||
cur_sub_chunk = chunk;
|
cur_sub_chunk = chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +422,7 @@ SpliceMultiTrack (UNICODE *TrackNames[], UNICODE *TrackText)
|
|||||||
|
|
||||||
// XXX: This code and the entire trackplayer are begging to be overhauled
|
// XXX: This code and the entire trackplayer are begging to be overhauled
|
||||||
void
|
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 UNICODE last_track_name[128] = "";
|
||||||
static unsigned long dec_offset = 0;
|
static unsigned long dec_offset = 0;
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
#define TRACKPLAYER_H
|
#define TRACKPLAYER_H
|
||||||
|
|
||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
|
#include "libs/callback.h"
|
||||||
typedef void (*TFB_TrackCB) (void);
|
|
||||||
|
|
||||||
#define ACCEL_SCROLL_SPEED 300
|
#define ACCEL_SCROLL_SPEED 300
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ extern void FastForward_Smooth (void);
|
|||||||
extern void FastReverse_Page (void);
|
extern void FastReverse_Page (void);
|
||||||
extern void FastForward_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 void SpliceMultiTrack (UNICODE *TrackNames[], UNICODE *TrackText);
|
||||||
|
|
||||||
extern int GetTrackPosition (int in_units);
|
extern int GetTrackPosition (int in_units);
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ VidPlayEx (VIDEO_REF vid, MUSIC_REF AudRef, MUSIC_REF SpeechRef,
|
|||||||
_cur_speech = 0;
|
_cur_speech = 0;
|
||||||
_cur_video = NULL_VIDEO_REF;
|
_cur_video = NULL_VIDEO_REF;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
// play video in the center of the screen
|
// play video in the center of the screen
|
||||||
if (TFB_PlayVideo (vid, (ScreenWidth - vid->w) / 2,
|
if (TFB_PlayVideo (vid, (ScreenWidth - vid->w) / 2,
|
||||||
(ScreenHeight - vid->h) / 2))
|
(ScreenHeight - vid->h) / 2))
|
||||||
@@ -144,7 +143,6 @@ VidPlayEx (VIDEO_REF vid, MUSIC_REF AudRef, MUSIC_REF SpeechRef,
|
|||||||
{
|
{
|
||||||
ret = NO_FMV;
|
ret = NO_FMV;
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,4 @@ struct legacy_video_ref
|
|||||||
MUSIC_REF speechref;
|
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
|
#endif
|
||||||
|
|||||||
@@ -143,14 +143,12 @@ processAudioSyncedFrame (VIDEO_REF vid)
|
|||||||
vid->cur_frame = vid->decoder->cur_frame;
|
vid->cur_frame = vid->decoder->cur_frame;
|
||||||
|
|
||||||
// draw the frame
|
// draw the frame
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
// We have the cliprect precalculated and don't need the rest
|
// We have the cliprect precalculated and don't need the rest
|
||||||
oldContext = SetContext (NULL);
|
oldContext = SetContext (NULL);
|
||||||
TFB_DrawScreen_Image (vid->frame,
|
TFB_DrawScreen_Image (vid->frame,
|
||||||
vid->dst_rect.corner.x, vid->dst_rect.corner.y, 0, 0,
|
vid->dst_rect.corner.x, vid->dst_rect.corner.y, 0, 0,
|
||||||
NULL, DRAW_REPLACE_MODE, TFB_SCREEN_MAIN);
|
NULL, DRAW_REPLACE_MODE, TFB_SCREEN_MAIN);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
FlushGraphics (); // needed to prevent half-frame updates
|
FlushGraphics (); // needed to prevent half-frame updates
|
||||||
|
|
||||||
// increase interframe with positive lag-count to allow audio to catch up
|
// increase interframe with positive lag-count to allow audio to catch up
|
||||||
@@ -195,14 +193,12 @@ processMuteFrame (VIDEO_REF vid)
|
|||||||
|
|
||||||
vid->cur_frame = vid->decoder->cur_frame;
|
vid->cur_frame = vid->decoder->cur_frame;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
// We have the cliprect precalculated and don't need the rest
|
// We have the cliprect precalculated and don't need the rest
|
||||||
oldContext = SetContext (NULL);
|
oldContext = SetContext (NULL);
|
||||||
TFB_DrawScreen_Image (vid->frame,
|
TFB_DrawScreen_Image (vid->frame,
|
||||||
vid->dst_rect.corner.x, vid->dst_rect.corner.y, 0, 0,
|
vid->dst_rect.corner.x, vid->dst_rect.corner.y, 0, 0,
|
||||||
NULL, DRAW_REPLACE_MODE, TFB_SCREEN_MAIN);
|
NULL, DRAW_REPLACE_MODE, TFB_SCREEN_MAIN);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
FlushGraphics (); // needed to prevent half-frame updates
|
FlushGraphics (); // needed to prevent half-frame updates
|
||||||
|
|
||||||
if (vid->cur_frame == vid->loop_frame)
|
if (vid->cur_frame == vid->loop_frame)
|
||||||
|
|||||||
+6
-6
@@ -402,16 +402,14 @@ main (int argc, char *argv[])
|
|||||||
InitTimeSystem ();
|
InitTimeSystem ();
|
||||||
InitTaskSystem ();
|
InitTaskSystem ();
|
||||||
|
|
||||||
#ifdef NETPLAY
|
|
||||||
Network_init ();
|
|
||||||
Alarm_init ();
|
Alarm_init ();
|
||||||
Callback_init ();
|
Callback_init ();
|
||||||
|
|
||||||
|
#ifdef NETPLAY
|
||||||
|
Network_init ();
|
||||||
NetManager_init ();
|
NetManager_init ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GraphicsLock = CreateMutex ("Graphics",
|
|
||||||
SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
|
|
||||||
|
|
||||||
gfxDriver = options.opengl.value ?
|
gfxDriver = options.opengl.value ?
|
||||||
TFB_GFXDRIVER_SDL_OPENGL : TFB_GFXDRIVER_SDL_PURE;
|
TFB_GFXDRIVER_SDL_OPENGL : TFB_GFXDRIVER_SDL_PURE;
|
||||||
gfxFlags = options.scaler.value;
|
gfxFlags = options.scaler.value;
|
||||||
@@ -476,10 +474,12 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
NetManager_uninit ();
|
NetManager_uninit ();
|
||||||
Alarm_uninit ();
|
|
||||||
Network_uninit ();
|
Network_uninit ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Callback_uninit ();
|
||||||
|
Alarm_uninit ();
|
||||||
|
|
||||||
// Not yet: CleanupTaskSystem ();
|
// Not yet: CleanupTaskSystem ();
|
||||||
UnInitTimeSystem ();
|
UnInitTimeSystem ();
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -302,7 +302,6 @@ DoBattle (BATTLE_STATE *bs)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (bs->first_time)
|
if (bs->first_time)
|
||||||
{
|
{
|
||||||
r.corner.x = SIS_ORG_X;
|
r.corner.x = SIS_ORG_X;
|
||||||
@@ -325,7 +324,6 @@ DoBattle (BATTLE_STATE *bs)
|
|||||||
ScreenTransition (3, &r);
|
ScreenTransition (3, &r);
|
||||||
}
|
}
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
if ((!(GLOBAL (CurrentActivity) & IN_BATTLE)) ||
|
if ((!(GLOBAL (CurrentActivity) & IN_BATTLE)) ||
|
||||||
(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||||
{
|
{
|
||||||
@@ -399,7 +397,6 @@ Battle (BattleFrameCallback *callback)
|
|||||||
{
|
{
|
||||||
SIZE num_ships;
|
SIZE num_ships;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
#if !(DEMO_MODE || CREATE_JOURNAL)
|
#if !(DEMO_MODE || CREATE_JOURNAL)
|
||||||
if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) {
|
if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) {
|
||||||
@@ -469,9 +466,7 @@ Battle (BattleFrameCallback *callback)
|
|||||||
bs.first_time = (BOOLEAN)(LOBYTE (GLOBAL (CurrentActivity)) ==
|
bs.first_time = (BOOLEAN)(LOBYTE (GLOBAL (CurrentActivity)) ==
|
||||||
IN_HYPERSPACE);
|
IN_HYPERSPACE);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DoInput (&bs, FALSE);
|
DoInput (&bs, FALSE);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
AbortBattle:
|
AbortBattle:
|
||||||
if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)
|
if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)
|
||||||
@@ -481,12 +476,10 @@ AbortBattle:
|
|||||||
// Do not return to the main menu when a game is aborted,
|
// Do not return to the main menu when a game is aborted,
|
||||||
// (just to the supermelee menu).
|
// (just to the supermelee menu).
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
waitResetConnections(NetState_inSetup);
|
waitResetConnections(NetState_inSetup);
|
||||||
// A connection may already be in inSetup (set from
|
// A connection may already be in inSetup (set from
|
||||||
// GetMeleeStarship). This is not a problem, although
|
// GetMeleeStarship). This is not a problem, although
|
||||||
// it will generate a warning in debug mode.
|
// it will generate a warning in debug mode.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
||||||
@@ -514,7 +507,6 @@ AbortBattle:
|
|||||||
UninitShips ();
|
UninitShips ();
|
||||||
FreeBattleSong ();
|
FreeBattleSong ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return (BOOLEAN) (num_ships < 0);
|
return (BOOLEAN) (num_ships < 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The callback function is called on every battle frame
|
// The callback function is called on every battle frame
|
||||||
// with GraphicsLock held, just before the display queue
|
// just before the display queue is drawn
|
||||||
// is drawn
|
|
||||||
typedef void (BattleFrameCallback) (void);
|
typedef void (BattleFrameCallback) (void);
|
||||||
|
|
||||||
typedef struct battlestate_struct {
|
typedef struct battlestate_struct {
|
||||||
|
|||||||
@@ -144,9 +144,7 @@ AddEscortShips (COUNT race, SIZE count)
|
|||||||
InsertQueue (&GLOBAL (built_ship_q), hStarShip, hOldShip);
|
InsertQueue (&GLOBAL (built_ship_q), hStarShip, hOldShip);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,9 +387,7 @@ RemoveSomeEscortShips (COUNT race, COUNT count)
|
|||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
// Update the display.
|
// Update the display.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ AddEvent (EVENT_TYPE type, COUNT month_index, COUNT day_index, COUNT
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function must be called with GraphicsLock held.
|
|
||||||
void
|
void
|
||||||
GameClockTick (void)
|
GameClockTick (void)
|
||||||
{
|
{
|
||||||
@@ -299,7 +298,6 @@ GameClockTick (void)
|
|||||||
UnlockMutex (clock_mutex);
|
UnlockMutex (clock_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function must be called with GraphicsLock held.
|
|
||||||
void
|
void
|
||||||
MoveGameClockDays (COUNT days)
|
MoveGameClockDays (COUNT days)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -531,14 +531,12 @@ DrawConnectDialog (void)
|
|||||||
r.corner.x = (SCREEN_WIDTH - r.extent.width) >> 1;
|
r.corner.x = (SCREEN_WIDTH - r.extent.width) >> 1;
|
||||||
r.corner.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
|
r.corner.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
|
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
|
||||||
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
|
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
|
||||||
|
|
||||||
menu.draw ((WIDGET *)&menu, r.corner.x + 10, r.corner.y + 10);
|
menu.draw ((WIDGET *)&menu, r.corner.x + 10, r.corner.y + 10);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
|
|||||||
@@ -632,13 +632,11 @@ DoTalkSegue (TALKING_STATE *pTS)
|
|||||||
CheckSubtitles ();
|
CheckSubtitles ();
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
// XXX: When seeking, all animations (talking and ambient) stop
|
// XXX: When seeking, all animations (talking and ambient) stop
|
||||||
// progressing. This is an original 3DO behavior, and I see no
|
// progressing. This is an original 3DO behavior, and I see no
|
||||||
// reason why the animations cannot continue while seeking.
|
// reason why the animations cannot continue while seeking.
|
||||||
UpdateAnimations (pTS->seeking);
|
UpdateAnimations (pTS->seeking);
|
||||||
UpdateSpeechGraphics ();
|
UpdateSpeechGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
curTrack = PlayingTrack ();
|
curTrack = PlayingTrack ();
|
||||||
pTS->ended = !pTS->seeking && !curTrack;
|
pTS->ended = !pTS->seeking && !curTrack;
|
||||||
@@ -653,9 +651,7 @@ DoTalkSegue (TALKING_STATE *pTS)
|
|||||||
static void
|
static void
|
||||||
runCommAnimFrame (void)
|
runCommAnimFrame (void)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
UpdateCommGraphics ();
|
UpdateCommGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SleepThread (COMM_ANIM_RATE);
|
SleepThread (COMM_ANIM_RATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,13 +760,11 @@ AlienTalkSegue (COUNT wait_track)
|
|||||||
if (!pCurInputState->Initialized)
|
if (!pCurInputState->Initialized)
|
||||||
{
|
{
|
||||||
InitSpeechGraphics ();
|
InitSpeechGraphics ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetColorMap (GetColorMapAddress (CommData.AlienColorMap));
|
SetColorMap (GetColorMapAddress (CommData.AlienColorMap));
|
||||||
SetContext (AnimContext);
|
SetContext (AnimContext);
|
||||||
DrawAlienFrame (NULL, 0, TRUE);
|
DrawAlienFrame (NULL, 0, TRUE);
|
||||||
UpdateSpeechGraphics ();
|
UpdateSpeechGraphics ();
|
||||||
CommIntroTransition ();
|
CommIntroTransition ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pCurInputState->Initialized = TRUE;
|
pCurInputState->Initialized = TRUE;
|
||||||
|
|
||||||
@@ -845,7 +839,6 @@ DoConvSummary (SUMMARY_STATE *pSS)
|
|||||||
r.extent.width = SIS_SCREEN_WIDTH;
|
r.extent.width = SIS_SCREEN_WIDTH;
|
||||||
r.extent.height = SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2;
|
r.extent.height = SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (AnimContext);
|
SetContext (AnimContext);
|
||||||
SetContextForeGroundColor (COMM_HISTORY_BACKGROUND_COLOR);
|
SetContextForeGroundColor (COMM_HISTORY_BACKGROUND_COLOR);
|
||||||
DrawFilledRectangle (&r);
|
DrawFilledRectangle (&r);
|
||||||
@@ -914,7 +907,6 @@ DoConvSummary (SUMMARY_STATE *pSS)
|
|||||||
font_DrawText (&mt);
|
font_DrawText (&mt);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pSS->PrintNext = FALSE;
|
pSS->PrintNext = FALSE;
|
||||||
}
|
}
|
||||||
@@ -934,9 +926,7 @@ SelectResponse (ENCOUNTER_STATE *pES)
|
|||||||
&pES->response_list[pES->cur_response].response_text;
|
&pES->response_list[pES->cur_response].response_text;
|
||||||
utf8StringCopy (pES->phrase_buf, sizeof pES->phrase_buf,
|
utf8StringCopy (pES->phrase_buf, sizeof pES->phrase_buf,
|
||||||
response_text->pStr);
|
response_text->pStr);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
FeedbackPlayerPhrase (pES->phrase_buf);
|
FeedbackPlayerPhrase (pES->phrase_buf);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
StopTrack ();
|
StopTrack ();
|
||||||
ClearSubtitles ();
|
ClearSubtitles ();
|
||||||
SetSliderImage (SetAbsFrameIndex (ActivityFrame, 2));
|
SetSliderImage (SetAbsFrameIndex (ActivityFrame, 2));
|
||||||
@@ -955,29 +945,23 @@ SelectConversationSummary (ENCOUNTER_STATE *pES)
|
|||||||
{
|
{
|
||||||
SUMMARY_STATE SummaryState;
|
SUMMARY_STATE SummaryState;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (pES)
|
if (pES)
|
||||||
FeedbackPlayerPhrase (pES->phrase_buf);
|
FeedbackPlayerPhrase (pES->phrase_buf);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SummaryState.Initialized = FALSE;
|
SummaryState.Initialized = FALSE;
|
||||||
DoConvSummary (&SummaryState);
|
DoConvSummary (&SummaryState);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (pES)
|
if (pES)
|
||||||
RefreshResponses (pES);
|
RefreshResponses (pES);
|
||||||
clear_subtitles = TRUE;
|
clear_subtitles = TRUE;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SelectReplay (ENCOUNTER_STATE *pES)
|
SelectReplay (ENCOUNTER_STATE *pES)
|
||||||
{
|
{
|
||||||
FadeMusic (BACKGROUND_VOL, ONE_SECOND);
|
FadeMusic (BACKGROUND_VOL, ONE_SECOND);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (pES)
|
if (pES)
|
||||||
FeedbackPlayerPhrase (pES->phrase_buf);
|
FeedbackPlayerPhrase (pES->phrase_buf);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
TalkSegue (0);
|
TalkSegue (0);
|
||||||
}
|
}
|
||||||
@@ -990,9 +974,7 @@ PlayerResponseInput (ENCOUNTER_STATE *pES)
|
|||||||
if (pES->top_response == (BYTE)~0)
|
if (pES->top_response == (BYTE)~0)
|
||||||
{
|
{
|
||||||
pES->top_response = 0;
|
pES->top_response = 0;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RefreshResponses (pES);
|
RefreshResponses (pES);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_SELECT])
|
if (PulsedInputState.menu[KEY_MENU_SELECT])
|
||||||
@@ -1013,9 +995,7 @@ PlayerResponseInput (ENCOUNTER_STATE *pES)
|
|||||||
|
|
||||||
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RefreshResponses (pES);
|
RefreshResponses (pES);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
FadeMusic (FOREGROUND_VOL, ONE_SECOND);
|
FadeMusic (FOREGROUND_VOL, ONE_SECOND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1029,7 +1009,6 @@ PlayerResponseInput (ENCOUNTER_STATE *pES)
|
|||||||
{
|
{
|
||||||
COORD y;
|
COORD y;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
add_text (-2,
|
add_text (-2,
|
||||||
&pES->response_list[pES->cur_response].response_text);
|
&pES->response_list[pES->cur_response].response_text);
|
||||||
@@ -1049,12 +1028,9 @@ PlayerResponseInput (ENCOUNTER_STATE *pES)
|
|||||||
RefreshResponses (pES);
|
RefreshResponses (pES);
|
||||||
}
|
}
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
UpdateCommGraphics ();
|
UpdateCommGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (pES->NextTime);
|
SleepThreadUntil (pES->NextTime);
|
||||||
pES->NextTime = GetTimeCounter () + COMM_ANIM_RATE;
|
pES->NextTime = GetTimeCounter () + COMM_ANIM_RATE;
|
||||||
@@ -1094,9 +1070,7 @@ DoLastReplay (LAST_REPLAY_STATE *pLRS)
|
|||||||
pLRS->TimeOut = FadeMusic (0, ONE_SECOND * 2) + ONE_SECOND / 60;
|
pLRS->TimeOut = FadeMusic (0, ONE_SECOND * 2) + ONE_SECOND / 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
UpdateCommGraphics ();
|
UpdateCommGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (pLRS->NextTime);
|
SleepThreadUntil (pLRS->NextTime);
|
||||||
pLRS->NextTime = GetTimeCounter () + COMM_ANIM_RATE;
|
pLRS->NextTime = GetTimeCounter () + COMM_ANIM_RATE;
|
||||||
@@ -1135,11 +1109,9 @@ DoCommunication (ENCOUNTER_STATE *pES)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
DestroyContext (AnimContext);
|
DestroyContext (AnimContext);
|
||||||
AnimContext = NULL;
|
AnimContext = NULL;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
FlushColorXForms ();
|
FlushColorXForms ();
|
||||||
ClearSubtitles ();
|
ClearSubtitles ();
|
||||||
@@ -1228,7 +1200,6 @@ HailAlien (void)
|
|||||||
SubtitleText.baseline = CommData.AlienTextBaseline;
|
SubtitleText.baseline = CommData.AlienTextBaseline;
|
||||||
SubtitleText.align = CommData.AlienTextAlign;
|
SubtitleText.align = CommData.AlienTextAlign;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// init subtitle cache context
|
// init subtitle cache context
|
||||||
TextCacheContext = CreateContext ("TextCacheContext");
|
TextCacheContext = CreateContext ("TextCacheContext");
|
||||||
@@ -1293,7 +1264,6 @@ HailAlien (void)
|
|||||||
DrawSISComWindow ();
|
DrawSISComWindow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LastActivity |= CHECK_LOAD; /* prevent spurious input */
|
LastActivity |= CHECK_LOAD; /* prevent spurious input */
|
||||||
(*CommData.init_encounter_func) ();
|
(*CommData.init_encounter_func) ();
|
||||||
@@ -1302,10 +1272,8 @@ HailAlien (void)
|
|||||||
(*CommData.post_encounter_func) ();
|
(*CommData.post_encounter_func) ();
|
||||||
(*CommData.uninit_encounter_func) ();
|
(*CommData.uninit_encounter_func) ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
SetContextFont (OldFont);
|
SetContextFont (OldFont);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DestroyStringTable (ReleaseStringTable (CommData.ConversationPhrases));
|
DestroyStringTable (ReleaseStringTable (CommData.ConversationPhrases));
|
||||||
DestroyMusic (CommData.AlienSong);
|
DestroyMusic (CommData.AlienSong);
|
||||||
@@ -1343,7 +1311,6 @@ InitCommunication (CONVERSATION which_comm)
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (LastActivity & CHECK_LOAD)
|
if (LastActivity & CHECK_LOAD)
|
||||||
{
|
{
|
||||||
@@ -1369,7 +1336,6 @@ InitCommunication (CONVERSATION which_comm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (which_comm == URQUAN_DRONE_CONVERSATION)
|
if (which_comm == URQUAN_DRONE_CONVERSATION)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -227,10 +227,8 @@ NoRadioactives (RESPONSE_REF R)
|
|||||||
{
|
{
|
||||||
NPCPhrase (HERE_IS_A_NEW_LANDER);
|
NPCPhrase (HERE_IS_A_NEW_LANDER);
|
||||||
++GLOBAL_SIS (NumLanders);
|
++GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
DeltaSISGauges (4, 0, 0);
|
DeltaSISGauges (4, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (LANDERS_LOST, 1);
|
SET_GAME_STATE (LANDERS_LOST, 1);
|
||||||
}
|
}
|
||||||
@@ -238,27 +236,21 @@ NoRadioactives (RESPONSE_REF R)
|
|||||||
{
|
{
|
||||||
NPCPhrase (HERE_IS_ANOTHER_LANDER);
|
NPCPhrase (HERE_IS_ANOTHER_LANDER);
|
||||||
++GLOBAL_SIS (NumLanders);
|
++GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
DeltaSISGauges (4, 0, 0);
|
DeltaSISGauges (4, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, need_fuel_mercury) ||
|
else if (PLAYER_SAID (R, need_fuel_mercury) ||
|
||||||
PLAYER_SAID (R, need_fuel_luna))
|
PLAYER_SAID (R, need_fuel_luna))
|
||||||
{
|
{
|
||||||
NPCPhrase (GIVE_FUEL);
|
NPCPhrase (GIVE_FUEL);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
|
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, need_fuel_again))
|
else if (PLAYER_SAID (R, need_fuel_again))
|
||||||
{
|
{
|
||||||
NPCPhrase (GIVE_FUEL_AGAIN);
|
NPCPhrase (GIVE_FUEL_AGAIN);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE]))
|
if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE]))
|
||||||
@@ -297,10 +289,8 @@ AskAfterRadios (RESPONSE_REF R)
|
|||||||
{
|
{
|
||||||
NPCPhrase (HERE_IS_A_NEW_LANDER);
|
NPCPhrase (HERE_IS_A_NEW_LANDER);
|
||||||
++GLOBAL_SIS (NumLanders);
|
++GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
DeltaSISGauges (4, 0, 0);
|
DeltaSISGauges (4, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (LANDERS_LOST, 1);
|
SET_GAME_STATE (LANDERS_LOST, 1);
|
||||||
}
|
}
|
||||||
@@ -308,27 +298,21 @@ AskAfterRadios (RESPONSE_REF R)
|
|||||||
{
|
{
|
||||||
NPCPhrase (HERE_IS_ANOTHER_LANDER);
|
NPCPhrase (HERE_IS_ANOTHER_LANDER);
|
||||||
++GLOBAL_SIS (NumLanders);
|
++GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
DeltaSISGauges (4, 0, 0);
|
DeltaSISGauges (4, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, need_fuel_mercury) ||
|
else if (PLAYER_SAID (R, need_fuel_mercury) ||
|
||||||
PLAYER_SAID (R, need_fuel_luna))
|
PLAYER_SAID (R, need_fuel_luna))
|
||||||
{
|
{
|
||||||
NPCPhrase (GIVE_FUEL);
|
NPCPhrase (GIVE_FUEL);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
|
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, need_fuel_again))
|
else if (PLAYER_SAID (R, need_fuel_again))
|
||||||
{
|
{
|
||||||
NPCPhrase (GIVE_FUEL_AGAIN);
|
NPCPhrase (GIVE_FUEL_AGAIN);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, where_get_radios))
|
else if (PLAYER_SAID (R, where_get_radios))
|
||||||
{
|
{
|
||||||
@@ -399,10 +383,8 @@ TellMoonBase (RESPONSE_REF R)
|
|||||||
{
|
{
|
||||||
NPCPhrase (HERE_IS_A_NEW_LANDER);
|
NPCPhrase (HERE_IS_A_NEW_LANDER);
|
||||||
++GLOBAL_SIS (NumLanders);
|
++GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
DeltaSISGauges (4, 0, 0);
|
DeltaSISGauges (4, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (LANDERS_LOST, 1);
|
SET_GAME_STATE (LANDERS_LOST, 1);
|
||||||
}
|
}
|
||||||
@@ -410,27 +392,21 @@ TellMoonBase (RESPONSE_REF R)
|
|||||||
{
|
{
|
||||||
NPCPhrase (HERE_IS_ANOTHER_LANDER);
|
NPCPhrase (HERE_IS_ANOTHER_LANDER);
|
||||||
++GLOBAL_SIS (NumLanders);
|
++GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
DeltaSISGauges (4, 0, 0);
|
DeltaSISGauges (4, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, need_fuel_mercury) ||
|
else if (PLAYER_SAID (R, need_fuel_mercury) ||
|
||||||
PLAYER_SAID (R, need_fuel_luna))
|
PLAYER_SAID (R, need_fuel_luna))
|
||||||
{
|
{
|
||||||
NPCPhrase (GIVE_FUEL);
|
NPCPhrase (GIVE_FUEL);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
|
SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, need_fuel_again))
|
else if (PLAYER_SAID (R, need_fuel_again))
|
||||||
{
|
{
|
||||||
NPCPhrase (GIVE_FUEL_AGAIN);
|
NPCPhrase (GIVE_FUEL_AGAIN);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (PLAYER_SAID (R, we_are_here_to_help))
|
else if (PLAYER_SAID (R, we_are_here_to_help))
|
||||||
{
|
{
|
||||||
@@ -593,9 +569,7 @@ GiveRadios (RESPONSE_REF R)
|
|||||||
NPCPhrase (FUEL_UP1);
|
NPCPhrase (FUEL_UP1);
|
||||||
AlienTalkSegue (1);
|
AlienTalkSegue (1);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED;
|
CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
XFormColorMap (GetColorMapAddress (
|
XFormColorMap (GetColorMapAddress (
|
||||||
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
|
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
|
||||||
|
|||||||
@@ -244,9 +244,7 @@ Buy (RESPONSE_REF R)
|
|||||||
NPCPhrase (NOT_ENOUGH_ROOM);
|
NPCPhrase (NOT_ENOUGH_ROOM);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (-SHIP_CREW_COST, 0, 0);
|
DeltaSISGauges (-SHIP_CREW_COST, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SlaveryCount += SHIP_CREW_COST;
|
SlaveryCount += SHIP_CREW_COST;
|
||||||
AddEscortShips (DRUUGE_SHIP, 1);
|
AddEscortShips (DRUUGE_SHIP, 1);
|
||||||
|
|
||||||
@@ -260,9 +258,7 @@ Buy (RESPONSE_REF R)
|
|||||||
NPCPhrase (NOT_ENOUGH_CREW);
|
NPCPhrase (NOT_ENOUGH_CREW);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
|
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SlaveryCount += ARTIFACT_CREW_COST;
|
SlaveryCount += ARTIFACT_CREW_COST;
|
||||||
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
|
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
|
||||||
SET_GAME_STATE (ROSY_SPHERE, 1);
|
SET_GAME_STATE (ROSY_SPHERE, 1);
|
||||||
@@ -276,9 +272,7 @@ Buy (RESPONSE_REF R)
|
|||||||
NPCPhrase (NOT_ENOUGH_CREW);
|
NPCPhrase (NOT_ENOUGH_CREW);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
|
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SlaveryCount += ARTIFACT_CREW_COST;
|
SlaveryCount += ARTIFACT_CREW_COST;
|
||||||
SET_GAME_STATE (ARTIFACT_2_ON_SHIP, 1);
|
SET_GAME_STATE (ARTIFACT_2_ON_SHIP, 1);
|
||||||
|
|
||||||
@@ -291,9 +285,7 @@ Buy (RESPONSE_REF R)
|
|||||||
NPCPhrase (NOT_ENOUGH_CREW);
|
NPCPhrase (NOT_ENOUGH_CREW);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
|
DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SlaveryCount += ARTIFACT_CREW_COST;
|
SlaveryCount += ARTIFACT_CREW_COST;
|
||||||
SET_GAME_STATE (ARTIFACT_3_ON_SHIP, 1);
|
SET_GAME_STATE (ARTIFACT_3_ON_SHIP, 1);
|
||||||
|
|
||||||
@@ -307,10 +299,8 @@ Buy (RESPONSE_REF R)
|
|||||||
NPCPhrase (NOT_ENOUGH_CREW);
|
NPCPhrase (NOT_ENOUGH_CREW);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (-FUEL_CREW_COST,
|
DeltaSISGauges (-FUEL_CREW_COST,
|
||||||
FUEL_CREW_COST * FUEL_TANK_SCALE, 0);
|
FUEL_CREW_COST * FUEL_TANK_SCALE, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SlaveryCount += FUEL_CREW_COST;
|
SlaveryCount += FUEL_CREW_COST;
|
||||||
|
|
||||||
NPCPhrase (BOUGHT_FUEL);
|
NPCPhrase (BOUGHT_FUEL);
|
||||||
@@ -466,14 +456,12 @@ DoTransaction (RESPONSE_REF R)
|
|||||||
capacity -= GLOBAL_SIS (FuelOnBoard);
|
capacity -= GLOBAL_SIS (FuelOnBoard);
|
||||||
f = (COUNT)((capacity + (FUEL_TANK_SCALE >> 1)) / FUEL_TANK_SCALE);
|
f = (COUNT)((capacity + (FUEL_TANK_SCALE >> 1)) / FUEL_TANK_SCALE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
while (capacity > 0x3FFFL)
|
while (capacity > 0x3FFFL)
|
||||||
{
|
{
|
||||||
DeltaSISGauges (0, 0x3FFF, 0);
|
DeltaSISGauges (0, 0x3FFF, 0);
|
||||||
capacity -= 0x3FFF;
|
capacity -= 0x3FFF;
|
||||||
}
|
}
|
||||||
DeltaSISGauges (0, (SIZE)capacity, 0);
|
DeltaSISGauges (0, (SIZE)capacity, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
NPCPhrase (FUEL0);
|
NPCPhrase (FUEL0);
|
||||||
NPCNumber (f, NULL);
|
NPCNumber (f, NULL);
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
|
|
||||||
#include "uqm/gameev.h"
|
#include "uqm/gameev.h"
|
||||||
#include "uqm/setup.h"
|
|
||||||
// for GraphicsLock
|
|
||||||
#include "uqm/shipcont.h"
|
#include "uqm/shipcont.h"
|
||||||
#include "libs/inplib.h"
|
#include "libs/inplib.h"
|
||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
@@ -590,9 +588,7 @@ StripShip (COUNT fuel_required)
|
|||||||
if (fuel_required == 0)
|
if (fuel_required == 0)
|
||||||
{
|
{
|
||||||
GlobData.SIS_state = SIS_copy;
|
GlobData.SIS_state = SIS_copy;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, rescue_fuel, UNDEFINED_DELTA);
|
DeltaSISGauges (UNDEFINED_DELTA, rescue_fuel, UNDEFINED_DELTA);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (fuel_required == (COUNT)~0)
|
else if (fuel_required == (COUNT)~0)
|
||||||
{
|
{
|
||||||
@@ -616,9 +612,7 @@ StripShip (COUNT fuel_required)
|
|||||||
GLOBAL_SIS (ModuleSlots[i]) = EMPTY_SLOT + 2;
|
GLOBAL_SIS (ModuleSlots[i]) = EMPTY_SLOT + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (fuel_required)
|
else if (fuel_required)
|
||||||
{
|
{
|
||||||
@@ -735,9 +729,7 @@ StripShip (COUNT fuel_required)
|
|||||||
if (total == 0)
|
if (total == 0)
|
||||||
{
|
{
|
||||||
NPCPhrase (CHARITY);
|
NPCPhrase (CHARITY);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, fuel_required, 0);
|
DeltaSISGauges (0, fuel_required, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -891,9 +883,7 @@ DeltaCredit (SIZE delta_credit)
|
|||||||
{
|
{
|
||||||
Credit += delta_credit;
|
Credit += delta_credit;
|
||||||
SetAvailableCredits (Credit);
|
SetAvailableCredits (Credit);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,14 +1035,12 @@ DoBuy (RESPONSE_REF R)
|
|||||||
NPCPhrase (GOT_FUEL);
|
NPCPhrase (GOT_FUEL);
|
||||||
|
|
||||||
f = (DWORD)needed_credit * FUEL_TANK_SCALE;
|
f = (DWORD)needed_credit * FUEL_TANK_SCALE;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
while (f > 0x3FFFL)
|
while (f > 0x3FFFL)
|
||||||
{
|
{
|
||||||
DeltaSISGauges (0, 0x3FFF, 0);
|
DeltaSISGauges (0, 0x3FFF, 0);
|
||||||
f -= 0x3FFF;
|
f -= 0x3FFF;
|
||||||
}
|
}
|
||||||
DeltaSISGauges (0, (SIZE)f, 0);
|
DeltaSISGauges (0, (SIZE)f, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
needed_credit *= (BIO_CREDIT_VALUE / 2);
|
needed_credit *= (BIO_CREDIT_VALUE / 2);
|
||||||
}
|
}
|
||||||
@@ -1251,9 +1239,7 @@ DoSell (RESPONSE_REF R)
|
|||||||
} while (GLOBAL_SIS (TotalBioMass));
|
} while (GLOBAL_SIS (TotalBioMass));
|
||||||
SleepThread (ONE_SECOND / 2);
|
SleepThread (ONE_SECOND / 2);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ClearSISRect (DRAW_SIS_DISPLAY);
|
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else /* if (R == sell_rainbow_locations) */
|
else /* if (R == sell_rainbow_locations) */
|
||||||
{
|
{
|
||||||
@@ -1838,11 +1824,9 @@ uninit_melnorme (void)
|
|||||||
static void
|
static void
|
||||||
post_melnorme_enc (void)
|
post_melnorme_enc (void)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (prevMsgMode != SMM_UNDEFINED)
|
if (prevMsgMode != SMM_UNDEFINED)
|
||||||
SetStatusMessageMode (prevMsgMode);
|
SetStatusMessageMode (prevMsgMode);
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCDATA*
|
LOCDATA*
|
||||||
|
|||||||
@@ -1656,9 +1656,7 @@ NormalStarbase (RESPONSE_REF R)
|
|||||||
else
|
else
|
||||||
NPCPhrase (GLOBAL_SHIP_NAME);
|
NPCPhrase (GLOBAL_SHIP_NAME);
|
||||||
NPCPhrase (STARBASE_IS_READY_C);
|
NPCPhrase (STARBASE_IS_READY_C);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 0, 2500);
|
DeltaSISGauges (0, 0, 2500);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SET_GAME_STATE (STARBASE_MONTH,
|
SET_GAME_STATE (STARBASE_MONTH,
|
||||||
GLOBAL (GameClock.month_index));
|
GLOBAL (GameClock.month_index));
|
||||||
SET_GAME_STATE (STARBASE_DAY,
|
SET_GAME_STATE (STARBASE_DAY,
|
||||||
@@ -1770,9 +1768,7 @@ SellMinerals (RESPONSE_REF R)
|
|||||||
Sleepy = FALSE;
|
Sleepy = FALSE;
|
||||||
GLOBAL_SIS (ElementAmounts[i]) = 0;
|
GLOBAL_SIS (ElementAmounts[i]) = 0;
|
||||||
GLOBAL_SIS (TotalElementMass) -= amount;
|
GLOBAL_SIS (TotalElementMass) -= amount;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, 0, amount * GLOBAL (ElementWorth[i]));
|
DeltaSISGauges (0, 0, amount * GLOBAL (ElementWorth[i]));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1781,10 +1777,8 @@ SellMinerals (RESPONSE_REF R)
|
|||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
DrawCargoStrings ((BYTE)i, (BYTE)i);
|
DrawCargoStrings ((BYTE)i, (BYTE)i);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ShowRemainingCapacity ();
|
ShowRemainingCapacity ();
|
||||||
DeltaSISGauges (0, 0, GLOBAL (ElementWorth[i]));
|
DeltaSISGauges (0, 0, GLOBAL (ElementWorth[i]));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
} while (--amount);
|
} while (--amount);
|
||||||
}
|
}
|
||||||
if (Sleepy) {
|
if (Sleepy) {
|
||||||
@@ -1794,9 +1788,7 @@ SellMinerals (RESPONSE_REF R)
|
|||||||
}
|
}
|
||||||
SleepThread (ONE_SECOND / 2);
|
SleepThread (ONE_SECOND / 2);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ClearSISRect (DRAW_SIS_DISPLAY);
|
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
// DrawStorageBays (FALSE);
|
// DrawStorageBays (FALSE);
|
||||||
|
|
||||||
if (total < 1000)
|
if (total < 1000)
|
||||||
|
|||||||
@@ -118,15 +118,12 @@ enum
|
|||||||
|
|
||||||
static int LastAlien;
|
static int LastAlien;
|
||||||
|
|
||||||
|
// Queued and executes synchronously on the Starcon2Main thread
|
||||||
static void
|
static void
|
||||||
SelectAlienZOQ (void)
|
SelectAlienZOQ (CallbackArg arg)
|
||||||
{
|
{
|
||||||
if (LastAlien != ZOQ_ALIEN)
|
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
|
// Transition to neutral state first if Pik was talking
|
||||||
if (LastAlien != FOT_ALIEN)
|
if (LastAlien != FOT_ALIEN)
|
||||||
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
|
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
|
||||||
@@ -142,17 +139,16 @@ SelectAlienZOQ (void)
|
|||||||
CommData.AlienTextFColor = ZOQ_FG_COLOR;
|
CommData.AlienTextFColor = ZOQ_FG_COLOR;
|
||||||
CommData.AlienTextBColor = ZOQ_BG_COLOR;
|
CommData.AlienTextBColor = ZOQ_BG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)arg; // ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Queued and executes synchronously on the Starcon2Main thread
|
||||||
static void
|
static void
|
||||||
SelectAlienPIK (void)
|
SelectAlienPIK (CallbackArg arg)
|
||||||
{
|
{
|
||||||
if (LastAlien != PIK_ALIEN)
|
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
|
// Transition to neutral state first if Zoq was talking
|
||||||
if (LastAlien != FOT_ALIEN)
|
if (LastAlien != FOT_ALIEN)
|
||||||
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
|
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
|
||||||
@@ -168,13 +164,15 @@ SelectAlienPIK (void)
|
|||||||
CommData.AlienTextFColor = PIK_FG_COLOR;
|
CommData.AlienTextFColor = PIK_FG_COLOR;
|
||||||
CommData.AlienTextBColor = PIK_BG_COLOR;
|
CommData.AlienTextBColor = PIK_BG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)arg; // ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ZFPTalkSegue (COUNT wait_track)
|
ZFPTalkSegue (COUNT wait_track)
|
||||||
{
|
{
|
||||||
LastAlien = FOT_ALIEN;
|
LastAlien = FOT_ALIEN;
|
||||||
SelectAlienZOQ ();
|
SelectAlienZOQ (0);
|
||||||
AlienTalkSegue (wait_track);
|
AlienTalkSegue (wait_track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,10 @@
|
|||||||
|
|
||||||
static int NPCNumberPhrase (int number, const char *fmt, UNICODE **ptrack);
|
static int NPCNumberPhrase (int number, const char *fmt, UNICODE **ptrack);
|
||||||
|
|
||||||
|
// The CallbackFunction is queued and executes synchronously
|
||||||
|
// on the Starcon2Main thread
|
||||||
void
|
void
|
||||||
NPCPhrase_cb (int index, TFB_TrackCB cb)
|
NPCPhrase_cb (int index, CallbackFunction cb)
|
||||||
{
|
{
|
||||||
UNICODE *pStr, buf[400];
|
UNICODE *pStr, buf[400];
|
||||||
void *pClip, *pTimeStamp;
|
void *pClip, *pTimeStamp;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "globdata.h"
|
#include "globdata.h"
|
||||||
#include "resinst.h"
|
#include "resinst.h"
|
||||||
#include "libs/sound/trackplayer.h"
|
#include "libs/sound/trackplayer.h"
|
||||||
|
#include "libs/callback.h"
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -88,7 +89,9 @@ extern void DoResponsePhrase (RESPONSE_REF R, RESPONSE_FUNC
|
|||||||
response_func, UNICODE *ContstructStr);
|
response_func, UNICODE *ContstructStr);
|
||||||
extern void DoNPCPhrase (UNICODE *pStr);
|
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)
|
#define NPCPhrase(index) NPCPhrase_cb ((index), NULL)
|
||||||
extern void NPCPhrase_splice (int index);
|
extern void NPCPhrase_splice (int index);
|
||||||
extern void NPCNumber (int number, const char *fmt);
|
extern void NPCNumber (int number, const char *fmt);
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ DoConfirmExit (void)
|
|||||||
|
|
||||||
PauseFlash ();
|
PauseFlash ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
STAMP s;
|
STAMP s;
|
||||||
@@ -160,7 +159,6 @@ DoConfirmExit (void)
|
|||||||
SetContextClipRect (&oldRect);
|
SetContextClipRect (&oldRect);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
ContinueFlash ();
|
ContinueFlash ();
|
||||||
|
|
||||||
@@ -217,7 +215,6 @@ DoPopupWindow (const char *msg)
|
|||||||
label.lines = lines;
|
label.lines = lines;
|
||||||
|
|
||||||
PauseFlash ();
|
PauseFlash ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
oldContext = SetContext (ScreenContext);
|
oldContext = SetContext (ScreenContext);
|
||||||
GetContextClipRect (&oldRect);
|
GetContextClipRect (&oldRect);
|
||||||
@@ -246,7 +243,6 @@ DoPopupWindow (const char *msg)
|
|||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
SetContextClipRect (&oldRect);
|
SetContextClipRect (&oldRect);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
ContinueFlash ();
|
ContinueFlash ();
|
||||||
SetMenuSounds (s0, s1);
|
SetMenuSounds (s0, s1);
|
||||||
StringBank_Free (bank);
|
StringBank_Free (bank);
|
||||||
|
|||||||
@@ -119,9 +119,6 @@ BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput);
|
|||||||
void DoPopupWindow(const char *msg);
|
void DoPopupWindow(const char *msg);
|
||||||
|
|
||||||
typedef void (InputFrameCallback) (void);
|
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 *);
|
InputFrameCallback* SetInputCallback (InputFrameCallback *);
|
||||||
// pInputState must point to a struct derived from INPUT_STATE_DESC
|
// pInputState must point to a struct derived from INPUT_STATE_DESC
|
||||||
void DoInput (void *pInputState, BOOLEAN resetInput);
|
void DoInput (void *pInputState, BOOLEAN resetInput);
|
||||||
|
|||||||
@@ -240,7 +240,6 @@ Credits_RenderTextFrame (CONTEXT TempContext, int *istr, int dir,
|
|||||||
t.pStr = " ";
|
t.pStr = " ";
|
||||||
t.CharCount = 1;
|
t.CharCount = 1;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (TempContext);
|
OldContext = SetContext (TempContext);
|
||||||
|
|
||||||
// get font dimensions
|
// get font dimensions
|
||||||
@@ -312,7 +311,6 @@ Credits_RenderTextFrame (CONTEXT TempContext, int *istr, int dir,
|
|||||||
|
|
||||||
SetContextFGFrame (OldFrame);
|
SetContextFGFrame (OldFrame);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
@@ -331,7 +329,6 @@ RenderCreditsScreen (CONTEXT targetContext)
|
|||||||
STAMP s;
|
STAMP s;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldContext = SetContext (targetContext);
|
oldContext = SetContext (targetContext);
|
||||||
// draw background
|
// draw background
|
||||||
s.origin.x = 0;
|
s.origin.x = 0;
|
||||||
@@ -358,7 +355,6 @@ RenderCreditsScreen (CONTEXT targetContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -373,7 +369,6 @@ InitCredits (void)
|
|||||||
LocalContext = CreateContext ("Credits.LocalContext");
|
LocalContext = CreateContext ("Credits.LocalContext");
|
||||||
DrawContext = CreateContext ("Credits.DrawContext");
|
DrawContext = CreateContext ("Credits.DrawContext");
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
targetFrame = GetContextFGFrame ();
|
targetFrame = GetContextFGFrame ();
|
||||||
GetContextClipRect (&ctxRect);
|
GetContextClipRect (&ctxRect);
|
||||||
CreditsExtent = ctxRect.extent;
|
CreditsExtent = ctxRect.extent;
|
||||||
@@ -402,7 +397,6 @@ InitCredits (void)
|
|||||||
SetContextFGFrame (targetFrame);
|
SetContextFGFrame (targetFrame);
|
||||||
|
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// Prepare the first screen frame
|
// Prepare the first screen frame
|
||||||
RenderCreditsScreen (LocalContext);
|
RenderCreditsScreen (LocalContext);
|
||||||
@@ -493,12 +487,10 @@ processCreditsFrame (void)
|
|||||||
s.origin.y = 0;
|
s.origin.y = 0;
|
||||||
s.frame = CreditsFrame;
|
s.frame = CreditsFrame;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (DrawContext);
|
OldContext = SetContext (DrawContext);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// prepare next screen frame
|
// prepare next screen frame
|
||||||
deficitHeight = calcDeficitHeight ();
|
deficitHeight = calcDeficitHeight ();
|
||||||
@@ -782,13 +774,11 @@ Credits (BOOLEAN WithOuttakes)
|
|||||||
|
|
||||||
hMusic = LoadMusic (CREDITS_MUSIC);
|
hMusic = LoadMusic (CREDITS_MUSIC);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
SetContextClipRect (NULL);
|
SetContextClipRect (NULL);
|
||||||
GetContextClipRect (&screenRect);
|
GetContextClipRect (&screenRect);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
ClearDrawable ();
|
ClearDrawable ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (!LoadCredits ())
|
if (!LoadCredits ())
|
||||||
return;
|
return;
|
||||||
@@ -797,10 +787,8 @@ Credits (BOOLEAN WithOuttakes)
|
|||||||
s.origin.x = 0;
|
s.origin.x = 0;
|
||||||
s.origin.y = 0;
|
s.origin.y = 0;
|
||||||
s.frame = CreditsBack;
|
s.frame = CreditsBack;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
FadeScreen (FadeAllToColor, ONE_SECOND / 2);
|
FadeScreen (FadeAllToColor, ONE_SECOND / 2);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// set the position of outtakes comm
|
// set the position of outtakes comm
|
||||||
CommWndRect.corner.x = (screenRect.extent.width - CommWndRect.extent.width)
|
CommWndRect.corner.x = (screenRect.extent.width - CommWndRect.extent.width)
|
||||||
@@ -836,11 +824,9 @@ Credits (BOOLEAN WithOuttakes)
|
|||||||
FadeMusic (0, ONE_SECOND / 2);
|
FadeMusic (0, ONE_SECOND / 2);
|
||||||
UninitCredits ();
|
UninitCredits ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
|
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
|
||||||
FlushColorXForms ();
|
FlushColorXForms ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (hMusic)
|
if (hMusic)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,9 +78,7 @@ DoSelectAction (MENU_STATE *pMS)
|
|||||||
if (!GameOptions ())
|
if (!GameOptions ())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
DrawMenuStateStrings (PM_CONVERSE, pMS->CurState);
|
DrawMenuStateStrings (PM_CONVERSE, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf ("Unknown option: %d\n", pMS->CurState);
|
printf ("Unknown option: %d\n", pMS->CurState);
|
||||||
@@ -270,7 +268,6 @@ InitEncounter (void)
|
|||||||
extern FRAME planet[];
|
extern FRAME planet[];
|
||||||
MUSIC_REF MR;
|
MUSIC_REF MR;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
@@ -278,11 +275,9 @@ InitEncounter (void)
|
|||||||
MR = LoadMusic (REDALERT_MUSIC);
|
MR = LoadMusic (REDALERT_MUSIC);
|
||||||
PlayMusic (MR, FALSE, 1);
|
PlayMusic (MR, FALSE, 1);
|
||||||
SegueFrame = CaptureDrawable (LoadGraphic (SEGUE_PMAP_ANIM));
|
SegueFrame = CaptureDrawable (LoadGraphic (SEGUE_PMAP_ANIM));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
DestroyMusic (MR);
|
DestroyMusic (MR);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
s.origin.x = s.origin.y = 0;
|
s.origin.x = s.origin.y = 0;
|
||||||
|
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
@@ -394,7 +389,6 @@ InitEncounter (void)
|
|||||||
DestroyDrawable (ReleaseDrawable (SegueFrame));
|
DestroyDrawable (ReleaseDrawable (SegueFrame));
|
||||||
ScreenTransition (3, NULL);
|
ScreenTransition (3, NULL);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
MENU_STATE MenuState;
|
MENU_STATE MenuState;
|
||||||
@@ -403,15 +397,11 @@ InitEncounter (void)
|
|||||||
MenuState.Initialized = FALSE;
|
MenuState.Initialized = FALSE;
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_CONVERSE, MenuState.CurState = HAIL);
|
DrawMenuStateStrings (PM_CONVERSE, MenuState.CurState = HAIL);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DoInput (&MenuState, TRUE);
|
DoInput (&MenuState, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return (MenuState.CurState);
|
return (MenuState.CurState);
|
||||||
}
|
}
|
||||||
@@ -451,10 +441,8 @@ DrawFadeText (const UNICODE *str1, const UNICODE *str2, BOOLEAN fade_in,
|
|||||||
{
|
{
|
||||||
for (i = 0; i < (SIZE) NUM_FADES; ++i)
|
for (i = 0; i < (SIZE) NUM_FADES; ++i)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
if (AnyButtonPress (TRUE))
|
if (AnyButtonPress (TRUE))
|
||||||
i = NUM_FADES - 1;
|
i = NUM_FADES - 1;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetContextForeGroundColor (fade_cycle[i]);
|
SetContextForeGroundColor (fade_cycle[i]);
|
||||||
font_DrawText (&t1);
|
font_DrawText (&t1);
|
||||||
@@ -467,10 +455,8 @@ DrawFadeText (const UNICODE *str1, const UNICODE *str2, BOOLEAN fade_in,
|
|||||||
{
|
{
|
||||||
for (i = NUM_FADES - 1; i >= 0; --i)
|
for (i = NUM_FADES - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
if (AnyButtonPress (TRUE))
|
if (AnyButtonPress (TRUE))
|
||||||
i = 0;
|
i = 0;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetContextForeGroundColor (fade_cycle[i]);
|
SetContextForeGroundColor (fade_cycle[i]);
|
||||||
font_DrawText (&t1);
|
font_DrawText (&t1);
|
||||||
@@ -492,7 +478,6 @@ UninitEncounter (void)
|
|||||||
|
|
||||||
ships_killed = 0;
|
ships_killed = 0;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
free_gravity_well ();
|
free_gravity_well ();
|
||||||
|
|
||||||
if ((GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
if ((GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||||
@@ -702,10 +687,8 @@ UninitEncounter (void)
|
|||||||
TimeCount Time = GetTimeCounter ();
|
TimeCount Time = GetTimeCounter ();
|
||||||
for (j = 0; j < NUM_SHIP_FADES; ++j)
|
for (j = 0; j < NUM_SHIP_FADES; ++j)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
Sleepy = (BOOLEAN)!AnyButtonPress (TRUE) &&
|
Sleepy = (BOOLEAN)!AnyButtonPress (TRUE) &&
|
||||||
!(GLOBAL (CurrentActivity) & CHECK_ABORT);
|
!(GLOBAL (CurrentActivity) & CHECK_ABORT);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (!Sleepy)
|
if (!Sleepy)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -738,9 +721,7 @@ UninitEncounter (void)
|
|||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
#endif /* NEVER */
|
#endif /* NEVER */
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
WaitForAnyButton (TRUE, ONE_SECOND * 3, FALSE);
|
WaitForAnyButton (TRUE, ONE_SECOND * 3, FALSE);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
{
|
{
|
||||||
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
||||||
@@ -766,9 +747,7 @@ UninitEncounter (void)
|
|||||||
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7);
|
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7);
|
||||||
// "Scavenged"
|
// "Scavenged"
|
||||||
DrawFadeText (str1, str2, TRUE, &scavenge_r);
|
DrawFadeText (str1, str2, TRUE, &scavenge_r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
WaitForAnyButton (TRUE, ONE_SECOND * 2, FALSE);
|
WaitForAnyButton (TRUE, ONE_SECOND * 2, FALSE);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
||||||
}
|
}
|
||||||
@@ -787,7 +766,6 @@ UninitEncounter (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExitUninitEncounter:
|
ExitUninitEncounter:
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return (ships_killed);
|
return (ships_killed);
|
||||||
}
|
}
|
||||||
@@ -799,7 +777,6 @@ EncounterBattle (void)
|
|||||||
extern UWORD nth_frame;
|
extern UWORD nth_frame;
|
||||||
InputContext *savedPlayerInput = NULL;
|
InputContext *savedPlayerInput = NULL;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (BATTLE_SEGUE, 1);
|
SET_GAME_STATE (BATTLE_SEGUE, 1);
|
||||||
|
|
||||||
@@ -838,9 +815,7 @@ EncounterBattle (void)
|
|||||||
|
|
||||||
GameSounds = CaptureSound (LoadSound (GAME_SOUNDS));
|
GameSounds = CaptureSound (LoadSound (GAME_SOUNDS));
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
Battle (NULL);
|
Battle (NULL);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DestroySound (ReleaseSound (GameSounds));
|
DestroySound (ReleaseSound (GameSounds));
|
||||||
GameSounds = 0;
|
GameSounds = 0;
|
||||||
@@ -864,6 +839,5 @@ EncounterBattle (void)
|
|||||||
|
|
||||||
GLOBAL (CurrentActivity) = OldActivity;
|
GLOBAL (CurrentActivity) = OldActivity;
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@
|
|||||||
#define FLASH_INTERNAL
|
#define FLASH_INTERNAL
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
// For GraphicsLock.
|
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
#include "libs/memlib.h"
|
#include "libs/memlib.h"
|
||||||
#include "libs/threadlib.h"
|
#include "libs/threadlib.h"
|
||||||
@@ -545,7 +543,6 @@ Flash_grabOriginal (FlashContext *context)
|
|||||||
if (context->original != (FRAME) 0)
|
if (context->original != (FRAME) 0)
|
||||||
DestroyDrawable (ReleaseDrawable (context->original));
|
DestroyDrawable (ReleaseDrawable (context->original));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldGfxContext = SetContext (context->gfxContext);
|
oldGfxContext = SetContext (context->gfxContext);
|
||||||
context->original = CaptureDrawable (CopyContextRect (&context->rect));
|
context->original = CaptureDrawable (CopyContextRect (&context->rect));
|
||||||
SetContext (oldGfxContext);
|
SetContext (oldGfxContext);
|
||||||
@@ -553,7 +550,6 @@ Flash_grabOriginal (FlashContext *context)
|
|||||||
// CopyContextRect() may have queued the command to read
|
// CopyContextRect() may have queued the command to read
|
||||||
// a rectangle from the screen; a FlushGraphics()
|
// a rectangle from the screen; a FlushGraphics()
|
||||||
// is necessary to ensure that it can actually be used.
|
// is necessary to ensure that it can actually be used.
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -589,7 +585,6 @@ Flash_makeFrame (FlashContext *context, FRAME dest, int numer, int denom)
|
|||||||
|
|
||||||
Flash_blendFraction (context, numer, denom, &blendedNumer, &blendedDenom);
|
Flash_blendFraction (context, numer, denom, &blendedNumer, &blendedDenom);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldGfxContext = SetContext (workGfxContext);
|
oldGfxContext = SetContext (workGfxContext);
|
||||||
SetContextFGFrame (dest);
|
SetContextFGFrame (dest);
|
||||||
|
|
||||||
@@ -650,7 +645,6 @@ Flash_makeFrame (FlashContext *context, FRAME dest, int numer, int denom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetContext (oldGfxContext);
|
SetContext (oldGfxContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare an entry in the cache.
|
// Prepare an entry in the cache.
|
||||||
@@ -686,7 +680,6 @@ Flash_drawFrame (FlashContext *context, FRAME frame)
|
|||||||
CONTEXT oldGfxContext;
|
CONTEXT oldGfxContext;
|
||||||
STAMP stamp;
|
STAMP stamp;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldGfxContext = SetContext (context->gfxContext);
|
oldGfxContext = SetContext (context->gfxContext);
|
||||||
|
|
||||||
stamp.origin = context->rect.corner;
|
stamp.origin = context->rect.corner;
|
||||||
@@ -694,7 +687,6 @@ Flash_drawFrame (FlashContext *context, FRAME frame)
|
|||||||
DrawStamp(&stamp);
|
DrawStamp(&stamp);
|
||||||
|
|
||||||
SetContext (oldGfxContext);
|
SetContext (oldGfxContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -79,13 +79,11 @@ SplashScreen (void (* DoProcessing)(DWORD TimeOut))
|
|||||||
DWORD TimeOut;
|
DWORD TimeOut;
|
||||||
|
|
||||||
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 120));
|
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 120));
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
s.origin.x = s.origin.y = 0;
|
s.origin.x = s.origin.y = 0;
|
||||||
s.frame = CaptureDrawable (LoadGraphic (TITLE_ANIM));
|
s.frame = CaptureDrawable (LoadGraphic (TITLE_ANIM));
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
TimeOut = FadeScreen (FadeAllToColor, ONE_SECOND / 2);
|
TimeOut = FadeScreen (FadeAllToColor, ONE_SECOND / 2);
|
||||||
|
|
||||||
|
|||||||
+1
-42
@@ -167,9 +167,7 @@ FeedbackSetting (BYTE which_setting)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (buf);
|
DrawStatusMessage (buf);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDSHS_NORMAL 0
|
#define DDSHS_NORMAL 0
|
||||||
@@ -229,7 +227,6 @@ DrawNameString (bool nameCaptain, UNICODE *Str, COUNT CursorPos,
|
|||||||
lf.align = ALIGN_CENTER;
|
lf.align = ALIGN_CENTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
SetContextFont (Font);
|
SetContextFont (Font);
|
||||||
lf.pStr = Str;
|
lf.pStr = Str;
|
||||||
@@ -253,14 +250,11 @@ DrawNameString (bool nameCaptain, UNICODE *Str, COUNT CursorPos,
|
|||||||
if ((text_r.extent.width + 2) >= r.extent.width)
|
if ((text_r.extent.width + 2) >= r.extent.width)
|
||||||
{ // the text does not fit the input box size and so
|
{ // the text does not fit the input box size and so
|
||||||
// will not fit when displayed later
|
// will not fit when displayed later
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
// disallow the change
|
// disallow the change
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
PreUpdateFlashRect ();
|
PreUpdateFlashRect ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetContextForeGroundColor (BackGround);
|
SetContextForeGroundColor (BackGround);
|
||||||
DrawFilledRectangle (&r);
|
DrawFilledRectangle (&r);
|
||||||
@@ -299,10 +293,9 @@ DrawNameString (bool nameCaptain, UNICODE *Str, COUNT CursorPos,
|
|||||||
SetContextForeGroundColor (ForeGround);
|
SetContextForeGroundColor (ForeGround);
|
||||||
font_DrawText (&lf);
|
font_DrawText (&lf);
|
||||||
|
|
||||||
PostUpdateFlashRectLocked ();
|
PostUpdateFlashRect ();
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,15 +318,11 @@ NameCaptainOrShip (bool nameCaptain)
|
|||||||
TEXTENTRY_STATE tes;
|
TEXTENTRY_STATE tes;
|
||||||
UNICODE *Setting;
|
UNICODE *Setting;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (nameCaptain ? &captainNameRect : &shipNameRect);
|
SetFlashRect (nameCaptain ? &captainNameRect : &shipNameRect);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DrawNameString (nameCaptain, buf, 0, DDSHS_EDIT);
|
DrawNameString (nameCaptain, buf, 0, DDSHS_EDIT);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (GAME_STRING (NAMING_STRING_BASE + 0));
|
DrawStatusMessage (GAME_STRING (NAMING_STRING_BASE + 0));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (nameCaptain)
|
if (nameCaptain)
|
||||||
{
|
{
|
||||||
@@ -359,9 +348,7 @@ NameCaptainOrShip (bool nameCaptain)
|
|||||||
else
|
else
|
||||||
utf8StringCopy (buf, sizeof (buf), Setting);
|
utf8StringCopy (buf, sizeof (buf), Setting);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DrawNameString (nameCaptain, buf, 0, DDSHS_NORMAL);
|
DrawNameString (nameCaptain, buf, 0, DDSHS_NORMAL);
|
||||||
|
|
||||||
@@ -450,9 +437,7 @@ SettingsMenu (void)
|
|||||||
MenuState.InputFunc = DoSettings;
|
MenuState.InputFunc = DoSettings;
|
||||||
DoInput (&MenuState, FALSE);
|
DoInput (&MenuState, FALSE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -677,10 +662,8 @@ DrawSavegameSummary (PICK_GAME_STATE *pickState, COUNT gameIndex)
|
|||||||
r.corner.y = SIS_ORG_Y + 84;
|
r.corner.y = SIS_ORG_Y + 84;
|
||||||
r.extent = OldRect.extent;
|
r.extent = OldRect.extent;
|
||||||
SetContextClipRect (&r);
|
SetContextClipRect (&r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
// draw the lander with upgrades
|
// draw the lander with upgrades
|
||||||
InitLander (pSD->Flags | OVERRIDE_LANDER_FLAGS);
|
InitLander (pSD->Flags | OVERRIDE_LANDER_FLAGS);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContextClipRect (&OldRect);
|
SetContextClipRect (&OldRect);
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
|
|
||||||
@@ -941,11 +924,9 @@ DoPickGame (MENU_STATE *pMS)
|
|||||||
|
|
||||||
if (NewState != pMS->CurState)
|
if (NewState != pMS->CurState)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
pMS->CurState = NewState;
|
pMS->CurState = NewState;
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
RedrawPickDisplay (pickState, pMS->CurState);
|
RedrawPickDisplay (pickState, pMS->CurState);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
|
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
|
||||||
@@ -965,9 +946,7 @@ SaveLoadGame (PICK_GAME_STATE *pickState, COUNT gameIndex)
|
|||||||
|
|
||||||
// TODO: fix ConfirmSaveLoad() interface so it does not rely on
|
// TODO: fix ConfirmSaveLoad() interface so it does not rely on
|
||||||
// MsgStamp != NULL parameter.
|
// MsgStamp != NULL parameter.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ConfirmSaveLoad (pickState->saving ? &saveStamp : NULL);
|
ConfirmSaveLoad (pickState->saving ? &saveStamp : NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (pickState->saving)
|
if (pickState->saving)
|
||||||
success = SaveGame (gameIndex, desc);
|
success = SaveGame (gameIndex, desc);
|
||||||
@@ -978,9 +957,7 @@ SaveLoadGame (PICK_GAME_STATE *pickState, COUNT gameIndex)
|
|||||||
// display a load problem message
|
// display a load problem message
|
||||||
if (pickState->saving)
|
if (pickState->saving)
|
||||||
{ // restore the screen under "SAVING..." message
|
{ // restore the screen under "SAVING..." message
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&saveStamp);
|
DrawStamp (&saveStamp);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (saveStamp.frame));
|
DestroyDrawable (ReleaseDrawable (saveStamp.frame));
|
||||||
@@ -1015,12 +992,10 @@ PickGame (BOOLEAN saving, BOOLEAN fromMainMenu)
|
|||||||
|
|
||||||
LoadGameDescriptions (pickState.summary);
|
LoadGameDescriptions (pickState.summary);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
// Save the current state of the screen for later restoration
|
// Save the current state of the screen for later restoration
|
||||||
DlgStamp = SaveContextFrame (NULL);
|
DlgStamp = SaveContextFrame (NULL);
|
||||||
GetContextClipRect (&DlgRect);
|
GetContextClipRect (&DlgRect);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (TimeOut);
|
SleepThreadUntil (TimeOut);
|
||||||
PauseMusic ();
|
PauseMusic ();
|
||||||
@@ -1028,7 +1003,6 @@ PickGame (BOOLEAN saving, BOOLEAN fromMainMenu)
|
|||||||
FadeMusic (NORMAL_VOLUME, 0);
|
FadeMusic (NORMAL_VOLUME, 0);
|
||||||
|
|
||||||
// draw the current savegame and fade in
|
// draw the current savegame and fade in
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
@@ -1050,7 +1024,6 @@ PickGame (BOOLEAN saving, BOOLEAN fromMainMenu)
|
|||||||
ScreenTransition (3, &ctxRect);
|
ScreenTransition (3, &ctxRect);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS | MENU_SOUND_PAGEUP | MENU_SOUND_PAGEDOWN,
|
SetMenuSounds (MENU_SOUND_ARROWS | MENU_SOUND_PAGEUP | MENU_SOUND_PAGEDOWN,
|
||||||
0);
|
0);
|
||||||
@@ -1076,9 +1049,7 @@ PickGame (BOOLEAN saving, BOOLEAN fromMainMenu)
|
|||||||
|
|
||||||
// reload and redraw everything
|
// reload and redraw everything
|
||||||
LoadGameDescriptions (pickState.summary);
|
LoadGameDescriptions (pickState.summary);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RedrawPickDisplay (&pickState, MenuState.CurState);
|
RedrawPickDisplay (&pickState, MenuState.CurState);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
@@ -1091,20 +1062,16 @@ PickGame (BOOLEAN saving, BOOLEAN fromMainMenu)
|
|||||||
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT) &&
|
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT) &&
|
||||||
(saving || (!pickState.success && !fromMainMenu)))
|
(saving || (!pickState.success && !fromMainMenu)))
|
||||||
{ // Restore previous screen
|
{ // Restore previous screen
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetTransitionSource (&DlgRect);
|
SetTransitionSource (&DlgRect);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawStamp (&DlgStamp);
|
DrawStamp (&DlgStamp);
|
||||||
ScreenTransition (3, &DlgRect);
|
ScreenTransition (3, &DlgRect);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (DlgStamp.frame));
|
DestroyDrawable (ReleaseDrawable (DlgStamp.frame));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
ResumeMusic ();
|
ResumeMusic ();
|
||||||
|
|
||||||
@@ -1132,14 +1099,10 @@ DoGameOptions (MENU_STATE *pMS)
|
|||||||
{
|
{
|
||||||
case SAVE_GAME:
|
case SAVE_GAME:
|
||||||
case LOAD_GAME:
|
case LOAD_GAME:
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
if (PickGame (pMS->CurState == SAVE_GAME, FALSE))
|
if (PickGame (pMS->CurState == SAVE_GAME, FALSE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
case QUIT_GAME:
|
case QUIT_GAME:
|
||||||
if (ConfirmExit ())
|
if (ConfirmExit ())
|
||||||
@@ -1181,17 +1144,13 @@ GameOptions (void)
|
|||||||
MenuState.CurState = SAVE_GAME;
|
MenuState.CurState = SAVE_GAME;
|
||||||
DrawMenuStateStrings (PM_SAVE_GAME, MenuState.CurState);
|
DrawMenuStateStrings (PM_SAVE_GAME, MenuState.CurState);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
MenuState.InputFunc = DoGameOptions;
|
MenuState.InputFunc = DoGameOptions;
|
||||||
DoInput (&MenuState, TRUE);
|
DoInput (&MenuState, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return !(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD));
|
return !(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1633,9 +1633,7 @@ DoHyperspaceMenu (MENU_STATE *pMS)
|
|||||||
if (!select)
|
if (!select)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
switch (pMS->CurState)
|
switch (pMS->CurState)
|
||||||
{
|
{
|
||||||
@@ -1675,9 +1673,7 @@ DoHyperspaceMenu (MENU_STATE *pMS)
|
|||||||
pMS->CurState = NAVIGATION;
|
pMS->CurState = NAVIGATION;
|
||||||
DrawMenuStateStrings (PM_STARMAP, pMS->CurState);
|
DrawMenuStateStrings (PM_STARMAP, pMS->CurState);
|
||||||
}
|
}
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1695,7 +1691,6 @@ UnbatchGraphics ();
|
|||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
OldColor = SetContextBackGroundColor (BLACK_COLOR);
|
OldColor = SetContextBackGroundColor (BLACK_COLOR);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
memset (&MenuState, 0, sizeof (MenuState));
|
memset (&MenuState, 0, sizeof (MenuState));
|
||||||
MenuState.InputFunc = DoHyperspaceMenu;
|
MenuState.InputFunc = DoHyperspaceMenu;
|
||||||
@@ -1703,14 +1698,11 @@ UnbatchGraphics ();
|
|||||||
MenuState.CurState = STARMAP;
|
MenuState.CurState = STARMAP;
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_STARMAP, STARMAP);
|
DrawMenuStateStrings (PM_STARMAP, STARMAP);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
DoInput (&MenuState, TRUE);
|
DoInput (&MenuState, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
@@ -1718,9 +1710,7 @@ UnbatchGraphics ();
|
|||||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||||
{
|
{
|
||||||
ClearSISRect (CLEAR_SIS_RADAR);
|
ClearSISRect (CLEAR_SIS_RADAR);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
WaitForNoInput (ONE_SECOND / 2, FALSE);
|
WaitForNoInput (ONE_SECOND / 2, FALSE);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetContextBackGroundColor (OldColor);
|
SetContextBackGroundColor (OldColor);
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ Present_BatchGraphics (PRESENTATION_INPUT_STATE* pPIS)
|
|||||||
if (!pPIS->Batched)
|
if (!pPIS->Batched)
|
||||||
{
|
{
|
||||||
pPIS->Batched = TRUE;
|
pPIS->Batched = TRUE;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +170,6 @@ Present_UnbatchGraphics (PRESENTATION_INPUT_STATE* pPIS, BOOLEAN bYield)
|
|||||||
if (pPIS->Batched)
|
if (pPIS->Batched)
|
||||||
{
|
{
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
pPIS->Batched = FALSE;
|
pPIS->Batched = FALSE;
|
||||||
if (bYield)
|
if (bYield)
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
@@ -196,7 +194,6 @@ Present_GenerateSIS (PRESENTATION_INPUT_STATE* pPIS)
|
|||||||
COUNT piece;
|
COUNT piece;
|
||||||
Color SisBack;
|
Color SisBack;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (OffScreenContext);
|
OldContext = SetContext (OffScreenContext);
|
||||||
|
|
||||||
SkelFrame = CaptureDrawable (LoadGraphic (SISSKEL_MASK_PMAP_ANIM));
|
SkelFrame = CaptureDrawable (LoadGraphic (SISSKEL_MASK_PMAP_ANIM));
|
||||||
@@ -264,7 +261,6 @@ Present_GenerateSIS (PRESENTATION_INPUT_STATE* pPIS)
|
|||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pPIS->SisFrame = SisFrame;
|
pPIS->SisFrame = SisFrame;
|
||||||
}
|
}
|
||||||
@@ -277,9 +273,7 @@ Present_DrawMovieFrame (PRESENTATION_INPUT_STATE* pPIS)
|
|||||||
s.origin.x = 0;
|
s.origin.x = 0;
|
||||||
s.origin.y = 0;
|
s.origin.y = 0;
|
||||||
s.frame = SetAbsFrameIndex (pPIS->Frame, pPIS->MovieFrame);
|
s.frame = SetAbsFrameIndex (pPIS->Frame, pPIS->MovieFrame);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
@@ -362,9 +356,7 @@ DoPresentation (void *pIS)
|
|||||||
/* center on screen */
|
/* center on screen */
|
||||||
pPIS->clip_r.corner.x = (SCREEN_WIDTH - w) / 2;
|
pPIS->clip_r.corner.x = (SCREEN_WIDTH - w) / 2;
|
||||||
pPIS->clip_r.corner.y = (SCREEN_HEIGHT - h) / 2;
|
pPIS->clip_r.corner.y = (SCREEN_HEIGHT - h) / 2;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContextClipRect (&pPIS->clip_r);
|
SetContextClipRect (&pPIS->clip_r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "FONT") == 0)
|
else if (strcmp (Opcode, "FONT") == 0)
|
||||||
@@ -390,11 +382,7 @@ DoPresentation (void *pIS)
|
|||||||
*pFont = LoadFontFile (pPIS->Buffer);
|
*pFont = LoadFontFile (pPIS->Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pPIS->Batched)
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContextFont (*pFont);
|
SetContextFont (*pFont);
|
||||||
if (!pPIS->Batched)
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "ANI") == 0)
|
else if (strcmp (Opcode, "ANI") == 0)
|
||||||
{ /* set ani */
|
{ /* set ani */
|
||||||
@@ -490,12 +478,8 @@ DoPresentation (void *pIS)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
t.baseline.x = x;
|
t.baseline.x = x;
|
||||||
t.baseline.y = y;
|
t.baseline.y = y;
|
||||||
if (!pPIS->Batched)
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawTextEffect (&t, pPIS->TextColor, pPIS->TextBackColor,
|
DrawTextEffect (&t, pPIS->TextColor, pPIS->TextBackColor,
|
||||||
pPIS->TextEffect);
|
pPIS->TextEffect);
|
||||||
if (!pPIS->Batched)
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "TFI") == 0)
|
else if (strcmp (Opcode, "TFI") == 0)
|
||||||
@@ -510,9 +494,7 @@ DoPresentation (void *pIS)
|
|||||||
|
|
||||||
Present_UnbatchGraphics (pPIS, TRUE);
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
GetContextFontLeading (&leading);
|
GetContextFontLeading (&leading);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
switch (pPIS->TextVPos)
|
switch (pPIS->TextVPos)
|
||||||
{
|
{
|
||||||
@@ -536,7 +518,6 @@ DoPresentation (void *pIS)
|
|||||||
pPIS->TextLines[i].baseline.y = y;
|
pPIS->TextLines[i].baseline.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
for (i = 0; i < pPIS->LinesCount; ++i)
|
for (i = 0; i < pPIS->LinesCount; ++i)
|
||||||
DrawTextEffect (pPIS->TextLines + i, pPIS->TextFadeColor,
|
DrawTextEffect (pPIS->TextLines + i, pPIS->TextFadeColor,
|
||||||
pPIS->TextFadeColor, pPIS->TextEffect);
|
pPIS->TextFadeColor, pPIS->TextEffect);
|
||||||
@@ -550,7 +531,6 @@ DoPresentation (void *pIS)
|
|||||||
ScreenTransition (3, &pPIS->tfade_r);
|
ScreenTransition (3, &pPIS->tfade_r);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "TFO") == 0)
|
else if (strcmp (Opcode, "TFO") == 0)
|
||||||
{ /* text fade-out */
|
{ /* text fade-out */
|
||||||
@@ -558,7 +538,6 @@ DoPresentation (void *pIS)
|
|||||||
|
|
||||||
Present_UnbatchGraphics (pPIS, TRUE);
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
/* do transition */
|
/* do transition */
|
||||||
SetTransitionSource (&pPIS->tfade_r);
|
SetTransitionSource (&pPIS->tfade_r);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -567,7 +546,6 @@ DoPresentation (void *pIS)
|
|||||||
pPIS->TextFadeColor, pPIS->TextEffect);
|
pPIS->TextFadeColor, pPIS->TextEffect);
|
||||||
ScreenTransition (3, &pPIS->tfade_r);
|
ScreenTransition (3, &pPIS->tfade_r);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "SAVEBG") == 0)
|
else if (strcmp (Opcode, "SAVEBG") == 0)
|
||||||
{ /* save background */
|
{ /* save background */
|
||||||
@@ -652,15 +630,11 @@ DoPresentation (void *pIS)
|
|||||||
}
|
}
|
||||||
s.origin.x = x;
|
s.origin.x = x;
|
||||||
s.origin.y = y;
|
s.origin.y = y;
|
||||||
if (!pPIS->Batched)
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
old_mode = SetGraphicScaleMode (scale_mode);
|
old_mode = SetGraphicScaleMode (scale_mode);
|
||||||
old_scale = SetGraphicScale (scale);
|
old_scale = SetGraphicScale (scale);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
SetGraphicScale (old_scale);
|
SetGraphicScale (old_scale);
|
||||||
SetGraphicScaleMode (old_mode);
|
SetGraphicScaleMode (old_mode);
|
||||||
if (!pPIS->Batched)
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "BATCH") == 0)
|
else if (strcmp (Opcode, "BATCH") == 0)
|
||||||
{ /* batch graphics */
|
{ /* batch graphics */
|
||||||
@@ -689,9 +663,7 @@ DoPresentation (void *pIS)
|
|||||||
{ /* clear screen */
|
{ /* clear screen */
|
||||||
Present_UnbatchGraphics (pPIS, TRUE);
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ClearDrawable ();
|
ClearDrawable ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "CALL") == 0)
|
else if (strcmp (Opcode, "CALL") == 0)
|
||||||
{ /* call another script */
|
{ /* call another script */
|
||||||
@@ -712,12 +684,8 @@ DoPresentation (void *pIS)
|
|||||||
l.second.x = x2;
|
l.second.x = x2;
|
||||||
l.second.y = y2;
|
l.second.y = y2;
|
||||||
|
|
||||||
if (!pPIS->Batched)
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContextForeGroundColor (pPIS->TextColor);
|
SetContextForeGroundColor (pPIS->TextColor);
|
||||||
DrawLine (&l);
|
DrawLine (&l);
|
||||||
if (!pPIS->Batched)
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -771,12 +739,10 @@ ShowSlidePresentation (STRING PresStr)
|
|||||||
pis.SlideShow = SetAbsStringTableIndex (pis.SlideShow, 0);
|
pis.SlideShow = SetAbsStringTableIndex (pis.SlideShow, 0);
|
||||||
pis.OperIndex = 0;
|
pis.OperIndex = 0;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (ScreenContext);
|
OldContext = SetContext (ScreenContext);
|
||||||
GetContextClipRect (&OldRect);
|
GetContextClipRect (&OldRect);
|
||||||
OldFont = SetContextFont (NULL);
|
OldFont = SetContextFont (NULL);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
pis.InputFunc = DoPresentation;
|
pis.InputFunc = DoPresentation;
|
||||||
@@ -797,11 +763,9 @@ ShowSlidePresentation (STRING PresStr)
|
|||||||
for (i = 0; i < MAX_FONTS; ++i)
|
for (i = 0; i < MAX_FONTS; ++i)
|
||||||
DestroyFont (pis.Fonts[i]);
|
DestroyFont (pis.Fonts[i]);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContextFont (OldFont);
|
SetContextFont (OldFont);
|
||||||
SetContextClipRect (&OldRect);
|
SetContextClipRect (&OldRect);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -853,11 +817,9 @@ FadeClearScreen (void)
|
|||||||
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
|
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
|
||||||
|
|
||||||
// clear the screen with black
|
// clear the screen with black
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
ClearDrawable ();
|
ClearDrawable ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
FadeScreen (FadeAllToColor, 0);
|
FadeScreen (FadeAllToColor, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,7 +498,6 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState)
|
|||||||
s.frame = SetAbsFrameIndex (PlayFrame, beg_index + NewState);
|
s.frame = SetAbsFrameIndex (PlayFrame, beg_index + NewState);
|
||||||
|
|
||||||
PreUpdateFlashRect ();
|
PreUpdateFlashRect ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (StatusContext);
|
OldContext = SetContext (StatusContext);
|
||||||
GetContextClipRect (&r);
|
GetContextClipRect (&r);
|
||||||
s.origin.x = RADAR_X - r.corner.x;
|
s.origin.x = RADAR_X - r.corner.x;
|
||||||
@@ -599,7 +598,6 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState)
|
|||||||
}
|
}
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
PostUpdateFlashRect ();
|
PostUpdateFlashRect ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ DoInstallModule (MENU_STATE *pMS)
|
|||||||
|
|
||||||
pMS->InputFunc = DoInstallModule;
|
pMS->InputFunc = DoInstallModule;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
ClearSISRect (CLEAR_SIS_RADAR);
|
ClearSISRect (CLEAR_SIS_RADAR);
|
||||||
@@ -296,7 +295,6 @@ DoInstallModule (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
@@ -382,15 +380,12 @@ DoInstallModule (MENU_STATE *pMS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawMenuStateStrings (PM_FUEL, pMS->CurState = OUTFIT_MODULES);
|
DrawMenuStateStrings (PM_FUEL, pMS->CurState = OUTFIT_MODULES);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
|
|
||||||
pMS->InputFunc = DoOutfit;
|
pMS->InputFunc = DoOutfit;
|
||||||
ClearSISRect (DRAW_SIS_DISPLAY);
|
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (motion)
|
else if (motion)
|
||||||
{
|
{
|
||||||
@@ -440,7 +435,6 @@ DoInstallModule (MENU_STATE *pMS)
|
|||||||
|| (NewItem >= GUN_WEAPON && NewItem <= CANNON_WEAPON
|
|| (NewItem >= GUN_WEAPON && NewItem <= CANNON_WEAPON
|
||||||
&& pMS->delta_item > 0 && pMS->delta_item < 13)));
|
&& pMS->delta_item > 0 && pMS->delta_item < 13)));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (NewState < EMPTY_SLOT)
|
if (NewState < EMPTY_SLOT)
|
||||||
{
|
{
|
||||||
if (NewItem != pMS->CurState)
|
if (NewItem != pMS->CurState)
|
||||||
@@ -540,7 +534,6 @@ InitFlash:
|
|||||||
else
|
else
|
||||||
SetFlashRect (&pMS->flash_rect0);
|
SetFlashRect (&pMS->flash_rect0);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -578,7 +571,6 @@ ChangeFuelQuantity (void)
|
|||||||
incr = minFit; // All we have.
|
incr = minFit; // All we have.
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (!incr)
|
if (!incr)
|
||||||
{
|
{
|
||||||
// No more room, not enough RUs, or no fuel left to drain.
|
// No more room, not enough RUs, or no fuel left to drain.
|
||||||
@@ -600,16 +592,13 @@ ChangeFuelQuantity (void)
|
|||||||
SetFlashRect (&r);
|
SetFlashRect (&r);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
onNamingDone (void)
|
onNamingDone (void)
|
||||||
{
|
{
|
||||||
// In case player just named a ship, redraw it
|
// In case player just named a ship, redraw it
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawFlagshipName (FALSE);
|
DrawFlagshipName (FALSE);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -639,7 +628,6 @@ DoOutfit (MENU_STATE *pMS)
|
|||||||
s.frame = CaptureDrawable (
|
s.frame = CaptureDrawable (
|
||||||
LoadGraphic (OUTFIT_PMAP_ANIM));
|
LoadGraphic (OUTFIT_PMAP_ANIM));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawSISFrame ();
|
DrawSISFrame ();
|
||||||
@@ -701,21 +689,16 @@ DoOutfit (MENU_STATE *pMS)
|
|||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawMenuStateStrings (PM_FUEL, pMS->CurState);
|
DrawMenuStateStrings (PM_FUEL, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawFlagshipName (FALSE);
|
DrawFlagshipName (FALSE);
|
||||||
if (optWhichFonts == OPT_PC)
|
if (optWhichFonts == OPT_PC)
|
||||||
DrawFlagshipStats ();
|
DrawFlagshipStats ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
ScreenTransition (3, NULL);
|
ScreenTransition (3, NULL);
|
||||||
PlayMusic (pMS->hMusic, TRUE, 1);
|
PlayMusic (pMS->hMusic, TRUE, 1);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
GLOBAL_SIS (FuelOnBoard) =
|
GLOBAL_SIS (FuelOnBoard) =
|
||||||
(GLOBAL_SIS (FuelOnBoard)
|
(GLOBAL_SIS (FuelOnBoard)
|
||||||
@@ -732,9 +715,7 @@ DoOutfit (MENU_STATE *pMS)
|
|||||||
if (pMS->CurState == OUTFIT_DOFUEL)
|
if (pMS->CurState == OUTFIT_DOFUEL)
|
||||||
{
|
{
|
||||||
pMS->CurState = OUTFIT_FUEL;
|
pMS->CurState = OUTFIT_FUEL;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -758,18 +739,14 @@ ExitOutfit:
|
|||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
pMS->CurState = OUTFIT_DOFUEL;
|
pMS->CurState = OUTFIT_DOFUEL;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
GetGaugeRect (&r, FALSE);
|
GetGaugeRect (&r, FALSE);
|
||||||
SetFlashRect (&r);
|
SetFlashRect (&r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OUTFIT_DOFUEL:
|
case OUTFIT_DOFUEL:
|
||||||
pMS->CurState = OUTFIT_FUEL;
|
pMS->CurState = OUTFIT_FUEL;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
case OUTFIT_MODULES:
|
case OUTFIT_MODULES:
|
||||||
pMS->CurState = EMPTY_SLOT + 2;
|
pMS->CurState = EMPTY_SLOT + 2;
|
||||||
@@ -786,9 +763,7 @@ ExitOutfit:
|
|||||||
if (!GameOptions ())
|
if (!GameOptions ())
|
||||||
goto ExitOutfit;
|
goto ExitOutfit;
|
||||||
DrawMenuStateStrings (PM_FUEL, pMS->CurState);
|
DrawMenuStateStrings (PM_FUEL, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ DoPickBattleShip (MENU_STATE *pMS)
|
|||||||
pMS->Initialized = TRUE;
|
pMS->Initialized = TRUE;
|
||||||
pMS->InputFunc = DoPickBattleShip;
|
pMS->InputFunc = DoPickBattleShip;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
goto ChangeSelection;
|
goto ChangeSelection;
|
||||||
}
|
}
|
||||||
@@ -106,7 +105,6 @@ DoPickBattleShip (MENU_STATE *pMS)
|
|||||||
|
|
||||||
PlayMenuSound (MENU_SOUND_MOVE);
|
PlayMenuSound (MENU_SOUND_MOVE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
#ifdef NEVER
|
#ifdef NEVER
|
||||||
SetContextForeGroundColor (
|
SetContextForeGroundColor (
|
||||||
@@ -240,7 +238,6 @@ ChangeSelection:
|
|||||||
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
SetFlashRect (&pMS->flash_rect0);
|
SetFlashRect (&pMS->flash_rect0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,10 +275,8 @@ OldContext = SetContext (SpaceContext);
|
|||||||
MenuState.flash_rect1.corner = pick_r.corner;
|
MenuState.flash_rect1.corner = pick_r.corner;
|
||||||
MenuState.flash_rect1.extent.width = 0;
|
MenuState.flash_rect1.extent.width = 0;
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
DoInput (&MenuState, FALSE);
|
DoInput (&MenuState, FALSE);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -239,8 +239,6 @@ DrawCargoStrings (BYTE OldElement, BYTE NewElement)
|
|||||||
{
|
{
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
OldContext = SetContext (StatusContext);
|
OldContext = SetContext (StatusContext);
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
|
|
||||||
@@ -266,15 +264,12 @@ DrawCargoStrings (BYTE OldElement, BYTE NewElement)
|
|||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DrawElementDescription (COUNT element)
|
DrawElementDescription (COUNT element)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (GAME_STRING (element + (CARGO_STRING_BASE + 2)));
|
DrawStatusMessage (GAME_STRING (element + (CARGO_STRING_BASE + 2)));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
@@ -302,10 +297,8 @@ DoDiscardCargo (MENU_STATE *pMS)
|
|||||||
--GLOBAL_SIS (ElementAmounts[pMS->CurState]);
|
--GLOBAL_SIS (ElementAmounts[pMS->CurState]);
|
||||||
DrawCargoStrings (pMS->CurState, pMS->CurState);
|
DrawCargoStrings (pMS->CurState, pMS->CurState);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
--GLOBAL_SIS (TotalElementMass);
|
--GLOBAL_SIS (TotalElementMass);
|
||||||
ShowRemainingCapacity ();
|
ShowRemainingCapacity ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // no element left in cargo hold
|
{ // no element left in cargo hold
|
||||||
@@ -358,8 +351,6 @@ CargoMenu (void)
|
|||||||
DoInput (&MenuState, TRUE);
|
DoInput (&MenuState, TRUE);
|
||||||
|
|
||||||
// erase the cargo display
|
// erase the cargo display
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ClearSISRect (DRAW_SIS_DISPLAY);
|
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ DrawDevicesDisplay (DEVICES_STATE *devState)
|
|||||||
static void
|
static void
|
||||||
DrawDevices (DEVICES_STATE *devState, COUNT OldDevice, COUNT NewDevice)
|
DrawDevices (DEVICES_STATE *devState, COUNT OldDevice, COUNT NewDevice)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
@@ -211,7 +210,6 @@ DrawDevices (DEVICES_STATE *devState, COUNT OldDevice, COUNT NewDevice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns TRUE if the broadcaster has been successfully activated,
|
// Returns TRUE if the broadcaster has been successfully activated,
|
||||||
@@ -493,13 +491,11 @@ DoManipulateDevices (MENU_STATE *pMS)
|
|||||||
{
|
{
|
||||||
DeviceStatus status;
|
DeviceStatus status;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
status = InvokeDevice (devState->list[pMS->CurState]);
|
status = InvokeDevice (devState->list[pMS->CurState]);
|
||||||
if (status == DEVICE_FAILURE)
|
if (status == DEVICE_FAILURE)
|
||||||
PlayMenuSound (MENU_SOUND_FAILURE);
|
PlayMenuSound (MENU_SOUND_FAILURE);
|
||||||
else if (status == DEVICE_SUCCESS)
|
else if (status == DEVICE_SUCCESS)
|
||||||
PlayMenuSound (MENU_SOUND_INVOKED);
|
PlayMenuSound (MENU_SOUND_INVOKED);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return (status == DEVICE_FAILURE);
|
return (status == DEVICE_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -682,9 +678,7 @@ DevicesMenu (void)
|
|||||||
if (GLOBAL_SIS (CrewEnlisted) != (COUNT)~0
|
if (GLOBAL_SIS (CrewEnlisted) != (COUNT)~0
|
||||||
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ClearSISRect (DRAW_SIS_DISPLAY);
|
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (!GET_GAME_STATE (PORTAL_COUNTER)
|
if (!GET_GAME_STATE (PORTAL_COUNTER)
|
||||||
&& !(GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
&& !(GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
||||||
|
|||||||
@@ -133,8 +133,6 @@ GenerateChmmr_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
|||||||
else if (matchWorld (solarSys, world, 1, 0))
|
else if (matchWorld (solarSys, world, 1, 0))
|
||||||
{
|
{
|
||||||
/* Starbase */
|
/* Starbase */
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo);
|
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo);
|
||||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||||
CaptureStringTable (LoadStringTable (CHMMR_BASE_STRTAB));
|
CaptureStringTable (LoadStringTable (CHMMR_BASE_STRTAB));
|
||||||
@@ -146,8 +144,6 @@ GenerateChmmr_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
|||||||
solarSys->SysInfo.PlanetInfo.DiscoveryString = 0;
|
solarSys->SysInfo.PlanetInfo.DiscoveryString = 0;
|
||||||
FreeLanderFont (&solarSys->SysInfo.PlanetInfo);
|
FreeLanderFont (&solarSys->SysInfo.PlanetInfo);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,9 +142,7 @@ GenerateMycon_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
SET_GAME_STATE (SUN_DEVICE_UNGUARDED, 1);
|
SET_GAME_STATE (SUN_DEVICE_UNGUARDED, 1);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,9 +135,7 @@ GenerateOrz_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
|||||||
if (OrzSurvivors)
|
if (OrzSurvivors)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,9 +231,7 @@ ZapToUrquanEncounter (void)
|
|||||||
{
|
{
|
||||||
#define LOST_DAYS 15
|
#define LOST_DAYS 15
|
||||||
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND * 2));
|
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND * 2));
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
MoveGameClockDays (LOST_DAYS);
|
MoveGameClockDays (LOST_DAYS);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0) | START_ENCOUNTER;
|
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0) | START_ENCOUNTER;
|
||||||
@@ -243,7 +241,6 @@ ZapToUrquanEncounter (void)
|
|||||||
dx = (SIZE)square_root ((long)dx * dx + (long)dy * dy)
|
dx = (SIZE)square_root ((long)dx * dx + (long)dy * dy)
|
||||||
+ (FUEL_TANK_SCALE >> 1);
|
+ (FUEL_TANK_SCALE >> 1);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, -dx, 0);
|
DeltaSISGauges (0, -dx, 0);
|
||||||
if (GLOBAL_SIS (FuelOnBoard) < 5 * FUEL_TANK_SCALE)
|
if (GLOBAL_SIS (FuelOnBoard) < 5 * FUEL_TANK_SCALE)
|
||||||
{
|
{
|
||||||
@@ -253,7 +250,6 @@ ZapToUrquanEncounter (void)
|
|||||||
}
|
}
|
||||||
DrawSISMessage (NULL);
|
DrawSISMessage (NULL);
|
||||||
DrawHyperCoords (EncounterPtr->loc_pt);
|
DrawHyperCoords (EncounterPtr->loc_pt);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
UnlockEncounter (hEncounter);
|
UnlockEncounter (hEncounter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,9 +132,7 @@ GenerateThraddash_generateOrbital (SOLARSYS_STATE *solarSys,
|
|||||||
&& (BYTE)(GET_GAME_STATE (THRADD_MISSION) - 1) >= 3))
|
&& (BYTE)(GET_GAME_STATE (THRADD_MISSION) - 1) >= 3))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurStarDescPtr->Index == AQUA_HELIX_DEFINED
|
if (CurStarDescPtr->Index == AQUA_HELIX_DEFINED
|
||||||
|
|||||||
@@ -174,9 +174,7 @@ GenerateUtwig_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
|||||||
if (DruugeSurvivors)
|
if (DruugeSurvivors)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
SET_GAME_STATE (BOMB_UNPROTECTED, 1);
|
SET_GAME_STATE (BOMB_UNPROTECTED, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,9 +158,7 @@ GenerateVux_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
|||||||
|| !GET_GAME_STATE (ZEX_IS_DEAD))
|
|| !GET_GAME_STATE (ZEX_IS_DEAD))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1142,7 +1142,6 @@ ScrollPlanetSide (SIZE dx, SIZE dy, int landingOffset)
|
|||||||
|
|
||||||
curLanderLoc = new_pt;
|
curLanderLoc = new_pt;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (PlanetContext);
|
OldContext = SetContext (PlanetContext);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -1252,7 +1251,6 @@ ScrollPlanetSide (SIZE dx, SIZE dy, int landingOffset)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1262,9 +1260,7 @@ animationInterframe (TimeCount *TimeIn, COUNT periods)
|
|||||||
|
|
||||||
for ( ; periods; --periods)
|
for ( ; periods; --periods)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RotatePlanetSphere (TRUE);
|
RotatePlanetSphere (TRUE);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (*TimeIn + ANIM_FRAME_RATE);
|
SleepThreadUntil (*TimeIn + ANIM_FRAME_RATE);
|
||||||
*TimeIn = GetTimeCounter ();
|
*TimeIn = GetTimeCounter ();
|
||||||
@@ -1279,7 +1275,6 @@ AnimateLaunch (FRAME farray)
|
|||||||
COUNT num_frames;
|
COUNT num_frames;
|
||||||
TimeCount NextTime;
|
TimeCount NextTime;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
r.corner.x = 0;
|
r.corner.x = 0;
|
||||||
@@ -1303,18 +1298,14 @@ AnimateLaunch (FRAME farray)
|
|||||||
#endif
|
#endif
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
GetFrameRect (s.frame, &r);
|
GetFrameRect (s.frame, &r);
|
||||||
s.frame = IncFrameIndex (s.frame);
|
s.frame = IncFrameIndex (s.frame);
|
||||||
|
|
||||||
SleepThreadUntil (NextTime);
|
SleepThreadUntil (NextTime);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RepairBackRect (&r);
|
RepairBackRect (&r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1325,18 +1316,14 @@ AnimateLanderWarmup (void)
|
|||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
TimeCount TimeIn = GetTimeCounter ();
|
TimeCount TimeIn = GetTimeCounter ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (RadarContext);
|
OldContext = SetContext (RadarContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
s.origin.x = 0;
|
s.origin.x = 0;
|
||||||
s.origin.y = 0;
|
s.origin.y = 0;
|
||||||
s.frame = SetAbsFrameIndex (LanderFrame[0],
|
s.frame = SetAbsFrameIndex (LanderFrame[0],
|
||||||
(ANGLE_TO_FACING (FULL_CIRCLE) << 1) + 1);
|
(ANGLE_TO_FACING (FULL_CIRCLE) << 1) + 1);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
animationInterframe (&TimeIn, 2);
|
animationInterframe (&TimeIn, 2);
|
||||||
|
|
||||||
@@ -1345,10 +1332,8 @@ AnimateLanderWarmup (void)
|
|||||||
{
|
{
|
||||||
animationInterframe (&TimeIn, 1);
|
animationInterframe (&TimeIn, 1);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (-1, 0, 0);
|
DeltaSISGauges (-1, 0, 0);
|
||||||
DeltaLanderCrew (1, 0);
|
DeltaLanderCrew (1, 0);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
animationInterframe (&TimeIn, 2);
|
animationInterframe (&TimeIn, 2);
|
||||||
@@ -1358,9 +1343,7 @@ AnimateLanderWarmup (void)
|
|||||||
else
|
else
|
||||||
s.frame = SetAbsFrameIndex (s.frame,
|
s.frame = SetAbsFrameIndex (s.frame,
|
||||||
(ANGLE_TO_FACING (FULL_CIRCLE) << 1) + 2);
|
(ANGLE_TO_FACING (FULL_CIRCLE) << 1) + 2);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
animationInterframe (&TimeIn, 2);
|
animationInterframe (&TimeIn, 2);
|
||||||
|
|
||||||
@@ -1370,26 +1353,20 @@ AnimateLanderWarmup (void)
|
|||||||
{
|
{
|
||||||
s.frame = SetAbsFrameIndex (s.frame,
|
s.frame = SetAbsFrameIndex (s.frame,
|
||||||
(ANGLE_TO_FACING (FULL_CIRCLE) << 1) + 3);
|
(ANGLE_TO_FACING (FULL_CIRCLE) << 1) + 3);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
animationInterframe (&TimeIn, 2);
|
animationInterframe (&TimeIn, 2);
|
||||||
|
|
||||||
s.frame = IncFrameIndex (s.frame);
|
s.frame = IncFrameIndex (s.frame);
|
||||||
}
|
}
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (GET_GAME_STATE (IMPROVED_LANDER_CARGO))
|
if (GET_GAME_STATE (IMPROVED_LANDER_CARGO))
|
||||||
{
|
{
|
||||||
animationInterframe (&TimeIn, 2);
|
animationInterframe (&TimeIn, 2);
|
||||||
|
|
||||||
s.frame = SetAbsFrameIndex (s.frame, 59);
|
s.frame = SetAbsFrameIndex (s.frame, 59);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
animationInterframe (&TimeIn, 2);
|
animationInterframe (&TimeIn, 2);
|
||||||
@@ -1419,7 +1396,6 @@ InitPlanetSide (POINT pt)
|
|||||||
|
|
||||||
curLanderLoc = pt;
|
curLanderLoc = pt;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
|
|
||||||
@@ -1452,7 +1428,6 @@ InitPlanetSide (POINT pt)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SET_GAME_STATE (PLANETARY_LANDING, 1);
|
SET_GAME_STATE (PLANETARY_LANDING, 1);
|
||||||
}
|
}
|
||||||
@@ -1749,7 +1724,6 @@ ReturnToOrbit (void)
|
|||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (PlanetContext);
|
OldContext = SetContext (PlanetContext);
|
||||||
GetContextClipRect (&r);
|
GetContextClipRect (&r);
|
||||||
|
|
||||||
@@ -1762,7 +1736,6 @@ ReturnToOrbit (void)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1972,9 +1945,7 @@ PlanetSide (POINT planetLoc)
|
|||||||
if (crew_left == 0)
|
if (crew_left == 0)
|
||||||
{
|
{
|
||||||
--GLOBAL_SIS (NumLanders);
|
--GLOBAL_SIS (NumLanders);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawLanders ();
|
DrawLanders ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
ReturnToOrbit ();
|
ReturnToOrbit ();
|
||||||
}
|
}
|
||||||
@@ -1988,7 +1959,6 @@ PlanetSide (POINT planetLoc)
|
|||||||
ReturnToOrbit ();
|
ReturnToOrbit ();
|
||||||
AnimateLaunch (LanderFrame[6]);
|
AnimateLaunch (LanderFrame[6]);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (crew_left, 0, 0);
|
DeltaSISGauges (crew_left, 0, 0);
|
||||||
|
|
||||||
if (PSD.ElementLevel)
|
if (PSD.ElementLevel)
|
||||||
@@ -2002,7 +1972,6 @@ PlanetSide (POINT planetLoc)
|
|||||||
}
|
}
|
||||||
DrawStorageBays (FALSE);
|
DrawStorageBays (FALSE);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
GLOBAL_SIS (TotalBioMass) += PSD.BiologicalLevel;
|
GLOBAL_SIS (TotalBioMass) += PSD.BiologicalLevel;
|
||||||
}
|
}
|
||||||
@@ -2042,10 +2011,7 @@ InitLander (BYTE LanderFlags)
|
|||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetContext (RadarContext);
|
SetContext (RadarContext);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
r.corner.x = 0;
|
r.corner.x = 0;
|
||||||
@@ -2132,6 +2098,4 @@ InitLander (BYTE LanderFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,6 @@ ZoomInPlanetSphere (void)
|
|||||||
pt.y = PLANET_ORG_Y + (int) (dy * (1.0 - scale)
|
pt.y = PLANET_ORG_Y + (int) (dy * (1.0 - scale)
|
||||||
* (SCAN_SCREEN_HEIGHT * 6 / 10) + 0.5);
|
* (SCAN_SCREEN_HEIGHT * 6 / 10) + 0.5);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -206,7 +205,6 @@ ZoomInPlanetSphere (void)
|
|||||||
SetGraphicScaleMode (oldMode);
|
SetGraphicScaleMode (oldMode);
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
repairRect.corner.x = pt.x + frameRect.corner.x;
|
repairRect.corner.x = pt.x + frameRect.corner.x;
|
||||||
repairRect.corner.y = pt.y + frameRect.corner.y;
|
repairRect.corner.y = pt.y + frameRect.corner.y;
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ CreatePlanetContext (void)
|
|||||||
|
|
||||||
assert (PlanetContext == NULL);
|
assert (PlanetContext == NULL);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// PlanetContext rect is relative to SpaceContext
|
// PlanetContext rect is relative to SpaceContext
|
||||||
oldContext = SetContext (SpaceContext);
|
oldContext = SetContext (SpaceContext);
|
||||||
GetContextClipRect (&r);
|
GetContextClipRect (&r);
|
||||||
@@ -72,7 +70,6 @@ CreatePlanetContext (void)
|
|||||||
SetContextClipRect (&r);
|
SetContextClipRect (&r);
|
||||||
|
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -263,9 +260,7 @@ LoadPlanet (FRAME SurfDefFrame)
|
|||||||
|
|
||||||
if (WaitMode)
|
if (WaitMode)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawOrbitalDisplay (DRAW_ORBITAL_WAIT);
|
DrawOrbitalDisplay (DRAW_ORBITAL_WAIT);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
@@ -281,15 +276,11 @@ LoadPlanet (FRAME SurfDefFrame)
|
|||||||
if (WaitMode)
|
if (WaitMode)
|
||||||
{
|
{
|
||||||
ZoomInPlanetSphere ();
|
ZoomInPlanetSphere ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawOrbitalDisplay (DRAW_ORBITAL_UPDATE);
|
DrawOrbitalDisplay (DRAW_ORBITAL_UPDATE);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
|
DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +293,6 @@ FreePlanet (void)
|
|||||||
UninitSphereRotation ();
|
UninitSphereRotation ();
|
||||||
|
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
for (i = 0; i < sizeof (pSolarSysState->PlanetSideFrame)
|
for (i = 0; i < sizeof (pSolarSysState->PlanetSideFrame)
|
||||||
/ sizeof (pSolarSysState->PlanetSideFrame[0]); ++i)
|
/ sizeof (pSolarSysState->PlanetSideFrame[0]); ++i)
|
||||||
@@ -353,7 +343,6 @@ FreePlanet (void)
|
|||||||
DestroyPlanetContext ();
|
DestroyPlanetContext ();
|
||||||
DestroyScanContext ();
|
DestroyScanContext ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -391,9 +380,7 @@ DoPlanetOrbit (MENU_STATE *pMS)
|
|||||||
if (!select)
|
if (!select)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
switch (pMS->CurState)
|
switch (pMS->CurState)
|
||||||
{
|
{
|
||||||
@@ -431,9 +418,7 @@ DoPlanetOrbit (MENU_STATE *pMS)
|
|||||||
// Deactivate planet rotation
|
// Deactivate planet rotation
|
||||||
oldCallback = SetInputCallback (NULL);
|
oldCallback = SetInputCallback (NULL);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
AutoPilotSet = StarMap ();
|
AutoPilotSet = StarMap ();
|
||||||
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
@@ -444,9 +429,7 @@ DoPlanetOrbit (MENU_STATE *pMS)
|
|||||||
|
|
||||||
if (!AutoPilotSet)
|
if (!AutoPilotSet)
|
||||||
{ // Redraw the orbital display
|
{ // Redraw the orbital display
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
|
DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Fall through !!!
|
// Fall through !!!
|
||||||
@@ -463,9 +446,7 @@ DoPlanetOrbit (MENU_STATE *pMS)
|
|||||||
pMS->CurState = NAVIGATION;
|
pMS->CurState = NAVIGATION;
|
||||||
DrawMenuStateStrings (PM_SCAN, pMS->CurState);
|
DrawMenuStateStrings (PM_SCAN, pMS->CurState);
|
||||||
}
|
}
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -474,9 +455,7 @@ DoPlanetOrbit (MENU_STATE *pMS)
|
|||||||
static void
|
static void
|
||||||
on_input_frame (void)
|
on_input_frame (void)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RotatePlanetSphere (TRUE);
|
RotatePlanetSphere (TRUE);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -488,9 +467,7 @@ PlanetOrbitMenu (void)
|
|||||||
memset (&MenuState, 0, sizeof MenuState);
|
memset (&MenuState, 0, sizeof MenuState);
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_SCAN, SCAN);
|
DrawMenuStateStrings (PM_SCAN, SCAN);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
MenuState.CurState = SCAN;
|
MenuState.CurState = SCAN;
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
@@ -501,8 +478,6 @@ PlanetOrbitMenu (void)
|
|||||||
|
|
||||||
SetInputCallback (oldCallback);
|
SetInputCallback (oldCallback);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawMenuStateStrings (PM_STARMAP, -NAVIGATION);
|
DrawMenuStateStrings (PM_STARMAP, -NAVIGATION);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1735,7 +1735,6 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
|
|||||||
RandomContext_SeedRandom (SysGenRNG, pPlanetDesc->rand_seed);
|
RandomContext_SeedRandom (SysGenRNG, pPlanetDesc->rand_seed);
|
||||||
|
|
||||||
TopoContext = CreateContext ("Plangen.TopoContext");
|
TopoContext = CreateContext ("Plangen.TopoContext");
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (TopoContext);
|
OldContext = SetContext (TopoContext);
|
||||||
planet_orbit_init ();
|
planet_orbit_init ();
|
||||||
|
|
||||||
@@ -1950,7 +1949,6 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DestroyContext (TopoContext);
|
DestroyContext (TopoContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ flashCurrentLocation (POINT *where)
|
|||||||
|
|
||||||
NextTime = GetTimeCounter () + (ONE_SECOND / 16);
|
NextTime = GetTimeCounter () + (ONE_SECOND / 16);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
|
|
||||||
if (c == 0x00 || c == 0x1A)
|
if (c == 0x00 || c == 0x1A)
|
||||||
@@ -138,7 +137,6 @@ flashCurrentLocation (POINT *where)
|
|||||||
SetContextForeGroundColor (OldColor);
|
SetContextForeGroundColor (OldColor);
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +297,6 @@ DrawStarMap (COUNT race_update, RECT *pClipRect)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
draw_cursor = TRUE;
|
draw_cursor = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,9 +556,6 @@ DrawStarMap (COUNT race_update, RECT *pClipRect)
|
|||||||
UNIVERSE_TO_DISPY (cursorLoc.y));
|
UNIVERSE_TO_DISPY (cursorLoc.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draw_cursor)
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -591,9 +585,7 @@ EraseCursor (COORD curs_x, COORD curs_y)
|
|||||||
#else /* NEW */
|
#else /* NEW */
|
||||||
r.extent.height += r.corner.y & 1;
|
r.extent.height += r.corner.y & 1;
|
||||||
r.corner.y &= ~1;
|
r.corner.y &= ~1;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawStarMap (0, &r);
|
DrawStarMap (0, &r);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
#endif /* OLD */
|
#endif /* OLD */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,11 +685,9 @@ UpdateCursorLocation (int sx, int sy, const POINT *newpt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
EraseCursor (pt.x, pt.y);
|
EraseCursor (pt.x, pt.y);
|
||||||
// ClearDrawable ();
|
// ClearDrawable ();
|
||||||
DrawCursor (s.origin.x, s.origin.y);
|
DrawCursor (s.origin.x, s.origin.y);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -767,14 +757,12 @@ UpdateCursorInfo (UNICODE *prevbuf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawHyperCoords (cursorLoc);
|
DrawHyperCoords (cursorLoc);
|
||||||
if (strcmp (buf, prevbuf) != 0)
|
if (strcmp (buf, prevbuf) != 0)
|
||||||
{
|
{
|
||||||
strcpy (prevbuf, buf);
|
strcpy (prevbuf, buf);
|
||||||
DrawSISMessage (buf);
|
DrawSISMessage (buf);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -806,9 +794,7 @@ UpdateFuelRequirement (void)
|
|||||||
fuel_required / FUEL_TANK_SCALE,
|
fuel_required / FUEL_TANK_SCALE,
|
||||||
(fuel_required % FUEL_TANK_SCALE) / 10);
|
(fuel_required % FUEL_TANK_SCALE) / 10);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (buf);
|
DrawStatusMessage (buf);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STAR_SEARCH_BUFSIZE 256
|
#define STAR_SEARCH_BUFSIZE 256
|
||||||
@@ -1059,10 +1045,8 @@ DrawMatchedStarName (TEXTENTRY_STATE *pTES)
|
|||||||
flags |= DSME_BLOCKCUR;
|
flags |= DSME_BLOCKCUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawSISMessageEx (buf, CurPos, ExPos, flags);
|
DrawSISMessageEx (buf, CurPos, ExPos, flags);
|
||||||
DrawHyperCoords (cursorLoc);
|
DrawHyperCoords (cursorLoc);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1133,9 +1117,7 @@ OnStarNameChange (TEXTENTRY_STATE *pTES)
|
|||||||
if (pTES->JoystickMode)
|
if (pTES->JoystickMode)
|
||||||
flags |= DSME_BLOCKCUR;
|
flags |= DSME_BLOCKCUR;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ret = DrawSISMessageEx (pSS->Text, pTES->CursorPos, -1, flags);
|
ret = DrawSISMessageEx (pSS->Text, pTES->CursorPos, -1, flags);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1196,9 +1178,7 @@ DoStarSearch (MENU_STATE *pMS)
|
|||||||
if (!pss)
|
if (!pss)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawSISMessageEx ("", 0, 0, DSME_SETFR);
|
DrawSISMessageEx ("", 0, 0, DSME_SETFR);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pss->pMS = pMS;
|
pss->pMS = pMS;
|
||||||
pss->LastChangeTime = 0;
|
pss->LastChangeTime = 0;
|
||||||
@@ -1220,9 +1200,7 @@ DoStarSearch (MENU_STATE *pMS)
|
|||||||
SetDefaultMenuRepeatDelay ();
|
SetDefaultMenuRepeatDelay ();
|
||||||
success = DoTextEntry (&tes);
|
success = DoTextEntry (&tes);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawSISMessageEx (pss->Text, -1, -1, DSME_CLEARFR);
|
DrawSISMessageEx (pss->Text, -1, -1, DSME_CLEARFR);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
HFree (pss);
|
HFree (pss);
|
||||||
|
|
||||||
@@ -1620,8 +1598,6 @@ StarMap (void)
|
|||||||
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
|
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
|
||||||
UpdateMap ();
|
UpdateMap ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DrawStarMap (0, (RECT*)-1);
|
DrawStarMap (0, (RECT*)-1);
|
||||||
transition_pending = FALSE;
|
transition_pending = FALSE;
|
||||||
|
|
||||||
@@ -1633,7 +1609,6 @@ StarMap (void)
|
|||||||
DrawCursor (UNIVERSE_TO_DISPX (cursorLoc.x),
|
DrawCursor (UNIVERSE_TO_DISPX (cursorLoc.x),
|
||||||
UNIVERSE_TO_DISPY (cursorLoc.y));
|
UNIVERSE_TO_DISPY (cursorLoc.y));
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY,
|
SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY,
|
||||||
@@ -1642,11 +1617,9 @@ StarMap (void)
|
|||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
SetDefaultMenuRepeatDelay ();
|
SetDefaultMenuRepeatDelay ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawHyperCoords (universe);
|
DrawHyperCoords (universe);
|
||||||
DrawSISMessage (NULL);
|
DrawSISMessage (NULL);
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (GLOBAL (autopilot.x) == universe.x
|
if (GLOBAL (autopilot.x) == universe.x
|
||||||
&& GLOBAL (autopilot.y) == universe.y)
|
&& GLOBAL (autopilot.y) == universe.y)
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
t.pStr = pStr;
|
t.pStr = pStr;
|
||||||
|
|
||||||
Sleepy = TRUE;
|
Sleepy = TRUE;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
FlushInput ();
|
FlushInput ();
|
||||||
// XXX: this is a pretty ugly goto
|
// XXX: this is a pretty ugly goto
|
||||||
@@ -163,9 +162,7 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
PlaySound (ReadOutSounds, NotPositional (), NULL,
|
PlaySound (ReadOutSounds, NotPositional (), NULL,
|
||||||
GAME_SOUND_PRIORITY);
|
GAME_SOUND_PRIORITY);
|
||||||
@@ -183,7 +180,6 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
{
|
{
|
||||||
Sleepy = FALSE;
|
Sleepy = FALSE;
|
||||||
// We draw the whole thing at once after this
|
// We draw the whole thing at once after this
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +200,6 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
if (!Sleepy)
|
if (!Sleepy)
|
||||||
{
|
{
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WaitForAnyButton (TRUE, WAIT_INFINITE, FALSE))
|
if (!WaitForAnyButton (TRUE, WAIT_INFINITE, FALSE))
|
||||||
@@ -216,18 +211,14 @@ InitPageCell:
|
|||||||
row_cells = 0;
|
row_cells = 0;
|
||||||
if (StrLen)
|
if (StrLen)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (!Sleepy)
|
if (!Sleepy)
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
ClearReportArea();
|
ClearReportArea();
|
||||||
SetContextForeGroundColor (
|
SetContextForeGroundColor (
|
||||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x1F, 0x00), 0xFF));
|
BUILD_COLOR (MAKE_RGB15 (0x00, 0x1F, 0x00), 0xFF));
|
||||||
if (Sleepy)
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -274,9 +265,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
|||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (saveStamp.frame));
|
DestroyDrawable (ReleaseDrawable (saveStamp.frame));
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
WaitForNoInput (WAIT_INFINITE, TRUE);
|
WaitForNoInput (WAIT_INFINITE, TRUE);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,6 @@ DoModifyRoster (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
else if (select || cancel)
|
else if (select || cancel)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
rosterState->modifyingCrew ^= true;
|
rosterState->modifyingCrew ^= true;
|
||||||
if (!rosterState->modifyingCrew)
|
if (!rosterState->modifyingCrew)
|
||||||
{
|
{
|
||||||
@@ -268,7 +267,6 @@ DoModifyRoster (MENU_STATE *pMS)
|
|||||||
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
|
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
|
||||||
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
|
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (rosterState->modifyingCrew)
|
else if (rosterState->modifyingCrew)
|
||||||
{
|
{
|
||||||
@@ -292,9 +290,7 @@ DoModifyRoster (MENU_STATE *pMS)
|
|||||||
|
|
||||||
if (delta != 0)
|
if (delta != 0)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
failed = !DeltaSupportCrew (rosterState, delta);
|
failed = !DeltaSupportCrew (rosterState, delta);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed)
|
if (failed)
|
||||||
@@ -350,7 +346,6 @@ DoModifyRoster (MENU_STATE *pMS)
|
|||||||
--NewState;
|
--NewState;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
|
|
||||||
@@ -366,7 +361,6 @@ DoModifyRoster (MENU_STATE *pMS)
|
|||||||
flashSupportShip (rosterState);
|
flashSupportShip (rosterState);
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SleepThread (ONE_SECOND / 30);
|
SleepThread (ONE_SECOND / 30);
|
||||||
@@ -416,22 +410,18 @@ RosterMenu (void)
|
|||||||
qsort (RosterState.shipPos, RosterState.count,
|
qsort (RosterState.shipPos, RosterState.count,
|
||||||
sizeof (RosterState.shipPos[0]), compShipPos);
|
sizeof (RosterState.shipPos[0]), compShipPos);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
selectSupportShip (&RosterState, MenuState.CurState);
|
selectSupportShip (&RosterState, MenuState.CurState);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
|
|
||||||
MenuState.InputFunc = DoModifyRoster;
|
MenuState.InputFunc = DoModifyRoster;
|
||||||
DoInput (&MenuState, TRUE);
|
DoInput (&MenuState, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (StatusContext);
|
SetContext (StatusContext);
|
||||||
// unselect the last ship
|
// unselect the last ship
|
||||||
drawSupportShip (&RosterState, FALSE);
|
drawSupportShip (&RosterState, FALSE);
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,15 +85,12 @@ RepairBackRect (RECT *pRect)
|
|||||||
static void
|
static void
|
||||||
EraseCoarseScan (void)
|
EraseCoarseScan (void)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawStarBackGround ();
|
DrawStarBackGround ();
|
||||||
DrawDefaultPlanetSphere ();
|
DrawDefaultPlanetSphere ();
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -160,7 +157,6 @@ PrintCoarseScanPC (void)
|
|||||||
|
|
||||||
GetPlanetTitle (buf, sizeof (buf));
|
GetPlanetTitle (buf, sizeof (buf));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
t.align = ALIGN_CENTER;
|
t.align = ALIGN_CENTER;
|
||||||
@@ -174,7 +170,6 @@ PrintCoarseScanPC (void)
|
|||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
|
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
#define LEFT_SIDE_BASELINE_X_PC 5
|
#define LEFT_SIDE_BASELINE_X_PC 5
|
||||||
#define RIGHT_SIDE_BASELINE_X_PC (SIS_SCREEN_WIDTH - 75)
|
#define RIGHT_SIDE_BASELINE_X_PC (SIS_SCREEN_WIDTH - 75)
|
||||||
@@ -183,7 +178,6 @@ PrintCoarseScanPC (void)
|
|||||||
t.baseline.y = SCAN_BASELINE_Y_PC;
|
t.baseline.y = SCAN_BASELINE_Y_PC;
|
||||||
t.align = ALIGN_LEFT;
|
t.align = ALIGN_LEFT;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE),
|
||||||
LEFT_SIDE_BASELINE_X_PC); // "Orbit: "
|
LEFT_SIDE_BASELINE_X_PC); // "Orbit: "
|
||||||
val = ((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L
|
val = ((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L
|
||||||
@@ -194,9 +188,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 2),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 2),
|
||||||
LEFT_SIDE_BASELINE_X_PC); // "Atmo: "
|
LEFT_SIDE_BASELINE_X_PC); // "Atmo: "
|
||||||
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE)
|
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE)
|
||||||
@@ -216,9 +208,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 6),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 6),
|
||||||
LEFT_SIDE_BASELINE_X_PC); // "Temp: "
|
LEFT_SIDE_BASELINE_X_PC); // "Temp: "
|
||||||
sprintf (buf, "%d" STR_DEGREE_SIGN " c",
|
sprintf (buf, "%d" STR_DEGREE_SIGN " c",
|
||||||
@@ -227,9 +217,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 7),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 7),
|
||||||
LEFT_SIDE_BASELINE_X_PC); // "Weather: "
|
LEFT_SIDE_BASELINE_X_PC); // "Weather: "
|
||||||
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0)
|
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0)
|
||||||
@@ -244,9 +232,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 10),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 10),
|
||||||
LEFT_SIDE_BASELINE_X_PC); // "Tectonics: "
|
LEFT_SIDE_BASELINE_X_PC); // "Tectonics: "
|
||||||
if (PLANSIZE (pSolarSysState->SysInfo.PlanetInfo.PlanDataPtr->Type) ==
|
if (PLANSIZE (pSolarSysState->SysInfo.PlanetInfo.PlanDataPtr->Type) ==
|
||||||
@@ -261,11 +247,9 @@ PrintCoarseScanPC (void)
|
|||||||
}
|
}
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
t.baseline.y = SCAN_BASELINE_Y_PC;
|
t.baseline.y = SCAN_BASELINE_Y_PC;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 11),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 11),
|
||||||
RIGHT_SIDE_BASELINE_X_PC); // "Mass: "
|
RIGHT_SIDE_BASELINE_X_PC); // "Mass: "
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
||||||
@@ -280,9 +264,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 13),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 13),
|
||||||
RIGHT_SIDE_BASELINE_X_PC); // "Radius: "
|
RIGHT_SIDE_BASELINE_X_PC); // "Radius: "
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
||||||
@@ -292,9 +274,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 14),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 14),
|
||||||
RIGHT_SIDE_BASELINE_X_PC); // "Gravity: "
|
RIGHT_SIDE_BASELINE_X_PC); // "Gravity: "
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity;
|
val = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity;
|
||||||
@@ -306,9 +286,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 16),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 16),
|
||||||
RIGHT_SIDE_BASELINE_X_PC); // "Day: "
|
RIGHT_SIDE_BASELINE_X_PC); // "Day: "
|
||||||
val = (SDWORD)pSolarSysState->SysInfo.PlanetInfo.RotationPeriod
|
val = (SDWORD)pSolarSysState->SysInfo.PlanetInfo.RotationPeriod
|
||||||
@@ -319,9 +297,7 @@ PrintCoarseScanPC (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING_PC;
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 18),
|
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 18),
|
||||||
RIGHT_SIDE_BASELINE_X_PC); // "Tilt: "
|
RIGHT_SIDE_BASELINE_X_PC); // "Tilt: "
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.AxialTilt;
|
val = pSolarSysState->SysInfo.PlanetInfo.AxialTilt;
|
||||||
@@ -331,7 +307,6 @@ PrintCoarseScanPC (void)
|
|||||||
sprintf (buf, "%d" STR_DEGREE_SIGN, val);
|
sprintf (buf, "%d" STR_DEGREE_SIGN, val);
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -345,7 +320,6 @@ PrintCoarseScan3DO (void)
|
|||||||
|
|
||||||
GetPlanetTitle (buf, sizeof (buf));
|
GetPlanetTitle (buf, sizeof (buf));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
|
|
||||||
t.align = ALIGN_CENTER;
|
t.align = ALIGN_CENTER;
|
||||||
@@ -363,8 +337,6 @@ PrintCoarseScan3DO (void)
|
|||||||
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 20);
|
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 20);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
#define LEFT_SIDE_BASELINE_X (27 + (16 - SAFE_X))
|
#define LEFT_SIDE_BASELINE_X (27 + (16 - SAFE_X))
|
||||||
#define RIGHT_SIDE_BASELINE_X (SIS_SCREEN_WIDTH - LEFT_SIDE_BASELINE_X)
|
#define RIGHT_SIDE_BASELINE_X (SIS_SCREEN_WIDTH - LEFT_SIDE_BASELINE_X)
|
||||||
#define SCAN_BASELINE_Y 25
|
#define SCAN_BASELINE_Y 25
|
||||||
@@ -373,7 +345,6 @@ PrintCoarseScan3DO (void)
|
|||||||
t.baseline.y = SCAN_BASELINE_Y;
|
t.baseline.y = SCAN_BASELINE_Y;
|
||||||
t.align = ALIGN_LEFT;
|
t.align = ALIGN_LEFT;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
val = ((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L
|
val = ((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L
|
||||||
+ (EARTH_RADIUS >> 1)) / EARTH_RADIUS);
|
+ (EARTH_RADIUS >> 1)) / EARTH_RADIUS);
|
||||||
@@ -381,9 +352,7 @@ PrintCoarseScan3DO (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE)
|
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE)
|
||||||
strcpy (buf, STR_INFINITY_SIGN);
|
strcpy (buf, STR_INFINITY_SIGN);
|
||||||
@@ -396,27 +365,21 @@ PrintCoarseScan3DO (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
sprintf (buf, "%d" STR_DEGREE_SIGN,
|
sprintf (buf, "%d" STR_DEGREE_SIGN,
|
||||||
pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature);
|
pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature);
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
sprintf (buf, "<%u>", pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0
|
sprintf (buf, "<%u>", pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0
|
||||||
? 0 : (pSolarSysState->SysInfo.PlanetInfo.Weather + 1));
|
? 0 : (pSolarSysState->SysInfo.PlanetInfo.Weather + 1));
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
sprintf (buf, "<%u>",
|
sprintf (buf, "<%u>",
|
||||||
PLANSIZE (
|
PLANSIZE (
|
||||||
@@ -425,13 +388,11 @@ PrintCoarseScan3DO (void)
|
|||||||
? 0 : (pSolarSysState->SysInfo.PlanetInfo.Tectonics + 1));
|
? 0 : (pSolarSysState->SysInfo.PlanetInfo.Tectonics + 1));
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
t.baseline.x = RIGHT_SIDE_BASELINE_X;
|
t.baseline.x = RIGHT_SIDE_BASELINE_X;
|
||||||
t.baseline.y = SCAN_BASELINE_Y;
|
t.baseline.y = SCAN_BASELINE_Y;
|
||||||
t.align = ALIGN_RIGHT;
|
t.align = ALIGN_RIGHT;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
||||||
val = ((DWORD) val * (DWORD) val * (DWORD) val / 100L
|
val = ((DWORD) val * (DWORD) val * (DWORD) val / 100L
|
||||||
@@ -443,9 +404,7 @@ PrintCoarseScan3DO (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
||||||
MakeScanValue (buf, val, STR_EARTH_SIGN);
|
MakeScanValue (buf, val, STR_EARTH_SIGN);
|
||||||
@@ -453,9 +412,7 @@ PrintCoarseScan3DO (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity;
|
val = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity;
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
@@ -464,9 +421,7 @@ PrintCoarseScan3DO (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
val = pSolarSysState->SysInfo.PlanetInfo.AxialTilt;
|
val = pSolarSysState->SysInfo.PlanetInfo.AxialTilt;
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
@@ -475,16 +430,13 @@ PrintCoarseScan3DO (void)
|
|||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
t.baseline.y += SCAN_LEADING;
|
t.baseline.y += SCAN_LEADING;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
t.pStr = buf;
|
t.pStr = buf;
|
||||||
val = (SDWORD)pSolarSysState->SysInfo.PlanetInfo.RotationPeriod
|
val = (SDWORD)pSolarSysState->SysInfo.PlanetInfo.RotationPeriod
|
||||||
* 10 / 24;
|
* 10 / 24;
|
||||||
MakeScanValue (buf, val, STR_EARTH_SIGN);
|
MakeScanValue (buf, val, STR_EARTH_SIGN);
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -667,11 +619,9 @@ DispatchLander (void)
|
|||||||
// Deactivate planet rotation callback
|
// Deactivate planet rotation callback
|
||||||
oldCallback = SetInputCallback (NULL);
|
oldCallback = SetInputCallback (NULL);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (0, -landingFuel, 0);
|
DeltaSISGauges (0, -landingFuel, 0);
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
drawPlanetCursor (FALSE);
|
drawPlanetCursor (FALSE);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
PlanetSide (planetLoc);
|
PlanetSide (planetLoc);
|
||||||
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
@@ -749,7 +699,6 @@ DoPickPlanetSide (MENU_STATE *pMS)
|
|||||||
if (CurrentInputState.menu[KEY_MENU_DOWN])
|
if (CurrentInputState.menu[KEY_MENU_DOWN])
|
||||||
dy = 1;
|
dy = 1;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
dx = dx << MAG_SHIFT;
|
dx = dx << MAG_SHIFT;
|
||||||
@@ -777,7 +726,6 @@ DoPickPlanetSide (MENU_STATE *pMS)
|
|||||||
flashPlanetLocation ();
|
flashPlanetLocation ();
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (TimeIn + ONE_SECOND / 40);
|
SleepThreadUntil (TimeIn + ONE_SECOND / 40);
|
||||||
}
|
}
|
||||||
@@ -799,9 +747,7 @@ drawLandingFuelUsage (COUNT fuel)
|
|||||||
static void
|
static void
|
||||||
eraseLandingFuelUsage (void)
|
eraseLandingFuelUsage (void)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
@@ -815,7 +761,6 @@ PickPlanetSide (void)
|
|||||||
memset (&MenuState, 0, sizeof MenuState);
|
memset (&MenuState, 0, sizeof MenuState);
|
||||||
MenuState.privData = &PickState;
|
MenuState.privData = &PickState;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ClearSISRect (CLEAR_SIS_RADAR);
|
ClearSISRect (CLEAR_SIS_RADAR);
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -827,7 +772,6 @@ PickPlanetSide (void)
|
|||||||
// Set the current flash location
|
// Set the current flash location
|
||||||
setPlanetCursorLoc (planetLoc);
|
setPlanetCursorLoc (planetLoc);
|
||||||
savePlanetLocationImage ();
|
savePlanetLocationImage ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
InitLander (0);
|
InitLander (0);
|
||||||
|
|
||||||
@@ -844,9 +788,7 @@ PickPlanetSide (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // player bailed out
|
{ // player bailed out
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
restorePlanetLocationImage ();
|
restorePlanetLocationImage ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
@@ -1026,7 +968,6 @@ ScanPlanet (COUNT scanType)
|
|||||||
|
|
||||||
t.pStr = GAME_STRING (SCAN_STRING_BASE + scan);
|
t.pStr = GAME_STRING (SCAN_STRING_BASE + scan);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
r.corner.x = 0;
|
r.corner.x = 0;
|
||||||
r.corner.y = t.baseline.y - 10;
|
r.corner.y = t.baseline.y - 10;
|
||||||
@@ -1041,14 +982,11 @@ ScanPlanet (COUNT scanType)
|
|||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
|
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// Draw a virgin surface
|
// Draw a virgin surface
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawPlanet (0, BLACK_COLOR);
|
DrawPlanet (0, BLACK_COLOR);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
tintColor = tintColors[scan];
|
tintColor = tintColors[scan];
|
||||||
|
|
||||||
@@ -1060,7 +998,6 @@ ScanPlanet (COUNT scanType)
|
|||||||
if (WaitForAnyButtonUntil (TRUE, TimeOut, FALSE))
|
if (WaitForAnyButtonUntil (TRUE, TimeOut, FALSE))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawPlanet (i, tintColor);
|
DrawPlanet (i, tintColor);
|
||||||
DrawScannedStuff (i, scan);
|
DrawScannedStuff (i, scan);
|
||||||
@@ -1068,21 +1005,17 @@ ScanPlanet (COUNT scanType)
|
|||||||
#ifdef SPIN_ON_SCAN
|
#ifdef SPIN_ON_SCAN
|
||||||
RotatePlanetSphere (TRUE);
|
RotatePlanetSphere (TRUE);
|
||||||
#endif
|
#endif
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < SCAN_LINES)
|
if (i < SCAN_LINES)
|
||||||
{ // Aborted by a keypress; draw in finished state
|
{ // Aborted by a keypress; draw in finished state
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawPlanet (SCAN_LINES - 1, tintColor);
|
DrawPlanet (SCAN_LINES - 1, tintColor);
|
||||||
DrawScannedStuff (SCAN_LINES - 1, scan);
|
DrawScannedStuff (SCAN_LINES - 1, scan);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (PlanetContext);
|
SetContext (PlanetContext);
|
||||||
RepairBackRect (&r);
|
RepairBackRect (&r);
|
||||||
|
|
||||||
@@ -1093,7 +1026,6 @@ ScanPlanet (COUNT scanType)
|
|||||||
DrawScannedObjects (FALSE);
|
DrawScannedObjects (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
FlushInput ();
|
FlushInput ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,17 +1067,13 @@ DoScan (MENU_STATE *pMS)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (!PickPlanetSide ())
|
if (!PickPlanetSide ())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_MIN_SCAN, pMS->CurState);
|
DrawMenuStateStrings (PM_MIN_SCAN, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1235,9 +1163,7 @@ ScanSystem (void)
|
|||||||
|
|
||||||
memset (&MenuState, 0, sizeof MenuState);
|
memset (&MenuState, 0, sizeof MenuState);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
GetScanContext (NULL);
|
GetScanContext (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (optWhichMenu == OPT_3DO &&
|
if (optWhichMenu == OPT_3DO &&
|
||||||
((pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
|
((pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
|
||||||
@@ -1252,17 +1178,13 @@ ScanSystem (void)
|
|||||||
planetLoc.x = (MAP_WIDTH >> 1) << MAG_SHIFT;
|
planetLoc.x = (MAP_WIDTH >> 1) << MAG_SHIFT;
|
||||||
planetLoc.y = (MAP_HEIGHT >> 1) << MAG_SHIFT;
|
planetLoc.y = (MAP_HEIGHT >> 1) << MAG_SHIFT;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
initPlanetLocationImage ();
|
initPlanetLocationImage ();
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
DrawScannedObjects (FALSE);
|
DrawScannedObjects (FALSE);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_MIN_SCAN, MenuState.CurState);
|
DrawMenuStateStrings (PM_MIN_SCAN, MenuState.CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (optWhichCoarseScan == OPT_PC)
|
if (optWhichCoarseScan == OPT_PC)
|
||||||
PrintCoarseScanPC ();
|
PrintCoarseScanPC ();
|
||||||
@@ -1274,18 +1196,14 @@ ScanSystem (void)
|
|||||||
MenuState.InputFunc = DoScan;
|
MenuState.InputFunc = DoScan;
|
||||||
DoInput (&MenuState, FALSE);
|
DoInput (&MenuState, FALSE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// cleanup scan graphics
|
// cleanup scan graphics
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
SetContext (ScanContext);
|
SetContext (ScanContext);
|
||||||
DrawPlanet (0, BLACK_COLOR);
|
DrawPlanet (0, BLACK_COLOR);
|
||||||
EraseCoarseScan ();
|
EraseCoarseScan ();
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (eraseFrame));
|
DestroyDrawable (ReleaseDrawable (eraseFrame));
|
||||||
eraseFrame = NULL;
|
eraseFrame = NULL;
|
||||||
|
|||||||
@@ -1030,10 +1030,8 @@ DrawSystemTransition (BOOLEAN inner)
|
|||||||
static void
|
static void
|
||||||
TransitionSystemIn (void)
|
TransitionSystemIn (void)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
DrawSystemTransition (playerInInnerSystem ());
|
DrawSystemTransition (playerInInnerSystem ());
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1117,7 +1115,6 @@ IP_frame (void)
|
|||||||
BOOLEAN locChange;
|
BOOLEAN locChange;
|
||||||
SIZE newRadius;
|
SIZE newRadius;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
|
|
||||||
GameClockTick ();
|
GameClockTick ();
|
||||||
@@ -1148,7 +1145,6 @@ IP_frame (void)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
@@ -1311,9 +1307,7 @@ EnterPlanetOrbit (void)
|
|||||||
ValidateInnerOrbits ();
|
ValidateInnerOrbits ();
|
||||||
ResetSolarSys ();
|
ResetSolarSys ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairSISBorder ();
|
RepairSISBorder ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
TransitionSystemIn ();
|
TransitionSystemIn ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1325,11 +1319,9 @@ InitSolarSys (void)
|
|||||||
BOOLEAN Reentry;
|
BOOLEAN Reentry;
|
||||||
PLANET_DESC *orbital;
|
PLANET_DESC *orbital;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LoadIPData ();
|
LoadIPData ();
|
||||||
LoadLanderData ();
|
LoadLanderData ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
Reentry = (GLOBAL (ShipFacing) != 0);
|
Reentry = (GLOBAL (ShipFacing) != 0);
|
||||||
if (!Reentry)
|
if (!Reentry)
|
||||||
@@ -1344,7 +1336,6 @@ InitSolarSys (void)
|
|||||||
MAX_ZOOM_RADIUS);
|
MAX_ZOOM_RADIUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
StarsFrame = CreateStarBackGround ();
|
StarsFrame = CreateStarBackGround ();
|
||||||
|
|
||||||
@@ -1352,7 +1343,6 @@ InitSolarSys (void)
|
|||||||
SetContextFGFrame (Screen);
|
SetContextFGFrame (Screen);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
orbital = LoadSolarSys ();
|
orbital = LoadSolarSys ();
|
||||||
InnerSystem = CheckZoomLevel ();
|
InnerSystem = CheckZoomLevel ();
|
||||||
@@ -1380,7 +1370,6 @@ InitSolarSys (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Draw the borders, the system (inner or outer) and fade/transition
|
{ // Draw the borders, the system (inner or outer) and fade/transition
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
|
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
@@ -1418,8 +1407,6 @@ InitSolarSys (void)
|
|||||||
|
|
||||||
LastActivity &= ~CHECK_LOAD;
|
LastActivity &= ~CHECK_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1928,9 +1915,7 @@ DoSolarSysMenu (MENU_STATE *pMS)
|
|||||||
if (!select)
|
if (!select)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
switch (pMS->CurState)
|
switch (pMS->CurState)
|
||||||
{
|
{
|
||||||
@@ -1971,9 +1956,7 @@ DoSolarSysMenu (MENU_STATE *pMS)
|
|||||||
pMS->CurState = NAVIGATION;
|
pMS->CurState = NAVIGATION;
|
||||||
DrawMenuStateStrings (PM_STARMAP, pMS->CurState);
|
DrawMenuStateStrings (PM_STARMAP, pMS->CurState);
|
||||||
}
|
}
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1996,10 +1979,8 @@ SolarSysMenu (void)
|
|||||||
MenuState.CurState = STARMAP;
|
MenuState.CurState = STARMAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStatusMessage (NULL);
|
DrawStatusMessage (NULL);
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
MenuState.InputFunc = DoSolarSysMenu;
|
MenuState.InputFunc = DoSolarSysMenu;
|
||||||
|
|||||||
@@ -42,10 +42,6 @@
|
|||||||
#include "libs/inplib.h"
|
#include "libs/inplib.h"
|
||||||
|
|
||||||
|
|
||||||
// TODO: This entire module fails to uphold the GraphicsLock semantics
|
|
||||||
// This either has to be fixed, or GraphicsLock completely ignored,
|
|
||||||
// or will become irrelevant if GraphicsLock completely removed.
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
START_NEW_GAME = 0,
|
START_NEW_GAME = 0,
|
||||||
@@ -74,7 +70,6 @@ DrawRestartMenuGraphic (MENU_STATE *pMS)
|
|||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
ClearDrawable ();
|
ClearDrawable ();
|
||||||
FlushColorXForms ();
|
FlushColorXForms ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
|
|
||||||
// Put the version number in the bottom right corner.
|
// Put the version number in the bottom right corner.
|
||||||
@@ -89,7 +84,6 @@ DrawRestartMenuGraphic (MENU_STATE *pMS)
|
|||||||
SetContextForeGroundColor (WHITE_COLOR);
|
SetContextForeGroundColor (WHITE_COLOR);
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -606,20 +606,16 @@ SaveProblem (void)
|
|||||||
STAMP s;
|
STAMP s;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
SaveProblemMessage (&s);
|
SaveProblemMessage (&s);
|
||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
WaitForAnyButton (TRUE, WAIT_INFINITE, FALSE);
|
WaitForAnyButton (TRUE, WAIT_INFINITE, FALSE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
// Restore the screen under the message
|
// Restore the screen under the message
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ FRAME StatusFrame;
|
|||||||
FRAME FlagStatFrame;
|
FRAME FlagStatFrame;
|
||||||
FRAME MiscDataFrame;
|
FRAME MiscDataFrame;
|
||||||
FRAME FontGradFrame;
|
FRAME FontGradFrame;
|
||||||
Mutex GraphicsLock;
|
|
||||||
STRING GameStrings;
|
STRING GameStrings;
|
||||||
QUEUE disp_q;
|
QUEUE disp_q;
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ extern FONT StarConFont;
|
|||||||
extern FONT MicroFont;
|
extern FONT MicroFont;
|
||||||
extern FONT TinyFont;
|
extern FONT TinyFont;
|
||||||
|
|
||||||
extern Mutex GraphicsLock;
|
|
||||||
extern CondVar RenderingCond;
|
extern CondVar RenderingCond;
|
||||||
|
|
||||||
extern QUEUE race_q[];
|
extern QUEUE race_q[];
|
||||||
|
|||||||
+8
-60
@@ -119,11 +119,9 @@ on_input_frame (void)
|
|||||||
{
|
{
|
||||||
CONTEXT oldContext;
|
CONTEXT oldContext;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldContext = SetContext (SpaceContext);
|
oldContext = SetContext (SpaceContext);
|
||||||
animatePowerLines (NULL);
|
animatePowerLines (NULL);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_SHIP_SPINS
|
#ifdef WANT_SHIP_SPINS
|
||||||
@@ -139,9 +137,7 @@ SpinStarShip (MENU_STATE *pMS, HFLEETINFO hStarShip)
|
|||||||
|
|
||||||
if (Index >= 0 && Index < NUM_MELEE_SHIPS)
|
if (Index >= 0 && Index < NUM_MELEE_SHIPS)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DoShipSpin (Index, pMS->hMusic);
|
DoShipSpin (Index, pMS->hMusic);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -201,7 +197,6 @@ DrawRaceStrings (MENU_STATE *pMS, BYTE NewRaceItem)
|
|||||||
STAMP s;
|
STAMP s;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
OldContext = SetContext (StatusContext);
|
OldContext = SetContext (StatusContext);
|
||||||
GetContextClipRect (&r);
|
GetContextClipRect (&r);
|
||||||
@@ -259,7 +254,6 @@ DrawRaceStrings (MENU_STATE *pMS, BYTE NewRaceItem)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SHIP_WIN_WIDTH 34
|
#define SHIP_WIN_WIDTH 34
|
||||||
@@ -455,7 +449,6 @@ ShowCombatShip (MENU_STATE *pMS, COUNT which_window,
|
|||||||
AllDoorsFinished = TRUE;
|
AllDoorsFinished = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
GetContextClipRect (&OldClipRect);
|
GetContextClipRect (&OldClipRect);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
@@ -503,12 +496,10 @@ ShowCombatShip (MENU_STATE *pMS, COUNT which_window,
|
|||||||
#endif
|
#endif
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: GraphicsLock is unlocked.
|
|
||||||
static void
|
static void
|
||||||
CrewTransaction (SIZE crew_delta)
|
CrewTransaction (SIZE crew_delta)
|
||||||
{
|
{
|
||||||
@@ -552,7 +543,6 @@ CrewTransaction (SIZE crew_delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: GraphicsLock is locked.
|
|
||||||
static void
|
static void
|
||||||
DMS_FlashFlagShip (void)
|
DMS_FlashFlagShip (void)
|
||||||
{
|
{
|
||||||
@@ -576,7 +566,6 @@ DMS_GetEscortShipRect (RECT *rOut, BYTE slotNr)
|
|||||||
rOut->extent.height = SHIP_WIN_HEIGHT;
|
rOut->extent.height = SHIP_WIN_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: GraphicsLock is locked.
|
|
||||||
static void
|
static void
|
||||||
DMS_FlashEscortShip (BYTE slotNr)
|
DMS_FlashEscortShip (BYTE slotNr)
|
||||||
{
|
{
|
||||||
@@ -585,7 +574,6 @@ DMS_FlashEscortShip (BYTE slotNr)
|
|||||||
SetFlashRect (&r);
|
SetFlashRect (&r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: GraphicsLock is locked.
|
|
||||||
static void
|
static void
|
||||||
DMS_FlashFlagShipCrewCount (void)
|
DMS_FlashFlagShipCrewCount (void)
|
||||||
{
|
{
|
||||||
@@ -596,7 +584,6 @@ DMS_FlashFlagShipCrewCount (void)
|
|||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: GraphicsLock is locked.
|
|
||||||
static void
|
static void
|
||||||
DMS_FlashEscortShipCrewCount (BYTE slotNr)
|
DMS_FlashEscortShipCrewCount (BYTE slotNr)
|
||||||
{
|
{
|
||||||
@@ -615,7 +602,6 @@ DMS_FlashEscortShipCrewCount (BYTE slotNr)
|
|||||||
|
|
||||||
// Helper function for DoModifyShips(). Called to change the flash
|
// Helper function for DoModifyShips(). Called to change the flash
|
||||||
// rectangle to the currently selected ship (flagship or escort ship).
|
// rectangle to the currently selected ship (flagship or escort ship).
|
||||||
// The caller must hold the graphicsLock.
|
|
||||||
static void
|
static void
|
||||||
DMS_FlashActiveShip (MENU_STATE *pMS)
|
DMS_FlashActiveShip (MENU_STATE *pMS)
|
||||||
{
|
{
|
||||||
@@ -636,7 +622,6 @@ DMS_FlashActiveShip (MENU_STATE *pMS)
|
|||||||
// XXX: right now, this only switches the sound and flash rectangle.
|
// XXX: right now, this only switches the sound and flash rectangle.
|
||||||
// Perhaps we should move more of the code to modify other aspects
|
// Perhaps we should move more of the code to modify other aspects
|
||||||
// here too.
|
// here too.
|
||||||
// The caller must hold the graphicsLock.
|
|
||||||
static void
|
static void
|
||||||
DMS_SetMode (MENU_STATE *pMS, DMS_Mode mode)
|
DMS_SetMode (MENU_STATE *pMS, DMS_Mode mode)
|
||||||
{
|
{
|
||||||
@@ -677,7 +662,6 @@ DMS_SetMode (MENU_STATE *pMS, DMS_Mode mode)
|
|||||||
// It works both when the cursor is over an escort ship, while not editing
|
// It works both when the cursor is over an escort ship, while not editing
|
||||||
// the crew, and when a new ship is added.
|
// the crew, and when a new ship is added.
|
||||||
// hStarShip is the ship in the slot under the cursor (or 0 if no such ship).
|
// hStarShip is the ship in the slot under the cursor (or 0 if no such ship).
|
||||||
// Pre: GraphicsLock is locked.
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
DMS_SpinShip (MENU_STATE *pMS, HSHIPFRAG hStarShip)
|
DMS_SpinShip (MENU_STATE *pMS, HSHIPFRAG hStarShip)
|
||||||
{
|
{
|
||||||
@@ -751,9 +735,9 @@ DMS_HireFlagShipCrew (void)
|
|||||||
|
|
||||||
// Update the crew counter and RU. Note that the crew counter is
|
// Update the crew counter and RU. Note that the crew counter is
|
||||||
// flashing.
|
// flashing.
|
||||||
PreUpdateFlashRectLocked ();
|
PreUpdateFlashRect ();
|
||||||
DeltaSISGauges (1, 0, -GLOBAL (CrewCost));
|
DeltaSISGauges (1, 0, -GLOBAL (CrewCost));
|
||||||
PostUpdateFlashRectLocked ();
|
PostUpdateFlashRect ();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -780,10 +764,10 @@ DMS_DismissFlagShipCrew (void)
|
|||||||
|
|
||||||
// Update the crew counter and RU. Note that the crew counter is
|
// Update the crew counter and RU. Note that the crew counter is
|
||||||
// flashing.
|
// flashing.
|
||||||
PreUpdateFlashRectLocked ();
|
PreUpdateFlashRect ();
|
||||||
DeltaSISGauges (-1, 0, GLOBAL (CrewCost) -
|
DeltaSISGauges (-1, 0, GLOBAL (CrewCost) -
|
||||||
(crew_bought == CREW_EXPENSE_THRESHOLD ? 2 : 0));
|
(crew_bought == CREW_EXPENSE_THRESHOLD ? 2 : 0));
|
||||||
PostUpdateFlashRectLocked ();
|
PostUpdateFlashRect ();
|
||||||
|
|
||||||
// Remove the pixel representing the crew member.
|
// Remove the pixel representing the crew member.
|
||||||
GetCPodCapacity (&r.corner);
|
GetCPodCapacity (&r.corner);
|
||||||
@@ -843,10 +827,10 @@ DMS_HireEscortShipCrew (SHIP_FRAGMENT *StarShipPtr)
|
|||||||
|
|
||||||
++StarShipPtr->crew_level;
|
++StarShipPtr->crew_level;
|
||||||
|
|
||||||
PreUpdateFlashRectLocked ();
|
PreUpdateFlashRect ();
|
||||||
DMS_GetEscortShipRect (&r, StarShipPtr->index);
|
DMS_GetEscortShipRect (&r, StarShipPtr->index);
|
||||||
ShowShipCrew (StarShipPtr, &r);
|
ShowShipCrew (StarShipPtr, &r);
|
||||||
PostUpdateFlashRectLocked ();
|
PostUpdateFlashRect ();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -888,10 +872,10 @@ DMS_DismissEscortShipCrew (SHIP_FRAGMENT *StarShipPtr)
|
|||||||
PlayMenuSound (MENU_SOUND_FAILURE);
|
PlayMenuSound (MENU_SOUND_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreUpdateFlashRectLocked ();
|
PreUpdateFlashRect ();
|
||||||
DMS_GetEscortShipRect (&r, StarShipPtr->index);
|
DMS_GetEscortShipRect (&r, StarShipPtr->index);
|
||||||
ShowShipCrew (StarShipPtr, &r);
|
ShowShipCrew (StarShipPtr, &r);
|
||||||
PostUpdateFlashRectLocked ();
|
PostUpdateFlashRect ();
|
||||||
|
|
||||||
return crew_delta;
|
return crew_delta;
|
||||||
}
|
}
|
||||||
@@ -903,7 +887,6 @@ DMS_DismissEscortShipCrew (SHIP_FRAGMENT *StarShipPtr)
|
|||||||
// selected.
|
// selected.
|
||||||
// 'dy' is -1 if the 'up' button was pressed, or '1' if the down button was
|
// 'dy' is -1 if the 'up' button was pressed, or '1' if the down button was
|
||||||
// pressed.
|
// pressed.
|
||||||
// Pre: caller holds the GraphicsLock
|
|
||||||
static void
|
static void
|
||||||
DMS_ModifyCrew (MENU_STATE *pMS, HSHIPFRAG hStarShip, SBYTE dy)
|
DMS_ModifyCrew (MENU_STATE *pMS, HSHIPFRAG hStarShip, SBYTE dy)
|
||||||
{
|
{
|
||||||
@@ -960,15 +943,12 @@ DMS_ModifyCrew (MENU_STATE *pMS, HSHIPFRAG hStarShip, SBYTE dy)
|
|||||||
pMS->delta_item &= MODIFY_CREW_FLAG;
|
pMS->delta_item &= MODIFY_CREW_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
CrewTransaction (crew_delta);
|
CrewTransaction (crew_delta);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for DoModifyShips(), called when the player presses the
|
// Helper function for DoModifyShips(), called when the player presses the
|
||||||
// select button when the cursor is over an empty escort ship slot.
|
// select button when the cursor is over an empty escort ship slot.
|
||||||
// Try to add the currently selected ship as an escort ship.
|
// Try to add the currently selected ship as an escort ship.
|
||||||
// Pre: caller does not hold the GraphicsLock
|
|
||||||
static void
|
static void
|
||||||
DMS_TryAddEscortShip (MENU_STATE *pMS)
|
DMS_TryAddEscortShip (MENU_STATE *pMS)
|
||||||
{
|
{
|
||||||
@@ -983,11 +963,9 @@ DMS_TryAddEscortShip (MENU_STATE *pMS)
|
|||||||
// Reset flash rectangle
|
// Reset flash rectangle
|
||||||
DrawMenuStateStrings (PM_CREW, SHIPYARD_CREW);
|
DrawMenuStateStrings (PM_CREW, SHIPYARD_CREW);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA,
|
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA,
|
||||||
-((int)ShipCost[Index]));
|
-((int)ShipCost[Index]));
|
||||||
DMS_SetMode (pMS, DMS_Mode_editCrew);
|
DMS_SetMode (pMS, DMS_Mode_editCrew);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1011,28 +989,21 @@ DMS_AddEscortShip (MENU_STATE *pMS, BOOLEAN special, BOOLEAN select,
|
|||||||
if (special)
|
if (special)
|
||||||
{
|
{
|
||||||
HSHIPFRAG hStarShip = GetEscortByStarShipIndex (pMS->delta_item);
|
HSHIPFRAG hStarShip = GetEscortByStarShipIndex (pMS->delta_item);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (DMS_SpinShip (pMS, hStarShip))
|
if (DMS_SpinShip (pMS, hStarShip))
|
||||||
DMS_SetMode (pMS, DMS_Mode_addEscort);
|
DMS_SetMode (pMS, DMS_Mode_addEscort);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
(void) special; // Satisfying compiler.
|
(void) special; // Satisfying compiler.
|
||||||
#endif /* WANT_SHIP_SPINS */
|
#endif /* WANT_SHIP_SPINS */
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
{
|
{
|
||||||
// Cancel selecting an escort ship.
|
// Cancel selecting an escort ship.
|
||||||
pMS->delta_item &= ~MODIFY_CREW_FLAG;
|
pMS->delta_item &= ~MODIFY_CREW_FLAG;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawMenuStateStrings (PM_CREW, SHIPYARD_CREW);
|
DrawMenuStateStrings (PM_CREW, SHIPYARD_CREW);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DMS_SetMode (pMS, DMS_Mode_navigate);
|
DMS_SetMode (pMS, DMS_Mode_navigate);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (select)
|
else if (select)
|
||||||
{
|
{
|
||||||
@@ -1065,12 +1036,10 @@ DMS_AddEscortShip (MENU_STATE *pMS, BOOLEAN special, BOOLEAN select,
|
|||||||
pMS->delta_item = currentShip | MODIFY_CREW_FLAG;
|
pMS->delta_item = currentShip | MODIFY_CREW_FLAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for DoModifyShips(), called when the player presses
|
// Helper function for DoModifyShips(), called when the player presses
|
||||||
// 'select' or 'cancel' after selling all the crew.
|
// 'select' or 'cancel' after selling all the crew.
|
||||||
// Pre: caller holds the GraphicsLock
|
|
||||||
static void
|
static void
|
||||||
DMS_ScrapEscortShip (MENU_STATE *pMS, HSHIPFRAG hStarShip)
|
DMS_ScrapEscortShip (MENU_STATE *pMS, HSHIPFRAG hStarShip)
|
||||||
{
|
{
|
||||||
@@ -1079,9 +1048,7 @@ DMS_ScrapEscortShip (MENU_STATE *pMS, HSHIPFRAG hStarShip)
|
|||||||
BYTE slotNr;
|
BYTE slotNr;
|
||||||
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
ShowCombatShip (pMS, pMS->CurState, StarShipPtr);
|
ShowCombatShip (pMS, pMS->CurState, StarShipPtr);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
slotNr = StarShipPtr->index;
|
slotNr = StarShipPtr->index;
|
||||||
UnlockShipFrag (&GLOBAL (built_ship_q), hStarShip);
|
UnlockShipFrag (&GLOBAL (built_ship_q), hStarShip);
|
||||||
@@ -1138,7 +1105,6 @@ DMS_MoveCursor (BYTE curState, SBYTE dx, SBYTE dy)
|
|||||||
|
|
||||||
// Helper function for DoModifyShips(), called every time DoModifyShip() is
|
// Helper function for DoModifyShips(), called every time DoModifyShip() is
|
||||||
// called when we are in crew editing mode.
|
// called when we are in crew editing mode.
|
||||||
// Pre: Caller holds the GraphicsLock
|
|
||||||
static void
|
static void
|
||||||
DMS_EditCrewMode (MENU_STATE *pMS, HSHIPFRAG hStarShip,
|
DMS_EditCrewMode (MENU_STATE *pMS, HSHIPFRAG hStarShip,
|
||||||
BOOLEAN select, BOOLEAN cancel, SBYTE dy)
|
BOOLEAN select, BOOLEAN cancel, SBYTE dy)
|
||||||
@@ -1209,9 +1175,7 @@ DMS_NavigateShipSlots (MENU_STATE *pMS, BOOLEAN special, BOOLEAN select,
|
|||||||
// Select button was pressed over an empty escort
|
// Select button was pressed over an empty escort
|
||||||
// ship slot. Switch to 'add escort ship' mode.
|
// ship slot. Switch to 'add escort ship' mode.
|
||||||
pMS->delta_item = MODIFY_CREW_FLAG;
|
pMS->delta_item = MODIFY_CREW_FLAG;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawRaceStrings (pMS, 0);
|
DrawRaceStrings (pMS, 0);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DMS_SetMode (pMS, DMS_Mode_addEscort);
|
DMS_SetMode (pMS, DMS_Mode_addEscort);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1227,9 +1191,7 @@ DMS_NavigateShipSlots (MENU_STATE *pMS, BOOLEAN special, BOOLEAN select,
|
|||||||
// Leave escort ship editor.
|
// Leave escort ship editor.
|
||||||
pMS->InputFunc = DoShipyard;
|
pMS->InputFunc = DoShipyard;
|
||||||
pMS->CurState = SHIPYARD_CREW;
|
pMS->CurState = SHIPYARD_CREW;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DMS_SetMode (pMS, DMS_Mode_exit);
|
DMS_SetMode (pMS, DMS_Mode_exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1257,10 +1219,8 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
pMS->CurState = MAKE_BYTE (0, 0xF);
|
pMS->CurState = MAKE_BYTE (0, 0xF);
|
||||||
pMS->delta_item = 0;
|
pMS->delta_item = 0;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
DMS_SetMode (pMS, DMS_Mode_navigate);
|
DMS_SetMode (pMS, DMS_Mode_navigate);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1279,7 +1239,6 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
if (PulsedInputState.menu[KEY_MENU_DOWN])
|
if (PulsedInputState.menu[KEY_MENU_DOWN])
|
||||||
dy = 1;
|
dy = 1;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (!(pMS->delta_item & MODIFY_CREW_FLAG))
|
if (!(pMS->delta_item & MODIFY_CREW_FLAG))
|
||||||
{
|
{
|
||||||
@@ -1304,7 +1263,6 @@ DoModifyShips (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SleepThread (ONE_SECOND / 30);
|
SleepThread (ONE_SECOND / 30);
|
||||||
@@ -1452,7 +1410,6 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
|
|
||||||
pMS->hMusic = LoadMusic (SHIPYARD_MUSIC);
|
pMS->hMusic = LoadMusic (SHIPYARD_MUSIC);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawSISFrame ();
|
DrawSISFrame ();
|
||||||
@@ -1460,12 +1417,10 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE));
|
DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE));
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
DrawBluePrint (pMS);
|
DrawBluePrint (pMS);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pMS->CurState = SHIPYARD_CREW;
|
pMS->CurState = SHIPYARD_CREW;
|
||||||
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
s.origin.x = 0;
|
s.origin.x = 0;
|
||||||
s.origin.y = 0;
|
s.origin.y = 0;
|
||||||
@@ -1490,7 +1445,6 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
|
|
||||||
ScreenTransition (3, NULL);
|
ScreenTransition (3, NULL);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
PlayMusic (pMS->hMusic, TRUE, 1);
|
PlayMusic (pMS->hMusic, TRUE, 1);
|
||||||
|
|
||||||
@@ -1498,9 +1452,7 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
|
|
||||||
SetInputCallback (on_input_frame);
|
SetInputCallback (on_input_frame);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pMS->Initialized = TRUE;
|
pMS->Initialized = TRUE;
|
||||||
@@ -1510,12 +1462,10 @@ DoShipyard (MENU_STATE *pMS)
|
|||||||
ExitShipyard:
|
ExitShipyard:
|
||||||
SetInputCallback (NULL);
|
SetInputCallback (NULL);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DestroyDrawable (ReleaseDrawable (pMS->ModuleFrame));
|
DestroyDrawable (ReleaseDrawable (pMS->ModuleFrame));
|
||||||
pMS->ModuleFrame = 0;
|
pMS->ModuleFrame = 0;
|
||||||
DestroyColorMap (ReleaseColorMap (pMS->CurString));
|
DestroyColorMap (ReleaseColorMap (pMS->CurString));
|
||||||
pMS->CurString = 0;
|
pMS->CurString = 0;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1532,9 +1482,7 @@ ExitShipyard:
|
|||||||
if (!GameOptions ())
|
if (!GameOptions ())
|
||||||
goto ExitShipyard;
|
goto ExitShipyard;
|
||||||
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
DrawMenuStateStrings (PM_CREW, pMS->CurState);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -100,9 +100,7 @@ ClearSISRect (BYTE ClearFlags)
|
|||||||
|
|
||||||
if (ClearFlags & CLEAR_SIS_RADAR)
|
if (ClearFlags & CLEAR_SIS_RADAR)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawMenuStateStrings ((BYTE)~0, 1);
|
DrawMenuStateStrings ((BYTE)~0, 1);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
#ifdef NEVER
|
#ifdef NEVER
|
||||||
r.corner.x = RADAR_X - 1;
|
r.corner.x = RADAR_X - 1;
|
||||||
r.corner.y = RADAR_Y - 1;
|
r.corner.y = RADAR_Y - 1;
|
||||||
@@ -951,7 +949,6 @@ DrawModules (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: GraphicsLock is unlocked
|
|
||||||
static void
|
static void
|
||||||
DrawSupportShips (void)
|
DrawSupportShips (void)
|
||||||
{
|
{
|
||||||
@@ -975,9 +972,7 @@ DrawSupportShips (void)
|
|||||||
|
|
||||||
s.origin = *pship_pos;
|
s.origin = *pship_pos;
|
||||||
s.frame = StarShipPtr->icons;
|
s.frame = StarShipPtr->icons;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
UnlockShipFrag (&GLOBAL (built_ship_q), hStarShip);
|
UnlockShipFrag (&GLOBAL (built_ship_q), hStarShip);
|
||||||
}
|
}
|
||||||
@@ -1142,9 +1137,7 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
|||||||
DrawTurningJets ();
|
DrawTurningJets ();
|
||||||
DrawModules ();
|
DrawModules ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawSupportShips ();
|
DrawSupportShips ();
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
@@ -1619,7 +1612,6 @@ scheduleFlashAlarm (void)
|
|||||||
flashAlarm = Alarm_addAbsoluteMs (nextTimeMs, updateFlashRect, NULL);
|
flashAlarm = Alarm_addAbsoluteMs (nextTimeMs, updateFlashRect, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: the caller holds the GraphicsLock
|
|
||||||
void
|
void
|
||||||
SetFlashRect (const RECT *pRect)
|
SetFlashRect (const RECT *pRect)
|
||||||
{
|
{
|
||||||
@@ -1683,9 +1675,7 @@ SetFlashRect (const RECT *pRect)
|
|||||||
// Flash rectangle is empty. Stop flashing.
|
// Flash rectangle is empty. Stop flashing.
|
||||||
if (flashContext != NULL)
|
if (flashContext != NULL)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
Alarm_remove(flashAlarm);
|
Alarm_remove(flashAlarm);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
flashAlarm = 0;
|
flashAlarm = 0;
|
||||||
|
|
||||||
Flash_terminate (flashContext);
|
Flash_terminate (flashContext);
|
||||||
@@ -1700,7 +1690,6 @@ COUNT updateFlashRectRecursion = 0;
|
|||||||
// ClearSISRect(), which calls DrawMenuStateStrings(), which starts its own
|
// ClearSISRect(), which calls DrawMenuStateStrings(), which starts its own
|
||||||
// UpdateFlashRect block. This should probably be cleaned up.
|
// UpdateFlashRect block. This should probably be cleaned up.
|
||||||
|
|
||||||
// GraphicsLock must be unlocked.
|
|
||||||
void
|
void
|
||||||
PreUpdateFlashRect (void)
|
PreUpdateFlashRect (void)
|
||||||
{
|
{
|
||||||
@@ -1713,7 +1702,6 @@ PreUpdateFlashRect (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphicsLock must be unlocked.
|
|
||||||
void
|
void
|
||||||
PostUpdateFlashRect (void)
|
PostUpdateFlashRect (void)
|
||||||
{
|
{
|
||||||
@@ -1727,26 +1715,6 @@ PostUpdateFlashRect (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because the situation occurs a lot where the GraphicsLock is already
|
|
||||||
// locked, we add this function.
|
|
||||||
void
|
|
||||||
PreUpdateFlashRectLocked (void)
|
|
||||||
{
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
PreUpdateFlashRect ();
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Because the situation occurs a lot where the GraphicsLock is already
|
|
||||||
// locked, we add this function.
|
|
||||||
void
|
|
||||||
PostUpdateFlashRectLocked (void)
|
|
||||||
{
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
PostUpdateFlashRect ();
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop flashing if flashing is active.
|
// Stop flashing if flashing is active.
|
||||||
void
|
void
|
||||||
PauseFlash (void)
|
PauseFlash (void)
|
||||||
|
|||||||
@@ -184,8 +184,6 @@ extern void ClearSISRect (BYTE ClearFlags);
|
|||||||
extern void SetFlashRect (const RECT *pRect);
|
extern void SetFlashRect (const RECT *pRect);
|
||||||
extern void PreUpdateFlashRect (void);
|
extern void PreUpdateFlashRect (void);
|
||||||
extern void PostUpdateFlashRect (void);
|
extern void PostUpdateFlashRect (void);
|
||||||
extern void PreUpdateFlashRectLocked (void);
|
|
||||||
extern void PostUpdateFlashRectLocked (void);
|
|
||||||
extern void PauseFlash (void);
|
extern void PauseFlash (void);
|
||||||
extern void ContinueFlash (void);
|
extern void ContinueFlash (void);
|
||||||
|
|
||||||
|
|||||||
@@ -307,7 +307,6 @@ DoStarBase (MENU_STATE *pMS)
|
|||||||
LastActivity &= ~CHECK_LOAD;
|
LastActivity &= ~CHECK_LOAD;
|
||||||
pMS->InputFunc = DoStarBase;
|
pMS->InputFunc = DoStarBase;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
|
|
||||||
if (pMS->hMusic)
|
if (pMS->hMusic)
|
||||||
@@ -318,12 +317,10 @@ DoStarBase (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pMS->Initialized = TRUE;
|
pMS->Initialized = TRUE;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pMS->CurFrame = CaptureDrawable (LoadGraphic (STARBASE_ANIM));
|
pMS->CurFrame = CaptureDrawable (LoadGraphic (STARBASE_ANIM));
|
||||||
pMS->hMusic = LoadMusic (STARBASE_MUSIC);
|
pMS->hMusic = LoadMusic (STARBASE_MUSIC);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -334,7 +331,6 @@ DoStarBase (MENU_STATE *pMS)
|
|||||||
ScreenTransition (3, NULL);
|
ScreenTransition (3, NULL);
|
||||||
PlayMusic (pMS->hMusic, TRUE, 1);
|
PlayMusic (pMS->hMusic, TRUE, 1);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (PulsedInputState.menu[KEY_MENU_SELECT])
|
else if (PulsedInputState.menu[KEY_MENU_SELECT])
|
||||||
{
|
{
|
||||||
@@ -404,7 +400,6 @@ ExitStarBase:
|
|||||||
NewState = TALK_COMMANDER;
|
NewState = TALK_COMMANDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
|
|
||||||
@@ -417,7 +412,6 @@ ExitStarBase:
|
|||||||
rotateStarbase (pMS, NULL);
|
rotateStarbase (pMS, NULL);
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThread (ONE_SECOND / 30);
|
SleepThread (ONE_SECOND / 30);
|
||||||
}
|
}
|
||||||
@@ -430,9 +424,7 @@ DoTimePassage (void)
|
|||||||
{
|
{
|
||||||
#define LOST_DAYS 14
|
#define LOST_DAYS 14
|
||||||
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND * 2));
|
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND * 2));
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
MoveGameClockDays (LOST_DAYS);
|
MoveGameClockDays (LOST_DAYS);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -541,12 +533,10 @@ InstallBombAtEarth (void)
|
|||||||
{
|
{
|
||||||
DoTimePassage ();
|
DoTimePassage ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
SetTransitionSource (NULL);
|
SetTransitionSource (NULL);
|
||||||
SetContextBackGroundColor (BLACK_COLOR);
|
SetContextBackGroundColor (BLACK_COLOR);
|
||||||
ClearDrawable ();
|
ClearDrawable ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (FadeScreen (FadeAllToColor, 0));
|
SleepThreadUntil (FadeScreen (FadeAllToColor, 0));
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ checkArilouGate (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Battle frame callback function.
|
// Battle frame callback function.
|
||||||
// Called with GraphicsLock held
|
|
||||||
static void
|
static void
|
||||||
on_battle_frame (void)
|
on_battle_frame (void)
|
||||||
{
|
{
|
||||||
@@ -286,9 +285,7 @@ while (--ac > 0)
|
|||||||
Battle (&on_battle_frame);
|
Battle (&on_battle_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetFlashRect (NULL);
|
SetFlashRect (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
LastActivity = GLOBAL (CurrentActivity);
|
LastActivity = GLOBAL (CurrentActivity);
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ DrawPickIcon (MeleeShip ship, bool DrawErase)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: the called holds the GraphicsLock
|
|
||||||
void
|
void
|
||||||
DrawPickFrame (MELEE_STATE *pMS)
|
DrawPickFrame (MELEE_STATE *pMS)
|
||||||
{
|
{
|
||||||
@@ -187,11 +186,9 @@ DoPickShip (MELEE_STATE *pMS)
|
|||||||
if (newSelectedShip != pMS->currentShip)
|
if (newSelectedShip != pMS->currentShip)
|
||||||
{
|
{
|
||||||
// A new ship has been selected.
|
// A new ship has been selected.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawPickIcon (pMS->currentShip, true);
|
DrawPickIcon (pMS->currentShip, true);
|
||||||
pMS->currentShip = newSelectedShip;
|
pMS->currentShip = newSelectedShip;
|
||||||
DrawMeleeShipStrings (pMS, newSelectedShip);
|
DrawMeleeShipStrings (pMS, newSelectedShip);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,9 +211,7 @@ BuildPickShip (MELEE_STATE *pMS)
|
|||||||
if (pMS->currentShip == MELEE_NONE)
|
if (pMS->currentShip == MELEE_NONE)
|
||||||
pMS->currentShip = 0;
|
pMS->currentShip = 0;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawPickFrame (pMS);
|
DrawPickFrame (pMS);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
pMS->InputFunc = DoPickShip;
|
pMS->InputFunc = DoPickShip;
|
||||||
DoInput (pMS, FALSE);
|
DoInput (pMS, FALSE);
|
||||||
|
|||||||
@@ -311,11 +311,9 @@ flashSelectedTeam (MELEE_STATE *pMS)
|
|||||||
NextTime = Now + FLASH_RATE;
|
NextTime = Now + FLASH_RATE;
|
||||||
hilite ^= 1;
|
hilite ^= 1;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
SelectFileString (pMS, hilite);
|
SelectFileString (pMS, hilite);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,12 +333,10 @@ DoLoadTeam (MELEE_STATE *pMS)
|
|||||||
|
|
||||||
if (!pMS->Initialized)
|
if (!pMS->Initialized)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawFileStrings (pMS);
|
DrawFileStrings (pMS);
|
||||||
SelectFileString (pMS, true);
|
SelectFileString (pMS, true);
|
||||||
pMS->Initialized = TRUE;
|
pMS->Initialized = TRUE;
|
||||||
pMS->InputFunc = DoLoadTeam;
|
pMS->InputFunc = DoLoadTeam;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,9 +356,7 @@ DoLoadTeam (MELEE_STATE *pMS)
|
|||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
GetFrameRect (SetAbsFrameIndex (MeleeFrame, 28), &r);
|
GetFrameRect (SetAbsFrameIndex (MeleeFrame, 28), &r);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairMeleeFrame (&r);
|
RepairMeleeFrame (&r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -418,7 +412,6 @@ DoLoadTeam (MELEE_STATE *pMS)
|
|||||||
if (newIndex != pMS->load.cur)
|
if (newIndex != pMS->load.cur)
|
||||||
{
|
{
|
||||||
// The cursor has been moved.
|
// The cursor has been moved.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (newTop == pMS->load.top)
|
if (newTop == pMS->load.top)
|
||||||
{
|
{
|
||||||
// The view itself hasn't changed.
|
// The view itself hasn't changed.
|
||||||
@@ -431,7 +424,6 @@ DoLoadTeam (MELEE_STATE *pMS)
|
|||||||
DrawFileStrings (pMS);
|
DrawFileStrings (pMS);
|
||||||
}
|
}
|
||||||
pMS->load.cur = newIndex;
|
pMS->load.cur = newIndex;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,11 +474,9 @@ DoSaveTeam (MELEE_STATE *pMS)
|
|||||||
snprintf (file, sizeof file, "%s.mle",
|
snprintf (file, sizeof file, "%s.mle",
|
||||||
MeleeSetup_getTeamName (pMS->meleeSetup, pMS->side));
|
MeleeSetup_getTeamName (pMS->meleeSetup, pMS->side));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (ScreenContext);
|
OldContext = SetContext (ScreenContext);
|
||||||
ConfirmSaveLoad (&MsgStamp);
|
ConfirmSaveLoad (&MsgStamp);
|
||||||
// Show the "Saving . . ." message.
|
// Show the "Saving . . ." message.
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
stream = uio_fopen (meleeDir, file, "wb");
|
stream = uio_fopen (meleeDir, file, "wb");
|
||||||
if (stream != NULL)
|
if (stream != NULL)
|
||||||
@@ -503,11 +493,9 @@ DoSaveTeam (MELEE_STATE *pMS)
|
|||||||
pMS->load.cur = 0;
|
pMS->load.cur = 0;
|
||||||
|
|
||||||
// Undo the screen damage done by the "Saving . . ." message.
|
// Undo the screen damage done by the "Saving . . ." message.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawStamp (&MsgStamp);
|
DrawStamp (&MsgStamp);
|
||||||
DestroyDrawable (ReleaseDrawable (MsgStamp.frame));
|
DestroyDrawable (ReleaseDrawable (MsgStamp.frame));
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (!saveOk)
|
if (!saveOk)
|
||||||
SaveProblem ();
|
SaveProblem ();
|
||||||
|
|||||||
@@ -250,7 +250,6 @@ GetShipBox (RECT *pRect, COUNT side, COUNT row, COUNT col)
|
|||||||
pRect->extent.height = MELEE_BOX_HEIGHT;
|
pRect->extent.height = MELEE_BOX_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The caller must hold the GraphicsLock.
|
|
||||||
static void
|
static void
|
||||||
DrawShipBox (COUNT side, FleetShipIndex index, MeleeShip ship, BOOLEAN HiLite)
|
DrawShipBox (COUNT side, FleetShipIndex index, MeleeShip ship, BOOLEAN HiLite)
|
||||||
{
|
{
|
||||||
@@ -286,7 +285,6 @@ DrawShipBox (COUNT side, FleetShipIndex index, MeleeShip ship, BOOLEAN HiLite)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The caller must hold the GraphicsLock.
|
|
||||||
static void
|
static void
|
||||||
ClearShipBox (COUNT side, FleetShipIndex index)
|
ClearShipBox (COUNT side, FleetShipIndex index)
|
||||||
{
|
{
|
||||||
@@ -570,7 +568,6 @@ DrawTeamString (MELEE_STATE *pMS, COUNT side, COUNT HiLiteState,
|
|||||||
|
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
// This function is generic. It should probably be moved to elsewhere.
|
// This function is generic. It should probably be moved to elsewhere.
|
||||||
// The caller should hold the GraphicsLock.
|
|
||||||
static void
|
static void
|
||||||
multiLineDrawText (TEXT *textIn, RECT *clipRect) {
|
multiLineDrawText (TEXT *textIn, RECT *clipRect) {
|
||||||
RECT oldRect;
|
RECT oldRect;
|
||||||
@@ -617,7 +614,6 @@ DrawMeleeStatusMessage (const char *message)
|
|||||||
CONTEXT oldContext;
|
CONTEXT oldContext;
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldContext = SetContext (SpaceContext);
|
oldContext = SetContext (SpaceContext);
|
||||||
|
|
||||||
r.corner.x = MELEE_STATUS_X_OFFS;
|
r.corner.x = MELEE_STATUS_X_OFFS;
|
||||||
@@ -643,7 +639,6 @@ DrawMeleeStatusMessage (const char *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -697,7 +692,6 @@ UpdateMeleeStatusMessage (ssize_t player)
|
|||||||
#endif /* NETPLAY */
|
#endif /* NETPLAY */
|
||||||
|
|
||||||
// XXX: this function is called when the current selection is blinking off.
|
// XXX: this function is called when the current selection is blinking off.
|
||||||
// The caller should hold the GraphicsLock.
|
|
||||||
static void
|
static void
|
||||||
Deselect (BYTE opt)
|
Deselect (BYTE opt)
|
||||||
{
|
{
|
||||||
@@ -760,7 +754,6 @@ Deselect (BYTE opt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX: this function is called when the current selection is blinking off.
|
// XXX: this function is called when the current selection is blinking off.
|
||||||
// The caller should hold the GraphicsLock.
|
|
||||||
static void
|
static void
|
||||||
Select (BYTE opt)
|
Select (BYTE opt)
|
||||||
{
|
{
|
||||||
@@ -837,14 +830,12 @@ Melee_flashSelection (MELEE_STATE *pMS)
|
|||||||
NextTime = Now + FLASH_RATE;
|
NextTime = Now + FLASH_RATE;
|
||||||
select = !select;
|
select = !select;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
if (select)
|
if (select)
|
||||||
Select (pMS->MeleeOption);
|
Select (pMS->MeleeOption);
|
||||||
else
|
else
|
||||||
Deselect (pMS->MeleeOption);
|
Deselect (pMS->MeleeOption);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,7 +861,6 @@ InitMelee (MELEE_STATE *pMS)
|
|||||||
(void) pMS;
|
(void) pMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre: The caller holds the GraphicsLock.
|
|
||||||
void
|
void
|
||||||
DrawMeleeShipStrings (MELEE_STATE *pMS, MeleeShip NewStarShip)
|
DrawMeleeShipStrings (MELEE_STATE *pMS, MeleeShip NewStarShip)
|
||||||
{
|
{
|
||||||
@@ -957,9 +947,7 @@ UpdateCurrentShip (MELEE_STATE *pMS)
|
|||||||
MeleeSetup_getShip (pMS->meleeSetup, pMS->side, slotNr);
|
MeleeSetup_getShip (pMS->meleeSetup, pMS->side, slotNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawMeleeShipStrings (pMS, pMS->currentShip);
|
DrawMeleeShipStrings (pMS, pMS->currentShip);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns (COUNT) ~0 for an invalid ship.
|
// returns (COUNT) ~0 for an invalid ship.
|
||||||
@@ -1025,9 +1013,7 @@ OnTeamNameChange (TEXTENTRY_STATE *pTES)
|
|||||||
if (pTES->JoystickMode)
|
if (pTES->JoystickMode)
|
||||||
hl |= DTSHS_BLOCKCUR;
|
hl |= DTSHS_BLOCKCUR;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
ret = DrawTeamString (pMS, pMS->side, hl, pTES->BaseStr);
|
ret = DrawTeamString (pMS, pMS->side, hl, pTES->BaseStr);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -1074,9 +1060,7 @@ BuildPickShipPopup (MELEE_STATE *pMS)
|
|||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
GetBuildPickFrameRect (&r);
|
GetBuildPickFrameRect (&r);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
RepairMeleeFrame (&r);
|
RepairMeleeFrame (&r);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCurrentShip (pMS);
|
UpdateCurrentShip (pMS);
|
||||||
@@ -1113,12 +1097,10 @@ DoEdit (MELEE_STATE *pMS)
|
|||||||
|| pMS->row == NUM_MELEE_ROWS))))
|
|| pMS->row == NUM_MELEE_ROWS))))
|
||||||
{
|
{
|
||||||
// Done editing the teams.
|
// Done editing the teams.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
Deselect (EDIT_MELEE);
|
Deselect (EDIT_MELEE);
|
||||||
pMS->currentShip = MELEE_NONE;
|
pMS->currentShip = MELEE_NONE;
|
||||||
pMS->MeleeOption = START_MELEE;
|
pMS->MeleeOption = START_MELEE;
|
||||||
pMS->InputFunc = DoMelee;
|
pMS->InputFunc = DoMelee;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
pMS->LastInputTime = GetTimeCounter ();
|
pMS->LastInputTime = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
else if (pMS->row < NUM_MELEE_ROWS
|
else if (pMS->row < NUM_MELEE_ROWS
|
||||||
@@ -1132,13 +1114,11 @@ DoEdit (MELEE_STATE *pMS)
|
|||||||
&& PulsedInputState.menu[KEY_MENU_SPECIAL])
|
&& PulsedInputState.menu[KEY_MENU_SPECIAL])
|
||||||
{
|
{
|
||||||
// TODO: this is a stub; Should we display a ship spin?
|
// TODO: this is a stub; Should we display a ship spin?
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
Deselect (EDIT_MELEE);
|
Deselect (EDIT_MELEE);
|
||||||
if (pMS->currentShip != MELEE_NONE)
|
if (pMS->currentShip != MELEE_NONE)
|
||||||
{
|
{
|
||||||
// Do something with pMS->currentShip here
|
// Do something with pMS->currentShip here
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else if (pMS->row < NUM_MELEE_ROWS &&
|
else if (pMS->row < NUM_MELEE_ROWS &&
|
||||||
PulsedInputState.menu[KEY_MENU_DELETE])
|
PulsedInputState.menu[KEY_MENU_DELETE])
|
||||||
@@ -1165,9 +1145,7 @@ DoEdit (MELEE_STATE *pMS)
|
|||||||
|
|
||||||
// going to enter text
|
// going to enter text
|
||||||
pMS->CurIndex = 0;
|
pMS->CurIndex = 0;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawTeamString (pMS, pMS->side, DTSHS_EDIT, NULL);
|
DrawTeamString (pMS, pMS->side, DTSHS_EDIT, NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
strncpy (buf, MeleeSetup_getTeamName (
|
strncpy (buf, MeleeSetup_getTeamName (
|
||||||
pMS->meleeSetup, pMS->side), MAX_TEAM_CHARS);
|
pMS->meleeSetup, pMS->side), MAX_TEAM_CHARS);
|
||||||
@@ -1238,12 +1216,10 @@ DoEdit (MELEE_STATE *pMS)
|
|||||||
|
|
||||||
if (col != pMS->col || row != pMS->row || side != pMS->side)
|
if (col != pMS->col || row != pMS->row || side != pMS->side)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
Deselect (EDIT_MELEE);
|
Deselect (EDIT_MELEE);
|
||||||
pMS->side = side;
|
pMS->side = side;
|
||||||
pMS->row = row;
|
pMS->row = row;
|
||||||
pMS->col = col;
|
pMS->col = col;
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
UpdateCurrentShip (pMS);
|
UpdateCurrentShip (pMS);
|
||||||
}
|
}
|
||||||
@@ -1488,9 +1464,7 @@ StartMelee (MELEE_STATE *pMS)
|
|||||||
{
|
{
|
||||||
if (!SetPlayerInputAll ())
|
if (!SetPlayerInputAll ())
|
||||||
break;
|
break;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
BuildAndDrawShipList (pMS);
|
BuildAndDrawShipList (pMS);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
||||||
|
|
||||||
@@ -1638,7 +1612,6 @@ DoConnectingDialog (MELEE_STATE *pMS)
|
|||||||
pMS->InputFunc = DoConnectingDialog;
|
pMS->InputFunc = DoConnectingDialog;
|
||||||
|
|
||||||
/* Draw the dialog box here */
|
/* Draw the dialog box here */
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
oldfont = SetContextFont (StarConFont);
|
oldfont = SetContextFont (StarConFont);
|
||||||
oldcolor = SetContextForeGroundColor (BLACK_COLOR);
|
oldcolor = SetContextForeGroundColor (BLACK_COLOR);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -1674,7 +1647,6 @@ DoConnectingDialog (MELEE_STATE *pMS)
|
|||||||
SetContextFont (oldfont);
|
SetContextFont (oldfont);
|
||||||
SetContextForeGroundColor (oldcolor);
|
SetContextForeGroundColor (oldcolor);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
netInput ();
|
netInput ();
|
||||||
@@ -1882,9 +1854,7 @@ DoMelee (MELEE_STATE *pMS)
|
|||||||
|
|
||||||
pMS->MeleeOption = START_MELEE;
|
pMS->MeleeOption = START_MELEE;
|
||||||
PlayMusic (pMS->hMusic, TRUE, 1);
|
PlayMusic (pMS->hMusic, TRUE, 1);
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
InitMelee (pMS);
|
InitMelee (pMS);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
FadeScreen (FadeAllToColor, ONE_SECOND / 2);
|
FadeScreen (FadeAllToColor, ONE_SECOND / 2);
|
||||||
pMS->LastInputTime = GetTimeCounter ();
|
pMS->LastInputTime = GetTimeCounter ();
|
||||||
@@ -1899,10 +1869,8 @@ DoMelee (MELEE_STATE *pMS)
|
|||||||
PulsedInputState.menu[KEY_MENU_LEFT])
|
PulsedInputState.menu[KEY_MENU_LEFT])
|
||||||
{
|
{
|
||||||
// Start editing the teams.
|
// Start editing the teams.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
pMS->LastInputTime = GetTimeCounter ();
|
pMS->LastInputTime = GetTimeCounter ();
|
||||||
Deselect (pMS->MeleeOption);
|
Deselect (pMS->MeleeOption);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
pMS->MeleeOption = EDIT_MELEE;
|
pMS->MeleeOption = EDIT_MELEE;
|
||||||
pMS->Initialized = FALSE;
|
pMS->Initialized = FALSE;
|
||||||
if (PulsedInputState.menu[KEY_MENU_CANCEL])
|
if (PulsedInputState.menu[KEY_MENU_CANCEL])
|
||||||
@@ -1949,11 +1917,9 @@ DoMelee (MELEE_STATE *pMS)
|
|||||||
pMS->MeleeOption == CONTROLS_BOT)
|
pMS->MeleeOption == CONTROLS_BOT)
|
||||||
UpdateMeleeStatusMessage (-1);
|
UpdateMeleeStatusMessage (-1);
|
||||||
#endif
|
#endif
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
Deselect (pMS->MeleeOption);
|
Deselect (pMS->MeleeOption);
|
||||||
pMS->MeleeOption = NewMeleeOption;
|
pMS->MeleeOption = NewMeleeOption;
|
||||||
Select (pMS->MeleeOption);
|
Select (pMS->MeleeOption);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
if (NewMeleeOption == CONTROLS_TOP ||
|
if (NewMeleeOption == CONTROLS_TOP ||
|
||||||
NewMeleeOption == CONTROLS_BOT)
|
NewMeleeOption == CONTROLS_BOT)
|
||||||
@@ -2148,14 +2114,12 @@ updateRandomSeed (MELEE_STATE *pMS, COUNT side, DWORD seed)
|
|||||||
void
|
void
|
||||||
confirmationCancelled (MELEE_STATE *pMS, COUNT side)
|
confirmationCancelled (MELEE_STATE *pMS, COUNT side)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (side == 0)
|
if (side == 0)
|
||||||
DrawMeleeStatusMessage (GAME_STRING (NETMELEE_STRING_BASE + 16));
|
DrawMeleeStatusMessage (GAME_STRING (NETMELEE_STRING_BASE + 16));
|
||||||
// "Bottom player changed something -- need to reconfirm."
|
// "Bottom player changed something -- need to reconfirm."
|
||||||
else
|
else
|
||||||
DrawMeleeStatusMessage (GAME_STRING (NETMELEE_STRING_BASE + 17));
|
DrawMeleeStatusMessage (GAME_STRING (NETMELEE_STRING_BASE + 17));
|
||||||
// "Top player changed something -- need to reconfirm."
|
// "Top player changed something -- need to reconfirm."
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
if (pMS->InputFunc == DoConfirmSettings)
|
if (pMS->InputFunc == DoConfirmSettings)
|
||||||
pMS->InputFunc = DoMelee;
|
pMS->InputFunc = DoMelee;
|
||||||
@@ -2168,9 +2132,7 @@ connectionFeedback (NetConnection *conn, const char *str, bool forcePopup) {
|
|||||||
if (bs == NULL && !forcePopup)
|
if (bs == NULL && !forcePopup)
|
||||||
{
|
{
|
||||||
// bs == NULL means the game has not started yet.
|
// bs == NULL means the game has not started yet.
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawMeleeStatusMessage (str);
|
DrawMeleeStatusMessage (str);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2314,10 +2276,8 @@ Melee_UpdateView_fleetValue (MELEE_STATE *pMS, COUNT side)
|
|||||||
if (pMS->meleeStarted)
|
if (pMS->meleeStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawFleetValue (pMS, side, DTSHS_REPAIR);
|
DrawFleetValue (pMS, side, DTSHS_REPAIR);
|
||||||
// BUG: The fleet value is always drawn as deselected.
|
// BUG: The fleet value is always drawn as deselected.
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2330,7 +2290,6 @@ Melee_UpdateView_ship (MELEE_STATE *pMS, COUNT side, FleetShipIndex index)
|
|||||||
|
|
||||||
ship = MeleeSetup_getShip (pMS->meleeSetup, side, index);
|
ship = MeleeSetup_getShip (pMS->meleeSetup, side, index);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
if (ship == MELEE_NONE)
|
if (ship == MELEE_NONE)
|
||||||
{
|
{
|
||||||
ClearShipBox (side, index);
|
ClearShipBox (side, index);
|
||||||
@@ -2339,7 +2298,6 @@ Melee_UpdateView_ship (MELEE_STATE *pMS, COUNT side, FleetShipIndex index)
|
|||||||
{
|
{
|
||||||
DrawShipBox (side, index, ship, FALSE);
|
DrawShipBox (side, index, ship, FALSE);
|
||||||
}
|
}
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2348,9 +2306,7 @@ Melee_UpdateView_teamName (MELEE_STATE *pMS, COUNT side)
|
|||||||
if (pMS->meleeStarted)
|
if (pMS->meleeStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawTeamString (pMS, side, DTSHS_REPAIR, NULL);
|
DrawTeamString (pMS, side, DTSHS_REPAIR, NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -2378,9 +2334,7 @@ Melee_Change_ship (MELEE_STATE *pMS, COUNT side, FleetShipIndex index,
|
|||||||
if (isShipSlotSelected (pMS, side, index))
|
if (isShipSlotSelected (pMS, side, index))
|
||||||
{
|
{
|
||||||
pMS->currentShip = ship;
|
pMS->currentShip = ship;
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DrawMeleeShipStrings (pMS, ship);
|
DrawMeleeShipStrings (pMS, ship);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -656,7 +656,6 @@ MeleeGameOver (void)
|
|||||||
for (playerI = 0; playerI < NUM_PLAYERS; playerI++)
|
for (playerI = 0; playerI < NUM_PLAYERS; playerI++)
|
||||||
DrawPickMeleeFrame (playerI);
|
DrawPickMeleeFrame (playerI);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
negotiateReadyConnections(true, NetState_inSetup);
|
negotiateReadyConnections(true, NetState_inSetup);
|
||||||
@@ -683,7 +682,6 @@ MeleeGameOver (void)
|
|||||||
&& (!(PlayerControl[0] & PlayerControl[1] & PSYTRON_CONTROL)
|
&& (!(PlayerControl[0] & PlayerControl[1] & PSYTRON_CONTROL)
|
||||||
|| GetTimeCounter () < TimeOut)));
|
|| GetTimeCounter () < TimeOut)));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -796,12 +794,10 @@ GetMeleeStarShips (COUNT playerMask, HSTARSHIP *ships)
|
|||||||
|
|
||||||
SetContext (OffScreenContext);
|
SetContext (OffScreenContext);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DoInput (&gmstate, FALSE);
|
DoInput (&gmstate, FALSE);
|
||||||
WaitForSoundEnd (0);
|
WaitForSoundEnd (0);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
for (playerI = 0; playerI < NUM_PLAYERS; playerI++)
|
for (playerI = 0; playerI < NUM_PLAYERS; playerI++)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-18
@@ -147,7 +147,7 @@ debugKeyPressed (void)
|
|||||||
// Fast forwards to the next event.
|
// Fast forwards to the next event.
|
||||||
// If skipHEE is set, HYPERSPACE_ENCOUNTER_EVENTs are skipped.
|
// If skipHEE is set, HYPERSPACE_ENCOUNTER_EVENTs are skipped.
|
||||||
// Must be called from the Starcon2Main thread.
|
// Must be called from the Starcon2Main thread.
|
||||||
// TODO: GraphicsLock and LockGameClock may be removed since it is only
|
// TODO: LockGameClock may be removed since it is only
|
||||||
// supposed to be called synchronously wrt the game logic thread.
|
// supposed to be called synchronously wrt the game logic thread.
|
||||||
void
|
void
|
||||||
forwardToNextEvent (BOOLEAN skipHEE)
|
forwardToNextEvent (BOOLEAN skipHEE)
|
||||||
@@ -161,9 +161,6 @@ forwardToNextEvent (BOOLEAN skipHEE)
|
|||||||
if (!GameClockRunning ())
|
if (!GameClockRunning ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Must hold GraphicsLock for MoveGameClockDays()
|
|
||||||
// Must acquire GraphicsLock *before* the game clock lock
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
LockGameClock ();
|
LockGameClock ();
|
||||||
|
|
||||||
done = !skipHEE;
|
done = !skipHEE;
|
||||||
@@ -192,7 +189,6 @@ forwardToNextEvent (BOOLEAN skipHEE)
|
|||||||
} while (!done);
|
} while (!done);
|
||||||
|
|
||||||
UnlockGameClock ();
|
UnlockGameClock ();
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -376,9 +372,7 @@ equipShip (void)
|
|||||||
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE ||
|
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE ||
|
||||||
LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
|
LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
|
||||||
{
|
{
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,9 +429,7 @@ clearEscorts (void)
|
|||||||
FreeShipFrag (&GLOBAL (built_ship_q), hStarShip);
|
FreeShipFrag (&GLOBAL (built_ship_q), hStarShip);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1865,16 +1857,13 @@ debugContexts (void)
|
|||||||
return;
|
return;
|
||||||
inDebugContexts = true;
|
inDebugContexts = true;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
contextCount = countVisibleContexts ();
|
contextCount = countVisibleContexts ();
|
||||||
if (contextCount == 0)
|
if (contextCount == 0)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
savedScreen = getScreen ();
|
savedScreen = getScreen ();
|
||||||
//UnlockMutex (GraphicsLock);
|
|
||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
// Make sure that the screen has actually been captured,
|
// Make sure that the screen has actually been captured,
|
||||||
// before we use the frame.
|
// before we use the frame.
|
||||||
@@ -1888,7 +1877,6 @@ debugContexts (void)
|
|||||||
|
|
||||||
hueIncrement = 360.0 / contextCount;
|
hueIncrement = 360.0 / contextCount;
|
||||||
|
|
||||||
//LockMutex (GraphicsLock);
|
|
||||||
visibleContextI = 0;
|
visibleContextI = 0;
|
||||||
for (context = GetFirstContext (); context != NULL;
|
for (context = GetFirstContext (); context != NULL;
|
||||||
context = GetNextContext (context))
|
context = GetNextContext (context))
|
||||||
@@ -1910,7 +1898,6 @@ debugContexts (void)
|
|||||||
|
|
||||||
// Blit the final debugging frame to the screen.
|
// Blit the final debugging frame to the screen.
|
||||||
putScreen (debugDrawFrame);
|
putScreen (debugDrawFrame);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// Wait for a key:
|
// Wait for a key:
|
||||||
{
|
{
|
||||||
@@ -1919,9 +1906,7 @@ debugContexts (void)
|
|||||||
DoInput(&state, TRUE);
|
DoInput(&state, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SetContext (orgContext);
|
SetContext (orgContext);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
// Destroy the debugging frame and context.
|
// Destroy the debugging frame and context.
|
||||||
DestroyContext (debugDrawContext);
|
DestroyContext (debugDrawContext);
|
||||||
@@ -1929,9 +1914,7 @@ debugContexts (void)
|
|||||||
// SetContextFGFrame().
|
// SetContextFGFrame().
|
||||||
DestroyDrawable (ReleaseDrawable (debugDrawFrame));
|
DestroyDrawable (ReleaseDrawable (debugDrawFrame));
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
putScreen (savedScreen);
|
putScreen (savedScreen);
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
DestroyDrawable (ReleaseDrawable (savedScreen));
|
DestroyDrawable (ReleaseDrawable (savedScreen));
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ PauseGame (void)
|
|||||||
if (PlayingTrack ())
|
if (PlayingTrack ())
|
||||||
PauseTrack ();
|
PauseTrack ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
OldContext = SetContext (ScreenContext);
|
OldContext = SetContext (ScreenContext);
|
||||||
oldOrigin = SetContextOrigin (MAKE_POINT (0, 0));
|
oldOrigin = SetContextOrigin (MAKE_POINT (0, 0));
|
||||||
GetContextClipRect (&OldRect);
|
GetContextClipRect (&OldRect);
|
||||||
@@ -170,11 +169,7 @@ PauseGame (void)
|
|||||||
SetSystemRect (&r);
|
SetSystemRect (&r);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
|
|
||||||
// It is safer to just not release the lock so any graphics tasks
|
|
||||||
// would be blocked
|
|
||||||
//UnlockMutex (GraphicsLock);
|
|
||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
//LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
while (ImmediateInputState.menu[KEY_PAUSE] && GamePaused)
|
while (ImmediateInputState.menu[KEY_PAUSE] && GamePaused)
|
||||||
{
|
{
|
||||||
@@ -209,7 +204,6 @@ PauseGame (void)
|
|||||||
if (PlayingTrack ())
|
if (PlayingTrack ())
|
||||||
ResumeTrack ();
|
ResumeTrack ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
GLOBAL (CurrentActivity) &= ~CHECK_PAUSE;
|
GLOBAL (CurrentActivity) &= ~CHECK_PAUSE;
|
||||||
@@ -300,7 +294,6 @@ SleepGame (void)
|
|||||||
PauseTrack ();
|
PauseTrack ();
|
||||||
PauseMusic ();
|
PauseMusic ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
while (!GameActive && !QuitPosted)
|
while (!GameActive && !QuitPosted)
|
||||||
SleepThread (ONE_SECOND / 2);
|
SleepThread (ONE_SECOND / 2);
|
||||||
@@ -314,7 +307,6 @@ SleepGame (void)
|
|||||||
if (PlayingTrack ())
|
if (PlayingTrack ())
|
||||||
ResumeTrack ();
|
ResumeTrack ();
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user