Random code cleanups: prototypes, formatting; generalized api for LoadPlanet() to take planet surface definition FRAME rather than IsEarth hack

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2074 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2005-12-15 00:29:25 +00:00
parent 4c52f07340
commit 10ec759022
44 changed files with 247 additions and 241 deletions
+16 -15
View File
@@ -22,22 +22,17 @@
#include "reslib.h"
#include "gamestr.h"
#include "init.h"
#include "hyper.h"
#include "planets/lander.h"
#include "starcon.h"
#include "setup.h"
#include "sounds.h"
#include "libs/sndlib.h"
#include "libs/vidlib.h"
//Added by Chris
void FreeSC2Data (void);
void FreeLanderData (void);
void FreeIPData (void);
void FreeHyperData (void);
//End Added by Chris
// XXX: we do not current have a header for this prototype to live in
// should be something like solarsys.h
extern void FreeIPData (void);
static void UninitContexts (void);
static void UninitKernel (BOOLEAN ships);
@@ -95,16 +90,22 @@ UninitKernel (BOOLEAN ships)
ActivityFrame = 0;
}
void
FreeGameData (void)
{
FreeSC2Data ();
FreeLanderData ();
FreeIPData ();
FreeHyperData ();
}
static void
UninitGameKernel (void)
{
// XXX: this function is never called. Why not? (BUG?)
if (ActivityFrame)
{
FreeSC2Data ();
FreeLanderData ();
FreeIPData ();
FreeHyperData ();
FreeGameData ();
UninitKernel (FALSE);
UninitContexts ();
+1 -1
View File
@@ -25,6 +25,7 @@
#include "endian_uqm.h"
#include "gamestr.h"
#include "options.h"
#include "load.h"
#include "oscill.h"
#include "resinst.h"
#include "settings.h"
@@ -2096,7 +2097,6 @@ RaceCommunication (void)
{
RACE_COMMUNICATION
};
extern ACTIVITY NextActivity;
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
{
+1 -6
View File
@@ -22,16 +22,11 @@
#include "gameev.h"
#include "setup.h"
#include "shipcont.h"
#include "libs/inplib.h"
#include "libs/mathlib.h"
//Added by Chris
void DrawCargoStrings (BYTE OldElement, BYTE NewElement);
//End Added by Chris
#define NUM_HISTORY_ITEMS 9
#define NUM_EVENT_ITEMS 8
#define NUM_ALIEN_RACE_ITEMS 16
+1 -8
View File
@@ -22,6 +22,7 @@
#include "build.h"
#include "setup.h"
#include "shipcont.h"
#include "libs/graphics/gfx_common.h"
#include "libs/inplib.h"
#include "libs/mathlib.h"
@@ -29,14 +30,6 @@
#include "libs/sound/sound.h"
//Added by Chris
void ShowRemainingCapacity (void);
void DrawCargoStrings (BYTE OldElement, BYTE NewElement);
//End Added by Chris
static void TellMission (RESPONSE_REF R);
static void SellMinerals (RESPONSE_REF R);
+1
View File
@@ -91,6 +91,7 @@ BOOLEAN PauseGame (void);
BOOLEAN DoConfirmExit (void);
void TFB_Abort (void);
BOOLEAN WaitAnyButtonOrQuit (BOOLEAN CheckSpecial);
extern void WaitForNoInput (SIZE Duration);
extern BOOLEAN ConfirmExit (void);
extern void DoInput (PVOID pInputState, BOOLEAN resetInput);
+2 -4
View File
@@ -23,11 +23,13 @@
#include "commglue.h"
#include "controls.h"
#include "encount.h"
#include "planets/lander.h"
#include "gamestr.h"
#include "inplib.h"
#include "load.h"
#include "options.h"
#include "save.h"
#include "starbase.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
@@ -1343,14 +1345,10 @@ PickGame (PMENU_STATE pMS)
{
if (pSolarSysState->MenuState.Initialized < 3)
{
extern MUSIC_REF SpaceMusic;
PlayMusic (SpaceMusic, TRUE, 1);
}
else
{
extern MUSIC_REF LanderMusic;
PlayMusic (LanderMusic, TRUE, 1);
}
}
-8
View File
@@ -33,14 +33,6 @@
#include "libs/mathlib.h"
//Added by Chris
void WaitForNoInput (SIZE Duration);
//End Added by Chris
static void LoadHyperData (void);
#define XOFFS ((RADAR_SCAN_WIDTH + (UNIT_SCREEN_WIDTH << 2)) >> 1)
#define YOFFS ((RADAR_SCAN_HEIGHT + (UNIT_SCREEN_HEIGHT << 2)) >> 1)
+1
View File
@@ -23,6 +23,7 @@
#include "encount.h"
#include "file.h"
#include "globdata.h"
#include "load.h"
#include "options.h"
#include "setup.h"
#include "state.h"
+3
View File
@@ -19,6 +19,9 @@
#include "sis.h"
#include "libs/compiler.h"
#include "globdata.h"
extern ACTIVITY NextActivity;
extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc);
+1 -5
View File
@@ -32,6 +32,7 @@
#include "resinst.h"
#include "save.h"
#include "settings.h"
#include "gameopt.h"
#include "setup.h"
#include "sounds.h"
#include "util.h"
@@ -46,11 +47,6 @@
#include <string.h>
//Added by Chris
void ConfirmSaveLoad (STAMP *MsgStamp);
//End Added by Chris
static void DrawMeleeShipStrings (PMELEE_STATE pMS, BYTE NewStarShip);
+54
View File
@@ -0,0 +1,54 @@
//Copyright Paul Reiche, Fred Ford. 1992-2002
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _MENUSTAT_H
#define _MENUSTAT_H
#include "libs/gfxlib.h"
#include "libs/sndlib.h"
#include "libs/tasklib.h"
typedef struct menu_state
{
BOOLEAN (*InputFunc) (struct menu_state *pMS);
COUNT MenuRepeatDelay;
SIZE Initialized;
BYTE CurState;
FRAME CurFrame;
STRING CurString;
POINT first_item;
SIZE delta_item;
FRAME ModuleFrame;
Task flash_task;
RECT flash_rect0, flash_rect1;
FRAME flash_frame0, flash_frame1;
MUSIC_REF hMusic;
} MENU_STATE;
typedef MENU_STATE *PMENU_STATE;
extern PMENU_STATE pMenuState;
#endif /* _MENUSTAT_H */
+1
View File
@@ -22,6 +22,7 @@
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/widgets.h"
#include "libs/graphics/tfb_draw.h"
#include "util.h"
typedef struct mouse_error_state {
BOOLEAN (*InputFunc) (struct mouse_error_state *pInputState);
+1
View File
@@ -23,6 +23,7 @@
#include "gamestr.h"
#include "resinst.h"
#include "settings.h"
#include "starbase.h"
#include "setup.h"
#include "sis.h"
#include "sounds.h"
+1 -2
View File
@@ -19,13 +19,12 @@
#include "colors.h"
#include "controls.h"
#include "gamestr.h"
#include "shipcont.h"
#include "setup.h"
#include "sounds.h"
#include "util.h"
void DrawCargoStrings (BYTE OldElement, BYTE NewElement);
void
ShowRemainingCapacity (void)
{
+2 -1
View File
@@ -21,6 +21,8 @@
#include "gamestr.h"
#include "controls.h"
#include "settings.h"
#include "shipcont.h"
#include "load.h"
#include "setup.h"
#include "state.h"
#include "sounds.h"
@@ -194,7 +196,6 @@ static UWORD
DeviceFailed (BYTE which_device)
{
BYTE val;
extern ACTIVITY NextActivity;
switch (which_device)
{
+1 -1
View File
@@ -175,7 +175,7 @@ GenerateBurvixes (BYTE control)
CaptureStringTable (
LoadStringTable (BURV_BCS_STRTAB));
}
LoadPlanet (FALSE);
LoadPlanet (NULL);
break;
}
default:
+1 -1
View File
@@ -106,7 +106,7 @@ GenerateColony (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.Tectonics = 0;
pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature = 28;
LoadPlanet (FALSE);
LoadPlanet (NULL);
break;
}
default:
+3 -2
View File
@@ -323,7 +323,8 @@ generate_orbital (void)
pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity =
CalcGravity (pSolarSysState->SysInfo.PlanetInfo.PlanetDensity,
pSolarSysState->SysInfo.PlanetInfo.PlanetRadius);
LoadPlanet (i == 2);
LoadPlanet (i == 2 ? CaptureDrawable (LoadGraphic (EARTH_MASK_ANIM))
: NULL);
}
else
{
@@ -415,7 +416,7 @@ generate_orbital (void)
pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity =
CalcGravity (pSolarSysState->SysInfo.PlanetInfo.PlanetDensity,
pSolarSysState->SysInfo.PlanetInfo.PlanetRadius);
LoadPlanet (FALSE);
LoadPlanet (NULL);
}
}
+2 -2
View File
@@ -206,7 +206,7 @@ GenerateSpathi (BYTE control)
LoadStringTable (UMGAH_BCS_STRTAB)
);
}
LoadPlanet (FALSE);
LoadPlanet (NULL);
break;
}
else if (pSolarSysState->pOrbitalDesc == &pSolarSysState->PlanetDesc[0])
@@ -230,7 +230,7 @@ GenerateSpathi (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.Tectonics = 0;
pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature = 31;
LoadPlanet (FALSE);
LoadPlanet (NULL);
break;
}
default:
+1
View File
@@ -18,6 +18,7 @@
#include "gfxlib.h"
#include "mathlib.h"
#include "planets.h"
void
DeltaTopography (COUNT num_iterations, PSBYTE DepthArray, PRECT pRect,
+1 -14
View File
@@ -22,6 +22,7 @@
#include "gamestr.h"
#include "lander.h"
#include "lifeform.h"
#include "scan.h"
#include "nameref.h"
#include "resinst.h"
#include "setup.h"
@@ -43,19 +44,6 @@
// ONE_SECOND.
#define PLANET_SIDE_RATE (ONE_SECOND / 35)
//Added by Chris
void
DrawPlanet(int x, int y, int dy, unsigned int rgb);
void RepairBackRect (PRECT pRect);
void
SetPlanetTilt (int da);
//End Added by Chris
extern void DrawScannedObjects (BOOLEAN Reversed);
FRAME LanderFrame[8];
static SOUND LanderSounds;
@@ -1152,7 +1140,6 @@ RepairScan (void)
{
CONTEXT OldContext;
HELEMENT hElement, hNextElement;
extern void DrawScannedObjects (BOOLEAN Reversed);
OldContext = SetContext (ScanContext);
+7
View File
@@ -23,6 +23,7 @@
#include "libs/compiler.h"
#include "libs/gfxlib.h"
#include "libs/sndlib.h"
#include "menustat.h"
#define NUM_TEXT_FRAMES 32
@@ -50,8 +51,14 @@ typedef struct
typedef PLANETSIDE_DESC *PPLANETSIDE_DESC;
extern CONTEXT ScanContext;
extern MUSIC_REF LanderMusic;
extern void PlanetSide (PMENU_STATE pMS);
extern void DoDiscoveryReport (SOUND ReadOutSounds);
extern void SetPlanetMusic (BYTE planet_type);
extern void LoadLanderData (void);
extern void FreeLanderData (void);
#endif /* _LANDER_H */
+9 -14
View File
@@ -20,6 +20,7 @@
#include "setup.h"
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/drawable.h"
#include "planets/scan.h"
#include <math.h>
@@ -30,21 +31,15 @@
#define USE_ADDITIVE_SCAN_BLIT
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c
// they should be sorted out and cleaned up at some point
extern DWORD frame_mapRGBA (FRAME FramePtr, UBYTE r, UBYTE g,
UBYTE b, UBYTE a);
extern void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0,
int x, int y);
extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame,
RECT *rdst, int num, int denom);
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy);
void fill_frame_rgb (FRAMEPTR FramePtr, DWORD color, int x0, int y0, int x, int y);
void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int num, int denom);
extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
extern void RenderLevelMasks (int);
void RepairBackRect (PRECT pRect);
// RotatePlanet
// This will take care of zooming into a planet on orbit, generating the planet frames
+5 -9
View File
@@ -18,6 +18,7 @@
#include "element.h"
#include "scan.h"
#include "lander.h"
#include "settings.h"
#include "setup.h"
#include "uqmdebug.h"
@@ -25,13 +26,8 @@
#include "resinst.h"
extern void DrawPlanet (int x, int y, int dy, unsigned int rgb);
extern void GeneratePlanetSide (void);
extern void GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth);
extern void SetPlanetMusic (BYTE planet_type);
extern int rotate_planet_task (PVOID Blah);
extern int rotate_planet_task (PVOID data);
extern MUSIC_REF LanderMusic;
void
DrawScannedObjects (BOOLEAN Reversed)
@@ -127,7 +123,7 @@ DrawOrbitalDisplay (DRAW_ORBITAL_MODE Mode)
// IsDefined is true only when the planet comes with its own bitmap,
// namely for Earth.
void
LoadPlanet (BOOLEAN IsDefined)
LoadPlanet (FRAME SurfDefFrame)
{
BOOLEAN WaitMode;
@@ -169,7 +165,7 @@ LoadPlanet (BOOLEAN IsDefined)
LoadLanderData ();
*/
GeneratePlanetMask (pPlanetDesc, IsDefined);
GeneratePlanetMask (pPlanetDesc, SurfDefFrame);
SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED));
if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0])
@@ -254,7 +250,7 @@ FreePlanet (void)
DestroyDrawable (ReleaseDrawable (Orbit->ShieldFrame));
Orbit->ShieldFrame = 0;
if (Orbit->lpTopoMap!=0)
if (Orbit->lpTopoMap != 0)
{
HFree (Orbit->lpTopoMap);
Orbit->lpTopoMap = 0;
+12 -3
View File
@@ -19,7 +19,7 @@
#ifndef _PLANETS_H
#define _PLANETS_H
#include "starbase.h"
#include "menustat.h"
#include "units.h"
#define END_INTERPLANETARY START_INTERPLANETARY
@@ -203,9 +203,10 @@ typedef struct solarsys_state
typedef SOLARSYS_STATE *PSOLARSYS_STATE;
extern PSOLARSYS_STATE pSolarSysState;
extern MUSIC_REF SpaceMusic;
extern void LoadPlanet (BOOLEAN IsDefined);
extern void DrawPlanet(int x, int y, int dy, unsigned int rgb);
extern void LoadPlanet (FRAME SurfDefFrame);
extern void DrawPlanet (int x, int y, int dy, unsigned int rgb);
extern void FreePlanet (void);
extern void LoadStdLanderFont (PLANET_INFO *info);
extern void FreeLanderFont (PLANET_INFO *info);
@@ -231,5 +232,13 @@ extern BOOLEAN ValidateOrbits (void);
extern void IP_reset (void);
extern void IP_frame (void);
extern PRECT RotatePlanet (int x, int dx, int dy, COUNT scale_amt,
UBYTE zoom_from, PRECT r);
extern void SetPlanetTilt (int da);
extern void DrawScannedObjects (BOOLEAN Reversed);
extern void GeneratePlanetMask (PPLANET_DESC pPlanetDesc, FRAME SurfDefFrame);
extern void DeltaTopography (COUNT num_iterations, PSBYTE DepthArray,
PRECT pRect, SIZE depth_delta);
#endif /* _PLANETS_H */
+46 -41
View File
@@ -20,7 +20,9 @@
#include "resinst.h"
#include "setup.h"
#include "planets/planets.h"
#include "planets/scan.h"
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/drawable.h"
#include "libs/mathlib.h"
#include <math.h>
@@ -37,28 +39,19 @@
// an additive overlay for the shield effect
#undef USE_ALPHA_SHIELD
extern void DeltaTopography (COUNT num_iterations, PSBYTE DepthArray,
PRECT pRect, SIZE depth_delta);
void SetPlanetTilt (int da);
void RepairBackRect (PRECT pRect);
PRECT RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from,
PRECT r);
DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a);
void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy);
FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0,
// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c
// they should be sorted out and cleaned up at some point
extern DWORD frame_mapRGBA (FRAME FramePtr, UBYTE r, UBYTE g,
UBYTE b, UBYTE a);
extern void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy);
extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh, int destroy);
extern void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0,
int x, int y);
extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame,
RECT *rdst, int num, int denom);
extern void getpixelarray (DWORD *array, FRAME FramePtr,
int width, int height);
void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int num, int denom);
void getpixelarray(DWORD *array, FRAME FramePtr, int width, int height);
#define SHIELD_GLOW_COMP 120
#define SHIELD_REFLECT_COMP 100
@@ -226,7 +219,7 @@ TransformTopography (FRAME DstFrame, PBYTE pTopoData, int w, int h)
SetContext (OldContext);
}
void
static void
RenderTopography (BOOLEAN Reconstruct)
// Reconstruct arg was not used on 3DO and is not needed here either
{
@@ -1222,7 +1215,8 @@ ValidateMap (PSBYTE DepthArray)
} while (--i);
}
void planet_orbit_init ()
void
planet_orbit_init ()
{
PLANET_ORBIT *Orbit = &pSolarSysState->Orbit;
@@ -1241,9 +1235,9 @@ void planet_orbit_init ()
Orbit->TopoZoomFrame = CaptureDrawable (
CreateDrawable (WANT_PIXMAP, (COUNT)(MAP_WIDTH << 2),
(COUNT)(MAP_HEIGHT << 2), 1));
Orbit->lpTopoMap = (DWORD *)HMalloc (sizeof(DWORD)
Orbit->lpTopoMap = HMalloc (sizeof (DWORD)
* (MAP_HEIGHT * (MAP_WIDTH + MAP_HEIGHT)));
Orbit->ScratchArray = (DWORD *)HMalloc (sizeof (DWORD *)
Orbit->ScratchArray = HMalloc (sizeof (DWORD)
* (SHIELD_DIAM) * (SHIELD_DIAM));
}
@@ -1468,7 +1462,7 @@ TopoScale4x (PBYTE pDstTopo, PBYTE pSrcTopo, int num_faults, int fault_var)
}
void
GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
GeneratePlanetMask (PPLANET_DESC pPlanetDesc, FRAME SurfDefFrame)
{
RECT r;
DWORD old_seed;
@@ -1483,15 +1477,22 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
OldContext = SetContext (TaskContext);
planet_orbit_init ();
if (IsEarth)
{
//Earth uses a pixmap for the topography
pSolarSysState->TopoFrame = CaptureDrawable (
LoadGraphic (EARTH_MASK_ANIM));
pSolarSysState->TopoFrame = stretch_frame (
pSolarSysState->TopoFrame, MAP_WIDTH, MAP_HEIGHT, 1);
} else {
if (SurfDefFrame)
{ // This is a defined planet; pixmap for the topography and
// elevation data is supplied in Surface Definition frame
// surface pixmap
SurfDefFrame = SetAbsFrameIndex (SurfDefFrame, 0);
if (GetFrameWidth (SurfDefFrame) != MAP_WIDTH
|| GetFrameHeight (SurfDefFrame) != MAP_HEIGHT)
pSolarSysState->TopoFrame = stretch_frame (SurfDefFrame,
MAP_WIDTH, MAP_HEIGHT, 1);
else
pSolarSysState->TopoFrame = SurfDefFrame;
}
else
{ // Generate planet surface elevation data and look
PlanDataPtr = &PlanData[pPlanetDesc->data_index & ~PLANET_SHIELDED];
r.corner.x = r.corner.y = 0;
@@ -1611,15 +1612,17 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
y += MAP_WIDTH + MAP_HEIGHT)
for (x = 0; x < MAP_HEIGHT; x++)
Orbit->lpTopoMap[y + x + MAP_WIDTH] = Orbit->lpTopoMap[y + x];
if (pSolarSysState->pOrbitalDesc->pPrevDesc ==
&pSolarSysState->SunDesc[0])
{
// This is a planet. Get its location
{ // this is a planet -- get its location
loc = pSolarSysState->pOrbitalDesc->location;
} else {
// This is a moon. Get its planet's location
}
else
{ // this is a moon -- get its planet's location
loc = pSolarSysState->pOrbitalDesc->pPrevDesc->location;
}
RenderPhongMask (loc);
if (pPlanetDesc->data_index & PLANET_SHIELDED)
@@ -1655,7 +1658,6 @@ rotate_planet_task (void *data)
// SetPlanetTilt ((pSS->SysInfo.PlanetInfo.AxialTilt << 8) / 360);
SetPlanetTilt (pSS->SysInfo.PlanetInfo.AxialTilt);
// angle=pSS->SysInfo.PlanetInfo.AxialTilt;
i = 1 - ((pSS->SysInfo.PlanetInfo.AxialTilt & 1) << 1);
init_x = (i == 1) ? (0) : (MAP_WIDTH - 1);
@@ -1689,7 +1691,7 @@ rotate_planet_task (void *data)
// to guarantee that PauseRotate doesn't change while waiting
// to acquire the graphics lock
LockMutex (GraphicsLock);
if (*(volatile UBYTE *)&pSS->PauseRotate !=1
if (*(volatile UBYTE *)&pSS->PauseRotate != 1
// if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))
{
@@ -1707,15 +1709,18 @@ rotate_planet_task (void *data)
++pSS->MenuState.Initialized;
}
x += i;
} else
}
else
view_index++;
UnlockMutex (GraphicsLock);
// If this frame hasn't been generted, generate it
if (! pSolarSysState->Orbit.isPFADefined[x]) {
if (! pSolarSysState->Orbit.isPFADefined[x])
{
RenderLevelMasks (x);
pSolarSysState->Orbit.isPFADefined[x] = 1;
}
if (zooming)
{
frame_num++;
+3 -12
View File
@@ -23,6 +23,8 @@
#include "gamestr.h"
#include "globdata.h"
#include "options.h"
#include "scan.h"
#include "shipcont.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
@@ -33,11 +35,6 @@
#include "libs/mathlib.h"
//Added by Chris
void RepairBackRect (PRECT pRect);
//End Added by Chris
#define UNIVERSE_TO_DISPX(ux) \
(COORD)(((((long)(ux) - pMenuState->flash_rect1.corner.x) \
@@ -1239,8 +1236,6 @@ DoFlagshipCommands (PMENU_STATE pMS)
break;
case EQUIP_DEVICE:
{
extern BOOLEAN Devices (PMENU_STATE pMS);
pMenuState = pMS;
if (!Devices (pMS))
select = FALSE;
@@ -1254,15 +1249,11 @@ DoFlagshipCommands (PMENU_STATE pMS)
}
case CARGO:
{
extern void Cargo (PMENU_STATE pMS);
Cargo (pMS);
break;
}
case ROSTER:
{
extern BOOLEAN Roster (void);
if (!Roster ())
select = FALSE;
break;
@@ -1299,7 +1290,7 @@ DoFlagshipCommands (PMENU_STATE pMS)
if (!AutoPilotSet && pMS->Initialized >= 3)
{
LoadPlanet (FALSE);
LoadPlanet (NULL);
--pMS->Initialized;
pSolarSysState->PauseRotate = 0;
LockMutex (GraphicsLock);
-1
View File
@@ -239,7 +239,6 @@ DoDiscoveryReport (SOUND ReadOutSounds)
{
POINT old_curs;
CONTEXT OldContext;
extern void DrawScannedObjects (BOOLEAN Reversed);
#ifdef DEBUG
if (disableInteractivity)
+2 -1
View File
@@ -20,13 +20,14 @@
#include "colors.h"
#include "controls.h"
#include "races.h"
#include "shipcont.h"
#include "setup.h"
#include "sounds.h"
#include "libs/gfxlib.h"
#include "libs/tasklib.h"
int
static int
flash_ship_task (void *data)
{
DWORD TimeIn;
+4 -14
View File
@@ -25,6 +25,9 @@
#include "options.h"
#include "resinst.h"
#include "settings.h"
#include "load.h"
#include "util.h"
#include "lander.h"
#include "setup.h"
#include "sounds.h"
#include "state.h"
@@ -33,14 +36,7 @@
#include "libs/mathlib.h"
//Added by Chris
void
DrawPlanet(int x, int y, int dy, unsigned int rgb);
void WaitForNoInput (SIZE Duration);
//End Added by Chris
extern FRAME SpaceJunkFrame;
// define SPIN_ON_SCAN to allow the planet to spin
// while scaning is going on
@@ -50,8 +46,6 @@ void WaitForNoInput (SIZE Duration);
#define FLASH_WIDTH 9
#define FLASH_HEIGHT 9
extern void DrawScannedObjects (BOOLEAN Reversed);
CONTEXT ScanContext;
void
@@ -73,7 +67,6 @@ static void
EraseCoarseScan (void)
{
RECT r, tr;
extern FRAME SpaceJunkFrame;
const int leftScanWidth = 80;
const int rightScanWidth = 80;
const int leftScanOffset = 5;
@@ -368,7 +361,6 @@ PrintCoarseScan3DO (void)
TEXT t;
STAMP s;
UNICODE buf[40];
extern FRAME SpaceJunkFrame;
LockMutex (GraphicsLock);
SetContext (SpaceContext);
@@ -746,7 +738,6 @@ PickPlanetSide (PMENU_STATE pMS)
else
{
COUNT fuel_required;
extern void PlanetSide (PMENU_STATE pMS);
fuel_required = (COUNT)(
pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity << 1
@@ -771,7 +762,6 @@ PickPlanetSide (PMENU_STATE pMS)
if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1)
{
HSTARSHIP hStarShip;
extern ACTIVITY NextActivity;
if (pMenuState->flash_task)
{
+3
View File
@@ -43,5 +43,8 @@ typedef SCAN_BLOCK *PSCAN_BLOCK;
#define SCALED_ROOT_TWO 92682L /* root 2 * (1 << 16) */
#define SCALE_FACTOR 16
extern void RepairBackRect (PRECT pRect);
extern void GeneratePlanetSide (void);
#endif /* _SCAN_H */
+4 -12
View File
@@ -25,6 +25,8 @@
#include "nameref.h"
#include "resinst.h"
#include "settings.h"
#include "lander.h"
#include "load.h"
#include "setup.h"
#include "sounds.h"
#include "state.h"
@@ -36,13 +38,6 @@
//#define DEBUG_SOLARSYS
//Added by Chris
void LoadLanderData (void);
void RenderTopography (BOOLEAN Reconstruct);
//End Added by Chris
PSOLARSYS_STATE pSolarSysState;
FRAME SISIPFrame, SunFrame, OrbitalFrame, SpaceJunkFrame;
@@ -807,8 +802,6 @@ flagship_inertial_thrust (COUNT CurrentAngle)
}
}
extern void DrawIPRadar (BOOLEAN FirstTime);
static void
ProcessShipControls (void)
{
@@ -871,6 +864,7 @@ UndrawShip (void)
BOOLEAN LeavingInnerSystem;
#ifdef SHOW_RADAR
extern void DrawIPRadar (BOOLEAN FirstTime);
DrawIPRadar (FALSE);
#endif /* SHOW_RADAR */
@@ -1470,8 +1464,6 @@ InitSolarSys (void)
if ((LastActivity & (CHECK_LOAD | CHECK_RESTART)) ==
LastActivity)
{
extern ACTIVITY NextActivity;
DrawSISFrame ();
if (NextActivity)
LastActivity &= ~(CHECK_LOAD | CHECK_RESTART);
@@ -1627,7 +1619,7 @@ GenerateRandomIP (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN] =
rand_val;
LoadPlanet (FALSE);
LoadPlanet (NULL);
break;
}
case GENERATE_NAME:
+4 -21
View File
@@ -28,25 +28,16 @@
#include "melee.h"
#include "resinst.h"
#include "settings.h"
#include "load.h"
#include "setup.h"
#include "sounds.h"
#include "setupmenu.h"
#include "util.h"
#include "starcon.h"
#include "uqmversion.h"
#include "libs/graphics/gfx_common.h"
#include "libs/inplib.h"
//Added by Chris
void FreeHyperData (void);
void FreeIPData (void);
void FreeSC2Data (void);
void FreeLanderData (void);
//End Added by Chris
enum
{
@@ -120,7 +111,6 @@ DWORD InTime;
static BOOLEAN
DoRestart (PMENU_STATE pMS)
{
extern void MouseError (void);
static DWORD InactTimeOut;
/* Cancel any presses of the Pause key. */
@@ -289,7 +279,6 @@ TimedOut:
{
DWORD TimeOut;
BYTE black_buf[1];
extern ACTIVITY NextActivity;
TryAgain:
ReinitQueue (&race_q[0]);
@@ -330,10 +319,7 @@ LastActivity = WON_LAST_BATTLE;
OutTakes ();
Credits ();
FreeSC2Data ();
FreeLanderData ();
FreeIPData ();
FreeHyperData ();
FreeGameData ();
TimeOut = ONE_SECOND / 2;
GLOBAL (CurrentActivity) = CHECK_ABORT;
@@ -382,10 +368,7 @@ LastActivity = WON_LAST_BATTLE;
if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)
{
FreeSC2Data ();
FreeLanderData ();
FreeIPData ();
FreeHyperData ();
FreeGameData ();
Melee ();
MenuState.Initialized = FALSE;
goto TryAgain;
+1 -2
View File
@@ -27,6 +27,7 @@
#include "globdata.h"
#include "options.h"
#include "races.h"
#include "shipcont.h"
#include "setup.h"
#include "state.h"
#include "util.h"
@@ -87,8 +88,6 @@ SaveShipQueue (DECODE_REF fh, PQUEUE pQueue)
static void
PrepareSummary (SUMMARY_DESC *summary_desc)
{
extern SIZE InventoryDevices (BYTE *pDeviceMap);
summary_desc->SS = GlobData.SIS_state;
switch (summary_desc->Activity = LOBYTE (GLOBAL (CurrentActivity)))
+1 -6
View File
@@ -31,18 +31,13 @@
#include "libs/file.h"
#include "libs/graphics/gfx_common.h"
#include "libs/threadlib.h"
#include "libs/vidlib.h"
#include <assert.h>
#include <errno.h>
#include <string.h>
//Added by Chris
extern BOOLEAN InitVideo (BOOLEAN UseCDROM);
//End Added by Chris
ACTIVITY LastActivity;
BYTE PlayerControl[NUM_PLAYERS];
+36
View File
@@ -0,0 +1,36 @@
//Copyright Paul Reiche, Fred Ford. 1992-2002
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SHIPCONT_H
#define _SHIPCONT_H
#include "menustat.h"
#define FIELD_WIDTH (STATUS_WIDTH - 5)
extern void Cargo (PMENU_STATE pMS);
extern BOOLEAN Roster (void);
extern BOOLEAN Devices (PMENU_STATE pMS);
extern void DrawCargoStrings (BYTE OldElement, BYTE NewElement);
extern void ShowRemainingCapacity (void);
extern SIZE InventoryDevices (BYTE *pDeviceMap);
#endif /* _SHIPCONT_H */
+1
View File
@@ -28,6 +28,7 @@
#include "nameref.h"
#include "resinst.h"
#include "settings.h"
#include "starbase.h"
#include "setup.h"
#include "sis.h"
#include "sounds.h"
+5 -2
View File
@@ -21,6 +21,7 @@
#include "encount.h"
#include "gamestr.h"
#include "options.h"
#include "starbase.h"
#include "setup.h"
#include "state.h"
#include "libs/graphics/gfx_common.h"
@@ -1174,8 +1175,10 @@ static FRAME flash_frame;
static FRAME flash_screen_frame = 0;
static int flash_changed;
Mutex flash_mutex = 0;
void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame,
RECT *rdst, int num, int denom);
// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c
// they should be sorted out and cleaned up at some point
extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame,
RECT *rdst, int num, int denom);
static int
flash_rect_func (void *data)
+2 -1
View File
@@ -21,6 +21,8 @@
#include "controls.h"
#include "encount.h"
#include "gamestr.h"
#include "load.h"
#include "starbase.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
@@ -29,7 +31,6 @@
#include "libs/tasklib.h"
#include "libs/inplib.h"
extern ACTIVITY NextActivity;
PMENU_STATE pMenuState;
+1 -29
View File
@@ -19,10 +19,7 @@
#ifndef _STARBASE_H
#define _STARBASE_H
#include "libs/gfxlib.h"
#include "libs/sndlib.h"
#include "libs/tasklib.h"
#include "menustat.h"
enum
{
@@ -33,31 +30,6 @@ enum
};
typedef BYTE STARBASE_STATE;
#define FIELD_WIDTH (STATUS_WIDTH - 5)
typedef struct menu_state
{
BOOLEAN (*InputFunc) (struct menu_state *pMS);
COUNT MenuRepeatDelay;
SIZE Initialized;
BYTE CurState;
FRAME CurFrame;
STRING CurString;
POINT first_item;
SIZE delta_item;
FRAME ModuleFrame;
Task flash_task;
RECT flash_rect0, flash_rect1;
FRAME flash_frame0, flash_frame1;
MUSIC_REF hMusic;
} MENU_STATE;
typedef MENU_STATE *PMENU_STATE;
extern PMENU_STATE pMenuState;
extern void InstallBombAtEarth (void);
extern void VisitStarBase (void);
+2 -2
View File
@@ -23,8 +23,10 @@
#include "gameev.h"
#include "types.h"
#include "globdata.h"
#include "load.h"
#include "resinst.h"
#include "restart.h"
#include "starbase.h"
#include "setup.h"
#include "starcon.h"
#include "uqmdebug.h"
@@ -135,8 +137,6 @@ while (--ac > 0)
AddInitialGameEvents();
do
{
extern ACTIVITY NextActivity;
SuspendGameClock ();
#ifdef DEBUG
+2 -1
View File
@@ -17,7 +17,8 @@
#ifndef _STARCON_H
#define _STARCON_H
extern int Starcon2Main(void *threadArg);
extern int Starcon2Main (void *threadArg);
extern void FreeGameData (void);
#endif /* _STARCON_H */
+1
View File
@@ -19,6 +19,7 @@
#include "commglue.h"
#include "comm.h"
#include "controls.h"
#include "util.h"
#include "setup.h"
#include "libs/inplib.h"
#include "libs/sound/trackplayer.h"
+1
View File
@@ -25,6 +25,7 @@ extern void DrawStarConBox (PRECT pRect, SIZE BorderWidth,
COLOR InteriorColor);
extern DWORD SeedRandomNumbers (void);
extern void MouseError (void);
#endif /* _UTIL_H */