Small resource loading functions cleanup

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2485 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2006-10-30 22:56:02 +00:00
parent 84fc66c1b0
commit e79889b9c4
21 changed files with 50 additions and 48 deletions
+4 -3
View File
@@ -28,6 +28,7 @@
# endif
#endif
#include "resinst.h"
#include "nameref.h"
#include "setup.h"
#include "settings.h"
#include "sounds.h"
@@ -215,11 +216,11 @@ BattleSong (BOOLEAN DoPlay)
if (BattleRef == 0)
{
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
BattleRef = LoadMusicInstance (BATTLE_MUSIC);
BattleRef = LoadMusic (BATTLE_MUSIC);
else if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
BattleRef = LoadMusicInstance (HYPERSPACE_MUSIC);
BattleRef = LoadMusic (HYPERSPACE_MUSIC);
else
BattleRef = LoadMusicInstance (QUASISPACE_MUSIC);
BattleRef = LoadMusic (QUASISPACE_MUSIC);
}
if (DoPlay)
+8 -7
View File
@@ -33,6 +33,7 @@
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "nameref.h"
#include "uqmdebug.h"
#include "libs/graphics/gfx_common.h"
#include "libs/inplib.h"
@@ -1331,25 +1332,25 @@ HailAlien (void)
ES.InputFunc = DoCommunication;
hOldIndex = SetResourceIndex (hResIndex);
PlayerFont = CaptureFont ((FONT_REF)LoadGraphic (PLAYER_FONT));
PlayerFont = CaptureFont ((FONT_REF)LoadFont (PLAYER_FONT));
SetResourceIndex (hOldIndex);
CommData.AlienFrame = CaptureDrawable (
LoadGraphicInstance ((RESOURCE)CommData.AlienFrame));
LoadGraphic ((RESOURCE)CommData.AlienFrame));
CommData.AlienFont = CaptureFont ((FONT_REF)
LoadGraphic ((RESOURCE)CommData.AlienFont));
LoadFont ((RESOURCE)CommData.AlienFont));
CommData.AlienColorMap = CaptureColorMap (
LoadColorMapInstance ((RESOURCE)CommData.AlienColorMap));
LoadColorMap ((RESOURCE)CommData.AlienColorMap));
if ((CommData.AlienSongFlags & LDASF_USE_ALTERNATE)
&& CommData.AlienAltSong)
SongRef = LoadMusicInstance ((RESOURCE)CommData.AlienAltSong);
SongRef = LoadMusic ((RESOURCE)CommData.AlienAltSong);
if (SongRef)
CommData.AlienSong = SongRef;
else
CommData.AlienSong = LoadMusicInstance ((RESOURCE)CommData.AlienSong);
CommData.AlienSong = LoadMusic ((RESOURCE)CommData.AlienSong);
CommData.ConversationPhrases = CaptureStringTable (
LoadStringTableInstance ((RESOURCE)CommData.ConversationPhrases));
LoadStringTable ((RESOURCE)CommData.ConversationPhrases));
// init subtitle cache context
TextCacheContext = CaptureContext (CreateContext ());
+2 -2
View File
@@ -556,7 +556,7 @@ StartCredits (void)
CreditsBack = CaptureDrawable (LoadGraphic (CREDITS_BACK_ANIM));
// load fonts
for (fdef = CreditsFont; fdef->size; ++fdef)
fdef->font = CaptureFont (LoadGraphic (fdef->res));
fdef->font = CaptureFont (LoadFont (fdef->res));
CreditsRate = CREDITS_BASE_RATE;
CreditsRunning = FALSE;
@@ -714,7 +714,7 @@ Credits (BOOLEAN WithOuttakes)
Task CredTask;
CREDITS_INPUT_STATE cis;
hMusic = LoadMusicInstance (CREDITS_MUSIC);
hMusic = LoadMusic (CREDITS_MUSIC);
LockMutex (GraphicsLock);
SetContext (ScreenContext);
+2 -2
View File
@@ -189,7 +189,7 @@ InitEncounter (void)
SetContext (SpaceContext);
SetContextFont (TinyFont);
MR = LoadMusicInstance (REDALERT_MUSIC);
MR = LoadMusic (REDALERT_MUSIC);
PlayMusic (MR, FALSE, 1);
SegueFrame = CaptureDrawable (LoadGraphic (SEGUE_PMAP_ANIM));
UnlockMutex (GraphicsLock);
@@ -767,7 +767,7 @@ EncounterBattle (void)
SetResourceIndex (hResIndex);
// MicroFont = CaptureFont (
// LoadGraphic (MICRO_FONT)
// LoadFont (MICRO_FONT)
// );
// MenuSounds = CaptureSound (LoadSound (MENU_SOUNDS));
// LoadSC2Data ();
+1
View File
@@ -23,6 +23,7 @@
#include "master.h"
#include "setup.h"
#include "resinst.h"
#include "nameref.h"
#include "build.h"
#include "state.h"
#include "gamestr.h"
+1
View File
@@ -18,6 +18,7 @@
#include "element.h"
#include "resinst.h"
#include "nameref.h"
#include "setup.h"
+1
View File
@@ -23,6 +23,7 @@
#include "init.h"
#include "port.h"
#include "resinst.h"
#include "nameref.h"
#include "setup.h"
#include "units.h"
+1
View File
@@ -23,6 +23,7 @@
#include "sounds.h"
#include "fmv.h"
#include "resinst.h"
#include "nameref.h"
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/drawable.h"
#include "libs/sound/sound.h"
-1
View File
@@ -234,7 +234,6 @@ extern BOOLEAN InstallGraphicResTypes (COUNT cel_type, COUNT font_type);
extern DWORD LoadCelFile (PVOID pStr);
extern DWORD LoadFontFile (PVOID pStr);
extern DWORD LoadGraphicInstance (DWORD res);
extern DWORD LoadGraphic (DWORD res);
extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame);
extern FRAME SetContextFontEffect (FRAME EffectFrame);
extern FONT SetContextFont (FONT Font);
-11
View File
@@ -18,12 +18,10 @@
#include "gfxintrn.h"
static COUNT _gfx_type;
BOOLEAN
InstallGraphicResTypes (COUNT cel_type, COUNT font_type)
{
_gfx_type = cel_type;
InstallResTypeVectors (cel_type, _GetCelData, _ReleaseCelData);
InstallResTypeVectors (font_type, _GetFontData, _ReleaseFontData);
return (TRUE);
@@ -41,12 +39,3 @@ LoadGraphicInstance (DWORD res)
return ((DWORD)hData);
}
DWORD
LoadGraphic (DWORD res)
{
if (_gfx_type)
return (LoadGraphicInstance (res));
else
return (LoadCelFile ((PVOID)res));
}
+1 -1
View File
@@ -2178,7 +2178,7 @@ DoMelee (PMELEE_STATE pMS)
DestroyMusic (pMS->hMusic);
pMS->hMusic = 0;
}
pMS->hMusic = LoadMusicInstance (MELEE_MUSIC);
pMS->hMusic = LoadMusic (MELEE_MUSIC);
pMS->Initialized = TRUE;
pMS->MeleeOption = START_MELEE;
+7 -5
View File
@@ -21,11 +21,13 @@
#include "restypes.h"
#define LoadCodeRes(r) LoadCodeResInstance (r)
#define LoadColorMap(r) LoadColorMapInstance (r)
#define LoadStringTable(r) LoadStringTableInstance(r)
#define LoadSound(r) LoadSoundInstance(r)
#define LoadMusic(r) LoadMusicInstance(r)
#define LoadCodeRes LoadCodeResInstance
#define LoadGraphic LoadGraphicInstance
#define LoadFont LoadGraphicInstance
#define LoadColorMap LoadColorMapInstance
#define LoadStringTable LoadStringTableInstance
#define LoadSound LoadSoundInstance
#define LoadMusic LoadMusicInstance
#define INIT_INSTANCES() do \
{ \
+2 -1
View File
@@ -22,6 +22,7 @@
#include "gameopt.h"
#include "gamestr.h"
#include "resinst.h"
#include "nameref.h"
#include "settings.h"
#include "starbase.h"
#include "setup.h"
@@ -624,7 +625,7 @@ DoOutfit (PMENU_STATE pMS)
pMS->CurFrame = CaptureDrawable (
LoadGraphic (MODULES_PMAP_ANIM));
pMS->hMusic = LoadMusicInstance (OUTFIT_MUSIC);
pMS->hMusic = LoadMusic (OUTFIT_MUSIC);
pMS->CurState = OUTFIT_FUEL;
pMS->ModuleFrame = CaptureDrawable (
LoadGraphic (SISMODS_MASK_PMAP_ANIM));
+1
View File
@@ -22,6 +22,7 @@
#include "pickmele.h"
#include "races.h"
#include "resinst.h"
#include "nameref.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
+1 -1
View File
@@ -1859,7 +1859,7 @@ LoadLanderData (void)
ri = GET_INSTANCE (ORBIT1_MUSIC);
rp = GET_PACKAGE (ORBIT1_MUSIC);
for (i = 0; i < NUM_ORBIT_THEMES; ++i, ++ri)
OrbitMusic[i] = LoadMusicInstance (MAKE_RESOURCE (rp, rt, ri));
OrbitMusic[i] = LoadMusic (MAKE_RESOURCE (rp, rt, ri));
}
}
}
+2 -1
View File
@@ -24,6 +24,7 @@
#include "uqmdebug.h"
#include "libs/graphics/gfx_common.h"
#include "resinst.h"
#include "nameref.h"
extern int rotate_planet_task (PVOID data);
@@ -278,7 +279,7 @@ FreePlanet (void)
void
LoadStdLanderFont (PLANET_INFO *info)
{
info->LanderFont = CaptureFont (LoadGraphic (LANDER_FONT));
info->LanderFont = CaptureFont (LoadFont (LANDER_FONT));
info->LanderFontEff = CaptureDrawable (
LoadGraphic (LANDER_FONTEFF_PMAP_ANIM));
}
+1 -1
View File
@@ -205,7 +205,7 @@ LoadIPData (void)
SunCMap = CaptureColorMap (LoadColorMap (IPSUN_COLOR_MAP));
SunFrame = CaptureDrawable (LoadGraphic (SUN_MASK_PMAP_ANIM));
SpaceMusic = LoadMusicInstance (IP_MUSIC);
SpaceMusic = LoadMusic (IP_MUSIC);
}
}
+2 -1
View File
@@ -27,6 +27,7 @@
#include "intel.h"
#include "melee.h"
#include "resinst.h"
#include "nameref.h"
#include "settings.h"
#include "load.h"
#include "setup.h"
@@ -124,7 +125,7 @@ DoRestart (PMENU_STATE pMS)
DestroyMusic (pMS->hMusic);
pMS->hMusic = 0;
}
pMS->hMusic = LoadMusicInstance (MAINMENU_MUSIC);
pMS->hMusic = LoadMusic (MAINMENU_MUSIC);
InactTimeOut = (pMS->hMusic ? 120 : 20) * ONE_SECOND;
PlayMusic (pMS->hMusic, TRUE, 1);
+4 -5
View File
@@ -169,11 +169,11 @@ InitKernel (void)
for (counter = 0; counter < NUM_PLAYERS; ++counter)
InitQueue (&race_q[counter], MAX_SHIPS_PER_SIDE, sizeof (STARSHIP));
StarConFont = CaptureFont (LoadGraphic (STARCON_FONT));
StarConFont = CaptureFont (LoadFont (STARCON_FONT));
if (StarConFont == NULL)
return FALSE;
TinyFont = CaptureFont (LoadGraphic (TINY_FONT));
TinyFont = CaptureFont (LoadFont (TINY_FONT));
if (TinyFont == NULL)
return FALSE;
@@ -185,12 +185,11 @@ InitKernel (void)
if (StatusFrame == NULL)
return FALSE;
GameStrings = CaptureStringTable (LoadStringTableInstance (
STARCON_GAME_STRINGS));
GameStrings = CaptureStringTable (LoadStringTable (STARCON_GAME_STRINGS));
if (GameStrings == 0)
return FALSE;
MicroFont = CaptureFont (LoadGraphic (MICRO_FONT));
MicroFont = CaptureFont (LoadFont (MICRO_FONT));
if (MicroFont == NULL)
return FALSE;
+1 -1
View File
@@ -1221,7 +1221,7 @@ DoShipyard (PMENU_STATE pMS)
pMS->CurString = CaptureColorMap (
LoadColorMap (HANGAR_COLOR_TAB));
pMS->hMusic = LoadMusicInstance (SHIPYARD_MUSIC);
pMS->hMusic = LoadMusic (SHIPYARD_MUSIC);
LockMutex (GraphicsLock);
SetTransitionSource (NULL);
+8 -5
View File
@@ -24,6 +24,7 @@
#include "load.h"
#include "starbase.h"
#include "resinst.h"
#include "nameref.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
@@ -261,8 +262,9 @@ rotate_starbase(void *data)
STAMP s;
Task task = (Task) data;
s.origin.x = s.origin.y = 0;
s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
//s.origin.x = s.origin.y = 0;
s.origin.x = SAFE_X;
s.origin.y = SAFE_Y + 4;
s.frame = IncFrameIndex (pMenuState->CurFrame);
TimeIn = GetTimeCounter ();
while (!Task_ReadState (task, TASK_EXIT))
@@ -322,11 +324,12 @@ DoStarBase (PMENU_STATE pMS)
UnlockMutex (GraphicsLock);
s.origin.x = s.origin.y = 0;
s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
//s.origin.x = s.origin.y = 0;
s.origin.x = SAFE_X;
s.origin.y = SAFE_Y + 4;
s.frame = CaptureDrawable (LoadGraphic (STARBASE_ANIM));
pMS->CurFrame = s.frame;
pMS->hMusic = LoadMusicInstance (STARBASE_MUSIC);
pMS->hMusic = LoadMusic (STARBASE_MUSIC);
LockMutex (GraphicsLock);
SetTransitionSource (NULL);